wini-web-components 2.7.0 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/index.d.ts +1 -0
- package/dist/vite.svg +1 -0
- package/dist/wini-web-components.css +4 -0
- package/dist/wini-web-components.js +32 -0
- package/dist/wini-web-components.mjs +6753 -0
- package/package.json +48 -82
- package/README.md +0 -21
- package/dist/component/button/button.d.ts +0 -21
- package/dist/component/button/button.js +0 -73
- package/dist/component/calendar/calendar.d.ts +0 -30
- package/dist/component/calendar/calendar.js +0 -357
- package/dist/component/card/card-info.d.ts +0 -15
- package/dist/component/card/card-info.js +0 -51
- package/dist/component/card/card.d.ts +0 -13
- package/dist/component/card/card.js +0 -33
- package/dist/component/checkbox/checkbox.d.ts +0 -24
- package/dist/component/checkbox/checkbox.js +0 -90
- package/dist/component/ck-editor/ckeditor.d.ts +0 -36
- package/dist/component/ck-editor/ckeditor.js +0 -392
- package/dist/component/component-status.d.ts +0 -8
- package/dist/component/component-status.js +0 -39
- package/dist/component/date-picker/date-picker.d.ts +0 -25
- package/dist/component/date-picker/date-picker.js +0 -329
- package/dist/component/date-time-picker/date-time-picker.d.ts +0 -36
- package/dist/component/date-time-picker/date-time-picker.js +0 -528
- package/dist/component/dialog/dialog.d.ts +0 -18
- package/dist/component/dialog/dialog.js +0 -113
- package/dist/component/import-file/import-file.d.ts +0 -33
- package/dist/component/import-file/import-file.js +0 -151
- package/dist/component/infinite-scroll/infinite-scroll.d.ts +0 -17
- package/dist/component/infinite-scroll/infinite-scroll.js +0 -37
- package/dist/component/input-multi-select/input-multi-select.d.ts +0 -21
- package/dist/component/input-multi-select/input-multi-select.js +0 -260
- package/dist/component/input-opt/input-opt.d.ts +0 -21
- package/dist/component/input-opt/input-opt.js +0 -157
- package/dist/component/input-otp/input-otp.d.ts +0 -22
- package/dist/component/input-otp/input-otp.js +0 -131
- package/dist/component/number-picker/number-picker.d.ts +0 -23
- package/dist/component/number-picker/number-picker.js +0 -125
- package/dist/component/pagination/pagination.d.ts +0 -13
- package/dist/component/pagination/pagination.js +0 -90
- package/dist/component/popup/popup.d.ts +0 -40
- package/dist/component/popup/popup.js +0 -125
- package/dist/component/progress-bar/progress-bar.d.ts +0 -16
- package/dist/component/progress-bar/progress-bar.js +0 -23
- package/dist/component/progress-circle/progress-circle.d.ts +0 -14
- package/dist/component/progress-circle/progress-circle.js +0 -19
- package/dist/component/radio-button/radio-button.d.ts +0 -20
- package/dist/component/radio-button/radio-button.js +0 -33
- package/dist/component/rating/rating.d.ts +0 -23
- package/dist/component/rating/rating.js +0 -54
- package/dist/component/select1/select1.d.ts +0 -31
- package/dist/component/select1/select1.js +0 -249
- package/dist/component/slider/slider.d.ts +0 -31
- package/dist/component/slider/slider.js +0 -64
- package/dist/component/switch/switch.d.ts +0 -23
- package/dist/component/switch/switch.js +0 -50
- package/dist/component/table/table.d.ts +0 -51
- package/dist/component/table/table.js +0 -66
- package/dist/component/tag/tag.d.ts +0 -22
- package/dist/component/tag/tag.js +0 -19
- package/dist/component/text/text.d.ts +0 -16
- package/dist/component/text/text.js +0 -20
- package/dist/component/text-area/text-area.d.ts +0 -27
- package/dist/component/text-area/text-area.js +0 -57
- package/dist/component/text-field/text-field.d.ts +0 -36
- package/dist/component/text-field/text-field.js +0 -80
- package/dist/component/toast-noti/toast-noti.d.ts +0 -5
- package/dist/component/toast-noti/toast-noti.js +0 -25
- package/dist/component/wini-icon/winicon.d.ts +0 -20
- package/dist/component/wini-icon/winicon.js +0 -176
- package/dist/form/login/view.d.ts +0 -40
- package/dist/form/login/view.js +0 -66
- package/dist/i18n.d.ts +0 -2
- package/dist/i18n.js +0 -125
- package/dist/index.d.ts +0 -33
- package/dist/index.js +0 -2
- package/dist/index.js.LICENSE.txt +0 -18
- package/dist/language/i18n.d.ts +0 -2
- package/dist/language/i18n.js +0 -146
- package/global.d.ts +0 -4
- /package/{public → dist}/favicon.ico +0 -0
- /package/{public → dist}/index.html +0 -0
- /package/{public → dist}/logo192.png +0 -0
- /package/{public → dist}/logo512.png +0 -0
- /package/{public → dist}/manifest.json +0 -0
- /package/{public → dist}/robots.txt +0 -0
package/dist/index.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):"object"==typeof exports?exports["wini-web-components"]=t(require("react"),require("react-dom")):e["wini-web-components"]=t(e.React,e.ReactDOM)}(this,((e,t)=>(()=>{var n,i,r={6:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,'.V0tFQvygj9tPMz8pRGsWtg\\=\\= {\r\n border-radius: 0.8rem;\r\n width: 100%;\r\n max-height: 100%;\r\n box-sizing: border-box;\r\n padding: 0.8rem 1.6rem;\r\n border: var(--neutral-bolder-border);\r\n border-radius: 0.8rem;\r\n gap: 0.8rem;\r\n position: relative;\r\n cursor: context-menu;\r\n}\r\n\r\n.V0tFQvygj9tPMz8pRGsWtg\\=\\=:focus-within {\r\n border-color: var(--primary-main-color);\r\n}\r\n\r\n.V0tFQvygj9tPMz8pRGsWtg\\=\\=._4prgfG5d4\\+IChvGhEHV37g\\=\\= {\r\n background-color: var(--neutral-disable-background-color) !important;\r\n pointer-events: none !important;\r\n}\r\n\r\n.V0tFQvygj9tPMz8pRGsWtg\\=\\=.va7BD-r43gsIlTSu2tDz\\+g\\=\\= {\r\n overflow: visible !important;\r\n border-color: var(--helper-text-color) !important;\r\n}\r\n\r\n.V0tFQvygj9tPMz8pRGsWtg\\=\\=.va7BD-r43gsIlTSu2tDz\\+g\\=\\=::after {\r\n content: attr(helper-text);\r\n color: var(--helper-text-color);\r\n position: absolute;\r\n left: 0;\r\n bottom: -0.4rem;\r\n width: max-content;\r\n font-size: 1.2rem;\r\n line-height: 1.6rem;\r\n font-family: inherit;\r\n transform: translateY(100%);\r\n}\r\n\r\n.V0tFQvygj9tPMz8pRGsWtg\\=\\= *:has(input),\r\n.V0tFQvygj9tPMz8pRGsWtg\\=\\= *:has(._21GxuiaSH-k-QWEqkFxukw\\=\\=),\r\n.V0tFQvygj9tPMz8pRGsWtg\\=\\= input {\r\n font: inherit;\r\n color: inherit;\r\n font-size: inherit;\r\n font-family: inherit;\r\n font-weight: inherit;\r\n line-height: inherit;\r\n text-align: inherit;\r\n text-overflow: inherit;\r\n}\r\n\r\n.V0tFQvygj9tPMz8pRGsWtg\\=\\= input {\r\n flex: 1;\r\n min-width: 6rem;\r\n border: none;\r\n outline: none;\r\n padding: 0;\r\n background-color: transparent;\r\n}\r\n\r\n.V0tFQvygj9tPMz8pRGsWtg\\=\\= ._21GxuiaSH-k-QWEqkFxukw\\=\\= {\r\n border-radius: 10rem;\r\n padding: 0.4rem 0.8rem;\r\n background-color: var(--neutral-selected-background-color);\r\n gap: 0.8rem;\r\n}\r\n\r\n.yCYvjgzuXlSZfY2AoPX0Mw\\=\\= {\r\n position: absolute;\r\n z-index: 10;\r\n background-color: var(--neutral-absolute-background-color);\r\n border-radius: 0.8rem;\r\n border: var(--neutral-main-border);\r\n height: fit-content;\r\n box-shadow: 0 0 12px 0 #00204d1f;\r\n align-items: center;\r\n}\r\n\r\n.yCYvjgzuXlSZfY2AoPX0Mw\\=\\=>.JZCRtDJyuveUjgDqFTBjHg\\=\\= {\r\n max-height: 100%;\r\n flex: 1;\r\n align-items: start;\r\n max-height: 28rem;\r\n min-height: 8rem;\r\n width: 100%;\r\n padding: 0.4rem 0;\r\n overflow: hidden auto;\r\n}\r\n\r\n.yCYvjgzuXlSZfY2AoPX0Mw\\=\\=>.JZCRtDJyuveUjgDqFTBjHg\\=\\= .JJKM4SJc8HTQqARlNQPrmQ\\=\\= {\r\n justify-content: start;\r\n align-items: center;\r\n padding: 0.8rem 1.6rem;\r\n gap: 0.8rem;\r\n width: 100%;\r\n cursor: context-menu;\r\n}\r\n\r\n.yCYvjgzuXlSZfY2AoPX0Mw\\=\\=>.JZCRtDJyuveUjgDqFTBjHg\\=\\= .JJKM4SJc8HTQqARlNQPrmQ\\=\\=:hover {\r\n background-color: var(--neutral-hover-background-color);\r\n}\r\n\r\n.yCYvjgzuXlSZfY2AoPX0Mw\\=\\=>.JZCRtDJyuveUjgDqFTBjHg\\=\\= .JJKM4SJc8HTQqARlNQPrmQ\\=\\=:has(input:checked) {\r\n background-color: var(--neutral-selected-background-color);\r\n}\r\n\r\n.yCYvjgzuXlSZfY2AoPX0Mw\\=\\=>.JZCRtDJyuveUjgDqFTBjHg\\=\\= .JJKM4SJc8HTQqARlNQPrmQ\\=\\=._4prgfG5d4\\+IChvGhEHV37g\\=\\= {\r\n background-color: var(--neutral-disable-background-color) !important;\r\n}\r\n\r\n.yCYvjgzuXlSZfY2AoPX0Mw\\=\\=>.JZCRtDJyuveUjgDqFTBjHg\\=\\= .JJKM4SJc8HTQqARlNQPrmQ\\=\\=._4prgfG5d4\\+IChvGhEHV37g\\=\\= * {\r\n color: var(--neutral-text-disabled-color) !important;\r\n}\r\n\r\n.ij049\\+deoo-tnrAnLPfxfg\\=\\= {\r\n padding: 0.8rem;\r\n font: 400 1.4rem/2rem "Inter";\r\n color: var(--neutral-text-title-reverse-color);\r\n}',""]),r.locals={"select-multi-container":"V0tFQvygj9tPMz8pRGsWtg==",disabled:"_4prgfG5d4+IChvGhEHV37g==","helper-text":"va7BD-r43gsIlTSu2tDz+g==","selected-item-value":"_21GxuiaSH-k-QWEqkFxukw==","select-multi-popup":"yCYvjgzuXlSZfY2AoPX0Mw==","select-body":"JZCRtDJyuveUjgDqFTBjHg==","select-tile":"JJKM4SJc8HTQqARlNQPrmQ==","no-results-found":"ij049+deoo-tnrAnLPfxfg=="};const s=r},12:t=>{"use strict";t.exports=e},30:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,'.\\+Luvw8jUZlJNxG0BFElpzg\\=\\= {\r\n border-radius: 0.8rem;\r\n width: 100%;\r\n box-sizing: border-box;\r\n padding: 0.8rem 1.6rem;\r\n border: var(--neutral-bolder-border);\r\n border-radius: 0.8rem;\r\n gap: 0.8rem;\r\n position: relative;\r\n cursor: context-menu;\r\n}\r\n\r\n.\\+Luvw8jUZlJNxG0BFElpzg\\=\\=:focus-within {\r\n border-color: var(--primary-main-color);\r\n}\r\n\r\n.\\+Luvw8jUZlJNxG0BFElpzg\\=\\=.OAghZKca595U6Er9n9Sdlg\\=\\= {\r\n background-color: var(--neutral-disable-background-color) !important;\r\n pointer-events: none !important;\r\n}\r\n\r\n.\\+Luvw8jUZlJNxG0BFElpzg\\=\\=.RZuCQOvywPF0QFRbZSJrDw\\=\\= {\r\n overflow: visible !important;\r\n border-color: var(--helper-text-color) !important;\r\n}\r\n\r\n.\\+Luvw8jUZlJNxG0BFElpzg\\=\\=.RZuCQOvywPF0QFRbZSJrDw\\=\\=::after {\r\n content: attr(helper-text);\r\n color: var(--helper-text-color);\r\n position: absolute;\r\n left: 0;\r\n bottom: -0.4rem;\r\n width: max-content;\r\n font-size: 1.2rem;\r\n line-height: 1.6rem;\r\n font-family: inherit;\r\n transform: translateY(100%);\r\n}\r\n\r\n.\\+Luvw8jUZlJNxG0BFElpzg\\=\\=>input {\r\n flex: 1;\r\n width: 100%;\r\n border: none;\r\n outline: none;\r\n padding: 0;\r\n background-color: transparent !important;\r\n font: inherit;\r\n color: inherit;\r\n font-size: inherit;\r\n font-family: inherit;\r\n font-weight: inherit;\r\n line-height: inherit;\r\n text-align: inherit;\r\n text-overflow: inherit;\r\n}\r\n\r\n.\\+Luvw8jUZlJNxG0BFElpzg\\=\\= input:read-only {\r\n cursor: context-menu;\r\n}\r\n\r\n.UTuSoTEcMojrcG1lZCoa6A\\=\\= {\r\n position: absolute;\r\n z-index: 10;\r\n background-color: var(--neutral-absolute-background-color);\r\n border-radius: 0.8rem;\r\n border: var(--neutral-main-border);\r\n height: fit-content;\r\n box-shadow: 0 0 12px 0 #00204d1f;\r\n align-items: center;\r\n}\r\n\r\n.UTuSoTEcMojrcG1lZCoa6A\\=\\=>.GV6NdtVQbuSkYhVmwJxjsQ\\=\\= {\r\n max-height: 100%;\r\n flex: 1;\r\n align-items: start;\r\n max-height: 28rem;\r\n min-height: 8rem;\r\n width: 100%;\r\n padding: 0.4rem 0;\r\n overflow: hidden auto;\r\n}\r\n\r\n.UTuSoTEcMojrcG1lZCoa6A\\=\\=>.GV6NdtVQbuSkYhVmwJxjsQ\\=\\= ._6ZBq5zgha6x741htsi1axw\\=\\= {\r\n justify-content: start;\r\n align-items: center;\r\n padding: 0.8rem 1.6rem;\r\n gap: 0.8rem;\r\n width: 100%;\r\n cursor: context-menu;\r\n}\r\n\r\n.UTuSoTEcMojrcG1lZCoa6A\\=\\=>.GV6NdtVQbuSkYhVmwJxjsQ\\=\\= ._6ZBq5zgha6x741htsi1axw\\=\\=:hover {\r\n background-color: var(--neutral-hover-background-color);\r\n}\r\n\r\n.UTuSoTEcMojrcG1lZCoa6A\\=\\=>.GV6NdtVQbuSkYhVmwJxjsQ\\=\\= ._6ZBq5zgha6x741htsi1axw\\=\\=.OAghZKca595U6Er9n9Sdlg\\=\\= {\r\n background-color: var(--neutral-disable-background-color) !important;\r\n}\r\n\r\n.UTuSoTEcMojrcG1lZCoa6A\\=\\=>.GV6NdtVQbuSkYhVmwJxjsQ\\=\\= ._6ZBq5zgha6x741htsi1axw\\=\\=.OAghZKca595U6Er9n9Sdlg\\=\\= * {\r\n color: var(--neutral-text-disabled-color) !important;\r\n}\r\n\r\n.F10H5h\\+BSQOX2mWTPhTN9g\\=\\= {\r\n padding: 0.8rem;\r\n font: 400 1.4rem/2rem "Inter";\r\n color: var(--neutral-text-title-reverse-color);\r\n}',""]),r.locals={"select1-container":"+Luvw8jUZlJNxG0BFElpzg==",disabled:"OAghZKca595U6Er9n9Sdlg==","helper-text":"RZuCQOvywPF0QFRbZSJrDw==","select1-popup":"UTuSoTEcMojrcG1lZCoa6A==","select-body":"GV6NdtVQbuSkYhVmwJxjsQ==","select-tile":"_6ZBq5zgha6x741htsi1axw==","no-results-found":"F10H5h+BSQOX2mWTPhTN9g=="};const s=r},33:e=>{"use strict";e.exports=t},72:(e,t,n)=>{"use strict";var i,r=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 o(e){for(var t=-1,n=0;n<s.length;n++)if(s[n].identifier===e){t=n;break}return t}function a(e,t){for(var n={},i=[],r=0;r<e.length;r++){var a=e[r],l=t.base?a[0]+t.base:a[0],c=n[l]||0,d="".concat(l," ").concat(c);n[l]=c+1;var u=o(d),h={css:a[1],media:a[2],sourceMap:a[3]};-1!==u?(s[u].references++,s[u].updater(h)):s.push({identifier:d,updater:p(h,t),references:1}),i.push(d)}return i}function l(e){var t=document.createElement("style"),i=e.attributes||{};if(void 0===i.nonce){var s=n.nc;s&&(i.nonce=s)}if(Object.keys(i).forEach((function(e){t.setAttribute(e,i[e])})),"function"==typeof e.insert)e.insert(t);else{var o=r(e.insert||"head");if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(t)}return t}var c,d=(c=[],function(e,t){return c[e]=t,c.filter(Boolean).join("\n")});function u(e,t,n,i){var r=n?"":i.media?"@media ".concat(i.media," {").concat(i.css,"}"):i.css;if(e.styleSheet)e.styleSheet.cssText=d(t,r);else{var s=document.createTextNode(r),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(s,o[t]):e.appendChild(s)}}function h(e,t,n){var i=n.css,r=n.media,s=n.sourceMap;if(r?e.setAttribute("media",r):e.removeAttribute("media"),s&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}var m=null,g=0;function p(e,t){var n,i,r;if(t.singleton){var s=g++;n=m||(m=l(t)),i=u.bind(null,n,s,!1),r=u.bind(null,n,s,!0)}else n=l(t),i=h.bind(null,n,t),r=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else r()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=(void 0===i&&(i=Boolean(window&&document&&document.all&&!window.atob)),i));var n=a(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var i=0;i<n.length;i++){var r=o(n[i]);s[r].references--}for(var l=a(e,t),c=0;c<n.length;c++){var d=o(n[c]);0===s[d].references&&(s[d].updater(),s.splice(d,1))}n=l}}}},156:e=>{"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},166:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,".oZ-5cyh8Hi\\+fNvgXaLsIKQ\\=\\= {\r\n gap: 0.8rem;\r\n}\r\n\r\n.oZ-5cyh8Hi\\+fNvgXaLsIKQ\\=\\= svg {\r\n cursor: pointer;\r\n}\r\n\r\n.oZ-5cyh8Hi\\+fNvgXaLsIKQ\\=\\= svg > * {\r\n pointer-events: none !important;\r\n}",""]),r.locals={"rating-container":"oZ-5cyh8Hi+fNvgXaLsIKQ=="};const s=r},238:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,".popup-overlay {\r\n position: fixed;\r\n top: 0 !important;\r\n left: 0 !important;\r\n right: 0 !important;\r\n bottom: 0 !important;\r\n width: 100dvw !important;\r\n height: 100dvh !important;\r\n background-color: #000000B2;\r\n display: flex !important;\r\n justify-content: center;\r\n align-items: center;\r\n z-index: 99;\r\n}\r\n\r\n.popup-container {\r\n position: relative;\r\n background-color: var(--neutral-absolute-background-color);\r\n border-radius: 0.8rem;\r\n border: var(--neutral-main-border);\r\n overflow: visible;\r\n max-width: 86%;\r\n max-height: 80%;\r\n}\r\n\r\n.popup-header {\r\n align-items: center;\r\n justify-content: start;\r\n padding: 1.6rem 2.4rem;\r\n border-bottom: var(--neutral-main-border);\r\n}\r\n\r\n.popup-footer {\r\n column-gap: 0.8rem;\r\n justify-content: end;\r\n padding: 1.2rem 2.4rem;\r\n border-top: var(--neutral-main-border);\r\n}\r\n\r\n.popup-container>.popup-close-btn {\r\n position: absolute;\r\n right: 0;\r\n top: 0;\r\n transform: translate(50%, -50%);\r\n width: 3.2rem;\r\n height: 3.2rem;\r\n padding: 0.6rem;\r\n border-radius: 50%;\r\n align-items: center;\r\n justify-content: center;\r\n background-color: var(--neutral-absolute-background-color);\r\n box-shadow: 0px 1px 6px 0px #2d32390f;\r\n}\r\n\r\n.popup-overlay.hidden-overlay {\r\n background-color: transparent;\r\n width: fit-content !important;\r\n height: fit-content !important;\r\n}\r\n\r\n.popup-overlay.hidden-overlay>* {\r\n position: fixed !important;\r\n z-index: 99;\r\n border-radius: 0.8rem;\r\n background-color: var(--neutral-absolute-background-color);\r\n}\r\n\r\n.popup-overlay>* {\r\n transition: width 0.8s ease-in-out, max-width 0.8s ease-in-out, height 0.8s ease-in-out, max-height 0.8s ease-in-out, border-radius 0.8s ease-in-out;\r\n box-shadow: 2px 0px 16px 0px hsla(0, 0%, 0%, 0.04);\r\n}\r\n\r\n.popup-overlay.hidden-overlay>.popup-container {\r\n position: absolute;\r\n width: max-content;\r\n height: max-content;\r\n background-color: transparent;\r\n}\r\n\r\n.popup-overlay.hidden-overlay>.popup-container .popup-close-btn {\r\n display: none !important;\r\n}\r\n\r\n@keyframes open-drawer-right-to-left {\r\n 0% {\r\n transform: translateX(100%);\r\n }\r\n\r\n 100% {\r\n transform: translateX(0);\r\n }\r\n}\r\n\r\n.right-drawer {\r\n top: 0;\r\n right: 0;\r\n height: 100dvh;\r\n animation: open-drawer-right-to-left 0.6s ease-in-out;\r\n animation-fill-mode: forwards;\r\n}\r\n\r\n@keyframes open-drawer-left-to-right {\r\n 0% {\r\n transform: translateX(-100%);\r\n }\r\n\r\n 100% {\r\n transform: translateX(0);\r\n }\r\n}\r\n\r\n.left-drawer {\r\n top: 0;\r\n left: 0;\r\n height: 100dvh;\r\n animation: open-drawer-left-to-right 0.6s ease-in-out;\r\n animation-fill-mode: forwards;\r\n}\r\n\r\n@keyframes show-dropdown-popup {\r\n 0% {\r\n opacity: 0;\r\n height: 0;\r\n width: 0;\r\n transform: scale(0);\r\n }\r\n\r\n 100% {\r\n opacity: 1;\r\n transform: scale(1);\r\n }\r\n}\r\n\r\n.dropdown-popup {\r\n animation: show-dropdown-popup 0.4s ease-in-out;\r\n}",""]);const s=r},270:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,".editor-container {\r\n position: relative;\r\n --ck-color-text: var(--neutral-text-title-color);\r\n width: 100%;\r\n height: 400px;\r\n max-height: 600px;\r\n border-radius: 0.8rem;\r\n border: var(--neutral-bolder-border);\r\n overflow: hidden visible;\r\n}\r\n\r\n.editor-container:has(.ck-read-only) {\r\n background-color: var(--neutral-disable-background-color) !important;\r\n pointer-events: none !important;\r\n}\r\n\r\n.editor-container:focus-within {\r\n border-color: var(--primary-main-color);\r\n}\r\n\r\n.editor-container.helper-text {\r\n overflow: visible !important;\r\n border-color: var(--helper-text-color) !important;\r\n}\r\n\r\n.editor-container.helper-text::after {\r\n content: attr(helper-text);\r\n color: var(--helper-text-color);\r\n position: absolute;\r\n left: 0;\r\n bottom: -0.4rem;\r\n width: max-content;\r\n font-size: 1.2rem;\r\n line-height: 1.6rem;\r\n font-family: inherit;\r\n transform: translateY(100%);\r\n}\r\n\r\n.ck-content {\r\n font-family: 'Inter';\r\n line-height: 1.6;\r\n word-break: break-word;\r\n}\r\n\r\n.ck-content h3.category {\r\n font-family: 'Inter';\r\n font-size: 20px;\r\n font-weight: bold;\r\n color: #555;\r\n letter-spacing: 10px;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n\r\n.ck-content h2.document-title {\r\n font-family: 'Inter';\r\n font-size: 50px;\r\n font-weight: bold;\r\n margin: 0;\r\n padding: 0;\r\n border: 0;\r\n}\r\n\r\n.ck-content h3.document-subtitle {\r\n font-family: 'Inter';\r\n font-size: 20px;\r\n color: #555;\r\n margin: 0 0 1em;\r\n font-weight: bold;\r\n padding: 0;\r\n}\r\n\r\n.ck-content blockquote.side-quote {\r\n font-family: 'Inter';\r\n font-style: normal;\r\n float: right;\r\n width: 35%;\r\n position: relative;\r\n border: 0;\r\n overflow: visible;\r\n z-index: 1;\r\n margin-left: 1em;\r\n}\r\n\r\n.ck-content blockquote.side-quote::before {\r\n content: '“';\r\n position: absolute;\r\n top: -37px;\r\n left: -10px;\r\n display: block;\r\n font-size: 200px;\r\n color: #e7e7e7;\r\n z-index: -1;\r\n line-height: 1;\r\n}\r\n\r\n.ck-content blockquote.side-quote p {\r\n font-size: 2em;\r\n line-height: 1;\r\n}\r\n\r\n.ck-content blockquote.side-quote p:last-child:not(:first-child) {\r\n font-size: 1.3em;\r\n text-align: right;\r\n color: #555;\r\n}\r\n\r\n.ck-content span.marker {\r\n background: yellow;\r\n}\r\n\r\n.ck-content span.spoiler {\r\n background: #000;\r\n color: #000;\r\n}\r\n\r\n.ck-content span.spoiler:hover {\r\n background: #000;\r\n color: #fff;\r\n}\r\n\r\n.ck-content pre.fancy-code {\r\n border: 0;\r\n margin-left: 2em;\r\n margin-right: 2em;\r\n border-radius: 10px;\r\n}\r\n\r\n.ck-content pre.fancy-code::before {\r\n content: '';\r\n display: block;\r\n height: 13px;\r\n background: url(data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1NCAxMyI+CiAgPGNpcmNsZSBjeD0iNi41IiBjeT0iNi41IiByPSI2LjUiIGZpbGw9IiNGMzZCNUMiLz4KICA8Y2lyY2xlIGN4PSIyNi41IiBjeT0iNi41IiByPSI2LjUiIGZpbGw9IiNGOUJFNEQiLz4KICA8Y2lyY2xlIGN4PSI0Ny41IiBjeT0iNi41IiByPSI2LjUiIGZpbGw9IiM1NkM0NTMiLz4KPC9zdmc+Cg==);\r\n margin-bottom: 8px;\r\n background-repeat: no-repeat;\r\n}\r\n\r\n.ck-content pre.fancy-code-dark {\r\n background: #272822;\r\n color: #fff;\r\n box-shadow: 5px 5px 0 #0000001f;\r\n}\r\n\r\n.ck-content pre.fancy-code-bright {\r\n background: #dddfe0;\r\n color: #000;\r\n box-shadow: 5px 5px 0 #b3b3b3;\r\n}\r\n\r\n.editor-container_classic-editor .editor-container__editor .ck-editor .ck-editor__editable {\r\n border-radius: 0;\r\n}\r\n\r\n.ck-editor-container {\r\n --ck-font-size-base: 1.4rem;\r\n}\r\n\r\n.editor-container__editor {\r\n flex: 1;\r\n height: 100%;\r\n overflow: hidden !important;\r\n display: flex;\r\n flex-direction: column;\r\n}\r\n\r\n.editor-container__editor>div,\r\n.ck.ck-reset.ck-editor.ck-rounded-corners {\r\n flex: 1;\r\n height: 100%;\r\n overflow: hidden !important;\r\n display: flex;\r\n flex-direction: column;\r\n}\r\n\r\n.ck.ck-editor__main>.ck.ck-content.ck-rounded-corners {\r\n min-height: 100%;\r\n}\r\n\r\n.ck.ck-toolbar {\r\n background-color: var(--neutral-absolute-background-color);\r\n border-radius: 0.8rem 0.8rem 0 0 !important;\r\n}\r\n\r\n.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content {\r\n height: 40px;\r\n border: none !important;\r\n border-radius: 0.8rem 0.8rem 0 0 !important;\r\n border-bottom: var(--neutral-bolder-border) !important;\r\n}\r\n\r\n.ck.ck-editor__main {\r\n flex: 1;\r\n height: 100% !important;\r\n overflow: hidden auto !important;\r\n}\r\n\r\n.ck.ck-editor__main>div {\r\n background-color: transparent !important;\r\n border: none !important;\r\n font-size: 16px !important;\r\n}\r\n\r\n.ck.ck-color-grid>button {\r\n border: var(--neutral-bolder-border);\r\n border-radius: 0.4rem !important;\r\n}",""]);const s=r},296:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,'.KlrwGLCQZnBakjABYRxMAw\\=\\= {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n width: 100dvw;\r\n height: 100dvh;\r\n background-color: rgba(0, 0, 0, 0.5);\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n z-index: 100;\r\n}\r\n\r\n.MVu1mUSPz0\\+6r88zImttsA\\=\\= {\r\n position: relative;\r\n background-color: var(--neutral-absolute-background-color);\r\n padding: 2.4rem;\r\n border-radius: 8px;\r\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);\r\n gap: 2.4rem;\r\n overflow: visible;\r\n}\r\n\r\n.MVu1mUSPz0\\+6r88zImttsA\\=\\= button {\r\n outline: none;\r\n padding: 0;\r\n border: none;\r\n}\r\n\r\n.qsY1ExmCfGV3istHZ0t1VA\\=\\= {\r\n gap: 1.6rem;\r\n}\r\n\r\n.qsY1ExmCfGV3istHZ0t1VA\\=\\=>div:last-child {\r\n width: 100%;\r\n align-items: inherit;\r\n gap: 8px;\r\n}\r\n\r\n.qsY1ExmCfGV3istHZ0t1VA\\=\\=>div:last-child>* {\r\n width: 100%;\r\n}\r\n\r\n.qsY1ExmCfGV3istHZ0t1VA\\=\\=>.fHyuXcabkhntpOvU9Vnllg\\=\\= {\r\n width: 5.6rem;\r\n height: 5.6rem;\r\n border-radius: 50%;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n\r\n._9E6ne9a2emJUBgm9oNgPqQ\\=\\= {\r\n gap: 8px;\r\n justify-content: end;\r\n width: 100%;\r\n}\r\n\r\n._9E6ne9a2emJUBgm9oNgPqQ\\=\\=>.ygaU0oXe13CsyE-mwfsHyQ\\=\\= {\r\n height: 4rem;\r\n justify-content: center;\r\n padding: 0 1.6rem;\r\n border-radius: 0.8rem;\r\n background-color: var(--neutral-main-background-color);\r\n}\r\n\r\n._9E6ne9a2emJUBgm9oNgPqQ\\=\\=>.ygaU0oXe13CsyE-mwfsHyQ\\=\\=>* {\r\n color: var(--neutral-text-subtitle-color);\r\n}\r\n\r\n._9E6ne9a2emJUBgm9oNgPqQ\\=\\=>.Q9Qd83pzdhQg2UVX0nzyDw\\=\\=>* {\r\n color: var(--neutral-text-title-reverse-color);\r\n}\r\n\r\n/* \r\nINFOR = 1\r\nERROR = 2\r\nWARNING = 3\r\nSUCCSESS = 4\r\n*/\r\n\r\n.MVu1mUSPz0\\+6r88zImttsA\\=\\=[dialog-type="1"] .fHyuXcabkhntpOvU9Vnllg\\=\\= {\r\n background-color: var(--infor-background);\r\n}\r\n\r\n.MVu1mUSPz0\\+6r88zImttsA\\=\\=[dialog-type="2"] .fHyuXcabkhntpOvU9Vnllg\\=\\= {\r\n background-color: var(--error-background);\r\n}\r\n\r\n.MVu1mUSPz0\\+6r88zImttsA\\=\\=[dialog-type="3"] .fHyuXcabkhntpOvU9Vnllg\\=\\= {\r\n background-color: var(--warning-background);\r\n}\r\n\r\n.MVu1mUSPz0\\+6r88zImttsA\\=\\=[dialog-type="4"] .fHyuXcabkhntpOvU9Vnllg\\=\\= {\r\n background-color: var(--success-background);\r\n}\r\n\r\n.MVu1mUSPz0\\+6r88zImttsA\\=\\=[dialog-type="1"] ._9E6ne9a2emJUBgm9oNgPqQ\\=\\=>.Q9Qd83pzdhQg2UVX0nzyDw\\=\\= {\r\n background-color: var(--infor-main-color);\r\n}\r\n\r\n.MVu1mUSPz0\\+6r88zImttsA\\=\\=[dialog-type="2"] ._9E6ne9a2emJUBgm9oNgPqQ\\=\\=>.Q9Qd83pzdhQg2UVX0nzyDw\\=\\= {\r\n background-color: var(--error-main-color);\r\n}\r\n\r\n.MVu1mUSPz0\\+6r88zImttsA\\=\\=[dialog-type="3"] ._9E6ne9a2emJUBgm9oNgPqQ\\=\\=>.Q9Qd83pzdhQg2UVX0nzyDw\\=\\= {\r\n background-color: var(--warning-main-color);\r\n}\r\n\r\n.MVu1mUSPz0\\+6r88zImttsA\\=\\=[dialog-type="4"] ._9E6ne9a2emJUBgm9oNgPqQ\\=\\=>.Q9Qd83pzdhQg2UVX0nzyDw\\=\\= {\r\n background-color: var(--success-main-color);\r\n}',""]),r.locals={"dialog-overlay":"KlrwGLCQZnBakjABYRxMAw==","dialog-container":"MVu1mUSPz0+6r88zImttsA==","dialog-body":"qsY1ExmCfGV3istHZ0t1VA==","dialog-status":"fHyuXcabkhntpOvU9Vnllg==","dialog-footer":"_9E6ne9a2emJUBgm9oNgPqQ==","dialog-action":"ygaU0oXe13CsyE-mwfsHyQ==","dialog-submit":"Q9Qd83pzdhQg2UVX0nzyDw=="};const s=r},313:(e,t,n)=>{"use strict";var i=n(925);function r(){}function s(){}s.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,s,o){if(o!==i){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:s,resetWarningCache:r};return n.PropTypes=n,n}},314: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,i){"string"==typeof e&&(e=[[null,e,""]]);var r={};if(i)for(var s=0;s<this.length;s++){var o=this[s][0];null!=o&&(r[o]=!0)}for(var a=0;a<e.length;a++){var l=[].concat(e[a]);i&&r[l[0]]||(n&&(l[2]?l[2]="".concat(n," and ").concat(l[2]):l[2]=n),t.push(l))}},t}},320:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,'.kYCSFhbXuBmkInBo79LwsA\\=\\= {\r\n background-color: var(--neutral-absolute-background-color);\r\n border-radius: 0.8rem;\r\n align-items: stretch;\r\n border: var(--neutral-main-border);\r\n width: fit-content;\r\n}\r\n\r\n.d1anYOnkwJ66eNrMYWDj7w\\=\\= {\r\n padding: 0.8rem 2.4rem 0.8rem 0;\r\n border-right: var(--neutral-main-border);\r\n}\r\n\r\n.d1anYOnkwJ66eNrMYWDj7w\\=\\=>.-PGQNpfIGDr\\+HCEmsIH6dA\\=\\= {\r\n color: var(--neutral-text-title-color);\r\n padding: 0.8rem 1.6rem;\r\n}\r\n\r\n.f8AIKOzEoa3fynUAZ2M7Gg\\=\\= {\r\n border-left: var(--neutral-main-border);\r\n height: 34.2rem;\r\n align-items: center;\r\n}\r\n\r\n.f8AIKOzEoa3fynUAZ2M7Gg\\=\\=>div[class*="heading-7"]:first-child {\r\n width: 100%;\r\n padding: 1.2rem 1.6rem;\r\n border-bottom: var(--neutral-main-border);\r\n text-align: center;\r\n}\r\n\r\n.f8AIKOzEoa3fynUAZ2M7Gg\\=\\= div[class*="scroll-picker-"] {\r\n flex: 1;\r\n height: 100%;\r\n gap: 0.4rem;\r\n padding: 0.4rem 0;\r\n overflow: hidden auto;\r\n scrollbar-width: thin;\r\n}\r\n\r\n.f8AIKOzEoa3fynUAZ2M7Gg\\=\\= ._3KLHVhi36nu7MRs17xVyRA\\=\\= {\r\n border-left: var(--neutral-main-border);\r\n border-right: var(--neutral-main-border);\r\n}\r\n\r\n.f8AIKOzEoa3fynUAZ2M7Gg\\=\\= div[class*="scroll-picker-"]>button {\r\n width: 5.6rem;\r\n padding: 0.4rem 0;\r\n}\r\n\r\n.f8AIKOzEoa3fynUAZ2M7Gg\\=\\= div[class*="scroll-picker-"]>button.mLu\\+YR5OcVzXmQH2Ew6ILQ\\=\\= {\r\n background-color: var(--primary-background);\r\n color: var(--primary-main-color);\r\n}\r\n\r\n.QSC1w2Y0yFvJKcpl3RmUOw\\=\\= {\r\n padding: 1.2rem 1.6rem;\r\n gap: 1.2rem;\r\n background-color: transparent !important;\r\n border-bottom: var(--neutral-main-border);\r\n justify-content: space-between;\r\n}\r\n\r\n.QSC1w2Y0yFvJKcpl3RmUOw\\=\\=>span {\r\n width: 100%;\r\n max-width: 15rem;\r\n flex: 1;\r\n text-align: center;\r\n cursor: pointer;\r\n border-radius: 0.8rem;\r\n}\r\n\r\n.QSC1w2Y0yFvJKcpl3RmUOw\\=\\=>span:hover {\r\n background-color: var(--neutral-hover-background-color);\r\n}\r\n\r\n.QSC1w2Y0yFvJKcpl3RmUOw\\=\\=>button {\r\n width: 1.6rem;\r\n height: 1.6rem;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n\r\n.QSC1w2Y0yFvJKcpl3RmUOw\\=\\=>button>svg {\r\n font-size: 1.4rem;\r\n color: var(--neutral-text-title-color);\r\n pointer-events: none;\r\n}\r\n\r\n.-gHAhV30Im4-HLC-DLudnA\\=\\= {\r\n padding: 1.2rem 1.6rem;\r\n width: 31.2rem;\r\n flex-wrap: wrap;\r\n gap: 0.8rem 0;\r\n}\r\n\r\n.-gHAhV30Im4-HLC-DLudnA\\=\\=>div {\r\n height: 3.2rem;\r\n padding: 0 0.4rem;\r\n display: flex;\r\n}\r\n\r\n.-gHAhV30Im4-HLC-DLudnA\\=\\=>div>* {\r\n border: 1px solid transparent;\r\n justify-content: center;\r\n height: 100%;\r\n width: 100%;\r\n}\r\n\r\n.axg73SfF1yEAkcFrK2EjFw\\=\\= {\r\n width: calc(100% / 7);\r\n}\r\n\r\n.axg73SfF1yEAkcFrK2EjFw\\=\\=>* {\r\n border-radius: 50%;\r\n}\r\n\r\n.zOdG7EgZM27\\+H9ecjjulXg\\=\\=,\r\n.Cv1Xb9IzVo0qMQIfXOe-vA\\=\\= {\r\n width: calc(100% / 3);\r\n}\r\n\r\n.zOdG7EgZM27\\+H9ecjjulXg\\=\\=>*,\r\n.Cv1Xb9IzVo0qMQIfXOe-vA\\=\\=>* {\r\n border-radius: 2.4rem;\r\n}\r\n\r\n.-gHAhV30Im4-HLC-DLudnA\\=\\=>._11H-sJONdtvS3w95bOuyqw\\=\\= {\r\n background-color: var(--neutral-main-background-color);\r\n}\r\n\r\n.-gHAhV30Im4-HLC-DLudnA\\=\\=:has(>._11H-sJONdtvS3w95bOuyqw\\=\\=, >.-TGPiKllKtW07UuzdCStXw\\=\\=)>.e4xRkQavg-M7Qn1HM1A3kA\\=\\= {\r\n background-image: linear-gradient(to right, transparent 50%, var(--neutral-main-background-color) 50%);\r\n}\r\n\r\n.-TGPiKllKtW07UuzdCStXw\\=\\= {\r\n background-image: linear-gradient(to left, transparent 50%, var(--neutral-main-background-color) 50%) !important;\r\n}\r\n\r\n.-gHAhV30Im4-HLC-DLudnA\\=\\=>.CUERAOyik1AoVEfOQeRHIw\\=\\=>* {\r\n border-color: var(--primary-main-color)\r\n}\r\n\r\n.-gHAhV30Im4-HLC-DLudnA\\=\\=>.mLu\\+YR5OcVzXmQH2Ew6ILQ\\=\\=>* {\r\n background-color: var(--primary-main-color);\r\n color: var(--neutral-absolute-background-color);\r\n}\r\n\r\n.-gHAhV30Im4-HLC-DLudnA\\=\\=>.Aq7xBMHxGt7HF7vxt62L6g\\=\\= {\r\n opacity: 0.24 !important;\r\n pointer-events: none !important;\r\n}',""]),r.locals={"calendar-container":"kYCSFhbXuBmkInBo79LwsA==","calendar-sidebar-options":"d1anYOnkwJ66eNrMYWDj7w==","calendar-sidebar-option-buttton":"-PGQNpfIGDr+HCEmsIH6dA==","picker-time-container":"f8AIKOzEoa3fynUAZ2M7Gg==","scroll-picker-minutes":"_3KLHVhi36nu7MRs17xVyRA==",selected:"mLu+YR5OcVzXmQH2Ew6ILQ==","picker-date-header":"QSC1w2Y0yFvJKcpl3RmUOw==","picker-date-body":"-gHAhV30Im4-HLC-DLudnA==","date-picker-circle":"axg73SfF1yEAkcFrK2EjFw==","month-picker-circle":"zOdG7EgZM27+H9ecjjulXg==","year-picker-circle":"Cv1Xb9IzVo0qMQIfXOe-vA==","in-range":"_11H-sJONdtvS3w95bOuyqw==","end-range":"-TGPiKllKtW07UuzdCStXw==","start-range":"e4xRkQavg-M7Qn1HM1A3kA==",today:"CUERAOyik1AoVEfOQeRHIw==",invalid:"Aq7xBMHxGt7HF7vxt62L6g=="};const s=r},342:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,".FgGCREHi\\+A0a8XNHinzDEw\\=\\= {\r\n height: 4rem;\r\n position: relative;\r\n gap: 0.8rem;\r\n border-radius: 0.8rem;\r\n border: var(--neutral-bolder-border);\r\n padding: 0.8rem 1.6rem;\r\n align-items: start;\r\n}\r\n\r\n.FgGCREHi\\+A0a8XNHinzDEw\\=\\=:has(> textarea:disabled) {\r\n background-color: var(--neutral-disable-background-color) !important;\r\n color: var(--neutral-text-disabled-color) !important;\r\n pointer-events: none !important;\r\n}\r\n\r\n.FgGCREHi\\+A0a8XNHinzDEw\\=\\=:focus-within {\r\n border-color: var(--primary-main-color);\r\n}\r\n\r\n.FgGCREHi\\+A0a8XNHinzDEw\\=\\=>textarea {\r\n flex: 1;\r\n padding: 0;\r\n width: 100%;\r\n height: inherit;\r\n max-height: 100%;\r\n border: none;\r\n outline: none;\r\n background-color: transparent !important;\r\n font: inherit;\r\n color: inherit;\r\n font-size: inherit;\r\n font-family: inherit;\r\n font-weight: inherit;\r\n line-height: inherit;\r\n text-align: inherit;\r\n text-overflow: inherit;\r\n resize: inherit;\r\n}\r\n\r\n.FgGCREHi\\+A0a8XNHinzDEw\\=\\=.osmCJeZl1hVqLcZn2W9KKg\\=\\= {\r\n overflow: visible !important;\r\n border-color: var(--helper-text-color) !important;\r\n}\r\n\r\n.FgGCREHi\\+A0a8XNHinzDEw\\=\\=.osmCJeZl1hVqLcZn2W9KKg\\=\\=::after {\r\n content: attr(helper-text);\r\n color: var(--helper-text-color);\r\n position: absolute;\r\n left: 0;\r\n bottom: -0.4rem;\r\n width: max-content;\r\n font-size: 1.2rem;\r\n line-height: 1.6rem;\r\n font-family: inherit;\r\n transform: translateY(100%);\r\n}",""]),r.locals={"text-area-container":"FgGCREHi+A0a8XNHinzDEw==","helper-text":"osmCJeZl1hVqLcZn2W9KKg=="};const s=r},348:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,'.ka4cXi\\+gRf9k8IM\\+VV0C0Q\\=\\= {\r\n padding: 0.4rem 1.2rem;\r\n border-radius: 0.8rem;\r\n gap: 0.8rem;\r\n justify-content: center;\r\n color: var(--neutral-text-subtitle-color, #61616B);\r\n width: fit-content;\r\n border: 1px solid transparent;\r\n outline: none;\r\n}\r\n\r\n.ka4cXi\\+gRf9k8IM\\+VV0C0Q\\=\\=[class~="border"] {\r\n border: var(--neutral-bolder-border);\r\n}\r\n\r\n.ka4cXi\\+gRf9k8IM\\+VV0C0Q\\=\\=[class~="dashed"] {\r\n border-style: dashed;\r\n color: hsla(hue, saturation, lightness, alpha);\r\n}\r\n\r\n.ka4cXi\\+gRf9k8IM\\+VV0C0Q\\=\\=[class~="size64"] {\r\n padding: 1.9rem 2.4rem;\r\n}\r\n\r\n.ka4cXi\\+gRf9k8IM\\+VV0C0Q\\=\\=[class~="size56"] {\r\n padding: 1.5rem 2rem;\r\n}\r\n\r\n.ka4cXi\\+gRf9k8IM\\+VV0C0Q\\=\\=[class~="size48"] {\r\n padding: 1.1rem 2rem;\r\n}\r\n\r\n.ka4cXi\\+gRf9k8IM\\+VV0C0Q\\=\\=[class~="size40"] {\r\n padding: 0.8rem 1.6rem;\r\n}\r\n\r\n.ka4cXi\\+gRf9k8IM\\+VV0C0Q\\=\\=[class~="size24"] {\r\n padding: 0.3rem 0.8rem;\r\n}\r\n\r\n.ka4cXi\\+gRf9k8IM\\+VV0C0Q\\=\\=>.qfduVuiygazk8UBdNdem7g\\=\\= {\r\n color: inherit;\r\n font: inherit;\r\n font-size: inherit;\r\n font-family: inherit;\r\n line-height: inherit;\r\n font-weight: inherit;\r\n text-align: inherit;\r\n letter-spacing: inherit;\r\n text-decoration: inherit;\r\n font-style: inherit;\r\n}\r\n\r\nbutton[class~="button-grey"],\r\na[class~="button-grey"] {\r\n background-color: var(--neutral-main-background-color) !important;\r\n border-color: var(--neutral-main-background-color) !important;\r\n}\r\n\r\nbutton[class~="button-grey"] *,\r\na[class~="button-grey"] * {\r\n color: var(--neutral-text-subtitle-color) !important;\r\n --color: var(--neutral-text-subtitle-color) !important;\r\n}\r\n\r\nbutton[class~="button-primary"],\r\na[class~="button-primary"] {\r\n background-color: var(--primary-main-color) !important;\r\n border-color: var(--primary-main-color) !important;\r\n}\r\n\r\nbutton[class~="button-primary"] *,\r\na[class~="button-primary"] * {\r\n color: var(--neutral-text-stable-color) !important;\r\n --color: var(--neutral-text-stable-color) !important;\r\n}\r\n\r\nbutton[class~="button-neutral"],\r\na[class~="button-neutral"] {\r\n border-color: var(--neutral-bolder-border-color) !important;\r\n}\r\n\r\nbutton[class~="button-neutral"] *,\r\na[class~="button-neutral"] * {\r\n color: var(--neutral-text-subtitle-color) !important;\r\n --color: var(--neutral-text-subtitle-color) !important;\r\n}\r\n\r\nbutton[class~="button-neutral"],\r\na[class~="button-neutral"] {\r\n border-color: var(--neutral-bolder-border-color) !important;\r\n}\r\n\r\nbutton[class~="button-black"] *,\r\na[class~="button-black"] * {\r\n color: var(--neutral-text-title-reverse-color) !important;\r\n --color: var(--neutral-text-title-reverse-color) !important;\r\n}\r\n\r\nbutton[class~="button-black"],\r\na[class~="button-black"] {\r\n background-color: var(--neutral-absolute-reverse-background-color) !important;\r\n border-color: var(--neutral-bolder-reverse-border-color) !important;\r\n}\r\n\r\nbutton[class~="button-white"] *,\r\na[class~="button-white"] * {\r\n color: var(--neutral-text-title-reverse-color) !important;\r\n --color: var(--neutral-text-title-reverse-color) !important;\r\n}\r\n\r\nbutton[class~="button-white"],\r\na[class~="button-white"] {\r\n background-color: var(--neutral-absolute-background-color) !important;\r\n border-color: var(--neutral-bolder-border-color) !important;\r\n}\r\n\r\nbutton[class~="button-infor"] *,\r\na[class~="button-infor"] * {\r\n color: var(--infor-main-color) !important;\r\n --color: var(--infor-main-color) !important;\r\n}\r\n\r\nbutton[class~="button-warning"],\r\na[class~="button-warning"] {\r\n border-color: var(--warning-main-color) !important;\r\n}\r\n\r\nbutton[class~="button-warning"] *,\r\na[class~="button-warning"] * {\r\n color: var(--warning-main-color) !important;\r\n --color: var(--warning-main-color) !important;\r\n}\r\n\r\nbutton[class~="button-error"],\r\na[class~="button-error"] {\r\n border-color: var(--error-main-color) !important;\r\n}\r\n\r\nbutton[class~="button-error"] *,\r\na[class~="button-error"] * {\r\n color: var(--error-main-color) !important;\r\n --color: var(--error-main-color) !important;\r\n}\r\n\r\nbutton[class~="button-success"],\r\na[class~="button-success"] {\r\n border-color: var(--success-main-color) !important;\r\n}\r\n\r\nbutton[class~="button-success"] *,\r\na[class~="button-success"] * {\r\n color: var(--success-main-color) !important;\r\n --color: var(--success-main-color) !important;\r\n}\r\n\r\nbutton[class~="button-infor-main"],\r\na[class~="button-infor-main"] {\r\n background-color: var(--infor-main-color) !important;\r\n border: var(--infor-main-color) !important;\r\n}\r\n\r\nbutton[class~="button-warning-main"],\r\na[class~="button-warning-main"] {\r\n background-color: var(--warning-main-color) !important;\r\n border: var(--warning-main-color) !important;\r\n}\r\n\r\nbutton[class~="button-error-main"],\r\na[class~="button-error-main"] {\r\n background-color: var(--error-main-color) !important;\r\n border: var(--error-main-color) !important;\r\n}\r\n\r\nbutton[class~="button-success-main"],\r\na[class~="button-success-main"] {\r\n background-color: var(--success-main-color) !important;\r\n border-color: var(--success-main-color) !important;\r\n}\r\n\r\nbutton[class~="button-infor-main"] *,\r\na[class~="button-infor-main"] *,\r\nbutton[class~="button-warning-main"] *,\r\na[class~="button-warning-main"] *,\r\nbutton[class~="button-error-main"] *,\r\na[class~="button-error-main"] *,\r\nbutton[class~="button-success-main"] *,\r\na[class~="button-success-main"] * {\r\n color: var(--neutral-text-stable-color) !important;\r\n --color: var(--neutral-text-stable-color) !important;\r\n}\r\n\r\nbutton.ka4cXi\\+gRf9k8IM\\+VV0C0Q\\=\\=:hover {\r\n opacity: 0.86;\r\n}\r\n\r\nbutton.ka4cXi\\+gRf9k8IM\\+VV0C0Q\\=\\=:focus {\r\n box-shadow: 0px 4px 20px 0px #0000001A inset;\r\n}\r\n\r\n.ka4cXi\\+gRf9k8IM\\+VV0C0Q\\=\\=:disabled {\r\n pointer-events: none;\r\n background-color: var(--neutral-disable-background-color, #dddde1) !important;\r\n border-color: var(--neutral-bolder-border-color, #D7D7DB) !important;\r\n}\r\n\r\n.ka4cXi\\+gRf9k8IM\\+VV0C0Q\\=\\=:disabled * {\r\n color: var(--neutral-text-disabled-color) !important;\r\n --color: var(--neutral-text-disabled-color) !important;\r\n}',""]),r.locals={"button-container":"ka4cXi+gRf9k8IM+VV0C0Q==","button-label":"qfduVuiygazk8UBdNdem7g=="};const s=r},378:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,".awssld__container figure,\r\n.awssld__content,\r\n.awssld__box {\r\n display: block;\r\n position: absolute;\r\n width: 100%;\r\n height: 100%;\r\n top: 0;\r\n left: 0;\r\n}\r\n\r\n.awssld__controls button,\r\n.awssld__bullets button {\r\n outline-color: 0;\r\n outline-style: none;\r\n outline-width: 0;\r\n}\r\n\r\n.awssld {\r\n --organic-arrow-thickness: 4px;\r\n --organic-arrow-height: 40px;\r\n --slider-height-percentage: 60%;\r\n --loader-bar-color: #851515;\r\n --loader-bar-height: 6px;\r\n --control-button-width: 10%;\r\n --control-button-height: 25%;\r\n --control-button-opacity: 0.5;\r\n --control-button-hover-opacity: 0.75;\r\n --control-button-background: transparent;\r\n --transition-bezier: cubic-bezier(0.5, 0.075, 0.25, 0.95);\r\n --slider-transition-duration: 575ms;\r\n --organic-arrow-color: #6a6a6a;\r\n --organic-arrow-border-radius: 0;\r\n --control-bullet-color: #6a6a6a;\r\n --control-bullet-active-color: #6a6a6a;\r\n --content-background-color: #2f2f2f;\r\n}\r\n\r\n.awssld {\r\n display: block;\r\n position: relative;\r\n width: 100%;\r\n max-width: 100%;\r\n}\r\n\r\n.awssld__wrapper {\r\n display: block;\r\n overflow: hidden;\r\n position: relative;\r\n height: 100%;\r\n width: 100%;\r\n}\r\n\r\n.awssld__container {\r\n display: block;\r\n width: 100%;\r\n height: 0;\r\n padding-bottom: var(--slider-height-percentage);\r\n}\r\n\r\n@media all and (max-width: 500px) {\r\n .awssld__container {\r\n padding-bottom: calc(var(--slider-height-percentage) * 1.25);\r\n }\r\n}\r\n\r\n.awssld__startUp {\r\n background-color: red;\r\n height: 100%;\r\n width: 100%;\r\n}\r\n\r\n.awssld__startUp>div {\r\n height: 100%;\r\n width: 100%;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n -webkit-box-pack: center;\r\n -ms-flex-pack: center;\r\n justify-content: center;\r\n}\r\n\r\n.awssld__startUp img {\r\n width: 35%;\r\n height: auto;\r\n}\r\n\r\n.awssld__content {\r\n background-color: var(--content-background-color);\r\n overflow: hidden;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n -webkit-box-pack: center;\r\n -ms-flex-pack: center;\r\n justify-content: center;\r\n}\r\n\r\n.awssld__content>img,\r\n.awssld__content>video {\r\n -o-object-fit: cover;\r\n object-fit: cover;\r\n width: 100%;\r\n height: 100%;\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n}\r\n\r\n.awssld__controls button {\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n -webkit-box-pack: center;\r\n -ms-flex-pack: center;\r\n justify-content: center;\r\n width: var(--control-button-width);\r\n height: var(--control-button-height);\r\n position: absolute;\r\n z-index: 10;\r\n top: calc(50% - (0.5 * var(--control-button-height)));\r\n border: none;\r\n background-color: var(--control-button-background);\r\n color: #fff;\r\n cursor: pointer;\r\n}\r\n\r\n.awssld__controls button .awssld__controls__arrow-left,\r\n.awssld__controls button .awssld__controls__arrow-right {\r\n opacity: var(--control-button-opacity);\r\n}\r\n\r\n.awssld__controls button:hover .awssld__controls__arrow-left,\r\n.awssld__controls button:hover .awssld__controls__arrow-right {\r\n opacity: var(--control-button-opacity-hover);\r\n}\r\n\r\n.awssld__controls--active .awssld__controls__arrow-left {\r\n opacity: var(--control-button-opacity-hover);\r\n -webkit-transform: translate3d(-100%, 0, 0);\r\n transform: translate3d(-100%, 0, 0);\r\n}\r\n\r\n.awssld__controls--active .awssld__controls__arrow-right {\r\n opacity: var(--control-button-opacity-hover);\r\n -webkit-transform: translate3d(100%, 0, 0);\r\n transform: translate3d(100%, 0, 0);\r\n}\r\n\r\n.awssld__controls--hidden {\r\n display: none;\r\n}\r\n\r\n@media all and (max-width: 520px) {\r\n .awssld__controls {\r\n visibility: hidden;\r\n }\r\n}\r\n\r\n.awssld__bar {\r\n display: block;\r\n width: 100%;\r\n height: var(--loader-bar-height);\r\n background-color: var(--loader-bar-color);\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n z-index: 101;\r\n -webkit-transition: -webkit-transform 3000ms var(--transition-bezier);\r\n transition: -webkit-transform 3000ms var(--transition-bezier);\r\n transition: transform 3000ms var(--transition-bezier);\r\n transition: transform 3000ms var(--transition-bezier), -webkit-transform 3000ms var(--transition-bezier);\r\n -webkit-transform: translate3d(-100%, 0, 0);\r\n transform: translate3d(-100%, 0, 0);\r\n}\r\n\r\n.awssld__bar--active {\r\n -webkit-transform: translate3d(-20%, 0, 0);\r\n transform: translate3d(-20%, 0, 0);\r\n}\r\n\r\n.awssld__bar--end {\r\n -webkit-transition-duration: 300ms;\r\n transition-duration: 300ms;\r\n -webkit-transform: translate3d(0, 0, 0);\r\n transform: translate3d(0, 0, 0);\r\n}\r\n\r\n.awssld__next {\r\n right: 0;\r\n}\r\n\r\n.awssld__prev {\r\n left: 0;\r\n}\r\n\r\n.awssld__box {\r\n z-index: 1;\r\n visibility: hidden;\r\n}\r\n\r\n.awssld--animated {\r\n will-change: transform;\r\n visibility: visible;\r\n}\r\n\r\n.awssld--animated-mobile {\r\n will-change: transform;\r\n -webkit-transition: -webkit-transform 325ms cubic-bezier(0.15, 0.65, 0.1, 1);\r\n transition: -webkit-transform 325ms cubic-bezier(0.15, 0.65, 0.1, 1);\r\n transition: transform 325ms cubic-bezier(0.15, 0.65, 0.1, 1);\r\n transition: transform 325ms cubic-bezier(0.15, 0.65, 0.1, 1), -webkit-transform 325ms cubic-bezier(0.15, 0.65, 0.1, 1);\r\n}\r\n\r\n.awssld--active {\r\n visibility: visible;\r\n z-index: 2;\r\n -webkit-transform: translate3d(0, 0, 0);\r\n transform: translate3d(0, 0, 0);\r\n}\r\n\r\n.awssld--moveRight,\r\n.awssld--moveLeft {\r\n -webkit-backface-visibility: hidden;\r\n backface-visibility: hidden;\r\n}\r\n\r\n.awssld--moveRight {\r\n -webkit-animation: slideFromRight var(--slider-transition-duration) both var(--transition-bezier);\r\n animation: slideFromRight var(--slider-transition-duration) both var(--transition-bezier);\r\n}\r\n\r\n.awssld--moveLeft {\r\n -webkit-animation: slideFromLeft var(--slider-transition-duration) both var(--transition-bezier);\r\n animation: slideFromLeft var(--slider-transition-duration) both var(--transition-bezier);\r\n}\r\n\r\n.awssld--exit {\r\n z-index: 0;\r\n}\r\n\r\n.awssld--exit.awssld--moveLeft {\r\n -webkit-animation: slideToLeft var(--slider-transition-duration) both var(--transition-bezier);\r\n animation: slideToLeft var(--slider-transition-duration) both var(--transition-bezier);\r\n}\r\n\r\n.awssld--exit.awssld--moveRight {\r\n -webkit-animation: slideToRight var(--slider-transition-duration) both var(--transition-bezier);\r\n animation: slideToRight var(--slider-transition-duration) both var(--transition-bezier);\r\n}\r\n\r\n.awssld--first .awssld__prev {\r\n visibility: hidden;\r\n}\r\n\r\n.awssld--last .awssld__next {\r\n visibility: hidden;\r\n}\r\n\r\n.awssld--fill-parent {\r\n position: absolute !important;\r\n width: 100% !important;\r\n height: 100% !important;\r\n top: 0;\r\n left: 0;\r\n}\r\n\r\n.awssld--fill-parent .awssld__container {\r\n height: 100%;\r\n padding: 0;\r\n}\r\n\r\n.awssld__bullets {\r\n position: absolute;\r\n bottom: -40px;\r\n width: 100%;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n -webkit-box-pack: center;\r\n -ms-flex-pack: center;\r\n justify-content: center;\r\n}\r\n\r\n.awssld__bullets button {\r\n padding: 0;\r\n display: block;\r\n width: 16px;\r\n height: 16px;\r\n margin: 5px;\r\n border-radius: 50%;\r\n background: var(--control-bullet-color);\r\n text-indent: -9999px;\r\n overflow: hidden;\r\n cursor: pointer;\r\n border: none;\r\n -webkit-transition: background-color 0.175s ease-out, -webkit-transform 0.225s cubic-bezier(0.8, 1.35, 0.75, 1.45);\r\n transition: background-color 0.175s ease-out, -webkit-transform 0.225s cubic-bezier(0.8, 1.35, 0.75, 1.45);\r\n transition: transform 0.225s cubic-bezier(0.8, 1.35, 0.75, 1.45), background-color 0.175s ease-out;\r\n transition: transform 0.225s cubic-bezier(0.8, 1.35, 0.75, 1.45), background-color 0.175s ease-out, -webkit-transform 0.225s cubic-bezier(0.8, 1.35, 0.75, 1.45);\r\n}\r\n\r\n.awssld__bullets button:hover {\r\n -webkit-transform: scale(1.2);\r\n transform: scale(1.2);\r\n}\r\n\r\n.awssld__bullets .awssld__bullets--loading {\r\n -webkit-transform: scale(1.2);\r\n transform: scale(1.2);\r\n}\r\n\r\n.awssld__bullets .awssld__bullets--active {\r\n -webkit-transform: scale(1.5);\r\n transform: scale(1.5);\r\n background: var(--control-bullet-active-color);\r\n}\r\n\r\n.awssld__bullets .awssld__bullets--active:hover {\r\n -webkit-transform: scale(1.5);\r\n transform: scale(1.5);\r\n}\r\n\r\n.awssld__controls__arrow-left,\r\n.awssld__controls__arrow-right {\r\n width: 100%;\r\n height: var(--organic-arrow-height);\r\n position: relative;\r\n display: block;\r\n -webkit-transition: opacity 0.2s ease-out, -webkit-transform 0.2s ease-out 0.125s;\r\n transition: opacity 0.2s ease-out, -webkit-transform 0.2s ease-out 0.125s;\r\n transition: transform 0.2s ease-out 0.125s, opacity 0.2s ease-out;\r\n transition: transform 0.2s ease-out 0.125s, opacity 0.2s ease-out, -webkit-transform 0.2s ease-out 0.125s;\r\n}\r\n\r\n.awssld__controls__arrow-left:before,\r\n.awssld__controls__arrow-left:after,\r\n.awssld__controls__arrow-right:before,\r\n.awssld__controls__arrow-right:after {\r\n content: ' ';\r\n position: absolute;\r\n right: calc(50% - (0.7071 * (var(--organic-arrow-height) + var(--organic-arrow-thickness))) / 2);\r\n height: 100%;\r\n border-radius: var(--organic-arrow-border-radius);\r\n width: var(--organic-arrow-thickness);\r\n background-color: var(--organic-arrow-color);\r\n -webkit-transition: background-color 0.15s ease-out, -webkit-transform 0.15s ease-out;\r\n transition: background-color 0.15s ease-out, -webkit-transform 0.15s ease-out;\r\n transition: transform 0.15s ease-out, background-color 0.15s ease-out;\r\n transition: transform 0.15s ease-out, background-color 0.15s ease-out, -webkit-transform 0.15s ease-out;\r\n}\r\n\r\n.awssld__controls__arrow-left:before,\r\n.awssld__controls__arrow-right:before {\r\n -webkit-transform-origin: 100% 100% 0;\r\n transform-origin: 100% 100% 0;\r\n top: -50%;\r\n -webkit-transform: rotate(-45deg);\r\n transform: rotate(-45deg);\r\n}\r\n\r\n.awssld__controls__arrow-left:after,\r\n.awssld__controls__arrow-right:after {\r\n -webkit-transform-origin: 100% 0% 0;\r\n transform-origin: 100% 0% 0;\r\n top: 50%;\r\n -webkit-transform: rotate(45deg);\r\n transform: rotate(45deg);\r\n}\r\n\r\n.awssld__controls__arrow-right--active {\r\n -webkit-transform: translate3d(100%, 0, 0);\r\n transform: translate3d(100%, 0, 0);\r\n}\r\n\r\n.awssld__controls__arrow-right--active:after {\r\n -webkit-transform: rotate(90deg) translate3d(50%, 0, 0) !important;\r\n transform: rotate(90deg) translate3d(50%, 0, 0) !important;\r\n}\r\n\r\n.awssld__controls__arrow-right--active:before {\r\n -webkit-transform: rotate(-90deg) translate3d(50%, 0, 0) !important;\r\n transform: rotate(-90deg) translate3d(50%, 0, 0) !important;\r\n}\r\n\r\n.awssld__controls__arrow-left:before,\r\n.awssld__controls__arrow-left:after {\r\n right: auto;\r\n left: calc(50% - (0.7071 * (var(--organic-arrow-height) + var(--organic-arrow-thickness))) / 2);\r\n}\r\n\r\n.awssld__controls__arrow-left:before {\r\n -webkit-transform-origin: 0 100% 0;\r\n transform-origin: 0 100% 0;\r\n top: -50%;\r\n -webkit-transform: rotate(45deg);\r\n transform: rotate(45deg);\r\n}\r\n\r\n.awssld__controls__arrow-left:after {\r\n -webkit-transform-origin: 0 0 0;\r\n transform-origin: 0 0 0;\r\n top: 50%;\r\n -webkit-transform: rotate(-45deg);\r\n transform: rotate(-45deg);\r\n}\r\n\r\n.awssld__controls__arrow-left--active {\r\n -webkit-transform: translate3d(-100%, 0, 0);\r\n transform: translate3d(-100%, 0, 0);\r\n}\r\n\r\n.awssld__controls__arrow-left--active:after {\r\n -webkit-transform: rotate(-90deg) translate3d(-50%, 0, 0) !important;\r\n transform: rotate(-90deg) translate3d(-50%, 0, 0) !important;\r\n}\r\n\r\n.awssld__controls__arrow-left--active:before {\r\n -webkit-transform: rotate(90deg) translate3d(-50%, 0, 0) !important;\r\n transform: rotate(90deg) translate3d(-50%, 0, 0) !important;\r\n}\r\n\r\n.awssld__controls button:hover .awssld__controls__arrow-left:before {\r\n opacity: 1;\r\n -webkit-transform: rotate(30deg);\r\n transform: rotate(30deg);\r\n}\r\n\r\n.awssld__controls button:hover .awssld__controls__arrow-left:after {\r\n opacity: 1;\r\n -webkit-transform: rotate(-30deg);\r\n transform: rotate(-30deg);\r\n}\r\n\r\n.awssld__controls button:hover .awssld__controls__arrow-right:before {\r\n opacity: 1;\r\n -webkit-transform: rotate(-30deg);\r\n transform: rotate(-30deg);\r\n}\r\n\r\n.awssld__controls button:hover .awssld__controls__arrow-right:after {\r\n opacity: 1;\r\n -webkit-transform: rotate(30deg);\r\n transform: rotate(30deg);\r\n}\r\n\r\n.awssld__timer {\r\n --timer-delay: 2000ms;\r\n --timer-release: 200ms;\r\n --timer-height: 4px;\r\n --timer-background-color: rgba(0, 0, 0, 0.15);\r\n width: 100%;\r\n height: var(--timer-height);\r\n background-color: var(--timer-background-color);\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n z-index: 100;\r\n -webkit-transform: translateX(-100%);\r\n transform: translateX(-100%);\r\n}\r\n\r\n.awssld__timer--animated {\r\n will-change: transform;\r\n -webkit-transition: -webkit-transform var(--timer-delay) linear;\r\n transition: -webkit-transform var(--timer-delay) linear;\r\n transition: transform var(--timer-delay) linear;\r\n transition: transform var(--timer-delay) linear, -webkit-transform var(--timer-delay) linear;\r\n}\r\n\r\n.awssld__timer--run {\r\n -webkit-transform: translateX(0);\r\n transform: translateX(0);\r\n}\r\n\r\n.awssld__timer--fast {\r\n -webkit-transition: -webkit-transform calc(var(--timer-release) / 2) linear;\r\n transition: -webkit-transform calc(var(--timer-release) / 2) linear;\r\n transition: transform calc(var(--timer-release) / 2) linear;\r\n transition: transform calc(var(--timer-release) / 2) linear, -webkit-transform calc(var(--timer-release) / 2) linear;\r\n -webkit-transform: translateX(-0.00001px);\r\n transform: translateX(-0.00001px);\r\n}\r\n\r\n.awssld__timer--end {\r\n -webkit-transform: translateX(-0.0001px);\r\n transform: translateX(-0.0001px);\r\n -webkit-transition: -webkit-transform var(--timer-release) linear;\r\n transition: -webkit-transform var(--timer-release) linear;\r\n transition: transform var(--timer-release) linear;\r\n transition: transform var(--timer-release) linear, -webkit-transform var(--timer-release) linear;\r\n}\r\n\r\n.awssld__timer--hidden {\r\n display: none;\r\n}\r\n\r\n@-webkit-keyframes slideFromLeft {\r\n from {\r\n -webkit-transform: translate3d(-100%, 0, 0);\r\n transform: translate3d(-100%, 0, 0);\r\n }\r\n\r\n to {\r\n -webkit-transform: translate3d(0, 0, 0);\r\n transform: translate3d(0, 0, 0);\r\n }\r\n}\r\n\r\n@keyframes slideFromLeft {\r\n from {\r\n -webkit-transform: translate3d(-100%, 0, 0);\r\n transform: translate3d(-100%, 0, 0);\r\n }\r\n\r\n to {\r\n -webkit-transform: translate3d(0, 0, 0);\r\n transform: translate3d(0, 0, 0);\r\n }\r\n}\r\n\r\n@-webkit-keyframes slideFromRight {\r\n from {\r\n -webkit-transform: translate3d(100%, 0, 0);\r\n transform: translate3d(100%, 0, 0);\r\n }\r\n\r\n to {\r\n -webkit-transform: translate3d(0, 0, 0);\r\n transform: translate3d(0, 0, 0);\r\n }\r\n}\r\n\r\n@keyframes slideFromRight {\r\n from {\r\n -webkit-transform: translate3d(100%, 0, 0);\r\n transform: translate3d(100%, 0, 0);\r\n }\r\n\r\n to {\r\n -webkit-transform: translate3d(0, 0, 0);\r\n transform: translate3d(0, 0, 0);\r\n }\r\n}\r\n\r\n@-webkit-keyframes slideToLeft {\r\n from {\r\n -webkit-transform: translate3d(0, 0, 0);\r\n transform: translate3d(0, 0, 0);\r\n }\r\n\r\n to {\r\n -webkit-transform: translate3d(-100%, 0, 0);\r\n transform: translate3d(-100%, 0, 0);\r\n }\r\n}\r\n\r\n@keyframes slideToLeft {\r\n from {\r\n -webkit-transform: translate3d(0, 0, 0);\r\n transform: translate3d(0, 0, 0);\r\n }\r\n\r\n to {\r\n -webkit-transform: translate3d(-100%, 0, 0);\r\n transform: translate3d(-100%, 0, 0);\r\n }\r\n}\r\n\r\n@-webkit-keyframes slideToRight {\r\n from {\r\n -webkit-transform: translate3d(0, 0, 0);\r\n transform: translate3d(0, 0, 0);\r\n }\r\n\r\n to {\r\n -webkit-transform: translate3d(100%, 0, 0);\r\n transform: translate3d(100%, 0, 0);\r\n }\r\n}\r\n\r\n@keyframes slideToRight {\r\n from {\r\n -webkit-transform: translate3d(0, 0, 0);\r\n transform: translate3d(0, 0, 0);\r\n }\r\n\r\n to {\r\n -webkit-transform: translate3d(100%, 0, 0);\r\n transform: translate3d(100%, 0, 0);\r\n }\r\n}\r\n\r\n.custom-slider-container {\r\n --content-background-color: #00000000 !important;\r\n}\r\n\r\n.custom-slider-container .awssld__content>* {\r\n width: 100%;\r\n height: 100%;\r\n}\r\n\r\n.custom-slider-container .awssld__controls button {\r\n padding: 2.4rem;\r\n width: fit-content;\r\n height: fit-content;\r\n top: 50%;\r\n transform: translateY(-50%);\r\n}",""]);const s=r},406:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,".comp-text {\r\n display: inline-block;\r\n -webkit-box-orient: vertical;\r\n -webkit-line-clamp: var(--max-line);\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n -webkit-box-pack: center;\r\n text-align: start;\r\n vertical-align: middle;\r\n display: -webkit-box;\r\n}\r\n\r\n.comp-text.type-button {\r\n cursor: pointer;\r\n}\r\n\r\n.comp-text.innerhtml * {\r\n -webkit-box-orient: vertical;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n text-align: inherit;\r\n margin: 0;\r\n padding: 0;\r\n font-family: inherit;\r\n font-size: inherit;\r\n -webkit-box-pack: inherit;\r\n}",""]);const s=r},486:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,'.cmry4h26x03StLoA3MxvDw\\=\\= {\r\n position: relative;\r\n border-radius: 0.4rem;\r\n border: var(--neutral-bolder-border);\r\n background-color: transparent;\r\n transition: border, background-color 0.4s;\r\n cursor: pointer;\r\n}\r\n\r\n.cmry4h26x03StLoA3MxvDw\\=\\=>input {\r\n position: absolute;\r\n opacity: 0;\r\n cursor: pointer;\r\n height: 0;\r\n width: 0;\r\n}\r\n\r\n.cmry4h26x03StLoA3MxvDw\\=\\=>svg {\r\n width: 100%;\r\n height: 100%;\r\n visibility: hidden;\r\n opacity: 0 !important;\r\n transition: visibility, opacity 0.4s;\r\n}\r\n\r\n.cmry4h26x03StLoA3MxvDw\\=\\=>svg>path {\r\n fill: var(--check-color, #fff);\r\n}\r\n\r\n.cmry4h26x03StLoA3MxvDw\\=\\=>input:checked~svg,\r\n.cmry4h26x03StLoA3MxvDw\\=\\=[is-null-value="true"]>svg {\r\n visibility: visible;\r\n opacity: 1 !important;\r\n}\r\n\r\n.cmry4h26x03StLoA3MxvDw\\=\\=:has(> input:checked),\r\n.cmry4h26x03StLoA3MxvDw\\=\\=[is-null-value="true"] {\r\n background-color: var(--primary-main-color);\r\n border: none !important;\r\n}\r\n\r\n.cmry4h26x03StLoA3MxvDw\\=\\=:has(> input:disabled) {\r\n background-color: var(--neutral-disable-background-color) !important;\r\n}\r\n\r\n.cmry4h26x03StLoA3MxvDw\\=\\=:has(> input:disabled)>svg>path {\r\n fill: var(--neutral-text-disabled-color) !important;\r\n}',""]),r.locals={"checkbox-container":"cmry4h26x03StLoA3MxvDw=="};const s=r},507:(e,t,n)=>{const i=n(659);function r(e,t){return function(n){return t(e(n))}}function s(e,t){const n=[t[e].parent,e];let s=i[t[e].parent][e],o=t[e].parent;for(;t[o].parent;)n.unshift(t[o].parent),s=r(i[t[o].parent][o],s),o=t[o].parent;return s.conversion=n,s}e.exports=function(e){const t=function(e){const t=function(){const e={},t=Object.keys(i);for(let n=t.length,i=0;i<n;i++)e[t[i]]={distance:-1,parent:null};return e}(),n=[e];for(t[e].distance=0;n.length;){const e=n.pop(),r=Object.keys(i[e]);for(let i=r.length,s=0;s<i;s++){const i=r[s],o=t[i];-1===o.distance&&(o.distance=t[e].distance+1,o.parent=e,n.unshift(i))}}return t}(e),n={},r=Object.keys(t);for(let e=r.length,i=0;i<e;i++){const e=r[i];null!==t[e].parent&&(n[e]=s(e,t))}return n}},528:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,'.L2Kf1P9pYC4Kvtz2Do5\\+3g\\=\\= {\r\n position: relative;\r\n box-sizing: border-box;\r\n padding: 0.8rem 1.5rem;\r\n border: var(--neutral-main-border);\r\n border-radius: 0.8rem;\r\n gap: 0.8rem;\r\n}\r\n\r\ninput::-webkit-outer-spin-button,\r\ninput::-webkit-inner-spin-button {\r\n -webkit-appearance: none;\r\n margin: 0;\r\n}\r\n\r\n.L2Kf1P9pYC4Kvtz2Do5\\+3g\\=\\=[class~="size48"] {\r\n padding: 1.2rem 1.5rem;\r\n}\r\n\r\n.L2Kf1P9pYC4Kvtz2Do5\\+3g\\=\\=[class~="size32"] {\r\n padding: 0.4rem 1.1rem;\r\n}\r\n\r\n.L2Kf1P9pYC4Kvtz2Do5\\+3g\\=\\=[class~="size24"] {\r\n padding: 0 0.7rem;\r\n}\r\n\r\n.L2Kf1P9pYC4Kvtz2Do5\\+3g\\=\\=:has(> input:disabled) {\r\n background-color: var(--neutral-disable-background-color) !important;\r\n color: var(--neutral-text-disabled-color) !important;\r\n pointer-events: none !important;\r\n}\r\n\r\n.L2Kf1P9pYC4Kvtz2Do5\\+3g\\=\\=:focus-within {\r\n border-color: var(--primary-main-color);\r\n}\r\n\r\n.L2Kf1P9pYC4Kvtz2Do5\\+3g\\=\\=>input {\r\n flex: 1;\r\n width: 100%;\r\n border: none;\r\n outline: none;\r\n padding: 0;\r\n background-color: transparent !important;\r\n font: inherit;\r\n color: inherit;\r\n font-size: inherit;\r\n font-family: inherit;\r\n font-weight: inherit;\r\n line-height: inherit;\r\n text-align: inherit;\r\n text-overflow: inherit;\r\n}\r\n\r\n.L2Kf1P9pYC4Kvtz2Do5\\+3g\\=\\=._5Wq4\\+\\+gX0k\\+tzISNkY7ARw\\=\\= {\r\n overflow: visible !important;\r\n border-color: var(--helper-text-color) !important;\r\n}\r\n\r\n.L2Kf1P9pYC4Kvtz2Do5\\+3g\\=\\=._5Wq4\\+\\+gX0k\\+tzISNkY7ARw\\=\\=::after {\r\n content: attr(helper-text);\r\n color: var(--helper-text-color);\r\n position: absolute;\r\n left: 0;\r\n bottom: -0.4rem;\r\n width: max-content;\r\n font-size: 1.2rem;\r\n line-height: 1.6rem;\r\n font-family: inherit;\r\n transform: translateY(100%);\r\n}',""]),r.locals={"text-field-container":"L2Kf1P9pYC4Kvtz2Do5+3g==","helper-text":"_5Wq4++gX0k+tzISNkY7ARw=="};const s=r},533:function(e,t,n){var i;i=function(e,t){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=5)}([function(e,t,n){"use strict";function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return s})),n.d(t,"c",(function(){return o}));var r=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),"undefined"!=typeof window&&(this.image=new Image,this.resolve=null,this.video=document.createElement("video"),this.events())}return function(e,t){t&&i(e.prototype,t)}(e,[{key:"events",value:function(){var e=this;this.video.addEventListener("loadeddata",(function(){return e.resolve&&e.resolve(!0)})),this.video.addEventListener("loadeddata",(function(){return e.resolve&&e.resolve(!1)})),this.image.onload=function(){return e.resolve&&e.resolve(!0)},this.image.onerror=function(){return e.resolve&&e.resolve(!1)}}},{key:"load",value:function(e){var t=this;return new Promise((function(n){e||n(!0),t.resolve=n,t.loading=!0,t.ended=!1,e.match(/\.(mp4|webm)/i)&&t.video.setAttribute("src",e),e.match(/\.(png|jp(e)?g|gif|webp)/i)&&(t.image.src=e,(t.image.width>0||t.image.height>0)&&n(!0))}))}},{key:"loadImage",value:function(e){var t=this,n=new Image,i=!1;n.onload=function(){i||t.pumpLoaded()},n.onerror=function(){i||t.pumpLoaded()},n.src=e,!1===i&&(n.width>0||n.height>0)&&(i=!0,this.pumpLoaded())}},{key:"loadVideo",value:function(e){var t=this,n=document.createElement("video");n.addEventListener("loadeddata",(function(){t.pumpLoaded()})),n.addEventListener("error",(function(){t.pumpLoaded()})),n.setAttribute("src",e)}},{key:"pumpLoaded",value:function(){this.loaded+=1,this.loaded===this.toLoad&&this.resolver(!0)}},{key:"startLoad",value:function(e){e.match(/\.(mp4|webm)/i)&&this.loadVideo(e),e.match(/\.(png|jp(e)?g|gif|webp)/i)&&this.loadImage(e)}},{key:"loadMultiple",value:function(e){var t=this;return this.loaded=0,this.toLoad=e.length,new Promise((function(n){t.resolver=n,e.forEach((function(e){t.startLoad(e)}))}))}}]),e}();function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;if(!t)return e.join(" ").trim();for(var n=[],i=e.length;i--;)t[e[i]]&&n.push(t[e[i]]);return n}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return t&&t[e]||e}},function(e,t,n){"use strict";n.d(t,"a",(function(){return a})),n.d(t,"b",(function(){return l})),n.d(t,"c",(function(){return c})),n.d(t,"e",(function(){return d})),n.d(t,"d",(function(){return u})),n.d(t,"g",(function(){return h})),n.d(t,"f",(function(){return m}));var i=n(0);function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=function(e,t){"string"==typeof t&&e&&t.split(" ").forEach((function(t){e.classList.add(t)}))},l=function(e,t){"string"==typeof t&&e&&t.split(" ").forEach((function(t){e.classList.remove(t)}))},c=function(e){return"string"==typeof e&&e.split(" ")[0]||""},d=function(e){var t=Array.isArray(e)?e:[e];if(1===t.length)return t[0];for(var n=s({},t[0]),i=1;i<t.length;i+=1){for(var r in n)t[i][r]&&(n[r]=[n[r],t[i][r]].join(" "));for(var o in t[i])n[o]||(n[o]=t[i][o])}return n};function u(e){var t,n=e.rootElement,r=e.cssModule,s=e.disabled,o=e.organicArrows,a=e.className,l=e.total,c=e.current,d=e.infinite,u=e.animation,h=e.fillParent,m=[n];return u&&m.push("".concat(n,"--").concat(u)),!0===o&&m.push("".concat(n,"--organic-arrows")),!0===s&&m.push("".concat(n,"--disabled")),h&&m.push("".concat(n,"--fill-parent")),!1===d&&(0===c&&m.push("".concat(n,"--first")),c===l-1&&m.push("".concat(n,"--last"))),r&&r[n]&&(m=Object(i.b)(m,r)),a&&(t=m).push.apply(t,function(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}(a.split(" "))),m.join(" ").trim().replace(/[\s]+/gi," ")}function h(e){var t=[];return(e.constructor===Array?e:[e]).forEach((function(e){var n=s({},e.props);e.props["data-src"]&&(n.source=e.props["data-src"]),e.props["data-slug"]&&(n.slug=e.props["data-slug"]),t.push(n)})),t}function m(e,t){return{boxA:Object(i.c)("".concat(e,"__boxA"),t),boxB:Object(i.c)("".concat(e,"__boxB"),t),box:Object(i.c)("".concat(e,"__box"),t),container:Object(i.c)("".concat(e,"__container"),t),wrapper:Object(i.c)("".concat(e,"__wrapper"),t),bar:Object(i.c)("".concat(e,"__bar"),t),barActive:Object(i.c)("".concat(e,"__bar--active"),t),barEnd:Object(i.c)("".concat(e,"__bar--end"),t),content:Object(i.c)("".concat(e,"__content"),t),contentStatic:Object(i.c)("".concat(e,"__content--static"),t),contentMoveLeft:Object(i.c)("".concat(e,"__content--moveLeft"),t),contentMoveRight:Object(i.c)("".concat(e,"__content--moveRight"),t),controlsHidden:Object(i.c)("".concat(e,"__controls--hidden"),t),controlsActive:Object(i.c)("".concat(e,"__controls--active"),t),animated:Object(i.c)("".concat(e,"--animated"),t),animatedMobile:Object(i.c)("".concat(e,"--animated-mobile"),t),contentExit:Object(i.c)("".concat(e,"__content--exit"),t),exit:Object(i.c)("".concat(e,"--exit"),t),active:Object(i.c)("".concat(e,"--active"),t),moveLeft:Object(i.c)("".concat(e,"--moveLeft"),t),moveRight:Object(i.c)("".concat(e,"--moveRight"),t),startUp:Object(i.c)("".concat(e,"__startUp"),t),bulletsLoading:Object(i.c)("".concat(e,"__bullets--loading"),t)}}},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){e.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function i(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.tolerance,r=void 0===i?0:i,s=n.propertyName;return new Promise((function(n){if(e){var i=null,o=t.charAt(0).toUpperCase()+t.slice(1),a=0;void 0!==e.style["Webkit"+o]&&(i="webkit"+o+"End"),void 0!==e.style.OTransition&&(i="o"+t+"End"),void 0!==e.style[t]&&(i=t+"end"),e.clearCssEndEvent&&e.clearCssEndEvent(),e.clearCssEndEvent=function(){e.removeEventListener(i,l)},e.addEventListener(i,l)}else n(!1);function l(t){if((t.srcElement||t.target)===e){if(a>=r){if(s&&s!==t.propertyName)return;e.removeEventListener(i,l),n(t)}a+=1}}}))}function r(e){window&&window.requestAnimationFrame((function(){window.requestAnimationFrame(e)}))}Object.defineProperty(t,"__esModule",{value:!0}),t.setCssEndEvent=i,t.beforeCssLayout=function(e){window&&window.requestAnimationFrame(e)},t.beforeNextCssLayout=r,t.beforeFutureCssLayout=function(e,t){!function e(t,n){window&&t&&Number.isInteger(t)&&t>0?window.requestAnimationFrame((function(){e(t-1,n)})):n()}(e+1,t)},t.onceNextCssLayout=function(){return new Promise((function(e){r(e)}))},t.onceTransitionEnd=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n){i(e,"transition",t).then(n)}))},t.onceAnimationEnd=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n){i(e,"animation",t).then(n)}))}}])},function(e,t,n){e.exports=n(13)},,,,,,,,function(e,t,n){"use strict";n.r(t);var i=n(3),r=n.n(i),s=n(2),o=n.n(s),a=n(4),l=n(0),c=n(1);function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var f=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t){return!t||"object"!==d(t)&&"function"!=typeof t?m(e):t}(this,h(t).call(this,e)),p(m(n),"bulletClick",(function(e){var t=e.currentTarget;t.classList.add(Object(l.c)("".concat(n.rootElement,"__bullets--loading"),n.props.cssModule));var i=parseInt(t.getAttribute("data-index"),10),r=!(n.props.selected>i);n.props.onClick({index:i,direction:r})})),n.rootElement=e.rootElement,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&g(e,t)}(t,e),function(e,t){t&&u(e.prototype,t)}(t,[{key:"renderBullets",value:function(){var e=this,t=this.props,n=t.cssModule,i=t.selected,s=t.media;return(void 0===s?[]:s).map((function(t,s){var o=s===i?Object(l.c)("".concat(e.rootElement,"__bullets--active"),n):null;return r.a.createElement("button",{key:"bullet-".concat(s),"data-index":s,onClick:e.bulletClick,className:o},s)}))}},{key:"render",value:function(){var e=this.props,t=e.cssModule,n=e.rootElement;return r.a.createElement("nav",{className:Object(l.c)("".concat(n,"__bullets"),t)},this.renderBullets())}}]),t}(r.a.Component);function b(e){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function w(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}p(f,"propTypes",{cssModule:o.a.object,rootElement:o.a.string.isRequired,media:o.a.array,onClick:o.a.func,selected:o.a.number}),p(f,"defaultProps",{cssModule:null,selected:0,media:[],onClick:function(){}});var k=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){return!t||"object"!==b(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,v(t).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&y(e,t)}(t,e),function(e,t){t&&w(e.prototype,t)}(t,[{key:"componentDidMount",value:function(){this.props.onMount({element:this.controls,next:this.next,prev:this.prev})}},{key:"render",value:function(){var e=this,t=this.props,n=t.rootElement,i=t.cssModule,s=t.organicArrows,o=t.buttonContentLeft,a=t.buttonContentRight,c=t.onNext,d=t.onPrev;return r.a.createElement("div",{ref:function(t){e.controls=t,e.props.onMount({element:e.controls,next:e.next||null,prev:e.prev||null})},className:[Object(l.c)("".concat(n,"__controls"),i),Object(l.c)("".concat(n,"__controls--hidden"),i)].join(" ")},r.a.createElement("button",{ref:function(t){e.next=t},"aria-label":"next",className:Object(l.c)("".concat(n,"__next"),i),onClick:c},s?r.a.createElement("span",{className:Object(l.c)("".concat(n,"__controls__arrow-right"),i)}):a),r.a.createElement("button",{ref:function(t){e.prev=t},"aria-label":"previous",className:Object(l.c)("".concat(n,"__prev"),i),onClick:d},s?r.a.createElement("span",{className:Object(l.c)("".concat(n,"__controls__arrow-left"),i)}):o))}}]),t}(r.a.Component);function x(e){return(x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function C(){return(C=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}function A(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function S(e,t){return(S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}_(k,"propTypes",{cssModule:o.a.object,rootElement:o.a.string.isRequired,onMount:o.a.func.isRequired,onNext:o.a.func.isRequired,onPrev:o.a.func.isRequired,buttonContentLeft:o.a.node,buttonContentRight:o.a.node,organicArrows:o.a.bool}),_(k,"defaultProps",{cssModule:null,organicArrows:!0,buttonContentLeft:null,buttonContentRight:null});var I=function(e){function t(){var e,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,r=new Array(i),s=0;s<i;s++)r[s]=arguments[s];return n=function(e,t){return!t||"object"!==x(t)&&"function"!=typeof t?T(e):t}(this,(e=E(t)).call.apply(e,[this].concat(r))),P(T(n),"state",{}),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&S(e,t)}(t,e),function(e,t){t&&A(e.prototype,t)}(t,[{key:"render",value:function(){var e=this.props,t=e.media,n=e.className,i=t.source,s=t.children,o=t.style,a=(t.loader,t["data-src"],t["data-alt"],t.className),l=(t.onTransitionEnd,t.onTransitionStartOut,t.onTransitionStartIn,t.onTransitionRequestOut,t.onTransitionRequestIn,function(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},s=Object.keys(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(t,["source","children","style","loader","data-src","data-alt","className","onTransitionEnd","onTransitionStartOut","onTransitionStartIn","onTransitionRequestOut","onTransitionRequestIn"])),c=null;return i&&(c=i.match(/\.(mp4|webm)/)?r.a.createElement("video",{title:t.title||t["data-title"],src:i,type:"video/mp4",controls:!0}):r.a.createElement("img",{alt:t.alt||t.title||t["data-alt"]||null,src:i})),r.a.createElement("div",C({className:n,style:o||null},l),c,s&&r.a.createElement("div",{className:a},t.children))}}]),t}(r.a.Component);function O(e){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function V(){return(V=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}function R(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function N(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function L(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?N(Object(n),!0).forEach((function(t){z(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function M(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function B(e){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function F(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function D(e,t){return(D=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function z(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}P(I,"propTypes",{media:o.a.object.isRequired,className:o.a.string.isRequired});var $="awssld",j=new l.a,H=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t){return!t||"object"!==O(t)&&"function"!=typeof t?F(e):t}(this,B(t).call(this,e)),z(F(n),"clickNext",(function(){var e=null===n.index?0:n.index+1;n.onTransitionRequest("next",e),n.goTo({index:e,direction:!0})})),z(F(n),"clickPrev",(function(){var e=n.index-1;n.onTransitionRequest("prev",e),n.goTo({index:e,direction:!1})})),z(F(n),"touchStart",(function(e){if(!n.animating&&null!==n.index){var t=e.nativeEvent;n.touchStartPoint=t.touches[0].clientX}})),z(F(n),"touchMove",(function(e){if(!n.animating&&n.touchStartPoint){var t=e.nativeEvent,i=t.touches[0].clientX-n.touchStartPoint,r=n[n.active],s=n[n.loader],o=!(i>0),a=Math.abs(i);!1!==n.touchEnabled?a>=10&&(!1===n.loading?n.goTo({index:o?n.index+1:n.index-1,direction:o,touch:!0}):!0===n.direction?(i+=10,Math.abs(i)>r.offsetWidth?i=-r.offsetWidth:i>0&&(i=0),r.style.transform="translate3d(".concat(i,"px, 0, 0)"),s.style.transform="translate3d(calc(100% + ".concat(i,"px), 0, 0)")):(i-=10,Math.abs(i)>r.offsetWidth?i=r.offsetWidth:i<0&&(i=0),r.style.transform="translate3d(".concat(i,"px, 0, 0)"),s.style.transform="translate3d(calc(-100% + ".concat(i,"px), 0, 0)"))):a>20&&(n.touchEnabled=!0,n.touchStartPoint=t.touches[0].clientX)}})),z(F(n),"touchEnd",(function(){!n.animating&&n.touchStartPoint&&n.loading&&(n.touchStartPoint=null,n.animating=!0,n.touchEnabled=!1,n.animateMobileEnd((function(){n.index=n.nextIndex,n.setState({index:n.index}),n.onTransitionEnd(),n.animating=!1,n.loading=!1,n.unchargeIndex()})))})),z(F(n),"bulletClick",(function(e){var t=e.currentTarget,i=parseInt(t.getAttribute("data-index"),10);n.goTo({index:i,direction:!(n.index>i)},(function(){Object(a.onceNextCssLayout)().then((function(){Object(c.a)(t,n.classNames.bulletsLoading)}))}))})),n.rootElement=e.rootElement||$,n.boxA=null,n.boxB=null,n.loaded=[],n.active="boxA",n.loader="boxB",n.nextIndex=null,n.loading=!1,n.media=null,n.started=!1,n.touchEnabled=!1,n.setupStartup(e),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&D(e,t)}(t,e),function(e,t){t&&M(e.prototype,t)}(t,[{key:"componentDidMount",value:function(){var e=this;Object(c.a)(this.boxA,this.classNames.active),this.props.startupScreen&&(this.buttons&&(Object(c.a)(this.buttons.element,this.classNames.controlsHidden),Object(c.a)(this.buttons.element,this.classNames.controlsActive)),!0===this.props.startup&&this.media.length>0&&this.startup()),this.props.onFirstMount&&this.props.onFirstMount(L({},this.getInfo())),this.buttons&&Object(a.onceNextCssLayout)().then((function(){e.buttons&&e.buttons.element&&Object(c.b)(e.buttons.element,e.classNames.controlsHidden)}))}},{key:"UNSAFE_componentWillReceiveProps",value:function(e){if(this.checkChildren(e),this.setupClassNames(Object(c.e)(e.cssModule)),e.name===this.props.name)if(!0!==e.startup||!1!==this.started)if(e.selected===this.props.selected)this.refreshSlider();else{var t=this.getIndex(e.selected),n=!0===e.infinite&&0===t&&this.index===this.media.length-1||!(this.index>t);this.goTo({index:t,direction:n})}else this.startup();else this.resetSlider(e.selected)}},{key:"onTransitionStart",value:function(){var e=this.media[this.index],t=this.media[this.nextIndex],n=L({},this.getInfo(),{nextSlide:this[this.loader],nextIndex:this.nextIndex,nextMedia:t});this.props.onTransitionStart&&this.props.onTransitionStart(n),e&&e.onTransitionStartOut&&e.onTransitionStartOut(n),t&&t.onTransitionStartIn&&t.onTransitionStartIn(n)}},{key:"onTransitionRequest",value:function(e,t){var n=this.media[this.index],i=this.checkIndex(t),r=this.media[i],s=L({eventName:e},this.getInfo(),{nextSlide:null,nextIndex:i,nextMedia:r});this.props.onTransitionRequest&&this.props.onTransitionRequest(s),n&&n.onTransitionRequestOut&&n.onTransitionRequestOut(s),r&&r.onTransitionRequestIn&&r.onTransitionRequestIn(s)}},{key:"onTransitionEnd",value:function(){var e=this.media[this.index],t=L({},this.getInfo());this.props.onTransitionEnd&&this.props.onTransitionEnd(t),e&&e.onTransitionEnd&&e.onTransitionEnd(t)}},{key:"getRootClassName",value:function(){var e=this.props,t=e.animation,n=e.className,i=e.cssModule,r=e.disabled,s=e.fillParent,o=e.infinite,a=e.organicArrows;return Object(c.d)({animation:t,className:n,cssModule:Object(c.e)(i),current:this.state.index,disabled:r,fillParent:s,infinite:o,organicArrows:a,rootElement:this.rootElement,total:this.media.length})}},{key:"setupStartup",value:function(e){if(this.checkChildren(e),this.setupClassNames(Object(c.e)(e.cssModule)),e.startupScreen){var t=this.getIndex(this.props.selected);this.index=null,this.state={index:this.index,boxA:{className:this.classNames.startUp,children:e.startupScreen},boxB:this.media[t]||null}}else this.started=!0,this.index=this.getIndex(this.props.selected),this.state={index:this.index,boxA:this.media[this.index]||null,boxB:null}}},{key:"getInfo",value:function(){return{slides:this.media.length,currentIndex:this.index,currentSlide:this[this.active],currentMedia:this.media[this.index],element:this.slider}}},{key:"getProgressBar",value:function(){if(!document)return{};var e=document.createElement("div");return e.className=this.classNames.bar,e}},{key:"setupClassNames",value:function(e){this.classNames=Object(c.f)(this.rootElement,e)}},{key:"getIndex",value:function(e){var t=0;return"number"==typeof e?e:("string"==typeof e&&this.media.forEach((function(n,i){n.slug===e&&(t=i)})),t)}},{key:"refreshSlider",value:function(){var e;if(!0!==this.loading&&!1!==this.props.startup&&null!==this.index){var t=this.index;this.setState((z(e={index:t},this.active,this.media[this.getIndex(t)]),z(e,this.loader,null),e))}}},{key:"startup",value:function(){var e=this;this.started=!0,setTimeout((function(){e.goTo({index:e.props.selected,direction:!0,touch:!1})}),this.props.startupDelay||75)}},{key:"resetSlider",value:function(){var e,t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.index=n,this.setState((z(e={index:n},this.active,this.media[this.getIndex(n)]),z(e,this.loader,null),e),(function(){t.props.onResetSlider&&t.props.onResetSlider(L({},t.getInfo()))}))}},{key:"checkChildren",value:function(e){e.children&&(e.children!==this.props.children||this.props.children&&!this.media)?this.media=Object(c.g)(e.children):e.media&&e.media.length?this.media=e.media:this.media||(this.media=[])}},{key:"startBarAnimation",value:function(e){var t=this,n=e.active;return new Promise((function(e){t.bar=t.getProgressBar(),n.appendChild(t.bar),Object(a.onceNextCssLayout)().then((function(){Object(a.onceNextCssLayout)().then((function(){Object(c.a)(t.bar,t.classNames.barActive),e()}))}))}))}},{key:"endBarAnimation",value:function(e){var t=this;this.bar&&Object(a.onceNextCssLayout)().then((function(){Object(a.onceTransitionEnd)(t.bar).then((function(){e()})),Object(c.a)(t.bar,t.classNames.barEnd)}))}},{key:"loadContent",value:function(e,t){var n=this;return new Promise((function(i,r){if(n.props.onLoadStart||t&&t.onLoadStart){var s=n.props.onLoadStart||t&&t.onLoadStart;return n.startBarAnimation({active:e}),void s(L({next:function(){n.endBarAnimation((function(){i(n.bar)}))},error:r},n.getInfo()))}if(t&&(t.source||t.preload)){var o=t.preload?t.preload:t.source&&[t.source]||[];return!0===n.checkLoadedUrls(o)?void i(null):(n.startBarAnimation({active:e}),void j.loadMultiple(o).then((function(){n.pushLoaded(o),n.endBarAnimation((function(){i(n.bar)}))})))}i(null)}))}},{key:"pushLoaded",value:function(e){this.loaded=[].concat(R(this.loaded),R(e))}},{key:"checkLoadedUrls",value:function(e){var t=this,n=!0;return e.forEach((function(e){t.loaded.includes(e)||(n=!1)})),n}},{key:"startAnimationMobile",value:function(){var e=this.direction,t=this[this.active],n=this[this.loader],i=e?this.classNames.contentMoveRight:this.classNames.contentMoveLeft,r=e?this.classNames.contentMoveLeft:this.classNames.contentMoveRight;this.props.onTransitionStart&&this.props.onTransitionStart(L({},this.getInfo(),{nextSlide:this[this.loader],nextIndex:this.nextIndex,nextMedia:this.media[this.nextIndex]}));var s=t.querySelector(".".concat(Object(c.c)(this.classNames.content)));Object(c.a)(s,r),Object(c.a)(s,this.classNames.contentExit);var o=n.querySelector(".".concat(Object(c.c)(this.classNames.content)));Object(c.a)(o,i),Object(c.a)(o,this.classNames.contentStatic),Object(c.a)(t,this.classNames.animated),Object(c.a)(n,this.classNames.animated)}},{key:"animateMobileEnd",value:function(e){var t=this,n=this.direction,i=this[this.active],r=this[this.loader],s=n?this.classNames.moveLeft:this.classNames.moveRight,o=n?this.classNames.contentMoveRight:this.classNames.contentMoveLeft,l=n?this.classNames.contentMoveLeft:this.classNames.contentMoveRight,d=r.querySelector(".".concat(Object(c.c)(this.classNames.content))),u=i.querySelector(".".concat(Object(c.c)(this.classNames.content)));Object(c.b)(d,this.classNames.contentStatic),Object(c.a)(r,this.classNames.animatedMobile),Object(c.a)(i,this.classNames.animatedMobile),Object(a.onceNextCssLayout)().then((function(){r.style.transform="translate3d(0, 0, 0)",i.style.transform="translate3d(".concat(t.direction?"-":"","100%, 0, 0)"),Object(a.onceTransitionEnd)(i).then((function(){t.loading&&(Object(c.b)(i,t.classNames.animated),Object(c.b)(r,t.classNames.animated),Object(c.a)(r,t.classNames.active),Object(c.b)(i,t.classNames.active),Object(c.b)(i,s),Object(c.b)(r,t.classNames.animatedMobile),Object(c.b)(i,t.classNames.animatedMobile),Object(c.b)(u,l),Object(c.b)(u,t.classNames.contentExit),Object(c.b)(d,o),t.buttons&&setTimeout((function(){t.buttons&&Object(c.b)(t.buttons.element,t.classNames.controlsActive)}),t.props.controlsReturnDelay),t.activeArrow&&(Object(c.b)(t.activeArrow,t.activeArrowClass),t.activeArrow=null,t.activeArrowClass=null),t.active="boxA"===t.active?"boxB":"boxA",t.loader="boxA"===t.active?"boxB":"boxA",e&&e())}))}))}},{key:"runAnimation",value:function(e){var t=this,n=e.active,i=e.media,r=e.contentExitMoveClass,s=e.contentEnterMoveClass,o=e.activeContentElement,l=e.loaderContentElement,d=e.loader,u=e.loaderPosition,h=e.exitPosition,m=e.callback,g=e.transitionDelay;this.loadContent(n,i).then((function(e){Object(c.a)(o,r),Object(c.a)(o,t.classNames.contentExit),Object(c.a)(l,s),Object(c.a)(l,t.classNames.contentStatic),setTimeout((function(){Object(a.onceNextCssLayout)().then((function(){Object(c.a)(n,t.classNames.animated),Object(c.a)(d,t.classNames.animated),Object(c.b)(l,t.classNames.contentStatic),Object(c.a)(n,t.classNames.exit),Object(c.a)(d,u),Object(c.a)(n,h),Object(a.onceAnimationEnd)(n).then((function(){Object(c.a)(d,t.classNames.active),Object(c.b)(d,u),Object(c.b)(d,t.classNames.animated),Object(c.b)(n,t.classNames.animated),Object(c.b)(n,t.classNames.active),Object(c.b)(n,h),Object(c.b)(n,t.classNames.exit),Object(c.b)(o,r),Object(c.b)(o,t.classNames.contentExit),Object(c.b)(l,s),e&&n.removeChild(e),t.buttons&&setTimeout((function(){t.buttons&&Object(c.b)(t.buttons.element,t.classNames.controlsActive)}),t.props.controlsReturnDelay),t.active="boxA"===t.active?"boxB":"boxA",t.loader="boxA"===t.active?"boxB":"boxA";var i=!t.activeArrow;t.activeArrow&&(Object(a.onceTransitionEnd)(t.activeArrow,{tolerance:null===t.index?0:2}).then((function(){t.releaseTransition()})),Object(c.b)(t.activeArrow,t.activeArrowClass),t.activeArrow=null,t.activeArrowClass=null),m({release:i})}))}))}),g)}))}},{key:"releaseTransition",value:function(){this.loading=!1}},{key:"startAnimation",value:function(e,t,n){var i=this.props.transitionDelay,r=this[this.active],s=this[this.loader],o=e?this.classNames.moveRight:this.classNames.moveLeft,a=e?this.classNames.moveLeft:this.classNames.moveRight,l=e?this.classNames.contentMoveRight:this.classNames.contentMoveLeft,d=e?this.classNames.contentMoveLeft:this.classNames.contentMoveRight,u=r.querySelector(".".concat(Object(c.c)(this.classNames.content))),h=s.querySelector(".".concat(Object(c.c)(this.classNames.content)));r.style.removeProperty("transform"),s.style.removeProperty("transform"),this.onTransitionStart();var m={active:r,media:t,contentExitMoveClass:d,contentEnterMoveClass:l,activeContentElement:u,loaderContentElement:h,loader:s,loaderPosition:o,exitPosition:a,callback:n,transitionDelay:i};this.runAnimation(m)}},{key:"goTo",value:function(e){var t=this,n=e.index,i=e.direction,r=e.touch,s=void 0!==r&&r,o=this.getIndex(n);!0!==this.loading&&n!==this.index?(this.loading=!0,this.direction=i,!0!==s?this.activateArrows(i,(function(){t.chargeIndex(o,(function(e){t.renderedLoader=!0,t.startAnimation(i,e,(function(e){var n=e.release,i=void 0===n||n;t.index=t.nextIndex,t.setState({index:t.index},(function(){t.onTransitionEnd(),!0===i&&t.releaseTransition()}))}))}))})):this.chargeIndex(o,(function(){t.activateArrows(i),t.startAnimationMobile()}))):this.props.onTransitionReject&&this.props.onTransitionReject(L({},this.getInfo(),{forceTransition:function(){t.goTo({index:n,direction:i,touch:s})}}))}},{key:"checkIndex",value:function(e){return e>this.media.length-1?0:e<0?this.media.length-1:e}},{key:"chargeIndex",value:function(e,t){this.nextIndex=this.checkIndex(e);var n={},i=this.media[this.nextIndex];n[this.loader]=L({loader:!0},i),this.setState(n,(function(){t(i)}))}},{key:"unchargeIndex",value:function(){var e={};e[this.loader]=null,this.setState(e,(function(){}))}},{key:"activateArrows",value:function(e,t){var n=e?"right":"left",i=Object(c.e)(this.props.cssModule),r=Object(c.c)(Object(l.c)("".concat(this.rootElement,"__controls__arrow-").concat(n),i));if(this.buttons){var s=e?this.buttons.next:this.buttons.prev;this.activeArrow=s.querySelector(".".concat(r))}!this.activeArrow||this.buttons&&this.buttons.element&&this.buttons.element.classList.contains(this.classNames.controlsActive)?t&&t():(this.activeArrowClass=Object(l.c)("".concat(this.rootElement,"__controls__arrow-").concat(n,"--active"),i),Object(a.onceTransitionEnd)(this.activeArrow,{tolerance:null===this.index?0:2}).then((function(){t&&t()})),this.buttons&&this.buttons.element&&(Object(c.a)(this.buttons.element,this.classNames.controlsActive),Object(c.a)(this.activeArrow,this.activeArrowClass)))}},{key:"renderBox",value:function(e){var t=this,n={};return this.props.mobileTouch&&(n.onTouchStart=this.touchStart,n.onTouchMove=this.touchMove,n.onTouchEnd=this.touchEnd),r.a.createElement("div",V({ref:function(n){t["box".concat(e)]=n},className:this.classNames.box},n),this.state["box".concat(e)]&&r.a.createElement(I,{media:this.state["box".concat(e)],className:this.classNames.content}))}},{key:"render",value:function(){var e=this,t=this.props,n=t.cssModule,i=t.organicArrows,s=t.bullets,o=t.style,a=t.customContent,l=t.buttons,d=t.buttonContentLeft,u=t.buttonContentRight,h=this.rootElement;return r.a.createElement("div",{ref:function(t){e.slider=t},className:this.getRootClassName(),style:o},r.a.createElement("div",{ref:function(t){e.wrapper=t},className:this.classNames.wrapper},r.a.createElement("div",{ref:function(t){e.container=t},className:this.classNames.container},this.renderBox("A"),this.renderBox("B")),l&&r.a.createElement(k,{rootElement:h,cssModule:Object(c.e)(n),onMount:function(t){e.buttons=t},onNext:this.clickNext,onPrev:this.clickPrev,organicArrows:i,buttonContentLeft:d,buttonContentRight:u}),a),s&&r.a.createElement(f,{cssModule:Object(c.e)(n),rootElement:h,media:this.media,selected:this.state.index,onClick:function(t){e.onTransitionRequest("bullet",t.index),e.goTo(t)}}))}}]),t}(r.a.Component);z(H,"propTypes",{animation:o.a.string,bullets:o.a.bool,buttonContentLeft:o.a.node,buttonContentRight:o.a.node,buttons:o.a.bool,children:o.a.node,className:o.a.string,controlsReturnDelay:o.a.number,cssModule:o.a.any,customContent:o.a.node,onLoadStart:o.a.func,disabled:o.a.bool,fillParent:o.a.bool,infinite:o.a.bool,media:o.a.array,name:o.a.string,onFirstMount:o.a.func,onResetSlider:o.a.func,onStartupRelease:o.a.func,onTransitionEnd:o.a.func,onTransitionRequest:o.a.func,onTransitionStart:o.a.func,organicArrows:o.a.bool,rootElement:o.a.string,selected:o.a.any,startup:o.a.bool,startupDelay:o.a.number,startupScreen:o.a.object,style:o.a.object,transitionDelay:o.a.number,mobileTouch:o.a.bool}),z(H,"defaultProps",{animation:null,bullets:!0,buttonContentLeft:null,buttonContentRight:null,buttons:!0,children:null,className:null,controlsReturnDelay:0,cssModule:null,customContent:null,onLoadStart:null,disabled:!1,fillParent:!1,infinite:!0,media:[],name:"awesome-slider",onFirstMount:null,onResetSlider:null,onStartupRelease:null,onTransitionEnd:null,onTransitionRequest:null,onTransitionStart:null,organicArrows:!0,rootElement:$,selected:0,startup:!0,startupDelay:0,startupScreen:null,style:{},transitionDelay:0,mobileTouch:!0}),t.default=H}])},e.exports=i(n(556),n(12))},542:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,".dNHXGu4ikoxNNqycYmQNXw\\=\\= {\r\n padding: 0.8rem 1.6rem;\r\n gap: 0.4rem;\r\n border-radius: 0.8rem;\r\n text-align: start;\r\n}\r\n\r\n.dNHXGu4ikoxNNqycYmQNXw\\=\\=>._9gsKxwDVQPs85o7r-BiHsw\\=\\= {\r\n padding: 0.5rem;\r\n margin-right: 0.8rem;\r\n border-radius: 50%;\r\n border: 1px dashed var(--neutral-text-subtitle-color)\r\n}\r\n\r\n.dNHXGu4ikoxNNqycYmQNXw\\=\\=>.AepH-WMVxygnaOkt-VFTRg\\=\\= {\r\n flex: 1;\r\n width: 100%;\r\n font: inherit;\r\n color: inherit;\r\n font-size: inherit;\r\n font-family: inherit;\r\n font-weight: inherit;\r\n line-height: inherit;\r\n text-align: inherit;\r\n text-overflow: inherit;\r\n}\r\n\r\n.dNHXGu4ikoxNNqycYmQNXw\\=\\=>input {\r\n outline: none;\r\n border: none;\r\n background-color: transparent !important;\r\n}\r\n\r\n.dNHXGu4ikoxNNqycYmQNXw\\=\\=>._9gsKxwDVQPs85o7r-BiHsw\\=\\=+.AepH-WMVxygnaOkt-VFTRg\\=\\= {\r\n width: calc(100% - 0.8rem);\r\n}\r\n\r\n.dNHXGu4ikoxNNqycYmQNXw\\=\\=:has(>input) {\r\n padding: 0.7rem 1.6rem;\r\n border: var(--neutral-main-border);\r\n}\r\n\r\n.dNHXGu4ikoxNNqycYmQNXw\\=\\=:has(>input):focus-within {\r\n border-color: var(--primary-main-color);\r\n}\r\n\r\n.dNHXGu4ikoxNNqycYmQNXw\\=\\=:has(> input:disabled),\r\n.dNHXGu4ikoxNNqycYmQNXw\\=\\=:disabled {\r\n background-color: var(--neutral-disable-background-color) !important;\r\n pointer-events: none !important;\r\n}\r\n\r\nbutton.dNHXGu4ikoxNNqycYmQNXw\\=\\=:hover {\r\n background-color: var(--neutral-hover-background-color);\r\n}\r\n\r\nbutton.dNHXGu4ikoxNNqycYmQNXw\\=\\=:focus {\r\n box-shadow: 0px 4px 20px 0px #0000001A inset;\r\n}\r\n\r\n.dNHXGu4ikoxNNqycYmQNXw\\=\\=.ABt4W-E7yJ08\\+1Hkranm1g\\=\\= {\r\n position: relative;\r\n overflow: visible !important;\r\n border-color: var(--helper-text-color) !important;\r\n}\r\n\r\n.dNHXGu4ikoxNNqycYmQNXw\\=\\=.ABt4W-E7yJ08\\+1Hkranm1g\\=\\=::after {\r\n content: attr(helper-text);\r\n color: var(--helper-text-color);\r\n position: absolute;\r\n left: 0;\r\n bottom: -0.4rem;\r\n width: max-content;\r\n font-size: 1.2rem;\r\n line-height: 1.6rem;\r\n font-family: inherit;\r\n transform: translateY(100%);\r\n}\r\n\r\n.AOmQxeg60FMsQGUMZoxOWQ\\=\\= {\r\n padding: 0.4rem 0;\r\n max-height: 28rem;\r\n min-width: 10rem;\r\n background-color: var(--neutral-absolute-background-color);\r\n}\r\n\r\n.AOmQxeg60FMsQGUMZoxOWQ\\=\\=>button {\r\n padding: 0.8rem;\r\n gap: 0.8rem;\r\n}\r\n\r\n.AOmQxeg60FMsQGUMZoxOWQ\\=\\=>button:hover {\r\n background-color: var(--neutral-hover-background-color);\r\n}",""]),r.locals={"date-time-picker":"dNHXGu4ikoxNNqycYmQNXw==","prefix-icon":"_9gsKxwDVQPs85o7r-BiHsw==",value:"AepH-WMVxygnaOkt-VFTRg==","helper-text":"ABt4W-E7yJ08+1Hkranm1g==","popup-actions":"AOmQxeg60FMsQGUMZoxOWQ=="};const s=r},544:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,".kTWkcsigv8cyJAWINlclmg\\=\\= {\r\n width: 100%;\r\n height: 100%;\r\n justify-content: space-between;\r\n gap: 1.6rem;\r\n}\r\n\r\n.kTWkcsigv8cyJAWINlclmg\\=\\=>.RCVZBDfGhcWhy6SeWWhYGQ\\=\\= {\r\n gap: 1.6rem;\r\n height: 100%;\r\n}\r\n\r\n.YYqYcAevZD7I6NUAWbRPPw\\=\\= {\r\n gap: 8px;\r\n height: 100%;\r\n}\r\n\r\n.BynbHf09Ra3ArZl6JRdR9g\\=\\= {\r\n gap: 0.8rem;\r\n}\r\n\r\n.BynbHf09Ra3ArZl6JRdR9g\\=\\=>li {\r\n width: 2.4rem;\r\n height: 2.4rem;\r\n color: #161C2499;\r\n justify-content: center;\r\n border-radius: 0.4rem;\r\n font-weight: 600;\r\n}\r\n\r\n.BynbHf09Ra3ArZl6JRdR9g\\=\\=>li * {\r\n color: inherit;\r\n font: inherit;\r\n font-size: inherit;\r\n font-family: inherit;\r\n line-height: inherit;\r\n font-weight: inherit;\r\n text-align: inherit;\r\n letter-spacing: inherit;\r\n}\r\n\r\n.BynbHf09Ra3ArZl6JRdR9g\\=\\=>li._1so4zD5hK\\+PcQrGBq\\+ZA-w\\=\\= {\r\n background-color: var(--infor-background);\r\n}\r\n\r\n.BynbHf09Ra3ArZl6JRdR9g\\=\\=>li._1so4zD5hK\\+PcQrGBq\\+ZA-w\\=\\= {\r\n color: var(--infor-main-color);\r\n}",""]),r.locals={"custom-pagination":"kTWkcsigv8cyJAWINlclmg==",row:"RCVZBDfGhcWhy6SeWWhYGQ==","items-per-page-container":"YYqYcAevZD7I6NUAWbRPPw==",pagination:"BynbHf09Ra3ArZl6JRdR9g==",active:"_1so4zD5hK+PcQrGBq+ZA-w=="};const s=r},556:(e,t,n)=>{e.exports=n(313)()},602:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,'.rkiZaeA9pT1\\+XLUsJX3paA\\=\\= {\r\n position: relative;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n\r\n.rkiZaeA9pT1\\+XLUsJX3paA\\=\\= input {\r\n display: none;\r\n}\r\n\r\n.rkiZaeA9pT1\\+XLUsJX3paA\\=\\=:has(input:disabled) {\r\n background-color: var(--neutral-disable-background-color) !important;\r\n pointer-events: none !important;\r\n}\r\n\r\n.rkiZaeA9pT1\\+XLUsJX3paA\\=\\=:not(.pjZA2KBN60wV-jVoregDKA\\=\\=) {\r\n max-width: 57rem;\r\n padding: 2.4rem;\r\n gap: 1.6rem;\r\n border-radius: 0.8rem;\r\n border: var(--neutral-bolder-border);\r\n}\r\n\r\n.rkiZaeA9pT1\\+XLUsJX3paA\\=\\=:not(.pjZA2KBN60wV-jVoregDKA\\=\\=):has(svg.k4s7rLMNvmIj5hX3T3\\+VPA\\=\\=) {\r\n border-style: dashed;\r\n}\r\n\r\n.rkiZaeA9pT1\\+XLUsJX3paA\\=\\=>.dJWpnWTERKd3gMA43bIq6w\\=\\=:not(*:has(>img)) {\r\n width: 4.8rem;\r\n height: 4.8rem;\r\n border-radius: 50%;\r\n}\r\n\r\n.rkiZaeA9pT1\\+XLUsJX3paA\\=\\=>.dJWpnWTERKd3gMA43bIq6w\\=\\= {\r\n background-color: var(--primary-background);\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n\r\n.rkiZaeA9pT1\\+XLUsJX3paA\\=\\=>.dJWpnWTERKd3gMA43bIq6w\\=\\=>img {\r\n max-width: 14rem;\r\n max-height: 8.8rem;\r\n border-radius: 0.8rem;\r\n}\r\n\r\n.rkiZaeA9pT1\\+XLUsJX3paA\\=\\=>.dFLwOeLGmBvdKpsI37iujQ\\=\\= {\r\n max-width: 100%;\r\n flex: 1;\r\n row-gap: 0.4rem;\r\n align-items: start;\r\n}\r\n\r\n.rkiZaeA9pT1\\+XLUsJX3paA\\=\\=.T2FEEcEIyCuLbEVQnzCXdA\\=\\=>.dFLwOeLGmBvdKpsI37iujQ\\=\\= {\r\n align-items: center;\r\n}\r\n\r\n.Ab7lmdFwzH-FSKZyTX4nSQ\\=\\= {\r\n width: 1.6rem;\r\n height: 1.6rem;\r\n margin-left: 0.6rem;\r\n}\r\n\r\ndiv[class*="Toastify__toast-body"]>div:last-child {\r\n font: 500 1.2rem/1.6rem;\r\n}\r\n\r\n.rkiZaeA9pT1\\+XLUsJX3paA\\=\\=.f7Py9c4FvR08Rq5w5Bdsqw\\=\\= {\r\n overflow: visible !important;\r\n border-color: var(--helper-text-color) !important;\r\n}\r\n\r\n.rkiZaeA9pT1\\+XLUsJX3paA\\=\\=.f7Py9c4FvR08Rq5w5Bdsqw\\=\\=::after {\r\n content: attr(helper-text);\r\n color: var(--helper-text-color);\r\n position: absolute;\r\n left: 0;\r\n bottom: -0.4rem;\r\n width: max-content;\r\n font-size: 1.2rem;\r\n line-height: 1.6rem;\r\n font-family: inherit;\r\n transform: translateY(100%);\r\n}',""]),r.locals={"import-file-container":"rkiZaeA9pT1+XLUsJX3paA==","button-only":"pjZA2KBN60wV-jVoregDKA==","preview-icon":"k4s7rLMNvmIj5hX3T3+VPA==","import-file-prefix":"dJWpnWTERKd3gMA43bIq6w==","file-preview-content":"dFLwOeLGmBvdKpsI37iujQ==",col:"T2FEEcEIyCuLbEVQnzCXdA==","remove-preview-file":"Ab7lmdFwzH-FSKZyTX4nSQ==","helper-text":"f7Py9c4FvR08Rq5w5Bdsqw=="};const s=r},622:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,".mRLkqF4t6D37R2Q92JN0yQ\\=\\= {\r\n row-gap: 1.2rem;\r\n width: 38.2rem;\r\n}\r\n\r\n.mRLkqF4t6D37R2Q92JN0yQ\\=\\=>.ENbMZZe8dWufoWnR6lIS0w\\=\\= {\r\n justify-content: space-between;\r\n width: 100%;\r\n}\r\n\r\n.mRLkqF4t6D37R2Q92JN0yQ\\=\\=>.euudZoQFbdOsRYwZj1hxKw\\=\\= {\r\n column-gap: 1.6rem;\r\n width: 100%;\r\n height: 2.2rem;\r\n}\r\n\r\n.mRLkqF4t6D37R2Q92JN0yQ\\=\\=>.euudZoQFbdOsRYwZj1hxKw\\=\\=>.tfqNpV3153\\+mdDRwsolgzA\\=\\= {\r\n border-radius: 10rem;\r\n width: 100%;\r\n flex: 1;\r\n height: 0.6rem;\r\n position: relative;\r\n overflow: hidden;\r\n background-color: var(--full-color);\r\n}\r\n\r\n.mRLkqF4t6D37R2Q92JN0yQ\\=\\=>.euudZoQFbdOsRYwZj1hxKw\\=\\=>.tfqNpV3153\\+mdDRwsolgzA\\=\\=::after {\r\n content: '';\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n width: var(--percent);\r\n height: 0.6rem;\r\n border-radius: 10rem;\r\n background-color: var(--percent-color);\r\n transition: width ease-in-out 1s;\r\n}\r\n\r\n.LlSm0PTCOcYE-hNkcuKBxw\\=\\=>div {\r\n width: 1.6rem !important;\r\n height: 1.6rem !important;\r\n}",""]),r.locals={"progress-bar-container":"mRLkqF4t6D37R2Q92JN0yQ==","progress-bar-title":"ENbMZZe8dWufoWnR6lIS0w==","progress-bar-tile":"euudZoQFbdOsRYwZj1hxKw==","progress-bar-value":"tfqNpV3153+mdDRwsolgzA==","status-icon":"LlSm0PTCOcYE-hNkcuKBxw=="};const s=r},634:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,".PyKLs4MLMCULYsKMYe3bkA\\=\\= {\r\n height: 4.8rem;\r\n gap: 0.8rem;\r\n}\r\n\r\n.PyKLs4MLMCULYsKMYe3bkA\\=\\=>input {\r\n border: var(--neutral-bolder-border);\r\n height: 100%;\r\n aspect-ratio: 1 / 1;\r\n border-radius: 0.8rem;\r\n text-align: center;\r\n min-width: 3.2rem;\r\n font: inherit;\r\n font-size: inherit;\r\n font-family: inherit;\r\n font-weight: inherit;\r\n line-height: inherit;\r\n font-style: inherit;\r\n}\r\n\r\n.PyKLs4MLMCULYsKMYe3bkA\\=\\=:focus-within>input {\r\n border-color: var(--primary-main-color);\r\n}\r\n\r\n.PyKLs4MLMCULYsKMYe3bkA\\=\\=.TDdmd\\+Yk\\+8JyXxLS\\+4VShA\\=\\= {\r\n overflow: visible !important;\r\n border-color: var(--helper-text-color) !important;\r\n}\r\n\r\n.PyKLs4MLMCULYsKMYe3bkA\\=\\=.TDdmd\\+Yk\\+8JyXxLS\\+4VShA\\=\\=::after {\r\n content: attr(helper-text);\r\n color: var(--helper-text-color);\r\n position: absolute;\r\n left: 0;\r\n bottom: -0.4rem;\r\n width: max-content;\r\n font-size: 1.2rem;\r\n line-height: 1.6rem;\r\n font-family: inherit;\r\n transform: translateY(100%);\r\n}",""]),r.locals={"input-opt-container":"PyKLs4MLMCULYsKMYe3bkA==","helper-text":"TDdmd+Yk+8JyXxLS+4VShA=="};const s=r},644:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,".eBvtL2EpMpr88ZjqAj7Viw\\=\\= {\r\n position: relative;\r\n display: inline-block;\r\n background-color: var(--off-bg) !important;\r\n border-radius: 50vw !important;\r\n border: none;\r\n outline: none;\r\n}\r\n\r\n.eBvtL2EpMpr88ZjqAj7Viw\\=\\=>input {\r\n opacity: 0;\r\n width: 0;\r\n height: 0;\r\n border: none;\r\n outline: none;\r\n}\r\n\r\n.eBvtL2EpMpr88ZjqAj7Viw\\=\\=>.fNktqrpC5gEeGqd3jinDaA\\=\\= {\r\n font-size: var(--size);\r\n position: absolute;\r\n height: calc(100% - 0.2em);\r\n aspect-ratio: 1 / 1;\r\n left: 0.1em;\r\n top: 0.1em;\r\n background-color: var(--dot-color);\r\n transition: 0.4s;\r\n border-radius: 50%;\r\n}\r\n\r\n.eBvtL2EpMpr88ZjqAj7Viw\\=\\=>input:checked+.fNktqrpC5gEeGqd3jinDaA\\=\\= {\r\n -webkit-transform: translateX(calc(0.8 * (100% + 0.2em)));\r\n -ms-transform: translateX(calc(0.8 * (100% + 0.2em)));\r\n transform: translateX(calc(0.8 * (100% + 0.2em)));\r\n}\r\n\r\n.eBvtL2EpMpr88ZjqAj7Viw\\=\\=:has(> input:checked) {\r\n background-color: var(--on-bg) !important;\r\n}\r\n\r\n.eBvtL2EpMpr88ZjqAj7Viw\\=\\=:has(> input:disabled:not(*:checked)) {\r\n pointer-events: none;\r\n border: var(--neutral-bolder-border);\r\n background-color: var(--neutral-disable-background-color) !important;\r\n}\r\n\r\n.eBvtL2EpMpr88ZjqAj7Viw\\=\\=:has(> input:disabled:not(*:checked)) .fNktqrpC5gEeGqd3jinDaA\\=\\= {\r\n background-color: var(--neutral-text-disabled-color) !important;\r\n}\r\n\r\n.eBvtL2EpMpr88ZjqAj7Viw\\=\\=:has(> input:disabled:checked) {\r\n pointer-events: none;\r\n background-color: var(--primary-lighter-color) !important;\r\n}",""]),r.locals={"switch-container":"eBvtL2EpMpr88ZjqAj7Viw==",slider:"fNktqrpC5gEeGqd3jinDaA=="};const s=r},648:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,".SYwd3vOAcc5Gum0yEl3HzA\\=\\= {\r\n height: max(var(--size), 14px);\r\n width: max(var(--size), 14px);\r\n aspect-ratio: 1 / 1 !important;\r\n border-radius: 50%;\r\n box-sizing: border-box;\r\n border: 2px solid var(--off-color);\r\n background-color: transparent !important;\r\n transition: border-color ease-in-out 0.5s;\r\n justify-content: center;\r\n cursor: pointer;\r\n}\r\n\r\n.SYwd3vOAcc5Gum0yEl3HzA\\=\\=>input {\r\n display: none;\r\n opacity: 0;\r\n cursor: pointer;\r\n}\r\n\r\n.SYwd3vOAcc5Gum0yEl3HzA\\=\\=>._3Ns-gufCVmEvg\\+3P1RxoCw\\=\\= {\r\n height: inherit;\r\n width: inherit;\r\n scale: 0.5;\r\n transform-origin: center center;\r\n border-radius: 50%;\r\n aspect-ratio: 1 / 1;\r\n visibility: hidden;\r\n opacity: 0;\r\n transition: visibility, opacity ease-in-out 0.5s;\r\n}\r\n\r\n.SYwd3vOAcc5Gum0yEl3HzA\\=\\=>input:checked~._3Ns-gufCVmEvg\\+3P1RxoCw\\=\\= {\r\n visibility: visible;\r\n opacity: 1;\r\n background-color: var(--active-color);\r\n}\r\n\r\n.SYwd3vOAcc5Gum0yEl3HzA\\=\\=:has(> input:checked) {\r\n border-color: var(--active-color) !important;\r\n}\r\n\r\n.SYwd3vOAcc5Gum0yEl3HzA\\=\\=:has(input:disabled) {\r\n pointer-events: none !important;\r\n border-color: var(--off-color) !important;\r\n background-color: var(--neutral-disable-background-color) !important;\r\n}\r\n\r\n.SYwd3vOAcc5Gum0yEl3HzA\\=\\=>input:disabled~._3Ns-gufCVmEvg\\+3P1RxoCw\\=\\= {\r\n display: block !important;\r\n background-color: var(--neutral-text-disabled-color);\r\n}",""]),r.locals={"radio-btn-container":"SYwd3vOAcc5Gum0yEl3HzA==",checkmark:"_3Ns-gufCVmEvg+3P1RxoCw=="};const s=r},659:(e,t,n)=>{const i=n(156),r={};for(const e of Object.keys(i))r[i[e]]=e;const s={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};e.exports=s;for(const e of Object.keys(s)){if(!("channels"in s[e]))throw new Error("missing channels property: "+e);if(!("labels"in s[e]))throw new Error("missing channel labels property: "+e);if(s[e].labels.length!==s[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:n}=s[e];delete s[e].channels,delete s[e].labels,Object.defineProperty(s[e],"channels",{value:t}),Object.defineProperty(s[e],"labels",{value:n})}s.rgb.hsl=function(e){const t=e[0]/255,n=e[1]/255,i=e[2]/255,r=Math.min(t,n,i),s=Math.max(t,n,i),o=s-r;let a,l;s===r?a=0:t===s?a=(n-i)/o:n===s?a=2+(i-t)/o:i===s&&(a=4+(t-n)/o),a=Math.min(60*a,360),a<0&&(a+=360);const c=(r+s)/2;return l=s===r?0:c<=.5?o/(s+r):o/(2-s-r),[a,100*l,100*c]},s.rgb.hsv=function(e){let t,n,i,r,s;const o=e[0]/255,a=e[1]/255,l=e[2]/255,c=Math.max(o,a,l),d=c-Math.min(o,a,l),u=function(e){return(c-e)/6/d+.5};return 0===d?(r=0,s=0):(s=d/c,t=u(o),n=u(a),i=u(l),o===c?r=i-n:a===c?r=1/3+t-i:l===c&&(r=2/3+n-t),r<0?r+=1:r>1&&(r-=1)),[360*r,100*s,100*c]},s.rgb.hwb=function(e){const t=e[0],n=e[1];let i=e[2];const r=s.rgb.hsl(e)[0],o=1/255*Math.min(t,Math.min(n,i));return i=1-1/255*Math.max(t,Math.max(n,i)),[r,100*o,100*i]},s.rgb.cmyk=function(e){const t=e[0]/255,n=e[1]/255,i=e[2]/255,r=Math.min(1-t,1-n,1-i);return[100*((1-t-r)/(1-r)||0),100*((1-n-r)/(1-r)||0),100*((1-i-r)/(1-r)||0),100*r]},s.rgb.keyword=function(e){const t=r[e];if(t)return t;let n,s=1/0;for(const t of Object.keys(i)){const r=(a=i[t],((o=e)[0]-a[0])**2+(o[1]-a[1])**2+(o[2]-a[2])**2);r<s&&(s=r,n=t)}var o,a;return n},s.keyword.rgb=function(e){return i[e]},s.rgb.xyz=function(e){let t=e[0]/255,n=e[1]/255,i=e[2]/255;return t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92,[100*(.4124*t+.3576*n+.1805*i),100*(.2126*t+.7152*n+.0722*i),100*(.0193*t+.1192*n+.9505*i)]},s.rgb.lab=function(e){const t=s.rgb.xyz(e);let n=t[0],i=t[1],r=t[2];return n/=95.047,i/=100,r/=108.883,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,[116*i-16,500*(n-i),200*(i-r)]},s.hsl.rgb=function(e){const t=e[0]/360,n=e[1]/100,i=e[2]/100;let r,s,o;if(0===n)return o=255*i,[o,o,o];r=i<.5?i*(1+n):i+n-i*n;const a=2*i-r,l=[0,0,0];for(let e=0;e<3;e++)s=t+1/3*-(e-1),s<0&&s++,s>1&&s--,o=6*s<1?a+6*(r-a)*s:2*s<1?r:3*s<2?a+(r-a)*(2/3-s)*6:a,l[e]=255*o;return l},s.hsl.hsv=function(e){const t=e[0];let n=e[1]/100,i=e[2]/100,r=n;const s=Math.max(i,.01);return i*=2,n*=i<=1?i:2-i,r*=s<=1?s:2-s,[t,100*(0===i?2*r/(s+r):2*n/(i+n)),(i+n)/2*100]},s.hsv.rgb=function(e){const t=e[0]/60,n=e[1]/100;let i=e[2]/100;const r=Math.floor(t)%6,s=t-Math.floor(t),o=255*i*(1-n),a=255*i*(1-n*s),l=255*i*(1-n*(1-s));switch(i*=255,r){case 0:return[i,l,o];case 1:return[a,i,o];case 2:return[o,i,l];case 3:return[o,a,i];case 4:return[l,o,i];case 5:return[i,o,a]}},s.hsv.hsl=function(e){const t=e[0],n=e[1]/100,i=e[2]/100,r=Math.max(i,.01);let s,o;o=(2-n)*i;const a=(2-n)*r;return s=n*r,s/=a<=1?a:2-a,s=s||0,o/=2,[t,100*s,100*o]},s.hwb.rgb=function(e){const t=e[0]/360;let n=e[1]/100,i=e[2]/100;const r=n+i;let s;r>1&&(n/=r,i/=r);const o=Math.floor(6*t),a=1-i;s=6*t-o,1&o&&(s=1-s);const l=n+s*(a-n);let c,d,u;switch(o){default:case 6:case 0:c=a,d=l,u=n;break;case 1:c=l,d=a,u=n;break;case 2:c=n,d=a,u=l;break;case 3:c=n,d=l,u=a;break;case 4:c=l,d=n,u=a;break;case 5:c=a,d=n,u=l}return[255*c,255*d,255*u]},s.cmyk.rgb=function(e){const t=e[0]/100,n=e[1]/100,i=e[2]/100,r=e[3]/100;return[255*(1-Math.min(1,t*(1-r)+r)),255*(1-Math.min(1,n*(1-r)+r)),255*(1-Math.min(1,i*(1-r)+r))]},s.xyz.rgb=function(e){const t=e[0]/100,n=e[1]/100,i=e[2]/100;let r,s,o;return r=3.2406*t+-1.5372*n+-.4986*i,s=-.9689*t+1.8758*n+.0415*i,o=.0557*t+-.204*n+1.057*i,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,r=Math.min(Math.max(0,r),1),s=Math.min(Math.max(0,s),1),o=Math.min(Math.max(0,o),1),[255*r,255*s,255*o]},s.xyz.lab=function(e){let t=e[0],n=e[1],i=e[2];return t/=95.047,n/=100,i/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,[116*n-16,500*(t-n),200*(n-i)]},s.lab.xyz=function(e){let t,n,i;n=(e[0]+16)/116,t=e[1]/500+n,i=n-e[2]/200;const r=n**3,s=t**3,o=i**3;return n=r>.008856?r:(n-16/116)/7.787,t=s>.008856?s:(t-16/116)/7.787,i=o>.008856?o:(i-16/116)/7.787,t*=95.047,n*=100,i*=108.883,[t,n,i]},s.lab.lch=function(e){const t=e[0],n=e[1],i=e[2];let r;return r=360*Math.atan2(i,n)/2/Math.PI,r<0&&(r+=360),[t,Math.sqrt(n*n+i*i),r]},s.lch.lab=function(e){const t=e[0],n=e[1],i=e[2]/360*2*Math.PI;return[t,n*Math.cos(i),n*Math.sin(i)]},s.rgb.ansi16=function(e,t=null){const[n,i,r]=e;let o=null===t?s.rgb.hsv(e)[2]:t;if(o=Math.round(o/50),0===o)return 30;let a=30+(Math.round(r/255)<<2|Math.round(i/255)<<1|Math.round(n/255));return 2===o&&(a+=60),a},s.hsv.ansi16=function(e){return s.rgb.ansi16(s.hsv.rgb(e),e[2])},s.rgb.ansi256=function(e){const t=e[0],n=e[1],i=e[2];return t===n&&n===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},s.ansi16.rgb=function(e){let t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const n=.5*(1+~~(e>50));return[(1&t)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},s.ansi256.rgb=function(e){if(e>=232){const t=10*(e-232)+8;return[t,t,t]}let t;return e-=16,[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},s.rgb.hex=function(e){const t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},s.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let n=t[0];3===t[0].length&&(n=n.split("").map((e=>e+e)).join(""));const i=parseInt(n,16);return[i>>16&255,i>>8&255,255&i]},s.rgb.hcg=function(e){const t=e[0]/255,n=e[1]/255,i=e[2]/255,r=Math.max(Math.max(t,n),i),s=Math.min(Math.min(t,n),i),o=r-s;let a,l;return a=o<1?s/(1-o):0,l=o<=0?0:r===t?(n-i)/o%6:r===n?2+(i-t)/o:4+(t-n)/o,l/=6,l%=1,[360*l,100*o,100*a]},s.hsl.hcg=function(e){const t=e[1]/100,n=e[2]/100,i=n<.5?2*t*n:2*t*(1-n);let r=0;return i<1&&(r=(n-.5*i)/(1-i)),[e[0],100*i,100*r]},s.hsv.hcg=function(e){const t=e[1]/100,n=e[2]/100,i=t*n;let r=0;return i<1&&(r=(n-i)/(1-i)),[e[0],100*i,100*r]},s.hcg.rgb=function(e){const t=e[0]/360,n=e[1]/100,i=e[2]/100;if(0===n)return[255*i,255*i,255*i];const r=[0,0,0],s=t%1*6,o=s%1,a=1-o;let l=0;switch(Math.floor(s)){case 0:r[0]=1,r[1]=o,r[2]=0;break;case 1:r[0]=a,r[1]=1,r[2]=0;break;case 2:r[0]=0,r[1]=1,r[2]=o;break;case 3:r[0]=0,r[1]=a,r[2]=1;break;case 4:r[0]=o,r[1]=0,r[2]=1;break;default:r[0]=1,r[1]=0,r[2]=a}return l=(1-n)*i,[255*(n*r[0]+l),255*(n*r[1]+l),255*(n*r[2]+l)]},s.hcg.hsv=function(e){const t=e[1]/100,n=t+e[2]/100*(1-t);let i=0;return n>0&&(i=t/n),[e[0],100*i,100*n]},s.hcg.hsl=function(e){const t=e[1]/100,n=e[2]/100*(1-t)+.5*t;let i=0;return n>0&&n<.5?i=t/(2*n):n>=.5&&n<1&&(i=t/(2*(1-n))),[e[0],100*i,100*n]},s.hcg.hwb=function(e){const t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],100*(n-t),100*(1-n)]},s.hwb.hcg=function(e){const t=e[1]/100,n=1-e[2]/100,i=n-t;let r=0;return i<1&&(r=(n-i)/(1-i)),[e[0],100*i,100*r]},s.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},s.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},s.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},s.gray.hsl=function(e){return[0,0,e[0]]},s.gray.hsv=s.gray.hsl,s.gray.hwb=function(e){return[0,100,e[0]]},s.gray.cmyk=function(e){return[0,0,0,e[0]]},s.gray.lab=function(e){return[e[0],0,0]},s.gray.hex=function(e){const t=255&Math.round(e[0]/100*255),n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(n.length)+n},s.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}},668:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,'.WOzwJL1aziVATJoO2wlQbQ\\=\\= {\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n width: fit-content;\r\n height: fit-content;\r\n padding: 0.2rem;\r\n --size: 1.6rem;\r\n --color: var(--neutral-text-subtitle-color);\r\n}\r\n\r\n.WOzwJL1aziVATJoO2wlQbQ\\=\\=[class~="link-icon"] {\r\n --size: \'undefined\';\r\n}\r\n\r\n.WOzwJL1aziVATJoO2wlQbQ\\=\\=>svg {\r\n width: var(--size, inherit) !important;\r\n height: var(--size, inherit) !important;\r\n}\r\n\r\n.WOzwJL1aziVATJoO2wlQbQ\\=\\=[class*="fill-icon"]>svg>*[fill^="#"] {\r\n fill: var(--color, "#61616B");\r\n}\r\n\r\n.WOzwJL1aziVATJoO2wlQbQ\\=\\=[class*="outline-icon"]>svg>*[stroke^="#"] {\r\n stroke: var(--color, "#61616B");\r\n}\r\n\r\n.WOzwJL1aziVATJoO2wlQbQ\\=\\=.MZ6CveZZ3WaWWoQA6j--Ow\\=\\= {\r\n cursor: pointer;\r\n}\r\n\r\n.WOzwJL1aziVATJoO2wlQbQ\\=\\=[class~="icon-button"] {\r\n border-radius: 50%;\r\n background-color: var(--neutral-main-background-color);\r\n}\r\n\r\n.WOzwJL1aziVATJoO2wlQbQ\\=\\=[class~="border"] {\r\n border: var(--neutral-bolder-border);\r\n}\r\n\r\n.WOzwJL1aziVATJoO2wlQbQ\\=\\=[class~="dashed"] {\r\n border-style: dashed;\r\n}\r\n\r\n.WOzwJL1aziVATJoO2wlQbQ\\=\\=[class~="size64"] {\r\n width: 6.4rem;\r\n height: 6.4rem;\r\n --size: 1.6rem;\r\n}\r\n\r\n.WOzwJL1aziVATJoO2wlQbQ\\=\\=[class~="size56"] {\r\n width: 5.6rem;\r\n height: 5.6rem;\r\n --size: 1.6rem;\r\n}\r\n\r\n.WOzwJL1aziVATJoO2wlQbQ\\=\\=[class~="size48"] {\r\n width: 4.8rem;\r\n height: 4.8rem;\r\n --size: 1.6rem;\r\n}\r\n\r\n.WOzwJL1aziVATJoO2wlQbQ\\=\\=[class~="size40"] {\r\n width: 4rem;\r\n height: 4rem;\r\n --size: 1.4rem;\r\n}\r\n\r\n.WOzwJL1aziVATJoO2wlQbQ\\=\\=[class~="size32"] {\r\n width: 3.2rem;\r\n height: 3.2rem;\r\n --size: 1.4rem;\r\n}\r\n\r\n.WOzwJL1aziVATJoO2wlQbQ\\=\\=[class~="size24"] {\r\n width: 2.4rem;\r\n height: 2.4rem;\r\n --size: 1rem;\r\n}\r\n\r\n@keyframes oiDFiSh4XtlPXv6yPAeQsA\\=\\= {\r\n from {\r\n opacity: 0;\r\n }\r\n\r\n to {\r\n opacity: 1;\r\n }\r\n}\r\n\r\n.W\\+7sANiXsHGGOKMCHq3i-Q\\=\\= {\r\n position: fixed;\r\n z-index: 999;\r\n animation: oiDFiSh4XtlPXv6yPAeQsA\\=\\= 0.2s ease-in-out;\r\n animation-fill-mode: forwards;\r\n}\r\n\r\n.W\\+7sANiXsHGGOKMCHq3i-Q\\=\\=>.FVzQhHlOwf\\+Rwnht23XR1Q\\=\\= {\r\n color: var(--neutral-text-body-reverse-color);\r\n background-color: var(--neutral-main-reverse-background-color);\r\n padding: 0.4rem 1.2rem;\r\n border-radius: 0.8rem;\r\n max-width: 21.2rem;\r\n text-align: center;\r\n}\r\n\r\n.WOzwJL1aziVATJoO2wlQbQ\\=\\=[class~="icon-button"]:hover {\r\n background-color: var(--neutral-hover-background-color);\r\n}',""]),r.locals={"wini-icon":"WOzwJL1aziVATJoO2wlQbQ==",clickable:"MZ6CveZZ3WaWWoQA6j--Ow==","tooltip-container":"W+7sANiXsHGGOKMCHq3i-Q==","on-open-tooltip":"oiDFiSh4XtlPXv6yPAeQsA==","tooltip-message":"FVzQhHlOwf+Rwnht23XR1Q=="};const s=r},694:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,"",""]);const s=r},713:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,".Wj36w4lYEd7ZaY6TJWrySQ\\=\\= {\r\n gap: 4.8rem;\r\n align-items: center;\r\n min-width: 320px;\r\n max-width: 460px;\r\n}\r\n\r\n.WS1eitZHf8ybIEce0hOV8Q\\=\\= {\r\n gap: 2rem;\r\n align-items: inherit;\r\n width: 100%;\r\n}\r\n\r\n.WS1eitZHf8ybIEce0hOV8Q\\=\\=>div:last-child {\r\n padding: 0.4rem 3.2rem;\r\n gap: inherit;\r\n align-items: inherit;\r\n width: 100%;\r\n}\r\n\r\n.WS1eitZHf8ybIEce0hOV8Q\\=\\=>div:last-child>div {\r\n width: 100%;\r\n}\r\n\r\nbutton.dqstmHIrJvSBIQ\\+a-SKj5A\\=\\= {\r\n height: 4.8rem;\r\n width: 100%;\r\n justify-content: center;\r\n background-color: var(--primary-main-color);\r\n color: var(--neutral-text-stable-color);\r\n}\r\n\r\nbutton:disabled.dqstmHIrJvSBIQ\\+a-SKj5A\\=\\= {\r\n background-color: var(--neutral-disable-background-color);\r\n color: var(--neutral-text-disabled-color);\r\n cursor: context-menu;\r\n}\r\n\r\n.cRanwOAEQR8dXYXmhQawAA\\=\\= {\r\n color: var(--neutral-text-subtitle-color);\r\n}\r\n\r\n.cRanwOAEQR8dXYXmhQawAA\\=\\=:hover {\r\n text-decoration: underline;\r\n cursor: pointer;\r\n}\r\n\r\n.EpoEyjIXAGjbt8cgimANcw\\=\\=:hover {\r\n text-decoration: underline;\r\n cursor: pointer;\r\n}\r\n\r\n.HD-2ykegaSEEDaqeFr0QNQ\\=\\= {\r\n gap: 1.6rem;\r\n flex-wrap: wrap;\r\n}\r\n\r\n.HD-2ykegaSEEDaqeFr0QNQ\\=\\=>button {\r\n height: 4.8rem;\r\n width: calc((100% - 1.6rem) / 2);\r\n gap: 1.6rem;\r\n justify-content: center;\r\n border: var(--neutral-bolder-border);\r\n background-color: transparent;\r\n}\r\n\r\n.nxy7Uhgpy\\+mQigy1l5GRnw\\=\\= {\r\n gap: 1.2rem;\r\n}\r\n\r\n.nxy7Uhgpy\\+mQigy1l5GRnw\\=\\=>div:nth-child(odd) {\r\n height: 1px;\r\n width: 100%;\r\n flex: 1;\r\n background-color: var(--neutral-text-body-reverse-color);\r\n}\r\n\r\n.nxy7Uhgpy\\+mQigy1l5GRnw\\=\\=>div:nth-child(even) {\r\n color: var(--neutral-text-subtitle-color);\r\n}",""]),r.locals={"login-view-container":"Wj36w4lYEd7ZaY6TJWrySQ==","login-view-form-container":"WS1eitZHf8ybIEce0hOV8Q==","login-btn":"dqstmHIrJvSBIQ+a-SKj5A==","forgot-password-btn":"cRanwOAEQR8dXYXmhQawAA==","register-btn":"EpoEyjIXAGjbt8cgimANcw==","login-social-media":"HD-2ykegaSEEDaqeFr0QNQ==","or-spacing":"nxy7Uhgpy+mQigy1l5GRnw=="};const s=r},734:(e,t,n)=>{const i=n(659),r=n(507),s={};Object.keys(i).forEach((e=>{s[e]={},Object.defineProperty(s[e],"channels",{value:i[e].channels}),Object.defineProperty(s[e],"labels",{value:i[e].labels});const t=r(e);Object.keys(t).forEach((n=>{const i=t[n];s[e][n]=function(e){const t=function(...t){const n=t[0];if(null==n)return n;n.length>1&&(t=n);const i=e(t);if("object"==typeof i)for(let e=i.length,t=0;t<e;t++)i[t]=Math.round(i[t]);return i};return"conversion"in e&&(t.conversion=e.conversion),t}(i),s[e][n].raw=function(e){const t=function(...t){const n=t[0];return null==n?n:(n.length>1&&(t=n),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(i)}))})),e.exports=s},742:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,'.kiwXrgPI75W2jvIkQLAFWA\\=\\= {\r\n position: relative;\r\n align-items: stretch;\r\n gap: 0.4rem;\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=[number-picker-type="outline"] {\r\n border-radius: 0.8rem;\r\n padding: 0 0.6rem;\r\n border: var(--neutral-bolder-border);\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=>div:has(>svg) {\r\n padding: 0.7rem;\r\n border: var(--neutral-bolder-border);\r\n border-radius: 50%;\r\n aspect-ratio: 1 / 1;\r\n height: 100%;\r\n cursor: pointer;\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=[number-picker-type="outline"]>div:has(>svg) {\r\n padding: 0.6rem;\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=[class~="size40"]>div>svg {\r\n width: 1.6rem;\r\n height: 1.6rem;\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=[class~="size40"]>div:has(>svg) {\r\n padding: 1.1rem;\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=[class~="size40"][number-picker-type="outline"]>div:has(>svg) {\r\n padding: 1rem;\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=[class~="size24"]>div:has(>svg) {\r\n padding: 0.5rem;\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=[class~="size24"][number-picker-type="outline"]>div:has(>svg) {\r\n padding: 0.4rem;\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=[class~="size24"]>div>svg {\r\n width: 1.2rem;\r\n height: 1.2rem;\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=[number-picker-type="outline"]>div:has(>svg) {\r\n border-color: transparent;\r\n border-radius: 0;\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=>div>svg {\r\n height: 100%;\r\n flex: 1;\r\n aspect-ratio: 1 / 1;\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=>div>svg * {\r\n fill: var(--neutral-text-subtitle-color);\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=>input {\r\n flex: 1;\r\n width: 100%;\r\n min-width: 5.6rem;\r\n border: var(--neutral-bolder-border);\r\n border-color: transparent;\r\n outline: none;\r\n padding: 0 0.4rem;\r\n background-color: transparent !important;\r\n font: inherit;\r\n color: inherit;\r\n font-size: inherit;\r\n font-family: inherit;\r\n font-weight: inherit;\r\n line-height: inherit;\r\n text-align: center;\r\n text-overflow: inherit;\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=>input:focus {\r\n border-color: var(--primary-main-color);\r\n border-radius: 0.8rem;\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=[number-picker-type="outline"] input {\r\n border: none;\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=[number-picker-type="outline"]:focus-within {\r\n border-color: var(--primary-main-color);\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=:has(>input:disabled) {\r\n pointer-events: none !important;\r\n color: var(--neutral-text-disabled-color);\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=[number-picker-type="outline"]:has(>input:disabled) {\r\n background-color: var(--neutral-disable-background-color);\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=:has(>input:disabled)>div:has(>svg) {\r\n background-color: var(--neutral-disable-background-color);\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=:has(>input:disabled) svg * {\r\n fill: var(--neutral-text-disabled-color);\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=.dhjY72w\\+YbF5BzLam\\+vDIA\\=\\= {\r\n overflow: visible !important;\r\n border-color: var(--helper-text-color) !important;\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=.dhjY72w\\+YbF5BzLam\\+vDIA\\=\\= {\r\n overflow: visible !important;\r\n border-color: var(--helper-text-color) !important;\r\n}\r\n\r\n.kiwXrgPI75W2jvIkQLAFWA\\=\\=.dhjY72w\\+YbF5BzLam\\+vDIA\\=\\=::after {\r\n content: attr(helper-text);\r\n color: var(--helper-text-color);\r\n position: absolute;\r\n left: 0;\r\n bottom: -0.4rem;\r\n width: max-content;\r\n font-size: 1.2rem;\r\n line-height: 1.6rem;\r\n font-family: inherit;\r\n transform: translateY(100%);\r\n}',""]),r.locals={"number-picker-container":"kiwXrgPI75W2jvIkQLAFWA==","helper-text":"dhjY72w+YbF5BzLam+vDIA=="};const s=r},750:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,".O6EKVaWnJmDyUhCmi\\+-RQA\\=\\=.qndalpJFIH0joJClHDZnnQ\\=\\=::after {\r\n content: '';\r\n position: sticky;\r\n width: 1.2rem;\r\n height: 1.2rem;\r\n border: 0.4rem solid var(--neutral-absolute-background-color);\r\n border-radius: 50%;\r\n border-top: 0.4rem solid var(--infor-main-color);\r\n -webkit-animation: cloX4W3AvdLT7qMlbOehXQ\\=\\= 2s linear infinite;\r\n /* Safari */\r\n animation: cloX4W3AvdLT7qMlbOehXQ\\=\\= 2s linear infinite;\r\n order: 100000;\r\n}\r\n\r\n/* Safari */\r\n@-webkit-keyframes cloX4W3AvdLT7qMlbOehXQ\\=\\= {\r\n 0% {\r\n -webkit-transform: rotate(0deg);\r\n }\r\n\r\n 100% {\r\n -webkit-transform: rotate(360deg);\r\n }\r\n}\r\n\r\n@keyframes cloX4W3AvdLT7qMlbOehXQ\\=\\= {\r\n 0% {\r\n transform: rotate(0deg);\r\n }\r\n\r\n 100% {\r\n transform: rotate(360deg);\r\n }\r\n}",""]),r.locals={"infinite-scroll":"O6EKVaWnJmDyUhCmi+-RQA==",loading:"qndalpJFIH0joJClHDZnnQ==",spin:"cloX4W3AvdLT7qMlbOehXQ=="};const s=r},764:function(e,t,n){var i;i=e=>(()=>{var t={703:(e,t,n)=>{"use strict";var i=n(414);function r(){}function s(){}s.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,s,o){if(o!==i){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:s,resetWarningCache:r};return n.PropTypes=n,n}},697:(e,t,n)=>{e.exports=n(703)()},414:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},98:t=>{"use strict";t.exports=e}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var s=n[e]={exports:{}};return t[e](s,s.exports,i),s.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";i.r(r),i.d(r,{default:()=>y});var e=i(98),t=i.n(e),n=i(697),s=i.n(n);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},o.apply(this,arguments)}var a=function(e){var n=e.pageClassName,i=e.pageLinkClassName,r=e.page,s=e.selected,a=e.activeClassName,l=e.activeLinkClassName,c=e.getEventListener,d=e.pageSelectedHandler,u=e.href,h=e.extraAriaContext,m=e.pageLabelBuilder,g=e.rel,p=e.ariaLabel||"Page "+r+(h?" "+h:""),f=null;return s&&(f="page",p=e.ariaLabel||"Page "+r+" is your current page",n=void 0!==n?n+" "+a:a,void 0!==i?void 0!==l&&(i=i+" "+l):i=l),t().createElement("li",{className:n},t().createElement("a",o({rel:g,role:u?void 0:"button",className:i,href:u,tabIndex:s?"-1":"0","aria-label":p,"aria-current":f,onKeyPress:d},c(d)),m(r)))};a.propTypes={pageSelectedHandler:s().func.isRequired,selected:s().bool.isRequired,pageClassName:s().string,pageLinkClassName:s().string,activeClassName:s().string,activeLinkClassName:s().string,extraAriaContext:s().string,href:s().string,ariaLabel:s().string,page:s().number.isRequired,getEventListener:s().func.isRequired,pageLabelBuilder:s().func.isRequired,rel:s().string};const l=a;function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},c.apply(this,arguments)}var d=function(e){var n=e.breakLabel,i=e.breakAriaLabel,r=e.breakClassName,s=e.breakLinkClassName,o=e.breakHandler,a=e.getEventListener,l=r||"break";return t().createElement("li",{className:l},t().createElement("a",c({className:s,role:"button",tabIndex:"0","aria-label":i,onKeyPress:o},a(o)),n))};d.propTypes={breakLabel:s().oneOfType([s().string,s().node]),breakAriaLabel:s().string,breakClassName:s().string,breakLinkClassName:s().string,breakHandler:s().func.isRequired,getEventListener:s().func.isRequired};const u=d;function h(e){return null!=e?e:arguments.length>1&&void 0!==arguments[1]?arguments[1]:""}function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function g(){return g=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},g.apply(this,arguments)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}function w(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var v=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(a,e);var n,i,r,s,o=(r=a,s=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=b(r);if(s){var n=b(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===m(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}(this,e)});function a(e){var n,i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),w(f(n=o.call(this,e)),"handlePreviousPage",(function(e){var t=n.state.selected;n.handleClick(e,null,t>0?t-1:void 0,{isPrevious:!0})})),w(f(n),"handleNextPage",(function(e){var t=n.state.selected,i=n.props.pageCount;n.handleClick(e,null,t<i-1?t+1:void 0,{isNext:!0})})),w(f(n),"handlePageSelected",(function(e,t){if(n.state.selected===e)return n.callActiveCallback(e),void n.handleClick(t,null,void 0,{isActive:!0});n.handleClick(t,null,e)})),w(f(n),"handlePageChange",(function(e){n.state.selected!==e&&(n.setState({selected:e}),n.callCallback(e))})),w(f(n),"getEventListener",(function(e){return w({},n.props.eventListener,e)})),w(f(n),"handleClick",(function(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=r.isPrevious,o=void 0!==s&&s,a=r.isNext,l=void 0!==a&&a,c=r.isBreak,d=void 0!==c&&c,u=r.isActive,h=void 0!==u&&u;e.preventDefault?e.preventDefault():e.returnValue=!1;var m=n.state.selected,g=n.props.onClick,p=i;if(g){var f=g({index:t,selected:m,nextSelectedPage:i,event:e,isPrevious:o,isNext:l,isBreak:d,isActive:h});if(!1===f)return;Number.isInteger(f)&&(p=f)}void 0!==p&&n.handlePageChange(p)})),w(f(n),"handleBreakClick",(function(e,t){var i=n.state.selected;n.handleClick(t,e,i<e?n.getForwardJump():n.getBackwardJump(),{isBreak:!0})})),w(f(n),"callCallback",(function(e){void 0!==n.props.onPageChange&&"function"==typeof n.props.onPageChange&&n.props.onPageChange({selected:e})})),w(f(n),"callActiveCallback",(function(e){void 0!==n.props.onPageActive&&"function"==typeof n.props.onPageActive&&n.props.onPageActive({selected:e})})),w(f(n),"getElementPageRel",(function(e){var t=n.state.selected,i=n.props,r=i.nextPageRel,s=i.prevPageRel,o=i.selectedPageRel;return t-1===e?s:t===e?o:t+1===e?r:void 0})),w(f(n),"pagination",(function(){var e=[],i=n.props,r=i.pageRangeDisplayed,s=i.pageCount,o=i.marginPagesDisplayed,a=i.breakLabel,l=i.breakClassName,c=i.breakLinkClassName,d=i.breakAriaLabels,h=n.state.selected;if(s<=r)for(var m=0;m<s;m++)e.push(n.getPageElement(m));else{var g=r/2,p=r-g;h>s-r/2?g=r-(p=s-h):h<r/2&&(p=r-(g=h));var f,b,w=function(e){return n.getPageElement(e)},v=[];for(f=0;f<s;f++){var y=f+1;if(y<=o)v.push({type:"page",index:f,display:w(f)});else if(y>s-o)v.push({type:"page",index:f,display:w(f)});else if(f>=h-g&&f<=h+(0===h&&r>1?p-1:p))v.push({type:"page",index:f,display:w(f)});else if(a&&v.length>0&&v[v.length-1].display!==b&&(r>0||o>0)){var _=f<h?d.backward:d.forward;b=t().createElement(u,{key:f,breakAriaLabel:_,breakLabel:a,breakClassName:l,breakLinkClassName:c,breakHandler:n.handleBreakClick.bind(null,f),getEventListener:n.getEventListener}),v.push({type:"break",index:f,display:b})}}v.forEach((function(t,n){var i=t;"break"===t.type&&v[n-1]&&"page"===v[n-1].type&&v[n+1]&&"page"===v[n+1].type&&v[n+1].index-v[n-1].index<=2&&(i={type:"page",index:t.index,display:w(t.index)}),e.push(i.display)}))}return e})),void 0!==e.initialPage&&void 0!==e.forcePage&&console.warn("(react-paginate): Both initialPage (".concat(e.initialPage,") and forcePage (").concat(e.forcePage,") props are provided, which is discouraged.")+" Use exclusively forcePage prop for a controlled component.\nSee https://reactjs.org/docs/forms.html#controlled-components"),i=e.initialPage?e.initialPage:e.forcePage?e.forcePage:0,n.state={selected:i},n}return n=a,(i=[{key:"componentDidMount",value:function(){var e=this.props,t=e.initialPage,n=e.disableInitialCallback,i=e.extraAriaContext,r=e.pageCount,s=e.forcePage;void 0===t||n||this.callCallback(t),i&&console.warn("DEPRECATED (react-paginate): The extraAriaContext prop is deprecated. You should now use the ariaLabelBuilder instead."),Number.isInteger(r)||console.warn("(react-paginate): The pageCount prop value provided is not an integer (".concat(r,"). Did you forget a Math.ceil()?")),void 0!==t&&t>r-1&&console.warn("(react-paginate): The initialPage prop provided is greater than the maximum page index from pageCount prop (".concat(t," > ").concat(r-1,").")),void 0!==s&&s>r-1&&console.warn("(react-paginate): The forcePage prop provided is greater than the maximum page index from pageCount prop (".concat(s," > ").concat(r-1,")."))}},{key:"componentDidUpdate",value:function(e){void 0!==this.props.forcePage&&this.props.forcePage!==e.forcePage&&(this.props.forcePage>this.props.pageCount-1&&console.warn("(react-paginate): The forcePage prop provided is greater than the maximum page index from pageCount prop (".concat(this.props.forcePage," > ").concat(this.props.pageCount-1,").")),this.setState({selected:this.props.forcePage})),Number.isInteger(e.pageCount)&&!Number.isInteger(this.props.pageCount)&&console.warn("(react-paginate): The pageCount prop value provided is not an integer (".concat(this.props.pageCount,"). Did you forget a Math.ceil()?"))}},{key:"getForwardJump",value:function(){var e=this.state.selected,t=this.props,n=t.pageCount,i=e+t.pageRangeDisplayed;return i>=n?n-1:i}},{key:"getBackwardJump",value:function(){var e=this.state.selected-this.props.pageRangeDisplayed;return e<0?0:e}},{key:"getElementHref",value:function(e){var t=this.props,n=t.hrefBuilder,i=t.pageCount,r=t.hrefAllControls;if(n)return r||e>=0&&e<i?n(e+1,i,this.state.selected):void 0}},{key:"ariaLabelBuilder",value:function(e){var t=e===this.state.selected;if(this.props.ariaLabelBuilder&&e>=0&&e<this.props.pageCount){var n=this.props.ariaLabelBuilder(e+1,t);return this.props.extraAriaContext&&!t&&(n=n+" "+this.props.extraAriaContext),n}}},{key:"getPageElement",value:function(e){var n=this.state.selected,i=this.props,r=i.pageClassName,s=i.pageLinkClassName,o=i.activeClassName,a=i.activeLinkClassName,c=i.extraAriaContext,d=i.pageLabelBuilder;return t().createElement(l,{key:e,pageSelectedHandler:this.handlePageSelected.bind(null,e),selected:n===e,rel:this.getElementPageRel(e),pageClassName:r,pageLinkClassName:s,activeClassName:o,activeLinkClassName:a,extraAriaContext:c,href:this.getElementHref(e),ariaLabel:this.ariaLabelBuilder(e),page:e+1,pageLabelBuilder:d,getEventListener:this.getEventListener})}},{key:"render",value:function(){var e=this.props.renderOnZeroPageCount;if(0===this.props.pageCount&&void 0!==e)return e?e(this.props):e;var n=this.props,i=n.disabledClassName,r=n.disabledLinkClassName,s=n.pageCount,o=n.className,a=n.containerClassName,l=n.previousLabel,c=n.previousClassName,d=n.previousLinkClassName,u=n.previousAriaLabel,m=n.prevRel,p=n.nextLabel,f=n.nextClassName,b=n.nextLinkClassName,w=n.nextAriaLabel,v=n.nextRel,y=this.state.selected,_=0===y,k=y===s-1,x="".concat(h(c)).concat(_?" ".concat(h(i)):""),C="".concat(h(f)).concat(k?" ".concat(h(i)):""),A="".concat(h(d)).concat(_?" ".concat(h(r)):""),E="".concat(h(b)).concat(k?" ".concat(h(r)):""),T=_?"true":"false",S=k?"true":"false";return t().createElement("ul",{className:o||a,role:"navigation","aria-label":"Pagination"},t().createElement("li",{className:x},t().createElement("a",g({className:A,href:this.getElementHref(y-1),tabIndex:_?"-1":"0",role:"button",onKeyPress:this.handlePreviousPage,"aria-disabled":T,"aria-label":u,rel:m},this.getEventListener(this.handlePreviousPage)),l)),this.pagination(),t().createElement("li",{className:C},t().createElement("a",g({className:E,href:this.getElementHref(y+1),tabIndex:k?"-1":"0",role:"button",onKeyPress:this.handleNextPage,"aria-disabled":S,"aria-label":w,rel:v},this.getEventListener(this.handleNextPage)),p)))}}])&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(n.prototype,i),Object.defineProperty(n,"prototype",{writable:!1}),a}(e.Component);w(v,"propTypes",{pageCount:s().number.isRequired,pageRangeDisplayed:s().number,marginPagesDisplayed:s().number,previousLabel:s().node,previousAriaLabel:s().string,prevPageRel:s().string,prevRel:s().string,nextLabel:s().node,nextAriaLabel:s().string,nextPageRel:s().string,nextRel:s().string,breakLabel:s().oneOfType([s().string,s().node]),breakAriaLabels:s().shape({forward:s().string,backward:s().string}),hrefBuilder:s().func,hrefAllControls:s().bool,onPageChange:s().func,onPageActive:s().func,onClick:s().func,initialPage:s().number,forcePage:s().number,disableInitialCallback:s().bool,containerClassName:s().string,className:s().string,pageClassName:s().string,pageLinkClassName:s().string,pageLabelBuilder:s().func,activeClassName:s().string,activeLinkClassName:s().string,previousClassName:s().string,nextClassName:s().string,previousLinkClassName:s().string,nextLinkClassName:s().string,disabledClassName:s().string,disabledLinkClassName:s().string,breakClassName:s().string,breakLinkClassName:s().string,extraAriaContext:s().string,ariaLabelBuilder:s().func,eventListener:s().string,renderOnZeroPageCount:s().func,selectedPageRel:s().string}),w(v,"defaultProps",{pageRangeDisplayed:2,marginPagesDisplayed:3,activeClassName:"selected",previousLabel:"Previous",previousClassName:"previous",previousAriaLabel:"Previous page",prevPageRel:"prev",prevRel:"prev",nextLabel:"Next",nextClassName:"next",nextAriaLabel:"Next page",nextPageRel:"next",nextRel:"next",breakLabel:"...",breakAriaLabels:{forward:"Jump forward",backward:"Jump backward"},disabledClassName:"disabled",disableInitialCallback:!1,pageLabelBuilder:function(e){return e},eventListener:"onClick",renderOnZeroPageCount:void 0,selectedPageRel:"canonical",hrefAllControls:!1});const y=v})(),r})(),e.exports=i(n(12))},842:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,'.Yni3Pvql0herzks7Xy73MQ\\=\\= {\r\n padding: 3px 7px;\r\n border-radius: 100rem;\r\n gap: 6px;\r\n justify-content: center;\r\n color: var(--neutral-text-subtitle-color, #61616B);\r\n border: var(--neutral-bolder-border);\r\n}\r\n\r\n.Yni3Pvql0herzks7Xy73MQ\\=\\=[class~="dashed"] {\r\n border-style: dashed;\r\n}\r\n\r\n.Yni3Pvql0herzks7Xy73MQ\\=\\=[class~="size32"] {\r\n padding: 4px 11px;\r\n gap: 8px;\r\n}\r\n\r\n.Yni3Pvql0herzks7Xy73MQ\\=\\=.CSye1BUBhJvpGtuHsh-cSg\\=\\= {\r\n cursor: pointer;\r\n}\r\n\r\n.Yni3Pvql0herzks7Xy73MQ\\=\\=>.QNxKNLi6fGs3tjszDzvvQA\\=\\= {\r\n color: inherit;\r\n font: inherit;\r\n font-size: inherit;\r\n font-family: inherit;\r\n line-height: inherit;\r\n font-weight: inherit;\r\n text-align: inherit;\r\n letter-spacing: inherit;\r\n}\r\n\r\n.Yni3Pvql0herzks7Xy73MQ\\=\\=.Xm3P6SEehRyAZrUM1TLYZA\\=\\= {\r\n color: var(--neutral-text-disabled-color);\r\n background-color: var(--neutral-disable-background-color) !important;\r\n border-color: var(--neutral-disable-background-color) !important;\r\n pointer-events: none !important;\r\n}\r\n\r\n.Yni3Pvql0herzks7Xy73MQ\\=\\=[class~="tag-primary"] {\r\n background-color: var(--primary-main-color) !important;\r\n border-color: var(--primary-main-color) !important;\r\n}\r\n\r\n.Yni3Pvql0herzks7Xy73MQ\\=\\=[class~="tag-primary"] * {\r\n color: var(--neutral-text-stable-color) !important;\r\n --color: var(--neutral-text-stable-color) !important;\r\n}\r\n\r\n.Yni3Pvql0herzks7Xy73MQ\\=\\=[class~="tag-grey"] {\r\n border-color: var(--neutral-bolder-border-color) !important;\r\n background-color: var(--neutral-main-background-color) !important;\r\n}\r\n\r\n.Yni3Pvql0herzks7Xy73MQ\\=\\=[class~="tag-grey"] * {\r\n color: var(--neutral-text-subtitle-color) !important;\r\n --color: var(--neutral-text-subtitle-color) !important;\r\n}\r\n\r\n.Yni3Pvql0herzks7Xy73MQ\\=\\=[class~="tag-neutral"] {\r\n border-color: var(--neutral-bolder-border-color) !important;\r\n}\r\n\r\n.Yni3Pvql0herzks7Xy73MQ\\=\\=[class~="tag-neutral"] * {\r\n color: var(--neutral-text-subtitle-color) !important;\r\n --color: var(--neutral-text-subtitle-color) !important;\r\n}\r\n\r\n.Yni3Pvql0herzks7Xy73MQ\\=\\=[class~="tag-infor"] {\r\n background-color: var(--infor-background);\r\n border-color: var(--infor-main-color) !important;\r\n}\r\n\r\n.Yni3Pvql0herzks7Xy73MQ\\=\\=[class~="tag-infor"] * {\r\n color: var(--infor-main-color) !important;\r\n --color: var(--infor-main-color) !important;\r\n}\r\n\r\n.Yni3Pvql0herzks7Xy73MQ\\=\\=[class~="tag-warning"] {\r\n background-color: var(--warning-background);\r\n border-color: var(--warning-main-color) !important;\r\n}\r\n\r\n.Yni3Pvql0herzks7Xy73MQ\\=\\=[class~="tag-warning"] * {\r\n color: var(--warning-main-color) !important;\r\n --color: var(--warning-main-color) !important;\r\n}\r\n\r\n.Yni3Pvql0herzks7Xy73MQ\\=\\=[class~="tag-error"] {\r\n background-color: var(--error-background);\r\n border-color: var(--error-main-color) !important;\r\n}\r\n\r\n.Yni3Pvql0herzks7Xy73MQ\\=\\=[class~="tag-error"] * {\r\n color: var(--error-main-color) !important;\r\n --color: var(--error-main-color) !important;\r\n}\r\n\r\n.Yni3Pvql0herzks7Xy73MQ\\=\\=[class~="tag-success"] {\r\n background-color: var(--success-background);\r\n border-color: var(--success-main-color) !important;\r\n}\r\n\r\n.Yni3Pvql0herzks7Xy73MQ\\=\\=[class~="tag-success"] * {\r\n color: var(--success-main-color) !important;\r\n --color: var(--success-main-color) !important;\r\n}',""]),r.locals={"tag-container":"Yni3Pvql0herzks7Xy73MQ==","type-button":"CSye1BUBhJvpGtuHsh-cSg==","tag-label":"QNxKNLi6fGs3tjszDzvvQA==",disabled:"Xm3P6SEehRyAZrUM1TLYZA=="};const s=r},852:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,':root {\r\n --toastify-color-light: #fff;\r\n --toastify-color-dark: #121212;\r\n --toastify-color-info: #287CF0;\r\n --toastify-color-success: #3AAC6D;\r\n --toastify-color-warning: #FC7A1C;\r\n --toastify-color-error: #E14337;\r\n --toastify-color-transparent: rgba(255, 255, 255, 0.7);\r\n --toastify-icon-color-info: var(--toastify-color-info);\r\n --toastify-icon-color-success: var(--toastify-color-success);\r\n --toastify-icon-color-warning: var(--toastify-color-warning);\r\n --toastify-icon-color-error: var(--toastify-color-error);\r\n --toastify-toast-width: 320px;\r\n --toastify-toast-offset: 16px;\r\n --toastify-toast-top: max(var(--toastify-toast-offset), env(safe-area-inset-top));\r\n --toastify-toast-right: max(var(--toastify-toast-offset), env(safe-area-inset-right));\r\n --toastify-toast-left: max(var(--toastify-toast-offset), env(safe-area-inset-left));\r\n --toastify-toast-bottom: max(var(--toastify-toast-offset), env(safe-area-inset-bottom));\r\n --toastify-toast-background: #fff;\r\n --toastify-toast-min-height: 64px;\r\n --toastify-toast-max-height: 800px;\r\n --toastify-toast-bd-radius: 6px;\r\n --toastify-font-family: sans-serif;\r\n --toastify-z-index: 9999;\r\n --toastify-text-color-light: #757575;\r\n --toastify-text-color-dark: #fff;\r\n --toastify-text-color-info: #fff;\r\n --toastify-text-color-success: #fff;\r\n --toastify-text-color-warning: #fff;\r\n --toastify-text-color-error: #fff;\r\n --toastify-spinner-color: #616161;\r\n --toastify-spinner-color-empty-area: #e0e0e0;\r\n --toastify-color-progress-light: linear-gradient(to right,\r\n #4cd964,\r\n #5ac8fa,\r\n #007aff,\r\n #34aadc,\r\n #5856d6,\r\n #ff2d55);\r\n --toastify-color-progress-dark: #bb86fc;\r\n --toastify-color-progress-info: var(--toastify-color-info);\r\n --toastify-color-progress-success: var(--toastify-color-success);\r\n --toastify-color-progress-warning: var(--toastify-color-warning);\r\n --toastify-color-progress-error: var(--toastify-color-error);\r\n --toastify-color-progress-bgo: 0.2;\r\n}\r\n\r\n.Toastify__toast-container {\r\n z-index: var(--toastify-z-index);\r\n transform: translate3d(0, 0, var(--toastify-z-index));\r\n position: fixed;\r\n padding: 4px;\r\n width: var(--toastify-toast-width);\r\n box-sizing: border-box;\r\n color: #fff;\r\n}\r\n\r\n.Toastify__toast-container--top-left {\r\n top: var(--toastify-toast-top);\r\n left: var(--toastify-toast-left);\r\n}\r\n\r\n.Toastify__toast-container--top-center {\r\n top: var(--toastify-toast-top);\r\n left: 50%;\r\n transform: translateX(-50%);\r\n}\r\n\r\n.Toastify__toast-container--top-right {\r\n top: var(--toastify-toast-top);\r\n right: var(--toastify-toast-right);\r\n}\r\n\r\n.Toastify__toast-container--bottom-left {\r\n bottom: var(--toastify-toast-bottom);\r\n left: var(--toastify-toast-left);\r\n}\r\n\r\n.Toastify__toast-container--bottom-center {\r\n bottom: var(--toastify-toast-bottom);\r\n left: 50%;\r\n transform: translateX(-50%);\r\n}\r\n\r\n.Toastify__toast-container--bottom-right {\r\n bottom: var(--toastify-toast-bottom);\r\n right: var(--toastify-toast-right);\r\n}\r\n\r\n@media only screen and (max-width : 480px) {\r\n .Toastify__toast-container {\r\n width: 100vw;\r\n padding: 0;\r\n left: env(safe-area-inset-left);\r\n margin: 0;\r\n }\r\n\r\n .Toastify__toast-container--top-left,\r\n .Toastify__toast-container--top-center,\r\n .Toastify__toast-container--top-right {\r\n top: env(safe-area-inset-top);\r\n transform: translateX(0);\r\n }\r\n\r\n .Toastify__toast-container--bottom-left,\r\n .Toastify__toast-container--bottom-center,\r\n .Toastify__toast-container--bottom-right {\r\n bottom: env(safe-area-inset-bottom);\r\n transform: translateX(0);\r\n }\r\n\r\n .Toastify__toast-container--rtl {\r\n right: env(safe-area-inset-right);\r\n left: initial;\r\n }\r\n}\r\n\r\n.Toastify__toast {\r\n --y: 0;\r\n position: relative;\r\n -ms-touch-action: none;\r\n touch-action: none;\r\n min-height: var(--toastify-toast-min-height);\r\n box-sizing: border-box;\r\n margin-bottom: 1rem;\r\n padding: 8px;\r\n border-radius: var(--toastify-toast-bd-radius);\r\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);\r\n display: -ms-flexbox;\r\n display: flex;\r\n -ms-flex-pack: justify;\r\n justify-content: space-between;\r\n max-height: var(--toastify-toast-max-height);\r\n font-family: var(--toastify-font-family);\r\n cursor: default;\r\n direction: ltr;\r\n /* webkit only issue #791 */\r\n z-index: 0;\r\n overflow: hidden;\r\n}\r\n\r\n.Toastify__toast--stacked {\r\n position: absolute;\r\n width: 100%;\r\n transform: translate3d(0, var(--y), 0) scale(var(--s));\r\n transition: transform 0.3s;\r\n}\r\n\r\n.Toastify__toast--stacked[data-collapsed] .Toastify__toast-body,\r\n.Toastify__toast--stacked[data-collapsed] .Toastify__close-button {\r\n transition: opacity 0.1s;\r\n}\r\n\r\n.Toastify__toast--stacked[data-collapsed=false] {\r\n overflow: visible;\r\n}\r\n\r\n.Toastify__toast--stacked[data-collapsed=true]:not(:last-child)>* {\r\n opacity: 0;\r\n}\r\n\r\n.Toastify__toast--stacked:after {\r\n content: "";\r\n position: absolute;\r\n left: 0;\r\n right: 0;\r\n height: calc(var(--g) * 1px);\r\n bottom: 100%;\r\n}\r\n\r\n.Toastify__toast--stacked[data-pos=top] {\r\n top: 0;\r\n}\r\n\r\n.Toastify__toast--stacked[data-pos=bot] {\r\n bottom: 0;\r\n}\r\n\r\n.Toastify__toast--stacked[data-pos=bot].Toastify__toast--stacked:before {\r\n transform-origin: top;\r\n}\r\n\r\n.Toastify__toast--stacked[data-pos=top].Toastify__toast--stacked:before {\r\n transform-origin: bottom;\r\n}\r\n\r\n.Toastify__toast--stacked:before {\r\n content: "";\r\n position: absolute;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n height: 100%;\r\n transform: scaleY(3);\r\n z-index: -1;\r\n}\r\n\r\n.Toastify__toast--rtl {\r\n direction: rtl;\r\n}\r\n\r\n.Toastify__toast--close-on-click {\r\n cursor: pointer;\r\n}\r\n\r\n.Toastify__toast-body {\r\n margin: auto 0;\r\n -ms-flex: 1 1 auto;\r\n flex: 1 1 auto;\r\n padding: 6px;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n}\r\n\r\n.Toastify__toast-body>div:last-child {\r\n word-break: break-word;\r\n -ms-flex: 1;\r\n flex: 1;\r\n}\r\n\r\n.Toastify__toast-icon {\r\n -webkit-margin-end: 10px;\r\n margin-inline-end: 10px;\r\n width: 20px;\r\n -ms-flex-negative: 0;\r\n flex-shrink: 0;\r\n display: -ms-flexbox;\r\n display: flex;\r\n}\r\n\r\n.Toastify--animate {\r\n animation-fill-mode: both;\r\n animation-duration: 0.5s;\r\n}\r\n\r\n.Toastify--animate-icon {\r\n animation-fill-mode: both;\r\n animation-duration: 0.3s;\r\n}\r\n\r\n@media only screen and (max-width : 480px) {\r\n .Toastify__toast {\r\n margin-bottom: 0;\r\n border-radius: 0;\r\n }\r\n}\r\n\r\n.Toastify__toast-theme--dark {\r\n background: var(--toastify-color-dark);\r\n color: var(--toastify-text-color-dark);\r\n}\r\n\r\n.Toastify__toast-theme--light {\r\n background: var(--toastify-color-light);\r\n color: var(--toastify-text-color-light);\r\n}\r\n\r\n.Toastify__toast-theme--colored.Toastify__toast--default {\r\n background: var(--toastify-color-light);\r\n color: var(--toastify-text-color-light);\r\n}\r\n\r\n.Toastify__toast-theme--colored.Toastify__toast--info {\r\n color: var(--toastify-text-color-info);\r\n background: var(--toastify-color-info);\r\n}\r\n\r\n.Toastify__toast-theme--colored.Toastify__toast--success {\r\n color: var(--toastify-text-color-success);\r\n background: var(--toastify-color-success);\r\n}\r\n\r\n.Toastify__toast-theme--colored.Toastify__toast--warning {\r\n color: var(--toastify-text-color-warning);\r\n background: var(--toastify-color-warning);\r\n}\r\n\r\n.Toastify__toast-theme--colored.Toastify__toast--error {\r\n color: var(--toastify-text-color-error);\r\n background: var(--toastify-color-error);\r\n}\r\n\r\n.Toastify__progress-bar-theme--light {\r\n background: var(--toastify-color-progress-light);\r\n}\r\n\r\n.Toastify__progress-bar-theme--dark {\r\n background: var(--toastify-color-progress-dark);\r\n}\r\n\r\n.Toastify__progress-bar--info {\r\n background: var(--toastify-color-progress-info);\r\n}\r\n\r\n.Toastify__progress-bar--success {\r\n background: var(--toastify-color-progress-success);\r\n}\r\n\r\n.Toastify__progress-bar--warning {\r\n background: var(--toastify-color-progress-warning);\r\n}\r\n\r\n.Toastify__progress-bar--error {\r\n background: var(--toastify-color-progress-error);\r\n}\r\n\r\n.Toastify__progress-bar-theme--colored.Toastify__progress-bar--info,\r\n.Toastify__progress-bar-theme--colored.Toastify__progress-bar--success,\r\n.Toastify__progress-bar-theme--colored.Toastify__progress-bar--warning,\r\n.Toastify__progress-bar-theme--colored.Toastify__progress-bar--error {\r\n background: var(--toastify-color-transparent);\r\n}\r\n\r\n.Toastify__close-button {\r\n color: #fff;\r\n background: transparent;\r\n outline: none;\r\n border: none;\r\n padding: 0;\r\n cursor: pointer;\r\n opacity: 0.7;\r\n transition: 0.3s ease;\r\n -ms-flex-item-align: start;\r\n align-self: flex-start;\r\n z-index: 1;\r\n}\r\n\r\n.Toastify__close-button--light {\r\n color: #000;\r\n opacity: 0.3;\r\n}\r\n\r\n.Toastify__close-button>svg {\r\n fill: currentColor;\r\n height: 16px;\r\n width: 14px;\r\n}\r\n\r\n.Toastify__close-button:hover,\r\n.Toastify__close-button:focus {\r\n opacity: 1;\r\n}\r\n\r\n@keyframes Toastify__trackProgress {\r\n 0% {\r\n transform: scaleX(1);\r\n }\r\n\r\n 100% {\r\n transform: scaleX(0);\r\n }\r\n}\r\n\r\n.Toastify__progress-bar {\r\n position: absolute;\r\n bottom: 0;\r\n left: 0;\r\n width: 100%;\r\n height: 100%;\r\n z-index: var(--toastify-z-index);\r\n opacity: 0.7;\r\n transform-origin: left;\r\n border-bottom-left-radius: var(--toastify-toast-bd-radius);\r\n}\r\n\r\n.Toastify__progress-bar--animated {\r\n animation: Toastify__trackProgress linear 1 forwards;\r\n}\r\n\r\n.Toastify__progress-bar--controlled {\r\n transition: transform 0.2s;\r\n}\r\n\r\n.Toastify__progress-bar--rtl {\r\n right: 0;\r\n left: initial;\r\n transform-origin: right;\r\n border-bottom-left-radius: initial;\r\n border-bottom-right-radius: var(--toastify-toast-bd-radius);\r\n}\r\n\r\n.Toastify__progress-bar--wrp {\r\n position: absolute;\r\n bottom: 0;\r\n left: 0;\r\n width: 100%;\r\n height: 5px;\r\n border-bottom-left-radius: var(--toastify-toast-bd-radius);\r\n}\r\n\r\n.Toastify__progress-bar--wrp[data-hidden=true] {\r\n opacity: 0;\r\n}\r\n\r\n.Toastify__progress-bar--bg {\r\n opacity: var(--toastify-color-progress-bgo);\r\n width: 100%;\r\n height: 100%;\r\n}\r\n\r\n.Toastify__spinner {\r\n width: 20px;\r\n height: 20px;\r\n box-sizing: border-box;\r\n border: 2px solid;\r\n border-radius: 100%;\r\n border-color: var(--toastify-spinner-color-empty-area);\r\n border-right-color: var(--toastify-spinner-color);\r\n animation: Toastify__spin 0.65s linear infinite;\r\n}\r\n\r\n@keyframes Toastify__bounceInRight {\r\n\r\n from,\r\n 60%,\r\n 75%,\r\n 90%,\r\n to {\r\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\r\n }\r\n\r\n from {\r\n opacity: 0;\r\n transform: translate3d(3000px, 0, 0);\r\n }\r\n\r\n 60% {\r\n opacity: 1;\r\n transform: translate3d(-25px, 0, 0);\r\n }\r\n\r\n 75% {\r\n transform: translate3d(10px, 0, 0);\r\n }\r\n\r\n 90% {\r\n transform: translate3d(-5px, 0, 0);\r\n }\r\n\r\n to {\r\n transform: none;\r\n }\r\n}\r\n\r\n@keyframes Toastify__bounceOutRight {\r\n 20% {\r\n opacity: 1;\r\n transform: translate3d(-20px, var(--y), 0);\r\n }\r\n\r\n to {\r\n opacity: 0;\r\n transform: translate3d(2000px, var(--y), 0);\r\n }\r\n}\r\n\r\n@keyframes Toastify__bounceInLeft {\r\n\r\n from,\r\n 60%,\r\n 75%,\r\n 90%,\r\n to {\r\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\r\n }\r\n\r\n 0% {\r\n opacity: 0;\r\n transform: translate3d(-3000px, 0, 0);\r\n }\r\n\r\n 60% {\r\n opacity: 1;\r\n transform: translate3d(25px, 0, 0);\r\n }\r\n\r\n 75% {\r\n transform: translate3d(-10px, 0, 0);\r\n }\r\n\r\n 90% {\r\n transform: translate3d(5px, 0, 0);\r\n }\r\n\r\n to {\r\n transform: none;\r\n }\r\n}\r\n\r\n@keyframes Toastify__bounceOutLeft {\r\n 20% {\r\n opacity: 1;\r\n transform: translate3d(20px, var(--y), 0);\r\n }\r\n\r\n to {\r\n opacity: 0;\r\n transform: translate3d(-2000px, var(--y), 0);\r\n }\r\n}\r\n\r\n@keyframes Toastify__bounceInUp {\r\n\r\n from,\r\n 60%,\r\n 75%,\r\n 90%,\r\n to {\r\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\r\n }\r\n\r\n from {\r\n opacity: 0;\r\n transform: translate3d(0, 3000px, 0);\r\n }\r\n\r\n 60% {\r\n opacity: 1;\r\n transform: translate3d(0, -20px, 0);\r\n }\r\n\r\n 75% {\r\n transform: translate3d(0, 10px, 0);\r\n }\r\n\r\n 90% {\r\n transform: translate3d(0, -5px, 0);\r\n }\r\n\r\n to {\r\n transform: translate3d(0, 0, 0);\r\n }\r\n}\r\n\r\n@keyframes Toastify__bounceOutUp {\r\n 20% {\r\n transform: translate3d(0, calc(var(--y) - 10px), 0);\r\n }\r\n\r\n 40%,\r\n 45% {\r\n opacity: 1;\r\n transform: translate3d(0, calc(var(--y) + 20px), 0);\r\n }\r\n\r\n to {\r\n opacity: 0;\r\n transform: translate3d(0, -2000px, 0);\r\n }\r\n}\r\n\r\n@keyframes Toastify__bounceInDown {\r\n\r\n from,\r\n 60%,\r\n 75%,\r\n 90%,\r\n to {\r\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\r\n }\r\n\r\n 0% {\r\n opacity: 0;\r\n transform: translate3d(0, -3000px, 0);\r\n }\r\n\r\n 60% {\r\n opacity: 1;\r\n transform: translate3d(0, 25px, 0);\r\n }\r\n\r\n 75% {\r\n transform: translate3d(0, -10px, 0);\r\n }\r\n\r\n 90% {\r\n transform: translate3d(0, 5px, 0);\r\n }\r\n\r\n to {\r\n transform: none;\r\n }\r\n}\r\n\r\n@keyframes Toastify__bounceOutDown {\r\n 20% {\r\n transform: translate3d(0, calc(var(--y) - 10px), 0);\r\n }\r\n\r\n 40%,\r\n 45% {\r\n opacity: 1;\r\n transform: translate3d(0, calc(var(--y) + 20px), 0);\r\n }\r\n\r\n to {\r\n opacity: 0;\r\n transform: translate3d(0, 2000px, 0);\r\n }\r\n}\r\n\r\n.Toastify__bounce-enter--top-left,\r\n.Toastify__bounce-enter--bottom-left {\r\n animation-name: Toastify__bounceInLeft;\r\n}\r\n\r\n.Toastify__bounce-enter--top-right,\r\n.Toastify__bounce-enter--bottom-right {\r\n animation-name: Toastify__bounceInRight;\r\n}\r\n\r\n.Toastify__bounce-enter--top-center {\r\n animation-name: Toastify__bounceInDown;\r\n}\r\n\r\n.Toastify__bounce-enter--bottom-center {\r\n animation-name: Toastify__bounceInUp;\r\n}\r\n\r\n.Toastify__bounce-exit--top-left,\r\n.Toastify__bounce-exit--bottom-left {\r\n animation-name: Toastify__bounceOutLeft;\r\n}\r\n\r\n.Toastify__bounce-exit--top-right,\r\n.Toastify__bounce-exit--bottom-right {\r\n animation-name: Toastify__bounceOutRight;\r\n}\r\n\r\n.Toastify__bounce-exit--top-center {\r\n animation-name: Toastify__bounceOutUp;\r\n}\r\n\r\n.Toastify__bounce-exit--bottom-center {\r\n animation-name: Toastify__bounceOutDown;\r\n}\r\n\r\n@keyframes Toastify__zoomIn {\r\n from {\r\n opacity: 0;\r\n transform: scale3d(0.3, 0.3, 0.3);\r\n }\r\n\r\n 50% {\r\n opacity: 1;\r\n }\r\n}\r\n\r\n@keyframes Toastify__zoomOut {\r\n from {\r\n opacity: 1;\r\n }\r\n\r\n 50% {\r\n opacity: 0;\r\n transform: translate3d(0, var(--y), 0) scale3d(0.3, 0.3, 0.3);\r\n }\r\n\r\n to {\r\n opacity: 0;\r\n }\r\n}\r\n\r\n.Toastify__zoom-enter {\r\n animation-name: Toastify__zoomIn;\r\n}\r\n\r\n.Toastify__zoom-exit {\r\n animation-name: Toastify__zoomOut;\r\n}\r\n\r\n@keyframes Toastify__flipIn {\r\n from {\r\n transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\r\n animation-timing-function: ease-in;\r\n opacity: 0;\r\n }\r\n\r\n 40% {\r\n transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\r\n animation-timing-function: ease-in;\r\n }\r\n\r\n 60% {\r\n transform: perspective(400px) rotate3d(1, 0, 0, 10deg);\r\n opacity: 1;\r\n }\r\n\r\n 80% {\r\n transform: perspective(400px) rotate3d(1, 0, 0, -5deg);\r\n }\r\n\r\n to {\r\n transform: perspective(400px);\r\n }\r\n}\r\n\r\n@keyframes Toastify__flipOut {\r\n from {\r\n transform: translate3d(0, var(--y), 0) perspective(400px);\r\n }\r\n\r\n 30% {\r\n transform: translate3d(0, var(--y), 0) perspective(400px) rotate3d(1, 0, 0, -20deg);\r\n opacity: 1;\r\n }\r\n\r\n to {\r\n transform: translate3d(0, var(--y), 0) perspective(400px) rotate3d(1, 0, 0, 90deg);\r\n opacity: 0;\r\n }\r\n}\r\n\r\n.Toastify__flip-enter {\r\n animation-name: Toastify__flipIn;\r\n}\r\n\r\n.Toastify__flip-exit {\r\n animation-name: Toastify__flipOut;\r\n}\r\n\r\n@keyframes Toastify__slideInRight {\r\n from {\r\n transform: translate3d(110%, 0, 0);\r\n visibility: visible;\r\n }\r\n\r\n to {\r\n transform: translate3d(0, var(--y), 0);\r\n }\r\n}\r\n\r\n@keyframes Toastify__slideInLeft {\r\n from {\r\n transform: translate3d(-110%, 0, 0);\r\n visibility: visible;\r\n }\r\n\r\n to {\r\n transform: translate3d(0, var(--y), 0);\r\n }\r\n}\r\n\r\n@keyframes Toastify__slideInUp {\r\n from {\r\n transform: translate3d(0, 110%, 0);\r\n visibility: visible;\r\n }\r\n\r\n to {\r\n transform: translate3d(0, var(--y), 0);\r\n }\r\n}\r\n\r\n@keyframes Toastify__slideInDown {\r\n from {\r\n transform: translate3d(0, -110%, 0);\r\n visibility: visible;\r\n }\r\n\r\n to {\r\n transform: translate3d(0, var(--y), 0);\r\n }\r\n}\r\n\r\n@keyframes Toastify__slideOutRight {\r\n from {\r\n transform: translate3d(0, var(--y), 0);\r\n }\r\n\r\n to {\r\n visibility: hidden;\r\n transform: translate3d(110%, var(--y), 0);\r\n }\r\n}\r\n\r\n@keyframes Toastify__slideOutLeft {\r\n from {\r\n transform: translate3d(0, var(--y), 0);\r\n }\r\n\r\n to {\r\n visibility: hidden;\r\n transform: translate3d(-110%, var(--y), 0);\r\n }\r\n}\r\n\r\n@keyframes Toastify__slideOutDown {\r\n from {\r\n transform: translate3d(0, var(--y), 0);\r\n }\r\n\r\n to {\r\n visibility: hidden;\r\n transform: translate3d(0, 500px, 0);\r\n }\r\n}\r\n\r\n@keyframes Toastify__slideOutUp {\r\n from {\r\n transform: translate3d(0, var(--y), 0);\r\n }\r\n\r\n to {\r\n visibility: hidden;\r\n transform: translate3d(0, -500px, 0);\r\n }\r\n}\r\n\r\n.Toastify__slide-enter--top-left,\r\n.Toastify__slide-enter--bottom-left {\r\n animation-name: Toastify__slideInLeft;\r\n}\r\n\r\n.Toastify__slide-enter--top-right,\r\n.Toastify__slide-enter--bottom-right {\r\n animation-name: Toastify__slideInRight;\r\n}\r\n\r\n.Toastify__slide-enter--top-center {\r\n animation-name: Toastify__slideInDown;\r\n}\r\n\r\n.Toastify__slide-enter--bottom-center {\r\n animation-name: Toastify__slideInUp;\r\n}\r\n\r\n.Toastify__slide-exit--top-left,\r\n.Toastify__slide-exit--bottom-left {\r\n animation-name: Toastify__slideOutLeft;\r\n animation-timing-function: ease-in;\r\n animation-duration: 0.3s;\r\n}\r\n\r\n.Toastify__slide-exit--top-right,\r\n.Toastify__slide-exit--bottom-right {\r\n animation-name: Toastify__slideOutRight;\r\n animation-timing-function: ease-in;\r\n animation-duration: 0.3s;\r\n}\r\n\r\n.Toastify__slide-exit--top-center {\r\n animation-name: Toastify__slideOutUp;\r\n animation-timing-function: ease-in;\r\n animation-duration: 0.3s;\r\n}\r\n\r\n.Toastify__slide-exit--bottom-center {\r\n animation-name: Toastify__slideOutDown;\r\n animation-timing-function: ease-in;\r\n animation-duration: 0.3s;\r\n}\r\n\r\n@keyframes Toastify__spin {\r\n from {\r\n transform: rotate(0deg);\r\n }\r\n\r\n to {\r\n transform: rotate(360deg);\r\n }\r\n}',""]);const s=r},898:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(314),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,".custom-table {\r\n border: none;\r\n min-width: 100%;\r\n border-collapse: collapse;\r\n}\r\n\r\n.custom-table>.tb-header {\r\n top: -1px;\r\n z-index: 4;\r\n position: sticky;\r\n background-color: #f9fafb;\r\n}\r\n\r\n.custom-table>.tb-header>tr {\r\n border-top: var(--neutral-bolder-border);\r\n border-bottom: var(--neutral-bolder-border);\r\n}\r\n\r\n.custom-table .tb-cell {\r\n height: 4.4rem;\r\n text-align: left;\r\n padding: 0 2.4rem;\r\n font: 400 1.4rem/2.2rem 'Inter';\r\n color: #00204DCC;\r\n vertical-align: middle;\r\n}\r\n\r\n.custom-table tr>td {\r\n background-color: #ffffff;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n max-width: 52rem;\r\n}\r\n\r\n.custom-table>.tb-header>tr>td {\r\n font: 600 1.2rem/2rem 'Inter';\r\n white-space: nowrap;\r\n color: #00204D99;\r\n background-color: #f9fafb;\r\n}\r\n\r\n.custom-table tr.selected {\r\n background-color: #f5f7fa;\r\n}\r\n\r\n.custom-table tr.selected>td {\r\n background-color: #f5f7fa;\r\n}\r\n\r\n.tb-row>.tb-cell.tb-cell-fixed {\r\n z-index: 2;\r\n position: sticky;\r\n /* box-shadow: 1px 0px 6px 0px rgba(45, 50, 57, 0.06); */\r\n background-color: #ffffff;\r\n}\r\n\r\n.tb-header .tb-cell.tb-cell-fixed {\r\n z-index: 2;\r\n position: sticky;\r\n /* box-shadow: 1px 0px 6px 0px rgba(45, 50, 57, 0.06); */\r\n background-color: #f9fafb;\r\n}\r\n\r\n.tb-cell[align-cell='start'] {\r\n text-align: start;\r\n}\r\n\r\n.tb-cell[align-cell='center'] {\r\n text-align: center;\r\n}\r\n\r\n.tb-cell[align-cell='end'] {\r\n text-align: end;\r\n}",""]);const s=r},915:e=>{e.exports={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}},925:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}},s={};function o(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={id:e,exports:{}};return r[e].call(n.exports,n,n.exports,o),n.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},i=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var r=Object.create(null);o.r(r);var s={};n=n||[null,i({}),i([]),i(i)];for(var a=2&t&&e;"object"==typeof a&&!~n.indexOf(a);a=i(a))Object.getOwnPropertyNames(a).forEach((t=>s[t]=()=>e[t]));return s.default=()=>e,o.d(r,s),r},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nc=void 0;var a={};return(()=>{"use strict";o.r(a),o.d(a,{Button:()=>Dt,Calendar:()=>Mt,CellAlignItems:()=>gn,Checkbox:()=>l,ComponentStatus:()=>tn,CustomCkEditor5:()=>TF,CustomSlider:()=>Si,DateTimePicker:()=>qt,Dialog:()=>J,DialogAlignment:()=>Z,ImportFile:()=>Nn,InfiniteScroll:()=>vi,InputOtp:()=>Bi,NumberPicker:()=>Ni,Pagination:()=>hn,Popup:()=>D,ProgressBar:()=>en,ProgressCircle:()=>Ci,RadioButton:()=>xn,Rating:()=>ki,Select1:()=>H,SelectMultiple:()=>Yt,Switch:()=>q,Table:()=>vn,Tag:()=>Oi,TbBody:()=>wn,TbCell:()=>pn,TbHeader:()=>bn,TbRow:()=>fn,Text:()=>f,TextArea:()=>Tn,TextField:()=>Et,ToastContainer:()=>gi,ToastMessage:()=>fi,WLoginView:()=>zi,Winicon:()=>w,closePopup:()=>F,getStatusIcon:()=>nn,i18n:()=>gD,showDialog:()=>X,showPopup:()=>B});var e=o(12),t=o.n(e),n=o(72),i=o.n(n),r=o(486);i()(r.A,{insert:"head",singleton:!1});const s=r.A.locals||{};class l extends t().Component{ref=(()=>(0,e.createRef)())();constructor(e){super(e),this.state={value:this.props.value??!1}}componentDidUpdate(e){e.value!==this.props.value&&this.setState({value:this.props.value})}onChange=()=>{const e=!this.state.value;this.setState({value:e}),this.props.onChange&&this.ref.current&&this.props.onChange(e,this.ref.current.querySelector("input"))};render(){let e={width:this.props.size??"2.4rem",height:this.props.size??"2.4rem"};return this.props.style&&(delete this.props.style.width,delete this.props.style.minWidth,delete this.props.style.maxWidth,delete this.props.style.height,delete this.props.style.minHeight,delete this.props.style.maxHeight,e={...this.props.style,...e}),t().createElement("label",{ref:this.ref,id:this.props.id,className:`${s["checkbox-container"]} row ${this.props.className??""}`,style:e,"is-null-value":`${null==this.state.value}`,onClick:this.props.onClick},t().createElement("input",{type:"checkbox",checked:!!this.state.value,disabled:this.props.disabled,onChange:e=>{e.stopPropagation();const t=!this.state.value;this.setState({value:t}),this.props.onChange&&this.props.onChange(t,e.target)}}),t().createElement("svg",{width:"100%",height:"100%",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{"--check-color":this.props.checkColor}},void 0===this.state.value?t().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.79199 9.95298C4.79199 9.69148 5.00398 9.47949 5.26548 9.47949H14.7352C14.9967 9.47949 15.2087 9.69148 15.2087 9.95298C15.2087 10.2145 14.9967 10.4265 14.7352 10.4265H5.26548C5.00398 10.4265 4.79199 10.2145 4.79199 9.95298Z"}):t().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.07 6.49317C15.2549 6.67808 15.2549 6.97787 15.07 7.16278L8.91467 13.3181C8.72977 13.503 8.42997 13.503 8.24507 13.3181L4.93067 10.0037C4.74577 9.81878 4.74577 9.51899 4.93067 9.33408C5.11558 9.14917 5.41537 9.14917 5.60028 9.33408L8.57987 12.3137L14.4004 6.49317C14.5853 6.30827 14.8851 6.30827 15.07 6.49317Z"})))}}var c=o(30);i()(c.A,{insert:"head",singleton:!1});const d=c.A.locals||{};var u=o(33),h=o.n(u),m=o(668);i()(m.A,{insert:"head",singleton:!1});const g=m.A.locals||{};var p=o(406);i()(p.A,{insert:"head",singleton:!1}),p.A.locals;class f extends t().Component{render(){let e=this.props.style??{};return this.props.maxLine&&(e={...e,"--max-line":this.props.maxLine}),this.props.html?t().createElement("div",{dangerouslySetInnerHTML:{__html:this.props.html},id:this.props.id,onMouseOver:this.props.onHover,onClick:this.props.onClick,className:`comp-text innerhtml ${this.props.onClick?"type-button":""} ${this.props.className??""}`,style:e}):t().createElement("div",{id:this.props.id,onMouseOver:this.props.onHover,onClick:this.props.onClick,className:`comp-text ${this.props.onClick?"type-button":""} ${this.props.className??""}`,style:e},this.props.children)}}function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},b.apply(null,arguments)}function w(n){let{id:i,src:r,link:s,className:o,style:a,size:l,color:c,alt:d,onClick:u,tooltip:m}=n;const p=(0,e.useRef)(null),[w,v]=(0,e.useState)(),[y,_]=(0,e.useState)(!1),k=(0,e.useMemo)((()=>m?{"tooltip-value":m,onMouseOver:()=>{_(!0)},onMouseOut:()=>{_(!1)}}:{}),[m]);return(0,e.useEffect)((()=>{r?fetch("https://cdn.jsdelivr.net/gh/WiniGit/icon-library@latest/"+r+".svg").then((async e=>{v(await e.text())})).catch((()=>{v(d??"error")})):s&&fetch(s).then((async e=>{v(await e.text())}))}),[r,s]),t().createElement(t().Fragment,null,t().createElement("div",b({ref:p,id:i,onClick:u,className:`${g["wini-icon"]} ${w?"":"skeleton-loading"} ${u?g.clickable:""} ${o??""} ${r?r.split("/").map(((e,t)=>0===t?`${e}-icon`:e.replace(" ","-"))).join(" "):""}${s?" link-icon":""}`,style:a?{...a,"--size":l,"--color":c}:{"--size":l,"--color":c},dangerouslySetInnerHTML:{__html:w??""}},k)),m&&y&&h().createPortal((()=>{if(!p.current)return null;const e=p.current.getBoundingClientRect();let n=m.position??"bottom";switch(document.body.offsetHeight-e.bottom<100&&"bottom"===n?n="top":e.top<100&&"top"===n&&(n="bottom"),document.body.offsetWidth-e.right<100&&"right"===n?n="left":e.left<100&&"left"===n&&(n="right"),n){case"top":return t().createElement("div",{ref:t=>{if(t){const n=t.getBoundingClientRect();n.x<0?(t.style.left=e.x+e.width/2+"px",t.style.transform="translateX(-1.8rem)",t.style.alignItems="start"):n.right>document.body.offsetWidth&&(t.style.left="unset",t.style.right=document.body.offsetWidth-e.right-e.width/2+"px",t.style.transform="translateX(-1.4rem)",t.style.alignItems="end")}},className:`col ${g["tooltip-container"]}`,style:{alignItems:"center",bottom:document.body.offsetHeight-e.top-4,left:e.left+e.width/2,transform:"translateX(-50%)"}},t().createElement(f,{className:`body-3 ${g["tooltip-message"]}`,maxLine:2},m.message),t().createElement("div",{className:"row",style:{padding:"0 1.2rem",transform:"translateY(-0.2rem)"}},t().createElement("div",{style:{borderLeft:"0.6rem solid transparent",borderRight:"0.6rem solid transparent",borderTop:"0.8rem solid var(--neutral-main-reverse-background-color)",borderRadius:2}})));case"bottom":return t().createElement("div",{ref:t=>{if(t){const n=t.getBoundingClientRect();n.x<0?(t.style.left=e.x+e.width/2+"px",t.style.transform="translateX(-1.8rem)",t.style.alignItems="start"):n.right>document.body.offsetWidth&&(t.style.left="unset",t.style.right=document.body.offsetWidth-e.right-e.width/2+"px",t.style.transform="translateX(-1.4rem)",t.style.alignItems="end")}},className:`col ${g["tooltip-container"]}`,style:{alignItems:"center",top:e.bottom+4,left:e.left+e.width/2,transform:"translateX(-50%)"}},t().createElement("div",{className:"row",style:{padding:"0 1.2rem",transform:"translateY(0.2rem)"}},t().createElement("div",{style:{borderLeft:"0.6rem solid transparent",borderRight:"0.6rem solid transparent",borderBottom:"0.8rem solid var(--neutral-main-reverse-background-color)",borderRadius:2}})),t().createElement(f,{className:`body-3 ${g["tooltip-message"]}`,maxLine:2},m.message));case"left":return t().createElement("div",{ref:t=>{if(t){const n=t.getBoundingClientRect();n.y<0?(t.style.top=e.y+e.height/2+"px",t.style.transform="translateY(-1.8rem)",t.style.alignItems="start"):n.bottom>document.body.offsetHeight&&(t.style.top="unset",t.style.bottom=document.body.offsetHeight-e.bottom-e.height/2+"px",t.style.transform="translateY(-1.4rem)",t.style.alignItems="end")}},className:`row ${g["tooltip-container"]}`,style:{top:e.top+e.height/2,right:document.body.offsetWidth-e.left-4,transform:"translateY(-50%)"}},t().createElement(f,{className:`body-3 ${g["tooltip-message"]}`,maxLine:2},m.message),t().createElement("div",{className:"row",style:{padding:"1.2rem 0",transform:"translateX(-0.2rem)"}},t().createElement("div",{style:{borderTop:"0.6rem solid transparent",borderBottom:"0.6rem solid transparent",borderLeft:"0.8rem solid var(--neutral-main-reverse-background-color)",borderRadius:2}})));case"right":return t().createElement("div",{ref:t=>{if(t){const n=t.getBoundingClientRect();n.y<0?(t.style.top=e.y+e.height/2+"px",t.style.transform="translateY(-1.8rem)",t.style.alignItems="start"):n.bottom>document.body.offsetHeight&&(t.style.top="unset",t.style.bottom=document.body.offsetHeight-e.bottom-e.height/2+"px",t.style.transform="translateY(-1.4rem)",t.style.alignItems="end")}},className:`row ${g["tooltip-container"]}`,style:{top:e.top+e.height/2,left:e.right+4,transform:"translateY(-50%)"}},t().createElement("div",{className:"row",style:{padding:"1.2rem 0",transform:"translateX(0.2rem)"}},t().createElement("div",{style:{borderTop:"0.6rem solid transparent",borderBottom:"0.6rem solid transparent",borderRight:"0.8rem solid var(--neutral-main-reverse-background-color)",borderRadius:2}})),t().createElement(f,{className:`body-3 ${g["tooltip-message"]}`,maxLine:2},m.message));default:return t().createElement("div",null)}})(),document.body))}o(915),Object.create(null);const v={},y=(e,t,n,i)=>{C(n)&&v[n]||(C(n)&&(v[n]=new Date),((e,t,n,i)=>{const r=[n,{code:t,...i||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(r,"warn","react-i18next::",!0);C(r[0])&&(r[0]=`react-i18next:: ${r[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...r):console?.warn&&console.warn(...r)})(e,t,n,i))},_=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout((()=>{e.off("initialized",n)}),0),t()};e.on("initialized",n)}},k=(e,t,n)=>{e.loadNamespaces(t,_(e,n))},x=(e,t,n,i)=>{if(C(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return k(e,n,i);n.forEach((t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)})),e.loadLanguages(t,_(e,i))},C=e=>"string"==typeof e,A=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,E={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},T=e=>E[e];let S,P={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(A,T)};const I={type:"3rdParty",init(e){((e={})=>{P={...P,...e}})(e.options.react),(e=>{S=e})(e)}},O=(0,e.createContext)();class V{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach((e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)}))}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const R=(e,t,n,i)=>e.getFixedT(t,n,i),N=(t,n={})=>{const{i18n:i}=n,{i18n:r,defaultNS:s}=(0,e.useContext)(O)||{},o=i||r||S;if(o&&!o.reportNamespaces&&(o.reportNamespaces=new V),!o){y(o,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const e=(e,t)=>{return C(t)?t:"object"==typeof(n=t)&&null!==n&&C(t.defaultValue)?t.defaultValue:Array.isArray(e)?e[e.length-1]:e;var n},t=[e,{},!1];return t.t=e,t.i18n={},t.ready=!1,t}o.options.react?.wait&&y(o,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...P,...o.options.react,...n},{useSuspense:l,keyPrefix:c}=a;let d=t||s||o.options?.defaultNS;d=C(d)?[d]:d||["translation"],o.reportNamespaces.addUsedNamespaces?.(d);const u=(o.isInitialized||o.initializedStoreOnce)&&d.every((e=>((e,t,n={})=>t.languages&&t.languages.length?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(t,i)=>{if(n.bindI18n?.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!i(t.isLanguageChangingTo,e))return!1}}):(y(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0))(e,o,a))),h=((t,n,i,r)=>(0,e.useCallback)(R(t,n,i,r),[t,n,i,r]))(o,n.lng||null,"fallback"===a.nsMode?d:d[0],c),m=()=>h,g=()=>R(o,n.lng||null,"fallback"===a.nsMode?d:d[0],c),[p,f]=(0,e.useState)(m);let b=d.join();n.lng&&(b=`${n.lng}${b}`);const w=((t,n)=>{const i=(0,e.useRef)();return(0,e.useEffect)((()=>{i.current=t}),[t,n]),i.current})(b),v=(0,e.useRef)(!0);(0,e.useEffect)((()=>{const{bindI18n:e,bindI18nStore:t}=a;v.current=!0,u||l||(n.lng?x(o,n.lng,d,(()=>{v.current&&f(g)})):k(o,d,(()=>{v.current&&f(g)}))),u&&w&&w!==b&&v.current&&f(g);const i=()=>{v.current&&f(g)};return e&&o?.on(e,i),t&&o?.store.on(t,i),()=>{v.current=!1,o&&e?.split(" ").forEach((e=>o.off(e,i))),t&&o&&t.split(" ").forEach((e=>o.store.off(e,i)))}}),[o,b]),(0,e.useEffect)((()=>{v.current&&u&&f(m)}),[o,c,u]);const _=[p,o,u];if(_.t=p,_.i18n=o,_.ready=u,u)return _;if(!u&&!l)return _;throw new Promise((e=>{n.lng?x(o,n.lng,d,(()=>e())):k(o,d,(()=>e()))}))},L=(t,n={})=>function(i){function r({forwardedRef:r,...s}){const[o,a,l]=N(t,{...s,keyPrefix:n.keyPrefix}),c={...s,t:o,i18n:a,tReady:l};return n.withRef&&r?c.ref=r:!n.withRef&&r&&(c.forwardedRef=r),(0,e.createElement)(i,c)}var s;return r.displayName=`withI18nextTranslation(${s=i,s.displayName||s.name||(C(s)&&s.length>0?s:"Unknown")})`,r.WrappedComponent=i,n.withRef?(0,e.forwardRef)(((t,n)=>(0,e.createElement)(r,Object.assign({},t,{forwardedRef:n})))):r};var M=o(238);i()(M.A,{insert:"head",singleton:!1}),M.A.locals;const B=e=>{e.ref?.current?.onOpen({heading:e.heading,content:e.content,body:e.body,footer:e.footer,clickOverlayClosePopup:e.clickOverlayClosePopup,style:e.style,className:e.className,hideButtonClose:e.hideButtonClose})},F=e=>{e.current.onClose()};class D extends t().Component{constructor(e){super(e)}state={open:!1};onOpen(e){this.setState({open:!0,...e})}onClose(){this.setState({open:!1})}render(){return t().createElement(t().Fragment,null,this.state.open&&t().createElement(z,{className:this.state.clickOverlayClosePopup?"hidden-overlay":"",onClose:this.state.clickOverlayClosePopup?()=>{this.onClose()}:void 0},this.state.content??t().createElement("div",{className:`popup-container col ${this.state.className??""}`,onClick:e=>e.stopPropagation(),style:this.state.style},this.state.heading,this.state.body,this.state.footer,this.state.hideButtonClose?null:t().createElement("button",{type:"button",onClick:()=>this.onClose(),className:"popup-close-btn row"},t().createElement("svg",{width:"100%",height:"100%",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{width:"2rem",height:"2rem"}},t().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.4223 4.7559C16.7477 4.43047 16.7477 3.90283 16.4223 3.57739C16.0968 3.25195 15.5692 3.25195 15.2438 3.57739L9.99967 8.82147L4.7556 3.57739C4.43016 3.25195 3.90252 3.25195 3.57709 3.57739C3.25165 3.90283 3.25165 4.43047 3.57709 4.7559L8.82116 9.99998L3.57709 15.2441C3.25165 15.5695 3.25165 16.0971 3.57709 16.4226C3.90252 16.748 4.43016 16.748 4.7556 16.4226L9.99967 11.1785L15.2438 16.4226C15.5692 16.748 16.0968 16.748 16.4223 16.4226C16.7477 16.0971 16.7477 15.5695 16.4223 15.2441L11.1782 9.99998L16.4223 4.7559Z",fill:"#00204D",fillOpacity:.6}))))))}}function z(n){let{children:i,onClose:r,className:s,style:o,onOpen:a}=n;const l=(0,e.useRef)(null);return(0,e.useEffect)((()=>{if(l.current&&r){const e=e=>{e.target!==l.current&&l.current.contains(e.target)||r(e)};return window.document.body.addEventListener("mousedown",e),()=>{window.document.body.removeEventListener("mousedown",e)}}}),[l.current]),(0,e.useEffect)((()=>{l.current&&a&&a(l.current)}),[l.current,a]),(0,e.useEffect)((()=>{if(l.current&&l.current.firstChild){const e=l.current.firstChild,t=e.getBoundingClientRect();t.x<0?(e.style.left="0px",e.style.right="unset"):t.right>document.body.offsetWidth&&(e.style.right="0px",e.style.left="unset"),t.y<0?(e.style.top="0px",e.style.bottom="unset"):t.bottom>document.body.offsetHeight&&(e.style.bottom="0px",e.style.top="unset")}}),[l]),t().createElement("div",{ref:l,className:`popup-overlay ${s??""}`,style:o},i)}class $ extends t().Component{containerRef=(()=>(0,e.createRef)())();inputRef=(()=>(0,e.createRef)())();constructor(e){super(e),this.state={value:e.value,options:e.options,offset:{x:0,y:0,height:0,width:0,bottom:0,left:0,right:0,top:0,toJSON:function(){throw new Error("Function not implemented.")}},isOpen:!1,onSelect:null},this.search=this.search.bind(this),this.onSelect=this.onSelect.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.inputRef.current&&(this.inputRef.current.value=`${this.state.options.find((e=>e.id===this.state.value))?.name??""}`)}async search(e){if(e.target.value.trim().length)if(this.props?.handleSearch){const t=await this.props.handleSearch(e.target.value.trim());this.setState({...this.state,search:t})}else this.setState({...this.state,search:this.props.options.filter((t=>"string"==typeof t.name&&t.name.toLowerCase().includes(e.target.value.trim().toLowerCase())))});else this.setState({...this.state,search:void 0})}onSelect(e){if(e.disabled)this.setState({...this.state,isOpen:!1,onSelect:void 0,selected:void 0}),this.inputRef.current?.blur();else{let t={...this.state,isOpen:!1,value:e.id,onSelect:void 0,selected:void 0};t.options.some((t=>t.id===e.id))||t.options.push(e),this.setState(t),this.inputRef.current?.blur()}this.props.onChange&&this.props.onChange(e)}onKeyDown=e=>{if((this.state.options?.length||this.state.search?.length)&&this.state.isOpen)switch(e.key.toLowerCase()){case"enter":e.preventDefault();const t=(this.state.search??this.state.options).find((e=>e.id===this.state.selected));t&&this.onSelect(t);break;case"arrowup":if(e.preventDefault(),this.state.selected){let e=(this.state.search??this.state.options).findIndex((e=>e.id===this.state.selected));e=(0===e?this.props.options.length:e)-1,this.setState({...this.state,selected:this.props.options[e]?.id})}break;case"arrowdown":if(e.preventDefault(),this.state.selected){let e=(this.state.search??this.state.options).findIndex((e=>e.id===this.state.selected));e=(e+1===this.props.options.length?-1:e)+1,this.setState({...this.state,selected:this.props.options[e]?.id})}}};componentDidUpdate(e,t){if(e.options!==this.props.options&&(this.setState({...this.state,options:this.props.options}),this.inputRef.current&&(this.inputRef.current.value=`${this.props.options.find((e=>e.id===this.state.value))?.name??""}`)),e.value!==this.props.value&&this.setState({...this.state,value:this.props.value}),t.value!==this.state.value&&this.inputRef.current&&(this.inputRef.current.value=`${this.state.options.find((e=>e.id===this.state.value))?.name??""}`),this.state.isOpen&&t.isOpen!==this.state.isOpen){const e=this.containerRef.current.querySelector(".select1-popup")?.getBoundingClientRect();if(e){let t;e.right>document.body.offsetWidth&&(t={top:this.state.offset.y+this.state.offset.height+2+"px",right:document.body.offsetWidth-this.state.offset.right+"px"});let n=e.bottom-8;const i=this.containerRef.current?.getBoundingClientRect();i&&n>document.body.offsetHeight&&(t={...t??{},top:i.y-2-e.height+"px"}),t&&(t.left??=t.right?void 0:`${this.state.offset.x}px`,t.width??=`${this.state.offset.width}px`,this.setState({...this.state,style:t}))}}}componentDidMount(){this.inputRef.current&&(this.inputRef.current.value=`${this.state.options.find((e=>e.id===this.state.value))?.name??""}`)}render(){const{t:e}=this.props,n=this.state.options.find((e=>e.id===this.state.value));return t().createElement("div",{id:this.props.id,ref:this.containerRef,className:`${d["select1-container"]} row ${this.props.disabled?d.disabled:""} ${this.props.helperText?.length&&d["helper-text"]} ${this.props.className??"body-3"}`,"helper-text":this.props.helperText,style:this.props.style?{"--helper-text-color":this.props.helperTextColor??"#e14337",...this.props.style}:{"--helper-text-color":this.props.helperTextColor??"#e14337"},onClick:()=>{this.state.isOpen||(this.setState({...this.state,isOpen:!0,style:void 0,offset:this.containerRef?.current?.getBoundingClientRect()}),this.inputRef.current?.focus())}},this.props.prefix,n&&"string"!=typeof n.name&&"number"!=typeof n.name?n.name:t().createElement("input",{ref:this.inputRef,readOnly:this.props.readOnly,onChange:this.search,placeholder:this.props.placeholder,onBlur:e=>{this.state.onSelect&&!this.props.readOnly&&e.target.focus()}}),this.props.suffix??t().createElement("div",{ref:e=>{e?.parentElement&&e.parentElement.getBoundingClientRect().width<88&&(e.style.display="none")},className:"row"},t().createElement(w,{src:this.state.isOpen?"fill/arrows/up-arrow":"fill/arrows/down-arrow",size:"1.2rem"})),this.state.isOpen&&t().createElement(z,{onOpen:this.props.onOpenOptions,className:"hidden-overlay",onClose:e=>{e.target!==this.inputRef.current&&this.setState({...this.state,isOpen:!1})}},t().createElement("div",{className:`${d["select1-popup"]} select1-popup col ${this.props.popupClassName??""}`,style:this.state.style??{top:this.state.offset.y+this.state.offset.height+2+"px",left:this.state.offset.x+"px",width:this.state.offset.width}},t().createElement("div",{className:`col ${d["select-body"]}`,onScroll:this.props.handleLoadmore?e=>{if(this.props.handleLoadmore){let t=e.target;this.props.handleLoadmore(Math.round(t.offsetHeight+t.scrollTop)>=t.scrollHeight-1,e)}}:void 0},(this.state.search??this.state.options).filter((e=>!e.parentId)).map((e=>t().createElement(j,{key:e.id,item:e,children:(this.state.search??this.state.options).filter((t=>t.parentId===e.id)),selected:this.state.selected===e.id,onClick:this.onSelect,treeData:(this.state.search??this.state.options).some((e=>e.parentId))}))),!this.state.search?.length&&!this.props.options?.length&&t().createElement("div",{className:d["no-results-found"]},e("noResultFound"))))))}}function j(n){let{item:i,children:r,selected:s,onClick:o,treeData:a}=n;const[l,c]=(0,e.useState)(!1);return i.title&&"string"!=typeof i.title?t().createElement(t().Fragment,null,i.title(o)):t().createElement("div",{className:"col",style:{width:"100%"}},t().createElement("div",{className:`${d["select-tile"]} row ${i.disabled?d.disabled:""}`,style:{paddingLeft:i.parentId?"4.4rem":void 0,backgroundColor:s?"var(--neutral-selected-background-color)":void 0},onClick:()=>{r?.length?c(!l):o(i)}},a?t().createElement("div",{className:"row",style:{width:"1.4rem",height:"1.4rem"}},r?.length?t().createElement(w,{src:l?"fill/arrows/triangle-down":"fill/arrows/triangle-right",size:"1.2rem"}):null):void 0,i.title&&"string"==typeof i.title||"string"==typeof i.name?t().createElement(f,{className:"body-3"},i.title&&"string"==typeof i.title?i.title:i.name):i.name),r?.length?t().createElement("div",{className:"col",style:{display:l?"flex":"none",width:"100%"}},r.map((e=>t().createElement(j,{key:e.id,item:e,onClick:o})))):void 0)}const H=L()($);var W=o(644);i()(W.A,{insert:"head",singleton:!1});const U=W.A.locals||{};class q extends t().Component{state=(()=>({value:this.props.value??!1}))();componentDidUpdate(e){e.value!==this.props.value&&this.setState({value:this.props.value})}render(){const e={"--off-bg":this.props.offBackground??"var(--neutral-main-background-color)","--on-bg":this.props.onBackground??"var(--primary-main-color)","--dot-color":this.props.dotColor??"#ffffff","--size":this.props.size?"number"==typeof this.props.size?`${this.props.size}px`:this.props.size:"2rem"};let n={height:this.props.size??"2rem",width:`calc(${this.props.size?"number"==typeof this.props.size?`${this.props.size}px`:this.props.size:"2rem"} * 9 / 5)`,...e};return this.props.style&&(delete this.props.style.width,delete this.props.style.minWidth,delete this.props.style.maxWidth,delete this.props.style.height,delete this.props.style.minHeight,delete this.props.style.maxHeight,n={...this.props.style,...n}),t().createElement("label",{id:this.props.id,className:`${U["switch-container"]} row ${this.props.className??""}`,style:n},t().createElement("input",{type:"checkbox",checked:this.state.value,name:this.props.name,disabled:this.props.disabled,onChange:()=>{const e=!this.state.value;this.setState({value:e}),this.props.onChange&&this.props.onChange(e)}}),t().createElement("span",{className:U.slider}))}}var G=o(296);i()(G.A,{insert:"head",singleton:!1});const K=G.A.locals||{};let Z=function(e){return e.start="start",e.center="center",e.end="end",e}({});class Q extends t().Component{constructor(e){super(e),this.state={open:!1,title:"",status:tn.INFOR,content:"",onSubmit:()=>{}}}showDialogNoti(e){this.setState({open:!0,...e})}closeDialog(){this.setState({open:!1})}render(){const{t:e}=this.props;return t().createElement(t().Fragment,null,this.state.open&&h().createPortal(t().createElement("div",{className:K["dialog-overlay"]},t().createElement("div",{className:`${K["dialog-container"]} col`,style:{width:"41.4rem",alignItems:this.state.alignment},"dialog-type":this.state.status,onClick:e=>e.stopPropagation()},t().createElement("div",{className:`${K["dialog-body"]} col`,style:{alignItems:"inherit"}},t().createElement("div",{className:`${K["dialog-status"]} row`},nn(this.state.status)),t().createElement("div",{className:"col"},t().createElement(f,{className:"heading-6",style:{textAlign:this.state.alignment===Z.center?"center":"start"}},this.state.title),t().createElement(f,{className:"body-3",style:{textAlign:this.state.alignment===Z.center?"center":"start"}},this.state.content))),t().createElement("div",{className:`${K["dialog-footer"]} row`},t().createElement("button",{type:"button",style:this.state.alignment===Z.center?{flex:1,width:"100%"}:void 0,onClick:()=>{this.state.onCancel&&this.state.onCancel(),this.setState({open:!1})},className:`${K["dialog-action"]} row`},t().createElement(f,{className:"button-text-3"},this.state.cancelTitle??e("cancel"))),t().createElement("button",{type:"button",style:this.state.alignment===Z.center?{flex:1,width:"100%"}:void 0,onClick:()=>{this.state.onSubmit(),this.setState({open:!1})},className:`${K["dialog-action"]} row ${K["dialog-submit"]}`},t().createElement(f,{className:"button-text-3"},this.state.submitTitle??e("submit")))))),document.body))}}const Y=(0,e.createRef)(),J=()=>{const{t:e,i18n:n}=N();return t().createElement(Q,{ref:Y,t:e,i18n:n,tReady:!0})},X=e=>{Y.current&&Y.current.showDialogNoti({title:e.title??"",status:e.status??tn.INFOR,content:e.content??"",onSubmit:e.onSubmit??(()=>{}),onCancel:e.onCancel,submitTitle:e.submitTitle,cancelTitle:e.cancelTitle,alignment:e.alignment})};var ee=o(542);i()(ee.A,{insert:"head",singleton:!1});const te=ee.A.locals||{};var ne=e=>"checkbox"===e.type,ie=e=>e instanceof Date,re=e=>null==e;const se=e=>"object"==typeof e;var oe=e=>!re(e)&&!Array.isArray(e)&&se(e)&&!ie(e),ae=e=>oe(e)&&e.target?ne(e.target)?e.target.checked:e.target.value:e,le=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),ce=e=>{const t=e.constructor&&e.constructor.prototype;return oe(t)&&t.hasOwnProperty("isPrototypeOf")},de="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function ue(e){let t;const n=Array.isArray(e),i="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(de&&(e instanceof Blob||i)||!n&&!oe(e))return e;if(t=n?[]:{},n||ce(e))for(const n in e)e.hasOwnProperty(n)&&(t[n]=ue(e[n]));else t=e}return t}var he=e=>Array.isArray(e)?e.filter(Boolean):[],me=e=>void 0===e,ge=(e,t,n)=>{if(!t||!oe(e))return n;const i=he(t.split(/[,[\].]+?/)).reduce(((e,t)=>re(e)?e:e[t]),e);return me(i)||i===e?me(e[t])?n:e[t]:i},pe=e=>"boolean"==typeof e,fe=e=>/^\w*$/.test(e),be=e=>he(e.replace(/["|']|\]/g,"").split(/\.|\[/)),we=(e,t,n)=>{let i=-1;const r=fe(t)?[t]:be(t),s=r.length,o=s-1;for(;++i<s;){const t=r[i];let s=n;if(i!==o){const n=e[t];s=oe(n)||Array.isArray(n)?n:isNaN(+r[i+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=s,e=e[t]}return e};const ve={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},ye={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},_e="pattern",ke="required";e.createContext(null);var xe=(e,t,n,i=!0)=>{const r={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(r,s,{get:()=>{const r=s;return t._proxyFormState[r]!==ye.all&&(t._proxyFormState[r]=!i||ye.all),n&&(n[r]=!0),e[r]}});return r},Ce=e=>oe(e)&&!Object.keys(e).length,Ae=(e,t,n,i)=>{n(e);const{name:r,...s}=e;return Ce(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find((e=>t[e]===(!i||ye.all)))},Ee=e=>Array.isArray(e)?e:[e];var Te=e=>"string"==typeof e,Se=(e,t,n,i,r)=>Te(e)?(i&&t.watch.add(e),ge(n,e,r)):Array.isArray(e)?e.map((e=>(i&&t.watch.add(e),ge(n,e)))):(i&&(t.watchAll=!0),n),Pe=(e,t,n,i,r)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[i]:r||!0}}:{},Ie=e=>({isOnSubmit:!e||e===ye.onSubmit,isOnBlur:e===ye.onBlur,isOnChange:e===ye.onChange,isOnAll:e===ye.all,isOnTouch:e===ye.onTouched}),Oe=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))));const Ve=(e,t,n,i)=>{for(const r of n||Object.keys(e)){const n=ge(e,r);if(n){const{_f:e,...s}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],r)&&!i)return!0;if(e.ref&&t(e.ref,e.name)&&!i)return!0;if(Ve(s,t))break}else if(oe(s)&&Ve(s,t))break}}};var Re=(e,t,n)=>{const i=Ee(ge(e,n));return we(i,"root",t[n]),we(e,n,i),e},Ne=e=>"file"===e.type,Le=e=>"function"==typeof e,Me=e=>{if(!de)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Be=e=>Te(e),Fe=e=>"radio"===e.type,De=e=>e instanceof RegExp;const ze={value:!1,isValid:!1},$e={value:!0,isValid:!0};var je=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!me(e[0].attributes.value)?me(e[0].value)||""===e[0].value?$e:{value:e[0].value,isValid:!0}:$e:ze}return ze};const He={isValid:!1,value:null};var We=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),He):He;function Ue(e,t,n="validate"){if(Be(e)||Array.isArray(e)&&e.every(Be)||pe(e)&&!e)return{type:n,message:Be(e)?e:"",ref:t}}var qe=e=>oe(e)&&!De(e)?e:{value:e,message:""},Ge=async(e,t,n,i,r,s)=>{const{ref:o,refs:a,required:l,maxLength:c,minLength:d,min:u,max:h,pattern:m,validate:g,name:p,valueAsNumber:f,mount:b}=e._f,w=ge(n,p);if(!b||t.has(p))return{};const v=a?a[0]:o,y=e=>{r&&v.reportValidity&&(v.setCustomValidity(pe(e)?"":e||""),v.reportValidity())},_={},k=Fe(o),x=ne(o),C=k||x,A=(f||Ne(o))&&me(o.value)&&me(w)||Me(o)&&""===o.value||""===w||Array.isArray(w)&&!w.length,E=Pe.bind(null,p,i,_),T=(e,t,n,i="maxLength",r="minLength")=>{const s=e?t:n;_[p]={type:e?i:r,message:s,ref:o,...E(e?i:r,s)}};if(s?!Array.isArray(w)||!w.length:l&&(!C&&(A||re(w))||pe(w)&&!w||x&&!je(a).isValid||k&&!We(a).isValid)){const{value:e,message:t}=Be(l)?{value:!!l,message:l}:qe(l);if(e&&(_[p]={type:ke,message:t,ref:v,...E(ke,t)},!i))return y(t),_}if(!(A||re(u)&&re(h))){let e,t;const n=qe(h),r=qe(u);if(re(w)||isNaN(w)){const i=o.valueAsDate||new Date(w),s=e=>new Date((new Date).toDateString()+" "+e),a="time"==o.type,l="week"==o.type;Te(n.value)&&w&&(e=a?s(w)>s(n.value):l?w>n.value:i>new Date(n.value)),Te(r.value)&&w&&(t=a?s(w)<s(r.value):l?w<r.value:i<new Date(r.value))}else{const i=o.valueAsNumber||(w?+w:w);re(n.value)||(e=i>n.value),re(r.value)||(t=i<r.value)}if((e||t)&&(T(!!e,n.message,r.message,"max","min"),!i))return y(_[p].message),_}if((c||d)&&!A&&(Te(w)||s&&Array.isArray(w))){const e=qe(c),t=qe(d),n=!re(e.value)&&w.length>+e.value,r=!re(t.value)&&w.length<+t.value;if((n||r)&&(T(n,e.message,t.message),!i))return y(_[p].message),_}if(m&&!A&&Te(w)){const{value:e,message:t}=qe(m);if(De(e)&&!w.match(e)&&(_[p]={type:_e,message:t,ref:o,...E(_e,t)},!i))return y(t),_}if(g)if(Le(g)){const e=Ue(await g(w,n),v);if(e&&(_[p]={...e,...E("validate",e.message)},!i))return y(e.message),_}else if(oe(g)){let e={};for(const t in g){if(!Ce(e)&&!i)break;const r=Ue(await g[t](w,n),v,t);r&&(e={...r,...E(t,r.message)},y(r.message),i&&(_[p]=e))}if(!Ce(e)&&(_[p]={ref:v,...e},!i))return _}return y(!0),_};function Ke(e,t){const n=Array.isArray(t)?t:fe(t)?[t]:be(t),i=1===n.length?e:function(e,t){const n=t.slice(0,-1).length;let i=0;for(;i<n;)e=me(e)?i++:e[t[i++]];return e}(e,n),r=n.length-1,s=n[r];return i&&delete i[s],0!==r&&(oe(i)&&Ce(i)||Array.isArray(i)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!me(e[t]))return!1;return!0}(i))&&Ke(e,n.slice(0,-1)),e}var Ze=()=>{let e=[];return{get observers(){return e},next:t=>{for(const n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}},Qe=e=>re(e)||!se(e);function Ye(e,t){if(Qe(e)||Qe(t))return e===t;if(ie(e)&&ie(t))return e.getTime()===t.getTime();const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(const r of n){const n=e[r];if(!i.includes(r))return!1;if("ref"!==r){const e=t[r];if(ie(n)&&ie(e)||oe(n)&&oe(e)||Array.isArray(n)&&Array.isArray(e)?!Ye(n,e):n!==e)return!1}}return!0}var Je=e=>"select-multiple"===e.type,Xe=e=>Fe(e)||ne(e),et=e=>Me(e)&&e.isConnected,tt=e=>{for(const t in e)if(Le(e[t]))return!0;return!1};function nt(e,t={}){const n=Array.isArray(e);if(oe(e)||n)for(const n in e)Array.isArray(e[n])||oe(e[n])&&!tt(e[n])?(t[n]=Array.isArray(e[n])?[]:{},nt(e[n],t[n])):re(e[n])||(t[n]=!0);return t}function it(e,t,n){const i=Array.isArray(e);if(oe(e)||i)for(const i in e)Array.isArray(e[i])||oe(e[i])&&!tt(e[i])?me(t)||Qe(n[i])?n[i]=Array.isArray(e[i])?nt(e[i],[]):{...nt(e[i])}:it(e[i],re(t)?{}:t[i],n[i]):n[i]=!Ye(e[i],t[i]);return n}var rt=(e,t)=>it(e,t,nt(t)),st=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:i})=>me(e)?e:t?""===e?NaN:e?+e:e:n&&Te(e)?new Date(e):i?i(e):e;function ot(e){const t=e.ref;return Ne(t)?t.files:Fe(t)?We(e.refs).value:Je(t)?[...t.selectedOptions].map((({value:e})=>e)):ne(t)?je(e.refs).value:st(me(t.value)?e.ref.value:t.value,e)}var at=(e,t,n,i)=>{const r={};for(const n of e){const e=ge(t,n);e&&we(r,n,e._f)}return{criteriaMode:n,names:[...e],fields:r,shouldUseNativeValidation:i}},lt=e=>me(e)?e:De(e)?e.source:oe(e)?De(e.value)?e.value.source:e.value:e;const ct="AsyncFunction";var dt=e=>!!e&&!!e.validate&&!!(Le(e.validate)&&e.validate.constructor.name===ct||oe(e.validate)&&Object.values(e.validate).find((e=>e.constructor.name===ct))),ut=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function ht(e,t,n){const i=ge(e,n);if(i||fe(n))return{error:i,name:n};const r=n.split(".");for(;r.length;){const i=r.join("."),s=ge(t,i),o=ge(e,i);if(s&&!Array.isArray(s)&&n!==i)return{name:n};if(o&&o.type)return{name:i,error:o};r.pop()}return{name:n}}var mt=(e,t,n,i,r)=>!r.isOnAll&&(!n&&r.isOnTouch?!(t||e):(n?i.isOnBlur:r.isOnBlur)?!e:!(n?i.isOnChange:r.isOnChange)||e),gt=(e,t)=>!he(ge(e,t)).length&&Ke(e,t);const pt={mode:ye.onSubmit,reValidateMode:ye.onChange,shouldFocusError:!0};function ft(e={}){let t,n={...pt,...e},i={submitCount:0,isDirty:!1,isLoading:Le(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1},r={},s=(oe(n.defaultValues)||oe(n.values))&&ue(n.defaultValues||n.values)||{},o=n.shouldUnregister?{}:ue(s),a={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},u={values:Ze(),array:Ze(),state:Ze()},h=Ie(n.mode),m=Ie(n.reValidateMode),g=n.criteriaMode===ye.all,p=async e=>{if(!n.disabled&&(d.isValid||e)){const e=n.resolver?Ce((await v()).errors):await y(r,!0);e!==i.isValid&&u.state.next({isValid:e})}},f=(e,t)=>{n.disabled||!d.isValidating&&!d.validatingFields||((e||Array.from(l.mount)).forEach((e=>{e&&(t?we(i.validatingFields,e,t):Ke(i.validatingFields,e))})),u.state.next({validatingFields:i.validatingFields,isValidating:!Ce(i.validatingFields)}))},b=(e,t,n,i)=>{const l=ge(r,e);if(l){const r=ge(o,e,me(n)?ge(s,e):n);me(r)||i&&i.defaultChecked||t?we(o,e,t?r:ot(l._f)):x(e,r),a.mount&&p()}},w=(e,t,o,a,l)=>{let c=!1,h=!1;const m={name:e};if(!n.disabled){const n=!!(ge(r,e)&&ge(r,e)._f&&ge(r,e)._f.disabled);if(!o||a){d.isDirty&&(h=i.isDirty,i.isDirty=m.isDirty=_(),c=h!==m.isDirty);const r=n||Ye(ge(s,e),t);h=!(n||!ge(i.dirtyFields,e)),r||n?Ke(i.dirtyFields,e):we(i.dirtyFields,e,!0),m.dirtyFields=i.dirtyFields,c=c||d.dirtyFields&&h!==!r}if(o){const t=ge(i.touchedFields,e);t||(we(i.touchedFields,e,o),m.touchedFields=i.touchedFields,c=c||d.touchedFields&&t!==o)}c&&l&&u.state.next(m)}return c?m:{}},v=async e=>{f(e,!0);const t=await n.resolver(o,n.context,at(e||l.mount,r,n.criteriaMode,n.shouldUseNativeValidation));return f(e),t},y=async(e,t,r={valid:!0})=>{for(const s in e){const a=e[s];if(a){const{_f:e,...c}=a;if(e){const c=l.array.has(e.name),u=a._f&&dt(a._f);u&&d.validatingFields&&f([s],!0);const h=await Ge(a,l.disabled,o,g,n.shouldUseNativeValidation&&!t,c);if(u&&d.validatingFields&&f([s]),h[e.name]&&(r.valid=!1,t))break;!t&&(ge(h,e.name)?c?Re(i.errors,h,e.name):we(i.errors,e.name,h[e.name]):Ke(i.errors,e.name))}!Ce(c)&&await y(c,t,r)}}return r.valid},_=(e,t)=>!n.disabled&&(e&&t&&we(o,e,t),!Ye(P(),s)),k=(e,t,n)=>Se(e,l,{...a.mount?o:me(t)?s:Te(e)?{[e]:t}:t},n,t),x=(e,t,n={})=>{const i=ge(r,e);let s=t;if(i){const n=i._f;n&&(!n.disabled&&we(o,e,st(t,n)),s=Me(n.ref)&&re(t)?"":t,Je(n.ref)?[...n.ref.options].forEach((e=>e.selected=s.includes(e.value))):n.refs?ne(n.ref)?n.refs.length>1?n.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(s)?!!s.find((t=>t===e.value)):s===e.value))):n.refs[0]&&(n.refs[0].checked=!!s):n.refs.forEach((e=>e.checked=e.value===s)):Ne(n.ref)?n.ref.value="":(n.ref.value=s,n.ref.type||u.values.next({name:e,values:{...o}})))}(n.shouldDirty||n.shouldTouch)&&w(e,s,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&S(e)},C=(e,t,n)=>{for(const i in t){const s=t[i],o=`${e}.${i}`,a=ge(r,o);(l.array.has(e)||oe(s)||a&&!a._f)&&!ie(s)?C(o,s,n):x(o,s,n)}},A=(e,t,n={})=>{const c=ge(r,e),h=l.array.has(e),m=ue(t);we(o,e,m),h?(u.array.next({name:e,values:{...o}}),(d.isDirty||d.dirtyFields)&&n.shouldDirty&&u.state.next({name:e,dirtyFields:rt(s,o),isDirty:_(e,m)})):!c||c._f||re(m)?x(e,m,n):C(e,m,n),Oe(e,l)&&u.state.next({...i}),u.values.next({name:a.mount?e:void 0,values:{...o}})},E=async e=>{a.mount=!0;const s=e.target;let b=s.name,_=!0;const k=ge(r,b),x=e=>{_=Number.isNaN(e)||ie(e)&&isNaN(e.getTime())||Ye(e,ge(o,b,e))};if(k){let a,C;const A=s.type?ot(k._f):ae(e),E=e.type===ve.BLUR||e.type===ve.FOCUS_OUT,T=!ut(k._f)&&!n.resolver&&!ge(i.errors,b)&&!k._f.deps||mt(E,ge(i.touchedFields,b),i.isSubmitted,m,h),P=Oe(b,l,E);we(o,b,A),E?(k._f.onBlur&&k._f.onBlur(e),t&&t(0)):k._f.onChange&&k._f.onChange(e);const I=w(b,A,E,!1),O=!Ce(I)||P;if(!E&&u.values.next({name:b,type:e.type,values:{...o}}),T)return d.isValid&&("onBlur"===n.mode&&E?p():E||p()),O&&u.state.next({name:b,...P?{}:I});if(!E&&P&&u.state.next({...i}),n.resolver){const{errors:e}=await v([b]);if(x(A),_){const t=ht(i.errors,r,b),n=ht(e,r,t.name||b);a=n.error,b=n.name,C=Ce(e)}}else f([b],!0),a=(await Ge(k,l.disabled,o,g,n.shouldUseNativeValidation))[b],f([b]),x(A),_&&(a?C=!1:d.isValid&&(C=await y(r,!0)));_&&(k._f.deps&&S(k._f.deps),((e,r,s,o)=>{const a=ge(i.errors,e),l=d.isValid&&pe(r)&&i.isValid!==r;var h;if(n.delayError&&s?(h=()=>((e,t)=>{we(i.errors,e,t),u.state.next({errors:i.errors})})(e,s),t=e=>{clearTimeout(c),c=setTimeout(h,e)},t(n.delayError)):(clearTimeout(c),t=null,s?we(i.errors,e,s):Ke(i.errors,e)),(s?!Ye(a,s):a)||!Ce(o)||l){const t={...o,...l&&pe(r)?{isValid:r}:{},errors:i.errors,name:e};i={...i,...t},u.state.next(t)}})(b,C,a,I))}},T=(e,t)=>{if(ge(i.errors,t)&&e.focus)return e.focus(),1},S=async(e,t={})=>{let s,o;const a=Ee(e);if(n.resolver){const t=await(async e=>{const{errors:t}=await v(e);if(e)for(const n of e){const e=ge(t,n);e?we(i.errors,n,e):Ke(i.errors,n)}else i.errors=t;return t})(me(e)?e:a);s=Ce(t),o=e?!a.some((e=>ge(t,e))):s}else e?(o=(await Promise.all(a.map((async e=>{const t=ge(r,e);return await y(t&&t._f?{[e]:t}:t)})))).every(Boolean),(o||i.isValid)&&p()):o=s=await y(r);return u.state.next({...!Te(e)||d.isValid&&s!==i.isValid?{}:{name:e},...n.resolver||!e?{isValid:s}:{},errors:i.errors}),t.shouldFocus&&!o&&Ve(r,T,e?a:l.mount),o},P=e=>{const t={...a.mount?o:s};return me(e)?t:Te(e)?ge(t,e):e.map((e=>ge(t,e)))},I=(e,t)=>({invalid:!!ge((t||i).errors,e),isDirty:!!ge((t||i).dirtyFields,e),error:ge((t||i).errors,e),isValidating:!!ge(i.validatingFields,e),isTouched:!!ge((t||i).touchedFields,e)}),O=(e,t,n)=>{const s=(ge(r,e,{_f:{}})._f||{}).ref,o=ge(i.errors,e)||{},{ref:a,message:l,type:c,...d}=o;we(i.errors,e,{...d,...t,ref:s}),u.state.next({name:e,errors:i.errors,isValid:!1}),n&&n.shouldFocus&&s&&s.focus&&s.focus()},V=(e,t={})=>{for(const a of e?Ee(e):l.mount)l.mount.delete(a),l.array.delete(a),t.keepValue||(Ke(r,a),Ke(o,a)),!t.keepError&&Ke(i.errors,a),!t.keepDirty&&Ke(i.dirtyFields,a),!t.keepTouched&&Ke(i.touchedFields,a),!t.keepIsValidating&&Ke(i.validatingFields,a),!n.shouldUnregister&&!t.keepDefaultValue&&Ke(s,a);u.values.next({values:{...o}}),u.state.next({...i,...t.keepDirty?{isDirty:_()}:{}}),!t.keepIsValid&&p()},R=({disabled:e,name:t,field:n,fields:i})=>{(pe(e)&&a.mount||e||l.disabled.has(t))&&(e?l.disabled.add(t):l.disabled.delete(t),w(t,ot(n?n._f:ge(i,t)._f),!1,!1,!0))},N=(e,t={})=>{let i=ge(r,e);const o=pe(t.disabled)||pe(n.disabled);return we(r,e,{...i||{},_f:{...i&&i._f?i._f:{ref:{name:e}},name:e,mount:!0,...t}}),l.mount.add(e),i?R({field:i,disabled:pe(t.disabled)?t.disabled:n.disabled,name:e}):b(e,!0,t.value),{...o?{disabled:t.disabled||n.disabled}:{},...n.progressive?{required:!!t.required,min:lt(t.min),max:lt(t.max),minLength:lt(t.minLength),maxLength:lt(t.maxLength),pattern:lt(t.pattern)}:{},name:e,onChange:E,onBlur:E,ref:o=>{if(o){N(e,t),i=ge(r,e);const n=me(o.value)&&o.querySelectorAll&&o.querySelectorAll("input,select,textarea")[0]||o,a=Xe(n),l=i._f.refs||[];if(a?l.find((e=>e===n)):n===i._f.ref)return;we(r,e,{_f:{...i._f,...a?{refs:[...l.filter(et),n,...Array.isArray(ge(s,e))?[{}]:[]],ref:{type:n.type,name:e}}:{ref:n}}}),b(e,!1,void 0,n)}else i=ge(r,e,{}),i._f&&(i._f.mount=!1),(n.shouldUnregister||t.shouldUnregister)&&(!le(l.array,e)||!a.action)&&l.unMount.add(e)}}},L=()=>n.shouldFocusError&&Ve(r,T,l.mount),M=(e,t)=>async s=>{let a;s&&(s.preventDefault&&s.preventDefault(),s.persist&&s.persist());let c=ue(o);if(l.disabled.size)for(const e of l.disabled)we(c,e,void 0);if(u.state.next({isSubmitting:!0}),n.resolver){const{errors:e,values:t}=await v();i.errors=e,c=t}else await y(r);if(Ke(i.errors,"root"),Ce(i.errors)){u.state.next({errors:{}});try{await e(c,s)}catch(e){a=e}}else t&&await t({...i.errors},s),L(),setTimeout(L);if(u.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ce(i.errors)&&!a,submitCount:i.submitCount+1,errors:i.errors}),a)throw a},B=(e,t={})=>{const c=e?ue(e):s,h=ue(c),m=Ce(e),g=m?s:h;if(t.keepDefaultValues||(s=c),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(rt(s,o))]);for(const t of Array.from(e))ge(i.dirtyFields,t)?we(g,t,ge(o,t)):A(t,ge(g,t))}else{if(de&&me(e))for(const e of l.mount){const t=ge(r,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(Me(e)){const t=e.closest("form");if(t){t.reset();break}}}}r={}}o=n.shouldUnregister?t.keepDefaultValues?ue(s):{}:ue(g),u.array.next({values:{...g}}),u.values.next({values:{...g}})}l={mount:t.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!d.isValid||!!t.keepIsValid||!!t.keepDirtyValues,a.watch=!!n.shouldUnregister,u.state.next({submitCount:t.keepSubmitCount?i.submitCount:0,isDirty:!m&&(t.keepDirty?i.isDirty:!(!t.keepDefaultValues||Ye(e,s))),isSubmitted:!!t.keepIsSubmitted&&i.isSubmitted,dirtyFields:m?{}:t.keepDirtyValues?t.keepDefaultValues&&o?rt(s,o):i.dirtyFields:t.keepDefaultValues&&e?rt(s,e):t.keepDirty?i.dirtyFields:{},touchedFields:t.keepTouched?i.touchedFields:{},errors:t.keepErrors?i.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&i.isSubmitSuccessful,isSubmitting:!1})},F=(e,t)=>B(Le(e)?e(o):e,t);return{control:{register:N,unregister:V,getFieldState:I,handleSubmit:M,setError:O,_executeSchema:v,_getWatch:k,_getDirty:_,_updateValid:p,_removeUnmounted:()=>{for(const e of l.unMount){const t=ge(r,e);t&&(t._f.refs?t._f.refs.every((e=>!et(e))):!et(t._f.ref))&&V(e)}l.unMount=new Set},_updateFieldArray:(e,t=[],l,c,h=!0,m=!0)=>{if(c&&l&&!n.disabled){if(a.action=!0,m&&Array.isArray(ge(r,e))){const t=l(ge(r,e),c.argA,c.argB);h&&we(r,e,t)}if(m&&Array.isArray(ge(i.errors,e))){const t=l(ge(i.errors,e),c.argA,c.argB);h&&we(i.errors,e,t),gt(i.errors,e)}if(d.touchedFields&&m&&Array.isArray(ge(i.touchedFields,e))){const t=l(ge(i.touchedFields,e),c.argA,c.argB);h&&we(i.touchedFields,e,t)}d.dirtyFields&&(i.dirtyFields=rt(s,o)),u.state.next({name:e,isDirty:_(e,t),dirtyFields:i.dirtyFields,errors:i.errors,isValid:i.isValid})}else we(o,e,t)},_updateDisabledField:R,_getFieldArray:e=>he(ge(a.mount?o:s,e,n.shouldUnregister?ge(s,e,[]):[])),_reset:B,_resetDefaultValues:()=>Le(n.defaultValues)&&n.defaultValues().then((e=>{F(e,n.resetOptions),u.state.next({isLoading:!1})})),_updateFormState:e=>{i={...i,...e}},_disableForm:e=>{pe(e)&&(u.state.next({disabled:e}),Ve(r,((t,n)=>{const i=ge(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach((t=>{t.disabled=i._f.disabled||e})))}),0,!1))},_subjects:u,_proxyFormState:d,_setErrors:e=>{i.errors=e,u.state.next({errors:i.errors,isValid:!1})},get _fields(){return r},get _formValues(){return o},get _state(){return a},set _state(e){a=e},get _defaultValues(){return s},get _names(){return l},set _names(e){l=e},get _formState(){return i},set _formState(e){i=e},get _options(){return n},set _options(e){n={...n,...e}}},trigger:S,register:N,handleSubmit:M,watch:(e,t)=>Le(e)?u.values.subscribe({next:n=>e(k(void 0,t),n)}):k(e,t,!0),setValue:A,getValues:P,reset:F,resetField:(e,t={})=>{ge(r,e)&&(me(t.defaultValue)?A(e,ue(ge(s,e))):(A(e,t.defaultValue),we(s,e,ue(t.defaultValue))),t.keepTouched||Ke(i.touchedFields,e),t.keepDirty||(Ke(i.dirtyFields,e),i.isDirty=t.defaultValue?_(e,ue(ge(s,e))):_()),t.keepError||(Ke(i.errors,e),d.isValid&&p()),u.state.next({...i}))},clearErrors:e=>{e&&Ee(e).forEach((e=>Ke(i.errors,e))),u.state.next({errors:e?i.errors:{}})},unregister:V,setError:O,setFocus:(e,t={})=>{const n=ge(r,e),i=n&&n._f;if(i){const e=i.refs?i.refs[0]:i.ref;e.focus&&(e.focus(),t.shouldSelect&&Le(e.select)&&e.select())}},getFieldState:I}}function bt(t={}){const n=e.useRef(void 0),i=e.useRef(void 0),[r,s]=e.useState({isDirty:!1,isValidating:!1,isLoading:Le(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,defaultValues:Le(t.defaultValues)?void 0:t.defaultValues});n.current||(n.current={...ft(t),formState:r});const o=n.current.control;return o._options=t,function(t){const n=e.useRef(t);n.current=t,e.useEffect((()=>{const e=!t.disabled&&n.current.subject&&n.current.subject.subscribe({next:n.current.next});return()=>{e&&e.unsubscribe()}}),[t.disabled])}({subject:o._subjects.state,next:e=>{Ae(e,o._proxyFormState,o._updateFormState,!0)&&s({...o._formState})}}),e.useEffect((()=>o._disableForm(t.disabled)),[o,t.disabled]),e.useEffect((()=>{if(o._proxyFormState.isDirty){const e=o._getDirty();e!==r.isDirty&&o._subjects.state.next({isDirty:e})}}),[o,r.isDirty]),e.useEffect((()=>{t.values&&!Ye(t.values,i.current)?(o._reset(t.values,o._options.resetOptions),i.current=t.values,s((e=>({...e})))):o._resetDefaultValues()}),[t.values,o]),e.useEffect((()=>{t.errors&&o._setErrors(t.errors)}),[t.errors,o]),e.useEffect((()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()})),e.useEffect((()=>{t.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})}),[t.shouldUnregister,o]),n.current.formState=xe(r,o),n.current}Math.pow(10,8);const wt=864e5;function vt(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function yt(e){const t=vt(e);return t.setHours(0,0,0,0),t}function _t(e){const t=vt(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function kt(e,t){const n=yt(e),i=yt(t),r=+n-_t(n),s=+i-_t(i);return Math.round((r-s)/wt)}var xt=o(528);i()(xt.A,{insert:"head",singleton:!1});const Ct=xt.A.locals||{};function At(){return At=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},At.apply(null,arguments)}class Et extends t().Component{containerRef=(()=>(0,e.createRef)())();getInput=()=>this.containerRef.current?.querySelector("input");render(){return t().createElement("div",{ref:this.containerRef,id:this.props.id,className:`${Ct["text-field-container"]} row ${this.props.className??"body-3"} ${this.props.helperText?.length?Ct["helper-text"]:""}`,"helper-text":this.props.helperText,style:this.props.style?{"--helper-text-color":this.props.helperTextColor??"#e14337",...this.props.style}:{"--helper-text-color":this.props.helperTextColor??"#e14337"}},this.props.prefix,this.props.register?t().createElement("input",At({name:this.props.name},this.props.register,{autoComplete:this.props.autoComplete,autoFocus:this.props.autoFocus,maxLength:this.props.maxLength,type:this.props.type??"text",placeholder:this.props.placeholder,readOnly:this.props.readOnly,disabled:this.props.disabled,onFocus:this.props.onFocus,onKeyDown:this.props.onComplete?e=>{this.props.onComplete&&"enter"===e.key.toLowerCase()&&this.props.onComplete(e)}:void 0})):t().createElement("input",{autoComplete:this.props.autoComplete,autoFocus:this.props.autoFocus,maxLength:this.props.maxLength,name:this.props.name,type:this.props.type??"text",defaultValue:this.props.defaultValue,value:this.props.value,placeholder:this.props.placeholder,readOnly:this.props.readOnly,disabled:this.props.disabled,onChange:this.props.onChange,onFocus:this.props.onFocus,onBlur:this.props.onBlur,onKeyDown:this.props.onComplete?e=>{this.props.onComplete&&"enter"===e.key.toLowerCase()&&this.props.onComplete(e)}:void 0}),this.props.suffix)}}var Tt=o(320);i()(Tt.A,{insert:"head",singleton:!1});const St=Tt.A.locals||{},Pt=new Date,It=new Date(Pt.getFullYear()-100,Pt.getMonth(),Pt.getDate()),Ot=new Date(Pt.getFullYear()+100,Pt.getMonth(),Pt.getDate()),Vt=(e,t,n)=>kt(e,t)>-1&&kt(n,e)>-1;var Rt=function(e){return e[e.DATE=0]="DATE",e[e.MONTH=1]="MONTH",e[e.YEAR=2]="YEAR",e}(Rt||{});const Nt=(e,t,n,i)=>{let r;n?i?(r=n instanceof Date?{sTime:n,eTime:n}:n,r.sTime.getTime()<e.getTime()&&(r.sTime=e),r.eTime.getTime()>t.getTime()&&(r.eTime=t)):(r=n instanceof Date?n:n.sTime,r.getTime()<e.getTime()&&(r=e),r.getTime()>t.getTime()&&(r=t)):r=i?{sTime:Pt,eTime:Pt}:Pt;const s=r instanceof Date?r.getMonth():r.sTime.getMonth(),o=r instanceof Date?r.getFullYear():r.sTime.getFullYear();return{value:n?r:void 0,selectMonth:s,selectYear:o,tab:Rt.DATE}};class Lt extends t().Component{constructor(e){super(e),this.minDate=!this.props.min||this.props.min.getTime()<It.getTime()?It:this.props.min,this.maxDate=!this.props.max||this.props.max.getTime()>Ot.getTime()?Ot:this.props.max,this.state=Nt(this.minDate,this.maxDate,this.props.value,this.props.range),this.showDateInMonth=this.showDateInMonth.bind(this),this.showMonthInYear=this.showMonthInYear.bind(this),this.showYearInRange=this.showYearInRange.bind(this),this.getTitle=this.getTitle.bind(this)}componentDidUpdate(e,t,n){e.value!==this.props.value&&this.setState(Nt(this.minDate,this.maxDate,this.props.value,this.props.range))}showDateInMonth(){let e=new Date(this.state.selectYear,this.state.selectMonth,1);return t().createElement(t().Fragment,null,Array.from({length:7}).map(((e,n)=>{switch(n){case 0:var i=this.props.t("su");break;case 1:i=this.props.t("mo");break;case 2:i=this.props.t("tu");break;case 3:i=this.props.t("we");break;case 4:i=this.props.t("th");break;case 5:i=this.props.t("fr");break;case 6:i=this.props.t("sa");break;default:i=""}return t().createElement("div",{key:"dtwk-"+n,className:`${St["date-picker-circle"]} date-picker-circle`},t().createElement("span",{className:"label-4 row"},i))})),Array.from({length:42}).map(((n,i)=>{let r=i%7+7*Math.floor(i/7)-e.getDay();const s=new Date(this.state.selectYear,this.state.selectMonth,r+1);let o=`${St["date-picker-circle"]} date-picker-circle`,a="body-3";return r+1===Pt.getDate()&&this.state.selectMonth===Pt.getMonth()&&this.state.selectYear===Pt.getFullYear()&&(o+=` ${St.today}`),Vt(s,this.minDate,this.maxDate)?this.state.value instanceof Date?this.state.value.getTime()===s.getTime()&&(o+=` ${St.selected}`):this.state.value?.sTime.getDate()===s.getDate()&&Math.abs(kt(s,this.state.value.sTime))<1||this.state.value?.eTime.getDate()===s.getDate()&&Math.abs(kt(s,this.state.value.eTime))<1?o+=` ${St.selected} ${St[(this.state.value?.sTime.getDate()===s.getDate()&&Math.abs(kt(s,this.state.value.sTime))<1?"start":"end")+"-range"]}`:this.state.value&&Vt(s,this.state.value.sTime,this.state.value.eTime)&&(o+=` ${St["in-range"]}`):o+=` ${St.invalid}`,s.getMonth()!==this.state.selectMonth&&(a="placeholder-2"),t().createElement("div",{key:s.toString(),className:o,style:void 0},t().createElement("button",{type:"button",className:`${a} row`,onClick:()=>{const e=this.state.value;if(this.props.range){const t=!e||s.getTime()<e.sTime.getTime()?{sTime:s,eTime:s}:{sTime:e.sTime,eTime:s};this.setState({...this.state,value:t}),this.props.onSelect&&this.props.onSelect(t)}else this.setState({...this.state,value:s}),this.props.onSelect&&this.props.onSelect(s)}},s.getDate()))})))}showMonthInYear(){return t().createElement(t().Fragment,null,Array.from({length:12}).map(((e,n)=>{switch(n){case 0:var i="en"===this.props.i18n.language?"Jan":this.props.t("january");break;case 1:i="en"===this.props.i18n.language?"Feb":this.props.t("february");break;case 2:i="en"===this.props.i18n.language?"Mar":this.props.t("march");break;case 3:i="en"===this.props.i18n.language?"Apr":this.props.t("april");break;case 4:i="en"===this.props.i18n.language?"May":this.props.t("may");break;case 5:i="en"===this.props.i18n.language?"Jun":this.props.t("june");break;case 6:i="en"===this.props.i18n.language?"Jul":this.props.t("july");break;case 7:i="en"===this.props.i18n.language?"Aug":this.props.t("august");break;case 8:i="en"===this.props.i18n.language?"Sep":this.props.t("september");break;case 9:i="en"===this.props.i18n.language?"Oct":this.props.t("october");break;case 10:i="en"===this.props.i18n.language?"Nov":this.props.t("november");break;case 11:i="en"===this.props.i18n.language?"Dec":this.props.t("december");break;default:i=""}const r=new Date(this.state.selectYear,n);let s=`${St["month-picker-circle"]} month-picker-circle`;return this.state.selectYear===Pt.getFullYear()&&Pt.getMonth()===n&&(s+=` ${St.today}`),Vt(r,this.minDate,this.maxDate)?this.state.value instanceof Date?this.state.selectYear===this.state.value.getFullYear()&&n===this.state.value.getMonth()&&(s+=` ${St.selected}`):this.state.value&&(n===this.state.value.sTime.getMonth()&&this.state.value.sTime.getFullYear()===this.state.selectYear||n===this.state.value.eTime.getMonth()&&this.state.value.eTime.getFullYear()===this.state.selectYear)?s+=` ${St.selected} ${St[(n===this.state.value.sTime.getMonth()&&this.state.value.sTime.getFullYear()===this.state.selectYear?"start":"end")+"-range"]}`:this.state.value&&Vt(r,this.state.value.sTime,this.state.value.eTime)&&(s+=` ${St["in-range"]}`):s+=` ${St.invalid}`,t().createElement("div",{key:r.toString(),className:s},t().createElement("button",{type:"button",className:"body-3 row",onClick:()=>{this.setState({...this.state,selectMonth:n,tab:Rt.DATE})}},i))})))}showYearInRange(){return Array.from({length:12}).map(((e,n)=>{let i=n+(this.state.selectYear-(this.state.selectYear-It.getFullYear())%12),r=`${St["year-picker-circle"]} year-picker-circle`;return i===Pt.getFullYear()&&(r+=` ${St.today}`),i<this.minDate.getFullYear()||i>this.maxDate.getFullYear()?r+=` ${St.invalid}`:this.state.value instanceof Date?i===this.state.value.getFullYear()&&(r+=` ${St.selected}`):i===this.state.value?.sTime.getFullYear()||i===this.state.value?.eTime.getFullYear()?r+=` ${St.selected} ${St[(i===this.state.value?.sTime.getFullYear()?"start":"end")+"-range"]}`:this.state.value&&i>this.state.value.sTime.getFullYear()&&i<this.state.value.eTime.getFullYear()&&(r+=` ${St["in-range"]}`),t().createElement("div",{key:i.toString(),className:r},t().createElement("button",{type:"button",className:"body-3 row",onClick:()=>{this.setState({...this.state,tab:Rt.MONTH,selectYear:i})}},i))}))}getTitle(){switch(this.state.tab){case Rt.YEAR:let t=this.state.selectYear-(this.state.selectYear-It.getFullYear())%12;return`${t}-${t+11}`;case Rt.MONTH:return this.state.selectYear;default:switch(this.state.selectMonth){case 0:var e=this.props.t("january");break;case 1:e=this.props.t("february");break;case 2:e=this.props.t("march");break;case 3:e=this.props.t("april");break;case 4:e=this.props.t("may");break;case 5:e=this.props.t("june");break;case 6:e=this.props.t("july");break;case 7:e=this.props.t("august");break;case 8:e=this.props.t("september");break;case 9:e=this.props.t("october");break;case 10:e=this.props.t("november");break;case 11:e=this.props.t("december");break;default:e=""}return`${e}${"en"===this.props.i18n.language?" ":"/"}${this.state.selectYear}`}}render(){return t().createElement("div",{className:`${St["calendar-container"]} col ${this.props.className??""}`,style:this.props.style},this.props.header,t().createElement("div",{className:`${St["picker-date-header"]} row`},t().createElement("button",{type:"button",onClick:()=>{switch(this.state.tab){case Rt.YEAR:this.state.selectYear-10<It.getFullYear()?this.setState({...this.state,selectYear:It.getFullYear()}):this.setState({...this.state,selectYear:this.state.selectYear-10});break;case Rt.MONTH:new Date(this.state.selectYear,this.state.selectMonth-1).getTime()>=It.getTime()&&this.setState({...this.state,selectYear:this.state.selectYear-1});break;default:const e=new Date(this.state.selectYear,this.state.selectMonth-1);e.getTime()>=It.getTime()&&this.setState({...this.state,selectMonth:e.getMonth(),selectYear:e.getFullYear()})}}},t().createElement(w,{src:"fill/arrows/left-arrow",size:"1.4rem"})),t().createElement("span",{className:"heading-7",onClick:()=>{this.state.tab!==Rt.YEAR&&this.setState({...this.state,tab:this.state.tab===Rt.DATE?Rt.MONTH:Rt.YEAR})}},this.getTitle()),t().createElement("button",{type:"button",onClick:()=>{switch(this.state.tab){case Rt.YEAR:this.state.selectYear+10>Ot.getFullYear()?this.setState({...this.state,selectYear:Ot.getFullYear()}):this.setState({...this.state,selectYear:this.state.selectYear+10});break;case Rt.MONTH:new Date(this.state.selectYear,this.state.selectMonth+1).getTime()<=Ot.getTime()&&this.setState({...this.state,selectYear:this.state.selectYear+1});break;default:const e=new Date(this.state.selectYear,this.state.selectMonth+1);e.getTime()<=Ot.getTime()&&this.setState({...this.state,selectMonth:e.getMonth(),selectYear:e.getFullYear()})}}},t().createElement(w,{src:"fill/arrows/right-arrow",size:"1.4rem"}))),t().createElement("div",{className:`${St["picker-date-body"]} row`},this.state.tab===Rt.YEAR?this.showYearInRange():this.state.tab===Rt.MONTH?this.showMonthInYear():this.showDateInMonth()),this.props.footer)}}const Mt=L()(Lt);var Bt=o(348);i()(Bt.A,{insert:"head",singleton:!1});const Ft=Bt.A.locals||{};function Dt(n){const i=(0,e.useRef)(null);return(0,e.useEffect)((()=>{if(i.current&&"submit"===n.type){function e(e){"enter"===e.key.toLowerCase()&&i.current.click()}return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}}}),[n.type,i.current]),n.linkTo?t().createElement("a",{id:n.id,href:n.disabled?void 0:n.linkTo,target:n.target,className:`${Ft["button-container"]} row ${n.className??"button-text-3"}`,style:n.style,onClick:n.onClick},n.prefix,t().createElement(f,{maxLine:1,className:Ft["button-label"]},n.label),n.suffix):t().createElement("button",{ref:i,id:n.id,type:n.type??"button",disabled:n.disabled,className:`${Ft["button-container"]} row ${n.className??"button-text-3"}`,style:n.style,onClick:n.onClick},n.prefix,t().createElement(f,{maxLine:1,className:Ft["button-label"]},n.label),n.suffix)}const zt=new Date,$t=new Date(zt.getFullYear()-100,zt.getMonth(),zt.getDate()),jt=new Date(zt.getFullYear()+100,zt.getMonth(),zt.getDate()),Ht=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"dd/mm/yyyy",n=t.split(" "),i=n[0],r=n[1];i.includes("hh")&&(i=n[1],r=n[0]);let s=i.split(t.includes("/")?"/":"-").map((t=>{switch(t.toLowerCase()){case"dd":return e.getDate()<10?`0${e.getDate()}`:`${e.getDate()}`;case"mm":return e.getMonth()+1<10?`0${e.getMonth()+1}`:`${e.getMonth()+1}`;case"yyyy":return`${e.getFullYear()}`;default:return""}})).join(t.includes("/")?"/":"-");return r?s+" "+r.split(":").map((t=>{switch(t){case"hh":return e.getHours()<10?`0${e.getHours()}`:`${e.getHours()}`;case"mm":return e.getMinutes()<10?`0${e.getMinutes()}`:`${e.getMinutes()}`;case"ss":return e.getSeconds()<10?`0${e.getSeconds()}`:`${e.getSeconds()}`;default:return""}})).join(":"):s},Wt=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"dd/mm/yyyy",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"/",i=t,r="",s=e,o="",a=!1;t.trim().indexOf(" ")>-1&&(i=t.trim().split(" ")[0],r=t.trim().split(" ")[1],s=e.trim().split(" ")[0],o=e.trim().split(" ")[1]??"00:00:00",a=!0);let l=i.toLowerCase().split(n),c=s.split(n),d=l.indexOf("mm"),u=l.indexOf("dd"),h=l.indexOf("yyyy"),m=0,g=0,p=0;if(a){let e=r.split(":"),t=e.indexOf("HH");t<0&&(t=e.indexOf("hh"));let n=e.indexOf("mm"),i=e.indexOf("ss"),s=o.split(":");m=parseInt(s[t]??"0"),g=parseInt(s[n]??"0"),p=parseInt(s[i]??"0")}let f=parseInt(c[d]);return f-=1,new Date(parseInt(c[h]),f,parseInt(c[u]??"0"),m,g,p)},Ut=(e,t,n)=>kt(e,t)>-1&&kt(n,e)>-1;function qt(n){const i=(0,e.useRef)(null),r=(0,e.useRef)(null),[s,o]=(0,e.useState)(),a=(0,e.useMemo)((()=>s?s instanceof Date?t().createElement(f,{className:te.value},Ht(s,"dd/mm/yyyy"+(n.pickerType?.includes("time")?" hh:mm":""))):t().createElement(t().Fragment,null,t().createElement(f,{className:te.value,style:{flex:"none",width:"fit-content"}},Ht(s.start??new Date,"dd/mm/yyyy"+(n.pickerType?.includes("time")||"auto"===n.pickerType?" hh:mm":""))," - ",Ht(s.end??new Date,"dd/mm/yyyy"+(n.pickerType?.includes("time")||"auto"===n.pickerType?" hh:mm":""))),s.repeatData&&t().createElement(w,{src:"outline/arrows/loop-2",size:"1.2rem"})):t().createElement(f,{className:te.value,style:{color:"var(--neutral-text-subtitle-color)"}},n.placeholder??"")),[s]);(0,e.useEffect)((()=>{r.current&&(s&&s instanceof Date?r.current.value=Ht(s,"dd/mm/yyyy"):r.current.value="")}),[s,r.current]),(0,e.useEffect)((()=>{switch(n.pickerType){case"date":case"datetime":o(n.value);break;default:o(n.value&&n.endValue?{start:n.value,end:n.endValue,repeatData:"auto"===n.pickerType?n.repeatValue:void 0}:void 0)}}),[n.value,n.endValue,n.repeatValue,n.pickerType]);const l=e=>{B({ref:i,clickOverlayClosePopup:!0,content:t().createElement(Gt,{ref:i,max:n.max,min:n.min,value:s instanceof Date?s:s?.start,endValue:s instanceof Date?void 0:s?.end,pickerType:n.pickerType,enableRepeat:n.enableRepeat,style:{top:e.bottom+2,left:e.left+16},onApply:e=>{o(e),F(i),n.onChange&&n.onChange(e),r.current&&r.current.focus()}})})};return t().createElement(t().Fragment,null,t().createElement(D,{ref:i}),"date"===n.pickerType?t().createElement("div",{id:n.id,className:`row ${te["date-time-picker"]} ${n.className??"body-3"} ${n.helperText?.length?te["helper-text"]:""}`,"helper-text":n.helperText,style:n.style?{"--helper-text-color":n.helperTextColor??"#e14337",...n.style}:{"--helper-text-color":n.helperTextColor??"#e14337"},onClick:e=>{const t=e.target.closest("div").getBoundingClientRect();l(t)}},n.prefix??t().createElement(w,{className:te["prefix-icon"],src:"outline/user interface/calendar-date",size:"1.2rem"}),t().createElement("input",{className:te.value,ref:r,autoComplete:"off",disabled:n.disabled,placeholder:n.placeholder,readOnly:n.pickOnly,onKeyDown:e=>{"enter"===e.key.toLowerCase()&&e.target.blur()},onBlur:n.pickOnly?void 0:e=>{const t=e.target.value.trim();let i;t.match(/[0-9]{1,2}(\/|-)[0-9]{1,2}(\/|-)[0-9]{4}/g)&&(i=Wt(t,"dd/MM/yyyy","/"),Ut(i,n.min??$t,n.min??jt)||(i=kt(n.min??$t,i)>-1?n.min??$t:kt(i,n.min??jt)>-1?n.max??jt:void 0)),o(i),n.onChange&&n.onChange(i)}})):t().createElement("button",{id:n.id,type:"button",disabled:n.disabled,className:`row ${te["date-time-picker"]} ${n.className??"body-3"}`,style:n.style,onClick:e=>{const t=e.target.closest("button").getBoundingClientRect();l(t)}},n.prefix??t().createElement(w,{className:te["prefix-icon"],src:"outline/user interface/calendar-date",size:"1.2rem"}),a))}const Gt=(0,e.forwardRef)((function(n,i){let{value:r,style:s,endValue:o,repeatValue:a,onApply:c,pickerType:d="auto",enableRepeat:u=!1,min:h,max:m}=n;const g=bt({shouldFocusError:!1}),[p,b]=(0,e.useState)(!1),[v,y]=(0,e.useState)(!1),_=new Date,[k,x]=(0,e.useState)({type:1,value:["everyday"]}),C=(0,e.useRef)(null),A=(0,e.useRef)(null),E=(0,e.useRef)(null),{t:T}=N(),S=/[0-9]{1,2}(\/|-)[0-9]{1,2}(\/|-)[0-9]{4}/g,P=/^(?:[01]\d|2[0-3]):[0-5]\d(?:[:][0-5]\d)?$/g;(0,e.useEffect)((()=>{a&&u?(y(!0),x(a)):y(!1)}),[a]),(0,e.useEffect)((()=>{p&&"auto"!==d&&!d.includes("time")?(b(!1),g.setValue("time-start",null),g.setValue("time-end",null)):!p&&d.includes("time")&&b(!0)}),[d]);const I=()=>{if(r){const e=new Date(r);g.setValue("date-start",e),A.current.getInput().value=Ht(e),(d.includes("time")||1===e.getSeconds())&&(b(!0),g.setValue("time-start",`${e.getHours()<9?`0${e.getHours()}`:e.getHours()}:${e.getMinutes()<9?`0${e.getMinutes()}`:e.getMinutes()}`))}else A.current.getInput().value=""},O=()=>{if((d?.includes("range")||"auto"===d)&&E.current)if(o){const e=new Date(o);g.setValue("date-end",e),E.current.getInput().value=Ht(e),(d.includes("time")||59===e.getSeconds())&&g.setValue("time-end",`${e.getHours()<9?`0${e.getHours()}`:e.getHours()}:${e.getMinutes()<9?`0${e.getMinutes()}`:e.getMinutes()}`)}else E.current.getInput().value=""};return(0,e.useEffect)((()=>{r&&A.current&&I()}),[r,A]),(0,e.useEffect)((()=>{O()}),[o,E,d]),t().createElement("div",{className:"col",style:{width:"31.2rem",...s}},t().createElement(D,{ref:C}),t().createElement(Mt,{min:h,max:m,range:d.includes("range")||"auto"===d,value:"date"===d||"datetime"===d?g.watch("date-start"):g.watch("date-start")&&g.watch("date-end")?{sTime:g.watch("date-start"),eTime:g.watch("date-end")}:void 0,header:"date"!==d&&t().createElement("div",{className:"row",style:{flexWrap:"wrap",gap:"0.8rem 1.2rem",padding:"1.6rem",borderBottom:"var(--neutral-main-border)"}},t().createElement(Et,{ref:A,autoComplete:"off",className:"col12 body-3",style:{"--gutter":"1.2rem",padding:"0.4rem 1.2rem"},placeholder:d.includes("range")||"auto"===d?T("start-date"):"dd/mm/yyyy",onComplete:e=>e.target.blur(),onBlur:e=>{const t=e.target.value;if(S.test(t)){const e=Wt(t,"dd/mm/yyyy","/");(d.includes("range")||"auto"===d)&&kt(g.getValues("date-end"),e)<0&&(g.setValue("date-end",e),E.current.getInput().value=Ht(e)),g.setValue("date-start",e)}else e.target.value=g.getValues("date-start")?Ht(g.getValues("date-start")):""}}),(d.includes("range")||"auto"===d)&&t().createElement(Et,{ref:E,autoComplete:"off",className:"col12 body-3",style:{"--gutter":"1.2rem",padding:"0.4rem 1.2rem"},placeholder:T("end-date"),onComplete:e=>e.target.blur(),onBlur:e=>{const t=e.target.value;if(S.test(t)){const e=Wt(t,"dd/mm/yyyy","/");kt(e,g.getValues("date-start"))<0&&(g.setValue("date-start",e),A.current.getInput().value=Ht(e)),g.setValue("date-end",e)}else e.target.value=g.getValues("date-end")?Ht(g.getValues("date-end")):""}}),p&&t().createElement(t().Fragment,null,t().createElement(Et,{autoComplete:"off",name:"time-start",style:{"--gutter":"1.2rem",padding:"0.4rem 1.2rem"},onComplete:e=>{e.target.blur()},register:g.register("time-start",{onChange:e=>e.target.value=e.target.value.trim(),onBlur:e=>{P.test(e.target.value)?g.setValue("time-start",e.target.value):e.target.value=""}}),className:"col12 body-3",placeholder:"hh:mm",onFocus:e=>{const n=e.target.closest("div").getBoundingClientRect();B({ref:C,clickOverlayClosePopup:!0,content:t().createElement("div",{className:`col ${te["popup-actions"]}`,style:{maxHeight:"24rem",top:n.bottom+2,right:document.body.offsetWidth-n.right,width:n.width,overflow:"hidden auto",border:"var(--neutral-main-border)"}},Array.from({length:48}).map(((e,n)=>{if(n%2==0)var i=`${n/2<9?"0"+n/2:n/2}:00`;else i=`${(n-1)/2<9?"0"+(n-1)/2:(n-1)/2}:30`;return t().createElement("button",{key:"time-"+n,type:"button",className:"row",onClick:()=>{g.setValue("time-start",i),F(C)}},t().createElement(f,{className:"body-3"},i))})))})}}),(d.includes("range")||"auto"===d)&&t().createElement(Et,{autoComplete:"off",name:"time-end",style:{"--gutter":"1.2rem",padding:"0.4rem 1.2rem"},onComplete:e=>{e.target.blur()},register:g.register("time-end",{onChange:e=>e.target.value=e.target.value.trim(),onBlur:e=>{P.test(e.target.value)?g.setValue("time-end",e.target.value):e.target.value=""}}),className:"col12 body-3",placeholder:"hh:mm",onFocus:e=>{const n=e.target.closest("div").getBoundingClientRect();B({ref:C,clickOverlayClosePopup:!0,content:t().createElement("div",{className:`col ${te["popup-actions"]}`,style:{maxHeight:"24rem",top:n.bottom+2,right:document.body.offsetWidth-n.right,width:n.width,overflow:"hidden auto",border:"var(--neutral-main-border)"}},Array.from({length:48}).map(((e,n)=>{if(n%2==0)var i=`${n/2<9?"0"+n/2:n/2}:00`;else i=`${(n-1)/2<9?"0"+(n-1)/2:(n-1)/2}:30`;return t().createElement("button",{key:"time-"+n,type:"button",className:"row",onClick:()=>{g.setValue("time-end",i),F(C)}},t().createElement(f,{className:"body-3"},i))})))})}}))),footer:"date"!==d&&t().createElement(t().Fragment,null,v&&t().createElement("div",{className:"col",style:{borderTop:"var(--neutral-main-border)"}},t().createElement("div",{className:"row",style:{gap:4,padding:"1.2rem 1.6rem"}},t().createElement(f,{className:"heading-8",style:{flex:1}},"Lặp lại"),t().createElement(Dt,{style:{padding:0},label:(()=>{switch(k.type){case 1:return T("daily");case 2:return T("weekly");case 3:return T("monthly");default:return""}})(),suffix:t().createElement(w,{src:"outline/arrows/down-arrow",size:"1.4rem",style:{padding:"0.2rem"}}),onClick:e=>{const n=e.target.closest("button").getBoundingClientRect();B({ref:C,clickOverlayClosePopup:!0,style:{position:"absolute",top:n.bottom+2,left:n.x+8},body:t().createElement("div",{className:"col popup-actions"},Array.from({length:3}).map(((e,n)=>{let i="";switch(n){case 0:i=T("daily");break;case 1:i=T("weekly");break;case 2:i=T("monthly")}return t().createElement("button",{key:"tStatus-"+n,type:"button",className:"row",onClick:()=>{let e=["everyday"];switch(n){case 0:e=["everyday"];break;case 1:e=_.getDay();break;case 2:e=_.getDate()}x({type:n+1,value:[e]}),F(C)}},t().createElement(f,{className:"button-text-3"},i))})))})}})),(()=>{switch(k.type){case 2:return t().createElement(t().Fragment,null,t().createElement(f,{className:"heading-8",style:{padding:"0 1.6rem"}},T("on")+" "+T("date").toLowerCase()),t().createElement("div",{className:"row",style:{justifyContent:"space-between",padding:"0.4rem 1.6rem"}},Array.from({length:7}).map(((e,n)=>{switch(n){case 0:var i=T("su");break;case 1:i=T("mo");break;case 2:i=T("tu");break;case 3:i=T("we");break;case 4:i=T("th");break;case 5:i=T("fr");break;case 6:i=T("sa");break;default:i=""}return t().createElement("div",{key:"weekday-"+n,className:"col",style:{gap:4,alignItems:"center"}},t().createElement(l,{size:"1.8rem",value:k.value.includes(n),disabled:k.value.includes(n)&&1===k.value.length,onChange:e=>{x(e?{type:2,value:[...k.value,n]}:{type:2,value:k.value.filter((e=>e!==n))})}}),t().createElement(f,{className:"placeholder-2"},i))}))));case 3:return t().createElement("div",{className:"row",style:{justifyContent:"space-between",padding:"0.4rem 1.6rem",gap:"1.2rem"}},t().createElement(f,{className:"heading-8",style:{flex:1}},T("on")+" "+T("date").toLowerCase()),t().createElement(Dt,{style:{padding:0},label:"last"===k.value[0]?T("Last"):`${k.value[0]}`,suffix:t().createElement(w,{src:"outline/arrows/down-arrow",size:"1.4rem",style:{padding:"0.2rem"}}),onClick:e=>{const n=e.target.closest("button").getBoundingClientRect();B({ref:C,clickOverlayClosePopup:!0,style:{top:n.bottom+2,right:document.body.offsetWidth-n.right,maxHeight:"30.4rem"},body:t().createElement("div",{className:"col popup-actions",style:{flex:1,overflow:"hidden auto"}},Array.from({length:29}).map(((e,n)=>{if(28===n)var i=T("Last");else i=`${n+1}`;return t().createElement("button",{key:"date-"+n,type:"button",className:"row",onClick:()=>{x({type:3,value:[28===n?"last":n+1]}),F(C)}},t().createElement(f,{className:"button-text-3"},i))})))})}}));default:return null}})()),c&&t().createElement("div",{className:"row",style:{gap:"0.8rem",padding:"1.2rem 1.6rem",borderTop:"var(--neutral-main-border)"}},"auto"===d&&t().createElement("div",{className:"row",style:{gap:4}},t().createElement(w,{src:"outline/user interface/time-alarm",size:"1.6rem",style:{padding:"0.7rem",borderRadius:"50%",backgroundColor:p?"var(--neutral-disable-background-color)":void 0},onClick:()=>{b(!p)}}),(u||"auto"===d)&&t().createElement(w,{src:"outline/arrows/loop-2",size:"1.6rem",style:{padding:"0.7rem",borderRadius:"50%",backgroundColor:v?"var(--neutral-disable-background-color)":void 0},onClick:()=>{y(!v)}})),t().createElement("div",{style:{flex:1}}),t().createElement(Dt,{label:T("reset"),onClick:()=>{g.setValue("date-start",null),g.setValue("date-end",null),g.setValue("time-start",null),g.setValue("time-end",null),I(),O()}}),t().createElement(Dt,{label:T("apply"),disabled:!g.watch("date-start")||!g.watch("date-end")&&(d.includes("range")||"auto"===d),className:"button-text-3 button-primary",onClick:()=>{let e=g.getValues("date-start"),t=p&&g.getValues("time-start")?.length?g.getValues("time-start"):"00:00";if(e.setHours(parseInt(t.split(":")[0]),parseInt(t.split(":")[1]),p?1:0,0),d.includes("range")||"auto"===d){var n=g.getValues("date-end");let e=p&&g.getValues("time-end")?.length?g.getValues("time-end"):"23:59";n.setHours(parseInt(e.split(":")[0]),parseInt(e.split(":")[1]),p?59:0,0)}c(d.includes("range")||"auto"===d?{start:e,end:n,repeatData:v?k:void 0}:e),F(i)}}))),onSelect:e=>{"date"!==d?e instanceof Date?(g.setValue("date-start",e),A.current&&(A.current.getInput().value=Ht(e))):(g.setValue("date-start",e.sTime),A.current&&(A.current.getInput().value=Ht(e.sTime)),(d.includes("range")||"auto"===d)&&(g.setValue("date-end",e.eTime),E.current&&(E.current.getInput().value=Ht(e.eTime)))):c&&(c(e),F(i))}}))}));var Kt=o(6);i()(Kt.A,{insert:"head",singleton:!1});const Zt=Kt.A.locals||{};class Qt extends t().Component{containerRef=(()=>(0,e.createRef)())();inputRef=(()=>(0,e.createRef)())();constructor(e){super(e),this.state={value:e.value??[],options:e.options,offset:{x:0,y:0,height:0,width:0,bottom:0,left:0,right:0,top:0,toJSON:function(){throw new Error("Function not implemented.")}},isOpen:!1,onSelect:null},this.onCheck=this.onCheck.bind(this),this.search=this.search.bind(this),this.onClickItem=this.onClickItem.bind(this)}onCheck(e,t){let n=[];n=e?[...this.state.value,...t.map((e=>e.id))]:this.state.value.filter((e=>t.every((t=>e!==t.id)))),this.setState({...this.state,value:n}),this.props.onChange&&this.props.onChange(n)}async search(e){if(e.target.value.trim().length)if(this.props?.handleSearch){const t=await this.props.handleSearch(e.target.value.trim());this.setState({...this.state,search:t})}else this.setState({...this.state,search:this.props.options.filter((t=>"string"==typeof t.name&&t.name.toLowerCase().includes(e.target.value.trim().toLowerCase())))});else this.setState({...this.state,search:void 0})}onClickItem(e,t){e.stopPropagation();let n=this.state.value.filter((e=>e!==t));this.setState({...this.state,value:n,...this.state.isOpen?{}:{isOpen:!0,style:void 0,offset:this.containerRef?.current?.getBoundingClientRect()}}),this.props.onChange&&this.props.onChange(n)}renderOptions(e){let n=[];return e.parentId||(n=(this.state.search??this.state.options).filter((t=>t.parentId===e.id))),t().createElement("div",{key:e.id,className:"col",style:{width:"100%"}},t().createElement("div",{className:`${Zt["select-tile"]} row ${e.disabled?Zt.disabled:""}`,style:{paddingLeft:e.parentId?"4.4rem":void 0},onClick:n.length?()=>{this.state.search?this.setState({...this.state,search:this.state.search.map((t=>t.id===e.id?{...t,isOpen:!e.isOpen}:t))}):this.setState({...this.state,options:this.state.options.map((t=>t.id===e.id?{...t,isOpen:!e.isOpen}:t))})}:void 0},(this.state.search??this.state.options).some((e=>e.parentId))&&t().createElement("div",{className:"row",style:{width:"1.4rem",height:"1.4rem"}},n.length?t().createElement(w,{src:e.isOpen?"fill/arrows/triangle-down":"fill/arrows/triangle-right",size:"1.2rem"}):null),t().createElement(l,{disabled:e.disabled,value:n.length?!!n.every((e=>this.state.value.includes(e.id)))||!!n.some((e=>this.state.value.includes(e.id)))&&void 0:this.state.value.includes(e.id),onChange:t=>{this.onCheck(t,[e,...n])},size:"2rem"}),t().createElement(f,{className:"body-3"},e.name)),t().createElement("div",{className:"col",style:{display:e.isOpen?"flex":"none",width:"100%"}},n.map((e=>this.renderOptions(e)))))}componentDidUpdate(e,t){if(e.options!==this.props.options&&this.setState({...this.state,options:this.props.options}),e.value!==this.props.value&&this.setState({...this.state,value:this.props.value??[]}),this.state.isOpen&&(t.isOpen!==this.state.isOpen||t.value.length!==this.state.value.length)){const e=this.containerRef.current.querySelector(".select-multi-popup")?.getBoundingClientRect();if(e){let n;t.isOpen!==this.state.isOpen&&e.right>document.body.offsetWidth&&(n={top:this.state.offset.y+this.state.offset.height+2+"px",right:document.body.offsetWidth-this.state.offset.right+"px"});let i=e.bottom-8;const r=this.containerRef.current?.getBoundingClientRect();r&&(t.value.length!==this.state.value.length&&(i=r.bottom+2+e.height,n={...n??{},top:`${r.bottom+2}px`}),i>document.body.offsetHeight&&(n={...n??{},top:r.y-2-e.height+"px"})),n&&(n.left??=n.right?void 0:`${this.state.offset.x}px`,n.width??=`${this.state.offset.width}px`,this.setState({...this.state,style:n}))}}}render(){const{t:e}=this.props;return t().createElement("div",{id:this.props.id,ref:this.containerRef,className:`${Zt["select-multi-container"]} row ${this.props.disabled?Zt.disabled:""} ${this.props.helperText?.length&&Zt["helper-text"]} ${this.props.className??"body-3"}`,"helper-text":this.props.helperText,style:this.props.style?{"--helper-text-color":this.props.helperTextColor??"#e14337",...this.props.style}:{"--helper-text-color":this.props.helperTextColor??"#e14337"},onClick:()=>{this.state.isOpen||this.setState({...this.state,isOpen:!0,style:void 0,offset:this.containerRef?.current?.getBoundingClientRect()})}},t().createElement("div",{className:"row",style:{flexWrap:"wrap",flex:1,width:"100%",gap:"0.6rem 0.4rem"}},this.state.value.map((e=>{const n=this.props.options.find((t=>t.id===e));return t().createElement("div",{key:e,className:`row ${Zt["selected-item-value"]}`,onClick:n?.disabled?void 0:t=>this.onClickItem(t,e)},t().createElement(f,{style:{color:"var(--neutral-text-title-color)",fontSize:"1.2rem",lineHeight:"1.4rem"}},n?.name),t().createElement(w,{src:"outline/user interface/e-remove",size:"1.2rem"}))})),(!this.state.value.length||this.state.isOpen)&&t().createElement("input",{ref:this.inputRef,autoFocus:this.state.value.length>0,onChange:this.search,placeholder:this.state.value.length?void 0:this.props.placeholder,onBlur:e=>{this.state.isOpen&&e.target.focus()}})),this.props.showClearValueButton&&this.state.value.length?t().createElement("button",{type:"button",className:"row",style:{padding:"0.4rem"},onClick:e=>{e.stopPropagation(),this.state.value.length&&this.setState({...this.state,isOpen:!0,value:[]})}},t().createElement(w,{src:"outline/user interface/c-remove",size:"1.6rem"})):t().createElement("div",{ref:e=>{e?.parentElement&&e.parentElement.getBoundingClientRect().width<100&&(e.style.display="none")},className:"row"},t().createElement(w,{src:this.state.isOpen?"fill/arrows/up-arrow":"fill/arrows/down-arrow",size:"1.2rem"})),this.state.isOpen&&t().createElement(z,{className:"hidden-overlay",onClose:e=>{e.target!==this.inputRef.current&&this.setState({...this.state,isOpen:!1})}},t().createElement("div",{className:`${Zt["select-multi-popup"]} select-multi-popup col ${this.props.popupClassName??""}`,style:this.state.style??{top:this.state.offset.y+this.state.offset.height+2+"px",left:this.state.offset.x+"px",width:this.state.offset.width}},t().createElement("div",{style:{padding:"1.2rem 1.6rem",width:"100%",borderBottom:"var(--neutral-main-border)"}},(()=>{const n=this.state.search??this.props.options??[],i=n.every((e=>this.state.value.some((t=>t===e.id))));return t().createElement(f,{onClick:()=>{let e=[];n.length&&(e=i?this.state.value.filter((e=>n.every((t=>e!==t.id||t.disabled)))):[...this.state.value,...n.filter((e=>this.state.value.every((t=>t!==e.id))&&!e.disabled)).map((e=>e.id))]),this.setState({...this.state,value:e}),this.props.onChange&&this.props.onChange(e)},className:"button-text-3",style:{color:n.length?void 0:"var(--neutral-text-title-color)"}},n.length&&i?`${e("remove")} ${e("all").toLowerCase()}`:`${e("select")} ${e("all").toLowerCase()}`)})()),t().createElement("div",{className:`col ${Zt["select-body"]}`,onScroll:this.props.handleLoadmore?e=>{if(this.props.handleLoadmore){let t=e.target;this.props.handleLoadmore(Math.round(t.offsetHeight+t.scrollTop)>=t.scrollHeight-1,e)}}:void 0},(this.state.search??this.state.options).filter((e=>!e.parentId)).map((e=>this.renderOptions(e))),!this.state.search?.length&&!this.props.options?.length&&t().createElement("div",{className:Zt["no-results-found"]},e("noResultFound"))))))}}const Yt=L()(Qt);var Jt=o(622);i()(Jt.A,{insert:"head",singleton:!1});const Xt=Jt.A.locals||{};function en(n){let{id:i,status:r=tn.INFOR,percent:s=100,titleText:o,title:a,hideTitle:l=!1,progressBarOnly:c=!1,fullColor:d="var(--neutral-main-background-color)",percentColor:u="var(--primary-main-color)",style:h,progressBarStyle:m}=n;const[g,p]=(0,e.useState)(!0);return t().createElement("div",{id:i,className:`col ${Xt["progress-bar-container"]}`,style:h?{padding:c?"0":"1.6rem 2.4rem",...h}:{padding:c?"0":"1.6rem 2.4rem"}},l||c?null:a??t().createElement("div",{className:`row ${Xt["progress-bar-title"]}`},t().createElement("div",{className:"heading-8"},o),t().createElement(w,{src:g?"fill/arrows/down-arrow":"fill/arrows/up-arrow",onClick:()=>{p(!g)}})),g?t().createElement("div",{className:`row ${Xt["progress-bar-tile"]}`},t().createElement("div",{className:Xt["progress-bar-value"],style:{"--percent-color":u,"--full-color":d,"--percent":`${s}%`,...m??{}}}),c||r===tn.INFOR?null:t().createElement("div",{className:`${Xt["status-icon"]}`},nn(r)),c?null:t().createElement("div",{className:"label-4"},s,"/100")):null)}let tn=function(e){return e[e.INFOR=1]="INFOR",e[e.ERROR=2]="ERROR",e[e.WARNING=3]="WARNING",e[e.SUCCSESS=4]="SUCCSESS",e}({});const nn=e=>{switch(e){case tn.ERROR:return sn;case tn.WARNING:return on;case tn.SUCCSESS:return an;default:return rn}},rn=t().createElement("div",{style:{width:"3.6rem",height:"3.6rem"}},t().createElement("svg",{width:"100%",height:"100%",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t().createElement("path",{d:"M18.0003 3.41669C15.116 3.41669 12.2965 4.27198 9.89826 5.87442C7.50005 7.47686 5.63087 9.75446 4.52709 12.4192C3.42331 15.084 3.13451 18.0162 3.69721 20.8451C4.25991 23.674 5.64884 26.2725 7.68836 28.312C9.72787 30.3515 12.3264 31.7404 15.1553 32.3031C17.9842 32.8658 20.9164 32.577 23.5811 31.4733C26.2459 30.3695 28.5235 28.5003 30.1259 26.1021C31.7284 23.7039 32.5837 20.8843 32.5837 18C32.5795 14.1336 31.0417 10.4267 28.3077 7.69266C25.5737 4.95867 21.8668 3.42087 18.0003 3.41669V3.41669ZM19.2496 26.1715H16.7401V15.5695H19.2496V26.1715ZM19.0418 12.2384C18.9034 12.3653 18.7407 12.463 18.5637 12.5256C18.3866 12.5883 18.1987 12.6146 18.0113 12.603C17.8204 12.6157 17.6289 12.5899 17.4481 12.5273C17.2673 12.4647 17.101 12.3664 16.9588 12.2384C16.8333 12.1032 16.7363 11.9441 16.6737 11.7706C16.611 11.5971 16.584 11.4127 16.5943 11.2285C16.5815 11.04 16.6073 10.8509 16.67 10.6727C16.7327 10.4945 16.8309 10.3309 16.9588 10.1919C17.1013 10.0644 17.2678 9.96649 17.4484 9.9039C17.6291 9.84131 17.8204 9.81526 18.0113 9.82728C18.1987 9.81637 18.3864 9.843 18.5633 9.90561C18.7403 9.96822 18.903 10.0655 19.0418 10.1919C19.1697 10.3309 19.268 10.4945 19.3307 10.6727C19.3934 10.8509 19.4191 11.04 19.4064 11.2285C19.4166 11.4127 19.3896 11.5971 19.327 11.7706C19.2644 11.9441 19.1674 12.1032 19.0418 12.2384Z",fill:"#366AE2"}))),sn=t().createElement("div",{style:{width:"3.6rem",height:"3.6rem"}},t().createElement("svg",{width:"100%",height:"100%",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t().createElement("path",{d:"M18.0003 3.41669C15.116 3.41669 12.2965 4.27198 9.89826 5.87442C7.50005 7.47686 5.63087 9.75446 4.52709 12.4192C3.42331 15.084 3.13451 18.0162 3.69721 20.8451C4.25991 23.674 5.64884 26.2725 7.68836 28.312C9.72787 30.3515 12.3264 31.7404 15.1553 32.3031C17.9842 32.8658 20.9164 32.577 23.5811 31.4733C26.2459 30.3695 28.5235 28.5003 30.1259 26.1021C31.7284 23.7039 32.5837 20.8843 32.5837 18C32.5724 14.1357 31.0324 10.4329 28.2999 7.70044C25.5674 4.96797 21.8646 3.42791 18.0003 3.41669V3.41669ZM24.016 22.2972L22.2976 24.0156L18.0003 19.7184L13.7031 24.0156L11.9847 22.2972L16.2819 18L11.9847 13.7028L13.7031 11.9844L18.0003 16.2816L22.2976 11.9844L24.016 13.7028L19.7187 18L24.016 22.2972Z",fill:"#E14337"}))),on=t().createElement("div",{style:{width:"3.6rem",height:"3.6rem"}},t().createElement("svg",{width:"100%",height:"100%",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t().createElement("path",{d:"M32.1516 25.8877L21.3215 5.41379C21.0014 4.81074 20.5231 4.30622 19.938 3.95437C19.3529 3.60252 18.6831 3.41663 18.0003 3.41663C17.3176 3.41663 16.6477 3.60252 16.0626 3.95437C15.4775 4.30622 14.9993 4.81074 14.6792 5.41379L3.84901 25.8877C3.54781 26.459 3.39954 27.0984 3.41863 27.744C3.43771 28.3895 3.6235 29.0191 3.95793 29.5716C4.29235 30.1241 4.76404 30.5806 5.32713 30.8969C5.89022 31.2131 6.52555 31.3783 7.17136 31.3763H28.8293C29.4751 31.3783 30.1104 31.2131 30.6735 30.8969C31.2366 30.5806 31.7083 30.1241 32.0427 29.5716C32.3771 29.0191 32.5629 28.3895 32.582 27.744C32.6011 27.0984 32.4528 26.459 32.1516 25.8877ZM18.0003 27.7294C17.6397 27.7294 17.2871 27.6224 16.9873 27.4221C16.6874 27.2217 16.4537 26.9369 16.3157 26.6037C16.1776 26.2705 16.1415 25.9039 16.2119 25.5502C16.2823 25.1965 16.4559 24.8715 16.7109 24.6165C16.966 24.3615 17.2909 24.1878 17.6446 24.1175C17.9983 24.0471 18.3649 24.0832 18.6981 24.2212C19.0313 24.3593 19.3161 24.593 19.5165 24.8928C19.7168 25.1927 19.8238 25.5453 19.8238 25.9059C19.8238 26.3895 19.6317 26.8533 19.2897 27.1953C18.9477 27.5373 18.4839 27.7294 18.0003 27.7294ZM19.216 21.6512H16.7847L16.1769 11.926H19.8238L19.216 21.6512Z",fill:"#FC6B03"}))),an=t().createElement("div",{style:{width:"3.6rem",height:"3.6rem"}},t().createElement("svg",{width:"100%",height:"100%",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t().createElement("path",{d:"M18.0003 3.41669C15.116 3.41669 12.2965 4.27198 9.89826 5.87442C7.50005 7.47686 5.63087 9.75446 4.52709 12.4192C3.42331 15.084 3.13451 18.0162 3.69721 20.8451C4.25991 23.674 5.64884 26.2725 7.68836 28.312C9.72787 30.3515 12.3264 31.7404 15.1553 32.3031C17.9842 32.8658 20.9164 32.577 23.5811 31.4733C26.2459 30.3695 28.5235 28.5003 30.1259 26.1021C31.7284 23.7039 32.5837 20.8843 32.5837 18C32.5724 14.1357 31.0324 10.4329 28.2999 7.70044C25.5674 4.96797 21.8646 3.42791 18.0003 3.41669V3.41669ZM15.5698 24.5795L8.99026 18L10.7087 16.2816L15.5698 21.1427L25.292 11.4205L27.0104 13.1389L15.5698 24.5795Z",fill:"#39AC6D"})));var ln=o(764),cn=o.n(ln),dn=o(544);i()(dn.A,{insert:"head",singleton:!1});const un=dn.A.locals||{};function hn(n){let{id:i,currentPage:r,itemPerPage:s,totalItem:o,onChangePage:a,hidePageSize:l=!1,hideGoToPage:c=!1,style:d}=n;const u=(0,e.useRef)(null),{t:h}=N();return(0,e.useEffect)((()=>{if(u.current){const e=u.current.getInput();e&&(e.value=r.toString())}}),[r]),r>1&&(0===o||Math.floor(o/s)+(o%s==0?0:1)<r)?(a(1,s),t().createElement("div",null)):o>0?t().createElement("div",{id:i,className:`${un["custom-pagination"]} row`,style:d},l?null:t().createElement("div",{className:"row",style:{gap:"0.8rem"}},t().createElement(H,{readOnly:!0,placeholder:s.toString(),options:[10,20,50,80,100,150,200].map(((e,t)=>({id:e,name:e}))),style:{borderRadius:"0.4rem",width:"5.6rem",padding:"0 0.8rem",height:"2.4rem"},onChange:e=>{a(r,isNaN(parseInt(e.id))?s:parseInt(e.id))}}),t().createElement(f,{className:"body-3"},h("ofItems",{totalItem:o}))),t().createElement("div",{style:{flex:1}}),t().createElement(cn(),{onPageChange:e=>{a(e.selected+1,s)},forcePage:r-1,breakClassName:"row button-text-3",breakLabel:"...",pageCount:Math.ceil(o/s),previousClassName:"row",previousLabel:t().createElement(w,{src:"fill/arrows/left-arrow",size:"1.4rem"}),nextClassName:"row",nextLabel:t().createElement(w,{src:"fill/arrows/right-arrow",size:"1.4rem"}),containerClassName:`${un.pagination} row`,pageClassName:"row button-text-3",activeClassName:un.active,hrefBuilder:e=>e>=1&&e<=Math.ceil(o/s)?`/page/${e}`:"#",renderOnZeroPageCount:null}),c?null:t().createElement(t().Fragment,null,t().createElement("div",{style:{height:"1.6rem",backgroundColor:"var(--neutral-bolder-border-color)",width:1}}),t().createElement(f,{className:"label-3"},h("go")," ",h("page").toLowerCase()),t().createElement(Et,{ref:u,style:{width:"4.8rem",textAlign:"center",padding:0,height:"2.4rem",borderRadius:"0.4rem"},className:"body-3",type:"number",onBlur:e=>{const t=e.target.value.trim().length?parseInt(e.target.value.trim()):void 0;t&&!isNaN(t)&&t>0&&t<=Math.ceil(o/s)?a(t,s):e.target.value=""}}))):t().createElement("div",{id:i})}var mn=o(898);i()(mn.A,{insert:"head",singleton:!1}),mn.A.locals;let gn=function(e){return e.start="start",e.center="center",e.end="end",e}({});class pn extends t().Component{render(){return t().createElement("td",{id:this.props.id,onClick:this.props.onClick,style:this.props.style,"align-cell":this.props.align??gn.start,className:`tb-cell ${this.props.className??""} ${this.props.fixed?"tb-cell-fixed":""}`},this.props.children)}}class fn extends t().Component{render(){return t().createElement("tr",{id:this.props.id,style:this.props.style,className:`tb-row ${this.props.className??""}`,onClick:this.props.onClick},(this.props.children??[]).map(((e,n)=>{let i=0;return this.props.children&&n>0&&n<this.props.children.length-1&&(i=`calc(${this.props.children.slice(0,n).map((e=>{const t=e.props.style?.minWidth??e.props.style?.width;return t?"number"==typeof t?`${t}px`:t:"60px"})).join(" + ")})`),t().createElement(pn,{id:e.props.id,key:`tb-cell-${n}`,align:e.props.align,children:e.props.children,fixed:e.props.fixed,onClick:e.props.onClick,style:e.props.fixed?this.props.children&&n===this.props.children.length-1?{right:0,...e.props.style??{}}:{left:i,...e.props.style??{}}:e.props.style,className:e.props.className})})))}}class bn extends t().Component{render(){return t().createElement("thead",{style:this.props.style,className:`tb-header ${this.props.className??""}`},t().createElement("tr",null,(this.props.children??[]).map(((e,n)=>{let i=0;return this.props.children&&n>0&&n<this.props.children.length-1&&(i=`calc(${this.props.children.slice(0,n).map((e=>e.props.style?.width?"number"==typeof e.props.style.width?`${e.props.style.width}px`:e.props.style.width:"60px")).join(" + ")})`),t().createElement(pn,{id:e.props.id,key:`tb-cell-${n}`,align:e.props.align,children:e.props.children,onClick:e.props.onClick,fixed:e.props.fixed,style:e.props.fixed?this.props.children&&n===this.props.children.length-1?{right:0,...e.props.style??{}}:{left:i,...e.props.style??{}}:e.props.style,className:e.props.className})}))))}}class wn extends t().Component{render(){return t().createElement("tbody",{id:this.props.id},this.props.children)}}class vn extends t().Component{render(){return t().createElement("table",{id:this.props.id,className:`custom-table ${this.props.className}`,style:this.props.style},this.props.children)}}var yn=o(648);i()(yn.A,{insert:"head",singleton:!1});const _n=yn.A.locals||{};function kn(){return kn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},kn.apply(null,arguments)}class xn extends t().Component{render(){let e={"--off-color":this.props.offColor??"var(--neutral-bolder-border-color)","--active-color":this.props.activeColor??"var(--primary-main-color)","--size":this.props.size?"number"==typeof this.props.size?`${this.props.size}px`:this.props.size:"20px"};return this.props.style&&(delete this.props.style.width,delete this.props.style.minWidth,delete this.props.style.maxWidth,delete this.props.style.height,delete this.props.style.minHeight,delete this.props.style.maxHeight,e={...this.props.style,...e}),t().createElement("label",{id:this.props.id,className:`row ${_n["radio-btn-container"]} ${this.props.className??""}`,style:e},this.props.register?t().createElement("input",kn({},this.props.register,{type:"radio",value:this.props.value,disabled:this.props.disabled})):t().createElement("input",{type:"radio",name:this.props.name,value:this.props.value,defaultChecked:this.props.defaultChecked,disabled:this.props.disabled,onChange:this.props.onChange}),t().createElement("span",{className:_n.checkmark}))}}var Cn=o(342);i()(Cn.A,{insert:"head",singleton:!1});const An=Cn.A.locals||{};function En(){return En=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},En.apply(null,arguments)}class Tn extends t().Component{containerRef=(()=>(0,e.createRef)())();getTextarea=()=>this.containerRef.current?.querySelector("textarea");render(){return t().createElement("div",{ref:this.containerRef,id:this.props.id,className:`${An["text-area-container"]} row ${this.props.className??"body-3"} ${this.props.helperText?.length?An["helper-text"]:""}`,"helper-text":this.props.helperText,style:this.props.style?{"--helper-text-color":this.props.helperTextColor??"#e14337",...this.props.style}:{"--helper-text-color":this.props.helperTextColor??"#e14337"}},this.props.register?t().createElement("textarea",En({name:this.props.name,autoFocus:this.props.autoFocus},this.props.register,{maxLength:this.props.maxLength,placeholder:this.props.placeholder,readOnly:this.props.readOnly,disabled:this.props.disabled,onFocus:this.props.onFocus})):t().createElement("textarea",{autoFocus:this.props.autoFocus,maxLength:this.props.maxLength,name:this.props.name,defaultValue:this.props.defaultValue,value:this.props.value,placeholder:this.props.placeholder,readOnly:this.props.readOnly,disabled:this.props.disabled,onChange:this.props.onChange,onFocus:this.props.onFocus,onBlur:this.props.onBlur}))}}var Sn=o(602);i()(Sn.A,{insert:"head",singleton:!1});const Pn=Sn.A.locals||{},In=t().createElement("svg",{width:"100%",height:"100%",style:{width:"3rem",height:"3rem"},viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t().createElement("path",{d:"M22.5312 6.51941C20.3258 6.12929 18.0555 6.35518 15.9702 7.1722C13.8849 7.98923 12.0654 9.36573 10.712 11.1502C9.53042 12.7081 8.74407 14.5243 8.41412 16.4432C6.99557 16.9154 5.7486 17.8144 4.85059 19.0274C3.77621 20.4786 3.27749 22.2764 3.45068 24.0737C3.62388 25.871 4.45672 27.5405 5.78845 28.7599C7.12018 29.9792 8.85639 30.6621 10.662 30.6766H13.1063C13.7786 30.6766 14.3236 30.1316 14.3236 29.4594C14.3236 28.7871 13.7786 28.2421 13.1063 28.2421H10.6769C9.47485 28.2313 8.31921 27.7762 7.43253 26.9643C6.54471 26.1514 5.98948 25.0384 5.87402 23.8402C5.75855 22.642 6.09103 21.4435 6.80729 20.476C7.52354 19.5085 8.57279 18.8406 9.75252 18.6013C10.2753 18.4952 10.6682 18.061 10.7216 17.5303C10.9012 15.7476 11.5691 14.049 12.6518 12.6214C13.7345 11.1938 15.1901 10.0926 16.8583 9.43899C18.5266 8.78536 20.3428 8.60466 22.1071 8.91675C23.8715 9.22884 25.5155 10.0216 26.8583 11.2079C28.2011 12.3941 29.1905 13.9278 29.7178 15.6402C30.2451 17.3526 30.2898 19.1772 29.8469 20.9134C29.404 22.6495 28.4907 24.2297 27.2075 25.4802C25.9244 26.7308 24.3211 27.603 22.5742 28.001C21.9187 28.1504 21.5084 28.8028 21.6577 29.4583C21.807 30.1138 22.4595 30.5241 23.115 30.3748C25.2987 29.8772 27.3028 28.7869 28.9067 27.2238C30.5107 25.6606 31.6523 23.6853 32.2059 21.5152C32.7595 19.345 32.7037 17.0642 32.0446 14.9237C31.3855 12.7833 30.1486 10.8661 28.4701 9.38333C26.7916 7.90052 24.7366 6.90953 22.5312 6.51941Z",style:{fill:"var(--primary-main-color)"}}),t().createElement("path",{d:"M17.1146 17.6431C17.2313 17.5264 17.3658 17.4384 17.5094 17.379C17.6513 17.3201 17.8067 17.2874 17.9697 17.2866L17.9753 17.2866L17.9809 17.2866C18.2906 17.288 18.5998 17.4069 18.8361 17.6431L23.7052 22.5123C24.1806 22.9876 24.1806 23.7584 23.7052 24.2338C23.2298 24.7091 22.4591 24.7091 21.9837 24.2338L19.1926 21.4427V29.4594C19.1926 30.1317 18.6476 30.6767 17.9753 30.6767C17.303 30.6767 16.758 30.1317 16.758 29.4594V21.4427L13.9669 24.2338C13.4916 24.7091 12.7208 24.7091 12.2455 24.2338C11.7701 23.7584 11.7701 22.9876 12.2455 22.5123L17.1146 17.6431Z",style:{fill:"var(--primary-main-color)"}})),On=t().createElement("svg",{className:Pn["preview-icon"],width:"100%",height:"100%",style:{width:"3rem",height:"3rem"},viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t().createElement("path",{d:"M20.9163 3.41669H7.54829C7.22597 3.41669 6.91686 3.54472 6.68895 3.77263C6.46105 4.00054 6.33301 4.30965 6.33301 4.63196V31.3681C6.33301 31.6904 6.46105 31.9995 6.68895 32.2274C6.91686 32.4553 7.22597 32.5834 7.54829 32.5834H29.4233C29.7456 32.5834 30.0547 32.4553 30.2826 32.2274C30.5105 31.9995 30.6386 31.6904 30.6386 31.3681V13.1389H22.1316C21.8093 13.1389 21.5002 13.0109 21.2723 12.783C21.0444 12.5551 20.9163 12.2459 20.9163 11.9236V3.41669Z",style:{fill:"var(--primary-main-color)"}}),t().createElement("path",{d:"M29.9264 10.7084H23.3469V4.12884L29.9264 10.7084Z",style:{fill:"var(--primary-main-color)"}})),Vn=t().createElement("svg",{width:"100%",height:"100%",style:{width:"2.4rem",height:"2.4rem"},fill:"none",xmlns:"http://www.w3.org/2000/svg"},t().createElement("path",{d:"M13.4144 12.0002L20.4144 5.00015L19.0002 3.58594L12.0002 10.5859L5.00015 3.58594L3.58594 5.00015L10.5859 12.0002L3.58594 19.0002L5.00015 20.4144L12.0002 13.4144L19.0002 20.4144L20.4144 19.0002L13.4144 12.0002Z",style:{fill:"var(--error-main-color)"}}));class Rn extends t().Component{fileRef=(()=>(0,e.createRef)())();constructor(e){super(e),this.state={preview:this.props.value?Array.isArray(this.props.value)?this.props.value:[this.props.value]:void 0}}showFilePicker(){this.fileRef.current?.click()}componentDidUpdate(e,t){e.value===this.props.value&&e.status===this.props.status||this.setState({...this.state,status:this.props.status,preview:this.props.value?Array.isArray(this.props.value)?this.props.value:[this.props.value]:void 0})}render(){const{t:e}=this.props;let n;this.props.maxSize&&(n=(e=>{if(0==e)return"0 Bytes";var t=Math.floor(Math.log(e)/Math.log(1e3));return parseFloat((e/Math.pow(1e3,t)).toFixed(2))+" "+["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][t]})(this.props.maxSize));let i=this.state.preview?this.props.style??{}:{cursor:"pointer",...this.props.style??{}};return t().createElement("div",{id:this.props.id,className:`${Pn["import-file-container"]} ${this.props.className??"row"} ${this.props.buttonOnly?Pn["button-only"]:""} ${this.props.helperText?.length?Pn["helper-text"]:""}`,style:{"--helper-text-color":this.props.helperTextColor??"#e14337",...i},"helper-text":this.props.helperText,onClick:()=>{this.state.preview||this.props.buttonOnly||this.showFilePicker()}},t().createElement("input",{disabled:this.props.disabled,type:"file",multiple:this.props.multiple,accept:(this.props.allowType??[]).join(","),ref:this.fileRef,onChange:t=>{let i;if(t.target.files?.length&&(i=[...t.target.files],this.props.maxSize&&i.some((e=>e.size>1024*this.props.maxSize))&&(fi.errors(e("limitFileError",{name:i.find((e=>e.size>1024*this.props.maxSize))?.name,sizeTitle:n})),i=i.filter((e=>e.size<=1024*this.props.maxSize)))),i)if(this.props.multiple){const e=this.state.preview?.filter((e=>i.every((t=>e.name!==t.name&&e.size!==t.size&&e.lastModified!==t.lastModified))))??[];this.setState({...this.state,preview:[...e,...i]}),this.props.onChange&&this.props.onChange([...e,...i])}else this.setState({...this.state,preview:i}),this.props.onChange&&this.props.onChange(i)}}),this.props.buttonOnly?null:this.props.multiple&&this.state.preview?.length?t().createElement("div",{className:"row",style:{flex:1,flexWrap:"wrap",gap:"0.8rem"}},this.state.preview.map((e=>t().createElement("div",{key:`${e.name}-${e.size}-${e.lastModified}`,className:"row",style:{gap:"0.8rem",padding:"0.6rem 0.8rem",borderRadius:"0.4rem",border:"var(--neutral-main-border)",flex:"0 calc((100% * 6 / 24) - 0.8rem * 3 / 4)",width:"auto",minWidth:"11.4rem",...this.props.fileTagStyle??{}}},t().createElement(w,{src:"outline/"+(e.type?.includes("image")?"multimedia/image":"files/file-export"),size:"1.4rem"}),t().createElement(f,{className:"subtitle-4",style:{flex:1,width:"100%"},maxLine:1},e.name),t().createElement(w,{src:"fill/user interface/e-remove",size:"1.4rem",onClick:()=>{const t=this.state.preview?.filter((t=>t.name!==e.name&&t.size!==e.size&&t.lastModified!==e.lastModified));this.setState({...this.state,preview:t}),this.props.onChange&&this.props.onChange(t)},color:"#E14337"}))))):t().createElement(t().Fragment,null,t().createElement("div",{className:`${Pn["import-file-prefix"]} row`},this.state.preview?.length?this.state.preview[0].type?.includes("image")?t().createElement("img",{src:this.state.preview[0]instanceof File?URL.createObjectURL(this.state.preview[0]):this.state.preview?.[0]?.url}):On:In),t().createElement("div",{className:`${Pn["file-preview-content"]} col`},t().createElement(f,{className:`${Pn["title-file"]} heading-8`,style:{maxWidth:"100%"}},this.state.preview?.[0]?.name??this.props.label??e("uploadFileAction")),t().createElement(f,{className:`${Pn["subtitle-file"]} subtitle-3`,style:{maxWidth:"100%"}},this.state.preview?.[0]?.size?`${this.state.preview?.[0].size}KB`:this.props.subTitle??(n?e("limitFileWarning",{sizeTitle:n}):"")))),this.state.preview?.length&&this.props.buttonOnly&&!this.props.multiple?t().createElement("div",{className:"row",style:{gap:"0.4rem"}},t().createElement(f,{className:"button-text-6"},this.state.preview?.[0].name??""),t().createElement("button",{type:"button",className:`${Pn["remove-preview-file"]}`,onClick:()=>{this.setState({...this.state,preview:void 0}),this.props.onChange&&this.props.onChange(void 0)}},Vn)):t().createElement(Dt,{label:this.state.preview?.length?this.props.multiple?`${e("add")} ${e("file").toLowerCase()}`:`${e("remove")} ${e("file").toLowerCase()}`:`${e("choose")} ${e("file").toLowerCase()}`,style:{padding:"1.2rem",backgroundColor:"var(--neutral-main-background-color)"},className:"button-text-4",onClick:()=>{this.state.preview&&!this.props.multiple?(this.setState({...this.state,preview:void 0}),this.props.onChange&&this.props.onChange(void 0)):(this.props.buttonOnly||this.state.preview)&&this.showFilePicker()}}))}}const Nn=L()(Rn);function Ln(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=Ln(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}const Mn=function(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Ln(e))&&(i&&(i+=" "),i+=t);return i},Bn=e=>"number"==typeof e&&!isNaN(e),Fn=e=>"string"==typeof e,Dn=e=>"function"==typeof e,zn=e=>Fn(e)||Dn(e)?e:null,$n=t=>(0,e.isValidElement)(t)||Fn(t)||Dn(t)||Bn(t);function jn(t){let{enter:n,exit:i,appendPosition:r=!1,collapse:s=!0,collapseDuration:o=300}=t;return function(t){let{children:a,position:l,preventExitTransition:c,done:d,nodeRef:u,isIn:h,playToast:m}=t;const g=r?`${n}--${l}`:n,p=r?`${i}--${l}`:i,f=(0,e.useRef)(0);return(0,e.useLayoutEffect)((()=>{const e=u.current,t=g.split(" "),n=i=>{i.target===u.current&&(m(),e.removeEventListener("animationend",n),e.removeEventListener("animationcancel",n),0===f.current&&"animationcancel"!==i.type&&e.classList.remove(...t))};e.classList.add(...t),e.addEventListener("animationend",n),e.addEventListener("animationcancel",n)}),[]),(0,e.useEffect)((()=>{const e=u.current,t=()=>{e.removeEventListener("animationend",t),s?function(e,t,n){void 0===n&&(n=300);const{scrollHeight:i,style:r}=e;requestAnimationFrame((()=>{r.minHeight="initial",r.height=i+"px",r.transition=`all ${n}ms`,requestAnimationFrame((()=>{r.height="0",r.padding="0",r.margin="0",setTimeout(t,n)}))}))}(e,d,o):d()};h||(c?t():(f.current=1,e.className+=` ${p}`,e.addEventListener("animationend",t)))}),[h]),e.createElement(e.Fragment,null,a)}}function Hn(e,t){return null!=e?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}:{}}const Wn=new Map;let Un=[];const qn=new Set,Gn=e=>qn.forEach((t=>t(e))),Kn=()=>Wn.size>0;function Zn(e,t){var n;if(t)return!(null==(n=Wn.get(t))||!n.isToastActive(e));let i=!1;return Wn.forEach((t=>{t.isToastActive(e)&&(i=!0)})),i}function Qn(e,t){$n(e)&&(Kn()||Un.push({content:e,options:t}),Wn.forEach((n=>{n.buildToast(e,t)})))}function Yn(e,t){Wn.forEach((n=>{null!=t&&null!=t&&t.containerId?(null==t?void 0:t.containerId)===n.id&&n.toggle(e,null==t?void 0:t.id):n.toggle(e,null==t?void 0:t.id)}))}function Jn(t){let{delay:n,isRunning:i,closeToast:r,type:s="default",hide:o,className:a,style:l,controlledProgress:c,progress:d,rtl:u,isIn:h,theme:m}=t;const g=o||c&&0===d,p={...l,animationDuration:`${n}ms`,animationPlayState:i?"running":"paused"};c&&(p.transform=`scaleX(${d})`);const f=Mn("Toastify__progress-bar",c?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${m}`,`Toastify__progress-bar--${s}`,{"Toastify__progress-bar--rtl":u}),b=Dn(a)?a({rtl:u,type:s,defaultClassName:f}):Mn(f,a),w={[c&&d>=1?"onTransitionEnd":"onAnimationEnd"]:c&&d<1?null:()=>{h&&r()}};return e.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":g},e.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${m} Toastify__progress-bar--${s}`}),e.createElement("div",{role:"progressbar","aria-hidden":g?"true":"false","aria-label":"notification timer",className:b,style:p,...w}))}let Xn=1;const ei=()=>""+Xn++;function ti(e){return e&&(Fn(e.toastId)||Bn(e.toastId))?e.toastId:ei()}function ni(e,t){return Qn(e,t),t.toastId}function ii(e,t){return{...t,type:t&&t.type||e,toastId:ti(t)}}function ri(e){return(t,n)=>ni(t,ii(e,n))}function si(e,t){return ni(e,ii("default",t))}si.loading=(e,t)=>ni(e,ii("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),si.promise=function(e,t,n){let i,{pending:r,error:s,success:o}=t;r&&(i=Fn(r)?si.loading(r,n):si.loading(r.render,{...n,...r}));const a={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},l=(e,t,r)=>{if(null==t)return void si.dismiss(i);const s={type:e,...a,...n,data:r},o=Fn(t)?{render:t}:t;return i?si.update(i,{...s,...o}):si(o.render,{...s,...o}),r},c=Dn(e)?e():e;return c.then((e=>l("success",o,e))).catch((e=>l("error",s,e))),c},si.success=ri("success"),si.info=ri("info"),si.error=ri("error"),si.warning=ri("warning"),si.warn=si.warning,si.dark=(e,t)=>ni(e,ii("default",{theme:"dark",...t})),si.dismiss=function(e){!function(e){var t;if(Kn()){if(null==e||Fn(t=e)||Bn(t))Wn.forEach((t=>{t.removeToast(e)}));else if(e&&("containerId"in e||"id"in e)){const t=Wn.get(e.containerId);t?t.removeToast(e.id):Wn.forEach((t=>{t.removeToast(e.id)}))}}else Un=Un.filter((t=>null!=e&&t.options.toastId!==e))}(e)},si.clearWaitingQueue=function(e){void 0===e&&(e={}),Wn.forEach((t=>{!t.props.limit||e.containerId&&t.id!==e.containerId||t.clearQueue()}))},si.isActive=Zn,si.update=function(e,t){void 0===t&&(t={});const n=((e,t)=>{var n;let{containerId:i}=t;return null==(n=Wn.get(i||1))?void 0:n.toasts.get(e)})(e,t);if(n){const{props:i,content:r}=n,s={delay:100,...i,...t,toastId:t.toastId||e,updateId:ei()};s.toastId!==e&&(s.staleId=e);const o=s.render||r;delete s.render,ni(o,s)}},si.done=e=>{si.update(e,{progress:1})},si.onChange=function(e){return qn.add(e),()=>{qn.delete(e)}},si.play=e=>Yn(!0,e),si.pause=e=>Yn(!1,e);const oi="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,ai=t=>{let{theme:n,type:i,isLoading:r,...s}=t;return e.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"colored"===n?"currentColor":`var(--toastify-icon-color-${i})`,...s})},li={info:function(t){return e.createElement(ai,{...t},e.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(t){return e.createElement(ai,{...t},e.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(t){return e.createElement(ai,{...t},e.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(t){return e.createElement(ai,{...t},e.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return e.createElement("div",{className:"Toastify__spinner"})}},ci=t=>{const{isRunning:n,preventExitTransition:i,toastRef:r,eventHandlers:s,playToast:o}=function(t){const[n,i]=(0,e.useState)(!1),[r,s]=(0,e.useState)(!1),o=(0,e.useRef)(null),a=(0,e.useRef)({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:l,pauseOnHover:c,closeToast:d,onClick:u,closeOnClick:h}=t;var m,g;function p(){i(!0)}function f(){i(!1)}function b(e){const i=o.current;a.canDrag&&i&&(a.didMove=!0,n&&f(),a.delta="x"===t.draggableDirection?e.clientX-a.start:e.clientY-a.start,a.start!==e.clientX&&(a.canCloseOnClick=!1),i.style.transform=`translate3d(${"x"===t.draggableDirection?`${a.delta}px, var(--y)`:`0, calc(${a.delta}px + var(--y))`},0)`,i.style.opacity=""+(1-Math.abs(a.delta/a.removalDistance)))}function w(){document.removeEventListener("pointermove",b),document.removeEventListener("pointerup",w);const e=o.current;if(a.canDrag&&a.didMove&&e){if(a.canDrag=!1,Math.abs(a.delta)>a.removalDistance)return s(!0),t.closeToast(),void t.collapseAll();e.style.transition="transform 0.2s, opacity 0.2s",e.style.removeProperty("transform"),e.style.removeProperty("opacity")}}null==(g=Wn.get((m={id:t.toastId,containerId:t.containerId,fn:i}).containerId||1))||g.setToggle(m.id,m.fn),(0,e.useEffect)((()=>{if(t.pauseOnFocusLoss)return document.hasFocus()||f(),window.addEventListener("focus",p),window.addEventListener("blur",f),()=>{window.removeEventListener("focus",p),window.removeEventListener("blur",f)}}),[t.pauseOnFocusLoss]);const v={onPointerDown:function(e){if(!0===t.draggable||t.draggable===e.pointerType){a.didMove=!1,document.addEventListener("pointermove",b),document.addEventListener("pointerup",w);const n=o.current;a.canCloseOnClick=!0,a.canDrag=!0,n.style.transition="none","x"===t.draggableDirection?(a.start=e.clientX,a.removalDistance=n.offsetWidth*(t.draggablePercent/100)):(a.start=e.clientY,a.removalDistance=n.offsetHeight*(80===t.draggablePercent?1.5*t.draggablePercent:t.draggablePercent)/100)}},onPointerUp:function(e){const{top:n,bottom:i,left:r,right:s}=o.current.getBoundingClientRect();"touchend"!==e.nativeEvent.type&&t.pauseOnHover&&e.clientX>=r&&e.clientX<=s&&e.clientY>=n&&e.clientY<=i?f():p()}};return l&&c&&(v.onMouseEnter=f,t.stacked||(v.onMouseLeave=p)),h&&(v.onClick=e=>{u&&u(e),a.canCloseOnClick&&d()}),{playToast:p,pauseToast:f,isRunning:n,preventExitTransition:r,toastRef:o,eventHandlers:v}}(t),{closeButton:a,children:l,autoClose:c,onClick:d,type:u,hideProgressBar:h,closeToast:m,transition:g,position:p,className:f,style:b,bodyClassName:w,bodyStyle:v,progressClassName:y,progressStyle:_,updateId:k,role:x,progress:C,rtl:A,toastId:E,deleteToast:T,isIn:S,isLoading:P,closeOnClick:I,theme:O}=t,V=Mn("Toastify__toast",`Toastify__toast-theme--${O}`,`Toastify__toast--${u}`,{"Toastify__toast--rtl":A},{"Toastify__toast--close-on-click":I}),R=Dn(f)?f({rtl:A,position:p,type:u,defaultClassName:V}):Mn(V,f),N=function(t){let{theme:n,type:i,isLoading:r,icon:s}=t,o=null;const a={theme:n,type:i};return!1===s||(Dn(s)?o=s({...a,isLoading:r}):(0,e.isValidElement)(s)?o=(0,e.cloneElement)(s,a):r?o=li.spinner():(e=>e in li)(i)&&(o=li[i](a))),o}(t),L=!!C||!c,M={closeToast:m,type:u,theme:O};let B=null;return!1===a||(B=Dn(a)?a(M):(0,e.isValidElement)(a)?(0,e.cloneElement)(a,M):function(t){let{closeToast:n,theme:i,ariaLabel:r="close"}=t;return e.createElement("button",{className:`Toastify__close-button Toastify__close-button--${i}`,type:"button",onClick:e=>{e.stopPropagation(),n(e)},"aria-label":r},e.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},e.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}(M)),e.createElement(g,{isIn:S,done:T,position:p,preventExitTransition:i,nodeRef:r,playToast:o},e.createElement("div",{id:E,onClick:d,"data-in":S,className:R,...s,style:b,ref:r},e.createElement("div",{...S&&{role:x},className:Dn(w)?w({type:u}):Mn("Toastify__toast-body",w),style:v},null!=N&&e.createElement("div",{className:Mn("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!P})},N),e.createElement("div",null,l)),B,e.createElement(Jn,{...k&&!L?{key:`pb-${k}`}:{},rtl:A,theme:O,delay:c,isRunning:n,isIn:S,closeToast:m,hide:h,type:u,style:_,className:y,controlledProgress:L,progress:C||0})))},di=function(e,t){return void 0===t&&(t=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}},ui=jn(di("bounce",!0)),hi=jn(di("slide",!0)),mi=(jn(di("zoom")),jn(di("flip")),{position:"top-right",transition:ui,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"});function gi(t){let n={...mi,...t};const i=t.stacked,[r,s]=(0,e.useState)(!0),o=(0,e.useRef)(null),{getToastToRender:a,isToastActive:l,count:c}=function(t){const{subscribe:n,getSnapshot:i,setProps:r}=(0,e.useRef)(function(t){const n=t.containerId||1;return{subscribe(i){const r=function(t,n,i){let r=1,s=0,o=[],a=[],l=[],c=n;const d=new Map,u=new Set,h=()=>{l=Array.from(d.values()),u.forEach((e=>e()))},m=e=>{a=null==e?[]:a.filter((t=>t!==e)),h()},g=t=>{const{toastId:n,onOpen:r,updateId:s,children:o}=t.props,l=null==s;t.staleId&&d.delete(t.staleId),d.set(n,t),a=[...a,t.props.toastId].filter((e=>e!==t.staleId)),h(),i(Hn(t,l?"added":"updated")),l&&Dn(r)&&r((0,e.isValidElement)(o)&&o.props)};return{id:t,props:c,observe:e=>(u.add(e),()=>u.delete(e)),toggle:(e,t)=>{d.forEach((n=>{null!=t&&t!==n.props.toastId||Dn(n.toggle)&&n.toggle(e)}))},removeToast:m,toasts:d,clearQueue:()=>{s-=o.length,o=[]},buildToast:(n,a)=>{if((e=>{let{containerId:n,toastId:i,updateId:r}=e;const s=n?n!==t:1!==t,o=d.has(i)&&null==r;return s||o})(a))return;const{toastId:l,updateId:u,data:p,staleId:f,delay:b}=a,w=()=>{m(l)},v=null==u;v&&s++;const y={...c,style:c.toastStyle,key:r++,...Object.fromEntries(Object.entries(a).filter((e=>{let[t,n]=e;return null!=n}))),toastId:l,updateId:u,data:p,closeToast:w,isIn:!1,className:zn(a.className||c.toastClassName),bodyClassName:zn(a.bodyClassName||c.bodyClassName),progressClassName:zn(a.progressClassName||c.progressClassName),autoClose:!a.isLoading&&(_=a.autoClose,k=c.autoClose,!1===_||Bn(_)&&_>0?_:k),deleteToast(){const t=d.get(l),{onClose:n,children:r}=t.props;Dn(n)&&n((0,e.isValidElement)(r)&&r.props),i(Hn(t,"removed")),d.delete(l),s--,s<0&&(s=0),o.length>0?g(o.shift()):h()}};var _,k;y.closeButton=c.closeButton,!1===a.closeButton||$n(a.closeButton)?y.closeButton=a.closeButton:!0===a.closeButton&&(y.closeButton=!$n(c.closeButton)||c.closeButton);let x=n;(0,e.isValidElement)(n)&&!Fn(n.type)?x=(0,e.cloneElement)(n,{closeToast:w,toastProps:y,data:p}):Dn(n)&&(x=n({closeToast:w,toastProps:y,data:p}));const C={content:x,props:y,staleId:f};c.limit&&c.limit>0&&s>c.limit&&v?o.push(C):Bn(b)?setTimeout((()=>{g(C)}),b):g(C)},setProps(e){c=e},setToggle:(e,t)=>{d.get(e).toggle=t},isToastActive:e=>a.some((t=>t===e)),getSnapshot:()=>l}}(n,t,Gn);Wn.set(n,r);const s=r.observe(i);return Un.forEach((e=>Qn(e.content,e.options))),Un=[],()=>{s(),Wn.delete(n)}},setProps(e){var t;null==(t=Wn.get(n))||t.setProps(e)},getSnapshot(){var e;return null==(e=Wn.get(n))?void 0:e.getSnapshot()}}}(t)).current;r(t);const s=(0,e.useSyncExternalStore)(n,i,i);return{getToastToRender:function(e){if(!s)return[];const n=new Map;return t.newestOnTop&&s.reverse(),s.forEach((e=>{const{position:t}=e.props;n.has(t)||n.set(t,[]),n.get(t).push(e)})),Array.from(n,(t=>e(t[0],t[1])))},isToastActive:Zn,count:null==s?void 0:s.length}}(n),{className:d,style:u,rtl:h,containerId:m}=n;function g(e){const t=Mn("Toastify__toast-container",`Toastify__toast-container--${e}`,{"Toastify__toast-container--rtl":h});return Dn(d)?d({position:e,rtl:h,defaultClassName:t}):Mn(t,zn(d))}function p(){i&&(s(!0),si.play())}return oi((()=>{if(i){var e;const t=o.current.querySelectorAll('[data-in="true"]'),i=12,s=null==(e=n.position)?void 0:e.includes("top");let a=0,l=0;Array.from(t).reverse().forEach(((e,t)=>{const n=e;n.classList.add("Toastify__toast--stacked"),t>0&&(n.dataset.collapsed=`${r}`),n.dataset.pos||(n.dataset.pos=s?"top":"bot");const o=a*(r?.2:1)+(r?0:i*t);n.style.setProperty("--y",`${s?o:-1*o}px`),n.style.setProperty("--g",`${i}`),n.style.setProperty("--s",""+(1-(r?l:0))),a+=n.offsetHeight,l+=.025}))}}),[r,c,i]),e.createElement("div",{ref:o,className:"Toastify",id:m,onMouseEnter:()=>{i&&(s(!1),si.pause())},onMouseLeave:p},a(((t,n)=>{const r=n.length?{...u}:{...u,pointerEvents:"none"};return e.createElement("div",{className:g(t),style:r,key:`container-${t}`},n.map((t=>{let{content:n,props:r}=t;return e.createElement(ci,{...r,stacked:i,collapseAll:p,isIn:l(r.toastId,r.containerId),style:r.style,key:`toast-${r.key}`},n)})))})))}var pi=o(852);i()(pi.A,{insert:"head",singleton:!1}),pi.A.locals;class fi{static success(e){si.success(e,{hideProgressBar:!0,transition:hi,autoClose:800,theme:"colored"})}static errors(e){si.error(e,{theme:"colored",pauseOnHover:!1,hideProgressBar:!0,transition:hi,autoClose:800})}}var bi=o(750);i()(bi.A,{insert:"head",singleton:!1});const wi=bi.A.locals||{};class vi extends t().Component{state={loading:!1};render(){return t().createElement("div",{id:this.props.id,onScroll:async e=>{if(this.props.handleScroll){this.setState({...this.state,loading:!0});let t=e.target;await this.props.handleScroll(Math.round(t.offsetHeight+t.scrollTop)>=t.scrollHeight-1,e),this.setState({loading:!1})}},className:`${wi["infinite-scroll"]} ${this.state.loading?wi.loading:""} ${this.props.className??"col"}`,style:this.props.style??{overflow:"hidden auto"}},this.props.children)}}var yi=o(166);i()(yi.A,{insert:"head",singleton:!1});const _i=yi.A.locals||{};class ki extends t().Component{state=(()=>({value:this.props.value??0}))();componentDidUpdate(e){e.value!==this.props.value&&this.setState({value:this.props.value??0})}render(){return t().createElement("div",{id:this.props.id,className:`row ${_i["rating-container"]} ${this.props.className??""}`,style:this.props.style},Array.from({length:5}).map(((e,n)=>{let i="rating-star-grad-0",r=0;return this.state.value>=5?(i="rating-star-grad-5",r=100):this.state.value>=n&&(i=window.crypto.randomUUID().replace(/-/g,""),r=100*(this.state.value-n)),t().createElement("svg",{onClick:()=>{this.props.onChange&&(this.setState({value:n+1}),this.props.onChange(n+1))},key:"rate-"+n,width:"100%",height:"100%",style:{width:this.props.size??"2rem",height:this.props.size??"2rem"},viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t().createElement("defs",null,t().createElement("linearGradient",{id:i,x1:"0%",x2:"100%",y1:"0%",y2:"0%"},t().createElement("stop",{offset:"0%",style:{stopColor:this.props.fillColor??"var(--secondary3-main-color,#FAAD1E)"}}),t().createElement("stop",{offset:`${r}%`,style:{stopColor:this.props.fillColor??"var(--secondary3-main-color,#FAAD1E)"}}),t().createElement("stop",{offset:`${r}%`,style:{stopColor:"#00000000"}}))),t().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 1.66667C10.2884 1.66667 10.5518 1.82993 10.6794 2.0878L12.844 6.46194L17.6847 7.16325C17.97 7.20459 18.2071 7.4039 18.2962 7.67736C18.3853 7.95082 18.311 8.25101 18.1045 8.45172L14.6018 11.8563L15.4285 16.6636C15.4772 16.947 15.3604 17.2334 15.127 17.4024C14.8937 17.5714 14.5844 17.5937 14.3292 17.4599L10 15.1897L5.67081 17.4599C5.41557 17.5937 5.10627 17.5714 4.87295 17.4024C4.63964 17.2334 4.52278 16.947 4.57151 16.6636L5.39815 11.8563L1.89545 8.45172C1.68896 8.25101 1.61465 7.95082 1.70377 7.67736C1.79288 7.4039 2.02996 7.20459 2.31533 7.16325L7.15599 6.46194L9.32063 2.0878C9.44825 1.82993 9.71162 1.66667 10 1.66667ZM10 4.12915L8.33846 7.48665C8.22811 7.70963 8.01479 7.86418 7.76802 7.89993L4.05223 8.43827L6.74094 11.0517C6.91947 11.2252 7.00094 11.4752 6.95881 11.7203L6.3243 15.4102L9.64738 13.6676C9.86813 13.5519 10.1319 13.5519 10.3526 13.6676L13.6757 15.4102L13.0412 11.7203C12.9991 11.4752 13.0805 11.2252 13.2591 11.0517L15.9478 8.43827L12.232 7.89993C11.9852 7.86418 11.7719 7.70963 11.6615 7.48665L10 4.12915Z",style:{fill:this.props.strokeColor??"var(--neutral-text-placeholder-color,#878792)"}}),t().createElement("path",{d:"M17.738 7.18949L12.8212 6.47499L10.6249 2.02268C10.5611 1.91426 10.47 1.82438 10.3608 1.76194C10.2515 1.6995 10.1279 1.66666 10.0021 1.66666C9.87623 1.66666 9.75259 1.6995 9.64335 1.76194C9.53411 1.82438 9.44306 1.91426 9.37921 2.02268L7.17875 6.47499L2.26191 7.18949C2.13368 7.208 2.0132 7.26201 1.91406 7.34542C1.81493 7.42882 1.74111 7.5383 1.70095 7.66147C1.66078 7.78463 1.65588 7.91658 1.68678 8.04239C1.71769 8.1682 1.78317 8.28286 1.87583 8.3734L5.43449 11.8411L4.59499 16.7385C4.57311 16.8662 4.58739 16.9975 4.63622 17.1175C4.68505 17.2375 4.76648 17.3414 4.8713 17.4175C4.97612 17.4937 5.10016 17.539 5.22938 17.5483C5.3586 17.5577 5.48785 17.5306 5.60252 17.4704L9.99998 15.1588L14.3974 17.4704C14.5121 17.5306 14.6414 17.5577 14.7706 17.5483C14.8998 17.539 15.0238 17.4937 15.1286 17.4175C15.2335 17.3414 15.3149 17.2375 15.3637 17.1175C15.4126 16.9975 15.4268 16.8662 15.405 16.7385L14.5655 11.8411L18.1241 8.3734C18.2168 8.28295 18.2823 8.16841 18.3132 8.0427C18.3442 7.91699 18.3394 7.78512 18.2994 7.66199C18.2594 7.53886 18.1858 7.42937 18.0868 7.34587C17.9879 7.26238 17.8675 7.20822 17.7394 7.18949H17.738Z",fill:`url(#${i})`}))})))}}var xi=o(694);function Ci(e){const n=30-(e.strokeWidth??4),i=2*Math.PI*n,r=(1-(e.percent??0)/100)*i;return t().createElement("svg",{id:e.id,width:"100%",height:"100%",viewBox:"0 0 60 60",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{width:"6rem",height:"6rem",...e.style??{}}},t().createElement("path",{d:`M 30,30 m 0,-${n} a ${n},${n} 0 1 1 0,${2*n} a ${n},${n} 0 1 1 0,-${2*n}`,style:{fill:"none",stroke:e.strokeColor??"var(--neutral-main-background-color)",strokeWidth:e.strokeWidth??"4px"}}),t().createElement("path",{d:`M 30,30 m 0,-${n} a ${n},${n} 0 1 1 0,${2*n} a ${n},${n} 0 1 1 0,-${2*n}`,style:{fill:e.fillColor??"none",stroke:e.percentColor??"var(--primary-main-color)",strokeWidth:e.strokeWidth??"4px",strokeLinecap:"round",strokeDasharray:`${i}px ${i}px`,strokeDashoffset:`${r}px`}}),t().createElement("text",{x:"50%",y:"50%",dy:".3em",textAnchor:"middle",fontSize:"1.6rem",fontWeight:"600",style:{fill:"var(neutral-text-title-color)",...e.textStyle??{}}},e.percent??0,"%"))}i()(xi.A,{insert:"head",singleton:!1}),xi.A.locals;var Ai=o(533),Ei=o.n(Ai),Ti=o(378);i()(Ti.A,{insert:"head",singleton:!1}),Ti.A.locals;class Si extends t().Component{constructor(e){super(e),e.buttons??=!0,this.state={page:0},this.autoPlay=this.autoPlay.bind(this),this.nextPage=this.nextPage.bind(this),this.previousPage=this.previousPage.bind(this)}nextPage=()=>{let e=this.state?.page??0;this.props?.children&&e+1<this.props.children.length&&(this.setState({page:e+1}),this.props.onChage&&this.props.onChage(e+1))};previousPage=()=>{let e=this.state?.page??0;this.props?.children&&e>0&&(this.setState({page:e-1}),this.props.onChage&&this.props.onChage(e-1))};autoPlay=()=>{let e=this.state?.page??0;this.props?.children&&e+1===this.props.children.length&&(e=-1),this.setState({page:e+1}),this.props.onChage&&this.props.onChage(e+1)};componentDidMount(){this.props.autoPlay&&(this.intervalPlay=setInterval(this.autoPlay,this.props.duration??2e3))}componentDidUpdate(e,t){this.props.autoPlay===e.autoPlay||this.props.autoPlay||clearInterval(this.intervalPlay)}render(){return t().createElement(Ei(),{style:this.props.style,className:`custom-slider-container ${this.props.className??""}`,selected:this.state.page,bullets:!1,buttons:!!this.props.buttons&&this.props.children&&this.props.children?.length>1,organicArrows:!1,buttonContentLeft:this.props.prevButton??t().createElement(w,{src:"fill/arrows/circle-ctrl-left",size:"2.4rem",color:this.props.iconColor??"var(--neutral-absolute-background-color)"}),buttonContentRight:this.props.nextButton??t().createElement(w,{src:"fill/arrows/circle-ctrl-right",size:"2.4rem",color:this.props.iconColor??"var(--neutral-absolute-background-color)"})},this.props.children)}}var Pi=o(842);i()(Pi.A,{insert:"head",singleton:!1});const Ii=Pi.A.locals||{};class Oi extends t().Component{render(){return t().createElement("div",{id:this.props.id,"tag-type":this.props.status??"default",className:`${Ii["tag-container"]} row ${this.props.onClick?Ii["type-button"]:""} ${this.props.disabled?Ii.disabled:""} ${this.props.className??"button-text-6"} `,style:this.props.style,onClick:this.props.onClick},this.props.prefix,t().createElement(f,{maxLine:1,className:Ii["tag-label"]},this.props.title),this.props.suffix)}}var Vi=o(742);i()(Vi.A,{insert:"head",singleton:!1});const Ri=Vi.A.locals||{},Ni=n=>{let{id:i,value:r,onChange:s,disabled:o,readOnly:a,className:l,helperText:c,helperTextColor:d,max:u,min:h,style:m,type:g="icon-button",volume:p=1}=n;const[f,b]=(0,e.useState)(0),w=(0,e.useRef)(null);return(0,e.useEffect)((()=>{w.current&&(b(r??0),w.current.value=`${r??0}`)}),[r,w]),t().createElement("div",{id:i,className:`row ${Ri["number-picker-container"]} ${l??"body-2"} ${c?.length&&Ri["helper-text"]}`,"number-picker-type":g??"icon-button","helper-text":c,style:m?{"--helper-text-color":d??"#e14337",...m}:{"--helper-text-color":d??"#e14337"}},t().createElement("div",{className:"row",onClick:()=>{let e=f-p;(void 0===h||e>=h)&&(e=p%1==0?Math.round(e):parseFloat(e.toFixed(1)),b(e),w.current&&(w.current.value=`${e}`),s&&s(e))}},t().createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.3335 7.93907C1.3335 7.60435 1.60484 7.33301 1.93956 7.33301H14.0608C14.3955 7.33301 14.6668 7.60435 14.6668 7.93907C14.6668 8.27379 14.3955 8.54513 14.0608 8.54513H1.93956C1.60484 8.54513 1.3335 8.27379 1.3335 7.93907Z"}))),t().createElement("input",{ref:w,readOnly:a,disabled:o,onKeyDown:e=>{"enter"===e.key.toLowerCase()&&e.target.blur()},onFocus:e=>{e.target.select()},onBlur:e=>{let t=p%1==0?parseInt(e.target.value.trim()):parseFloat(e.target.value.trim());isNaN(t)?e.target.value=`${f}`:(t=p%1==0?Math.round(t):parseFloat(t.toFixed(1)),void 0!==h&&t<h?(b(h),w.current&&(w.current.value=`${h}`),s&&s(h)):void 0!==u&&t>u?(b(u),w.current&&(w.current.value=`${u}`),s&&s(u)):(b(t),w.current&&(w.current.value=`${t}`),s&&s(t)))}}),t().createElement("div",{className:"row",onClick:()=>{let e=f+p;(void 0===u||e<=u)&&(e=p%1==0?Math.round(e):parseFloat(e.toFixed(1)),b(e),w.current&&(w.current.value=`${e}`),s&&s(e))}},t().createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t().createElement("path",{d:"M8.60622 1.93907C8.60622 1.60435 8.33488 1.33301 8.00016 1.33301C7.66544 1.33301 7.3941 1.60435 7.3941 1.93907V7.39361H1.93956C1.60484 7.39361 1.3335 7.66496 1.3335 7.99967C1.3335 8.33439 1.60484 8.60574 1.93956 8.60574H7.3941V14.0603C7.3941 14.395 7.66544 14.6663 8.00016 14.6663C8.33488 14.6663 8.60622 14.395 8.60622 14.0603V8.60574H14.0608C14.3955 8.60574 14.6668 8.33439 14.6668 7.99967C14.6668 7.66496 14.3955 7.39361 14.0608 7.39361H8.60622V1.93907Z"}))))};var Li=o(634);i()(Li.A,{insert:"head",singleton:!1});const Mi=Li.A.locals||{};class Bi extends t().Component{containerRef=(()=>(0,e.createRef)())();constructor(e){super(e),this.getValue=this.getValue.bind(this)}getValue=()=>this.containerRef.current?[...this.containerRef.current.querySelectorAll("input")].map((e=>e.value)).join(""):this.props.value??"";componentDidUpdate(e,t,n){if(e.value!==this.props.value&&this.containerRef.current){const e=[...this.containerRef.current.querySelectorAll("input")];if(this.props.value?.length)for(let t=0;t<e.length;t++)e[t].value=this.props.value[t];else for(let t=0;t<e.length;t++)e[t].value=""}}render(){return t().createElement("div",{id:this.props.id,ref:this.containerRef,"helper-text":this.props.helperText,style:this.props.style?{"--helper-text-color":this.props.helperTextColor??"#e14337",...this.props.style}:{"--helper-text-color":this.props.helperTextColor??"#e14337"},className:`row body-1 ${Mi["input-opt-container"]} ${this.props.helperText?.length&&"helper-text"} ${this.props.className??""}`,onMouseDown:e=>{e.stopPropagation(),e.preventDefault();const t=[...e.target.closest("div").childNodes];for(const[e,n]of t.entries())if(!n.value.length||e===t.length-1){n.focus();break}}},Array.from({length:this.props.length??6}).map(((e,n)=>t().createElement("input",{key:"opt-"+n,autoFocus:0===n&&this.props.autoFocus,disabled:this.props.disabled,style:this.props.inputStyle,onKeyDown:e=>{const t=e.key.toLowerCase();switch(t){case"backspace":e.target.value.length?e.target.value="":"input"===e.target.previousSibling?.localName?e.target.previousSibling.focus():e.target.blur();break;case"delete":e.target.value="";break;default:if(e.preventDefault(),e.stopPropagation(),"v"===t&&e.ctrlKey)return navigator.clipboard.readText().then((t=>{/^\d{6}$/g.test(t)&&[...e.target.closest("div").childNodes].forEach(((e,n)=>{e.value=t[n],e.focus()}))}));/[0-9]/g.test(t)&&!t.startsWith("f")&&(e.target.value.length||(e.target.value=t),"input"!==e.target.nextSibling?.localName||e.target.nextSibling.value.length?e.target.blur():e.target.nextSibling.focus())}},onBlur:()=>{this.props.onChange&&this.props.onChange(this.getValue(),this.containerRef.current)}}))))}}var Fi=o(713);i()(Fi.A,{insert:"head",singleton:!1});const Di=Fi.A.locals||{};function zi(n){const i=bt({shouldFocusError:!1}),[r,s]=(0,e.useState)(!1),{t:o}=N(),a=e=>{n.onSubmit&&n.onSubmit(e,i)};return t().createElement("form",{id:n.id,className:`col login-view-container ${Di["login-view-container"]} ${n.className??""}`,style:n.style},"string"==typeof n.logo?t().createElement("img",{alt:"logo",src:n.logo,height:"36rem"}):n.logo,t().createElement("div",{className:`col login-view-form-container ${Di["login-view-form-container"]}`},t().createElement(f,{className:"heading-4"},n.title??`${o("loginTo")} Wini`),t().createElement("div",{className:"col"},t().createElement("div",{className:"col",style:{gap:"0.8rem",overflow:"visible"}},t().createElement(f,{className:"label-3"},n.formData.username.label??o("username")),t().createElement(Et,{autoComplete:"username",className:"placeholder-2",placeholder:n.formData.username.label,style:{height:"4.8rem"},prefix:n.formData.username.prefix,name:n.formData.username.name,register:(n.methods??i).register(n.formData.username.name,{onChange:e=>{e.target.value=e.target.value.trim()},onBlur:n.formData.username.onValidate}),onComplete:e=>{e.target.blur()},helperText:(n.methods??i).formState.errors?.[n.formData.username.name]?.message})),t().createElement("div",{className:"col",style:{gap:"0.8rem",overflow:"visible"}},t().createElement(f,{className:"label-3"},n.formData.password.label??o("password")),t().createElement(Et,{autoComplete:"current-password",className:"placeholder-2",placeholder:n.formData.password.label,style:{height:"4.8rem"},prefix:n.formData.password.prefix,suffix:t().createElement("button",{type:"button",onClick:()=>{s(!r)}},t().createElement(w,{src:"outline/user interface/"+(r?"view":"hide"),size:"1.6rem"})),name:n.formData.password.name,type:r?"text":"password",register:(n.methods??i).register(n.formData.password.name,{onChange:e=>{e.target.value=e.target.value.trim()},onBlur:n.formData.password.onValidate}),onComplete:e=>{(n.methods??i).watch(n.formData.password.name)?.length?(e.target.blur(),!n.formData.password.onValidate&&n.onSubmit&&a((n.methods??i).getValues())):e.target.blur()},helperText:(n.methods??i).formState.errors?.[n.formData.password.name]?.message})),t().createElement(f,{className:`button-text-3 ${Di["forgot-password-btn"]}`,onClick:n.onForgotPassword},n.forgotPasswordText??o("forgotPassword")),t().createElement("div",{className:"col",style:{gap:"1.6rem"}},t().createElement(Dt,{disabled:!(n.methods??i).watch(n.formData.username.name)?.length||!(n.methods??i).watch(n.formData.password.name)?.length,className:`button-text-1 ${Di["login-btn"]}`,onClick:n.onSubmit&&(n.methods??i).handleSubmit(a),label:n.buttonLoginLabel??o("login")}),t().createElement("div",{className:"row",style:{justifyContent:"center",gap:"0.4rem"}},t().createElement(f,{className:"label-4"},n.registerPrefixText??o("dontHaveAccount")),t().createElement(f,{className:`button-text-3 ${Di["register-btn"]}`,onClick:n.onRegister},n.registerText??`${o("signupFor")} Wini`))),n.loginWithGoogle||n.loginWithFacebook||n.loginWithApple||n.loginWithMicrosoft?t().createElement(t().Fragment,null,t().createElement("div",{className:`row ${Di["or-spacing"]}`},t().createElement("div",null),t().createElement(f,{className:"label-4"},n.orText??o("or")),t().createElement("div",null)),t().createElement("div",{className:`row ${Di["login-social-media"]}`},n.loginWithGoogle&&t().createElement(Dt,{className:"label-1",onClick:n.loginWithGoogle,prefix:t().createElement(w,{src:"color/social media/google",size:"2rem"}),label:"Google"}),n.loginWithFacebook&&t().createElement(Dt,{className:"label-1",onClick:n.loginWithFacebook,prefix:t().createElement(w,{src:"color/social media/logo-facebook",size:"2rem"}),label:"Facebook"}),n.loginWithApple&&t().createElement(Dt,{className:"label-1",onClick:n.loginWithApple,prefix:t().createElement(w,{src:"color/development/apple",size:"2rem"}),label:"Apple"}),n.loginWithMicrosoft&&t().createElement(Dt,{className:"label-1",onClick:n.loginWithMicrosoft,prefix:t().createElement(w,{src:"color/development/microsoft",size:"2rem"}),label:"Microsoft"}))):null)))}const $i=new Array(256).fill("").map(((e,t)=>("0"+t.toString(16)).slice(-2)));function ji(e){return!!e&&/^\d+\.\d+\.\d+/.test(e)}function Hi(e){return!!e&&["nightly","alpha","internal","nightly-","staging"].some((t=>e.includes(t)))}function Wi(e){if(Hi(e))return 3;const{major:t}=function(e){if(!ji(e))throw new Error(`Invalid semantic version: ${e||"<blank>"}.`);const[t,n,i]=e.split(".");return{major:Number.parseInt(t,10),minor:Number.parseInt(n,10),patch:Number.parseInt(i,10)}}(e);switch(!0){case t>=44:return 3;case t>=38:return 2;default:return 1}}function Ui(e,t){switch(t||=function(){const e=function(){const{CKEDITOR_VERSION:e,CKEDITOR:t}=window;return ji(n=e)||Hi(n)?{source:t?"cdn":"npm",version:e}:null;var n}();return e?Wi(e.version):null}()||void 0,t){case 1:case 2:return void 0===e;case 3:return"GPL"===e;default:return!1}}var qi=Object.defineProperty,Gi=(e,t,n)=>((e,t,n)=>t in e?qi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);const Ki=class e{constructor(e,t){Gi(this,"_lifecycle"),Gi(this,"_element"),Gi(this,"_releaseLock",null),Gi(this,"_value",null),Gi(this,"_afterMountCallbacks",[]),Gi(this,"_state",{destroyedBeforeInitialization:!1,mountingInProgress:null}),Gi(this,"release",function(e){let t=null;return(...n)=>(t||(t={current:e(...n)}),t.current)}((()=>{const{_releaseLock:e,_state:t,_element:n,_lifecycle:i}=this;t.mountingInProgress?t.mountingInProgress.then((()=>i.unmount({element:n,mountResult:this.value}))).catch((e=>{console.error("Semaphore unmounting error:",e)})).then(e.resolve).then((()=>{this._value=null})):(t.destroyedBeforeInitialization=!0,e.resolve())}))),this._element=e,this._lifecycle=t,this._lock()}get value(){return this._value}unsafeSetValue(e){this._value=e,this._afterMountCallbacks.forEach((t=>t(e))),this._afterMountCallbacks=[]}runAfterMount(e){const{_value:t,_afterMountCallbacks:n}=this;t?e(t):n.push(e)}_lock(){const{_semaphores:t}=e,{_state:n,_element:i,_lifecycle:r}=this,s=t.get(i)||Promise.resolve(null),o=function(){const e={resolve:null,promise:null};return e.promise=new Promise((t=>{e.resolve=t})),e}();this._releaseLock=o;const a=s.then((()=>n.destroyedBeforeInitialization?Promise.resolve(void 0):(n.mountingInProgress=r.mount().then((e=>(e&&this.unsafeSetValue(e),e))),n.mountingInProgress))).then((async e=>{e&&r.afterMount&&await r.afterMount({element:i,mountResult:e})})).then((()=>o.promise)).catch((e=>{console.error("Semaphore mounting error:",e)})).then((()=>{t.get(i)===a&&t.delete(i)}));t.set(i,a)}};Gi(Ki,"_semaphores",new Map);let Zi=Ki;const Qi="$__CKEditorReactContextMetadata",Yi=e.createContext(null),Ji=e=>t=>(e=>!!e&&"object"==typeof e&&"status"in e&&["initializing","initialized","error"].includes(e.status))(t)&&t.status===e,Xi=Ji("initializing"),er=(tr={version:"9.5.0",frameworkVersion:e.version},function(e){Ui(e.config.get("licenseKey"))||e.on("collectUsageData",((e,{setUsageData:t})=>{t("integration.react",tr)}))});var tr;const nr="Lock from React integration (@ckeditor/ckeditor5-react)";class ir extends e.Component{constructor(t){super(t),Gi(this,"domContainer",e.createRef()),Gi(this,"editorSemaphore",null),this._checkVersion()}_checkVersion(){const{CKEDITOR_VERSION:e}=window;if(!e)return console.warn('Cannot find the "CKEDITOR_VERSION" in the "window" scope.');const[t]=e.split(".").map(Number);t>=42||e.startsWith("0.0.0")||console.warn("The <CKEditor> component requires using CKEditor 5 in version 42+ or nightly build.")}get _semaphoreValue(){const{editorSemaphore:e}=this;return e?e.value:null}get watchdog(){const{_semaphoreValue:e}=this;return e?e.watchdog:null}get editor(){const{_semaphoreValue:e}=this;return e?e.instance:null}shouldComponentUpdate(e){const{props:t,editorSemaphore:n}=this;return e.id!==t.id||e.disableWatchdog!==t.disableWatchdog||(n&&(n.runAfterMount((({instance:n})=>{this._shouldUpdateEditorData(t,e,n)&&n.data.set(e.data)})),"disabled"in e&&n.runAfterMount((({instance:t})=>{e.disabled?t.enableReadOnlyMode(nr):t.disableReadOnlyMode(nr)}))),!1)}componentDidMount(){Xi(this.context)||this._initLifeCycleSemaphore()}componentDidUpdate(){Xi(this.context)||this._initLifeCycleSemaphore()}componentWillUnmount(){this._unlockLifeCycleSemaphore()}_unlockLifeCycleSemaphore(){this.editorSemaphore&&(this.editorSemaphore.release(),this.editorSemaphore=null)}_initLifeCycleSemaphore(){this._unlockLifeCycleSemaphore(),this.editorSemaphore=new Zi(this.domContainer.current,{mount:async()=>this._initializeEditor(),afterMount:({mountResult:e})=>{const{onReady:t}=this.props;t&&null!==this.domContainer.current&&t(e.instance)},unmount:async({element:e,mountResult:t})=>{const{onAfterDestroy:n}=this.props;try{await this._destroyEditor(t),e.innerHTML=""}finally{n&&n(t.instance)}}})}render(){return e.createElement("div",{ref:this.domContainer})}async _initializeEditor(){if(this.props.disableWatchdog)return{instance:await this._createEditor(this.domContainer.current,this._getConfig()),watchdog:null};const e=(()=>{return e=this.context,Ji("initialized")(e)&&"ready"===e.watchdog.state?new rr(this.context.watchdog):new this.props.editor.EditorWatchdog(this.props.editor,this.props.watchdogConfig);var e})(),t={current:0};return e.setCreator((async(n,i)=>{var r;const{editorSemaphore:s}=this,{onAfterDestroy:o}=this.props;t.current>0&&o&&(null==(r=null==s?void 0:s.value)?void 0:r.instance)&&o(s.value.instance);const a=await this._createEditor(n,i);return s&&t.current>0&&(s.unsafeSetValue({instance:a,watchdog:e}),setTimeout((()=>{this.props.onReady&&this.props.onReady(e.editor)}))),t.current++,a})),e.on("error",((e,{error:t,causesRestart:n})=>{(this.props.onError||console.error)(t,{phase:"runtime",willEditorRestart:n})})),await e.create(this.domContainer.current,this._getConfig()).catch((e=>{(this.props.onError||console.error)(e,{phase:"initialization",willEditorRestart:!1})})),{watchdog:e,instance:e.editor}}_createEditor(e,t){const{contextItemMetadata:n}=this.props;return n&&(t=function(e,t){return{...t,[Qi]:e}}(n,t)),this.props.editor.create(e,(i=t,Ui(i.licenseKey)?i:function(e,t){const n=e.extraPlugins||[];return{...e,extraPlugins:[...n,...t.filter((e=>!n.includes(e)))]}}(i,[er]))).then((e=>{"disabled"in this.props&&this.props.disabled&&e.enableReadOnlyMode(nr);const t=e.model.document,n=e.editing.view.document;return t.on("change:data",(t=>{this.props.onChange&&this.props.onChange(t,e)})),n.on("focus",(t=>{this.props.onFocus&&this.props.onFocus(t,e)})),n.on("blur",(t=>{this.props.onBlur&&this.props.onBlur(t,e)})),e}));var i}async _destroyEditor(e){const{watchdog:t,instance:n}=e;return new Promise(((e,i)=>{setTimeout((async()=>{try{if(t)return await t.destroy(),e();if(n)return await n.destroy(),e();e()}catch(e){console.error(e),i(e)}}))}))}_shouldUpdateEditorData(e,t,n){return e.data!==t.data&&n.data.get()!==t.data}_getConfig(){const e=this.props.config||{};return this.props.data&&e.initialData&&console.warn("Editor data should be provided either using `config.initialData` or `content` property. The config value takes precedence over `content` property and will be used when both are specified."),{...e,initialData:e.initialData||this.props.data||""}}}Gi(ir,"contextType",Yi);class rr{constructor(e){Gi(this,"_contextWatchdog"),Gi(this,"_id"),Gi(this,"_creator"),this._contextWatchdog=e,this._id=function(){const[e,t,n,i]=crypto.getRandomValues(new Uint32Array(4));return"e"+$i[255&e]+$i[e>>8&255]+$i[e>>16&255]+$i[e>>24&255]+$i[255&t]+$i[t>>8&255]+$i[t>>16&255]+$i[t>>24&255]+$i[255&n]+$i[n>>8&255]+$i[n>>16&255]+$i[n>>24&255]+$i[255&i]+$i[i>>8&255]+$i[i>>16&255]+$i[i>>24&255]}()}setCreator(e){this._creator=e}create(e,t){return this._contextWatchdog.add({sourceElementOrData:e,config:t,creator:this._creator,id:this._id,type:"editor"})}on(e,t){this._contextWatchdog.on("itemError",((e,{itemId:n,error:i})=>{n===this._id&&t(null,{error:i,causesRestart:void 0})}))}destroy(){return"ready"===this._contextWatchdog.state?this._contextWatchdog.remove(this._id):Promise.resolve()}get editor(){return this._contextWatchdog.getItem(this._id)}}function sr(...e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}(0,e.memo)((0,e.forwardRef)((({id:t,semaphore:n,rootName:i},r)=>{const s=(0,e.useRef)(null);return(0,e.useEffect)((()=>{let e,t;return n.runAfterMount((({instance:n})=>{if(!s.current)return;t=n;const{ui:r,model:o}=t,a=o.document.getRoot(i);a&&t.ui.getEditableElement(i)&&t.detachEditable(a),e=r.view.createEditable(i,s.current),r.addEditable(e),n.editing.view.forceRender()})),()=>{if(t&&"destroyed"!==t.state&&s.current){const e=t.model.document.getRoot(i);e&&t.detachEditable(e)}}}),[n.revision]),e.createElement("div",{key:n.revision,id:t,ref:sr(r,s)})}))).displayName="EditorEditable";(0,e.forwardRef)((({editor:t},n)=>{const i=(0,e.useRef)(null);return(0,e.useEffect)((()=>{const e=i.current;if(!t||!e)return;const n=t.ui.view.toolbar.element;return e.appendChild(n),()=>{e.contains(n)&&e.removeChild(n)}}),[t&&t.id]),e.createElement("div",{ref:sr(i,n)})})).displayName="EditorToolbarWrapper";const or=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},ar="object"==typeof global&&global&&global.Object===Object&&global;var lr="object"==typeof self&&self&&self.Object===Object&&self;const cr=ar||lr||Function("return this")(),dr=cr.Symbol;var ur=Object.prototype,hr=ur.hasOwnProperty,mr=ur.toString,gr=dr?dr.toStringTag:void 0;var pr=Object.prototype.toString;var fr=dr?dr.toStringTag:void 0;const br=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":fr&&fr in Object(e)?function(e){var t=hr.call(e,gr),n=e[gr];try{e[gr]=void 0;var i=!0}catch(e){}var r=mr.call(e);return i&&(t?e[gr]=n:delete e[gr]),r}(e):function(e){return pr.call(e)}(e)},wr=Array.isArray,vr=function(e){return null!=e&&"object"==typeof e},yr=function(e){return"string"==typeof e||!wr(e)&&vr(e)&&"[object String]"==br(e)},_r=function(e,t){return function(n){return e(t(n))}},kr=_r(Object.getPrototypeOf,Object);var xr=Function.prototype,Cr=Object.prototype,Ar=xr.toString,Er=Cr.hasOwnProperty,Tr=Ar.call(Object);const Sr=function(e){if(!vr(e)||"[object Object]"!=br(e))return!1;var t=kr(e);if(null===t)return!0;var n=Er.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ar.call(n)==Tr},Pr=function(e,t){return e===t||e!=e&&t!=t},Ir=function(e,t){for(var n=e.length;n--;)if(Pr(e[n][0],t))return n;return-1};var Or=Array.prototype.splice;function Vr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Vr.prototype.clear=function(){this.__data__=[],this.size=0},Vr.prototype.delete=function(e){var t=this.__data__,n=Ir(t,e);return!(n<0||(n==t.length-1?t.pop():Or.call(t,n,1),--this.size,0))},Vr.prototype.get=function(e){var t=this.__data__,n=Ir(t,e);return n<0?void 0:t[n][1]},Vr.prototype.has=function(e){return Ir(this.__data__,e)>-1},Vr.prototype.set=function(e,t){var n=this.__data__,i=Ir(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};const Rr=Vr,Nr=function(e){if(!or(e))return!1;var t=br(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Lr=cr["__core-js_shared__"];var Mr,Br=(Mr=/[^.]+$/.exec(Lr&&Lr.keys&&Lr.keys.IE_PROTO||""))?"Symbol(src)_1."+Mr:"";var Fr=Function.prototype.toString;const Dr=function(e){if(null!=e){try{return Fr.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var zr=/^\[object .+?Constructor\]$/,$r=Function.prototype,jr=Object.prototype,Hr=$r.toString,Wr=jr.hasOwnProperty,Ur=RegExp("^"+Hr.call(Wr).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const qr=function(e){return!(!or(e)||(t=e,Br&&Br in t))&&(Nr(e)?Ur:zr).test(Dr(e));var t},Gr=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return qr(n)?n:void 0},Kr=Gr(cr,"Map"),Zr=Gr(Object,"create");var Qr=Object.prototype.hasOwnProperty;var Yr=Object.prototype.hasOwnProperty;function Jr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Jr.prototype.clear=function(){this.__data__=Zr?Zr(null):{},this.size=0},Jr.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Jr.prototype.get=function(e){var t=this.__data__;if(Zr){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Qr.call(t,e)?t[e]:void 0},Jr.prototype.has=function(e){var t=this.__data__;return Zr?void 0!==t[e]:Yr.call(t,e)},Jr.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Zr&&void 0===t?"__lodash_hash_undefined__":t,this};const Xr=Jr,es=function(e,t){var n,i,r=e.__data__;return("string"==(i=typeof(n=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==n:null===n)?r["string"==typeof t?"string":"hash"]:r.map};function ts(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}ts.prototype.clear=function(){this.size=0,this.__data__={hash:new Xr,map:new(Kr||Rr),string:new Xr}},ts.prototype.delete=function(e){var t=es(this,e).delete(e);return this.size-=t?1:0,t},ts.prototype.get=function(e){return es(this,e).get(e)},ts.prototype.has=function(e){return es(this,e).has(e)},ts.prototype.set=function(e,t){var n=es(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};const ns=ts;function is(e){var t=this.__data__=new Rr(e);this.size=t.size}is.prototype.clear=function(){this.__data__=new Rr,this.size=0},is.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},is.prototype.get=function(e){return this.__data__.get(e)},is.prototype.has=function(e){return this.__data__.has(e)},is.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Rr){var i=n.__data__;if(!Kr||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new ns(i)}return n.set(e,t),this.size=n.size,this};const rs=is,ss=function(){try{var e=Gr(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),os=function(e,t,n){"__proto__"==t&&ss?ss(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n};var as=Object.prototype.hasOwnProperty;const ls=function(e,t,n){var i=e[t];as.call(e,t)&&Pr(i,n)&&(void 0!==n||t in e)||os(e,t,n)},cs=function(e,t,n,i){var r=!n;n||(n={});for(var s=-1,o=t.length;++s<o;){var a=t[s],l=i?i(n[a],e[a],a,n,e):void 0;void 0===l&&(l=e[a]),r?os(n,a,l):ls(n,a,l)}return n},ds=function(e){return vr(e)&&"[object Arguments]"==br(e)};var us=Object.prototype,hs=us.hasOwnProperty,ms=us.propertyIsEnumerable;const gs=ds(function(){return arguments}())?ds:function(e){return vr(e)&&hs.call(e,"callee")&&!ms.call(e,"callee")};var ps="object"==typeof exports&&exports&&!exports.nodeType&&exports,fs=ps&&"object"==typeof module&&module&&!module.nodeType&&module,bs=fs&&fs.exports===ps?cr.Buffer:void 0;const ws=(bs?bs.isBuffer:void 0)||function(){return!1};var vs=/^(?:0|[1-9]\d*)$/;const ys=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&vs.test(e))&&e>-1&&e%1==0&&e<t},_s=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var ks={};ks["[object Float32Array]"]=ks["[object Float64Array]"]=ks["[object Int8Array]"]=ks["[object Int16Array]"]=ks["[object Int32Array]"]=ks["[object Uint8Array]"]=ks["[object Uint8ClampedArray]"]=ks["[object Uint16Array]"]=ks["[object Uint32Array]"]=!0,ks["[object Arguments]"]=ks["[object Array]"]=ks["[object ArrayBuffer]"]=ks["[object Boolean]"]=ks["[object DataView]"]=ks["[object Date]"]=ks["[object Error]"]=ks["[object Function]"]=ks["[object Map]"]=ks["[object Number]"]=ks["[object Object]"]=ks["[object RegExp]"]=ks["[object Set]"]=ks["[object String]"]=ks["[object WeakMap]"]=!1;const xs=function(e){return function(t){return e(t)}};var Cs="object"==typeof exports&&exports&&!exports.nodeType&&exports,As=Cs&&"object"==typeof module&&module&&!module.nodeType&&module,Es=As&&As.exports===Cs&&ar.process;const Ts=function(){try{return As&&As.require&&As.require("util").types||Es&&Es.binding&&Es.binding("util")}catch(e){}}();var Ss=Ts&&Ts.isTypedArray;const Ps=Ss?xs(Ss):function(e){return vr(e)&&_s(e.length)&&!!ks[br(e)]};var Is=Object.prototype.hasOwnProperty;const Os=function(e,t){var n=wr(e),i=!n&&gs(e),r=!n&&!i&&ws(e),s=!n&&!i&&!r&&Ps(e),o=n||i||r||s,a=o?function(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}(e.length,String):[],l=a.length;for(var c in e)!t&&!Is.call(e,c)||o&&("length"==c||r&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ys(c,l))||a.push(c);return a};var Vs=Object.prototype;const Rs=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Vs)},Ns=_r(Object.keys,Object);var Ls=Object.prototype.hasOwnProperty;const Ms=function(e){return null!=e&&_s(e.length)&&!Nr(e)},Bs=function(e){return Ms(e)?Os(e):function(e){if(!Rs(e))return Ns(e);var t=[];for(var n in Object(e))Ls.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)};var Fs=Object.prototype.hasOwnProperty;const Ds=function(e){if(!or(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Rs(e),n=[];for(var i in e)("constructor"!=i||!t&&Fs.call(e,i))&&n.push(i);return n},zs=function(e){return Ms(e)?Os(e,!0):Ds(e)};var $s="object"==typeof exports&&exports&&!exports.nodeType&&exports,js=$s&&"object"==typeof module&&module&&!module.nodeType&&module,Hs=js&&js.exports===$s?cr.Buffer:void 0,Ws=Hs?Hs.allocUnsafe:void 0;const Us=function(e,t){if(t)return e.slice();var n=e.length,i=Ws?Ws(n):new e.constructor(n);return e.copy(i),i},qs=function(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n<i;)t[n]=e[n];return t},Gs=function(){return[]};var Ks=Object.prototype.propertyIsEnumerable,Zs=Object.getOwnPropertySymbols;const Qs=Zs?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,i=null==e?0:e.length,r=0,s=[];++n<i;){var o=e[n];t(o,n,e)&&(s[r++]=o)}return s}(Zs(e),(function(t){return Ks.call(e,t)})))}:Gs,Ys=function(e,t){for(var n=-1,i=t.length,r=e.length;++n<i;)e[r+n]=t[n];return e},Js=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Ys(t,Qs(e)),e=kr(e);return t}:Gs,Xs=function(e,t,n){var i=t(e);return wr(e)?i:Ys(i,n(e))},eo=function(e){return Xs(e,Bs,Qs)},to=function(e){return Xs(e,zs,Js)},no=Gr(cr,"DataView"),io=Gr(cr,"Promise"),ro=Gr(cr,"Set"),so=Gr(cr,"WeakMap");var oo="[object Map]",ao="[object Promise]",lo="[object Set]",co="[object WeakMap]",uo="[object DataView]",ho=Dr(no),mo=Dr(Kr),go=Dr(io),po=Dr(ro),fo=Dr(so),bo=br;(no&&bo(new no(new ArrayBuffer(1)))!=uo||Kr&&bo(new Kr)!=oo||io&&bo(io.resolve())!=ao||ro&&bo(new ro)!=lo||so&&bo(new so)!=co)&&(bo=function(e){var t=br(e),n="[object Object]"==t?e.constructor:void 0,i=n?Dr(n):"";if(i)switch(i){case ho:return uo;case mo:return oo;case go:return ao;case po:return lo;case fo:return co}return t});const wo=bo;var vo=Object.prototype.hasOwnProperty;const yo=cr.Uint8Array,_o=function(e){var t=new e.constructor(e.byteLength);return new yo(t).set(new yo(e)),t};var ko=/\w*$/;var xo=dr?dr.prototype:void 0,Co=xo?xo.valueOf:void 0;const Ao=function(e,t){var n=t?_o(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)},Eo=function(e,t,n){var i,r,s,o=e.constructor;switch(t){case"[object ArrayBuffer]":return _o(e);case"[object Boolean]":case"[object Date]":return new o(+e);case"[object DataView]":return function(e,t){var n=t?_o(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(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 Ao(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(s=new(r=e).constructor(r.source,ko.exec(r))).lastIndex=r.lastIndex,s;case"[object Symbol]":return i=e,Co?Object(Co.call(i)):{}}};var To=Object.create;const So=function(){function e(){}return function(t){if(!or(t))return{};if(To)return To(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),Po=function(e){return"function"!=typeof e.constructor||Rs(e)?{}:So(kr(e))};var Io=Ts&&Ts.isMap;const Oo=Io?xs(Io):function(e){return vr(e)&&"[object Map]"==wo(e)};var Vo=Ts&&Ts.isSet;const Ro=Vo?xs(Vo):function(e){return vr(e)&&"[object Set]"==wo(e)};var No="[object Arguments]",Lo="[object Function]",Mo="[object Object]",Bo={};Bo[No]=Bo["[object Array]"]=Bo["[object ArrayBuffer]"]=Bo["[object DataView]"]=Bo["[object Boolean]"]=Bo["[object Date]"]=Bo["[object Float32Array]"]=Bo["[object Float64Array]"]=Bo["[object Int8Array]"]=Bo["[object Int16Array]"]=Bo["[object Int32Array]"]=Bo["[object Map]"]=Bo["[object Number]"]=Bo[Mo]=Bo["[object RegExp]"]=Bo["[object Set]"]=Bo["[object String]"]=Bo["[object Symbol]"]=Bo["[object Uint8Array]"]=Bo["[object Uint8ClampedArray]"]=Bo["[object Uint16Array]"]=Bo["[object Uint32Array]"]=!0,Bo["[object Error]"]=Bo[Lo]=Bo["[object WeakMap]"]=!1;const Fo=function e(t,n,i,r,s,o){var a,l=1&n,c=2&n,d=4&n;if(i&&(a=s?i(t,r,s,o):i(t)),void 0!==a)return a;if(!or(t))return t;var u=wr(t);if(u){if(a=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&vo.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(t),!l)return qs(t,a)}else{var h=wo(t),m=h==Lo||"[object GeneratorFunction]"==h;if(ws(t))return Us(t,l);if(h==Mo||h==No||m&&!s){if(a=c||m?{}:Po(t),!l)return c?function(e,t){return cs(e,Js(e),t)}(t,function(e,t){return e&&cs(t,zs(t),e)}(a,t)):function(e,t){return cs(e,Qs(e),t)}(t,function(e,t){return e&&cs(t,Bs(t),e)}(a,t))}else{if(!Bo[h])return s?t:{};a=Eo(t,h,l)}}o||(o=new rs);var g=o.get(t);if(g)return g;o.set(t,a),Ro(t)?t.forEach((function(r){a.add(e(r,n,i,r,t,o))})):Oo(t)&&t.forEach((function(r,s){a.set(s,e(r,n,i,s,t,o))}));var p=u?void 0:(d?c?to:eo:c?zs:Bs)(t);return function(e,t){for(var n=-1,i=null==e?0:e.length;++n<i&&!1!==t(e[n],n,e););}(p||t,(function(r,s){p&&(r=t[s=r]),ls(a,s,e(r,n,i,s,t,o))})),a},Do=function(e,t){return Fo(e,5,t="function"==typeof t?t:void 0)},zo=function(e){return vr(e)&&1===e.nodeType&&!Sr(e)},$o=function(e,t,n){(void 0!==n&&!Pr(e[t],n)||void 0===n&&!(t in e))&&os(e,t,n)},jo=function(e,t,n){for(var i=-1,r=Object(e),s=n(e),o=s.length;o--;){var a=s[++i];if(!1===t(r[a],a,r))break}return e},Ho=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]},Wo=function(e,t,n,i,r,s,o){var a,l=Ho(e,n),c=Ho(t,n),d=o.get(c);if(d)$o(e,n,d);else{var u=s?s(l,c,n+"",e,t,o):void 0,h=void 0===u;if(h){var m=wr(c),g=!m&&ws(c),p=!m&&!g&&Ps(c);u=c,m||g||p?wr(l)?u=l:vr(a=l)&&Ms(a)?u=qs(l):g?(h=!1,u=Us(c,!0)):p?(h=!1,u=Ao(c,!0)):u=[]:Sr(c)||gs(c)?(u=l,gs(l)?u=function(e){return cs(e,zs(e))}(l):or(l)&&!Nr(l)||(u=Po(c))):h=!1}h&&(o.set(c,u),r(u,c,i,s,o),o.delete(c)),$o(e,n,u)}},Uo=function e(t,n,i,r,s){t!==n&&jo(n,(function(o,a){if(s||(s=new rs),or(o))Wo(t,n,a,i,e,r,s);else{var l=r?r(Ho(t,a),o,a+"",t,n,s):void 0;void 0===l&&(l=o),$o(t,a,l)}}),zs)},qo=function(e){return e};var Go=Math.max;const Ko=ss?function(e,t){return ss(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:qo;var Zo=Date.now;const Qo=(Yo=Ko,Jo=0,Xo=0,function(){var e=Zo(),t=16-(e-Xo);if(Xo=e,t>0){if(++Jo>=800)return arguments[0]}else Jo=0;return Yo.apply(void 0,arguments)});var Yo,Jo,Xo;const ea=function(e,t){return Qo(function(e,t,n){return t=Go(void 0===t?e.length-1:t,0),function(){for(var i=arguments,r=-1,s=Go(i.length-t,0),o=Array(s);++r<s;)o[r]=i[t+r];r=-1;for(var a=Array(t+1);++r<t;)a[r]=i[r];return a[t]=n(o),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,a)}}(e,t,qo),e+"")},ta=function(e){return ea((function(t,n){var i=-1,r=n.length,s=r>1?n[r-1]:void 0,o=r>2?n[2]:void 0;for(s=e.length>3&&"function"==typeof s?(r--,s):void 0,o&&function(e,t,n){if(!or(n))return!1;var i=typeof t;return!!("number"==i?Ms(n)&&ys(t,n.length):"string"==i&&t in n)&&Pr(n[t],e)}(n[0],n[1],o)&&(s=r<3?void 0:s,r=1),t=Object(t);++i<r;){var a=n[i];a&&e(t,a,i,s)}return t}))},na=ta((function(e,t,n){Uo(e,t,n)}));let ia;try{ia={window,document}}catch(e){ia={window:{},document:{}}}var ra=ia;function sa(){try{return navigator.userAgent.toLowerCase()}catch(e){return""}}const oa=sa(),aa={isMac:la(oa),isWindows:ca(oa),isGecko:da(oa),isSafari:ua(oa),isiOS:ha(oa),isAndroid:ma(oa),isBlink:ga(oa),get isMediaForcedColors(){return!!ra.window.matchMedia&&ra.window.matchMedia("(forced-colors: active)").matches},get isMotionReduced(){return!!ra.window.matchMedia&&ra.window.matchMedia("(prefers-reduced-motion)").matches},features:{isRegExpUnicodePropertySupported:pa()}};function la(e){return e.indexOf("macintosh")>-1}function ca(e){return e.indexOf("windows")>-1}function da(e){return!!e.match(/gecko\/\d+/)}function ua(e){return e.indexOf(" applewebkit/")>-1&&-1===e.indexOf("chrome")}function ha(e){return!!e.match(/iphone|ipad/i)||la(e)&&navigator.maxTouchPoints>0}function ma(e){return e.indexOf("android")>-1}function ga(e){return e.indexOf("chrome/")>-1&&e.indexOf("edge/")<0}function pa(){let e=!1;try{e=0==="ć".search(new RegExp("[\\p{L}]","u"))}catch(e){}return e}function fa(e,t,n,i){n=n||function(e,t){return e===t};const r=Array.isArray(e)?e:Array.prototype.slice.call(e),s=Array.isArray(t)?t:Array.prototype.slice.call(t),o=function(e,t,n){const i=ba(e,t,n);if(-1===i)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const r=ba(wa(e,i),wa(t,i),n);return{firstIndex:i,lastIndexOld:e.length-r,lastIndexNew:t.length-r}}(r,s,n),a=i?function(e,t){const{firstIndex:n,lastIndexOld:i,lastIndexNew:r}=e;if(-1===n)return Array(t).fill("equal");let s=[];return n>0&&(s=s.concat(Array(n).fill("equal"))),r-n>0&&(s=s.concat(Array(r-n).fill("insert"))),i-n>0&&(s=s.concat(Array(i-n).fill("delete"))),r<t&&(s=s.concat(Array(t-r).fill("equal"))),s}(o,s.length):function(e,t){const n=[],{firstIndex:i,lastIndexOld:r,lastIndexNew:s}=t;return s-i>0&&n.push({index:i,type:"insert",values:e.slice(i,s)}),r-i>0&&n.push({index:i+(s-i),type:"delete",howMany:r-i}),n}(s,o);return a}function ba(e,t,n){for(let i=0;i<Math.max(e.length,t.length);i++)if(void 0===e[i]||void 0===t[i]||!n(e[i],t[i]))return i;return-1}function wa(e,t){return e.slice(t).reverse()}function va(e,t,n){n=n||function(e,t){return e===t};const i=e.length,r=t.length;if(i>200||r>200||i+r>300)return va.fastDiff(e,t,n,!0);let s,o;if(r<i){const n=e;e=t,t=n,s="delete",o="insert"}else s="insert",o="delete";const a=e.length,l=t.length,c=l-a,d={},u={};function h(i){const r=(void 0!==u[i-1]?u[i-1]:-1)+1,c=void 0!==u[i+1]?u[i+1]:-1,h=r>c?-1:1;d[i+h]&&(d[i]=d[i+h].slice(0)),d[i]||(d[i]=[]),d[i].push(r>c?s:o);let m=Math.max(r,c),g=m-i;for(;g<a&&m<l&&n(e[g],t[m]);)g++,m++,d[i].push("equal");return m}let m,g=0;do{for(m=-g;m<c;m++)u[m]=h(m);for(m=c+g;m>c;m--)u[m]=h(m);u[c]=h(c),g++}while(u[c]!==l);return d[c].slice(1)}va.fastDiff=fa;class ya{source;name;path;stop;off;return;constructor(e,t){this.source=e,this.name=t,this.path=[],this.stop=function e(){e.called=!0},this.off=function e(){e.called=!0}}}const _a=new Array(256).fill("").map(((e,t)=>("0"+t.toString(16)).slice(-2)));function ka(){const[e,t,n,i]=crypto.getRandomValues(new Uint32Array(4));return"e"+_a[255&e]+_a[e>>8&255]+_a[e>>16&255]+_a[e>>24&255]+_a[255&t]+_a[t>>8&255]+_a[t>>16&255]+_a[t>>24&255]+_a[255&n]+_a[n>>8&255]+_a[n>>16&255]+_a[n>>24&255]+_a[255&i]+_a[i>>8&255]+_a[i>>16&255]+_a[i>>24&255]}const xa={get(e="normal"){return"number"!=typeof e?this[e]||this.normal:e},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5};function Ca(e,t){const n=xa.get(t.priority);let i=0,r=e.length;for(;i<r;){const t=i+r>>1;xa.get(e[t].priority)<n?r=t:i=t+1}e.splice(i,0,t)}class Aa extends Error{context;data;constructor(e,t,n){super(function(e,t){const n=new WeakSet;return e+(t?` ${JSON.stringify(t,((e,t)=>{if("object"==typeof t&&null!==t){if(n.has(t))return`[object ${t.constructor.name}]`;n.add(t)}return t}))}`:"")+Ta(e)}(e,n)),this.name="CKEditorError",this.context=t,this.data=n}is(e){return"CKEditorError"===e}static rethrowUnexpectedError(e,t){if(e.is&&e.is("CKEditorError"))throw e;const n=new Aa(e.message,t);throw n.stack=e.stack,n}}function Ea(e,t){console.warn(...Sa(e,t))}function Ta(e){return`\nRead more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-${e}`}function Sa(e,t){const n=Ta(e);return t?[e,t,n]:[e,n]}const Pa=new Date(2025,1,12);if(globalThis.CKEDITOR_VERSION)throw new Aa("ckeditor-duplicated-modules",null);globalThis.CKEDITOR_VERSION="44.2.0";const Ia=Symbol("listeningTo"),Oa=Symbol("emitterId"),Va=Symbol("delegations"),Ra=Na(Object);function Na(e){return e?class extends e{on(e,t,n){this.listenTo(this,e,t,n)}once(e,t,n){let i=!1;this.listenTo(this,e,((e,...n)=>{i||(i=!0,e.off(),t.call(this,e,...n))}),n)}off(e,t){this.stopListening(this,e,t)}listenTo(e,t,n,i={}){let r,s;this[Ia]||(this[Ia]={});const o=this[Ia];Ma(e)||La(e);const a=Ma(e);(r=o[a])||(r=o[a]={emitter:e,callbacks:{}}),(s=r.callbacks[t])||(s=r.callbacks[t]=[]),s.push(n),function(e,t,n,i,r){t._addEventListener?t._addEventListener(n,i,r):e._addEventListener.call(t,n,i,r)}(this,e,t,n,i)}stopListening(e,t,n){const i=this[Ia];let r=e&&Ma(e);const s=i&&r?i[r]:void 0,o=s&&t?s.callbacks[t]:void 0;if(!(!i||e&&!s||t&&!o))if(n)za(this,e,t,n),-1!==o.indexOf(n)&&(1===o.length?delete s.callbacks[t]:za(this,e,t,n));else if(o){for(;n=o.pop();)za(this,e,t,n);delete s.callbacks[t]}else if(s){for(t in s.callbacks)this.stopListening(e,t);delete i[r]}else{for(r in i)this.stopListening(i[r].emitter);delete this[Ia]}}fire(e,...t){try{const n=e instanceof ya?e:new ya(this,e),i=n.name;let r=function(e,t){if(!e._events)return null;let n=t;do{const t=e._events[n];if(t&&t.callbacks&&t.callbacks.length)return t.callbacks;const i=n.lastIndexOf(":");n=i>-1?n.substring(0,i):""}while(n);return null}(this,i);if(n.path.push(this),r){r=r.slice();for(let e=0;e<r.length;e++){const s=r[e].callback;if(s.call(this,n,...t),n.off.called&&(delete n.off.called,this._removeEventListener(i,s)),n.stop.called)break}}const s=this[Va];if(s){const e=s.get(i),r=s.get("*");e&&Da(e,n,t),r&&Da(r,n,t)}return n.return}catch(e){Aa.rethrowUnexpectedError(e,this)}}delegate(...e){return{to:(t,n)=>{this[Va]||(this[Va]=new Map),e.forEach((e=>{const i=this[Va].get(e);i?i.set(t,n):this[Va].set(e,new Map([[t,n]]))}))}}}stopDelegating(e,t){if(this[Va])if(e)if(t){const n=this[Va].get(e);n&&n.delete(t)}else this[Va].delete(e);else this[Va].clear()}_addEventListener(e,t,n){!function(e,t){const n=Ba(e);if(n[t])return;let i=t,r=null;const s=[];for(;""!==i&&!n[i];)n[i]={callbacks:[],childEvents:[]},s.push(n[i]),r&&n[i].childEvents.push(r),r=i,i=i.substr(0,i.lastIndexOf(":"));if(""!==i){for(const e of s)e.callbacks=n[i].callbacks.slice();n[i].childEvents.push(r)}}(this,e);const i=Fa(this,e),r={callback:t,priority:xa.get(n.priority)};for(const e of i)Ca(e,r)}_removeEventListener(e,t){const n=Fa(this,e);for(const e of n)for(let n=0;n<e.length;n++)e[n].callback==t&&(e.splice(n,1),n--)}}:Ra}function La(e,t){e[Oa]||(e[Oa]=t||ka())}function Ma(e){return e[Oa]}function Ba(e){return e._events||Object.defineProperty(e,"_events",{value:{}}),e._events}function Fa(e,t){const n=Ba(e)[t];if(!n)return[];let i=[n.callbacks];for(let t=0;t<n.childEvents.length;t++){const r=Fa(e,n.childEvents[t]);i=i.concat(r)}return i}function Da(e,t,n){for(let[i,r]of e){r?"function"==typeof r&&(r=r(t.name)):r=t.name;const e=new ya(t.source,r);e.path=[...t.path],i.fire(e,...n)}}function za(e,t,n,i){t._removeEventListener?t._removeEventListener(n,i):e._removeEventListener.call(t,n,i)}["on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach((e=>{Na[e]=Ra.prototype[e]}));const $a=Symbol("observableProperties"),ja=Symbol("boundObservables"),Ha=Symbol("boundProperties"),Wa=Symbol("decoratedMethods"),Ua=Symbol("decoratedOriginal"),qa=Ga(Na());function Ga(e){return e?class extends e{set(e,t){if(or(e))return void Object.keys(e).forEach((t=>{this.set(t,e[t])}),this);Ka(this);const n=this[$a];if(e in this&&!n.has(e))throw new Aa("observable-set-cannot-override",this);Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>n.get(e),set(t){const i=n.get(e);let r=this.fire(`set:${e}`,e,t,i);void 0===r&&(r=t),i===r&&n.has(e)||(n.set(e,r),this.fire(`change:${e}`,e,r,i))}}),this[e]=t}bind(...e){if(!e.length||!Ya(e))throw new Aa("observable-bind-wrong-properties",this);if(new Set(e).size!==e.length)throw new Aa("observable-bind-duplicate-properties",this);Ka(this);const t=this[Ha];e.forEach((e=>{if(t.has(e))throw new Aa("observable-bind-rebind",this)}));const n=new Map;return e.forEach((e=>{const i={property:e,to:[]};t.set(e,i),n.set(e,i)})),{to:Za,toMany:Qa,_observable:this,_bindProperties:e,_to:[],_bindings:n}}unbind(...e){if(!this[$a])return;const t=this[Ha],n=this[ja];if(e.length){if(!Ya(e))throw new Aa("observable-unbind-wrong-properties",this);e.forEach((e=>{const i=t.get(e);i&&(i.to.forEach((([e,t])=>{const r=n.get(e),s=r[t];s.delete(i),s.size||delete r[t],Object.keys(r).length||(n.delete(e),this.stopListening(e,"change"))})),t.delete(e))}))}else n.forEach(((e,t)=>{this.stopListening(t,"change")})),n.clear(),t.clear()}decorate(e){Ka(this);const t=this[e];if(!t)throw new Aa("observablemixin-cannot-decorate-undefined",this,{object:this,methodName:e});this.on(e,((e,n)=>{e.return=t.apply(this,n)})),this[e]=function(...t){return this.fire(e,t)},this[e][Ua]=t,this[Wa]||(this[Wa]=[]),this[Wa].push(e)}stopListening(e,t,n){if(!e&&this[Wa]){for(const e of this[Wa])this[e]=this[e][Ua];delete this[Wa]}super.stopListening(e,t,n)}[$a];[Wa];[Ha];[ja]}:qa}function Ka(e){e[$a]||(Object.defineProperty(e,$a,{value:new Map}),Object.defineProperty(e,ja,{value:new Map}),Object.defineProperty(e,Ha,{value:new Map}))}function Za(...e){const t=function(...e){if(!e.length)throw new Aa("observable-bind-to-parse-error",null);const t={to:[]};let n;return"function"==typeof e[e.length-1]&&(t.callback=e.pop()),e.forEach((e=>{if("string"==typeof e)n.properties.push(e);else{if("object"!=typeof e)throw new Aa("observable-bind-to-parse-error",null);n={observable:e,properties:[]},t.to.push(n)}})),t}(...e),n=Array.from(this._bindings.keys()),i=n.length;if(!t.callback&&t.to.length>1)throw new Aa("observable-bind-to-no-callback",this);if(i>1&&t.callback)throw new Aa("observable-bind-to-extra-callback",this);var r;t.to.forEach((e=>{if(e.properties.length&&e.properties.length!==i)throw new Aa("observable-bind-to-properties-length",this);e.properties.length||(e.properties=this._bindProperties)})),this._to=t.to,t.callback&&(this._bindings.get(n[0]).callback=t.callback),r=this._observable,this._to.forEach((e=>{const t=r[ja];let n;t.get(e.observable)||r.listenTo(e.observable,"change",((i,s)=>{n=t.get(e.observable)[s],n&&n.forEach((e=>{Ja(r,e.property)}))}))})),function(e){let t;e._bindings.forEach(((n,i)=>{e._to.forEach((r=>{t=r.properties[n.callback?0:e._bindProperties.indexOf(i)],n.to.push([r.observable,t]),function(e,t,n,i){const r=e[ja],s=r.get(n),o=s||{};o[i]||(o[i]=new Set),o[i].add(t),s||r.set(n,o)}(e._observable,n,r.observable,t)}))}))}(this),this._bindProperties.forEach((e=>{Ja(this._observable,e)}))}function Qa(e,t,n){if(this._bindings.size>1)throw new Aa("observable-bind-to-many-not-one-binding",this);this.to(...function(e,t){const n=e.map((e=>[e,t]));return Array.prototype.concat.apply([],n)}(e,t),n)}function Ya(e){return e.every((e=>"string"==typeof e))}function Ja(e,t){const n=e[Ha].get(t);let i;n.callback?i=n.callback.apply(e,n.to.map((e=>e[0][e[1]]))):(i=n.to[0],i=i[0][i[1]]),Object.prototype.hasOwnProperty.call(e,t)?e[t]=i:e.set(t,i)}["set","bind","unbind","decorate","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach((e=>{Ga[e]=qa.prototype[e]}));class Xa{_replacedElements;constructor(){this._replacedElements=[]}replace(e,t){this._replacedElements.push({element:e,newElement:t}),e.style.display="none",t&&e.parentNode.insertBefore(t,e.nextSibling)}restore(){this._replacedElements.forEach((({element:e,newElement:t})=>{e.style.display="",t&&t.remove()})),this._replacedElements=[]}}function el(e){let t=0;for(const n of e)t++;return t}function tl(e,t){const n=Math.min(e.length,t.length);for(let i=0;i<n;i++)if(e[i]!=t[i])return i;return e.length==t.length?"same":e.length<t.length?"prefix":"extension"}function nl(e){return!(!e||!e[Symbol.iterator])}function il(e,t,n={},i=[]){const r=n&&n.xmlns,s=r?e.createElementNS(r,t):e.createElement(t);for(const e in n)s.setAttribute(e,n[e]);!yr(i)&&nl(i)||(i=[i]);for(let t of i)yr(t)&&(t=e.createTextNode(t)),s.appendChild(t);return s}class rl{_config;constructor(e,t){this._config=Object.create(null),t&&this.define(sl(t)),e&&this._setObjectToTarget(this._config,e)}set(e,t){this._setToTarget(this._config,e,t)}define(e,t){this._setToTarget(this._config,e,t,!0)}get(e){return this._getFromSource(this._config,e)}*names(){for(const e of Object.keys(this._config))yield e}_setToTarget(e,t,n,i=!1){if(Sr(t))return void this._setObjectToTarget(e,t,i);const r=t.split(".");t=r.pop();for(const t of r)Sr(e[t])||(e[t]=Object.create(null)),e=e[t];if(Sr(n))return Sr(e[t])||(e[t]=Object.create(null)),e=e[t],void this._setObjectToTarget(e,n,i);i&&void 0!==e[t]||(e[t]=n)}_getFromSource(e,t){const n=t.split(".");t=n.pop();for(const t of n){if(!Sr(e[t])){e=null;break}e=e[t]}return e?sl(e[t]):void 0}_setObjectToTarget(e,t,n){Object.keys(t).forEach((i=>{this._setToTarget(e,i,t[i],n)}))}}function sl(e){return Do(e,ol)}function ol(e){return zo(e)||"function"==typeof e?e:void 0}function al(e){if(e){if(e.defaultView)return e instanceof e.defaultView.Document;if(e.ownerDocument&&e.ownerDocument.defaultView)return e instanceof e.ownerDocument.defaultView.Node}return!1}function ll(e){const t=Object.prototype.toString.apply(e);return"[object Window]"==t||"[object global]"==t}const cl=dl(Na());function dl(e){return e?class extends e{listenTo(e,t,n,i={}){if(al(e)||ll(e)){const r={capture:!!i.useCapture,passive:!!i.usePassive},s=this._getProxyEmitter(e,r)||new ul(e,r);this.listenTo(s,t,n,i)}else super.listenTo(e,t,n,i)}stopListening(e,t,n){if(al(e)||ll(e)){const i=this._getAllProxyEmitters(e);for(const e of i)this.stopListening(e,t,n)}else super.stopListening(e,t,n)}_getProxyEmitter(e,t){return function(e,t){const n=e[Ia];return n&&n[t]?n[t].emitter:null}(this,hl(e,t))}_getAllProxyEmitters(e){return[{capture:!1,passive:!1},{capture:!1,passive:!0},{capture:!0,passive:!1},{capture:!0,passive:!0}].map((t=>this._getProxyEmitter(e,t))).filter((e=>!!e))}}:cl}["_getProxyEmitter","_getAllProxyEmitters","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach((e=>{dl[e]=cl.prototype[e]}));class ul extends(Na()){_domNode;_options;constructor(e,t){super(),La(this,hl(e,t)),this._domNode=e,this._options=t}_domListeners;attach(e){if(this._domListeners&&this._domListeners[e])return;const t=this._createDomListener(e);this._domNode.addEventListener(e,t,this._options),this._domListeners||(this._domListeners={}),this._domListeners[e]=t}detach(e){let t;!this._domListeners[e]||(t=this._events[e])&&t.callbacks.length||this._domListeners[e].removeListener()}_addEventListener(e,t,n){this.attach(e),Na().prototype._addEventListener.call(this,e,t,n)}_removeEventListener(e,t){Na().prototype._removeEventListener.call(this,e,t),this.detach(e)}_createDomListener(e){const t=t=>{this.fire(e,t)};return t.removeListener=()=>{this._domNode.removeEventListener(e,t,this._options),delete this._domListeners[e]},t}}function hl(e,t){let n=function(e){return e["data-ck-expando"]||(e["data-ck-expando"]=ka())}(e);for(const e of Object.keys(t).sort())t[e]&&(n+="-"+e);return n}function ml(e){const t=e.ownerDocument.defaultView.getComputedStyle(e);return{top:parseInt(t.borderTopWidth,10),right:parseInt(t.borderRightWidth,10),bottom:parseInt(t.borderBottomWidth,10),left:parseInt(t.borderLeftWidth,10)}}function gl(e){if(!e.target)return null;const t=e.target.ownerDocument,n=e.clientX,i=e.clientY;let r=null;return t.caretRangeFromPoint&&t.caretRangeFromPoint(n,i)?r=t.caretRangeFromPoint(n,i):e.rangeParent&&(r=t.createRange(),r.setStart(e.rangeParent,e.rangeOffset),r.collapse(!0)),r}function pl(e){return"[object Text]"==Object.prototype.toString.call(e)}function fl(e){return"[object Range]"==Object.prototype.toString.apply(e)}function bl(e){return e&&e.parentNode?e.offsetParent===ra.document.body?null:e.offsetParent:null}const wl=["top","right","bottom","left","width","height"];class vl{top;right;bottom;left;width;height;_source;constructor(e){const t=fl(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),kl(e)||t)if(t){const t=vl.getDomRangeRects(e);yl(this,vl.getBoundingRect(t))}else yl(this,e.getBoundingClientRect());else if(ll(e)){const{innerWidth:t,innerHeight:n}=e;yl(this,{top:0,right:t,bottom:n,left:0,width:t,height:n})}else yl(this,e)}clone(){return new vl(this)}moveTo(e,t){return this.top=t,this.right=e+this.width,this.bottom=t+this.height,this.left=e,this}moveBy(e,t){return this.top+=t,this.right+=e,this.left+=e,this.bottom+=t,this}getIntersection(e){const t={top:Math.max(this.top,e.top),right:Math.min(this.right,e.right),bottom:Math.min(this.bottom,e.bottom),left:Math.max(this.left,e.left),width:0,height:0};if(t.width=t.right-t.left,t.height=t.bottom-t.top,t.width<0||t.height<0)return null;{const e=new vl(t);return e._source=this._source,e}}getIntersectionArea(e){const t=this.getIntersection(e);return t?t.getArea():0}getArea(){return this.width*this.height}getVisible(){const e=this._source;let t=this.clone();if(_l(e))return t;let n,i=e,r=e.parentNode||e.commonAncestorContainer;for(;r&&!_l(r);){const e="visible"===((s=r)instanceof HTMLElement?s.ownerDocument.defaultView.getComputedStyle(s).overflow:"visible");i instanceof HTMLElement&&"absolute"===xl(i)&&(n=i);const o=xl(r);if(e||n&&("relative"===o&&e||"relative"!==o)){i=r,r=r.parentNode;continue}const a=new vl(r),l=t.getIntersection(a);if(!l)return null;l.getArea()<t.getArea()&&(t=l),i=r,r=r.parentNode}var s;return t}isEqual(e){for(const t of wl)if(this[t]!==e[t])return!1;return!0}contains(e){const t=this.getIntersection(e);return!(!t||!t.isEqual(e))}toAbsoluteRect(){const{scrollX:e,scrollY:t}=ra.window,n=this.clone().moveBy(e,t);if(kl(n._source)){const e=bl(n._source);e&&function(e,t){const n=new vl(t),i=ml(t);let r=0,s=0;r-=n.left,s-=n.top,r+=t.scrollLeft,s+=t.scrollTop,r-=i.left,s-=i.top,e.moveBy(r,s)}(n,e)}return n}excludeScrollbarsAndBorders(){const e=this._source;let t,n,i;if(ll(e))t=e.innerWidth-e.document.documentElement.clientWidth,n=e.innerHeight-e.document.documentElement.clientHeight,i=e.getComputedStyle(e.document.documentElement).direction;else{const r=ml(e);t=e.offsetWidth-e.clientWidth-r.left-r.right,n=e.offsetHeight-e.clientHeight-r.top-r.bottom,i=e.ownerDocument.defaultView.getComputedStyle(e).direction,this.left+=r.left,this.top+=r.top,this.right-=r.right,this.bottom-=r.bottom,this.width=this.right-this.left,this.height=this.bottom-this.top}return this.width-=t,"ltr"===i?this.right-=t:this.left+=t,this.height-=n,this.bottom-=n,this}static getDomRangeRects(e){const t=[],n=Array.from(e.getClientRects());if(n.length)for(const e of n)t.push(new vl(e));else{let n=e.startContainer;pl(n)&&(n=n.parentNode);const i=new vl(n.getBoundingClientRect());i.right=i.left,i.width=0,t.push(i)}return t}static getBoundingRect(e){const t={left:Number.POSITIVE_INFINITY,top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,width:0,height:0};let n=0;for(const i of e)n++,t.left=Math.min(t.left,i.left),t.top=Math.min(t.top,i.top),t.right=Math.max(t.right,i.right),t.bottom=Math.max(t.bottom,i.bottom);return 0==n?null:(t.width=t.right-t.left,t.height=t.bottom-t.top,new vl(t))}}function yl(e,t){for(const n of wl)e[n]=t[n]}function _l(e){return!!kl(e)&&e===e.ownerDocument.body}function kl(e){return null!==e&&"object"==typeof e&&1===e.nodeType&&"function"==typeof e.getBoundingClientRect}function xl(e){return e instanceof HTMLElement?e.ownerDocument.defaultView.getComputedStyle(e).position:"static"}class Cl{_element;_callback;static _observerInstance=null;static _elementCallbacks=null;constructor(e,t){Cl._observerInstance||Cl._createObserver(),this._element=e,this._callback=t,Cl._addElementCallback(e,t),Cl._observerInstance.observe(e)}get element(){return this._element}destroy(){Cl._deleteElementCallback(this._element,this._callback)}static _addElementCallback(e,t){Cl._elementCallbacks||(Cl._elementCallbacks=new Map);let n=Cl._elementCallbacks.get(e);n||(n=new Set,Cl._elementCallbacks.set(e,n)),n.add(t)}static _deleteElementCallback(e,t){const n=Cl._getElementCallbacks(e);n&&(n.delete(t),n.size||(Cl._elementCallbacks.delete(e),Cl._observerInstance.unobserve(e))),Cl._elementCallbacks&&!Cl._elementCallbacks.size&&(Cl._observerInstance=null,Cl._elementCallbacks=null)}static _getElementCallbacks(e){return Cl._elementCallbacks?Cl._elementCallbacks.get(e):null}static _createObserver(){Cl._observerInstance=new ra.window.ResizeObserver((e=>{for(const t of e){const e=Cl._getElementCallbacks(t.target);if(e)for(const n of e)n(t)}}))}}function Al(e,t){e instanceof HTMLTextAreaElement&&(e.value=t),e.innerHTML=t}function El(e){return t=>t+e}function Tl(e){let t=0;for(;e.previousSibling;)e=e.previousSibling,t++;return t}function Sl(e,t,n){e.insertBefore(n,e.childNodes[t]||null)}function Pl(e){return e&&e.nodeType===Node.COMMENT_NODE}function Il(e){try{ra.document.createAttribute(e)}catch(e){return!1}return!0}function Ol(e){return!!e&&(pl(e)?Ol(e.parentElement):!!e.getClientRects&&!!e.getClientRects().length)}function Vl({element:e,target:t,positions:n,limiter:i,fitInViewport:r,viewportOffsetConfig:s}){Nr(t)&&(t=t()),Nr(i)&&(i=i());const o=bl(e),a=function(e){e=Object.assign({top:0,bottom:0,left:0,right:0},e);const t=new vl(ra.window);return t.top+=e.top,t.height-=e.top,t.bottom-=e.bottom,t.height-=e.bottom,t}(s),l=new vl(e),c=Rl(t,a);let d;if(!c||!a.getIntersection(c))return null;const u={targetRect:c,elementRect:l,positionedElementAncestor:o,viewportRect:a};if(i||r){if(i){const e=Rl(i,a);e&&(u.limiterRect=e)}d=function(e,t){const{elementRect:n}=t,i=n.getArea(),r=e.map((e=>new Nl(e,t))).filter((e=>!!e.name));let s=0,o=null;for(const e of r){const{limiterIntersectionArea:t,viewportIntersectionArea:n}=e;if(t===i)return e;const r=n**2+t**2;r>s&&(s=r,o=e)}return o}(n,u)}else d=new Nl(n[0],u);return d}function Rl(e,t){const n=new vl(e).getVisible();return n?n.getIntersection(t):null}class Nl{name;config;_positioningFunctionCoordinates;_options;_cachedRect;_cachedAbsoluteRect;constructor(e,t){const n=e(t.targetRect,t.elementRect,t.viewportRect,t.limiterRect);if(!n)return;const{left:i,top:r,name:s,config:o}=n;this.name=s,this.config=o,this._positioningFunctionCoordinates={left:i,top:r},this._options=t}get left(){return this._absoluteRect.left}get top(){return this._absoluteRect.top}get limiterIntersectionArea(){const e=this._options.limiterRect;return e?e.getIntersectionArea(this._rect):0}get viewportIntersectionArea(){return this._options.viewportRect.getIntersectionArea(this._rect)}get _rect(){return this._cachedRect||(this._cachedRect=this._options.elementRect.clone().moveTo(this._positioningFunctionCoordinates.left,this._positioningFunctionCoordinates.top)),this._cachedRect}get _absoluteRect(){return this._cachedAbsoluteRect||(this._cachedAbsoluteRect=this._rect.toAbsoluteRect()),this._cachedAbsoluteRect}}function Ll(e){const t=e.parentNode;t&&t.removeChild(e)}function Ml({target:e,viewportOffset:t=0,ancestorOffset:n=0,alignToTop:i,forceScroll:r}){const s=Hl(e);let o=s,a=null;for(t=function(e){return"number"==typeof e?{top:e,bottom:e,left:e,right:e}:e}(t);o;){let l;l=Wl(o==s?e:a),Fl({parent:l,getRect:()=>Ul(e,o),alignToTop:i,ancestorOffset:n,forceScroll:r});let c=Ul(e,o);const d=Ul(l,o);if(c.height>d.height){const e=c.getIntersection(d);e&&(c=e)}if(Bl({window:o,rect:c,viewportOffset:t,alignToTop:i,forceScroll:r}),o.parent!=o){if(a=o.frameElement,o=o.parent,!a)return}else o=null}}function Bl({window:e,rect:t,alignToTop:n,forceScroll:i,viewportOffset:r}){const s=t.clone().moveBy(0,r.bottom),o=t.clone().moveBy(0,-r.top),a=new vl(e).excludeScrollbarsAndBorders(),l=n&&i,c=[o,s].every((e=>a.contains(e)));let{scrollX:d,scrollY:u}=e;const h=d,m=u;l?u-=a.top-t.top+r.top:c||(zl(o,a)?u-=a.top-t.top+r.top:Dl(s,a)&&(u+=n?t.top-a.top-r.top:t.bottom-a.bottom+r.bottom)),c||($l(t,a)?d-=a.left-t.left+r.left:jl(t,a)&&(d+=t.right-a.right+r.right)),d==h&&u===m||e.scrollTo(d,u)}function Fl({parent:e,getRect:t,alignToTop:n,forceScroll:i,ancestorOffset:r=0,limiterElement:s}){const o=Hl(e),a=n&&i;let l,c,d;const u=s||o.document.body;for(;e!=u;)c=t(),l=new vl(e).excludeScrollbarsAndBorders(),d=l.contains(c),a?e.scrollTop-=l.top-c.top+r:d||(zl(c,l)?e.scrollTop-=l.top-c.top+r:Dl(c,l)&&(e.scrollTop+=n?c.top-l.top-r:c.bottom-l.bottom+r)),d||($l(c,l)?e.scrollLeft-=l.left-c.left+r:jl(c,l)&&(e.scrollLeft+=c.right-l.right+r)),e=e.parentNode}function Dl(e,t){return e.bottom>t.bottom}function zl(e,t){return e.top<t.top}function $l(e,t){return e.left<t.left}function jl(e,t){return e.right>t.right}function Hl(e){return fl(e)?e.startContainer.ownerDocument.defaultView:e.ownerDocument.defaultView}function Wl(e){if(fl(e)){let t=e.commonAncestorContainer;return pl(t)&&(t=t.parentNode),t}return e.parentNode}function Ul(e,t){const n=Hl(e),i=new vl(e);if(n===t)return i;{let e=n;for(;e!=t;){const t=e.frameElement,n=new vl(t).excludeScrollbarsAndBorders();i.moveBy(n.left,n.top),e=e.parent}}return i}const ql={ctrl:"⌃",cmd:"⌘",alt:"⌥",shift:"⇧"},Gl={ctrl:"Ctrl+",alt:"Alt+",shift:"Shift+"},Kl={37:"←",38:"↑",39:"→",40:"↓",9:"⇥",33:"Page Up",34:"Page Down"},Zl=tc(),Ql=Object.fromEntries(Object.entries(Zl).map((([e,t])=>{let n;return n=t in Kl?Kl[t]:e.charAt(0).toUpperCase()+e.slice(1),[t,n]})));function Yl(e){let t;if("string"==typeof e){if(t=Zl[e.toLowerCase()],!t)throw new Aa("keyboard-unknown-key",null,{key:e})}else t=e.keyCode+(e.altKey?Zl.alt:0)+(e.ctrlKey?Zl.ctrl:0)+(e.shiftKey?Zl.shift:0)+(e.metaKey?Zl.cmd:0);return t}function Jl(e){return"string"==typeof e&&(e=function(e){return e.split("+").map((e=>e.trim()))}(e)),e.map((e=>"string"==typeof e?function(e){if(e.endsWith("!"))return Yl(e.slice(0,-1));const t=Yl(e);return(aa.isMac||aa.isiOS)&&t==Zl.ctrl?Zl.cmd:t}(e):e)).reduce(((e,t)=>t+e),0)}function Xl(e,t){let n=Jl(e);const i=t?"Mac"===t:aa.isMac||aa.isiOS;return Object.entries(i?ql:Gl).reduce(((e,[t,i])=>(n&Zl[t]&&(n&=~Zl[t],e+=i),e)),"")+(n?Ql[n]:"")}function ec(e,t){const n="ltr"===t;switch(e){case Zl.arrowleft:return n?"left":"right";case Zl.arrowright:return n?"right":"left";case Zl.arrowup:return"up";case Zl.arrowdown:return"down"}}function tc(){const e={pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,backspace:8,delete:46,enter:13,space:32,esc:27,tab:9,ctrl:1114112,shift:2228224,alt:4456448,cmd:8912896};for(let t=65;t<=90;t++)e[String.fromCharCode(t).toLowerCase()]=t;for(let t=48;t<=57;t++)e[t-48]=t;for(let t=112;t<=123;t++)e["f"+(t-111)]=t;return Object.assign(e,{"'":222,",":108,"-":109,".":110,"/":111,";":186,"=":187,"[":219,"\\":220,"]":221,"`":223}),e}const nc=["ar","ara","dv","div","fa","per","fas","he","heb","ku","kur","ug","uig"];function ic(e){return nc.includes(e)?"rtl":"ltr"}function rc(e){return Array.isArray(e)?e:[e]}ra.window.CKEDITOR_TRANSLATIONS||(ra.window.CKEDITOR_TRANSLATIONS={});class sc{uiLanguage;uiLanguageDirection;contentLanguage;contentLanguageDirection;t;translations;constructor({uiLanguage:e="en",contentLanguage:t,translations:n}={}){this.uiLanguage=e,this.contentLanguage=t||this.uiLanguage,this.uiLanguageDirection=ic(this.uiLanguage),this.contentLanguageDirection=ic(this.contentLanguage),this.translations=function(e){return Array.isArray(e)?e.reduce(((e,t)=>na(e,t))):e}(n),this.t=(e,t)=>this._t(e,t)}get language(){return console.warn("locale-deprecated-language-property: The Locale#language property has been deprecated and will be removed in the near future. Please use #uiLanguage and #contentLanguage properties instead."),this.uiLanguage}_t(e,t=[]){t=rc(t),"string"==typeof e&&(e={string:e});const n=e.plural?t[0]:1;return function(e,t){return e.replace(/%(\d+)/g,((e,n)=>n<t.length?t[n]:e))}(function(e,t,n=1,i){if("number"!=typeof n)throw new Aa("translation-service-quantity-not-a-number",null,{quantity:n});const r=i||ra.window.CKEDITOR_TRANSLATIONS,s=function(e){return Object.keys(e).length}(r);1===s&&(e=Object.keys(r)[0]);const o=t.id||t.string;if(0===s||!function(e,t,n){return!!n[e]&&!!n[e].dictionary[t]}(e,o,r))return 1!==n?t.plural:t.string;const a=r[e].dictionary,l=r[e].getPluralForm||(e=>1===e?0:1),c=a[o];return"string"==typeof c?c:c[Number(l(n))]}(this.uiLanguage,e,n,this.translations),t)}}class oc extends(Na()){_items;_itemMap;_idProperty;_bindToCollection;_bindToExternalToInternalMap;_bindToInternalToExternalMap;_skippedIndexesFromExternal;constructor(e={},t={}){super();const n=nl(e);if(n||(t=e),this._items=[],this._itemMap=new Map,this._idProperty=t.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[],n)for(const t of e)this._items.push(t),this._itemMap.set(this._getItemIdBeforeAdding(t),t)}get length(){return this._items.length}get first(){return this._items[0]||null}get last(){return this._items[this.length-1]||null}add(e,t){return this.addMany([e],t)}addMany(e,t){if(void 0===t)t=this._items.length;else if(t>this._items.length||t<0)throw new Aa("collection-add-item-invalid-index",this);let n=0;for(const i of e){const e=this._getItemIdBeforeAdding(i),r=t+n;this._items.splice(r,0,i),this._itemMap.set(e,i),this.fire("add",i,r),n++}return this.fire("change",{added:e,removed:[],index:t}),this}get(e){let t;if("string"==typeof e)t=this._itemMap.get(e);else{if("number"!=typeof e)throw new Aa("collection-get-invalid-arg",this);t=this._items[e]}return t||null}has(e){if("string"==typeof e)return this._itemMap.has(e);{const t=e[this._idProperty];return t&&this._itemMap.has(t)}}getIndex(e){let t;return t="string"==typeof e?this._itemMap.get(e):e,t?this._items.indexOf(t):-1}remove(e){const[t,n]=this._remove(e);return this.fire("change",{added:[],removed:[t],index:n}),t}map(e,t){return this._items.map(e,t)}forEach(e,t){this._items.forEach(e,t)}find(e,t){return this._items.find(e,t)}filter(e,t){return this._items.filter(e,t)}clear(){this._bindToCollection&&(this.stopListening(this._bindToCollection),this._bindToCollection=null);const e=Array.from(this._items);for(;this.length;)this._remove(0);this.fire("change",{added:[],removed:e,index:0})}bindTo(e){if(this._bindToCollection)throw new Aa("collection-bind-to-rebind",this);return this._bindToCollection=e,{as:e=>{this._setUpBindToBinding((t=>new e(t)))},using:e=>{"function"==typeof e?this._setUpBindToBinding(e):this._setUpBindToBinding((t=>t[e]))}}}_setUpBindToBinding(e){const t=this._bindToCollection,n=(n,i,r)=>{const s=t._bindToCollection==this,o=t._bindToInternalToExternalMap.get(i);if(s&&o)this._bindToExternalToInternalMap.set(i,o),this._bindToInternalToExternalMap.set(o,i);else{const n=e(i);if(!n)return void this._skippedIndexesFromExternal.push(r);let s=r;for(const e of this._skippedIndexesFromExternal)r>e&&s--;for(const e of t._skippedIndexesFromExternal)s>=e&&s++;this._bindToExternalToInternalMap.set(i,n),this._bindToInternalToExternalMap.set(n,i),this.add(n,s);for(let e=0;e<t._skippedIndexesFromExternal.length;e++)s<=t._skippedIndexesFromExternal[e]&&t._skippedIndexesFromExternal[e]++}};for(const e of t)n(0,e,t.getIndex(e));this.listenTo(t,"add",n),this.listenTo(t,"remove",((e,t,n)=>{const i=this._bindToExternalToInternalMap.get(t);i&&this.remove(i),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce(((e,t)=>(n<t&&e.push(t-1),n>t&&e.push(t),e)),[])}))}_getItemIdBeforeAdding(e){const t=this._idProperty;let n;if(t in e){if(n=e[t],"string"!=typeof n)throw new Aa("collection-add-invalid-id",this);if(this.get(n))throw new Aa("collection-add-item-already-exists",this)}else e[t]=n=ka();return n}_remove(e){let t,n,i,r=!1;const s=this._idProperty;if("string"==typeof e?(n=e,i=this._itemMap.get(n),r=!i,i&&(t=this._items.indexOf(i))):"number"==typeof e?(t=e,i=this._items[t],r=!i,i&&(n=i[s])):(i=e,n=i[s],t=this._items.indexOf(i),r=-1==t||!this._itemMap.get(n)),r)throw new Aa("collection-remove-404",this);this._items.splice(t,1),this._itemMap.delete(n);const o=this._bindToInternalToExternalMap.get(i);return this._bindToInternalToExternalMap.delete(i),this._bindToExternalToInternalMap.delete(o),this.fire("remove",i,t),[i,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}}function ac(e){const t=e.next();return t.done?null:t.value}class lc extends(dl(Ga())){_elements=new Set;_externalViews=new Set;_blurTimeout=null;constructor(){super(),this.set("isFocused",!1),this.set("focusedElement",null)}get elements(){return Array.from(this._elements.values())}get externalViews(){return Array.from(this._externalViews.values())}add(e){if(dc(e))this._addElement(e);else if(cc(e))this._addView(e);else{if(!e.element)throw new Aa("focustracker-add-view-missing-element",{focusTracker:this,view:e});this._addElement(e.element)}}remove(e){dc(e)?this._removeElement(e):cc(e)?this._removeView(e):this._removeElement(e.element)}_addElement(e){if(this._elements.has(e))throw new Aa("focustracker-add-element-already-exist",this);this.listenTo(e,"focus",(()=>{const t=this.externalViews.find((t=>function(e,t){return!!uc(e,t)||!!t.focusTracker.externalViews.find((t=>uc(e,t)))}(e,t)));t?this._focus(t.element):this._focus(e)}),{useCapture:!0}),this.listenTo(e,"blur",(()=>{this._blur()}),{useCapture:!0}),this._elements.add(e)}_removeElement(e){this._elements.has(e)&&(this.stopListening(e),this._elements.delete(e)),e===this.focusedElement&&this._blur()}_addView(e){e.element&&this._addElement(e.element),this.listenTo(e.focusTracker,"change:focusedElement",(()=>{e.focusTracker.focusedElement?e.element&&this._focus(e.element):this._blur()})),this._externalViews.add(e)}_removeView(e){e.element&&this._removeElement(e.element),this.stopListening(e.focusTracker),this._externalViews.delete(e)}destroy(){this.stopListening(),this._elements.clear(),this._externalViews.clear(),this.isFocused=!1,this.focusedElement=null}_focus(e){this._clearBlurTimeout(),this.focusedElement=e,this.isFocused=!0}_blur(){this.elements.find((e=>e.contains(document.activeElement)))||this.externalViews.find((e=>e.focusTracker.isFocused&&!e.focusTracker._blurTimeout))||(this._clearBlurTimeout(),this._blurTimeout=setTimeout((()=>{this.focusedElement=null,this.isFocused=!1}),0))}_clearBlurTimeout(){clearTimeout(this._blurTimeout),this._blurTimeout=null}}function cc(e){return"focusTracker"in e&&e.focusTracker instanceof lc}function dc(e){return zo(e)}function uc(e,t){return!!t.element&&t.element.contains(document.activeElement)&&e.contains(t.element)}class hc{_listener;constructor(){this._listener=new(dl())}listenTo(e){this._listener.listenTo(e,"keydown",((e,t)=>{this._listener.fire("_keydown:"+Yl(t),t)}))}set(e,t,n={}){const i=Jl(e),r=n.priority;this._listener.listenTo(this._listener,"_keydown:"+i,((e,i)=>{n.filter&&!n.filter(i)||(t(i,(()=>{i.preventDefault(),i.stopPropagation(),e.stop()})),e.return=!0)}),{priority:r})}press(e){return!!this._listener.fire("_keydown:"+Yl(e),e)}stopListening(e){this._listener.stopListening(e)}destroy(){this.stopListening()}}function mc(e){return nl(e)?new Map(e):function(e){const t=new Map;for(const n in e)t.set(n,e[n]);return t}(e)}function gc(e,t,n){const i=e.length,r=t.length;for(let t=i-1;t>=n;t--)e[t+r]=e[t];for(let i=0;i<r;i++)e[n+i]=t[i]}function pc(e,t){let n;function i(...r){i.cancel(),n=setTimeout((()=>e(...r)),t)}return i.cancel=()=>{clearTimeout(n)},i}function fc(e){try{if(!e.startsWith("ey"))return null;const t=atob(e.replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(t)}catch(e){return null}}function bc(e,t){return!!(n=e.charAt(t-1))&&1==n.length&&/[\ud800-\udbff]/.test(n)&&function(e){return!!e&&1==e.length&&/[\udc00-\udfff]/.test(e)}(e.charAt(t));var n}function wc(e,t){return!!(n=e.charAt(t))&&1==n.length&&/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test(n);var n}const vc=_c();function yc(e,t){const n=String(e).matchAll(vc);return Array.from(n).some((e=>e.index<t&&t<e.index+e[0].length))}function _c(){const e=/\p{Regional_Indicator}{2}/u.source,t="(?:"+[/\p{Emoji}[\u{E0020}-\u{E007E}]+\u{E007F}/u,/\p{Emoji}\u{FE0F}?\u{20E3}/u,/\p{Emoji}\u{FE0F}/u,/(?=\p{General_Category=Other_Symbol})\p{Emoji}\p{Emoji_Modifier}*/u].map((e=>e.source)).join("|")+")";return new RegExp(`${e}|${t}(?:${t})*`,"ug")}const kc=function(e){return"symbol"==typeof e||vr(e)&&"[object Symbol]"==br(e)};var xc=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Cc=/^\w*$/;const Ac=function(e,t){if(wr(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!kc(e))||Cc.test(e)||!xc.test(e)||null!=t&&e in Object(t)};function Ec(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var i=arguments,r=t?t.apply(this,i):i[0],s=n.cache;if(s.has(r))return s.get(r);var o=e.apply(this,i);return n.cache=s.set(r,o)||s,o};return n.cache=new(Ec.Cache||ns),n}Ec.Cache=ns;var Tc=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Sc=/\\(\\)?/g;const Pc=(Ic=Ec((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Tc,(function(e,n,i,r){t.push(i?r.replace(Sc,"$1"):n||e)})),t}),(function(e){return 500===Oc.size&&Oc.clear(),e})),Oc=Ic.cache,Ic);var Ic,Oc;const Vc=function(e,t){for(var n=-1,i=null==e?0:e.length,r=Array(i);++n<i;)r[n]=t(e[n],n,e);return r};var Rc=dr?dr.prototype:void 0,Nc=Rc?Rc.toString:void 0;const Lc=function e(t){if("string"==typeof t)return t;if(wr(t))return Vc(t,e)+"";if(kc(t))return Nc?Nc.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n},Mc=function(e){return null==e?"":Lc(e)},Bc=function(e,t){return wr(e)?e:Ac(e,t)?[e]:Pc(Mc(e))},Fc=function(e){if("string"==typeof e||kc(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t},Dc=function(e,t){for(var n=0,i=(t=Bc(t,e)).length;null!=e&&n<i;)e=e[Fc(t[n++])];return n&&n==i?e:void 0},zc=function(e,t,n){var i=null==e?void 0:Dc(e,t);return void 0===i?n:i},$c=function(e,t,n){return null==e?e:function(e,t,n,i){if(!or(e))return e;for(var r=-1,s=(t=Bc(t,e)).length,o=s-1,a=e;null!=a&&++r<s;){var l=Fc(t[r]),c=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(r!=o){var d=a[l];void 0===(c=i?i(d,l,a):void 0)&&(c=or(d)?d:ys(t[r+1])?[]:{})}ls(a,l,c),a=a[l]}return e}(e,t,n)},jc=function(e){return Fo(e,4)},Hc=function(e,t,n){var i=-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 s=Array(r);++i<r;)s[i]=e[i+t];return s},Wc=function(e,t){return null==(e=function(e,t){return t.length<2?e:Dc(e,Hc(t,0,-1))}(e,t=Bc(t,e)))||delete e[Fc((n=t,i=null==n?0:n.length,i?n[i-1]:void 0))];var n,i},Uc=ta((function(e,t){cs(t,zs(t),e)})),qc=function(){return cr.Date.now()};var Gc=/\s/;var Kc=/^\s+/;const Zc=function(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&Gc.test(e.charAt(t)););return t}(e)+1).replace(Kc,""):e};var Qc=/^[-+]0x[0-9a-f]+$/i,Yc=/^0b[01]+$/i,Jc=/^0o[0-7]+$/i,Xc=parseInt;const ed=function(e){if("number"==typeof e)return e;if(kc(e))return NaN;if(or(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=or(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Zc(e);var n=Yc.test(e);return n||Jc.test(e)?Xc(e.slice(2),n?2:8):Qc.test(e)?NaN:+e};var td=Math.max,nd=Math.min;const id=function(e,t,n){var i,r,s,o,a,l,c=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function m(t){var n=i,s=r;return i=r=void 0,c=t,o=e.apply(s,n)}function g(e){var n=e-l;return void 0===l||n>=t||n<0||u&&e-c>=s}function p(){var e=qc();if(g(e))return f(e);a=setTimeout(p,function(e){var n=t-(e-l);return u?nd(n,s-(e-c)):n}(e))}function f(e){return a=void 0,h&&i?m(e):(i=r=void 0,o)}function b(){var e=qc(),n=g(e);if(i=arguments,r=this,l=e,n){if(void 0===a)return function(e){return c=e,a=setTimeout(p,t),d?m(e):o}(l);if(u)return clearTimeout(a),a=setTimeout(p,t),m(l)}return void 0===a&&(a=setTimeout(p,t)),o}return t=ed(t)||0,or(n)&&(d=!!n.leading,s=(u="maxWait"in n)?td(ed(n.maxWait)||0,t):s,h="trailing"in n?!!n.trailing:h),b.cancel=function(){void 0!==a&&clearTimeout(a),c=0,i=l=r=a=void 0},b.flush=function(){return void 0===a?o:f(qc())},b};function rd(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new ns;++t<n;)this.add(e[t])}rd.prototype.add=rd.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},rd.prototype.has=function(e){return this.__data__.has(e)};const sd=rd,od=function(e,t){for(var n=-1,i=null==e?0:e.length;++n<i;)if(t(e[n],n,e))return!0;return!1},ad=function(e,t){return e.has(t)},ld=function(e,t,n,i,r,s){var o=1&n,a=e.length,l=t.length;if(a!=l&&!(o&&l>a))return!1;var c=s.get(e),d=s.get(t);if(c&&d)return c==t&&d==e;var u=-1,h=!0,m=2&n?new sd:void 0;for(s.set(e,t),s.set(t,e);++u<a;){var g=e[u],p=t[u];if(i)var f=o?i(p,g,u,t,e,s):i(g,p,u,e,t,s);if(void 0!==f){if(f)continue;h=!1;break}if(m){if(!od(t,(function(e,t){if(!ad(m,t)&&(g===e||r(g,e,n,i,s)))return m.push(t)}))){h=!1;break}}else if(g!==p&&!r(g,p,n,i,s)){h=!1;break}}return s.delete(e),s.delete(t),h},cd=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,i){n[++t]=[i,e]})),n},dd=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n};var ud=dr?dr.prototype:void 0,hd=ud?ud.valueOf:void 0;var md=Object.prototype.hasOwnProperty;var gd="[object Arguments]",pd="[object Array]",fd="[object Object]",bd=Object.prototype.hasOwnProperty;const wd=function(e,t,n,i,r,s){var o=wr(e),a=wr(t),l=o?pd:wo(e),c=a?pd:wo(t),d=(l=l==gd?fd:l)==fd,u=(c=c==gd?fd:c)==fd,h=l==c;if(h&&ws(e)){if(!ws(t))return!1;o=!0,d=!1}if(h&&!d)return s||(s=new rs),o||Ps(e)?ld(e,t,n,i,r,s):function(e,t,n,i,r,s,o){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||!s(new yo(e),new yo(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Pr(+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=cd;case"[object Set]":var l=1&i;if(a||(a=dd),e.size!=t.size&&!l)return!1;var c=o.get(e);if(c)return c==t;i|=2,o.set(e,t);var d=ld(a(e),a(t),i,r,s,o);return o.delete(e),d;case"[object Symbol]":if(hd)return hd.call(e)==hd.call(t)}return!1}(e,t,l,n,i,r,s);if(!(1&n)){var m=d&&bd.call(e,"__wrapped__"),g=u&&bd.call(t,"__wrapped__");if(m||g){var p=m?e.value():e,f=g?t.value():t;return s||(s=new rs),r(p,f,n,i,s)}}return!!h&&(s||(s=new rs),function(e,t,n,i,r,s){var o=1&n,a=eo(e),l=a.length;if(l!=eo(t).length&&!o)return!1;for(var c=l;c--;){var d=a[c];if(!(o?d in t:md.call(t,d)))return!1}var u=s.get(e),h=s.get(t);if(u&&h)return u==t&&h==e;var m=!0;s.set(e,t),s.set(t,e);for(var g=o;++c<l;){var p=e[d=a[c]],f=t[d];if(i)var b=o?i(f,p,d,t,e,s):i(p,f,d,e,t,s);if(!(void 0===b?p===f||r(p,f,n,i,s):b)){m=!1;break}g||(g="constructor"==d)}if(m&&!g){var w=e.constructor,v=t.constructor;w==v||!("constructor"in e)||!("constructor"in t)||"function"==typeof w&&w instanceof w&&"function"==typeof v&&v instanceof v||(m=!1)}return s.delete(e),s.delete(t),m}(e,t,n,i,r,s))},vd=function e(t,n,i,r,s){return t===n||(null==t||null==n||!vr(t)&&!vr(n)?t!=t&&n!=n:wd(t,n,i,r,e,s))},yd=function(e,t,n){var i=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===i?vd(e,t,void 0,n):!!i},_d=function(e){return Fo(e,5)},kd=function(e,t){return vd(e,t)},xd=new WeakMap;let Cd=!1;function Ad({view:e,element:t,text:n,isDirectHost:i=!0,keepOnFocus:r=!1}){const s=e.document;function o(n){const o={text:n,isDirectHost:i,keepOnFocus:r,hostElement:i?t:null};xd.get(s).set(t,o),e.change((e=>Ed([[t,o]],e)))}xd.has(s)||(xd.set(s,new Map),s.registerPostFixer((e=>Ed(xd.get(s),e))),s.on("change:isComposing",(()=>{e.change((e=>Ed(xd.get(s),e)))}),{priority:"high"})),t.is("editableElement")&&t.on("change:placeholder",((e,t,n)=>o(n))),t.placeholder?o(t.placeholder):n&&o(n),n&&(Cd||Ea("enableplaceholder-deprecated-text-option"),Cd=!0)}function Ed(e,t){const n=[];let i=!1;for(const[r,s]of e)s.isDirectHost&&(n.push(r),Td(t,r,s)&&(i=!0));for(const[r,s]of e){if(s.isDirectHost)continue;const e=Sd(r);e&&(n.includes(e)||(s.hostElement=e,Td(t,r,s)&&(i=!0)))}return i}function Td(e,t,n){const{text:i,isDirectHost:r,hostElement:s}=n;let o=!1;return s.getAttribute("data-placeholder")!==i&&(e.setAttribute("data-placeholder",i,s),o=!0),(r||1==t.childCount)&&function(e,t){if(!e.isAttached())return!1;if(function(e){for(const t of e.getChildren())if(!t.is("uiElement"))return!0;return!1}(e))return!1;const n=e.document,i=n.selection.anchor;return!(n.isComposing&&i&&i.parent===e||!t&&n.isFocused&&(!i||i.parent===e))}(s,n.keepOnFocus)?function(e,t){return!t.hasClass("ck-placeholder")&&(e.addClass("ck-placeholder",t),!0)}(e,s)&&(o=!0):function(e,t){return!!t.hasClass("ck-placeholder")&&(e.removeClass("ck-placeholder",t),!0)}(e,s)&&(o=!0),o}function Sd(e){if(e.childCount){const t=e.getChild(0);if(t.is("element")&&!t.is("uiElement")&&!t.is("attributeElement"))return t}return null}let Pd=class{is(){throw new Error("is() method is abstract")}},Id=class extends(Na(Pd)){document;parent;constructor(e){super(),this.document=e,this.parent=null}get index(){let e;if(!this.parent)return null;if(-1==(e=this.parent.getChildIndex(this)))throw new Aa("view-node-not-found-in-parent",this);return e}get nextSibling(){const e=this.index;return null!==e&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return null!==e&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.root.is("rootElement")}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.index),t=t.parent;return e}getAncestors(e={}){const t=[];let n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}getCommonAncestor(e,t={}){const n=this.getAncestors(t),i=e.getAncestors(t);let r=0;for(;n[r]==i[r]&&n[r];)r++;return 0===r?null:n[r-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),n=e.getPath(),i=tl(t,n);switch(i){case"prefix":return!0;case"extension":return!1;default:return t[i]<n[i]}}isAfter(e){return this!=e&&this.root===e.root&&!this.isBefore(e)}_remove(){this.parent._removeChildren(this.index)}_fireChange(e,t,n){this.fire(`change:${e}`,t,n),this.parent&&this.parent._fireChange(e,t,n)}toJSON(){const e=jc(this);return delete e.parent,e}};Id.prototype.is=function(e){return"node"===e||"view:node"===e};let Od=class e extends Id{_textData;constructor(e,t){super(e),this._textData=t}get data(){return this._textData}get _data(){return this.data}set _data(e){this._fireChange("text",this),this._textData=e}isSimilar(t){return t instanceof e&&(this===t||this.data===t.data)}_clone(){return new e(this.document,this.data)}};Od.prototype.is=function(e){return"$text"===e||"view:$text"===e||"text"===e||"view:text"===e||"node"===e||"view:node"===e};let Vd=class extends Pd{textNode;data;offsetInText;constructor(e,t,n){if(super(),this.textNode=e,t<0||t>e.data.length)throw new Aa("view-textproxy-wrong-offsetintext",this);if(n<0||t+n>e.data.length)throw new Aa("view-textproxy-wrong-length",this);this.data=e.data.substring(t,t+n),this.offsetInText=t}get offsetSize(){return this.data.length}get isPartial(){return this.data.length!==this.textNode.data.length}get parent(){return this.textNode.parent}get root(){return this.textNode.root}get document(){return this.textNode.document}getAncestors(e={}){const t=[];let n=e.includeSelf?this.textNode:this.parent;for(;null!==n;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}};Vd.prototype.is=function(e){return"$textProxy"===e||"view:$textProxy"===e||"textProxy"===e||"view:textProxy"===e};class Rd{_patterns=[];constructor(...e){this.add(...e)}add(...e){for(let t of e)("string"==typeof t||t instanceof RegExp)&&(t={name:t}),this._patterns.push(t)}match(...e){for(const t of e)for(const e of this._patterns){const n=Nd(t,e);if(n)return{element:t,pattern:e,match:n}}return null}matchAll(...e){const t=[];for(const n of e)for(const e of this._patterns){const i=Nd(n,e);i&&t.push({element:n,pattern:e,match:i})}return t.length>0?t:null}getElementName(){if(1!==this._patterns.length)return null;const e=this._patterns[0],t=e.name;return"function"==typeof e||!t||t instanceof RegExp?null:t}}function Nd(e,t){if("function"==typeof t)return t(e);const n={};return t.name&&(n.name=function(e,t){return e instanceof RegExp?!!t.match(e):e===t}(t.name,e.name),!n.name)||t.attributes&&(n.attributes=function(e,t){const n=new Set(t.getAttributeKeys());return"object"!=typeof e||e instanceof RegExp||Array.isArray(e)?(n.delete("style"),n.delete("class")):(void 0!==e.style&&Ea("matcher-pattern-deprecated-attributes-style-key",e),void 0!==e.class&&Ea("matcher-pattern-deprecated-attributes-class-key",e)),Ld(e,n,(e=>t.getAttribute(e)))}(t.attributes,e),!n.attributes)||t.classes&&(n.classes=function(e,t){return Ld(e,t.getClassNames(),(()=>{}))}(t.classes,e),!n.classes)||t.styles&&(n.styles=function(e,t){return Ld(e,t.getStyleNames(!0),(e=>t.getStyle(e)))}(t.styles,e),!n.styles)?null:n}function Ld(e,t,n){const i=function(e){if(Array.isArray(e))return e.map((e=>"object"!=typeof e||e instanceof RegExp?[e,!0]:(void 0!==e.key&&void 0!==e.value||Ea("matcher-pattern-missing-key-or-value",e),[e.key,e.value])));if("object"!=typeof e||e instanceof RegExp)return[[e,!0]];const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push([n,e[n]]);return t}(e),r=Array.from(t),s=[];if(i.forEach((([e,t])=>{r.forEach((i=>{(function(e,t){return!0===e||e===t||e instanceof RegExp&&t.match(e)})(e,i)&&function(e,t,n){if(!0===e)return!0;const i=n(t);return e===i||e instanceof RegExp&&!!String(i).match(e)}(t,i,n)&&s.push(i)}))})),i.length&&!(s.length<i.length))return s}class Md{_styles;_cachedStyleNames=null;_cachedExpandedStyleNames=null;_styleProcessor;constructor(e){this._styles={},this._styleProcessor=e}get isEmpty(){return!Object.entries(this._styles).length}get size(){return this.isEmpty?0:this.getStyleNames().length}setTo(e){this.clear();const t=function(e){let t=null,n=0,i=0,r=null;const s=new Map;if(""===e)return s;";"!=e.charAt(e.length-1)&&(e+=";");for(let o=0;o<e.length;o++){const a=e.charAt(o);if(null===t)switch(a){case":":r||(r=e.substr(n,o-n),i=o+1);break;case'"':case"'":t=a;break;case";":{const t=e.substr(i,o-i);r&&s.set(r.trim(),t.trim()),r=null,n=o+1;break}}else a===t&&(t=null)}return s}(e);for(const[e,n]of t)this._styleProcessor.toNormalizedForm(e,n,this._styles)}has(e){if(this.isEmpty)return!1;const t=this._styleProcessor.getReducedForm(e,this._styles).find((([t])=>t===e));return Array.isArray(t)}set(e,t){if(this._cachedStyleNames=null,this._cachedExpandedStyleNames=null,or(e))for(const[t,n]of Object.entries(e))this._styleProcessor.toNormalizedForm(t,n,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles)}remove(e){this._cachedStyleNames=null,this._cachedExpandedStyleNames=null;const t=Fd(e);(function(e,t){null==e||Wc(e,t)})(this._styles,t),delete this._styles[e],this._cleanEmptyObjectsOnPath(t)}getNormalized(e){return this._styleProcessor.getNormalized(e,this._styles)}toString(){return this.isEmpty?"":this.getStylesEntries().map((e=>e.join(":"))).sort().join(";")+";"}getAsString(e){if(this.isEmpty)return;if(this._styles[e]&&!or(this._styles[e]))return this._styles[e];const t=this._styleProcessor.getReducedForm(e,this._styles).find((([t])=>t===e));return Array.isArray(t)?t[1]:void 0}getStyleNames(e=!1){return this.isEmpty?[]:e?(this._cachedExpandedStyleNames=this._cachedExpandedStyleNames||this._styleProcessor.getStyleNames(this._styles),this._cachedExpandedStyleNames):(this._cachedStyleNames=this._cachedStyleNames||this.getStylesEntries().map((([e])=>e)),this._cachedStyleNames)}clear(){this._styles={},this._cachedStyleNames=null,this._cachedExpandedStyleNames=null}getStylesEntries(){const e=[],t=Object.keys(this._styles);for(const n of t)e.push(...this._styleProcessor.getReducedForm(n,this._styles));return e}_cleanEmptyObjectsOnPath(e){const t=e.split(".");if(!(t.length>1))return;const n=t.splice(0,t.length-1).join("."),i=zc(this._styles,n);i&&!Object.keys(i).length&&this.remove(n)}}class Bd{_normalizers;_extractors;_reducers;_consumables;constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,n){if(or(t))Dd(n,Fd(e),t);else if(this._normalizers.has(e)){const i=this._normalizers.get(e),{path:r,value:s}=i(t);Dd(n,r,s)}else Dd(n,e,t)}getNormalized(e,t){if(!e)return na({},t);if(void 0!==t[e])return t[e];if(this._extractors.has(e)){const n=this._extractors.get(e);if("string"==typeof n)return zc(t,n);const i=n(e,t);if(i)return i}return zc(t,Fd(e))}getReducedForm(e,t){const n=this.getNormalized(e,t);return void 0===n?[]:this._reducers.has(e)?this._reducers.get(e)(n):[[e,n]]}getStyleNames(e){const t=new Set;for(const n of this._consumables.keys()){const i=this.getNormalized(n,e);i&&("object"!=typeof i||Object.keys(i).length)&&t.add(n)}for(const n of Object.keys(e))t.add(n);return Array.from(t)}getRelatedStyles(e){return this._consumables.get(e)||[]}setNormalizer(e,t){this._normalizers.set(e,t)}setExtractor(e,t){this._extractors.set(e,t)}setReducer(e,t){this._reducers.set(e,t)}setStyleRelation(e,t){this._mapStyleNames(e,t);for(const n of t)this._mapStyleNames(n,[e])}_mapStyleNames(e,t){this._consumables.has(e)||this._consumables.set(e,[]),this._consumables.get(e).push(...t)}}function Fd(e){return e.replace("-",".")}function Dd(e,t,n){let i=n;or(n)&&(i=na({},zc(e,t),n)),$c(e,t,i)}let zd=class e extends Id{name;_unsafeAttributesToRender=[];_attrs;_children;_classes;_styles;_customProperties=new Map;constructor(e,t,n,i){if(super(e),this.name=t,this._attrs=function(e){const t=mc(e);for(const[e,n]of t)null===n?t.delete(e):"string"!=typeof n&&t.set(e,String(n));return t}(n),this._children=[],i&&this._insertChild(0,i),this._classes=new Set,this._attrs.has("class")){const e=this._attrs.get("class");$d(this._classes,e),this._attrs.delete("class")}this._styles=new Md(this.document.stylesProcessor),this._attrs.has("style")&&(this._styles.setTo(this._attrs.get("style")),this._attrs.delete("style"))}get childCount(){return this._children.length}get isEmpty(){return 0===this._children.length}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}*getAttributeKeys(){this._classes.size>0&&(yield"class"),this._styles.isEmpty||(yield"style"),yield*this._attrs.keys()}*getAttributes(){yield*this._attrs.entries(),this._classes.size>0&&(yield["class",this.getAttribute("class")]),this._styles.isEmpty||(yield["style",this.getAttribute("style")])}getAttribute(e){if("class"==e)return this._classes.size>0?[...this._classes].join(" "):void 0;if("style"==e){const e=this._styles.toString();return""==e?void 0:e}return this._attrs.get(e)}hasAttribute(e){return"class"==e?this._classes.size>0:"style"==e?!this._styles.isEmpty:this._attrs.has(e)}isSimilar(t){if(!(t instanceof e))return!1;if(this===t)return!0;if(this.name!=t.name)return!1;if(this._attrs.size!==t._attrs.size||this._classes.size!==t._classes.size||this._styles.size!==t._styles.size)return!1;for(const[e,n]of this._attrs)if(!t._attrs.has(e)||t._attrs.get(e)!==n)return!1;for(const e of this._classes)if(!t._classes.has(e))return!1;for(const e of this._styles.getStyleNames())if(!t._styles.has(e)||t._styles.getAsString(e)!==this._styles.getAsString(e))return!1;return!0}hasClass(...e){for(const t of e)if(!this._classes.has(t))return!1;return!0}getClassNames(){return this._classes.keys()}getStyle(e){return this._styles.getAsString(e)}getNormalizedStyle(e){return this._styles.getNormalized(e)}getStyleNames(e){return this._styles.getStyleNames(e)}hasStyle(...e){for(const t of e)if(!this._styles.has(t))return!1;return!0}findAncestor(...e){const t=new Rd(...e);let n=this.parent;for(;n&&!n.is("documentFragment");){if(t.match(n))return n;n=n.parent}return null}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}getIdentity(){const e=Array.from(this._classes).sort().join(","),t=this._styles.toString(),n=Array.from(this._attrs).map((e=>`${e[0]}="${e[1]}"`)).sort().join(" ");return this.name+(""==e?"":` class="${e}"`)+(t?` style="${t}"`:"")+(""==n?"":` ${n}`)}shouldRenderUnsafeAttribute(e){return this._unsafeAttributesToRender.includes(e)}_clone(e=!1){const t=[];if(e)for(const n of this.getChildren())t.push(n._clone(e));const n=new this.constructor(this.document,this.name,this._attrs,t);return n._classes=new Set(this._classes),n._styles.set(this._styles.getNormalized()),n._customProperties=new Map(this._customProperties),n.getFillerOffset=this.getFillerOffset,n._unsafeAttributesToRender=this._unsafeAttributesToRender,n}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange("children",this,{index:e});let n=0;const i=function(e,t){if("string"==typeof t)return[new Od(e,t)];nl(t)||(t=[t]);const n=[];for(const i of t)"string"==typeof i?n.push(new Od(e,i)):i instanceof Vd?n.push(new Od(e,i.data)):n.push(i);return n}(this.document,t);for(const t of i)null!==t.parent&&t._remove(),t.parent=this,t.document=this.document,this._children.splice(e,0,t),e++,n++;return n}_removeChildren(e,t=1){this._fireChange("children",this,{index:e});for(let n=e;n<e+t;n++)this._children[n].parent=null;return this._children.splice(e,t)}_setAttribute(e,t){const n=String(t);this._fireChange("attributes",this),"class"==e?$d(this._classes,n):"style"==e?this._styles.setTo(n):this._attrs.set(e,n)}_removeAttribute(e){return this._fireChange("attributes",this),"class"==e?this._classes.size>0&&(this._classes.clear(),!0):"style"==e?!this._styles.isEmpty&&(this._styles.clear(),!0):this._attrs.delete(e)}_addClass(e){this._fireChange("attributes",this);for(const t of rc(e))this._classes.add(t)}_removeClass(e){this._fireChange("attributes",this);for(const t of rc(e))this._classes.delete(t)}_setStyle(e,t){this._fireChange("attributes",this),"string"!=typeof e?this._styles.set(e):this._styles.set(e,t)}_removeStyle(e){this._fireChange("attributes",this);for(const t of rc(e))this._styles.remove(t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}};function $d(e,t){const n=t.split(/\s+/);e.clear(),n.forEach((t=>e.add(t)))}zd.prototype.is=function(e,t){return t?t===this.name&&("element"===e||"view:element"===e):"element"===e||"view:element"===e||"node"===e||"view:node"===e};class jd extends zd{constructor(e,t,n,i){super(e,t,n,i),this.getFillerOffset=Hd}}function Hd(){const e=[...this.getChildren()],t=e[this.childCount-1];if(t&&t.is("element","br"))return this.childCount;for(const t of e)if(!t.is("uiElement"))return null;return this.childCount}jd.prototype.is=function(e,t){return t?t===this.name&&("containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};class Wd extends(Ga(jd)){constructor(e,t,n,i){super(e,t,n,i),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("placeholder",void 0),this.bind("isReadOnly").to(e),this.bind("isFocused").to(e,"isFocused",(t=>t&&e.selection.editableElement==this)),this.listenTo(e.selection,"change",(()=>{this.isFocused=e.isFocused&&e.selection.editableElement==this}))}destroy(){this.stopListening()}}Wd.prototype.is=function(e,t){return t?t===this.name&&("editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};const Ud=Symbol("rootName");class qd extends Wd{constructor(e,t){super(e,t),this.rootName="main"}get rootName(){return this.getCustomProperty(Ud)}set rootName(e){this._setCustomProperty(Ud,e)}set _name(e){this.name=e}}qd.prototype.is=function(e,t){return t?t===this.name&&("rootElement"===e||"view:rootElement"===e||"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"rootElement"===e||"view:rootElement"===e||"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};let Gd=class{direction;boundaries;singleCharacters;shallow;ignoreElementEnd;_position;_boundaryStartParent;_boundaryEndParent;constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new Aa("view-tree-walker-no-start-position",null);if(e.direction&&"forward"!=e.direction&&"backward"!=e.direction)throw new Aa("view-tree-walker-unknown-direction",e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,e.startPosition?this._position=Kd._createAt(e.startPosition):this._position=Kd._createAt(e.boundaries["backward"==e.direction?"end":"start"]),this.direction=e.direction||"forward",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null}[Symbol.iterator](){return this}get position(){return this._position}skip(e){let t,n;do{n=this.position,t=this.next()}while(!t.done&&e(t.value));t.done||(this._position=n)}jumpTo(e){this._boundaryStartParent&&e.isBefore(this.boundaries.start)?e=this.boundaries.start:this._boundaryEndParent&&e.isAfter(this.boundaries.end)&&(e=this.boundaries.end),this._position=e.clone()}next(){return"forward"==this.direction?this._next():this._previous()}_next(){let e=this.position.clone();const t=this.position,n=e.parent;if(null===n.parent&&e.offset===n.childCount)return{done:!0,value:void 0};if(n===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0,value:void 0};let i;if(n&&n.is("view:$text")){if(e.isAtEnd)return this._position=Kd._createAfter(n),this._next();i=n.data[e.offset]}else i=n.getChild(e.offset);if("string"==typeof i){let i;i=this.singleCharacters?1:(n===this._boundaryEndParent?this.boundaries.end.offset:n.data.length)-e.offset;const r=new Vd(n,e.offset,i);return e.offset+=i,this._position=e,this._formatReturnValue("text",r,t,e,i)}if(i&&i.is("view:element")){if(this.shallow){if(this.boundaries&&this.boundaries.end.isBefore(e))return{done:!0,value:void 0};e.offset++}else e=new Kd(i,0);return this._position=e,this._formatReturnValue("elementStart",i,t,e,1)}if(i&&i.is("view:$text")){if(this.singleCharacters)return e=new Kd(i,0),this._position=e,this._next();let n,r=i.data.length;return i==this._boundaryEndParent?(r=this.boundaries.end.offset,n=new Vd(i,0,r),e=Kd._createAfter(n)):(n=new Vd(i,0,i.data.length),e.offset++),this._position=e,this._formatReturnValue("text",n,t,e,r)}return e=Kd._createAfter(n),this._position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",n,t,e)}_previous(){let e=this.position.clone();const t=this.position,n=e.parent;if(null===n.parent&&0===e.offset)return{done:!0,value:void 0};if(n==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0,value:void 0};let i;if(n.is("view:$text")){if(e.isAtStart)return this._position=Kd._createBefore(n),this._previous();i=n.data[e.offset-1]}else i=n.getChild(e.offset-1);if("string"==typeof i){let i;if(this.singleCharacters)i=1;else{const t=n===this._boundaryStartParent?this.boundaries.start.offset:0;i=e.offset-t}e.offset-=i;const r=new Vd(n,e.offset,i);return this._position=e,this._formatReturnValue("text",r,t,e,i)}if(i&&i.is("view:element"))return this.shallow?(e.offset--,this._position=e,this._formatReturnValue("elementStart",i,t,e,1)):(e=new Kd(i,i.childCount),this._position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",i,t,e));if(i&&i.is("view:$text")){if(this.singleCharacters)return e=new Kd(i,i.data.length),this._position=e,this._previous();let n,r=i.data.length;if(i==this._boundaryStartParent){const t=this.boundaries.start.offset;n=new Vd(i,t,i.data.length-t),r=n.data.length,e=Kd._createBefore(n)}else n=new Vd(i,0,i.data.length),e.offset--;return this._position=e,this._formatReturnValue("text",n,t,e,r)}return e=Kd._createBefore(n),this._position=e,this._formatReturnValue("elementStart",n,t,e,1)}_formatReturnValue(e,t,n,i,r){return t.is("view:$textProxy")&&(t.offsetInText+t.data.length==t.textNode.data.length&&("forward"!=this.direction||this.boundaries&&this.boundaries.end.isEqual(this.position)?n=Kd._createAfter(t.textNode):(i=Kd._createAfter(t.textNode),this._position=i)),0===t.offsetInText&&("backward"!=this.direction||this.boundaries&&this.boundaries.start.isEqual(this.position)?n=Kd._createBefore(t.textNode):(i=Kd._createBefore(t.textNode),this._position=i))),{done:!1,value:{type:e,item:t,previousPosition:n,nextPosition:i,length:r}}}},Kd=class e extends Pd{parent;offset;constructor(e,t){super(),this.parent=e,this.offset=t}get nodeAfter(){return this.parent.is("$text")?null:this.parent.getChild(this.offset)||null}get nodeBefore(){return this.parent.is("$text")?null:this.parent.getChild(this.offset-1)||null}get isAtStart(){return 0===this.offset}get isAtEnd(){const e=this.parent.is("$text")?this.parent.data.length:this.parent.childCount;return this.offset===e}get root(){return this.parent.root}get editableElement(){let e=this.parent;for(;!(e instanceof Wd);){if(!e.parent)return null;e=e.parent}return e}getShiftedBy(t){const n=e._createAt(this),i=n.offset+t;return n.offset=i<0?0:i,n}getLastMatchingPosition(e,t={}){t.startPosition=this;const n=new Gd(t);return n.skip(e),n.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const t=this.getAncestors(),n=e.getAncestors();let i=0;for(;t[i]==n[i]&&t[i];)i++;return 0===i?null:t[i-1]}isEqual(e){return this.parent==e.parent&&this.offset==e.offset}isBefore(e){return"before"==this.compareWith(e)}isAfter(e){return"after"==this.compareWith(e)}compareWith(e){if(this.root!==e.root)return"different";if(this.isEqual(e))return"same";const t=this.parent.is("node")?this.parent.getPath():[],n=e.parent.is("node")?e.parent.getPath():[];t.push(this.offset),n.push(e.offset);const i=tl(t,n);switch(i){case"prefix":return"before";case"extension":return"after";default:return t[i]<n[i]?"before":"after"}}getWalker(e={}){return e.startPosition=this,new Gd(e)}clone(){return new e(this.parent,this.offset)}static _createAt(t,n){if(t instanceof e)return new this(t.parent,t.offset);{const i=t;if("end"==n)n=i.is("$text")?i.data.length:i.childCount;else{if("before"==n)return this._createBefore(i);if("after"==n)return this._createAfter(i);if(0!==n&&!n)throw new Aa("view-createpositionat-offset-required",i)}return new e(i,n)}}static _createAfter(t){if(t.is("$textProxy"))return new e(t.textNode,t.offsetInText+t.data.length);if(!t.parent)throw new Aa("view-position-after-root",t,{root:t});return new e(t.parent,t.index+1)}static _createBefore(t){if(t.is("$textProxy"))return new e(t.textNode,t.offsetInText);if(!t.parent)throw new Aa("view-position-before-root",t,{root:t});return new e(t.parent,t.index)}};Kd.prototype.is=function(e){return"position"===e||"view:position"===e};let Zd=class e extends Pd{start;end;constructor(e,t=null){super(),this.start=e.clone(),this.end=t?t.clone():e.clone()}*[Symbol.iterator](){yield*new Gd({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return this.start.parent===this.end.parent}get root(){return this.start.root}getEnlarged(){let t=this.start.getLastMatchingPosition(Qd,{direction:"backward"}),n=this.end.getLastMatchingPosition(Qd);return t.parent.is("$text")&&t.isAtStart&&(t=Kd._createBefore(t.parent)),n.parent.is("$text")&&n.isAtEnd&&(n=Kd._createAfter(n.parent)),new e(t,n)}getTrimmed(){let t=this.start.getLastMatchingPosition(Qd);if(t.isAfter(this.end)||t.isEqual(this.end))return new e(t,t);let n=this.end.getLastMatchingPosition(Qd,{direction:"backward"});const i=t.nodeAfter,r=n.nodeBefore;return i&&i.is("$text")&&(t=new Kd(i,0)),r&&r.is("$text")&&(n=new Kd(r,r.data.length)),new e(t,n)}isEqual(e){return this==e||this.start.isEqual(e.start)&&this.end.isEqual(e.end)}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const n=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),i=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return n&&i}getDifference(t){const n=[];return this.isIntersecting(t)?(this.containsPosition(t.start)&&n.push(new e(this.start,t.start)),this.containsPosition(t.end)&&n.push(new e(t.end,this.end))):n.push(this.clone()),n}getIntersection(t){if(this.isIntersecting(t)){let n=this.start,i=this.end;return this.containsPosition(t.start)&&(n=t.start),this.containsPosition(t.end)&&(i=t.end),new e(n,i)}return null}getWalker(e={}){return e.boundaries=this,new Gd(e)}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;let e=this.start.nodeAfter,t=this.end.nodeBefore;return this.start.parent.is("$text")&&this.start.isAtEnd&&this.start.parent.nextSibling&&(e=this.start.parent.nextSibling),this.end.parent.is("$text")&&this.end.isAtStart&&this.end.parent.previousSibling&&(t=this.end.parent.previousSibling),e&&e.is("element")&&e===t?e:null}clone(){return new e(this.start,this.end)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new Gd(e);for(const e of t)yield e.item}*getPositions(e={}){e.boundaries=this;const t=new Gd(e);yield t.position;for(const e of t)yield e.nextPosition}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}static _createFromParentsAndOffsets(e,t,n,i){return new this(new Kd(e,t),new Kd(n,i))}static _createFromPositionAndShift(e,t){const n=e,i=e.getShiftedBy(t);return t>0?new this(n,i):new this(i,n)}static _createIn(e){return this._createFromParentsAndOffsets(e,0,e,e.childCount)}static _createOn(e){const t=e.is("$textProxy")?e.offsetSize:1;return this._createFromPositionAndShift(Kd._createBefore(e),t)}};function Qd(e){return!(!e.item.is("attributeElement")&&!e.item.is("uiElement"))}Zd.prototype.is=function(e){return"range"===e||"view:range"===e};let Yd=class e extends(Na(Pd)){_ranges;_lastRangeBackward;_isFake;_fakeSelectionLabel;constructor(...e){super(),this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",e.length&&this.setTo(...e)}get isFake(){return this._isFake}get fakeSelectionLabel(){return this._fakeSelectionLabel}get anchor(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.end:e.start).clone()}get focus(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.start:e.end).clone()}get isCollapsed(){return 1===this.rangeCount&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}get editableElement(){return this.anchor?this.anchor.editableElement:null}*getRanges(){for(const e of this._ranges)yield e.clone()}getFirstRange(){let e=null;for(const t of this._ranges)e&&!t.start.isBefore(e.start)||(e=t);return e?e.clone():null}getLastRange(){let e=null;for(const t of this._ranges)e&&!t.end.isAfter(e.end)||(e=t);return e?e.clone():null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}isEqual(e){if(this.isFake!=e.isFake)return!1;if(this.isFake&&this.fakeSelectionLabel!=e.fakeSelectionLabel)return!1;if(this.rangeCount!=e.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let n=!1;for(const i of e._ranges)if(t.isEqual(i)){n=!0;break}if(!n)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const t=el(this.getRanges());if(t!=el(e.getRanges()))return!1;if(0==t)return!0;for(let t of this.getRanges()){t=t.getTrimmed();let n=!1;for(let i of e.getRanges())if(i=i.getTrimmed(),t.start.isEqual(i.start)&&t.end.isEqual(i.end)){n=!0;break}if(!n)return!1}return!0}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}setTo(...t){let[n,i,r]=t;if("object"==typeof i&&(r=i,i=void 0),null===n)this._setRanges([]),this._setFakeOptions(r);else if(n instanceof e||n instanceof Jd)this._setRanges(n.getRanges(),n.isBackward),this._setFakeOptions({fake:n.isFake,label:n.fakeSelectionLabel});else if(n instanceof Zd)this._setRanges([n],r&&r.backward),this._setFakeOptions(r);else if(n instanceof Kd)this._setRanges([new Zd(n)]),this._setFakeOptions(r);else if(n instanceof Id){const e=!!r&&!!r.backward;let t;if(void 0===i)throw new Aa("view-selection-setto-required-second-parameter",this);t="in"==i?Zd._createIn(n):"on"==i?Zd._createOn(n):new Zd(Kd._createAt(n,i)),this._setRanges([t],e),this._setFakeOptions(r)}else{if(!nl(n))throw new Aa("view-selection-setto-not-selectable",this);this._setRanges(n,r&&r.backward),this._setFakeOptions(r)}this.fire("change")}setFocus(e,t){if(null===this.anchor)throw new Aa("view-selection-setfocus-no-ranges",this);const n=Kd._createAt(e,t);if("same"==n.compareWith(this.focus))return;const i=this.anchor;this._ranges.pop(),"before"==n.compareWith(i)?this._addRange(new Zd(n,i),!0):this._addRange(new Zd(i,n)),this.fire("change")}_setRanges(e,t=!1){e=Array.from(e),this._ranges=[];for(const t of e)this._addRange(t);this._lastRangeBackward=!!t}_setFakeOptions(e={}){this._isFake=!!e.fake,this._fakeSelectionLabel=e.fake&&e.label||""}_addRange(e,t=!1){if(!(e instanceof Zd))throw new Aa("view-selection-add-range-not-range",this);this._pushRange(e),this._lastRangeBackward=!!t}_pushRange(e){for(const t of this._ranges)if(e.isIntersecting(t))throw new Aa("view-selection-range-intersects",this,{addedRange:e,intersectingRange:t});this._ranges.push(new Zd(e.start,e.end))}};Yd.prototype.is=function(e){return"selection"===e||"view:selection"===e};let Jd=class extends(Na(Pd)){_selection;constructor(...e){super(),this._selection=new Yd,this._selection.delegate("change").to(this),e.length&&this._selection.setTo(...e)}get isFake(){return this._selection.isFake}get fakeSelectionLabel(){return this._selection.fakeSelectionLabel}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get isCollapsed(){return this._selection.isCollapsed}get rangeCount(){return this._selection.rangeCount}get isBackward(){return this._selection.isBackward}get editableElement(){return this._selection.editableElement}get _ranges(){return this._selection._ranges}*getRanges(){yield*this._selection.getRanges()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getSelectedElement(){return this._selection.getSelectedElement()}isEqual(e){return this._selection.isEqual(e)}isSimilar(e){return this._selection.isSimilar(e)}_setTo(...e){this._selection.setTo(...e)}_setFocus(e,t){this._selection.setFocus(e,t)}};Jd.prototype.is=function(e){return"selection"===e||"documentSelection"==e||"view:selection"==e||"view:documentSelection"==e};class Xd extends ya{startRange;_eventPhase;_currentTarget;constructor(e,t,n){super(e,t),this.startRange=n,this._eventPhase="none",this._currentTarget=null}get eventPhase(){return this._eventPhase}get currentTarget(){return this._currentTarget}}const eu=Symbol("bubbling contexts");function tu(e){return class extends e{fire(e,...t){try{const n=e instanceof ya?e:new ya(this,e),i=su(this);if(!i.size)return;if(nu(n,"capturing",this),iu(i,"$capture",n,...t))return n.return;const r=n.startRange||this.selection.getFirstRange(),s=r?r.getContainedElement():null,o=!!s&&Boolean(ru(i,s));let a=s||function(e){if(!e)return null;const t=e.start.parent,n=e.end.parent,i=t.getPath(),r=n.getPath();return i.length>r.length?t:n}(r);if(nu(n,"atTarget",a),!o){if(iu(i,"$text",n,...t))return n.return;nu(n,"bubbling",a)}for(;a;){if(a.is("rootElement")){if(iu(i,"$root",n,...t))return n.return}else if(a.is("element")&&iu(i,a.name,n,...t))return n.return;if(iu(i,a,n,...t))return n.return;a=a.parent,nu(n,"bubbling",a)}return nu(n,"bubbling",this),iu(i,"$document",n,...t),n.return}catch(e){Aa.rethrowUnexpectedError(e,this)}}_addEventListener(e,t,n){const i=rc(n.context||"$document"),r=su(this);for(const s of i){let i=r.get(s);i||(i=new(Na()),r.set(s,i)),this.listenTo(i,e,t,n)}}_removeEventListener(e,t){const n=su(this);for(const i of n.values())this.stopListening(i,e,t)}}}{const e=tu(Object);["fire","_addEventListener","_removeEventListener"].forEach((t=>{tu[t]=e.prototype[t]}))}function nu(e,t,n){e instanceof Xd&&(e._eventPhase=t,e._currentTarget=n)}function iu(e,t,n,...i){const r="string"==typeof t?e.get(t):ru(e,t);return!!r&&(r.fire(n,...i),n.stop.called)}function ru(e,t){for(const[n,i]of e)if("function"==typeof n&&n(t))return i;return null}function su(e){return e[eu]||(e[eu]=new Map),e[eu]}let ou=class extends(tu(Ga())){selection;roots;stylesProcessor;_postFixers=new Set;constructor(e){super(),this.selection=new Jd,this.roots=new oc({idProperty:"rootName"}),this.stylesProcessor=e,this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isSelecting",!1),this.set("isComposing",!1)}getRoot(e="main"){return this.roots.get(e)}registerPostFixer(e){this._postFixers.add(e)}destroy(){this.roots.forEach((e=>e.destroy())),this.stopListening()}_callPostFixers(e){let t=!1;do{for(const n of this._postFixers)if(t=n(e),t)break}while(t)}};class au extends zd{static DEFAULT_PRIORITY=10;_priority=10;_id=null;_clonesGroup=null;constructor(e,t,n,i){super(e,t,n,i),this.getFillerOffset=lu}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(null===this.id)throw new Aa("attribute-element-get-elements-with-same-id-no-id",this);return new Set(this._clonesGroup)}isSimilar(e){return null!==this.id||null!==e.id?this.id===e.id:super.isSimilar(e)&&this.priority==e.priority}_clone(e=!1){const t=super._clone(e);return t._priority=this._priority,t._id=this._id,t}}function lu(){if(cu(this))return null;let e=this.parent;for(;e&&e.is("attributeElement");){if(cu(e)>1)return null;e=e.parent}return!e||cu(e)>1?null:this.childCount}function cu(e){return Array.from(e.getChildren()).filter((e=>!e.is("uiElement"))).length}au.prototype.is=function(e,t){return t?t===this.name&&("attributeElement"===e||"view:attributeElement"===e||"element"===e||"view:element"===e):"attributeElement"===e||"view:attributeElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};class du extends zd{constructor(e,t,n,i){super(e,t,n,i),this.getFillerOffset=uu}_insertChild(e,t){if(t&&(t instanceof Id||Array.from(t).length>0))throw new Aa("view-emptyelement-cannot-add",[this,t]);return 0}}function uu(){return null}du.prototype.is=function(e,t){return t?t===this.name&&("emptyElement"===e||"view:emptyElement"===e||"element"===e||"view:element"===e):"emptyElement"===e||"view:emptyElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};class hu extends zd{constructor(e,t,n,i){super(e,t,n,i),this.getFillerOffset=mu}_insertChild(e,t){if(t&&(t instanceof Id||Array.from(t).length>0))throw new Aa("view-uielement-cannot-add",[this,t]);return 0}render(e,t){return this.toDomElement(e)}toDomElement(e){const t=e.createElement(this.name);for(const e of this.getAttributeKeys())t.setAttribute(e,this.getAttribute(e));return t}}function mu(){return null}hu.prototype.is=function(e,t){return t?t===this.name&&("uiElement"===e||"view:uiElement"===e||"element"===e||"view:element"===e):"uiElement"===e||"view:uiElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};class gu extends zd{constructor(e,t,n,i){super(e,t,n,i),this.getFillerOffset=pu}_insertChild(e,t){if(t&&(t instanceof Id||Array.from(t).length>0))throw new Aa("view-rawelement-cannot-add",[this,t]);return 0}render(e,t){}}function pu(){return null}gu.prototype.is=function(e,t){return t?t===this.name&&("rawElement"===e||"view:rawElement"===e||"element"===e||"view:element"===e):"rawElement"===e||"view:rawElement"===e||e===this.name||e==="view:"+this.name||"element"===e||"view:element"===e||"node"===e||"view:node"===e};let fu=class extends(Na(Pd)){document;_children=[];_customProperties=new Map;constructor(e,t){super(),this.document=e,t&&this._insertChild(0,t)}[Symbol.iterator](){return this._children[Symbol.iterator]()}get childCount(){return this._children.length}get isEmpty(){return 0===this.childCount}get root(){return this}get parent(){return null}get name(){}get getFillerOffset(){}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}_appendChild(e){return this._insertChild(this.childCount,e)}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}_insertChild(e,t){this._fireChange("children",this,{index:e});let n=0;const i=function(e,t){return"string"==typeof t?[new Od(e,t)]:(nl(t)||(t=[t]),Array.from(t).map((t=>"string"==typeof t?new Od(e,t):t instanceof Vd?new Od(e,t.data):t)))}(this.document,t);for(const t of i)null!==t.parent&&t._remove(),t.parent=this,this._children.splice(e,0,t),e++,n++;return n}_removeChildren(e,t=1){this._fireChange("children",this,{index:e});for(let n=e;n<e+t;n++)this._children[n].parent=null;return this._children.splice(e,t)}_fireChange(e,t,n){this.fire(`change:${e}`,t,n)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}};fu.prototype.is=function(e){return"documentFragment"===e||"view:documentFragment"===e};class bu{document;_cloneGroups=new Map;_slotFactory=null;constructor(e){this.document=e}setSelection(...e){this.document.selection._setTo(...e)}setSelectionFocus(e,t){this.document.selection._setFocus(e,t)}createDocumentFragment(e){return new fu(this.document,e)}createText(e){return new Od(this.document,e)}createAttributeElement(e,t,n={}){const i=new au(this.document,e,t);return"number"==typeof n.priority&&(i._priority=n.priority),n.id&&(i._id=n.id),n.renderUnsafeAttributes&&i._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),i}createContainerElement(e,t,n={},i={}){let r=null;Sr(n)?i=n:r=n;const s=new jd(this.document,e,t,r);return i.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),s}createEditableElement(e,t,n={}){const i=new Wd(this.document,e,t);return n.renderUnsafeAttributes&&i._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),i}createEmptyElement(e,t,n={}){const i=new du(this.document,e,t);return n.renderUnsafeAttributes&&i._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),i}createUIElement(e,t,n){const i=new hu(this.document,e,t);return n&&(i.render=n),i}createRawElement(e,t,n,i={}){const r=new gu(this.document,e,t);return n&&(r.render=n),i.renderUnsafeAttributes&&r._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),r}setAttribute(e,t,n){n._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,n){Sr(e)&&void 0===n?t._setStyle(e):n._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,n){n._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}breakAttributes(e){return e instanceof Kd?this._breakAttributes(e):this._breakAttributesRange(e)}breakContainer(e){const t=e.parent;if(!t.is("containerElement"))throw new Aa("view-writer-break-non-container-element",this.document);if(!t.parent)throw new Aa("view-writer-break-root",this.document);if(e.isAtStart)return Kd._createBefore(t);if(!e.isAtEnd){const n=t._clone(!1);this.insert(Kd._createAfter(t),n);const i=new Zd(e,Kd._createAt(t,"end")),r=new Kd(n,0);this.move(i,r)}return Kd._createAfter(t)}mergeAttributes(e){const t=e.offset,n=e.parent;if(n.is("$text"))return e;if(n.is("attributeElement")&&0===n.childCount){const e=n.parent,t=n.index;return n._remove(),this._removeFromClonedElementsGroup(n),this.mergeAttributes(new Kd(e,t))}const i=n.getChild(t-1),r=n.getChild(t);if(!i||!r)return e;if(i.is("$text")&&r.is("$text"))return _u(i,r);if(i.is("attributeElement")&&r.is("attributeElement")&&i.isSimilar(r)){const e=i.childCount;return i._appendChild(r.getChildren()),r._remove(),this._removeFromClonedElementsGroup(r),this.mergeAttributes(new Kd(i,e))}return e}mergeContainers(e){const t=e.nodeBefore,n=e.nodeAfter;if(!(t&&n&&t.is("containerElement")&&n.is("containerElement")))throw new Aa("view-writer-merge-containers-invalid-position",this.document);const i=t.getChild(t.childCount-1),r=i instanceof Od?Kd._createAt(i,"end"):Kd._createAt(t,"end");return this.move(Zd._createIn(n),Kd._createAt(t,"end")),this.remove(Zd._createOn(n)),r}insert(e,t){xu(t=nl(t)?[...t]:[t],this.document);const n=t.reduce(((e,t)=>{const n=e[e.length-1],i=!t.is("uiElement");return n&&n.breakAttributes==i?n.nodes.push(t):e.push({breakAttributes:i,nodes:[t]}),e}),[]);let i=null,r=e;for(const{nodes:e,breakAttributes:t}of n){const n=this._insertNodes(r,e,t);i||(i=n.start),r=n.end}return i?new Zd(i,r):new Zd(e)}remove(e){const t=e instanceof Zd?e:Zd._createOn(e);if(Au(t,this.document),t.isCollapsed)return new fu(this.document);const{start:n,end:i}=this._breakAttributesRange(t,!0),r=n.parent,s=i.offset-n.offset,o=r._removeChildren(n.offset,s);for(const e of o)this._removeFromClonedElementsGroup(e);const a=this.mergeAttributes(n);return t.start=a,t.end=a.clone(),new fu(this.document,o)}clear(e,t){Au(e,this.document);const n=e.getWalker({direction:"backward",ignoreElementEnd:!0});for(const i of n){const n=i.item;let r;if(n.is("element")&&t.isSimilar(n))r=Zd._createOn(n);else if(!i.nextPosition.isAfter(e.start)&&n.is("$textProxy")){const e=n.getAncestors().find((e=>e.is("element")&&t.isSimilar(e)));e&&(r=Zd._createIn(e))}r&&(r.end.isAfter(e.end)&&(r.end=e.end),r.start.isBefore(e.start)&&(r.start=e.start),this.remove(r))}}move(e,t){let n;if(t.isAfter(e.end)){const i=(t=this._breakAttributes(t,!0)).parent,r=i.childCount;e=this._breakAttributesRange(e,!0),n=this.remove(e),t.offset+=i.childCount-r}else n=this.remove(e);return this.insert(t,n)}wrap(e,t){if(!(t instanceof au))throw new Aa("view-writer-wrap-invalid-attribute",this.document);if(Au(e,this.document),e.isCollapsed){let i=e.start;i.parent.is("element")&&(n=i.parent,!Array.from(n.getChildren()).some((e=>!e.is("uiElement"))))&&(i=i.getLastMatchingPosition((e=>e.item.is("uiElement")))),i=this._wrapPosition(i,t);const r=this.document.selection;return r.isCollapsed&&r.getFirstPosition().isEqual(e.start)&&this.setSelection(i),new Zd(i)}return this._wrapRange(e,t);var n}unwrap(e,t){if(!(t instanceof au))throw new Aa("view-writer-unwrap-invalid-attribute",this.document);if(Au(e,this.document),e.isCollapsed)return e;const{start:n,end:i}=this._breakAttributesRange(e,!0),r=n.parent,s=this._unwrapChildren(r,n.offset,i.offset,t),o=this.mergeAttributes(s.start);o.isEqual(s.start)||s.end.offset--;const a=this.mergeAttributes(s.end);return new Zd(o,a)}rename(e,t){const n=new jd(this.document,e,t.getAttributes());return this.insert(Kd._createAfter(t),n),this.move(Zd._createIn(t),Kd._createAt(n,0)),this.remove(Zd._createOn(t)),n}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,t){return Kd._createAt(e,t)}createPositionAfter(e){return Kd._createAfter(e)}createPositionBefore(e){return Kd._createBefore(e)}createRange(e,t){return new Zd(e,t)}createRangeOn(e){return Zd._createOn(e)}createRangeIn(e){return Zd._createIn(e)}createSelection(...e){return new Yd(...e)}createSlot(e="children"){if(!this._slotFactory)throw new Aa("view-writer-invalid-create-slot-context",this.document);return this._slotFactory(this,e)}_registerSlotFactory(e){this._slotFactory=e}_clearSlotFactory(){this._slotFactory=null}_insertNodes(e,t,n){let i,r;if(i=n?wu(e):e.parent.is("$text")?e.parent.parent:e.parent,!i)throw new Aa("view-writer-invalid-position-container",this.document);r=n?this._breakAttributes(e,!0):e.parent.is("$text")?yu(e):e;const s=i._insertChild(r.offset,t);for(const e of t)this._addToClonedElementsGroup(e);const o=r.getShiftedBy(s),a=this.mergeAttributes(r);a.isEqual(r)||o.offset--;const l=this.mergeAttributes(o);return new Zd(a,l)}_wrapChildren(e,t,n,i){let r=t;const s=[];for(;r<n;){const t=e.getChild(r),n=t.is("$text"),l=t.is("attributeElement");if(l&&this._wrapAttributeElement(i,t))s.push(new Kd(e,r));else if(n||!l||(a=t,(o=i).priority<a.priority||!(o.priority>a.priority)&&o.getIdentity()<a.getIdentity())){const n=i._clone();t._remove(),n._appendChild(t),e._insertChild(r,n),this._addToClonedElementsGroup(n),s.push(new Kd(e,r))}else this._wrapChildren(t,0,t.childCount,i);r++}var o,a;let l=0;for(const e of s)e.offset-=l,e.offset!=t&&(this.mergeAttributes(e).isEqual(e)||(l++,n--));return Zd._createFromParentsAndOffsets(e,t,e,n)}_unwrapChildren(e,t,n,i){let r=t;const s=[];for(;r<n;){const t=e.getChild(r);if(t.is("attributeElement"))if(t.isSimilar(i)){const i=t.getChildren(),o=t.childCount;t._remove(),e._insertChild(r,i),this._removeFromClonedElementsGroup(t),s.push(new Kd(e,r),new Kd(e,r+o)),r+=o,n+=o-1}else this._unwrapAttributeElement(i,t)?(s.push(new Kd(e,r),new Kd(e,r+1)),r++):(this._unwrapChildren(t,0,t.childCount,i),r++);else r++}let o=0;for(const e of s)e.offset-=o,e.offset!=t&&e.offset!=n&&(this.mergeAttributes(e).isEqual(e)||(o++,n--));return Zd._createFromParentsAndOffsets(e,t,e,n)}_wrapRange(e,t){const{start:n,end:i}=this._breakAttributesRange(e,!0),r=n.parent,s=this._wrapChildren(r,n.offset,i.offset,t),o=this.mergeAttributes(s.start);o.isEqual(s.start)||s.end.offset--;const a=this.mergeAttributes(s.end);return new Zd(o,a)}_wrapPosition(e,t){if(t.isSimilar(e.parent))return vu(e.clone());e.parent.is("$text")&&(e=yu(e));const n=this.createAttributeElement("_wrapPosition-fake-element");n._priority=Number.POSITIVE_INFINITY,n.isSimilar=()=>!1,e.parent._insertChild(e.offset,n);const i=new Zd(e,e.getShiftedBy(1));this.wrap(i,t);const r=new Kd(n.parent,n.index);n._remove();const s=r.nodeBefore,o=r.nodeAfter;return s&&s.is("view:$text")&&o&&o.is("view:$text")?_u(s,o):vu(r)}_wrapAttributeElement(e,t){if(!Eu(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const n of e.getAttributeKeys())if("class"!==n&&"style"!==n&&t.hasAttribute(n)&&t.getAttribute(n)!==e.getAttribute(n))return!1;for(const n of e.getStyleNames())if(t.hasStyle(n)&&t.getStyle(n)!==e.getStyle(n))return!1;for(const n of e.getAttributeKeys())"class"!==n&&"style"!==n&&(t.hasAttribute(n)||this.setAttribute(n,e.getAttribute(n),t));for(const n of e.getStyleNames())t.hasStyle(n)||this.setStyle(n,e.getStyle(n),t);for(const n of e.getClassNames())t.hasClass(n)||this.addClass(n,t);return!0}_unwrapAttributeElement(e,t){if(!Eu(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const n of e.getAttributeKeys())if("class"!==n&&"style"!==n&&(!t.hasAttribute(n)||t.getAttribute(n)!==e.getAttribute(n)))return!1;if(!t.hasClass(...e.getClassNames()))return!1;for(const n of e.getStyleNames())if(!t.hasStyle(n)||t.getStyle(n)!==e.getStyle(n))return!1;for(const n of e.getAttributeKeys())"class"!==n&&"style"!==n&&this.removeAttribute(n,t);return this.removeClass(Array.from(e.getClassNames()),t),this.removeStyle(Array.from(e.getStyleNames()),t),!0}_breakAttributesRange(e,t=!1){const n=e.start,i=e.end;if(Au(e,this.document),e.isCollapsed){const n=this._breakAttributes(e.start,t);return new Zd(n,n)}const r=this._breakAttributes(i,t),s=r.parent.childCount,o=this._breakAttributes(n,t);return r.offset+=r.parent.childCount-s,new Zd(o,r)}_breakAttributes(e,t=!1){const n=e.offset,i=e.parent;if(e.parent.is("emptyElement"))throw new Aa("view-writer-cannot-break-empty-element",this.document);if(e.parent.is("uiElement"))throw new Aa("view-writer-cannot-break-ui-element",this.document);if(e.parent.is("rawElement"))throw new Aa("view-writer-cannot-break-raw-element",this.document);if(!t&&i.is("$text")&&Cu(i.parent))return e.clone();if(Cu(i))return e.clone();if(i.is("$text"))return this._breakAttributes(yu(e),t);if(n==i.childCount){const e=new Kd(i.parent,i.index+1);return this._breakAttributes(e,t)}if(0===n){const e=new Kd(i.parent,i.index);return this._breakAttributes(e,t)}{const e=i.index+1,r=i._clone();i.parent._insertChild(e,r),this._addToClonedElementsGroup(r);const s=i.childCount-n,o=i._removeChildren(n,s);r._appendChild(o);const a=new Kd(i.parent,e);return this._breakAttributes(a,t)}}_addToClonedElementsGroup(e){if(!e.root.is("rootElement"))return;if(e.is("element"))for(const t of e.getChildren())this._addToClonedElementsGroup(t);const t=e.id;if(!t)return;let n=this._cloneGroups.get(t);n||(n=new Set,this._cloneGroups.set(t,n)),n.add(e),e._clonesGroup=n}_removeFromClonedElementsGroup(e){if(e.is("element"))for(const t of e.getChildren())this._removeFromClonedElementsGroup(t);const t=e.id;if(!t)return;const n=this._cloneGroups.get(t);n&&n.delete(e)}}function wu(e){let t=e.parent;for(;!Cu(t);){if(!t)return;t=t.parent}return t}function vu(e){const t=e.nodeBefore;if(t&&t.is("$text"))return new Kd(t,t.data.length);const n=e.nodeAfter;return n&&n.is("$text")?new Kd(n,0):e}function yu(e){if(e.offset==e.parent.data.length)return new Kd(e.parent.parent,e.parent.index+1);if(0===e.offset)return new Kd(e.parent.parent,e.parent.index);const t=e.parent.data.slice(e.offset);return e.parent._data=e.parent.data.slice(0,e.offset),e.parent.parent._insertChild(e.parent.index+1,new Od(e.root.document,t)),new Kd(e.parent.parent,e.parent.index+1)}function _u(e,t){const n=e.data.length;return e._data+=t.data,t._remove(),new Kd(e,n)}const ku=[Od,au,jd,du,gu,hu];function xu(e,t){for(const n of e){if(!ku.some((e=>n instanceof e)))throw new Aa("view-writer-insert-invalid-node-type",t);n.is("$text")||xu(n.getChildren(),t)}}function Cu(e){return e&&(e.is("containerElement")||e.is("documentFragment"))}function Au(e,t){const n=wu(e.start),i=wu(e.end);if(!n||!i||n!==i)throw new Aa("view-writer-invalid-range-container",t)}function Eu(e,t){return null===e.id&&null===t.id}const Tu=e=>e.createTextNode(" "),Su=e=>{const t=e.createElement("span");return t.dataset.ckeFiller="true",t.innerText=" ",t},Pu=e=>{const t=e.createElement("br");return t.dataset.ckeFiller="true",t},Iu="".repeat(7);function Ou(e){return"string"==typeof e?e.substr(0,7)===Iu:pl(e)&&e.data.substr(0,7)===Iu}function Vu(e){return 7==e.data.length&&Ou(e)}function Ru(e){const t="string"==typeof e?e:e.data;return Ou(e)?t.slice(7):t}function Nu(e,t){if(t.keyCode==Zl.arrowleft){const e=t.domTarget.ownerDocument.defaultView.getSelection();if(1==e.rangeCount&&e.getRangeAt(0).collapsed){const t=e.getRangeAt(0).startContainer,n=e.getRangeAt(0).startOffset;Ou(t)&&n<=7&&e.collapse(t,0)}}}class Lu extends(Ga()){domDocuments=new Set;domConverter;markedAttributes=new Set;markedChildren=new Set;markedTexts=new Set;selection;_inlineFiller=null;_fakeSelectionContainer=null;constructor(e,t){super(),this.domConverter=e,this.selection=t,this.set("isFocused",!1),this.set("isSelecting",!1),this.set("isComposing",!1),aa.isBlink&&!aa.isAndroid&&this.on("change:isSelecting",(()=>{this.isSelecting||this.render()}))}markToSync(e,t){if("text"===e)this.domConverter.mapViewToDom(t.parent)&&this.markedTexts.add(t);else{if(!this.domConverter.mapViewToDom(t))return;if("attributes"===e)this.markedAttributes.add(t);else{if("children"!==e)throw new Aa("view-renderer-unknown-type",this);this.markedChildren.add(t)}}}render(){if(this.isComposing&&!aa.isAndroid)return;let e=null;const t=!(aa.isBlink&&!aa.isAndroid&&this.isSelecting);for(const e of this.markedChildren)this._updateChildrenMappings(e);t?(this._inlineFiller&&!this._isSelectionInInlineFiller()&&this._removeInlineFiller(),this._inlineFiller?e=this._getInlineFillerPosition():this._needsInlineFillerAtSelection()&&(e=this.selection.getFirstPosition(),this.markedChildren.add(e.parent))):this._inlineFiller&&this._inlineFiller.parentNode&&(e=this.domConverter.domPositionToView(this._inlineFiller),e&&e.parent.is("$text")&&(e=Kd._createBefore(e.parent)));for(const e of this.markedAttributes)this._updateAttrs(e);for(const t of this.markedChildren)this._updateChildren(t,{inlineFillerPosition:e});for(const t of this.markedTexts)!this.markedChildren.has(t.parent)&&this.domConverter.mapViewToDom(t.parent)&&this._updateText(t,{inlineFillerPosition:e});if(t)if(e){const t=this.domConverter.viewPositionToDom(e),n=t.parent.ownerDocument;Ou(t.parent)?this._inlineFiller=t.parent:this._inlineFiller=Mu(n,t.parent,t.offset)}else this._inlineFiller=null;this._updateFocus(),this._updateSelection(),this.domConverter._clearTemporaryCustomProperties(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const n=Array.from(t.childNodes),i=Array.from(this.domConverter.viewChildrenToDom(e,{withChildren:!1})),r=this._diffNodeLists(n,i),s=this._findUpdateActions(r,n,i,Bu);if(-1!==s.indexOf("update")){const t={equal:0,insert:0,delete:0};for(const r of s)if("update"===r){const r=t.equal+t.insert,s=t.equal+t.delete,o=e.getChild(r);!o||o.is("uiElement")||o.is("rawElement")||this._updateElementMappings(o,n[s]),Ll(i[r]),t.equal++}else t[r]++}}_updateElementMappings(e,t){this.domConverter.unbindDomElement(t),this.domConverter.bindElements(t,e),this.markedChildren.add(e),this.markedAttributes.add(e)}_getInlineFillerPosition(){const e=this.selection.getFirstPosition();return e.parent.is("$text")?Kd._createBefore(e.parent):e}_isSelectionInInlineFiller(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=this.domConverter.viewPositionToDom(e);return!!(t&&pl(t.parent)&&Ou(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!Ou(e))throw new Aa("view-renderer-filler-was-lost",this);Vu(e)?e.remove():e.data=e.data.substr(7),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=e.parent,n=e.offset;if(!this.domConverter.mapViewToDom(t.root))return!1;if(!t.is("element"))return!1;if(!function(e){if("false"==e.getAttribute("contenteditable"))return!1;const t=e.findAncestor((e=>e.hasAttribute("contenteditable")));return!t||"true"==t.getAttribute("contenteditable")}(t))return!1;const i=e.nodeBefore,r=e.nodeAfter;return!(i instanceof Od||r instanceof Od||!(n!==t.getFillerOffset()||i&&i.is("element","br"))||aa.isAndroid&&(i||r))}_updateText(e,t){const n=this.domConverter.findCorrespondingDomText(e);let i=this.domConverter.viewToDom(e).data;const r=t.inlineFillerPosition;r&&r.parent==e.parent&&r.offset==e.index&&(i=Iu+i),this._updateTextNode(n,i)}_updateAttrs(e){const t=this.domConverter.mapViewToDom(e);if(t){for(const n of Array.from(t.attributes)){const i=n.name;e.hasAttribute(i)||this.domConverter.removeDomElementAttribute(t,i)}for(const n of e.getAttributeKeys())this.domConverter.setDomElementAttribute(t,n,e.getAttribute(n),e)}}_updateChildren(e,t){const n=this.domConverter.mapViewToDom(e);if(!n)return;if(aa.isAndroid){let e=null;for(const t of Array.from(n.childNodes)){if(e&&pl(e)&&pl(t)){n.normalize();break}e=t}}const i=t.inlineFillerPosition,r=n.childNodes,s=Array.from(this.domConverter.viewChildrenToDom(e,{bind:!0}));i&&i.parent===e&&Mu(n.ownerDocument,s,i.offset);const o=this._diffNodeLists(r,s),a=this._findUpdateActions(o,r,s,Fu);let l=0;const c=new Set;for(const e of a)"delete"===e?(c.add(r[l]),Ll(r[l])):"equal"!==e&&"update"!==e||l++;l=0;for(const e of a)"insert"===e?(Sl(n,l,s[l]),l++):"update"===e?(this._updateTextNode(r[l],s[l].data),l++):"equal"===e&&(this._markDescendantTextToSync(this.domConverter.domToView(s[l])),l++);for(const e of c)e.parentNode||this.domConverter.unbindDomElement(e)}_diffNodeLists(e,t){return va(e=function(e,t){const n=Array.from(e);return 0!=n.length&&t?(n[n.length-1]==t&&n.pop(),n):n}(e,this._fakeSelectionContainer),t,Du.bind(null,this.domConverter))}_findUpdateActions(e,t,n,i){if(-1===e.indexOf("insert")||-1===e.indexOf("delete"))return e;let r=[],s=[],o=[];const a={equal:0,insert:0,delete:0};for(const l of e)"insert"===l?o.push(n[a.equal+a.insert]):"delete"===l?s.push(t[a.equal+a.delete]):(r=r.concat(va(s,o,i).map((e=>"equal"===e?"update":e))),r.push("equal"),s=[],o=[]),a[l]++;return r.concat(va(s,o,i).map((e=>"equal"===e?"update":e)))}_updateTextNode(e,t){const n=e.data;n!=t&&(aa.isAndroid&&this.isComposing&&n.replace(/\u00A0/g," ")==t.replace(/\u00A0/g," ")||this._updateTextNodeInternal(e,t))}_updateTextNodeInternal(e,t){const n=fa(e.data,t);for(const t of n)"insert"===t.type?e.insertData(t.index,t.values.join("")):e.deleteData(t.index,t.howMany)}_markDescendantTextToSync(e){if(e)if(e.is("$text"))this.markedTexts.add(e);else if(e.is("element"))for(const t of e.getChildren())this._markDescendantTextToSync(t)}_updateSelection(){if(aa.isBlink&&!aa.isAndroid&&this.isSelecting&&!this.markedChildren.size)return;if(0===this.selection.rangeCount)return this._removeDomSelection(),void this._removeFakeSelection();const e=this.domConverter.mapViewToDom(this.selection.editableElement);this.isFocused&&e&&(this.selection.isFake?this._updateFakeSelection(e):this._fakeSelectionContainer&&this._fakeSelectionContainer.isConnected?(this._removeFakeSelection(),this._updateDomSelection(e)):this.isComposing&&aa.isAndroid||this._updateDomSelection(e))}_updateFakeSelection(e){const t=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=function(e){const t=e.createElement("div");return t.className="ck-fake-selection-container",Object.assign(t.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),t.textContent=" ",t}(t));const n=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(n,this.selection),!this._fakeSelectionNeedsUpdate(e))return;n.parentElement&&n.parentElement==e||e.appendChild(n),n.textContent=this.selection.fakeSelectionLabel||" ";const i=t.getSelection(),r=t.createRange();i.removeAllRanges(),r.selectNodeContents(n),i.addRange(r)}_updateDomSelection(e){const t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;const n=this.domConverter.viewPositionToDom(this.selection.anchor),i=this.domConverter.viewPositionToDom(this.selection.focus);t.setBaseAndExtent(n.parent,n.offset,i.parent,i.offset),aa.isGecko&&function(e,t){let n=e.parent,i=e.offset;if(pl(n)&&Vu(n)&&(i=Tl(n)+1,n=n.parentNode),n.nodeType!=Node.ELEMENT_NODE||i!=n.childNodes.length-1)return;const r=n.childNodes[i];r&&"BR"==r.tagName&&t.addRange(t.getRangeAt(0))}(i,t)}_domSelectionNeedsUpdate(e){if(!this.domConverter.isDomSelectionCorrect(e))return!0;const t=e&&this.domConverter.domSelectionToView(e);return!(t&&this.selection.isEqual(t)||!this.selection.isCollapsed&&this.selection.isSimilar(t))}_fakeSelectionNeedsUpdate(e){const t=this._fakeSelectionContainer,n=e.ownerDocument.getSelection();return!t||t.parentElement!==e||n.anchorNode!==t&&!t.contains(n.anchorNode)||t.textContent!==this.selection.fakeSelectionLabel}_removeDomSelection(){for(const e of this.domDocuments){const t=e.getSelection();if(t.rangeCount){const n=e.activeElement,i=this.domConverter.mapDomToView(n);n&&i&&t.removeAllRanges()}}}_removeFakeSelection(){const e=this._fakeSelectionContainer;e&&e.remove()}_updateFocus(){if(this.isFocused){const e=this.selection.editableElement;e&&this.domConverter.focus(e)}}}function Mu(e,t,n){const i=t instanceof Array?t:t.childNodes,r=i[n];if(pl(r))return r.data=Iu+r.data,r;{const r=e.createTextNode(Iu);return Array.isArray(t)?i.splice(n,0,r):Sl(t,n,r),r}}function Bu(e,t){return al(e)&&al(t)&&!pl(e)&&!pl(t)&&!Pl(e)&&!Pl(t)&&e.tagName.toLowerCase()===t.tagName.toLowerCase()}function Fu(e,t){return al(e)&&al(t)&&pl(e)&&pl(t)}function Du(e,t,n){return t===n||(pl(t)&&pl(n)?t.data===n.data:!(!e.isBlockFiller(t)||!e.isBlockFiller(n)))}const zu=Pu(ra.document),$u=Tu(ra.document),ju=Su(ra.document),Hu="data-ck-unsafe-attribute-",Wu="data-ck-unsafe-element";class Uu{document;renderingMode;blockFillerMode;preElements;blockElements;inlineObjectElements;unsafeElements;_domDocument;_domToViewMapping=new WeakMap;_viewToDomMapping=new WeakMap;_fakeSelectionMapping=new WeakMap;_rawContentElementMatcher=new Rd;_inlineObjectElementMatcher=new Rd;_elementsWithTemporaryCustomProperties=new Set;constructor(e,{blockFillerMode:t,renderingMode:n="editing"}={}){this.document=e,this.renderingMode=n,this.blockFillerMode=t||("editing"===n?"br":"nbsp"),this.preElements=["pre","textarea"],this.blockElements=["address","article","aside","blockquote","caption","center","dd","details","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","legend","li","main","menu","nav","ol","p","pre","section","summary","table","tbody","td","tfoot","th","thead","tr","ul"],this.inlineObjectElements=["object","iframe","input","button","textarea","select","option","video","embed","audio","img","canvas"],this.unsafeElements=["script","style"],this._domDocument="editing"===this.renderingMode?ra.document:ra.document.implementation.createHTMLDocument("")}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new Yd(t))}fakeSelectionToView(e){return this._fakeSelectionMapping.get(e)}bindElements(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}unbindDomElement(e){const t=this._domToViewMapping.get(e);if(t){this._domToViewMapping.delete(e),this._viewToDomMapping.delete(t);for(const t of e.children)this.unbindDomElement(t)}}bindDocumentFragments(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}shouldRenderAttribute(e,t,n){return"data"===this.renderingMode||!(e=e.toLowerCase()).startsWith("on")&&("srcdoc"!==e||!t.match(/\bon\S+\s*=|javascript:|<\s*\/*script/i))&&("img"===n&&("src"===e||"srcset"===e)||"source"===n&&"srcset"===e||!t.match(/^\s*(javascript:|data:(image\/svg|text\/x?html))/i))}setContentOf(e,t){if("data"===this.renderingMode)return void(e.innerHTML=t);const n=(new DOMParser).parseFromString(t,"text/html"),i=n.createDocumentFragment(),r=n.body.childNodes;for(;r.length>0;)i.appendChild(r[0]);const s=n.createTreeWalker(i,NodeFilter.SHOW_ELEMENT),o=[];let a;for(;a=s.nextNode();)o.push(a);for(const e of o){for(const t of e.getAttributeNames())this.setDomElementAttribute(e,t,e.getAttribute(t));const t=e.tagName.toLowerCase();this._shouldRenameElement(t)&&(Ku(t),e.replaceWith(this._createReplacementDomElement(t,e)))}for(;e.firstChild;)e.firstChild.remove();e.append(i)}viewToDom(e,t={}){if(e.is("$text")){const t=this._processDataFromViewText(e);return this._domDocument.createTextNode(t)}{const n=e;if(this.mapViewToDom(n)){if(!n.getCustomProperty("editingPipeline:doNotReuseOnce"))return this.mapViewToDom(n);this._elementsWithTemporaryCustomProperties.add(n)}let i;if(n.is("documentFragment"))i=this._domDocument.createDocumentFragment(),t.bind&&this.bindDocumentFragments(i,n);else{if(n.is("uiElement"))return i="$comment"===n.name?this._domDocument.createComment(n.getCustomProperty("$rawContent")):n.render(this._domDocument,this),t.bind&&this.bindElements(i,n),i;this._shouldRenameElement(n.name)?(Ku(n.name),i=this._createReplacementDomElement(n.name)):i=n.hasAttribute("xmlns")?this._domDocument.createElementNS(n.getAttribute("xmlns"),n.name):this._domDocument.createElement(n.name),n.is("rawElement")&&n.render(i,this),t.bind&&this.bindElements(i,n);for(const e of n.getAttributeKeys())this.setDomElementAttribute(i,e,n.getAttribute(e),n)}if(!1!==t.withChildren)for(const e of this.viewChildrenToDom(n,t))i instanceof HTMLTemplateElement?i.content.appendChild(e):i.appendChild(e);return i}}setDomElementAttribute(e,t,n,i){const r=this.shouldRenderAttribute(t,n,e.tagName.toLowerCase())||i&&i.shouldRenderUnsafeAttribute(t);r||Ea("domconverter-unsafe-attribute-detected",{domElement:e,key:t,value:n}),Il(t)?(e.hasAttribute(t)&&!r?e.removeAttribute(t):e.hasAttribute(Hu+t)&&r&&e.removeAttribute(Hu+t),e.setAttribute(r?t:Hu+t,n)):Ea("domconverter-invalid-attribute-detected",{domElement:e,key:t,value:n})}removeDomElementAttribute(e,t){t!=Wu&&(e.removeAttribute(t),e.removeAttribute(Hu+t))}*viewChildrenToDom(e,t={}){const n=e.getFillerOffset&&e.getFillerOffset();let i=0;for(const r of e.getChildren()){n===i&&(yield this._getBlockFiller());const e=r.is("element")&&!!r.getCustomProperty("dataPipeline:transparentRendering")&&!ac(r.getAttributes());if(e&&"data"==this.renderingMode)if(r.is("rawElement")){const e=this._domDocument.createElement(r.name);r.render(e,this),yield*[...e.childNodes]}else yield*this.viewChildrenToDom(r,t);else e&&Ea("domconverter-transparent-rendering-unsupported-in-editing-pipeline",{viewElement:r}),yield this.viewToDom(r,t);i++}n===i&&(yield this._getBlockFiller())}viewRangeToDom(e){const t=this.viewPositionToDom(e.start),n=this.viewPositionToDom(e.end),i=this._domDocument.createRange();return i.setStart(t.parent,t.offset),i.setEnd(n.parent,n.offset),i}viewPositionToDom(e){const t=e.parent;if(t.is("$text")){const n=this.findCorrespondingDomText(t);if(!n)return null;let i=e.offset;return Ou(n)&&(i+=7),{parent:n,offset:i}}{let n,i,r;if(0===e.offset){if(n=this.mapViewToDom(t),!n)return null;r=n.childNodes[0]}else{const t=e.nodeBefore;if(i=t.is("$text")?this.findCorrespondingDomText(t):this.mapViewToDom(t),!i)return null;n=i.parentNode,r=i.nextSibling}return pl(r)&&Ou(r)?{parent:r,offset:7}:{parent:n,offset:i?Tl(i)+1:0}}}domToView(e,t={}){const n=[],i=this._domToView(e,t,n),r=i.next().value;return r?(i.next(),this._processDomInlineNodes(null,n,t),r.is("$text")&&0==r.data.length?null:r):null}*domChildrenToView(e,t={},n=[]){let i=[];i=e instanceof HTMLTemplateElement?[...e.content.childNodes]:[...e.childNodes];for(let r=0;r<i.length;r++){const s=i[r],o=this._domToView(s,t,n),a=o.next().value;null!==a&&(this._isBlockViewElement(a)&&this._processDomInlineNodes(e,n,t),yield a,o.next())}this._processDomInlineNodes(e,n,t)}domSelectionToView(e){if(function(e){if(!aa.isGecko)return!1;if(!e.rangeCount)return!1;const t=e.getRangeAt(0).startContainer;try{Object.prototype.toString.call(t)}catch(e){return!0}return!1}(e))return new Yd([]);if(1===e.rangeCount){let t=e.getRangeAt(0).startContainer;pl(t)&&(t=t.parentNode);const n=this.fakeSelectionToView(t);if(n)return n}const t=this.isDomSelectionBackward(e),n=[];for(let t=0;t<e.rangeCount;t++){const i=e.getRangeAt(t),r=this.domRangeToView(i);r&&n.push(r)}return new Yd(n,{backward:t})}domRangeToView(e){const t=this.domPositionToView(e.startContainer,e.startOffset),n=this.domPositionToView(e.endContainer,e.endOffset);return t&&n?new Zd(t,n):null}domPositionToView(e,t=0){if(this.isBlockFiller(e))return this.domPositionToView(e.parentNode,Tl(e));const n=this.mapDomToView(e);if(n&&(n.is("uiElement")||n.is("rawElement")))return Kd._createBefore(n);if(pl(e)){if(Vu(e))return this.domPositionToView(e.parentNode,Tl(e));const n=this.findCorrespondingViewText(e);let i=t;return n?(Ou(e)&&(i-=7,i=i<0?0:i),new Kd(n,i)):null}if(0===t){const t=this.mapDomToView(e);if(t)return new Kd(t,0)}else{const n=e.childNodes[t-1];if(pl(n)&&Vu(n)||n&&this.isBlockFiller(n))return this.domPositionToView(n.parentNode,Tl(n));const i=pl(n)?this.findCorrespondingViewText(n):this.mapDomToView(n);if(i&&i.parent)return new Kd(i.parent,i.index+1)}return null}mapDomToView(e){return this.getHostViewElement(e)||this._domToViewMapping.get(e)}findCorrespondingViewText(e){if(Vu(e))return null;const t=this.getHostViewElement(e);if(t)return t;const n=e.previousSibling;if(n){if(!this.isElement(n))return null;const e=this.mapDomToView(n);if(e){const t=e.nextSibling;return t instanceof Od?t:null}}else{const t=this.mapDomToView(e.parentNode);if(t){const e=t.getChild(0);return e instanceof Od?e:null}}return null}mapViewToDom(e){return this._viewToDomMapping.get(e)}findCorrespondingDomText(e){const t=e.previousSibling;return t&&this.mapViewToDom(t)?this.mapViewToDom(t).nextSibling:!t&&e.parent&&this.mapViewToDom(e.parent)?this.mapViewToDom(e.parent).childNodes[0]:null}focus(e){const t=this.mapViewToDom(e);if(t&&t.ownerDocument.activeElement!==t){const{scrollX:e,scrollY:n}=ra.window,i=[];qu(t,(e=>{const{scrollLeft:t,scrollTop:n}=e;i.push([t,n])})),t.focus(),qu(t,(e=>{const[t,n]=i.shift();e.scrollLeft=t,e.scrollTop=n})),ra.window.scrollTo(e,n)}}_clearDomSelection(){const e=this.mapViewToDom(this.document.selection.editableElement);if(!e)return;const t=e.ownerDocument.defaultView.getSelection(),n=this.domSelectionToView(t);n&&n.rangeCount>0&&t.removeAllRanges()}isElement(e){return e&&e.nodeType==Node.ELEMENT_NODE}isDocumentFragment(e){return e&&e.nodeType==Node.DOCUMENT_FRAGMENT_NODE}isBlockFiller(e){return"br"==this.blockFillerMode?e.isEqualNode(zu):!("BR"!==e.tagName||!Gu(e,this.blockElements)||1!==e.parentNode.childNodes.length)||e.isEqualNode(ju)||function(e,t){return e.isEqualNode($u)&&Gu(e,t)&&1===e.parentNode.childNodes.length}(e,this.blockElements)}isDomSelectionBackward(e){if(e.isCollapsed)return!1;const t=this._domDocument.createRange();try{t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset)}catch(e){return!1}const n=t.collapsed;return t.detach(),n}getHostViewElement(e){const t=function(e){const t=[];let n=e;for(;n&&n.nodeType!=Node.DOCUMENT_NODE;)t.unshift(n),n=n.parentNode;return t}(e);for(t.pop();t.length;){const e=t.pop(),n=this._domToViewMapping.get(e);if(n&&(n.is("uiElement")||n.is("rawElement")))return n}return null}isDomSelectionCorrect(e){return this._isDomSelectionPositionCorrect(e.anchorNode,e.anchorOffset)&&this._isDomSelectionPositionCorrect(e.focusNode,e.focusOffset)}registerRawContentMatcher(e){this._rawContentElementMatcher.add(e)}registerInlineObjectMatcher(e){this._inlineObjectElementMatcher.add(e)}_clearTemporaryCustomProperties(){for(const e of this._elementsWithTemporaryCustomProperties)e._removeCustomProperty("editingPipeline:doNotReuseOnce");this._elementsWithTemporaryCustomProperties.clear()}_getBlockFiller(){switch(this.blockFillerMode){case"nbsp":return Tu(this._domDocument);case"markedNbsp":return Su(this._domDocument);case"br":return Pu(this._domDocument)}}_isDomSelectionPositionCorrect(e,t){if(pl(e)&&Ou(e)&&t<7)return!1;if(this.isElement(e)&&Ou(e.childNodes[t]))return!1;const n=this.mapDomToView(e);return!n||!n.is("uiElement")&&!n.is("rawElement")}*_domToView(e,t,n){if(this.isBlockFiller(e))return null;const i=this.getHostViewElement(e);if(i)return i;if(Pl(e)&&t.skipComments)return null;if(pl(e)){if(Vu(e))return null;{const t=e.data;if(""===t)return null;const i=new Od(this.document,t);return n.push(i),i}}{let i=this.mapDomToView(e);if(i)return this._isInlineObjectElement(i)&&n.push(i),i;if(this.isDocumentFragment(e))i=new fu(this.document),t.bind&&this.bindDocumentFragments(e,i);else{i=this._createViewElement(e,t),t.bind&&this.bindElements(e,i);const r=e.attributes;if(r)for(let e=r.length,t=0;t<e;t++)i._setAttribute(r[t].name,r[t].value);if(this._isViewElementWithRawContent(i,t))return i._setCustomProperty("$rawContent",e.innerHTML),this._isBlockViewElement(i)||n.push(i),i;if(Pl(e))return i._setCustomProperty("$rawContent",e.data),i}yield i;const r=[];if(!1!==t.withChildren)for(const n of this.domChildrenToView(e,t,r))i._appendChild(n);if(this._isInlineObjectElement(i))n.push(i),this._processDomInlineNodes(null,r,t);else for(const e of r)n.push(e)}}_processDomInlineNodes(e,t,n){if(!t.length)return;if(e&&!this.isDocumentFragment(e)&&!this._isBlockDomElement(e))return;let i=!1;for(let e=0;e<t.length;e++){const r=t[e];if(!r.is("$text")){i=!1;continue}let s,o=!1;if(this._isPreFormatted(r))s=Ru(r.data);else{s=r.data.replace(/[ \n\t\r]{1,}/g," "),o=/[^\S\u00A0]/.test(s.charAt(s.length-1));const a=e>0?t[e-1]:null,l=e+1<t.length?t[e+1]:null,c=!a||a.is("element")&&"br"==a.name||i,d=!l&&!Ou(r.data);!1!==n.withChildren&&(c&&(s=s.replace(/^ /,"")),d&&(s=s.replace(/ $/,""))),s=Ru(s),s=s.replace(/ \u00A0/g," ");const u=l&&l.is("element")&&"br"!=l.name,h=l&&l.is("$text")&&" "==l.data.charAt(0);(/[ \u00A0]\u00A0$/.test(s)||!l||u||h)&&(s=s.replace(/\u00A0$/," ")),(c||a&&a.is("element")&&"br"!=a.name)&&(s=s.replace(/^\u00A0/," "))}0==s.length&&r.parent?(r._remove(),t.splice(e,1),e--):(r._data=s,i=o)}t.length=0}_processDataFromViewText(e){let t=e.data;if(this._isPreFormatted(e))return t;if(" "==t.charAt(0)){const n=this._getTouchingInlineViewNode(e,!1);!(n&&n.is("$textProxy")&&this._nodeEndsWithSpace(n))&&n||(t=" "+t.substr(1))}if(" "==t.charAt(t.length-1)){const n=this._getTouchingInlineViewNode(e,!0),i=n&&n.is("$textProxy")&&" "==n.data.charAt(0);" "!=t.charAt(t.length-2)&&n&&!i||(t=t.substr(0,t.length-1)+" ")}return t.replace(/ {2}/g," ")}_nodeEndsWithSpace(e){if(this._isPreFormatted(e))return!1;const t=this._processDataFromViewText(e);return" "==t.charAt(t.length-1)}_isPreFormatted(e){if(function(e,t){return e.getAncestors().some((e=>e.is("element")&&t.includes(e.name)))}(e,this.preElements))return!0;for(const t of e.getAncestors({parentFirst:!0}))if(t.is("element")&&t.hasStyle("white-space")&&"inherit"!==t.getStyle("white-space"))return["pre","pre-wrap","break-spaces"].includes(t.getStyle("white-space"));return!1}_getTouchingInlineViewNode(e,t){const n=new Gd({startPosition:t?Kd._createAfter(e):Kd._createBefore(e),direction:t?"forward":"backward"});for(const{item:e}of n){if(e.is("$textProxy"))return e;if(!e.is("element")||!e.getCustomProperty("dataPipeline:transparentRendering")){if(e.is("element","br"))return null;if(this._isInlineObjectElement(e))return e;if(e.is("containerElement"))return null}}return null}_isBlockDomElement(e){return this.isElement(e)&&this.blockElements.includes(e.tagName.toLowerCase())}_isBlockViewElement(e){return e.is("element")&&this.blockElements.includes(e.name)}_isInlineObjectElement(e){return!!e.is("element")&&("br"==e.name||this.inlineObjectElements.includes(e.name)||!!this._inlineObjectElementMatcher.match(e))}_createViewElement(e,t){if(Pl(e))return new hu(this.document,"$comment");const n=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();return new zd(this.document,n)}_isViewElementWithRawContent(e,t){return!1!==t.withChildren&&e.is("element")&&!!this._rawContentElementMatcher.match(e)}_shouldRenameElement(e){const t=e.toLowerCase();return"editing"===this.renderingMode&&this.unsafeElements.includes(t)}_createReplacementDomElement(e,t){const n=this._domDocument.createElement("span");if(n.setAttribute(Wu,e),t){for(;t.firstChild;)n.appendChild(t.firstChild);for(const e of t.getAttributeNames())n.setAttribute(e,t.getAttribute(e))}return n}}function qu(e,t){let n=e;for(;n;)t(n),n=n.parentElement}function Gu(e,t){const n=e.parentNode;return!!n&&!!n.tagName&&t.includes(n.tagName.toLowerCase())}function Ku(e){"script"===e&&Ea("domconverter-unsafe-script-element-detected"),"style"===e&&Ea("domconverter-unsafe-style-element-detected")}class Zu extends(dl()){view;document;_isEnabled=!1;constructor(e){super(),this.view=e,this.document=e.document}get isEnabled(){return this._isEnabled}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}destroy(){this.disable(),this.stopListening()}checkShouldIgnoreEventFromTarget(e){return e&&3===e.nodeType&&(e=e.parentNode),!(!e||1!==e.nodeType)&&e.matches("[data-cke-ignore-events], [data-cke-ignore-events] *")}}class Qu{view;document;domEvent;domTarget;constructor(e,t,n){this.view=e,this.document=e.document,this.domEvent=t,this.domTarget=t.target,Uc(this,n)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}}class Yu extends Zu{useCapture=!1;usePassive=!1;observe(e){("string"==typeof this.domEventType?[this.domEventType]:this.domEventType).forEach((t=>{this.listenTo(e,t,((e,t)=>{this.isEnabled&&!this.checkShouldIgnoreEventFromTarget(t.target)&&this.onDomEvent(t)}),{useCapture:this.useCapture,usePassive:this.usePassive})}))}stopObserving(e){this.stopListening(e)}fire(e,t,n){this.isEnabled&&this.document.fire(e,new Qu(this.view,t,n))}}class Ju extends Yu{domEventType=["keydown","keyup"];onDomEvent(e){const t={keyCode:e.keyCode,altKey:e.altKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,metaKey:e.metaKey,get keystroke(){return Yl(this)}};this.fire(e.type,e,t)}}class Xu extends Zu{_fireSelectionChangeDoneDebounced;constructor(e){super(e),this._fireSelectionChangeDoneDebounced=id((e=>{this.document.fire("selectionChangeDone",e)}),200)}observe(){const e=this.document;e.on("arrowKey",((t,n)=>{e.selection.isFake&&this.isEnabled&&n.preventDefault()}),{context:"$capture"}),e.on("arrowKey",((t,n)=>{e.selection.isFake&&this.isEnabled&&this._handleSelectionMove(n.keyCode)}),{priority:"lowest"})}stopObserving(){}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const t=this.document.selection,n=new Yd(t.getRanges(),{backward:t.isBackward,fake:!1});e!=Zl.arrowleft&&e!=Zl.arrowup||n.setTo(n.getFirstPosition()),e!=Zl.arrowright&&e!=Zl.arrowdown||n.setTo(n.getLastPosition());const i={oldSelection:t,newSelection:n,domSelection:null};this.document.fire("selectionChange",i),this._fireSelectionChangeDoneDebounced(i)}}class eh extends Zu{domConverter;_config;_domElements;_mutationObserver;constructor(e){super(e),this._config={childList:!0,characterData:!0,subtree:!0},this.domConverter=e.domConverter,this._domElements=new Set,this._mutationObserver=new window.MutationObserver(this._onMutations.bind(this))}flush(){this._onMutations(this._mutationObserver.takeRecords())}observe(e){this._domElements.add(e),this.isEnabled&&this._mutationObserver.observe(e,this._config)}stopObserving(e){if(this._domElements.delete(e),this.isEnabled){this._mutationObserver.disconnect();for(const e of this._domElements)this._mutationObserver.observe(e,this._config)}}enable(){super.enable();for(const e of this._domElements)this._mutationObserver.observe(e,this._config)}disable(){super.disable(),this._mutationObserver.disconnect()}destroy(){super.destroy(),this._mutationObserver.disconnect()}_onMutations(e){if(0===e.length)return;const t=this.domConverter,n=new Set,i=new Set;for(const n of e){const e=t.mapDomToView(n.target);e&&(e.is("uiElement")||e.is("rawElement")||"childList"!==n.type||this._isBogusBrMutation(n)||i.add(e))}for(const r of e){const e=t.mapDomToView(r.target);if((!e||!e.is("uiElement")&&!e.is("rawElement"))&&"characterData"===r.type){const e=t.findCorrespondingViewText(r.target);e&&!i.has(e.parent)?n.add(e):!e&&Ou(r.target)&&i.add(t.mapDomToView(r.target.parentNode))}}const r=[];for(const e of n)r.push({type:"text",node:e});for(const e of i){const n=t.mapViewToDom(e),i=Array.from(e.getChildren()),s=Array.from(t.domChildrenToView(n,{withChildren:!1}));yd(i,s,th)||r.push({type:"children",node:e})}r.length&&this.document.fire("mutations",{mutations:r})}_isBogusBrMutation(e){let t=null;return null===e.nextSibling&&0===e.removedNodes.length&&1==e.addedNodes.length&&(t=this.domConverter.domToView(e.addedNodes[0],{withChildren:!1})),t&&t.is("element","br")}}function th(e,t){if(!Array.isArray(e))return e===t||!(!e.is("$text")||!t.is("$text"))&&e.data===t.data}class nh extends Yu{_renderTimeoutId=null;_isFocusChanging=!1;domEventType=["focus","blur"];constructor(e){super(e),this.useCapture=!0;const t=this.document;t.on("focus",(()=>this._handleFocus())),t.on("blur",((e,t)=>this._handleBlur(t))),t.on("beforeinput",(()=>{t.isFocused||this._handleFocus()}),{priority:"highest"})}flush(){this._isFocusChanging&&(this._isFocusChanging=!1,this.document.isFocused=!0)}onDomEvent(e){this.fire(e.type,e)}destroy(){this._clearTimeout(),super.destroy()}_handleFocus(){this._clearTimeout(),this._isFocusChanging=!0,this._renderTimeoutId=setTimeout((()=>{this._renderTimeoutId=null,this.flush(),this.view.change((()=>{}))}),50)}_handleBlur(e){const t=this.document.selection.editableElement;null!==t&&t!==e.target||(this.document.isFocused=!1,this._isFocusChanging=!1,this.view.change((()=>{})))}_clearTimeout(){this._renderTimeoutId&&(clearTimeout(this._renderTimeoutId),this._renderTimeoutId=null)}}class ih extends Zu{mutationObserver;focusObserver;selection;domConverter;_documents;_fireSelectionChangeDoneDebounced;_clearInfiniteLoopInterval;_documentIsSelectingInactivityTimeoutDebounced;_loopbackCounter;constructor(e){super(e),this.mutationObserver=e.getObserver(eh),this.focusObserver=e.getObserver(nh),this.selection=this.document.selection,this.domConverter=e.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=id((e=>{this.document.fire("selectionChangeDone",e)}),200),this._clearInfiniteLoopInterval=setInterval((()=>this._clearInfiniteLoop()),1e3),this._documentIsSelectingInactivityTimeoutDebounced=id((()=>this.document.isSelecting=!1),5e3),this._loopbackCounter=0}observe(e){const t=e.ownerDocument,n=()=>{this.document.isSelecting&&(this._handleSelectionChange(t),this.document.isSelecting=!1,this._documentIsSelectingInactivityTimeoutDebounced.cancel())};this.listenTo(e,"selectstart",(()=>{this.document.isSelecting=!0,this._documentIsSelectingInactivityTimeoutDebounced()}),{priority:"highest"}),this.listenTo(e,"keydown",n,{priority:"highest",useCapture:!0}),this.listenTo(e,"keyup",n,{priority:"highest",useCapture:!0}),this._documents.has(t)||(this.listenTo(t,"mouseup",n,{priority:"highest",useCapture:!0}),this.listenTo(t,"selectionchange",(()=>{this.document.isComposing&&!aa.isAndroid||(this._handleSelectionChange(t),this._documentIsSelectingInactivityTimeoutDebounced())})),this.listenTo(this.view.document,"compositionstart",(()=>{this._handleSelectionChange(t)}),{priority:"lowest"}),this._documents.add(t))}stopObserving(e){this.stopListening(e)}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel(),this._documentIsSelectingInactivityTimeoutDebounced.cancel()}_reportInfiniteLoop(){}_handleSelectionChange(e){if(!this.isEnabled)return;const t=e.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(t.anchorNode))return;this.mutationObserver.flush();const n=this.domConverter.domSelectionToView(t);if(0!=n.rangeCount){if(this.view.hasDomSelection=!0,this.focusObserver.flush(),!this.selection.isEqual(n)||!this.domConverter.isDomSelectionCorrect(t))if(++this._loopbackCounter>60)this._reportInfiniteLoop();else if(this.selection.isSimilar(n))this.view.forceRender();else{const e={oldSelection:this.selection,newSelection:n,domSelection:t};this.document.fire("selectionChange",e),this._fireSelectionChangeDoneDebounced(e)}}else this.view.hasDomSelection=!1}_clearInfiniteLoop(){this._loopbackCounter=0}}class rh extends Yu{domEventType=["compositionstart","compositionupdate","compositionend"];constructor(e){super(e);const t=this.document;t.on("compositionstart",(()=>{t.isComposing=!0}),{priority:"low"}),t.on("compositionend",(()=>{t.isComposing=!1}),{priority:"low"})}onDomEvent(e){this.fire(e.type,e,{data:e.data})}}class sh{_files;_native;constructor(e,t={}){this._files=t.cacheFiles?oh(e):null,this._native=e}get files(){return this._files||(this._files=oh(this._native)),this._files}get types(){return this._native.types}getData(e){return this._native.getData(e)}setData(e,t){this._native.setData(e,t)}set effectAllowed(e){this._native.effectAllowed=e}get effectAllowed(){return this._native.effectAllowed}set dropEffect(e){this._native.dropEffect=e}get dropEffect(){return this._native.dropEffect}setDragImage(e,t,n){this._native.setDragImage(e,t,n)}get isCanceled(){return"none"==this._native.dropEffect||!!this._native.mozUserCancelled}}function oh(e){const t=Array.from(e.files||[]),n=Array.from(e.items||[]);return t.length?t:n.filter((e=>"file"===e.kind)).map((e=>e.getAsFile()))}class ah extends Yu{domEventType="beforeinput";onDomEvent(e){const t=e.getTargetRanges(),n=this.view,i=n.document;let r=null,s=null,o=[];if(e.dataTransfer&&(r=new sh(e.dataTransfer)),null!==e.data?s=e.data:r&&(s=r.getData("text/plain")),i.selection.isFake)o=Array.from(i.selection.getRanges());else if(t.length)o=t.map((e=>{const t=n.domConverter.domPositionToView(e.startContainer,e.startOffset),i=n.domConverter.domPositionToView(e.endContainer,e.endOffset);return t?n.createRange(t,i):i?n.createRange(i):void 0})).filter((e=>!!e));else if(aa.isAndroid){const t=e.target.ownerDocument.defaultView.getSelection();o=Array.from(n.domConverter.domSelectionToView(t).getRanges())}if(aa.isAndroid&&"insertCompositionText"==e.inputType&&s&&s.endsWith("\n"))this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:[n.createRange(o[0].end)]});else if("insertText"==e.inputType&&s&&s.includes("\n")){const t=s.split(/\n{1,2}/g);let n=o;for(let s=0;s<t.length;s++){const o=t[s];""!=o&&(this.fire(e.type,e,{data:o,dataTransfer:r,targetRanges:n,inputType:e.inputType,isComposing:e.isComposing}),n=[i.selection.getFirstRange()]),s+1<t.length&&(this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:n}),n=[i.selection.getFirstRange()])}}else this.fire(e.type,e,{data:s,dataTransfer:r,targetRanges:o,inputType:e.inputType,isComposing:e.isComposing})}}class lh extends Zu{constructor(e){super(e),this.document.on("keydown",((e,t)=>{if(this.isEnabled&&((n=t.keyCode)==Zl.arrowright||n==Zl.arrowleft||n==Zl.arrowup||n==Zl.arrowdown)){const n=new Xd(this.document,"arrowKey",this.document.selection.getFirstRange());this.document.fire(n,t),n.stop.called&&e.stop()}var n}))}observe(){}stopObserving(){}}class ch extends Zu{constructor(e){super(e);const t=this.document;t.on("keydown",((e,n)=>{if(!this.isEnabled||n.keyCode!=Zl.tab||n.ctrlKey)return;const i=new Xd(t,"tab",t.selection.getFirstRange());t.fire(i,n),i.stop.called&&e.stop()}))}observe(){}stopObserving(){}}class dh extends(Ga()){document;domConverter;domRoots=new Map;_renderer;_initialDomRootAttributes=new WeakMap;_observers=new Map;_writer;_ongoingChange=!1;_postFixersInProgress=!1;_renderingDisabled=!1;_hasChangedSinceTheLastRendering=!1;constructor(e){var t;super(),this.document=new ou(e),this.domConverter=new Uu(this.document),this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new Lu(this.domConverter,this.document.selection),this._renderer.bind("isFocused","isSelecting","isComposing").to(this.document,"isFocused","isSelecting","isComposing"),this._writer=new bu(this.document),this.addObserver(eh),this.addObserver(nh),this.addObserver(ih),this.addObserver(Ju),this.addObserver(Xu),this.addObserver(rh),this.addObserver(lh),this.addObserver(ah),this.addObserver(ch),this.document.on("arrowKey",Nu,{priority:"low"}),(t=this).document.on("arrowKey",((e,n)=>function(e,t,n){if(t.keyCode==Zl.arrowright){const e=t.domTarget.ownerDocument.defaultView.getSelection(),i=1==e.rangeCount&&e.getRangeAt(0).collapsed;if(i||t.shiftKey){const t=e.focusNode,r=e.focusOffset,s=n.domPositionToView(t,r);if(null===s)return;let o=!1;const a=s.getLastMatchingPosition((e=>(e.item.is("uiElement")&&(o=!0),!(!e.item.is("uiElement")&&!e.item.is("attributeElement")))));if(o){const t=n.viewPositionToDom(a);i?e.collapse(t.parent,t.offset):e.extend(t.parent,t.offset)}}}}(0,n,t.domConverter)),{priority:"low"}),this.on("render",(()=>{this._render(),this.document.fire("layoutChanged"),this._hasChangedSinceTheLastRendering=!1})),this.listenTo(this.document.selection,"change",(()=>{this._hasChangedSinceTheLastRendering=!0})),this.listenTo(this.document,"change:isFocused",(()=>{this._hasChangedSinceTheLastRendering=!0})),aa.isiOS&&this.listenTo(this.document,"blur",((e,t)=>{this.domConverter.mapDomToView(t.domEvent.relatedTarget)||this.domConverter._clearDomSelection()})),this.listenTo(this.document,"mutations",((e,{mutations:t})=>{t.forEach((e=>this._renderer.markToSync(e.type,e.node)))}),{priority:"low"}),this.listenTo(this.document,"mutations",(()=>{this.forceRender()}),{priority:"lowest"})}attachDomRoot(e,t="main"){const n=this.document.getRoot(t);n._name=e.tagName.toLowerCase();const i={};for(const{name:t,value:r}of Array.from(e.attributes))i[t]=r,"class"===t?this._writer.addClass(r.split(" "),n):n.hasAttribute(t)||this._writer.setAttribute(t,r,n);this._initialDomRootAttributes.set(e,i);const r=()=>{this._writer.setAttribute("contenteditable",(!n.isReadOnly).toString(),n),n.isReadOnly?this._writer.addClass("ck-read-only",n):this._writer.removeClass("ck-read-only",n)};r(),this.domRoots.set(t,e),this.domConverter.bindElements(e,n),this._renderer.markToSync("children",n),this._renderer.markToSync("attributes",n),this._renderer.domDocuments.add(e.ownerDocument),n.on("change:children",((e,t)=>this._renderer.markToSync("children",t))),n.on("change:attributes",((e,t)=>this._renderer.markToSync("attributes",t))),n.on("change:text",((e,t)=>this._renderer.markToSync("text",t))),n.on("change:isReadOnly",(()=>this.change(r))),n.on("change",(()=>{this._hasChangedSinceTheLastRendering=!0}));for(const n of this._observers.values())n.observe(e,t)}detachDomRoot(e){const t=this.domRoots.get(e);Array.from(t.attributes).forEach((({name:e})=>t.removeAttribute(e)));const n=this._initialDomRootAttributes.get(t);for(const e in n)t.setAttribute(e,n[e]);this.domRoots.delete(e),this.domConverter.unbindDomElement(t);for(const e of this._observers.values())e.stopObserving(t)}getDomRoot(e="main"){return this.domRoots.get(e)}addObserver(e){let t=this._observers.get(e);if(t)return t;t=new e(this),this._observers.set(e,t);for(const[e,n]of this.domRoots)t.observe(n,e);return t.enable(),t}getObserver(e){return this._observers.get(e)}disableObservers(){for(const e of this._observers.values())e.disable()}enableObservers(){for(const e of this._observers.values())e.enable()}scrollToTheSelection({alignToTop:e,forceScroll:t,viewportOffset:n=20,ancestorOffset:i=20}={}){const r=this.document.selection.getFirstRange();if(!r)return;const s=_d({alignToTop:e,forceScroll:t,viewportOffset:n,ancestorOffset:i});"number"==typeof n&&(n={top:n,bottom:n,left:n,right:n});const o={target:this.domConverter.viewRangeToDom(r),viewportOffset:n,ancestorOffset:i,alignToTop:e,forceScroll:t};this.fire("scrollToTheSelection",o,s),Ml(o)}focus(){if(!this.document.isFocused){const e=this.document.selection.editableElement;e&&(this.domConverter.focus(e),this.forceRender())}}change(e){if(this.isRenderingInProgress||this._postFixersInProgress)throw new Aa("cannot-change-view-tree",this);try{if(this._ongoingChange)return e(this._writer);this._ongoingChange=!0;const t=e(this._writer);return this._ongoingChange=!1,!this._renderingDisabled&&this._hasChangedSinceTheLastRendering&&(this._postFixersInProgress=!0,this.document._callPostFixers(this._writer),this._postFixersInProgress=!1,this.fire("render")),t}catch(e){Aa.rethrowUnexpectedError(e,this)}}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.getObserver(nh).flush(),this.change((()=>{}))}destroy(){for(const e of this._observers.values())e.destroy();this.document.destroy(),this.stopListening()}createPositionAt(e,t){return Kd._createAt(e,t)}createPositionAfter(e){return Kd._createAfter(e)}createPositionBefore(e){return Kd._createBefore(e)}createRange(e,t){return new Zd(e,t)}createRangeOn(e){return Zd._createOn(e)}createRangeIn(e){return Zd._createIn(e)}createSelection(...e){return new Yd(...e)}_disableRendering(e){this._renderingDisabled=e,0==e&&this.change((()=>{}))}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}}class uh{is(){throw new Error("is() method is abstract")}}class hh extends uh{textNode;data;offsetInText;constructor(e,t,n){if(super(),this.textNode=e,t<0||t>e.offsetSize)throw new Aa("model-textproxy-wrong-offsetintext",this);if(n<0||t+n>e.offsetSize)throw new Aa("model-textproxy-wrong-length",this);this.data=e.data.substring(t,t+n),this.offsetInText=t}get startOffset(){return null!==this.textNode.startOffset?this.textNode.startOffset+this.offsetInText:null}get offsetSize(){return this.data.length}get endOffset(){return null!==this.startOffset?this.startOffset+this.offsetSize:null}get isPartial(){return this.offsetSize!==this.textNode.offsetSize}get parent(){return this.textNode.parent}get root(){return this.textNode.root}getPath(){const e=this.textNode.getPath();return e.length>0&&(e[e.length-1]+=this.offsetInText),e}getAncestors(e={}){const t=[];let n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}hasAttribute(e){return this.textNode.hasAttribute(e)}getAttribute(e){return this.textNode.getAttribute(e)}getAttributes(){return this.textNode.getAttributes()}getAttributeKeys(){return this.textNode.getAttributeKeys()}}hh.prototype.is=function(e){return"$textProxy"===e||"model:$textProxy"===e||"textProxy"===e||"model:textProxy"===e};class mh{direction;boundaries;singleCharacters;shallow;ignoreElementEnd;_position;_boundaryStartParent;_boundaryEndParent;_visitedParent;constructor(e){if(!e||!e.boundaries&&!e.startPosition)throw new Aa("model-tree-walker-no-start-position",null);const t=e.direction||"forward";if("forward"!=t&&"backward"!=t)throw new Aa("model-tree-walker-unknown-direction",e,{direction:t});this.direction=t,this.boundaries=e.boundaries||null,e.startPosition?this._position=e.startPosition.clone():this._position=ph._createAt(this.boundaries["backward"==this.direction?"end":"start"]),this.position.stickiness="toNone",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null,this._visitedParent=this.position.parent}[Symbol.iterator](){return this}get position(){return this._position}skip(e){let t,n,i,r;do{i=this.position,r=this._visitedParent,({done:t,value:n}=this.next())}while(!t&&e(n));t||(this._position=i,this._visitedParent=r)}jumpTo(e){this._boundaryStartParent&&e.isBefore(this.boundaries.start)?e=this.boundaries.start:this._boundaryEndParent&&e.isAfter(this.boundaries.end)&&(e=this.boundaries.end),this._position=e.clone(),this._visitedParent=e.parent}next(){return"forward"==this.direction?this._next():this._previous()}_next(){const e=this.position,t=this.position.clone(),n=this._visitedParent;if(null===n.parent&&t.offset===n.maxOffset)return{done:!0,value:void 0};if(n===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0,value:void 0};const i=fh(t,n),r=i||bh(t,n,i);if(r&&r.is("model:element")){if(this.shallow){if(this.boundaries&&this.boundaries.end.isBefore(t))return{done:!0,value:void 0};t.offset++}else t.path.push(0),this._visitedParent=r;return this._position=t,gh("elementStart",r,e,t,1)}if(r&&r.is("model:$text")){let i;if(this.singleCharacters)i=1;else{let e=r.endOffset;this._boundaryEndParent==n&&this.boundaries.end.offset<e&&(e=this.boundaries.end.offset),i=e-t.offset}const s=t.offset-r.startOffset,o=new hh(r,s,i);return t.offset+=i,this._position=t,gh("text",o,e,t,i)}return t.path.pop(),t.offset++,this._position=t,this._visitedParent=n.parent,this.ignoreElementEnd?this._next():gh("elementEnd",n,e,t)}_previous(){const e=this.position,t=this.position.clone(),n=this._visitedParent;if(null===n.parent&&0===t.offset)return{done:!0,value:void 0};if(n==this._boundaryStartParent&&t.offset==this.boundaries.start.offset)return{done:!0,value:void 0};const i=t.parent,r=fh(t,i),s=r||wh(t,i,r);if(s&&s.is("model:element"))return t.offset--,this.shallow?(this._position=t,gh("elementStart",s,e,t,1)):(t.path.push(s.maxOffset),this._position=t,this._visitedParent=s,this.ignoreElementEnd?this._previous():gh("elementEnd",s,e,t));if(s&&s.is("model:$text")){let i;if(this.singleCharacters)i=1;else{let e=s.startOffset;this._boundaryStartParent==n&&this.boundaries.start.offset>e&&(e=this.boundaries.start.offset),i=t.offset-e}const r=t.offset-s.startOffset,o=new hh(s,r-i,i);return t.offset-=i,this._position=t,gh("text",o,e,t,i)}return t.path.pop(),this._position=t,this._visitedParent=n.parent,gh("elementStart",n,e,t,1)}}function gh(e,t,n,i,r){return{done:!1,value:{type:e,item:t,previousPosition:n,nextPosition:i,length:r}}}class ph extends uh{root;path;stickiness;constructor(e,t,n="toNone"){if(super(),!e.is("element")&&!e.is("documentFragment"))throw new Aa("model-position-root-invalid",e);if(!Array.isArray(t)||0===t.length)throw new Aa("model-position-path-incorrect-format",e,{path:t});e.is("rootElement")?t=t.slice():(t=[...e.getPath(),...t],e=e.root),this.root=e,this.path=t,this.stickiness=n}get offset(){return this.path[this.path.length-1]}set offset(e){this.path[this.path.length-1]=e}get parent(){let e=this.root;for(let t=0;t<this.path.length-1;t++)if(e=e.getChildAtOffset(this.path[t]),!e)throw new Aa("model-position-path-incorrect",this,{position:this});if(e.is("$text"))throw new Aa("model-position-path-incorrect",this,{position:this});return e}get index(){return this.parent.offsetToIndex(this.offset)}get textNode(){return fh(this,this.parent)}get nodeAfter(){const e=this.parent;return bh(this,e,fh(this,e))}get nodeBefore(){const e=this.parent;return wh(this,e,fh(this,e))}get isAtStart(){return 0===this.offset}get isAtEnd(){return this.offset==this.parent.maxOffset}isValid(){if(this.offset<0)return!1;let e=this.root;for(let t=0;t<this.path.length-1;t++)if(e=e.getChildAtOffset(this.path[t]),!e)return!1;return this.offset<=e.maxOffset}compareWith(e){if(this.root!=e.root)return"different";const t=tl(this.path,e.path);switch(t){case"same":return"same";case"prefix":return"before";case"extension":return"after";default:return this.path[t]<e.path[t]?"before":"after"}}getLastMatchingPosition(e,t={}){t.startPosition=this;const n=new mh(t);return n.skip(e),n.position}getParentPath(){return this.path.slice(0,-1)}getAncestors(){const e=this.parent;return e.is("documentFragment")?[e]:e.getAncestors({includeSelf:!0})}findAncestor(e){const t=this.parent;return t.is("element")?t.findAncestor(e,{includeSelf:!0}):null}getCommonPath(e){if(this.root!=e.root)return[];const t=tl(this.path,e.path),n="string"==typeof t?Math.min(this.path.length,e.path.length):t;return this.path.slice(0,n)}getCommonAncestor(e){const t=this.getAncestors(),n=e.getAncestors();let i=0;for(;t[i]==n[i]&&t[i];)i++;return 0===i?null:t[i-1]}getShiftedBy(e){const t=this.clone(),n=t.offset+e;return t.offset=n<0?0:n,t}isAfter(e){return"after"==this.compareWith(e)}isBefore(e){return"before"==this.compareWith(e)}isEqual(e){return"same"==this.compareWith(e)}isTouching(e){if(this.root!==e.root)return!1;const t=Math.min(this.path.length,e.path.length);for(let n=0;n<t;n++){const t=this.path[n]-e.path[n];if(t<-1||t>1)return!1;if(1===t)return vh(e,this,n);if(-1===t)return vh(this,e,n)}return this.path.length===e.path.length||(this.path.length>e.path.length?yh(this.path,t):yh(e.path,t))}hasSameParentAs(e){return this.root===e.root&&"same"==tl(this.getParentPath(),e.getParentPath())}getTransformedByOperation(e){let t;switch(e.type){case"insert":t=this._getTransformedByInsertOperation(e);break;case"move":case"remove":case"reinsert":t=this._getTransformedByMoveOperation(e);break;case"split":t=this._getTransformedBySplitOperation(e);break;case"merge":t=this._getTransformedByMergeOperation(e);break;default:t=ph._createAt(this)}return t}_getTransformedByInsertOperation(e){return this._getTransformedByInsertion(e.position,e.howMany)}_getTransformedByMoveOperation(e){return this._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany)}_getTransformedBySplitOperation(e){const t=e.movedRange;return t.containsPosition(this)||t.start.isEqual(this)&&"toNext"==this.stickiness?this._getCombined(e.splitPosition,e.moveTargetPosition):e.graveyardPosition?this._getTransformedByMove(e.graveyardPosition,e.insertionPosition,1):this._getTransformedByInsertion(e.insertionPosition,1)}_getTransformedByMergeOperation(e){const t=e.movedRange;let n;return t.containsPosition(this)||t.start.isEqual(this)?(n=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(n=n._getTransformedByDeletion(e.deletionPosition,1))):n=this.isEqual(e.deletionPosition)?ph._createAt(e.deletionPosition):this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),n}_getTransformedByDeletion(e,t){const n=ph._createAt(this);if(this.root!=e.root)return n;if("same"==tl(e.getParentPath(),this.getParentPath())){if(e.offset<this.offset){if(e.offset+t>this.offset)return null;n.offset-=t}}else if("prefix"==tl(e.getParentPath(),this.getParentPath())){const i=e.path.length-1;if(e.offset<=this.path[i]){if(e.offset+t>this.path[i])return null;n.path[i]-=t}}return n}_getTransformedByInsertion(e,t){const n=ph._createAt(this);if(this.root!=e.root)return n;if("same"==tl(e.getParentPath(),this.getParentPath()))(e.offset<this.offset||e.offset==this.offset&&"toPrevious"!=this.stickiness)&&(n.offset+=t);else if("prefix"==tl(e.getParentPath(),this.getParentPath())){const i=e.path.length-1;e.offset<=this.path[i]&&(n.path[i]+=t)}return n}_getTransformedByMove(e,t,n){if(t=t._getTransformedByDeletion(e,n),e.isEqual(t))return ph._createAt(this);const i=this._getTransformedByDeletion(e,n);return null===i||e.isEqual(this)&&"toNext"==this.stickiness||e.getShiftedBy(n).isEqual(this)&&"toPrevious"==this.stickiness?this._getCombined(e,t):i._getTransformedByInsertion(t,n)}_getCombined(e,t){const n=e.path.length-1,i=ph._createAt(t);return i.stickiness=this.stickiness,i.offset=i.offset+this.path[n]-e.offset,i.path=[...i.path,...this.path.slice(n+1)],i}toJSON(){return{root:this.root.toJSON(),path:Array.from(this.path),stickiness:this.stickiness}}clone(){return new this.constructor(this.root,this.path,this.stickiness)}static _createAt(e,t,n="toNone"){if(e.is("model:position"))return new ph(e.root,e.path,e.stickiness);{const i=e;if("end"==t)t=i.maxOffset;else{if("before"==t)return this._createBefore(i,n);if("after"==t)return this._createAfter(i,n);if(0!==t&&!t)throw new Aa("model-createpositionat-offset-required",[this,e])}if(!i.is("element")&&!i.is("documentFragment"))throw new Aa("model-position-parent-incorrect",[this,e]);const r=i.getPath();return r.push(t),new this(i.root,r,n)}}static _createAfter(e,t){if(!e.parent)throw new Aa("model-position-after-root",[this,e],{root:e});return this._createAt(e.parent,e.endOffset,t)}static _createBefore(e,t){if(!e.parent)throw new Aa("model-position-before-root",e,{root:e});return this._createAt(e.parent,e.startOffset,t)}static fromJSON(e,t){if("$graveyard"===e.root){const n=new ph(t.graveyard,e.path);return n.stickiness=e.stickiness,n}if(!t.getRoot(e.root))throw new Aa("model-position-fromjson-no-root",t,{rootName:e.root});return new ph(t.getRoot(e.root),e.path,e.stickiness)}}function fh(e,t){const n=t.getChildAtOffset(e.offset);return n&&n.is("$text")&&n.startOffset<e.offset?n:null}function bh(e,t,n){return null!==n?null:t.getChildAtOffset(e.offset)}function wh(e,t,n){return null!==n?null:t.getChild(t.offsetToIndex(e.offset)-1)}function vh(e,t,n){return n+1!==e.path.length&&!!yh(t.path,n+1)&&!!function(e,t){let n=e.parent,i=e.path.length-1,r=0;for(;i>=t;){if(e.path[i]+r!==n.maxOffset)return!1;r=1,i--,n=n.parent}return!0}(e,n+1)}function yh(e,t){for(;t<e.length;){if(0!==e[t])return!1;t++}return!0}ph.prototype.is=function(e){return"position"===e||"model:position"===e};class _h extends uh{start;end;constructor(e,t){super(),this.start=ph._createAt(e),this.end=t?ph._createAt(t):ph._createAt(e),this.start.stickiness=this.isCollapsed?"toNone":"toNext",this.end.stickiness=this.isCollapsed?"toNone":"toPrevious"}*[Symbol.iterator](){yield*new mh({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return"same"==tl(this.start.getParentPath(),this.end.getParentPath())}get root(){return this.start.root}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const n=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),i=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return n&&i}containsItem(e){const t=ph._createBefore(e);return this.containsPosition(t)||this.start.isEqual(t)}isEqual(e){return this.start.isEqual(e.start)&&this.end.isEqual(e.end)}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new _h(this.start,e.start)),this.containsPosition(e.end)&&t.push(new _h(e.end,this.end))):t.push(new _h(this.start,this.end)),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,n=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(n=e.end),new _h(t,n)}return null}getJoined(e,t=!1){let n=this.isIntersecting(e);if(n||(n=this.start.isBefore(e.start)?t?this.end.isTouching(e.start):this.end.isEqual(e.start):t?e.end.isTouching(this.start):e.end.isEqual(this.start)),!n)return null;let i=this.start,r=this.end;return e.start.isBefore(i)&&(i=e.start),e.end.isAfter(r)&&(r=e.end),new _h(i,r)}getMinimalFlatRanges(){const e=[],t=this.start.getCommonPath(this.end).length,n=ph._createAt(this.start);let i=n.parent;for(;n.path.length>t+1;){const t=i.maxOffset-n.offset;0!==t&&e.push(new _h(n,n.getShiftedBy(t))),n.path=n.path.slice(0,-1),n.offset++,i=i.parent}for(;n.path.length<=this.end.path.length;){const t=this.end.path[n.path.length-1],i=t-n.offset;0!==i&&e.push(new _h(n,n.getShiftedBy(i))),n.offset=t,n.path.push(0)}return e}getWalker(e={}){return e.boundaries=this,new mh(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new mh(e);for(const e of t)yield e.item}*getPositions(e={}){e.boundaries=this;const t=new mh(e);yield t.position;for(const e of t)yield e.nextPosition}getTransformedByOperation(e){switch(e.type){case"insert":return this._getTransformedByInsertOperation(e);case"move":case"remove":case"reinsert":return this._getTransformedByMoveOperation(e);case"split":return[this._getTransformedBySplitOperation(e)];case"merge":return[this._getTransformedByMergeOperation(e)]}return[new _h(this.start,this.end)]}getTransformedByOperations(e){const t=[new _h(this.start,this.end)];for(const n of e)for(let e=0;e<t.length;e++){const i=t[e].getTransformedByOperation(n);t.splice(e,1,...i),e+=i.length-1}for(let e=0;e<t.length;e++){const n=t[e];for(let i=e+1;i<t.length;i++){const e=t[i];(n.containsRange(e)||e.containsRange(n)||n.isEqual(e))&&t.splice(i,1)}}return t}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;const e=this.start.nodeAfter,t=this.end.nodeBefore;return e&&e.is("element")&&e===t?e:null}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}clone(){return new this.constructor(this.start,this.end)}_getTransformedByInsertOperation(e,t=!1){return this._getTransformedByInsertion(e.position,e.howMany,t)}_getTransformedByMoveOperation(e,t=!1){const n=e.sourcePosition,i=e.howMany,r=e.targetPosition;return this._getTransformedByMove(n,r,i,t)}_getTransformedBySplitOperation(e){const t=this.start._getTransformedBySplitOperation(e);let n=this.end._getTransformedBySplitOperation(e);return this.end.isEqual(e.insertionPosition)&&(n=this.end.getShiftedBy(1)),t.root!=n.root&&(n=this.end.getShiftedBy(-1)),new _h(t,n)}_getTransformedByMergeOperation(e){if(this.start.isEqual(e.targetPosition)&&this.end.isEqual(e.deletionPosition))return new _h(this.start);let t=this.start._getTransformedByMergeOperation(e),n=this.end._getTransformedByMergeOperation(e);return t.root!=n.root&&(n=this.end.getShiftedBy(-1)),t.isAfter(n)?(e.sourcePosition.isBefore(e.targetPosition)?(t=ph._createAt(n),t.offset=0):(e.deletionPosition.isEqual(t)||(n=e.deletionPosition),t=e.targetPosition),new _h(t,n)):new _h(t,n)}_getTransformedByInsertion(e,t,n=!1){if(n&&this.containsPosition(e))return[new _h(this.start,e),new _h(e.getShiftedBy(t),this.end._getTransformedByInsertion(e,t))];{const n=new _h(this.start,this.end);return n.start=n.start._getTransformedByInsertion(e,t),n.end=n.end._getTransformedByInsertion(e,t),[n]}}_getTransformedByMove(e,t,n,i=!1){if(this.isCollapsed){const i=this.start._getTransformedByMove(e,t,n);return[new _h(i)]}const r=_h._createFromPositionAndShift(e,n),s=t._getTransformedByDeletion(e,n);if(this.containsPosition(t)&&!i&&(r.containsPosition(this.start)||r.containsPosition(this.end))){const i=this.start._getTransformedByMove(e,t,n),r=this.end._getTransformedByMove(e,t,n);return[new _h(i,r)]}let o;const a=this.getDifference(r);let l=null;const c=this.getIntersection(r);if(1==a.length?l=new _h(a[0].start._getTransformedByDeletion(e,n),a[0].end._getTransformedByDeletion(e,n)):2==a.length&&(l=new _h(this.start,this.end._getTransformedByDeletion(e,n))),o=l?l._getTransformedByInsertion(s,n,null!==c||i):[],c){const e=new _h(c.start._getCombined(r.start,s),c.end._getCombined(r.start,s));2==o.length?o.splice(1,0,e):o.push(e)}return o}_getTransformedByDeletion(e,t){let n=this.start._getTransformedByDeletion(e,t),i=this.end._getTransformedByDeletion(e,t);return null==n&&null==i?null:(null==n&&(n=e),null==i&&(i=e),new _h(n,i))}static _createFromPositionAndShift(e,t){const n=e,i=e.getShiftedBy(t);return t>0?new this(n,i):new this(i,n)}static _createIn(e){return new this(ph._createAt(e,0),ph._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(ph._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(0===e.length)throw new Aa("range-create-from-ranges-empty-array",null);if(1==e.length)return e[0].clone();const t=e[0];e.sort(((e,t)=>e.start.isAfter(t.start)?1:-1));const n=e.indexOf(t),i=new this(t.start,t.end);for(let t=n-1;t>=0&&e[t].end.isEqual(i.start);t--)i.start=ph._createAt(e[t].start);for(let t=n+1;t<e.length&&e[t].start.isEqual(i.end);t++)i.end=ph._createAt(e[t].end);return i}static fromJSON(e,t){return new this(ph.fromJSON(e.start,t),ph.fromJSON(e.end,t))}}_h.prototype.is=function(e){return"range"===e||"model:range"===e};class kh extends(Na()){_modelToViewMapping=new WeakMap;_viewToModelMapping=new WeakMap;_viewToModelLengthCallbacks=new Map;_markerNameToElements=new Map;_elementToMarkerNames=new Map;_deferredBindingRemovals=new Map;_unboundMarkerNames=new Set;_cache=new xh;constructor(){super(),this.on("modelToViewPosition",((e,t)=>{if(t.viewPosition)return;const n=this._modelToViewMapping.get(t.modelPosition.parent);if(!n)throw new Aa("mapping-model-position-view-parent-not-found",this,{modelPosition:t.modelPosition});t.viewPosition=this.findPositionIn(n,t.modelPosition.offset)}),{priority:"low"}),this.on("viewToModelPosition",((e,t)=>{if(t.modelPosition)return;const n=this.findMappedViewAncestor(t.viewPosition),i=this._viewToModelMapping.get(n),r=this._toModelOffset(t.viewPosition.parent,t.viewPosition.offset,n);t.modelPosition=ph._createAt(i,r)}),{priority:"low"})}bindElements(e,t){this._modelToViewMapping.set(e,t),this._viewToModelMapping.set(t,e)}unbindViewElement(e,t={}){const n=this.toModelElement(e);if(this._elementToMarkerNames.has(e))for(const t of this._elementToMarkerNames.get(e))this._unboundMarkerNames.add(t);t.defer?this._deferredBindingRemovals.set(e,e.root):(this._viewToModelMapping.delete(e)&&this._cache.stopTracking(e),this._modelToViewMapping.get(n)==e&&this._modelToViewMapping.delete(n))}unbindModelElement(e){const t=this.toViewElement(e);this._modelToViewMapping.delete(e),this._viewToModelMapping.get(t)==e&&this._viewToModelMapping.delete(t)&&this._cache.stopTracking(t)}bindElementToMarker(e,t){const n=this._markerNameToElements.get(t)||new Set;n.add(e);const i=this._elementToMarkerNames.get(e)||new Set;i.add(t),this._markerNameToElements.set(t,n),this._elementToMarkerNames.set(e,i)}unbindElementFromMarkerName(e,t){const n=this._markerNameToElements.get(t);n&&(n.delete(e),0==n.size&&this._markerNameToElements.delete(t));const i=this._elementToMarkerNames.get(e);i&&(i.delete(t),0==i.size&&this._elementToMarkerNames.delete(e))}flushUnboundMarkerNames(){const e=Array.from(this._unboundMarkerNames);return this._unboundMarkerNames.clear(),e}flushDeferredBindings(){for(const[e,t]of this._deferredBindingRemovals)e.root==t&&this.unbindViewElement(e);this._deferredBindingRemovals=new Map}clearBindings(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set,this._deferredBindingRemovals=new Map}toModelElement(e){return this._viewToModelMapping.get(e)}toViewElement(e){return this._modelToViewMapping.get(e)}toModelRange(e){return new _h(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new Zd(this.toViewPosition(e.start),this.toViewPosition(e.end))}toModelPosition(e){const t={viewPosition:e,mapper:this};return this.fire("viewToModelPosition",t),t.modelPosition}toViewPosition(e,t={}){const n={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",n),n.viewPosition}markerNameToElements(e){const t=this._markerNameToElements.get(e);if(!t)return null;const n=new Set;for(const e of t)if(e.is("attributeElement"))for(const t of e.getElementsWithSameId())n.add(t);else n.add(e);return n}registerViewToModelLength(e,t){this._viewToModelLengthCallbacks.set(e,t)}findMappedViewAncestor(e){let t=e.parent;for(;!this._viewToModelMapping.has(t);)t=t.parent;return t}_toModelOffset(e,t,n){if(n!=e)return this._toModelOffset(e.parent,e.index,n)+this._toModelOffset(e,t,e);if(e.is("$text"))return t;let i=0;for(let n=0;n<t;n++)i+=this.getModelLength(e.getChild(n));return i}getModelLength(e){const t=[e];let n=0;for(;t.length>0;){const e=t.pop(),i=e.name&&this._viewToModelLengthCallbacks.size>0&&this._viewToModelLengthCallbacks.get(e.name);if(i)n+=i(e);else if(this._viewToModelMapping.has(e))n+=1;else if(e.is("$text"))n+=e.data.length;else{if(e.is("uiElement"))continue;for(const n of e.getChildren())t.push(n)}}return n}findPositionIn(e,t){if(0===t)return this._moveViewPositionToTextNode(new Kd(e,0));if(0==this._viewToModelLengthCallbacks.size&&this._viewToModelMapping.has(e)){const n=this._cache.getClosest(e,t);return this._findPositionStartingFrom(n.viewPosition,n.modelOffset,t,e,!0)}return this._findPositionStartingFrom(new Kd(e,0),0,t,e,!1)}_findPositionStartingFrom(e,t,n,i,r){let s,o=e.parent,a=e.offset;if(o.is("$text"))return new Kd(o,n-t);let l=t,c=0;for(;l<n;)if(s=o.getChild(a),s)c=this.getModelLength(s),l+=c,a++,r&&this._cache.save(o,a,i,l);else{if(o==i)throw new Aa("mapping-model-offset-not-found",this,{modelOffset:n,viewContainer:i});a=o.parent.getChildIndex(o)+1,o=o.parent}return l==n?this._moveViewPositionToTextNode(new Kd(o,a)):this._findPositionStartingFrom(new Kd(s,0),l-c,n,i,r)}_moveViewPositionToTextNode(e){const t=e.nodeBefore,n=e.nodeAfter;return t&&t.is("view:$text")?new Kd(t,t.data.length):n&&n.is("view:$text")?new Kd(n,0):e}}class xh extends(Na()){_cachedMapping=new WeakMap;_nodeToCacheListIndex=new WeakMap;_invalidateOnChildrenChangeCallback=(e,t,n)=>{this._clearCacheInsideParent(t,n.index)};_invalidateOnTextChangeCallback=(e,t)=>{this._clearCacheStartingBefore(t)};save(e,t,n,i){const r=this._cachedMapping.get(n),s=r.cacheMap.get(i);if(s){const n=e.getChild(t-1),i=s.viewPosition.nodeBefore?this._nodeToCacheListIndex.get(s.viewPosition.nodeBefore):0;return void this._nodeToCacheListIndex.set(n,i)}const o={viewPosition:new Kd(e,t),modelOffset:i};r.maxModelOffset=i>r.maxModelOffset?i:r.maxModelOffset,r.cacheMap.set(i,o);let a=r.cacheList.length-1;for(;a>=0&&r.cacheList[a].modelOffset>i;)a--;if(r.cacheList.splice(a+1,0,o),t>0){const n=e.getChild(t-1);this._nodeToCacheListIndex.set(n,a+1)}}getClosest(e,t){const n=this._cachedMapping.get(e);let i;if(n)if(t>n.maxModelOffset)i=n.cacheList[n.cacheList.length-1];else{i=n.cacheMap.get(t)||this._findInCacheList(n.cacheList,t)}else i=this.startTracking(e);const r=this._hoistViewPosition(i.viewPosition);return{modelOffset:i.modelOffset,viewPosition:r}}_hoistViewPosition(e){for(;e.parent.parent&&!this._cachedMapping.has(e.parent)&&e.isAtEnd;){const t=e.parent.parent,n=t.getChildIndex(e.parent)+1;e=new Kd(t,n)}return e}startTracking(e){const t={viewPosition:new Kd(e,0),modelOffset:0},n={maxModelOffset:0,cacheList:[t],cacheMap:new Map([[0,t]])};return this._cachedMapping.set(e,n),e.on("change:children",this._invalidateOnChildrenChangeCallback),e.on("change:text",this._invalidateOnTextChangeCallback),t}stopTracking(e){e.off("change:children",this._invalidateOnChildrenChangeCallback),e.off("change:text",this._invalidateOnTextChangeCallback),this._cachedMapping.delete(e)}_clearCacheInsideParent(e,t){if(0==t)this._cachedMapping.has(e)?this._clearCacheAll(e):this._clearCacheStartingBefore(e);else{const n=e.getChild(t-1);this._clearCacheStartingBefore(n)}}_clearCacheAll(e){const t=this._cachedMapping.get(e);t.maxModelOffset>0&&(t.maxModelOffset=0,t.cacheList.length=1,t.cacheMap.clear(),t.cacheMap.set(0,t.cacheList[0]))}_clearCacheStartingBefore(e){const t=this._nodeToCacheListIndex.get(e);if(void 0===t){const t=e.parent;return void(this._cachedMapping.has(t)||this._clearCacheStartingBefore(t))}let n=e.parent;for(;!this._cachedMapping.has(n);)n=n.parent;this._clearCacheFromIndex(n,t)}_clearCacheFromIndex(e,t){0===t&&(t=1);const n=this._cachedMapping.get(e),i=n.cacheList[t-1];if(!i)return;n.maxModelOffset=i.modelOffset;const r=n.cacheList.splice(t);for(const e of r){n.cacheMap.delete(e.modelOffset);const t=e.viewPosition.nodeBefore;this._nodeToCacheListIndex.delete(t)}}_findInCacheList(e,t){let n=0,i=e.length-1,r=i-n>>1,s=e[r];for(;n<i;)s.modelOffset<t?n=r+1:i=r-1,r=n+(i-n>>1),s=e[r];return s.modelOffset<=t?s:e[r-1]}}class Ch{_consumable=new Map;_textProxyRegistry=new Map;add(e,t){t=Ah(t),e instanceof hh&&(e=this._getSymbolForTextProxy(e)),this._consumable.has(e)||this._consumable.set(e,new Map),this._consumable.get(e).set(t,!0)}consume(e,t){return t=Ah(t),e instanceof hh&&(e=this._getSymbolForTextProxy(e)),!!this.test(e,t)&&(this._consumable.get(e).set(t,!1),!0)}test(e,t){t=Ah(t),e instanceof hh&&(e=this._getSymbolForTextProxy(e));const n=this._consumable.get(e);if(void 0===n)return null;const i=n.get(t);return void 0===i?null:i}revert(e,t){t=Ah(t),e instanceof hh&&(e=this._getSymbolForTextProxy(e));const n=this.test(e,t);return!1===n?(this._consumable.get(e).set(t,!0),!0):!0!==n&&null}verifyAllConsumed(e){const t=[];for(const[n,i]of this._consumable)for(const[r,s]of i){const i=r.split(":")[0];s&&e==i&&t.push({event:r,item:n.name||n.description})}if(t.length)throw new Aa("conversion-model-consumable-not-consumed",null,{items:t})}_getSymbolForTextProxy(e){let t=null;const n=this._textProxyRegistry.get(e.startOffset);if(n){const i=n.get(e.endOffset);i&&(t=i.get(e.parent))}return t||(t=this._addSymbolForTextProxy(e)),t}_addSymbolForTextProxy(e){const t=e.startOffset,n=e.endOffset,i=e.parent,r=Symbol("$textProxy:"+e.data);let s,o;return s=this._textProxyRegistry.get(t),s||(s=new Map,this._textProxyRegistry.set(t,s)),o=s.get(n),o||(o=new Map,s.set(n,o)),o.set(i,r),r}}function Ah(e){const t=e.split(":");return"insert"==t[0]?t[0]:"addMarker"==t[0]||"removeMarker"==t[0]?e:t.length>1?t[0]+":"+t[1]:t[0]}class Eh extends(Na()){_conversionApi;_firedEventsMap;constructor(e){super(),this._conversionApi={dispatcher:this,...e},this._firedEventsMap=new WeakMap}convertChanges(e,t,n){const i=this._createConversionApi(n,e.getRefreshedItems());for(const t of e.getMarkersToRemove())this._convertMarkerRemove(t.name,t.range,i);const r=this._reduceChanges(e.getChanges());for(const e of r)"insert"===e.type?this._convertInsert(_h._createFromPositionAndShift(e.position,e.length),i):"reinsert"===e.type?this._convertReinsert(_h._createFromPositionAndShift(e.position,e.length),i):"remove"===e.type?this._convertRemove(e.position,e.length,e.name,i):this._convertAttribute(e.range,e.attributeKey,e.attributeOldValue,e.attributeNewValue,i);i.mapper.flushDeferredBindings();for(const e of i.mapper.flushUnboundMarkerNames()){const n=t.get(e).getRange();this._convertMarkerRemove(e,n,i),this._convertMarkerAdd(e,n,i)}for(const t of e.getMarkersToAdd())this._convertMarkerAdd(t.name,t.range,i);i.consumable.verifyAllConsumed("insert")}convert(e,t,n,i={}){const r=this._createConversionApi(n,void 0,i);this._convertInsert(e,r);for(const[e,n]of t)this._convertMarkerAdd(e,n,r);r.consumable.verifyAllConsumed("insert")}convertSelection(e,t,n){const i=this._createConversionApi(n);this.fire("cleanSelection",{selection:e},i);const r=e.getFirstPosition().root;if(!i.mapper.toViewElement(r))return;const s=Array.from(t.getMarkersAtPosition(e.getFirstPosition()));if(this._addConsumablesForSelection(i.consumable,e,s),this.fire("selection",{selection:e},i),e.isCollapsed){for(const t of s)if(i.consumable.test(e,"addMarker:"+t.name)){const n=t.getRange();if(!Th(e.getFirstPosition(),t,i.mapper))continue;const r={item:e,markerName:t.name,markerRange:n};this.fire(`addMarker:${t.name}`,r,i)}for(const t of e.getAttributeKeys())if(i.consumable.test(e,"attribute:"+t)){const n={item:e,range:e.getFirstRange(),attributeKey:t,attributeOldValue:null,attributeNewValue:e.getAttribute(t)};this.fire(`attribute:${t}:$text`,n,i)}}}_convertInsert(e,t,n={}){n.doNotAddConsumables||this._addConsumablesForInsert(t.consumable,e);for(const n of e.getWalker({shallow:!0}))this._testAndFire("insert",Sh(n),t)}_convertRemove(e,t,n,i){this.fire(`remove:${n}`,{position:e,length:t},i)}_convertAttribute(e,t,n,i,r){this._addConsumablesForRange(r.consumable,e,`attribute:${t}`);for(const s of e){const e={item:s.item,range:_h._createFromPositionAndShift(s.previousPosition,s.length),attributeKey:t,attributeOldValue:n,attributeNewValue:i};this._testAndFire(`attribute:${t}`,e,r)}}_convertReinsert(e,t){const n=Array.from(e.getWalker({shallow:!0}));this._addConsumablesForInsert(t.consumable,n);for(const e of n.map(Sh))this._testAndFire("insert",{...e,reconversion:!0},t)}_convertMarkerAdd(e,t,n){if("$graveyard"==t.root.rootName)return;const i=`addMarker:${e}`;if(n.consumable.add(t,i),this.fire(i,{markerName:e,markerRange:t},n),n.consumable.consume(t,i)){this._addConsumablesForRange(n.consumable,t,i);for(const r of t.getItems()){if(!n.consumable.test(r,i))continue;const s={item:r,range:_h._createOn(r),markerName:e,markerRange:t};this.fire(i,s,n)}}}_convertMarkerRemove(e,t,n){"$graveyard"!=t.root.rootName&&this.fire(`removeMarker:${e}`,{markerName:e,markerRange:t},n)}_reduceChanges(e){const t={changes:e};return this.fire("reduceChanges",t),t.changes}_addConsumablesForInsert(e,t){for(const n of t){const t=n.item;if(null===e.test(t,"insert")){e.add(t,"insert");for(const n of t.getAttributeKeys())e.add(t,"attribute:"+n)}}return e}_addConsumablesForRange(e,t,n){for(const i of t.getItems())e.add(i,n);return e}_addConsumablesForSelection(e,t,n){e.add(t,"selection");for(const i of n)e.add(t,"addMarker:"+i.name);for(const n of t.getAttributeKeys())e.add(t,"attribute:"+n);return e}_testAndFire(e,t,n){const i=function(e,t){return`${e}:${t.item.is("element")?t.item.name:"$text"}`}(e,t),r=t.item.is("$textProxy")?n.consumable._getSymbolForTextProxy(t.item):t.item,s=this._firedEventsMap.get(n),o=s.get(r);if(o){if(o.has(i))return;o.add(i)}else s.set(r,new Set([i]));this.fire(i,t,n)}_testAndFireAddAttributes(e,t){const n={item:e,range:_h._createOn(e)};for(const e of n.item.getAttributeKeys())n.attributeKey=e,n.attributeOldValue=null,n.attributeNewValue=n.item.getAttribute(e),this._testAndFire(`attribute:${e}`,n,t)}_createConversionApi(e,t=new Set,n={}){const i={...this._conversionApi,consumable:new Ch,writer:e,options:n,convertItem:e=>this._convertInsert(_h._createOn(e),i),convertChildren:e=>this._convertInsert(_h._createIn(e),i,{doNotAddConsumables:!0}),convertAttributes:e=>this._testAndFireAddAttributes(e,i),canReuseView:e=>!t.has(i.mapper.toModelElement(e))};return this._firedEventsMap.set(i,new Map),i}}function Th(e,t,n){const i=t.getRange(),r=Array.from(e.getAncestors());return r.shift(),r.reverse(),!r.some((e=>{if(i.containsItem(e))return!!n.toViewElement(e).getCustomProperty("addHighlight")}))}function Sh(e){return{item:e.item,range:_h._createFromPositionAndShift(e.previousPosition,e.length)}}let Ph=class extends uh{parent=null;_attrs;_index=null;_startOffset=null;constructor(e){super(),this._attrs=mc(e)}get document(){return null}get index(){return this._index}get startOffset(){return this._startOffset}get offsetSize(){return 1}get endOffset(){return null===this.startOffset?null:this.startOffset+this.offsetSize}get nextSibling(){const e=this.index;return null!==e&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return null!==e&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return null!==this.parent&&this.root.isAttached()}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.startOffset),t=t.parent;return e}getAncestors(e={}){const t=[];let n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}getCommonAncestor(e,t={}){const n=this.getAncestors(t),i=e.getAncestors(t);let r=0;for(;n[r]==i[r]&&n[r];)r++;return 0===r?null:n[r-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),n=e.getPath(),i=tl(t,n);switch(i){case"prefix":return!0;case"extension":return!1;default:return t[i]<n[i]}}isAfter(e){return this!=e&&this.root===e.root&&!this.isBefore(e)}hasAttribute(e){return this._attrs.has(e)}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}toJSON(){const e={};return this._attrs.size&&(e.attributes=Array.from(this._attrs).reduce(((e,t)=>(e[t[0]]=t[1],e)),{})),e}_clone(e){return new this.constructor(this._attrs)}_remove(){this.parent._removeChildren(this.index)}_setAttribute(e,t){this._attrs.set(e,t)}_setAttributesTo(e){this._attrs=mc(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}};Ph.prototype.is=function(e){return"node"===e||"model:node"===e};class Ih extends(Na(uh)){_lastRangeBackward=!1;_attrs=new Map;_ranges=[];constructor(...e){super(),e.length&&this.setTo(...e)}get anchor(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.end:e.start}return null}get focus(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.start:e.end}return null}get isCollapsed(){return 1===this._ranges.length&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}isEqual(e){if(this.rangeCount!=e.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let n=!1;for(const i of e._ranges)if(t.isEqual(i)){n=!0;break}if(!n)return!1}return!0}*getRanges(){for(const e of this._ranges)yield new _h(e.start,e.end)}getFirstRange(){let e=null;for(const t of this._ranges)e&&!t.start.isBefore(e.start)||(e=t);return e?new _h(e.start,e.end):null}getLastRange(){let e=null;for(const t of this._ranges)e&&!t.end.isAfter(e.end)||(e=t);return e?new _h(e.start,e.end):null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}setTo(...e){let[t,n,i]=e;if("object"==typeof n&&(i=n,n=void 0),null===t)this._setRanges([]);else if(t instanceof Ih)this._setRanges(t.getRanges(),t.isBackward);else if(t&&"function"==typeof t.getRanges)this._setRanges(t.getRanges(),t.isBackward);else if(t instanceof _h)this._setRanges([t],!!i&&!!i.backward);else if(t instanceof ph)this._setRanges([new _h(t)]);else if(t instanceof Ph){const e=!!i&&!!i.backward;let r;if("in"==n)r=_h._createIn(t);else if("on"==n)r=_h._createOn(t);else{if(void 0===n)throw new Aa("model-selection-setto-required-second-parameter",[this,t]);r=new _h(ph._createAt(t,n))}this._setRanges([r],e)}else{if(!nl(t))throw new Aa("model-selection-setto-not-selectable",[this,t]);this._setRanges(t,i&&!!i.backward)}}_setRanges(e,t=!1){const n=Array.from(e),i=n.some((t=>{if(!(t instanceof _h))throw new Aa("model-selection-set-ranges-not-range",[this,e]);return this._ranges.every((e=>!e.isEqual(t)))}));(n.length!==this._ranges.length||i)&&(this._replaceAllRanges(n),this._lastRangeBackward=!!t,this.fire("change:range",{directChange:!0}))}setFocus(e,t){if(null===this.anchor)throw new Aa("model-selection-setfocus-no-ranges",[this,e]);const n=ph._createAt(e,t);if("same"==n.compareWith(this.focus))return;const i=this.anchor;this._ranges.length&&this._popRange(),"before"==n.compareWith(i)?(this._pushRange(new _h(n,i)),this._lastRangeBackward=!0):(this._pushRange(new _h(i,n)),this._lastRangeBackward=!1),this.fire("change:range",{directChange:!0})}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}hasAttribute(e){return this._attrs.has(e)}removeAttribute(e){this.hasAttribute(e)&&(this._attrs.delete(e),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}setAttribute(e,t){this.getAttribute(e)!==t&&(this._attrs.set(e,t),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}*getSelectedBlocks(){const e=new WeakSet;for(const t of this.getRanges()){const n=Rh(t.start,e);Lh(n,t)&&(yield n);const i=t.getWalker();for(const n of i){const r=n.item;"elementEnd"==n.type&&Vh(r,e,t)?yield r:"elementStart"==n.type&&r.is("model:element")&&r.root.document.model.schema.isBlock(r)&&i.jumpTo(ph._createAt(r,"end"))}const r=Rh(t.end,e);Mh(r,t)&&(yield r)}}containsEntireContent(e=this.anchor.root){const t=ph._createAt(e,0),n=ph._createAt(e,"end");return t.isTouching(this.getFirstPosition())&&n.isTouching(this.getLastPosition())}_pushRange(e){this._checkRange(e),this._ranges.push(new _h(e.start,e.end))}_checkRange(e){for(let t=0;t<this._ranges.length;t++)if(e.isIntersecting(this._ranges[t]))throw new Aa("model-selection-range-intersects",[this,e],{addedRange:e,intersectingRange:this._ranges[t]})}_replaceAllRanges(e){this._removeAllRanges();for(const t of e)this._pushRange(t)}_removeAllRanges(){for(;this._ranges.length>0;)this._popRange()}_popRange(){this._ranges.pop()}}function Oh(e,t){return!t.has(e)&&(t.add(e),e.root.document.model.schema.isBlock(e)&&!!e.parent)}function Vh(e,t,n){return Oh(e,t)&&Nh(e,n)}function Rh(e,t){const n=e.parent.root.document.model.schema,i=e.parent.getAncestors({parentFirst:!0,includeSelf:!0});let r=!1;const s=i.find((e=>!r&&(r=n.isLimit(e),!r&&Oh(e,t))));return i.forEach((e=>t.add(e))),s}function Nh(e,t){const n=function(e){const t=e.root.document.model.schema;let n=e.parent;for(;n;){if(t.isBlock(n))return n;n=n.parent}}(e);return!n||!t.containsRange(_h._createOn(n),!0)}function Lh(e,t){return!!e&&(!(!t.isCollapsed&&!e.isEmpty)||!t.start.isTouching(ph._createAt(e,e.maxOffset))&&Nh(e,t))}function Mh(e,t){return!!e&&(!(!t.isCollapsed&&!e.isEmpty)||!t.end.isTouching(ph._createAt(e,0))&&Nh(e,t))}Ih.prototype.is=function(e){return"selection"===e||"model:selection"===e};class Bh extends(Na(_h)){constructor(e,t){super(e,t),Fh.call(this)}detach(){this.stopListening()}toRange(){return new _h(this.start,this.end)}static fromRange(e){return new Bh(e.start,e.end)}}function Fh(){this.listenTo(this.root.document.model,"applyOperation",((e,t)=>{const n=t[0];n.isDocumentOperation&&Dh.call(this,n)}),{priority:"low"})}function Dh(e){const t=this.getTransformedByOperation(e),n=_h._createFromRanges(t),i=!n.isEqual(this),r=function(e,t){switch(t.type){case"insert":return e.containsPosition(t.position);case"move":case"remove":case"reinsert":case"merge":return e.containsPosition(t.sourcePosition)||e.start.isEqual(t.sourcePosition)||e.containsPosition(t.targetPosition);case"split":return e.containsPosition(t.splitPosition)||e.containsPosition(t.insertionPosition)}return!1}(this,e);let s=null;if(i){"$graveyard"==n.root.rootName&&(s="remove"==e.type?e.sourcePosition:e.deletionPosition);const t=this.toRange();this.start=n.start,this.end=n.end,this.fire("change:range",t,{deletionPosition:s})}else r&&this.fire("change:content",this.toRange(),{deletionPosition:s})}Bh.prototype.is=function(e){return"liveRange"===e||"model:liveRange"===e||"range"==e||"model:range"===e};class zh extends Ph{_data;constructor(e,t){super(t),this._data=e||""}get offsetSize(){return this.data.length}get data(){return this._data}toJSON(){const e=super.toJSON();return e.data=this.data,e}_clone(){return new zh(this.data,this.getAttributes())}static fromJSON(e){return new zh(e.data,e.attributes)}}zh.prototype.is=function(e){return"$text"===e||"model:$text"===e||"text"===e||"model:text"===e||"node"===e||"model:node"===e};const $h="selection:";class jh extends(Na(uh)){_selection;constructor(e){super(),this._selection=new Hh(e),this._selection.delegate("change:range").to(this),this._selection.delegate("change:attribute").to(this),this._selection.delegate("change:marker").to(this)}get isCollapsed(){return this._selection.isCollapsed}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get rangeCount(){return this._selection.rangeCount}get hasOwnRange(){return this._selection.hasOwnRange}get isBackward(){return this._selection.isBackward}get isGravityOverridden(){return this._selection.isGravityOverridden}get markers(){return this._selection.markers}get _ranges(){return this._selection._ranges}getRanges(){return this._selection.getRanges()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getSelectedBlocks(){return this._selection.getSelectedBlocks()}getSelectedElement(){return this._selection.getSelectedElement()}containsEntireContent(e){return this._selection.containsEntireContent(e)}destroy(){this._selection.destroy()}getAttributeKeys(){return this._selection.getAttributeKeys()}getAttributes(){return this._selection.getAttributes()}getAttribute(e){return this._selection.getAttribute(e)}hasAttribute(e){return this._selection.hasAttribute(e)}refresh(){this._selection.updateMarkers(),this._selection._updateAttributes(!1)}observeMarkers(e){this._selection.observeMarkers(e)}_setFocus(e,t){this._selection.setFocus(e,t)}_setTo(...e){this._selection.setTo(...e)}_setAttribute(e,t){this._selection.setAttribute(e,t)}_removeAttribute(e){this._selection.removeAttribute(e)}_getStoredAttributes(){return this._selection.getStoredAttributes()}_overrideGravity(){return this._selection.overrideGravity()}_restoreGravity(e){this._selection.restoreGravity(e)}static _getStoreAttributeKey(e){return $h+e}static _isStoreAttributeKey(e){return e.startsWith($h)}}jh.prototype.is=function(e){return"selection"===e||"model:selection"==e||"documentSelection"==e||"model:documentSelection"==e};class Hh extends Ih{markers=new oc({idProperty:"name"});_model;_document;_attributePriority=new Map;_selectionRestorePosition=null;_hasChangedRange=!1;_overriddenGravityRegister=new Set;_observedMarkers=new Set;constructor(e){super(),this._model=e.model,this._document=e,this.listenTo(this._model,"applyOperation",((e,t)=>{const n=t[0];n.isDocumentOperation&&"marker"!=n.type&&"rename"!=n.type&&"noop"!=n.type&&(0==this._ranges.length&&this._selectionRestorePosition&&this._fixGraveyardSelection(this._selectionRestorePosition),this._selectionRestorePosition=null,this._hasChangedRange&&(this._hasChangedRange=!1,this.fire("change:range",{directChange:!1})))}),{priority:"lowest"}),this.on("change:range",(()=>{this._validateSelectionRanges(this.getRanges())})),this.listenTo(this._model.markers,"update",((e,t,n,i)=>{this._updateMarker(t,i)})),this.listenTo(this._document,"change",((e,t)=>{!function(e,t){const n=e.document.differ;for(const i of n.getChanges()){if("insert"!=i.type)continue;const n=i.position.parent;i.length===n.maxOffset&&e.enqueueChange(t,(e=>{const t=Array.from(n.getAttributeKeys()).filter((e=>e.startsWith($h)));for(const i of t)e.removeAttribute(i,n)}))}}(this._model,t)}))}get isCollapsed(){return 0===this._ranges.length?this._document._getDefaultRange().isCollapsed:super.isCollapsed}get anchor(){return super.anchor||this._document._getDefaultRange().start}get focus(){return super.focus||this._document._getDefaultRange().end}get rangeCount(){return this._ranges.length?this._ranges.length:1}get hasOwnRange(){return this._ranges.length>0}get isGravityOverridden(){return!!this._overriddenGravityRegister.size}destroy(){for(let e=0;e<this._ranges.length;e++)this._ranges[e].detach();this.stopListening()}*getRanges(){this._ranges.length?yield*super.getRanges():yield this._document._getDefaultRange()}getFirstRange(){return super.getFirstRange()||this._document._getDefaultRange()}getLastRange(){return super.getLastRange()||this._document._getDefaultRange()}setTo(...e){super.setTo(...e),this._updateAttributes(!0),this.updateMarkers()}setFocus(e,t){super.setFocus(e,t),this._updateAttributes(!0),this.updateMarkers()}setAttribute(e,t){if(this._setAttribute(e,t)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}removeAttribute(e){if(this._removeAttribute(e)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}overrideGravity(){const e=ka();return this._overriddenGravityRegister.add(e),1===this._overriddenGravityRegister.size&&this._updateAttributes(!0),e}restoreGravity(e){if(!this._overriddenGravityRegister.has(e))throw new Aa("document-selection-gravity-wrong-restore",this,{uid:e});this._overriddenGravityRegister.delete(e),this.isGravityOverridden||this._updateAttributes(!0)}observeMarkers(e){this._observedMarkers.add(e),this.updateMarkers()}_replaceAllRanges(e){this._validateSelectionRanges(e),super._replaceAllRanges(e)}_popRange(){this._ranges.pop().detach()}_pushRange(e){const t=this._prepareRange(e);t&&this._ranges.push(t)}_validateSelectionRanges(e){for(const t of e)if(!this._document._validateSelectionRange(t))throw new Aa("document-selection-wrong-position",this,{range:t})}_prepareRange(e){if(this._checkRange(e),e.root==this._document.graveyard)return;const t=Bh.fromRange(e);return t.on("change:range",((e,n,i)=>{if(this._hasChangedRange=!0,t.root==this._document.graveyard){this._selectionRestorePosition=i.deletionPosition;const e=this._ranges.indexOf(t);this._ranges.splice(e,1),t.detach()}})),t}updateMarkers(){if(!this._observedMarkers.size)return;const e=[];let t=!1;for(const t of this._model.markers){const n=t.name.split(":",1)[0];if(!this._observedMarkers.has(n))continue;const i=t.getRange();for(const n of this.getRanges())i.containsRange(n,!n.isCollapsed)&&e.push(t)}const n=Array.from(this.markers);for(const n of e)this.markers.has(n)||(this.markers.add(n),t=!0);for(const n of Array.from(this.markers))e.includes(n)||(this.markers.remove(n),t=!0);t&&this.fire("change:marker",{oldMarkers:n,directChange:!1})}_updateMarker(e,t){const n=e.name.split(":",1)[0];if(!this._observedMarkers.has(n))return;let i=!1;const r=Array.from(this.markers),s=this.markers.has(e);if(t){let n=!1;for(const e of this.getRanges())if(t.containsRange(e,!e.isCollapsed)){n=!0;break}n&&!s?(this.markers.add(e),i=!0):!n&&s&&(this.markers.remove(e),i=!0)}else s&&(this.markers.remove(e),i=!0);i&&this.fire("change:marker",{oldMarkers:r,directChange:!1})}_updateAttributes(e){const t=mc(this._getSurroundingAttributes()),n=mc(this.getAttributes());if(e)this._attributePriority=new Map,this._attrs=new Map;else for(const[e,t]of this._attributePriority)"low"==t&&(this._attrs.delete(e),this._attributePriority.delete(e));this._setAttributesTo(t);const i=[];for(const[e,t]of this.getAttributes())n.has(e)&&n.get(e)===t||i.push(e);for(const[e]of n)this.hasAttribute(e)||i.push(e);i.length>0&&this.fire("change:attribute",{attributeKeys:i,directChange:!1})}_setAttribute(e,t,n=!0){const i=n?"normal":"low";return("low"!=i||"normal"!=this._attributePriority.get(e))&&(super.getAttribute(e)!==t&&(this._attrs.set(e,t),this._attributePriority.set(e,i),!0))}_removeAttribute(e,t=!0){const n=t?"normal":"low";return!("low"==n&&"normal"==this._attributePriority.get(e)||(this._attributePriority.set(e,n),!super.hasAttribute(e)||(this._attrs.delete(e),0)))}_setAttributesTo(e){const t=new Set;for(const[t,n]of this.getAttributes())e.get(t)!==n&&this._removeAttribute(t,!1);for(const[n,i]of e)this._setAttribute(n,i,!1)&&t.add(n);return t}*getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const t of e.getAttributeKeys())if(t.startsWith($h)){const n=t.substr(10);yield[n,e.getAttribute(t)]}}_getSurroundingAttributes(){const e=this.getFirstPosition(),t=this._model.schema;if("$graveyard"==e.root.rootName)return null;let n=null;if(this.isCollapsed){const i=e.textNode?e.textNode:e.nodeBefore,r=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(n=Wh(i,t)),n||(n=Wh(r,t)),!this.isGravityOverridden&&!n){let e=i;for(;e&&!n;)e=e.previousSibling,n=Wh(e,t)}if(!n){let e=r;for(;e&&!n;)e=e.nextSibling,n=Wh(e,t)}n||(n=this.getStoredAttributes())}else{const e=this.getFirstRange();for(const i of e){if(i.item.is("element")&&t.isObject(i.item)){n=Wh(i.item,t);break}if("text"==i.type){n=i.item.getAttributes();break}}}return n}_fixGraveyardSelection(e){const t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t)}}function Wh(e,t){if(!e)return null;if(e instanceof hh||e instanceof zh)return e.getAttributes();if(!t.isInline(e))return null;if(!t.isObject(e))return[];const n=[];for(const[i,r]of e.getAttributes())t.checkAttribute("$text",i)&&!1!==t.getAttributeProperties(i).copyFromObject&&n.push([i,r]);return n}class Uh{_nodes=[];_offsetToNode=[];constructor(e){e&&this._insertNodes(0,e)}[Symbol.iterator](){return this._nodes[Symbol.iterator]()}get length(){return this._nodes.length}get maxOffset(){return this._offsetToNode.length}getNode(e){return this._nodes[e]||null}getNodeAtOffset(e){return this._offsetToNode[e]||null}getNodeIndex(e){return e.index}getNodeStartOffset(e){return e.startOffset}indexToOffset(e){if(e==this._nodes.length)return this.maxOffset;const t=this._nodes[e];if(!t)throw new Aa("model-nodelist-index-out-of-bounds",this);return this.getNodeStartOffset(t)}offsetToIndex(e){if(e==this._offsetToNode.length)return this._nodes.length;const t=this._offsetToNode[e];if(!t)throw new Aa("model-nodelist-offset-out-of-bounds",this,{offset:e,nodeList:this});return this.getNodeIndex(t)}_insertNodes(e,t){const n=[];for(const e of t){if(!(e instanceof Ph))throw new Aa("model-nodelist-insertnodes-not-node",this);n.push(e)}let i=this.indexToOffset(e);gc(this._nodes,n,e),gc(this._offsetToNode,function(e){const t=[];let n=0;for(const i of e)for(let e=0;e<i.offsetSize;e++)t[n++]=i;return t}(n),i);for(let t=e;t<this._nodes.length;t++)this._nodes[t]._index=t,this._nodes[t]._startOffset=i,i+=this._nodes[t].offsetSize}_removeNodes(e,t=1){if(0==t)return[];let n=this.indexToOffset(e);const i=this._nodes.splice(e,t),r=i[i.length-1],s=r.startOffset+r.offsetSize-n;this._offsetToNode.splice(n,s);for(const e of i)e._index=null,e._startOffset=null;for(let t=e;t<this._nodes.length;t++)this._nodes[t]._index=t,this._nodes[t]._startOffset=n,n+=this._nodes[t].offsetSize;return i}_removeNodesArray(e){if(0==e.length)return;for(const t of e)t._index=null,t._startOffset=null;this._nodes=this._nodes.filter((e=>null!==e.index)),this._offsetToNode=this._offsetToNode.filter((e=>null!==e.index));let t=0;for(let e=0;e<this._nodes.length;e++)this._nodes[e]._index=e,this._nodes[e]._startOffset=t,t+=this._nodes[e].offsetSize}toJSON(){return this._nodes.map((e=>e.toJSON()))}}class qh extends Ph{name;_children=new Uh;constructor(e,t,n){super(t),this.name=e,n&&this._insertChild(0,n)}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}getChild(e){return this._children.getNode(e)}getChildAtOffset(e){return this._children.getNodeAtOffset(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}offsetToIndex(e){return this._children.offsetToIndex(e)}getNodeByPath(e){let t=this;for(const n of e)t=t.getChildAtOffset(n);return t}findAncestor(e,t={}){let n=t.includeSelf?this:this.parent;for(;n;){if(n.name===e)return n;n=n.parent}return null}toJSON(){const e=super.toJSON();if(e.name=this.name,this._children.length>0){e.children=[];for(const t of this._children)e.children.push(t.toJSON())}return e}_clone(e=!1){const t=e?function(e){const t=[];for(const n of e)t.push(n._clone(!0));return t}(this._children):void 0;return new qh(this.name,this.getAttributes(),t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const n=function(e){if("string"==typeof e)return[new zh(e)];nl(e)||(e=[e]);const t=[];for(const n of e)"string"==typeof n?t.push(new zh(n)):n instanceof hh?t.push(new zh(n.data,n.getAttributes())):t.push(n);return t}(t);for(const e of n)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,n)}_removeChildren(e,t=1){const n=this._children._removeNodes(e,t);for(const e of n)e.parent=null;return n}_removeChildrenArray(e){this._children._removeNodesArray(e);for(const t of e)t.parent=null}static fromJSON(e){let t;if(e.children){t=[];for(const n of e.children)n.name?t.push(qh.fromJSON(n)):t.push(zh.fromJSON(n))}return new qh(e.name,e.attributes,t)}}qh.prototype.is=function(e,t){return t?t===this.name&&("element"===e||"model:element"===e):"element"===e||"model:element"===e||"node"===e||"model:node"===e};class Gh{_dispatchers;constructor(e){this._dispatchers=e}add(e){for(const t of this._dispatchers)e(t);return this}}class Kh extends Gh{elementToElement(e){return this.add(function(e){const t=Yh(e.model),n=Jh(e.view,"container");return t.attributes.length&&(t.children=!0),i=>{i.on(`insert:${t.name}`,function(e,t=om){return(n,i,r)=>{if(!t(i.item,r.consumable,{preflight:!0}))return;const s=e(i.item,r,i);if(!s)return;t(i.item,r.consumable);const o=r.mapper.toViewPosition(i.range.start);r.mapper.bindElements(i.item,s),r.writer.insert(o,s),r.convertAttributes(i.item),rm(s,i.item.getChildren(),r,{reconversion:i.reconversion})}}(n,im(t)),{priority:e.converterPriority||"normal"}),(t.children||t.attributes.length)&&i.on("reduceChanges",nm(t),{priority:"low"})}}(e))}elementToStructure(e){return this.add(function(e){const t=Yh(e.model),n=Jh(e.view,"container");return t.children=!0,i=>{if(i._conversionApi.schema.checkChild(t.name,"$text"))throw new Aa("conversion-element-to-structure-disallowed-text",i,{elementName:t.name});var r,s;i.on(`insert:${t.name}`,(r=n,s=im(t),(e,t,n)=>{if(!s(t.item,n.consumable,{preflight:!0}))return;const i=new Map;n.writer._registerSlotFactory(function(e,t,n){return(i,r)=>{const s=i.createContainerElement("$slot");let o=null;if("children"===r)o=Array.from(e.getChildren());else{if("function"!=typeof r)throw new Aa("conversion-slot-mode-unknown",n.dispatcher,{modeOrFilter:r});o=Array.from(e.getChildren()).filter((e=>r(e)))}return t.set(s,o),s}}(t.item,i,n));const o=r(t.item,n,t);if(n.writer._clearSlotFactory(),!o)return;!function(e,t,n){const i=Array.from(t.values()).flat(),r=new Set(i);if(r.size!=i.length)throw new Aa("conversion-slot-filter-overlap",n.dispatcher,{element:e});if(r.size!=e.childCount)throw new Aa("conversion-slot-filter-incomplete",n.dispatcher,{element:e})}(t.item,i,n),s(t.item,n.consumable);const a=n.mapper.toViewPosition(t.range.start);n.mapper.bindElements(t.item,o),n.writer.insert(a,o),n.convertAttributes(t.item),function(e,t,n,i){n.mapper.on("modelToViewPosition",o,{priority:"highest"});let r=null,s=null;for([r,s]of t)rm(e,s,n,i),n.writer.move(n.writer.createRangeIn(r),n.writer.createPositionBefore(r)),n.writer.remove(r);function o(e,t){const n=t.modelPosition.nodeAfter,i=s.indexOf(n);i<0||(t.viewPosition=t.mapper.findPositionIn(r,i))}n.mapper.off("modelToViewPosition",o)}(o,i,n,{reconversion:t.reconversion})}),{priority:e.converterPriority||"normal"}),i.on("reduceChanges",nm(t),{priority:"low"})}}(e))}attributeToElement(e){return this.add(function(e){let t=(e=_d(e)).model;"string"==typeof t&&(t={key:t});let n=`attribute:${t.key}`;if(t.name&&(n+=":"+t.name),t.values)for(const n of t.values)e.view[n]=Jh(e.view[n],"attribute");else e.view=Jh(e.view,"attribute");const i=Xh(e);return t=>{t.on(n,function(e){return(t,n,i)=>{if(!i.consumable.test(n.item,t.name))return;const r=e(n.attributeOldValue,i,n),s=e(n.attributeNewValue,i,n);if(!r&&!s)return;i.consumable.consume(n.item,t.name);const o=i.writer,a=o.document.selection;if(n.item instanceof Ih||n.item instanceof jh)o.wrap(a.getFirstRange(),s);else{let e=i.mapper.toViewRange(n.range);null!==n.attributeOldValue&&r&&(e=o.unwrap(e,r)),null!==n.attributeNewValue&&s&&o.wrap(e,s)}}}(i),{priority:e.converterPriority||"normal"})}}(e))}attributeToAttribute(e){return this.add(function(e){let t=(e=_d(e)).model;"string"==typeof t&&(t={key:t});let n=`attribute:${t.key}`;if(t.name&&(n+=":"+t.name),t.values)for(const n of t.values)e.view[n]=em(e.view[n]);else e.view=em(e.view);const i=Xh(e);return t=>{var r;t.on(n,(r=i,(e,t,n)=>{if(!n.consumable.test(t.item,e.name))return;const i=r(t.attributeOldValue,n,t),s=r(t.attributeNewValue,n,t);if(!i&&!s)return;n.consumable.consume(t.item,e.name);const o=n.mapper.toViewElement(t.item),a=n.writer;if(!o)throw new Aa("conversion-attribute-to-attribute-on-text",n.dispatcher,t);if(null!==t.attributeOldValue&&i)if("class"==i.key){const e="string"==typeof i.value?i.value.split(/\s+/):i.value;for(const t of e)a.removeClass(t,o)}else if("style"==i.key)if("string"==typeof i.value){const e=new Md(a.document.stylesProcessor);e.setTo(i.value);for(const[t]of e.getStylesEntries())a.removeStyle(t,o)}else{const e=Object.keys(i.value);for(const t of e)a.removeStyle(t,o)}else a.removeAttribute(i.key,o);if(null!==t.attributeNewValue&&s)if("class"==s.key){const e="string"==typeof s.value?s.value.split(/\s+/):s.value;for(const t of e)a.addClass(t,o)}else if("style"==s.key)if("string"==typeof s.value){const e=new Md(a.document.stylesProcessor);e.setTo(s.value);for(const[t,n]of e.getStylesEntries())a.setStyle(t,n,o)}else{const e=Object.keys(s.value);for(const t of e)a.setStyle(t,s.value[t],o)}else a.setAttribute(s.key,s.value,o)}),{priority:e.converterPriority||"normal"})}}(e))}markerToElement(e){return this.add(function(e){const t=Jh(e.view,"ui");return n=>{var i;n.on(`addMarker:${e.model}`,(i=t,(e,t,n)=>{t.isOpening=!0;const r=i(t,n);t.isOpening=!1;const s=i(t,n);if(!r||!s)return;const o=t.markerRange;if(o.isCollapsed&&!n.consumable.consume(o,e.name))return;for(const t of o)if(!n.consumable.consume(t.item,e.name))return;const a=n.mapper,l=n.writer;l.insert(a.toViewPosition(o.start),r),n.mapper.bindElementToMarker(r,t.markerName),o.isCollapsed||(l.insert(a.toViewPosition(o.end),s),n.mapper.bindElementToMarker(s,t.markerName)),e.stop()}),{priority:e.converterPriority||"normal"}),n.on(`removeMarker:${e.model}`,((e,t,n)=>{const i=n.mapper.markerNameToElements(t.markerName);if(i){for(const e of i)n.mapper.unbindElementFromMarkerName(e,t.markerName),n.writer.clear(n.writer.createRangeOn(e),e);n.writer.clearClonedElementsGroup(t.markerName),e.stop()}}),{priority:e.converterPriority||"normal"})}}(e))}markerToHighlight(e){return this.add(function(e){return t=>{var n;t.on(`addMarker:${e.model}`,(n=e.view,(e,t,i)=>{if(!t.item)return;if(!(t.item instanceof Ih||t.item instanceof jh||t.item.is("$textProxy")))return;const r=tm(n,t,i);if(!r)return;if(!i.consumable.consume(t.item,e.name))return;const s=i.writer,o=Zh(s,r),a=s.document.selection;if(t.item instanceof Ih||t.item instanceof jh)s.wrap(a.getFirstRange(),o);else{const e=i.mapper.toViewRange(t.range),n=s.wrap(e,o);for(const e of n.getItems())if(e.is("attributeElement")&&e.isSimilar(o)){i.mapper.bindElementToMarker(e,t.markerName);break}}}),{priority:e.converterPriority||"normal"}),t.on(`addMarker:${e.model}`,function(e){return(t,n,i)=>{if(!n.item)return;if(!(n.item instanceof qh))return;const r=tm(e,n,i);if(!r)return;if(!i.consumable.test(n.item,t.name))return;const s=i.mapper.toViewElement(n.item);if(s&&s.getCustomProperty("addHighlight")){i.consumable.consume(n.item,t.name);for(const e of _h._createIn(n.item))i.consumable.consume(e.item,t.name);s.getCustomProperty("addHighlight")(s,r,i.writer),i.mapper.bindElementToMarker(s,n.markerName)}}}(e.view),{priority:e.converterPriority||"normal"}),t.on(`removeMarker:${e.model}`,function(e){return(t,n,i)=>{if(n.markerRange.isCollapsed)return;const r=tm(e,n,i);if(!r)return;const s=Zh(i.writer,r),o=i.mapper.markerNameToElements(n.markerName);if(o){for(const e of o)i.mapper.unbindElementFromMarkerName(e,n.markerName),e.is("attributeElement")?i.writer.unwrap(i.writer.createRangeOn(e),s):e.getCustomProperty("removeHighlight")(e,r.id,i.writer);i.writer.clearClonedElementsGroup(n.markerName),t.stop()}}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}markerToData(e){return this.add(function(e){const t=(e=_d(e)).model;let n=e.view;return n||(n=n=>({group:t,name:n.substr(e.model.length+1)})),i=>{var r;i.on(`addMarker:${t}`,(r=n,(e,t,n)=>{const i=r(t.markerName,n);if(!i)return;const s=t.markerRange;n.consumable.consume(s,e.name)&&(Qh(s,!1,n,t,i),Qh(s,!0,n,t,i),e.stop())}),{priority:e.converterPriority||"normal"}),i.on(`removeMarker:${t}`,function(e){return(t,n,i)=>{const r=e(n.markerName,i);if(!r)return;const s=i.mapper.markerNameToElements(n.markerName);if(s){for(const e of s)i.mapper.unbindElementFromMarkerName(e,n.markerName),e.is("containerElement")?(o(`data-${r.group}-start-before`,e),o(`data-${r.group}-start-after`,e),o(`data-${r.group}-end-before`,e),o(`data-${r.group}-end-after`,e)):i.writer.clear(i.writer.createRangeOn(e),e);i.writer.clearClonedElementsGroup(n.markerName),t.stop()}function o(e,t){if(t.hasAttribute(e)){const n=new Set(t.getAttribute(e).split(","));n.delete(r.name),0==n.size?i.writer.removeAttribute(e,t):i.writer.setAttribute(e,Array.from(n).join(","),t)}}}}(n),{priority:e.converterPriority||"normal"})}}(e))}}function Zh(e,t){const n=e.createAttributeElement("span",t.attributes);return t.classes&&n._addClass(t.classes),"number"==typeof t.priority&&(n._priority=t.priority),n._id=t.id,n}function Qh(e,t,n,i,r){const s=t?e.start:e.end,o=s.nodeAfter&&s.nodeAfter.is("element")?s.nodeAfter:null,a=s.nodeBefore&&s.nodeBefore.is("element")?s.nodeBefore:null;if(o||a){let e,s;t&&o||!t&&!a?(e=o,s=!0):(e=a,s=!1);const l=n.mapper.toViewElement(e);if(l)return void function(e,t,n,i,r,s){const o=`data-${s.group}-${t?"start":"end"}-${n?"before":"after"}`,a=e.hasAttribute(o)?e.getAttribute(o).split(","):[];a.unshift(s.name),i.writer.setAttribute(o,a.join(","),e),i.mapper.bindElementToMarker(e,r.markerName)}(l,t,s,n,i,r)}!function(e,t,n,i,r){const s=`${r.group}-${t?"start":"end"}`,o=r.name?{name:r.name}:null,a=n.writer.createUIElement(s,o);n.writer.insert(e,a),n.mapper.bindElementToMarker(a,i.markerName)}(n.mapper.toViewPosition(s),t,n,i,r)}function Yh(e){return"string"==typeof e&&(e={name:e}),{name:e.name,attributes:e.attributes?rc(e.attributes):[],children:!!e.children}}function Jh(e,t){return"function"==typeof e?e:(n,i)=>function(e,t,n){let i;"string"==typeof e&&(e={name:e});const r=t.writer,s=Object.assign({},e.attributes);if("container"==n)i=r.createContainerElement(e.name,s);else if("attribute"==n){const t={priority:e.priority||au.DEFAULT_PRIORITY};i=r.createAttributeElement(e.name,s,t)}else i=r.createUIElement(e.name,s);if(e.styles){const t=Object.keys(e.styles);for(const n of t)r.setStyle(n,e.styles[n],i)}if(e.classes){const t=e.classes;if("string"==typeof t)r.addClass(t,i);else for(const e of t)r.addClass(e,i)}return i}(e,i,t)}function Xh(e){return e.model.values?(t,n,i)=>{const r=e.view[t];return r?r(t,n,i):null}:e.view}function em(e){return"string"==typeof e?t=>({key:e,value:t}):"object"==typeof e?e.value?()=>e:t=>({key:e.key,value:t}):e}function tm(e,t,n){const i="function"==typeof e?e(t,n):e;return i?(i.priority||(i.priority=10),i.id||(i.id=t.markerName),i):null}function nm(e){const t=function(e){return(t,n)=>{if(!t.is("element",e.name))return!1;if("attribute"==n.type){if(e.attributes.includes(n.attributeKey))return!0}else if(e.children)return!0;return!1}}(e);return(e,n)=>{const i=[];n.reconvertedElements||(n.reconvertedElements=new Set);for(const e of n.changes){const r="attribute"==e.type?e.range.start.nodeAfter:e.position.parent;if(r&&t(r,e)){if(!n.reconvertedElements.has(r)){n.reconvertedElements.add(r);const e=ph._createBefore(r);let t=i.length;for(let n=i.length-1;n>=0;n--){const r=i[n],s=("attribute"==r.type?r.range.start:r.position).compareWith(e);if("before"==s||"remove"==r.type&&"same"==s)break;t=n}i.splice(t,0,{type:"remove",name:r.name,position:e,length:1},{type:"reinsert",name:r.name,position:e,length:1})}}else i.push(e)}n.changes=i}}function im(e){return(t,n,i={})=>{const r=["insert"];for(const n of e.attributes)t.hasAttribute(n)&&r.push(`attribute:${n}`);return!!r.every((e=>n.test(t,e)))&&(i.preflight||r.forEach((e=>n.consume(t,e))),!0)}}function rm(e,t,n,i){for(const r of t)sm(e.root,r,n,i)||n.convertItem(r)}function sm(e,t,n,i){const{writer:r,mapper:s}=n;if(!i.reconversion)return!1;const o=s.toViewElement(t);return!(!o||o.root==e||!n.canReuseView(o)||(r.move(r.createRangeOn(o),s.toViewPosition(ph._createBefore(t))),0))}function om(e,t,{preflight:n}={}){return n?t.test(e,"insert"):t.consume(e,"insert")}function am(e){const{schema:t,document:n}=e.model;for(const i of n.getRoots())if(i.isEmpty&&!t.checkChild(i,"$text")&&t.checkChild(i,"paragraph"))return e.insertElement("paragraph",i),!0;return!1}function lm(e,t,n){const i=n.createContext(e);return!!n.checkChild(i,"paragraph")&&!!n.checkChild(i.push("paragraph"),t)}function cm(e,t){const n=t.createElement("paragraph");return t.insert(n,e),t.createPositionAt(n,0)}class dm extends Gh{elementToElement(e){return this.add(um(e))}elementToAttribute(e){return this.add(function(e){gm(e=_d(e));const t=pm(e,!1),n=hm(e.view),i=n?`element:${n}`:"element";return n=>{n.on(i,t,{priority:e.converterPriority||"low"})}}(e))}attributeToAttribute(e){return this.add(function(e){let t=null;("string"==typeof(e=_d(e)).view||e.view.key)&&(t=function(e){"string"==typeof e.view&&(e.view={key:e.view});const t=e.view.key,n=void 0===e.view.value?/[\s\S]*/:e.view.value;let i;if("class"==t||"style"==t){const e="class"==t?"classes":"styles";i={[e]:n}}else i={attributes:{[t]:n}};return e.view.name&&(i.name=e.view.name),e.view=i,t}(e)),gm(e,t);const n=pm(e,!0);return t=>{t.on("element",n,{priority:e.converterPriority||"low"})}}(e))}elementToMarker(e){return this.add(function(e){const t=function(e){return(t,n)=>{const i="string"==typeof e?e:e(t,n);return n.writer.createElement("$marker",{"data-name":i})}}(e.model);return um({...e,model:t})}(e))}dataToMarker(e){return this.add(function(e){(e=_d(e)).model||(e.model=t=>t?e.view+":"+t:e.view);const t={view:e.view,model:e.model},n=mm(fm(t,"start")),i=mm(fm(t,"end"));return r=>{r.on(`element:${e.view}-start`,n,{priority:e.converterPriority||"normal"}),r.on(`element:${e.view}-end`,i,{priority:e.converterPriority||"normal"});const s=xa.low,o=xa.highest,a=xa.get(e.converterPriority)/o;r.on("element",function(e){return(t,n,i)=>{const r=`data-${e.view}`;function s(t,r){for(const s of r){const r=e.model(s,i),o=i.writer.createElement("$marker",{"data-name":r});i.writer.insert(o,t),n.modelCursor.isEqual(t)?n.modelCursor=n.modelCursor.getShiftedBy(1):n.modelCursor=n.modelCursor._getTransformedByInsertion(t,1),n.modelRange=n.modelRange._getTransformedByInsertion(t,1)[0]}}(i.consumable.test(n.viewItem,{attributes:r+"-end-after"})||i.consumable.test(n.viewItem,{attributes:r+"-start-after"})||i.consumable.test(n.viewItem,{attributes:r+"-end-before"})||i.consumable.test(n.viewItem,{attributes:r+"-start-before"}))&&(n.modelRange||Object.assign(n,i.convertChildren(n.viewItem,n.modelCursor)),i.consumable.consume(n.viewItem,{attributes:r+"-end-after"})&&s(n.modelRange.end,n.viewItem.getAttribute(r+"-end-after").split(",")),i.consumable.consume(n.viewItem,{attributes:r+"-start-after"})&&s(n.modelRange.end,n.viewItem.getAttribute(r+"-start-after").split(",")),i.consumable.consume(n.viewItem,{attributes:r+"-end-before"})&&s(n.modelRange.start,n.viewItem.getAttribute(r+"-end-before").split(",")),i.consumable.consume(n.viewItem,{attributes:r+"-start-before"})&&s(n.modelRange.start,n.viewItem.getAttribute(r+"-start-before").split(",")))}}(t),{priority:s+a})}}(e))}}function um(e){const t=mm(e=_d(e)),n=hm(e.view),i=n?`element:${n}`:"element";return n=>{n.on(i,t,{priority:e.converterPriority||"normal"})}}function hm(e){return"string"==typeof e?e:"object"==typeof e&&"string"==typeof e.name?e.name:null}function mm(e){const t=new Rd(e.view);return(n,i,r)=>{const s=t.match(i.viewItem);if(!s)return;const o=s.match;if(o.name=!0,!r.consumable.test(i.viewItem,o))return;const a=function(e,t,n){return e instanceof Function?e(t,n):n.writer.createElement(e)}(e.model,i.viewItem,r);a&&r.safeInsert(a,i.modelCursor)&&(r.consumable.consume(i.viewItem,o),r.convertChildren(i.viewItem,a),r.updateConversionResult(a,i))}}function gm(e,t=null){const n=null===t||(e=>e.getAttribute(t)),i="object"!=typeof e.model?e.model:e.model.key,r="object"!=typeof e.model||void 0===e.model.value?n:e.model.value;e.model={key:i,value:r}}function pm(e,t){const n=new Rd(e.view);return(i,r,s)=>{if(!r.modelRange&&t)return;const o=n.match(r.viewItem);if(!o)return;if(function(e,t){const n="function"==typeof e?e(t):e;return!("object"==typeof n&&!hm(n))&&(!n.classes&&!n.attributes&&!n.styles)}(e.view,r.viewItem)?o.match.name=!0:delete o.match.name,!s.consumable.test(r.viewItem,o.match))return;const a=e.model.key,l="function"==typeof e.model.value?e.model.value(r.viewItem,s):e.model.value;if(null===l)return;r.modelRange||Object.assign(r,s.convertChildren(r.viewItem,r.modelCursor));const c=function(e,t,n,i){let r=!1;for(const s of Array.from(e.getItems({shallow:n})))i.schema.checkAttribute(s,t.key)&&(r=!0,s.hasAttribute(t.key)||i.writer.setAttribute(t.key,t.value,s));return r}(r.modelRange,{key:a,value:l},t,s);c&&(s.consumable.test(r.viewItem,{name:!0})&&(o.match.name=!0),s.consumable.consume(r.viewItem,o.match))}}function fm(e,t){return{view:`${e.view}-${t}`,model:(t,n)=>{const i=t.getAttribute("name"),r=e.model(i,n);return n.writer.createElement("$marker",{"data-name":r})}}}function bm(e,t){return e.isCollapsed?function(e,t){const n=e.start,i=t.getNearestSelectionRange(n);if(!i){const e=n.getAncestors().reverse().find((e=>t.isObject(e)));return e?_h._createOn(e):null}if(!i.isCollapsed)return i;const r=i.start;return n.isEqual(r)?null:new _h(r)}(e,t):function(e,t){const{start:n,end:i}=e,r=t.checkChild(n,"$text"),s=t.checkChild(i,"$text"),o=t.getLimitElement(n),a=t.getLimitElement(i);if(o===a){if(r&&s)return null;if(function(e,t,n){const i=e.nodeAfter&&!n.isLimit(e.nodeAfter)||n.checkChild(e,"$text"),r=t.nodeBefore&&!n.isLimit(t.nodeBefore)||n.checkChild(t,"$text");return i||r}(n,i,t)){const e=n.nodeAfter&&t.isSelectable(n.nodeAfter)?null:t.getNearestSelectionRange(n,"forward"),r=i.nodeBefore&&t.isSelectable(i.nodeBefore)?null:t.getNearestSelectionRange(i,"backward"),s=e?e.start:n,o=r?r.end:i;return new _h(s,o)}}const l=o&&!o.is("rootElement"),c=a&&!a.is("rootElement");if(l||c){const e=n.nodeAfter&&i.nodeBefore&&n.nodeAfter.parent===i.nodeBefore.parent,r=l&&(!e||!vm(n.nodeAfter,t)),s=c&&(!e||!vm(i.nodeBefore,t));let d=n,u=i;return r&&(d=ph._createBefore(wm(o,t))),s&&(u=ph._createAfter(wm(a,t))),new _h(d,u)}return null}(e,t)}function wm(e,t){let n=e,i=n;for(;t.isLimit(i)&&i.parent;)n=i,i=i.parent;return n}function vm(e,t){return e&&t.isSelectable(e)}class ym extends(Ga()){model;view;mapper;downcastDispatcher;constructor(e,t){super(),this.model=e,this.view=new dh(t),this.mapper=new kh,this.downcastDispatcher=new Eh({mapper:this.mapper,schema:e.schema});const n=this.model.document,i=n.selection,r=this.model.markers;var s,o,a;this.listenTo(this.model,"_beforeChanges",(()=>{this.view._disableRendering(!0)}),{priority:"highest"}),this.listenTo(this.model,"_afterChanges",(()=>{this.view._disableRendering(!1)}),{priority:"lowest"}),this.listenTo(n,"change",(()=>{this.view.change((e=>{this.downcastDispatcher.convertChanges(n.differ,r,e),this.downcastDispatcher.convertSelection(i,r,e)}))}),{priority:"low"}),this.listenTo(this.view.document,"selectionChange",function(e,t){return(n,i)=>{const r=i.newSelection,s=[];for(const e of r.getRanges())s.push(t.toModelRange(e));const o=e.createSelection(s,{backward:r.isBackward});o.isEqual(e.document.selection)||e.change((e=>{e.setSelection(o)}))}}(this.model,this.mapper)),this.listenTo(this.view.document,"beforeinput",(s=this.mapper,o=this.model.schema,a=this.view,(e,t)=>{if(!a.document.isComposing||aa.isAndroid)for(let e=0;e<t.targetRanges.length;e++){const n=t.targetRanges[e],i=s.toModelRange(n),r=bm(i,o);r&&!r.isEqual(i)&&(t.targetRanges[e]=s.toViewRange(r))}}),{priority:"high"}),this.downcastDispatcher.on("insert:$text",((e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;const i=n.writer,r=n.mapper.toViewPosition(t.range.start),s=i.createText(t.item.data);i.insert(r,s)}),{priority:"lowest"}),this.downcastDispatcher.on("insert",((e,t,n)=>{n.convertAttributes(t.item),t.reconversion||!t.item.is("element")||t.item.isEmpty||n.convertChildren(t.item)}),{priority:"lowest"}),this.downcastDispatcher.on("remove",((e,t,n)=>{const i=n.mapper.toViewPosition(t.position),r=t.position.getShiftedBy(t.length),s=n.mapper.toViewPosition(r,{isPhantom:!0}),o=n.writer.createRange(i,s),a=n.writer.remove(o.getTrimmed());for(const e of n.writer.createRangeIn(a).getItems())n.mapper.unbindViewElement(e,{defer:!0})}),{priority:"low"}),this.downcastDispatcher.on("cleanSelection",((e,t,n)=>{const i=n.writer,r=i.document.selection;for(const e of r.getRanges())e.isCollapsed&&e.end.parent.isAttached()&&n.writer.mergeAttributes(e.start);i.setSelection(null)})),this.downcastDispatcher.on("selection",((e,t,n)=>{const i=t.selection;if(i.isCollapsed)return;if(!n.consumable.consume(i,"selection"))return;const r=[];for(const e of i.getRanges())r.push(n.mapper.toViewRange(e));n.writer.setSelection(r,{backward:i.isBackward})}),{priority:"low"}),this.downcastDispatcher.on("selection",((e,t,n)=>{const i=t.selection;if(!i.isCollapsed)return;if(!n.consumable.consume(i,"selection"))return;const r=n.writer,s=i.getFirstPosition(),o=n.mapper.toViewPosition(s),a=r.breakAttributes(o);r.setSelection(a)}),{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using((e=>{if("$graveyard"==e.rootName)return null;const t=new qd(this.view.document,e.name);return t.rootName=e.rootName,this.mapper.bindElements(e,t),t}))}destroy(){this.view.destroy(),this.stopListening()}reconvertMarker(e){const t="string"==typeof e?e:e.name,n=this.model.markers.get(t);if(!n)throw new Aa("editingcontroller-reconvertmarker-marker-not-exist",this,{markerName:t});this.model.change((()=>{this.model.markers._refresh(n)}))}reconvertItem(e){this.model.change((()=>{this.model.document.differ._refreshItem(e)}))}}class _m{_consumables=new Map;add(e,t){let n;e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):(this._consumables.has(e)?n=this._consumables.get(e):(n=new xm(e),this._consumables.set(e,n)),n.add(t))}test(e,t){const n=this._consumables.get(e);return void 0===n?null:e.is("$text")||e.is("documentFragment")?n:n.test(t)}consume(e,t){return!!this.test(e,t)&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!1):this._consumables.get(e).consume(t),!0)}revert(e,t){const n=this._consumables.get(e);void 0!==n&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):n.revert(t))}static consumablesFromElement(e){const t={element:e,name:!0,attributes:[],classes:[],styles:[]},n=e.getAttributeKeys();for(const e of n)"style"!=e&&"class"!=e&&t.attributes.push(e);const i=e.getClassNames();for(const e of i)t.classes.push(e);const r=e.getStyleNames();for(const e of r)t.styles.push(e);return t}static createFrom(e,t){if(t||(t=new _m),e.is("$text"))return t.add(e),t;e.is("element")&&t.add(e,_m.consumablesFromElement(e)),e.is("documentFragment")&&t.add(e);for(const n of e.getChildren())t=_m.createFrom(n,t);return t}}const km=["attributes","classes","styles"];class xm{element;_canConsumeName;_consumables;constructor(e){this.element=e,this._canConsumeName=null,this._consumables={attributes:new Map,styles:new Map,classes:new Map}}add(e){e.name&&(this._canConsumeName=!0);for(const t of km)t in e&&this._add(t,e[t])}test(e){if(e.name&&!this._canConsumeName)return this._canConsumeName;for(const t of km)if(t in e){const n=this._test(t,e[t]);if(!0!==n)return n}return!0}consume(e){e.name&&(this._canConsumeName=!1);for(const t of km)t in e&&this._consume(t,e[t])}revert(e){e.name&&(this._canConsumeName=!0);for(const t of km)t in e&&this._revert(t,e[t])}_add(e,t){const n=rc(t),i=this._consumables[e];for(const t of n){if("attributes"===e&&("class"===t||"style"===t))throw new Aa("viewconsumable-invalid-attribute",this);if(i.set(t,!0),"styles"===e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))i.set(e,!0)}}_test(e,t){const n=rc(t),i=this._consumables[e];for(const t of n)if("attributes"!==e||"class"!==t&&"style"!==t){const e=i.get(t);if(void 0===e)return null;if(!e)return!1}else{const e="class"==t?"classes":"styles",n=this._test(e,[...this._consumables[e].keys()]);if(!0!==n)return n}return!0}_consume(e,t){const n=rc(t),i=this._consumables[e];for(const t of n)if("attributes"!==e||"class"!==t&&"style"!==t){if(i.set(t,!1),"styles"==e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))i.set(e,!1)}else{const e="class"==t?"classes":"styles";this._consume(e,[...this._consumables[e].keys()])}}_revert(e,t){const n=rc(t),i=this._consumables[e];for(const t of n)if("attributes"!==e||"class"!==t&&"style"!==t)!1===i.get(t)&&i.set(t,!0);else{const e="class"==t?"classes":"styles";this._revert(e,[...this._consumables[e].keys()])}}}class Cm extends(Ga()){_sourceDefinitions={};_attributeProperties=Object.create(null);_customChildChecks=new Map;_customAttributeChecks=new Map;_genericCheckSymbol=Symbol("$generic");_compiledDefinitions;constructor(){super(),this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",((e,t)=>{t[0]=new Am(t[0])}),{priority:"highest"}),this.on("checkChild",((e,t)=>{t[0]=new Am(t[0]),t[1]=this.getDefinition(t[1])}),{priority:"highest"})}register(e,t){if(this._sourceDefinitions[e])throw new Aa("schema-cannot-register-item-twice",this,{itemName:e});this._sourceDefinitions[e]=[Object.assign({},t)],this._clearCache()}extend(e,t){if(!this._sourceDefinitions[e])throw new Aa("schema-cannot-extend-missing-item",this,{itemName:e});this._sourceDefinitions[e].push(Object.assign({},t)),this._clearCache()}getDefinitions(){return this._compiledDefinitions||this._compile(),this._compiledDefinitions}getDefinition(e){let t;return t="string"==typeof e?e:"is"in e&&(e.is("$text")||e.is("$textProxy"))?"$text":e.name,this.getDefinitions()[t]}isRegistered(e){return!!this.getDefinition(e)}isBlock(e){const t=this.getDefinition(e);return!(!t||!t.isBlock)}isLimit(e){const t=this.getDefinition(e);return!(!t||!t.isLimit&&!t.isObject)}isObject(e){const t=this.getDefinition(e);return!!t&&!!(t.isObject||t.isLimit&&t.isSelectable&&t.isContent)}isInline(e){const t=this.getDefinition(e);return!(!t||!t.isInline)}isSelectable(e){const t=this.getDefinition(e);return!(!t||!t.isSelectable&&!t.isObject)}isContent(e){const t=this.getDefinition(e);return!(!t||!t.isContent&&!t.isObject)}checkChild(e,t){return!!t&&this._checkContextMatch(e,t)}checkAttribute(e,t){const n=this.getDefinition(e.last);if(!n)return!1;const i=this._evaluateAttributeChecks(e,t);return void 0!==i?i:n.allowAttributes.includes(t)}checkMerge(e,t){if(e instanceof ph){const t=e.nodeBefore,n=e.nodeAfter;if(!(t instanceof qh))throw new Aa("schema-check-merge-no-element-before",this);if(!(n instanceof qh))throw new Aa("schema-check-merge-no-element-after",this);return this.checkMerge(t,n)}if(this.isLimit(e)||this.isLimit(t))return!1;for(const n of t.getChildren())if(!this.checkChild(e,n))return!1;return!0}addChildCheck(e,t){const n=void 0!==t?t:this._genericCheckSymbol,i=this._customChildChecks.get(n)||[];i.push(e),this._customChildChecks.set(n,i)}addAttributeCheck(e,t){const n=void 0!==t?t:this._genericCheckSymbol,i=this._customAttributeChecks.get(n)||[];i.push(e),this._customAttributeChecks.set(n,i)}setAttributeProperties(e,t){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),t)}getAttributeProperties(e){return this._attributeProperties[e]||Object.create(null)}getLimitElement(e){let t;for(t=e instanceof ph?e.parent:(e instanceof _h?[e]:Array.from(e.getRanges())).reduce(((e,t)=>{const n=t.getCommonAncestor();return e?e.getCommonAncestor(n,{includeSelf:!0}):n}),null);!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){const n=[...e.getFirstPosition().getAncestors(),new zh("",e.getAttributes())];return this.checkAttribute(n,t)}{const n=e.getRanges();for(const e of n)for(const n of e)if(this.checkAttribute(n.item,t))return!0}return!1}*getValidRanges(e,t){e=function*(e){for(const t of e)yield*t.getMinimalFlatRanges()}(e);for(const n of e)yield*this._getValidRangesForRange(n,t)}getNearestSelectionRange(e,t="both"){if("$graveyard"==e.root.rootName)return null;if(this.checkChild(e,"$text"))return new _h(e);let n,i;const r=e.getAncestors().reverse().find((e=>this.isLimit(e)))||e.root;"both"!=t&&"backward"!=t||(n=new mh({boundaries:_h._createIn(r),startPosition:e,direction:"backward"})),"both"!=t&&"forward"!=t||(i=new mh({boundaries:_h._createIn(r),startPosition:e}));for(const e of function*(e,t){let n=!1;for(;!n;){if(n=!0,e){const t=e.next();t.done||(n=!1,yield{walker:e,value:t.value})}if(t){const e=t.next();e.done||(n=!1,yield{walker:t,value:e.value})}}}(n,i)){const t=e.walker==n?"elementEnd":"elementStart",i=e.value;if(i.type==t&&this.isObject(i.item))return _h._createOn(i.item);if(this.checkChild(i.nextPosition,"$text"))return new _h(i.nextPosition)}return null}findAllowedParent(e,t){let n=e.parent;for(;n;){if(this.checkChild(n,t))return n;if(this.isLimit(n))return null;n=n.parent}return null}setAllowedAttributes(e,t,n){const i=n.model;for(const[r,s]of Object.entries(t))i.schema.checkAttribute(e,r)&&n.setAttribute(r,s,e)}removeDisallowedAttributes(e,t){for(const n of e)if(n.is("$text"))Fm(this,n,t);else{const e=_h._createIn(n).getPositions();for(const n of e)Fm(this,n.nodeBefore||n.parent,t)}}getAttributesWithProperty(e,t,n){const i={};for(const[r,s]of e.getAttributes()){const e=this.getAttributeProperties(r);void 0!==e[t]&&(void 0!==n&&n!==e[t]||(i[r]=s))}return i}createContext(e){return new Am(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},t=this._sourceDefinitions,n=Object.keys(t);for(const i of n)e[i]=Em(t[i],i);const i=Object.values(e);for(const t of i)Tm(e,t),Sm(e,t),Pm(e,t),Im(e,t);for(const e of i)Om(0,e);for(const t of i)Vm(e,t);for(const t of i)Rm(e,t);for(const t of i)Nm(e,t);for(const t of i)Lm(e,t);this._compiledDefinitions=function(e){const t={};for(const n of Object.values(e))t[n.name]={name:n.name,isBlock:!!n.isBlock,isContent:!!n.isContent,isInline:!!n.isInline,isLimit:!!n.isLimit,isObject:!!n.isObject,isSelectable:!!n.isSelectable,allowIn:Array.from(n.allowIn).filter((t=>!!e[t])),allowChildren:Array.from(n.allowChildren).filter((t=>!!e[t])),allowAttributes:Array.from(n.allowAttributes)};return t}(e)}_checkContextMatch(e,t){const n=e.last;let i=this._evaluateChildChecks(e,t);if(i=void 0!==i?i:t.allowIn.includes(n.name),!i)return!1;const r=this.getDefinition(n),s=e.trimLast();return!!r&&(0==s.length||this._checkContextMatch(s,r))}_evaluateChildChecks(e,t){const n=this._customChildChecks.get(this._genericCheckSymbol)||[],i=this._customChildChecks.get(t.name)||[];for(const r of[...n,...i]){const n=r(e,t);if(void 0!==n)return n}}_evaluateAttributeChecks(e,t){const n=this._customAttributeChecks.get(this._genericCheckSymbol)||[],i=this._customAttributeChecks.get(t)||[];for(const r of[...n,...i]){const n=r(e,t);if(void 0!==n)return n}}*_getValidRangesForRange(e,t){let n=e.start,i=e.start;for(const r of e.getItems({shallow:!0}))r.is("element")&&(yield*this._getValidRangesForRange(_h._createIn(r),t)),this.checkAttribute(r,t)||(n.isEqual(i)||(yield new _h(n,i)),n=ph._createAfter(r)),i=ph._createAfter(r);n.isEqual(i)||(yield new _h(n,i))}findOptimalInsertionRange(e,t){const n=e.getSelectedElement();if(n&&this.isObject(n)&&!this.isInline(n))return"before"==t||"after"==t?new _h(ph._createAt(n,t)):_h._createOn(n);const i=ac(e.getSelectedBlocks());if(!i)return new _h(e.focus);if(i.isEmpty)return new _h(ph._createAt(i,0));const r=ph._createAfter(i);return e.focus.isTouching(r)?new _h(r):new _h(ph._createBefore(i))}}class Am{_items;constructor(e){if(e instanceof Am)return e;let t;t="string"==typeof e?[e]:Array.isArray(e)?e:e.getAncestors({includeSelf:!0}),this._items=t.map(Bm)}get length(){return this._items.length}get last(){return this._items[this._items.length-1]}[Symbol.iterator](){return this._items[Symbol.iterator]()}push(e){const t=new Am([e]);return t._items=[...this._items,...t._items],t}trimLast(){const e=new Am([]);return e._items=this._items.slice(0,-1),e}getItem(e){return this._items[e]}*getNames(){yield*this._items.map((e=>e.name))}endsWith(e){return Array.from(this.getNames()).join(" ").endsWith(e)}startsWith(e){return Array.from(this.getNames()).join(" ").startsWith(e)}}function Em(e,t){const n={name:t,allowIn:new Set,allowChildren:new Set,disallowIn:new Set,disallowChildren:new Set,allowContentOf:new Set,allowWhere:new Set,allowAttributes:new Set,disallowAttributes:new Set,allowAttributesOf:new Set,inheritTypesFrom:new Set};return function(e,t){for(const n of e){const e=Object.keys(n).filter((e=>e.startsWith("is")));for(const i of e)t[i]=!!n[i]}}(e,n),Mm(e,n,"allowIn"),Mm(e,n,"allowChildren"),Mm(e,n,"disallowIn"),Mm(e,n,"disallowChildren"),Mm(e,n,"allowContentOf"),Mm(e,n,"allowWhere"),Mm(e,n,"allowAttributes"),Mm(e,n,"disallowAttributes"),Mm(e,n,"allowAttributesOf"),Mm(e,n,"inheritTypesFrom"),function(e,t){for(const n of e){const e=n.inheritAllFrom;e&&(t.allowContentOf.add(e),t.allowWhere.add(e),t.allowAttributesOf.add(e),t.inheritTypesFrom.add(e))}}(e,n),n}function Tm(e,t){for(const n of t.allowIn){const i=e[n];i?i.allowChildren.add(t.name):t.allowIn.delete(n)}}function Sm(e,t){for(const n of t.allowChildren){const i=e[n];i?i.allowIn.add(t.name):t.allowChildren.delete(n)}}function Pm(e,t){for(const n of t.disallowIn){const i=e[n];i?i.disallowChildren.add(t.name):t.disallowIn.delete(n)}}function Im(e,t){for(const n of t.disallowChildren){const i=e[n];i?i.disallowIn.add(t.name):t.disallowChildren.delete(n)}}function Om(e,t){for(const e of t.disallowChildren)t.allowChildren.delete(e);for(const e of t.disallowIn)t.allowIn.delete(e);for(const e of t.disallowAttributes)t.allowAttributes.delete(e)}function Vm(e,t){for(const n of t.allowContentOf){const i=e[n];i&&(i.disallowChildren.forEach((n=>{t.allowChildren.has(n)||(t.disallowChildren.add(n),e[n].disallowIn.add(t.name))})),i.allowChildren.forEach((n=>{t.disallowChildren.has(n)||(t.allowChildren.add(n),e[n].allowIn.add(t.name))})))}}function Rm(e,t){for(const n of t.allowWhere){const i=e[n];i&&(i.disallowIn.forEach((n=>{t.allowIn.has(n)||(t.disallowIn.add(n),e[n].disallowChildren.add(t.name))})),i.allowIn.forEach((n=>{t.disallowIn.has(n)||(t.allowIn.add(n),e[n].allowChildren.add(t.name))})))}}function Nm(e,t){for(const n of t.allowAttributesOf){const i=e[n];if(!i)return;i.allowAttributes.forEach((e=>{t.disallowAttributes.has(e)||t.allowAttributes.add(e)}))}}function Lm(e,t){for(const n of t.inheritTypesFrom){const i=e[n];if(i){const e=Object.keys(i).filter((e=>e.startsWith("is")));for(const n of e)n in t||(t[n]=i[n])}}}function Mm(e,t,n){for(const i of e){let e=i[n];"string"==typeof e&&(e=[e]),Array.isArray(e)&&e.forEach((e=>t[n].add(e)))}}function Bm(e){return"string"==typeof e||e.is("documentFragment")?{name:"string"==typeof e?e:"$documentFragment",*getAttributeKeys(){},getAttribute(){}}:{name:e.is("element")?e.name:"$text",*getAttributeKeys(){yield*e.getAttributeKeys()},getAttribute:t=>e.getAttribute(t)}}function Fm(e,t,n){for(const i of t.getAttributeKeys())e.checkAttribute(t,i)||n.removeAttribute(i,t)}class Dm extends(Na()){conversionApi;_splitParts=new Map;_cursorParents=new Map;_modelCursor=null;_emptyElementsToKeep=new Set;constructor(e){super(),this.conversionApi={...e,consumable:null,writer:null,store:null,convertItem:(e,t)=>this._convertItem(e,t),convertChildren:(e,t)=>this._convertChildren(e,t),safeInsert:(e,t)=>this._safeInsert(e,t),updateConversionResult:(e,t)=>this._updateConversionResult(e,t),splitToAllowedParent:(e,t)=>this._splitToAllowedParent(e,t),getSplitParts:e=>this._getSplitParts(e),keepEmptyElement:e=>this._keepEmptyElement(e)}}convert(e,t,n=["$root"]){this.fire("viewCleanup",e),this._modelCursor=function(e,t){let n;for(const i of new Am(e)){const e={};for(const t of i.getAttributeKeys())e[t]=i.getAttribute(t);const r=t.createElement(i.name,e);n&&t.insert(r,n),n=ph._createAt(r,0)}return n}(n,t),this.conversionApi.writer=t,this.conversionApi.consumable=_m.createFrom(e),this.conversionApi.store={};const{modelRange:i}=this._convertItem(e,this._modelCursor),r=t.createDocumentFragment();if(i){this._removeEmptyElements();const e=this._modelCursor.parent,n=e._removeChildren(0,e.childCount);r._insertChild(0,n),r.markers=function(e,t){const n=new Set,i=new Map,r=_h._createIn(e).getItems();for(const e of r)e.is("element","$marker")&&n.add(e);for(const e of n){const n=e.getAttribute("data-name"),r=t.createPositionBefore(e);i.has(n)?i.get(n).end=r.clone():i.set(n,new _h(r.clone())),t.remove(e)}return i}(r,t)}return this._modelCursor=null,this._splitParts.clear(),this._cursorParents.clear(),this._emptyElementsToKeep.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,r}_convertItem(e,t){const n={viewItem:e,modelCursor:t,modelRange:null};if(e.is("element")?this.fire(`element:${e.name}`,n,this.conversionApi):e.is("$text")?this.fire("text",n,this.conversionApi):this.fire("documentFragment",n,this.conversionApi),n.modelRange&&!(n.modelRange instanceof _h))throw new Aa("view-conversion-dispatcher-incorrect-result",this);return{modelRange:n.modelRange,modelCursor:n.modelCursor}}_convertChildren(e,t){let n=t.is("position")?t:ph._createAt(t,0);const i=new _h(n);for(const t of Array.from(e.getChildren())){const e=this._convertItem(t,n);e.modelRange instanceof _h&&(i.end=e.modelRange.end,n=e.modelCursor)}return{modelRange:i,modelCursor:n}}_safeInsert(e,t){const n=this._splitToAllowedParent(e,t);return!!n&&(this.conversionApi.writer.insert(e,n.position),!0)}_updateConversionResult(e,t){const n=this._getSplitParts(e),i=this.conversionApi.writer;t.modelRange||(t.modelRange=i.createRange(i.createPositionBefore(e),i.createPositionAfter(n[n.length-1])));const r=this._cursorParents.get(e);t.modelCursor=r?i.createPositionAt(r,0):t.modelRange.end}_splitToAllowedParent(e,t){const{schema:n,writer:i}=this.conversionApi;let r=n.findAllowedParent(t,e);if(r){if(r===t.parent)return{position:t};this._modelCursor.parent.getAncestors().includes(r)&&(r=null)}if(!r)return lm(t,e,n)?{position:cm(t,i)}:null;const s=this.conversionApi.writer.split(t,r),o=[];for(const e of s.range.getWalker())if("elementEnd"==e.type)o.push(e.item);else{const t=o.pop(),n=e.item;this._registerSplitPair(t,n)}const a=s.range.end.parent;return this._cursorParents.set(e,a),{position:s.position,cursorParent:a}}_registerSplitPair(e,t){this._splitParts.has(e)||this._splitParts.set(e,[e]);const n=this._splitParts.get(e);this._splitParts.set(t,n),n.push(t)}_getSplitParts(e){let t;return t=this._splitParts.has(e)?this._splitParts.get(e):[e],t}_keepEmptyElement(e){this._emptyElementsToKeep.add(e)}_removeEmptyElements(){const e=new Map;for(const t of this._splitParts.keys())if(t.isEmpty&&!this._emptyElementsToKeep.has(t)){const n=e.get(t.parent)||[];n.push(t),this._splitParts.delete(t),e.set(t.parent,n)}for(const[t,n]of e)t._removeChildrenArray(n);e.size&&this._removeEmptyElements()}}class zm{getHtml(e){const t=ra.document.implementation.createHTMLDocument("").createElement("div");return t.appendChild(e),t.innerHTML}}class $m{domParser;domConverter;htmlWriter;skipComments=!0;constructor(e){this.domParser=new DOMParser,this.domConverter=new Uu(e,{renderingMode:"data"}),this.htmlWriter=new zm}toData(e){const t=this.domConverter.viewToDom(e);return this.htmlWriter.getHtml(t)}toView(e){const t=this._toDom(e);return this.domConverter.domToView(t,{skipComments:this.skipComments})}registerRawContentMatcher(e){this.domConverter.registerRawContentMatcher(e)}useFillerType(e){this.domConverter.blockFillerMode="marked"==e?"markedNbsp":"nbsp"}_toDom(e){/<(?:html|body|head|meta)(?:\s[^>]*)?>/i.test(e.trim().slice(0,1e4))||(e=`<body>${e}</body>`);const t=this.domParser.parseFromString(e,"text/html"),n=t.createDocumentFragment(),i=t.body.childNodes;for(;i.length>0;)n.appendChild(i[0]);return n}}class jm extends(Na()){model;mapper;downcastDispatcher;upcastDispatcher;viewDocument;stylesProcessor;htmlProcessor;processor;_viewWriter;constructor(e,t){super(),this.model=e,this.mapper=new kh,this.downcastDispatcher=new Eh({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",((e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;const i=n.writer,r=n.mapper.toViewPosition(t.range.start),s=i.createText(t.item.data);i.insert(r,s)}),{priority:"lowest"}),this.downcastDispatcher.on("insert",((e,t,n)=>{n.convertAttributes(t.item),t.reconversion||!t.item.is("element")||t.item.isEmpty||n.convertChildren(t.item)}),{priority:"lowest"}),this.upcastDispatcher=new Dm({schema:e.schema}),this.viewDocument=new ou(t),this.stylesProcessor=t,this.htmlProcessor=new $m(this.viewDocument),this.processor=this.htmlProcessor,this._viewWriter=new bu(this.viewDocument),this.upcastDispatcher.on("text",((e,t,{schema:n,consumable:i,writer:r})=>{let s=t.modelCursor;if(!i.test(t.viewItem))return;if(!n.checkChild(s,"$text")){if(!lm(s,"$text",n))return;if(0==t.viewItem.data.trim().length)return;s=cm(s,r)}i.consume(t.viewItem);const o=r.createText(t.viewItem.data);r.insert(o,s),t.modelRange=r.createRange(s,s.getShiftedBy(o.offsetSize)),t.modelCursor=t.modelRange.end}),{priority:"lowest"}),this.upcastDispatcher.on("element",((e,t,n)=>{if(!t.modelRange&&n.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:i}=n.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=i}}),{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",((e,t,n)=>{if(!t.modelRange&&n.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:i}=n.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=i}}),{priority:"lowest"}),Ga().prototype.decorate.call(this,"init"),Ga().prototype.decorate.call(this,"set"),Ga().prototype.decorate.call(this,"get"),Ga().prototype.decorate.call(this,"toView"),Ga().prototype.decorate.call(this,"toModel"),this.on("init",(()=>{this.fire("ready")}),{priority:"lowest"}),this.on("ready",(()=>{this.model.enqueueChange({isUndoable:!1},am)}),{priority:"lowest"})}get(e={}){const{rootName:t="main",trim:n="empty"}=e;if(!this._checkIfRootsExists([t]))throw new Aa("datacontroller-get-non-existent-root",this);const i=this.model.document.getRoot(t);return i.isAttached()||Ea("datacontroller-get-detached-root",this),"empty"!==n||this.model.hasContent(i,{ignoreWhitespaces:!0})?this.stringify(i,e):""}stringify(e,t={}){const n=this.toView(e,t);return this.processor.toData(n)}toView(e,t={}){const n=this.viewDocument,i=this._viewWriter;this.mapper.clearBindings();const r=_h._createIn(e),s=new fu(n);this.mapper.bindElements(e,s);const o=e.is("documentFragment")?e.markers:function(e){const t=[],n=e.root.document;if(!n)return new Map;const i=_h._createIn(e);for(const e of n.model.markers){const n=e.getRange(),r=n.isCollapsed,s=n.start.isEqual(i.start)||n.end.isEqual(i.end);if(r&&s)t.push([e.name,n]);else{const r=i.getIntersection(n);r&&t.push([e.name,r])}}return t.sort((([e,t],[n,i])=>{if("after"!==t.end.compareWith(i.start))return 1;if("before"!==t.start.compareWith(i.end))return-1;switch(t.start.compareWith(i.start)){case"before":return 1;case"after":return-1;default:switch(t.end.compareWith(i.end)){case"before":return 1;case"after":return-1;default:return n.localeCompare(e)}}})),new Map(t)}(e);return this.downcastDispatcher.convert(r,o,i,t),s}init(e){if(this.model.document.version)throw new Aa("datacontroller-init-document-not-empty",this);let t={};if("string"==typeof e?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new Aa("datacontroller-init-non-existent-root",this);return this.model.enqueueChange({isUndoable:!1},(e=>{for(const n of Object.keys(t)){const i=this.model.document.getRoot(n);e.insert(this.parse(t[n],i),i,0)}})),Promise.resolve()}set(e,t={}){let n={};if("string"==typeof e?n.main=e:n=e,!this._checkIfRootsExists(Object.keys(n)))throw new Aa("datacontroller-set-non-existent-root",this);this.model.enqueueChange(t.batchType||{},(e=>{e.setSelection(null),e.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const t of Object.keys(n)){const i=this.model.document.getRoot(t);e.remove(e.createRangeIn(i)),e.insert(this.parse(n[t],i),i,0)}}))}parse(e,t="$root"){const n=this.processor.toView(e);return this.toModel(n,t)}toModel(e,t="$root"){return this.model.change((n=>this.upcastDispatcher.convert(e,n,t)))}addStyleProcessorRules(e){e(this.stylesProcessor)}registerRawContentMatcher(e){this.processor&&this.processor!==this.htmlProcessor&&this.processor.registerRawContentMatcher(e),this.htmlProcessor.registerRawContentMatcher(e)}destroy(){this.stopListening()}_checkIfRootsExists(e){for(const t of e)if(!this.model.document.getRoot(t))return!1;return!0}}class Hm{_helpers=new Map;_downcast;_upcast;constructor(e,t){this._downcast=rc(e),this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=rc(t),this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(e,t){const n=this._downcast.includes(t);if(!this._upcast.includes(t)&&!n)throw new Aa("conversion-add-alias-dispatcher-not-registered",this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:n})}for(e){if(!this._helpers.has(e))throw new Aa("conversion-for-unknown-group",this);return this._helpers.get(e)}elementToElement(e){this.for("downcast").elementToElement(e);for(const{model:t,view:n}of Wm(e))this.for("upcast").elementToElement({model:t,view:n,converterPriority:e.converterPriority})}attributeToElement(e){this.for("downcast").attributeToElement(e);for(const{model:t,view:n}of Wm(e))this.for("upcast").elementToAttribute({view:n,model:t,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(const{model:t,view:n}of Wm(e))this.for("upcast").attributeToAttribute({view:n,model:t})}_createConversionHelpers({name:e,dispatchers:t,isDowncast:n}){if(this._helpers.has(e))throw new Aa("conversion-group-exists",this);const i=n?new Kh(t):new dm(t);this._helpers.set(e,i)}}function*Wm(e){if(e.model.values)for(const t of e.model.values){const n={key:e.model.key,value:t},i=e.view[t],r=e.upcastAlso?e.upcastAlso[t]:void 0;yield*Um(n,i,r)}else yield*Um(e.model,e.view,e.upcastAlso)}function*Um(e,t,n){if(yield{model:e,view:t},n)for(const t of rc(n))yield{model:e,view:t}}class qm{baseVersion;isDocumentOperation;batch;constructor(e){this.baseVersion=e,this.isDocumentOperation=null!==this.baseVersion,this.batch=null}_validate(){}toJSON(){const e=Object.assign({},this);return e.__className=this.constructor.className,delete e.batch,delete e.isDocumentOperation,e}static get className(){return"Operation"}static fromJSON(e,t){return new this(e.baseVersion)}}function Gm(e,t){const n=Qm(t),i=n.reduce(((e,t)=>e+t.offsetSize),0),r=e.parent;Jm(e);const s=e.index;return r._insertChild(s,n),Ym(r,s+n.length),Ym(r,s),new _h(e,e.getShiftedBy(i))}function Km(e){if(!e.isFlat)throw new Aa("operation-utils-remove-range-not-flat",this);const t=e.start.parent;Jm(e.start),Jm(e.end);const n=t._removeChildren(e.start.index,e.end.index-e.start.index);return Ym(t,e.start.index),n}function Zm(e,t){if(!e.isFlat)throw new Aa("operation-utils-move-range-not-flat",this);const n=Km(e);return Gm(t=t._getTransformedByDeletion(e.start,e.end.offset-e.start.offset),n)}function Qm(e){const t=[];!function e(n){if("string"==typeof n)t.push(new zh(n));else if(n instanceof hh)t.push(new zh(n.data,n.getAttributes()));else if(n instanceof Ph)t.push(n);else if(nl(n))for(const t of n)e(t)}(e);for(let e=1;e<t.length;e++){const n=t[e],i=t[e-1];n instanceof zh&&i instanceof zh&&Xm(n,i)&&(t.splice(e-1,2,new zh(i.data+n.data,i.getAttributes())),e--)}return t}function Ym(e,t){const n=e.getChild(t-1),i=e.getChild(t);if(n&&i&&n.is("$text")&&i.is("$text")&&Xm(n,i)){const r=new zh(n.data+i.data,n.getAttributes());e._removeChildren(t-1,2),e._insertChild(t-1,r)}}function Jm(e){const t=e.textNode,n=e.parent;if(t){const i=e.offset-t.startOffset,r=t.index;n._removeChildren(r,1);const s=new zh(t.data.substr(0,i),t.getAttributes()),o=new zh(t.data.substr(i),t.getAttributes());n._insertChild(r,[s,o])}}function Xm(e,t){const n=e.getAttributes(),i=t.getAttributes();for(const e of n){if(e[1]!==t.getAttribute(e[0]))return!1;i.next()}return i.next().done}class eg extends qm{sourcePosition;howMany;targetPosition;constructor(e,t,n,i){super(i),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toNext",this.howMany=t,this.targetPosition=n.clone(),this.targetPosition.stickiness="toNone"}get type(){return"$graveyard"==this.targetPosition.root.rootName?"remove":"$graveyard"==this.sourcePosition.root.rootName?"reinsert":"move"}get affectedSelectable(){return[_h._createFromPositionAndShift(this.sourcePosition,this.howMany),_h._createFromPositionAndShift(this.targetPosition,0)]}clone(){return new eg(this.sourcePosition,this.howMany,this.targetPosition,this.baseVersion)}getMovedRangeStart(){return this.targetPosition._getTransformedByDeletion(this.sourcePosition,this.howMany)}getReversed(){const e=this.sourcePosition._getTransformedByInsertion(this.targetPosition,this.howMany);return new eg(this.getMovedRangeStart(),this.howMany,e,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent,n=this.sourcePosition.offset,i=this.targetPosition.offset;if(n+this.howMany>e.maxOffset)throw new Aa("move-operation-nodes-do-not-exist",this);if(e===t&&n<i&&i<n+this.howMany)throw new Aa("move-operation-range-into-itself",this);if(this.sourcePosition.root==this.targetPosition.root&&"prefix"==tl(this.sourcePosition.getParentPath(),this.targetPosition.getParentPath())){const e=this.sourcePosition.path.length-1;if(this.targetPosition.path[e]>=n&&this.targetPosition.path[e]<n+this.howMany)throw new Aa("move-operation-node-into-itself",this)}}_execute(){Zm(_h._createFromPositionAndShift(this.sourcePosition,this.howMany),this.targetPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e.targetPosition=this.targetPosition.toJSON(),e}static get className(){return"MoveOperation"}static fromJSON(e,t){const n=ph.fromJSON(e.sourcePosition,t),i=ph.fromJSON(e.targetPosition,t);return new this(n,e.howMany,i,e.baseVersion)}}class tg extends qm{position;nodes;shouldReceiveAttributes;constructor(e,t,n){super(n),this.position=e.clone(),this.position.stickiness="toNone",this.nodes=new Uh(Qm(t)),this.shouldReceiveAttributes=!1}get type(){return"insert"}get howMany(){return this.nodes.maxOffset}get affectedSelectable(){return this.position.clone()}clone(){const e=new Uh([...this.nodes].map((e=>e._clone(!0)))),t=new tg(this.position,e,this.baseVersion);return t.shouldReceiveAttributes=this.shouldReceiveAttributes,t}getReversed(){const e=this.position.root.document.graveyard,t=new ph(e,[0]);return new eg(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffset<this.position.offset)throw new Aa("insert-operation-position-invalid",this)}_execute(){const e=this.nodes;this.nodes=new Uh([...e].map((e=>e._clone(!0)))),Gm(this.position,e)}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e.nodes=this.nodes.toJSON(),e}static get className(){return"InsertOperation"}static fromJSON(e,t){const n=[];for(const t of e.nodes)t.name?n.push(qh.fromJSON(t)):n.push(zh.fromJSON(t));const i=new tg(ph.fromJSON(e.position,t),n,e.baseVersion);return i.shouldReceiveAttributes=e.shouldReceiveAttributes,i}}class ng extends qm{splitPosition;howMany;insertionPosition;graveyardPosition;constructor(e,t,n,i,r){super(r),this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=t,this.insertionPosition=n,this.graveyardPosition=i?i.clone():null,this.graveyardPosition&&(this.graveyardPosition.stickiness="toNext")}get type(){return"split"}get moveTargetPosition(){const e=this.insertionPosition.path.slice();return e.push(0),new ph(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new _h(this.splitPosition,e)}get affectedSelectable(){const e=[_h._createFromPositionAndShift(this.splitPosition,0),_h._createFromPositionAndShift(this.insertionPosition,0)];return this.graveyardPosition&&e.push(_h._createFromPositionAndShift(this.graveyardPosition,0)),e}clone(){return new ng(this.splitPosition,this.howMany,this.insertionPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.splitPosition.root.document.graveyard,t=new ph(e,[0]);return new ig(this.moveTargetPosition,this.howMany,this.splitPosition,t,this.baseVersion+1)}_validate(){const e=this.splitPosition.parent,t=this.splitPosition.offset;if(!e||e.maxOffset<t)throw new Aa("split-operation-position-invalid",this);if(!e.parent)throw new Aa("split-operation-split-in-root",this);if(this.howMany!=e.maxOffset-this.splitPosition.offset)throw new Aa("split-operation-how-many-invalid",this);if(this.graveyardPosition&&!this.graveyardPosition.nodeAfter)throw new Aa("split-operation-graveyard-position-invalid",this)}_execute(){const e=this.splitPosition.parent;if(this.graveyardPosition)Zm(_h._createFromPositionAndShift(this.graveyardPosition,1),this.insertionPosition);else{const t=e._clone();Gm(this.insertionPosition,t)}Zm(new _h(ph._createAt(e,this.splitPosition.offset),ph._createAt(e,e.maxOffset)),this.moveTargetPosition)}toJSON(){const e=super.toJSON();return e.splitPosition=this.splitPosition.toJSON(),e.insertionPosition=this.insertionPosition.toJSON(),this.graveyardPosition&&(e.graveyardPosition=this.graveyardPosition.toJSON()),e}static get className(){return"SplitOperation"}static getInsertionPosition(e){const t=e.path.slice(0,-1);return t[t.length-1]++,new ph(e.root,t,"toPrevious")}static fromJSON(e,t){const n=ph.fromJSON(e.splitPosition,t),i=ph.fromJSON(e.insertionPosition,t),r=e.graveyardPosition?ph.fromJSON(e.graveyardPosition,t):null;return new this(n,e.howMany,i,r,e.baseVersion)}}class ig extends qm{sourcePosition;howMany;targetPosition;graveyardPosition;constructor(e,t,n,i,r){super(r),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=t,this.targetPosition=n.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=i.clone()}get type(){return"merge"}get deletionPosition(){return new ph(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const e=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new _h(this.sourcePosition,e)}get affectedSelectable(){const e=this.sourcePosition.parent;return[_h._createOn(e),_h._createFromPositionAndShift(this.targetPosition,0),_h._createFromPositionAndShift(this.graveyardPosition,0)]}clone(){return new ig(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.targetPosition._getTransformedByMergeOperation(this),t=this.sourcePosition.path.slice(0,-1),n=new ph(this.sourcePosition.root,t)._getTransformedByMergeOperation(this);return new ng(e,this.howMany,n,this.graveyardPosition,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent;if(!e.parent)throw new Aa("merge-operation-source-position-invalid",this);if(!t.parent)throw new Aa("merge-operation-target-position-invalid",this);if(this.howMany!=e.maxOffset)throw new Aa("merge-operation-how-many-invalid",this)}_execute(){const e=this.sourcePosition.parent;Zm(_h._createIn(e),this.targetPosition),Zm(_h._createOn(e),this.graveyardPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=e.sourcePosition.toJSON(),e.targetPosition=e.targetPosition.toJSON(),e.graveyardPosition=e.graveyardPosition.toJSON(),e}static get className(){return"MergeOperation"}static fromJSON(e,t){const n=ph.fromJSON(e.sourcePosition,t),i=ph.fromJSON(e.targetPosition,t),r=ph.fromJSON(e.graveyardPosition,t);return new this(n,e.howMany,i,r,e.baseVersion)}}class rg extends qm{name;oldRange;newRange;affectsData;_markers;constructor(e,t,n,i,r,s){super(s),this.name=e,this.oldRange=t?t.clone():null,this.newRange=n?n.clone():null,this.affectsData=r,this._markers=i}get type(){return"marker"}get affectedSelectable(){const e=[];return this.oldRange&&e.push(this.oldRange.clone()),this.newRange&&(this.oldRange?e.push(...this.newRange.getDifference(this.oldRange)):e.push(this.newRange.clone())),e}clone(){return new rg(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new rg(this.name,this.newRange,this.oldRange,this._markers,this.affectsData,this.baseVersion+1)}_execute(){this.newRange?this._markers._set(this.name,this.newRange,!0,this.affectsData):this._markers._remove(this.name)}toJSON(){const e=super.toJSON();return this.oldRange&&(e.oldRange=this.oldRange.toJSON()),this.newRange&&(e.newRange=this.newRange.toJSON()),delete e._markers,e}static get className(){return"MarkerOperation"}static fromJSON(e,t){return new rg(e.name,e.oldRange?_h.fromJSON(e.oldRange,t):null,e.newRange?_h.fromJSON(e.newRange,t):null,t.model.markers,e.affectsData,e.baseVersion)}}class sg extends qm{range;key;oldValue;newValue;constructor(e,t,n,i,r){super(r),this.range=e.clone(),this.key=t,this.oldValue=void 0===n?null:n,this.newValue=void 0===i?null:i}get type(){return null===this.oldValue?"addAttribute":null===this.newValue?"removeAttribute":"changeAttribute"}get affectedSelectable(){return this.range.clone()}clone(){return new sg(this.range,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new sg(this.range,this.key,this.newValue,this.oldValue,this.baseVersion+1)}toJSON(){const e=super.toJSON();return e.range=this.range.toJSON(),e}_validate(){if(!this.range.isFlat)throw new Aa("attribute-operation-range-not-flat",this);for(const e of this.range.getItems({shallow:!0})){if(null!==this.oldValue&&!kd(e.getAttribute(this.key),this.oldValue))throw new Aa("attribute-operation-wrong-old-value",this,{item:e,key:this.key,value:this.oldValue});if(null===this.oldValue&&null!==this.newValue&&e.hasAttribute(this.key))throw new Aa("attribute-operation-attribute-exists",this,{node:e,key:this.key})}}_execute(){kd(this.oldValue,this.newValue)||function(e,t,n){Jm(e.start),Jm(e.end);for(const i of e.getItems({shallow:!0})){const e=i.is("$textProxy")?i.textNode:i;null!==n?e._setAttribute(t,n):e._removeAttribute(t),Ym(e.parent,e.index)}Ym(e.end.parent,e.end.index)}(this.range,this.key,this.newValue)}static get className(){return"AttributeOperation"}static fromJSON(e,t){return new sg(_h.fromJSON(e.range,t),e.key,e.oldValue,e.newValue,e.baseVersion)}}class og extends qm{get type(){return"noop"}get affectedSelectable(){return null}clone(){return new og(this.baseVersion)}getReversed(){return new og(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}class ag extends qm{position;oldName;newName;constructor(e,t,n,i){super(i),this.position=e,this.position.stickiness="toNext",this.oldName=t,this.newName=n}get type(){return"rename"}get affectedSelectable(){return this.position.nodeAfter}clone(){return new ag(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new ag(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(!(e instanceof qh))throw new Aa("rename-operation-wrong-position",this);if(e.name!==this.oldName)throw new Aa("rename-operation-wrong-name",this)}_execute(){this.position.nodeAfter.name=this.newName}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e}static get className(){return"RenameOperation"}static fromJSON(e,t){return new ag(ph.fromJSON(e.position,t),e.oldName,e.newName,e.baseVersion)}}class lg extends qm{root;key;oldValue;newValue;constructor(e,t,n,i,r){super(r),this.root=e,this.key=t,this.oldValue=void 0===n?null:n,this.newValue=void 0===i?null:i}get type(){return null===this.oldValue?"addRootAttribute":null===this.newValue?"removeRootAttribute":"changeRootAttribute"}get affectedSelectable(){return this.root}clone(){return new lg(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new lg(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new Aa("rootattribute-operation-not-a-root",this,{root:this.root,key:this.key});if(null!==this.oldValue&&this.root.getAttribute(this.key)!==this.oldValue)throw new Aa("rootattribute-operation-wrong-old-value",this,{root:this.root,key:this.key});if(null===this.oldValue&&null!==this.newValue&&this.root.hasAttribute(this.key))throw new Aa("rootattribute-operation-attribute-exists",this,{root:this.root,key:this.key})}_execute(){null!==this.newValue?this.root._setAttribute(this.key,this.newValue):this.root._removeAttribute(this.key)}toJSON(){const e=super.toJSON();return e.root=this.root.toJSON(),e}static get className(){return"RootAttributeOperation"}static fromJSON(e,t){if(!t.getRoot(e.root))throw new Aa("rootattribute-operation-fromjson-no-root",this,{rootName:e.root});return new lg(t.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}class cg extends qm{rootName;elementName;isAdd;_document;constructor(e,t,n,i,r){super(r),this.rootName=e,this.elementName=t,this.isAdd=n,this._document=i,this._document.getRoot(this.rootName)||(this._document.createRoot(this.elementName,this.rootName)._isAttached=!1)}get type(){return this.isAdd?"addRoot":"detachRoot"}get affectedSelectable(){return this._document.getRoot(this.rootName)}clone(){return new cg(this.rootName,this.elementName,this.isAdd,this._document,this.baseVersion)}getReversed(){return new cg(this.rootName,this.elementName,!this.isAdd,this._document,this.baseVersion+1)}_execute(){this._document.getRoot(this.rootName)._isAttached=this.isAdd}toJSON(){const e=super.toJSON();return delete e._document,e}static get className(){return"RootOperation"}static fromJSON(e,t){return new cg(e.rootName,e.elementName,e.isAdd,t,e.baseVersion)}}const dg={};dg[sg.className]=sg,dg[tg.className]=tg,dg[rg.className]=rg,dg[eg.className]=eg,dg[og.className]=og,dg[qm.className]=qm,dg[ag.className]=ag,dg[lg.className]=lg,dg[cg.className]=cg,dg[ng.className]=ng,dg[ig.className]=ig;class ug{static fromJSON(e,t){return dg[e.__className].fromJSON(e,t)}}const hg=new Map;function mg(e,t,n){let i=hg.get(e);i||(i=new Map,hg.set(e,i)),i.set(t,n)}function gg(e){return[e]}function pg(e,t,n={}){const i=function(e,t){const n=hg.get(e);return n&&n.has(t)?n.get(t):gg}(e.constructor,t.constructor);try{return i(e=e.clone(),t,n)}catch(e){throw e}}function fg(e,t,n){e=e.slice(),t=t.slice();const i=new bg(n.document,n.useRelations,n.forceWeakRemove);i.setOriginalOperations(e),i.setOriginalOperations(t);const r=i.originalOperations;if(0==e.length||0==t.length)return{operationsA:e,operationsB:t,originalOperations:r};const s=new WeakMap;for(const t of e)s.set(t,0);const o={nextBaseVersionA:e[e.length-1].baseVersion+1,nextBaseVersionB:t[t.length-1].baseVersion+1,originalOperationsACount:e.length,originalOperationsBCount:t.length};let a=0;for(;a<e.length;){const n=e[a],r=s.get(n);if(r==t.length){a++;continue}const o=t[r],l=pg(n,o,i.getContext(n,o,!0)),c=pg(o,n,i.getContext(o,n,!1));i.updateRelation(n,o),i.setOriginalOperations(l,n),i.setOriginalOperations(c,o);for(const e of l)s.set(e,r+c.length);e.splice(a,1,...l),t.splice(r,1,...c)}if(yg(e),yg(t),n.padWithNoOps){const n=e.length-o.originalOperationsACount,i=t.length-o.originalOperationsBCount;vg(e,i-n),vg(t,n-i)}return wg(e,o.nextBaseVersionB),wg(t,o.nextBaseVersionA),{operationsA:e,operationsB:t,originalOperations:r}}class bg{originalOperations;_history;_useRelations;_forceWeakRemove;_relations;constructor(e,t,n=!1){this.originalOperations=new Map,this._history=e.history,this._useRelations=t,this._forceWeakRemove=!!n,this._relations=new Map}setOriginalOperations(e,t=null){const n=t?this.originalOperations.get(t):null;for(const t of e)this.originalOperations.set(t,n||t)}updateRelation(e,t){if(e instanceof eg)t instanceof ig?e.targetPosition.isEqual(t.sourcePosition)||t.movedRange.containsPosition(e.targetPosition)?this._setRelation(e,t,"insertAtSource"):e.targetPosition.isEqual(t.deletionPosition)?this._setRelation(e,t,"insertBetween"):e.targetPosition.isAfter(t.sourcePosition)&&this._setRelation(e,t,"moveTargetAfter"):t instanceof eg&&(e.targetPosition.isEqual(t.sourcePosition)||e.targetPosition.isBefore(t.sourcePosition)?this._setRelation(e,t,"insertBefore"):this._setRelation(e,t,"insertAfter"));else if(e instanceof ng){if(t instanceof ig)e.splitPosition.isBefore(t.sourcePosition)&&this._setRelation(e,t,"splitBefore");else if(t instanceof eg)if(e.splitPosition.isEqual(t.sourcePosition)||e.splitPosition.isBefore(t.sourcePosition))this._setRelation(e,t,"splitBefore");else{const n=_h._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&n.containsPosition(e.splitPosition)){const i=n.end.offset-e.splitPosition.offset,r=e.splitPosition.offset-n.start.offset;this._setRelation(e,t,{howMany:i,offset:r})}}}else if(e instanceof ig)t instanceof ig?(e.targetPosition.isEqual(t.sourcePosition)||this._setRelation(e,t,"mergeTargetNotMoved"),e.sourcePosition.isEqual(t.targetPosition)&&this._setRelation(e,t,"mergeSourceNotMoved"),e.sourcePosition.isEqual(t.sourcePosition)&&this._setRelation(e,t,"mergeSameElement")):t instanceof ng?e.sourcePosition.isEqual(t.splitPosition)&&this._setRelation(e,t,"splitAtSource"):t instanceof eg&&t.howMany>0&&(e.sourcePosition.isEqual(t.sourcePosition.getShiftedBy(t.howMany))&&this._setRelation(e,t,"mergeSourceAffected"),e.targetPosition.isEqual(t.sourcePosition)&&this._setRelation(e,t,"mergeTargetWasBefore"));else if(e instanceof rg){const n=e.newRange;if(!n)return;if(t instanceof ig){const i=n.start.isEqual(t.targetPosition),r=n.start.isEqual(t.deletionPosition),s=n.end.isEqual(t.deletionPosition),o=n.end.isEqual(t.sourcePosition);(i||r||s||o)&&this._setRelation(e,t,{wasInLeftElement:i,wasStartBeforeMergedElement:r,wasEndBeforeMergedElement:s,wasInRightElement:o})}}}getContext(e,t,n){return{aIsStrong:n,aWasUndone:this._wasUndone(e),bWasUndone:this._wasUndone(t),abRelation:this._useRelations?this._getRelation(e,t):null,baRelation:this._useRelations?this._getRelation(t,e):null,forceWeakRemove:this._forceWeakRemove}}_wasUndone(e){const t=this.originalOperations.get(e);return t.wasUndone||this._history.isUndoneOperation(t)}_getRelation(e,t){const n=this.originalOperations.get(t),i=this._history.getUndoneOperation(n);if(!i)return null;const r=this.originalOperations.get(e),s=this._relations.get(r);return s&&s.get(i)||null}_setRelation(e,t,n){const i=this.originalOperations.get(e),r=this.originalOperations.get(t);let s=this._relations.get(i);s||(s=new Map,this._relations.set(i,s)),s.set(r,n)}}function wg(e,t){for(const n of e)n.baseVersion=t++}function vg(e,t){for(let n=0;n<t;n++)e.push(new og(0))}function yg(e){const t=new Map;for(let n=0;n<e.length;n++){const i=e[n];i instanceof rg&&(-1!==i.baseVersion?t.set(i.name,{op:i,ranges:i.newRange?[i.newRange]:[]}):(i.newRange&&t.get(i.name).ranges.push(i.newRange),e.splice(n,1),n--))}for(const{op:e,ranges:n}of t.values())n.length?e.newRange=_h._createFromRanges(n):e.newRange=null}function _g(e,t,n){const i=e.nodes.getNode(0).getAttribute(t);if(i==n)return null;const r=new _h(e.position,e.position.getShiftedBy(e.howMany));return new sg(r,t,i,n,0)}function kg(e,t){return null===e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany)}function xg(e,t){const n=[];for(let i=0;i<e.length;i++){const r=e[i],s=new eg(r.start,r.end.offset-r.start.offset,t,0);n.push(s);for(let t=i+1;t<e.length;t++)e[t]=e[t]._getTransformedByMove(s.sourcePosition,s.targetPosition,s.howMany)[0];t=t._getTransformedByMove(s.sourcePosition,s.targetPosition,s.howMany)}return n}mg(sg,sg,((e,t,n)=>{if(e.key===t.key&&e.range.start.hasSameParentAs(t.range.start)){const i=e.range.getDifference(t.range).map((t=>new sg(t,e.key,e.oldValue,e.newValue,0))),r=e.range.getIntersection(t.range);return r&&n.aIsStrong&&i.push(new sg(r,t.key,t.newValue,e.newValue,0)),0==i.length?[new og(0)]:i}return[e]})),mg(sg,tg,((e,t)=>{if(e.range.start.hasSameParentAs(t.position)&&e.range.containsPosition(t.position)){const n=e.range._getTransformedByInsertion(t.position,t.howMany,!t.shouldReceiveAttributes).map((t=>new sg(t,e.key,e.oldValue,e.newValue,e.baseVersion)));if(t.shouldReceiveAttributes){const i=_g(t,e.key,e.oldValue);i&&n.unshift(i)}return n}return e.range=e.range._getTransformedByInsertion(t.position,t.howMany,!1)[0],[e]})),mg(sg,ig,((e,t)=>{const n=[];e.range.start.hasSameParentAs(t.deletionPosition)&&(e.range.containsPosition(t.deletionPosition)||e.range.start.isEqual(t.deletionPosition))&&n.push(_h._createFromPositionAndShift(t.graveyardPosition,1));const i=e.range._getTransformedByMergeOperation(t);return i.isCollapsed||n.push(i),n.map((t=>new sg(t,e.key,e.oldValue,e.newValue,e.baseVersion)))})),mg(sg,eg,((e,t)=>function(e,t){const n=_h._createFromPositionAndShift(t.sourcePosition,t.howMany);let i=null,r=[];n.containsRange(e,!0)?i=e:e.start.hasSameParentAs(n.start)?(r=e.getDifference(n),i=e.getIntersection(n)):r=[e];const s=[];for(let e of r){e=e._getTransformedByDeletion(t.sourcePosition,t.howMany);const n=t.getMovedRangeStart(),i=e.start.hasSameParentAs(n),r=e._getTransformedByInsertion(n,t.howMany,i);s.push(...r)}return i&&s.push(i._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany,!1)[0]),s}(e.range,t).map((t=>new sg(t,e.key,e.oldValue,e.newValue,e.baseVersion))))),mg(sg,ng,((e,t)=>{if(e.range.end.isEqual(t.insertionPosition))return t.graveyardPosition||e.range.end.offset++,[e];if(e.range.start.hasSameParentAs(t.splitPosition)&&e.range.containsPosition(t.splitPosition)){const n=e.clone();return n.range=new _h(t.moveTargetPosition.clone(),e.range.end._getCombined(t.splitPosition,t.moveTargetPosition)),e.range.end=t.splitPosition.clone(),e.range.end.stickiness="toPrevious",[e,n]}return e.range=e.range._getTransformedBySplitOperation(t),[e]})),mg(tg,sg,((e,t)=>{const n=[e];if(e.shouldReceiveAttributes&&e.position.hasSameParentAs(t.range.start)&&t.range.containsPosition(e.position)){const i=_g(e,t.key,t.newValue);i&&n.push(i)}return n})),mg(tg,tg,((e,t,n)=>(e.position.isEqual(t.position)&&n.aIsStrong||(e.position=e.position._getTransformedByInsertOperation(t)),[e]))),mg(tg,eg,((e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e]))),mg(tg,ng,((e,t)=>(e.position=e.position._getTransformedBySplitOperation(t),[e]))),mg(tg,ig,((e,t)=>(e.position=e.position._getTransformedByMergeOperation(t),[e]))),mg(rg,tg,((e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByInsertOperation(t)[0]),e.newRange&&(e.newRange=e.newRange._getTransformedByInsertOperation(t)[0]),[e]))),mg(rg,rg,((e,t,n)=>{if(e.name==t.name){if(!n.aIsStrong)return[new og(0)];e.oldRange=t.newRange?t.newRange.clone():null}return[e]})),mg(rg,ig,((e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByMergeOperation(t)),e.newRange&&(e.newRange=e.newRange._getTransformedByMergeOperation(t)),[e]))),mg(rg,eg,((e,t)=>{const n=[e];if(e.oldRange&&(e.oldRange=_h._createFromRanges(e.oldRange._getTransformedByMoveOperation(t))),e.newRange){const i=e.newRange._getTransformedByMoveOperation(t);e.newRange=i[0];for(let t=1;t<i.length;t++){const r=e.clone();r.oldRange=null,r.newRange=i[t],r.baseVersion=-1,n.push(r)}}return n})),mg(rg,ng,((e,t,n)=>{if(e.oldRange&&(e.oldRange=e.oldRange._getTransformedBySplitOperation(t)),e.newRange){if(n.abRelation){const i=e.newRange._getTransformedBySplitOperation(t);return e.newRange.start.isEqual(t.splitPosition)&&n.abRelation.wasStartBeforeMergedElement?e.newRange.start=ph._createAt(t.insertionPosition):e.newRange.start.isEqual(t.splitPosition)&&!n.abRelation.wasInLeftElement?e.newRange.start=ph._createAt(t.moveTargetPosition):e.newRange.start=i.start,e.newRange.end.isEqual(t.splitPosition)&&n.abRelation.wasInRightElement?e.newRange.end=ph._createAt(t.moveTargetPosition):e.newRange.end.isEqual(t.splitPosition)&&n.abRelation.wasEndBeforeMergedElement?e.newRange.end=ph._createAt(t.insertionPosition):e.newRange.end=i.end,[e]}e.newRange=e.newRange._getTransformedBySplitOperation(t)}return[e]})),mg(ig,tg,((e,t)=>(e.sourcePosition.hasSameParentAs(t.position)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByInsertOperation(t),e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t),[e]))),mg(ig,ig,((e,t,n)=>{if(e.sourcePosition.isEqual(t.sourcePosition)&&e.targetPosition.isEqual(t.targetPosition)){if(n.bWasUndone){const n=t.graveyardPosition.path.slice();return n.push(0),e.sourcePosition=new ph(t.graveyardPosition.root,n),e.howMany=0,[e]}return[new og(0)]}if(e.sourcePosition.isEqual(t.sourcePosition)&&!e.targetPosition.isEqual(t.targetPosition)&&!n.bWasUndone&&"splitAtSource"!=n.abRelation){const i="$graveyard"==e.targetPosition.root.rootName,r="$graveyard"==t.targetPosition.root.rootName;if(r&&!i||(!i||r)&&n.aIsStrong){const n=t.targetPosition._getTransformedByMergeOperation(t),i=e.targetPosition._getTransformedByMergeOperation(t);return[new eg(n,e.howMany,i,0)]}return[new og(0)]}return e.sourcePosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByMergeOperation(t),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),e.graveyardPosition.isEqual(t.graveyardPosition)&&n.aIsStrong||(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]})),mg(ig,eg,((e,t,n)=>{const i=_h._createFromPositionAndShift(t.sourcePosition,t.howMany);return"remove"==t.type&&!n.bWasUndone&&e.deletionPosition.hasSameParentAs(t.sourcePosition)&&i.containsPosition(e.sourcePosition)?[new og(0)]:(t.sourcePosition.getShiftedBy(t.howMany).isEqual(e.sourcePosition)?e.sourcePosition.stickiness="toNone":t.targetPosition.isEqual(e.sourcePosition)&&"mergeSourceAffected"==n.abRelation?e.sourcePosition.stickiness="toNext":t.sourcePosition.isEqual(e.targetPosition)?(e.targetPosition.stickiness="toNone",e.howMany-=t.howMany):t.targetPosition.isEqual(e.targetPosition)&&"mergeTargetWasBefore"==n.abRelation?(e.targetPosition.stickiness="toPrevious",e.howMany+=t.howMany):(e.sourcePosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.sourcePosition.hasSameParentAs(t.sourcePosition)&&(e.howMany-=t.howMany)),e.sourcePosition=e.sourcePosition._getTransformedByMoveOperation(t),e.targetPosition=e.targetPosition._getTransformedByMoveOperation(t),e.sourcePosition.stickiness="toPrevious",e.targetPosition.stickiness="toNext",e.graveyardPosition.isEqual(t.targetPosition)||(e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)),[e])})),mg(ig,ng,((e,t,n)=>{if(t.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByDeletion(t.graveyardPosition,1),e.deletionPosition.isEqual(t.graveyardPosition)&&(e.howMany=t.howMany)),e.targetPosition.isEqual(t.splitPosition)&&(t.graveyardPosition&&e.deletionPosition.isEqual(t.graveyardPosition)||"mergeTargetNotMoved"==n.abRelation))return e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),[e];if(e.sourcePosition.isEqual(t.splitPosition)){if("mergeSourceNotMoved"==n.abRelation)return e.howMany=0,e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e];if("mergeSameElement"==n.abRelation||e.sourcePosition.offset>0)return e.sourcePosition=t.moveTargetPosition.clone(),e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e]}return e.sourcePosition.hasSameParentAs(t.splitPosition)&&(e.howMany=t.splitPosition.offset),e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e]})),mg(eg,tg,((e,t)=>{const n=_h._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByInsertOperation(t,!1)[0];return e.sourcePosition=n.start,e.howMany=n.end.offset-n.start.offset,e.targetPosition.isEqual(t.position)||(e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t)),[e]})),mg(eg,eg,((e,t,n)=>{const i=_h._createFromPositionAndShift(e.sourcePosition,e.howMany),r=_h._createFromPositionAndShift(t.sourcePosition,t.howMany);let s,o=n.aIsStrong,a=!n.aIsStrong;if("insertBefore"==n.abRelation||"insertAfter"==n.baRelation?a=!0:"insertAfter"!=n.abRelation&&"insertBefore"!=n.baRelation||(a=!1),s=e.targetPosition.isEqual(t.targetPosition)&&a?e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany):e.targetPosition._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),kg(e,t)&&kg(t,e))return[t.getReversed()];if(i.containsPosition(t.targetPosition)&&i.containsRange(r,!0))return i.start=i.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),i.end=i.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),xg([i],s);if(r.containsPosition(e.targetPosition)&&r.containsRange(i,!0))return i.start=i.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),i.end=i.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),xg([i],s);const l=tl(e.sourcePosition.getParentPath(),t.sourcePosition.getParentPath());if("prefix"==l||"extension"==l)return i.start=i.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),i.end=i.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),xg([i],s);"remove"!=e.type||"remove"==t.type||n.aWasUndone||n.forceWeakRemove?"remove"==e.type||"remove"!=t.type||n.bWasUndone||n.forceWeakRemove||(o=!1):o=!0;const c=[],d=i.getDifference(r);for(const e of d){e.start=e.start._getTransformedByDeletion(t.sourcePosition,t.howMany),e.end=e.end._getTransformedByDeletion(t.sourcePosition,t.howMany);const n="same"==tl(e.start.getParentPath(),t.getMovedRangeStart().getParentPath()),i=e._getTransformedByInsertion(t.getMovedRangeStart(),t.howMany,n);c.push(...i)}const u=i.getIntersection(r);return null!==u&&o&&(u.start=u.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),u.end=u.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),0===c.length?c.push(u):1==c.length?r.start.isBefore(i.start)||r.start.isEqual(i.start)?c.unshift(u):c.push(u):c.splice(1,0,u)),0===c.length?[new og(e.baseVersion)]:xg(c,s)})),mg(eg,ng,((e,t,n)=>{let i=e.targetPosition.clone();e.targetPosition.isEqual(t.insertionPosition)&&t.graveyardPosition&&"moveTargetAfter"!=n.abRelation||(i=e.targetPosition._getTransformedBySplitOperation(t));const r=_h._createFromPositionAndShift(e.sourcePosition,e.howMany);if(r.end.isEqual(t.insertionPosition))return t.graveyardPosition||e.howMany++,e.targetPosition=i,[e];if(r.start.hasSameParentAs(t.splitPosition)&&r.containsPosition(t.splitPosition)){let e=new _h(t.splitPosition,r.end);return e=e._getTransformedBySplitOperation(t),xg([new _h(r.start,t.splitPosition),e],i)}e.targetPosition.isEqual(t.splitPosition)&&"insertAtSource"==n.abRelation&&(i=t.moveTargetPosition),e.targetPosition.isEqual(t.insertionPosition)&&"insertBetween"==n.abRelation&&(i=e.targetPosition);const s=[r._getTransformedBySplitOperation(t)];if(t.graveyardPosition){const i=r.start.isEqual(t.graveyardPosition)||r.containsPosition(t.graveyardPosition);e.howMany>1&&i&&!n.aWasUndone&&s.push(_h._createFromPositionAndShift(t.insertionPosition,1))}return xg(s,i)})),mg(eg,ig,((e,t,n)=>{const i=_h._createFromPositionAndShift(e.sourcePosition,e.howMany);if(t.deletionPosition.hasSameParentAs(e.sourcePosition)&&i.containsPosition(t.sourcePosition))if("remove"!=e.type||n.forceWeakRemove){if(1==e.howMany)return n.bWasUndone?(e.sourcePosition=t.graveyardPosition.clone(),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]):[new og(0)]}else if(!n.aWasUndone){const n=[];let i=t.graveyardPosition.clone(),r=t.targetPosition._getTransformedByMergeOperation(t);const s=e.targetPosition.getTransformedByOperation(t);e.howMany>1&&(n.push(new eg(e.sourcePosition,e.howMany-1,s,0)),i=i._getTransformedByMove(e.sourcePosition,s,e.howMany-1),r=r._getTransformedByMove(e.sourcePosition,s,e.howMany-1));const o=t.deletionPosition._getCombined(e.sourcePosition,s),a=new eg(i,1,o,0),l=a.getMovedRangeStart().path.slice();l.push(0);const c=new ph(a.targetPosition.root,l);r=r._getTransformedByMove(i,o,1);const d=new eg(r,t.howMany,c,0);return n.push(a),n.push(d),n}const r=_h._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByMergeOperation(t);return e.sourcePosition=r.start,e.howMany=r.end.offset-r.start.offset,e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]})),mg(ag,tg,((e,t)=>(e.position=e.position._getTransformedByInsertOperation(t),[e]))),mg(ag,ig,((e,t)=>e.position.isEqual(t.deletionPosition)?(e.position=t.graveyardPosition.clone(),e.position.stickiness="toNext",[e]):(e.position=e.position._getTransformedByMergeOperation(t),[e]))),mg(ag,eg,((e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e]))),mg(ag,ag,((e,t,n)=>{if(e.position.isEqual(t.position)){if(!n.aIsStrong)return[new og(0)];e.oldName=t.newName}return[e]})),mg(ag,ng,((e,t)=>{if("same"==tl(e.position.path,t.splitPosition.getParentPath())&&!t.graveyardPosition){const t=new ag(e.position.getShiftedBy(1),e.oldName,e.newName,0);return[e,t]}return e.position=e.position._getTransformedBySplitOperation(t),[e]})),mg(lg,lg,((e,t,n)=>{if(e.root===t.root&&e.key===t.key){if(!n.aIsStrong||e.newValue===t.newValue)return[new og(0)];e.oldValue=t.newValue}return[e]})),mg(cg,cg,((e,t)=>e.rootName===t.rootName&&e.isAdd===t.isAdd?[new og(0)]:[e])),mg(ng,tg,((e,t)=>(e.splitPosition.hasSameParentAs(t.position)&&e.splitPosition.offset<t.position.offset&&(e.howMany+=t.howMany),e.splitPosition=e.splitPosition._getTransformedByInsertOperation(t),e.insertionPosition=e.insertionPosition._getTransformedByInsertOperation(t),[e]))),mg(ng,ig,((e,t,n)=>{if(!e.graveyardPosition&&!n.bWasUndone&&e.splitPosition.hasSameParentAs(t.sourcePosition)){const n=t.graveyardPosition.path.slice();n.push(0);const i=new ph(t.graveyardPosition.root,n),r=ng.getInsertionPosition(new ph(t.graveyardPosition.root,n)),s=new ng(i,0,r,null,0);return e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=ng.getInsertionPosition(e.splitPosition),e.graveyardPosition=s.insertionPosition.clone(),e.graveyardPosition.stickiness="toNext",[s,e]}return e.splitPosition.hasSameParentAs(t.deletionPosition)&&!e.splitPosition.isAfter(t.deletionPosition)&&e.howMany--,e.splitPosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=ng.getInsertionPosition(e.splitPosition),e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]})),mg(ng,eg,((e,t,n)=>{const i=_h._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.graveyardPosition){const r=i.start.isEqual(e.graveyardPosition)||i.containsPosition(e.graveyardPosition);if(!n.bWasUndone&&r){const n=e.splitPosition._getTransformedByMoveOperation(t),i=e.graveyardPosition._getTransformedByMoveOperation(t),r=i.path.slice();r.push(0);const s=new ph(i.root,r);return[new eg(n,e.howMany,s,0)]}e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)}const r=e.splitPosition.isEqual(t.targetPosition);if(r&&("insertAtSource"==n.baRelation||"splitBefore"==n.abRelation))return e.howMany+=t.howMany,e.splitPosition=e.splitPosition._getTransformedByDeletion(t.sourcePosition,t.howMany),e.insertionPosition=ng.getInsertionPosition(e.splitPosition),[e];if(r&&n.abRelation&&n.abRelation.howMany){const{howMany:t,offset:i}=n.abRelation;return e.howMany+=t,e.splitPosition=e.splitPosition.getShiftedBy(i),[e]}if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&i.containsPosition(e.splitPosition)){const n=t.howMany-(e.splitPosition.offset-t.sourcePosition.offset);return e.howMany-=n,e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset<t.targetPosition.offset&&(e.howMany+=t.howMany),e.splitPosition=t.sourcePosition.clone(),e.insertionPosition=ng.getInsertionPosition(e.splitPosition),[e]}return t.sourcePosition.isEqual(t.targetPosition)||(e.splitPosition.hasSameParentAs(t.sourcePosition)&&e.splitPosition.offset<=t.sourcePosition.offset&&(e.howMany-=t.howMany),e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset<t.targetPosition.offset&&(e.howMany+=t.howMany)),e.splitPosition.stickiness="toNone",e.splitPosition=e.splitPosition._getTransformedByMoveOperation(t),e.splitPosition.stickiness="toNext",e.graveyardPosition?e.insertionPosition=e.insertionPosition._getTransformedByMoveOperation(t):e.insertionPosition=ng.getInsertionPosition(e.splitPosition),[e]})),mg(ng,ng,((e,t,n)=>{if(e.splitPosition.isEqual(t.splitPosition)){if(!e.graveyardPosition&&!t.graveyardPosition)return[new og(0)];if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition))return[new og(0)];if("splitBefore"==n.abRelation)return e.howMany=0,e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t),[e]}if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition)){const i="$graveyard"==e.splitPosition.root.rootName,r="$graveyard"==t.splitPosition.root.rootName;if(r&&!i||(!i||r)&&n.aIsStrong){const n=[];return t.howMany&&n.push(new eg(t.moveTargetPosition,t.howMany,t.splitPosition,0)),e.howMany&&n.push(new eg(e.splitPosition,e.howMany,e.moveTargetPosition,0)),n}return[new og(0)]}if(e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t)),e.splitPosition.isEqual(t.insertionPosition)&&"splitBefore"==n.abRelation)return e.howMany++,[e];if(t.splitPosition.isEqual(e.insertionPosition)&&"splitBefore"==n.baRelation){const n=t.insertionPosition.path.slice();n.push(0);const i=new ph(t.insertionPosition.root,n);return[e,new eg(e.insertionPosition,1,i,0)]}return e.splitPosition.hasSameParentAs(t.splitPosition)&&e.splitPosition.offset<t.splitPosition.offset&&(e.howMany-=t.howMany),e.splitPosition=e.splitPosition._getTransformedBySplitOperation(t),e.insertionPosition=ng.getInsertionPosition(e.splitPosition),[e]}));class Cg extends(Na(ph)){constructor(e,t,n="toNone"){if(super(e,t,n),!this.root.is("rootElement"))throw new Aa("model-liveposition-root-not-rootelement",e);Ag.call(this)}detach(){this.stopListening()}toPosition(){return new ph(this.root,this.path.slice(),this.stickiness)}static fromPosition(e,t){return new this(e.root,e.path.slice(),t||e.stickiness)}}function Ag(){this.listenTo(this.root.document.model,"applyOperation",((e,t)=>{const n=t[0];n.isDocumentOperation&&Eg.call(this,n)}),{priority:"low"})}function Eg(e){const t=this.getTransformedByOperation(e);if(!this.isEqual(t)){const e=this.toPosition();this.path=t.path,this.root=t.root,this.fire("change",e)}}Cg.prototype.is=function(e){return"livePosition"===e||"model:livePosition"===e||"position"==e||"model:position"===e};class Tg{operations;isUndoable;isLocal;isUndo;isTyping;constructor(e={}){"string"==typeof e&&(e="transparent"===e?{isUndoable:!1}:{},Ea("batch-constructor-deprecated-string-type"));const{isUndoable:t=!0,isLocal:n=!0,isUndo:i=!1,isTyping:r=!1}=e;this.operations=[],this.isUndoable=t,this.isLocal=n,this.isUndo=i,this.isTyping=r}get type(){return Ea("batch-type-deprecated"),"default"}get baseVersion(){for(const e of this.operations)if(null!==e.baseVersion)return e.baseVersion;return null}addOperation(e){return e.isDocumentOperation&&(e.batch=this,this.operations.push(e)),e}}class Sg{static _statesPriority=[void 0,"refresh","rename","move"];_markerCollection;_changesInElement=new Map;_elementsSnapshots=new Map;_elementChildrenSnapshots=new Map;_elementState=new Map;_changedMarkers=new Map;_changedRoots=new Map;_changeCount=0;_cachedChanges=null;_cachedChangesWithGraveyard=null;_refreshedItems=new Set;constructor(e){this._markerCollection=e}get isEmpty(){return 0==this._changesInElement.size&&0==this._changedMarkers.size&&0==this._changedRoots.size}bufferOperation(e){const t=e;switch(t.type){case"insert":if(this._isInInsertedElement(t.position.parent))return;this._markInsert(t.position.parent,t.position.offset,t.nodes.maxOffset);break;case"addAttribute":case"removeAttribute":case"changeAttribute":for(const e of t.range.getItems({shallow:!0}))this._isInInsertedElement(e.parent)||this._markAttribute(e);break;case"remove":case"move":case"reinsert":{if(t.sourcePosition.isEqual(t.targetPosition)||t.sourcePosition.getShiftedBy(t.howMany).isEqual(t.targetPosition))return;const e=this._isInInsertedElement(t.sourcePosition.parent),n=this._isInInsertedElement(t.targetPosition.parent);e||this._markRemove(t.sourcePosition.parent,t.sourcePosition.offset,t.howMany),n||this._markInsert(t.targetPosition.parent,t.getMovedRangeStart().offset,t.howMany);const i=_h._createFromPositionAndShift(t.sourcePosition,t.howMany);for(const e of i.getItems({shallow:!0}))this._setElementState(e,"move");break}case"rename":{if(this._isInInsertedElement(t.position.parent))return;this._markRemove(t.position.parent,t.position.offset,1),this._markInsert(t.position.parent,t.position.offset,1);const e=_h._createFromPositionAndShift(t.position,1);for(const t of this._markerCollection.getMarkersIntersectingRange(e)){const e=t.getData();this.bufferMarkerChange(t.name,e,e)}this._setElementState(t.position.nodeAfter,"rename");break}case"split":{const e=t.splitPosition.parent;if(!this._isInInsertedElement(e)){this._markRemove(e,t.splitPosition.offset,t.howMany);const n=_h._createFromPositionAndShift(t.splitPosition,t.howMany);for(const e of n.getItems({shallow:!0}))this._setElementState(e,"move")}this._isInInsertedElement(t.insertionPosition.parent)||this._markInsert(t.insertionPosition.parent,t.insertionPosition.offset,1),t.graveyardPosition&&(this._markRemove(t.graveyardPosition.parent,t.graveyardPosition.offset,1),this._setElementState(t.graveyardPosition.nodeAfter,"move"));break}case"merge":{const e=t.sourcePosition.parent;this._isInInsertedElement(e.parent)||this._markRemove(e.parent,e.startOffset,1);const n=t.graveyardPosition.parent;this._markInsert(n,t.graveyardPosition.offset,1),this._setElementState(e,"move");const i=t.targetPosition.parent;if(!this._isInInsertedElement(i)){this._markInsert(i,t.targetPosition.offset,e.maxOffset);const n=_h._createFromPositionAndShift(t.sourcePosition,t.howMany);for(const e of n.getItems({shallow:!0}))this._setElementState(e,"move")}break}case"detachRoot":case"addRoot":{const e=t.affectedSelectable;if(!e._isLoaded)return;if(e.isAttached()==t.isAdd)return;this._bufferRootStateChange(t.rootName,t.isAdd);break}case"addRootAttribute":case"removeRootAttribute":case"changeRootAttribute":{if(!t.root._isLoaded)return;const e=t.root.rootName;this._bufferRootAttributeChange(e,t.key,t.oldValue,t.newValue);break}}this._cachedChanges=null}bufferMarkerChange(e,t,n){t.range&&t.range.root.is("rootElement")&&!t.range.root._isLoaded&&(t.range=null),n.range&&n.range.root.is("rootElement")&&!n.range.root._isLoaded&&(n.range=null);let i=this._changedMarkers.get(e);i?i.newMarkerData=n:(i={newMarkerData:n,oldMarkerData:t},this._changedMarkers.set(e,i)),null==i.oldMarkerData.range&&null==n.range&&this._changedMarkers.delete(e)}getMarkersToRemove(){const e=[];for(const[t,n]of this._changedMarkers)null!=n.oldMarkerData.range&&e.push({name:t,range:n.oldMarkerData.range});return e}getMarkersToAdd(){const e=[];for(const[t,n]of this._changedMarkers)null!=n.newMarkerData.range&&e.push({name:t,range:n.newMarkerData.range});return e}getChangedMarkers(){return Array.from(this._changedMarkers).map((([e,t])=>({name:e,data:{oldRange:t.oldMarkerData.range,newRange:t.newMarkerData.range}})))}hasDataChanges(){if(this.getChanges().length)return!0;if(this._changedRoots.size>0)return!0;for(const{newMarkerData:e,oldMarkerData:t}of this._changedMarkers.values()){if(e.affectsData!==t.affectsData)return!0;if(e.affectsData){const n=e.range&&!t.range,i=!e.range&&t.range,r=e.range&&t.range&&!e.range.isEqual(t.range);if(n||i||r)return!0}}return!1}getChanges(e={}){if(this._cachedChanges)return e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();let t=[];for(const e of this._changesInElement.keys()){const n=this._changesInElement.get(e).sort(((e,t)=>e.offset===t.offset?e.type!=t.type?"remove"==e.type?-1:1:0:e.offset<t.offset?-1:1)),i=this._elementChildrenSnapshots.get(e),r=Ig(e.getChildren()),s=Og(i.length,n);let o=0,a=0;for(const n of s)if("i"===n){const n=this._getDiffActionForNode(r[o].node,"insert"),i=this._elementsSnapshots.get(r[o].node),s=this._getInsertDiff(e,o,n,r[o],i);t.push(s),o++}else if("r"===n){const n=this._getDiffActionForNode(i[a].node,"remove"),r=this._getRemoveDiff(e,o,n,i[a]);t.push(r),a++}else if("a"===n){const n=i[a].attributes,s=r[o].attributes;let l;if("$text"==r[o].name)l=new _h(ph._createAt(e,o),ph._createAt(e,o+1));else{const t=e.offsetToIndex(o);l=new _h(ph._createAt(e,o),ph._createAt(e.getChild(t),0))}const c=this._getAttributesDiff(l,n,s);t.push(...c),o++,a++}else o++,a++}t.sort(((e,t)=>e.position.root!=t.position.root?e.position.root.rootName<t.position.root.rootName?-1:1:e.position.isEqual(t.position)?e.changeCount-t.changeCount:e.position.isBefore(t.position)?-1:1));for(let e=1,n=0;e<t.length;e++){const i=t[n],r=t[e],s="remove"==i.type&&"remove"==r.type&&"$text"==i.name&&"$text"==r.name&&i.position.isEqual(r.position),o="insert"==i.type&&"insert"==r.type&&"$text"==i.name&&"$text"==r.name&&i.position.parent==r.position.parent&&i.position.offset+i.length==r.position.offset,a="attribute"==i.type&&"attribute"==r.type&&i.position.parent==r.position.parent&&i.range.isFlat&&r.range.isFlat&&i.position.offset+i.length==r.position.offset&&i.attributeKey==r.attributeKey&&i.attributeOldValue==r.attributeOldValue&&i.attributeNewValue==r.attributeNewValue;s||o||a?(i.length++,a&&(i.range.end=i.range.end.getShiftedBy(1)),t[e]=null):n=e}t=t.filter((e=>e));for(const e of t)delete e.changeCount,"attribute"==e.type&&(delete e.position,delete e.length);return this._changeCount=0,this._cachedChangesWithGraveyard=t,this._cachedChanges=t.filter(Vg),e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice()}getChangedRoots(){return Array.from(this._changedRoots.values()).map((e=>{const t={...e};return void 0!==t.state&&delete t.attributes,t}))}getRefreshedItems(){return new Set(this._refreshedItems)}reset(){this._changesInElement.clear(),this._elementChildrenSnapshots.clear(),this._elementsSnapshots.clear(),this._elementState.clear(),this._changedMarkers.clear(),this._changedRoots.clear(),this._refreshedItems.clear(),this._cachedChanges=null}_refreshItem(e){if(this._isInInsertedElement(e.parent))return;this._markRemove(e.parent,e.startOffset,e.offsetSize),this._markInsert(e.parent,e.startOffset,e.offsetSize),this._refreshedItems.add(e),this._setElementState(e,"refresh");const t=_h._createOn(e);for(const e of this._markerCollection.getMarkersIntersectingRange(t)){const t=e.getData();this.bufferMarkerChange(e.name,t,t)}this._cachedChanges=null}_bufferRootLoad(e){if(e.isAttached()){this._bufferRootStateChange(e.rootName,!0),this._markInsert(e,0,e.maxOffset);for(const t of e.getAttributeKeys())this._bufferRootAttributeChange(e.rootName,t,null,e.getAttribute(t));for(const t of this._markerCollection)if(t.getRange().root==e){const e=t.getData();this.bufferMarkerChange(t.name,{...e,range:null},e)}}}_bufferRootStateChange(e,t){if(!this._changedRoots.has(e))return void this._changedRoots.set(e,{name:e,state:t?"attached":"detached"});const n=this._changedRoots.get(e);void 0!==n.state?(delete n.state,void 0===n.attributes&&this._changedRoots.delete(e)):n.state=t?"attached":"detached"}_bufferRootAttributeChange(e,t,n,i){const r=this._changedRoots.get(e)||{name:e},s=r.attributes||{};if(s[t]){const e=s[t];i===e.oldValue?delete s[t]:e.newValue=i}else s[t]={oldValue:n,newValue:i};0===Object.entries(s).length?(delete r.attributes,void 0===r.state&&this._changedRoots.delete(e)):(r.attributes=s,this._changedRoots.set(e,r))}_markInsert(e,t,n){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const i={type:"insert",offset:t,howMany:n,count:this._changeCount++};this._markChange(e,i)}_markRemove(e,t,n){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const i={type:"remove",offset:t,howMany:n,count:this._changeCount++};this._markChange(e,i),this._removeAllNestedChanges(e,t,n)}_markAttribute(e){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const t={type:"attribute",offset:e.startOffset,howMany:e.offsetSize,count:this._changeCount++};this._markChange(e.parent,t)}_markChange(e,t){this._makeSnapshots(e);const n=this._getChangesForElement(e);this._handleChange(t,n),n.push(t);for(let e=0;e<n.length;e++)n[e].howMany<1&&(n.splice(e,1),e--)}_setElementState(e,t){if(!e.is("element"))return;const n=Sg._statesPriority.indexOf(this._elementState.get(e));Sg._statesPriority.indexOf(t)>n&&this._elementState.set(e,t)}_getDiffActionForNode(e,t){if(!e.is("element"))return t;if(!this._elementsSnapshots.has(e))return t;const n=this._elementState.get(e);return n&&"move"!=n?n:t}_getChangesForElement(e){let t;return this._changesInElement.has(e)?t=this._changesInElement.get(e):(t=[],this._changesInElement.set(e,t)),t}_makeSnapshots(e){if(this._elementChildrenSnapshots.has(e))return;const t=Ig(e.getChildren());this._elementChildrenSnapshots.set(e,t);for(const e of t)this._elementsSnapshots.set(e.node,e)}_handleChange(e,t){e.nodesToHandle=e.howMany;for(const n of t){const i=e.offset+e.howMany,r=n.offset+n.howMany;if("insert"==e.type&&("insert"==n.type&&(e.offset<=n.offset?n.offset+=e.howMany:e.offset<r&&(n.howMany+=e.nodesToHandle,e.nodesToHandle=0)),"remove"==n.type&&e.offset<n.offset&&(n.offset+=e.howMany),"attribute"==n.type))if(e.offset<=n.offset)n.offset+=e.howMany;else if(e.offset<r){const r=n.howMany;n.howMany=e.offset-n.offset,t.unshift({type:"attribute",offset:i,howMany:r-n.howMany,count:this._changeCount++})}if("remove"==e.type){if("insert"==n.type)if(i<=n.offset)n.offset-=e.howMany;else if(i<=r)if(e.offset<n.offset){const t=i-n.offset;n.offset=e.offset,n.howMany-=t,e.nodesToHandle-=t}else n.howMany-=e.nodesToHandle,e.nodesToHandle=0;else if(e.offset<=n.offset)e.nodesToHandle-=n.howMany,n.howMany=0;else if(e.offset<r){const t=r-e.offset;n.howMany-=t,e.nodesToHandle-=t}if("remove"==n.type&&(i<=n.offset?n.offset-=e.howMany:e.offset<n.offset&&(e.nodesToHandle+=n.howMany,n.howMany=0)),"attribute"==n.type)if(i<=n.offset)n.offset-=e.howMany;else if(e.offset<n.offset){const t=i-n.offset;n.offset=e.offset,n.howMany-=t}else if(e.offset<r)if(i<=r){const i=n.howMany;n.howMany=e.offset-n.offset;const r=i-n.howMany-e.nodesToHandle;t.unshift({type:"attribute",offset:e.offset,howMany:r,count:this._changeCount++})}else n.howMany-=r-e.offset}if("attribute"==e.type){if("insert"==n.type)if(e.offset<n.offset&&i>n.offset){if(i>r){const e={type:"attribute",offset:r,howMany:i-r,count:this._changeCount++};this._handleChange(e,t),t.push(e)}e.nodesToHandle=n.offset-e.offset,e.howMany=e.nodesToHandle}else e.offset>=n.offset&&e.offset<r&&(i>r?(e.nodesToHandle=i-r,e.offset=r):e.nodesToHandle=0);if("remove"==n.type&&e.offset<n.offset&&i>n.offset){const r={type:"attribute",offset:n.offset,howMany:i-n.offset,count:this._changeCount++};this._handleChange(r,t),t.push(r),e.nodesToHandle=n.offset-e.offset,e.howMany=e.nodesToHandle}"attribute"==n.type&&(e.offset>=n.offset&&i<=r?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=n.offset&&i>=r&&(n.howMany=0))}}e.howMany=e.nodesToHandle,delete e.nodesToHandle}_getInsertDiff(e,t,n,i,r){const s={type:"insert",position:ph._createAt(e,t),name:i.name,attributes:new Map(i.attributes),length:1,changeCount:this._changeCount++,action:n};return"insert"!=n&&r&&(s.before={name:r.name,attributes:new Map(r.attributes)}),s}_getRemoveDiff(e,t,n,i){return{type:"remove",action:n,position:ph._createAt(e,t),name:i.name,attributes:new Map(i.attributes),length:1,changeCount:this._changeCount++}}_getAttributesDiff(e,t,n){const i=[];n=new Map(n);for(const[r,s]of t){const t=n.has(r)?n.get(r):null;t!==s&&i.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:r,attributeOldValue:s,attributeNewValue:t,changeCount:this._changeCount++}),n.delete(r)}for(const[t,r]of n)i.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:t,attributeOldValue:null,attributeNewValue:r,changeCount:this._changeCount++});return i}_isInInsertedElement(e){const t=e.parent;if(!t)return!1;const n=this._changesInElement.get(t),i=e.startOffset;if(n)for(const e of n)if("insert"==e.type&&i>=e.offset&&i<e.offset+e.howMany)return!0;return this._isInInsertedElement(t)}_removeAllNestedChanges(e,t,n){const i=new _h(ph._createAt(e,t),ph._createAt(e,t+n));for(const e of i.getItems({shallow:!0}))e.is("element")&&(this._changesInElement.delete(e),this._removeAllNestedChanges(e,0,e.maxOffset))}}function Pg(e){return{node:e,name:e.is("$text")?"$text":e.name,attributes:new Map(e.getAttributes())}}function Ig(e){const t=[];for(const n of e)if(n.is("$text"))for(let e=0;e<n.data.length;++e)t.push(Pg(n));else t.push(Pg(n));return t}function Og(e,t){const n=[];let i=0,r=0;for(const e of t){if(e.offset>i){for(let t=0;t<e.offset-i;t++)n.push("e");r+=e.offset-i}if("insert"==e.type){for(let t=0;t<e.howMany;t++)n.push("i");i=e.offset+e.howMany}else if("remove"==e.type){for(let t=0;t<e.howMany;t++)n.push("r");i=e.offset,r+=e.howMany}else{if(e.howMany>1500)for(let t=0;t<e.howMany;t++)n.push("a");else n.push(..."a".repeat(e.howMany).split(""));i=e.offset+e.howMany,r+=e.howMany}}if(r<e)for(let t=0;t<e-r-i;t++)n.push("e");return n}function Vg(e){const t="position"in e&&"$graveyard"==e.position.root.rootName,n="range"in e&&"$graveyard"==e.range.root.rootName;return!t&&!n}class Rg{_operations=[];_undoPairs=new Map;_undoneOperations=new Set;_baseVersionToOperationIndex=new Map;_version=0;_gaps=new Map;get version(){return this._version}set version(e){this._operations.length&&e>this._version+1&&this._gaps.set(this._version,e),this._version=e}get lastOperation(){return this._operations[this._operations.length-1]}addOperation(e){if(e.baseVersion!==this.version)throw new Aa("model-document-history-addoperation-incorrect-version",this,{operation:e,historyVersion:this.version});this._operations.push(e),this._version++,this._baseVersionToOperationIndex.set(e.baseVersion,this._operations.length-1)}getOperations(e,t=this.version){if(!this._operations.length)return[];const n=this._operations[0];void 0===e&&(e=n.baseVersion);let i=t-1;for(const[t,n]of this._gaps)e>t&&e<n&&(e=n),i>t&&i<n&&(i=t-1);if(i<n.baseVersion||e>this.lastOperation.baseVersion)return[];let r=this._baseVersionToOperationIndex.get(e);void 0===r&&(r=0);let s=this._baseVersionToOperationIndex.get(i);return void 0===s&&(s=this._operations.length-1),this._operations.slice(r,s+1)}getOperation(e){const t=this._baseVersionToOperationIndex.get(e);if(void 0!==t)return this._operations[t]}setOperationAsUndone(e,t){this._undoPairs.set(t,e),this._undoneOperations.add(e)}isUndoingOperation(e){return this._undoPairs.has(e)}isUndoneOperation(e){return this._undoneOperations.has(e)}getUndoneOperation(e){return this._undoPairs.get(e)}reset(){this._version=0,this._undoPairs=new Map,this._operations=[],this._undoneOperations=new Set,this._gaps=new Map,this._baseVersionToOperationIndex=new Map}}class Ng extends qh{rootName;_document;_isAttached=!0;_isLoaded=!0;constructor(e,t,n="main"){super(t),this._document=e,this.rootName=n}get document(){return this._document}isAttached(){return this._isAttached}toJSON(){return this.rootName}}Ng.prototype.is=function(e,t){return t?t===this.name&&("rootElement"===e||"model:rootElement"===e||"element"===e||"model:element"===e):"rootElement"===e||"model:rootElement"===e||"element"===e||"model:element"===e||"node"===e||"model:node"===e};const Lg="$graveyard";class Mg extends(Na()){model;history;selection;roots;differ;isReadOnly;_postFixers;_hasSelectionChangedFromTheLastChangeBlock;constructor(e){super(),this.model=e,this.history=new Rg,this.selection=new jh(this),this.roots=new oc({idProperty:"rootName"}),this.differ=new Sg(e.markers),this.isReadOnly=!1,this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=!1,this.createRoot("$root",Lg),this.listenTo(e,"applyOperation",((e,t)=>{const n=t[0];n.isDocumentOperation&&this.differ.bufferOperation(n)}),{priority:"high"}),this.listenTo(e,"applyOperation",((e,t)=>{const n=t[0];n.isDocumentOperation&&this.history.addOperation(n)}),{priority:"low"}),this.listenTo(this.selection,"change",(()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0})),this.listenTo(e.markers,"update",((e,t,n,i,r)=>{const s={...t.getData(),range:i};this.differ.bufferMarkerChange(t.name,r,s),null===n&&t.on("change",((e,n)=>{const i=t.getData();this.differ.bufferMarkerChange(t.name,{...i,range:n},i)}))})),this.registerPostFixer((e=>{let t=!1;for(const n of this.roots)n.isAttached()||n.isEmpty||(e.remove(e.createRangeIn(n)),t=!0);for(const n of this.model.markers)n.getRange().root.isAttached()||(e.removeMarker(n),t=!0);return t}))}get version(){return this.history.version}set version(e){this.history.version=e}get graveyard(){return this.getRoot(Lg)}createRoot(e="$root",t="main"){if(this.roots.get(t))throw new Aa("model-document-createroot-name-exists",this,{name:t});const n=new Ng(this,e,t);return this.roots.add(n),n}destroy(){this.selection.destroy(),this.stopListening()}getRoot(e="main"){return this.roots.get(e)}getRootNames(e=!1){return this.getRoots(e).map((e=>e.rootName))}getRoots(e=!1){return this.roots.filter((t=>t!=this.graveyard&&(e||t.isAttached())&&t._isLoaded))}registerPostFixer(e){this._postFixers.add(e)}toJSON(){const e=jc(this);return e.selection="[engine.model.DocumentSelection]",e.model="[engine.model.Model]",e}_handleChangeBlock(e){this._hasDocumentChangedFromTheLastChangeBlock()&&(this._callPostFixers(e),this.selection.refresh(),this.differ.hasDataChanges()?this.fire("change:data",e.batch):this.fire("change",e.batch),this.selection.refresh(),this.differ.reset()),this._hasSelectionChangedFromTheLastChangeBlock=!1}_hasDocumentChangedFromTheLastChangeBlock(){return!this.differ.isEmpty||this._hasSelectionChangedFromTheLastChangeBlock}_getDefaultRoot(){const e=this.getRoots();return e.length?e[0]:this.graveyard}_getDefaultRange(){const e=this._getDefaultRoot(),t=this.model,n=t.schema,i=t.createPositionFromPath(e,[0]);return n.getNearestSelectionRange(i)||t.createRange(i)}_validateSelectionRange(e){return e.start.isValid()&&e.end.isValid()&&Bg(e.start)&&Bg(e.end)}_callPostFixers(e){let t=!1;do{for(const n of this._postFixers)if(this.selection.refresh(),t=n(e),t)break}while(t)}}function Bg(e){const t=e.textNode;if(t){const n=t.data,i=e.offset-t.startOffset;return!bc(n,i)&&!wc(n,i)}return!0}class Fg extends(Na()){_markers=new Map;[Symbol.iterator](){return this._markers.values()}has(e){const t=e instanceof Dg?e.name:e;return this._markers.has(t)}get(e){return this._markers.get(e)||null}_set(e,t,n=!1,i=!1){const r=e instanceof Dg?e.name:e;if(r.includes(","))throw new Aa("markercollection-incorrect-marker-name",this);const s=this._markers.get(r);if(s){const e=s.getData(),o=s.getRange();let a=!1;return o.isEqual(t)||(s._attachLiveRange(Bh.fromRange(t)),a=!0),n!=s.managedUsingOperations&&(s._managedUsingOperations=n,a=!0),"boolean"==typeof i&&i!=s.affectsData&&(s._affectsData=i,a=!0),a&&this.fire(`update:${r}`,s,o,t,e),s}const o=Bh.fromRange(t),a=new Dg(r,o,n,i);return this._markers.set(r,a),this.fire(`update:${r}`,a,null,t,{...a.getData(),range:null}),a}_remove(e){const t=e instanceof Dg?e.name:e,n=this._markers.get(t);return!!n&&(this._markers.delete(t),this.fire(`update:${t}`,n,n.getRange(),null,n.getData()),this._destroyMarker(n),!0)}_refresh(e){const t=e instanceof Dg?e.name:e,n=this._markers.get(t);if(!n)throw new Aa("markercollection-refresh-marker-not-exists",this);const i=n.getRange();this.fire(`update:${t}`,n,i,i,n.getData())}*getMarkersAtPosition(e){for(const t of this)t.getRange().containsPosition(e)&&(yield t)}*getMarkersIntersectingRange(e){for(const t of this)null!==t.getRange().getIntersection(e)&&(yield t)}destroy(){for(const e of this._markers.values())this._destroyMarker(e);this._markers=null,this.stopListening()}*getMarkersGroup(e){for(const t of this._markers.values())t.name.startsWith(e+":")&&(yield t)}_destroyMarker(e){e.stopListening(),e._detachLiveRange()}}class Dg extends(Na(uh)){name;_managedUsingOperations;_affectsData;_liveRange;constructor(e,t,n,i){super(),this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=n,this._affectsData=i}get managedUsingOperations(){if(!this._liveRange)throw new Aa("marker-destroyed",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new Aa("marker-destroyed",this);return this._affectsData}getData(){return{range:this.getRange(),affectsData:this.affectsData,managedUsingOperations:this.managedUsingOperations}}getStart(){if(!this._liveRange)throw new Aa("marker-destroyed",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new Aa("marker-destroyed",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new Aa("marker-destroyed",this);return this._liveRange.toRange()}_attachLiveRange(e){return this._liveRange&&this._detachLiveRange(),e.delegate("change:range").to(this),e.delegate("change:content").to(this),this._liveRange=e,e}_detachLiveRange(){this._liveRange.stopDelegating("change:range",this),this._liveRange.stopDelegating("change:content",this),this._liveRange.detach(),this._liveRange=null}}Dg.prototype.is=function(e){return"marker"===e||"model:marker"===e};class zg extends qm{sourcePosition;howMany;constructor(e,t){super(null),this.sourcePosition=e.clone(),this.howMany=t}get type(){return"detach"}get affectedSelectable(){return null}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e}_validate(){if(this.sourcePosition.root.document)throw new Aa("detach-operation-on-document-node",this)}_execute(){Km(_h._createFromPositionAndShift(this.sourcePosition,this.howMany))}static get className(){return"DetachOperation"}}class $g extends uh{markers=new Map;_children=new Uh;constructor(e){super(),e&&this._insertChild(0,e)}[Symbol.iterator](){return this.getChildren()}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}get nextSibling(){return null}get previousSibling(){return null}get root(){return this}get parent(){return null}get document(){return null}isAttached(){return!1}getAncestors(){return[]}getChild(e){return this._children.getNode(e)}getChildAtOffset(e){return this._children.getNodeAtOffset(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}getPath(){return[]}getNodeByPath(e){let t=this;for(const n of e)t=t.getChildAtOffset(n);return t}offsetToIndex(e){return this._children.offsetToIndex(e)}toJSON(){const e=[];for(const t of this._children)e.push(t.toJSON());return e}static fromJSON(e){const t=[];for(const n of e)n.name?t.push(qh.fromJSON(n)):t.push(zh.fromJSON(n));return new $g(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const n=function(e){return"string"==typeof e?[new zh(e)]:(nl(e)||(e=[e]),Array.from(e).map((e=>"string"==typeof e?new zh(e):e instanceof hh?new zh(e.data,e.getAttributes()):e)))}(t);for(const e of n)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,n)}_removeChildren(e,t=1){const n=this._children._removeNodes(e,t);for(const e of n)e.parent=null;return n}_removeChildrenArray(e){this._children._removeNodesArray(e);for(const t of e)t.parent=null}}$g.prototype.is=function(e){return"documentFragment"===e||"model:documentFragment"===e};class jg{model;batch;constructor(e,t){this.model=e,this.batch=t}createText(e,t){return new zh(e,t)}createElement(e,t){return new qh(e,t)}createDocumentFragment(){return new $g}cloneElement(e,t=!0){return e._clone(t)}insert(e,t,n=0){if(this._assertWriterUsedCorrectly(),e instanceof zh&&""==e.data)return;const i=ph._createAt(t,n);if(e.parent){if(Gg(e.root,i.root))return void this.move(_h._createOn(e),i);if(e.root.document)throw new Aa("model-writer-insert-forbidden-move",this);this.remove(e)}const r=i.root.document?i.root.document.version:null,s=e instanceof $g?e._removeChildren(0,e.childCount):e,o=new tg(i,s,r);if(e instanceof zh&&(o.shouldReceiveAttributes=!0),this.batch.addOperation(o),this.model.applyOperation(o),e instanceof $g)for(const[t,n]of e.markers){const e=ph._createAt(n.root,0),r={range:new _h(n.start._getCombined(e,i),n.end._getCombined(e,i)),usingOperation:!0,affectsData:!0};this.model.markers.has(t)?this.updateMarker(t,r):this.addMarker(t,r)}}insertText(e,t,n,i){t instanceof $g||t instanceof qh||t instanceof ph?this.insert(this.createText(e),t,n):this.insert(this.createText(e,t),n,i)}insertElement(e,t,n,i){t instanceof $g||t instanceof qh||t instanceof ph?this.insert(this.createElement(e),t,n):this.insert(this.createElement(e,t),n,i)}append(e,t){this.insert(e,t,"end")}appendText(e,t,n){t instanceof $g||t instanceof qh?this.insert(this.createText(e),t,"end"):this.insert(this.createText(e,t),n,"end")}appendElement(e,t,n){t instanceof $g||t instanceof qh?this.insert(this.createElement(e),t,"end"):this.insert(this.createElement(e,t),n,"end")}setAttribute(e,t,n){if(this._assertWriterUsedCorrectly(),n instanceof _h){const i=n.getMinimalFlatRanges();for(const n of i)Hg(this,e,t,n)}else Wg(this,e,t,n)}setAttributes(e,t){for(const[n,i]of mc(e))this.setAttribute(n,i,t)}removeAttribute(e,t){if(this._assertWriterUsedCorrectly(),t instanceof _h){const n=t.getMinimalFlatRanges();for(const t of n)Hg(this,e,null,t)}else Wg(this,e,null,t)}clearAttributes(e){this._assertWriterUsedCorrectly();const t=e=>{for(const t of e.getAttributeKeys())this.removeAttribute(t,e)};if(e instanceof _h)for(const n of e.getItems())t(n);else t(e)}move(e,t,n){if(this._assertWriterUsedCorrectly(),!(e instanceof _h))throw new Aa("writer-move-invalid-range",this);if(!e.isFlat)throw new Aa("writer-move-range-not-flat",this);const i=ph._createAt(t,n);if(i.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!Gg(e.root,i.root))throw new Aa("writer-move-different-document",this);const r=e.root.document?e.root.document.version:null,s=new eg(e.start,e.end.offset-e.start.offset,i,r);this.batch.addOperation(s),this.model.applyOperation(s)}remove(e){this._assertWriterUsedCorrectly();const t=(e instanceof _h?e:_h._createOn(e)).getMinimalFlatRanges().reverse();for(const e of t)this._addOperationForAffectedMarkers("move",e),qg(e.start,e.end.offset-e.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();const t=e.nodeBefore,n=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(t instanceof qh))throw new Aa("writer-merge-no-element-before",this);if(!(n instanceof qh))throw new Aa("writer-merge-no-element-after",this);e.root.document?this._merge(e):this._mergeDetached(e)}createPositionFromPath(e,t,n){return this.model.createPositionFromPath(e,t,n)}createPositionAt(e,t){return this.model.createPositionAt(e,t)}createPositionAfter(e){return this.model.createPositionAfter(e)}createPositionBefore(e){return this.model.createPositionBefore(e)}createRange(e,t){return this.model.createRange(e,t)}createRangeIn(e){return this.model.createRangeIn(e)}createRangeOn(e){return this.model.createRangeOn(e)}createSelection(...e){return this.model.createSelection(...e)}_mergeDetached(e){const t=e.nodeBefore,n=e.nodeAfter;this.move(_h._createIn(n),ph._createAt(t,"end")),this.remove(n)}_merge(e){const t=ph._createAt(e.nodeBefore,"end"),n=ph._createAt(e.nodeAfter,0),i=e.root.document.graveyard,r=new ph(i,[0]),s=e.root.document.version,o=new ig(n,e.nodeAfter.maxOffset,t,r,s);this.batch.addOperation(o),this.model.applyOperation(o)}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof qh))throw new Aa("writer-rename-not-element-instance",this);const n=e.root.document?e.root.document.version:null,i=new ag(ph._createBefore(e),e.name,t,n);this.batch.addOperation(i),this.model.applyOperation(i)}split(e,t){this._assertWriterUsedCorrectly();let n,i,r=e.parent;if(!r.parent)throw new Aa("writer-split-element-no-parent",this);if(t||(t=r.parent),!e.parent.getAncestors({includeSelf:!0}).includes(t))throw new Aa("writer-split-invalid-limit-element",this);do{const t=r.root.document?r.root.document.version:null,s=r.maxOffset-e.offset,o=ng.getInsertionPosition(e),a=new ng(e,s,o,null,t);this.batch.addOperation(a),this.model.applyOperation(a),n||i||(n=r,i=e.parent.nextSibling),r=(e=this.createPositionAfter(e.parent)).parent}while(r!==t);return{position:e,range:new _h(ph._createAt(n,"end"),ph._createAt(i,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new Aa("writer-wrap-range-not-flat",this);const n=t instanceof qh?t:new qh(t);if(n.childCount>0)throw new Aa("writer-wrap-element-not-empty",this);if(null!==n.parent)throw new Aa("writer-wrap-element-attached",this);this.insert(n,e.start);const i=new _h(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(i,ph._createAt(n,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),null===e.parent)throw new Aa("writer-unwrap-element-no-parent",this);this.move(_h._createIn(e),this.createPositionAfter(e)),this.remove(e)}addMarker(e,t){if(this._assertWriterUsedCorrectly(),!t||"boolean"!=typeof t.usingOperation)throw new Aa("writer-addmarker-no-usingoperation",this);const n=t.usingOperation,i=t.range,r=void 0!==t.affectsData&&t.affectsData;if(this.model.markers.has(e))throw new Aa("writer-addmarker-marker-exists",this);if(!i)throw new Aa("writer-addmarker-no-range",this);return n?(Ug(this,e,null,i,r),this.model.markers.get(e)):this.model.markers._set(e,i,n,r)}updateMarker(e,t){this._assertWriterUsedCorrectly();const n="string"==typeof e?e:e.name,i=this.model.markers.get(n);if(!i)throw new Aa("writer-updatemarker-marker-not-exists",this);if(!t)return Ea("writer-updatemarker-reconvert-using-editingcontroller",{markerName:n}),void this.model.markers._refresh(i);const r="boolean"==typeof t.usingOperation,s="boolean"==typeof t.affectsData,o=s?t.affectsData:i.affectsData;if(!r&&!t.range&&!s)throw new Aa("writer-updatemarker-wrong-options",this);const a=i.getRange(),l=t.range?t.range:a;r&&t.usingOperation!==i.managedUsingOperations?t.usingOperation?Ug(this,n,null,l,o):(Ug(this,n,a,null,o),this.model.markers._set(n,l,void 0,o)):i.managedUsingOperations?Ug(this,n,a,l,o):this.model.markers._set(n,l,void 0,o)}removeMarker(e){this._assertWriterUsedCorrectly();const t="string"==typeof e?e:e.name;if(!this.model.markers.has(t))throw new Aa("writer-removemarker-no-marker",this);const n=this.model.markers.get(t);n.managedUsingOperations?Ug(this,t,n.getRange(),null,n.affectsData):this.model.markers._remove(t)}addRoot(e,t="$root"){this._assertWriterUsedCorrectly();const n=this.model.document.getRoot(e);if(n&&n.isAttached())throw new Aa("writer-addroot-root-exists",this);const i=this.model.document,r=new cg(e,t,!0,i,i.version);return this.batch.addOperation(r),this.model.applyOperation(r),this.model.document.getRoot(e)}detachRoot(e){this._assertWriterUsedCorrectly();const t="string"==typeof e?this.model.document.getRoot(e):e;if(!t||!t.isAttached())throw new Aa("writer-detachroot-no-root",this);for(const e of this.model.markers)e.getRange().root===t&&this.removeMarker(e);for(const e of t.getAttributeKeys())this.removeAttribute(e,t);this.remove(this.createRangeIn(t));const n=this.model.document,i=new cg(t.rootName,t.name,!1,n,n.version);this.batch.addOperation(i),this.model.applyOperation(i)}setSelection(...e){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(...e)}setSelectionFocus(e,t){this._assertWriterUsedCorrectly(),this.model.document.selection._setFocus(e,t)}setSelectionAttribute(e,t){if(this._assertWriterUsedCorrectly(),"string"==typeof e)this._setSelectionAttribute(e,t);else for(const[t,n]of mc(e))this._setSelectionAttribute(t,n)}removeSelectionAttribute(e){if(this._assertWriterUsedCorrectly(),"string"==typeof e)this._removeSelectionAttribute(e);else for(const t of e)this._removeSelectionAttribute(t)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(e){this.model.document.selection._restoreGravity(e)}_setSelectionAttribute(e,t){const n=this.model.document.selection;if(n.isCollapsed&&n.anchor.parent.isEmpty){const i=jh._getStoreAttributeKey(e);this.setAttribute(i,t,n.anchor.parent)}n._setAttribute(e,t)}_removeSelectionAttribute(e){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const n=jh._getStoreAttributeKey(e);this.removeAttribute(n,t.anchor.parent)}t._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new Aa("writer-incorrect-use",this)}_addOperationForAffectedMarkers(e,t){for(const n of this.model.markers){if(!n.managedUsingOperations)continue;const i=n.getRange();let r=!1;if("move"===e){const e=t;r=e.containsPosition(i.start)||e.start.isEqual(i.start)||e.containsPosition(i.end)||e.end.isEqual(i.end)}else{const e=t,n=e.nodeBefore,s=e.nodeAfter,o=i.start.parent==n&&i.start.isAtEnd,a=i.end.parent==s&&0==i.end.offset,l=i.end.nodeAfter==s,c=i.start.nodeAfter==s;r=o||a||l||c}r&&this.updateMarker(n.name,{range:i})}}}function Hg(e,t,n,i){const r=e.model,s=r.document;let o,a,l,c=i.start;for(const e of i.getWalker({shallow:!0}))l=e.item.getAttribute(t),o&&a!=l&&(a!=n&&d(),c=o),o=e.nextPosition,a=l;function d(){const i=new _h(c,o),l=i.root.document?s.version:null,d=new sg(i,t,a,n,l);e.batch.addOperation(d),r.applyOperation(d)}o instanceof ph&&o!=c&&a!=n&&d()}function Wg(e,t,n,i){const r=e.model,s=r.document,o=i.getAttribute(t);let a,l;if(o!=n){if(i.root===i){const e=i.document?s.version:null;l=new lg(i,t,o,n,e)}else{a=new _h(ph._createBefore(i),e.createPositionAfter(i));const r=a.root.document?s.version:null;l=new sg(a,t,o,n,r)}e.batch.addOperation(l),r.applyOperation(l)}}function Ug(e,t,n,i,r){const s=e.model,o=s.document,a=new rg(t,n,i,s.markers,!!r,o.version);e.batch.addOperation(a),s.applyOperation(a)}function qg(e,t,n,i){let r;if(e.root.document){const n=i.document,s=new ph(n.graveyard,[0]);r=new eg(e,t,s,n.version)}else r=new zg(e,t);n.addOperation(r),i.applyOperation(r)}function Gg(e,t){return e===t||e instanceof Ng&&t instanceof Ng}function Kg(e,t,n={}){if(t.isCollapsed)return;const i=t.getFirstRange();if("$graveyard"==i.root.rootName)return;const r=e.schema;e.change((e=>{if(!n.doNotResetEntireContent&&function(e,t){const n=e.getLimitElement(t);if(!t.containsEntireContent(n))return!1;const i=t.getFirstRange();return i.start.parent!=i.end.parent&&e.checkChild(n,"paragraph")}(r,t))return void function(e,t){const n=e.model.schema.getLimitElement(t);e.remove(e.createRangeIn(n)),Jg(e,e.createPositionAt(n,0),t)}(e,t);const s={};if(!n.doNotAutoparagraph){const e=t.getSelectedElement();e&&Object.assign(s,r.getAttributesWithProperty(e,"copyOnReplace",!0))}const[o,a]=function(e){const t=e.root.document.model,n=e.start;let i=e.end;if(t.hasContent(e,{ignoreMarkers:!0})){const n=function(e){const t=e.parent,n=t.root.document.model.schema,i=t.getAncestors({parentFirst:!0,includeSelf:!0});for(const e of i){if(n.isLimit(e))return null;if(n.isBlock(e))return e}}(i);if(n&&i.isTouching(t.createPositionAt(n,0))){const n=t.createSelection(e);t.modifySelection(n,{direction:"backward"});const r=n.getLastPosition(),s=t.createRange(r,i);t.hasContent(s,{ignoreMarkers:!0})||(i=r)}}return[Cg.fromPosition(n,"toPrevious"),Cg.fromPosition(i,"toNext")]}(i);o.isTouching(a)||e.remove(e.createRange(o,a)),n.leaveUnmerged||(function(e,t,n){const i=e.model;if(!Yg(e.model.schema,t,n))return;const[r,s]=function(e,t){const n=e.getAncestors(),i=t.getAncestors();let r=0;for(;n[r]&&n[r]==i[r];)r++;return[n[r],i[r]]}(t,n);r&&s&&(!i.hasContent(r,{ignoreMarkers:!0})&&i.hasContent(s,{ignoreMarkers:!0})?Qg(e,t,n,r.parent):Zg(e,t,n,r.parent))}(e,o,a),r.removeDisallowedAttributes(o.parent.getChildren(),e)),Xg(e,t,o),!n.doNotAutoparagraph&&function(e,t){const n=e.checkChild(t,"$text"),i=e.checkChild(t,"paragraph");return!n&&i}(r,o)&&Jg(e,o,t,s),o.detach(),a.detach()}))}function Zg(e,t,n,i){const r=t.parent,s=n.parent;if(r!=i&&s!=i){for(t=e.createPositionAfter(r),(n=e.createPositionBefore(s)).isEqual(t)||e.insert(s,t),e.merge(t);n.parent.isEmpty;){const t=n.parent;n=e.createPositionBefore(t),e.remove(t)}Yg(e.model.schema,t,n)&&Zg(e,t,n,i)}}function Qg(e,t,n,i){const r=t.parent,s=n.parent;if(r!=i&&s!=i){for(t=e.createPositionAfter(r),(n=e.createPositionBefore(s)).isEqual(t)||e.insert(r,n);t.parent.isEmpty;){const n=t.parent;t=e.createPositionBefore(n),e.remove(n)}n=e.createPositionBefore(s),function(e,t){const n=t.nodeBefore,i=t.nodeAfter;n.name!=i.name&&e.rename(n,i.name),e.clearAttributes(n),e.setAttributes(Object.fromEntries(i.getAttributes()),n),e.merge(t)}(e,n),Yg(e.model.schema,t,n)&&Qg(e,t,n,i)}}function Yg(e,t,n){const i=t.parent,r=n.parent;return i!=r&&!e.isLimit(i)&&!e.isLimit(r)&&function(e,t,n){const i=new _h(e,t);for(const e of i.getWalker())if(n.isLimit(e.item))return!1;return!0}(t,n,e)}function Jg(e,t,n,i={}){const r=e.createElement("paragraph");e.model.schema.setAllowedAttributes(r,i,e),e.insert(r,t),Xg(e,n,e.createPositionAt(r,0))}function Xg(e,t,n){t instanceof jh?e.setSelection(n):t.setTo(n)}function ep(e,t){const n=[];Array.from(e.getItems({direction:"backward"})).map((e=>t.createRangeOn(e))).filter((t=>(t.start.isAfter(e.start)||t.start.isEqual(e.start))&&(t.end.isBefore(e.end)||t.end.isEqual(e.end)))).forEach((e=>{n.push(e.start.parent),t.remove(e)})),n.forEach((e=>{let n=e;for(;n.parent&&n.isEmpty;){const e=t.createRangeOn(n);n=n.parent,t.remove(e)}}))}class tp{model;writer;position;canMergeWith;schema;_documentFragment;_documentFragmentPosition;_firstNode=null;_lastNode=null;_lastAutoParagraph=null;_filterAttributesOf=[];_affectedStart=null;_affectedEnd=null;_nodeToSelect=null;constructor(e,t,n){this.model=e,this.writer=t,this.position=n,this.canMergeWith=new Set([this.position.parent]),this.schema=e.schema,this._documentFragment=t.createDocumentFragment(),this._documentFragmentPosition=t.createPositionAt(this._documentFragment,0)}handleNodes(e){for(const t of Array.from(e))this._handleNode(t);this._insertPartialFragment(),this._lastAutoParagraph&&this._updateLastNodeFromAutoParagraph(this._lastAutoParagraph),this._mergeOnRight(),this.schema.removeDisallowedAttributes(this._filterAttributesOf,this.writer),this._filterAttributesOf=[]}_updateLastNodeFromAutoParagraph(e){const t=this.writer.createPositionAfter(this._lastNode),n=this.writer.createPositionAfter(e);if(n.isAfter(t)){if(this._lastNode=e,this.position.parent!=e||!this.position.isAtEnd)throw new Aa("insertcontent-invalid-insertion-position",this);this.position=n,this._setAffectedBoundaries(this.position)}}getSelectionRange(){return this._nodeToSelect?_h._createOn(this._nodeToSelect):this.model.schema.getNearestSelectionRange(this.position)}getAffectedRange(){return this._affectedStart?new _h(this._affectedStart,this._affectedEnd):null}destroy(){this._affectedStart&&this._affectedStart.detach(),this._affectedEnd&&this._affectedEnd.detach()}_handleNode(e){this._checkAndSplitToAllowedPosition(e)?(this._appendToFragment(e),this._firstNode||(this._firstNode=e),this._lastNode=e):this.schema.isObject(e)||this._handleDisallowedNode(e)}_insertPartialFragment(){if(this._documentFragment.isEmpty)return;const e=Cg.fromPosition(this.position,"toNext");this._setAffectedBoundaries(this.position),this._documentFragment.getChild(0)==this._firstNode&&(this.writer.insert(this._firstNode,this.position),this._mergeOnLeft(),this.position=e.toPosition()),this._documentFragment.isEmpty||this.writer.insert(this._documentFragment,this.position),this._documentFragmentPosition=this.writer.createPositionAt(this._documentFragment,0),this.position=e.toPosition(),e.detach()}_handleDisallowedNode(e){e.is("element")&&this.handleNodes(e.getChildren())}_appendToFragment(e){if(!this.schema.checkChild(this.position,e))throw new Aa("insertcontent-wrong-position",this,{node:e,position:this.position});this.writer.insert(e,this._documentFragmentPosition),this._documentFragmentPosition=this._documentFragmentPosition.getShiftedBy(e.offsetSize),this.schema.isObject(e)&&!this.schema.checkChild(this.position,"$text")?this._nodeToSelect=e:this._nodeToSelect=null,this._filterAttributesOf.push(e)}_setAffectedBoundaries(e){this._affectedStart||(this._affectedStart=Cg.fromPosition(e,"toPrevious")),this._affectedEnd&&!this._affectedEnd.isBefore(e)||(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=Cg.fromPosition(e,"toNext"))}_mergeOnLeft(){const e=this._firstNode;if(!(e instanceof qh))return;if(!this._canMergeLeft(e))return;const t=Cg._createBefore(e);t.stickiness="toNext";const n=Cg.fromPosition(this.position,"toNext");this._affectedStart.isEqual(t)&&(this._affectedStart.detach(),this._affectedStart=Cg._createAt(t.nodeBefore,"end","toPrevious")),this._firstNode===this._lastNode&&(this._firstNode=t.nodeBefore,this._lastNode=t.nodeBefore),this.writer.merge(t),t.isEqual(this._affectedEnd)&&this._firstNode===this._lastNode&&(this._affectedEnd.detach(),this._affectedEnd=Cg._createAt(t.nodeBefore,"end","toNext")),this.position=n.toPosition(),n.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_mergeOnRight(){const e=this._lastNode;if(!(e instanceof qh))return;if(!this._canMergeRight(e))return;const t=Cg._createAfter(e);if(t.stickiness="toNext",!this.position.isEqual(t))throw new Aa("insertcontent-invalid-insertion-position",this);this.position=ph._createAt(t.nodeBefore,"end");const n=Cg.fromPosition(this.position,"toPrevious");this._affectedEnd.isEqual(t)&&(this._affectedEnd.detach(),this._affectedEnd=Cg._createAt(t.nodeBefore,"end","toNext")),this._firstNode===this._lastNode&&(this._firstNode=t.nodeBefore,this._lastNode=t.nodeBefore),this.writer.merge(t),t.getShiftedBy(-1).isEqual(this._affectedStart)&&this._firstNode===this._lastNode&&(this._affectedStart.detach(),this._affectedStart=Cg._createAt(t.nodeBefore,0,"toPrevious")),this.position=n.toPosition(),n.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_canMergeLeft(e){const t=e.previousSibling;return t instanceof qh&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(t,e)}_canMergeRight(e){const t=e.nextSibling;return t instanceof qh&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(e,t)}_insertAutoParagraph(){this._insertPartialFragment();const e=this.writer.createElement("paragraph");this.writer.insert(e,this.position),this._setAffectedBoundaries(this.position),this._lastAutoParagraph=e,this.position=this.writer.createPositionAt(e,0)}_checkAndSplitToAllowedPosition(e){const t=this._getAllowedIn(this.position.parent,e);if(!t)return!1;for(t!=this.position.parent&&this._insertPartialFragment();t!=this.position.parent;)if(this.position.isAtStart){const e=this.position.parent;this.position=this.writer.createPositionBefore(e),e.isEmpty&&e.parent===t&&this.writer.remove(e)}else if(this.position.isAtEnd)this.position=this.writer.createPositionAfter(this.position.parent);else{const e=this.writer.createPositionAfter(this.position.parent);this._setAffectedBoundaries(this.position),this.writer.split(this.position),this.position=e,this.canMergeWith.add(this.position.nodeAfter)}return this.schema.checkChild(this.position.parent,e)||this._insertAutoParagraph(),!0}_getAllowedIn(e,t){return this.schema.checkChild(e,t)||this.schema.checkChild(e,"paragraph")&&this.schema.checkChild("paragraph",t)?e:this.schema.isLimit(e)?null:this._getAllowedIn(e.parent,t)}}function np(e,t){const{isForward:n,walker:i,unit:r,schema:s,treatEmojiAsSingleUnit:o}=e,{type:a,item:l,nextPosition:c}=t;if("text"==a)return"word"===e.unit?function(e,t){let n=e.position.textNode;for(n||(n=t?e.position.nodeAfter:e.position.nodeBefore);n&&n.is("$text");){const i=e.position.offset-n.startOffset;if(sp(n,i,t))n=t?e.position.nodeAfter:e.position.nodeBefore;else{if(rp(n.data,i,t))break;e.next()}}return e.position}(i,n):function(e,t,n){const i=e.position.textNode;if(i){const r=i.data;let s=e.position.offset-i.startOffset;for(;bc(r,s)||"character"==t&&wc(r,s)||n&&yc(r,s);)e.next(),s=e.position.offset-i.startOffset}return e.position}(i,r,o);if(a==(n?"elementStart":"elementEnd")){if(s.isSelectable(l))return ph._createAt(l,n?"after":"before");if(s.checkChild(c,"$text"))return c}else{if(s.isLimit(l))return void i.skip((()=>!0));if(s.checkChild(c,"$text"))return c}}function ip(e,t){const n=e.root,i=ph._createAt(n,t?"end":0);return t?new _h(e,i):new _h(i,e)}function rp(e,t,n){const i=t+(n?0:-1);return' ,.?!:;"-()'.includes(e.charAt(i))}function sp(e,t,n){return t===(n?e.offsetSize:0)}class op extends(Ga()){markers;document;schema;_pendingChanges;_currentWriter;constructor(){var e;super(),this.markers=new Fg,this.document=new Mg(this),this.schema=new Cm,this._pendingChanges=[],this._currentWriter=null,["deleteContent","modifySelection","getSelectedContent","applyOperation"].forEach((e=>this.decorate(e))),this.on("applyOperation",((e,t)=>{t[0]._validate()}),{priority:"highest"}),this.schema.register("$root",{isLimit:!0}),this.schema.register("$container",{allowIn:["$root","$container"]}),this.schema.register("$block",{allowIn:["$root","$container"],isBlock:!0}),this.schema.register("$blockObject",{allowWhere:"$block",isBlock:!0,isObject:!0}),this.schema.register("$inlineObject",{allowWhere:"$text",allowAttributesOf:"$text",isInline:!0,isObject:!0}),this.schema.register("$text",{allowIn:"$block",isInline:!0,isContent:!0}),this.schema.register("$clipboardHolder",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$documentFragment",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$marker"),this.schema.addChildCheck((()=>!0),"$marker"),(e=this).document.registerPostFixer((t=>function(e,t){const n=t.document.selection,i=t.schema,r=[];let s=!1;for(const e of n.getRanges()){const t=bm(e,i);t&&!t.isEqual(e)?(r.push(t),s=!0):r.push(e)}return s&&e.setSelection(function(e){const t=[...e],n=new Set;let i=1;for(;i<t.length;){const e=t[i],r=t.slice(0,i);for(const[s,o]of r.entries())if(!n.has(s))if(e.isEqual(o))n.add(s);else if(e.isIntersecting(o)){n.add(s),n.add(i);const r=e.getJoined(o);t.push(r)}i++}return t.filter(((e,t)=>!n.has(t)))}(r),{backward:n.isBackward}),!1}(t,e))),this.document.registerPostFixer(am),this.on("insertContent",((e,[t,n])=>{e.return=function(e,t,n){return e.change((i=>{const r=n||e.document.selection;r.isCollapsed||e.deleteContent(r,{doNotAutoparagraph:!0});const s=new tp(e,i,r.anchor),o=[];let a;if(t.is("documentFragment")){if(t.markers.size){const e=[];for(const[n,i]of t.markers){const{start:t,end:r}=i,s=t.isEqual(r);e.push({position:t,name:n,isCollapsed:s},{position:r,name:n,isCollapsed:s})}e.sort((({position:e},{position:t})=>e.isBefore(t)?1:-1));for(const{position:n,name:r,isCollapsed:s}of e){let e=null,a=null;const l=n.parent===t&&n.isAtStart,c=n.parent===t&&n.isAtEnd;l||c?s&&(a=l?"start":"end"):(e=i.createElement("$marker"),i.insert(e,n)),o.push({name:r,element:e,collapsed:a})}}a=t.getChildren()}else a=[t];s.handleNodes(a);let l=s.getSelectionRange();if(t.is("documentFragment")&&o.length){const e=l?Bh.fromRange(l):null,t={};for(let e=o.length-1;e>=0;e--){const{name:n,element:r,collapsed:a}=o[e],l=!t[n];if(l&&(t[n]=[]),r){const e=i.createPositionAt(r,"before");t[n].push(e),i.remove(r)}else{const e=s.getAffectedRange();if(!e){a&&t[n].push(s.position);continue}a?t[n].push(e[a]):t[n].push(l?e.start:e.end)}}for(const[e,[n,r]]of Object.entries(t))n&&r&&n.root===r.root&&n.root.document&&!i.model.markers.has(e)&&i.addMarker(e,{usingOperation:!0,affectsData:!0,range:new _h(n,r)});e&&(l=e.toRange(),e.detach())}l&&(r instanceof jh?i.setSelection(l):r.setTo(l));const c=s.getAffectedRange()||e.createRange(r.anchor);return s.destroy(),c}))}(this,t,n)})),this.on("insertObject",((e,[t,n,i])=>{e.return=function(e,t,n,i={}){if(!e.schema.isObject(t))throw new Aa("insertobject-element-not-an-object",e,{object:t});const r=n||e.document.selection;let s=r;i.findOptimalPosition&&e.schema.isBlock(t)&&(s=e.createSelection(e.schema.findOptimalInsertionRange(r,i.findOptimalPosition)));const o=ac(r.getSelectedBlocks()),a={};return o&&Object.assign(a,e.schema.getAttributesWithProperty(o,"copyOnReplace",!0)),e.change((n=>{s.isCollapsed||e.deleteContent(s,{doNotAutoparagraph:!0});let r=t;const o=s.anchor.parent;!e.schema.checkChild(o,t)&&e.schema.checkChild(o,"paragraph")&&e.schema.checkChild("paragraph",t)&&(r=n.createElement("paragraph"),n.insert(t,r)),e.schema.setAllowedAttributes(r,a,n);const l=e.insertContent(r,s);return l.isCollapsed||i.setSelection&&function(e,t,n,i){const r=e.model;if("on"==n)return void e.setSelection(t,"on");if("after"!=n)throw new Aa("insertobject-invalid-place-parameter-value",r);let s=t.nextSibling;r.schema.isInline(t)?e.setSelection(t,"after"):(!(s&&r.schema.checkChild(s,"$text"))&&r.schema.checkChild(t.parent,"paragraph")&&(s=e.createElement("paragraph"),r.schema.setAllowedAttributes(s,i,e),r.insertContent(s,e.createPositionAfter(t))),s&&e.setSelection(s,0))}(n,t,i.setSelection,a),l}))}(this,t,n,i)})),this.on("canEditAt",(e=>{const t=!this.document.isReadOnly;e.return=t,t||e.stop()}))}change(e){try{return 0===this._pendingChanges.length?(this._pendingChanges.push({batch:new Tg,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(e){Aa.rethrowUnexpectedError(e,this)}}enqueueChange(e,t){try{e?"function"==typeof e?(t=e,e=new Tg):e instanceof Tg||(e=new Tg(e)):e=new Tg,this._pendingChanges.push({batch:e,callback:t}),1==this._pendingChanges.length&&this._runPendingChanges()}catch(e){Aa.rethrowUnexpectedError(e,this)}}applyOperation(e){e._execute()}insertContent(e,t,n,...i){const r=ap(t,n);return this.fire("insertContent",[e,r,n,...i])}insertObject(e,t,n,i,...r){const s=ap(t,n);return this.fire("insertObject",[e,s,i,i,...r])}deleteContent(e,t){Kg(this,e,t)}modifySelection(e,t){!function(e,t,n={}){const i=e.schema,r="backward"!=n.direction,s=n.unit?n.unit:"character",o=!!n.treatEmojiAsSingleUnit,a=t.focus,l=new mh({boundaries:ip(a,r),singleCharacters:!0,direction:r?"forward":"backward"}),c={walker:l,schema:i,isForward:r,unit:s,treatEmojiAsSingleUnit:o};let d;for(;d=l.next();){if(d.done)return;const n=np(c,d.value);if(n)return void(t instanceof jh?e.change((e=>{e.setSelectionFocus(n)})):t.setFocus(n))}}(this,e,t)}getSelectedContent(e){return function(e,t){return e.change((e=>{const n=e.createDocumentFragment(),i=t.getFirstRange();if(!i||i.isCollapsed)return n;const r=i.start.root,s=i.start.getCommonPath(i.end),o=r.getNodeByPath(s);let a;a=i.start.parent==i.end.parent?i:e.createRange(e.createPositionAt(o,i.start.path[s.length]),e.createPositionAt(o,i.end.path[s.length]+1));const l=a.end.offset-a.start.offset;for(const t of a.getItems({shallow:!0}))t.is("$textProxy")?e.appendText(t.data,t.getAttributes(),n):e.append(e.cloneElement(t,!0),n);if(a!=i){const t=i._getTransformedByMove(a.start,e.createPositionAt(n,0),l)[0],r=e.createRange(e.createPositionAt(n,0),t.start);ep(e.createRange(t.end,e.createPositionAt(n,"end")),e),ep(r,e)}return n}))}(this,e)}hasContent(e,t={}){const n=e instanceof _h?e:_h._createIn(e);if(n.isCollapsed)return!1;const{ignoreWhitespaces:i=!1,ignoreMarkers:r=!1}=t;if(!r)for(const e of this.markers.getMarkersIntersectingRange(n))if(e.affectsData)return!0;for(const e of n.getItems())if(this.schema.isContent(e)){if(!e.is("$textProxy"))return!0;if(!i)return!0;if(-1!==e.data.search(/\S/))return!0}return!1}canEditAt(e){const t=ap(e);return this.fire("canEditAt",[t])}createPositionFromPath(e,t,n){return new ph(e,t,n)}createPositionAt(e,t){return ph._createAt(e,t)}createPositionAfter(e){return ph._createAfter(e)}createPositionBefore(e){return ph._createBefore(e)}createRange(e,t){return new _h(e,t)}createRangeIn(e){return _h._createIn(e)}createRangeOn(e){return _h._createOn(e)}createSelection(...e){return new Ih(...e)}createBatch(e){return new Tg(e)}createOperationFromJSON(e){return ug.fromJSON(e,this.document)}destroy(){this.document.destroy(),this.stopListening()}_runPendingChanges(){const e=[];this.fire("_beforeChanges");try{for(;this._pendingChanges.length;){const t=this._pendingChanges[0].batch;this._currentWriter=new jg(this,t);const n=this._pendingChanges[0].callback(this._currentWriter);e.push(n),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}}finally{this._pendingChanges.length=0,this._currentWriter=null,this.fire("_afterChanges")}return e}}function ap(e,t){if(e)return e instanceof Ih||e instanceof jh?e:e instanceof Ph?t||0===t?new Ih(e,t):e.is("rootElement")?new Ih(e,"in"):new Ih(e,"on"):new Ih(e)}class lp extends Yu{domEventType="click";onDomEvent(e){this.fire(e.type,e)}}class cp extends Yu{domEventType=["mousedown","mouseup","mouseover","mouseout"];onDomEvent(e){this.fire(e.type,e)}}class dp extends Yu{domEventType=["touchstart","touchend","touchmove"];onDomEvent(e){this.fire(e.type,e)}}class up{document;constructor(e){this.document=e}createDocumentFragment(e){return new fu(this.document,e)}createElement(e,t,n){return new zd(this.document,e,t,n)}createText(e){return new Od(this.document,e)}clone(e,t=!1){return e._clone(t)}appendChild(e,t){return t._appendChild(e)}insertChild(e,t,n){return n._insertChild(e,t)}removeChildren(e,t,n){return n._removeChildren(e,t)}remove(e){const t=e.parent;return t?this.removeChildren(t.getChildIndex(e),1,t):[]}replace(e,t){const n=e.parent;if(n){const i=n.getChildIndex(e);return this.removeChildren(i,1,n),this.insertChild(i,t,n),!0}return!1}unwrapElement(e){const t=e.parent;if(t){const n=t.getChildIndex(e);this.remove(e),this.insertChild(n,e.getChildren(),t)}}rename(e,t){const n=new zd(this.document,e,t.getAttributes(),t.getChildren());return this.replace(t,n)?n:null}setAttribute(e,t,n){n._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,n){Sr(e)&&void 0===n?t._setStyle(e):n._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,n){n._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}createPositionAt(e,t){return Kd._createAt(e,t)}createPositionAfter(e){return Kd._createAfter(e)}createPositionBefore(e){return Kd._createBefore(e)}createRange(e,t){return new Zd(e,t)}createRangeOn(e){return Zd._createOn(e)}createRangeIn(e){return Zd._createIn(e)}createSelection(...e){return new Yd(...e)}}const hp=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,mp=/^rgb\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}[0-9]{1,3}[ %]?\)$/i,gp=/^rgba\([ ]?([0-9]{1,3}[ %]?,[ ]?){3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,pp=/^hsl\([ ]?([0-9]{1,3}[ %]?[,]?[ ]*){3}(1|[0-9]+%|[0]?\.?[0-9]+)?\)$/i,fp=/^hsla\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,bp=/\w+\((?:[^()]|\([^()]*\))*\)|\S+/gi,wp=new Set(["black","silver","gray","white","maroon","red","purple","fuchsia","green","lime","olive","yellow","navy","blue","teal","aqua","orange","aliceblue","antiquewhite","aquamarine","azure","beige","bisque","blanchedalmond","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","gainsboro","ghostwhite","gold","goldenrod","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","limegreen","linen","magenta","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","oldlace","olivedrab","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellowgreen","activeborder","activecaption","appworkspace","background","buttonface","buttonhighlight","buttonshadow","buttontext","captiontext","graytext","highlight","highlighttext","inactiveborder","inactivecaption","inactivecaptiontext","infobackground","infotext","menu","menutext","scrollbar","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","window","windowframe","windowtext","rebeccapurple","currentcolor","transparent"]);function vp(e){return e.startsWith("#")?hp.test(e):e.startsWith("rgb")?mp.test(e)||gp.test(e):e.startsWith("hsl")?pp.test(e)||fp.test(e):wp.has(e.toLowerCase())}const yp=["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset"];function _p(e){return yp.includes(e)}const kp=/^([+-]?[0-9]*([.][0-9]+)?(px|cm|mm|in|pc|pt|ch|em|ex|rem|vh|vw|vmin|vmax)|0)$/;function xp(e){return kp.test(e)}const Cp=/^[+-]?[0-9]*([.][0-9]+)?%$/;function Ap(e){return Cp.test(e)}const Ep=["repeat-x","repeat-y","repeat","space","round","no-repeat"];const Tp=["center","top","bottom","left","right"];function Sp(e){return Tp.includes(e)}const Pp=["fixed","scroll","local"];function Ip(e){return Pp.includes(e)}const Op=/^url\(/;function Vp(e){return Op.test(e)}function Rp(e=""){if(""===e)return{top:void 0,right:void 0,bottom:void 0,left:void 0};const t=Bp(e),n=t[0],i=t[2]||n,r=t[1]||n;return{top:n,bottom:i,right:r,left:t[3]||r}}function Np(e){return t=>{const{top:n,right:i,bottom:r,left:s}=t,o=[];return[n,i,s,r].every((e=>!!e))?o.push([e,Lp(t)]):(n&&o.push([e+"-top",n]),i&&o.push([e+"-right",i]),r&&o.push([e+"-bottom",r]),s&&o.push([e+"-left",s])),o}}function Lp({top:e,right:t,bottom:n,left:i}){const r=[];return i!==t?r.push(e,t,n,i):n!==e?r.push(e,t,n):t!==e?r.push(e,t):r.push(e),r.join(" ")}function Mp(e){return t=>({path:e,value:Rp(t)})}function Bp(e){const t=e.trim().slice(0,1500).matchAll(bp);return Array.from(t).map((e=>e[0]))}function Fp(e){e.setNormalizer("background",(e=>{const t={},n=Bp(e);for(const e of n)i=e,Ep.includes(i)?(t.repeat=t.repeat||[],t.repeat.push(e)):Sp(e)?(t.position=t.position||[],t.position.push(e)):Ip(e)?t.attachment=e:vp(e)?t.color=e:Vp(e)&&(t.image=e);var i;return{path:"background",value:t}})),e.setNormalizer("background-color",(e=>({path:"background.color",value:e}))),e.setReducer("background",(e=>{const t=[];return t.push(["background-color",e.color]),t})),e.setStyleRelation("background",["background-color"])}function Dp(e){e.setNormalizer("border",(e=>{const{color:t,style:n,width:i}=qp(e);return{path:"border",value:{color:Rp(t),style:Rp(n),width:Rp(i)}}})),e.setNormalizer("border-top",zp("top")),e.setNormalizer("border-right",zp("right")),e.setNormalizer("border-bottom",zp("bottom")),e.setNormalizer("border-left",zp("left")),e.setNormalizer("border-color",$p("color")),e.setNormalizer("border-width",$p("width")),e.setNormalizer("border-style",$p("style")),e.setNormalizer("border-top-color",Hp("color","top")),e.setNormalizer("border-top-style",Hp("style","top")),e.setNormalizer("border-top-width",Hp("width","top")),e.setNormalizer("border-right-color",Hp("color","right")),e.setNormalizer("border-right-style",Hp("style","right")),e.setNormalizer("border-right-width",Hp("width","right")),e.setNormalizer("border-bottom-color",Hp("color","bottom")),e.setNormalizer("border-bottom-style",Hp("style","bottom")),e.setNormalizer("border-bottom-width",Hp("width","bottom")),e.setNormalizer("border-left-color",Hp("color","left")),e.setNormalizer("border-left-style",Hp("style","left")),e.setNormalizer("border-left-width",Hp("width","left")),e.setExtractor("border-top",Wp("top")),e.setExtractor("border-right",Wp("right")),e.setExtractor("border-bottom",Wp("bottom")),e.setExtractor("border-left",Wp("left")),e.setExtractor("border-top-color","border.color.top"),e.setExtractor("border-right-color","border.color.right"),e.setExtractor("border-bottom-color","border.color.bottom"),e.setExtractor("border-left-color","border.color.left"),e.setExtractor("border-top-width","border.width.top"),e.setExtractor("border-right-width","border.width.right"),e.setExtractor("border-bottom-width","border.width.bottom"),e.setExtractor("border-left-width","border.width.left"),e.setExtractor("border-top-style","border.style.top"),e.setExtractor("border-right-style","border.style.right"),e.setExtractor("border-bottom-style","border.style.bottom"),e.setExtractor("border-left-style","border.style.left"),e.setReducer("border-color",Np("border-color")),e.setReducer("border-style",Np("border-style")),e.setReducer("border-width",Np("border-width")),e.setReducer("border-top",Gp("top")),e.setReducer("border-right",Gp("right")),e.setReducer("border-bottom",Gp("bottom")),e.setReducer("border-left",Gp("left")),e.setReducer("border",function(){return t=>{const n=Up(t,"top"),i=Up(t,"right"),r=Up(t,"bottom"),s=Up(t,"left"),o=[n,i,r,s],a={width:e(o,"width"),style:e(o,"style"),color:e(o,"color")},l=Kp(a,"all");if(l.length)return l;const c=Object.entries(a).reduce(((e,[t,n])=>(n&&(e.push([`border-${t}`,n]),o.forEach((e=>delete e[t]))),e)),[]);return[...c,...Kp(n,"top"),...Kp(i,"right"),...Kp(r,"bottom"),...Kp(s,"left")]};function e(e,t){return e.map((e=>e[t])).reduce(((e,t)=>e==t?e:null))}}()),e.setStyleRelation("border",["border-color","border-style","border-width","border-top","border-right","border-bottom","border-left","border-top-color","border-right-color","border-bottom-color","border-left-color","border-top-style","border-right-style","border-bottom-style","border-left-style","border-top-width","border-right-width","border-bottom-width","border-left-width"]),e.setStyleRelation("border-color",["border-top-color","border-right-color","border-bottom-color","border-left-color"]),e.setStyleRelation("border-style",["border-top-style","border-right-style","border-bottom-style","border-left-style"]),e.setStyleRelation("border-width",["border-top-width","border-right-width","border-bottom-width","border-left-width"]),e.setStyleRelation("border-top",["border-top-color","border-top-style","border-top-width"]),e.setStyleRelation("border-right",["border-right-color","border-right-style","border-right-width"]),e.setStyleRelation("border-bottom",["border-bottom-color","border-bottom-style","border-bottom-width"]),e.setStyleRelation("border-left",["border-left-color","border-left-style","border-left-width"])}function zp(e){return t=>{const{color:n,style:i,width:r}=qp(t),s={};return void 0!==n&&(s.color={[e]:n}),void 0!==i&&(s.style={[e]:i}),void 0!==r&&(s.width={[e]:r}),{path:"border",value:s}}}function $p(e){return t=>({path:"border",value:jp(t,e)})}function jp(e,t){return{[t]:Rp(e)}}function Hp(e,t){return n=>({path:"border",value:{[e]:{[t]:n}}})}function Wp(e){return(t,n)=>{if(n.border)return Up(n.border,e)}}function Up(e,t){const n={};return e.width&&e.width[t]&&(n.width=e.width[t]),e.style&&e.style[t]&&(n.style=e.style[t]),e.color&&e.color[t]&&(n.color=e.color[t]),n}function qp(e){const t={},n=Bp(e);for(const e of n)xp(e)||/thin|medium|thick/.test(e)?t.width=e:_p(e)?t.style=e:t.color=e;return t}function Gp(e){return t=>Kp(t,e)}function Kp(e,t){const n=[];if(e&&e.width&&n.push("width"),e&&e.style&&n.push("style"),e&&e.color&&n.push("color"),3==n.length){const i=n.map((t=>e[t])).join(" ");return["all"==t?["border",i]:[`border-${t}`,i]]}return"all"==t?[]:n.map((n=>[`border-${t}-${n}`,e[n]]))}function Zp(e){e.setNormalizer("margin",Mp("margin")),e.setNormalizer("margin-top",(e=>({path:"margin.top",value:e}))),e.setNormalizer("margin-right",(e=>({path:"margin.right",value:e}))),e.setNormalizer("margin-bottom",(e=>({path:"margin.bottom",value:e}))),e.setNormalizer("margin-left",(e=>({path:"margin.left",value:e}))),e.setReducer("margin",Np("margin")),e.setStyleRelation("margin",["margin-top","margin-right","margin-bottom","margin-left"])}function Qp(e){e.setNormalizer("padding",Mp("padding")),e.setNormalizer("padding-top",(e=>({path:"padding.top",value:e}))),e.setNormalizer("padding-right",(e=>({path:"padding.right",value:e}))),e.setNormalizer("padding-bottom",(e=>({path:"padding.bottom",value:e}))),e.setNormalizer("padding-left",(e=>({path:"padding.left",value:e}))),e.setReducer("padding",Np("padding")),e.setStyleRelation("padding",["padding-top","padding-right","padding-bottom","padding-left"])}const Yp=function(e,t,n){var i=!0,r=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return or(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),id(e,t,{leading:i,maxWait:t,trailing:r})};class Jp{crashes=[];state="initializing";_crashNumberLimit;_now=Date.now;_minimumNonErrorTimePeriod;_boundErrorHandler;_listeners;constructor(e){if(this.crashes=[],this._crashNumberLimit="number"==typeof e.crashNumberLimit?e.crashNumberLimit:3,this._minimumNonErrorTimePeriod="number"==typeof e.minimumNonErrorTimePeriod?e.minimumNonErrorTimePeriod:5e3,this._boundErrorHandler=e=>{const t="error"in e?e.error:e.reason;t instanceof Error&&this._handleError(t,e)},this._listeners={},!this._restart)throw new Error("The Watchdog class was split into the abstract `Watchdog` class and the `EditorWatchdog` class. Please, use `EditorWatchdog` if you have used the `Watchdog` class previously.")}destroy(){this._stopErrorHandling(),this._listeners={}}on(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)}off(e,t){this._listeners[e]=this._listeners[e].filter((e=>e!==t))}_fire(e,...t){const n=this._listeners[e]||[];for(const e of n)e.apply(this,[null,...t])}_startErrorHandling(){window.addEventListener("error",this._boundErrorHandler),window.addEventListener("unhandledrejection",this._boundErrorHandler)}_stopErrorHandling(){window.removeEventListener("error",this._boundErrorHandler),window.removeEventListener("unhandledrejection",this._boundErrorHandler)}_handleError(e,t){if(this._shouldReactToError(e)){this.crashes.push({message:e.message,stack:e.stack,filename:t instanceof ErrorEvent?t.filename:void 0,lineno:t instanceof ErrorEvent?t.lineno:void 0,colno:t instanceof ErrorEvent?t.colno:void 0,date:this._now()});const n=this._shouldRestart();this.state="crashed",this._fire("stateChange"),this._fire("error",{error:e,causesRestart:n}),n?this._restart():(this.state="crashedPermanently",this._fire("stateChange"))}}_shouldReactToError(e){return e.is&&e.is("CKEditorError")&&void 0!==e.context&&null!==e.context&&"ready"===this.state&&this._isErrorComingFromThisItem(e)}_shouldRestart(){return this.crashes.length<=this._crashNumberLimit||(this.crashes[this.crashes.length-1].date-this.crashes[this.crashes.length-1-this._crashNumberLimit].date)/this._crashNumberLimit>this._minimumNonErrorTimePeriod}}function Xp(e,t=new Set){const n=[e],i=new Set;let r=0;for(;n.length>r;){const e=n[r++];if(!i.has(e)&&ef(e)&&!t.has(e))if(i.add(e),Symbol.iterator in e)try{for(const t of e)n.push(t)}catch(e){}else for(const t in e)"defaultValue"!==t&&n.push(e[t])}return i}function ef(e){const t=Object.prototype.toString.call(e),n=typeof e;return!("number"===n||"boolean"===n||"string"===n||"symbol"===n||"function"===n||"[object Date]"===t||"[object RegExp]"===t||"[object Module]"===t||null==e||e._watchdogExcluded||e instanceof EventTarget||e instanceof Event)}function tf(e,t,n=new Set){if(e===t&&"object"==typeof(i=e)&&null!==i)return!0;var i;const r=Xp(e,n),s=Xp(t,n);for(const e of r)if(s.has(e))return!0;return!1}class nf extends Jp{_editor=null;_lifecyclePromise=null;_throttledSave;_data;_lastDocumentVersion;_elementOrData;_initUsingData=!0;_editables={};_config;_excludedProps;constructor(e,t={}){super(t),this._throttledSave=Yp(this._save.bind(this),"number"==typeof t.saveInterval?t.saveInterval:5e3),e&&(this._creator=(t,n)=>e.create(t,n)),this._destructor=e=>e.destroy()}get editor(){return this._editor}get _item(){return this._editor}setCreator(e){this._creator=e}setDestructor(e){this._destructor=e}_restart(){return Promise.resolve().then((()=>(this.state="initializing",this._fire("stateChange"),this._destroy()))).catch((e=>{console.error("An error happened during the editor destroying.",e)})).then((()=>{const e={},t=[],n=this._config.rootsAttributes||{},i={};for(const[r,s]of Object.entries(this._data.roots))s.isLoaded?(e[r]="",i[r]=n[r]||{}):t.push(r);const r={...this._config,extraPlugins:this._config.extraPlugins||[],lazyRoots:t,rootsAttributes:i,_watchdogInitialData:this._data};return delete r.initialData,r.extraPlugins.push(rf),this._initUsingData?this.create(e,r,r.context):zo(this._elementOrData)?this.create(this._elementOrData,r,r.context):this.create(this._editables,r,r.context)})).then((()=>{this._fire("restart")}))}create(e=this._elementOrData,t=this._config,n){return this._lifecyclePromise=Promise.resolve(this._lifecyclePromise).then((()=>(super._startErrorHandling(),this._elementOrData=e,this._initUsingData="string"==typeof e||Object.keys(e).length>0&&"string"==typeof Object.values(e)[0],this._config=this._cloneEditorConfiguration(t)||{},this._config.context=n,this._creator(e,this._config)))).then((e=>{this._editor=e,e.model.document.on("change:data",this._throttledSave),this._lastDocumentVersion=e.model.document.version,this._data=this._getData(),this._initUsingData||(this._editables=this._getEditables()),this.state="ready",this._fire("stateChange")})).finally((()=>{this._lifecyclePromise=null})),this._lifecyclePromise}destroy(){return this._lifecyclePromise=Promise.resolve(this._lifecyclePromise).then((()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy()))).finally((()=>{this._lifecyclePromise=null})),this._lifecyclePromise}_destroy(){return Promise.resolve().then((()=>{this._stopErrorHandling(),this._throttledSave.cancel();const e=this._editor;return this._editor=null,e.model.document.off("change:data",this._throttledSave),this._destructor(e)}))}_save(){const e=this._editor.model.document.version;try{this._data=this._getData(),this._initUsingData||(this._editables=this._getEditables()),this._lastDocumentVersion=e}catch(e){console.error(e,"An error happened during restoring editor data. Editor will be restored from the previously saved data.")}}_setExcludedProperties(e){this._excludedProps=e}_getData(){const e=this._editor,t=e.model.document.roots.filter((e=>e.isAttached()&&"$graveyard"!=e.rootName)),{plugins:n}=e,i=n.has("CommentsRepository")&&n.get("CommentsRepository"),r=n.has("TrackChanges")&&n.get("TrackChanges"),s={roots:{},markers:{},commentThreads:JSON.stringify([]),suggestions:JSON.stringify([])};t.forEach((e=>{s.roots[e.rootName]={content:JSON.stringify(Array.from(e.getChildren())),attributes:JSON.stringify(Array.from(e.getAttributes())),isLoaded:e._isLoaded}}));for(const t of e.model.markers)t._affectsData&&(s.markers[t.name]={rangeJSON:t.getRange().toJSON(),usingOperation:t._managedUsingOperations,affectsData:t._affectsData});return i&&(s.commentThreads=JSON.stringify(i.getCommentThreads({toJSON:!0,skipNotAttached:!0}))),r&&(s.suggestions=JSON.stringify(r.getSuggestions({toJSON:!0,skipNotAttached:!0}))),s}_getEditables(){const e={};for(const t of this.editor.model.document.getRootNames()){const n=this.editor.ui.getEditableElement(t);n&&(e[t]=n)}return e}_isErrorComingFromThisItem(e){return tf(this._editor,e.context,this._excludedProps)}_cloneEditorConfiguration(e){return Do(e,((e,t)=>zo(e)||"context"===t?e:void 0))}}class rf{editor;_data;constructor(e){this.editor=e,this._data=e.config.get("_watchdogInitialData")}init(){this.editor.data.on("init",(e=>{e.stop(),this.editor.model.enqueueChange({isUndoable:!1},(e=>{this._restoreCollaborationData(),this._restoreEditorData(e)})),this.editor.data.fire("ready")}),{priority:999})}_createNode(e,t){if("name"in t){const n=e.createElement(t.name,t.attributes);if(t.children)for(const i of t.children)n._appendChild(this._createNode(e,i));return n}return e.createText(t.data,t.attributes)}_restoreEditorData(e){const t=this.editor;Object.entries(this._data.roots).forEach((([n,{content:i,attributes:r}])=>{const s=JSON.parse(i),o=JSON.parse(r),a=t.model.document.getRoot(n);for(const[t,n]of o)e.setAttribute(t,n,a);for(const t of s){const n=this._createNode(e,t);e.insert(n,a,"end")}})),Object.entries(this._data.markers).forEach((([n,i])=>{const{document:r}=t.model,{rangeJSON:{start:s,end:o},...a}=i,l=r.getRoot(s.root),c=e.createPositionFromPath(l,s.path,s.stickiness),d=e.createPositionFromPath(l,o.path,o.stickiness),u=e.createRange(c,d);e.addMarker(n,{range:u,...a})}))}_restoreCollaborationData(){const e=JSON.parse(this._data.commentThreads),t=JSON.parse(this._data.suggestions);e.forEach((e=>{const t=this.editor.config.get("collaboration.channelId"),n=this.editor.plugins.get("CommentsRepository");n.hasCommentThread(e.threadId)&&n.getCommentThread(e.threadId).remove(),n.addCommentThread({channelId:t,...e})})),t.forEach((e=>{const t=this.editor.plugins.get("TrackChangesEditing");t.hasSuggestion(e.id)?t.getSuggestion(e.id).attributes=e.attributes:t.addSuggestionData(e)}))}}const sf=Symbol("MainQueueId");class of extends Jp{_watchdogs=new Map;_watchdogConfig;_context=null;_contextProps=new Set;_actionQueues=new af;_contextConfig;_item;constructor(e,t={}){super(t),this._watchdogConfig=t,this._creator=t=>e.create(t),this._destructor=e=>e.destroy(),this._actionQueues.onEmpty((()=>{"initializing"===this.state&&(this.state="ready",this._fire("stateChange"))}))}setCreator(e){this._creator=e}setDestructor(e){this._destructor=e}get context(){return this._context}create(e={}){return this._actionQueues.enqueue(sf,(()=>(this._contextConfig=e,this._create())))}getItem(e){return this._getWatchdog(e)._item}getItemState(e){return this._getWatchdog(e).state}add(e){const t=lf(e);return Promise.all(t.map((e=>this._actionQueues.enqueue(e.id,(()=>{if("destroyed"===this.state)throw new Error("Cannot add items to destroyed watchdog.");if(!this._context)throw new Error("Context was not created yet. You should call the `ContextWatchdog#create()` method first.");let t;if(this._watchdogs.has(e.id))throw new Error(`Item with the given id is already added: '${e.id}'.`);if("editor"===e.type)return t=new nf(null,this._watchdogConfig),t.setCreator(e.creator),t._setExcludedProperties(this._contextProps),e.destructor&&t.setDestructor(e.destructor),this._watchdogs.set(e.id,t),t.on("error",((n,{error:i,causesRestart:r})=>{this._fire("itemError",{itemId:e.id,error:i}),r&&this._actionQueues.enqueue(e.id,(()=>new Promise((n=>{const i=()=>{t.off("restart",i),this._fire("itemRestart",{itemId:e.id}),n()};t.on("restart",i)}))))})),t.create(e.sourceElementOrData,e.config,this._context);throw new Error(`Not supported item type: '${e.type}'.`)})))))}remove(e){const t=lf(e);return Promise.all(t.map((e=>this._actionQueues.enqueue(e,(()=>{const t=this._getWatchdog(e);return this._watchdogs.delete(e),t.destroy()})))))}destroy(){return this._actionQueues.enqueue(sf,(()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy())))}_restart(){return this._actionQueues.enqueue(sf,(()=>(this.state="initializing",this._fire("stateChange"),this._destroy().catch((e=>{console.error("An error happened during destroying the context or items.",e)})).then((()=>this._create())).then((()=>this._fire("restart"))))))}_create(){return Promise.resolve().then((()=>(this._startErrorHandling(),this._creator(this._contextConfig)))).then((e=>(this._context=e,this._contextProps=Xp(this._context),Promise.all(Array.from(this._watchdogs.values()).map((e=>(e._setExcludedProperties(this._contextProps),e.create(void 0,void 0,this._context))))))))}_destroy(){return Promise.resolve().then((()=>{this._stopErrorHandling();const e=this._context;return this._context=null,this._contextProps=new Set,Promise.all(Array.from(this._watchdogs.values()).map((e=>e.destroy()))).then((()=>this._destructor(e)))}))}_getWatchdog(e){const t=this._watchdogs.get(e);if(!t)throw new Error(`Item with the given id was not registered: ${e}.`);return t}_isErrorComingFromThisItem(e){for(const t of this._watchdogs.values())if(t._isErrorComingFromThisItem(e))return!1;return tf(this._context,e.context)}}class af{_onEmptyCallbacks=[];_queues=new Map;_activeActions=0;onEmpty(e){this._onEmptyCallbacks.push(e)}enqueue(e,t){const n=e===sf;this._activeActions++,this._queues.get(e)||this._queues.set(e,Promise.resolve());const i=(n?Promise.all(this._queues.values()):Promise.all([this._queues.get(sf),this._queues.get(e)])).then(t),r=i.catch((()=>{}));return this._queues.set(e,r),i.finally((()=>{this._activeActions--,this._queues.get(e)===r&&0===this._activeActions&&this._onEmptyCallbacks.forEach((e=>e()))}))}}function lf(e){return Array.isArray(e)?e:[e]}class cf extends(Ga()){editor;_disableStack=new Set;constructor(e){super(),this.editor=e,this.set("isEnabled",!0)}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",df,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",df),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}static get isOfficialPlugin(){return!1}static get isPremiumPlugin(){return!1}}function df(e){e.return=!1,e.stop()}class uf extends(Ga()){editor;_isEnabledBasedOnSelection;_affectsData;_disableStack;constructor(e){super(),this.editor=e,this.set("value",void 0),this.set("isEnabled",!1),this._affectsData=!0,this._isEnabledBasedOnSelection=!0,this._disableStack=new Set,this.decorate("execute"),this.listenTo(this.editor.model.document,"change",(()=>{this.refresh()})),this.listenTo(e,"change:isReadOnly",(()=>{this.refresh()})),this.on("set:isEnabled",(t=>{if(!this.affectsData)return;const n=e.model.document.selection,i=!("$graveyard"==n.getFirstPosition().root.rootName)&&e.model.canEditAt(n);(e.isReadOnly||this._isEnabledBasedOnSelection&&!i)&&(t.return=!1,t.stop())}),{priority:"highest"}),this.on("execute",(e=>{this.isEnabled||e.stop()}),{priority:"high"})}get affectsData(){return this._affectsData}set affectsData(e){this._affectsData=e}refresh(){this.isEnabled=!0}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",hf,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",hf),this.refresh())}execute(...e){}destroy(){this.stopListening()}}function hf(e){e.return=!1,e.stop()}class mf extends uf{_childCommandsDefinitions=[];refresh(){}execute(...e){const t=this._getFirstEnabledCommand();return!!t&&t.execute(e)}registerChildCommand(e,t={}){Ca(this._childCommandsDefinitions,{command:e,priority:t.priority||"normal"}),e.on("change:isEnabled",(()=>this._checkEnabled())),this._checkEnabled()}_checkEnabled(){this.isEnabled=!!this._getFirstEnabledCommand()}_getFirstEnabledCommand(){const e=this._childCommandsDefinitions.find((({command:e})=>e.isEnabled));return e&&e.command}}class gf extends(Na()){_context;_plugins=new Map;_availablePlugins;_contextPlugins;constructor(e,t=[],n=[]){super(),this._context=e,this._availablePlugins=new Map;for(const e of t)e.pluginName&&this._availablePlugins.set(e.pluginName,e);this._contextPlugins=new Map;for(const[e,t]of n)this._contextPlugins.set(e,t),this._contextPlugins.set(t,e),e.pluginName&&this._availablePlugins.set(e.pluginName,e)}*[Symbol.iterator](){for(const e of this._plugins)"function"==typeof e[0]&&(yield e)}get(e){const t=this._plugins.get(e);if(!t){let t=e;throw"function"==typeof e&&(t=e.pluginName||e.name),new Aa("plugincollection-plugin-not-loaded",this._context,{plugin:t})}return t}has(e){return this._plugins.has(e)}init(e,t=[],n=[]){const i=this,r=this._context;!function e(t,n=new Set){t.forEach((t=>{a(t)&&(n.has(t)||(n.add(t),t.pluginName&&!i._availablePlugins.has(t.pluginName)&&i._availablePlugins.set(t.pluginName,t),t.requires&&e(t.requires,n)))}))}(e),u(e);const s=[...function e(t,n=new Set){return t.map((e=>a(e)?e:i._availablePlugins.get(e))).reduce(((t,i)=>n.has(i)?t:(n.add(i),i.requires&&(u(i.requires,i),e(i.requires,n).forEach((e=>t.add(e)))),t.add(i))),new Set)}(e.filter((e=>!c(e,t))))];!function(e,t){for(const n of t){if("function"!=typeof n)throw new Aa("plugincollection-replace-plugin-invalid-type",null,{pluginItem:n});const t=n.pluginName;if(!t)throw new Aa("plugincollection-replace-plugin-missing-name",null,{pluginItem:n});if(n.requires&&n.requires.length)throw new Aa("plugincollection-plugin-for-replacing-cannot-have-dependencies",null,{pluginName:t});const r=i._availablePlugins.get(t);if(!r)throw new Aa("plugincollection-plugin-for-replacing-not-exist",null,{pluginName:t});const s=e.indexOf(r);if(-1===s){if(i._contextPlugins.has(r))return;throw new Aa("plugincollection-plugin-for-replacing-not-loaded",null,{pluginName:t})}if(r.requires&&r.requires.length)throw new Aa("plugincollection-replaced-plugin-cannot-have-dependencies",null,{pluginName:t});e.splice(s,1,n),i._availablePlugins.set(t,n)}}(s,n);const o=function(e){return e.map((e=>{let t=i._contextPlugins.get(e);return t=t||new e(r),i._add(e,t),t}))}(s);return h(o,"init").then((()=>h(o,"afterInit"))).then((()=>o));function a(e){return"function"==typeof e}function l(e){return a(e)&&!!e.isContextPlugin}function c(e,t){return t.some((t=>t===e||d(e)===t||d(t)===e))}function d(e){return a(e)?e.pluginName||e.name:e}function u(e,n=null){e.map((e=>a(e)?e:i._availablePlugins.get(e)||e)).forEach((e=>{!function(e,t){if(!a(e)){if(t)throw new Aa("plugincollection-soft-required",r,{missingPlugin:e,requiredBy:d(t)});throw new Aa("plugincollection-plugin-not-found",r,{plugin:e})}}(e,n),function(e,t){if(l(t)&&!l(e))throw new Aa("plugincollection-context-required",r,{plugin:d(e),requiredBy:d(t)})}(e,n),function(e,n){if(n&&c(e,t))throw new Aa("plugincollection-required",r,{plugin:d(e),requiredBy:d(n)})}(e,n)}))}function h(e,t){return e.reduce(((e,n)=>n[t]?i._contextPlugins.has(n)?e:e.then(n[t].bind(n)):e),Promise.resolve())}}destroy(){const e=[];for(const[,t]of this)"function"!=typeof t.destroy||this._contextPlugins.has(t)||e.push(t.destroy());return Promise.all(e)}_add(e,t){this._plugins.set(e,t);const n=e.pluginName;if(n){if(this._plugins.has(n))throw new Aa("plugincollection-plugin-name-conflict",null,{pluginName:n,plugin1:this._plugins.get(n).constructor,plugin2:e});this._plugins.set(n,t)}}}class pf{config;plugins;locale;t;editors;static defaultConfig;static builtinPlugins;_contextOwner=null;constructor(e){const{translations:t,...n}=e||{};this.config=new rl(n,this.constructor.defaultConfig);const i=this.constructor.builtinPlugins;this.config.define("plugins",i),this.plugins=new gf(this,i);const r=this.config.get("language")||{};this.locale=new sc({uiLanguage:"string"==typeof r?r:r.ui,contentLanguage:this.config.get("language.content"),translations:t}),this.t=this.locale.t,this.editors=new oc}initPlugins(){const e=this.config.get("plugins")||[],t=this.config.get("substitutePlugins")||[];for(const n of e.concat(t)){if("function"!=typeof n)throw new Aa("context-initplugins-constructor-only",null,{Plugin:n});if(!0!==n.isContextPlugin)throw new Aa("context-initplugins-invalid-plugin",null,{Plugin:n})}return this.plugins.init(e,[],t)}destroy(){return Promise.all(Array.from(this.editors,(e=>e.destroy()))).then((()=>this.plugins.destroy()))}_addEditor(e,t){if(this._contextOwner)throw new Aa("context-addeditor-private-context");this.editors.add(e),t&&(this._contextOwner=e)}_removeEditor(e){return this.editors.has(e)&&this.editors.remove(e),this._contextOwner===e?this.destroy():Promise.resolve()}_getEditorConfig(){const e={};for(const t of this.config.names())["plugins","removePlugins","extraPlugins"].includes(t)||(e[t]=this.config.get(t));return e}static create(e){return new Promise((t=>{const n=new this(e);t(n.initPlugins().then((()=>n)))}))}}class ff extends(Ga()){context;constructor(e){super(),this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return!0}static get isOfficialPlugin(){return!1}static get isPremiumPlugin(){return!1}}class bf{_commands;constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const n=this.get(e);if(!n)throw new Aa("commandcollection-command-not-found",this,{commandName:e});return n.execute(...t)}*names(){yield*this._commands.keys()}*commands(){yield*this._commands.values()}[Symbol.iterator](){return this._commands[Symbol.iterator]()}destroy(){for(const e of this.commands())e.destroy()}}class wf extends hc{editor;constructor(e){super(),this.editor=e}set(e,t,n={}){if("string"==typeof t){const e=t;t=(t,n)=>{this.editor.execute(e),n()}}super.set(e,t,n)}}const vf="contentEditing",yf="common";class _f{keystrokeInfos=new Map;_editor;constructor(e){this._editor=e;const t=e.config.get("menuBar.isVisible"),n=e.locale.t;this.addKeystrokeInfoCategory({id:vf,label:n("Content editing keystrokes"),description:n("These keyboard shortcuts allow for quick access to content editing features.")});const i=[{label:n("Close contextual balloons, dropdowns, and dialogs"),keystroke:"Esc"},{label:n("Open the accessibility help dialog"),keystroke:"Alt+0"},{label:n("Move focus between form fields (inputs, buttons, etc.)"),keystroke:[["Tab"],["Shift+Tab"]]},{label:n("Move focus to the toolbar, navigate between toolbars"),keystroke:"Alt+F10",mayRequireFn:!0},{label:n("Navigate through the toolbar or menu bar"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]},{label:n("Execute the currently focused button. Executing buttons that interact with the editor content moves the focus back to the content."),keystroke:[["Enter"],["Space"]]}];t&&i.push({label:n("Move focus to the menu bar, navigate between menu bars"),keystroke:"Alt+F9",mayRequireFn:!0}),this.addKeystrokeInfoCategory({id:"navigation",label:n("User interface and content navigation keystrokes"),description:n("Use the following keystrokes for more efficient navigation in the CKEditor 5 user interface."),groups:[{id:"common",keystrokes:i}]})}addKeystrokeInfoCategory({id:e,label:t,description:n,groups:i}){this.keystrokeInfos.set(e,{id:e,label:t,description:n,groups:new Map}),this.addKeystrokeInfoGroup({categoryId:e,id:yf}),i&&i.forEach((t=>{this.addKeystrokeInfoGroup({categoryId:e,...t})}))}addKeystrokeInfoGroup({categoryId:e=vf,id:t,label:n,keystrokes:i}){const r=this.keystrokeInfos.get(e);if(!r)throw new Aa("accessibility-unknown-keystroke-info-category",this._editor,{groupId:t,categoryId:e});r.groups.set(t,{id:t,label:n,keystrokes:i||[]})}addKeystrokeInfos({categoryId:e=vf,groupId:t=yf,keystrokes:n}){if(!this.keystrokeInfos.has(e))throw new Aa("accessibility-unknown-keystroke-info-category",this._editor,{categoryId:e,keystrokes:n});const i=this.keystrokeInfos.get(e);if(!i.groups.has(t))throw new Aa("accessibility-unknown-keystroke-info-group",this._editor,{groupId:t,categoryId:e,keystrokes:n});i.groups.get(t).keystrokes.push(...n)}}function kf(e){return Object.getPrototypeOf(e).constructor.editorName}function xf(e){if(!e)return;const t=Array.isArray(e)?{items:e}:e,n=function e(t){return t.flatMap((t=>"string"==typeof t?[t]:e(t.items)))}(t.items||[]);return{isMultiline:n.includes("-"),shouldNotGroupWhenFull:!!t.shouldNotGroupWhenFull,items:(i=n,i.filter((e=>"|"!==e&&"-"!==e)))};var i}function Cf(){let e="unknown",t="unknown";return aa.isMac?e="mac":aa.isWindows?e="windows":aa.isiOS?e="ios":aa.isAndroid&&(e="android"),aa.isGecko?t="gecko":aa.isBlink?t="blink":aa.isSafari&&(t="safari"),{os:e,browser:t}}class Af extends(Ga()){static get editorName(){return"Editor"}accessibility;commands;config;conversion;data;editing;locale;model;plugins;keystrokes;t;static defaultConfig;static builtinPlugins;_context;_readOnlyLocks;constructor(e={}){if(super(),"sanitizeHtml"in e)throw new Aa("editor-config-sanitizehtml-not-supported");const t=this.constructor,{translations:n,...i}=t.defaultConfig||{},{translations:r=n,...s}=e,o=e.language||i.language;this._context=e.context||new pf({language:o,translations:r}),this._context._addEditor(this,!e.context);const a=Array.from(t.builtinPlugins||[]);this.config=new rl(s,i),this.config.define("plugins",a),this.config.define(this._context._getEditorConfig()),function(e){let t=e.get("licenseKey");if(!t&&window.CKEDITOR_GLOBAL_LICENSE_KEY&&(t=window.CKEDITOR_GLOBAL_LICENSE_KEY,e.set("licenseKey",t)),!t)throw new Aa("license-key-missing")}(this.config),this.plugins=new gf(this,a,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this._readOnlyLocks=new Set,this.commands=new bf,this.set("state","initializing"),this.once("ready",(()=>this.state="ready"),{priority:"high"}),this.once("destroy",(()=>this.state="destroyed"),{priority:"high"}),this.model=new op,this.on("change:isReadOnly",(()=>{this.model.document.isReadOnly=this.isReadOnly}));const l=new Bd;this.data=new jm(this.model,l),this.editing=new ym(this.model,l),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new Hm([this.editing.downcastDispatcher,this.data.downcastDispatcher],this.data.upcastDispatcher),this.conversion.addAlias("dataDowncast",this.data.downcastDispatcher),this.conversion.addAlias("editingDowncast",this.editing.downcastDispatcher),this.keystrokes=new wf(this),this.keystrokes.listenTo(this.editing.view.document),this.accessibility=new _f(this),function(e){const t=e.config.get("licenseKey"),n=window[Symbol.for("cke distribution")]||"sh";function i(t){e.enableReadOnlyMode(Symbol("invalidLicense")),e._showLicenseError(t)}if("GPL"==t)return void("cloud"==n&&i("distributionChannel"));const r=function(e){const t=e.split(".");return 3!=t.length?null:t[1]}(t);if(!r)return void i("invalid");const s=fc(r);if(!s)return void i("invalid");if(!function(e){return["exp","jti","vc"].every((t=>t in e))}(s))return void i("invalid");if(s.distributionChannel&&!rc(s.distributionChannel).includes(n))return void i("distributionChannel");if(function(e){const t=Array.isArray(e)?e:[e],n=function(){const e=[];for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)1&n?n=3988292384^n>>>1:n>>>=1;e[t]=n}return e}();let i=-1;const r=t.map((e=>Array.isArray(e)?e.join(""):String(e))).join("");for(let e=0;e<r.length;e++)i=i>>>8^n[255&(i^r.charCodeAt(e))];return i=~i>>>0,i.toString(16).padStart(8,"0")}(function(e){return Object.getOwnPropertyNames(e).sort().filter((t=>"vc"!=t&&null!=e[t])).map((t=>e[t]))}(s))!=s.vc.toLowerCase())return void i("invalid");if(new Date(1e3*s.exp)<Pa)return void i("expired");const o=s.licensedHosts;if(o&&o.length>0&&!function(e){const{hostname:t}=new URL(window.location.href);if(e.includes(t))return!0;const n=t.split(".");return e.filter((e=>e.includes("*"))).map((e=>e.split("."))).filter((e=>e.length<=n.length)).map((e=>Array(n.length-e.length).fill("*"===e[0]?"*":"").concat(e))).some((e=>n.every(((t,n)=>e[n]===t||"*"===e[n]))))}(o))i("domainLimit");else if(["evaluation","trial"].includes(s.licenseType)&&1e3*s.exp<Date.now())i("expired");else{if(["development","evaluation","trial"].includes(s.licenseType)){const{licenseType:e}=s,t=e[0].toUpperCase()+e.slice(1);console.info(`%cCKEditor 5 ${t} License`,"color: #ffffff; background: #743CCD; font-size: 14px; padding: 4px 8px; border-radius: 4px;"),console.warn(`⚠️ You are using a ${e} license of CKEditor 5`+("trial"===e?" which is for evaluation purposes only":"")+". For production usage, please obtain a production license at https://portal.ckeditor.com/")}if(["evaluation","trial"].includes(s.licenseType)){const t=s.licenseType,n=setTimeout((()=>{i(`${t}Limit`)}),6e5);e.on("destroy",(()=>{clearTimeout(n)}))}s.usageEndpoint&&e.once("ready",(()=>{const n={requestId:ka(),requestTime:Math.round(Date.now()/1e3),license:t,editor:Ef(e)};e._sendUsageRequest(s.usageEndpoint,n).then((e=>{const{status:t,message:n}=e;n&&console.warn(n),"ok"!=t&&i("usageLimit")}),(()=>{var e,t;e="license-key-validation-endpoint-not-reachable",t={url:s.usageEndpoint},console.error(...Sa(e,t))}))}),{priority:"high"})}}(this)}get isReadOnly(){return this._readOnlyLocks.size>0}set isReadOnly(e){throw new Aa("editor-isreadonly-has-no-setter")}enableReadOnlyMode(e){if("string"!=typeof e&&"symbol"!=typeof e)throw new Aa("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)||(this._readOnlyLocks.add(e),1===this._readOnlyLocks.size&&this.fire("change:isReadOnly","isReadOnly",!0,!1))}disableReadOnlyMode(e){if("string"!=typeof e&&"symbol"!=typeof e)throw new Aa("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)&&(this._readOnlyLocks.delete(e),0===this._readOnlyLocks.size&&this.fire("change:isReadOnly","isReadOnly",!1,!0))}setData(e){this.data.set(e)}getData(e){return this.data.get(e)}initPlugins(){const e=this.config,t=e.get("plugins"),n=e.get("removePlugins")||[],i=e.get("extraPlugins")||[],r=e.get("substitutePlugins")||[];return this.plugins.init(t.concat(i),n,r)}destroy(){let e=Promise.resolve();return"initializing"==this.state&&(e=new Promise((e=>this.once("ready",e)))),e.then((()=>{this.fire("destroy"),this.stopListening(),this.commands.destroy()})).then((()=>this.plugins.destroy())).then((()=>{this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy()})).then((()=>this._context._removeEditor(this)))}execute(e,...t){try{return this.commands.execute(e,...t)}catch(e){Aa.rethrowUnexpectedError(e,this)}}focus(){this.editing.view.focus()}static create(...e){throw new Error("This is an abstract method.")}static Context=pf;static EditorWatchdog=nf;static ContextWatchdog=of;_showLicenseError(e,t){setTimeout((()=>{if("invalid"==e)throw new Aa("invalid-license-key");if("expired"==e)throw new Aa("license-key-expired");if("domainLimit"==e)throw new Aa("license-key-domain-limit");if("featureNotAllowed"==e)throw new Aa("license-key-plugin-not-allowed",null,{pluginName:t});if("evaluationLimit"==e)throw new Aa("license-key-evaluation-limit");if("trialLimit"==e)throw new Aa("license-key-trial-limit");if("developmentLimit"==e)throw new Aa("license-key-development-limit");if("usageLimit"==e)throw new Aa("license-key-usage-limit");if("distributionChannel"==e)throw new Aa("license-key-invalid-distribution-channel")}),0),this._showLicenseError=()=>{}}async _sendUsageRequest(e,t){const n=new Headers({"Content-Type":"application/json"}),i=await fetch(new URL(e),{method:"POST",headers:n,body:JSON.stringify(t)});if(!i.ok)throw new Error(`HTTP Response: ${i.status}`);return i.json()}}function Ef(e){const t=function(e){return{sessionId:(localStorage.getItem("__ckeditor-session-id")||localStorage.setItem("__ckeditor-session-id",ka()),localStorage.getItem("__ckeditor-session-id")),pageSessionId:(ra.window.CKEDITOR_PAGE_SESSION_ID=ra.window.CKEDITOR_PAGE_SESSION_ID||ka(),ra.window.CKEDITOR_PAGE_SESSION_ID),hostname:window.location.hostname,version:globalThis.CKEDITOR_VERSION,type:kf(e),plugins:(t=e.plugins,Array.from(t).filter((([e])=>!!e.pluginName)).map((([e])=>{const{pluginName:t,isContextPlugin:n,isOfficialPlugin:i,isPremiumPlugin:r}=e;return{isContext:!!n,isOfficial:!!i,isPremium:!!r,name:t}}))),distribution:{channel:window[Symbol.for("cke distribution")]||"sh"},env:Cf(),integration:Object.create(null),menuBar:{isVisible:!!e.config.get("menuBar.isVisible")},language:{ui:e.locale.uiLanguage,content:e.locale.contentLanguage},toolbar:{main:xf(e.config.get("toolbar")),block:xf(e.config.get("blockToolbar")),balloon:xf(e.config.get("balloonToolbar"))}};var t}(e);return e.fire("collectUsageData",{setUsageData:function(e,n){if(void 0!==zc(t,e))throw new Aa("editor-usage-data-path-already-set",{path:e});$c(t,e,n)}}),t}function Tf(e){return class extends e{sourceElement;updateSourceElement(e){if(!this.sourceElement)throw new Aa("editor-missing-sourceelement",this);const t=this.config.get("updateSourceElementOnDestroy"),n=this.sourceElement instanceof HTMLTextAreaElement;if(!t&&!n)return void Al(this.sourceElement,"");const i="string"==typeof e?e:this.data.get();Al(this.sourceElement,i)}}}Tf.updateSourceElement=Tf(Object).prototype.updateSourceElement;class Sf extends ff{_actions;static get pluginName(){return"PendingActions"}static get isOfficialPlugin(){return!0}init(){this.set("hasAny",!1),this._actions=new oc({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(e){if("string"!=typeof e)throw new Aa("pendingactions-add-invalid-message",this);const t=new(Ga());return t.set("message",e),this._actions.add(t),this.hasAny=!0,t}remove(e){this._actions.remove(e),this.hasAny=!!this._actions.length}get first(){return this._actions.get(0)}[Symbol.iterator](){return this._actions[Symbol.iterator]()}}const Pf={bold:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.187 17H5.773c-.637 0-1.092-.138-1.364-.415-.273-.277-.409-.718-.409-1.323V4.738c0-.617.14-1.062.419-1.332.279-.27.73-.406 1.354-.406h4.68c.69 0 1.288.041 1.793.124.506.083.96.242 1.36.478.341.197.644.447.906.75a3.262 3.262 0 0 1 .808 2.162c0 1.401-.722 2.426-2.167 3.075C15.05 10.175 16 11.315 16 13.01a3.756 3.756 0 0 1-2.296 3.504 6.1 6.1 0 0 1-1.517.377c-.571.073-1.238.11-2 .11zm-.217-6.217H7v4.087h3.069c1.977 0 2.965-.69 2.965-2.072 0-.707-.256-1.22-.768-1.537-.512-.319-1.277-.478-2.296-.478zM7 5.13v3.619h2.606c.729 0 1.292-.067 1.69-.2a1.6 1.6 0 0 0 .91-.765c.165-.267.247-.566.247-.897 0-.707-.26-1.176-.778-1.409-.519-.232-1.31-.348-2.375-.348H7z"/></svg>',cancel:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.591 10.177 4.243 4.242a1 1 0 0 1-1.415 1.415l-4.242-4.243-4.243 4.243a1 1 0 0 1-1.414-1.415l4.243-4.242L4.52 5.934A1 1 0 0 1 5.934 4.52l4.243 4.243 4.242-4.243a1 1 0 1 1 1.415 1.414l-4.243 4.243z"/></svg>',caption:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 16h9a1 1 0 0 1 0 2H2a1 1 0 0 1 0-2z"/><path d="M17 1a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14zm0 1.5H3a.5.5 0 0 0-.492.41L2.5 3v9a.5.5 0 0 0 .41.492L3 12.5h14a.5.5 0 0 0 .492-.41L17.5 12V3a.5.5 0 0 0-.41-.492L17 2.5z" fill-opacity=".6"/></svg>',check:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.972 16.615a.997.997 0 0 1-.744-.292l-4.596-4.596a1 1 0 1 1 1.414-1.414l3.926 3.926 9.937-9.937a1 1 0 0 1 1.414 1.415L7.717 16.323a.997.997 0 0 1-.745.292z"/></svg>',cog:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.333 2 .19 2.263a5.899 5.899 0 0 1 1.458.604L14.714 3.4 16.6 5.286l-1.467 1.733c.263.452.468.942.605 1.46L18 8.666v2.666l-2.263.19a5.899 5.899 0 0 1-.604 1.458l1.467 1.733-1.886 1.886-1.733-1.467a5.899 5.899 0 0 1-1.46.605L11.334 18H8.667l-.19-2.263a5.899 5.899 0 0 1-1.458-.604L5.286 16.6 3.4 14.714l1.467-1.733a5.899 5.899 0 0 1-.604-1.458L2 11.333V8.667l2.262-.189a5.899 5.899 0 0 1 .605-1.459L3.4 5.286 5.286 3.4l1.733 1.467a5.899 5.899 0 0 1 1.46-.605L8.666 2h2.666zM10 6.267a3.733 3.733 0 1 0 0 7.466 3.733 3.733 0 0 0 0-7.466z"/></svg>',colorPalette:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.209 18.717A8.5 8.5 0 1 1 18.686 9.6h-.008l.002.12a3 3 0 0 1-2.866 2.997h-.268l-.046-.002v.002h-4.791a2 2 0 1 0 0 4 1 1 0 1 1-.128 1.992 8.665 8.665 0 0 1-.372.008Zm-3.918-7.01a1.25 1.25 0 1 0-2.415-.648 1.25 1.25 0 0 0 2.415.647ZM5.723 8.18a1.25 1.25 0 1 0 .647-2.414 1.25 1.25 0 0 0-.647 2.414ZM9.76 6.155a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415Zm4.028 1.759a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415Z"/></svg>',eraser:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m8.636 9.531-2.758 3.94a.5.5 0 0 0 .122.696l3.224 2.284h1.314l2.636-3.736L8.636 9.53zm.288 8.451L5.14 15.396a2 2 0 0 1-.491-2.786l6.673-9.53a2 2 0 0 1 2.785-.49l3.742 2.62a2 2 0 0 1 .491 2.785l-7.269 10.053-2.147-.066z"/><path d="M4 18h5.523v-1H4zm-2 0h1v-1H2z"/></svg>',history:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11 1a9 9 0 1 1-8.027 13.075l1.128-1.129A7.502 7.502 0 0 0 18.5 10a7.5 7.5 0 1 0-14.962.759l-.745-.746-.76.76A9 9 0 0 1 11 1z"/><path d="M.475 8.17a.75.75 0 0 1 .978.047l.075.082 1.284 1.643 1.681-1.284a.75.75 0 0 1 .978.057l.073.083a.75.75 0 0 1-.057.978l-.083.073-2.27 1.737a.75.75 0 0 1-.973-.052l-.074-.082-1.741-2.23a.75.75 0 0 1 .13-1.052z"/><path d="M11.5 5v4.999l3.196 3.196-1.06 1.06L10.1 10.72l-.1-.113V5z"/></svg>',image:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.66 9.118a.693.693 0 0 1 .956.032l3.65 3.411 2.422-2.238a.695.695 0 0 1 .945 0L17.5 13.6V2.5h-15v11.1l4.16-4.482ZM17.8 1c.652 0 1.2.47 1.2 1.1v14.362c0 .64-.532 1.038-1.184 1.038H2.184C1.532 17.5 1 17.103 1 16.462V2.1C1 1.47 1.537 1 2.2 1h15.6Zm-5.655 6a2.128 2.128 0 0 1 .157-2.364A2.133 2.133 0 1 1 12.145 7Z"/></svg>',imageUpload:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.201 1C.538 1 0 1.47 0 2.1v14.363c0 .64.534 1.037 1.186 1.037h9.494a2.97 2.97 0 0 1-.414-.287 2.998 2.998 0 0 1-1.055-2.03 3.003 3.003 0 0 1 .693-2.185l.383-.455-.02.018-3.65-3.41a.695.695 0 0 0-.957-.034L1.5 13.6V2.5h15v5.535a2.97 2.97 0 0 1 1.412.932l.088.105V2.1c0-.63-.547-1.1-1.2-1.1H1.202Zm11.713 2.803a2.146 2.146 0 0 0-2.049 1.992 2.14 2.14 0 0 0 1.28 2.096 2.13 2.13 0 0 0 2.644-3.11 2.134 2.134 0 0 0-1.875-.978Z"/><path d="M15.522 19.1a.79.79 0 0 0 .79-.79v-5.373l2.059 2.455a.79.79 0 1 0 1.211-1.015l-3.352-3.995a.79.79 0 0 0-.995-.179.784.784 0 0 0-.299.221l-3.35 3.99a.79.79 0 1 0 1.21 1.017l1.936-2.306v5.185c0 .436.353.79.79.79Z"/><path d="M15.522 19.1a.79.79 0 0 0 .79-.79v-5.373l2.059 2.455a.79.79 0 1 0 1.211-1.015l-3.352-3.995a.79.79 0 0 0-.995-.179.784.784 0 0 0-.299.221l-3.35 3.99a.79.79 0 1 0 1.21 1.017l1.936-2.306v5.185c0 .436.353.79.79.79Z"/></svg>',imageAssetManager:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.201 1c-.662 0-1.2.47-1.2 1.1v14.248c0 .64.533 1.152 1.185 1.152h6.623v-7.236L6.617 9.15a.694.694 0 0 0-.957-.033L1.602 13.55V2.553l14.798.003V9.7H18V2.1c0-.63-.547-1.1-1.2-1.1H1.202Zm11.723 2.805a2.094 2.094 0 0 0-1.621.832 2.127 2.127 0 0 0 1.136 3.357 2.13 2.13 0 0 0 2.611-1.506 2.133 2.133 0 0 0-.76-2.244 2.13 2.13 0 0 0-1.366-.44Z"/><path clip-rule="evenodd" d="M19.898 12.369v6.187a.844.844 0 0 1-.844.844h-8.719a.844.844 0 0 1-.843-.844v-7.312a.844.844 0 0 1 .843-.844h2.531a.843.843 0 0 1 .597.248l.838.852h4.75c.223 0 .441.114.6.272a.844.844 0 0 1 .247.597Zm-1.52.654-4.377.02-1.1-1.143H11v6h7.4l-.023-4.877Z"/></svg>',imageUrl:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.201 1C.538 1 0 1.47 0 2.1v14.363c0 .64.534 1.037 1.186 1.037h7.029a5.401 5.401 0 0 1 .615-4.338l.762-1.232-2.975-2.78a.696.696 0 0 0-.957-.033L1.5 13.6V2.5h15v6.023c.449.131.887.32 1.307.573l.058.033c.046.028.09.057.135.086V2.1c0-.63-.547-1.1-1.2-1.1H1.202Zm11.713 2.803a2.15 2.15 0 0 0-1.611.834 2.118 2.118 0 0 0-.438 1.158 2.14 2.14 0 0 0 1.277 2.096 2.132 2.132 0 0 0 2.645-3.11 2.13 2.13 0 0 0-1.873-.978Z"/><path d="M16.63 10.294a3.003 3.003 0 0 0-4.142.887l-.117.177a.647.647 0 0 0-.096.492.664.664 0 0 0 .278.418.7.7 0 0 0 .944-.234 1.741 1.741 0 0 1 2.478-.463 1.869 1.869 0 0 1 .476 2.55.637.637 0 0 0-.071.5.646.646 0 0 0 .309.396.627.627 0 0 0 .869-.19l.027-.041a3.226 3.226 0 0 0-.956-4.492Zm-6.061 3.78-.044.066a3.228 3.228 0 0 0 .82 4.403 3.005 3.005 0 0 0 4.275-.798l.13-.197a.626.626 0 0 0 .092-.475.638.638 0 0 0-.268-.402.713.713 0 0 0-.99.26l-.018.029a1.741 1.741 0 0 1-2.477.461 1.87 1.87 0 0 1-.475-2.55l.029-.047a.647.647 0 0 0 .086-.485.66.66 0 0 0-.275-.408l-.04-.027a.609.609 0 0 0-.845.17Z"/><path d="M15.312 13.925c.24-.36.154-.838-.19-1.067-.346-.23-.82-.124-1.059.236l-1.268 1.907c-.239.36-.153.838.192 1.067.345.23.818.123 1.057-.236l1.268-1.907Z"/></svg>',lowVision:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5.085 6.22 2.943 4.078a.75.75 0 1 1 1.06-1.06l2.592 2.59A11.094 11.094 0 0 1 10 5.068c4.738 0 8.578 3.101 8.578 5.083 0 1.197-1.401 2.803-3.555 3.887l1.714 1.713a.75.75 0 0 1-.09 1.138.488.488 0 0 1-.15.084.75.75 0 0 1-.821-.16L6.17 7.304c-.258.11-.51.233-.757.365l6.239 6.24-.006.005.78.78c-.388.094-.78.166-1.174.215l-1.11-1.11h.011L4.55 8.197a7.2 7.2 0 0 0-.665.514l-.112.098 4.897 4.897-.005.006 1.276 1.276a10.164 10.164 0 0 1-1.477-.117l-.479-.479-.009.009-4.863-4.863-.022.031a2.563 2.563 0 0 0-.124.2c-.043.077-.08.158-.108.241a.534.534 0 0 0-.028.133.29.29 0 0 0 .008.072.927.927 0 0 0 .082.226c.067.133.145.26.234.379l3.242 3.365.025.01.59.623c-3.265-.918-5.59-3.155-5.59-4.668 0-1.194 1.448-2.838 3.663-3.93zm7.07.531a4.632 4.632 0 0 1 1.108 5.992l.345.344.046-.018a9.313 9.313 0 0 0 2-1.112c.256-.187.5-.392.727-.613.137-.134.27-.277.392-.431.072-.091.141-.185.203-.286.057-.093.107-.19.148-.292a.72.72 0 0 0 .036-.12.29.29 0 0 0 .008-.072.492.492 0 0 0-.028-.133.999.999 0 0 0-.036-.096 2.165 2.165 0 0 0-.071-.145 2.917 2.917 0 0 0-.125-.2 3.592 3.592 0 0 0-.263-.335 5.444 5.444 0 0 0-.53-.523 7.955 7.955 0 0 0-1.054-.768 9.766 9.766 0 0 0-1.879-.891c-.337-.118-.68-.219-1.027-.301zm-2.85.21-.069.002a.508.508 0 0 0-.254.097.496.496 0 0 0-.104.679.498.498 0 0 0 .326.199l.045.005c.091.003.181.003.272.012a2.45 2.45 0 0 1 2.017 1.513c.024.061.043.125.069.185a.494.494 0 0 0 .45.287h.008a.496.496 0 0 0 .35-.158.482.482 0 0 0 .13-.335.638.638 0 0 0-.048-.219 3.379 3.379 0 0 0-.36-.723 3.438 3.438 0 0 0-2.791-1.543l-.028-.001h-.013z"/></svg>',textAlternative:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.035 1C2.446 1 2 1.54 2 2.098V10.5h1.5v-8h13v8H18V2.098C18 1.539 17.48 1 16.9 1H3.035Zm10.453 2.61a1.885 1.885 0 0 0-1.442.736 1.89 1.89 0 0 0 1.011 2.976 1.903 1.903 0 0 0 2.253-1.114 1.887 1.887 0 0 0-1.822-2.598ZM7.463 8.163a.611.611 0 0 0-.432.154L5.071 10.5h5.119L7.88 8.348a.628.628 0 0 0-.417-.185Zm6.236 1.059a.62.62 0 0 0-.42.164L12.07 10.5h2.969l-.92-1.113a.618.618 0 0 0-.42-.165ZM.91 11.5a.91.91 0 0 0-.91.912v6.877c0 .505.405.91.91.91h18.178a.91.91 0 0 0 .912-.91v-6.877a.908.908 0 0 0-.912-.912H.91ZM3.668 13h1.947l2.135 5.7H5.898l-.28-.946H3.601l-.278.945H1.516L3.668 13Zm4.947 0h1.801v4.3h2.7v1.4h-4.5V13h-.001Zm4.5 0h5.4v1.4h-1.798v4.3h-1.701v-4.3h-1.9V13h-.001Zm-8.517 1.457-.614 2.059h1.262l-.648-2.059Z"/></svg>',loupe:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.68 13.74h-.001l4.209 4.208a1 1 0 1 0 1.414-1.414l-4.267-4.268a6 6 0 1 0-1.355 1.474ZM13 9a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z"/></svg>',previousArrow:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.463 5.187a.888.888 0 1 1 1.254 1.255L9.16 10l3.557 3.557a.888.888 0 1 1-1.254 1.255L7.26 10.61a.888.888 0 0 1 .16-1.382l4.043-4.042z"/></svg>',nextArrow:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.537 14.813a.888.888 0 1 1-1.254-1.255L10.84 10 7.283 6.442a.888.888 0 1 1 1.254-1.255L12.74 9.39a.888.888 0 0 1-.16 1.382l-4.043 4.042z"/></svg>',importExport:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M19 4.5 14 0H3v12.673l.868-1.041c.185-.222.4-.402.632-.54V1.5h8v5h5v7.626a2.24 2.24 0 0 1 1.5.822V4.5ZM14 5V2l3.3 3H14Zm-3.692 12.5c.062.105.133.206.213.303L11.52 19H8v-.876a2.243 2.243 0 0 0 1.82-.624h.488Zm7.518-.657a.75.75 0 0 0-1.152-.96L15.5 17.29V12H14v5.29l-1.174-1.408a.75.75 0 0 0-1.152.96l2.346 2.816a.95.95 0 0 0 1.46 0l2.346-2.815Zm-15.056-.38a.75.75 0 0 1-.096-1.056l2.346-2.815a.95.95 0 0 1 1.46 0l2.346 2.815a.75.75 0 1 1-1.152.96L6.5 14.96V20H5v-5.04l-1.174 1.408a.75.75 0 0 1-1.056.096Z"/></svg>',paragraph:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.5 5.5H7v5h3.5a2.5 2.5 0 1 0 0-5zM5 3h6.5v.025a5 5 0 0 1 0 9.95V13H7v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z"/></svg>',plus:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 2a1 1 0 0 0-1 1v6H3a1 1 0 1 0 0 2h6v6a1 1 0 1 0 2 0v-6h6a1 1 0 1 0 0-2h-6V3a1 1 0 0 0-1-1Z"/></svg>',text:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.816 11.5 7.038 4.785 4.261 11.5h5.555Zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13Z"/><path d="m12.09 17-.534-1.292.848-1.971.545 1.319L12.113 17h-.023Zm1.142-5.187.545 1.319L15.5 9.13l1.858 4.316h-3.45l.398.965h3.467L18.887 17H20l-3.873-9h-1.254l-1.641 3.813Z"/></svg>',alignBottom:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m9.239 13.938-2.88-1.663a.75.75 0 0 1 .75-1.3L9 12.067V4.75a.75.75 0 1 1 1.5 0v7.318l1.89-1.093a.75.75 0 0 1 .75 1.3l-2.879 1.663a.752.752 0 0 1-.511.187.752.752 0 0 1-.511-.187zM4.25 17a.75.75 0 1 1 0-1.5h10.5a.75.75 0 0 1 0 1.5H4.25z"/></svg>',alignMiddle:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.75 11.875a.752.752 0 0 1 .508.184l2.883 1.666a.75.75 0 0 1-.659 1.344l-.091-.044-1.892-1.093.001 4.318a.75.75 0 1 1-1.5 0v-4.317l-1.89 1.092a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .51-.187zM15.25 9a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5h10.5zM9.75.375a.75.75 0 0 1 .75.75v4.318l1.89-1.093.092-.045a.75.75 0 0 1 .659 1.344l-2.883 1.667a.752.752 0 0 1-.508.184.752.752 0 0 1-.511-.187L6.359 5.65a.75.75 0 0 1 .75-1.299L9 5.442V1.125a.75.75 0 0 1 .75-.75z"/></svg>',alignTop:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m10.261 7.062 2.88 1.663a.75.75 0 0 1-.75 1.3L10.5 8.933v7.317a.75.75 0 1 1-1.5 0V8.932l-1.89 1.093a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .511-.187.752.752 0 0 1 .511.187zM15.25 4a.75.75 0 1 1 0 1.5H4.75a.75.75 0 0 1 0-1.5h10.5z"/></svg>',alignLeft:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z"/></svg>',alignCenter:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm2.286 4c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75z"/></svg>',alignRight:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M18 3.75a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 8a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 4a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75zm0-8a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75z"/></svg>',alignJustify:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z"/></svg>',objectLeft:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zm0-3H18v1.5h-4.5zm0-3H18v1.5h-4.5zM2 15h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',objectCenter:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M15.003 7v5.5a1 1 0 0 1-1 1H5.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H6.5V12h6.997V7.5z"/></svg>',objectRight:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2zm0-9h5v1.5H2zm0 3h5v1.5H2zm0 3h5v1.5H2z"/><path d="M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H9.5V12h6.997V7.5z"/></svg>',objectFullWidth:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M18 7v5.5a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1zm-1.505.5H3.504V12h12.991V7.5z"/></svg>',objectInline:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zM2 15h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',objectBlockLeft:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',objectBlockRight:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H9.5V12h6.997V7.5z"/></svg>',objectSizeCustom:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:v="https://vecta.io/nano" viewBox="0 0 20 20"><path d="M.95 1.43a.95.95 0 0 0-.95.95v3.1a.95.95 0 0 0 .95.95h.75v6.3H.95a.95.95 0 0 0-.95.95v3.1a.95.95 0 0 0 .95.95h3.1a.95.95 0 0 0 .95-.95v-.65h1.932l1.539-1.5H5v-.95a.95.95 0 0 0-.95-.95H3.2v-6.3h.85A.95.95 0 0 0 5 5.48v-.55h10v.55a.95.95 0 0 0 .95.95h3.1a.95.95 0 0 0 .95-.95v-3.1a.95.95 0 0 0-.95-.95h-3.1a.95.95 0 0 0-.95.95v1.05H5V2.38a.95.95 0 0 0-.95-.95H.95zm.55 3.5v-2h2v2h-2zm0 9.3v2h2v-2h-2zm15-11.3v2h2v-2h-2z"/><path d="M8.139 20.004v-2.388l7.045-7.048 2.391 2.391-7.046 7.046h-2.39zm11.421-9.101a.64.64 0 0 1-.138.206l-1.165 1.168-2.391-2.391 1.167-1.163a.63.63 0 0 1 .206-.138.635.635 0 0 1 .243-.049.63.63 0 0 1 .449.187l1.491 1.488c.059.059.108.129.138.206s.049.16.049.243a.6.6 0 0 1-.049.243z"/></svg>',objectSizeFull:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 17v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zM1 15.5v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm0-2v1h-1v-1h1zm-19 0v1H0v-1h1zM14.5 2v1h-1V2h1zm2 0v1h-1V2h1zm2 0v1h-1V2h1zm-8 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm8 0v1h-1V2h1zm-10 0v1h-1V2h1z"/><path d="M18.095 2H1.905C.853 2 0 2.895 0 4v12c0 1.105.853 2 1.905 2h16.19C19.147 18 20 17.105 20 16V4c0-1.105-.853-2-1.905-2zm0 1.5c.263 0 .476.224.476.5v12c0 .276-.213.5-.476.5H1.905a.489.489 0 0 1-.476-.5V4c0-.276.213-.5.476-.5h16.19z"/></svg>',objectSizeLarge:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 16.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1ZM1 15v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 13v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 11v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 9v1H0V9h1Zm19 0v1h-1V9h1ZM1 7v1H0V7h1Zm19 0v1h-1V7h1ZM1 5v1H0V5h1Zm19 0v1h-1V5h1Zm0-2v1h-1V3h1ZM1 3v1H0V3h1Zm13.5-1.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm-8 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm8 0v1h-1v-1h1Zm-10 0v1h-1v-1h1Z"/><path d="M13 5.5H2a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-8a2 2 0 0 0-2-2ZM13 7a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-8A.5.5 0 0 1 2 7h11Z"/></svg>',objectSizeSmall:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 16.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1ZM1 15v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 13v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 11v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 9v1H0V9h1Zm19 0v1h-1V9h1ZM1 7v1H0V7h1Zm19 0v1h-1V7h1ZM1 5v1H0V5h1Zm19 0v1h-1V5h1Zm0-2v1h-1V3h1ZM1 3v1H0V3h1Zm13.5-1.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm-8 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm8 0v1h-1v-1h1Zm-10 0v1h-1v-1h1Z"/><path d="M7 9.5H2a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h5a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2ZM7 11a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-4A.5.5 0 0 1 2 11h5Z"/></svg>',objectSizeMedium:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 16.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1ZM1 15v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 13v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 11v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 9v1H0V9h1Zm19 0v1h-1V9h1ZM1 7v1H0V7h1Zm19 0v1h-1V7h1ZM1 5v1H0V5h1Zm19 0v1h-1V5h1Zm0-2v1h-1V3h1ZM1 3v1H0V3h1Zm13.5-1.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm-8 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm8 0v1h-1v-1h1Zm-10 0v1h-1v-1h1Z"/><path d="M10 7.5H2a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2ZM10 9a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-6A.5.5 0 0 1 2 9h8Z"/></svg>',pencil:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m7.3 17.37-.061.088a1.518 1.518 0 0 1-.934.535l-4.178.663-.806-4.153a1.495 1.495 0 0 1 .187-1.058l.056-.086L8.77 2.639c.958-1.351 2.803-1.076 4.296-.03 1.497 1.047 2.387 2.693 1.433 4.055L7.3 17.37zM9.14 4.728l-5.545 8.346 3.277 2.294 5.544-8.346L9.14 4.728zM6.07 16.512l-3.276-2.295.53 2.73 2.746-.435zM9.994 3.506 13.271 5.8c.316-.452-.16-1.333-1.065-1.966-.905-.634-1.895-.78-2.212-.328zM8 18.5 9.375 17H19v1.5H8z"/></svg>',pilcrow:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.999 2H15a1 1 0 0 1 0 2h-1.004v13a1 1 0 1 1-2 0V4H8.999v13a1 1 0 1 1-2 0v-7A4 4 0 0 1 3 6a4 4 0 0 1 3.999-4z"/></svg>',quote:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 10.423a6.5 6.5 0 0 1 6.056-6.408l.038.67C6.448 5.423 5.354 7.663 5.22 10H9c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574zm8 0a6.5 6.5 0 0 1 6.056-6.408l.038.67c-2.646.739-3.74 2.979-3.873 5.315H17c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574z"/></svg>',threeVerticalDots:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="9.5" cy="4.5" r="1.5"/><circle cx="9.5" cy="10.5" r="1.5"/><circle cx="9.5" cy="16.5" r="1.5"/></svg>',dragIndicator:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5 3.25a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M12 3.25a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M12 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M5 16.75a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M12 16.75a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/></svg>',redo:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m14.958 9.367-2.189 1.837a.75.75 0 0 0 .965 1.149l3.788-3.18a.747.747 0 0 0 .21-.284.75.75 0 0 0-.17-.945L13.77 4.762a.75.75 0 1 0-.964 1.15l2.331 1.955H6.22A.75.75 0 0 0 6 7.9a4 4 0 1 0 1.477 7.718l-.344-1.489A2.5 2.5 0 1 1 6.039 9.4l-.008-.032h8.927z"/></svg>',undo:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m5.042 9.367 2.189 1.837a.75.75 0 0 1-.965 1.149l-3.788-3.18a.747.747 0 0 1-.21-.284.75.75 0 0 1 .17-.945L6.23 4.762a.75.75 0 1 1 .964 1.15L4.863 7.866h8.917A.75.75 0 0 1 14 7.9a4 4 0 1 1-1.477 7.718l.344-1.489a2.5 2.5 0 1 0 1.094-4.73l.008-.032H5.042z"/></svg>',bulletedList:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zm-6 0C1 4.784 1.777 4 2.75 4c.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75C1.784 7.5 1 6.723 1 5.75zm6 9c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zm-6 0c0-.966.777-1.75 1.75-1.75.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75-.966 0-1.75-.777-1.75-1.75z"/></svg>',numberedList:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM3.5 3v5H2V3.7H1v-1h2.5V3zM.343 17.857l2.59-3.257H2.92a.6.6 0 1 0-1.04 0H.302a2 2 0 1 1 3.995 0h-.001c-.048.405-.16.734-.333.988-.175.254-.59.692-1.244 1.312H4.3v1h-4l.043-.043zM7 14.75a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75z"/></svg>',todoList:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m2.315 14.705 2.224-2.24a.689.689 0 0 1 .963 0 .664.664 0 0 1 0 .949L2.865 16.07a.682.682 0 0 1-.112.089.647.647 0 0 1-.852-.051L.688 14.886a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0l.717.722zm5.185.045a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75zM2.329 5.745l2.21-2.226a.689.689 0 0 1 .963 0 .664.664 0 0 1 0 .95L2.865 7.125a.685.685 0 0 1-.496.196.644.644 0 0 1-.468-.187L.688 5.912a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0l.73.736zM7.5 5.75A.75.75 0 0 1 8.25 5h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75z"/></svg>',codeBlock:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.87 12.61a.75.75 0 0 1-.089.976l-.085.07-3.154 2.254 3.412 2.414a.75.75 0 0 1 .237.95l-.057.095a.75.75 0 0 1-.95.237l-.096-.058-4.272-3.022-.003-1.223 4.01-2.867a.75.75 0 0 1 1.047.174zm2.795-.231.095.057 4.011 2.867-.003 1.223-4.272 3.022-.095.058a.75.75 0 0 1-.88-.151l-.07-.086-.058-.095a.75.75 0 0 1 .15-.88l.087-.07 3.412-2.414-3.154-2.253-.085-.071a.75.75 0 0 1 .862-1.207zM16 0a2 2 0 0 1 2 2v9.354l-.663-.492-.837-.001V2a.5.5 0 0 0-.5-.5H2a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h3.118L7.156 19H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h14zM5.009 15l.003 1H3v-1h2.009zm2.188-2-1.471 1H5v-1h2.197zM10 11v.095L8.668 12H7v-1h3zm4-2v1H7V9h7zm0-2v1H7V7h7zm-4-2v1H5V5h5zM6 3v1H3V3h3z"/></svg>',browseFiles:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.627 16.5zm5.873-.196zm0-7.001V8h-13v8.5h4.341c.191.54.457 1.044.785 1.5H2a1.5 1.5 0 0 1-1.5-1.5v-13A1.5 1.5 0 0 1 2 2h4.5a1.5 1.5 0 0 1 1.06.44L9.122 4H16a1.5 1.5 0 0 1 1.5 1.5v1A1.5 1.5 0 0 1 19 8v2.531a6.027 6.027 0 0 0-1.5-1.228zM16 6.5v-1H8.5l-2-2H2v13h1V8a1.5 1.5 0 0 1 1.5-1.5H16z"/><path d="M14.5 19.5a5 5 0 1 1 0-10 5 5 0 0 1 0 10zM15 14v-2h-1v2h-2v1h2v2h1v-2h2v-1h-2z"/></svg>',heading1:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M19 9v10h-2v-8h-2V9h4zM4 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1H10a1 1 0 0 1-1-1V11H4v4.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1H3a1 1 0 0 1 1 1v4.5z"/></svg>',heading2:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V11H3v4.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1H2a1 1 0 0 1 1 1v4.5zm16.076 8.343V18.5h-6.252c.067-.626.27-1.22.61-1.78.338-.561 1.006-1.305 2.005-2.232.804-.749 1.297-1.257 1.479-1.523.245-.368.368-.732.368-1.092 0-.398-.107-.703-.32-.917-.214-.214-.51-.32-.886-.32-.372 0-.669.111-.889.336-.22.224-.347.596-.38 1.117l-1.778-.178c.106-.982.438-1.686.997-2.114.558-.427 1.257-.64 2.095-.64.918 0 1.64.247 2.164.742.525.495.787 1.11.787 1.847 0 .419-.075.818-.225 1.197-.15.378-.388.775-.714 1.19-.216.275-.605.67-1.168 1.187-.563.516-.92.859-1.07 1.028a3.11 3.11 0 0 0-.365.495h3.542z"/></svg>',heading3:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V11H3v4.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1H2a1 1 0 0 1 1 1v4.5zm9.989 7.53 1.726-.209c.055.44.203.777.445 1.01.24.232.533.349.876.349.368 0 .678-.14.93-.42.251-.279.377-.655.377-1.13 0-.448-.12-.803-.362-1.066a1.153 1.153 0 0 0-.882-.393c-.228 0-.501.044-.819.133l.197-1.453c.482.012.85-.092 1.105-.315.253-.222.38-.517.38-.885 0-.313-.093-.563-.279-.75-.186-.185-.434-.278-.743-.278a1.07 1.07 0 0 0-.78.317c-.216.212-.347.52-.394.927l-1.644-.28c.114-.562.287-1.012.517-1.348.231-.337.553-.601.965-.794a3.24 3.24 0 0 1 1.387-.289c.876 0 1.579.28 2.108.838.436.457.653.973.653 1.549 0 .817-.446 1.468-1.339 1.955.533.114.96.37 1.28.768.319.398.478.878.478 1.441 0 .817-.298 1.513-.895 2.088-.596.576-1.339.864-2.228.864-.842 0-1.54-.243-2.094-.727-.555-.485-.876-1.118-.965-1.901z"/></svg>',heading4:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.5 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V11h-5v4.5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v4.5zm13.55 10v-1.873h-3.81v-1.561l4.037-5.91h1.498v5.904h1.156v1.567h-1.156V18.5H17.05zm0-3.44v-3.18l-2.14 3.18h2.14z"/></svg>',heading5:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.5 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V11h-5v4.5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v4.5zm9.578 7.607 1.777-.184c.05.402.201.72.45.955a1.223 1.223 0 0 0 1.81-.101c.258-.303.387-.759.387-1.368 0-.572-.128-1-.384-1.286-.256-.285-.59-.428-1-.428-.512 0-.971.226-1.377.679l-1.448-.21.915-4.843h4.716v1.67H15.56l-.28 1.58a2.697 2.697 0 0 1 1.219-.298 2.68 2.68 0 0 1 2.012.863c.55.576.825 1.323.825 2.241a3.36 3.36 0 0 1-.666 2.05c-.605.821-1.445 1.232-2.52 1.232-.86 0-1.56-.23-2.101-.692-.542-.461-.866-1.081-.971-1.86z"/></svg>',heading6:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.5 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V11h-5v4.5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v4.5zm15.595 2.973-1.726.19c-.043-.355-.153-.617-.33-.787-.178-.169-.409-.253-.692-.253-.377 0-.695.169-.956.507-.26.339-.424 1.043-.492 2.114.445-.525.997-.787 1.657-.787.745 0 1.383.284 1.914.85.531.568.797 1.3.797 2.197 0 .952-.28 1.716-.838 2.291-.559.576-1.276.864-2.152.864-.94 0-1.712-.365-2.317-1.095-.605-.73-.908-1.927-.908-3.59 0-1.705.316-2.935.946-3.688.63-.753 1.45-1.13 2.457-1.13.706 0 1.291.198 1.755.594.463.395.758.97.885 1.723zm-4.043 3.891c0 .58.133 1.028.4 1.343.266.315.57.473.914.473.33 0 .605-.13.825-.388.22-.258.33-.68.33-1.27 0-.604-.118-1.047-.355-1.329a1.115 1.115 0 0 0-.89-.422c-.342 0-.632.134-.869.403s-.355.666-.355 1.19z"/></svg>',horizontalLine:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 9h16v2H2z"/></svg>',html:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M17 0a2 2 0 0 1 2 2v7a1 1 0 0 1 1 1v5a1 1 0 0 1-.883.993l-.118.006L19 17a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2l-.001-1.001-.116-.006A1 1 0 0 1 0 15v-5a1 1 0 0 1 .999-1L1 2a2 2 0 0 1 2-2h14zm.499 15.999h-15L2.5 17a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5l-.001-1.001zm-3.478-6.013-.014.014H14v.007l-1.525 1.525-1.46-1.46-.015.013V10h-1v5h1v-3.53l1.428 1.43.048.043.131-.129L14 11.421V15h1v-5h-.965l-.014-.014zM2 10H1v5h1v-2h2v2h1v-5H4v2H2v-2zm7 0H6v1h1v4h1v-4h1v-1zm8 0h-1v5h3v-1h-2v-4zm0-8.5H3a.5.5 0 0 0-.5.5l-.001 6.999h15L17.5 2a.5.5 0 0 0-.5-.5zM10 7v1H4V7h6zm3-2v1H4V5h9zm-3-2v1H4V3h6z"/></svg>',indent:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zM1.632 6.95 5.02 9.358a.4.4 0 0 1-.013.661l-3.39 2.207A.4.4 0 0 1 1 11.892V7.275a.4.4 0 0 1 .632-.326z"/></svg>',outdent:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zm1.618-9.55L.98 9.358a.4.4 0 0 0 .013.661l3.39 2.207A.4.4 0 0 0 5 11.892V7.275a.4.4 0 0 0-.632-.326z"/></svg>',table:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 5.5v3h4v-3H3Zm0 4v3h4v-3H3Zm0 4v3h4v-3H3Zm5 3h4v-3H8v3Zm5 0h4v-3h-4v3Zm4-4v-3h-4v3h4Zm0-4v-3h-4v3h4Zm1.5 8A1.5 1.5 0 0 1 17 18H3a1.5 1.5 0 0 1-1.5-1.5V3c.222-.863 1.068-1.5 2-1.5h13c.932 0 1.778.637 2 1.5v13.5Zm-6.5-4v-3H8v3h4Zm0-4v-3H8v3h4Z"/></svg>',source:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.5 0 5 4.5v15.003h-16V0h11zM3 1.5v3.25l-1.497 1-.003 8 1.5 1v3.254L7.685 18l-.001 1.504H17.5V8.002L16 9.428l-.004-4.22-4.222-3.692L3 1.5z"/><path d="M4.06 6.64a.75.75 0 0 1 .958 1.15l-.085.07L2.29 9.75l2.646 1.89c.302.216.4.62.232.951l-.058.095a.75.75 0 0 1-.951.232l-.095-.058-3.5-2.5V9.14l3.496-2.5zm4.194 6.22a.75.75 0 0 1-.958-1.149l.085-.07 2.643-1.89-2.646-1.89a.75.75 0 0 1-.232-.952l.058-.095a.75.75 0 0 1 .95-.232l.096.058 3.5 2.5v1.22l-3.496 2.5zm7.644-.836 2.122 2.122-5.825 5.809-2.125-.005.003-2.116zm2.539-1.847 1.414 1.414a.5.5 0 0 1 0 .707l-1.06 1.06-2.122-2.12 1.061-1.061a.5.5 0 0 1 .707 0z"/></svg>\n',remove:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5.2 7h9.2c.6 0 1 .4 1 1v9.9c0 .5-.4 1-1 1H5.2a1 1 0 0 1-1-1V8c0-.6.4-1 1-1Zm1 1.5c-.3 0-.5.2-.5.5v8c0 .3.2.5.5.5h.5c.2 0 .5-.2.5-.5V9c0-.3-.3-.5-.5-.5h-.5Zm3.2 0c-.2 0-.5.2-.5.5v8c0 .3.3.5.5.5h.5c.3 0 .5-.2.5-.5V9c0-.3-.2-.5-.5-.5h-.5Zm3.5 0c-.2 0-.5.2-.5.5v8c0 .3.3.5.5.5h.5c.3 0 .5-.2.5-.5V9c0-.3-.2-.5-.5-.5h-.5Zm-1.4-7.1H8.3L6.5 3.6H3.8c-.5 0-.7.3-.7.8s.2.7.7.7h12c.6 0 .9-.2.9-.7 0-.5-.3-.8-1-.8h-2.4l-1.8-2.2Z"/></svg>',bookmark:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M5.68 3.417a.238.238 0 0 0-.24.236v12.66l3.793-3.102a1.215 1.215 0 0 1 1.534 0l3.793 3.103V3.654a.238.238 0 0 0-.24-.237H5.68ZM4 3.653C4 2.74 4.752 2 5.68 2h8.64c.928 0 1.68.74 1.68 1.653v13.164c0 1-1.185 1.547-1.967.908L10 14.426l-4.033 3.299c-.782.64-1.967.092-1.967-.908V3.653Z"/></svg>',bookmarkInline:'<svg viewBox="0 0 14 16" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M2 14.436V2a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v12.436a.5.5 0 0 1-.819.385l-3.862-3.2a.5.5 0 0 0-.638 0l-3.862 3.2A.5.5 0 0 1 2 14.436Z"/></svg>',emoji:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M8.5 8.25a1.25 1.25 0 1 1-2.499.001A1.25 1.25 0 0 1 8.5 8.25Z"/><path clip-rule="evenodd" d="M14 8.25a1.25 1.25 0 1 1-2.499.001A1.25 1.25 0 0 1 14 8.25Z"/><path clip-rule="evenodd" d="M7.127 12.088a.75.75 0 1 0-1.254.824C6.88 14.444 8.423 15.25 10 15.25c1.578 0 3.12-.805 4.127-2.338a.75.75 0 0 0-1.254-.824C12.13 13.221 11.048 13.75 10 13.75c-1.047 0-2.13-.529-2.873-1.662Z"/><path d="M10 19a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0-1.5a7.5 7.5 0 1 1 0-15 7.5 7.5 0 0 1 0 15Z"/></svg>\n'};class If extends(Ga()){total;_reader;_data;constructor(){super();const e=new window.FileReader;this._reader=e,this._data=void 0,this.set("loaded",0),e.onprogress=e=>{this.loaded=e.loaded}}get error(){return this._reader.error}get data(){return this._data}read(e){const t=this._reader;return this.total=e.size,new Promise(((n,i)=>{t.onload=()=>{const e=t.result;this._data=e,n(e)},t.onerror=()=>{i("error")},t.onabort=()=>{i("aborted")},this._reader.readAsDataURL(e)}))}abort(){this._reader.abort()}}class Of extends cf{loaders=new oc;_loadersMap=new Map;_pendingAction=null;static get pluginName(){return"FileRepository"}static get isOfficialPlugin(){return!0}static get requires(){return[Sf]}init(){this.loaders.on("change",(()=>this._updatePendingAction())),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",((e,t)=>t?e/t*100:0))}getLoader(e){return this._loadersMap.get(e)||null}createLoader(e){if(!this.createUploadAdapter)return Ea("filerepository-no-upload-adapter"),null;const t=new Vf(Promise.resolve(e),this.createUploadAdapter);return this.loaders.add(t),this._loadersMap.set(e,t),e instanceof Promise&&t.file.then((e=>{this._loadersMap.set(e,t)})).catch((()=>{})),t.on("change:uploaded",(()=>{let e=0;for(const t of this.loaders)e+=t.uploaded;this.uploaded=e})),t.on("change:uploadTotal",(()=>{let e=0;for(const t of this.loaders)t.uploadTotal&&(e+=t.uploadTotal);this.uploadTotal=e})),t}destroyLoader(e){const t=e instanceof Vf?e:this.getLoader(e);t._destroy(),this.loaders.remove(t),this._loadersMap.forEach(((e,n)=>{e===t&&this._loadersMap.delete(n)}))}_updatePendingAction(){const e=this.editor.plugins.get(Sf);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t,n=e=>`${t("Upload in progress")} ${parseInt(e)}%.`;this._pendingAction=e.add(n(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",n)}}else e.remove(this._pendingAction),this._pendingAction=null}}class Vf extends(Ga()){id;_filePromiseWrapper;_adapter;_reader;constructor(e,t){super(),this.id=ka(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=t(this),this._reader=new If,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",((e,t)=>t?e/t*100:0)),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then((e=>this._filePromiseWrapper?e:null)):Promise.resolve(null)}get data(){return this._reader.data}read(){if("idle"!=this.status)throw new Aa("filerepository-read-wrong-status",this);return this.status="reading",this.file.then((e=>this._reader.read(e))).then((e=>{if("reading"!==this.status)throw this.status;return this.status="idle",e})).catch((e=>{if("aborted"===e)throw this.status="aborted","aborted";throw this.status="error",this._reader.error?this._reader.error:e}))}upload(){if("idle"!=this.status)throw new Aa("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then((()=>this._adapter.upload())).then((e=>(this.uploadResponse=e,this.status="idle",e))).catch((e=>{if("aborted"===this.status)throw"aborted";throw this.status="error",e}))}abort(){const e=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?"reading"==e?this._reader.abort():"uploading"==e&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch((()=>{})),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(e){const t={};return t.promise=new Promise(((n,i)=>{t.rejecter=i,t.isFulfilled=!1,e.then((e=>{t.isFulfilled=!0,n(e)})).catch((e=>{t.isFulfilled=!0,i(e)}))})),t}}var Rf=/[\\^$.*+?()[\]{}|]/g,Nf=RegExp(Rf.source);const Lf=function(e){return(e=Mc(e))&&Nf.test(e)?e.replace(Rf,"\\$&"):e},Mf=function(e){return function(t){return null==e?void 0:e[t]}};Mf({"&":"&","<":"<",">":">",'"':""","'":"'"});RegExp(/[&<>"']/g.source);var Bf=o(156);const Ff=function(e){var t,n,i=[],r=1;if("string"==typeof e)if(Bf[e])i=Bf[e].slice(),n="rgb";else if("transparent"===e)r=0,n="rgb",i=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(e)){var s=e.slice(1);r=1,(l=s.length)<=4?(i=[parseInt(s[0]+s[0],16),parseInt(s[1]+s[1],16),parseInt(s[2]+s[2],16)],4===l&&(r=parseInt(s[3]+s[3],16)/255)):(i=[parseInt(s[0]+s[1],16),parseInt(s[2]+s[3],16),parseInt(s[4]+s[5],16)],8===l&&(r=parseInt(s[6]+s[7],16)/255)),i[0]||(i[0]=0),i[1]||(i[1]=0),i[2]||(i[2]=0),n="rgb"}else if(t=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(e)){var o=t[1],a="rgb"===o;n=s=o.replace(/a$/,"");var l="cmyk"===s?4:"gray"===s?1:3;i=t[2].trim().split(/\s*[,\/]\s*|\s+/).map((function(e,t){if(/%$/.test(e))return t===l?parseFloat(e)/100:"rgb"===s?255*parseFloat(e)/100:parseFloat(e);if("h"===s[t]){if(/deg$/.test(e))return parseFloat(e);if(void 0!==Df[e])return Df[e]}return parseFloat(e)})),o===s&&i.push(1),r=a||void 0===i[l]?1:i[l],i=i.slice(0,l)}else e.length>10&&/[0-9](?:\s|\/)/.test(e)&&(i=e.match(/([0-9]+)/g).map((function(e){return parseFloat(e)})),n=e.match(/([a-z])/gi).join("").toLowerCase());else isNaN(e)?Array.isArray(e)||e.length?(i=[e[0],e[1],e[2]],n="rgb",r=4===e.length?e[3]:1):e instanceof Object&&(null!=e.r||null!=e.red||null!=e.R?(n="rgb",i=[e.r||e.red||e.R||0,e.g||e.green||e.G||0,e.b||e.blue||e.B||0]):(n="hsl",i=[e.h||e.hue||e.H||0,e.s||e.saturation||e.S||0,e.l||e.lightness||e.L||e.b||e.brightness]),r=e.a||e.alpha||e.opacity||1,null!=e.opacity&&(r/=100)):(n="rgb",i=[e>>>16,(65280&e)>>>8,255&e]);return{space:n,values:i,alpha:r}};var Df={red:0,orange:60,yellow:120,green:180,blue:240,purple:300},zf=o(734),$f=o.t(zf,2);const jf=(e,t=0,n=1)=>e>n?n:e<t?t:e,Hf=(e,t=0,n=Math.pow(10,t))=>Math.round(n*e)/n,Wf=(Math.PI,e=>("#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?Hf(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?Hf(parseInt(e.substring(6,8),16)/255,2):1})),Uf=e=>{const{h:t,s:n,l:i}=(({h:e,s:t,v:n,a:i})=>{const r=(200-t)*n/100;return{h:Hf(e),s:Hf(r>0&&r<200?t*n/100/(r<=100?r:200-r)*100:0),l:Hf(r/2),a:Hf(i,2)}})(e);return`hsl(${t}, ${n}%, ${i}%)`},qf=e=>{const t=e.toString(16);return t.length<2?"0"+t:t},Gf=(e,t)=>{if(e===t)return!0;for(const n in e)if(e[n]!==t[n])return!1;return!0},Kf={},Zf=e=>{let t=Kf[e];return t||(t=document.createElement("template"),t.innerHTML=e,Kf[e]=t),t},Qf=(e,t,n)=>{e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}))};let Yf=!1;const Jf=e=>"touches"in e,Xf=(e,t)=>{const n=Jf(t)?t.touches[0]:t,i=e.el.getBoundingClientRect();Qf(e.el,"move",e.getMove({x:jf((n.pageX-(i.left+window.pageXOffset))/i.width),y:jf((n.pageY-(i.top+window.pageYOffset))/i.height)}))};class eb{constructor(e,t,n,i){const r=Zf(`<div role="slider" tabindex="0" part="${t}" ${n}><div part="${t}-pointer"></div></div>`);e.appendChild(r.content.cloneNode(!0));const s=e.querySelector(`[part=${t}]`);s.addEventListener("mousedown",this),s.addEventListener("touchstart",this),s.addEventListener("keydown",this),this.el=s,this.xy=i,this.nodes=[s.firstChild,s]}set dragging(e){const t=e?document.addEventListener:document.removeEventListener;t(Yf?"touchmove":"mousemove",this),t(Yf?"touchend":"mouseup",this)}handleEvent(e){switch(e.type){case"mousedown":case"touchstart":if(e.preventDefault(),!(e=>!(Yf&&!Jf(e)||(Yf||(Yf=Jf(e)),0)))(e)||!Yf&&0!=e.button)return;this.el.focus(),Xf(this,e),this.dragging=!0;break;case"mousemove":case"touchmove":e.preventDefault(),Xf(this,e);break;case"mouseup":case"touchend":this.dragging=!1;break;case"keydown":((e,t)=>{const n=t.keyCode;n>40||e.xy&&n<37||n<33||(t.preventDefault(),Qf(e.el,"move",e.getMove({x:39===n?.01:37===n?-.01:34===n?.05:33===n?-.05:35===n?1:36===n?-1:0,y:40===n?.01:38===n?-.01:0},!0)))})(this,e)}}style(e){e.forEach(((e,t)=>{for(const n in e)this.nodes[t].style.setProperty(n,e[n])}))}}class tb extends eb{constructor(e){super(e,"hue",'aria-label="Hue" aria-valuemin="0" aria-valuemax="360"',!1)}update({h:e}){this.h=e,this.style([{left:e/360*100+"%",color:Uf({h:e,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuenow",`${Hf(e)}`)}getMove(e,t){return{h:t?jf(this.h+360*e.x,0,360):360*e.x}}}class nb extends eb{constructor(e){super(e,"saturation",'aria-label="Color"',!0)}update(e){this.hsva=e,this.style([{top:100-e.v+"%",left:`${e.s}%`,color:Uf(e)},{"background-color":Uf({h:e.h,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuetext",`Saturation ${Hf(e.s)}%, Brightness ${Hf(e.v)}%`)}getMove(e,t){return{s:t?jf(this.hsva.s+100*e.x,0,100):100*e.x,v:t?jf(this.hsva.v-100*e.y,0,100):Math.round(100-100*e.y)}}}const ib=Symbol("same"),rb=Symbol("color"),sb=Symbol("hsva"),ob=Symbol("update"),ab=Symbol("parts"),lb=Symbol("css"),cb=Symbol("sliders");class db extends HTMLElement{static get observedAttributes(){return["color"]}get[lb](){return[':host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:"";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}',"[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}","[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}"]}get[cb](){return[nb,tb]}get color(){return this[rb]}set color(e){if(!this[ib](e)){const t=this.colorModel.toHsva(e);this[ob](t),this[rb]=e}}constructor(){super();const e=Zf(`<style>${this[lb].join("")}</style>`),t=this.attachShadow({mode:"open"});t.appendChild(e.content.cloneNode(!0)),t.addEventListener("move",this),this[ab]=this[cb].map((e=>new e(t)))}connectedCallback(){if(this.hasOwnProperty("color")){const e=this.color;delete this.color,this.color=e}else this.color||(this.color=this.colorModel.defaultColor)}attributeChangedCallback(e,t,n){const i=this.colorModel.fromAttr(n);this[ib](i)||(this.color=i)}handleEvent(e){const t=this[sb],n={...t,...e.detail};let i;this[ob](n),Gf(n,t)||this[ib](i=this.colorModel.fromHsva(n))||(this[rb]=i,Qf(this,"color-changed",{value:i}))}[ib](e){return this.color&&this.colorModel.equal(e,this.color)}[ob](e){this[sb]=e,this[ab].forEach((t=>t.update(e)))}}const ub={defaultColor:"#000",toHsva:e=>(({r:e,g:t,b:n,a:i})=>{const r=Math.max(e,t,n),s=r-Math.min(e,t,n),o=s?r===e?(t-n)/s:r===t?2+(n-e)/s:4+(e-t)/s:0;return{h:Hf(60*(o<0?o+6:o)),s:Hf(r?s/r*100:0),v:Hf(r/255*100),a:i}})(Wf(e)),fromHsva:({h:e,s:t,v:n})=>(({r:e,g:t,b:n,a:i})=>{const r=i<1?qf(Hf(255*i)):"";return"#"+qf(e)+qf(t)+qf(n)+r})((({h:e,s:t,v:n,a:i})=>{e=e/360*6,t/=100,n/=100;const r=Math.floor(e),s=n*(1-t),o=n*(1-(e-r)*t),a=n*(1-(1-e+r)*t),l=r%6;return{r:Hf(255*[n,o,s,s,a,n][l]),g:Hf(255*[a,n,n,o,s,s][l]),b:Hf(255*[s,s,a,n,n,o][l]),a:Hf(i,2)}})({h:e,s:t,v:n,a:1})),equal:(e,t)=>e.toLowerCase()===t.toLowerCase()||Gf(Wf(e),Wf(t)),fromAttr:e=>e};class hb extends db{get colorModel(){return ub}}class mb extends oc{_parentElement;constructor(e=[]){super(e,{idProperty:"viewUid"}),this.on("add",((e,t,n)=>{this._renderViewIntoCollectionParent(t,n)})),this.on("remove",((e,t)=>{t.element&&this._parentElement&&t.element.remove()})),this._parentElement=null}destroy(){this.map((e=>e.destroy()))}setParent(e){this._parentElement=e;for(const e of this)this._renderViewIntoCollectionParent(e)}delegate(...e){if(!e.length||!e.every((e=>"string"==typeof e)))throw new Aa("ui-viewcollection-delegate-wrong-events",this);return{to:t=>{for(const n of this)for(const i of e)n.delegate(i).to(t);this.on("add",((n,i)=>{for(const n of e)i.delegate(n).to(t)})),this.on("remove",((n,i)=>{for(const n of e)i.stopDelegating(n,t)}))}}}_renderViewIntoCollectionParent(e,t){e.isRendered||e.render(),e.element&&this._parentElement&&this._parentElement.insertBefore(e.element,this._parentElement.children[t])}remove(e){return super.remove(e)}}class gb extends(Na()){ns;tag;text;attributes;children;eventListeners;_isRendered;_revertData;constructor(e){super(),Object.assign(this,Cb(xb(e))),this._isRendered=!1,this._revertData=null}render(){const e=this._renderNode({intoFragment:!0});return this._isRendered=!0,e}apply(e){return this._revertData={children:[],bindings:[],attributes:{}},this._renderNode({node:e,intoFragment:!1,isApplying:!0,revertData:this._revertData}),e}revert(e){if(!this._revertData)throw new Aa("ui-template-revert-not-applied",[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){yield*function*e(t){if(t.children)for(const n of t.children)Ib(n)?yield n:Ob(n)&&(yield*e(n))}(this)}static bind(e,t){return{to:(n,i)=>new fb({eventNameOrFunction:n,attribute:n,observable:e,emitter:t,callback:i}),if:(n,i,r)=>new bb({observable:e,emitter:t,attribute:n,valueIfTrue:i,callback:r})}}static extend(e,t){if(e._isRendered)throw new Aa("template-extend-render",[this,e]);Sb(e,Cb(xb(t)))}_renderNode(e){let t;if(t=e.node?this.tag&&this.text:this.tag?this.text:!this.text,t)throw new Aa("ui-template-wrong-syntax",this);return this.text?this._renderText(e):this._renderElement(e)}_renderElement(e){let t=e.node;return t||(t=e.node=document.createElementNS(this.ns||"http://www.w3.org/1999/xhtml",this.tag)),this._renderAttributes(e),this._renderElementChildren(e),this._setUpListeners(e),t}_renderText(e){let t=e.node;return t?e.revertData.text=t.textContent:t=e.node=document.createTextNode(""),wb(this.text)?this._bindToObservable({schema:this.text,updater:yb(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){if(!this.attributes)return;const t=e.node,n=e.revertData;for(const i in this.attributes){const r=t.getAttribute(i),s=this.attributes[i];n&&(n.attributes[i]=r);const o=Rb(s)?s[0].ns:null;if(wb(s)){const a=Rb(s)?s[0].value:s;n&&Nb(i)&&a.unshift(r),this._bindToObservable({schema:a,updater:_b(t,i,o),data:e})}else if("style"==i&&"string"!=typeof s[0])this._renderStyleAttribute(s[0],e);else{n&&r&&Nb(i)&&s.unshift(r);const e=s.map((e=>e&&e.value||e)).reduce(((e,t)=>e.concat(t)),[]).reduce(Eb,"");Pb(e)||t.setAttributeNS(o,i,e)}}}_renderStyleAttribute(e,t){const n=t.node;for(const i in e){const r=e[i];wb(r)?this._bindToObservable({schema:[r],updater:kb(n,i),data:t}):n.style[i]=r}}_renderElementChildren(e){const t=e.node,n=e.intoFragment?document.createDocumentFragment():t,i=e.isApplying;let r=0;for(const s of this.children)if(Vb(s)){if(!i){s.setParent(t);for(const e of s)n.appendChild(e.element)}}else if(Ib(s))i||(s.isRendered||s.render(),n.appendChild(s.element));else if(al(s))n.appendChild(s);else if(i){const t={children:[],bindings:[],attributes:{}};e.revertData.children.push(t),s._renderNode({intoFragment:!1,node:n.childNodes[r++],isApplying:!0,revertData:t})}else n.appendChild(s.render());e.intoFragment&&t.appendChild(n)}_setUpListeners(e){if(this.eventListeners)for(const t in this.eventListeners){const n=this.eventListeners[t].map((n=>{const[i,r]=t.split("@");return n.activateDomEventListener(i,r,e)}));e.revertData&&e.revertData.bindings.push(n)}}_bindToObservable({schema:e,updater:t,data:n}){const i=n.revertData;vb(e,t,n);const r=e.filter((e=>!Pb(e))).filter((e=>e.observable)).map((i=>i.activateAttributeListener(e,t,n)));i&&i.bindings.push(r)}_revertTemplateFromNode(e,t){for(const e of t.bindings)for(const t of e)t();if(t.text)return void(e.textContent=t.text);const n=e;for(const e in t.attributes){const i=t.attributes[e];null===i?n.removeAttribute(e):n.setAttribute(e,i)}for(let e=0;e<t.children.length;++e)this._revertTemplateFromNode(n.childNodes[e],t.children[e])}}class pb{attribute;observable;emitter;callback;constructor(e){this.attribute=e.attribute,this.observable=e.observable,this.emitter=e.emitter,this.callback=e.callback}getValue(e){const t=this.observable[this.attribute];return this.callback?this.callback(t,e):t}activateAttributeListener(e,t,n){const i=()=>vb(e,t,n);return this.emitter.listenTo(this.observable,`change:${this.attribute}`,i),()=>{this.emitter.stopListening(this.observable,`change:${this.attribute}`,i)}}}class fb extends pb{eventNameOrFunction;constructor(e){super(e),this.eventNameOrFunction=e.eventNameOrFunction}activateDomEventListener(e,t,n){const i=(e,n)=>{t&&!n.target.matches(t)||("function"==typeof this.eventNameOrFunction?this.eventNameOrFunction(n):this.observable.fire(this.eventNameOrFunction,n))};return this.emitter.listenTo(n.node,e,i),()=>{this.emitter.stopListening(n.node,e,i)}}}class bb extends pb{valueIfTrue;constructor(e){super(e),this.valueIfTrue=e.valueIfTrue}getValue(e){return!Pb(super.getValue(e))&&(this.valueIfTrue||!0)}}function wb(e){return!!e&&(e.value&&(e=e.value),Array.isArray(e)?e.some(wb):e instanceof pb)}function vb(e,t,{node:n}){const i=function(e,t){return e.map((e=>e instanceof pb?e.getValue(t):e))}(e,n);let r;r=1==e.length&&e[0]instanceof bb?i[0]:i.reduce(Eb,""),Pb(r)?t.remove():t.set(r)}function yb(e){return{set(t){e.textContent=t},remove(){e.textContent=""}}}function _b(e,t,n){return{set(i){e.setAttributeNS(n,t,i)},remove(){e.removeAttributeNS(n,t)}}}function kb(e,t){return{set(n){e.style[t]=n},remove(){e.style[t]=null}}}function xb(e){return Do(e,(e=>{if(e&&(e instanceof pb||Ob(e)||Ib(e)||Vb(e)))return e}))}function Cb(e){if("string"==typeof e?e=function(e){return{text:[e]}}(e):e.text&&function(e){e.text=rc(e.text)}(e),e.on&&(e.eventListeners=function(e){for(const t in e)Ab(e,t);return e}(e.on),delete e.on),!e.text){e.attributes&&function(e){for(const t in e)e[t].value&&(e[t].value=rc(e[t].value)),Ab(e,t)}(e.attributes);const t=[];if(e.children)if(Vb(e.children))t.push(e.children);else for(const n of e.children)Ob(n)||Ib(n)||al(n)?t.push(n):t.push(new gb(n));e.children=t}return e}function Ab(e,t){e[t]=rc(e[t])}function Eb(e,t){return Pb(t)?e:Pb(e)?t:`${e} ${t}`}function Tb(e,t){for(const n in t)e[n]?e[n].push(...t[n]):e[n]=t[n]}function Sb(e,t){if(t.attributes&&(e.attributes||(e.attributes={}),Tb(e.attributes,t.attributes)),t.eventListeners&&(e.eventListeners||(e.eventListeners={}),Tb(e.eventListeners,t.eventListeners)),t.text&&e.text.push(...t.text),t.children&&t.children.length){if(e.children.length!=t.children.length)throw new Aa("ui-template-extend-children-mismatch",e);let n=0;for(const i of t.children)Sb(e.children[n++],i)}}function Pb(e){return!e&&0!==e}function Ib(e){return e instanceof Lb}function Ob(e){return e instanceof gb}function Vb(e){return e instanceof mb}function Rb(e){return or(e[0])&&e[0].ns}function Nb(e){return"class"==e||"style"==e}class Lb extends(dl(Ga())){element;isRendered;locale;t;template;_viewCollections;_unboundChildren;_bindTemplate;constructor(e){super(),this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new oc,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",((t,n)=>{n.locale=e,n.t=e&&e.t})),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=gb.bind(this,this)}createCollection(e){const t=new mb(e);return this._viewCollections.add(t),t}registerChild(e){nl(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t)}deregisterChild(e){nl(e)||(e=[e]);for(const t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new gb(e)}extendTemplate(e){gb.extend(this.template,e)}render(){if(this.isRendered)throw new Aa("ui-view-render-already-rendered",this);this.template&&(this.element=this.template.render(),this.registerChild(this.template.getViews())),this.isRendered=!0}destroy(){this.stopListening(),this._viewCollections.map((e=>e.destroy())),this.template&&this.template._revertData&&this.template.revert(this.element)}}function Mb({emitter:e,activator:t,callback:n,contextElements:i,listenerOptions:r}){e.listenTo(document,"mousedown",((e,r)=>{if(!t())return;const s="function"==typeof r.composedPath?r.composedPath():[],o="function"==typeof i?i():i;for(const e of o)if(e.contains(r.target)||s.includes(e))return;n()}),r)}function Bb(e){return class extends e{disableCssTransitions(){this._isCssTransitionsDisabled=!0}enableCssTransitions(){this._isCssTransitionsDisabled=!1}constructor(...e){super(...e),this.set("_isCssTransitionsDisabled",!1),this.initializeCssTransitionDisablerMixin()}initializeCssTransitionDisablerMixin(){this.extendTemplate({attributes:{class:[this.bindTemplate.if("_isCssTransitionsDisabled","ck-transitions-disabled")]}})}}}function Fb({view:e}){e.listenTo(e.element,"submit",((t,n)=>{n.preventDefault(),e.fire("submit")}),{useCapture:!0})}function Db({keystrokeHandler:e,focusTracker:t,gridItems:n,numberOfColumns:i,uiLanguageDirection:r}){const s="number"==typeof i?()=>i:i;function o(e){return i=>{const r=n.find((e=>e.element===t.focusedElement)),s=n.getIndex(r),o=e(s,n);n.get(o).focus(),i.stopPropagation(),i.preventDefault()}}function a(e,t){return e===t-1?0:e+1}function l(e,t){return 0===e?t-1:e-1}e.set("arrowright",o(((e,t)=>"rtl"===r?l(e,t.length):a(e,t.length)))),e.set("arrowleft",o(((e,t)=>"rtl"===r?a(e,t.length):l(e,t.length)))),e.set("arrowup",o(((e,t)=>{let n=e-s();return n<0&&(n=e+s()*Math.floor(t.length/s()),n>t.length-1&&(n-=s())),n}))),e.set("arrowdown",o(((e,t)=>{let n=e+s();return n>t.length-1&&(n=e%s()),n})))}class zb extends Lb{static presentationalAttributeNames=["alignment-baseline","baseline-shift","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-rendering","cursor","direction","display","dominant-baseline","fill","fill-opacity","fill-rule","filter","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","mask","opacity","overflow","paint-order","pointer-events","shape-rendering","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-overflow","text-rendering","transform","unicode-bidi","vector-effect","visibility","white-space","word-spacing","writing-mode"];constructor(){super();const e=this.bindTemplate;this.set("content",""),this.set("viewBox","0 0 20 20"),this.set("fillColor",""),this.set("isColorInherited",!0),this.set("isVisible",!0),this.setTemplate({tag:"svg",ns:"http://www.w3.org/2000/svg",attributes:{class:["ck","ck-icon",e.if("isVisible","ck-hidden",(e=>!e)),"ck-reset_all-excluded",e.if("isColorInherited","ck-icon_inherit-color")],viewBox:e.to("viewBox"),"aria-hidden":!0}})}render(){super.render(),this._updateXMLContent(),this._colorFillPaths(),this.on("change:content",(()=>{this._updateXMLContent(),this._colorFillPaths()})),this.on("change:fillColor",(()=>{this._colorFillPaths()}))}_updateXMLContent(){if(this.content){const e=(new DOMParser).parseFromString(this.content.trim(),"image/svg+xml").querySelector("svg"),t=e.getAttribute("viewBox");t&&(this.viewBox=t);for(const{name:t,value:n}of Array.from(e.attributes))zb.presentationalAttributeNames.includes(t)&&this.element.setAttribute(t,n);for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(;e.childNodes.length>0;)this.element.appendChild(e.childNodes[0])}}_colorFillPaths(){this.fillColor&&this.element.querySelectorAll(".ck-icon__fill").forEach((e=>{e.style.fill=this.fillColor}))}}class $b extends Lb{constructor(){super(),this.set({style:void 0,text:void 0,id:void 0});const e=this.bindTemplate;this.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:e.to("style"),id:e.to("id")},children:[{text:e.to("text")}]})}}class jb extends Lb{children;labelView;iconView;keystrokeView;_focusDelayed=null;constructor(e,t=new $b){super(e);const n=this.bindTemplate,i=ka();this.set("_ariaPressed",!1),this.set("_ariaChecked",!1),this.set("ariaLabel",void 0),this.set("ariaLabelledBy",`ck-editor__aria-label_${i}`),this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isVisible",!0),this.set("isToggleable",!1),this.set("keystroke",void 0),this.set("label",void 0),this.set("role",void 0),this.set("tabindex",-1),this.set("tooltip",!1),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.set("withKeystroke",!1),this.children=this.createCollection(),this.labelView=this._setupLabelView(t),this.iconView=new zb,this.iconView.extendTemplate({attributes:{class:"ck-button__icon"}}),this.keystrokeView=this._createKeystrokeView(),this.bind("_tooltipString").to(this,"tooltip",this,"label",this,"keystroke",this._getTooltipString.bind(this));const r={tag:"button",attributes:{class:["ck","ck-button",n.to("class"),n.if("isEnabled","ck-disabled",(e=>!e)),n.if("isVisible","ck-hidden",(e=>!e)),n.to("isOn",(e=>e?"ck-on":"ck-off")),n.if("withText","ck-button_with-text"),n.if("withKeystroke","ck-button_with-keystroke")],role:n.to("role"),type:n.to("type",(e=>e||"button")),tabindex:n.to("tabindex"),"aria-checked":n.to("_ariaChecked"),"aria-pressed":n.to("_ariaPressed"),"aria-label":n.to("ariaLabel"),"aria-labelledby":n.to("ariaLabelledBy"),"aria-disabled":n.if("isEnabled",!0,(e=>!e)),"data-cke-tooltip-text":n.to("_tooltipString"),"data-cke-tooltip-position":n.to("tooltipPosition")},children:this.children,on:{click:n.to((e=>{this.isEnabled?this.fire("execute"):e.preventDefault()}))}};this.bind("_ariaPressed").to(this,"isOn",this,"isToggleable",this,"role",((e,t,n)=>!(!t||Hb(n))&&String(!!e))),this.bind("_ariaChecked").to(this,"isOn",this,"isToggleable",this,"role",((e,t,n)=>!(!t||!Hb(n))&&String(!!e))),aa.isSafari&&(this._focusDelayed||(this._focusDelayed=pc((()=>this.focus()),0)),r.on.mousedown=n.to((()=>{this._focusDelayed()})),r.on.mouseup=n.to((()=>{this._focusDelayed.cancel()}))),this.setTemplate(r)}render(){super.render(),this.icon&&(this.iconView.bind("content").to(this,"icon"),this.children.add(this.iconView)),this.children.add(this.labelView),this.withKeystroke&&this.keystroke&&this.children.add(this.keystrokeView)}focus(){this.element.focus()}destroy(){this._focusDelayed&&this._focusDelayed.cancel(),super.destroy()}_setupLabelView(e){return e.bind("text","style","id").to(this,"label","labelStyle","ariaLabelledBy"),e}_createKeystrokeView(){const e=new Lb;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",(e=>Xl(e)))}]}),e}_getTooltipString(e,t,n){return e?"string"==typeof e?e:(n&&(n=Xl(n)),e instanceof Function?e(t,n):`${t}${n?` (${n})`:""}`):""}}function Hb(e){switch(e){case"radio":case"checkbox":case"option":case"switch":case"menuitemcheckbox":case"menuitemradio":return!0;default:return!1}}class Wb extends Lb{children;iconView;constructor(e,t={}){super(e);const n=this.bindTemplate;this.set("label",t.label||""),this.set("class",t.class||null),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__header",n.to("class")]},children:this.children}),t.icon&&(this.iconView=new zb,this.iconView.content=t.icon,this.children.add(this.iconView));const i=new Lb(e);i.setTemplate({tag:"h2",attributes:{class:["ck","ck-form__header__label"],role:"presentation"},children:[{text:n.to("label")}]}),this.children.add(i)}}class Ub extends(Na()){focusables;focusTracker;keystrokeHandler;actions;constructor(e){if(super(),this.focusables=e.focusables,this.focusTracker=e.focusTracker,this.keystrokeHandler=e.keystrokeHandler,this.actions=e.actions,e.actions&&e.keystrokeHandler)for(const t in e.actions){let n=e.actions[t];"string"==typeof n&&(n=[n]);for(const i of n)e.keystrokeHandler.set(i,((e,n)=>{this[t](),n()}),e.keystrokeHandlerOptions)}this.on("forwardCycle",(()=>this.focusFirst()),{priority:"low"}),this.on("backwardCycle",(()=>this.focusLast()),{priority:"low"})}get first(){return this.focusables.find(qb)||null}get last(){return this.focusables.filter(qb).slice(-1)[0]||null}get next(){return this._getDomFocusableItem(1)}get previous(){return this._getDomFocusableItem(-1)}get current(){let e=null;return null===this.focusTracker.focusedElement?null:(this.focusables.find(((t,n)=>{const i=t.element===this.focusTracker.focusedElement;return i&&(e=n),i})),e)}focusFirst(){this._focus(this.first,1)}focusLast(){this._focus(this.last,-1)}focusNext(){const e=this.next;e&&this.focusables.getIndex(e)===this.current||e===this.first?this.fire("forwardCycle"):this._focus(e,1)}focusPrevious(){const e=this.previous;e&&this.focusables.getIndex(e)===this.current||e===this.last?this.fire("backwardCycle"):this._focus(e,-1)}chain(e){const t=()=>null===this.current?null:this.focusables.get(this.current);this.listenTo(e,"forwardCycle",(e=>{const n=t();this.focusNext(),n!==t()&&e.stop()}),{priority:"low"}),this.listenTo(e,"backwardCycle",(e=>{const n=t();this.focusPrevious(),n!==t()&&e.stop()}),{priority:"low"})}unchain(e){this.stopListening(e)}_focus(e,t){e&&this.focusTracker.focusedElement!==e.element&&e.focus(t)}_getDomFocusableItem(e){const t=this.focusables.length;if(!t)return null;const n=this.current;if(null===n)return this[1===e?"first":"last"];let i=this.focusables.get(n),r=(n+t+e)%t;do{const n=this.focusables.get(r);if(qb(n)){i=n;break}r=(r+t+e)%t}while(r!==n);return i}}function qb(e){return Gb(e)&&Ol(e.element)}function Gb(e){return!(!("focus"in e)||"function"!=typeof e.focus)}function Kb(e){return class extends e{_onDragBound=this._onDrag.bind(this);_onDragEndBound=this._onDragEnd.bind(this);_lastDraggingCoordinates={x:0,y:0};constructor(...e){super(...e),this.on("render",(()=>{this._attachListeners()})),this.set("isDragging",!1)}_attachListeners(){this.listenTo(this.element,"mousedown",this._onDragStart.bind(this)),this.listenTo(this.element,"touchstart",this._onDragStart.bind(this))}_attachDragListeners(){this.listenTo(ra.document,"mouseup",this._onDragEndBound),this.listenTo(ra.document,"touchend",this._onDragEndBound),this.listenTo(ra.document,"mousemove",this._onDragBound),this.listenTo(ra.document,"touchmove",this._onDragBound)}_detachDragListeners(){this.stopListening(ra.document,"mouseup",this._onDragEndBound),this.stopListening(ra.document,"touchend",this._onDragEndBound),this.stopListening(ra.document,"mousemove",this._onDragBound),this.stopListening(ra.document,"touchmove",this._onDragBound)}_onDragStart(e,t){if(!this._isHandleElementPressed(t))return;this._attachDragListeners();let n=0,i=0;t instanceof MouseEvent?(n=t.clientX,i=t.clientY):(n=t.touches[0].clientX,i=t.touches[0].clientY),this._lastDraggingCoordinates={x:n,y:i},this.isDragging=!0}_onDrag(e,t){if(!this.isDragging)return void this._detachDragListeners();let n=0,i=0;t instanceof MouseEvent?(n=t.clientX,i=t.clientY):(n=t.touches[0].clientX,i=t.touches[0].clientY),t.preventDefault(),this.fire("drag",{deltaX:Math.round(n-this._lastDraggingCoordinates.x),deltaY:Math.round(i-this._lastDraggingCoordinates.y)}),this._lastDraggingCoordinates={x:n,y:i}}_onDragEnd(){this._detachDragListeners(),this.isDragging=!1}_isHandleElementPressed(e){return!!this.dragHandleElement&&(this.dragHandleElement===e.target||e.target instanceof HTMLElement&&this.dragHandleElement.contains(e.target))}}}class Zb extends Lb{children;keystrokes;focusCycler;_focusTracker;_focusables;constructor(e){super(e),this.children=this.createCollection(),this.keystrokes=new hc,this._focusTracker=new lc,this._focusables=new mb,this.focusCycler=new Ub({focusables:this._focusables,focusTracker:this._focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog__actions"]},children:this.children})}render(){super.render(),this.keystrokes.listenTo(this.element)}setButtons(e){for(const t of e){const e=new jb(this.locale);let n;for(n in e.on("execute",(()=>t.onExecute())),t.onCreate&&t.onCreate(e),t)"onExecute"!=n&&"onCreate"!=n&&e.set(n,t[n]);this.children.add(e)}this._updateFocusCyclableItems()}focus(e){-1===e?this.focusCycler.focusLast():this.focusCycler.focusFirst()}_updateFocusCyclableItems(){Array.from(this.children).forEach((e=>{this._focusables.add(e),this._focusTracker.add(e.element)}))}}class Qb extends Lb{children;constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog__content"]},children:this.children})}reset(){for(;this.children.length;)this.children.remove(0)}}const Yb="screen-center",Jb="editor-center",Xb="editor-top-side",ew=El("px");class tw extends(Kb(Lb)){parts;headerView;closeButtonView;actionsView;static defaultOffset=15;contentView;keystrokes;focusTracker;wasMoved=!1;_getCurrentDomRoot;_getViewportOffset;_focusables;_focusCycler;constructor(e,{getCurrentDomRoot:t,getViewportOffset:n,keystrokeHandlerOptions:i}){super(e);const r=this.bindTemplate,s=e.t;this.set("className",""),this.set("ariaLabel",s("Editor dialog")),this.set("isModal",!1),this.set("position",Yb),this.set("_isVisible",!1),this.set("_isTransparent",!1),this.set("_top",0),this.set("_left",0),this._getCurrentDomRoot=t,this._getViewportOffset=n,this.decorate("moveTo"),this.parts=this.createCollection(),this.keystrokes=new hc,this.focusTracker=new lc,this._focusables=new mb,this._focusCycler=new Ub({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"},keystrokeHandlerOptions:i}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog-overlay",r.if("isModal","ck-dialog-overlay__transparent",(e=>!e)),r.if("_isVisible","ck-hidden",(e=>!e))],tabindex:"-1"},children:[{tag:"div",attributes:{tabindex:"-1",class:["ck","ck-dialog",r.if("isModal","ck-dialog_modal"),r.to("className")],role:"dialog","aria-label":r.to("ariaLabel"),style:{top:r.to("_top",(e=>ew(e))),left:r.to("_left",(e=>ew(e))),visibility:r.if("_isTransparent","hidden")}},children:this.parts}]})}render(){super.render(),this.keystrokes.set("Esc",((e,t)=>{e.defaultPrevented||(this.fire("close",{source:"escKeyPress"}),t())})),this.on("drag",((e,{deltaX:t,deltaY:n})=>{this.wasMoved=!0,this.moveBy(t,n)})),this.listenTo(ra.window,"resize",(()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()})),this.listenTo(ra.document,"scroll",(()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()})),this.on("change:_isVisible",((e,t,n)=>{n&&(this._isTransparent=!0,setTimeout((()=>{this.updatePosition(),this._isTransparent=!1,this.focus()}),10))})),this.keystrokes.listenTo(this.element)}get dragHandleElement(){return this.headerView&&!this.isModal?this.headerView.element:null}setupParts({icon:e,title:t,hasCloseButton:n=!0,content:i,actionButtons:r}){t&&(this.headerView=new Wb(this.locale,{icon:e}),n&&(this.closeButtonView=this._createCloseButton(),this.headerView.children.add(this.closeButtonView)),this.headerView.label=t,this.ariaLabel=t,this.parts.add(this.headerView,0)),i&&(i instanceof Lb&&(i=[i]),this.contentView=new Qb(this.locale),this.contentView.children.addMany(i),this.parts.add(this.contentView)),r&&(this.actionsView=new Zb(this.locale),this.actionsView.setButtons(r),this.parts.add(this.actionsView)),this._updateFocusCyclableItems()}focus(){this._focusCycler.focusFirst()}moveTo(e,t){const n=this._getViewportRect(),i=this._getDialogRect();e+i.width>n.right&&(e=n.right-i.width),e<n.left&&(e=n.left),t<n.top&&(t=n.top),this._moveTo(e,t)}_moveTo(e,t){this._left=e,this._top=t}moveBy(e,t){this.moveTo(this._left+e,this._top+t)}_moveOffScreen(){this._moveTo(-9999,-9999)}updatePosition(){if(!this.element||!this.element.parentNode)return;const e=this._getViewportRect();let t,n=this.position;this._getCurrentDomRoot()?t=this._getVisibleDomRootRect(e):n=Yb;const i=tw.defaultOffset,r=this._getDialogRect();switch(n){case Xb:if(t){const e="ltr"===this.locale.contentLanguageDirection?t.right-r.width-i:t.left+i;this.moveTo(e,t.top+i)}else this._moveOffScreen();break;case Jb:t?this.moveTo(Math.round(t.left+t.width/2-r.width/2),Math.round(t.top+t.height/2-r.height/2)):this._moveOffScreen();break;case Yb:this.moveTo(Math.round((e.width-r.width)/2),Math.round((e.height-r.height)/2));break;case"editor-top-center":t?this.moveTo(Math.round(t.left+t.width/2-r.width/2),t.top+i):this._moveOffScreen();break;case"editor-bottom-center":t?this.moveTo(Math.round(t.left+t.width/2-r.width/2),t.bottom-r.height-i):this._moveOffScreen();break;case"editor-above-center":t?this.moveTo(Math.round(t.left+t.width/2-r.width/2),t.top-r.height-i):this._moveOffScreen();break;case"editor-below-center":t?this.moveTo(Math.round(t.left+t.width/2-r.width/2),t.bottom+i):this._moveOffScreen()}}_getVisibleDomRootRect(e){let t=new vl(this._getCurrentDomRoot()).getVisible();return t?(t=e.getIntersection(t),t||null):null}_getDialogRect(){return new vl(this.element.firstElementChild)}_getViewportRect(){const e=new vl(ra.window);if(this.isModal)return e;const t={top:0,bottom:0,left:0,right:0,...this._getViewportOffset()};return e.top+=t.top,e.height-=t.top,e.bottom-=t.bottom,e.height-=t.bottom,e.left+=t.left,e.right-=t.right,e.width-=t.left+t.right,e}_updateFocusCyclableItems(){const e=[];if(this.contentView)for(const t of this.contentView.children)Gb(t)&&e.push(t);this.actionsView&&e.push(this.actionsView),this.closeButtonView&&e.push(this.closeButtonView),e.forEach((e=>{var t;this._focusables.add(e),this.focusTracker.add(e.element),Gb(t=e)&&"focusCycler"in t&&t.focusCycler instanceof Ub&&this._focusCycler.chain(e.focusCycler)}))}_createCloseButton(){const e=new jb(this.locale),t=this.locale.t;return e.set({label:t("Close"),tooltip:!0,icon:Pf.cancel}),e.on("execute",(()=>this.fire("close",{source:"closeButton"}))),e}}class nw extends cf{view;static _visibleDialogPlugin;_onHide;static get pluginName(){return"Dialog"}static get isOfficialPlugin(){return!0}constructor(e){super(e);const t=e.t;this._initShowHideListeners(),this._initFocusToggler(),this._initMultiRootIntegration(),this.set({id:null,isOpen:!1}),e.accessibility.addKeystrokeInfos({categoryId:"navigation",keystrokes:[{label:t("Move focus in and out of an active dialog window"),keystroke:"Ctrl+F6",mayRequireFn:!0}]})}destroy(){super.destroy(),nw._visibleDialogPlugin===this&&this._unlockBodyScroll()}_initShowHideListeners(){this.on("show",((e,t)=>{this._show(t)})),this.on("show",((e,t)=>{t.onShow&&t.onShow(this)}),{priority:"low"}),this.on("hide",(()=>{nw._visibleDialogPlugin&&nw._visibleDialogPlugin._hide()})),this.on("hide",(()=>{this._onHide&&(this._onHide(this),this._onHide=void 0)}),{priority:"low"})}_initFocusToggler(){const e=this.editor;e.keystrokes.set("Ctrl+F6",((t,n)=>{this.isOpen&&!this.view.isModal&&(this.view.focusTracker.isFocused?e.editing.view.focus():this.view.focus(),n())}))}_initMultiRootIntegration(){const e=this.editor.model;e.document.on("change:data",(()=>{if(!this.view)return;const t=e.document.differ.getChangedRoots();for(const e of t)e.state&&this.view.updatePosition()}))}show(e){this.hide(),this.fire(`show:${e.id}`,e)}_show({id:e,icon:t,title:n,hasCloseButton:i=!0,content:r,actionButtons:s,className:o,isModal:a,position:l,onHide:c,keystrokeHandlerOptions:d}){const u=this.editor;this.view=new tw(u.locale,{getCurrentDomRoot:()=>u.editing.view.getDomRoot(u.model.document.selection.anchor.root.rootName),getViewportOffset:()=>u.ui.viewportOffset,keystrokeHandlerOptions:d});const h=this.view;h.on("close",(()=>{this.hide()})),u.ui.view.body.add(h),u.keystrokes.listenTo(h.element),l||(l=a?Yb:Jb),a&&this._lockBodyScroll(),h.set({position:l,_isVisible:!0,className:o,isModal:a}),h.setupParts({icon:t,title:n,hasCloseButton:i,content:r,actionButtons:s}),this.id=e,c&&(this._onHide=c),this.isOpen=!0,nw._visibleDialogPlugin=this}hide(){nw._visibleDialogPlugin&&nw._visibleDialogPlugin.fire(`hide:${nw._visibleDialogPlugin.id}`)}_hide(){if(!this.view)return;const e=this.editor,t=this.view;t.isModal&&this._unlockBodyScroll(),t.contentView&&t.contentView.reset(),e.ui.view.body.remove(t),e.ui.focusTracker.remove(t.element),e.keystrokes.stopListening(t.element),t.destroy(),e.editing.view.focus(),this.id=null,this.isOpen=!1,nw._visibleDialogPlugin=null}_lockBodyScroll(){document.documentElement.classList.add("ck-dialog-scroll-locked")}_unlockBodyScroll(){document.documentElement.classList.remove("ck-dialog-scroll-locked")}}class iw extends jb{_checkIconHolderView=new rw;constructor(e,t=new $b){super(e,t),this.set({hasCheckSpace:!1,_hasCheck:this.isToggleable});const n=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-list-item-button",n.if("isToggleable","ck-list-item-button_toggleable")]}}),this.bind("_hasCheck").to(this,"hasCheckSpace",this,"isToggleable",((e,t)=>e||t))}render(){super.render(),this._hasCheck&&this.children.add(this._checkIconHolderView,0),this._watchCheckIconHolderMount()}_watchCheckIconHolderMount(){this._checkIconHolderView.bind("isOn").to(this,"isOn",(e=>this.isToggleable&&e)),this.on("change:_hasCheck",((e,t,n)=>{const{children:i,_checkIconHolderView:r}=this;n?i.add(r,0):i.remove(r)}))}}class rw extends Lb{children;_checkIconView=this._createCheckIconView();constructor(){super();const e=this.bindTemplate;this.children=this.createCollection(),this.set("isOn",!1),this.setTemplate({tag:"span",children:this.children,attributes:{class:["ck","ck-list-item-button__check-holder",e.to("isOn",(e=>e?"ck-on":"ck-off"))]}})}render(){super.render(),this.isOn&&this.children.add(this._checkIconView,0),this._watchCheckIconMount()}_watchCheckIconMount(){this.on("change:isOn",((e,t,n)=>{const{children:i,_checkIconView:r}=this;n&&!i.has(r)?i.add(r):!n&&i.has(r)&&i.remove(r)}))}_createCheckIconView(){const e=new zb;return e.content=Pf.check,e.extendTemplate({attributes:{class:"ck-list-item-button__check-icon"}}),e}}class sw extends iw{constructor(e){super(e),this.set({withText:!0,withKeystroke:!0,tooltip:!1,role:"menuitem"}),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item__button"]}})}}class ow extends Lb{id;constructor(e){super(e),this.set("text",void 0),this.set("for",void 0),this.id=`ck-editor__label_${ka()}`;const t=this.bindTemplate;this.setTemplate({tag:"label",attributes:{class:["ck","ck-label"],id:this.id,for:t.to("for")},children:[{text:t.to("text")}]})}}class aw extends Lb{constructor(e,t){super(e);const n=e.t,i=new ow;i.text=n("Help Contents. To close this dialog press ESC."),this.setTemplate({tag:"div",attributes:{class:["ck","ck-accessibility-help-dialog__content"],"aria-labelledby":i.id,role:"document",tabindex:-1},children:[il(document,"p",{},n("Below, you can find a list of keyboard shortcuts that can be used in the editor.")),...this._createCategories(Array.from(t.values())),i]})}focus(){this.element.focus()}_createCategories(e){return e.map((e=>{const t=[il(document,"h3",{},e.label),...Array.from(e.groups.values()).map((e=>this._createGroup(e))).flat()];return e.description&&t.splice(1,0,il(document,"p",{},e.description)),il(document,"section",{},t)}))}_createGroup(e){const t=e.keystrokes.sort(((e,t)=>e.label.localeCompare(t.label))).map((e=>this._createGroupRow(e))).flat(),n=[il(document,"dl",{},t)];return e.label&&n.unshift(il(document,"h4",{},e.label)),n}_createGroupRow(e){const t=this.locale.t,n=il(document,"dt"),i=il(document,"dd"),r="string"==typeof(o=e.keystroke)?[[o]]:"string"==typeof o[0]?[o]:o,s=[];var o;for(const e of r)s.push(e.map(lw).join(""));return n.innerHTML=e.label,i.innerHTML=s.join(", ")+(e.mayRequireFn&&aa.isMac?` ${t("(may require <kbd>Fn</kbd>)")}`:""),[n,i]}}function lw(e){return Xl(e).split("+").map((e=>`<kbd>${e}</kbd>`)).join("+")}var cw='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 6.628a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"/><path d="M8.5 9.125a.3.3 0 0 0-.253-.296L5.11 8.327a.75.75 0 1 1 .388-1.449l4.04.716c.267.072.624.08.893.009l4.066-.724a.75.75 0 1 1 .388 1.45l-3.132.5a.3.3 0 0 0-.253.296v1.357a.3.3 0 0 0 .018.102l1.615 4.438a.75.75 0 0 1-1.41.513l-1.35-3.71a.3.3 0 0 0-.281-.197h-.209a.3.3 0 0 0-.282.198l-1.35 3.711a.75.75 0 0 1-1.41-.513l1.64-4.509a.3.3 0 0 0 .019-.103V9.125Z"/><path clip-rule="evenodd" d="M10 18.5a8.5 8.5 0 1 1 0-17 8.5 8.5 0 0 1 0 17Zm0 1.5c5.523 0 10-4.477 10-10S15.523 0 10 0 0 4.477 0 10s4.477 10 10 10Z"/></svg>';class dw extends cf{contentView=null;static get requires(){return[nw]}static get pluginName(){return"AccessibilityHelp"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.locale.t;e.ui.componentFactory.add("accessibilityHelp",(()=>{const e=this._createButton(jb);return e.set({tooltip:!0,withText:!1,label:t("Accessibility help")}),e})),e.ui.componentFactory.add("menuBar:accessibilityHelp",(()=>{const e=this._createButton(sw);return e.label=t("Accessibility"),e})),e.keystrokes.set("Alt+0",((e,t)=>{this._toggleDialog(),t()})),this._setupRootLabels()}_createButton(e){const t=this.editor,n=t.plugins.get("Dialog"),i=new e(t.locale);return i.set({keystroke:"Alt+0",icon:cw,isToggleable:!0}),i.on("execute",(()=>this._toggleDialog())),i.bind("isOn").to(n,"id",(e=>"accessibilityHelp"===e)),i}_setupRootLabels(){const e=this.editor,t=e.editing.view,n=e.t;function i(e,t){const i=[t.getAttribute("aria-label"),n("Press %0 for help.",[Xl("Alt+0")])].filter((e=>e)).join(". ");e.setAttribute("aria-label",i,t)}e.ui.on("ready",(()=>{t.change((e=>{for(const n of t.document.roots)i(e,n)})),e.on("addRoot",((n,r)=>{const s=e.editing.view.document.getRoot(r.rootName);t.change((e=>i(e,s)))}),{priority:"low"})}))}_toggleDialog(){const e=this.editor,t=e.plugins.get("Dialog"),n=e.locale.t;this.contentView||(this.contentView=new aw(e.locale,e.accessibility.keystrokeInfos)),"accessibilityHelp"===t.id?t.hide():t.show({id:"accessibilityHelp",className:"ck-accessibility-help-dialog",title:n("Accessibility help"),icon:cw,hasCloseButton:!0,content:this.contentView})}}class uw extends mb{locale;_bodyCollectionContainer;static _bodyWrapper;constructor(e,t=[]){super(t),this.locale=e}get bodyCollectionContainer(){return this._bodyCollectionContainer}attachToDom(){this._bodyCollectionContainer=new gb({tag:"div",attributes:{class:["ck","ck-reset_all","ck-body","ck-rounded-corners"],dir:this.locale.uiLanguageDirection,role:"application"},children:this}).render(),uw._bodyWrapper&&uw._bodyWrapper.isConnected||(uw._bodyWrapper=il(document,"div",{class:"ck-body-wrapper"}),document.body.appendChild(uw._bodyWrapper)),uw._bodyWrapper.appendChild(this._bodyCollectionContainer)}detachFromDom(){super.destroy(),this._bodyCollectionContainer&&this._bodyCollectionContainer.remove(),uw._bodyWrapper&&!uw._bodyWrapper.childElementCount&&(uw._bodyWrapper.remove(),delete uw._bodyWrapper)}}class hw extends jb{toggleSwitchView;constructor(e){super(e),this.isToggleable=!0,this.toggleSwitchView=this._createToggleView(),this.extendTemplate({attributes:{class:"ck-switchbutton"}})}render(){super.render(),this.children.add(this.toggleSwitchView)}_createToggleView(){const e=new Lb;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}class mw extends(pw(jb)){}class gw extends(pw(iw)){}function pw(e){return class extends e{buttonView;_fileInputView;constructor(...e){super(...e),this.buttonView=this,this._fileInputView=new fw(this.locale),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.on("execute",(()=>{this._fileInputView.open()})),this.extendTemplate({attributes:{class:"ck-file-dialog-button"}})}render(){super.render(),this.children.add(this._fileInputView)}}}class fw extends Lb{constructor(e){super(e),this.set("acceptedType",void 0),this.set("allowMultipleFiles",!1);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:t.to("acceptedType"),multiple:t.to("allowMultipleFiles")},on:{change:t.to((()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""}))}})}open(){this.element.click()}}var bw='<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"><path d="M.941 4.523a.75.75 0 1 1 1.06-1.06l3.006 3.005 3.005-3.005a.75.75 0 1 1 1.06 1.06l-3.549 3.55a.75.75 0 0 1-1.168-.136L.941 4.523z"/></svg>';class ww extends Lb{buttonView;children;constructor(e,t){super(e);const n=this.bindTemplate;this.set("isCollapsed",!1),this.set("label",""),this.buttonView=this._createButtonView(),this.children=this.createCollection(),this.set("_collapsibleAriaLabelUid",void 0),t&&this.children.addMany(t),this.setTemplate({tag:"div",attributes:{class:["ck","ck-collapsible",n.if("isCollapsed","ck-collapsible_collapsed")]},children:[this.buttonView,{tag:"div",attributes:{class:["ck","ck-collapsible__children"],role:"region",hidden:n.if("isCollapsed","hidden"),"aria-labelledby":n.to("_collapsibleAriaLabelUid")},children:this.children}]})}render(){super.render(),this._collapsibleAriaLabelUid=this.buttonView.labelView.element.id}focus(){this.buttonView.focus()}_createButtonView(){const e=new jb(this.locale),t=e.bindTemplate;return e.set({withText:!0,icon:bw}),e.extendTemplate({attributes:{"aria-expanded":t.to("isOn",(e=>String(e)))}}),e.bind("label").to(this),e.bind("isOn").to(this,"isCollapsed",(e=>!e)),e.on("execute",(()=>{this.isCollapsed=!this.isCollapsed})),e}}function vw(e,t){const n=e.t,i={Black:n("Black"),"Dim grey":n("Dim grey"),Grey:n("Grey"),"Light grey":n("Light grey"),White:n("White"),Red:n("Red"),Orange:n("Orange"),Yellow:n("Yellow"),"Light green":n("Light green"),Green:n("Green"),Aquamarine:n("Aquamarine"),Turquoise:n("Turquoise"),"Light blue":n("Light blue"),Blue:n("Blue"),Purple:n("Purple")};return t.map((e=>{const t=i[e.label];return t&&t!=e.label&&(e.label=t),e}))}function yw(e){return e.map(_w).filter((e=>!!e))}function _w(e){return"string"==typeof e?{model:e,label:e,hasBorder:!1,view:{name:"span",styles:{color:e}}}:{model:e.color,label:e.label||e.color,hasBorder:void 0!==e.hasBorder&&e.hasBorder,view:{name:"span",styles:{color:`${e.color}`}}}}class kw extends jb{constructor(e){super(e);const t=this.bindTemplate;this.set("color",void 0),this.set("hasBorder",!1),this.icon='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M16.935 5.328a2 2 0 0 1 0 2.829l-7.778 7.778a2 2 0 0 1-2.829 0L3.5 13.107a1.999 1.999 0 1 1 2.828-2.829l.707.707a1 1 0 0 0 1.414 0l5.658-5.657a2 2 0 0 1 2.828 0z"/><path d="M14.814 6.035 8.448 12.4a1 1 0 0 1-1.414 0l-1.413-1.415A1 1 0 1 0 4.207 12.4l2.829 2.829a1 1 0 0 0 1.414 0l7.778-7.778a1 1 0 1 0-1.414-1.415z"/></svg>',this.extendTemplate({attributes:{style:{backgroundColor:t.to("color",(e=>aa.isMediaForcedColors?null:e))},class:["ck","ck-color-grid__tile",t.if("hasBorder","ck-color-selector__color-tile_bordered")]}})}render(){super.render(),this.iconView.fillColor="hsl(0, 0%, 100%)"}}class xw extends Lb{columns;items;focusTracker;keystrokes;constructor(e,t){super(e);const n=t&&t.colorDefinitions?t.colorDefinitions:[];this.columns=t&&t.columns?t.columns:5;const i={gridTemplateColumns:`repeat( ${this.columns}, 1fr)`};this.set("selectedColor",void 0),this.items=this.createCollection(),this.focusTracker=new lc,this.keystrokes=new hc,this.items.on("add",((e,t)=>{t.isOn=t.color===this.selectedColor})),n.forEach((e=>{const t=new kw;t.set({color:e.color,label:e.label,tooltip:!0,hasBorder:e.options.hasBorder}),t.on("execute",(()=>{this.fire("execute",{value:e.color,hasBorder:e.options.hasBorder,label:e.label})})),this.items.add(t)})),this.setTemplate({tag:"div",children:this.items,attributes:{class:["ck","ck-color-grid"],style:i}}),this.on("change:selectedColor",((e,t,n)=>{for(const e of this.items)e.isOn=e.color===n}))}focus(){this.items.length&&this.items.first.focus()}focusLast(){this.items.length&&this.items.last.focus()}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",((e,t)=>{this.focusTracker.add(t.element)})),this.items.on("remove",((e,t)=>{this.focusTracker.remove(t.element)})),this.keystrokes.listenTo(this.element),Db({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:this.columns,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}}function Cw(e,t){if(!e)return"";const n=Aw(e);if(!n)return"";if(n.space===t)return e;if(i=n,!Object.keys($f).includes(i.space))return"";var i;const r=$f[n.space][t];return r?function(e,t){switch(t){case"hex":return`#${e}`;case"rgb":return`rgb(${e[0]}, ${e[1]}, ${e[2]})`;case"hsl":return`hsl(${e[0]}, ${e[1]}%, ${e[2]}%)`;case"hwb":return`hwb(${e[0]}, ${e[1]}, ${e[2]})`;case"lab":return`lab(${e[0]}% ${e[1]} ${e[2]})`;case"lch":return`lch(${e[0]}% ${e[1]} ${e[2]})`;default:return""}}(r("hex"===n.space?n.hexValue:n.values),t):""}function Aw(e){if(e.startsWith("#")){const t=Ff(e);return{space:"hex",values:t.values,hexValue:e,alpha:t.alpha}}const t=Ff(e);return t.space?t:null}class Ew extends Lb{fieldView;labelView;statusView;fieldWrapperChildren;constructor(e,t){super(e);const n=`ck-labeled-field-view-${ka()}`,i=`ck-labeled-field-view-status-${ka()}`;this.fieldView=t(this,n,i),this.set("label",void 0),this.set("isEnabled",!0),this.set("isEmpty",!0),this.set("isFocused",!1),this.set("errorText",null),this.set("infoText",null),this.set("class",void 0),this.set("placeholder",void 0),this.labelView=this._createLabelView(n),this.statusView=this._createStatusView(i),this.fieldWrapperChildren=this.createCollection([this.fieldView,this.labelView]),this.bind("_statusText").to(this,"errorText",this,"infoText",((e,t)=>e||t));const r=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view",r.to("class"),r.if("isEnabled","ck-disabled",(e=>!e)),r.if("isEmpty","ck-labeled-field-view_empty"),r.if("isFocused","ck-labeled-field-view_focused"),r.if("placeholder","ck-labeled-field-view_placeholder"),r.if("errorText","ck-error")]},children:[{tag:"div",attributes:{class:["ck","ck-labeled-field-view__input-wrapper"]},children:this.fieldWrapperChildren},this.statusView]})}_createLabelView(e){const t=new ow(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createStatusView(e){const t=new Lb(this.locale),n=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view__status",n.if("errorText","ck-labeled-field-view__status_error"),n.if("_statusText","ck-hidden",(e=>!e))],id:e,role:n.if("errorText","alert")},children:[{text:n.to("_statusText")}]}),t}focus(e){this.fieldView.focus(e)}}class Tw extends Lb{focusTracker;constructor(e){super(e),this.set("value",void 0),this.set("id",void 0),this.set("placeholder",void 0),this.set("tabIndex",void 0),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById",void 0),this.set("ariaLabel",void 0),this.focusTracker=new lc,this.bind("isFocused").to(this.focusTracker),this.set("isEmpty",!0);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck","ck-input",t.if("isFocused","ck-input_focused"),t.if("isEmpty","ck-input-text_empty"),t.if("hasError","ck-error")],id:t.to("id"),placeholder:t.to("placeholder"),tabindex:t.to("tabIndex"),readonly:t.to("isReadOnly"),"aria-invalid":t.if("hasError",!0),"aria-describedby":t.to("ariaDescribedById"),"aria-label":t.to("ariaLabel")},on:{input:t.to(((...e)=>{this.fire("input",...e),this._updateIsEmpty()})),change:t.to(this._updateIsEmpty.bind(this))}})}render(){super.render(),this.focusTracker.add(this.element),this._setDomElementValue(this.value),this._updateIsEmpty(),this.on("change:value",((e,t,n)=>{this._setDomElementValue(n),this._updateIsEmpty()}))}destroy(){super.destroy(),this.focusTracker.destroy()}select(){this.element.select()}focus(){this.element.focus()}reset(){this.value=this.element.value="",this._updateIsEmpty()}_updateIsEmpty(){this.isEmpty=!this.element.value}_setDomElementValue(e){this.element.value=e||0===e?e:""}}class Sw extends Tw{constructor(e){super(e),this.set("inputMode","text");const t=this.bindTemplate;this.extendTemplate({attributes:{inputmode:t.to("inputMode")}})}}class Pw extends Sw{constructor(e){super(e),this.extendTemplate({attributes:{type:"text",class:["ck-input-text"]}})}}class Iw extends Sw{constructor(e,{min:t,max:n,step:i}={}){super(e);const r=this.bindTemplate;this.set("min",t),this.set("max",n),this.set("step",i),this.extendTemplate({attributes:{type:"number",class:["ck-input-number"],min:r.to("min"),max:r.to("max"),step:r.to("step")}})}}class Ow extends Lb{children;constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!1),this.set("position","se"),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-dropdown__panel",t.to("position",(e=>`ck-dropdown__panel_${e}`)),t.if("isVisible","ck-dropdown__panel-visible")],tabindex:"-1"},children:this.children,on:{selectstart:t.to((e=>{"input"!==e.target.tagName.toLocaleLowerCase()&&e.preventDefault()}))}})}focus(){if(this.children.length){const e=this.children.first;"function"==typeof e.focus?e.focus():Ea("ui-dropdown-panel-focus-child-missing-focus",{childView:this.children.first,dropdownPanel:this})}}focusLast(){if(this.children.length){const e=this.children.last;"function"==typeof e.focusLast?e.focusLast():e.focus()}}}class Vw extends Lb{buttonView;panelView;focusTracker;keystrokes;listView;toolbarView;menuView;constructor(e,t,n){super(e);const i=this.bindTemplate;this.buttonView=t,this.panelView=n,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class",void 0),this.set("id",void 0),this.set("panelPosition","auto"),this.panelView.bind("isVisible").to(this,"isOpen"),this.keystrokes=new hc,this.focusTracker=new lc,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",i.to("class"),i.if("isEnabled","ck-disabled",(e=>!e))],id:i.to("id"),"aria-describedby":i.to("ariaDescribedById")},children:[t,n]}),t.extendTemplate({attributes:{class:["ck-dropdown__button"],"data-cke-tooltip-disabled":i.to("isOpen")}})}render(){super.render(),this.focusTracker.add(this.buttonView.element),this.focusTracker.add(this.panelView.element),this.listenTo(this.buttonView,"open",(()=>{this.isOpen=!this.isOpen})),this.on("change:isOpen",((e,t,n)=>{if(n)if("auto"===this.panelPosition){const e=Vw._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions});this.panelView.position=e?e.name:this._defaultPanelPositionName}else this.panelView.position=this.panelPosition})),this.keystrokes.listenTo(this.element);const e=(e,t)=>{this.isOpen&&(this.isOpen=!1,t())};this.keystrokes.set("arrowdown",((e,t)=>{this.buttonView.isEnabled&&!this.isOpen&&(this.isOpen=!0,t())})),this.keystrokes.set("arrowright",((e,t)=>{this.isOpen&&t()})),this.keystrokes.set("arrowleft",e),this.keystrokes.set("esc",e)}focus(){this.buttonView.focus()}get _panelPositions(){const{south:e,north:t,southEast:n,southWest:i,northEast:r,northWest:s,southMiddleEast:o,southMiddleWest:a,northMiddleEast:l,northMiddleWest:c}=Vw.defaultPanelPositions;return"rtl"!==this.locale.uiLanguageDirection?[n,i,o,a,e,r,s,l,c,t]:[i,n,a,o,e,s,r,c,l,t]}get _defaultPanelPositionName(){return"rtl"===this.locale.uiLanguageDirection?"sw":"se"}static defaultPanelPositions={south:(e,t)=>({top:e.bottom,left:e.left-(t.width-e.width)/2,name:"s"}),southEast:e=>({top:e.bottom,left:e.left,name:"se"}),southWest:(e,t)=>({top:e.bottom,left:e.left-t.width+e.width,name:"sw"}),southMiddleEast:(e,t)=>({top:e.bottom,left:e.left-(t.width-e.width)/4,name:"sme"}),southMiddleWest:(e,t)=>({top:e.bottom,left:e.left-3*(t.width-e.width)/4,name:"smw"}),north:(e,t)=>({top:e.top-t.height,left:e.left-(t.width-e.width)/2,name:"n"}),northEast:(e,t)=>({top:e.top-t.height,left:e.left,name:"ne"}),northWest:(e,t)=>({top:e.top-t.height,left:e.left-t.width+e.width,name:"nw"}),northMiddleEast:(e,t)=>({top:e.top-t.height,left:e.left-(t.width-e.width)/4,name:"nme"}),northMiddleWest:(e,t)=>({top:e.top-t.height,left:e.left-3*(t.width-e.width)/4,name:"nmw"})};static _getOptimalPosition=Vl}class Rw extends jb{arrowView;constructor(e){super(e),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to("isOn",(e=>String(e)))}}),this.delegate("execute").to(this,"open")}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new zb;return e.content=bw,e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}class Nw extends Lb{children;constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!0),this.children=this.createCollection(),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__item",t.if("isVisible","ck-hidden",(e=>!e))],role:"presentation"},children:this.children})}focus(){this.children.first&&this.children.first.focus()}}class Lw extends Lb{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}class Mw extends Lb{labelView;items;children;constructor(e,t=new ow){super(e);const n=this.bindTemplate,i=new Bw(e);this.set({label:"",isVisible:!0}),this.labelView=t,this.labelView.bind("text").to(this,"label"),this.children=this.createCollection(),this.children.addMany([this.labelView,i]),i.set({role:"group",ariaLabelledBy:t.id}),i.focusTracker.destroy(),i.keystrokes.destroy(),this.items=i.items,this.setTemplate({tag:"li",attributes:{role:"presentation",class:["ck","ck-list__group",n.if("isVisible","ck-hidden",(e=>!e))]},children:this.children})}focus(){if(this.items){const e=this.items.find((e=>!(e instanceof Lw)));e&&e.focus()}}}class Bw extends Lb{focusables;items;focusTracker;keystrokes;_focusCycler;_listItemGroupToChangeListeners=new WeakMap;constructor(e){super(e);const t=this.bindTemplate;this.focusables=new mb,this.items=this.createCollection(),this.focusTracker=new lc,this.keystrokes=new hc,this._focusCycler=new Ub({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this.set("ariaLabel",void 0),this.set("ariaLabelledBy",void 0),this.set("role",void 0),this.setTemplate({tag:"ul",attributes:{class:["ck","ck-reset","ck-list"],role:t.to("role"),"aria-label":t.to("ariaLabel"),"aria-labelledby":t.to("ariaLabelledBy")},children:this.items})}render(){super.render();for(const e of this.items)e instanceof Mw?this._registerFocusableItemsGroup(e):e instanceof Nw&&this._registerFocusableListItem(e);this.items.on("change",((e,t)=>{for(const e of t.removed)e instanceof Mw?this._deregisterFocusableItemsGroup(e):e instanceof Nw&&this._deregisterFocusableListItem(e);for(const e of Array.from(t.added).reverse())e instanceof Mw?this._registerFocusableItemsGroup(e,t.index):this._registerFocusableListItem(e,t.index)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}focusFirst(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}_registerFocusableListItem(e,t){this.focusTracker.add(e.element),this.focusables.add(e,t)}_deregisterFocusableListItem(e){this.focusTracker.remove(e.element),this.focusables.remove(e)}_getOnGroupItemsChangeCallback(e){return(t,n)=>{for(const e of n.removed)this._deregisterFocusableListItem(e);for(const t of Array.from(n.added).reverse())this._registerFocusableListItem(t,this.items.getIndex(e)+n.index)}}_registerFocusableItemsGroup(e,t){Array.from(e.items).forEach(((e,n)=>{const i=void 0!==t?t+n:void 0;this._registerFocusableListItem(e,i)}));const n=this._getOnGroupItemsChangeCallback(e);this._listItemGroupToChangeListeners.set(e,n),e.items.on("change",n)}_deregisterFocusableItemsGroup(e){for(const t of e.items)this._deregisterFocusableListItem(t);e.items.off("change",this._listItemGroupToChangeListeners.get(e)),this._listItemGroupToChangeListeners.delete(e)}}const Fw=El("px"),Dw={top:-99999,left:-99999,name:"arrowless",config:{withArrow:!1}};class zw extends Lb{content;_pinWhenIsVisibleCallback;_resizeObserver;constructor(e){super(e);const t=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("position","arrow_nw"),this.set("isVisible",!1),this.set("withArrow",!0),this.set("class",void 0),this._pinWhenIsVisibleCallback=null,this._resizeObserver=null,this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-panel",t.to("position",(e=>`ck-balloon-panel_${e}`)),t.if("isVisible","ck-balloon-panel_visible"),t.if("withArrow","ck-balloon-panel_with-arrow"),t.to("class")],style:{top:t.to("top",Fw),left:t.to("left",Fw)}},children:this.content})}destroy(){this.hide(),super.destroy()}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(e){const t=$w(e.target);if(t&&!Ol(t))return!1;this.show();const n=zw.defaultPositions,i=Object.assign({},{element:this.element,positions:[n.southArrowNorth,n.southArrowNorthMiddleWest,n.southArrowNorthMiddleEast,n.southArrowNorthWest,n.southArrowNorthEast,n.northArrowSouth,n.northArrowSouthMiddleWest,n.northArrowSouthMiddleEast,n.northArrowSouthWest,n.northArrowSouthEast,n.viewportStickyNorth],limiter:ra.document.body,fitInViewport:!0},e),r=zw._getOptimalPosition(i)||Dw,s=parseInt(r.left),o=parseInt(r.top),a=r.name,l=r.config||{},{withArrow:c=!0}=l;return this.top=o,this.left=s,this.position=a,this.withArrow=c,!0}pin(e){this.unpin(),this._startPinning(e)&&(this._pinWhenIsVisibleCallback=()=>{this.isVisible?this._startPinning(e):this._stopPinning()},this.listenTo(this,"change:isVisible",this._pinWhenIsVisibleCallback))}unpin(){this._pinWhenIsVisibleCallback&&(this._stopPinning(),this.stopListening(this,"change:isVisible",this._pinWhenIsVisibleCallback),this._pinWhenIsVisibleCallback=null,this.hide())}_startPinning(e){if(!this.attachTo(e))return!1;let t=$w(e.target);const n=e.limiter?$w(e.limiter):ra.document.body;if(this.listenTo(ra.document,"scroll",((i,r)=>{const s=r.target,o=t&&s.contains(t),a=n&&s.contains(n);!o&&!a&&t&&n||this.attachTo(e)}),{useCapture:!0}),this.listenTo(ra.window,"resize",(()=>{this.attachTo(e)})),!this._resizeObserver&&(t&&pl(t)&&(t=t.parentElement),t)){const e=()=>{Ol(t)||this.unpin()};this._resizeObserver=new Cl(t,e)}return!0}_stopPinning(){this.stopListening(ra.document,"scroll"),this.stopListening(ra.window,"resize"),this._resizeObserver&&(this._resizeObserver.destroy(),this._resizeObserver=null)}static generatePositions(e={}){const{sideOffset:t=zw.arrowSideOffset,heightOffset:n=zw.arrowHeightOffset,stickyVerticalOffset:i=zw.stickyVerticalOffset,config:r}=e;return{northWestArrowSouthWest:(e,n)=>({top:s(e,n),left:e.left-t,name:"arrow_sw",...r&&{config:r}}),northWestArrowSouthMiddleWest:(e,n)=>({top:s(e,n),left:e.left-.25*n.width-t,name:"arrow_smw",...r&&{config:r}}),northWestArrowSouth:(e,t)=>({top:s(e,t),left:e.left-t.width/2,name:"arrow_s",...r&&{config:r}}),northWestArrowSouthMiddleEast:(e,n)=>({top:s(e,n),left:e.left-.75*n.width+t,name:"arrow_sme",...r&&{config:r}}),northWestArrowSouthEast:(e,n)=>({top:s(e,n),left:e.left-n.width+t,name:"arrow_se",...r&&{config:r}}),northArrowSouthWest:(e,n)=>({top:s(e,n),left:e.left+e.width/2-t,name:"arrow_sw",...r&&{config:r}}),northArrowSouthMiddleWest:(e,n)=>({top:s(e,n),left:e.left+e.width/2-.25*n.width-t,name:"arrow_smw",...r&&{config:r}}),northArrowSouth:(e,t)=>({top:s(e,t),left:e.left+e.width/2-t.width/2,name:"arrow_s",...r&&{config:r}}),northArrowSouthMiddleEast:(e,n)=>({top:s(e,n),left:e.left+e.width/2-.75*n.width+t,name:"arrow_sme",...r&&{config:r}}),northArrowSouthEast:(e,n)=>({top:s(e,n),left:e.left+e.width/2-n.width+t,name:"arrow_se",...r&&{config:r}}),northEastArrowSouthWest:(e,n)=>({top:s(e,n),left:e.right-t,name:"arrow_sw",...r&&{config:r}}),northEastArrowSouthMiddleWest:(e,n)=>({top:s(e,n),left:e.right-.25*n.width-t,name:"arrow_smw",...r&&{config:r}}),northEastArrowSouth:(e,t)=>({top:s(e,t),left:e.right-t.width/2,name:"arrow_s",...r&&{config:r}}),northEastArrowSouthMiddleEast:(e,n)=>({top:s(e,n),left:e.right-.75*n.width+t,name:"arrow_sme",...r&&{config:r}}),northEastArrowSouthEast:(e,n)=>({top:s(e,n),left:e.right-n.width+t,name:"arrow_se",...r&&{config:r}}),southWestArrowNorthWest:e=>({top:o(e),left:e.left-t,name:"arrow_nw",...r&&{config:r}}),southWestArrowNorthMiddleWest:(e,n)=>({top:o(e),left:e.left-.25*n.width-t,name:"arrow_nmw",...r&&{config:r}}),southWestArrowNorth:(e,t)=>({top:o(e),left:e.left-t.width/2,name:"arrow_n",...r&&{config:r}}),southWestArrowNorthMiddleEast:(e,n)=>({top:o(e),left:e.left-.75*n.width+t,name:"arrow_nme",...r&&{config:r}}),southWestArrowNorthEast:(e,n)=>({top:o(e),left:e.left-n.width+t,name:"arrow_ne",...r&&{config:r}}),southArrowNorthWest:e=>({top:o(e),left:e.left+e.width/2-t,name:"arrow_nw",...r&&{config:r}}),southArrowNorthMiddleWest:(e,n)=>({top:o(e),left:e.left+e.width/2-.25*n.width-t,name:"arrow_nmw",...r&&{config:r}}),southArrowNorth:(e,t)=>({top:o(e),left:e.left+e.width/2-t.width/2,name:"arrow_n",...r&&{config:r}}),southArrowNorthMiddleEast:(e,n)=>({top:o(e),left:e.left+e.width/2-.75*n.width+t,name:"arrow_nme",...r&&{config:r}}),southArrowNorthEast:(e,n)=>({top:o(e),left:e.left+e.width/2-n.width+t,name:"arrow_ne",...r&&{config:r}}),southEastArrowNorthWest:e=>({top:o(e),left:e.right-t,name:"arrow_nw",...r&&{config:r}}),southEastArrowNorthMiddleWest:(e,n)=>({top:o(e),left:e.right-.25*n.width-t,name:"arrow_nmw",...r&&{config:r}}),southEastArrowNorth:(e,t)=>({top:o(e),left:e.right-t.width/2,name:"arrow_n",...r&&{config:r}}),southEastArrowNorthMiddleEast:(e,n)=>({top:o(e),left:e.right-.75*n.width+t,name:"arrow_nme",...r&&{config:r}}),southEastArrowNorthEast:(e,n)=>({top:o(e),left:e.right-n.width+t,name:"arrow_ne",...r&&{config:r}}),westArrowEast:(e,t)=>({top:e.top+e.height/2-t.height/2,left:e.left-t.width-n,name:"arrow_e",...r&&{config:r}}),eastArrowWest:(e,t)=>({top:e.top+e.height/2-t.height/2,left:e.right+n,name:"arrow_w",...r&&{config:r}}),viewportStickyNorth:(e,t,n,s)=>{const o=s||n;return e.getIntersection(o)?o.height-e.height>i?null:{top:o.top+i,left:e.left+e.width/2-t.width/2,name:"arrowless",config:{withArrow:!1,...r}}:null}};function s(e,t){return e.top-t.height-n}function o(e){return e.bottom+n}}static arrowSideOffset=25;static arrowHeightOffset=10;static stickyVerticalOffset=20;static _getOptimalPosition=Vl;static defaultPositions=zw.generatePositions()}function $w(e){return zo(e)?e:fl(e)?e.commonAncestorContainer:"function"==typeof e?$w(e()):null}class jw extends Lb{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}class Hw extends Lb{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__line-break"]}})}}function Ww(e){if(Array.isArray(e))return{items:e,removeItems:[]};const t={items:[],removeItems:[]};return e?{...t,...e}:t}const Uw=(()=>({alignLeft:Pf.alignLeft,bold:Pf.bold,importExport:Pf.importExport,paragraph:Pf.paragraph,plus:Pf.plus,text:Pf.text,threeVerticalDots:Pf.threeVerticalDots,pilcrow:Pf.pilcrow,dragIndicator:Pf.dragIndicator}))();class qw extends Lb{options;items;focusTracker;keystrokes;itemsView;children;focusables;_focusCycler;_behavior;constructor(e,t){super(e);const n=this.bindTemplate,i=this.t;this.options=t||{},this.set("ariaLabel",i("Editor toolbar")),this.set("maxWidth","auto"),this.set("role","toolbar"),this.items=this.createCollection(),this.focusTracker=new lc,this.keystrokes=new hc,this.set("class",void 0),this.set("isCompact",!1),this.itemsView=new Gw(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection();const r="rtl"===e.uiLanguageDirection;this._focusCycler=new Ub({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:[r?"arrowright":"arrowleft","arrowup"],focusNext:[r?"arrowleft":"arrowright","arrowdown"]}});const s=["ck","ck-toolbar",n.to("class"),n.if("isCompact","ck-toolbar_compact")];var o;this.options.shouldGroupWhenFull&&this.options.isFloating&&s.push("ck-toolbar_floating"),this.setTemplate({tag:"div",attributes:{class:s,role:n.to("role"),"aria-label":n.to("ariaLabel"),style:{maxWidth:n.to("maxWidth")},tabindex:-1},children:this.children,on:{mousedown:(o=this,o.bindTemplate.to((e=>{e.target===o.element&&e.preventDefault()})))}}),this._behavior=this.options.shouldGroupWhenFull?new Zw(this):new Kw(this)}render(){super.render(),this.focusTracker.add(this.element);for(const e of this.items)this.focusTracker.add(e);this.items.on("add",((e,t)=>{this.focusTracker.add(t)})),this.items.on("remove",((e,t)=>{this.focusTracker.remove(t)})),this.keystrokes.listenTo(this.element),this._behavior.render(this)}destroy(){return this._behavior.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy(),super.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}fillFromConfig(e,t,n){this.items.addMany(this._buildItemsFromConfig(e,t,n))}_buildItemsFromConfig(e,t,n){const i=Ww(e),r=n||i.removeItems;return this._cleanItemsConfiguration(i.items,t,r).map((e=>or(e)?this._createNestedToolbarDropdown(e,t,r):"|"===e?new jw:"-"===e?new Hw:t.create(e))).filter((e=>!!e))}_cleanItemsConfiguration(e,t,n){const i=e.filter(((e,i,r)=>"|"===e||-1===n.indexOf(e)&&("-"===e?!this.options.shouldGroupWhenFull||(Ea("toolbarview-line-break-ignored-when-grouping-items",r),!1):!(!or(e)&&!t.has(e)&&(Ea("toolbarview-item-unavailable",{item:e}),1)))));return this._cleanSeparatorsAndLineBreaks(i)}_cleanSeparatorsAndLineBreaks(e){const t=e=>"-"!==e&&"|"!==e,n=e.length,i=e.findIndex(t);if(-1===i)return[];const r=n-e.slice().reverse().findIndex(t);return e.slice(i,r).filter(((e,n,i)=>!!t(e)||!(n>0&&i[n-1]===e)))}_createNestedToolbarDropdown(e,t,n){let{label:i,icon:r,items:s,tooltip:o=!0,withText:a=!1}=e;if(s=this._cleanItemsConfiguration(s,t,n),!s.length)return null;const l=Yw(this.locale);return i||Ea("toolbarview-nested-toolbar-dropdown-missing-label",e),l.class="ck-toolbar__nested-toolbar-dropdown",l.buttonView.set({label:i,tooltip:o,withText:!!a}),!1!==r?l.buttonView.icon=Uw[r]||r||Pf.threeVerticalDots:l.buttonView.withText=!0,Jw(l,(()=>l.toolbarView._buildItemsFromConfig(s,t,n))),l}}class Gw extends Lb{children;constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class Kw{constructor(e){const t=e.bindTemplate;e.set("isVertical",!1),e.itemsView.children.bindTo(e.items).using((e=>e)),e.focusables.bindTo(e.items).using((e=>Gb(e)?e:null)),e.extendTemplate({attributes:{class:[t.if("isVertical","ck-toolbar_vertical")]}})}render(){}destroy(){}}class Zw{view;viewChildren;viewFocusables;viewItemsView;viewFocusTracker;viewLocale;ungroupedItems;groupedItems;groupedItemsDropdown;resizeObserver=null;cachedPadding=null;shouldUpdateGroupingOnNextResize=!1;viewElement;constructor(e){this.view=e,this.viewChildren=e.children,this.viewFocusables=e.focusables,this.viewItemsView=e.itemsView,this.viewFocusTracker=e.focusTracker,this.viewLocale=e.locale,this.ungroupedItems=e.createCollection(),this.groupedItems=e.createCollection(),this.groupedItemsDropdown=this._createGroupedItemsDropdown(),e.itemsView.children.bindTo(this.ungroupedItems).using((e=>e)),this.ungroupedItems.on("change",this._updateFocusCyclableItems.bind(this)),e.children.on("change",this._updateFocusCyclableItems.bind(this)),e.items.on("change",((e,t)=>{const n=t.index,i=Array.from(t.added);for(const e of t.removed)n>=this.ungroupedItems.length?this.groupedItems.remove(e):this.ungroupedItems.remove(e);for(let e=n;e<n+i.length;e++){const t=i[e-n];e>this.ungroupedItems.length?this.groupedItems.add(t,e-this.ungroupedItems.length):this.ungroupedItems.add(t,e)}this._updateGrouping()})),e.extendTemplate({attributes:{class:["ck-toolbar_grouping"]}})}render(e){this.viewElement=e.element,this._enableGroupingOnResize(),this._enableGroupingOnMaxWidthChange(e)}destroy(){this.groupedItemsDropdown.destroy(),this.resizeObserver.destroy()}_updateGrouping(){if(!this.viewElement.ownerDocument.body.contains(this.viewElement))return;if(!Ol(this.viewElement))return void(this.shouldUpdateGroupingOnNextResize=!0);const e=this.groupedItems.length;let t;for(;this._areItemsOverflowing;)this._groupLastItem(),t=!0;if(!t&&this.groupedItems.length){for(;this.groupedItems.length&&!this._areItemsOverflowing;)this._ungroupFirstItem();this._areItemsOverflowing&&this._groupLastItem()}this.groupedItems.length!==e&&this.view.fire("groupedItemsUpdate")}get _areItemsOverflowing(){if(!this.ungroupedItems.length)return!1;const e=this.viewElement,t=this.viewLocale.uiLanguageDirection,n=new vl(e.lastChild),i=new vl(e);if(!this.cachedPadding){const n=ra.window.getComputedStyle(e),i="ltr"===t?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(n[i])}return"ltr"===t?n.right>i.right-this.cachedPadding:n.left<i.left+this.cachedPadding}_enableGroupingOnResize(){let e;this.resizeObserver=new Cl(this.viewElement,(t=>{e&&e===t.contentRect.width&&!this.shouldUpdateGroupingOnNextResize||(this.shouldUpdateGroupingOnNextResize=!1,this._updateGrouping(),e=t.contentRect.width)})),this._updateGrouping()}_enableGroupingOnMaxWidthChange(e){e.on("change:maxWidth",(()=>{this._updateGrouping()}))}_groupLastItem(){this.groupedItems.length||(this.viewChildren.add(new jw),this.viewChildren.add(this.groupedItemsDropdown),this.viewFocusTracker.add(this.groupedItemsDropdown.element)),this.groupedItems.add(this.ungroupedItems.remove(this.ungroupedItems.last),0)}_ungroupFirstItem(){this.ungroupedItems.add(this.groupedItems.remove(this.groupedItems.first)),this.groupedItems.length||(this.viewChildren.remove(this.groupedItemsDropdown),this.viewChildren.remove(this.viewChildren.last),this.viewFocusTracker.remove(this.groupedItemsDropdown.element))}_createGroupedItemsDropdown(){const e=this.viewLocale,t=e.t,n=Yw(e);return n.class="ck-toolbar__grouped-dropdown",n.panelPosition="ltr"===e.uiLanguageDirection?"sw":"se",Jw(n,this.groupedItems),n.buttonView.set({label:t("Show more items"),tooltip:!0,tooltipPosition:"rtl"===e.uiLanguageDirection?"se":"sw",icon:Pf.threeVerticalDots}),n}_updateFocusCyclableItems(){this.viewFocusables.clear(),this.ungroupedItems.map((e=>{Gb(e)&&this.viewFocusables.add(e)})),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}class Qw extends Lb{children;actionView;arrowView;keystrokes;focusTracker;constructor(e,t){super(e);const n=this.bindTemplate;this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isToggleable",!1),this.set("isVisible",!0),this.set("keystroke",void 0),this.set("withKeystroke",!1),this.set("label",void 0),this.set("tabindex",-1),this.set("tooltip",!1),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.children=this.createCollection(),this.actionView=this._createActionView(t),this.arrowView=this._createArrowView(),this.keystrokes=new hc,this.focusTracker=new lc,this.setTemplate({tag:"div",attributes:{class:["ck","ck-splitbutton",n.to("class"),n.if("isVisible","ck-hidden",(e=>!e)),this.arrowView.bindTemplate.if("isOn","ck-splitbutton_open")]},children:this.children})}render(){super.render(),this.children.add(this.actionView),this.children.add(this.arrowView),this.focusTracker.add(this.actionView.element),this.focusTracker.add(this.arrowView.element),this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",((e,t)=>{this.focusTracker.focusedElement===this.actionView.element&&(this.arrowView.focus(),t())})),this.keystrokes.set("arrowleft",((e,t)=>{this.focusTracker.focusedElement===this.arrowView.element&&(this.actionView.focus(),t())}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.actionView.focus()}_createActionView(e){const t=e||new jb;return e||t.bind("icon","isEnabled","isOn","isToggleable","keystroke","label","tabindex","tooltip","tooltipPosition","type","withText").to(this),t.extendTemplate({attributes:{class:"ck-splitbutton__action"}}),t.delegate("execute").to(this),t}_createArrowView(){const e=new jb,t=e.bindTemplate;return e.icon=bw,e.extendTemplate({attributes:{class:["ck-splitbutton__arrow"],"data-cke-tooltip-disabled":t.to("isOn"),"aria-haspopup":!0,"aria-expanded":t.to("isOn",(e=>String(e)))}}),e.bind("isEnabled").to(this),e.bind("label").to(this),e.bind("tooltip").to(this),e.delegate("execute").to(this,"open"),e}}function Yw(e,t=Rw){const n="function"==typeof t?new t(e):t,i=new Ow(e),r=new Vw(e,n,i);return n.bind("isEnabled").to(r),n instanceof Qw?n.arrowView.bind("isOn").to(r,"isOpen"):n.bind("isOn").to(r,"isOpen"),function(e){(function(e){Mb({emitter:e,activator:()=>e.isRendered&&e.isOpen,callback:()=>{e.isOpen=!1},contextElements:()=>[e.element,...iv(e.focusTracker).filter((t=>!e.element.contains(t)))]})})(e),function(e){e.on("execute",(t=>{t.source instanceof hw||(e.isOpen=!1)}))}(e),function(e){e.focusTracker.on("change:isFocused",((t,n,i)=>{!i&&e.isOpen&&(e.isOpen=!1)}))}(e),function(e){e.keystrokes.set("arrowdown",((t,n)=>{e.isOpen&&(e.panelView.focus(),n())})),e.keystrokes.set("arrowup",((t,n)=>{e.isOpen&&(e.panelView.focusLast(),n())}))}(e),function(e){e.on("change:isOpen",((t,n,i)=>{i||e.focusTracker.elements.some((e=>e.contains(ra.document.activeElement)))&&e.buttonView.focus()}))}(e),function(e){e.on("change:isOpen",((t,n,i)=>{i&&e.panelView.focus()}),{priority:"low"})}(e)}(r),r}function Jw(e,t,n={}){e.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),e.isOpen?Xw(e,t,n):e.once("change:isOpen",(()=>Xw(e,t,n)),{priority:"highest"}),n.enableActiveItemFocusOnDropdownOpen&&nv(e,(()=>e.toolbarView.items.find((e=>e.isOn))))}function Xw(e,t,n){const i=e.locale,r=i.t,s=e.toolbarView=new qw(i),o="function"==typeof t?t():t;s.ariaLabel=n.ariaLabel||r("Dropdown toolbar"),n.maxWidth&&(s.maxWidth=n.maxWidth),n.class&&(s.class=n.class),n.isCompact&&(s.isCompact=n.isCompact),n.isVertical&&(s.isVertical=!0),o instanceof mb?s.items.bindTo(o).using((e=>e)):s.items.addMany(o),e.panelView.children.add(s),e.focusTracker.add(s),s.items.delegate("execute").to(e)}function ev(e,t,n={}){e.isOpen?tv(e,t,n):e.once("change:isOpen",(()=>tv(e,t,n)),{priority:"highest"}),nv(e,(()=>e.listView.items.find((e=>e instanceof Nw&&e.children.first.isOn))))}function tv(e,t,n){const i=e.locale,r=e.listView=new Bw(i),s="function"==typeof t?t():t;r.ariaLabel=n.ariaLabel,r.role=n.role,rv(e,r.items,s,i),e.panelView.children.add(r),r.items.delegate("execute").to(e)}function nv(e,t){e.on("change:isOpen",(()=>{if(!e.isOpen)return;const n=t();n&&("function"==typeof n.focus?n.focus():Ea("ui-dropdown-focus-child-on-open-child-missing-focus",{view:n}))}),{priority:xa.low-10})}function iv(e){return[...e.elements,...e.externalViews.flatMap((e=>iv(e.focusTracker)))]}function rv(e,t,n,i){t.on("change",(()=>{const e=[...t].reduce(((e,t)=>(t instanceof Nw&&t.children.first instanceof iw&&e.push(t.children.first),e)),[]),n=e.some((e=>e.isToggleable));e.forEach((e=>{e.hasCheckSpace=n}))})),t.bindTo(n).using((t=>{if("separator"===t.type)return new Lw(i);if("group"===t.type){const n=new Mw(i);return n.set({label:t.label}),rv(e,n.items,t.items,i),n.items.delegate("execute").to(e),n}if("button"===t.type||"switchbutton"===t.type){const e="menuitemcheckbox"===t.model.role||"menuitemradio"===t.model.role,n=new Nw(i);let r;return"button"===t.type?(r=new iw(i),r.set({isToggleable:e})):r=new hw(i),r.bind(...Object.keys(t.model)).to(t.model),r.delegate("execute").to(n),n.children.add(r),n}return null}))}const sv=(e,t,n)=>{const i=new Pw(e.locale);return i.set({id:t,ariaDescribedById:n}),i.bind("isReadOnly").to(e,"isEnabled",(e=>!e)),i.bind("hasError").to(e,"errorText",(e=>!!e)),i.on("input",(()=>{e.errorText=null})),e.bind("isEmpty","isFocused","placeholder").to(i),i},ov=(e,t,n)=>{const i=new Iw(e.locale);return i.set({id:t,ariaDescribedById:n,inputMode:"numeric"}),i.bind("isReadOnly").to(e,"isEnabled",(e=>!e)),i.bind("hasError").to(e,"errorText",(e=>!!e)),i.on("input",(()=>{e.errorText=null})),e.bind("isEmpty","isFocused","placeholder").to(i),i},av=(e,t,n)=>{const i=Yw(e.locale);return i.set({id:t,ariaDescribedById:n}),i.bind("isEnabled").to(e),i};class lv extends Lb{hexInputRow;_debounceColorPickerEvent;_config;constructor(e,t={}){super(e),this.set({color:"",_hexColor:""}),this.hexInputRow=this._createInputRow();const n=this.createCollection();t.hideInput||n.add(this.hexInputRow),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker"],tabindex:-1},children:n}),this._config=t,this._debounceColorPickerEvent=id((e=>{this.set("color",e),this.fire("colorSelected",{color:this.color})}),150,{leading:!0}),this.on("set:color",((e,t,n)=>{e.return=Cw(n,this._config.format||"hsl")})),this.on("change:color",(()=>{this._hexColor=cv(this.color)})),this.on("change:_hexColor",(()=>{document.activeElement!==this.picker&&this.picker.setAttribute("color",this._hexColor),cv(this.color)!=cv(this._hexColor)&&(this.color=this._hexColor)}))}render(){var e,t;if(super.render(),e="hex-color-picker",t=hb,void 0===customElements.get(e)&&customElements.define(e,t),this.picker=ra.document.createElement("hex-color-picker"),this.picker.setAttribute("class","hex-color-picker"),this.picker.setAttribute("tabindex","-1"),this._createSlidersView(),this.element){this.hexInputRow.element?this.element.insertBefore(this.picker,this.hexInputRow.element):this.element.appendChild(this.picker);const e=document.createElement("style");e.textContent='[role="slider"]:focus [part$="pointer"] {border: 1px solid #fff;outline: 1px solid var(--ck-color-focus-border);box-shadow: 0 0 0 2px #fff;}',this.picker.shadowRoot.appendChild(e)}this.picker.addEventListener("color-changed",(e=>{const t=e.detail.value;this._debounceColorPickerEvent(t)}))}focus(){!this._config.hideInput&&(aa.isGecko||aa.isiOS||aa.isSafari)&&this.hexInputRow.children.get(1).focus(),this.slidersView.first.focus()}_createSlidersView(){const e=[...this.picker.shadowRoot.children].filter((e=>"slider"===e.getAttribute("role"))).map((e=>new dv(e)));this.slidersView=this.createCollection(),e.forEach((e=>{this.slidersView.add(e)}))}_createInputRow(){const e=this._createColorInput();return new hv(this.locale,e)}_createColorInput(){const e=new Ew(this.locale,sv),{t}=this.locale;return e.set({label:t("HEX"),class:"color-picker-hex-input"}),e.fieldView.bind("value").to(this,"_hexColor",(t=>e.isFocused?e.fieldView.value:t.startsWith("#")?t.substring(1):t)),e.fieldView.on("input",(()=>{const t=e.fieldView.element.value;if(t){const e=mv(t);e&&this._debounceColorPickerEvent(e)}})),e}isValid(){const{t:e}=this.locale;return!!this._config.hideInput||(this.resetValidationStatus(),!!this.hexInputRow.getParsedColor()||(this.hexInputRow.inputView.errorText=e('Please enter a valid color (e.g. "ff0000").'),!1))}resetValidationStatus(){this.hexInputRow.inputView.errorText=null}}function cv(e){let t=function(e){if(!e)return"";const t=Aw(e);return t?"hex"===t.space?t.hexValue:Cw(e,"hex"):"#000"}(e);return t||(t="#000"),4===t.length&&(t="#"+[t[1],t[1],t[2],t[2],t[3],t[3]].join("")),t.toLowerCase()}class dv extends Lb{constructor(e){super(),this.element=e}focus(){this.element.focus()}}class uv extends Lb{constructor(e){super(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__hash-view"]},children:"#"})}}class hv extends Lb{children;inputView;constructor(e,t){super(e),this.inputView=t,this.children=this.createCollection([new uv,this.inputView]),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__row"]},children:this.children})}getParsedColor(){return mv(this.inputView.fieldView.element.value)}}function mv(e){if(!e)return null;const t=e.trim().replace(/^#/,"");return[3,4,6,8].includes(t.length)&&/^(([0-9a-fA-F]{2}){3,4}|([0-9a-fA-F]){3,4})$/.test(t)?`#${t}`:null}class gv extends(Ga(oc)){constructor(e){super(e),this.set("isEmpty",!0),this.on("change",(()=>{this.set("isEmpty",0===this.length)}))}add(e,t){return this.find((t=>t.color===e.color))?this:super.add(e,t)}hasColor(e){return!!this.find((t=>t.color===e))}}class pv extends Lb{items;colorDefinitions;focusTracker;columns;documentColors;documentColorsCount;staticColorsGrid;documentColorsGrid;colorPickerButtonView;removeColorButtonView;_focusables;_documentColorsLabel;_removeButtonLabel;_colorPickerLabel;constructor(e,{colors:t,columns:n,removeButtonLabel:i,documentColorsLabel:r,documentColorsCount:s,colorPickerLabel:o,focusTracker:a,focusables:l}){super(e);const c=this.bindTemplate;this.set("isVisible",!0),this.focusTracker=a,this.items=this.createCollection(),this.colorDefinitions=t,this.columns=n,this.documentColors=new gv,this.documentColorsCount=s,this._focusables=l,this._removeButtonLabel=i,this._colorPickerLabel=o,this._documentColorsLabel=r,this.setTemplate({tag:"div",attributes:{class:["ck-color-grids-fragment",c.if("isVisible","ck-hidden",(e=>!e))]},children:this.items}),this.removeColorButtonView=this._createRemoveColorButton(),this.items.add(this.removeColorButtonView)}updateDocumentColors(e,t){const n=e.document,i=this.documentColorsCount;this.documentColors.clear();for(const r of n.getRoots()){const n=e.createRangeIn(r);for(const e of n.getItems())if(e.is("$textProxy")&&e.hasAttribute(t)&&(this._addColorToDocumentColors(e.getAttribute(t)),this.documentColors.length>=i))return}}updateSelectedColors(){const e=this.documentColorsGrid,t=this.staticColorsGrid,n=this.selectedColor;t.selectedColor=n,e&&(e.selectedColor=n)}render(){if(super.render(),this.staticColorsGrid=this._createStaticColorsGrid(),this.items.add(this.staticColorsGrid),this.documentColorsCount){const e=gb.bind(this.documentColors,this.documentColors),t=new Lb(this.locale);t.setTemplate({tag:"span",attributes:{class:["ck","ck-color-grid__label",e.if("isEmpty","ck-hidden")]},children:[{text:this._documentColorsLabel}]}),this.items.add(t),this.documentColorsGrid=this._createDocumentColorsGrid(),this.items.add(this.documentColorsGrid)}this._createColorPickerButton(),this._addColorSelectorElementsToFocusTracker()}focus(){this.removeColorButtonView.focus()}destroy(){super.destroy()}addColorPickerButton(){this.colorPickerButtonView&&(this.items.add(this.colorPickerButtonView),this.focusTracker.add(this.colorPickerButtonView.element),this._focusables.add(this.colorPickerButtonView))}_addColorSelectorElementsToFocusTracker(){this.focusTracker.add(this.removeColorButtonView.element),this._focusables.add(this.removeColorButtonView),this.staticColorsGrid&&(this.focusTracker.add(this.staticColorsGrid.element),this._focusables.add(this.staticColorsGrid)),this.documentColorsGrid&&(this.focusTracker.add(this.documentColorsGrid.element),this._focusables.add(this.documentColorsGrid))}_createColorPickerButton(){this.colorPickerButtonView=new jb,this.colorPickerButtonView.set({label:this._colorPickerLabel,withText:!0,icon:Pf.colorPalette,class:"ck-color-selector__color-picker"}),this.colorPickerButtonView.on("execute",(()=>{this.fire("colorPicker:show")}))}_createRemoveColorButton(){const e=new jb;return e.set({withText:!0,icon:Pf.eraser,label:this._removeButtonLabel}),e.class="ck-color-selector__remove-color",e.on("execute",(()=>{this.fire("execute",{value:null,source:"removeColorButton"})})),e.render(),e}_createStaticColorsGrid(){const e=new xw(this.locale,{colorDefinitions:this.colorDefinitions,columns:this.columns});return e.on("execute",((e,t)=>{this.fire("execute",{value:t.value,source:"staticColorsGrid"})})),e}_createDocumentColorsGrid(){const e=gb.bind(this.documentColors,this.documentColors),t=new xw(this.locale,{columns:this.columns});return t.extendTemplate({attributes:{class:e.if("isEmpty","ck-hidden")}}),t.items.bindTo(this.documentColors).using((e=>{const t=new kw;return t.set({color:e.color,hasBorder:e.options&&e.options.hasBorder}),e.label&&t.set({label:e.label,tooltip:!0}),t.on("execute",(()=>{this.fire("execute",{value:e.color,source:"documentColorsGrid"})})),t})),this.documentColors.on("change:isEmpty",((e,n,i)=>{i&&(t.selectedColor=null)})),t}_addColorToDocumentColors(e){const t=this.colorDefinitions.find((t=>t.color===e));t?this.documentColors.add(Object.assign({},t)):this.documentColors.add({color:e,label:e,options:{hasBorder:!1}})}}class fv extends Lb{items;colorPickerView;saveButtonView;cancelButtonView;actionBarView;focusTracker;keystrokes;_focusables;_colorPickerViewConfig;constructor(e,{focusTracker:t,focusables:n,keystrokes:i,colorPickerViewConfig:r}){super(e),this.items=this.createCollection(),this.focusTracker=t,this.keystrokes=i,this.set("isVisible",!1),this.set("selectedColor",void 0),this._focusables=n,this._colorPickerViewConfig=r;const s=this.bindTemplate,{saveButtonView:o,cancelButtonView:a}=this._createActionButtons();this.saveButtonView=o,this.cancelButtonView=a,this.actionBarView=this._createActionBarView({saveButtonView:o,cancelButtonView:a}),this.setTemplate({tag:"div",attributes:{class:["ck-color-picker-fragment",s.if("isVisible","ck-hidden",(e=>!e))]},children:this.items})}render(){super.render();const e=new lv(this.locale,{...this._colorPickerViewConfig});this.colorPickerView=e,this.colorPickerView.render(),this.selectedColor&&(e.color=this.selectedColor),this.listenTo(this,"change:selectedColor",((t,n,i)=>{e.color=i})),this.items.add(this.colorPickerView),this.items.add(this.actionBarView),this._addColorPickersElementsToFocusTracker(),this._stopPropagationOnArrowsKeys(),this._executeOnEnterPress(),this._executeUponColorChange()}destroy(){super.destroy()}focus(){this.colorPickerView.focus()}resetValidationStatus(){this.colorPickerView.resetValidationStatus()}_executeOnEnterPress(){this.keystrokes.set("enter",(e=>{this.isVisible&&this.focusTracker.focusedElement!==this.cancelButtonView.element&&this.colorPickerView.isValid()&&(this.fire("execute",{value:this.selectedColor}),e.stopPropagation(),e.preventDefault())}))}_stopPropagationOnArrowsKeys(){const e=e=>e.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}_addColorPickersElementsToFocusTracker(){for(const e of this.colorPickerView.slidersView)this.focusTracker.add(e.element),this._focusables.add(e);const e=this.colorPickerView.hexInputRow.children.get(1);e.element&&(this.focusTracker.add(e.element),this._focusables.add(e)),this.focusTracker.add(this.saveButtonView.element),this._focusables.add(this.saveButtonView),this.focusTracker.add(this.cancelButtonView.element),this._focusables.add(this.cancelButtonView)}_createActionBarView({saveButtonView:e,cancelButtonView:t}){const n=new Lb,i=this.createCollection();return i.add(e),i.add(t),n.setTemplate({tag:"div",attributes:{class:["ck","ck-color-selector_action-bar"]},children:i}),n}_createActionButtons(){const e=this.locale,t=e.t,n=new jb(e),i=new jb(e);return n.set({icon:Pf.check,class:"ck-button-save",type:"button",withText:!1,label:t("Accept")}),i.set({icon:Pf.cancel,class:"ck-button-cancel",type:"button",withText:!1,label:t("Cancel")}),n.on("execute",(()=>{this.colorPickerView.isValid()&&this.fire("execute",{source:"colorPickerSaveButton",value:this.selectedColor})})),i.on("execute",(()=>{this.fire("colorPicker:cancel")})),{saveButtonView:n,cancelButtonView:i}}_executeUponColorChange(){this.colorPickerView.on("colorSelected",((e,t)=>{this.fire("execute",{value:t.color,source:"colorPicker"}),this.set("selectedColor",t.color)}))}}class bv extends Lb{focusTracker;keystrokes;items;colorGridsFragmentView;colorPickerFragmentView;_focusCycler;_focusables;_colorPickerViewConfig;constructor(e,{colors:t,columns:n,removeButtonLabel:i,documentColorsLabel:r,documentColorsCount:s,colorPickerLabel:o,colorPickerViewConfig:a}){super(e),this.items=this.createCollection(),this.focusTracker=new lc,this.keystrokes=new hc,this._focusables=new mb,this._colorPickerViewConfig=a,this._focusCycler=new Ub({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.colorGridsFragmentView=new pv(e,{colors:t,columns:n,removeButtonLabel:i,documentColorsLabel:r,documentColorsCount:s,colorPickerLabel:o,focusTracker:this.focusTracker,focusables:this._focusables}),this.colorPickerFragmentView=new fv(e,{focusables:this._focusables,focusTracker:this.focusTracker,keystrokes:this.keystrokes,colorPickerViewConfig:a}),this.set("_isColorGridsFragmentVisible",!0),this.set("_isColorPickerFragmentVisible",!1),this.set("selectedColor",void 0),this.colorGridsFragmentView.bind("isVisible").to(this,"_isColorGridsFragmentVisible"),this.colorPickerFragmentView.bind("isVisible").to(this,"_isColorPickerFragmentVisible"),this.on("change:selectedColor",((e,t,n)=>{this.colorGridsFragmentView.set("selectedColor",n),this.colorPickerFragmentView.set("selectedColor",n)})),this.colorGridsFragmentView.on("change:selectedColor",((e,t,n)=>{this.set("selectedColor",n)})),this.colorPickerFragmentView.on("change:selectedColor",((e,t,n)=>{this.set("selectedColor",n)})),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-selector"]},children:this.items})}render(){super.render(),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}appendUI(){this._appendColorGridsFragment(),this._colorPickerViewConfig&&this._appendColorPickerFragment()}showColorPickerFragment(){this.colorPickerFragmentView.colorPickerView&&!this._isColorPickerFragmentVisible&&(this._isColorPickerFragmentVisible=!0,this.colorPickerFragmentView.focus(),this.colorPickerFragmentView.resetValidationStatus(),this._isColorGridsFragmentVisible=!1)}showColorGridsFragment(){this._isColorGridsFragmentVisible||(this._isColorGridsFragmentVisible=!0,this.colorGridsFragmentView.focus(),this._isColorPickerFragmentVisible=!1)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}updateDocumentColors(e,t){this.colorGridsFragmentView.updateDocumentColors(e,t)}updateSelectedColors(){this.colorGridsFragmentView.updateSelectedColors()}_appendColorGridsFragment(){this.items.length||(this.items.add(this.colorGridsFragmentView),this.colorGridsFragmentView.delegate("execute").to(this),this.colorGridsFragmentView.delegate("colorPicker:show").to(this))}_appendColorPickerFragment(){2!==this.items.length&&(this.items.add(this.colorPickerFragmentView),this.colorGridsFragmentView.colorPickerButtonView&&this.colorGridsFragmentView.colorPickerButtonView.on("execute",(()=>{this.showColorPickerFragment()})),this.colorGridsFragmentView.addColorPickerButton(),this.colorPickerFragmentView.delegate("execute").to(this),this.colorPickerFragmentView.delegate("colorPicker:cancel").to(this))}}class wv{editor;_components=new Map;constructor(e){this.editor=e}*names(){for(const e of this._components.values())yield e.originalName}add(e,t){this._components.set(vv(e),{callback:t,originalName:e})}create(e){if(!this.has(e))throw new Aa("componentfactory-item-missing",this,{name:e});return this._components.get(vv(e)).callback(this.editor.locale)}has(e){return this._components.has(vv(e))}}function vv(e){return String(e).toLowerCase()}const yv="ck-tooltip";class _v extends(dl()){tooltipTextView;balloonPanelView;static defaultBalloonPositions=zw.generatePositions({heightOffset:5,sideOffset:13});_currentElementWithTooltip=null;_currentTooltipPosition=null;_mutationObserver=null;_pinTooltipDebounced;_unpinTooltipDebounced;_watchdogExcluded;static _editors=new Set;static _instance=null;constructor(e){if(super(),_v._editors.add(e),_v._instance)return _v._instance;_v._instance=this,this.tooltipTextView=new Lb(e.locale),this.tooltipTextView.set("text",""),this.tooltipTextView.setTemplate({tag:"span",attributes:{class:["ck","ck-tooltip__text"]},children:[{text:this.tooltipTextView.bindTemplate.to("text")}]}),this.balloonPanelView=new zw(e.locale),this.balloonPanelView.class=yv,this.balloonPanelView.content.add(this.tooltipTextView),this._mutationObserver=function(e){const t=new MutationObserver((()=>{e()}));return{attach(e){t.observe(e,{attributes:!0,attributeFilter:["data-cke-tooltip-text","data-cke-tooltip-position"]})},detach(){t.disconnect()}}}((()=>{this._updateTooltipPosition()})),this._pinTooltipDebounced=id(this._pinTooltip,600),this._unpinTooltipDebounced=id(this._unpinTooltip,400),this.listenTo(ra.document,"keydown",this._onKeyDown.bind(this),{useCapture:!0}),this.listenTo(ra.document,"mouseenter",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(ra.document,"mouseleave",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(ra.document,"focus",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(ra.document,"blur",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(ra.document,"scroll",this._onScroll.bind(this),{useCapture:!0}),this._watchdogExcluded=!0}destroy(e){const t=e.ui.view&&e.ui.view.body;_v._editors.delete(e),this.stopListening(e.ui),t&&t.has(this.balloonPanelView)&&t.remove(this.balloonPanelView),_v._editors.size||(this._unpinTooltip(),this.balloonPanelView.destroy(),this.stopListening(),_v._instance=null)}static getPositioningFunctions(e){const t=_v.defaultBalloonPositions;return{s:[t.southArrowNorth,t.southArrowNorthEast,t.southArrowNorthWest],n:[t.northArrowSouth],e:[t.eastArrowWest],w:[t.westArrowEast],sw:[t.southArrowNorthEast],se:[t.southArrowNorthWest]}[e]}_onKeyDown(e,t){"Escape"===t.key&&this._currentElementWithTooltip&&(this._unpinTooltip(),t.stopPropagation())}_onEnterOrFocus(e,{target:t}){const n=kv(t);n?n!==this._currentElementWithTooltip?(this._unpinTooltip(),"focus"===e.name&&!n.matches(":hover")||n.matches("[data-cke-tooltip-instant]")?this._pinTooltip(n,xv(n)):this._pinTooltipDebounced(n,xv(n))):this._unpinTooltipDebounced.cancel():"focus"===e.name&&this._unpinTooltip()}_onLeaveOrBlur(e,{target:t,relatedTarget:n}){if("mouseleave"===e.name){if(!zo(t))return;const e=this.balloonPanelView.element,i=e&&(e===n||e.contains(n)),r=!i&&t===e;if(i)return void this._unpinTooltipDebounced.cancel();if(!r&&this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;const s=kv(t),o=kv(n);(r||s&&s!==o)&&(this._pinTooltipDebounced.cancel(),this._currentElementWithTooltip&&this._currentElementWithTooltip.matches("[data-cke-tooltip-instant]")||s&&s.matches("[data-cke-tooltip-instant]")?this._unpinTooltip():this._unpinTooltipDebounced())}else{if(this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;this._pinTooltipDebounced.cancel(),this._unpinTooltipDebounced()}}_onScroll(e,{target:t}){this._currentElementWithTooltip&&(t.contains(this.balloonPanelView.element)&&t.contains(this._currentElementWithTooltip)||this._unpinTooltip())}_pinTooltip(e,{text:t,position:n,cssClass:i}){this._unpinTooltip();const r=ac(_v._editors.values()).ui.view.body;r.has(this.balloonPanelView)||r.add(this.balloonPanelView),this.tooltipTextView.text=t,this.balloonPanelView.class=[yv,i].filter((e=>e)).join(" "),this.balloonPanelView.pin({target:e,positions:_v.getPositioningFunctions(n)}),this._mutationObserver.attach(e);for(const e of _v._editors)this.listenTo(e.ui,"update",this._updateTooltipPosition.bind(this),{priority:"low"});this._currentElementWithTooltip=e,this._currentTooltipPosition=n}_unpinTooltip(){this._unpinTooltipDebounced.cancel(),this._pinTooltipDebounced.cancel(),this.balloonPanelView.unpin();for(const e of _v._editors)this.stopListening(e.ui,"update");this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this.tooltipTextView.text="",this._mutationObserver.detach()}_updateTooltipPosition(){if(!this._currentElementWithTooltip)return;const e=xv(this._currentElementWithTooltip);Ol(this._currentElementWithTooltip)&&e.text?this.balloonPanelView.pin({target:this._currentElementWithTooltip,positions:_v.getPositioningFunctions(e.position)}):this._unpinTooltip()}}function kv(e){return zo(e)?e.closest("[data-cke-tooltip-text]:not([data-cke-tooltip-disabled])"):null}function xv(e){return{text:e.dataset.ckeTooltipText,position:e.dataset.ckeTooltipPosition||"s",cssClass:e.dataset.ckeTooltipClass||""}}class Cv extends(dl()){editor;_balloonView=null;_showBalloonThrottled=Yp((()=>this._showBalloon()),50,{leading:!0});_lastFocusedEditableElement=null;_balloonClass;constructor(e,t={}){super(),this.editor=e,this._balloonClass=t.balloonClass,e.on("ready",(()=>this._handleEditorReady()))}destroy(){const e=this._balloonView;e&&(e.unpin(),this._balloonView=null),this._showBalloonThrottled.cancel(),this.stopListening()}_handleEditorReady(){const e=this.editor;this._isEnabled()&&e.ui.view&&(e.ui.focusTracker.on("change:isFocused",((e,t,n)=>{this._updateLastFocusedEditableElement(),n?this._showBalloon():this._hideBalloon()})),e.ui.focusTracker.on("change:focusedElement",((e,t,n)=>{this._updateLastFocusedEditableElement(),n&&this._showBalloon()})),e.ui.on("update",(()=>{this._showBalloonThrottled()})))}_getNormalizedConfig(){return{side:"ltr"===this.editor.locale.contentLanguageDirection?"right":"left",position:"border",verticalOffset:0,horizontalOffset:5}}_showBalloon(){const e=this._getBalloonAttachOptions();e&&(this._balloonView||(this._balloonView=this._createBalloonView()),this._balloonView.pin(e))}_hideBalloon(){this._balloonView&&this._balloonView.unpin()}_createBalloonView(){const e=this.editor,t=new zw,n=this._createBadgeContent();return t.content.add(n),this._balloonClass&&(t.class=this._balloonClass),e.ui.view.body.add(t),t}_getBalloonAttachOptions(){if(!this._lastFocusedEditableElement)return null;const e=this._getNormalizedConfig(),t="right"===e.side?Av(this._lastFocusedEditableElement,n=e,((e,t)=>e.left+e.width-t.width-n.horizontalOffset)):function(e,t){return Av(e,t,(e=>e.left+t.horizontalOffset))}(this._lastFocusedEditableElement,e);var n;return{target:this._lastFocusedEditableElement,positions:[t]}}_updateLastFocusedEditableElement(){const e=this.editor,t=e.ui.focusTracker.isFocused,n=e.ui.focusTracker.focusedElement;if(!t||!n)return void(this._lastFocusedEditableElement=null);const i=Array.from(e.ui.getEditableElementsNames()).map((t=>e.ui.getEditableElement(t)));i.includes(n)?this._lastFocusedEditableElement=n:this._lastFocusedEditableElement=i[0]}}function Av(e,t,n){return(i,r)=>{const s=new vl(e);if(s.width<350||s.height<50)return null;let o;o="inside"===t.position?s.bottom-r.height:s.bottom-r.height/2,o-=t.verticalOffset;const a=n(s,r),l=i.clone().moveTo(a,o).getIntersection(r.clone().moveTo(a,o)).getVisible();return!l||l.getArea()<r.getArea()?null:{top:o,left:a,name:`position_${t.position}-side_${t.side}`,config:{withArrow:!1}}}}class Ev extends Cv{constructor(e){super(e,{balloonClass:"ck-powered-by-balloon"})}_isEnabled(){const e=this.editor;if(e.config.get("ui.poweredBy.forceVisible"))return!0;const t=e.config.get("licenseKey");if("GPL"==t)return!0;const n=fc(t.split(".")[1]);return!n||!n.whiteLabel}_createBadgeContent(){return new Tv(this.editor.locale,this._getNormalizedConfig().label)}_getNormalizedConfig(){const e=super._getNormalizedConfig(),t=this.editor.config.get("ui.poweredBy")||{},n=t.position||e.position,i="inside"===n?5:e.verticalOffset;return{position:n,side:t.side||e.side,label:void 0===t.label?"Powered by":t.label,verticalOffset:void 0!==t.verticalOffset?t.verticalOffset:i,horizontalOffset:void 0!==t.horizontalOffset?t.horizontalOffset:e.horizontalOffset,forceVisible:!!t.forceVisible}}}class Tv extends Lb{constructor(e,t){super(e);const n=new zb,i=this.bindTemplate;n.set({content:'<svg xmlns="http://www.w3.org/2000/svg" width="53" height="10" viewBox="0 0 53 10"><path fill="#1C2331" d="M31.724 1.492a15.139 15.139 0 0 0 .045 1.16 2.434 2.434 0 0 0-.687-.34 3.68 3.68 0 0 0-1.103-.166 2.332 2.332 0 0 0-1.14.255 1.549 1.549 0 0 0-.686.87c-.15.41-.225.98-.225 1.712 0 .939.148 1.659.444 2.161.297.503.792.754 1.487.754.452.015.9-.094 1.294-.316.296-.174.557-.4.771-.669l.14.852h1.282V.007h-1.623v1.485ZM31 6.496a1.77 1.77 0 0 1-.494.061.964.964 0 0 1-.521-.127.758.758 0 0 1-.296-.466 3.984 3.984 0 0 1-.093-.992 4.208 4.208 0 0 1 .098-1.052.753.753 0 0 1 .307-.477 1.08 1.08 0 0 1 .55-.122c.233-.004.466.026.69.089l.483.144v2.553c-.11.076-.213.143-.307.2a1.73 1.73 0 0 1-.417.189ZM35.68 0l-.702.004c-.322.002-.482.168-.48.497l.004.581c.002.33.164.493.486.49l.702-.004c.322-.002.481-.167.48-.496L36.165.49c-.002-.33-.164-.493-.486-.491ZM36.145 2.313l-1.612.01.034 5.482 1.613-.01-.035-5.482ZM39.623.79 37.989.8 38 2.306l-.946.056.006 1.009.949-.006.024 2.983c.003.476.143.844.419 1.106.275.26.658.39 1.148.387.132 0 .293-.01.483-.03.19-.02.38-.046.57-.08.163-.028.324-.068.482-.119l-.183-1.095-.702.004a.664.664 0 0 1-.456-.123.553.553 0 0 1-.14-.422l-.016-2.621 1.513-.01-.006-1.064-1.514.01-.01-1.503ZM46.226 2.388c-.41-.184-.956-.274-1.636-.27-.673.004-1.215.101-1.627.29-.402.179-.72.505-.888.91-.18.419-.268.979-.264 1.68.004.688.1 1.24.285 1.655.172.404.495.724.9.894.414.18.957.268 1.63.264.68-.004 1.224-.099 1.632-.284.4-.176.714-.501.878-.905.176-.418.263-.971.258-1.658-.004-.702-.097-1.261-.28-1.677a1.696 1.696 0 0 0-.888-.9Zm-.613 3.607a.77.77 0 0 1-.337.501 1.649 1.649 0 0 1-1.317.009.776.776 0 0 1-.343-.497 4.066 4.066 0 0 1-.105-1.02 4.136 4.136 0 0 1 .092-1.03.786.786 0 0 1 .337-.507 1.59 1.59 0 0 1 1.316-.008.79.79 0 0 1 .344.502c.078.337.113.683.105 1.03.012.343-.019.685-.092 1.02ZM52.114 2.07a2.67 2.67 0 0 0-1.128.278c-.39.191-.752.437-1.072.73l-.157-.846-1.273.008.036 5.572 1.623-.01-.024-3.78c.35-.124.646-.22.887-.286.26-.075.53-.114.8-.118l.45-.003.144-1.546-.286.001ZM22.083 7.426l-1.576-2.532a2.137 2.137 0 0 0-.172-.253 1.95 1.95 0 0 0-.304-.29.138.138 0 0 1 .042-.04 1.7 1.7 0 0 0 .328-.374l1.75-2.71c.01-.015.025-.028.024-.048-.01-.01-.021-.007-.031-.007L20.49 1.17a.078.078 0 0 0-.075.045l-.868 1.384c-.23.366-.46.732-.688 1.099a.108.108 0 0 1-.112.06c-.098-.005-.196-.001-.294-.002-.018 0-.038.006-.055-.007.002-.02.002-.039.005-.058a4.6 4.6 0 0 0 .046-.701V1.203c0-.02-.009-.032-.03-.03h-.033L16.93 1.17c-.084 0-.073-.01-.073.076v6.491c-.001.018.006.028.025.027h1.494c.083 0 .072.007.072-.071v-2.19c0-.055-.003-.11-.004-.166a3.366 3.366 0 0 0-.05-.417h.06c.104 0 .209.002.313-.002a.082.082 0 0 1 .084.05c.535.913 1.07 1.824 1.607 2.736a.104.104 0 0 0 .103.062c.554-.003 1.107-.002 1.66-.002l.069-.003-.019-.032-.188-.304ZM27.112 6.555c-.005-.08-.004-.08-.082-.08h-2.414c-.053 0-.106-.003-.159-.011a.279.279 0 0 1-.246-.209.558.558 0 0 1-.022-.15c0-.382 0-.762-.002-1.143 0-.032.007-.049.042-.044h2.504c.029.003.037-.012.034-.038V3.814c0-.089.013-.078-.076-.078h-2.44c-.07 0-.062.003-.062-.06v-.837c0-.047.004-.093.013-.14a.283.283 0 0 1 .241-.246.717.717 0 0 1 .146-.011h2.484c.024.002.035-.009.036-.033l.003-.038.03-.496c.01-.183.024-.365.034-.548.005-.085.003-.087-.082-.094-.218-.018-.437-.038-.655-.05a17.845 17.845 0 0 0-.657-.026 72.994 72.994 0 0 0-1.756-.016 1.7 1.7 0 0 0-.471.064 1.286 1.286 0 0 0-.817.655c-.099.196-.149.413-.145.633v3.875c0 .072.003.144.011.216a1.27 1.27 0 0 0 .711 1.029c.228.113.48.167.734.158.757-.005 1.515.002 2.272-.042.274-.016.548-.034.82-.053.03-.002.043-.008.04-.041-.008-.104-.012-.208-.019-.312a69.964 69.964 0 0 1-.05-.768ZM16.14 7.415l-.127-1.075c-.004-.03-.014-.04-.044-.037a13.125 13.125 0 0 1-.998.073c-.336.01-.672.02-1.008.016-.116-.001-.233-.014-.347-.039a.746.746 0 0 1-.45-.262c-.075-.1-.132-.211-.167-.33a3.324 3.324 0 0 1-.126-.773 9.113 9.113 0 0 1-.015-.749c0-.285.022-.57.065-.852.023-.158.066-.312.127-.46a.728.728 0 0 1 .518-.443 1.64 1.64 0 0 1 .397-.048c.628-.001 1.255.003 1.882.05.022.001.033-.006.036-.026l.003-.031.06-.55c.019-.177.036-.355.057-.532.004-.034-.005-.046-.04-.056a5.595 5.595 0 0 0-1.213-.21 10.783 10.783 0 0 0-.708-.02c-.24-.003-.48.01-.719.041a3.477 3.477 0 0 0-.625.14 1.912 1.912 0 0 0-.807.497c-.185.2-.33.433-.424.688a4.311 4.311 0 0 0-.24 1.096c-.031.286-.045.572-.042.86-.006.43.024.86.091 1.286.04.25.104.497.193.734.098.279.26.53.473.734.214.205.473.358.756.446.344.11.702.17 1.063.177a8.505 8.505 0 0 0 1.578-.083 6.11 6.11 0 0 0 .766-.18c.03-.008.047-.023.037-.057a.157.157 0 0 1-.003-.025Z"/><path fill="#AFE229" d="M6.016 6.69a1.592 1.592 0 0 0-.614.21c-.23.132-.422.32-.56.546-.044.072-.287.539-.287.539l-.836 1.528.009.006c.038.025.08.046.123.063.127.046.26.07.395.073.505.023 1.011-.007 1.517-.003.29.009.58.002.869-.022a.886.886 0 0 0 .395-.116.962.962 0 0 0 .312-.286c.056-.083.114-.163.164-.249.24-.408.48-.816.718-1.226.075-.128.148-.257.222-.386l.112-.192a1.07 1.07 0 0 0 .153-.518l-1.304.023s-1.258-.005-1.388.01Z"/><path fill="#771BFF" d="m2.848 9.044.76-1.39.184-.352c-.124-.067-.245-.14-.367-.21-.346-.204-.706-.384-1.045-.6a.984.984 0 0 1-.244-.207c-.108-.134-.136-.294-.144-.46-.021-.409-.002-.818-.009-1.227-.003-.195 0-.39.003-.585.004-.322.153-.553.427-.713l.833-.488c.22-.13.44-.257.662-.385.05-.029.105-.052.158-.077.272-.128.519-.047.76.085l.044.028c.123.06.242.125.358.196.318.178.635.357.952.537.095.056.187.117.275.184.194.144.254.35.266.578.016.284.007.569.006.853-.001.28.004.558 0 .838.592-.003 1.259 0 1.259 0l.723-.013c-.003-.292-.007-.584-.007-.876 0-.524.015-1.048-.016-1.571-.024-.42-.135-.8-.492-1.067a5.02 5.02 0 0 0-.506-.339A400.52 400.52 0 0 0 5.94.787C5.722.664 5.513.524 5.282.423 5.255.406 5.228.388 5.2.373 4.758.126 4.305-.026 3.807.21c-.097.046-.197.087-.29.14A699.896 699.896 0 0 0 .783 1.948c-.501.294-.773.717-.778 1.31-.004.36-.009.718-.001 1.077.016.754-.017 1.508.024 2.261.016.304.07.6.269.848.127.15.279.28.448.382.622.4 1.283.734 1.92 1.11l.183.109Z"/></svg>\n',isColorInherited:!1}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-powered-by"],"aria-hidden":!0},children:[{tag:"a",attributes:{href:"https://ckeditor.com/powered-by-ckeditor/?utm_source=ckeditor&utm_medium=referral&utm_campaign=701Dn000000hVgmIAE_powered_by_ckeditor_logo",target:"_blank",tabindex:"-1"},children:[...t?[{tag:"span",attributes:{class:["ck","ck-powered-by__label"]},children:[t]}]:[],n],on:{dragstart:i.to((e=>e.preventDefault()))}}]})}}class Sv extends Cv{licenseTypeMessage={evaluation:"For evaluation purposes only",trial:"For evaluation purposes only",development:"For development purposes only"};constructor(e){super(e,{balloonClass:"ck-evaluation-badge-balloon"})}_isEnabled(){const e=Iv(this.editor.config.get("licenseKey"));return Boolean(e&&this.licenseTypeMessage[e])}_createBadgeContent(){const e=Iv(this.editor.config.get("licenseKey"));return new Pv(this.editor.locale,this.licenseTypeMessage[e])}_getNormalizedConfig(){const e=super._getNormalizedConfig(),t=this.editor.config.get("ui.poweredBy")||{};return{position:t.position||e.position,side:"left"===(t.side||e.side)?"right":"left",verticalOffset:e.verticalOffset,horizontalOffset:e.horizontalOffset}}}class Pv extends Lb{constructor(e,t){super(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-evaluation-badge"],"aria-hidden":!0},children:[{tag:"span",attributes:{class:["ck","ck-evaluation-badge__label"]},children:[t]}]})}}function Iv(e){if("GPL"==e)return"GPL";const t=fc(e.split(".")[1]);return t?t.licenseType||"production":null}const Ov={POLITE:"polite",ASSERTIVE:"assertive"};class Vv{editor;view;constructor(e){this.editor=e,e.once("ready",(()=>{for(const e of Object.values(Ov))this.announce("",e)}))}announce(e,t=Ov.POLITE){const n=this.editor;if(!n.ui.view)return;this.view||(this.view=new Rv(n.locale),n.ui.view.body.add(this.view));const{politeness:i,isUnsafeHTML:r}="string"==typeof t?{politeness:t}:t;let s=this.view.regionViews.find((e=>e.politeness===i));s||(s=new Nv(n,i),this.view.regionViews.add(s)),s.announce({announcement:e,isUnsafeHTML:r})}}class Rv extends Lb{regionViews;constructor(e){super(e),this.regionViews=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-aria-live-announcer"]},children:this.regionViews})}}class Nv extends Lb{politeness;_domConverter;_pruneAnnouncementsInterval;constructor(e,t){super(e.locale),this.setTemplate({tag:"div",attributes:{"aria-live":t,"aria-relevant":"additions"},children:[{tag:"ul",attributes:{class:["ck","ck-aria-live-region-list"]}}]}),e.on("destroy",(()=>{null!==this._pruneAnnouncementsInterval&&(clearInterval(this._pruneAnnouncementsInterval),this._pruneAnnouncementsInterval=null)})),this.politeness=t,this._domConverter=e.data.htmlProcessor.domConverter,this._pruneAnnouncementsInterval=setInterval((()=>{this.element&&this._listElement.firstChild&&this._listElement.firstChild.remove()}),5e3)}announce({announcement:e,isUnsafeHTML:t}){if(!e.trim().length)return;const n=document.createElement("li");t?this._domConverter.setContentOf(n,e):n.innerText=e,this._listElement.appendChild(n)}get _listElement(){return this.element.querySelector("ul")}}class Lv extends Nw{constructor(e,t){super(e);const n=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item"]},on:{mouseenter:n.to("mouseenter")}}),this.delegate("mouseenter").to(t)}}const Mv={toggleMenusAndFocusItemsOnHover(e){e.on("menu:mouseenter",(t=>{if(e.isFocusBorderEnabled||e.isOpen){if(e.isOpen)for(const n of e.menus){const e=t.path[0],i=e instanceof Lv&&e.children.first===n;n.isOpen=(t.path.includes(n)||i)&&n.isEnabled}t.source.focus()}}))},focusCycleMenusOnArrows(e){const t="rtl"===e.locale.uiLanguageDirection;function n(t,n){const i=e.children.getIndex(t),r=t.isOpen,s=e.children.length,o=e.children.get((i+s+n)%s);t.isOpen=!1,r&&(o.isOpen=!0),o.buttonView.focus()}e.on("menu:arrowright",(e=>{n(e.source,t?-1:1)})),e.on("menu:arrowleft",(e=>{n(e.source,t?1:-1)}))},closeMenusWhenTheBarCloses(e){e.on("change:isOpen",(()=>{e.isOpen||e.menus.forEach((e=>{e.isOpen=!1}))}))},closeMenuWhenAnotherOnTheSameLevelOpens(e){e.on("menu:change:isOpen",((t,n,i)=>{i&&e.menus.filter((e=>t.source.parentMenuView===e.parentMenuView&&t.source!==e&&e.isOpen)).forEach((e=>{e.isOpen=!1}))}))},closeOnClickOutside(e){Mb({emitter:e,activator:()=>e.isOpen,callback:()=>e.close(),contextElements:()=>e.children.map((e=>e.element))})},enableFocusHighlightOnInteraction(e){let t=!1;e.on("change:isOpen",((n,i,r)=>{r||(t||(e.isFocusBorderEnabled=!1),t=!1)})),e.listenTo(e.element,"keydown",(()=>{t=!0}),{useCapture:!0}),e.listenTo(e.element,"keyup",(()=>{t=!1}),{useCapture:!0}),e.listenTo(e.element,"focus",(()=>{t&&(e.isFocusBorderEnabled=!0)}),{useCapture:!0})}},Bv={openAndFocusPanelOnArrowDownKey(e){e.keystrokes.set("arrowdown",((t,n)=>{e.focusTracker.focusedElement===e.buttonView.element&&(e.isOpen||(e.isOpen=!0),e.panelView.focus(),n())}))},openOnArrowRightKey(e){const t="rtl"===e.locale.uiLanguageDirection?"arrowleft":"arrowright";e.keystrokes.set(t,((t,n)=>{e.focusTracker.focusedElement===e.buttonView.element&&e.isEnabled&&(e.isOpen||(e.isOpen=!0),e.panelView.focus(),n())}))},openOnButtonClick(e){e.buttonView.on("execute",(()=>{e.isOpen=!0}))},toggleOnButtonClick(e){e.buttonView.on("execute",(()=>{e.isOpen=!e.isOpen}))},openAndFocusOnEnterKeyPress(e){e.keystrokes.set("enter",((t,n)=>{e.focusTracker.focusedElement===e.buttonView.element&&(e.isOpen=!0,e.panelView.focus(),n())}))},closeOnArrowLeftKey(e){const t="rtl"===e.locale.uiLanguageDirection?"arrowright":"arrowleft";e.keystrokes.set(t,((t,n)=>{e.isOpen&&(e.isOpen=!1,e.focus(),n())}))},closeOnEscKey(e){e.keystrokes.set("esc",((t,n)=>{e.isOpen&&(e.isOpen=!1,e.focus(),n())}))},closeOnParentClose(e){e.parentMenuView.on("change:isOpen",((t,n,i)=>{i||t.source!==e.parentMenuView||(e.isOpen=!1)}))}},Fv={southEast:e=>({top:e.bottom,left:e.left,name:"se"}),southWest:(e,t)=>({top:e.bottom,left:e.left-t.width+e.width,name:"sw"}),northEast:(e,t)=>({top:e.top-t.height,left:e.left,name:"ne"}),northWest:(e,t)=>({top:e.top-t.height,left:e.left-t.width+e.width,name:"nw"}),eastSouth:e=>({top:e.top,left:e.right-5,name:"es"}),eastNorth:(e,t)=>({top:e.top-t.height,left:e.right-5,name:"en"}),westSouth:(e,t)=>({top:e.top,left:e.left-t.width+5,name:"ws"}),westNorth:(e,t)=>({top:e.top-t.height,left:e.left-t.width+5,name:"wn"})},Dv=[{menuId:"file",label:"File",groups:[{groupId:"export",items:["menuBar:exportPdf","menuBar:exportWord"]},{groupId:"import",items:["menuBar:importWord"]},{groupId:"revisionHistory",items:["menuBar:revisionHistory"]}]},{menuId:"edit",label:"Edit",groups:[{groupId:"undo",items:["menuBar:undo","menuBar:redo"]},{groupId:"selectAll",items:["menuBar:selectAll"]},{groupId:"findAndReplace",items:["menuBar:findAndReplace"]}]},{menuId:"view",label:"View",groups:[{groupId:"sourceEditingEnhanced",items:["menuBar:sourceEditingEnhanced"]},{groupId:"sourceEditing",items:["menuBar:sourceEditing"]},{groupId:"showBlocks",items:["menuBar:showBlocks"]},{groupId:"previewMergeFields",items:["menuBar:previewMergeFields"]},{groupId:"restrictedEditing",items:["menuBar:restrictedEditing"]}]},{menuId:"insert",label:"Insert",groups:[{groupId:"insertMainWidgets",items:["menuBar:insertImage","menuBar:ckbox","menuBar:ckfinder","menuBar:insertTable"]},{groupId:"insertInline",items:["menuBar:link","menuBar:bookmark","menuBar:comment","menuBar:insertMergeField","menuBar:emoji"]},{groupId:"insertMinorWidgets",items:["menuBar:mediaEmbed","menuBar:insertTemplate","menuBar:specialCharacters","menuBar:blockQuote","menuBar:codeBlock","menuBar:htmlEmbed"]},{groupId:"insertStructureWidgets",items:["menuBar:horizontalLine","menuBar:pageBreak","menuBar:tableOfContents"]},{groupId:"restrictedEditingException",items:["menuBar:restrictedEditingException"]}]},{menuId:"format",label:"Format",groups:[{groupId:"textAndFont",items:[{menuId:"text",label:"Text",groups:[{groupId:"basicStyles",items:["menuBar:bold","menuBar:italic","menuBar:underline","menuBar:strikethrough","menuBar:superscript","menuBar:subscript","menuBar:code"]},{groupId:"textPartLanguage",items:["menuBar:textPartLanguage"]}]},{menuId:"font",label:"Font",groups:[{groupId:"fontProperties",items:["menuBar:fontSize","menuBar:fontFamily"]},{groupId:"fontColors",items:["menuBar:fontColor","menuBar:fontBackgroundColor"]},{groupId:"highlight",items:["menuBar:highlight"]}]},"menuBar:heading"]},{groupId:"list",items:["menuBar:bulletedList","menuBar:numberedList","menuBar:multiLevelList","menuBar:todoList"]},{groupId:"indent",items:["menuBar:alignment","menuBar:indent","menuBar:outdent"]},{groupId:"caseChange",items:["menuBar:caseChange"]},{groupId:"removeFormat",items:["menuBar:removeFormat"]}]},{menuId:"tools",label:"Tools",groups:[{groupId:"aiTools",items:["menuBar:aiAssistant","menuBar:aiCommands"]},{groupId:"tools",items:["menuBar:trackChanges","menuBar:commentsArchive"]}]},{menuId:"help",label:"Help",groups:[{groupId:"help",items:["menuBar:accessibilityHelp"]}]}];function zv({normalizedConfig:e,locale:t,componentFactory:n,extraItems:i}){const r=_d(e);return $v(e,r,i),function(e,t){const n=t.removeItems,i=[];t.items=t.items.filter((({menuId:e})=>!n.includes(e)||(i.push(e),!1))),Uv(t.items,(e=>{e.groups=e.groups.filter((({groupId:e})=>!n.includes(e)||(i.push(e),!1)));for(const t of e.groups)t.items=t.items.filter((e=>{const t=Kv(e);return!n.includes(t)||(i.push(t),!1)}))}));for(const t of n)i.includes(t)||Ea("menu-bar-item-could-not-be-removed",{menuBarConfig:e,itemName:t})}(e,r),$v(e,r,r.addItems),function(e,t,n){Uv(t.items,(i=>{for(const r of i.groups)r.items=r.items.filter((r=>{const s="string"==typeof r&&!n.has(r);return s&&!t.isUsingDefaultConfig&&Ea("menu-bar-item-unavailable",{menuBarConfig:e,parentMenuConfig:_d(i),componentName:r}),!s}))}))}(e,r,n),Hv(e,r),function(e,t){const n=t.t,i={File:n({string:"File",id:"MENU_BAR_MENU_FILE"}),Edit:n({string:"Edit",id:"MENU_BAR_MENU_EDIT"}),View:n({string:"View",id:"MENU_BAR_MENU_VIEW"}),Insert:n({string:"Insert",id:"MENU_BAR_MENU_INSERT"}),Format:n({string:"Format",id:"MENU_BAR_MENU_FORMAT"}),Tools:n({string:"Tools",id:"MENU_BAR_MENU_TOOLS"}),Help:n({string:"Help",id:"MENU_BAR_MENU_HELP"}),Text:n({string:"Text",id:"MENU_BAR_MENU_TEXT"}),Font:n({string:"Font",id:"MENU_BAR_MENU_FONT"})};Uv(e.items,(e=>{e.label in i&&(e.label=i[e.label])}))}(r,t),r}function $v(e,t,n){const i=[];if(0!=n.length){for(const e of n){const n=(s=e.position).startsWith("start")?"start":s.startsWith("end")?"end":s.startsWith("after")?"after":"before",o=Gv(e.position);if("object"==typeof(r=e)&&"menu"in r)if(o){const r=t.items.findIndex((e=>e.menuId===o));-1!=r?"before"===n?(t.items.splice(r,0,e.menu),i.push(e)):"after"===n&&(t.items.splice(r+1,0,e.menu),i.push(e)):jv(t,e.menu,o,n)&&i.push(e)}else"start"===n?(t.items.unshift(e.menu),i.push(e)):"end"===n&&(t.items.push(e.menu),i.push(e));else qv(e)?Uv(t.items,(t=>{if(t.menuId===o)"start"===n?(t.groups.unshift(e.group),i.push(e)):"end"===n&&(t.groups.push(e.group),i.push(e));else{const r=t.groups.findIndex((e=>e.groupId===o));-1!==r&&("before"===n?(t.groups.splice(r,0,e.group),i.push(e)):"after"===n&&(t.groups.splice(r+1,0,e.group),i.push(e)))}})):jv(t,e.item,o,n)&&i.push(e)}var r;for(const t of n)i.includes(t)||Ea("menu-bar-item-could-not-be-added",{menuBarConfig:e,addedItemConfig:t})}var s}function jv(e,t,n,i){let r=!1;return Uv(e.items,(e=>{for(const{groupId:s,items:o}of e.groups){if(r)return;if(s===n)"start"===i?(o.unshift(t),r=!0):"end"===i&&(o.push(t),r=!0);else{const e=o.findIndex((e=>Kv(e)===n));-1!==e&&("before"===i?(o.splice(e,0,t),r=!0):"after"===i&&(o.splice(e+1,0,t),r=!0))}}})),r}function Hv(e,t){const n=t.isUsingDefaultConfig;let i=!1;t.items=t.items.filter((t=>!!t.groups.length||(Wv(e,t,n),!1))),t.items.length?(Uv(t.items,(t=>{t.groups=t.groups.filter((e=>!!e.items.length||(i=!0,!1)));for(const r of t.groups)r.items=r.items.filter((t=>!(Zv(t)&&!t.groups.length&&(Wv(e,t,n),i=!0,1))))})),i&&Hv(e,t)):Wv(e,e,n)}function Wv(e,t,n){n||Ea("menu-bar-menu-empty",{menuBarConfig:e,emptyMenuConfig:t})}function Uv(e,t){if(Array.isArray(e))for(const t of e)n(t);function n(e){t(e);for(const t of e.groups)for(const e of t.items)Zv(e)&&n(e)}}function qv(e){return"object"==typeof e&&"group"in e}function Gv(e){const t=e.match(/^[^:]+:(.+)/);return t?t[1]:null}function Kv(e){return"string"==typeof e?e:e.menuId}function Zv(e){return"object"==typeof e&&"menuId"in e}class Qv extends(Ga()){editor;componentFactory;focusTracker;tooltipManager;poweredBy;evaluationBadge;ariaLiveAnnouncer;isReady=!1;_editableElementsMap=new Map;_focusableToolbarDefinitions=[];_extraMenuBarElements=[];_lastFocusedForeignElement=null;constructor(e){super();const t=e.editing.view;this.editor=e,this.componentFactory=new wv(e),this.focusTracker=new lc,this.tooltipManager=new _v(e),this.poweredBy=new Ev(e),this.evaluationBadge=new Sv(e),this.ariaLiveAnnouncer=new Vv(e),this.set("viewportOffset",this._readViewportOffsetFromConfig()),this.once("ready",(()=>{this._bindBodyCollectionWithFocusTracker(),this.isReady=!0})),this.listenTo(t.document,"layoutChanged",this.update.bind(this)),this.listenTo(t,"scrollToTheSelection",this._handleScrollToTheSelection.bind(this)),this._initFocusTracking()}get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy(),this.tooltipManager.destroy(this.editor),this.poweredBy.destroy(),this.evaluationBadge.destroy();for(const e of this._editableElementsMap.values())e.ckeditorInstance=null,this.editor.keystrokes.stopListening(e);this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[]}setEditableElement(e,t){this._editableElementsMap.set(e,t),t.ckeditorInstance||(t.ckeditorInstance=this.editor),this.focusTracker.add(t);const n=()=>{this.editor.editing.view.getDomRoot(e)||this.editor.keystrokes.listenTo(t)};this.isReady?n():this.once("ready",n)}removeEditableElement(e){const t=this._editableElementsMap.get(e);t&&(this._editableElementsMap.delete(e),this.editor.keystrokes.stopListening(t),this.focusTracker.remove(t),t.ckeditorInstance=null)}getEditableElement(e="main"){return this._editableElementsMap.get(e)}getEditableElementsNames(){return this._editableElementsMap.keys()}addToolbar(e,t={}){e.isRendered?(this.focusTracker.add(e),this.editor.keystrokes.listenTo(e.element)):e.once("render",(()=>{this.focusTracker.add(e),this.editor.keystrokes.listenTo(e.element)})),this._focusableToolbarDefinitions.push({toolbarView:e,options:t})}extendMenuBar(e){this._extraMenuBarElements.push(e)}get _editableElements(){return console.warn("editor-ui-deprecated-editable-elements: The EditorUI#_editableElements property has been deprecated and will be removed in the near future.",{editorUI:this}),this._editableElementsMap}_initMenuBar(e){const t=e.element;this.focusTracker.add(t),this.editor.keystrokes.listenTo(t);const n=function(e){let t;return t="items"in e&&e.items?{items:e.items,removeItems:[],addItems:[],isVisible:!0,isUsingDefaultConfig:!1,...e}:{items:_d(Dv),addItems:[],removeItems:[],isVisible:!0,isUsingDefaultConfig:!0,...e},t}(this.editor.config.get("menuBar")||{});e.fillFromConfig(n,this.componentFactory,this._extraMenuBarElements),this.editor.keystrokes.set("Esc",((e,n)=>{t.contains(this.editor.ui.focusTracker.focusedElement)&&(this._lastFocusedForeignElement?(this._lastFocusedForeignElement.focus(),this._lastFocusedForeignElement=null):this.editor.editing.view.focus(),n())})),this.editor.keystrokes.set("Alt+F9",((n,i)=>{t.contains(this.editor.ui.focusTracker.focusedElement)||(this._saveLastFocusedForeignElement(),e.isFocusBorderEnabled=!0,e.focus(),i())}))}_readViewportOffsetFromConfig(){const e=this.editor,t=e.config.get("ui.viewportOffset");if(t)return t;const n=e.config.get("toolbar.viewportTopOffset");return n?(console.warn("editor-ui-deprecated-viewport-offset-config: The `toolbar.vieportTopOffset` configuration option is deprecated. It will be removed from future CKEditor versions. Use `ui.viewportOffset.top` instead."),{top:n}):{top:0}}_initFocusTracking(){const e=this.editor;let t;e.keystrokes.set("Alt+F10",((e,n)=>{this._saveLastFocusedForeignElement();const i=this._getCurrentFocusedToolbarDefinition();i&&t||(t=this._getFocusableCandidateToolbarDefinitions());for(let e=0;e<t.length;e++){const e=t.shift();if(t.push(e),e!==i&&this._focusFocusableCandidateToolbar(e)){i&&i.options.afterBlur&&i.options.afterBlur();break}}n()})),e.keystrokes.set("Esc",((t,n)=>{const i=this._getCurrentFocusedToolbarDefinition();i&&(this._lastFocusedForeignElement?(this._lastFocusedForeignElement.focus(),this._lastFocusedForeignElement=null):e.editing.view.focus(),i.options.afterBlur&&i.options.afterBlur(),n())}))}_saveLastFocusedForeignElement(){const e=this.focusTracker.focusedElement;Array.from(this._editableElementsMap.values()).includes(e)&&!Array.from(this.editor.editing.view.domRoots.values()).includes(e)&&(this._lastFocusedForeignElement=e)}_getFocusableCandidateToolbarDefinitions(){const e=[];for(const t of this._focusableToolbarDefinitions){const{toolbarView:n,options:i}=t;(Ol(n.element)||i.beforeFocus)&&e.push(t)}return e.sort(((e,t)=>Yv(e)-Yv(t))),e}_getCurrentFocusedToolbarDefinition(){for(const e of this._focusableToolbarDefinitions)if(e.toolbarView.element&&e.toolbarView.element.contains(this.focusTracker.focusedElement))return e;return null}_focusFocusableCandidateToolbar(e){const{toolbarView:t,options:{beforeFocus:n}}=e;return n&&n(),!!Ol(t.element)&&(t.focus(),!0)}_handleScrollToTheSelection(e,t){const n={top:0,bottom:0,left:0,right:0,...this.viewportOffset};t.viewportOffset.top+=n.top,t.viewportOffset.bottom+=n.bottom,t.viewportOffset.left+=n.left,t.viewportOffset.right+=n.right}_bindBodyCollectionWithFocusTracker(){const e=this.view.body;for(const t of e)this.focusTracker.add(t.element);e.on("add",((e,t)=>{this.focusTracker.add(t.element)})),e.on("remove",((e,t)=>{this.focusTracker.remove(t.element)}))}}function Yv(e){const{toolbarView:t,options:n}=e;let i=10;return Ol(t.element)&&i--,n.isContextual&&i--,i}class Jv extends Lb{body;menuBarView;constructor(e){super(e),this.body=new uw(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}class Xv extends Jv{top;main;_voiceLabelView;constructor(e){super(e),this.top=this.createCollection(),this.main=this.createCollection(),this._voiceLabelView=this._createVoiceLabel(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-editor","ck-rounded-corners"],role:"application",dir:e.uiLanguageDirection,lang:e.uiLanguage,"aria-labelledby":this._voiceLabelView.id},children:[this._voiceLabelView,{tag:"div",attributes:{class:["ck","ck-editor__top","ck-reset_all"],role:"presentation"},children:this.top},{tag:"div",attributes:{class:["ck","ck-editor__main"],role:"presentation"},children:this.main}]})}_createVoiceLabel(){const e=this.t,t=new ow;return t.text=e("Rich Text Editor"),t.extendTemplate({attributes:{class:"ck-voice-label"}}),t}}class ey extends Lb{name=null;_editingView;_editableElement;_hasExternalElement;constructor(e,t,n){super(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-content","ck-editor__editable","ck-rounded-corners"],lang:e.contentLanguage,dir:e.contentLanguageDirection}}),this.set("isFocused",!1),this._editableElement=n,this._hasExternalElement=!!this._editableElement,this._editingView=t}render(){super.render(),this._hasExternalElement?this.template.apply(this.element=this._editableElement):this._editableElement=this.element,this.on("change:isFocused",(()=>this._updateIsFocusedClasses())),this._updateIsFocusedClasses()}destroy(){this._hasExternalElement&&this.template.revert(this._editableElement),super.destroy()}get hasExternalElement(){return this._hasExternalElement}_updateIsFocusedClasses(){const e=this._editingView;function t(t){e.change((n=>{const i=e.document.getRoot(t.name);n.addClass(t.isFocused?"ck-focused":"ck-blurred",i),n.removeClass(t.isFocused?"ck-blurred":"ck-focused",i)}))}e.isRenderingInProgress?function n(i){e.once("change:isRenderingInProgress",((e,r,s)=>{s?n(i):t(i)}))}(this):t(this)}}class ty extends ey{_options;constructor(e,t,n,i={}){super(e,t,n),this._options=i,this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}})}render(){super.render();const e=this._editingView;e.change((t=>{const n=e.document.getRoot(this.name);t.setAttribute("aria-label",this.getEditableAriaLabel(),n)}))}getEditableAriaLabel(){const e=this.locale.t,t=this._options.label,n=this._editableElement,i=this.name;if("string"==typeof t)return t;if("object"==typeof t)return t[i];if("function"==typeof t)return t(this);if(n){const e=n.getAttribute("aria-label");if(e)return e}return e("Rich Text Editor. Editing area: %0",i)}}class ny extends ff{static get pluginName(){return"Notification"}static get isOfficialPlugin(){return!0}init(){this.on("show:warning",((e,t)=>{window.alert(t.message)}),{priority:"lowest"})}showSuccess(e,t={}){this._showNotification({message:e,type:"success",namespace:t.namespace,title:t.title})}showInfo(e,t={}){this._showNotification({message:e,type:"info",namespace:t.namespace,title:t.title})}showWarning(e,t={}){this._showNotification({message:e,type:"warning",namespace:t.namespace,title:t.title})}_showNotification(e){const t=e.namespace?`show:${e.type}:${e.namespace}`:`show:${e.type}`;this.fire(t,{message:e.message,type:e.type,title:e.title||""})}}class iy extends(Ga()){constructor(e,t){super(),t&&Uc(this,t),e&&this.set(e)}}const ry=El("px");class sy extends cf{positionLimiter;visibleStack;_viewToStack=new Map;_idToStack=new Map;_view=null;_rotatorView=null;_fakePanelsView=null;static get pluginName(){return"ContextualBalloon"}static get isOfficialPlugin(){return!0}constructor(e){super(e),this.positionLimiter=()=>{const e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},this.decorate("getPositionOptions"),this.set("visibleView",null),this.set("_numberOfStacks",0),this.set("_singleViewMode",!1)}destroy(){super.destroy(),this._view&&this._view.destroy(),this._rotatorView&&this._rotatorView.destroy(),this._fakePanelsView&&this._fakePanelsView.destroy()}get view(){return this._view||this._createPanelView(),this._view}hasView(e){return Array.from(this._viewToStack.keys()).includes(e)}add(e){if(this._view||this._createPanelView(),this.hasView(e.view))throw new Aa("contextualballoon-add-view-exist",[this,e]);const t=e.stackId||"main";if(!this._idToStack.has(t))return this._idToStack.set(t,new Map([[e.view,e]])),this._viewToStack.set(e.view,this._idToStack.get(t)),this._numberOfStacks=this._idToStack.size,void(this._visibleStack&&!e.singleViewMode||this.showStack(t));const n=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),n.set(e.view,e),this._viewToStack.set(e.view,n),n===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new Aa("contextualballoon-remove-view-not-exist",[this,e]);const t=this._viewToStack.get(e);this._singleViewMode&&this.visibleView===e&&(this._singleViewMode=!1),this.visibleView===e&&(1===t.size?this._idToStack.size>1?this._showNextStack():(this.view.hide(),this.visibleView=null,this._rotatorView.hideView()):this._showView(Array.from(t.values())[t.size-2])),1===t.size?(this._idToStack.delete(this._getStackId(t)),this._numberOfStacks=this._idToStack.size):t.delete(e),this._viewToStack.delete(e)}updatePosition(e){e&&(this._visibleStack.get(this.visibleView).position=e),this.view.pin(this.getPositionOptions()),this._fakePanelsView.updatePosition()}getPositionOptions(){let e=Array.from(this._visibleStack.values()).pop().position;return e&&(e.limiter||(e=Object.assign({},e,{limiter:this.positionLimiter})),e=Object.assign({},e,{viewportOffsetConfig:this.editor.ui.viewportOffset})),e}showStack(e){this.visibleStack=e;const t=this._idToStack.get(e);if(!t)throw new Aa("contextualballoon-showstack-stack-not-exist",this);this._visibleStack!==t&&this._showView(Array.from(t.values()).pop())}_createPanelView(){this._view=new zw(this.editor.locale),this.editor.ui.view.body.add(this._view),this._rotatorView=this._createRotatorView(),this._fakePanelsView=this._createFakePanelsView()}get _visibleStack(){return this._viewToStack.get(this.visibleView)}_getStackId(e){return Array.from(this._idToStack.entries()).find((t=>t[1]===e))[0]}_showNextStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)+1;e[t]||(t=0),this.showStack(this._getStackId(e[t]))}_showPrevStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)-1;e[t]||(t=e.length-1),this.showStack(this._getStackId(e[t]))}_createRotatorView(){const e=new oy(this.editor.locale),t=this.editor.locale.t;return this.view.content.add(e),e.bind("isNavigationVisible").to(this,"_numberOfStacks",this,"_singleViewMode",((e,t)=>!t&&e>1)),e.on("change:isNavigationVisible",(()=>this.updatePosition()),{priority:"low"}),e.bind("counter").to(this,"visibleView",this,"_numberOfStacks",((e,n)=>{if(n<2)return"";const i=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("%0 of %1",[i,n])})),e.buttonNextView.on("execute",(()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showNextStack()})),e.buttonPrevView.on("execute",(()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showPrevStack()})),e}_createFakePanelsView(){const e=new ay(this.editor.locale,this.view);return e.bind("numberOfPanels").to(this,"_numberOfStacks",this,"_singleViewMode",((e,t)=>!t&&e>=2?Math.min(e-1,2):0)),e.listenTo(this.view,"change:top",(()=>e.updatePosition())),e.listenTo(this.view,"change:left",(()=>e.updatePosition())),this.editor.ui.view.body.add(e),e}_showView({view:e,balloonClassName:t="",withArrow:n=!0,singleViewMode:i=!1}){this.view.class=t,this.view.withArrow=n,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this.getPositionOptions()),this._fakePanelsView.updatePosition(),i&&(this._singleViewMode=!0)}}class oy extends Lb{focusTracker;buttonPrevView;buttonNextView;content;constructor(e){super(e);const t=e.t,n=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new lc,this.buttonPrevView=this._createButtonView(t("Previous"),Pf.previousArrow),this.buttonNextView=this._createButtonView(t("Next"),Pf.nextArrow),this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-rotator"],"z-index":"-1"},children:[{tag:"div",attributes:{class:["ck-balloon-rotator__navigation",n.to("isNavigationVisible",(e=>e?"":"ck-hidden"))]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:n.to("counter")}]},this.buttonNextView]},{tag:"div",attributes:{class:"ck-balloon-rotator__content"},children:this.content}]})}render(){super.render(),this.focusTracker.add(this.element)}destroy(){super.destroy(),this.focusTracker.destroy()}showView(e){this.hideView(),this.content.add(e)}hideView(){this.content.clear()}_createButtonView(e,t){const n=new jb(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n}}class ay extends Lb{content;_balloonPanelView;constructor(e,t){super(e);const n=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("height",0),this.set("width",0),this.set("numberOfPanels",0),this.content=this.createCollection(),this._balloonPanelView=t,this.setTemplate({tag:"div",attributes:{class:["ck-fake-panel",n.to("numberOfPanels",(e=>e?"":"ck-hidden"))],style:{top:n.to("top",ry),left:n.to("left",ry),width:n.to("width",ry),height:n.to("height",ry)}},children:this.content}),this.on("change:numberOfPanels",((e,t,n,i)=>{n>i?this._addPanels(n-i):this._removePanels(i-n),this.updatePosition()}))}_addPanels(e){for(;e--;){const e=new Lb;e.setTemplate({tag:"div"}),this.content.add(e),this.registerChild(e)}}_removePanels(e){for(;e--;){const e=this.content.last;this.content.remove(e),this.deregisterChild(e),e.destroy()}}updatePosition(){if(this.numberOfPanels){const{top:e,left:t}=this._balloonPanelView,{width:n,height:i}=new vl(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:n,height:i})}}}const ly=El("px");class cy extends Lb{content;contentPanelElement;_contentPanelPlaceholder;constructor(e){super(e);const t=this.bindTemplate;this.set("isActive",!1),this.set("isSticky",!1),this.set("limiterElement",null),this.set("limiterBottomOffset",50),this.set("viewportTopOffset",0),this.set("_marginLeft",null),this.set("_isStickyToTheBottomOfLimiter",!1),this.set("_stickyTopOffset",null),this.set("_stickyBottomOffset",null),this.content=this.createCollection(),this._contentPanelPlaceholder=new gb({tag:"div",attributes:{class:["ck","ck-sticky-panel__placeholder"],style:{display:t.to("isSticky",(e=>e?"block":"none")),height:t.to("isSticky",(e=>e?ly(this._contentPanelRect.height):null))}}}).render(),this.contentPanelElement=new gb({tag:"div",attributes:{class:["ck","ck-sticky-panel__content",t.if("isSticky","ck-sticky-panel__content_sticky"),t.if("_isStickyToTheBottomOfLimiter","ck-sticky-panel__content_sticky_bottom-limit")],style:{width:t.to("isSticky",(e=>e?ly(this._contentPanelPlaceholder.getBoundingClientRect().width):null)),top:t.to("_stickyTopOffset",(e=>e?ly(e):e)),bottom:t.to("_stickyBottomOffset",(e=>e?ly(e):e)),marginLeft:t.to("_marginLeft")}},children:this.content}).render(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-sticky-panel"]},children:[this._contentPanelPlaceholder,this.contentPanelElement]})}render(){super.render(),this.checkIfShouldBeSticky(),this.listenTo(ra.document,"scroll",(()=>{this.checkIfShouldBeSticky()}),{useCapture:!0}),this.listenTo(this,"change:isActive",(()=>{this.checkIfShouldBeSticky()}))}checkIfShouldBeSticky(){if(!this.limiterElement||!this.isActive)return void this._unstick();const e=new vl(this.limiterElement);let t=e.getVisible();if(t){const e=new vl(ra.window);e.top+=this.viewportTopOffset,e.height-=this.viewportTopOffset,t=t.getIntersection(e)}if(t&&e.top<t.top){const n=t.top;if(n+this._contentPanelRect.height+this.limiterBottomOffset>t.bottom){const n=Math.max(e.bottom-t.bottom,0)+this.limiterBottomOffset;e.bottom-n>e.top+this._contentPanelRect.height?this._stickToBottomOfLimiter(n):this._unstick()}else this._contentPanelRect.height+this.limiterBottomOffset<e.height?this._stickToTopOfAncestors(n):this._unstick()}else this._unstick()}_stickToTopOfAncestors(e){this.isSticky=!0,this._isStickyToTheBottomOfLimiter=!1,this._stickyTopOffset=e,this._stickyBottomOffset=null,this._marginLeft=ly(-ra.window.scrollX)}_stickToBottomOfLimiter(e){this.isSticky=!0,this._isStickyToTheBottomOfLimiter=!0,this._stickyTopOffset=null,this._stickyBottomOffset=e,this._marginLeft=ly(-ra.window.scrollX)}_unstick(){this.isSticky=!1,this._isStickyToTheBottomOfLimiter=!1,this._stickyTopOffset=null,this._stickyBottomOffset=null,this._marginLeft=null}get _contentPanelRect(){return new vl(this.contentPanelElement)}}const dy=El("px");class uy extends cf{toolbarView;focusTracker;_balloonConfig;_resizeObserver=null;_balloon;_fireSelectionChangeDebounced;static get pluginName(){return"BalloonToolbar"}static get isOfficialPlugin(){return!0}static get requires(){return[sy]}constructor(e){super(e),this._balloonConfig=Ww(e.config.get("balloonToolbar")),this.toolbarView=this._createToolbarView(),this.focusTracker=new lc,this._trackFocusableEditableElements(),this.focusTracker.add(this.toolbarView),e.ui.addToolbar(this.toolbarView,{beforeFocus:()=>this.show(!0),afterBlur:()=>this.hide(),isContextual:!0}),this._balloon=e.plugins.get(sy),this._fireSelectionChangeDebounced=id((()=>this.fire("_selectionChangeDebounced")),200),this.decorate("show")}init(){const e=this.editor,t=e.model.document.selection;this.listenTo(this.focusTracker,"change:isFocused",((e,t,n)=>{const i=this._balloon.visibleView===this.toolbarView;!n&&i?this.hide():n&&this.show()})),this.listenTo(t,"change:range",((e,n)=>{(n.directChange||t.isCollapsed)&&this.hide(),this._fireSelectionChangeDebounced()})),this.listenTo(this,"_selectionChangeDebounced",(()=>{this.editor.editing.view.document.isFocused&&this.show()})),this._balloonConfig.shouldNotGroupWhenFull||this.listenTo(e,"ready",(()=>{const t=e.ui.view.editable.element;this._resizeObserver=new Cl(t,(e=>{this.toolbarView.maxWidth=dy(.9*e.contentRect.width)}))})),this.listenTo(this.toolbarView,"groupedItemsUpdate",(()=>{this._updatePosition()})),e.ui.once("ready",(()=>{this.toolbarView.fillFromConfig(this._balloonConfig,this.editor.ui.componentFactory)}))}_createToolbarView(){const e=this.editor.locale.t,t=!this._balloonConfig.shouldNotGroupWhenFull,n=new qw(this.editor.locale,{shouldGroupWhenFull:t,isFloating:!0});return n.ariaLabel=e("Editor contextual toolbar"),n.render(),n}show(e=!1){const t=this.editor,n=t.model.document.selection,i=t.model.schema;this._balloon.hasView(this.toolbarView)||n.isCollapsed&&!e||function(e,t){return 1!==e.rangeCount&&[...e.getRanges()].every((e=>{const n=e.getContainedElement();return n&&t.isSelectable(n)}))}(n,i)||Array.from(this.toolbarView.items).every((e=>void 0!==e.isEnabled&&!e.isEnabled))||(this.listenTo(this.editor.ui,"update",(()=>{this._updatePosition()})),this._balloon.add({view:this.toolbarView,position:this._getBalloonPositionData(),balloonClassName:"ck-toolbar-container"}))}hide(){this._balloon.hasView(this.toolbarView)&&(this.stopListening(this.editor.ui,"update"),this._balloon.remove(this.toolbarView))}_trackFocusableEditableElements(){const{editor:e,focusTracker:t}=this,{editing:n}=e;n.view.addObserver(class extends Zu{observe(e){t.add(e)}stopObserving(e){t.remove(e)}})}_getBalloonPositionData(){const e=this.editor.editing.view,t=e.document,n=t.selection,i=t.selection.isBackward;return{target:()=>{const t=i?n.getFirstRange():n.getLastRange(),r=vl.getDomRangeRects(e.domConverter.viewRangeToDom(t));return i?r[0]:(r.length>1&&0===r[r.length-1].width&&r.pop(),r[r.length-1])},positions:this._getBalloonPositions(i)}}_updatePosition(){this._balloon.updatePosition(this._getBalloonPositionData())}destroy(){super.destroy(),this.stopListening(),this._fireSelectionChangeDebounced.cancel(),this.toolbarView.destroy(),this.focusTracker.destroy(),this._resizeObserver&&this._resizeObserver.destroy()}_getBalloonPositions(e){const t=aa.isSafari&&aa.isiOS?zw.generatePositions({heightOffset:Math.max(zw.arrowHeightOffset,Math.round(20/ra.window.visualViewport.scale))}):zw.defaultPositions;return e?[t.northWestArrowSouth,t.northWestArrowSouthWest,t.northWestArrowSouthEast,t.northWestArrowSouthMiddleEast,t.northWestArrowSouthMiddleWest,t.southWestArrowNorth,t.southWestArrowNorthWest,t.southWestArrowNorthEast,t.southWestArrowNorthMiddleWest,t.southWestArrowNorthMiddleEast]:[t.southEastArrowNorth,t.southEastArrowNorthEast,t.southEastArrowNorthWest,t.southEastArrowNorthMiddleEast,t.southEastArrowNorthMiddleWest,t.northEastArrowSouth,t.northEastArrowSouthEast,t.northEastArrowSouthWest,t.northEastArrowSouthMiddleEast,t.northEastArrowSouthMiddleWest]}}class hy extends iw{arrowView;constructor(e){super(e);const t=this.bindTemplate;this.set({withText:!0,role:"menuitem"}),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__button"],"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to("isOn",(e=>String(e))),"data-cke-tooltip-disabled":t.to("isOn")},on:{mouseenter:t.to("mouseenter")}})}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new zb;return e.content=bw,e.extendTemplate({attributes:{class:"ck-menu-bar__menu__button__arrow"}}),e}}class my extends Lb{children;constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!1),this.set("position","se"),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-menu-bar__menu__panel",t.to("position",(e=>`ck-menu-bar__menu__panel_position_${e}`)),t.if("isVisible","ck-hidden",(e=>!e))],tabindex:"-1"},children:this.children,on:{selectstart:t.to((e=>{"input"!==e.target.tagName.toLocaleLowerCase()&&e.preventDefault()}))}})}focus(e=1){this.children.length&&(1===e?this.children.first.focus():this.children.last.focus())}}class gy extends Lb{buttonView;panelView;focusTracker;keystrokes;constructor(e){super(e);const t=this.bindTemplate;this.buttonView=new hy(e),this.buttonView.delegate("mouseenter").to(this),this.buttonView.bind("isOn","isEnabled").to(this,"isOpen","isEnabled"),this.panelView=new my(e),this.panelView.bind("isVisible").to(this,"isOpen"),this.keystrokes=new hc,this.focusTracker=new lc,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("panelPosition","w"),this.set("class",void 0),this.set("parentMenuView",null),this.setTemplate({tag:"div",attributes:{class:["ck","ck-menu-bar__menu",t.to("class"),t.if("isEnabled","ck-disabled",(e=>!e)),t.if("parentMenuView","ck-menu-bar__menu_top-level",(e=>!e))]},children:[this.buttonView,this.panelView]})}render(){super.render(),this.focusTracker.add(this.buttonView.element),this.focusTracker.add(this.panelView.element),this.keystrokes.listenTo(this.element),Bv.closeOnEscKey(this),this._repositionPanelOnOpen()}_attachBehaviors(){this.parentMenuView?(Bv.openOnButtonClick(this),Bv.openOnArrowRightKey(this),Bv.closeOnArrowLeftKey(this),Bv.openAndFocusOnEnterKeyPress(this),Bv.closeOnParentClose(this)):(this._propagateArrowKeystrokeEvents(),Bv.openAndFocusPanelOnArrowDownKey(this),Bv.toggleOnButtonClick(this))}_propagateArrowKeystrokeEvents(){this.keystrokes.set("arrowright",((e,t)=>{this.fire("arrowright"),t()})),this.keystrokes.set("arrowleft",((e,t)=>{this.fire("arrowleft"),t()}))}_repositionPanelOnOpen(){this.on("change:isOpen",((e,t,n)=>{if(!n)return;const i=gy._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions});this.panelView.position=i?i.name:this._defaultMenuPositionName}))}focus(){this.buttonView.focus()}get _panelPositions(){const{southEast:e,southWest:t,northEast:n,northWest:i,westSouth:r,eastSouth:s,westNorth:o,eastNorth:a}=Fv;return"ltr"===this.locale.uiLanguageDirection?this.parentMenuView?[s,a,r,o]:[e,t,n,i]:this.parentMenuView?[r,o,s,a]:[t,e,i,n]}get _defaultMenuPositionName(){return"ltr"===this.locale.uiLanguageDirection?this.parentMenuView?"es":"se":this.parentMenuView?"ws":"sw"}static _getOptimalPosition=Vl}class py extends Bw{constructor(e){super(e),this.role="menu",this.items.on("change",this._setItemsCheckSpace.bind(this))}_setItemsCheckSpace(){const e=Array.from(this.items).some((e=>{const t=fy(e);return t&&t.isToggleable}));this.items.forEach((t=>{const n=fy(t);n&&(n.hasCheckSpace=e)}))}}function fy(e){return e instanceof Nw?e.children.map((e=>function(e){return"object"==typeof e&&"buttonView"in e&&e.buttonView instanceof jb}(e)?e.buttonView:e)).find((e=>e instanceof iw)):null}class by extends gw{constructor(e){super(e),this.set({withText:!0,withKeystroke:!0,tooltip:!1,role:"menuitem"}),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item__button"]}})}}const wy=["mouseenter","arrowleft","arrowright","change:isOpen"];class vy extends Lb{children;menus=[];constructor(e){super(e);const t=e.t,n=this.bindTemplate;this.set({isOpen:!1,isFocusBorderEnabled:!1}),this._setupIsOpenUpdater(),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-menu-bar",n.if("isFocusBorderEnabled","ck-menu-bar_focus-border-enabled")],"aria-label":t("Editor menu bar"),role:"menubar"},children:this.children})}fillFromConfig(e,t,n=[]){const i=zv({normalizedConfig:e,locale:this.locale,componentFactory:t,extraItems:n}).items.map((e=>this._createMenu({componentFactory:t,menuDefinition:e})));this.children.addMany(i)}render(){super.render(),Mv.toggleMenusAndFocusItemsOnHover(this),Mv.closeMenusWhenTheBarCloses(this),Mv.closeMenuWhenAnotherOnTheSameLevelOpens(this),Mv.focusCycleMenusOnArrows(this),Mv.closeOnClickOutside(this),Mv.enableFocusHighlightOnInteraction(this)}focus(){this.children.first&&this.children.first.focus()}close(){for(const e of this.children)e.isOpen=!1}registerMenu(e,t=null){t?(e.delegate(...wy).to(t),e.parentMenuView=t):e.delegate(...wy).to(this,(e=>"menu:"+e)),e._attachBehaviors(),this.menus.push(e)}_createMenu({componentFactory:e,menuDefinition:t,parentMenuView:n}){const i=this.locale,r=new gy(i);return this.registerMenu(r,n),r.buttonView.set({label:t.label}),r.once("change:isOpen",(()=>{const n=new py(i);n.ariaLabel=t.label,r.panelView.children.add(n),n.items.addMany(this._createMenuItems({menuDefinition:t,parentMenuView:r,componentFactory:e}))})),r}_createMenuItems({menuDefinition:e,parentMenuView:t,componentFactory:n}){const i=this.locale,r=[];for(const s of e.groups){for(const e of s.items){const s=new Lv(i,t);if(or(e))s.children.add(this._createMenu({componentFactory:n,menuDefinition:e,parentMenuView:t}));else{const i=this._createMenuItemContentFromFactory({componentName:e,componentFactory:n,parentMenuView:t});if(!i)continue;s.children.add(i)}r.push(s)}s!==e.groups[e.groups.length-1]&&r.push(new Lw(i))}return r}_createMenuItemContentFromFactory({componentName:e,parentMenuView:t,componentFactory:n}){const i=n.create(e);return i instanceof gy||i instanceof sw||i instanceof by?(this._registerMenuTree(i,t),i.on("execute",(()=>{this.close()})),i):(Ea("menu-bar-component-unsupported",{componentName:e,componentView:i}),null)}_registerMenuTree(e,t){if(!(e instanceof gy))return void e.delegate("mouseenter").to(t);this.registerMenu(e,t);const n=e.panelView.children.filter((e=>e instanceof py))[0];if(!n)return void e.delegate("mouseenter").to(t);const i=n.items.filter((e=>e instanceof Nw));for(const t of i)this._registerMenuTree(t.children.get(0),e)}_setupIsOpenUpdater(){let e;this.on("menu:change:isOpen",((t,n,i)=>{clearTimeout(e),i?this.isOpen=!0:e=setTimeout((()=>{this.isOpen=Array.from(this.children).some((e=>e.isOpen))}),0)}))}}const yy=["left","right","center","justify"];function _y(e){return yy.includes(e)}function ky(e,t){return"rtl"==t.contentLanguageDirection?"right"===e:"left"===e}function xy(e){const t=e.map((e=>{let t;return t="string"==typeof e?{name:e}:e,t})).filter((e=>{const t=yy.includes(e.name);return t||Ea("alignment-config-name-not-recognized",{option:e}),t})),n=t.filter((e=>Boolean(e.className))).length;if(n&&n<t.length)throw new Aa("alignment-config-classnames-are-missing",{configuredOptions:e});return t.forEach(((t,n,i)=>{const r=i.slice(n+1);if(r.some((e=>e.name==t.name)))throw new Aa("alignment-config-name-already-defined",{option:t,configuredOptions:e});if(t.className&&r.some((e=>e.className==t.className)))throw new Aa("alignment-config-classname-already-defined",{option:t,configuredOptions:e})})),t}const Cy="alignment";class Ay extends uf{refresh(){const e=this.editor.locale,t=ac(this.editor.model.document.selection.getSelectedBlocks());this.isEnabled=Boolean(t)&&this._canBeAligned(t),this.isEnabled&&t.hasAttribute("alignment")?this.value=t.getAttribute("alignment"):this.value="rtl"===e.contentLanguageDirection?"right":"left"}execute(e={}){const t=this.editor,n=t.locale,i=t.model,r=i.document,s=e.value;i.change((e=>{const t=Array.from(r.selection.getSelectedBlocks()).filter((e=>this._canBeAligned(e))),i=t[0].getAttribute("alignment");ky(s,n)||i===s||!s?function(e,t){for(const n of e)t.removeAttribute(Cy,n)}(t,e):function(e,t,n){for(const i of e)t.setAttribute(Cy,n,i)}(t,e,s)}))}_canBeAligned(e){return this.editor.model.schema.checkAttribute(e,Cy)}}class Ey extends cf{static get pluginName(){return"AlignmentEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("alignment",{options:yy.map((e=>({name:e})))})}init(){const e=this.editor,t=e.locale,n=e.model.schema,i=xy(e.config.get("alignment.options")).filter((e=>_y(e.name)&&!ky(e.name,t))),r=i.some((e=>!!e.className));n.extend("$block",{allowAttributes:"alignment"}),e.model.schema.setAttributeProperties("alignment",{isFormatting:!0}),r?e.conversion.attributeToAttribute(function(e){const t={};for(const n of e)t[n.name]={key:"class",value:n.className};return{model:{key:"alignment",values:e.map((e=>e.name))},view:t}}(i)):e.conversion.for("downcast").attributeToAttribute(function(e){const t={};for(const{name:n}of e)t[n]={key:"style",value:{"text-align":n}};return{model:{key:"alignment",values:e.map((e=>e.name))},view:t}}(i));const s=function(e){const t=[];for(const{name:n}of e)t.push({view:{key:"style",value:{"text-align":n}},model:{key:"alignment",value:n}});return t}(i);for(const t of s)e.conversion.for("upcast").attributeToAttribute(t);const o=function(e){const t=[];for(const{name:n}of e)t.push({view:{key:"align",value:n},model:{key:"alignment",value:n}});return t}(i);for(const t of o)e.conversion.for("upcast").attributeToAttribute(t);e.commands.add("alignment",new Ay(e))}}const Ty=(()=>new Map([["left",Pf.alignLeft],["right",Pf.alignRight],["center",Pf.alignCenter],["justify",Pf.alignJustify]]))();class Sy extends cf{get localizedOptionTitles(){const e=this.editor.t;return{left:e("Align left"),right:e("Align right"),center:e("Align center"),justify:e("Justify")}}static get pluginName(){return"AlignmentUI"}static get isOfficialPlugin(){return!0}init(){const e=xy(this.editor.config.get("alignment.options"));e.map((e=>e.name)).filter(_y).forEach((e=>this._addButton(e))),this._addToolbarDropdown(e),this._addMenuBarMenu(e)}_addButton(e){this.editor.ui.componentFactory.add(`alignment:${e}`,(t=>this._createButton(t,e)))}_createButton(e,t,n={}){const i=this.editor,r=i.commands.get("alignment"),s=new jb(e);return s.set({label:this.localizedOptionTitles[t],icon:Ty.get(t),tooltip:!0,isToggleable:!0,...n}),s.bind("isEnabled").to(r),s.bind("isOn").to(r,"value",(e=>e===t)),this.listenTo(s,"execute",(()=>{i.execute("alignment",{value:t}),i.editing.view.focus()})),s}_addToolbarDropdown(e){const t=this.editor;t.ui.componentFactory.add("alignment",(n=>{const i=Yw(n),r="rtl"===n.uiLanguageDirection?"w":"e",s=n.t;Jw(i,(()=>e.map((e=>this._createButton(n,e.name,{tooltipPosition:r})))),{enableActiveItemFocusOnDropdownOpen:!0,isVertical:!0,ariaLabel:s("Text alignment toolbar")}),i.buttonView.set({label:s("Text alignment"),tooltip:!0}),i.extendTemplate({attributes:{class:"ck-alignment-dropdown"}});const o="rtl"===n.contentLanguageDirection?Ty.get("right"):Ty.get("left"),a=t.commands.get("alignment");return i.buttonView.bind("icon").to(a,"value",(e=>Ty.get(e)||o)),i.bind("isEnabled").to(a,"isEnabled"),this.listenTo(i,"execute",(()=>{t.editing.view.focus()})),i}))}_addMenuBarMenu(e){const t=this.editor;t.ui.componentFactory.add("menuBar:alignment",(n=>{const i=t.commands.get("alignment"),r=n.t,s=new gy(n),o=new py(n);s.bind("isEnabled").to(i),o.set({ariaLabel:r("Text alignment"),role:"menu"}),s.buttonView.set({label:r("Text alignment")});for(const r of e){const e=new Lv(n,s),a=new sw(n);a.delegate("execute").to(s),a.set({label:this.localizedOptionTitles[r.name],icon:Ty.get(r.name),role:"menuitemcheckbox",isToggleable:!0}),a.on("execute",(()=>{t.execute("alignment",{value:r.name}),t.editing.view.focus()})),a.bind("isOn").to(i,"value",(e=>e===r.name)),a.bind("isEnabled").to(i,"isEnabled"),e.children.add(a),o.items.add(e)}return s.panelView.children.add(o),s}))}}class Py extends cf{static get requires(){return[Ey,Sy]}static get pluginName(){return"Alignment"}static get isOfficialPlugin(){return!0}}class Iy{model;limit;_isLocked;_size;_batch=null;_changeCallback;_selectionChangeCallback;constructor(e,t=20){this.model=e,this._size=0,this.limit=t,this._isLocked=!1,this._changeCallback=(e,t)=>{t.isLocal&&t.isUndoable&&t!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}get size(){return this._size}input(e){this._size+=e,this._size>=this.limit&&this._reset(!0)}get isLocked(){return this._isLocked}lock(){this._isLocked=!0}unlock(){this._isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(e=!1){this.isLocked&&!e||(this._batch=null,this._size=0)}}class Oy extends uf{_buffer;constructor(e,t){super(e),this._buffer=new Iy(e.model,t),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,n=t.document,i=e.text||"",r=i.length;let s=n.selection;if(e.selection?s=e.selection:e.range&&(s=t.createSelection(e.range)),!t.canEditAt(s))return;const o=e.resultRange;t.enqueueChange(this._buffer.batch,(e=>{this._buffer.lock();const a=Array.from(n.selection.getAttributes());t.deleteContent(s),i&&t.insertContent(e.createText(i,a),s),o?e.setSelection(o):s.is("documentSelection")||e.setSelection(s),this._buffer.unlock(),this._buffer.input(r)}))}}const Vy=["insertText","insertReplacementText"],Ry=[...Vy,"insertCompositionText"];class Ny extends Zu{focusObserver;constructor(e){super(e),this.focusObserver=e.getObserver(nh);const t=aa.isAndroid?Ry:Vy,n=e.document;n.on("beforeinput",((i,r)=>{if(!this.isEnabled)return;const{data:s,targetRanges:o,inputType:a,domEvent:l}=r;if(!t.includes(a))return;this.focusObserver.flush();const c=new ya(n,"insertText");n.fire(c,new Qu(e,l,{text:s,selection:e.createSelection(o)})),c.stop.called&&i.stop()})),aa.isAndroid||n.on("compositionend",((t,{data:i,domEvent:r})=>{this.isEnabled&&i&&n.fire("insertText",new Qu(e,r,{text:i}))}),{priority:"lowest"})}observe(){}stopObserving(){}}class Ly extends cf{_compositionQueue;static get pluginName(){return"Input"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model,n=e.editing.view,i=e.editing.mapper,r=t.document.selection;this._compositionQueue=new My(e),n.addObserver(Ny);const s=new Oy(e,e.config.get("typing.undoStep")||20);e.commands.add("insertText",s),e.commands.add("input",s),this.listenTo(n.document,"insertText",((s,o)=>{n.document.isComposing||o.preventDefault(),aa.isAndroid&&n.document.isComposing&&this._compositionQueue.flush("next beforeinput");const{text:a,selection:l}=o;let c;c=l?Array.from(l.getRanges()).map((e=>i.toModelRange(e))):Array.from(r.getRanges());let d=a;if(aa.isAndroid){const e=Array.from(c[0].getItems()).reduce(((e,t)=>e+(t.is("$textProxy")?t.data:"")),"");if(e&&(e.length<=d.length?d.startsWith(e)&&(d=d.substring(e.length),c[0].start=c[0].start.getShiftedBy(e.length)):e.startsWith(d)&&(c[0].start=c[0].start.getShiftedBy(d.length),d="")),0==d.length&&c[0].isCollapsed)return}const u={text:d,selection:t.createSelection(c)};aa.isAndroid&&n.document.isComposing?this._compositionQueue.push(u):(e.execute("insertText",u),n.scrollToTheSelection())})),aa.isAndroid?this.listenTo(n.document,"keydown",((e,i)=>{!r.isCollapsed&&229==i.keyCode&&n.document.isComposing&&By(t,s)})):this.listenTo(n.document,"compositionstart",(()=>{r.isCollapsed||By(t,s)})),aa.isAndroid?(this.listenTo(n.document,"mutations",((e,{mutations:t})=>{if(n.document.isComposing)for(const{node:e}of t){const t=Fy(e,i),n=i.toModelElement(t);if(this._compositionQueue.isComposedElement(n))return void this._compositionQueue.flush("mutations")}})),this.listenTo(n.document,"compositionend",(()=>{this._compositionQueue.flush("composition end")})),this.listenTo(n.document,"compositionend",(()=>{const e=[];for(const t of this._compositionQueue.flushComposedElements()){const n=i.toViewElement(t);n&&e.push({type:"children",node:n})}e.length&&n.document.fire("mutations",{mutations:e})}),{priority:"lowest"})):this.listenTo(n.document,"compositionend",(()=>{n.document.fire("mutations",{mutations:[]})}),{priority:"lowest"})}destroy(){super.destroy(),this._compositionQueue.destroy()}}class My{editor;flushDebounced=id((()=>this.flush("timeout")),50);_queue=[];_compositionElements=new Set;constructor(e){this.editor=e}destroy(){for(this.flushDebounced.cancel(),this._compositionElements.clear();this._queue.length;)this.shift()}get length(){return this._queue.length}push(e){const t={text:e.text};if(e.selection){t.selectionRanges=[];for(const n of e.selection.getRanges())t.selectionRanges.push(Bh.fromRange(n)),this._compositionElements.add(n.start.parent)}this._queue.push(t),this.flushDebounced()}shift(){const e=this._queue.shift(),t={text:e.text};if(e.selectionRanges){const n=e.selectionRanges.map((e=>function(e){const t=e.toRange();return e.detach(),"$graveyard"==t.root.rootName?null:t}(e))).filter((e=>!!e));n.length&&(t.selection=this.editor.model.createSelection(n))}return t}flush(e){const t=this.editor,n=t.model,i=t.editing.view;if(this.flushDebounced.cancel(),!this._queue.length)return;const r=t.commands.get("insertText").buffer;n.enqueueChange(r.batch,(()=>{for(r.lock();this._queue.length;){const e=this.shift();t.execute("insertText",e)}r.unlock()})),i.scrollToTheSelection()}isComposedElement(e){return this._compositionElements.has(e)}flushComposedElements(){const e=Array.from(this._compositionElements);return this._compositionElements.clear(),e}}function By(e,t){if(!t.isEnabled)return;const n=t.buffer;n.lock(),e.enqueueChange(n.batch,(()=>{e.deleteContent(e.document.selection)})),n.unlock()}function Fy(e,t){let n=e.is("$text")?e.parent:e;for(;!t.toModelElement(n);)n=n.parent;return n}class Dy extends uf{direction;_buffer;constructor(e,t){super(e),this.direction=t,this._buffer=new Iy(e.model,e.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,n=t.document;t.enqueueChange(this._buffer.batch,(i=>{this._buffer.lock();const r=i.createSelection(e.selection||n.selection);if(!t.canEditAt(r))return;const s=e.sequence||1,o=r.isCollapsed;if(r.isCollapsed&&t.modifySelection(r,{direction:this.direction,unit:e.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(s))return void this._replaceEntireContentWithParagraph(i);if(this._shouldReplaceFirstBlockWithParagraph(r,s))return void this.editor.execute("paragraph",{selection:r});if(r.isCollapsed)return;let a=0;r.getFirstRange().getMinimalFlatRanges().forEach((e=>{a+=el(e.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))})),t.deleteContent(r,{doNotResetEntireContent:o,direction:this.direction}),this._buffer.input(a),i.setSelection(r),this._buffer.unlock()}))}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,n=t.document.selection,i=t.schema.getLimitElement(n);if(!n.isCollapsed||!n.containsEntireContent(i))return!1;if(!t.schema.checkChild(i,"paragraph"))return!1;const r=i.getChild(0);return!r||!r.is("element","paragraph")}_replaceEntireContentWithParagraph(e){const t=this.editor.model,n=t.document.selection,i=t.schema.getLimitElement(n),r=e.createElement("paragraph");e.remove(e.createRangeIn(i)),e.insert(r,i),e.setSelection(r,0)}_shouldReplaceFirstBlockWithParagraph(e,t){const n=this.editor.model;if(t>1||"backward"!=this.direction)return!1;if(!e.isCollapsed)return!1;const i=e.getFirstPosition(),r=n.schema.getLimitElement(i),s=r.getChild(0);return i.parent==s&&!!e.containsEntireContent(s)&&!!n.schema.checkChild(r,"paragraph")&&"paragraph"!=s.name}}const zy="word",$y="selection",jy="backward",Hy="forward",Wy={deleteContent:{unit:$y,direction:jy},deleteContentBackward:{unit:"codePoint",direction:jy},deleteWordBackward:{unit:zy,direction:jy},deleteHardLineBackward:{unit:$y,direction:jy},deleteSoftLineBackward:{unit:$y,direction:jy},deleteContentForward:{unit:"character",direction:Hy},deleteWordForward:{unit:zy,direction:Hy},deleteHardLineForward:{unit:$y,direction:Hy},deleteSoftLineForward:{unit:$y,direction:Hy}};class Uy extends Zu{constructor(e){super(e);const t=e.document;let n=0;t.on("keydown",(()=>{n++})),t.on("keyup",(()=>{n=0})),t.on("beforeinput",((i,r)=>{if(!this.isEnabled)return;const{targetRanges:s,domEvent:o,inputType:a}=r,l=Wy[a];if(!l)return;const c={direction:l.direction,unit:l.unit,sequence:n};c.unit==$y&&(c.selectionToRemove=e.createSelection(s[0])),"deleteContentBackward"===a&&(aa.isAndroid&&(c.sequence=1),function(e){if(1!=e.length||e[0].isCollapsed)return!1;const t=e[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0});let n=0;for(const{nextPosition:e,item:i}of t){if(e.parent.is("$text")){const t=e.parent.data,i=e.offset;if(bc(t,i)||wc(t,i)||yc(t,i))continue;n++}else(i.is("containerElement")||i.is("emptyElement"))&&n++;if(n>1)return!0}return!1}(s)&&(c.unit=$y,c.selectionToRemove=e.createSelection(s)));const d=new Xd(t,"delete",s[0]);t.fire(d,new Qu(e,o,c)),d.stop.called&&i.stop()})),aa.isBlink&&function(e){const t=e.view,n=t.document;let i=null,r=!1;function s(e){return e==Zl.backspace||e==Zl.delete}function o(e){return e==Zl.backspace?jy:Hy}n.on("keydown",((e,{keyCode:t})=>{i=t,r=!1})),n.on("keyup",((a,{keyCode:l,domEvent:c})=>{const d=n.selection,u=e.isEnabled&&l==i&&s(l)&&!d.isCollapsed&&!r;if(i=null,u){const e=d.getFirstRange(),i=new Xd(n,"delete",e),r={unit:$y,direction:o(l),selectionToRemove:d};n.fire(i,new Qu(t,c,r))}})),n.on("beforeinput",((e,{inputType:t})=>{const n=Wy[t];s(i)&&n&&n.direction==o(i)&&(r=!0)}),{priority:"high"}),n.on("beforeinput",((e,{inputType:t,data:n})=>{i==Zl.delete&&"insertText"==t&&""==n&&e.stop()}),{priority:"high"})}(this)}observe(){}stopObserving(){}}class qy extends cf{_undoOnBackspace;static get pluginName(){return"Delete"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view,n=t.document,i=e.model.document;t.addObserver(Uy),this._undoOnBackspace=!1;const r=new Dy(e,"forward");e.commands.add("deleteForward",r),e.commands.add("forwardDelete",r),e.commands.add("delete",new Dy(e,"backward")),this.listenTo(n,"delete",((i,r)=>{n.isComposing||r.preventDefault();const{direction:s,sequence:o,selectionToRemove:a,unit:l}=r,c="forward"===s?"deleteForward":"delete",d={sequence:o};if("selection"==l){const t=Array.from(a.getRanges()).map((t=>e.editing.mapper.toModelRange(t)));d.selection=e.model.createSelection(t)}else d.unit=l;e.execute(c,d),t.scrollToTheSelection()}),{priority:"low"}),this.editor.plugins.has("UndoEditing")&&(this.listenTo(n,"delete",((t,n)=>{this._undoOnBackspace&&"backward"==n.direction&&1==n.sequence&&"codePoint"==n.unit&&(this._undoOnBackspace=!1,e.execute("undo"),n.preventDefault(),t.stop())}),{context:"$capture"}),this.listenTo(i,"change",(()=>{this._undoOnBackspace=!1})))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class Gy extends cf{static get requires(){return[Ly,qy]}static get pluginName(){return"Typing"}static get isOfficialPlugin(){return!0}}function Ky(e,t){let n=e.start;return{text:Array.from(e.getWalker({ignoreElementEnd:!1})).reduce(((e,{item:i})=>i.is("$text")||i.is("$textProxy")?e+i.data:(n=t.createPositionAfter(i),"")),""),range:t.createRange(n,e.end)}}class Zy extends(Ga()){model;testCallback;_hasMatch;constructor(e,t){super(),this.model=e,this.testCallback=t,this._hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",(()=>{this.isEnabled?this._startListening():(this.stopListening(e.document.selection),this.stopListening(e.document))})),this._startListening()}get hasMatch(){return this._hasMatch}_startListening(){const e=this.model.document;this.listenTo(e.selection,"change:range",((t,{directChange:n})=>{n&&(e.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1))})),this.listenTo(e,"change:data",((e,t)=>{!t.isUndo&&t.isLocal&&this._evaluateTextBeforeSelection("data",{batch:t})}))}_evaluateTextBeforeSelection(e,t={}){const n=this.model,i=n.document.selection,r=n.createRange(n.createPositionAt(i.focus.parent,0),i.focus),{text:s,range:o}=Ky(r,n),a=this.testCallback(s);if(!a&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!a,a){const n=Object.assign(t,{text:s,range:o});"object"==typeof a&&Object.assign(n,a),this.fire(`matched:${e}`,n)}}}class Qy extends cf{attributes;_overrideUid;_isNextGravityRestorationSkipped=!1;static get pluginName(){return"TwoStepCaretMovement"}static get isOfficialPlugin(){return!0}constructor(e){super(e),this.attributes=new Set,this._overrideUid=null}init(){const e=this.editor,t=e.model,n=e.editing.view,i=e.locale,r=t.document.selection;this.listenTo(n.document,"arrowKey",((e,t)=>{if(!r.isCollapsed)return;if(t.shiftKey||t.altKey||t.ctrlKey)return;const n=t.keyCode==Zl.arrowright,s=t.keyCode==Zl.arrowleft;if(!n&&!s)return;const o=i.contentLanguageDirection;let a=!1;a="ltr"===o&&n||"rtl"===o&&s?this._handleForwardMovement(t):this._handleBackwardMovement(t),!0===a&&e.stop()}),{context:"$text",priority:"highest"}),this.listenTo(r,"change:range",((e,t)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!t.directChange&&n_(r.getFirstPosition(),this.attributes)||this._restoreGravity())})),this._enableClickingAfterNode(),this._enableInsertContentSelectionAttributesFixer(),this._handleDeleteContentAfterNode()}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,n=this.editor.model,i=n.document.selection,r=i.getFirstPosition();return!(this._isGravityOverridden||r.isAtStart&&Yy(i,t)||!n_(r,t)||(e_(e),Yy(i,t)&&n_(r,t,!0)?Xy(n,t):this._overrideGravity(),0))}_handleBackwardMovement(e){const t=this.attributes,n=this.editor.model,i=n.document.selection,r=i.getFirstPosition();return this._isGravityOverridden?(e_(e),this._restoreGravity(),n_(r,t,!0)?Xy(n,t):Jy(n,t,r),!0):r.isAtStart?!!Yy(i,t)&&(e_(e),Jy(n,t,r),!0):!Yy(i,t)&&n_(r,t,!0)?(e_(e),Jy(n,t,r),!0):!!t_(r,t)&&(r.isAtEnd&&!Yy(i,t)&&n_(r,t)?(e_(e),Jy(n,t,r),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1))}_enableClickingAfterNode(){const e=this.editor,t=e.model,n=t.document.selection,i=e.editing.view.document;e.editing.view.addObserver(cp),e.editing.view.addObserver(dp);let r=!1,s=!1;this.listenTo(i,"touchstart",(()=>{s=!1,r=!0})),this.listenTo(i,"mousedown",(()=>{s=!0})),this.listenTo(i,"selectionChange",(()=>{const e=this.attributes;if(!s&&!r)return;if(s=!1,r=!1,!n.isCollapsed)return;if(!Yy(n,e))return;const i=n.getFirstPosition();n_(i,e)&&(i.isAtStart||n_(i,e,!0)?Xy(t,e):this._isGravityOverridden||this._overrideGravity())}))}_enableInsertContentSelectionAttributesFixer(){const e=this.editor.model,t=e.document.selection,n=this.attributes;this.listenTo(e,"insertContent",(()=>{const i=t.getFirstPosition();Yy(t,n)&&n_(i,n)&&Xy(e,n)}),{priority:"low"})}_handleDeleteContentAfterNode(){const e=this.editor,t=e.model,n=t.document.selection,i=e.editing.view;let r=!1,s=!1;this.listenTo(i.document,"delete",((e,t)=>{r="backward"===t.direction}),{priority:"high"}),this.listenTo(t,"deleteContent",(()=>{if(!r)return;const e=n.getFirstPosition();s=Yy(n,this.attributes)&&!t_(e,this.attributes)}),{priority:"high"}),this.listenTo(t,"deleteContent",(()=>{r&&(r=!1,s||e.model.enqueueChange((()=>{const e=n.getFirstPosition();Yy(n,this.attributes)&&n_(e,this.attributes)&&(e.isAtStart||n_(e,this.attributes,!0)?Xy(t,this.attributes):this._isGravityOverridden||this._overrideGravity())})))}),{priority:"low"})}get _isGravityOverridden(){return!!this._overrideUid}_overrideGravity(){this._overrideUid=this.editor.model.change((e=>e.overrideSelectionGravity()))}_restoreGravity(){this.editor.model.change((e=>{e.restoreSelectionGravity(this._overrideUid),this._overrideUid=null}))}}function Yy(e,t){for(const n of t)if(e.hasAttribute(n))return!0;return!1}function Jy(e,t,n){const i=n.nodeBefore;e.change((n=>{if(i){const t=[],r=e.schema.isObject(i)&&e.schema.isInline(i);for(const[n,s]of i.getAttributes())!e.schema.checkAttribute("$text",n)||r&&!1===e.schema.getAttributeProperties(n).copyFromObject||t.push([n,s]);n.setSelectionAttribute(t)}else n.removeSelectionAttribute(t)}))}function Xy(e,t){e.change((e=>{e.removeSelectionAttribute(t)}))}function e_(e){e.preventDefault()}function t_(e,t){return n_(e.getShiftedBy(-1),t)}function n_(e,t,n=!1){const{nodeBefore:i,nodeAfter:r}=e;for(const e of t){const t=i?i.getAttribute(e):void 0,s=r?r.getAttribute(e):void 0;if((!n||void 0!==t&&void 0!==s)&&s!==t)return!0}return!1}const i_={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"½",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"⅓",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"⅔",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"¼",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"¾",null]},lessThanOrEqual:{from:"<=",to:"≤"},greaterThanOrEqual:{from:">=",to:"≥"},notEqual:{from:"!=",to:"≠"},arrowLeft:{from:"<-",to:"←"},arrowRight:{from:"->",to:"→"},horizontalEllipsis:{from:"...",to:"…"},enDash:{from:/(^| )(--)( )$/,to:[null,"–",null]},emDash:{from:/(^| )(---)( )$/,to:[null,"—",null]},quotesPrimary:{from:a_('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:a_("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:a_("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:a_('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:a_('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:a_("'"),to:[null,"‚",null,"’"]}},r_={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},s_=["symbols","mathematical","typography","quotes"];class o_ extends cf{static get requires(){return["Delete","Input"]}static get pluginName(){return"TextTransformation"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("typing",{transformations:{include:s_}})}init(){const e=this.editor.model.document.selection;e.on("change:range",(()=>{this.isEnabled=!e.anchor.parent.is("element","codeBlock")})),this._enableTransformationWatchers()}_enableTransformationWatchers(){const e=this.editor,t=e.model,n=e.plugins.get("Delete"),i=function(e){const t=e.extra||[],n=e.remove||[],i=e=>!n.includes(e);return function(e){const t=new Set;for(const n of e)if("string"==typeof n&&r_[n])for(const e of r_[n])t.add(e);else t.add(n);return Array.from(t)}(e.include.concat(t).filter(i)).filter(i).map((e=>"string"==typeof e&&i_[e]?i_[e]:e)).filter((e=>"object"==typeof e)).map((e=>{return{from:(n=e.from,"string"==typeof n?new RegExp(`(${Lf(n)})$`):n),to:(t=e.to,"string"==typeof t?()=>[t]:t instanceof Array?()=>t:t)};var t,n}))}(e.config.get("typing.transformations")),r=new Zy(e.model,(e=>{for(const t of i)if(t.from.test(e))return{normalizedTransformation:t}}));r.on("matched:data",((e,i)=>{if(!i.batch.isTyping)return;const{from:r,to:s}=i.normalizedTransformation,o=r.exec(i.text),a=s(o.slice(1)),l=i.range;let c=o.index;t.enqueueChange((e=>{for(let n=1;n<o.length;n++){const r=o[n],s=a[n-1];if(null==s){c+=r.length;continue}const d=l.start.getShiftedBy(c),u=t.createRange(d,d.getShiftedBy(r.length)),h=((i=d).textNode?i.textNode:i.nodeAfter).getAttributes();t.insertContent(e.createText(s,h),u),c+=s.length}var i;t.enqueueChange((()=>{n.requestUndoOnBackspace()}))}))})),r.bind("isEnabled").to(this)}}function a_(e){return new RegExp(`(^|\\s)(${e})([^${e}]*)(${e})$`)}function l_(e,t,n,i){return i.createRange(c_(e,t,n,!0,i),c_(e,t,n,!1,i))}function c_(e,t,n,i,r){let s=e.textNode||(i?e.nodeBefore:e.nodeAfter),o=null;for(;s&&s.getAttribute(t)==n;)o=s,s=i?s.previousSibling:s.nextSibling;return o?r.createPositionAt(o,i?"before":"after"):e}function d_(e,t,n,i){const r=e.editing.view,s=new Set;r.document.registerPostFixer((r=>{const o=e.model.document.selection;let a=!1;if(o.hasAttribute(t)){const l=l_(o.getFirstPosition(),t,o.getAttribute(t),e.model),c=e.editing.mapper.toViewRange(l);for(const e of c.getItems())e.is("element",n)&&!e.hasClass(i)&&(r.addClass(i,e),s.add(e),a=!0)}return a})),e.conversion.for("editingDowncast").add((e=>{function t(){r.change((e=>{for(const t of s.values())e.removeClass(i,t),s.delete(t)}))}e.on("insert",t,{priority:"highest"}),e.on("remove",t,{priority:"highest"}),e.on("attribute",t,{priority:"highest"}),e.on("selection",t,{priority:"highest"})}))}function u_(e,t,n,i){let r,s=null;"function"==typeof i?r=i:(s=e.commands.get(i),r=()=>{e.execute(i)}),e.model.document.on("change:data",((o,a)=>{if(s&&!s.isEnabled||!t.isEnabled)return;const l=ac(e.model.document.selection.getRanges());if(!l.isCollapsed)return;if(a.isUndo||!a.isLocal)return;const c=Array.from(e.model.document.differ.getChanges()),d=c[0];if(1!=c.length||"insert"!==d.type||"$text"!=d.name||1!=d.length)return;const u=d.position.parent;if(u.is("element","codeBlock"))return;if(u.is("element","listItem")&&"function"!=typeof i&&!["numberedList","bulletedList","todoList"].includes(i))return;if(s&&!0===s.value)return;const h=u.getChild(0),m=e.model.createRangeOn(h);if(!m.containsRange(l)&&!l.end.isEqual(m.end))return;const g=n.exec(h.data.substr(0,l.end.offset));g&&e.model.enqueueChange((t=>{const n=t.createPositionAt(u,0),i=t.createPositionAt(u,g[0].length),s=new Bh(n,i);if(!1!==r({match:g})){t.remove(s);const n=e.model.document.selection.getFirstRange(),i=t.createRangeIn(u);!u.isEmpty||i.isEqual(n)||i.containsRange(n,!0)||t.remove(u)}s.detach(),e.model.enqueueChange((()=>{e.plugins.get("Delete").requestUndoOnBackspace()}))}))}))}function h_(e,t,n,i){let r,s;n instanceof RegExp?r=n:s=n,s=s||(e=>{let t;const n=[],i=[];for(;null!==(t=r.exec(e))&&!(t&&t.length<4);){let{index:e,1:r,2:s,3:o}=t;const a=r+s+o;e+=t[0].length-a.length;const l=[e,e+r.length],c=[e+r.length+s.length,e+r.length+s.length+o.length];n.push(l),n.push(c),i.push([e+r.length,e+r.length+s.length])}return{remove:n,format:i}}),e.model.document.on("change:data",((n,r)=>{if(r.isUndo||!r.isLocal||!t.isEnabled)return;const o=e.model,a=o.document.selection;if(!a.isCollapsed)return;const l=Array.from(o.document.differ.getChanges()),c=l[0];if(1!=l.length||"insert"!==c.type||"$text"!=c.name||1!=c.length)return;const d=a.focus,u=d.parent,{text:h,range:m}=function(e,t){let n=e.start;return{text:Array.from(e.getItems()).reduce(((e,i)=>!i.is("$text")&&!i.is("$textProxy")||i.getAttribute("code")?(n=t.createPositionAfter(i),""):e+i.data),""),range:t.createRange(n,e.end)}}(o.createRange(o.createPositionAt(u,0),d),o),g=s(h),p=m_(m.start,g.format,o),f=m_(m.start,g.remove,o);p.length&&f.length&&o.enqueueChange((t=>{if(!1!==i(t,p)){for(const e of f.reverse())t.remove(e);o.enqueueChange((()=>{e.plugins.get("Delete").requestUndoOnBackspace()}))}}))}))}function m_(e,t,n){return t.filter((e=>void 0!==e[0]&&void 0!==e[1])).map((t=>n.createRange(e.getShiftedBy(t[0]),e.getShiftedBy(t[1]))))}class g_ extends cf{static get requires(){return[qy]}static get pluginName(){return"Autoformat"}static get isOfficialPlugin(){return!0}afterInit(){const e=this.editor,t=this.editor.t;this._addListAutoformats(),this._addBasicStylesAutoformats(),this._addHeadingAutoformats(),this._addBlockQuoteAutoformats(),this._addCodeBlockAutoformats(),this._addHorizontalLineAutoformats(),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Revert autoformatting action"),keystroke:"Backspace"}]})}_addListAutoformats(){const e=this.editor.commands;e.get("bulletedList")&&u_(this.editor,this,/^[*-]\s$/,"bulletedList"),e.get("numberedList")&&u_(this.editor,this,/^1[.|)]\s$/,"numberedList"),e.get("todoList")&&u_(this.editor,this,/^\[\s?\]\s$/,"todoList"),e.get("checkTodoList")&&u_(this.editor,this,/^\[\s?x\s?\]\s$/,(()=>{this.editor.execute("todoList"),this.editor.execute("checkTodoList")}))}_addBasicStylesAutoformats(){const e=this.editor.commands;if(e.get("bold")){const e=p_(this.editor,"bold");h_(this.editor,this,/(?:^|\s)(\*\*)([^*]+)(\*\*)$/g,e),h_(this.editor,this,/(?:^|\s)(__)([^_]+)(__)$/g,e)}if(e.get("italic")){const e=p_(this.editor,"italic");h_(this.editor,this,/(?:^|\s)(\*)([^*_]+)(\*)$/g,e),h_(this.editor,this,/(?:^|\s)(_)([^_]+)(_)$/g,e)}if(e.get("code")){const e=p_(this.editor,"code");h_(this.editor,this,/(`)([^`]+)(`)$/g,e)}if(e.get("strikethrough")){const e=p_(this.editor,"strikethrough");h_(this.editor,this,/(~~)([^~]+)(~~)$/g,e)}}_addHeadingAutoformats(){const e=this.editor.commands.get("heading");e&&e.modelElements.filter((e=>e.match(/^heading[1-6]$/))).forEach((t=>{const n=t[7],i=new RegExp(`^(#{${n}})\\s$`);u_(this.editor,this,i,(()=>{if(!e.isEnabled||e.value===t)return!1;this.editor.execute("heading",{value:t})}))}))}_addBlockQuoteAutoformats(){this.editor.commands.get("blockQuote")&&u_(this.editor,this,/^>\s$/,"blockQuote")}_addCodeBlockAutoformats(){const e=this.editor,t=e.model.document.selection;e.commands.get("codeBlock")&&u_(e,this,/^```$/,(()=>{if(t.getFirstPosition().parent.is("element","listItem"))return!1;this.editor.execute("codeBlock",{usePreviousLanguageChoice:!0})}))}_addHorizontalLineAutoformats(){this.editor.commands.get("horizontalLine")&&u_(this.editor,this,/^---$/,"horizontalLine")}}function p_(e,t){return(n,i)=>{if(!e.commands.get(t).isEnabled)return!1;const r=e.model.schema.getValidRanges(i,t);for(const e of r)n.setAttribute(t,!0,e);n.removeSelectionAttribute(t)}}class f_ extends cf{adapter;_debouncedSave;_lastDocumentVersion;_savePromise;_domEmitter;_config;_pendingActions;_makeImmediateSave;_action=null;static get pluginName(){return"Autosave"}static get isOfficialPlugin(){return!0}static get requires(){return[Sf]}constructor(e){super(e);const t=e.config.get("autosave")||{},n=t.waitingTime||1e3;this.set("state","synchronized"),this._debouncedSave=id(this._save.bind(this),n),this._lastDocumentVersion=e.model.document.version,this._savePromise=null,this._domEmitter=new(dl()),this._config=t,this._pendingActions=e.plugins.get(Sf),this._makeImmediateSave=!1}init(){const e=this.editor,t=e.model.document;this.listenTo(e,"ready",(()=>{this.listenTo(t,"change:data",((e,t)=>{this._saveCallbacks.length&&t.isLocal&&("synchronized"===this.state&&(this.state="waiting",this._setPendingAction()),"waiting"===this.state&&this._debouncedSave())}))})),this.listenTo(e,"destroy",(()=>this._flush()),{priority:"highest"}),this._domEmitter.listenTo(window,"beforeunload",((e,t)=>{this._pendingActions.hasAny&&(t.returnValue=this._pendingActions.first.message)}))}destroy(){this._domEmitter.stopListening(),super.destroy()}save(){return this._debouncedSave.cancel(),this._save()}_flush(){this._debouncedSave.flush()}_save(){return this._savePromise?(this._makeImmediateSave=this.editor.model.document.version>this._lastDocumentVersion,this._savePromise):(this._setPendingAction(),this.state="saving",this._lastDocumentVersion=this.editor.model.document.version,this._savePromise=Promise.resolve().then((()=>Promise.all(this._saveCallbacks.map((e=>e(this.editor)))))).finally((()=>{this._savePromise=null})).then((()=>{if(this._makeImmediateSave)return this._makeImmediateSave=!1,this._save();this.editor.model.document.version>this._lastDocumentVersion?(this.state="waiting",this._debouncedSave()):(this.state="synchronized",this._pendingActions.remove(this._action),this._action=null)})).catch((e=>{throw this.state="error",this.state="saving",this._debouncedSave(),e})),this._savePromise)}_setPendingAction(){const e=this.editor.t;this._action||(this._action=this._pendingActions.add(e("Saving changes")))}get _saveCallbacks(){const e=[];return this.adapter&&this.adapter.save&&e.push(this.adapter.save),this._config.save&&e.push(this._config.save),e}}class b_ extends uf{attributeKey;constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,n=t.document.selection,i=void 0===e.forceValue?!this.value:e.forceValue;t.change((e=>{if(n.isCollapsed)i?e.setSelectionAttribute(this.attributeKey,!0):e.removeSelectionAttribute(this.attributeKey);else{const r=t.schema.getValidRanges(n.getRanges(),this.attributeKey);for(const t of r)i?e.setAttribute(this.attributeKey,i,t):e.removeAttribute(this.attributeKey,t)}}))}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,n=e.document.selection;if(n.isCollapsed)return n.hasAttribute(this.attributeKey);for(const e of n.getRanges())for(const n of e.getItems())if(t.checkAttribute(n,this.attributeKey))return n.hasAttribute(this.attributeKey);return!1}}const w_="bold";class v_ extends cf{static get pluginName(){return"BoldEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:w_}),e.model.schema.setAttributeProperties(w_,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:w_,view:"strong",upcastAlso:["b",e=>{const t=e.getStyle("font-weight");return t&&("bold"==t||Number(t)>=600)?{name:!0,styles:["font-weight"]}:null}]}),e.commands.add(w_,new b_(e,w_)),e.keystrokes.set("CTRL+B",w_),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Bold text"),keystroke:"CTRL+B"}]})}}function y_({editor:e,commandName:t,plugin:n,icon:i,label:r,keystroke:s}){return o=>{const a=e.commands.get(t),l=new o(e.locale);return l.set({label:r,icon:i,keystroke:s,isToggleable:!0}),l.bind("isEnabled").to(a,"isEnabled"),l.bind("isOn").to(a,"value"),l instanceof sw?l.set({role:"menuitemcheckbox"}):l.set({tooltip:!0}),n.listenTo(l,"execute",(()=>{e.execute(t),e.editing.view.focus()})),l}}const __="bold";class k_ extends cf{static get pluginName(){return"BoldUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.locale.t,n=y_({editor:e,commandName:__,plugin:this,icon:Pf.bold,label:t("Bold"),keystroke:"CTRL+B"});e.ui.componentFactory.add(__,(()=>n(jb))),e.ui.componentFactory.add("menuBar:"+__,(()=>n(sw)))}}class x_ extends cf{static get requires(){return[v_,k_]}static get pluginName(){return"Bold"}static get isOfficialPlugin(){return!0}}const C_="code";class A_ extends cf{static get pluginName(){return"CodeEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Qy]}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:C_}),e.model.schema.setAttributeProperties(C_,{isFormatting:!0,copyOnEnter:!1}),e.conversion.attributeToElement({model:C_,view:"code"}),e.commands.add(C_,new b_(e,C_)),e.plugins.get(Qy).registerAttribute(C_),d_(e,C_,"code","ck-code_selected"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Move out of an inline code style"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}}const E_="code";class T_ extends cf{static get pluginName(){return"CodeUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.locale.t,n=y_({editor:e,commandName:E_,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.5 5.7 5.2 3.9v1.3l-5.6 4c-.1.2-.3.2-.5.2-.3-.1-.6-.7-.6-1l.3-.4 4.7-3.5L11.5 7l-.2-.2c-.1-.3-.1-.6 0-.8.2-.2.5-.4.8-.4a.8.8 0 0 1 .4.1zm-5.2 0L2 9.6v1.3l5.6 4c.1.2.3.2.5.2.3-.1.7-.7.6-1 0-.1 0-.3-.2-.4l-5-3.5L8.2 7l.2-.2c.1-.3.1-.6 0-.8-.2-.2-.5-.4-.8-.4a.8.8 0 0 0-.3.1z"/></svg>',label:t("Code")});e.ui.componentFactory.add(E_,(()=>n(jb))),e.ui.componentFactory.add("menuBar:"+E_,(()=>n(sw)))}}class S_ extends cf{static get requires(){return[A_,T_]}static get pluginName(){return"Code"}static get isOfficialPlugin(){return!0}}const P_="italic";class I_ extends cf{static get pluginName(){return"ItalicEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:P_}),e.model.schema.setAttributeProperties(P_,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:P_,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add(P_,new b_(e,P_)),e.keystrokes.set("CTRL+I",P_),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Italic text"),keystroke:"CTRL+I"}]})}}const O_="italic";class V_ extends cf{static get pluginName(){return"ItalicUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.locale.t,n=y_({editor:e,commandName:O_,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m9.586 14.633.021.004c-.036.335.095.655.393.962.082.083.173.15.274.201h1.474a.6.6 0 1 1 0 1.2H5.304a.6.6 0 0 1 0-1.2h1.15c.474-.07.809-.182 1.005-.334.157-.122.291-.32.404-.597l2.416-9.55a1.053 1.053 0 0 0-.281-.823 1.12 1.12 0 0 0-.442-.296H8.15a.6.6 0 0 1 0-1.2h6.443a.6.6 0 1 1 0 1.2h-1.195c-.376.056-.65.155-.823.296-.215.175-.423.439-.623.79l-2.366 9.347z"/></svg>',keystroke:"CTRL+I",label:t("Italic")});e.ui.componentFactory.add(O_,(()=>n(jb))),e.ui.componentFactory.add("menuBar:"+O_,(()=>n(sw)))}}class R_ extends cf{static get requires(){return[I_,V_]}static get pluginName(){return"Italic"}static get isOfficialPlugin(){return!0}}const N_="strikethrough";class L_ extends cf{static get pluginName(){return"StrikethroughEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:N_}),e.model.schema.setAttributeProperties(N_,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:N_,view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),e.commands.add(N_,new b_(e,N_)),e.keystrokes.set("CTRL+SHIFT+X","strikethrough"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Strikethrough text"),keystroke:"CTRL+SHIFT+X"}]})}}const M_="strikethrough";class B_ extends cf{static get pluginName(){return"StrikethroughUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.locale.t,n=y_({editor:e,commandName:M_,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 16.4c-.8-.4-1.5-.9-2.2-1.5a.6.6 0 0 1-.2-.5l.3-.6h1c1 1.2 2.1 1.7 3.7 1.7 1 0 1.8-.3 2.3-.6.6-.4.6-1.2.6-1.3.2-1.2-.9-2.1-.9-2.1h2.1c.3.7.4 1.2.4 1.7v.8l-.6 1.2c-.6.8-1.1 1-1.6 1.2a6 6 0 0 1-2.4.6c-1 0-1.8-.3-2.5-.6zM6.8 9 6 8.3c-.4-.5-.5-.8-.5-1.6 0-.7.1-1.3.5-1.8.4-.6 1-1 1.6-1.3a6.3 6.3 0 0 1 4.7 0 4 4 0 0 1 1.7 1l.3.7c0 .1.2.4-.2.7-.4.2-.9.1-1 0a3 3 0 0 0-1.2-1c-.4-.2-1-.3-2-.4-.7 0-1.4.2-2 .6-.8.6-1 .8-1 1.5 0 .8.5 1 1.2 1.5.6.4 1.1.7 1.9 1H6.8z"/><path d="M3 10.5V9h14v1.5z"/></svg>',keystroke:"CTRL+SHIFT+X",label:t("Strikethrough")});e.ui.componentFactory.add(M_,(()=>n(jb))),e.ui.componentFactory.add("menuBar:"+M_,(()=>n(sw)))}}class F_ extends cf{static get requires(){return[L_,B_]}static get pluginName(){return"Strikethrough"}static get isOfficialPlugin(){return!0}}const D_="subscript";class z_ extends cf{static get pluginName(){return"SubscriptEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:D_}),e.model.schema.setAttributeProperties(D_,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:D_,view:"sub",upcastAlso:[{styles:{"vertical-align":"sub"}}]}),e.commands.add(D_,new b_(e,D_))}}const $_="subscript";class j_ extends cf{static get pluginName(){return"SubscriptUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.locale.t,n=y_({editor:e,commandName:$_,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m7.03 10.349 3.818-3.819a.8.8 0 1 1 1.132 1.132L8.16 11.48l3.819 3.818a.8.8 0 1 1-1.132 1.132L7.03 12.61l-3.818 3.82a.8.8 0 1 1-1.132-1.132L5.9 11.48 2.08 7.662A.8.8 0 1 1 3.212 6.53l3.818 3.82zm8.147 7.829h2.549c.254 0 .447.05.58.152a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393c-.105.108-.266.162-.48.162h-3.594c-.245 0-.435-.066-.572-.197a.621.621 0 0 1-.205-.463c0-.114.044-.265.132-.453a1.62 1.62 0 0 1 .288-.444c.433-.436.824-.81 1.172-1.122.348-.312.597-.517.747-.615.267-.183.49-.368.667-.553.177-.185.312-.375.405-.57.093-.194.139-.384.139-.57a1.008 1.008 0 0 0-.554-.917 1.197 1.197 0 0 0-.56-.133c-.426 0-.761.182-1.005.546a2.332 2.332 0 0 0-.164.39 1.609 1.609 0 0 1-.258.488c-.096.114-.237.17-.423.17a.558.558 0 0 1-.405-.156.568.568 0 0 1-.161-.427c0-.218.05-.446.151-.683.101-.238.252-.453.452-.646s.454-.349.762-.467a2.998 2.998 0 0 1 1.081-.178c.498 0 .923.076 1.274.228a1.916 1.916 0 0 1 1.004 1.032 1.984 1.984 0 0 1-.156 1.794c-.2.32-.405.572-.613.754-.208.182-.558.468-1.048.857-.49.39-.826.691-1.008.906a2.703 2.703 0 0 0-.24.309z"/></svg>',label:t("Subscript")});e.ui.componentFactory.add($_,(()=>n(jb))),e.ui.componentFactory.add("menuBar:"+$_,(()=>n(sw)))}}class H_ extends cf{static get requires(){return[z_,j_]}static get pluginName(){return"Subscript"}static get isOfficialPlugin(){return!0}}const W_="superscript";class U_ extends cf{static get pluginName(){return"SuperscriptEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:W_}),e.model.schema.setAttributeProperties(W_,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:W_,view:"sup",upcastAlso:[{styles:{"vertical-align":"super"}}]}),e.commands.add(W_,new b_(e,W_))}}const q_="superscript";class G_ extends cf{static get pluginName(){return"SuperscriptUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.locale.t,n=y_({editor:e,commandName:q_,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M15.677 8.678h2.549c.254 0 .447.05.58.152a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393c-.105.108-.266.162-.48.162h-3.594c-.245 0-.435-.066-.572-.197a.621.621 0 0 1-.205-.463c0-.114.044-.265.132-.453a1.62 1.62 0 0 1 .288-.444c.433-.436.824-.81 1.172-1.122.348-.312.597-.517.747-.615.267-.183.49-.368.667-.553.177-.185.312-.375.405-.57.093-.194.139-.384.139-.57a1.008 1.008 0 0 0-.554-.917 1.197 1.197 0 0 0-.56-.133c-.426 0-.761.182-1.005.546a2.332 2.332 0 0 0-.164.39 1.609 1.609 0 0 1-.258.488c-.096.114-.237.17-.423.17a.558.558 0 0 1-.405-.156.568.568 0 0 1-.161-.427c0-.218.05-.446.151-.683.101-.238.252-.453.452-.646s.454-.349.762-.467a2.998 2.998 0 0 1 1.081-.178c.498 0 .923.076 1.274.228a1.916 1.916 0 0 1 1.004 1.032 1.984 1.984 0 0 1-.156 1.794c-.2.32-.405.572-.613.754-.208.182-.558.468-1.048.857-.49.39-.826.691-1.008.906a2.703 2.703 0 0 0-.24.309zM7.03 10.349l3.818-3.819a.8.8 0 1 1 1.132 1.132L8.16 11.48l3.819 3.818a.8.8 0 1 1-1.132 1.132L7.03 12.61l-3.818 3.82a.8.8 0 1 1-1.132-1.132L5.9 11.48 2.08 7.662A.8.8 0 1 1 3.212 6.53l3.818 3.82z"/></svg>',label:t("Superscript")});e.ui.componentFactory.add(q_,(()=>n(jb))),e.ui.componentFactory.add("menuBar:"+q_,(()=>n(sw)))}}class K_ extends cf{static get requires(){return[U_,G_]}static get pluginName(){return"Superscript"}static get isOfficialPlugin(){return!0}}const Z_="underline";class Q_ extends cf{static get pluginName(){return"UnderlineEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:Z_}),e.model.schema.setAttributeProperties(Z_,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Z_,view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),e.commands.add(Z_,new b_(e,Z_)),e.keystrokes.set("CTRL+U","underline"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Underline text"),keystroke:"CTRL+U"}]})}}const Y_="underline";class J_ extends cf{static get pluginName(){return"UnderlineUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.locale.t,n=y_({editor:e,commandName:Y_,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 18v-1.5h14V18zm2.2-8V3.6c0-.4.4-.6.8-.6.3 0 .7.2.7.6v6.2c0 2 1.3 2.8 3.2 2.8 1.9 0 3.4-.9 3.4-2.9V3.6c0-.3.4-.5.8-.5.3 0 .7.2.7.5V10c0 2.7-2.2 4-4.9 4-2.6 0-4.7-1.2-4.7-4z"/></svg>',label:t("Underline"),keystroke:"CTRL+U"});e.ui.componentFactory.add(Y_,(()=>n(jb))),e.ui.componentFactory.add("menuBar:"+Y_,(()=>n(sw)))}}class X_ extends cf{static get requires(){return[Q_,J_]}static get pluginName(){return"Underline"}static get isOfficialPlugin(){return!0}}function*ek(e,t){for(const n of t)n&&e.getAttributeProperties(n[0]).copyOnEnter&&(yield n)}class tk extends uf{execute(){this.editor.model.change((e=>{this.enterBlock(e),this.fire("afterExecute",{writer:e})}))}enterBlock(e){const t=this.editor.model,n=t.document.selection,i=t.schema,r=n.isCollapsed,s=n.getFirstRange(),o=s.start.parent,a=s.end.parent;if(i.isLimit(o)||i.isLimit(a))return r||o!=a||t.deleteContent(n),!1;if(r){const t=ek(e.model.schema,n.getAttributes());return nk(e,s.start),e.setSelectionAttribute(t),!0}{const i=!(s.start.isAtStart&&s.end.isAtEnd),r=o==a;if(t.deleteContent(n,{leaveUnmerged:i}),i){if(r)return nk(e,n.focus),!0;e.setSelection(a,0)}}return!1}}function nk(e,t){e.split(t),e.setSelection(t.parent.nextSibling,0)}const ik={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class rk extends Zu{constructor(e){super(e);const t=this.document;let n=!1;t.on("keydown",((e,t)=>{n=t.shiftKey})),t.on("beforeinput",((i,r)=>{if(!this.isEnabled)return;let s=r.inputType;aa.isSafari&&n&&"insertParagraph"==s&&(s="insertLineBreak");const o=r.domEvent,a=ik[s];if(!a)return;const l=new Xd(t,"enter",r.targetRanges[0]);t.fire(l,new Qu(e,o,{isSoft:a.isSoft})),l.stop.called&&i.stop()}))}observe(){}stopObserving(){}}class sk extends cf{static get pluginName(){return"Enter"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view,n=t.document,i=this.editor.t;t.addObserver(rk),e.commands.add("enter",new tk(e)),this.listenTo(n,"enter",((i,r)=>{n.isComposing||r.preventDefault(),r.isSoft||(e.execute("enter"),t.scrollToTheSelection())}),{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:i("Insert a hard break (a new paragraph)"),keystroke:"Enter"}]})}}class ok extends uf{execute(){const e=this.editor.model,t=e.document;e.change((n=>{!function(e,t,n){const i=n.isCollapsed,r=n.getFirstRange(),s=r.start.parent,o=r.end.parent,a=s==o;if(i){const i=ek(e.schema,n.getAttributes());ak(e,t,r.end),t.removeSelectionAttribute(n.getAttributeKeys()),t.setSelectionAttribute(i)}else{const i=!(r.start.isAtStart&&r.end.isAtEnd);e.deleteContent(n,{leaveUnmerged:i}),a?ak(e,t,n.focus):i&&t.setSelection(o,0)}}(e,n,t.selection),this.fire("afterExecute",{writer:n})}))}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=function(e,t){if(t.rangeCount>1)return!1;const n=t.anchor;if(!n||!e.checkChild(n,"softBreak"))return!1;const i=t.getFirstRange(),r=i.start.parent,s=i.end.parent;return!lk(r,e)&&!lk(s,e)||r===s}(e.schema,t.selection)}}function ak(e,t,n){const i=t.createElement("softBreak");e.insertContent(i,n),t.setSelection(i,"after")}function lk(e,t){return!e.is("rootElement")&&(t.isLimit(e)||lk(e.parent,t))}class ck extends cf{static get pluginName(){return"ShiftEnter"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model.schema,n=e.conversion,i=e.editing.view,r=i.document,s=this.editor.t;t.register("softBreak",{allowWhere:"$text",isInline:!0}),n.for("upcast").elementToElement({model:"softBreak",view:"br"}),n.for("downcast").elementToElement({model:"softBreak",view:(e,{writer:t})=>t.createEmptyElement("br")}),i.addObserver(rk),e.commands.add("shiftEnter",new ok(e)),this.listenTo(r,"enter",((t,n)=>{r.isComposing||n.preventDefault(),n.isSoft&&(e.execute("shiftEnter"),i.scrollToTheSelection())}),{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:s("Insert a soft break (a <code><br></code> element)"),keystroke:"Shift+Enter"}]})}}class dk extends uf{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,n=t.schema,i=t.document.selection,r=Array.from(i.getSelectedBlocks()),s=void 0===e.forceValue?!this.value:e.forceValue;t.change((e=>{if(s){const t=r.filter((e=>uk(e)||mk(n,e)));this._applyQuote(e,t)}else this._removeQuote(e,r.filter(uk))}))}_getValue(){const e=ac(this.editor.model.document.selection.getSelectedBlocks());return!(!e||!uk(e))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,n=ac(e.getSelectedBlocks());return!!n&&mk(t,n)}_removeQuote(e,t){hk(e,t).reverse().forEach((t=>{if(t.start.isAtStart&&t.end.isAtEnd)return void e.unwrap(t.start.parent);if(t.start.isAtStart){const n=e.createPositionBefore(t.start.parent);return void e.move(t,n)}t.end.isAtEnd||e.split(t.end);const n=e.createPositionAfter(t.end.parent);e.move(t,n)}))}_applyQuote(e,t){const n=[];hk(e,t).reverse().forEach((t=>{let i=uk(t.start);i||(i=e.createElement("blockQuote"),e.wrap(t,i)),n.push(i)})),n.reverse().reduce(((t,n)=>t.nextSibling==n?(e.merge(e.createPositionAfter(t)),t):n))}}function uk(e){return"blockQuote"==e.parent.name?e.parent:null}function hk(e,t){let n,i=0;const r=[];for(;i<t.length;){const s=t[i],o=t[i+1];n||(n=e.createPositionBefore(s)),o&&s.nextSibling==o||(r.push(e.createRange(n,e.createPositionAfter(s))),n=null),i++}return r}function mk(e,t){const n=e.checkChild(t.parent,"blockQuote"),i=e.checkChild(["$root","blockQuote"],t);return n&&i}class gk extends cf{static get pluginName(){return"BlockQuoteEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[sk,qy]}init(){const e=this.editor,t=e.model.schema;e.commands.add("blockQuote",new dk(e)),t.register("blockQuote",{inheritAllFrom:"$container"}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer((n=>{const i=e.model.document.differ.getChanges();for(const e of i)if("insert"==e.type){const i=e.position.nodeAfter;if(!i)continue;if(i.is("element","blockQuote")&&i.isEmpty)return n.remove(i),!0;if(i.is("element","blockQuote")&&!t.checkChild(e.position,i))return n.unwrap(i),!0;if(i.is("element")){const e=n.createRangeIn(i);for(const i of e.getItems())if(i.is("element","blockQuote")&&!t.checkChild(n.createPositionBefore(i),i))return n.unwrap(i),!0}}else if("remove"==e.type){const t=e.position.parent;if(t.is("element","blockQuote")&&t.isEmpty)return n.remove(t),!0}return!1}));const n=this.editor.editing.view.document,i=e.model.document.selection,r=e.commands.get("blockQuote");this.listenTo(n,"enter",((t,n)=>{i.isCollapsed&&r.value&&i.getLastPosition().parent.isEmpty&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),n.preventDefault(),t.stop())}),{context:"blockquote"}),this.listenTo(n,"delete",((t,n)=>{if("backward"!=n.direction||!i.isCollapsed||!r.value)return;const s=i.getLastPosition().parent;s.isEmpty&&!s.previousSibling&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),n.preventDefault(),t.stop())}),{context:"blockquote"})}}class pk extends cf{static get pluginName(){return"BlockQuoteUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("blockQuote",(()=>{const e=this._createButton(jb);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add("menuBar:blockQuote",(()=>{const e=this._createButton(sw);return e.set({role:"menuitemcheckbox"}),e}))}_createButton(e){const t=this.editor,n=t.locale,i=t.commands.get("blockQuote"),r=new e(t.locale),s=n.t;return r.set({label:s("Block quote"),icon:Pf.quote,isToggleable:!0}),r.bind("isEnabled").to(i,"isEnabled"),r.bind("isOn").to(i,"value"),this.listenTo(r,"execute",(()=>{t.execute("blockQuote"),t.editing.view.focus()})),r}}class fk extends cf{static get requires(){return[gk,pk]}static get pluginName(){return"BlockQuote"}static get isOfficialPlugin(){return!0}}class bk extends(Na()){_stack=[];add(e,t){const n=this._stack,i=n[0];this._insertDescriptor(e);const r=n[0];i===r||wk(i,r)||this.fire("change:top",{oldDescriptor:i,newDescriptor:r,writer:t})}remove(e,t){const n=this._stack,i=n[0];this._removeDescriptor(e);const r=n[0];i===r||wk(i,r)||this.fire("change:top",{oldDescriptor:i,newDescriptor:r,writer:t})}_insertDescriptor(e){const t=this._stack,n=t.findIndex((t=>t.id===e.id));if(wk(e,t[n]))return;n>-1&&t.splice(n,1);let i=0;for(;t[i]&&(r=t[i],s=e,r.priority>s.priority||!(r.priority<s.priority)&&vk(r.classes)>vk(s.classes));)i++;var r,s;t.splice(i,0,e)}_removeDescriptor(e){const t=this._stack,n=t.findIndex((t=>t.id===e));n>-1&&t.splice(n,1)}}function wk(e,t){return e&&t&&e.priority==t.priority&&vk(e.classes)==vk(t.classes)}function vk(e){return Array.isArray(e)?e.sort().join(","):e}const yk="ck-widget_selected";function _k(e){return!!e.is("element")&&!!e.getCustomProperty("widget")}function kk(e,t,n={}){if(!e.is("containerElement"))throw new Aa("widget-to-widget-wrong-element-type",null,{element:e});return t.setAttribute("contenteditable","false",e),t.addClass("ck-widget",e),t.setCustomProperty("widget",!0,e),e.getFillerOffset=Sk,t.setCustomProperty("widgetLabel",[],e),n.label&&function(e,t){e.getCustomProperty("widgetLabel").push(t)}(e,n.label),n.hasSelectionHandle&&function(e,t){const n=t.createUIElement("div",{class:"ck ck-widget__selection-handle"},(function(e){const t=this.toDomElement(e),n=new zb;return n.set("content",'<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M4 0v1H1v3H0V.5A.5.5 0 0 1 .5 0H4zm8 0h3.5a.5.5 0 0 1 .5.5V4h-1V1h-3V0zM4 16H.5a.5.5 0 0 1-.5-.5V12h1v3h3v1zm8 0v-1h3v-3h1v3.5a.5.5 0 0 1-.5.5H12z"/><path fill-opacity=".256" d="M1 1h14v14H1z"/><g class="ck-icon__selected-indicator"><path d="M7 0h2v1H7V0zM0 7h1v2H0V7zm15 0h1v2h-1V7zm-8 8h2v1H7v-1z"/><path fill-opacity=".254" d="M1 1h14v14H1z"/></g></svg>'),n.render(),t.appendChild(n.element),t}));t.insert(t.createPositionAt(e,0),n),t.addClass(["ck-widget_with-selection-handle"],e)}(e,t),Ak(e,t),e}function xk(e,t,n){if(t.classes&&n.addClass(rc(t.classes),e),t.attributes)for(const i in t.attributes)n.setAttribute(i,t.attributes[i],e)}function Ck(e,t,n){if(t.classes&&n.removeClass(rc(t.classes),e),t.attributes)for(const i in t.attributes)n.removeAttribute(i,e)}function Ak(e,t,n=xk,i=Ck){const r=new bk;r.on("change:top",((t,r)=>{r.oldDescriptor&&i(e,r.oldDescriptor,r.writer),r.newDescriptor&&n(e,r.newDescriptor,r.writer)})),t.setCustomProperty("addHighlight",((e,t,n)=>r.add(t,n)),e),t.setCustomProperty("removeHighlight",((e,t,n)=>r.remove(t,n)),e)}function Ek(e,t,n={}){return t.addClass(["ck-editor__editable","ck-editor__nested-editable"],e),t.setAttribute("role","textbox",e),t.setAttribute("tabindex","-1",e),n.label&&t.setAttribute("aria-label",n.label,e),t.setAttribute("contenteditable",e.isReadOnly?"false":"true",e),e.on("change:isReadOnly",((n,i,r)=>{t.setAttribute("contenteditable",r?"false":"true",e)})),e.on("change:isFocused",((n,i,r)=>{r?t.addClass("ck-editor__nested-editable_focused",e):t.removeClass("ck-editor__nested-editable_focused",e)})),Ak(e,t),e}function Tk(e,t){const n=e.getSelectedElement();if(n){const i=Vk(e);if(i)return t.createRange(t.createPositionAt(n,i))}return t.schema.findOptimalInsertionRange(e)}function Sk(){return null}function Pk(e){const t=e=>{const{width:t,paddingLeft:n,paddingRight:i}=e.ownerDocument.defaultView.getComputedStyle(e);return parseFloat(t)-(parseFloat(n)||0)-(parseFloat(i)||0)},n=e.parentElement;if(!n)return 0;let i=t(n),r=0,s=n;for(;isNaN(i);){if(s=s.parentElement,++r>5)return 0;i=t(s)}return i}const Ik="widget-type-around";function Ok(e,t,n){return!!e&&_k(e)&&!n.isInline(t)}function Vk(e){return e.getAttribute(Ik)}const Rk=["before","after"],Nk=(new DOMParser).parseFromString('<svg viewBox="0 0 10 8" xmlns="http://www.w3.org/2000/svg"><path d="M9.055.263v3.972h-6.77M1 4.216l2-2.038m-2 2 2 2.038"/></svg>',"image/svg+xml").firstChild,Lk="ck-widget__type-around_disabled";class Mk extends cf{_currentFakeCaretModelElement=null;static get pluginName(){return"WidgetTypeAround"}static get isOfficialPlugin(){return!0}static get requires(){return[sk,qy]}init(){const e=this.editor,t=e.editing.view;this.on("change:isEnabled",((n,i,r)=>{t.change((e=>{for(const n of t.document.roots)r?e.removeClass(Lk,n):e.addClass(Lk,n)})),r||e.model.change((e=>{e.removeSelectionAttribute(Ik)}))})),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableInsertObjectIntegration(),this._enableDeleteContentIntegration()}destroy(){super.destroy(),this._currentFakeCaretModelElement=null}_insertParagraph(e,t){const n=this.editor,i=n.editing.view,r=n.model.schema.getAttributesWithProperty(e,"copyOnReplace",!0);n.execute("insertParagraph",{position:n.model.createPositionAt(e,t),attributes:r}),i.focus(),i.scrollToTheSelection()}_listenToIfEnabled(e,t,n,i){this.listenTo(e,t,((...e)=>{this.isEnabled&&n(...e)}),i)}_insertParagraphAccordingToFakeCaretPosition(){const e=this.editor.model.document.selection,t=Vk(e);if(!t)return!1;const n=e.getSelectedElement();return this._insertParagraph(n,t),!0}_enableTypeAroundUIInjection(){const e=this.editor,t=e.model.schema,n=e.locale.t,i={before:n("Insert paragraph before block"),after:n("Insert paragraph after block")};e.editing.downcastDispatcher.on("insert",((e,r,s)=>{const o=s.mapper.toViewElement(r.item);o&&Ok(o,r.item,t)&&(!function(e,t,n){const i=e.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},(function(e){const n=this.toDomElement(e);return function(e,t){for(const n of Rk){const i=new gb({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${n}`],title:t[n],"aria-hidden":"true"},children:[e.ownerDocument.importNode(Nk,!0)]});e.appendChild(i.render())}}(n,t),function(e){const t=new gb({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});e.appendChild(t.render())}(n),n}));e.insert(e.createPositionAt(n,"end"),i)}(s.writer,i,o),o.getCustomProperty("widgetLabel").push((()=>this.isEnabled?n("Press Enter to type after or press Shift + Enter to type before the widget"):"")))}),{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const e=this.editor,t=e.model,n=t.document.selection,i=t.schema,r=e.editing.view;function s(e){return`ck-widget_type-around_show-fake-caret_${e}`}this._listenToIfEnabled(r.document,"arrowKey",((e,t)=>{this._handleArrowKeyPress(e,t)}),{context:[_k,"$text"],priority:"high"}),this._listenToIfEnabled(n,"change:range",((t,n)=>{n.directChange&&e.model.change((e=>{e.removeSelectionAttribute(Ik)}))})),this._listenToIfEnabled(t.document,"change:data",(()=>{const t=n.getSelectedElement();t&&Ok(e.editing.mapper.toViewElement(t),t,i)||e.model.change((e=>{e.removeSelectionAttribute(Ik)}))})),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",((e,t,n)=>{const r=n.writer;if(this._currentFakeCaretModelElement){const e=n.mapper.toViewElement(this._currentFakeCaretModelElement);e&&(r.removeClass(Rk.map(s),e),this._currentFakeCaretModelElement=null)}const o=t.selection.getSelectedElement();if(!o)return;const a=n.mapper.toViewElement(o);if(!Ok(a,o,i))return;const l=Vk(t.selection);l&&(r.addClass(s(l),a),this._currentFakeCaretModelElement=o)})),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",((t,n,i)=>{i||e.model.change((e=>{e.removeSelectionAttribute(Ik)}))}))}_handleArrowKeyPress(e,t){const n=this.editor,i=n.model,r=i.document.selection,s=i.schema,o=n.editing.view,a=function(e,t){const n=ec(e,t);return"down"===n||"right"===n}(t.keyCode,n.locale.contentLanguageDirection),l=o.document.selection.getSelectedElement();let c;Ok(l,n.editing.mapper.toModelElement(l),s)?c=this._handleArrowKeyPressOnSelectedWidget(a):r.isCollapsed?c=this._handleArrowKeyPressWhenSelectionNextToAWidget(a):t.shiftKey||(c=this._handleArrowKeyPressWhenNonCollapsedSelection(a)),c&&(t.preventDefault(),e.stop())}_handleArrowKeyPressOnSelectedWidget(e){const t=this.editor.model,n=Vk(t.document.selection);return t.change((t=>n?n!==(e?"after":"before")&&(t.removeSelectionAttribute(Ik),!0):(t.setSelectionAttribute(Ik,e?"after":"before"),!0)))}_handleArrowKeyPressWhenSelectionNextToAWidget(e){const t=this.editor,n=t.model,i=n.schema,r=t.plugins.get("Widget"),s=r._getObjectElementNextToSelection(e);return!!Ok(t.editing.mapper.toViewElement(s),s,i)&&(n.change((t=>{r._setSelectionOverElement(s),t.setSelectionAttribute(Ik,e?"before":"after")})),!0)}_handleArrowKeyPressWhenNonCollapsedSelection(e){const t=this.editor,n=t.model,i=n.schema,r=t.editing.mapper,s=n.document.selection,o=e?s.getLastPosition().nodeBefore:s.getFirstPosition().nodeAfter;return!!Ok(r.toViewElement(o),o,i)&&(n.change((t=>{t.setSelection(o,"on"),t.setSelectionAttribute(Ik,e?"after":"before")})),!0)}_enableInsertingParagraphsOnButtonClick(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"mousedown",((n,i)=>{const r=i.domTarget.closest(".ck-widget__type-around__button");if(!r)return;const s=r.classList.contains("ck-widget__type-around__button_before")?"before":"after",o=function(e,t){const n=e.closest(".ck-widget");return t.mapDomToView(n)}(r,t.domConverter),a=e.editing.mapper.toModelElement(o);this._insertParagraph(a,s),i.preventDefault(),n.stop()}))}_enableInsertingParagraphsOnEnterKeypress(){const e=this.editor,t=e.model.document.selection,n=e.editing.view;this._listenToIfEnabled(n.document,"enter",((n,i)=>{if("atTarget"!=n.eventPhase)return;const r=t.getSelectedElement(),s=e.editing.mapper.toViewElement(r),o=e.model.schema;let a;this._insertParagraphAccordingToFakeCaretPosition()?a=!0:Ok(s,r,o)&&(this._insertParagraph(r,i.isSoft?"before":"after"),a=!0),a&&(i.preventDefault(),n.stop())}),{context:_k})}_enableInsertingParagraphsOnTypingKeystroke(){const e=this.editor.editing.view.document;this._listenToIfEnabled(e,"insertText",((t,n)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(n.selection=e.selection)}),{priority:"high"}),aa.isAndroid?this._listenToIfEnabled(e,"keydown",((e,t)=>{229==t.keyCode&&this._insertParagraphAccordingToFakeCaretPosition()})):this._listenToIfEnabled(e,"compositionstart",(()=>{this._insertParagraphAccordingToFakeCaretPosition()}),{priority:"high"})}_enableDeleteIntegration(){const e=this.editor,t=e.editing.view,n=e.model,i=n.schema;this._listenToIfEnabled(t.document,"delete",((t,r)=>{if("atTarget"!=t.eventPhase)return;const s=Vk(n.document.selection);if(!s)return;const o=r.direction,a=n.document.selection.getSelectedElement(),l="forward"==o;if("before"===s===l)e.execute("delete",{selection:n.createSelection(a,"on")});else{const t=i.getNearestSelectionRange(n.createPositionAt(a,s),o);if(t)if(t.isCollapsed){const r=n.createSelection(t.start);if(n.modifySelection(r,{direction:o}),r.focus.isEqual(t.start)){const e=function(e,t){let n=t;for(const i of t.getAncestors({parentFirst:!0})){if(i.childCount>1||e.isLimit(i))break;n=i}return n}(i,t.start.parent);n.deleteContent(n.createSelection(e,"on"),{doNotAutoparagraph:!0})}else n.change((n=>{n.setSelection(t),e.execute(l?"deleteForward":"delete")}))}else n.change((n=>{n.setSelection(t),e.execute(l?"deleteForward":"delete")}))}r.preventDefault(),t.stop()}),{context:_k})}_enableInsertContentIntegration(){const e=this.editor,t=this.editor.model,n=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",((e,[i,r])=>{if(r&&!r.is("documentSelection"))return;const s=Vk(n);return s?(e.stop(),t.change((e=>{const r=n.getSelectedElement(),o=t.createPositionAt(r,s),a=e.createSelection(o),l=t.insertContent(i,a);return e.setSelection(a),l}))):void 0}),{priority:"high"})}_enableInsertObjectIntegration(){const e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"insertObject",((e,n)=>{const[,i,r={}]=n;if(i&&!i.is("documentSelection"))return;const s=Vk(t);s&&(r.findOptimalPosition=s,n[3]=r)}),{priority:"high"})}_enableDeleteContentIntegration(){const e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"deleteContent",((e,[n])=>{n&&!n.is("documentSelection")||Vk(t)&&e.stop()}),{priority:"high"})}}function Bk(e,t,n){const i=e.schema,r=e.createRangeIn(t.root),s="forward"==n?"elementStart":"elementEnd";for(const{previousPosition:e,item:o,type:a}of r.getWalker({startPosition:t,direction:n})){if(i.isLimit(o)&&!i.isInline(o))return e;if(a==s&&i.isBlock(o))return null}return null}function Fk(e,t,n){const i="backward"==n?t.end:t.start;if(e.checkChild(i,"$text"))return i;for(const{nextPosition:i}of t.getWalker({direction:n}))if(e.checkChild(i,"$text"))return i;return null}class Dk extends cf{_previouslySelected=new Set;static get pluginName(){return"Widget"}static get isOfficialPlugin(){return!0}static get requires(){return[Mk,qy]}init(){const e=this.editor,t=e.editing.view,n=t.document,i=e.t;this.editor.editing.downcastDispatcher.on("selection",((t,n,i)=>{const r=i.writer,s=n.selection;if(s.isCollapsed)return;const o=s.getSelectedElement();if(!o)return;const a=e.editing.mapper.toViewElement(o);var l;_k(a)&&i.consumable.consume(s,"selection")&&r.setSelection(r.createRangeOn(a),{fake:!0,label:(l=a,l.getCustomProperty("widgetLabel").reduce(((e,t)=>"function"==typeof t?e?e+". "+t():t():e?e+". "+t:t),""))})})),this.editor.editing.downcastDispatcher.on("selection",((e,t,n)=>{this._clearPreviouslySelectedWidgets(n.writer);const i=n.writer,r=i.document.selection;let s=null;for(const e of r.getRanges())for(const t of e){const e=t.item;_k(e)&&(o=e,!(a=s)||!Array.from(o.getAncestors()).includes(a))&&(i.addClass(yk,e),this._previouslySelected.add(e),s=e)}var o,a}),{priority:"low"}),t.addObserver(cp),this.listenTo(n,"mousedown",((...e)=>this._onMousedown(...e))),this.listenTo(n,"arrowKey",((...e)=>{this._handleSelectionChangeOnArrowKeyPress(...e)}),{context:[_k,"$text"]}),this.listenTo(n,"arrowKey",((...e)=>{this._preventDefaultOnArrowKeyPress(...e)}),{context:"$root"}),this.listenTo(n,"arrowKey",function(e){const t=e.model;return(n,i)=>{const r=i.keyCode==Zl.arrowup,s=i.keyCode==Zl.arrowdown,o=i.shiftKey,a=t.document.selection;if(!r&&!s)return;const l=s;if(o&&function(e,t){return!e.isCollapsed&&e.isBackward==t}(a,l))return;const c=function(e,t,n){const i=e.model;if(n){const e=t.isCollapsed?t.focus:t.getLastPosition(),n=Bk(i,e,"forward");if(!n)return null;const r=i.createRange(e,n),s=Fk(i.schema,r,"backward");return s?i.createRange(e,s):null}{const e=t.isCollapsed?t.focus:t.getFirstPosition(),n=Bk(i,e,"backward");if(!n)return null;const r=i.createRange(n,e),s=Fk(i.schema,r,"forward");return s?i.createRange(s,e):null}}(e,a,l);if(c){if(c.isCollapsed){if(a.isCollapsed)return;if(o)return}(c.isCollapsed||function(e,t,n){const i=e.model,r=e.view.domConverter;if(n){const e=i.createSelection(t.start);i.modifySelection(e),e.focus.isAtEnd||t.start.isEqual(e.focus)||(t=i.createRange(e.focus,t.end))}const s=e.mapper.toViewRange(t),o=r.viewRangeToDom(s),a=vl.getDomRangeRects(o);let l;for(const e of a)if(void 0!==l){if(Math.round(e.top)>=l)return!1;l=Math.max(l,Math.round(e.bottom))}else l=Math.round(e.bottom);return!0}(e,c,l))&&(t.change((e=>{const n=l?c.end:c.start;if(o){const i=t.createSelection(a.anchor);i.setFocus(n),e.setSelection(i)}else e.setSelection(n)})),n.stop(),i.preventDefault(),i.stopPropagation())}}}(this.editor.editing),{context:"$text"}),this.listenTo(n,"delete",((e,t)=>{this._handleDelete("forward"==t.direction)&&(t.preventDefault(),e.stop())}),{context:"$root"}),this.listenTo(n,"tab",((e,t)=>{"atTarget"==e.eventPhase&&(t.shiftKey||this._selectFirstNestedEditable()&&(t.preventDefault(),e.stop()))}),{context:_k,priority:"low"}),this.listenTo(n,"tab",((e,t)=>{t.shiftKey&&this._selectAncestorWidget()&&(t.preventDefault(),e.stop())}),{priority:"low"}),this.listenTo(n,"keydown",((e,t)=>{t.keystroke==Zl.esc&&this._selectAncestorWidget()&&(t.preventDefault(),e.stop())}),{priority:"low"}),e.accessibility.addKeystrokeInfoGroup({id:"widget",label:i("Keystrokes that can be used when a widget is selected (for example: image, table, etc.)"),keystrokes:[{label:i("Move focus from an editable area back to the parent widget"),keystroke:"Esc"},{label:i("Insert a new paragraph directly after a widget"),keystroke:"Enter"},{label:i("Insert a new paragraph directly before a widget"),keystroke:"Shift+Enter"},{label:i("Move the caret to allow typing directly before a widget"),keystroke:[["arrowup"],["arrowleft"]]},{label:i("Move the caret to allow typing directly after a widget"),keystroke:[["arrowdown"],["arrowright"]]}]})}_onMousedown(e,t){const n=this.editor,i=n.editing.view,r=i.document;let s=t.target;if(!s)return;if(t.domEvent.detail>=3)return void(this._selectBlockContent(s)&&t.preventDefault());if(!_k(s)){const e=function(e){let t=e;for(;t;){if(t.is("editableElement")||_k(t))return t;t=t.parent}return null}(s);if(!e)return;if(_k(e))s=e;else{const e=function(e,t){const n=gl(t.domEvent);let i=null;if(i=n?e.domConverter.domRangeToView(n):e.createRange(e.createPositionAt(t.target,0)),!i)return null;const r=i.start;if(!r.parent)return null;let s=r.parent;return r.parent.is("editableElement")&&(r.isAtEnd&&r.nodeBefore?s=r.nodeBefore:r.isAtStart&&r.nodeAfter&&(s=r.nodeAfter)),s.is("$text")?s.parent:s}(i,t);if(!e||!_k(e))return;s=e}}aa.isAndroid&&t.preventDefault(),r.isFocused||i.focus();const o=n.editing.mapper.toModelElement(s);this._setSelectionOverElement(o)}_selectBlockContent(e){const t=this.editor,n=t.model,i=t.editing.mapper,r=n.schema,s=i.findMappedViewAncestor(this.editor.editing.view.createPositionAt(e,0)),o=function(e,t){for(const n of e.getAncestors({includeSelf:!0,parentFirst:!0})){if(t.checkChild(n,"$text"))return n;if(t.isLimit(n)&&!t.isObject(n))break}return null}(i.toModelElement(s),n.schema);return!!o&&(n.change((e=>{const t=r.isLimit(o)?null:function(e,t){const n=new mh({startPosition:e});for(const{item:e}of n){if(t.isLimit(e)||!e.is("element"))return null;if(t.checkChild(e,"$text"))return e}return null}(e.createPositionAfter(o),r),n=e.createPositionAt(o,0),i=t?e.createPositionAt(t,0):e.createPositionAt(o,"end");e.setSelection(e.createRange(n,i))})),!0)}_handleSelectionChangeOnArrowKeyPress(e,t){const n=t.keyCode,i=this.editor.model,r=i.schema,s=i.document.selection,o=s.getSelectedElement(),a=ec(n,this.editor.locale.contentLanguageDirection),l="down"==a||"right"==a,c="up"==a||"down"==a;if(o&&r.isObject(o)){const n=l?s.getLastPosition():s.getFirstPosition(),o=r.getNearestSelectionRange(n,l?"forward":"backward");return void(o&&(i.change((e=>{e.setSelection(o)})),t.preventDefault(),e.stop()))}if(!s.isCollapsed&&!t.shiftKey){const n=s.getFirstPosition(),o=s.getLastPosition(),a=n.nodeAfter,c=o.nodeBefore;return void((a&&r.isObject(a)||c&&r.isObject(c))&&(i.change((e=>{e.setSelection(l?o:n)})),t.preventDefault(),e.stop()))}if(!s.isCollapsed)return;const d=this._getObjectElementNextToSelection(l);if(d&&r.isObject(d)){if(r.isInline(d)&&c)return;this._setSelectionOverElement(d),t.preventDefault(),e.stop()}}_preventDefaultOnArrowKeyPress(e,t){const n=this.editor.model,i=n.schema,r=n.document.selection.getSelectedElement();r&&i.isObject(r)&&(t.preventDefault(),e.stop())}_handleDelete(e){const t=this.editor.model.document.selection;if(!this.editor.model.canEditAt(t))return;if(!t.isCollapsed)return;const n=this._getObjectElementNextToSelection(e);return n?(this.editor.model.change((e=>{let i=t.anchor.parent;for(;i.isEmpty;){const t=i;i=t.parent,e.remove(t)}this._setSelectionOverElement(n)})),!0):void 0}_setSelectionOverElement(e){this.editor.model.change((t=>{t.setSelection(t.createRangeOn(e))}))}_getObjectElementNextToSelection(e){const t=this.editor.model,n=t.schema,i=t.document.selection,r=t.createSelection(i);if(t.modifySelection(r,{direction:e?"forward":"backward"}),r.isEqual(i))return null;const s=e?r.focus.nodeBefore:r.focus.nodeAfter;return s&&n.isObject(s)?s:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass(yk,t);this._previouslySelected.clear()}_selectFirstNestedEditable(){const e=this.editor,t=this.editor.editing.view.document;for(const n of t.selection.getFirstRange().getItems())if(n.is("editableElement")){const t=e.editing.mapper.toModelElement(n);if(!t)continue;const i=e.model.createPositionAt(t,0),r=e.model.schema.getNearestSelectionRange(i,"forward");return e.model.change((e=>{e.setSelection(r)})),!0}return!1}_selectAncestorWidget(){const e=this.editor,t=e.editing.mapper,n=e.editing.view.document.selection.getFirstPosition().parent,i=(n.is("$text")?n.parent:n).findAncestor(_k);if(!i)return!1;const r=t.toModelElement(i);return!!r&&(e.model.change((e=>{e.setSelection(r,"on")})),!0)}}class zk extends cf{_toolbarDefinitions=new Map;_balloon;static get requires(){return[sy]}static get pluginName(){return"WidgetToolbarRepository"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(e.plugins.has("BalloonToolbar")){const t=e.plugins.get("BalloonToolbar");this.listenTo(t,"show",(t=>{(function(e){const t=e.getSelectedElement();return!(!t||!_k(t))})(e.editing.view.document.selection)&&t.stop()}),{priority:"high"})}this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",(()=>{this._updateToolbarsVisibility()})),this.listenTo(e.ui,"update",(()=>{this._updateToolbarsVisibility()})),this.listenTo(e.ui.focusTracker,"change:isFocused",(()=>{this._updateToolbarsVisibility()}),{priority:"low"})}destroy(){super.destroy();for(const e of this._toolbarDefinitions.values())e.view.destroy()}register(e,{ariaLabel:t,items:n,getRelatedElement:i,balloonClassName:r="ck-toolbar-container"}){if(!n.length)return void Ea("widget-toolbar-no-items",{toolbarId:e});const s=this.editor,o=s.t,a=new qw(s.locale);if(a.ariaLabel=t||o("Widget toolbar"),this._toolbarDefinitions.has(e))throw new Aa("widget-toolbar-duplicated",this,{toolbarId:e});const l={view:a,getRelatedElement:i,balloonClassName:r,itemsConfig:n,initialized:!1};s.ui.addToolbar(a,{isContextual:!0,beforeFocus:()=>{const e=i(s.editing.view.document.selection);e&&this._showToolbar(l,e)},afterBlur:()=>{this._hideToolbar(l)}}),this._toolbarDefinitions.set(e,l)}_updateToolbarsVisibility(){let e=0,t=null,n=null;for(const i of this._toolbarDefinitions.values()){const r=i.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&r)if(this.editor.ui.focusTracker.isFocused){const s=r.getAncestors().length;s>e&&(e=s,t=r,n=i)}else this._isToolbarVisible(i)&&this._hideToolbar(i);else this._isToolbarInBalloon(i)&&this._hideToolbar(i)}n&&this._showToolbar(n,t)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(e,t){this._isToolbarVisible(e)?$k(this.editor,t):this._isToolbarInBalloon(e)||(e.initialized||(e.initialized=!0,e.view.fillFromConfig(e.itemsConfig,this.editor.ui.componentFactory)),this._balloon.add({view:e.view,position:jk(this.editor,t),balloonClassName:e.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",(()=>{for(const e of this._toolbarDefinitions.values())if(this._isToolbarVisible(e)){const t=e.getRelatedElement(this.editor.editing.view.document.selection);$k(this.editor,t)}})))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function $k(e,t){const n=e.plugins.get("ContextualBalloon"),i=jk(e,t);n.updatePosition(i)}function jk(e,t){const n=e.editing.view,i=zw.defaultPositions;return{target:n.domConverter.mapViewToDom(t),positions:[i.northArrowSouth,i.northArrowSouthWest,i.northArrowSouthEast,i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast,i.viewportStickyNorth]}}class Hk extends(Ga()){_referenceCoordinates;_options;_originalWidth;_originalHeight;_originalWidthPercents;_aspectRatio;constructor(e){super(),this.set("activeHandlePosition",null),this.set("proposedWidthPercents",null),this.set("proposedWidth",null),this.set("proposedHeight",null),this.set("proposedHandleHostWidth",null),this.set("proposedHandleHostHeight",null),this._options=e,this._referenceCoordinates=null}get originalWidth(){return this._originalWidth}get originalHeight(){return this._originalHeight}get originalWidthPercents(){return this._originalWidthPercents}get aspectRatio(){return this._aspectRatio}begin(e,t,n){const i=new vl(t);this.activeHandlePosition=function(e){const t=["top-left","top-right","bottom-right","bottom-left"];for(const n of t)if(e.classList.contains(`ck-widget__resizer__handle-${n}`))return n}(e),this._referenceCoordinates=function(e,t){const n=new vl(e),i=t.split("-"),r={x:"right"==i[1]?n.right:n.left,y:"bottom"==i[0]?n.bottom:n.top};return r.x+=e.ownerDocument.defaultView.scrollX,r.y+=e.ownerDocument.defaultView.scrollY,r}(t,function(e){const t=e.split("-"),n={top:"bottom",bottom:"top",left:"right",right:"left"};return`${n[t[0]]}-${n[t[1]]}`}(this.activeHandlePosition)),this._originalWidth=i.width,this._originalHeight=i.height,this._aspectRatio=i.width/i.height;const r=n.style.width;r&&r.match(/^\d+(\.\d*)?%$/)?this._originalWidthPercents=parseFloat(r):this._originalWidthPercents=function(e,t=new vl(e)){const n=Pk(e);return n?t.width/n*100:0}(n,i)}update(e){this.proposedWidth=e.width,this.proposedHeight=e.height,this.proposedWidthPercents=e.widthPercents,this.proposedHandleHostWidth=e.handleHostWidth,this.proposedHandleHostHeight=e.handleHostHeight}}class Wk extends Lb{constructor(){super();const e=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-size-view",e.to("_viewPosition",(e=>e?`ck-orientation-${e}`:""))],style:{display:e.if("_isVisible","none",(e=>!e))}},children:[{text:e.to("_label")}]})}_bindToState(e,t){this.bind("_isVisible").to(t,"proposedWidth",t,"proposedHeight",((e,t)=>null!==e&&null!==t)),this.bind("_label").to(t,"proposedHandleHostWidth",t,"proposedHandleHostHeight",t,"proposedWidthPercents",((t,n,i)=>"px"===e.unit?`${t}×${n}`:`${i}%`)),this.bind("_viewPosition").to(t,"activeHandlePosition",t,"proposedHandleHostWidth",t,"proposedHandleHostHeight",((e,t,n)=>t<50||n<50?"above-center":e))}_dismiss(){this.unbind(),this._isVisible=!1}}class Uk extends(Ga()){_state;_sizeView;_options;_viewResizerWrapper=null;_initialViewWidth;constructor(e){super(),this._options=e,this.set("isEnabled",!0),this.set("isSelected",!1),this.bind("isVisible").to(this,"isEnabled",this,"isSelected",((e,t)=>e&&t)),this.decorate("begin"),this.decorate("cancel"),this.decorate("commit"),this.decorate("updateSize"),this.on("commit",(e=>{this.state.proposedWidth||this.state.proposedWidthPercents||(this._cleanup(),e.stop())}),{priority:"high"})}get state(){return this._state}show(){this._options.editor.editing.view.change((e=>{e.removeClass("ck-hidden",this._viewResizerWrapper)}))}hide(){this._options.editor.editing.view.change((e=>{e.addClass("ck-hidden",this._viewResizerWrapper)}))}attach(){const e=this,t=this._options.viewElement;this._options.editor.editing.view.change((n=>{const i=n.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},(function(t){const n=this.toDomElement(t);return e._appendHandles(n),e._appendSizeUI(n),n}));n.insert(n.createPositionAt(t,"end"),i),n.addClass("ck-widget_with-resizer",t),this._viewResizerWrapper=i,this.isVisible||this.hide()})),this.on("change:isVisible",(()=>{this.isVisible?(this.show(),this.redraw()):this.hide()}))}begin(e){this._state=new Hk(this._options),this._sizeView._bindToState(this._options,this.state),this._initialViewWidth=this._options.viewElement.getStyle("width"),this.state.begin(e,this._getHandleHost(),this._getResizeHost())}updateSize(e){const t=this._proposeNewSize(e);this._options.editor.editing.view.change((e=>{const n=this._options.unit||"%",i=("%"===n?t.widthPercents:t.width)+n;e.setStyle("width",i,this._options.viewElement)}));const n=this._getHandleHost(),i=new vl(n),r=Math.round(i.width),s=Math.round(i.height),o=new vl(n);t.width=Math.round(o.width),t.height=Math.round(o.height),this.redraw(i),this.state.update({...t,handleHostWidth:r,handleHostHeight:s})}commit(){const e=this._options.unit||"%",t=("%"===e?this.state.proposedWidthPercents:this.state.proposedWidth)+e;this._options.editor.editing.view.change((()=>{this._cleanup(),this._options.onCommit(t)}))}cancel(){this._cleanup()}destroy(){this.cancel()}redraw(e){const t=this._domResizerWrapper;if(!((n=t)&&n.ownerDocument&&n.ownerDocument.contains(n)))return;var n;const i=t.parentElement,r=this._getHandleHost(),s=this._viewResizerWrapper,o=[s.getStyle("width"),s.getStyle("height"),s.getStyle("left"),s.getStyle("top")];let a;if(i.isSameNode(r)){const t=e||new vl(r);a=[t.width+"px",t.height+"px",void 0,void 0]}else a=[r.offsetWidth+"px",r.offsetHeight+"px",r.offsetLeft+"px",r.offsetTop+"px"];"same"!==tl(o,a)&&this._options.editor.editing.view.change((e=>{e.setStyle({width:a[0],height:a[1],left:a[2],top:a[3]},s)}))}containsHandle(e){return this._domResizerWrapper.contains(e)}static isResizeHandle(e){return e.classList.contains("ck-widget__resizer__handle")}_cleanup(){this._sizeView._dismiss(),this._options.editor.editing.view.change((e=>{e.setStyle("width",this._initialViewWidth,this._options.viewElement)}))}_proposeNewSize(e){const t=this.state,n=(r=e).pageX,i=r.pageY;var r;const s=!this._options.isCentered||this._options.isCentered(this),o={x:t._referenceCoordinates.x-(n+t.originalWidth),y:i-t.originalHeight-t._referenceCoordinates.y};s&&t.activeHandlePosition.endsWith("-right")&&(o.x=n-(t._referenceCoordinates.x+t.originalWidth)),s&&(o.x*=2);let a=Math.abs(t.originalWidth+o.x),l=Math.abs(t.originalHeight+o.y);return"width"==(a/t.aspectRatio>l?"width":"height")?l=a/t.aspectRatio:a=l*t.aspectRatio,{width:Math.round(a),height:Math.round(l),widthPercents:Math.min(Math.round(t.originalWidthPercents/t.originalWidth*a*100)/100,100)}}_getResizeHost(){const e=this._domResizerWrapper.parentElement;return this._options.getResizeHost(e)}_getHandleHost(){const e=this._domResizerWrapper.parentElement;return this._options.getHandleHost(e)}get _domResizerWrapper(){return this._options.editor.editing.view.domConverter.mapViewToDom(this._viewResizerWrapper)}_appendHandles(e){const t=["top-left","top-right","bottom-right","bottom-left"];for(const i of t)e.appendChild(new gb({tag:"div",attributes:{class:"ck-widget__resizer__handle "+(n=i,`ck-widget__resizer__handle-${n}`)}}).render());var n}_appendSizeUI(e){this._sizeView=new Wk,this._sizeView.render(),e.appendChild(this._sizeView.element)}}class qk extends cf{_resizers=new Map;_observer;_redrawSelectedResizerThrottled;static get pluginName(){return"WidgetResize"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.editing,t=ra.window.document;this.set("selectedResizer",null),this.set("_activeResizer",null),e.view.addObserver(cp),this._observer=new(dl()),this.listenTo(e.view.document,"mousedown",this._mouseDownListener.bind(this),{priority:"high"}),this._observer.listenTo(t,"mousemove",this._mouseMoveListener.bind(this)),this._observer.listenTo(t,"mouseup",this._mouseUpListener.bind(this)),this._redrawSelectedResizerThrottled=Yp((()=>this.redrawSelectedResizer()),200),this.editor.ui.on("update",this._redrawSelectedResizerThrottled),this.editor.model.document.on("change",(()=>{for(const[e,t]of this._resizers)e.isAttached()||(this._resizers.delete(e),t.destroy())}),{priority:"lowest"}),this._observer.listenTo(ra.window,"resize",this._redrawSelectedResizerThrottled);const n=this.editor.editing.view.document.selection;n.on("change",(()=>{const e=n.getSelectedElement(),t=this.getResizerByViewElement(e)||null;t?this.select(t):this.deselect()}))}redrawSelectedResizer(){this.selectedResizer&&this.selectedResizer.isVisible&&this.selectedResizer.redraw()}destroy(){super.destroy(),this._observer.stopListening();for(const e of this._resizers.values())e.destroy();this._redrawSelectedResizerThrottled.cancel()}select(e){this.deselect(),this.selectedResizer=e,this.selectedResizer.isSelected=!0}deselect(){this.selectedResizer&&(this.selectedResizer.isSelected=!1),this.selectedResizer=null}attachTo(e){const t=new Uk(e),n=this.editor.plugins;if(t.attach(),n.has("WidgetToolbarRepository")){const e=n.get("WidgetToolbarRepository");t.on("begin",(()=>{e.forceDisabled("resize")}),{priority:"lowest"}),t.on("cancel",(()=>{e.clearForceDisabled("resize")}),{priority:"highest"}),t.on("commit",(()=>{e.clearForceDisabled("resize")}),{priority:"highest"})}this._resizers.set(e.viewElement,t);const i=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(i)==t&&this.select(t),t}getResizerByViewElement(e){return this._resizers.get(e)}_getResizerByHandle(e){for(const t of this._resizers.values())if(t.containsHandle(e))return t}_mouseDownListener(e,t){const n=t.domTarget;Uk.isResizeHandle(n)&&(this._activeResizer=this._getResizerByHandle(n)||null,this._activeResizer&&(this._activeResizer.begin(n),e.stop(),t.preventDefault()))}_mouseMoveListener(e,t){this._activeResizer&&this._activeResizer.updateSize(t)}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null)}}class Gk extends Lb{focusTracker=new lc;keystrokes=new hc;idInputView;buttonView;children;_validators;_focusables=new mb;_focusCycler;constructor(e,t){super(e);const n=e.t;this._validators=t,this.idInputView=this._createIdInput(),this.buttonView=this._createButton(n("Insert"),"ck-button-action ck-button-bold"),this.buttonView.type="submit",this.children=this._createViewChildren(),this._focusCycler=new Ub({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-bookmark-view"],tabindex:"-1"},children:this.children})}render(){super.render(),Fb({view:this}),[this.idInputView,this.buttonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.idInputView.errorText=t,!1}return!0}resetFormStatus(){this.idInputView.errorText=null}_createViewChildren(){const e=this.createCollection(),t=this.t;return e.add(new Wb(this.locale,{label:t("Bookmark")})),e.add(this._createFormContentView()),e}_createFormContentView(){const e=new Lb(this.locale),t=this.createCollection();return t.add(this.idInputView),t.add(this.buttonView),e.setTemplate({tag:"div",attributes:{class:["ck","ck-bookmark-form","ck-responsive-form"]},children:t}),e}_createIdInput(){const e=this.locale.t,t=new Ew(this.locale,sv);return t.label=e("Bookmark name"),t.infoText=e("Enter the bookmark name without spaces."),t}_createButton(e,t){const n=new jb(this.locale);return n.set({label:e,withText:!0}),n.extendTemplate({attributes:{class:t}}),n}get id(){const{element:e}=this.idInputView.fieldView;return e?e.value.trim():null}}class Kk extends Lb{focusTracker=new lc;keystrokes=new hc;bookmarkPreviewView;removeButtonView;editButtonView;_focusables=new mb;_focusCycler;constructor(e){super(e);const t=e.t;this.bookmarkPreviewView=this._createBookmarkPreviewView(),this.removeButtonView=this._createButton(t("Remove bookmark"),Pf.remove,"remove",this.bookmarkPreviewView),this.editButtonView=this._createButton(t("Edit bookmark"),Pf.pencil,"edit",this.bookmarkPreviewView),this.set("id",void 0),this._focusCycler=new Ub({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-bookmark-actions","ck-responsive-form"],tabindex:"-1"},children:[this.bookmarkPreviewView,this.editButtonView,this.removeButtonView]})}render(){super.render(),[this.editButtonView,this.removeButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(e,t,n,i){const r=new jb(this.locale);return r.set({label:e,icon:t,tooltip:!0}),r.delegate("execute").to(this,n),r.labelView.unbind("id"),r.labelView.bind("id").to(r,"ariaLabelledBy",(e=>e.split(" ")[0])),r.ariaLabelledBy=`${r.ariaLabelledBy} ${i.id}`,r}_createBookmarkPreviewView(){const e=new ow(this.locale);return e.extendTemplate({attributes:{class:["ck","ck-bookmark-actions__preview"]}}),e.bind("text").to(this,"id"),e}}function Zk(e){return!(!e||"string"!=typeof e||/\s/.test(e))}class Qk extends uf{refresh(){const e=this.editor.model.document.selection,t=this._getPositionToInsertBookmark(e);this.isEnabled=!!t}execute(e){if(!e)return;const{bookmarkId:t}=e;if(!Zk(t))return void Ea("insert-bookmark-command-executed-with-invalid-name");const n=this.editor,i=n.model,r=i.document.selection;i.change((e=>{let s=this._getPositionToInsertBookmark(r);if(!i.schema.checkChild(s,"bookmark")){const e=n.execute("insertParagraph",{position:s});if(!e)return;s=e}const o=e.createElement("bookmark",{...Object.fromEntries(r.getAttributes()),bookmarkId:t});i.insertObject(o,s,null,{setSelection:"on"})}))}_getPositionToInsertBookmark(e){const t=this.editor.model,n=t.schema,i=e.getFirstRange(),r=i.start;if(Yk(r,n))return r;for(const{previousPosition:e,item:r}of i){if(r.is("element")&&n.checkChild(r,"$text")&&Yk(r,n))return t.createPositionAt(r,0);if(Yk(e,n))return e}return null}}function Yk(e,t){return!!t.checkChild(e,"bookmark")||!!t.checkChild(e,"paragraph")&&t.checkChild("paragraph","bookmark")}class Jk extends uf{refresh(){const e=Xk(this.editor.model.document.selection);this.isEnabled=!!e,this.value=e?e.getAttribute("bookmarkId"):void 0}execute(e){if(!e)return;const{bookmarkId:t}=e;if(!Zk(t))return void Ea("update-bookmark-command-executed-with-invalid-name");const n=this.editor.model,i=Xk(n.document.selection);i&&n.change((e=>{e.setAttribute("bookmarkId",t,i)}))}}function Xk(e){const t=e.getSelectedElement();return t&&t.is("element","bookmark")?t:null}class ex extends cf{_bookmarkElements=new Map;static get pluginName(){return"BookmarkEditing"}static get isOfficialPlugin(){return!0}init(){const{editor:e}=this;this._defineSchema(),this._defineConverters(),e.commands.add("insertBookmark",new Qk(e)),e.commands.add("updateBookmark",new Jk(e)),this.listenTo(e.model.document,"change:data",(()=>{this._trackBookmarkElements()}))}getElementForBookmarkId(e){for(const[t,n]of this._bookmarkElements)if(n==e)return t;return null}_defineSchema(){this.editor.model.schema.register("bookmark",{inheritAllFrom:"$inlineObject",allowAttributes:"bookmarkId",disallowAttributes:["linkHref","htmlA"]})}_defineConverters(){const{editor:e}=this,{conversion:t,t:n}=e;e.data.htmlProcessor.domConverter.registerInlineObjectMatcher((e=>tx(e))),e.editing.view.domConverter.registerInlineObjectMatcher((e=>tx(e,!1))),t.for("dataDowncast").elementToElement({model:{name:"bookmark",attributes:["bookmarkId"]},view:(e,{writer:t})=>t.createEmptyElement("a",{id:e.getAttribute("bookmarkId")})}),t.for("editingDowncast").elementToElement({model:{name:"bookmark",attributes:["bookmarkId"]},view:(e,{writer:t})=>{const i=e.getAttribute("bookmarkId"),r=t.createContainerElement("a",{id:i,class:"ck-bookmark"},[this._createBookmarkUIElement(t)]);return this._bookmarkElements.set(e,i),kk(r,t,{label:()=>`${i} ${n("bookmark widget")}`})}}),t.for("upcast").add((t=>t.on("element:a",function(e){return(t,n,i)=>{const r=n.viewItem,s=tx(r,!1);if(!s||!i.consumable.test(r,s))return;const o=function(e){const t=e.config.get("bookmark.enableNonEmptyAnchorConversion");return void 0===t||t}(e);if(!o&&!r.isEmpty)return;const a=i.writer,l=r.getAttribute("id"),c=r.getAttribute("name"),d=l||c,u=a.createElement("bookmark",{bookmarkId:d});if(!i.safeInsert(u,n.modelCursor))return;i.consumable.consume(r,s),l===c&&i.consumable.consume(r,{attributes:["name"]}),i.updateConversionResult(u,n);const{modelCursor:h,modelRange:m}=i.convertChildren(r,n.modelCursor);n.modelCursor=h,n.modelRange=a.createRange(n.modelRange.start,m.end)}}(e))))}_createBookmarkUIElement(e){return e.createUIElement("span",{class:"ck-bookmark__icon"},(function(e){const t=this.toDomElement(e),n=new zb;return n.set({content:Pf.bookmarkInline,isColorInherited:!1}),n.render(),t.appendChild(n.element),t}))}_trackBookmarkElements(){this._bookmarkElements.forEach(((e,t)=>{"$graveyard"===t.root.rootName&&this._bookmarkElements.delete(t)}))}}function tx(e,t=!0){if("a"!==e.name)return null;if(t&&!e.isEmpty)return null;const n=e.hasAttribute("id"),i=e.hasAttribute("name"),r=e.hasAttribute("href");return n&&!r?{name:!0,attributes:["id"]}:i&&!r?{name:!0,attributes:["name"]}:null}const nx="bookmark-ui";class ix extends cf{actionsView=null;formView=null;_balloon;static get requires(){return[ex,sy]}static get pluginName(){return"BookmarkUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.editing.view.addObserver(lp),this._balloon=e.plugins.get(sy),this._createToolbarBookmarkButton(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:nx,view:{classes:["ck-fake-bookmark-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:nx,view:(e,{writer:t})=>{if(!e.markerRange.isCollapsed)return null;const n=t.createUIElement("span");return t.addClass(["ck-fake-bookmark-selection","ck-fake-bookmark-selection_collapsed"],n),n}})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){const e=this.editor,t=new Kk(e.locale),n=e.commands.get("updateBookmark"),i=e.commands.get("delete");return t.bind("id").to(n,"value"),t.editButtonView.bind("isEnabled").to(n),t.removeButtonView.bind("isEnabled").to(i),this.listenTo(t,"edit",(()=>{this._addFormView()})),this.listenTo(t,"remove",(()=>{this._hideUI(),e.execute("delete")})),t.keystrokes.set("Esc",((e,t)=>{this._hideUI(),t()})),t}_createFormView(){const e=this.editor,t=e.locale,n=e.commands.get("insertBookmark"),i=e.commands.get("updateBookmark"),r=[n,i],s=new(Bb(Gk))(t,function(e){const{t}=e,n=e.plugins.get(ex);return[e=>{if(!e.id)return t("Bookmark must not be empty.")},e=>{if(e.id&&/\s/.test(e.id))return t("Bookmark name cannot contain space characters.")},i=>{const r=e.model.document.selection.getSelectedElement(),s=n.getElementForBookmarkId(i.id);if(r!==s)return s?t("Bookmark name already exists."):void 0}]}(e));return s.idInputView.fieldView.bind("value").to(i,"value"),s.idInputView.bind("isEnabled").toMany(r,"isEnabled",((...e)=>e.some((e=>e)))),s.buttonView.bind("isEnabled").toMany(r,"isEnabled",((...e)=>e.some((e=>e)))),this.listenTo(s,"submit",(()=>{if(s.isValid()){const t=s.id;this._getSelectedBookmarkElement()?e.execute("updateBookmark",{bookmarkId:t}):e.execute("insertBookmark",{bookmarkId:t}),this._closeFormView()}})),this.listenTo(s.idInputView,"change:errorText",(()=>{e.ui.update()})),s.keystrokes.set("Esc",((e,t)=>{this._closeFormView(),t()})),s}_createToolbarBookmarkButton(){const e=this.editor;e.ui.componentFactory.add("bookmark",(()=>{const e=this._createButton(jb);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add("menuBar:bookmark",(()=>this._createButton(sw)))}_createButton(e){const t=this.editor,n=t.locale,i=new e(n),r=t.commands.get("insertBookmark"),s=t.commands.get("updateBookmark"),o=n.t;return i.set({label:o("Bookmark"),icon:Pf.bookmark}),this.listenTo(i,"execute",(()=>this._showUI(!0))),i.bind("isEnabled").toMany([r,s],"isEnabled",((...e)=>e.some((e=>e)))),i.bind("isOn").to(s,"value",(e=>!!e)),i}_enableBalloonActivators(){const e=this.editor.editing.view.document;this.listenTo(e,"click",(()=>{this._getSelectedBookmarkElement()&&this._showUI()}))}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",((e,t)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),t())}),{priority:"high"}),this.editor.keystrokes.set("Esc",((e,t)=>{this._isUIVisible&&(this._hideUI(),t())})),Mb({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUI()})}_updateFormButtonLabel(e){const t=this.editor.locale.t;this.formView.buttonView.label=t(e?"Update":"Insert")}_addActionsView(){this.actionsView||this._createViews(),this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const e=this.editor.commands.get("updateBookmark");this.formView.disableCssTransitions(),this.formView.resetFormStatus(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.formView.idInputView.fieldView.value=e.value||"",this._balloon.visibleView===this.formView&&this.formView.idInputView.fieldView.select(),this.formView.enableCssTransitions()}_closeFormView(){void 0!==this.editor.commands.get("updateBookmark").value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.buttonView.focus(),this.formView.idInputView.fieldView.reset(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedBookmarkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let n=this._getSelectedBookmarkElement(),i=s();this._updateFormButtonLabel(!!n);const r=()=>{const e=this._getSelectedBookmarkElement(),t=s();n&&!e||!n&&t!==i?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),this._updateFormButtonLabel(!!n),n=e,i=t};function s(){return t.selection.focus.getAncestors().reverse().find((e=>e.is("element")))}this.listenTo(e.ui,"update",r),this.listenTo(this._balloon,"change:visibleView",r)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _areActionsInPanel(){return!!this.actionsView&&this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return!!this.actionsView&&this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){const e=this._balloon.visibleView;return!!this.formView&&e==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=this.editor.model;let n;const i=this._getSelectedBookmarkElement();if(t.markers.has(nx)){const t=Array.from(this.editor.editing.mapper.markerNameToElements(nx)),i=e.createRange(e.createPositionBefore(t[0]),e.createPositionAfter(t[t.length-1]));n=e.domConverter.viewRangeToDom(i)}else i&&(n=()=>{const t=this.editor.editing.mapper,n=e.domConverter,r=t.toViewElement(i);return n.mapViewToDom(r)});return n&&{target:n}}_getSelectedBookmarkElement(){const e=this.editor.model.document.selection.getSelectedElement();return e&&e.is("element","bookmark")?e:null}_showFakeVisualSelection(){const e=this.editor.model;e.change((t=>{const n=e.document.selection.getFirstRange();if(e.markers.has(nx))t.updateMarker(nx,{range:n});else if(n.start.isAtEnd){const i=n.start.getLastMatchingPosition((({item:t})=>!e.schema.isContent(t)),{boundaries:n});t.addMarker(nx,{usingOperation:!1,affectsData:!1,range:t.createRange(i,n.end)})}else t.addMarker(nx,{usingOperation:!1,affectsData:!1,range:n})}))}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(nx)&&e.change((e=>{e.removeMarker(nx)}))}}class rx extends cf{static get pluginName(){return"Bookmark"}static get requires(){return[ex,ix,Dk]}static get isOfficialPlugin(){return!0}}Error;const sx=function(e,t){return e&&jo(e,t,Bs)},ox=function(e){return e==e&&!or(e)},ax=function(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in Object(n))}},lx=function(e){var t=function(e){for(var t=Bs(e),n=t.length;n--;){var i=t[n],r=e[i];t[n]=[i,r,ox(r)]}return t}(e);return 1==t.length&&t[0][2]?ax(t[0][0],t[0][1]):function(n){return n===e||function(e,t,n,i){var r=n.length,s=r,o=!i;if(null==e)return!s;for(e=Object(e);r--;){var a=n[r];if(o&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++r<s;){var l=(a=n[r])[0],c=e[l],d=a[1];if(o&&a[2]){if(void 0===c&&!(l in e))return!1}else{var u=new rs;if(i)var h=i(c,d,l,e,t,u);if(!(void 0===h?vd(d,c,3,i,u):h))return!1}}return!0}(n,e,t)}},cx=function(e,t){return null!=e&&t in Object(e)},dx=function(e,t){return null!=e&&function(e,t,n){for(var i=-1,r=(t=Bc(t,e)).length,s=!1;++i<r;){var o=Fc(t[i]);if(!(s=null!=e&&n(e,o)))break;e=e[o]}return s||++i!=r?s:!!(r=null==e?0:e.length)&&_s(r)&&ys(o,r)&&(wr(e)||gs(e))}(e,t,cx)},ux=function(e){return Ac(e)?(t=Fc(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return Dc(t,e)}}(e);var t},hx=function(e){return"function"==typeof e?e:null==e?qo:"object"==typeof e?wr(e)?(t=e[0],n=e[1],Ac(t)&&ox(n)?ax(Fc(t),n):function(e){var i=zc(e,t);return void 0===i&&i===n?dx(e,t):vd(n,i,3)}):lx(e):ux(e);var t,n};class mx extends Yu{domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"];constructor(e){super(e);const t=this.document;function n(e){return(n,i)=>{i.preventDefault();const r=i.dropRange?[i.dropRange]:null,s=new ya(t,e);t.fire(s,{dataTransfer:i.dataTransfer,method:n.name,targetRanges:r,target:i.target,domEvent:i.domEvent}),s.stop.called&&i.stopPropagation()}}this.listenTo(t,"paste",n("clipboardInput"),{priority:"low"}),this.listenTo(t,"drop",n("clipboardInput"),{priority:"low"}),this.listenTo(t,"dragover",n("dragging"),{priority:"low"})}onDomEvent(e){const t="clipboardData"in e?e.clipboardData:e.dataTransfer,n="drop"==e.type||"paste"==e.type,i={dataTransfer:new sh(t,{cacheFiles:n})};if("drop"==e.type||"dragover"==e.type){const t=gl(e);i.dropRange=t&&this.view.domConverter.domRangeToView(t)}this.fire(e.type,e,i)}}const gx=["figcaption","li"],px=["ol","ul"];function fx(e,t){if(t.is("$text")||t.is("$textProxy"))return t.data;if(t.is("element","img")&&t.hasAttribute("alt"))return t.getAttribute("alt");if(t.is("element","br"))return"\n";let n="",i=null;for(const o of t.getChildren())n+=(r=o,((s=i)?r.is("element","li")&&!r.isEmpty&&r.getChild(0).is("containerElement")||px.includes(r.name)&&px.includes(s.name)?"\n\n":r.is("containerElement")||s.is("containerElement")?gx.includes(r.name)||gx.includes(s.name)?"\n":r.is("element")&&r.getCustomProperty("dataPipeline:transparentRendering")||s.is("element")&&s.getCustomProperty("dataPipeline:transparentRendering")?"":"\n\n":"":"")+fx(e,o)),i=o;var r,s;if(t.is("rawElement")){const i=document.createElement("div");t.render(i,e),n+=bx(i)}return n}function bx(e){let t="";if(e.nodeType===Node.TEXT_NODE)return e.textContent;if("BR"===e.tagName)return"\n";for(const n of e.childNodes)t+=bx(n);return t}class wx extends cf{_markersToCopy=new Map;static get pluginName(){return"ClipboardMarkersUtils"}static get isOfficialPlugin(){return!0}_registerMarkerToCopy(e,t){this._markersToCopy.set(e,t)}_copySelectedFragmentWithMarkers(e,t,n=e=>e.model.getSelectedContent(e.model.document.selection)){return this.editor.model.change((i=>{const r=i.model.document.selection;i.setSelection(t);const s=this._insertFakeMarkersIntoSelection(i,i.model.document.selection,e),o=n(i),a=this._removeFakeMarkersInsideElement(i,o);for(const[e,t]of Object.entries(s)){a[e]||=i.createRangeIn(o);for(const e of t)i.remove(e)}o.markers.clear();for(const[e,t]of Object.entries(a))o.markers.set(e,t);return i.setSelection(r),o}))}_pasteMarkersIntoTransformedElement(e,t){const n=this._getPasteMarkersFromRangeMap(e);return this.editor.model.change((e=>{const i=this._insertFakeMarkersElements(e,n),r=t(e),s=this._removeFakeMarkersInsideElement(e,r);for(const t of Object.values(i).flat())e.remove(t);for(const[t,n]of Object.entries(s))e.model.markers.has(t)||e.addMarker(t,{usingOperation:!0,affectsData:!0,range:n});return r}))}_pasteFragmentWithMarkers(e){const t=this._getPasteMarkersFromRangeMap(e.markers);e.markers.clear();for(const n of t)e.markers.set(n.name,n.range);return this.editor.model.insertContent(e)}_forceMarkersCopy(e,t,n={allowedActions:"all",copyPartiallySelected:!0,duplicateOnPaste:!0}){const i=this._markersToCopy.get(e);this._markersToCopy.set(e,n),t(),i?this._markersToCopy.set(e,i):this._markersToCopy.delete(e)}_isMarkerCopyable(e,t){const n=this._getMarkerClipboardConfig(e);if(!n)return!1;if(!t)return!0;const{allowedActions:i}=n;return"all"===i||i.includes(t)}_hasMarkerConfiguration(e){return!!this._getMarkerClipboardConfig(e)}_getMarkerClipboardConfig(e){const[t]=e.split(":");return this._markersToCopy.get(t)||null}_insertFakeMarkersIntoSelection(e,t,n){const i=this._getCopyableMarkersFromSelection(e,t,n);return this._insertFakeMarkersElements(e,i)}_getCopyableMarkersFromSelection(e,t,n){const i=Array.from(t.getRanges()),r=new Set(i.flatMap((t=>Array.from(e.model.markers.getMarkersIntersectingRange(t)))));return Array.from(r).filter((e=>{if(!this._isMarkerCopyable(e.name,n))return!1;const{copyPartiallySelected:t}=this._getMarkerClipboardConfig(e.name);if(!t){const t=e.getRange();return i.some((e=>e.containsRange(t,!0)))}return!0})).map((e=>({name:"dragstart"===n?this._getUniqueMarkerName(e.name):e.name,range:e.getRange()})))}_getPasteMarkersFromRangeMap(e,t=null){const{model:n}=this.editor;return(e instanceof Map?Array.from(e.entries()):Object.entries(e)).flatMap((([e,i])=>{if(!this._hasMarkerConfiguration(e))return[{name:e,range:i}];if(this._isMarkerCopyable(e,t)){const t=this._getMarkerClipboardConfig(e),r=n.markers.has(e)&&"$graveyard"===n.markers.get(e).getRange().root.rootName;return(t.duplicateOnPaste||r)&&(e=this._getUniqueMarkerName(e)),[{name:e,range:i}]}return[]}))}_insertFakeMarkersElements(e,t){const n={},i=t.flatMap((e=>{const{start:t,end:n}=e.range;return[{position:t,marker:e,type:"start"},{position:n,marker:e,type:"end"}]})).sort((({position:e},{position:t})=>e.isBefore(t)?1:-1));for(const{position:t,marker:r,type:s}of i){const i=e.createElement("$marker",{"data-name":r.name,"data-type":s});n[r.name]||(n[r.name]=[]),n[r.name].push(i),e.insert(i,t)}return n}_removeFakeMarkersInsideElement(e,t){return function(e,t){var n={};return t=hx(t),sx(e,(function(e,i,r){os(n,i,t(e,i,r))})),n}(this._getAllFakeMarkersFromElement(e,t).reduce(((t,n)=>{const i=n.markerElement&&e.createPositionBefore(n.markerElement);let r=t[n.name],s=!1;return r&&r.start&&r.end&&(this._getMarkerClipboardConfig(n.name).duplicateOnPaste?t[this._getUniqueMarkerName(n.name)]=t[n.name]:s=!0,r=null),s||(t[n.name]={...r,[n.type]:i}),n.markerElement&&e.remove(n.markerElement),t}),{}),(n=>new _h(n.start||e.createPositionFromPath(t,[0]),n.end||e.createPositionAt(t,"end"))))}_getAllFakeMarkersFromElement(e,t){const n=Array.from(e.createRangeIn(t)).flatMap((({item:e})=>{if(!e.is("element","$marker"))return[];const t=e.getAttribute("data-name"),n=e.getAttribute("data-type");return[{markerElement:e,name:t,type:n}]})),i=[],r=[];for(const e of n)"end"===e.type&&(n.some((t=>t.name===e.name&&"start"===t.type))||i.push({markerElement:null,name:e.name,type:"start"})),"start"===e.type&&(n.some((t=>t.name===e.name&&"end"===t.type))||r.unshift({markerElement:null,name:e.name,type:"end"}));return[...i,...n,...r]}_getUniqueMarkerName(e){const t=e.split(":"),n=ka().substring(1,6);return 3===t.length?`${t.slice(0,2).join(":")}:${n}`:`${t.join(":")}:${n}`}}class vx extends cf{static get pluginName(){return"ClipboardPipeline"}static get isOfficialPlugin(){return!0}static get requires(){return[wx]}init(){this.editor.editing.view.addObserver(mx),this._setupPasteDrop(),this._setupCopyCut()}_fireOutputTransformationEvent(e,t,n){const i=this.editor.plugins.get("ClipboardMarkersUtils");this.editor.model.enqueueChange({isUndoable:"cut"===n},(()=>{const r=i._copySelectedFragmentWithMarkers(n,t);this.fire("outputTransformation",{dataTransfer:e,content:r,method:n})}))}_setupPasteDrop(){const e=this.editor,t=e.model,n=e.editing.view,i=n.document,r=this.editor.plugins.get("ClipboardMarkersUtils");this.listenTo(i,"clipboardInput",((t,n)=>{"paste"!=n.method||e.model.canEditAt(e.model.document.selection)||t.stop()}),{priority:"highest"}),this.listenTo(i,"clipboardInput",((e,t)=>{const i=t.dataTransfer;let r;if(t.content)r=t.content;else{let e="";i.getData("text/html")?e=function(e){return e.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,((e,t)=>1==t.length?" ":t)).replace(/<!--[\s\S]*?-->/g,"")}(i.getData("text/html")):i.getData("text/plain")&&(((s=(s=i.getData("text/plain")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br>").replace(/\t/g," ").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," ")).includes("</p><p>")||s.includes("<br>"))&&(s=`<p>${s}</p>`),e=s),r=this.editor.data.htmlProcessor.toView(e)}var s;const o=new ya(this,"inputTransformation"),a=i.getData("application/ckeditor5-editor-id")||null;this.fire(o,{content:r,dataTransfer:i,sourceEditorId:a,targetRanges:t.targetRanges,method:t.method}),o.stop.called&&e.stop(),n.scrollToTheSelection()}),{priority:"low"}),this.listenTo(this,"inputTransformation",((e,n)=>{if(n.content.isEmpty)return;const i=this.editor.data.toModel(n.content,"$clipboardHolder");0!=i.childCount&&(e.stop(),t.change((()=>{this.fire("contentInsertion",{content:i,method:n.method,sourceEditorId:n.sourceEditorId,dataTransfer:n.dataTransfer,targetRanges:n.targetRanges})})))}),{priority:"low"}),this.listenTo(this,"contentInsertion",((e,t)=>{t.resultRange=r._pasteFragmentWithMarkers(t.content)}),{priority:"low"})}_setupCopyCut(){const e=this.editor,t=e.model.document,n=e.editing.view.document,i=(e,n)=>{const i=n.dataTransfer;n.preventDefault(),this._fireOutputTransformationEvent(i,t.selection,e.name)};this.listenTo(n,"copy",i,{priority:"low"}),this.listenTo(n,"cut",((t,n)=>{e.model.canEditAt(e.model.document.selection)?i(t,n):n.preventDefault()}),{priority:"low"}),this.listenTo(this,"outputTransformation",((t,i)=>{const r=e.data.toView(i.content,{isClipboardPipeline:!0});n.fire("clipboardOutput",{dataTransfer:i.dataTransfer,content:r,method:i.method})}),{priority:"low"}),this.listenTo(n,"clipboardOutput",((n,i)=>{i.content.isEmpty||(i.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(i.content)),i.dataTransfer.setData("text/plain",fx(e.data.htmlProcessor.domConverter,i.content)),i.dataTransfer.setData("application/ckeditor5-editor-id",this.editor.id)),"cut"==i.method&&e.model.deleteContent(t.selection)}),{priority:"low"})}}const yx=El("px");class _x extends Lb{constructor(){super();const e=this.bindTemplate;this.set({isVisible:!1,left:null,top:null,width:null}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-clipboard-drop-target-line",e.if("isVisible","ck-hidden",(e=>!e))],style:{left:e.to("left",(e=>yx(e))),top:e.to("top",(e=>yx(e))),width:e.to("width",(e=>yx(e)))}}})}}class kx extends cf{removeDropMarkerDelayed=pc((()=>this.removeDropMarker()),40);_updateDropMarkerThrottled=Yp((e=>this._updateDropMarker(e)),40);_reconvertMarkerThrottled=Yp((()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")}),0);_dropTargetLineView=new _x;_domEmitter=new(dl());_scrollables=new Map;static get pluginName(){return"DragDropTarget"}static get isOfficialPlugin(){return!0}init(){this._setupDropMarker()}destroy(){this._domEmitter.stopListening();for(const{resizeObserver:e}of this._scrollables.values())e.destroy();return this._updateDropMarkerThrottled.cancel(),this.removeDropMarkerDelayed.cancel(),this._reconvertMarkerThrottled.cancel(),super.destroy()}updateDropMarker(e,t,n,i,r,s){this.removeDropMarkerDelayed.cancel();const o=xx(this.editor,e,t,n,i,r,s);if(o)return s&&s.containsRange(o)?this.removeDropMarker():void this._updateDropMarkerThrottled(o)}getFinalDropRange(e,t,n,i,r,s){const o=xx(this.editor,e,t,n,i,r,s);return this.removeDropMarker(),o}removeDropMarker(){const e=this.editor.model;this.removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),this._dropTargetLineView.isVisible=!1,e.markers.has("drop-target")&&e.change((e=>{e.removeMarker("drop-target")}))}_setupDropMarker(){const e=this.editor;e.ui.view.body.add(this._dropTargetLineView),e.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),e.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(t,{writer:n})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(n);t.markerRange.isCollapsed?this._updateDropTargetLine(t.markerRange):this._dropTargetLineView.isVisible=!1}})}_updateDropMarker(e){const t=this.editor,n=t.model.markers;t.model.change((t=>{n.has("drop-target")?n.get("drop-target").getRange().isEqual(e)||t.updateMarker("drop-target",{range:e}):t.addMarker("drop-target",{range:e,usingOperation:!1,affectsData:!1})}))}_createDropTargetPosition(e){return e.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},(function(e){const t=this.toDomElement(e);return t.append("",e.createElement("span"),""),t}))}_updateDropTargetLine(e){const t=this.editor.editing,n=e.start.nodeBefore,i=e.start.nodeAfter,r=e.start.parent,s=n?t.mapper.toViewElement(n):null,o=s?t.view.domConverter.mapViewToDom(s):null,a=i?t.mapper.toViewElement(i):null,l=a?t.view.domConverter.mapViewToDom(a):null,c=t.mapper.toViewElement(r);if(!c)return;const d=t.view.domConverter.mapViewToDom(c),u=this._getScrollableRect(c),{scrollX:h,scrollY:m}=ra.window,g=o?new vl(o):null,p=l?new vl(l):null,f=new vl(d).excludeScrollbarsAndBorders(),b=g?g.bottom:f.top,w=p?p.top:f.bottom,v=ra.window.getComputedStyle(d),y=b<=w?(b+w)/2:w;if(u.top<y&&y<u.bottom){const e=f.left+parseFloat(v.paddingLeft),t=f.right-parseFloat(v.paddingRight),n=Math.max(e+h,u.left),i=Math.min(t+h,u.right);this._dropTargetLineView.set({isVisible:!0,left:n,top:y+m,width:i-n})}else this._dropTargetLineView.isVisible=!1}_getScrollableRect(e){const t=e.root.rootName;let n;if(this._scrollables.has(t))n=this._scrollables.get(t).domElement;else{n=function(e){let t=e;do{t=t.parentElement;const e=ra.window.getComputedStyle(t).overflowY;if("auto"==e||"scroll"==e)break}while("BODY"!=t.tagName);return t}(this.editor.editing.view.domConverter.mapViewToDom(e)),this._domEmitter.listenTo(n,"scroll",this._reconvertMarkerThrottled,{usePassive:!0});const i=new Cl(n,this._reconvertMarkerThrottled);this._scrollables.set(t,{domElement:n,resizeObserver:i})}return new vl(n).excludeScrollbarsAndBorders()}}function xx(e,t,n,i,r,s,o){const a=e.model,l=e.editing.mapper;let c=Tx(e,t);for(;c;){if(!s)if(a.schema.checkChild(c,"$text")){if(n){const t=n[0].start,s=l.toModelPosition(t);if(!o||Array.from(o.getItems({shallow:!0})).every((e=>a.schema.checkChild(s,e)))){if(a.schema.checkChild(s,"$text"))return a.createRange(s);if(t)return Ax(e,Tx(e,t.parent),i,r)}}}else if(a.schema.isInline(c))return Ax(e,c,i,r);if(a.schema.isBlock(c))return Ax(e,c,i,r);if(a.schema.checkChild(c,"$block")){const t=Array.from(c.getChildren()).filter((t=>t.is("element")&&!Cx(e,t)));let n=0,s=t.length;if(0==s)return a.createRange(a.createPositionAt(c,"end"));for(;n<s-1;){const o=Math.floor((n+s)/2);"before"==Ex(e,t[o],i,r)?s=o:n=o}return Ax(e,t[n],i,r)}c=c.parent}return null}function Cx(e,t){const n=e.editing.mapper,i=e.editing.view.domConverter,r=n.toViewElement(t);if(!r)return!0;const s=i.mapViewToDom(r);return"none"!=ra.window.getComputedStyle(s).float}function Ax(e,t,n,i){const r=e.model;return r.createRange(r.createPositionAt(t,Ex(e,t,n,i)))}function Ex(e,t,n,i){const r=e.editing.mapper,s=e.editing.view.domConverter,o=r.toViewElement(t),a=s.mapViewToDom(o),l=new vl(a);return e.model.schema.isInline(t)?n<(l.left+l.right)/2?"before":"after":i<(l.top+l.bottom)/2?"before":"after"}function Tx(e,t){const n=e.editing.mapper,i=e.editing.view,r=n.toModelElement(t);if(r)return r;const s=i.createPositionBefore(t),o=n.findMappedViewAncestor(s);return n.toModelElement(o)}class Sx extends cf{_isBlockDragging=!1;_domEmitter=new(dl());static get pluginName(){return"DragDropBlockToolbar"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(this.listenTo(e,"change:isReadOnly",((e,t,n)=>{n?(this.forceDisabled("readOnlyMode"),this._isBlockDragging=!1):this.clearForceDisabled("readOnlyMode")})),aa.isAndroid&&this.forceDisabled("noAndroidSupport"),e.plugins.has("BlockToolbar")){const t=e.plugins.get("BlockToolbar").buttonView.element;this._domEmitter.listenTo(t,"dragstart",((e,t)=>this._handleBlockDragStart(t))),this._domEmitter.listenTo(ra.document,"dragover",((e,t)=>this._handleBlockDragging(t))),this._domEmitter.listenTo(ra.document,"drop",((e,t)=>this._handleBlockDragging(t))),this._domEmitter.listenTo(ra.document,"dragend",(()=>this._handleBlockDragEnd()),{useCapture:!0}),this.isEnabled&&t.setAttribute("draggable","true"),this.on("change:isEnabled",((e,n,i)=>{t.setAttribute("draggable",i?"true":"false")}))}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(e){if(!this.isEnabled)return;const t=this.editor.model,n=t.document.selection,i=this.editor.editing.view,r=Array.from(n.getSelectedBlocks()),s=t.createRange(t.createPositionBefore(r[0]),t.createPositionAfter(r[r.length-1]));t.change((e=>e.setSelection(s))),this._isBlockDragging=!0,i.focus(),i.getObserver(mx).onDomEvent(e)}_handleBlockDragging(e){if(!this.isEnabled||!this._isBlockDragging)return;const t=e.clientX+("ltr"==this.editor.locale.contentLanguageDirection?100:-100),n=e.clientY,i=document.elementFromPoint(t,n),r=this.editor.editing.view;i&&i.closest(".ck-editor__editable")&&r.getObserver(mx).onDomEvent({...e,type:e.type,dataTransfer:e.dataTransfer,target:i,clientX:t,clientY:n,preventDefault:()=>e.preventDefault(),stopPropagation:()=>e.stopPropagation()})}_handleBlockDragEnd(){this._isBlockDragging=!1}}class Px extends cf{_draggedRange;_draggingUid;_draggableElement;_clearDraggableAttributesDelayed=pc((()=>this._clearDraggableAttributes()),40);_blockMode=!1;_domEmitter=new(dl());_previewContainer;static get pluginName(){return"DragDrop"}static get isOfficialPlugin(){return!0}static get requires(){return[vx,Dk,kx,Sx]}init(){const e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,t.addObserver(mx),t.addObserver(cp),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",((e,t,n)=>{n?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})),this.on("change:isEnabled",((e,t,n)=>{n||this._finalizeDragging(!1)})),aa.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._previewContainer&&this._previewContainer.remove(),this._domEmitter.stopListening(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const e=this.editor,t=e.model,n=e.editing.view,i=n.document,r=e.plugins.get(kx);this.listenTo(i,"dragstart",((e,n)=>{if(n.target&&n.target.is("editableElement"))return void n.preventDefault();if(this._prepareDraggedRange(n.target),!this._draggedRange)return void n.preventDefault();this._draggingUid=ka(),n.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",n.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const i=t.createSelection(this._draggedRange.toRange());this.editor.plugins.get("ClipboardPipeline")._fireOutputTransformationEvent(n.dataTransfer,i,"dragstart");const{dataTransfer:r,domTarget:s,domEvent:o}=n,{clientX:a}=o;this._updatePreview({dataTransfer:r,domTarget:s,clientX:a}),n.stopPropagation(),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")}),{priority:"low"}),this.listenTo(i,"dragend",((e,t)=>{this._finalizeDragging(!t.dataTransfer.isCanceled&&"move"==t.dataTransfer.dropEffect)}),{priority:"low"}),this._domEmitter.listenTo(ra.document,"dragend",(()=>{this._blockMode=!1}),{useCapture:!0}),this.listenTo(i,"dragenter",(()=>{this.isEnabled&&n.focus()})),this.listenTo(i,"dragleave",(()=>{r.removeDropMarkerDelayed()})),this.listenTo(i,"dragging",((e,t)=>{if(!this.isEnabled)return void(t.dataTransfer.dropEffect="none");const{clientX:n,clientY:i}=t.domEvent;r.updateDropMarker(t.target,t.targetRanges,n,i,this._blockMode,this._draggedRange),this._draggedRange||(t.dataTransfer.dropEffect="copy"),aa.isGecko||("copy"==t.dataTransfer.effectAllowed?t.dataTransfer.dropEffect="copy":["all","copyMove"].includes(t.dataTransfer.effectAllowed)&&(t.dataTransfer.dropEffect="move")),e.stop()}),{priority:"low"})}_setupClipboardInputIntegration(){const e=this.editor,t=e.editing.view.document,n=e.plugins.get(kx);this.listenTo(t,"clipboardInput",((t,i)=>{if("drop"!=i.method)return;const{clientX:r,clientY:s}=i.domEvent,o=n.getFinalDropRange(i.target,i.targetRanges,r,s,this._blockMode,this._draggedRange);return o?(this._draggedRange&&this._draggingUid!=i.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=""),"move"==Ix(i.dataTransfer)&&this._draggedRange&&this._draggedRange.containsRange(o,!0)?(this._finalizeDragging(!1),void t.stop()):void(i.targetRanges=[e.editing.mapper.toViewRange(o)])):(this._finalizeDragging(!1),void t.stop())}),{priority:"high"})}_setupContentInsertionIntegration(){const e=this.editor.plugins.get(vx);e.on("contentInsertion",((e,t)=>{if(!this.isEnabled||"drop"!==t.method)return;const n=t.targetRanges.map((e=>this.editor.editing.mapper.toModelRange(e)));this.editor.model.change((e=>e.setSelection(n)))}),{priority:"high"}),e.on("contentInsertion",((e,t)=>{if(!this.isEnabled||"drop"!==t.method)return;const n="move"==Ix(t.dataTransfer),i=!t.resultRange||!t.resultRange.isCollapsed;this._finalizeDragging(i&&n)}),{priority:"lowest"})}_setupDraggableAttributeHandling(){const e=this.editor,t=e.editing.view,n=t.document;this.listenTo(n,"mousedown",((i,r)=>{if(aa.isAndroid||!r)return;this._clearDraggableAttributesDelayed.cancel();let s=Ox(r.target);if(aa.isBlink&&!e.isReadOnly&&!s&&!n.selection.isCollapsed){const e=n.selection.getSelectedElement();e&&_k(e)||(s=n.selection.editableElement)}s&&(t.change((e=>{e.setAttribute("draggable","true",s)})),this._draggableElement=e.editing.mapper.toModelElement(s))})),this.listenTo(n,"mouseup",(()=>{aa.isAndroid||this._clearDraggableAttributesDelayed()}))}_clearDraggableAttributes(){const e=this.editor.editing;e.view.change((t=>{this._draggableElement&&"$graveyard"!=this._draggableElement.root.rootName&&t.removeAttribute("draggable",e.mapper.toViewElement(this._draggableElement)),this._draggableElement=null}))}_finalizeDragging(e){const t=this.editor,n=t.model;t.plugins.get(kx).removeDropMarker(),this._clearDraggableAttributes(),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._previewContainer&&(this._previewContainer.remove(),this._previewContainer=void 0),this._draggedRange&&(e&&this.isEnabled&&n.change((e=>{const t=n.createSelection(this._draggedRange);n.deleteContent(t,{doNotAutoparagraph:!0});const i=t.getFirstPosition().parent;i.isEmpty&&!n.schema.checkChild(i,"$text")&&n.schema.checkChild(i,"paragraph")&&e.insertElement("paragraph",i,0)})),this._draggedRange.detach(),this._draggedRange=null)}_prepareDraggedRange(e){const t=this.editor,n=t.model,i=n.document.selection,r=e?Ox(e):null;if(r){const e=t.editing.mapper.toModelElement(r);return this._draggedRange=Bh.fromRange(n.createRangeOn(e)),this._blockMode=n.schema.isBlock(e),void(t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop"))}if(i.isCollapsed&&!i.getFirstPosition().parent.isEmpty)return;const s=Array.from(i.getSelectedBlocks()),o=i.getFirstRange();if(0==s.length)return void(this._draggedRange=Bh.fromRange(o));const a=Vx(n,s);if(s.length>1)this._draggedRange=Bh.fromRange(a),this._blockMode=!0;else if(1==s.length){const e=o.start.isTouching(a.start)&&o.end.isTouching(a.end);this._draggedRange=Bh.fromRange(e?a:o),this._blockMode=e}n.change((e=>e.setSelection(this._draggedRange.toRange())))}_updatePreview({dataTransfer:e,domTarget:t,clientX:n}){const i=this.editor.editing.view,r=i.document.selection.editableElement,s=i.domConverter.mapViewToDom(r),o=ra.window.getComputedStyle(s);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=il(ra.document,"div",{style:"position: fixed; left: -999999px;"}),ra.document.body.appendChild(this._previewContainer));const a=new vl(s);if(s.contains(t))return;const l=parseFloat(o.paddingLeft),c=il(ra.document,"div");c.className="ck ck-content",c.style.width=o.width,c.style.paddingLeft=`${a.left-n+l}px`,aa.isiOS&&(c.style.backgroundColor="white"),i.domConverter.setContentOf(c,e.getData("text/html")),e.setDragImage(c,0,0),this._previewContainer.appendChild(c)}}function Ix(e){return aa.isGecko?e.dropEffect:["all","copyMove"].includes(e.effectAllowed)?"move":"copy"}function Ox(e){if(e.is("editableElement"))return null;if(e.hasClass("ck-widget__selection-handle"))return e.findAncestor(_k);if(_k(e))return e;const t=e.findAncestor((e=>_k(e)||e.is("editableElement")));return _k(t)?t:null}function Vx(e,t){const n=t[0],i=t[t.length-1],r=n.getCommonAncestor(i),s=e.createPositionBefore(n),o=e.createPositionAfter(i);if(r&&r.is("element")&&!e.schema.isLimit(r)){const t=e.createRangeOn(r),n=s.isTouching(t.start),i=o.isTouching(t.end);if(n&&i)return Vx(e,[r])}return e.createRange(s,o)}class Rx extends cf{static get pluginName(){return"PastePlainText"}static get isOfficialPlugin(){return!0}static get requires(){return[vx]}init(){const e=this.editor,t=e.model,n=e.editing.view,i=t.document.selection;n.addObserver(mx),e.plugins.get(vx).on("contentInsertion",((e,n)=>{(function(e,t){let n=t.createRangeIn(e);if(1==e.childCount){const i=e.getChild(0);i.is("element")&&t.schema.isBlock(i)&&!t.schema.isObject(i)&&!t.schema.isLimit(i)&&(n=t.createRangeIn(i))}for(const e of n.getItems()){if(!t.schema.isInline(e))return!1;if(Array.from(e.getAttributeKeys()).find((e=>t.schema.getAttributeProperties(e).isFormatting)))return!1}return!0})(n.content,t)&&t.change((e=>{const r=Array.from(i.getAttributes()).filter((([e])=>t.schema.getAttributeProperties(e).isFormatting));i.isCollapsed||t.deleteContent(i,{doNotAutoparagraph:!0}),r.push(...i.getAttributes());const s=e.createRangeIn(n.content);for(const n of s.getItems())for(const i of r)t.schema.checkAttribute(n,i[0])&&e.setAttribute(i[0],i[1],n)}))}))}}class Nx extends cf{static get pluginName(){return"Clipboard"}static get isOfficialPlugin(){return!0}static get requires(){return[wx,vx,Px,Rx]}init(){const e=this.editor,t=this.editor.t;e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Copy selected content"),keystroke:"CTRL+C"},{label:t("Paste content"),keystroke:"CTRL+V"},{label:t("Paste content as plain text"),keystroke:"CTRL+SHIFT+V"}]})}}function Lx(e){const t=e.t,n=e.config.get("codeBlock.languages");for(const e of n)"Plain text"===e.label&&(e.label=t("Plain text")),void 0===e.class&&(e.class=`language-${e.language}`);return n}function Mx(e,t,n){const i={};for(const r of e)"class"===t?i[r[t].split(" ").shift()]=r[n]:i[r[t]]=r[n];return i}function Bx(e){return e.data.match(/^(\s*)/)[0]}function Fx(e){const t=e.document.selection,n=[];if(t.isCollapsed)return[t.anchor];const i=t.getFirstRange().getWalker({ignoreElementEnd:!0,direction:"backward"});for(const{item:t}of i){let i=t.is("$textProxy")?t.textNode:t;const r=i.parent;if(!r.is("element","codeBlock")||i.is("element","softBreak"))continue;for(;i.previousSibling&&!i.previousSibling.is("element","softBreak");)i=i.previousSibling;const s=i.is("$text")?i.startOffset+Bx(i).length:i.startOffset,o=e.createPositionAt(r,s);n.every((e=>!e.isEqual(o)))&&n.push(o)}return n}function Dx(e){const t=ac(e.getSelectedBlocks());return!!t&&t.is("element","codeBlock")}function zx(e,t){return!t.is("rootElement")&&!e.isLimit(t)&&e.checkChild(t.parent,"codeBlock")}function $x(e,t,n,i){const r=Mx(t,"language","label"),s=n.getAttribute("language");if(s in r){return e("enter"===i?"Entering %0 code snippet":"Leaving %0 code snippet",r[s])}return e("enter"===i?"Entering code snippet":"Leaving code snippet")}function jx(e,t){for(e.textNode&&(e=t.createPositionBefore(e.textNode));e.nodeBefore&&!e.nodeBefore.is("element","softBreak");)e=t.createPositionBefore(e.nodeBefore);const n=e.nodeAfter;return n&&n.is("$text")?n:null}class Hx extends uf{_lastLanguage;constructor(e){super(e),this._lastLanguage=null}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor,n=t.model,i=n.document.selection,r=Lx(t)[0],s=Array.from(i.getSelectedBlocks()),o=null==e.forceValue?!this.value:e.forceValue,a=function(e,t,n){return e.language?e.language:e.usePreviousLanguageChoice&&t?t:n}(e,this._lastLanguage,r.language);n.change((e=>{o?this._applyCodeBlock(e,s,a):this._removeCodeBlock(e,s)}))}_getValue(){const e=ac(this.editor.model.document.selection.getSelectedBlocks());return!(!e||!e.is("element","codeBlock"))&&e.getAttribute("language")}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,n=ac(e.getSelectedBlocks());return!!n&&zx(t,n)}_applyCodeBlock(e,t,n){this._lastLanguage=n;const i=this.editor.model.schema,r=t.filter((e=>zx(i,e)));for(const t of r)e.rename(t,"codeBlock"),e.setAttribute("language",n,t),i.removeDisallowedAttributes([t],e),Array.from(t.getChildren()).filter((e=>!i.checkChild(t,e))).forEach((t=>e.remove(t)));r.reverse().forEach(((t,n)=>{const i=r[n+1];t.previousSibling===i&&(e.appendElement("softBreak",i),e.merge(e.createPositionBefore(t)))}))}_removeCodeBlock(e,t){const n=t.filter((e=>e.is("element","codeBlock")));for(const t of n){const n=e.createRangeOn(t);for(const t of Array.from(n.getItems()).reverse())if(t.is("element","softBreak")&&t.parent.is("element","codeBlock")){const{position:n}=e.split(e.createPositionBefore(t)),i=n.nodeAfter;e.rename(i,"paragraph"),e.removeAttribute("language",i),e.remove(t)}e.rename(t,"paragraph"),e.removeAttribute("language",t)}}}class Wx extends uf{_indentSequence;constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model;e.change((t=>{const n=Fx(e);for(const i of n){const n=t.createText(this._indentSequence);e.insertContent(n,i)}}))}_checkEnabled(){return!!this._indentSequence&&Dx(this.editor.model.document.selection)}}class Ux extends uf{_indentSequence;constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model;e.change((()=>{const t=Fx(e);for(const n of t){const t=qx(e,n,this._indentSequence);t&&e.deleteContent(e.createSelection(t))}}))}_checkEnabled(){if(!this._indentSequence)return!1;const e=this.editor.model;return!!Dx(e.document.selection)&&Fx(e).some((t=>qx(e,t,this._indentSequence)))}}function qx(e,t,n){const i=jx(t,e);if(!i)return null;const r=Bx(i),s=r.lastIndexOf(n);if(s+n.length!==r.length)return null;if(-1===s)return null;const{parent:o,startOffset:a}=i;return e.createRange(e.createPositionAt(o,a+s),e.createPositionAt(o,a+s+n.length))}function Gx(e,t,n=!1){const i=Mx(t,"language","class"),r=Mx(t,"language","label");return(t,s,o)=>{const{writer:a,mapper:l,consumable:c}=o;if(!c.consume(s.item,"insert"))return;const d=s.item.getAttribute("language"),u=l.toViewPosition(e.createPositionBefore(s.item)),h={};n&&(h["data-language"]=r[d],h.spellcheck="false");const m=i[d]?{class:i[d]}:void 0,g=a.createContainerElement("code",m),p=a.createContainerElement("pre",h,g);a.insert(u,p),l.bindElements(s.item,g)}}const Kx="paragraph";class Zx extends cf{static get pluginName(){return"CodeBlockEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[ck]}constructor(e){super(e),e.config.define("codeBlock",{languages:[{language:"plaintext",label:"Plain text"},{language:"c",label:"C"},{language:"cs",label:"C#"},{language:"cpp",label:"C++"},{language:"css",label:"CSS"},{language:"diff",label:"Diff"},{language:"html",label:"HTML"},{language:"java",label:"Java"},{language:"javascript",label:"JavaScript"},{language:"php",label:"PHP"},{language:"python",label:"Python"},{language:"ruby",label:"Ruby"},{language:"typescript",label:"TypeScript"},{language:"xml",label:"XML"}],indentSequence:"\t"})}init(){const e=this.editor,t=e.model.schema,n=e.model,i=e.editing.view,r=Lx(e);e.commands.add("codeBlock",new Hx(e)),e.commands.add("indentCodeBlock",new Wx(e)),e.commands.add("outdentCodeBlock",new Ux(e)),this.listenTo(i.document,"tab",((t,n)=>{const i=n.shiftKey?"outdentCodeBlock":"indentCodeBlock";e.commands.get(i).isEnabled&&(e.execute(i),n.stopPropagation(),n.preventDefault(),t.stop())}),{context:"pre"}),t.register("codeBlock",{allowWhere:"$block",allowChildren:"$text",disallowChildren:"$inlineObject",allowAttributes:["language"],allowAttributesOf:"$listItem",isBlock:!0}),t.addAttributeCheck(((e,n)=>{const i=e.getItem(e.length-2);if(t.getAttributeProperties(n).isFormatting&&i&&"codeBlock"==i.name)return!1})),e.editing.downcastDispatcher.on("insert:codeBlock",Gx(n,r,!0)),e.data.downcastDispatcher.on("insert:codeBlock",Gx(n,r)),e.data.downcastDispatcher.on("insert:softBreak",function(e){return(t,n,i)=>{if("codeBlock"!==n.item.parent.name)return;const{writer:r,mapper:s,consumable:o}=i;if(!o.consume(n.item,"insert"))return;const a=s.toViewPosition(e.createPositionBefore(n.item));r.insert(a,r.createText("\n"))}}(n),{priority:"high"}),e.data.upcastDispatcher.on("element:code",function(e,t){const n=Mx(t,"class","language"),i=t[0].language;return(e,t,r)=>{const s=t.viewItem,o=s.parent;if(!o||!o.is("element","pre"))return;if(t.modelCursor.findAncestor("codeBlock"))return;const{consumable:a,writer:l}=r;if(!a.test(s,{name:!0}))return;const c=l.createElement("codeBlock"),d=[...s.getClassNames()];d.length||d.push("");for(const e of d){const t=n[e];if(t){l.setAttribute("language",t,c);break}}c.hasAttribute("language")||l.setAttribute("language",i,c),r.convertChildren(s,c),r.safeInsert(c,t.modelCursor)&&(a.consume(s,{name:!0}),r.updateConversionResult(c,t))}}(0,r)),e.data.upcastDispatcher.on("text",((e,t,{consumable:n,writer:i})=>{let r=t.modelCursor;if(!n.test(t.viewItem))return;if(!r.findAncestor("codeBlock"))return;n.consume(t.viewItem);const s=t.viewItem.data.split("\n").map((e=>i.createText(e))),o=s[s.length-1];for(const e of s)if(i.insert(e,r),r=r.getShiftedBy(e.offsetSize),e!==o){const e=i.createElement("softBreak");i.insert(e,r),r=i.createPositionAfter(e)}t.modelRange=i.createRange(t.modelCursor,r),t.modelCursor=r})),e.data.upcastDispatcher.on("element:pre",((e,t,{consumable:n})=>{const i=t.viewItem;if(i.findAncestor("pre"))return;const r=Array.from(i.getChildren()),s=r.find((e=>e.is("element","code")));if(s)for(const e of r)e!==s&&e.is("$text")&&n.consume(e,{name:!0})}),{priority:"high"}),this.listenTo(e.editing.view.document,"clipboardInput",((t,i)=>{let r=n.createRange(n.document.selection.anchor);if(i.targetRanges&&(r=e.editing.mapper.toModelRange(i.targetRanges[0])),!r.start.parent.is("element","codeBlock"))return;const s=i.dataTransfer.getData("text/plain"),o=new up(e.editing.view.document);i.content=function(e,t){const n=e.createDocumentFragment(),i=t.split("\n"),r=i.reduce(((t,n,r)=>(t.push(n),r<i.length-1&&t.push(e.createElement("br")),t)),[]);return e.appendChild(r,n),n}(o,s)})),e.plugins.has("ClipboardPipeline")&&e.plugins.get(vx).on("contentInsertion",((n,i)=>{const r=e.model,s=r.document.selection;s.anchor.parent.is("element","codeBlock")&&r.change((e=>{const n=e.createRangeIn(i.content);for(const i of[...n.getItems()])i.is("node")&&!t.checkChild(s.anchor,i)&&e.remove(i)}))})),this.listenTo(n,"getSelectedContent",((e,[i])=>{const r=i.anchor;!i.isCollapsed&&r.parent.is("element","codeBlock")&&r.hasSameParentAs(i.focus)&&n.change((n=>{const s=e.return;if(r.parent.is("element")&&(s.childCount>1||i.containsEntireContent(r.parent))){const t=n.createElement("codeBlock",r.parent.getAttributes());n.append(s,t);const i=n.createDocumentFragment();return n.append(t,i),void(e.return=i)}const o=s.getChild(0);t.checkAttribute(o,"code")&&n.setAttribute("code",!0,o)}))}))}afterInit(){const e=this.editor,t=e.commands,n=t.get("indent"),i=t.get("outdent");n&&n.registerChildCommand(t.get("indentCodeBlock"),{priority:"highest"}),i&&i.registerChildCommand(t.get("outdentCodeBlock")),this.listenTo(e.editing.view.document,"enter",((t,n)=>{e.model.document.selection.getLastPosition().parent.is("element","codeBlock")&&(function(e,t){const n=e.model.document,i=e.editing.view,r=n.selection.getLastPosition(),s=r.nodeAfter;return!(t||!n.selection.isCollapsed||!r.isAtStart)&&(!!Yx(s)&&(e.model.change((t=>{e.execute("enter");const i=n.selection.anchor.parent.previousSibling;t.rename(i,Kx),t.setSelection(i,"in"),e.model.schema.removeDisallowedAttributes([i],t),t.remove(s)})),i.scrollToTheSelection(),!0))}(e,n.isSoft)||function(e,t){const n=e.model,i=n.document,r=e.editing.view,s=i.selection.getLastPosition(),o=s.nodeBefore;let a;if(t||!i.selection.isCollapsed||!s.isAtEnd||!o||!o.previousSibling)return!1;if(Yx(o)&&Yx(o.previousSibling))a=n.createRange(n.createPositionBefore(o.previousSibling),n.createPositionAfter(o));else if(Qx(o)&&Yx(o.previousSibling)&&Yx(o.previousSibling.previousSibling))a=n.createRange(n.createPositionBefore(o.previousSibling.previousSibling),n.createPositionAfter(o));else{if(!(Qx(o)&&Yx(o.previousSibling)&&Qx(o.previousSibling.previousSibling)&&o.previousSibling.previousSibling&&Yx(o.previousSibling.previousSibling.previousSibling)))return!1;a=n.createRange(n.createPositionBefore(o.previousSibling.previousSibling.previousSibling),n.createPositionAfter(o))}return e.model.change((t=>{t.remove(a),e.execute("enter");const n=i.selection.anchor.parent;t.rename(n,Kx),e.model.schema.removeDisallowedAttributes([n],t)})),r.scrollToTheSelection(),!0}(e,n.isSoft)||function(e){const t=e.model,n=t.document;let i;const r=jx(n.selection.getLastPosition(),t);r&&r.is("$text")&&(i=Bx(r)),e.model.change((t=>{e.execute("shiftEnter"),i&&t.insertText(i,n.selection.anchor)}))}(e),n.preventDefault(),t.stop())}),{context:"pre"}),this._initAriaAnnouncements()}_initAriaAnnouncements(){const{model:e,ui:t,t:n}=this.editor,i=Lx(this.editor);let r=null;e.document.selection.on("change:range",(()=>{const s=e.document.selection.focus.parent;t&&r!==s&&s.is("element")&&(r&&r.is("element","codeBlock")&&t.ariaLiveAnnouncer.announce($x(n,i,r,"leave")),s.is("element","codeBlock")&&t.ariaLiveAnnouncer.announce($x(n,i,s,"enter")),r=s)}))}}function Qx(e){return e&&e.is("$text")&&!e.data.match(/\S/)}function Yx(e){return e&&e.is("element","softBreak")}class Jx extends cf{static get pluginName(){return"CodeBlockUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t,n=e.ui.componentFactory,i=Lx(e),r=this._getLanguageListItemDefinitions(i),s=e.commands.get("codeBlock");n.add("codeBlock",(n=>{const i=Yw(n,Qw),o=i.buttonView,a=t("Insert code block");return o.set({label:a,tooltip:!0,icon:Pf.codeBlock,isToggleable:!0}),o.bind("isOn").to(s,"value",(e=>!!e)),o.on("execute",(()=>{e.execute("codeBlock",{usePreviousLanguageChoice:!0}),e.editing.view.focus()})),i.on("execute",(t=>{e.execute("codeBlock",{language:t.source._codeBlockLanguage,forceValue:!0}),e.editing.view.focus()})),i.class="ck-code-block-dropdown",i.bind("isEnabled").to(s),ev(i,r,{role:"menu",ariaLabel:a}),i})),n.add("menuBar:codeBlock",(n=>{const i=new gy(n);i.buttonView.set({role:"menuitem",label:t("Code block"),icon:Pf.codeBlock}),i.bind("isEnabled").to(s);const o=new py(n);o.set({ariaLabel:t("Insert code block")});for(const t of r){const r=new Lv(n,i),a=new sw(n);a.bind(...Object.keys(t.model)).to(t.model),a.set({isToggleable:!0,role:"menuitemcheckbox"}),a.delegate("execute").to(i),a.on("execute",(()=>{e.execute("codeBlock",{language:t.model._codeBlockLanguage,forceValue:s.value!=t.model._codeBlockLanguage}),e.editing.view.focus()})),r.children.add(a),o.items.add(r)}return i.panelView.children.add(o),i}))}_getLanguageListItemDefinitions(e){const t=this.editor.commands.get("codeBlock"),n=new oc;for(const i of e){const e={type:"button",model:new iy({_codeBlockLanguage:i.language,label:i.label,role:"menuitemradio",withText:!0})};e.model.bind("isOn").to(t,"value",(t=>t===e.model._codeBlockLanguage)),n.add(e)}return n}}class Xx extends cf{static get requires(){return[Zx,Jx]}static get pluginName(){return"CodeBlock"}static get isOfficialPlugin(){return!0}}class eC extends Qv{view;_toolbarConfig;_elementReplacer;constructor(e,t){super(e),this.view=t,this._toolbarConfig=Ww(e.config.get("toolbar")),this._elementReplacer=new Xa,this.listenTo(e.editing.view,"scrollToTheSelection",this._handleScrollToTheSelectionWithStickyPanel.bind(this))}get element(){return this.view.element}init(e){const t=this.editor,n=this.view,i=t.editing.view,r=n.editable,s=i.document.getRoot();r.name=s.rootName,n.render();const o=r.element;this.setEditableElement(r.name,o),n.editable.bind("isFocused").to(this.focusTracker),i.attachDomRoot(o),e&&this._elementReplacer.replace(e,this.element),this._initPlaceholder(),this._initToolbar(),n.menuBarView&&this._initMenuBar(n.menuBarView),this._initDialogPluginIntegration(),this._initContextualBalloonIntegration(),this.fire("ready")}destroy(){super.destroy();const e=this.view,t=this.editor.editing.view;this._elementReplacer.restore(),t.getDomRoot(e.editable.name)&&t.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){const e=this.view;e.stickyPanel.bind("isActive").to(this.focusTracker,"isFocused"),e.stickyPanel.limiterElement=e.element,e.stickyPanel.bind("viewportTopOffset").to(this,"viewportOffset",(({top:e})=>e||0)),e.toolbar.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(e.toolbar)}_initPlaceholder(){const e=this.editor,t=e.editing.view,n=t.document.getRoot(),i=e.sourceElement;let r;const s=e.config.get("placeholder");s&&(r="string"==typeof s?s:s[this.view.editable.name]),!r&&i&&"textarea"===i.tagName.toLowerCase()&&(r=i.getAttribute("placeholder")),r&&(n.placeholder=r),Ad({view:t,element:n,isDirectHost:!1,keepOnFocus:!0})}_initContextualBalloonIntegration(){if(!this.editor.plugins.has("ContextualBalloon"))return;const{stickyPanel:e}=this.view,t=this.editor.plugins.get("ContextualBalloon");t.on("getPositionOptions",(t=>{const n=t.return;if(!n||!e.isSticky||!e.element)return;const i=new vl(e.element).height,r="function"==typeof n.target?n.target():n.target,s="function"==typeof n.limiter?n.limiter():n.limiter;if(r&&s&&new vl(r).height>=new vl(s).height-i)return;const o={...n.viewportOffsetConfig},a=(o.top||0)+i;t.return={...n,viewportOffsetConfig:{...o,top:a}}}),{priority:"low"});const n=()=>{t.visibleView&&t.updatePosition()};this.listenTo(e,"change:isSticky",n),this.listenTo(this.editor.ui,"change:viewportOffset",n)}_handleScrollToTheSelectionWithStickyPanel(e,t,n){const i=this.view.stickyPanel;if(i.isSticky){const e=new vl(i.element).height;t.viewportOffset.top+=e}else{const e=()=>{this.editor.editing.view.scrollToTheSelection(n)};this.listenTo(i,"change:isSticky",e),setTimeout((()=>{this.stopListening(i,"change:isSticky",e)}),20)}}_initDialogPluginIntegration(){if(!this.editor.plugins.has("Dialog"))return;const e=this.view.stickyPanel,t=this.editor.plugins.get("Dialog");t.on("show",(()=>{const n=t.view;n.on("moveTo",((t,i)=>{if(!e.isSticky||n.wasMoved||n.isModal)return;const r=new vl(e.contentPanelElement);i[1]<r.bottom+tw.defaultOffset&&(i[1]=r.bottom+tw.defaultOffset)}),{priority:"high"})}),{priority:"low"})}}class tC extends Xv{stickyPanel;toolbar;editable;constructor(e,t,n={}){super(e),this.stickyPanel=new cy(e),this.toolbar=new qw(e,{shouldGroupWhenFull:n.shouldToolbarGroupWhenFull}),n.useMenuBar&&(this.menuBarView=new vy(e)),this.editable=new ty(e,t,void 0,{label:n.label})}render(){super.render(),this.menuBarView?this.stickyPanel.content.addMany([this.menuBarView,this.toolbar]):this.stickyPanel.content.add(this.toolbar),this.top.add(this.stickyPanel),this.main.add(this.editable)}}class nC extends(Tf(Af)){static get editorName(){return"ClassicEditor"}ui;constructor(e,t={}){if(!iC(e)&&void 0!==t.initialData)throw new Aa("editor-create-initial-data",null);super(t),this.config.define("menuBar.isVisible",!1),void 0===this.config.get("initialData")&&this.config.set("initialData",function(e){return iC(e)?(t=e)instanceof HTMLTextAreaElement?t.value:t.innerHTML:e;var t}(e)),iC(e)&&(this.sourceElement=e),this.model.document.createRoot();const n=!this.config.get("toolbar.shouldNotGroupWhenFull"),i=this.config.get("menuBar"),r=new tC(this.locale,this.editing.view,{shouldToolbarGroupWhenFull:n,useMenuBar:i.isVisible,label:this.config.get("label")});this.ui=new eC(this,r),function(e){if(!Nr(e.updateSourceElement))throw new Aa("attachtoform-missing-elementapi-interface",e);const t=e.sourceElement;if(function(e){return!!e&&"textarea"===e.tagName.toLowerCase()}(t)&&t.form){let n;const i=t.form,r=()=>e.updateSourceElement();Nr(i.submit)&&(n=i.submit,i.submit=()=>{r(),n.apply(i)}),i.addEventListener("submit",r),e.on("destroy",(()=>{i.removeEventListener("submit",r),n&&(i.submit=n)}))}}(this)}destroy(){return this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),super.destroy()}static create(e,t={}){return new Promise((n=>{const i=new this(e,t);n(i.initPlugins().then((()=>i.ui.init(iC(e)?e:null))).then((()=>i.data.init(i.config.get("initialData")))).then((()=>i.fire("ready"))).then((()=>i)))}))}}function iC(e){return zo(e)}function rC(e){return Array.isArray?Array.isArray(e):"[object Array]"===dC(e)}function sC(e){return"string"==typeof e}function oC(e){return"number"==typeof e}function aC(e){return"object"==typeof e}function lC(e){return null!=e}function cC(e){return!e.trim().length}function dC(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const uC=Object.prototype.hasOwnProperty;class hC{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach((e=>{let n=mC(e);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight})),this._keys.forEach((e=>{e.weight/=t}))}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function mC(e){let t=null,n=null,i=null,r=1,s=null;if(sC(e)||rC(e))i=e,t=gC(e),n=pC(e);else{if(!uC.call(e,"name"))throw new Error("Missing name property in key");const o=e.name;if(i=o,uC.call(e,"weight")&&(r=e.weight,r<=0))throw new Error((e=>`Property 'weight' in key '${e}' must be a positive integer`)(o));t=gC(o),n=pC(o),s=e.getFn}return{path:t,id:n,weight:r,src:i,getFn:s}}function gC(e){return rC(e)?e:e.split(".")}function pC(e){return rC(e)?e.join("."):e}var fC={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,useExtendedSearch:!1,getFn:function(e,t){let n=[],i=!1;const r=(e,t,s)=>{if(lC(e))if(t[s]){const o=e[t[s]];if(!lC(o))return;if(s===t.length-1&&(sC(o)||oC(o)||function(e){return!0===e||!1===e||function(e){return aC(e)&&null!==e}(e)&&"[object Boolean]"==dC(e)}(o)))n.push(function(e){return null==e?"":function(e){if("string"==typeof e)return e;let t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(o));else if(rC(o)){i=!0;for(let e=0,n=o.length;e<n;e+=1)r(o[e],t,s+1)}else t.length&&r(o,t,s+1)}else n.push(e)};return r(e,sC(t)?t.split("."):t,0),i?n:n[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};const bC=/[^ ]+/g;class wC{constructor({getFn:e=fC.getFn,fieldNormWeight:t=fC.fieldNormWeight}={}){this.norm=function(e=1,t=3){const n=new Map,i=Math.pow(10,t);return{get(t){const r=t.match(bC).length;if(n.has(r))return n.get(r);const s=1/Math.pow(r,.5*e),o=parseFloat(Math.round(s*i)/i);return n.set(r,o),o},clear(){n.clear()}}}(t,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach(((e,t)=>{this._keysMap[e.id]=t}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,sC(this.docs[0])?this.docs.forEach(((e,t)=>{this._addString(e,t)})):this.docs.forEach(((e,t)=>{this._addObject(e,t)})),this.norm.clear())}add(e){const t=this.size();sC(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,n=this.size();t<n;t+=1)this.records[t].i-=1}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!lC(e)||cC(e))return;let n={v:e,i:t,n:this.norm.get(e)};this.records.push(n)}_addObject(e,t){let n={i:t,$:{}};this.keys.forEach(((t,i)=>{let r=t.getFn?t.getFn(e):this.getFn(e,t.path);if(lC(r))if(rC(r)){let e=[];const t=[{nestedArrIndex:-1,value:r}];for(;t.length;){const{nestedArrIndex:n,value:i}=t.pop();if(lC(i))if(sC(i)&&!cC(i)){let t={v:i,i:n,n:this.norm.get(i)};e.push(t)}else rC(i)&&i.forEach(((e,n)=>{t.push({nestedArrIndex:n,value:e})}))}n.$[i]=e}else if(sC(r)&&!cC(r)){let e={v:r,n:this.norm.get(r)};n.$[i]=e}})),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function vC(e,t,{getFn:n=fC.getFn,fieldNormWeight:i=fC.fieldNormWeight}={}){const r=new wC({getFn:n,fieldNormWeight:i});return r.setKeys(e.map(mC)),r.setSources(t),r.create(),r}function yC(e,{errors:t=0,currentLocation:n=0,expectedLocation:i=0,distance:r=fC.distance,ignoreLocation:s=fC.ignoreLocation}={}){const o=t/e.length;if(s)return o;const a=Math.abs(i-n);return r?o+a/r:a?1:o}const _C=32;function kC(e){let t={};for(let n=0,i=e.length;n<i;n+=1){const r=e.charAt(n);t[r]=(t[r]||0)|1<<i-n-1}return t}class xC{constructor(e,{location:t=fC.location,threshold:n=fC.threshold,distance:i=fC.distance,includeMatches:r=fC.includeMatches,findAllMatches:s=fC.findAllMatches,minMatchCharLength:o=fC.minMatchCharLength,isCaseSensitive:a=fC.isCaseSensitive,ignoreLocation:l=fC.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:i,includeMatches:r,findAllMatches:s,minMatchCharLength:o,isCaseSensitive:a,ignoreLocation:l},this.pattern=a?e:e.toLowerCase(),this.chunks=[],!this.pattern.length)return;const c=(e,t)=>{this.chunks.push({pattern:e,alphabet:kC(e),startIndex:t})},d=this.pattern.length;if(d>_C){let e=0;const t=d%_C,n=d-t;for(;e<n;)c(this.pattern.substr(e,_C),e),e+=_C;if(t){const e=d-_C;c(this.pattern.substr(e),e)}}else c(this.pattern,0)}searchIn(e){const{isCaseSensitive:t,includeMatches:n}=this.options;if(t||(e=e.toLowerCase()),this.pattern===e){let t={isMatch:!0,score:0};return n&&(t.indices=[[0,e.length-1]]),t}const{location:i,distance:r,threshold:s,findAllMatches:o,minMatchCharLength:a,ignoreLocation:l}=this.options;let c=[],d=0,u=!1;this.chunks.forEach((({pattern:t,alphabet:h,startIndex:m})=>{const{isMatch:g,score:p,indices:f}=function(e,t,n,{location:i=fC.location,distance:r=fC.distance,threshold:s=fC.threshold,findAllMatches:o=fC.findAllMatches,minMatchCharLength:a=fC.minMatchCharLength,includeMatches:l=fC.includeMatches,ignoreLocation:c=fC.ignoreLocation}={}){if(t.length>_C)throw new Error("Pattern length exceeds max of 32.");const d=t.length,u=e.length,h=Math.max(0,Math.min(i,u));let m=s,g=h;const p=a>1||l,f=p?Array(u):[];let b;for(;(b=e.indexOf(t,g))>-1;){let e=yC(t,{currentLocation:b,expectedLocation:h,distance:r,ignoreLocation:c});if(m=Math.min(e,m),g=b+d,p){let e=0;for(;e<d;)f[b+e]=1,e+=1}}g=-1;let w=[],v=1,y=d+u;const _=1<<d-1;for(let i=0;i<d;i+=1){let s=0,a=y;for(;s<a;)yC(t,{errors:i,currentLocation:h+a,expectedLocation:h,distance:r,ignoreLocation:c})<=m?s=a:y=a,a=Math.floor((y-s)/2+s);y=a;let l=Math.max(1,h-a+1),b=o?u:Math.min(h+a,u)+d,k=Array(b+2);k[b+1]=(1<<i)-1;for(let s=b;s>=l;s-=1){let o=s-1,a=n[e.charAt(o)];if(p&&(f[o]=+!!a),k[s]=(k[s+1]<<1|1)&a,i&&(k[s]|=(w[s+1]|w[s])<<1|1|w[s+1]),k[s]&_&&(v=yC(t,{errors:i,currentLocation:o,expectedLocation:h,distance:r,ignoreLocation:c}),v<=m)){if(m=v,g=o,g<=h)break;l=Math.max(1,2*h-g)}}if(yC(t,{errors:i+1,currentLocation:h,expectedLocation:h,distance:r,ignoreLocation:c})>m)break;w=k}const k={isMatch:g>=0,score:Math.max(.001,v)};if(p){const e=function(e=[],t=fC.minMatchCharLength){let n=[],i=-1,r=-1,s=0;for(let o=e.length;s<o;s+=1){let o=e[s];o&&-1===i?i=s:o||-1===i||(r=s-1,r-i+1>=t&&n.push([i,r]),i=-1)}return e[s-1]&&s-i>=t&&n.push([i,s-1]),n}(f,a);e.length?l&&(k.indices=e):k.isMatch=!1}return k}(e,t,h,{location:i+m,distance:r,threshold:s,findAllMatches:o,minMatchCharLength:a,includeMatches:n,ignoreLocation:l});g&&(u=!0),d+=p,g&&f&&(c=[...c,...f])}));let h={isMatch:u,score:u?d/this.chunks.length:1};return u&&n&&(h.indices=c),h}}class CC{constructor(e){this.pattern=e}static isMultiMatch(e){return AC(e,this.multiRegex)}static isSingleMatch(e){return AC(e,this.singleRegex)}search(){}}function AC(e,t){const n=e.match(t);return n?n[1]:null}class EC extends CC{constructor(e,{location:t=fC.location,threshold:n=fC.threshold,distance:i=fC.distance,includeMatches:r=fC.includeMatches,findAllMatches:s=fC.findAllMatches,minMatchCharLength:o=fC.minMatchCharLength,isCaseSensitive:a=fC.isCaseSensitive,ignoreLocation:l=fC.ignoreLocation}={}){super(e),this._bitapSearch=new xC(e,{location:t,threshold:n,distance:i,includeMatches:r,findAllMatches:s,minMatchCharLength:o,isCaseSensitive:a,ignoreLocation:l})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class TC extends CC{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t,n=0;const i=[],r=this.pattern.length;for(;(t=e.indexOf(this.pattern,n))>-1;)n=t+r,i.push([t,n-1]);const s=!!i.length;return{isMatch:s,score:s?0:1,indices:i}}}const SC=[class extends CC{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},TC,class extends CC{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},class extends CC{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends CC{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends CC{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},class extends CC{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},EC],PC=SC.length,IC=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,OC=new Set([EC.type,TC.type]);const VC=[];function RC(e,t){for(let n=0,i=VC.length;n<i;n+=1){let i=VC[n];if(i.condition(e,t))return new i(e,t)}return new xC(e,t)}const NC="$and",LC="$path",MC=e=>!(!e[NC]&&!e.$or),BC=e=>({[NC]:Object.keys(e).map((t=>({[t]:e[t]})))});function FC(e,t,{auto:n=!0}={}){const i=e=>{let r=Object.keys(e);const s=(e=>!!e[LC])(e);if(!s&&r.length>1&&!MC(e))return i(BC(e));if((e=>!rC(e)&&aC(e)&&!MC(e))(e)){const i=s?e[LC]:r[0],o=s?e.$val:e[i];if(!sC(o))throw new Error((e=>`Invalid value for key ${e}`)(i));const a={keyId:pC(i),pattern:o};return n&&(a.searcher=RC(o,t)),a}let o={children:[],operator:r[0]};return r.forEach((t=>{const n=e[t];rC(n)&&n.forEach((e=>{o.children.push(i(e))}))})),o};return MC(e)||(e=BC(e)),i(e)}function DC(e,t){const n=e.matches;t.matches=[],lC(n)&&n.forEach((e=>{if(!lC(e.indices)||!e.indices.length)return;const{indices:n,value:i}=e;let r={indices:n,value:i};e.key&&(r.key=e.key.src),e.idx>-1&&(r.refIndex=e.idx),t.matches.push(r)}))}function zC(e,t){t.score=e.score}class $C{constructor(e,t={},n){this.options={...fC,...t},this.options.useExtendedSearch,this._keyStore=new hC(this.options.keys),this.setCollection(e,n)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof wC))throw new Error("Incorrect 'index' type");this._myIndex=t||vC(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){lC(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const t=[];for(let n=0,i=this._docs.length;n<i;n+=1){const r=this._docs[n];e(r,n)&&(this.removeAt(n),n-=1,i-=1,t.push(r))}return t}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:t=-1}={}){const{includeMatches:n,includeScore:i,shouldSort:r,sortFn:s,ignoreFieldNorm:o}=this.options;let a=sC(e)?sC(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return function(e,{ignoreFieldNorm:t=fC.ignoreFieldNorm}){e.forEach((e=>{let n=1;e.matches.forEach((({key:e,norm:i,score:r})=>{const s=e?e.weight:null;n*=Math.pow(0===r&&s?Number.EPSILON:r,(s||1)*(t?1:i))})),e.score=n}))}(a,{ignoreFieldNorm:o}),r&&a.sort(s),oC(t)&&t>-1&&(a=a.slice(0,t)),function(e,t,{includeMatches:n=fC.includeMatches,includeScore:i=fC.includeScore}={}){const r=[];return n&&r.push(DC),i&&r.push(zC),e.map((e=>{const{idx:n}=e,i={item:t[n],refIndex:n};return r.length&&r.forEach((t=>{t(e,i)})),i}))}(a,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(e){const t=RC(e,this.options),{records:n}=this._myIndex,i=[];return n.forEach((({v:e,i:n,n:r})=>{if(!lC(e))return;const{isMatch:s,score:o,indices:a}=t.searchIn(e);s&&i.push({item:e,idx:n,matches:[{score:o,value:e,norm:r,indices:a}]})})),i}_searchLogical(e){const t=FC(e,this.options),n=(e,t,i)=>{if(!e.children){const{keyId:n,searcher:r}=e,s=this._findMatches({key:this._keyStore.get(n),value:this._myIndex.getValueForItemAtKeyId(t,n),searcher:r});return s&&s.length?[{idx:i,item:t,matches:s}]:[]}const r=[];for(let s=0,o=e.children.length;s<o;s+=1){const o=e.children[s],a=n(o,t,i);if(a.length)r.push(...a);else if(e.operator===NC)return[]}return r},i=this._myIndex.records,r={},s=[];return i.forEach((({$:e,i})=>{if(lC(e)){let o=n(t,e,i);o.length&&(r[i]||(r[i]={idx:i,item:e,matches:[]},s.push(r[i])),o.forEach((({matches:e})=>{r[i].matches.push(...e)})))}})),s}_searchObjectList(e){const t=RC(e,this.options),{keys:n,records:i}=this._myIndex,r=[];return i.forEach((({$:e,i})=>{if(!lC(e))return;let s=[];n.forEach(((n,i)=>{s.push(...this._findMatches({key:n,value:e[i],searcher:t}))})),s.length&&r.push({idx:i,item:e,matches:s})})),r}_findMatches({key:e,value:t,searcher:n}){if(!lC(t))return[];let i=[];if(rC(t))t.forEach((({v:t,i:r,n:s})=>{if(!lC(t))return;const{isMatch:o,score:a,indices:l}=n.searchIn(t);o&&i.push({score:a,key:e,value:t,idx:r,norm:s,indices:l})}));else{const{v:r,n:s}=t,{isMatch:o,score:a,indices:l}=n.searchIn(r);o&&i.push({score:a,key:e,value:r,norm:s,indices:l})}return i}}$C.version="7.0.0",$C.createIndex=vC,$C.parseIndex=function(e,{getFn:t=fC.getFn,fieldNormWeight:n=fC.fieldNormWeight}={}){const{keys:i,records:r}=e,s=new wC({getFn:t,fieldNormWeight:n});return s.setKeys(i),s.setIndexRecords(r),s},$C.config=fC,$C.parseQuery=FC,function(...e){VC.push(...e)}(class{constructor(e,{isCaseSensitive:t=fC.isCaseSensitive,includeMatches:n=fC.includeMatches,minMatchCharLength:i=fC.minMatchCharLength,ignoreLocation:r=fC.ignoreLocation,findAllMatches:s=fC.findAllMatches,location:o=fC.location,threshold:a=fC.threshold,distance:l=fC.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:n,minMatchCharLength:i,findAllMatches:s,ignoreLocation:r,location:o,threshold:a,distance:l},this.pattern=t?e:e.toLowerCase(),this.query=function(e,t={}){return e.split("|").map((e=>{let n=e.trim().split(IC).filter((e=>e&&!!e.trim())),i=[];for(let e=0,r=n.length;e<r;e+=1){const r=n[e];let s=!1,o=-1;for(;!s&&++o<PC;){const e=SC[o];let n=e.isMultiMatch(r);n&&(i.push(new e(n,t)),s=!0)}if(!s)for(o=-1;++o<PC;){const e=SC[o];let n=e.isSingleMatch(r);if(n){i.push(new e(n,t));break}}}return i}))}(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){const t=this.query;if(!t)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:i}=this.options;e=i?e:e.toLowerCase();let r=0,s=[],o=0;for(let i=0,a=t.length;i<a;i+=1){const a=t[i];s.length=0,r=0;for(let t=0,i=a.length;t<i;t+=1){const i=a[t],{isMatch:l,indices:c,score:d}=i.search(e);if(!l){o=0,r=0,s.length=0;break}if(r+=1,o+=d,n){const e=i.constructor.type;OC.has(e)?s=[...s,...c]:s.push(c)}}if(r){let e={isMatch:!0,score:o/r};return n&&(e.indices=s),e}}return{isMatch:!1,score:1}}});const jC=(HC=sx,function(e,t){if(null==e)return e;if(!Ms(e))return HC(e,t);for(var n=e.length,i=-1,r=Object(e);++i<n&&!1!==t(r[i],i,r););return e});var HC;var WC=Object.prototype.hasOwnProperty;class UC extends uf{constructor(e){super(e),this.affectsData=!1}execute(){const e=this.editor.model,t=e.document.selection;let n=e.schema.getLimitElement(t);if(t.containsEntireContent(n)||!qC(e.schema,n))do{if(n=n.parent,!n)return}while(!qC(e.schema,n));e.change((e=>{e.setSelection(n,"in")}))}}function qC(e,t){return e.isLimit(t)&&(e.checkChild(t,"$text")||e.checkChild(t,"paragraph"))}const GC=Jl("Ctrl+A");class KC extends cf{static get pluginName(){return"SelectAllEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t,n=e.editing.view.document;e.commands.add("selectAll",new UC(e)),this.listenTo(n,"keydown",((t,n)=>{Yl(n)===GC&&(e.execute("selectAll"),n.preventDefault())})),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Select all"),keystroke:"CTRL+A"}]})}}class ZC extends cf{static get pluginName(){return"SelectAllUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",(()=>{const e=this._createButton(jb);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add("menuBar:selectAll",(()=>this._createButton(sw)))}_createButton(e){const t=this.editor,n=t.locale,i=t.commands.get("selectAll"),r=new e(t.locale),s=n.t;return r.set({label:s("Select all"),icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M.75 15.5a.75.75 0 0 1 .75.75V18l.008.09A.5.5 0 0 0 2 18.5h1.75a.75.75 0 1 1 0 1.5H1.5l-.144-.007a1.5 1.5 0 0 1-1.35-1.349L0 18.5v-2.25a.75.75 0 0 1 .75-.75zm18.5 0a.75.75 0 0 1 .75.75v2.25l-.007.144a1.5 1.5 0 0 1-1.349 1.35L18.5 20h-2.25a.75.75 0 1 1 0-1.5H18a.5.5 0 0 0 .492-.41L18.5 18v-1.75a.75.75 0 0 1 .75-.75zm-10.45 3c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2h1.6zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2h1.6zm.45-5.5a.75.75 0 1 1 0 1.5h-8.5a.75.75 0 1 1 0-1.5h8.5zM1.3 11c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2h1.1zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2h1.1zm-4.55-2a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5h10.5zM1.3 7c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2h1.1zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2h1.1zm-4.55-2a.75.75 0 1 1 0 1.5h-2.5a.75.75 0 1 1 0-1.5h2.5zm-5 0a.75.75 0 1 1 0 1.5h-5.5a.75.75 0 0 1 0-1.5h5.5zm-6.5-5a.75.75 0 0 1 0 1.5H2a.5.5 0 0 0-.492.41L1.5 2v1.75a.75.75 0 0 1-1.5 0V1.5l.007-.144A1.5 1.5 0 0 1 1.356.006L1.5 0h2.25zM18.5 0l.144.007a1.5 1.5 0 0 1 1.35 1.349L20 1.5v2.25a.75.75 0 1 1-1.5 0V2l-.008-.09A.5.5 0 0 0 18 1.5h-1.75a.75.75 0 1 1 0-1.5h2.25zM8.8 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2h1.6zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2h1.6z"/></svg>',keystroke:"Ctrl+A"}),r.bind("isEnabled").to(i,"isEnabled"),this.listenTo(r,"execute",(()=>{t.execute("selectAll"),t.editing.view.focus()})),r}}class QC extends cf{static get requires(){return[KC,ZC]}static get pluginName(){return"SelectAll"}static get isOfficialPlugin(){return!0}}class YC extends uf{_stack=[];_createdBatches=new WeakSet;constructor(e){super(e),this.refresh(),this._isEnabledBasedOnSelection=!1,this.listenTo(e.data,"set",((e,t)=>{t[1]={...t[1]};const n=t[1];n.batchType||(n.batchType={isUndoable:!1})}),{priority:"high"}),this.listenTo(e.data,"set",((e,t)=>{t[1].batchType.isUndoable||this.clearStack()}))}refresh(){this.isEnabled=this._stack.length>0}get createdBatches(){return this._createdBatches}addBatch(e){const t=this.editor.model.document.selection,n={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:n}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,t,n){const i=this.editor.model,r=i.document,s=[],o=e.map((e=>e.getTransformedByOperations(n))),a=o.flat();for(const e of o){const t=e.filter((e=>e.root!=r.graveyard)).filter((e=>!XC(e,a)));t.length&&(JC(t),s.push(t[0]))}s.length&&i.change((e=>{e.setSelection(s,{backward:t})}))}_undo(e,t){const n=this.editor.model,i=n.document;this._createdBatches.add(t);const r=e.operations.slice().filter((e=>e.isDocumentOperation));r.reverse();for(const e of r){const r=e.baseVersion+1,s=Array.from(i.history.getOperations(r)),o=fg([e.getReversed()],s,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(let r of o){const s=r.affectedSelectable;s&&!n.canEditAt(s)&&(r=new og(r.baseVersion)),t.addOperation(r),n.applyOperation(r),i.history.setOperationAsUndone(e,r)}}}}function JC(e){e.sort(((e,t)=>e.start.isBefore(t.start)?-1:1));for(let t=1;t<e.length;t++){const n=e[t-1].getJoined(e[t],!0);n&&(t--,e.splice(t,2,n))}}function XC(e,t){return t.some((t=>t!==e&&t.containsRange(e,!0)))}class eA extends YC{execute(e=null){const t=e?this._stack.findIndex((t=>t.batch==e)):this._stack.length-1,n=this._stack.splice(t,1)[0],i=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(i,(()=>{this._undo(n.batch,i);const e=this.editor.model.document.history.getOperations(n.batch.baseVersion);this._restoreSelection(n.selection.ranges,n.selection.isBackward,e)})),this.fire("revert",n.batch,i),this.refresh()}}class tA extends YC{execute(){const e=this._stack.pop(),t=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(t,(()=>{const n=e.batch.operations[e.batch.operations.length-1].baseVersion+1,i=this.editor.model.document.history.getOperations(n);this._restoreSelection(e.selection.ranges,e.selection.isBackward,i),this._undo(e.batch,t)})),this.refresh()}}class nA extends cf{_undoCommand;_redoCommand;_batchRegistry=new WeakSet;static get pluginName(){return"UndoEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t;this._undoCommand=new eA(e),this._redoCommand=new tA(e),e.commands.add("undo",this._undoCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",((e,t)=>{const n=t[0];if(!n.isDocumentOperation)return;const i=n.batch,r=this._redoCommand.createdBatches.has(i),s=this._undoCommand.createdBatches.has(i);this._batchRegistry.has(i)||(this._batchRegistry.add(i),i.isUndoable&&(r?this._undoCommand.addBatch(i):s||(this._undoCommand.addBatch(i),this._redoCommand.clearStack())))}),{priority:"highest"}),this.listenTo(this._undoCommand,"revert",((e,t,n)=>{this._redoCommand.addBatch(n)})),e.keystrokes.set("CTRL+Z","undo"),e.keystrokes.set("CTRL+Y","redo"),e.keystrokes.set("CTRL+SHIFT+Z","redo"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Undo"),keystroke:"CTRL+Z"},{label:t("Redo"),keystroke:[["CTRL+Y"],["CTRL+SHIFT+Z"]]}]})}}class iA extends cf{static get pluginName(){return"UndoUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.locale,n=e.t,i="ltr"==t.uiLanguageDirection?Pf.undo:Pf.redo,r="ltr"==t.uiLanguageDirection?Pf.redo:Pf.undo;this._addButtonsToFactory("undo",n("Undo"),"CTRL+Z",i),this._addButtonsToFactory("redo",n("Redo"),"CTRL+Y",r)}_addButtonsToFactory(e,t,n,i){const r=this.editor;r.ui.componentFactory.add(e,(()=>{const r=this._createButton(jb,e,t,n,i);return r.set({tooltip:!0}),r})),r.ui.componentFactory.add("menuBar:"+e,(()=>this._createButton(sw,e,t,n,i)))}_createButton(e,t,n,i,r){const s=this.editor,o=s.locale,a=s.commands.get(t),l=new e(o);return l.set({label:n,icon:r,keystroke:i}),l.bind("isEnabled").to(a,"isEnabled"),this.listenTo(l,"execute",(()=>{s.execute(t),s.editing.view.focus()})),l}}class rA extends cf{static get requires(){return[nA,iA]}static get pluginName(){return"Undo"}static get isOfficialPlugin(){return!0}}class sA extends cf{static get requires(){return[dw,Nx,sk,QC,ck,Gy,rA]}static get pluginName(){return"Essentials"}static get isOfficialPlugin(){return!0}}class oA extends Lb{children;_findInputView;_replaceInputView;_findButtonView;_findPrevButtonView;_findNextButtonView;_advancedOptionsCollapsibleView;_matchCaseSwitchView;_wholeWordsOnlySwitchView;_replaceButtonView;_replaceAllButtonView;_inputsDivView;_actionButtonsDivView;_focusTracker;_keystrokes;_focusables;focusCycler;constructor(e){super(e);const t=e.t;this.children=this.createCollection(),this.set("matchCount",0),this.set("highlightOffset",0),this.set("isDirty",!1),this.set("_areCommandsEnabled",{}),this.set("_resultsCounterText",""),this.set("_matchCase",!1),this.set("_wholeWordsOnly",!1),this.bind("_searchResultsFound").to(this,"matchCount",this,"isDirty",((e,t)=>e>0&&!t)),this._findInputView=this._createInputField(t("Find in text…")),this._findPrevButtonView=this._createButton({label:t("Previous result"),class:"ck-button-prev",icon:Pf.previousArrow,keystroke:"Shift+F3",tooltip:!0}),this._findNextButtonView=this._createButton({label:t("Next result"),class:"ck-button-next",icon:Pf.previousArrow,keystroke:"F3",tooltip:!0}),this._replaceInputView=this._createInputField(t("Replace with…"),"ck-labeled-field-replace"),this._inputsDivView=this._createInputsDiv(),this._matchCaseSwitchView=this._createMatchCaseSwitch(),this._wholeWordsOnlySwitchView=this._createWholeWordsOnlySwitch(),this._advancedOptionsCollapsibleView=this._createAdvancedOptionsCollapsible(),this._replaceAllButtonView=this._createButton({label:t("Replace all"),class:"ck-button-replaceall",withText:!0}),this._replaceButtonView=this._createButton({label:t("Replace"),class:"ck-button-replace",withText:!0}),this._findButtonView=this._createButton({label:t("Find"),class:"ck-button-find ck-button-action",withText:!0}),this._actionButtonsDivView=this._createActionButtonsDiv(),this._focusTracker=new lc,this._keystrokes=new hc,this._focusables=new mb,this.focusCycler=new Ub({focusables:this._focusables,focusTracker:this._focusTracker,keystrokeHandler:this._keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.addMany([this._inputsDivView,this._advancedOptionsCollapsibleView,this._actionButtonsDivView]),this.setTemplate({tag:"form",attributes:{class:["ck","ck-find-and-replace-form"],tabindex:"-1"},children:this.children})}render(){super.render(),Fb({view:this}),this._initFocusCycling(),this._initKeystrokeHandling()}destroy(){super.destroy(),this._focusTracker.destroy(),this._keystrokes.destroy()}focus(e){-1===e?this.focusCycler.focusLast():this.focusCycler.focusFirst()}reset(){this._findInputView.errorText=null,this.isDirty=!0}get _textToFind(){return this._findInputView.fieldView.element.value}get _textToReplace(){return this._replaceInputView.fieldView.element.value}_createInputsDiv(){const e=this.locale,t=e.t,n=new Lb(e);return this._findInputView.fieldView.on("input",(()=>{this.isDirty=!0})),this._findPrevButtonView.delegate("execute").to(this,"findPrevious"),this._findNextButtonView.delegate("execute").to(this,"findNext"),this._findPrevButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",(({findPrevious:e})=>e)),this._findNextButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",(({findNext:e})=>e)),this._injectFindResultsCounter(),this._replaceInputView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",(({replace:e},t)=>e&&t)),this._replaceInputView.bind("infoText").to(this._replaceInputView,"isEnabled",this._replaceInputView,"isFocused",((e,n)=>e||!n?"":t("Tip: Find some text first in order to replace it."))),n.setTemplate({tag:"div",attributes:{class:["ck","ck-find-and-replace-form__inputs"]},children:[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView]}),n}_onFindButtonExecute(){if(this._textToFind)this.isDirty=!1,this.fire("findNext",{searchText:this._textToFind,matchCase:this._matchCase,wholeWords:this._wholeWordsOnly});else{const e=this.t;this._findInputView.errorText=e("Text to find must not be empty.")}}_injectFindResultsCounter(){const e=this.locale,t=e.t,n=this.bindTemplate,i=new Lb(this.locale);this.bind("_resultsCounterText").to(this,"highlightOffset",this,"matchCount",((e,n)=>t("%0 of %1",[e,n]))),i.setTemplate({tag:"span",attributes:{class:["ck","ck-results-counter",n.if("isDirty","ck-hidden")]},children:[{text:n.to("_resultsCounterText")}]});const r=()=>{const t=this._findInputView.fieldView.element;if(!t||!Ol(t))return;const n=new vl(i.element).width,r="ltr"===e.uiLanguageDirection?"paddingRight":"paddingLeft";t.style[r]=n?`calc( 2 * var(--ck-spacing-standard) + ${n}px )`:""};this.on("change:_resultsCounterText",r,{priority:"low"}),this.on("change:isDirty",r,{priority:"low"}),this._findInputView.template.children[0].children.push(i)}_createAdvancedOptionsCollapsible(){const e=this.locale.t,t=new ww(this.locale,[this._matchCaseSwitchView,this._wholeWordsOnlySwitchView]);return t.set({label:e("Advanced options"),isCollapsed:!0}),t}_createActionButtonsDiv(){const e=new Lb(this.locale);return this._replaceButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",(({replace:e},t)=>e&&t)),this._replaceAllButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",(({replaceAll:e},t)=>e&&t)),this._replaceButtonView.on("execute",(()=>{this.fire("replace",{searchText:this._textToFind,replaceText:this._textToReplace})})),this._replaceAllButtonView.on("execute",(()=>{this.fire("replaceAll",{searchText:this._textToFind,replaceText:this._textToReplace}),this.focus()})),this._findButtonView.on("execute",this._onFindButtonExecute.bind(this)),e.setTemplate({tag:"div",attributes:{class:["ck","ck-find-and-replace-form__actions"]},children:[this._replaceAllButtonView,this._replaceButtonView,this._findButtonView]}),e}_createMatchCaseSwitch(){const e=this.locale.t,t=new hw(this.locale);return t.set({label:e("Match case"),withText:!0}),t.bind("isOn").to(this,"_matchCase"),t.on("execute",(()=>{this._matchCase=!this._matchCase,this.isDirty=!0})),t}_createWholeWordsOnlySwitch(){const e=this.locale.t,t=new hw(this.locale);return t.set({label:e("Whole words only"),withText:!0}),t.bind("isOn").to(this,"_wholeWordsOnly"),t.on("execute",(()=>{this._wholeWordsOnly=!this._wholeWordsOnly,this.isDirty=!0})),t}_initFocusCycling(){[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView,this._advancedOptionsCollapsibleView.buttonView,this._matchCaseSwitchView,this._wholeWordsOnlySwitchView,this._replaceAllButtonView,this._replaceButtonView,this._findButtonView].forEach((e=>{this._focusables.add(e),this._focusTracker.add(e.element)}))}_initKeystrokeHandling(){const e=e=>e.stopPropagation(),t=e=>{e.stopPropagation(),e.preventDefault()};this._keystrokes.listenTo(this.element),this._keystrokes.set("f3",(e=>{t(e),this._findNextButtonView.fire("execute")})),this._keystrokes.set("shift+f3",(e=>{t(e),this._findPrevButtonView.fire("execute")})),this._keystrokes.set("enter",(e=>{const n=e.target;n===this._findInputView.fieldView.element?(this._areCommandsEnabled.findNext?this._findNextButtonView.fire("execute"):this._findButtonView.fire("execute"),t(e)):n!==this._replaceInputView.fieldView.element||this.isDirty||(this._replaceButtonView.fire("execute"),t(e))})),this._keystrokes.set("shift+enter",(e=>{e.target===this._findInputView.fieldView.element&&(this._areCommandsEnabled.findPrevious?this._findPrevButtonView.fire("execute"):this._findButtonView.fire("execute"),t(e))})),this._keystrokes.set("arrowright",e),this._keystrokes.set("arrowleft",e),this._keystrokes.set("arrowup",e),this._keystrokes.set("arrowdown",e)}_createButton(e){const t=new jb(this.locale);return t.set(e),t}_createInputField(e,t){const n=new Ew(this.locale,sv);return n.label=e,n.class=t,n}}var aA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.87 13.786 1.532-1.286 3.857 4.596a1 1 0 1 1-1.532 1.286l-3.857-4.596z"/><path d="M16.004 8.5a6.5 6.5 0 0 1-9.216 5.905c-1.154-.53-.863-1.415-.663-1.615.194-.194.564-.592 1.635-.141a4.5 4.5 0 0 0 5.89-5.904l-.104-.227 1.332-1.331c.045-.046.196-.041.224.007a6.47 6.47 0 0 1 .902 3.306zm-3.4-5.715c.562.305.742 1.106.354 1.494-.388.388-.995.414-1.476.178a4.5 4.5 0 0 0-6.086 5.882l.114.236-1.348 1.349c-.038.037-.17.022-.198-.023a6.5 6.5 0 0 1 5.54-9.9 6.469 6.469 0 0 1 3.1.784z"/><path d="M4.001 11.93.948 8.877a.2.2 0 0 1 .141-.341h6.106a.2.2 0 0 1 .141.341L4.283 11.93a.2.2 0 0 1-.282 0zm11.083-6.789 3.053 3.053a.2.2 0 0 1-.14.342H11.89a.2.2 0 0 1-.14-.342l3.052-3.053a.2.2 0 0 1 .282 0z"/></svg>';class lA extends cf{static get requires(){return[nw]}static get pluginName(){return"FindAndReplaceUI"}static get isOfficialPlugin(){return!0}formView;constructor(e){super(e),e.config.define("findAndReplace.uiType","dialog"),this.formView=null}init(){const e=this.editor,t="dropdown"===e.config.get("findAndReplace.uiType"),n=e.commands.get("find"),i=this.editor.t;e.ui.componentFactory.add("findAndReplace",(()=>{let i;return t?(i=this._createDropdown(),i.bind("isEnabled").to(n)):i=this._createDialogButtonForToolbar(),e.keystrokes.set("Ctrl+F",((t,r)=>{if(n.isEnabled){if(i instanceof Vw){const e=i.buttonView;e.isOn||e.fire("execute")}else i.isOn?e.plugins.get("Dialog").view.focus():i.fire("execute");r()}})),i})),t||e.ui.componentFactory.add("menuBar:findAndReplace",(()=>this._createDialogButtonForMenuBar())),e.accessibility.addKeystrokeInfos({keystrokes:[{label:i("Find in the document"),keystroke:"CTRL+F"}]})}_createDropdown(){const e=this.editor,t=e.locale.t,n=Yw(e.locale);return n.once("change:isOpen",(()=>{this.formView=this._createFormView(),this.formView.children.add(new Wb(e.locale,{label:t("Find and replace")}),0),n.panelView.children.add(this.formView)})),n.on("change:isOpen",((e,t,n)=>{n?this._setupFormView():this.fire("searchReseted")}),{priority:"low"}),n.buttonView.set({icon:aA,label:t("Find and replace"),keystroke:"CTRL+F",tooltip:!0}),n}_createDialogButtonForToolbar(){const e=this.editor,t=this._createButton(jb),n=e.plugins.get("Dialog");return t.set({tooltip:!0}),t.bind("isOn").to(n,"id",(e=>"findAndReplace"===e)),t.on("execute",(()=>{t.isOn?n.hide():this._showDialog()})),t}_createDialogButtonForMenuBar(){const e=this._createButton(sw),t=this.editor.plugins.get("Dialog"),n=this.editor.plugins.get("Dialog");return e.set({role:"menuitemcheckbox",isToggleable:!0}),e.bind("isOn").to(n,"id",(e=>"findAndReplace"===e)),e.on("execute",(()=>{"findAndReplace"!==t.id?this._showDialog():t.hide()})),e}_createButton(e){const t=this.editor,n=t.commands.get("find"),i=new e(t.locale),r=t.locale.t;return i.bind("isEnabled").to(n),i.set({icon:aA,label:r("Find and replace"),keystroke:"CTRL+F"}),i}_showDialog(){const e=this.editor,t=e.plugins.get("Dialog"),n=e.locale.t;this.formView||(this.formView=this._createFormView()),t.show({id:"findAndReplace",title:n("Find and replace"),content:this.formView,position:Xb,onShow:()=>{this._setupFormView()},onHide:()=>{this.fire("searchReseted")}})}_createFormView(){const e=this.editor,t=new(Bb(oA))(e.locale),n=e.commands,i=this.editor.plugins.get("FindAndReplaceEditing").state;t.bind("highlightOffset").to(i,"highlightedOffset"),t.listenTo(i.results,"change",(()=>{t.matchCount=i.results.length}));const r=n.get("findNext"),s=n.get("findPrevious"),o=n.get("replace"),a=n.get("replaceAll");return t.bind("_areCommandsEnabled").to(r,"isEnabled",s,"isEnabled",o,"isEnabled",a,"isEnabled",((e,t,n,i)=>({findNext:e,findPrevious:t,replace:n,replaceAll:i}))),t.delegate("findNext","findPrevious","replace","replaceAll").to(this),t.on("change:isDirty",((e,t,n)=>{n&&this.fire("searchReseted")})),t}_setupFormView(){this.formView.disableCssTransitions(),this.formView.reset(),this.formView._findInputView.fieldView.select(),this.formView.enableCssTransitions()}}class cA extends uf{_state;constructor(e,t){super(e),this.isEnabled=!0,this.affectsData=!1,this._state=t}execute(e,{matchCase:t,wholeWords:n}={}){const{editor:i}=this,{model:r}=i,s=i.plugins.get("FindAndReplaceUtils");let o,a="";o="string"==typeof e?(...i)=>({results:s.findByTextCallback(e,{matchCase:t,wholeWords:n})(...i),searchText:e}):e;const l=o;o=(...e)=>{const t=l(...e);return t&&"searchText"in t&&(a=t.searchText),t};const c=r.document.getRootNames().reduce(((e,t)=>s.updateFindResultFromRange(r.createRangeIn(r.document.getRoot(t)),r,o,e)),null);return this._state.clear(r),this._state.results.addMany(c),this._state.highlightedResult=c.get(0),this._state.searchText=a,o&&(this._state.lastSearchCallback=o),this._state.matchCase=!!t,this._state.matchWholeWords=!!n,{results:c,findCallback:o}}}class dA extends(Ga()){constructor(e){super(),this.set("results",new oc),this.set("highlightedResult",null),this.set("highlightedOffset",0),this.set("searchText",""),this.set("replaceText",""),this.set("lastSearchCallback",null),this.set("matchCase",!1),this.set("matchWholeWords",!1),this.results.on("change",((t,{removed:n,index:i})=>{if(Array.from(n).length){let t=!1;if(e.change((i=>{for(const r of n)this.highlightedResult===r&&(t=!0),e.markers.has(r.marker.name)&&i.removeMarker(r.marker)})),t){const e=i>=this.results.length?0:i;this.highlightedResult=this.results.get(e)}}})),this.on("change:highlightedResult",(()=>{this.refreshHighlightOffset(e)}))}clear(e){this.searchText="",e.change((t=>{if(this.highlightedResult){const n=this.highlightedResult.marker.name.split(":")[1],i=e.markers.get(`findResultHighlighted:${n}`);i&&t.removeMarker(i)}[...this.results].forEach((({marker:e})=>{t.removeMarker(e)}))})),this.results.clear()}refreshHighlightOffset(e){const{highlightedResult:t,results:n}=this;this.highlightedOffset=t?uA(e,[...n]).indexOf(t)+1:0}}function uA(e,t){const n={before:-1,same:0,after:1,different:1};return e.document.getRootNames().flatMap((e=>t.filter((t=>t.marker.getStart().root.rootName===e)).sort(((e,t)=>n[e.marker.getStart().compareWith(t.marker.getStart())]))))}class hA extends uf{_state;constructor(e,t){super(e),this.isEnabled=!0,this._state=t,this._isEnabledBasedOnSelection=!1}_replace(e,t){const{model:n}=this.editor,i=t.marker.getRange();n.canEditAt(i)&&n.change((r=>{if("$graveyard"===i.root.rootName)return void this._state.results.remove(t);let s={};for(const e of i.getItems())if(e.is("$text")||e.is("$textProxy")){s=e.getAttributes();break}n.insertContent(r.createText(e,s),i),this._state.results.has(t)&&this._state.results.remove(t)}))}}class mA extends hA{execute(e,t){const n=Math.max(this._state.highlightedOffset-1,0);if(this._replace(e,t),this._state.results.length){const e=uA(this.editor.model,[...this._state.results]);this._state.highlightedResult=e[n%e.length]}}}class gA extends hA{execute(e,t){const{editor:n}=this,{model:i}=n,r=n.plugins.get("FindAndReplaceUtils"),s=t instanceof oc?t:i.document.getRootNames().reduce(((e,n)=>r.updateFindResultFromRange(i.createRangeIn(i.document.getRoot(n)),i,r.findByTextCallback(t,this._state),e)),null);s.length&&i.change((()=>{[...s].forEach((t=>{this._replace(e,t)}))}))}}class pA extends uf{_state;constructor(e,t){super(e),this.affectsData=!1,this._state=t,this.isEnabled=!1,this.listenTo(this._state.results,"change",(()=>{this.isEnabled=this._state.results.length>1}))}refresh(){this.isEnabled=this._state.results.length>1}execute(){const e=this._state.results,t=e.getIndex(this._state.highlightedResult),n=t+1>=e.length?0:t+1;this._state.highlightedResult=this._state.results.get(n)}}class fA extends pA{execute(){const e=this._state.results.getIndex(this._state.highlightedResult),t=e-1<0?this._state.results.length-1:e-1;this._state.highlightedResult=this._state.results.get(t)}}class bA extends cf{static get pluginName(){return"FindAndReplaceUtils"}static get isOfficialPlugin(){return!0}updateFindResultFromRange(e,t,n,i){const r=i||new oc;return t.change((i=>{[...e].forEach((({type:e,item:s})=>{if("elementStart"===e&&t.schema.checkChild(s,"$text")){let e=n({item:s,text:this.rangeToText(t.createRangeIn(s))});if(!e)return;"results"in e&&(e=e.results),e.forEach((e=>{const t=`findResult:${ka()}`,n=i.addMarker(t,{usingOperation:!1,affectsData:!1,range:i.createRange(i.createPositionAt(s,e.start),i.createPositionAt(s,e.end))}),o=function(e,t){const n=e.find((({marker:e})=>t.getStart().isBefore(e.getStart())));return n?e.getIndex(n):e.length}(r,n);(e=>r.find((t=>{const{marker:n}=t,i=n.getRange(),r=e.getRange();return i.isEqual(r)})))(n)||r.add({id:t,label:e.label,marker:n},o)}))}}))})),r}rangeToText(e){return Array.from(e.getItems({shallow:!0})).reduce(((e,t)=>t.is("$text")||t.is("$textProxy")?e+t.data:`${e}\n`),"")}findByTextCallback(e,t){let n="gu";t.matchCase||(n+="i");let i=`(${Lf(e)})`;if(t.wholeWords){const t="[^a-zA-ZÀ-ɏḀ-ỿ]";new RegExp("^"+t).test(e)||(i=`(^|${t}|_)${i}`),new RegExp(t+"$").test(e)||(i=`${i}(?=_|${t}|$)`)}const r=new RegExp(i,n);return function({text:e}){return[...e.matchAll(r)].map(wA)}}}function wA(e){const t=e.length-1;let n=e.index;return 3===e.length&&(n+=e[1].length),{label:e[t],start:n,end:n+e[t].length}}class vA extends cf{static get requires(){return[bA]}static get pluginName(){return"FindAndReplaceEditing"}static get isOfficialPlugin(){return!0}state;init(){this.state=new dA(this.editor.model),this.set("_isSearchActive",!1),this._defineConverters(),this._defineCommands(),this.listenTo(this.state,"change:highlightedResult",((e,t,n,i)=>{const{model:r}=this.editor;r.change((e=>{if(i){const t=i.marker.name.split(":")[1],n=r.markers.get(`findResultHighlighted:${t}`);n&&e.removeMarker(n)}if(n){const t=n.marker.name.split(":")[1];e.addMarker(`findResultHighlighted:${t}`,{usingOperation:!1,affectsData:!1,range:n.marker.getRange()})}}))}));const e=id(((e,t,n)=>{if(n){const e=this.editor.editing.view.domConverter,t=this.editor.editing.mapper.toViewRange(n.marker.getRange());Ml({target:e.viewRangeToDom(t),viewportOffset:40})}}).bind(this),32);this.listenTo(this.state,"change:highlightedResult",e,{priority:"low"}),this.listenTo(this.editor,"destroy",e.cancel),this.on("change:_isSearchActive",((e,t,n)=>{n?this.listenTo(this.editor.model.document,"change:data",this._onDocumentChange):this.stopListening(this.editor.model.document,"change:data",this._onDocumentChange)}))}find(e,t){return this._isSearchActive=!0,this.editor.execute("find",e,t),this.state.results}stop(){this.state.clear(this.editor.model),this._isSearchActive=!1}_defineCommands(){this.editor.commands.add("find",new cA(this.editor,this.state)),this.editor.commands.add("findNext",new pA(this.editor,this.state)),this.editor.commands.add("findPrevious",new fA(this.editor,this.state)),this.editor.commands.add("replace",new mA(this.editor,this.state)),this.editor.commands.add("replaceAll",new gA(this.editor,this.state))}_defineConverters(){const{editor:e}=this;e.conversion.for("editingDowncast").markerToHighlight({model:"findResult",view:({markerName:e})=>{const[,t]=e.split(":");return{name:"span",classes:["ck-find-result"],attributes:{"data-find-result":t}}}}),e.conversion.for("editingDowncast").markerToHighlight({model:"findResultHighlighted",view:({markerName:e})=>{const[,t]=e.split(":");return{name:"span",classes:["ck-find-result_selected"],attributes:{"data-find-result":t}}}})}_onDocumentChange=()=>{const e=new Set,t=new Set,n=this.editor.model,{results:i}=this.state,r=n.document.differ.getChanges(),s=n.document.differ.getChangedMarkers();r.forEach((i=>{i.position&&("$text"===i.name||i.position.nodeAfter&&n.schema.isInline(i.position.nodeAfter)?(e.add(i.position.parent),[...n.markers.getMarkersAtPosition(i.position)].forEach((e=>{t.add(e.name)}))):"insert"===i.type&&i.position.nodeAfter&&e.add(i.position.nodeAfter))})),s.forEach((({name:e,data:{newRange:n}})=>{n&&"$graveyard"===n.start.root.rootName&&t.add(e)})),e.forEach((e=>{[...n.markers.getMarkersIntersectingRange(n.createRangeIn(e))].forEach((e=>t.add(e.name)))})),t.forEach((e=>{i.has(e)&&(i.get(e)===this.state.highlightedResult&&(this.state.highlightedResult=null),i.remove(e))}));const o=[],a=this.editor.plugins.get("FindAndReplaceUtils");e.forEach((e=>{const t=a.updateFindResultFromRange(n.createRangeOn(e),n,this.state.lastSearchCallback,i);o.push(...t)})),s.forEach((e=>{if(e.data.newRange){const t=a.updateFindResultFromRange(e.data.newRange,n,this.state.lastSearchCallback,i);o.push(...t)}})),!this.state.highlightedResult&&o.length?this.state.highlightedResult=o[0]:this.state.refreshHighlightOffset(n)}}class yA extends cf{static get requires(){return[vA,lA]}static get pluginName(){return"FindAndReplace"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.plugins.get("FindAndReplaceUI"),t=this.editor.plugins.get("FindAndReplaceEditing"),n=t.state;e.on("findNext",((e,i)=>{i?(n.searchText=i.searchText,t.find(i.searchText,i)):this.editor.execute("findNext")})),e.on("findPrevious",((e,i)=>{i&&n.searchText!==i.searchText?t.find(i.searchText):this.editor.execute("findPrevious")})),e.on("replace",((e,i)=>{n.searchText!==i.searchText&&t.find(i.searchText);const r=n.highlightedResult;r&&this.editor.execute("replace",i.replaceText,r)})),e.on("replaceAll",((e,i)=>{n.searchText!==i.searchText&&t.find(i.searchText),this.editor.execute("replaceAll",i.replaceText,n.results)})),e.on("searchReseted",(()=>{n.clear(this.editor.model),t.stop()}))}}class _A extends uf{attributeKey;constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute(this.attributeKey),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,n=t.document.selection,i=e.value,r=e.batch,s=e=>{if(n.isCollapsed)i?e.setSelectionAttribute(this.attributeKey,i):e.removeSelectionAttribute(this.attributeKey);else{const r=t.schema.getValidRanges(n.getRanges(),this.attributeKey);for(const t of r)i?e.setAttribute(this.attributeKey,i,t):e.removeAttribute(this.attributeKey,t)}};r?t.enqueueChange(r,(e=>{s(e)})):t.change((e=>{s(e)}))}}const kA="fontSize",xA="fontFamily",CA="fontColor",AA="fontBackgroundColor";function EA(e,t){const n={model:{key:e,values:[]},view:{},upcastAlso:{}};for(const e of t)n.model.values.push(e.model),n.view[e.model]=e.view,e.upcastAlso&&(n.upcastAlso[e.model]=e.upcastAlso);return n}function TA(e){return t=>t.getStyle(e).replace(/\s/g,"")}function SA(e){return(t,{writer:n})=>n.createAttributeElement("span",{style:`${e}:${t}`},{priority:7})}class PA extends _A{constructor(e){super(e,xA)}}function IA(e){return e.map(OA).filter((e=>void 0!==e))}function OA(e){return"object"==typeof e?e:"default"===e?{title:"Default",model:void 0}:"string"==typeof e?function(e){const t=e.replace(/"|'/g,"").split(","),n=t[0],i=t.map(VA).join(", ");return{title:n,model:i,view:{name:"span",styles:{"font-family":i},priority:7}}}(e):void 0}function VA(e){return(e=e.trim()).indexOf(" ")>0&&(e=`'${e}'`),e}class RA extends cf{static get pluginName(){return"FontFamilyEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(xA,{options:["default","Arial, Helvetica, sans-serif","Courier New, Courier, monospace","Georgia, serif","Lucida Sans Unicode, Lucida Grande, sans-serif","Tahoma, Geneva, sans-serif","Times New Roman, Times, serif","Trebuchet MS, Helvetica, sans-serif","Verdana, Geneva, sans-serif"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:xA}),e.model.schema.setAttributeProperties(xA,{isFormatting:!0,copyOnEnter:!0});const t=IA(e.config.get("fontFamily.options")).filter((e=>e.model)),n=EA(xA,t);e.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(n),e.commands.add(xA,new PA(e))}_prepareAnyValueConverters(){const e=this.editor;e.conversion.for("downcast").attributeToElement({model:xA,view:(e,{writer:t})=>t.createAttributeElement("span",{style:"font-family:"+e},{priority:7})}),e.conversion.for("upcast").elementToAttribute({model:{key:xA,value:e=>e.getStyle("font-family")},view:{name:"span",styles:{"font-family":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{face:/.*/}},model:{key:xA,value:e=>e.getAttribute("face")}})}}var NA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.03 3h6.149a.75.75 0 1 1 0 1.5h-5.514L11.03 3zm1.27 3h4.879a.75.75 0 1 1 0 1.5h-4.244L12.3 6zm1.27 3h3.609a.75.75 0 1 1 0 1.5h-2.973L13.57 9zm-2.754 2.5L8.038 4.785 5.261 11.5h5.555zm.62 1.5H4.641l-1.666 4.028H1.312l5.789-14h1.875l5.789 14h-1.663L11.436 13z"/></svg>';class LA extends cf{static get pluginName(){return"FontFamilyUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t,n=this._getLocalizedOptions(),i=e.commands.get(xA),r=t("Font Family"),s=function(e,t){const n=new oc;for(const i of e){const e={type:"button",model:new iy({commandName:xA,commandParam:i.model,label:i.title,role:"menuitemradio",withText:!0})};e.model.bind("isOn").to(t,"value",(e=>e===i.model||!(!e||!i.model)&&e.split(",")[0].replace(/'/g,"").toLowerCase()===i.model.toLowerCase())),i.view&&"string"!=typeof i.view&&i.view.styles&&e.model.set("labelStyle",`font-family: ${i.view.styles["font-family"]}`),n.add(e)}return n}(n,i);e.ui.componentFactory.add(xA,(t=>{const n=Yw(t);return ev(n,s,{role:"menu",ariaLabel:r}),n.buttonView.set({label:r,icon:NA,tooltip:!0}),n.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),n.bind("isEnabled").to(i),this.listenTo(n,"execute",(t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()})),n})),e.ui.componentFactory.add(`menuBar:${xA}`,(t=>{const n=new gy(t);n.buttonView.set({label:r,icon:NA}),n.bind("isEnabled").to(i);const o=new py(t);for(const i of s){const r=new Lv(t,n),s=new sw(t);s.set({role:"menuitemradio",isToggleable:!0}),s.bind(...Object.keys(i.model)).to(i.model),s.delegate("execute").to(n),s.on("execute",(()=>{e.execute(i.model.commandName,{value:i.model.commandParam}),e.editing.view.focus()})),r.children.add(s),o.items.add(r)}return n.panelView.children.add(o),n}))}_getLocalizedOptions(){const e=this.editor,t=e.t;return IA(e.config.get(xA).options).map((e=>("Default"===e.title&&(e.title=t("Default")),e)))}}class MA extends cf{static get requires(){return[RA,LA]}static get pluginName(){return"FontFamily"}static get isOfficialPlugin(){return!0}}class BA extends _A{constructor(e){super(e,kA)}}function FA(e){return e.map((e=>function(e){if("number"==typeof e&&(e=String(e)),"object"==typeof e&&((t=e).title&&t.model&&t.view))return zA(e);var t;const n=function(e){return"string"==typeof e?DA[e]:DA[e.model]}(e);return n?zA(n):"default"===e?{model:void 0,title:"Default"}:function(e){let t;if("object"==typeof e){if(!e.model)throw new Aa("font-size-invalid-definition",null,e);t=parseFloat(e.model)}else t=parseFloat(e);return isNaN(t)}(e)?void 0:function(e){return"string"==typeof e&&(e={title:e,model:`${parseFloat(e)}px`}),e.view={name:"span",styles:{"font-size":e.model}},zA(e)}(e)}(e))).filter((e=>void 0!==e))}const DA={get tiny(){return{title:"Tiny",model:"tiny",view:{name:"span",classes:"text-tiny",priority:7}}},get small(){return{title:"Small",model:"small",view:{name:"span",classes:"text-small",priority:7}}},get big(){return{title:"Big",model:"big",view:{name:"span",classes:"text-big",priority:7}}},get huge(){return{title:"Huge",model:"huge",view:{name:"span",classes:"text-huge",priority:7}}}};function zA(e){return e.view&&"string"!=typeof e.view&&!e.view.priority&&(e.view.priority=7),e}const $A=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class jA extends cf{static get pluginName(){return"FontSizeEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(kA,{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:kA}),e.model.schema.setAttributeProperties(kA,{isFormatting:!0,copyOnEnter:!0});const t=e.config.get("fontSize.supportAllValues"),n=FA(this.editor.config.get("fontSize.options")).filter((e=>e.model)),i=EA(kA,n);t?(this._prepareAnyValueConverters(i),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(i),e.commands.add(kA,new BA(e))}_prepareAnyValueConverters(e){const t=this.editor,n=e.model.values.filter((e=>!xp(String(e))&&!Ap(String(e))));if(n.length)throw new Aa("font-size-invalid-use-of-named-presets",null,{presets:n});t.conversion.for("downcast").attributeToElement({model:kA,view:(e,{writer:t})=>{if(e)return t.createAttributeElement("span",{style:"font-size:"+e},{priority:7})}}),t.conversion.for("upcast").elementToAttribute({model:{key:kA,value:e=>e.getStyle("font-size")},view:{name:"span",styles:{"font-size":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{size:/^[+-]?\d{1,3}$/}},model:{key:kA,value:e=>{const t=e.getAttribute("size"),n="-"===t[0]||"+"===t[0];let i=parseInt(t,10);n&&(i=3+i);const r=$A.length-1,s=Math.min(Math.max(i,0),r);return $A[s]}}})}}var HA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.816 11.5 7.038 4.785 4.261 11.5h5.555zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13zm7.55 2.279.779-.779.707.707-2.265 2.265-2.193-2.265.707-.707.765.765V4.825c0-.042 0-.083.002-.123l-.77.77-.707-.707L17.207 2.5l2.265 2.265-.707.707-.782-.782c.002.043.003.089.003.135v10.454z"/></svg>';class WA extends cf{static get pluginName(){return"FontSizeUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t,n=this._getLocalizedOptions(),i=e.commands.get(kA),r=t("Font Size"),s=function(e,t){const n=new oc;for(const i of e){const e={type:"button",model:new iy({commandName:kA,commandParam:i.model,label:i.title,class:"ck-fontsize-option",role:"menuitemradio",withText:!0})};i.view&&"string"!=typeof i.view&&(i.view.styles&&e.model.set("labelStyle",`font-size:${i.view.styles["font-size"]}`),i.view.classes&&e.model.set("class",`${e.model.class} ${i.view.classes}`)),e.model.bind("isOn").to(t,"value",(e=>e===i.model)),n.add(e)}return n}(n,i);e.ui.componentFactory.add(kA,(t=>{const n=Yw(t);return ev(n,s,{role:"menu",ariaLabel:r}),n.buttonView.set({label:r,icon:HA,tooltip:!0}),n.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),n.bind("isEnabled").to(i),this.listenTo(n,"execute",(t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()})),n})),e.ui.componentFactory.add(`menuBar:${kA}`,(t=>{const n=new gy(t);n.buttonView.set({label:r,icon:HA}),n.bind("isEnabled").to(i);const o=new py(t);for(const i of s){const r=new Lv(t,n),s=new sw(t);s.set({role:"menuitemradio",isToggleable:!0}),s.bind(...Object.keys(i.model)).to(i.model),s.delegate("execute").to(n),s.on("execute",(()=>{e.execute(i.model.commandName,{value:i.model.commandParam}),e.editing.view.focus()})),r.children.add(s),o.items.add(r)}return n.panelView.children.add(o),n}))}_getLocalizedOptions(){const e=this.editor,t=e.t,n={Default:t("Default"),Tiny:t("Tiny"),Small:t("Small"),Big:t("Big"),Huge:t("Huge")};return FA(e.config.get(kA).options).map((e=>{const t=n[e.title];return t&&t!=e.title&&(e=Object.assign({},e,{title:t})),e}))}}class UA extends cf{static get requires(){return[jA,WA]}static get pluginName(){return"FontSize"}static get isOfficialPlugin(){return!0}normalizeSizeOptions(e){return FA(e)}}class qA extends _A{constructor(e){super(e,CA)}}class GA extends cf{static get pluginName(){return"FontColorEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(CA,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{color:/[\s\S]+/}},model:{key:CA,value:TA("color")}}),e.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:CA,value:e=>e.getAttribute("color")}}),e.conversion.for("downcast").attributeToElement({model:CA,view:SA("color")}),e.commands.add(CA,new qA(e)),e.model.schema.extend("$text",{allowAttributes:CA}),e.model.schema.setAttributeProperties(CA,{isFormatting:!0,copyOnEnter:!0})}}class KA extends cf{commandName;componentName;icon;dropdownLabel;columns;constructor(e,{commandName:t,componentName:n,icon:i,dropdownLabel:r}){super(e),this.commandName=t,this.componentName=n,this.icon=i,this.dropdownLabel=r,this.columns=e.config.get(`${this.componentName}.columns`)}init(){const e=this.editor,t=e.locale,n=t.t,i=e.commands.get(this.commandName),r=e.config.get(this.componentName),s=vw(t,yw(r.colors)),o=r.documentColors,a=!1!==r.colorPicker;e.ui.componentFactory.add(this.componentName,(t=>{const l=Yw(t);let c=!1;const d=function({dropdownView:e,colors:t,columns:n,removeButtonLabel:i,colorPickerLabel:r,documentColorsLabel:s,documentColorsCount:o,colorPickerViewConfig:a}){const l=e.locale,c=new bv(l,{colors:t,columns:n,removeButtonLabel:i,colorPickerLabel:r,documentColorsLabel:s,documentColorsCount:o,colorPickerViewConfig:a});return e.colorSelectorView=c,e.panelView.children.add(c),c}({dropdownView:l,colors:s.map((e=>({label:e.label,color:e.model,options:{hasBorder:e.hasBorder}}))),columns:this.columns,removeButtonLabel:n("Remove color"),colorPickerLabel:n("Color picker"),documentColorsLabel:0!==o?n("Document colors"):"",documentColorsCount:void 0===o?this.columns:o,colorPickerViewConfig:!!a&&(r.colorPicker||{})});return d.bind("selectedColor").to(i,"value"),l.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),l.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),l.bind("isEnabled").to(i),d.on("execute",((t,n)=>{l.isOpen&&e.execute(this.commandName,{value:n.value,batch:this._undoStepBatch}),"colorPicker"!==n.source&&e.editing.view.focus(),"colorPickerSaveButton"===n.source&&(l.isOpen=!1)})),d.on("colorPicker:show",(()=>{this._undoStepBatch=e.model.createBatch()})),d.on("colorPicker:cancel",(()=>{this._undoStepBatch.operations.length&&(l.isOpen=!1,e.execute("undo",this._undoStepBatch)),e.editing.view.focus()})),l.on("change:isOpen",((t,n,i)=>{c||(c=!0,l.colorSelectorView.appendUI()),i&&(0!==o&&d.updateDocumentColors(e.model,this.componentName),d.updateSelectedColors(),d.showColorGridsFragment())})),nv(l,(()=>l.colorSelectorView.colorGridsFragmentView.staticColorsGrid.items.find((e=>e.isOn)))),l})),e.ui.componentFactory.add(`menuBar:${this.componentName}`,(t=>{const r=new gy(t);r.buttonView.set({label:this.dropdownLabel,icon:this.icon}),r.bind("isEnabled").to(i);let a=!1;const l=new bv(t,{colors:s.map((e=>({label:e.label,color:e.model,options:{hasBorder:e.hasBorder}}))),columns:this.columns,removeButtonLabel:n("Remove color"),colorPickerLabel:n("Color picker"),documentColorsLabel:0!==o?n("Document colors"):"",documentColorsCount:void 0===o?this.columns:o,colorPickerViewConfig:!1});return l.bind("selectedColor").to(i,"value"),l.delegate("execute").to(r),l.on("execute",((t,n)=>{e.execute(this.commandName,{value:n.value,batch:this._undoStepBatch}),e.editing.view.focus()})),r.on("change:isOpen",((t,n,i)=>{a||(a=!0,l.appendUI()),i&&(0!==o&&l.updateDocumentColors(e.model,this.componentName),l.updateSelectedColors(),l.showColorGridsFragment())})),r.panelView.children.add(l),r}))}}class ZA extends KA{constructor(e){const t=e.locale.t;super(e,{commandName:CA,componentName:CA,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.4 10.3 10 4.5l-2.4 5.8h4.8zm.5 1.2H7.1L5.7 15H4.2l5-12h1.6l5 12h-1.5L13 11.5zm3.1 7H4a1 1 0 0 1 0-2h12a1 1 0 0 1 0 2z"/></svg>',dropdownLabel:t("Font Color")})}static get pluginName(){return"FontColorUI"}}class QA extends cf{static get requires(){return[GA,ZA]}static get pluginName(){return"FontColor"}static get isOfficialPlugin(){return!0}}class YA extends _A{constructor(e){super(e,AA)}}class JA extends cf{static get pluginName(){return"FontBackgroundColorEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(AA,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.data.addStyleProcessorRules(Fp),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:AA,value:TA("background-color")}}),e.conversion.for("downcast").attributeToElement({model:AA,view:SA("background-color")}),e.commands.add(AA,new YA(e)),e.model.schema.extend("$text",{allowAttributes:AA}),e.model.schema.setAttributeProperties(AA,{isFormatting:!0,copyOnEnter:!0})}}class XA extends KA{constructor(e){const t=e.locale.t;super(e,{commandName:AA,componentName:AA,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M4 2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zm8.38 9.262H7.62L10 5.506l2.38 5.756zm.532 1.285L14.34 16h1.426L10.804 4H9.196L4.234 16H5.66l1.428-3.453h5.824z"/></svg>',dropdownLabel:t("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}}class eE extends cf{static get requires(){return[JA,XA]}static get pluginName(){return"FontBackgroundColor"}static get isOfficialPlugin(){return!0}}class tE extends uf{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){const e=this.editor.model,t=ac(e.document.selection.getSelectedBlocks());this.value=!!t&&t.is("element","paragraph"),this.isEnabled=!!t&&nE(t,e.schema)}execute(e={}){const t=this.editor.model,n=t.document,i=e.selection||n.selection;t.canEditAt(i)&&t.change((e=>{const n=i.getSelectedBlocks();for(const i of n)!i.is("element","paragraph")&&nE(i,t.schema)&&e.rename(i,"paragraph")}))}}function nE(e,t){return t.checkChild(e.parent,"paragraph")&&!t.isObject(e)}class iE extends uf{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}execute(e){const t=this.editor.model,n=e.attributes;let i=e.position;return t.canEditAt(i)?t.change((e=>{if(i=this._findPositionToInsertParagraph(i,e),!i)return null;const r=e.createElement("paragraph");return n&&t.schema.setAllowedAttributes(r,n,e),t.insertContent(r,i),e.setSelection(r,"in"),e.createPositionAt(r,0)})):null}_findPositionToInsertParagraph(e,t){const n=this.editor.model;if(n.schema.checkChild(e,"paragraph"))return e;const i=n.schema.findAllowedParent(e,"paragraph");if(!i)return null;const r=e.parent,s=n.schema.checkChild(r,"$text");return r.isEmpty||s&&e.isAtEnd?n.createPositionAfter(r):!r.isEmpty&&s&&e.isAtStart?n.createPositionBefore(r):t.split(e,i).position}}class rE extends cf{static get pluginName(){return"Paragraph"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model;e.commands.add("paragraph",new tE(e)),e.commands.add("insertParagraph",new iE(e)),t.schema.register("paragraph",{inheritAllFrom:"$block"}),e.conversion.elementToElement({model:"paragraph",view:"p"}),e.conversion.for("upcast").elementToElement({model:(e,{writer:t})=>rE.paragraphLikeElements.has(e.name)?e.isEmpty?null:t.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}static paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"])}class sE extends uf{modelElements;constructor(e,t){super(e),this.modelElements=t}refresh(){const e=ac(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some((t=>oE(e,t,this.editor.model.schema)))}execute(e){const t=this.editor.model,n=t.document,i=e.value;t.change((e=>{const r=Array.from(n.selection.getSelectedBlocks()).filter((e=>oE(e,i,t.schema)));for(const t of r)t.is("element",i)||e.rename(t,i)}))}}function oE(e,t,n){return n.checkChild(e.parent,t)&&!n.isObject(e)}const aE="paragraph";class lE extends cf{static get pluginName(){return"HeadingEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("heading",{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h2",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h3",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h4",title:"Heading 3",class:"ck-heading_heading3"}]})}static get requires(){return[rE]}init(){const e=this.editor,t=e.config.get("heading.options"),n=[];for(const i of t)"paragraph"!==i.model&&(e.model.schema.register(i.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(i),n.push(i.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new sE(e,n))}afterInit(){const e=this.editor,t=e.commands.get("enter"),n=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",((t,i)=>{const r=e.model.document.selection.getFirstPosition().parent;n.some((e=>r.is("element",e.model)))&&!r.is("element",aE)&&0===r.childCount&&i.writer.rename(r,aE)}))}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:xa.low+1})}}class cE extends cf{static get pluginName(){return"HeadingUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t,n=function(e){const t=e.t,n={Paragraph:t("Paragraph"),"Heading 1":t("Heading 1"),"Heading 2":t("Heading 2"),"Heading 3":t("Heading 3"),"Heading 4":t("Heading 4"),"Heading 5":t("Heading 5"),"Heading 6":t("Heading 6")};return e.config.get("heading.options").map((e=>{const t=n[e.title];return t&&t!=e.title&&(e.title=t),e}))}(e),i=t("Choose heading"),r=t("Heading");e.ui.componentFactory.add("heading",(t=>{const s={},o=new oc,a=e.commands.get("heading"),l=e.commands.get("paragraph"),c=[a];for(const e of n){const t={type:"button",model:new iy({label:e.title,class:e.class,role:"menuitemradio",withText:!0})};"paragraph"===e.model?(t.model.bind("isOn").to(l,"value"),t.model.set("commandName","paragraph"),c.push(l)):(t.model.bind("isOn").to(a,"value",(t=>t===e.model)),t.model.set({commandName:"heading",commandValue:e.model})),o.add(t),s[e.model]=e.title}const d=Yw(t);return ev(d,o,{ariaLabel:r,role:"menu"}),d.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),d.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),d.bind("isEnabled").toMany(c,"isEnabled",((...e)=>e.some((e=>e)))),d.buttonView.bind("label").to(a,"value",l,"value",((e,t)=>{const n=t?"paragraph":e;return"boolean"==typeof n?i:s[n]?s[n]:i})),d.buttonView.bind("ariaLabel").to(a,"value",l,"value",((e,t)=>{const n=t?"paragraph":e;return"boolean"==typeof n?r:s[n]?`${s[n]}, ${r}`:r})),this.listenTo(d,"execute",(t=>{const{commandName:n,commandValue:i}=t.source;e.execute(n,i?{value:i}:void 0),e.editing.view.focus()})),d})),e.ui.componentFactory.add("menuBar:heading",(i=>{const r=new gy(i),s=e.commands.get("heading"),o=e.commands.get("paragraph"),a=[s],l=new py(i);r.set({class:"ck-heading-dropdown"}),l.set({ariaLabel:t("Heading"),role:"menu"}),r.buttonView.set({label:t("Heading")}),r.panelView.children.add(l);for(const t of n){const n=new Lv(i,r),c=new sw(i);n.children.add(c),l.items.add(n),c.set({isToggleable:!0,label:t.title,role:"menuitemradio",class:t.class}),c.delegate("execute").to(r),c.on("execute",(()=>{const n="paragraph"===t.model?"paragraph":"heading";e.execute(n,{value:t.model}),e.editing.view.focus()})),"paragraph"===t.model?(c.bind("isOn").to(o,"value"),a.push(o)):c.bind("isOn").to(s,"value",(e=>e===t.model))}return r.bind("isEnabled").toMany(a,"isEnabled",((...e)=>e.some((e=>e)))),r}))}}class dE extends cf{static get requires(){return[lE,cE]}static get pluginName(){return"Heading"}static get isOfficialPlugin(){return!0}}new Set(["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"]);class uE extends uf{refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute("highlight"),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"highlight")}execute(e={}){const t=this.editor.model,n=t.document.selection,i=e.value;t.change((e=>{if(n.isCollapsed){const t=n.getFirstPosition();if(n.hasAttribute("highlight")){const n=e=>e.item.hasAttribute("highlight")&&e.item.getAttribute("highlight")===this.value,r=t.getLastMatchingPosition(n,{direction:"backward"}),s=t.getLastMatchingPosition(n),o=e.createRange(r,s);i&&this.value!==i?(t.isEqual(s)||e.setAttribute("highlight",i,o),e.setSelectionAttribute("highlight",i)):(t.isEqual(s)||e.removeAttribute("highlight",o),e.removeSelectionAttribute("highlight"))}else i&&e.setSelectionAttribute("highlight",i)}else{const r=t.schema.getValidRanges(n.getRanges(),"highlight");for(const t of r)i?e.setAttribute("highlight",i,t):e.removeAttribute("highlight",t)}}))}}class hE extends cf{static get pluginName(){return"HighlightEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("highlight",{options:[{model:"yellowMarker",class:"marker-yellow",title:"Yellow marker",color:"var(--ck-highlight-marker-yellow)",type:"marker"},{model:"greenMarker",class:"marker-green",title:"Green marker",color:"var(--ck-highlight-marker-green)",type:"marker"},{model:"pinkMarker",class:"marker-pink",title:"Pink marker",color:"var(--ck-highlight-marker-pink)",type:"marker"},{model:"blueMarker",class:"marker-blue",title:"Blue marker",color:"var(--ck-highlight-marker-blue)",type:"marker"},{model:"redPen",class:"pen-red",title:"Red pen",color:"var(--ck-highlight-pen-red)",type:"pen"},{model:"greenPen",class:"pen-green",title:"Green pen",color:"var(--ck-highlight-pen-green)",type:"pen"}]})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"highlight"});const t=e.config.get("highlight.options");e.conversion.attributeToElement(function(e){const t={model:{key:"highlight",values:[]},view:{}};for(const n of e)t.model.values.push(n.model),t.view[n.model]={name:"mark",classes:n.class};return t}(t)),e.commands.add("highlight",new uE(e))}}class mE extends cf{get localizedOptionTitles(){const e=this.editor.t;return{"Yellow marker":e("Yellow marker"),"Green marker":e("Green marker"),"Pink marker":e("Pink marker"),"Blue marker":e("Blue marker"),"Red pen":e("Red pen"),"Green pen":e("Green pen")}}static get pluginName(){return"HighlightUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.config.get("highlight.options");for(const t of e)this._addHighlighterButton(t);this._addRemoveHighlightButton(),this._addDropdown(e),this._addMenuBarButton(e)}_addRemoveHighlightButton(){const e=this.editor.t,t=this.editor.commands.get("highlight");this._addButton("removeHighlight",e("Remove highlight"),Pf.eraser,null,(e=>{e.bind("isEnabled").to(t,"isEnabled")}))}_addHighlighterButton(e){const t=this.editor.commands.get("highlight");this._addButton("highlight:"+e.model,e.title,gE(e.type),e.model,(function(n){n.bind("isEnabled").to(t,"isEnabled"),n.bind("isOn").to(t,"value",(t=>t===e.model)),n.iconView.fillColor=e.color,n.isToggleable=!0}))}_addButton(e,t,n,i,r){const s=this.editor;s.ui.componentFactory.add(e,(e=>{const o=new jb(e),a=this.localizedOptionTitles[t]?this.localizedOptionTitles[t]:t;return o.set({label:a,icon:n,tooltip:!0}),o.on("execute",(()=>{s.execute("highlight",{value:i}),s.editing.view.focus()})),r(o),o}))}_addDropdown(e){const t=this.editor,n=t.t,i=t.ui.componentFactory,r=e[0],s=e.reduce(((e,t)=>(e[t.model]=t,e)),{});i.add("highlight",(o=>{const a=t.commands.get("highlight"),l=Yw(o,Qw),c=l.buttonView;function d(e,t){const n=e&&e!==c.lastExecuted?e:c.lastExecuted;return s[n][t]}return c.set({label:n("Highlight"),tooltip:!0,lastExecuted:r.model,commandValue:r.model,isToggleable:!0}),c.bind("icon").to(a,"value",(e=>gE(d(e,"type")))),c.bind("color").to(a,"value",(e=>d(e,"color"))),c.bind("commandValue").to(a,"value",(e=>d(e,"model"))),c.bind("isOn").to(a,"value",(e=>!!e)),c.delegate("execute").to(l),l.bind("isEnabled").to(a,"isEnabled"),Jw(l,(()=>{const t=e.map((e=>{const t=i.create("highlight:"+e.model);return this.listenTo(t,"execute",(()=>{l.buttonView.set({lastExecuted:e.model})})),t}));return t.push(new jw),t.push(i.create("removeHighlight")),t}),{enableActiveItemFocusOnDropdownOpen:!0,ariaLabel:n("Text highlight toolbar")}),function(e){e.buttonView.actionView.iconView.bind("fillColor").to(e.buttonView,"color")}(l),c.on("execute",(()=>{t.execute("highlight",{value:c.commandValue})})),this.listenTo(l,"execute",(()=>{t.editing.view.focus()})),l}))}_addMenuBarButton(e){const t=this.editor,n=t.t,i=t.commands.get("highlight");t.ui.componentFactory.add("menuBar:highlight",(r=>{const s=new gy(r);s.buttonView.set({label:n("Highlight"),icon:gE("marker")}),s.bind("isEnabled").to(i),s.buttonView.iconView.fillColor="transparent";const o=new py(r);for(const n of e){const e=new Lv(r,s),a=new sw(r);a.set({label:n.title,icon:gE(n.type),role:"menuitemradio",isToggleable:!0}),a.iconView.fillColor=n.color,a.delegate("execute").to(s),a.bind("isOn").to(i,"value",(e=>e===n.model)),a.on("execute",(()=>{t.execute("highlight",{value:n.model}),t.editing.view.focus()})),e.children.add(a),o.items.add(e)}o.items.add(new Lw(r));const a=new Lv(r,s),l=new sw(r);return l.set({label:n("Remove highlight"),icon:Pf.eraser}),l.delegate("execute").to(s),l.on("execute",(()=>{t.execute("highlight",{value:null}),t.editing.view.focus()})),a.children.add(l),o.items.add(a),s.panelView.children.add(o),s}))}}function gE(e){return"marker"===e?'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M10.798 1.59 3.002 12.875l1.895 1.852 2.521 1.402 6.997-12.194z"/><path d="m2.556 16.727.234-.348c-.297-.151-.462-.293-.498-.426-.036-.137.002-.416.115-.837.094-.25.15-.449.169-.595a4.495 4.495 0 0 0 0-.725c-.209-.621-.303-1.041-.284-1.26.02-.218.178-.506.475-.862l6.77-9.414c.539-.91 1.605-.85 3.199.18 1.594 1.032 2.188 1.928 1.784 2.686l-5.877 10.36c-.158.412-.333.673-.526.782-.193.108-.604.179-1.232.21-.362.131-.608.237-.738.318-.13.081-.305.238-.526.47-.293.265-.504.397-.632.397-.096 0-.27-.075-.524-.226l-.31.41-1.6-1.12zm-.279.415 1.575 1.103-.392.515H1.19l1.087-1.618zm8.1-13.656-4.953 6.9L8.75 12.57l4.247-7.574c.175-.25-.188-.647-1.092-1.192-.903-.546-1.412-.652-1.528-.32zM8.244 18.5 9.59 17h9.406v1.5H8.245z"/></svg>':'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M10.126 2.268 2.002 13.874l1.895 1.852 2.521 1.402L14.47 5.481l-1.543-2.568-2.801-.645z"/><path d="m4.5 18.088-2.645-1.852-.04-2.95-.006-.005.006-.008v-.025l.011.008L8.73 2.97c.165-.233.356-.417.567-.557l-1.212.308L4.604 7.9l-.83-.558 3.694-5.495 2.708-.69 1.65 1.145.046.018.85-1.216 2.16 1.512-.856 1.222c.828.967 1.144 2.141.432 3.158L7.55 17.286l.006.005-3.055.797H4.5zm-.634.166-1.976.516-.026-1.918 2.002 1.402zM9.968 3.817l-.006-.004-6.123 9.184 3.277 2.294 6.108-9.162.005.003c.317-.452-.16-1.332-1.064-1.966-.891-.624-1.865-.776-2.197-.349zM8.245 18.5 9.59 17h9.406v1.5H8.245z"/></svg>'}class pE extends cf{static get requires(){return[hE,mE]}static get pluginName(){return"Highlight"}static get isOfficialPlugin(){return!0}}class fE extends uf{refresh(){const e=this.editor.model,t=e.schema,n=e.document.selection;this.isEnabled=function(e,t,n){const i=function(e,t){const n=Tk(e,t).start.parent;return n.isEmpty&&!n.is("element","$root")?n.parent:n}(e,n);return t.checkChild(i,"horizontalLine")}(n,t,e)}execute(){const e=this.editor.model;e.change((t=>{const n=t.createElement("horizontalLine");e.insertObject(n,null,null,{setSelection:"after"})}))}}class bE extends cf{static get pluginName(){return"HorizontalLineEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model.schema,n=e.t,i=e.conversion;t.register("horizontalLine",{inheritAllFrom:"$blockObject"}),i.for("dataDowncast").elementToElement({model:"horizontalLine",view:(e,{writer:t})=>t.createEmptyElement("hr")}),i.for("editingDowncast").elementToStructure({model:"horizontalLine",view:(e,{writer:t})=>{const i=n("Horizontal line"),r=t.createContainerElement("div",null,t.createEmptyElement("hr"));return t.addClass("ck-horizontal-line",r),t.setCustomProperty("hr",!0,r),function(e,t,n){return t.setCustomProperty("horizontalLine",!0,e),kk(e,t,{label:n})}(r,t,i)}}),i.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),e.commands.add("horizontalLine",new fE(e))}}class wE extends cf{static get pluginName(){return"HorizontalLineUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("horizontalLine",(()=>{const e=this._createButton(jb);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add("menuBar:horizontalLine",(()=>this._createButton(sw)))}_createButton(e){const t=this.editor,n=t.locale,i=t.commands.get("horizontalLine"),r=new e(t.locale),s=n.t;return r.set({label:s("Horizontal line"),icon:Pf.horizontalLine}),r.bind("isEnabled").to(i,"isEnabled"),this.listenTo(r,"execute",(()=>{t.execute("horizontalLine"),t.editing.view.focus()})),r}}class vE extends cf{static get requires(){return[bE,wE,Dk]}static get pluginName(){return"HorizontalLine"}static get isOfficialPlugin(){return!0}}class yE extends uf{refresh(){const e=this.editor.model,t=e.schema,n=e.document.selection,i=_E(n);this.isEnabled=function(e,t,n){const i=function(e,t){const n=Tk(e,t).start.parent;return n.isEmpty&&!n.is("rootElement")?n.parent:n}(e,n);return t.checkChild(i,"rawHtml")}(n,t,e),this.value=i?i.getAttribute("value")||"":null}execute(e){const t=this.editor.model,n=t.document.selection;t.change((i=>{let r;null!==this.value?r=_E(n):(r=i.createElement("rawHtml"),t.insertObject(r,null,null,{setSelection:"on"})),i.setAttribute("value",e,r)}))}}function _E(e){const t=e.getSelectedElement();return t&&t.is("element","rawHtml")?t:null}class kE extends cf{_widgetButtonViewReferences=new Set;static get pluginName(){return"HtmlEmbedEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("htmlEmbed",{showPreviews:!1,sanitizeHtml:e=>(Ea("html-embed-provide-sanitize-function"),{html:e,hasChanged:!1})})}init(){const e=this.editor;e.model.schema.register("rawHtml",{inheritAllFrom:"$blockObject",allowAttributes:["value"]}),e.commands.add("htmlEmbed",new yE(e)),this._setupConversion()}_setupConversion(){const e=this.editor,t=e.t,n=e.editing.view,i=this._widgetButtonViewReferences,r=e.config.get("htmlEmbed");function s({editor:e,domElement:n,state:r,props:s}){n.textContent="";const a=n.ownerDocument;let l;if(r.isEditable){const e={isDisabled:!1,placeholder:s.textareaPlaceholder};l=o({domDocument:a,state:r,props:e}),n.append(l)}else if(r.showPreviews){const i={sanitizeHtml:s.sanitizeHtml};n.append(function({editor:e,domDocument:n,state:i,props:r}){const s=r.sanitizeHtml(i.getRawHtmlValue()),o=il(n,"div",{class:"ck ck-reset_all raw-html-embed__preview-placeholder"},i.getRawHtmlValue().length>0?t("No preview available"):t("Empty snippet content")),a=il(n,"div",{class:"raw-html-embed__preview-content",dir:e.locale.contentLanguageDirection}),l=n.createRange().createContextualFragment(s.html);a.appendChild(l);return il(n,"div",{class:"raw-html-embed__preview"},[o,a])}({domDocument:a,state:r,props:i,editor:e}))}else{const e={isDisabled:!0,placeholder:s.textareaPlaceholder};n.append(o({domDocument:a,state:r,props:e}))}const c={onEditClick:s.onEditClick,onSaveClick:()=>{s.onSaveClick(l.value)},onCancelClick:s.onCancelClick};n.prepend(function({editor:e,domDocument:t,state:n,props:r}){const s=il(t,"div",{class:"raw-html-embed__buttons-wrapper"});if(n.isEditable){const t=xE(e,"save",r.onSaveClick),n=xE(e,"cancel",r.onCancelClick);s.append(t.element,n.element),i.add(t).add(n)}else{const t=xE(e,"edit",r.onEditClick);s.append(t.element),i.add(t)}return s}({editor:e,domDocument:a,state:r,props:c}))}function o({domDocument:e,state:t,props:n}){const i=il(e,"textarea",{placeholder:n.placeholder,class:"ck ck-reset ck-input ck-input-text raw-html-embed__source"});return i.disabled=n.isDisabled,i.value=t.getRawHtmlValue(),i}this.editor.editing.view.on("render",(()=>{for(const e of i){if(e.element&&e.element.isConnected)return;e.destroy(),i.delete(e)}}),{priority:"lowest"}),e.data.registerRawContentMatcher({name:"div",classes:"raw-html-embed"}),e.conversion.for("upcast").elementToElement({view:{name:"div",classes:"raw-html-embed"},model:(e,{writer:t})=>t.createElement("rawHtml",{value:e.getCustomProperty("$rawContent")})}),e.conversion.for("dataDowncast").elementToElement({model:"rawHtml",view:(e,{writer:t})=>t.createRawElement("div",{class:"raw-html-embed"},(function(t){t.innerHTML=e.getAttribute("value")||""}))}),e.conversion.for("editingDowncast").elementToStructure({model:{name:"rawHtml",attributes:["value"]},view:(i,{writer:o})=>{let a,l,c;const d=o.createRawElement("div",{class:"raw-html-embed__content-wrapper"},(function(t){a=t,s({editor:e,domElement:t,state:l,props:c}),a.addEventListener("mousedown",(()=>{if(l.isEditable){const t=e.model;t.document.selection.getSelectedElement()!==i&&t.change((e=>e.setSelection(i,"on")))}}),!0)})),u={makeEditable(){l=Object.assign({},l,{isEditable:!0}),s({domElement:a,editor:e,state:l,props:c}),n.change((e=>{e.setAttribute("data-cke-ignore-events","true",d)})),a.querySelector("textarea").focus()},save(t){t!==l.getRawHtmlValue()?(e.execute("htmlEmbed",t),e.editing.view.focus()):this.cancel()},cancel(){l=Object.assign({},l,{isEditable:!1}),s({domElement:a,editor:e,state:l,props:c}),e.editing.view.focus(),n.change((e=>{e.removeAttribute("data-cke-ignore-events",d)}))}};l={showPreviews:r.showPreviews,isEditable:!1,getRawHtmlValue:()=>i.getAttribute("value")||""},c={sanitizeHtml:r.sanitizeHtml,textareaPlaceholder:t("Paste raw HTML here..."),onEditClick(){u.makeEditable()},onSaveClick(e){u.save(e)},onCancelClick(){u.cancel()}};const h=o.createContainerElement("div",{class:"raw-html-embed","data-html-embed-label":t("HTML snippet"),dir:e.locale.uiLanguageDirection},d);return o.setCustomProperty("rawHtmlApi",u,h),o.setCustomProperty("rawHtml",!0,h),kk(h,o,{label:t("HTML snippet"),hasSelectionHandle:!0})}})}}function xE(e,t,n){const{t:i}=e.locale,r=new jb(e.locale),s=e.commands.get("htmlEmbed");return r.set({class:`raw-html-embed__${t}-button`,icon:Pf.pencil,tooltip:!0,tooltipPosition:"rtl"===e.locale.uiLanguageDirection?"e":"w"}),r.render(),"edit"===t?(r.set({icon:Pf.pencil,label:i("Edit source")}),r.bind("isEnabled").to(s)):"save"===t?(r.set({icon:Pf.check,label:i("Save changes")}),r.bind("isEnabled").to(s)):r.set({icon:Pf.cancel,label:i("Cancel")}),r.on("execute",n),r}class CE extends cf{static get pluginName(){return"HtmlEmbedUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.locale.t;e.ui.componentFactory.add("htmlEmbed",(()=>{const e=this._createButton(jb);return e.set({tooltip:!0,label:t("Insert HTML")}),e})),e.ui.componentFactory.add("menuBar:htmlEmbed",(()=>{const e=this._createButton(sw);return e.set({label:t("HTML snippet")}),e}))}_createButton(e){const t=this.editor,n=t.commands.get("htmlEmbed"),i=new e(t.locale);return i.set({icon:Pf.html}),i.bind("isEnabled").to(n,"isEnabled"),this.listenTo(i,"execute",(()=>{t.execute("htmlEmbed"),t.editing.view.focus(),t.editing.view.document.selection.getSelectedElement().getCustomProperty("rawHtmlApi").makeEditable()})),i}}class AE extends cf{static get requires(){return[kE,CE,Dk]}static get pluginName(){return"HtmlEmbed"}static get isOfficialPlugin(){return!0}}const EE=Mf({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"});var TE=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,SE=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");var PE=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var IE=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var OE="\\ud800-\\udfff",VE="\\u2700-\\u27bf",RE="a-z\\xdf-\\xf6\\xf8-\\xff",NE="A-Z\\xc0-\\xd6\\xd8-\\xde",LE="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ME="["+LE+"]",BE="\\d+",FE="["+VE+"]",DE="["+RE+"]",zE="[^"+OE+LE+BE+VE+RE+NE+"]",$E="(?:\\ud83c[\\udde6-\\uddff]){2}",jE="[\\ud800-\\udbff][\\udc00-\\udfff]",HE="["+NE+"]",WE="(?:"+DE+"|"+zE+")",UE="(?:"+HE+"|"+zE+")",qE="(?:['’](?:d|ll|m|re|s|t|ve))?",GE="(?:['’](?:D|LL|M|RE|S|T|VE))?",KE="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",ZE="[\\ufe0e\\ufe0f]?",QE=ZE+KE+"(?:\\u200d(?:"+["[^"+OE+"]",$E,jE].join("|")+")"+ZE+KE+")*",YE="(?:"+[FE,$E,jE].join("|")+")"+QE,JE=RegExp([HE+"?"+DE+"+"+qE+"(?="+[ME,HE,"$"].join("|")+")",UE+"+"+GE+"(?="+[ME,HE+WE,"$"].join("|")+")",HE+"?"+WE+"+"+qE,HE+"+"+GE,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",BE,YE].join("|"),"g");const XE=function(e,t,n){return e=Mc(e),void 0===(t=n?void 0:t)?function(e){return IE.test(e)}(e)?function(e){return e.match(JE)||[]}(e):function(e){return e.match(PE)||[]}(e):e.match(t)||[]};var eT=RegExp("['’]","g");var tT=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const nT=function(e){return tT.test(e)};var iT="\\ud800-\\udfff",rT="["+iT+"]",sT="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",oT="\\ud83c[\\udffb-\\udfff]",aT="[^"+iT+"]",lT="(?:\\ud83c[\\udde6-\\uddff]){2}",cT="[\\ud800-\\udbff][\\udc00-\\udfff]",dT="(?:"+sT+"|"+oT+")?",uT="[\\ufe0e\\ufe0f]?",hT=uT+dT+"(?:\\u200d(?:"+[aT,lT,cT].join("|")+")"+uT+dT+")*",mT="(?:"+[aT+sT+"?",sT,lT,cT,rT].join("|")+")",gT=RegExp(oT+"(?="+oT+")|"+mT+hT,"g");const pT=function(e){return nT(e)?function(e){return e.match(gT)||[]}(e):function(e){return e.split("")}(e)},fT=function(e){e=Mc(e);var t,n,i,r,s=nT(e)?pT(e):void 0,o=s?s[0]:e.charAt(0),a=s?(t=s,n=1,r=t.length,i=void 0===i?r:i,!n&&i>=r?t:Hc(t,n,i)).join(""):e.slice(1);return o.toUpperCase()+a},bT=(wT=function(e,t,n){return e+(n?" ":"")+fT(t)},function(e){return function(e,t,n,i){var r=-1,s=null==e?0:e.length;for(i&&s&&(n=e[++r]);++r<s;)n=t(n,e[r],r,e);return n}(XE(function(e){return(e=Mc(e))&&e.replace(TE,EE).replace(SE,"")}(e).replace(eT,"")),wT,"")});var wT;const vT=ta((function(e,t,n,i){Uo(e,t,n,i)}));function yT(e,t,n,i){t&&function(e,t,n){if(t.attributes)for(const[i]of Object.entries(t.attributes))e.removeAttribute(i,n);if(t.styles)for(const i of Object.keys(t.styles))e.removeStyle(i,n);t.classes&&e.removeClass(t.classes,n)}(e,t,i),n&&_T(e,n,i)}function _T(e,t,n){if(t.attributes)for(const[i,r]of Object.entries(t.attributes))e.setAttribute(i,r,n);t.styles&&e.setStyle(t.styles,n),t.classes&&e.addClass(t.classes,n)}function kT(e,t,n,i,r){const s=t.getAttribute(n),o={};for(const e of["attributes","styles","classes"]){if(e!=i){s&&s[e]&&(o[e]=s[e]);continue}if("classes"==i){const t=new Set(s&&s.classes||[]);r(t),t.size&&(o[e]=Array.from(t));continue}const t=new Map(Object.entries(s&&s[e]||{}));r(t),t.size&&(o[e]=Object.fromEntries(t))}Object.keys(o).length?t.is("documentSelection")?e.setSelectionAttribute(n,o):e.setAttribute(n,o,t):s&&(t.is("documentSelection")?e.removeSelectionAttribute(n):e.removeAttribute(n,t))}function xT(e){return`html${t=e,bT(t).replace(/ /g,"")}Attributes`;var t}function CT({model:e}){return(t,n)=>n.writer.createElement(e,{htmlContent:t.getCustomProperty("$rawContent")})}function AT(e,{view:t,isInline:n}){const i=e.t;return(e,{writer:r})=>{const s=i("HTML object"),o=ET(t,e,r),a=e.getAttribute(xT(t));return r.addClass("html-object-embed__content",o),a&&_T(r,a,o),kk(r.createContainerElement(n?"span":"div",{class:"html-object-embed","data-html-object-embed-label":s},o),r,{label:s})}}function ET(e,t,n){return n.createRawElement(e,null,((e,n)=>{n.setContentOf(e,t.getAttribute("htmlContent"))}))}function TT({model:e,view:t},n){return(i,{writer:r,consumable:s})=>{if(!i.hasAttribute(e))return null;const o=r.createContainerElement(t),a=i.getAttribute(e);return s.consume(i,`attribute:${e}`),_T(r,a,o),o.getFillerOffset=()=>null,n?kk(o,r):o}}function ST({priority:e,view:t}){return(n,i)=>{if(!n)return;const{writer:r}=i,s=r.createAttributeElement(t,null,{priority:e});return _T(r,n,s),s}}function PT({view:e},t){return n=>{n.on(`element:${e}`,((e,n,i)=>{if(!n.modelRange||n.modelRange.isCollapsed)return;const r=t.processViewAttributes(n.viewItem,i);r&&i.writer.setAttribute(xT(n.viewItem.name),r,n.modelRange)}),{priority:"low"})}}function IT({view:e,model:t}){return n=>{n.on(`attribute:${xT(e)}:${t}`,((e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;const{attributeOldValue:i,attributeNewValue:r}=t;yT(n.writer,i,r,n.mapper.toViewElement(t.item))}))}}var OT=[{model:"codeBlock",view:"pre"},{model:"paragraph",view:"p"},{model:"blockQuote",view:"blockquote"},{model:"listItem",view:"li"},{model:"pageBreak",view:"div"},{model:"rawHtml",view:"div"},{model:"table",view:"table"},{model:"tableRow",view:"tr"},{model:"tableCell",view:"td"},{model:"tableCell",view:"th"},{model:"tableColumnGroup",view:"colgroup"},{model:"tableColumn",view:"col"},{model:"caption",view:"caption"},{model:"caption",view:"figcaption"},{model:"imageBlock",view:"img"},{model:"imageInline",view:"img"},{model:"htmlP",view:"p",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlBlockquote",view:"blockquote",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlTable",view:"table",modelSchema:{allowWhere:"$block",isBlock:!0}},{model:"htmlTbody",view:"tbody",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlThead",view:"thead",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlTfoot",view:"tfoot",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlCaption",view:"caption",modelSchema:{allowIn:"htmlTable",allowChildren:"$text",isBlock:!1}},{model:"htmlColgroup",view:"colgroup",modelSchema:{allowIn:"htmlTable",allowChildren:"col",isBlock:!1}},{model:"htmlCol",view:"col",modelSchema:{allowIn:"htmlColgroup",isBlock:!1}},{model:"htmlTr",view:"tr",modelSchema:{allowIn:["htmlTable","htmlThead","htmlTbody"],isLimit:!0}},{model:"htmlTd",view:"td",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlTh",view:"th",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlFigure",view:"figure",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFigcaption",view:"figcaption",modelSchema:{allowIn:"htmlFigure",allowChildren:"$text",isBlock:!1}},{model:"htmlAddress",view:"address",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlAside",view:"aside",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlMain",view:"main",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDetails",view:"details",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSummary",view:"summary",modelSchema:{allowChildren:["htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6","$text"],allowIn:"htmlDetails",isBlock:!1}},{model:"htmlDiv",view:"div",paragraphLikeModel:"htmlDivParagraph",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlFieldset",view:"fieldset",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlLegend",view:"legend",modelSchema:{allowIn:"htmlFieldset",allowChildren:"$text"}},{model:"htmlHeader",view:"header",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFooter",view:"footer",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlForm",view:"form",modelSchema:{inheritAllFrom:"$container",isBlock:!0}},{model:"htmlHgroup",view:"hgroup",modelSchema:{allowIn:["$root","$container"],allowChildren:["paragraph","htmlP","htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6"],isBlock:!1}},{model:"htmlH1",view:"h1",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH2",view:"h2",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH3",view:"h3",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH4",view:"h4",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH5",view:"h5",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH6",view:"h6",modelSchema:{inheritAllFrom:"$block"}},{model:"$htmlList",modelSchema:{allowWhere:"$container",allowChildren:["$htmlList","htmlLi"],isBlock:!1}},{model:"htmlDir",view:"dir",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlMenu",view:"menu",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlUl",view:"ul",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlOl",view:"ol",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlLi",view:"li",modelSchema:{allowIn:"$htmlList",allowChildren:"$text",isBlock:!1}},{model:"htmlPre",view:"pre",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlArticle",view:"article",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSection",view:"section",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlNav",view:"nav",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDivDl",view:"div",modelSchema:{allowChildren:["htmlDt","htmlDd"],allowIn:"htmlDl"}},{model:"htmlDl",view:"dl",modelSchema:{allowWhere:"$container",allowChildren:["htmlDt","htmlDd","htmlDivDl"],isBlock:!1}},{model:"htmlDt",view:"dt",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlDd",view:"dd",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlCenter",view:"center",modelSchema:{inheritAllFrom:"$container",isBlock:!1}}],VT=[{model:"htmlLiAttributes",view:"li",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlOlAttributes",view:"ol",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlUlAttributes",view:"ul",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"table"},{model:"htmlTheadAttributes",view:"thead",appliesToBlock:"table"},{model:"htmlTbodyAttributes",view:"tbody",appliesToBlock:"table"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"imageBlock"},{model:"htmlAcronym",view:"acronym",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTt",view:"tt",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlFont",view:"font",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTime",view:"time",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlVar",view:"var",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBig",view:"big",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSmall",view:"small",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSamp",view:"samp",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlQ",view:"q",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlOutput",view:"output",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlKbd",view:"kbd",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdi",view:"bdi",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdo",view:"bdo",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlAbbr",view:"abbr",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlA",view:"a",priority:5,coupledAttribute:"linkHref"},{model:"htmlStrong",view:"strong",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlB",view:"b",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlI",view:"i",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlEm",view:"em",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlS",view:"s",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDel",view:"del",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlIns",view:"ins",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlU",view:"u",coupledAttribute:"underline",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSub",view:"sub",coupledAttribute:"subscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSup",view:"sup",coupledAttribute:"superscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCode",view:"code",coupledAttribute:"code",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlMark",view:"mark",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSpan",view:"span",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCite",view:"cite",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlLabel",view:"label",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDfn",view:"dfn",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlObject",view:"object",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlIframe",view:"iframe",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlInput",view:"input",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlButton",view:"button",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlTextarea",view:"textarea",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlSelect",view:"select",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlVideo",view:"video",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlEmbed",view:"embed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlOembed",view:"oembed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlAudio",view:"audio",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlImg",view:"img",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlCanvas",view:"canvas",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlMeter",view:"meter",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlProgress",view:"progress",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlScript",view:"script",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlStyle",view:"style",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlCustomElement",view:"$customElement",modelSchema:{allowWhere:["$text","$block"],allowAttributesOf:"$inlineObject",isInline:!0}}];class RT extends cf{_definitions=[];static get pluginName(){return"DataSchema"}static get isOfficialPlugin(){return!0}init(){for(const e of OT)this.registerBlockElement(e);for(const e of VT)this.registerInlineElement(e)}registerBlockElement(e){this._definitions.push({...e,isBlock:!0})}registerInlineElement(e){this._definitions.push({...e,isInline:!0})}extendBlockElement(e){this._extendDefinition({...e,isBlock:!0})}extendInlineElement(e){this._extendDefinition({...e,isInline:!0})}getDefinitionsForView(e,t=!1){const n=new Set;for(const i of this._getMatchingViewDefinitions(e)){if(t)for(const e of this._getReferences(i.model))n.add(e);n.add(i)}return n}getDefinitionsForModel(e){return this._definitions.filter((t=>t.model==e))}_getMatchingViewDefinitions(e){return this._definitions.filter((t=>t.view&&function(e,t){return"string"==typeof e?e===t:e instanceof RegExp&&e.test(t)}(e,t.view)))}*_getReferences(e){const t=["inheritAllFrom","inheritTypesFrom","allowWhere","allowContentOf","allowAttributesOf"],n=this._definitions.filter((t=>t.model==e));for(const{modelSchema:i}of n)if(i)for(const n of t)for(const t of rc(i[n]||[])){const n=this._definitions.filter((e=>e.model==t));for(const i of n)t!==e&&(yield*this._getReferences(i.model),yield i)}}_extendDefinition(e){const t=Array.from(this._definitions.entries()).filter((([,t])=>t.model==e.model));if(0!=t.length)for(const[n,i]of t)this._definitions[n]=vT({},i,e,((e,t)=>Array.isArray(e)?e.concat(t):void 0));else this._definitions.push(e)}}class NT extends cf{_dataSchema;_allowedAttributes;_disallowedAttributes;_allowedElements;_disallowedElements;_dataInitialized;_coupledAttributes;constructor(e){super(e),this._dataSchema=e.plugins.get("DataSchema"),this._allowedAttributes=new Rd,this._disallowedAttributes=new Rd,this._allowedElements=new Set,this._disallowedElements=new Set,this._dataInitialized=!1,this._coupledAttributes=null,this._registerElementsAfterInit(),this._registerElementHandlers(),this._registerCoupledAttributesPostFixer(),this._registerAssociatedHtmlAttributesPostFixer()}static get pluginName(){return"DataFilter"}static get isOfficialPlugin(){return!0}static get requires(){return[RT,Dk]}loadAllowedConfig(e){for(const t of e){const e=t.name||/[\s\S]+/,n=DT(t);this.allowElement(e),n.forEach((e=>this.allowAttributes(e)))}}loadDisallowedConfig(e){for(const t of e){const e=t.name||/[\s\S]+/,n=DT(t);0==n.length?this.disallowElement(e):n.forEach((e=>this.disallowAttributes(e)))}}loadAllowedEmptyElementsConfig(e){for(const t of e)this.allowEmptyElement(t)}allowElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!0))this._addAllowedElement(t),this._coupledAttributes=null}disallowElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!1))this._disallowedElements.add(t.view)}allowEmptyElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!0))t.isInline&&this._dataSchema.extendInlineElement({...t,allowEmpty:!0})}allowAttributes(e){this._allowedAttributes.add(e)}disallowAttributes(e){this._disallowedAttributes.add(e)}processViewAttributes(e,t){const{consumable:n}=t;return LT(e,this._disallowedAttributes,n),function(e,{attributes:t,classes:n,styles:i}){return t.length||n.length||i.length?{...t.length&&{attributes:MT(e,t)},...i.length&&{styles:BT(e,i)},...n.length&&{classes:n}}:null}(e,LT(e,this._allowedAttributes,n))}_addAllowedElement(e){if(!this._allowedElements.has(e)){if(this._allowedElements.add(e),"appliesToBlock"in e&&"string"==typeof e.appliesToBlock)for(const t of this._dataSchema.getDefinitionsForModel(e.appliesToBlock))t.isBlock&&this._addAllowedElement(t);this._dataInitialized&&this.editor.data.once("set",(()=>{this._fireRegisterEvent(e)}),{priority:xa.highest+1})}}_registerElementsAfterInit(){this.editor.data.on("init",(()=>{this._dataInitialized=!0;for(const e of this._allowedElements)this._fireRegisterEvent(e)}),{priority:xa.highest+1})}_registerElementHandlers(){this.on("register",((e,t)=>{const n=this.editor.model.schema;if(t.isObject&&!n.isRegistered(t.model))this._registerObjectElement(t);else if(t.isBlock)this._registerBlockElement(t);else{if(!t.isInline)throw new Aa("data-filter-invalid-definition",null,t);this._registerInlineElement(t)}e.stop()}),{priority:"lowest"})}_registerCoupledAttributesPostFixer(){const e=this.editor.model,t=e.document.selection;e.document.registerPostFixer((t=>{const n=e.document.differ.getChanges();let i=!1;const r=this._getCoupledAttributesMap();for(const e of n){if("attribute"!=e.type||null!==e.attributeNewValue)continue;const n=r.get(e.attributeKey);if(n)for(const{item:r}of e.range.getWalker())for(const e of n)r.hasAttribute(e)&&(t.removeAttribute(e,r),i=!0)}return i})),this.listenTo(t,"change:attribute",((n,{attributeKeys:i})=>{const r=new Set,s=this._getCoupledAttributesMap();for(const e of i){if(t.hasAttribute(e))continue;const n=s.get(e);if(n)for(const e of n)t.hasAttribute(e)&&r.add(e)}0!=r.size&&e.change((e=>{for(const t of r)e.removeSelectionAttribute(t)}))}))}_registerAssociatedHtmlAttributesPostFixer(){const e=this.editor.model;e.document.registerPostFixer((t=>{const n=e.document.differ.getChanges();let i=!1;for(const r of n)if("insert"===r.type&&"$text"!==r.name)for(const n of r.attributes.keys())n.startsWith("html")&&n.endsWith("Attributes")&&(e.schema.checkAttribute(r.name,n)||(t.removeAttribute(n,r.position.nodeAfter),i=!0));return i}))}_getCoupledAttributesMap(){if(this._coupledAttributes)return this._coupledAttributes;this._coupledAttributes=new Map;for(const e of this._allowedElements)if(e.coupledAttribute&&e.model){const t=this._coupledAttributes.get(e.coupledAttribute);t?t.push(e.model):this._coupledAttributes.set(e.coupledAttribute,[e.model])}return this._coupledAttributes}_fireRegisterEvent(e){e.view&&this._disallowedElements.has(e.view)||this.fire(e.view?`register:${e.view}`:"register",e)}_registerObjectElement(e){const t=this.editor,n=t.model.schema,i=t.conversion,{view:r,model:s}=e;n.register(s,e.modelSchema),r&&(n.extend(e.model,{allowAttributes:[xT(r),"htmlContent"]}),t.data.registerRawContentMatcher({name:r}),i.for("upcast").elementToElement({view:r,model:CT(e),converterPriority:xa.low+2}),i.for("upcast").add(PT(e,this)),i.for("editingDowncast").elementToStructure({model:{name:s,attributes:[xT(r)]},view:AT(t,e)}),i.for("dataDowncast").elementToElement({model:s,view:(e,{writer:t})=>ET(r,e,t)}),i.for("dataDowncast").add(IT(e)))}_registerBlockElement(e){const t=this.editor,n=t.model.schema,i=t.conversion,{view:r,model:s}=e;if(!n.isRegistered(e.model)){if(n.register(e.model,e.modelSchema),!r)return;i.for("upcast").elementToElement({model:s,view:r,converterPriority:xa.low+2}),i.for("downcast").elementToElement({model:s,view:r})}r&&(n.extend(e.model,{allowAttributes:xT(r)}),i.for("upcast").add(PT(e,this)),i.for("downcast").add(IT(e)))}_registerInlineElement(e){const t=this.editor,n=t.model.schema,i=t.conversion,r=e.model;e.appliesToBlock||(n.extend("$text",{allowAttributes:r}),e.attributeProperties&&n.setAttributeProperties(r,e.attributeProperties),i.for("upcast").add(function({view:e,model:t,allowEmpty:n},i){return t=>{t.on(`element:${e}`,((e,t,s)=>{let o=i.processViewAttributes(t.viewItem,s);if(o||s.consumable.test(t.viewItem,{name:!0})){if(o=o||{},s.consumable.consume(t.viewItem,{name:!0}),t.modelRange||(t=Object.assign(t,s.convertChildren(t.viewItem,t.modelCursor))),n&&t.modelRange.isCollapsed&&Object.keys(o).length){const e=s.writer.createElement("htmlEmptyElement");if(!s.safeInsert(e,t.modelCursor))return;const n=s.getSplitParts(e);return t.modelRange=s.writer.createRange(t.modelRange.start,s.writer.createPositionAfter(n[n.length-1])),s.updateConversionResult(e,t),void r(e,o,s)}for(const e of t.modelRange.getItems())r(e,o,s)}}),{priority:"low"})};function r(e,n,i){if(i.schema.checkAttribute(e,t)){const r=function(e,t){const n=_d(e);let i="attributes";for(i in t)n[i]="classes"==i?Array.from(new Set([...e[i]||[],...t[i]])):{...e[i],...t[i]};return n}(n,e.getAttribute(t)||{});i.writer.setAttribute(t,r,e)}}}(e,this)),i.for("downcast").attributeToElement({model:r,view:ST(e)}),e.allowEmpty&&(n.setAttributeProperties(r,{copyFromObject:!1}),n.isRegistered("htmlEmptyElement")||n.register("htmlEmptyElement",{inheritAllFrom:"$inlineObject"}),t.data.htmlProcessor.domConverter.registerInlineObjectMatcher((t=>t.name==e.view&&t.isEmpty&&Array.from(t.getAttributeKeys()).length?{name:!0}:null)),i.for("editingDowncast").elementToElement({model:"htmlEmptyElement",view:TT(e,!0)}),i.for("dataDowncast").elementToElement({model:"htmlEmptyElement",view:TT(e)})))}}function LT(e,t,n){const i=t.matchAll(e)||[],r=e.document.stylesProcessor;return i.reduce(((t,{match:i})=>{for(const s of i.styles||[]){const i=r.getRelatedStyles(s).filter((e=>e.split("-").length>s.split("-").length)).sort(((e,t)=>t.split("-").length-e.split("-").length));for(const r of i)n.consume(e,{styles:[r]})&&t.styles.push(r);n.consume(e,{styles:[s]})&&t.styles.push(s)}for(const r of i.classes||[])n.consume(e,{classes:[r]})&&t.classes.push(r);for(const r of i.attributes||[])n.consume(e,{attributes:[r]})&&t.attributes.push(r);return t}),{attributes:[],classes:[],styles:[]})}function MT(e,t){const n={};for(const i of t){const t=e.getAttribute(i);void 0!==t&&Il(i)&&(n[i]=t)}return n}function BT(e,t){const n=new Md(e.document.stylesProcessor);for(const i of t){const t=e.getStyle(i);void 0!==t&&n.set(i,t)}return Object.fromEntries(n.getStylesEntries())}function FT(e,t){const{name:n}=e,i=e[t];return Sr(i)?Object.entries(i).map((([e,i])=>({name:n,[t]:{[e]:i}}))):Array.isArray(i)?i.map((e=>({name:n,[t]:[e]}))):[e]}function DT(e){const{name:t,attributes:n,classes:i,styles:r}=e,s=[];return n&&s.push(...FT({name:t,attributes:n},"attributes")),i&&s.push(...FT({name:t,classes:i},"classes")),r&&s.push(...FT({name:t,styles:r},"styles")),s}class zT extends cf{static get requires(){return[NT]}static get pluginName(){return"CodeBlockElementSupport"}static get isOfficialPlugin(){return!0}init(){if(!this.editor.plugins.has("CodeBlockEditing"))return;const e=this.editor.plugins.get(NT);e.on("register:pre",((t,n)=>{if("codeBlock"!==n.model)return;const i=this.editor,r=i.model.schema,s=i.conversion;r.extend("codeBlock",{allowAttributes:["htmlPreAttributes","htmlContentAttributes"]}),s.for("upcast").add(function(e){return t=>{t.on("element:code",((t,n,i)=>{const r=n.viewItem,s=r.parent;function o(t,r){const s=e.processViewAttributes(t,i);s&&i.writer.setAttribute(r,s,n.modelRange)}s&&s.is("element","pre")&&(o(s,"htmlPreAttributes"),o(r,"htmlContentAttributes"))}),{priority:"low"})}}(e)),s.for("downcast").add((e=>{e.on("attribute:htmlPreAttributes:codeBlock",((e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;const{attributeOldValue:i,attributeNewValue:r}=t,s=n.mapper.toViewElement(t.item).parent;yT(n.writer,i,r,s)})),e.on("attribute:htmlContentAttributes:codeBlock",((e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;const{attributeOldValue:i,attributeNewValue:r}=t,s=n.mapper.toViewElement(t.item);yT(n.writer,i,r,s)}))})),t.stop()}))}}class $T extends cf{static get requires(){return[NT]}static get pluginName(){return"DualContentModelElementSupport"}static get isOfficialPlugin(){return!0}init(){this.editor.plugins.get(NT).on("register",((e,t)=>{const n=t,i=this.editor,r=i.model.schema,s=i.conversion;if(!n.paragraphLikeModel)return;if(r.isRegistered(n.model)||r.isRegistered(n.paragraphLikeModel))return;const o={model:n.paragraphLikeModel,view:n.view};r.register(n.model,n.modelSchema),r.register(o.model,{inheritAllFrom:"$block"}),s.for("upcast").elementToElement({view:n.view,model:(e,{writer:t})=>this._hasBlockContent(e)?t.createElement(n.model):t.createElement(o.model),converterPriority:xa.low+.5}),s.for("downcast").elementToElement({view:n.view,model:n.model}),this._addAttributeConversion(n),s.for("downcast").elementToElement({view:o.view,model:o.model}),this._addAttributeConversion(o),e.stop()}))}_hasBlockContent(e){const t=this.editor.editing.view,n=t.domConverter.blockElements;for(const i of t.createRangeIn(e).getItems())if(i.is("element")&&n.includes(i.name))return!0;return!1}_addAttributeConversion(e){const t=this.editor,n=t.conversion,i=t.plugins.get(NT);t.model.schema.extend(e.model,{allowAttributes:xT(e.view)}),n.for("upcast").add(PT(e,i)),n.for("downcast").add(IT(e))}}class jT extends cf{static get requires(){return[RT,sk]}static get pluginName(){return"HeadingElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("HeadingEditing"))return;const t=e.config.get("heading.options");this.registerHeadingElements(e,t)}registerHeadingElements(e,t){const n=e.plugins.get(RT),i=[];for(const e of t)"model"in e&&"view"in e&&(n.registerBlockElement({view:e.view,model:e.model}),i.push(e.model));n.extendBlockElement({model:"htmlHgroup",modelSchema:{allowChildren:i}}),n.extendBlockElement({model:"htmlSummary",modelSchema:{allowChildren:i}})}}function HT(e,t,n){const i=e.createRangeOn(t);for(const{item:e}of i.getWalker())if(e.is("element",n))return e}class WT extends cf{static get requires(){return[NT]}static get pluginName(){return"ImageElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("ImageInlineEditing")&&!e.plugins.has("ImageBlockEditing"))return;const t=e.model.schema,n=e.conversion,i=e.plugins.get(NT);i.on("register:figure",(()=>{n.for("upcast").add(function(e){return t=>{t.on("element:figure",((t,n,i)=>{const r=n.viewItem;if(!n.modelRange||!r.hasClass("image"))return;const s=e.processViewAttributes(r,i);s&&i.writer.setAttribute("htmlFigureAttributes",s,n.modelRange)}),{priority:"low"})}}(i))})),i.on("register:img",((r,s)=>{"imageBlock"!==s.model&&"imageInline"!==s.model||(t.isRegistered("imageBlock")&&t.extend("imageBlock",{allowAttributes:["htmlImgAttributes","htmlFigureAttributes","htmlLinkAttributes"]}),t.isRegistered("imageInline")&&t.extend("imageInline",{allowAttributes:["htmlA","htmlImgAttributes"]}),n.for("upcast").add(function(e){return t=>{t.on("element:img",((t,n,i)=>{if(!n.modelRange)return;const r=n.viewItem,s=e.processViewAttributes(r,i);s&&i.writer.setAttribute("htmlImgAttributes",s,n.modelRange)}),{priority:"low"})}}(i)),n.for("downcast").add((e=>{function t(t,n){e.on(`attribute:${n}:imageBlock`,((e,n,i)=>{if(!i.consumable.test(n.item,e.name))return;const{attributeOldValue:r,attributeNewValue:s}=n,o=i.mapper.toViewElement(n.item),a=HT(i.writer,o,t);a&&(yT(i.writer,r,s,a),i.consumable.consume(n.item,e.name))}),{priority:"low"}),"a"===t&&e.on("attribute:linkHref:imageBlock",((e,t,n)=>{if(!n.consumable.consume(t.item,"attribute:htmlLinkAttributes:imageBlock"))return;const i=n.mapper.toViewElement(t.item),r=HT(n.writer,i,"a");_T(n.writer,t.item.getAttribute("htmlLinkAttributes"),r)}),{priority:"low"})}var n;n="htmlImgAttributes",e.on(`attribute:${n}:imageInline`,((e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;const{attributeOldValue:i,attributeNewValue:r}=t,s=n.mapper.toViewElement(t.item);yT(n.writer,i,r,s)}),{priority:"low"}),t("img","htmlImgAttributes"),t("figure","htmlFigureAttributes"),t("a","htmlLinkAttributes")})),e.plugins.has("LinkImage")&&n.for("upcast").add(function(e,t){const n=t.plugins.get("ImageUtils");return t=>{t.on("element:a",((t,i,r)=>{const s=i.viewItem;if(!n.findViewImgElement(s))return;const o=i.modelCursor.parent;if(!o.is("element","imageBlock"))return;const a=e.processViewAttributes(s,r);a&&r.writer.setAttribute("htmlLinkAttributes",a,o)}),{priority:"low"})}}(i,e)),r.stop())}))}}class UT extends cf{static get requires(){return[NT]}static get pluginName(){return"MediaEmbedElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("MediaEmbed")||e.config.get("mediaEmbed.previewsInData"))return;const t=e.model.schema,n=e.conversion,i=this.editor.plugins.get(NT),r=this.editor.plugins.get(RT),s=e.config.get("mediaEmbed.elementName");r.registerBlockElement({model:"media",view:s}),i.on("register:figure",(()=>{n.for("upcast").add(function(e){return t=>{t.on("element:figure",((t,n,i)=>{const r=n.viewItem;if(!n.modelRange||!r.hasClass("media"))return;const s=e.processViewAttributes(r,i);s&&i.writer.setAttribute("htmlFigureAttributes",s,n.modelRange)}),{priority:"low"})}}(i))})),i.on(`register:${s}`,((e,r)=>{"media"===r.model&&(t.extend("media",{allowAttributes:[xT(s),"htmlFigureAttributes"]}),n.for("upcast").add(function(e,t){const n=(n,i,r)=>{!function(t,n){const s=e.processViewAttributes(t,r);s&&r.writer.setAttribute(n,s,i.modelRange)}(i.viewItem,xT(t))};return e=>{e.on(`element:${t}`,n,{priority:"low"})}}(i,s)),n.for("dataDowncast").add(function(e){return t=>{function n(e,n){t.on(`attribute:${n}:media`,((t,n,i)=>{if(!i.consumable.consume(n.item,t.name))return;const{attributeOldValue:r,attributeNewValue:s}=n,o=i.mapper.toViewElement(n.item),a=HT(i.writer,o,e);yT(i.writer,r,s,a)}))}n(e,xT(e)),n("figure","htmlFigureAttributes")}}(s)),e.stop())}))}}class qT extends cf{static get requires(){return[NT]}static get pluginName(){return"ScriptElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.plugins.get(NT);e.on("register:script",((t,n)=>{const i=this.editor,r=i.model.schema,s=i.conversion;r.register("htmlScript",n.modelSchema),r.extend("htmlScript",{allowAttributes:["htmlScriptAttributes","htmlContent"],isContent:!0}),i.data.registerRawContentMatcher({name:"script"}),s.for("upcast").elementToElement({view:"script",model:CT(n)}),s.for("upcast").add(PT(n,e)),s.for("downcast").elementToElement({model:"htmlScript",view:(e,{writer:t})=>ET("script",e,t)}),s.for("downcast").add(IT(n)),t.stop()}))}}class GT extends cf{static get requires(){return[NT]}static get pluginName(){return"TableElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("TableEditing"))return;const t=e.model.schema,n=e.conversion,i=e.plugins.get(NT),r=e.plugins.get("TableUtils");i.on("register:figure",(()=>{n.for("upcast").add(function(e){return t=>{t.on("element:figure",((t,n,i)=>{const r=n.viewItem;if(!n.modelRange||!r.hasClass("table"))return;const s=e.processViewAttributes(r,i);s&&i.writer.setAttribute("htmlFigureAttributes",s,n.modelRange)}),{priority:"low"})}}(i))})),i.on("register:table",((s,o)=>{"table"===o.model&&(t.extend("table",{allowAttributes:["htmlTableAttributes","htmlFigureAttributes","htmlTheadAttributes","htmlTbodyAttributes"]}),n.for("upcast").add(function(e){return t=>{t.on("element:table",((t,n,i)=>{if(!n.modelRange)return;const r=n.viewItem;s(r,"htmlTableAttributes");for(const e of r.getChildren())e.is("element","thead")&&s(e,"htmlTheadAttributes"),e.is("element","tbody")&&s(e,"htmlTbodyAttributes");function s(t,r){const s=e.processViewAttributes(t,i);s&&i.writer.setAttribute(r,s,n.modelRange)}}),{priority:"low"})}}(i)),n.for("downcast").add((e=>{function t(t,n){e.on(`attribute:${n}:table`,((e,n,i)=>{if(!i.consumable.test(n.item,e.name))return;const r=i.mapper.toViewElement(n.item),s=HT(i.writer,r,t);s&&(i.consumable.consume(n.item,e.name),yT(i.writer,n.attributeOldValue,n.attributeNewValue,s))}))}t("table","htmlTableAttributes"),t("figure","htmlFigureAttributes"),t("thead","htmlTheadAttributes"),t("tbody","htmlTbodyAttributes")})),e.model.document.registerPostFixer(function(e,t){return n=>{const i=e.document.differ.getChanges();let r=!1;for(const e of i){if("attribute"!=e.type||"headingRows"!=e.attributeKey)continue;const i=e.range.start.nodeAfter,s=i.getAttribute("htmlTheadAttributes"),o=i.getAttribute("htmlTbodyAttributes");s&&!e.attributeNewValue?(n.removeAttribute("htmlTheadAttributes",i),r=!0):o&&e.attributeNewValue==t.getRows(i)&&(n.removeAttribute("htmlTbodyAttributes",i),r=!0)}return r}}(e.model,r)),s.stop())}))}}class KT extends cf{static get requires(){return[NT]}static get pluginName(){return"StyleElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.plugins.get(NT);e.on("register:style",((t,n)=>{const i=this.editor,r=i.model.schema,s=i.conversion;r.register("htmlStyle",n.modelSchema),r.extend("htmlStyle",{allowAttributes:["htmlStyleAttributes","htmlContent"],isContent:!0}),i.data.registerRawContentMatcher({name:"style"}),s.for("upcast").elementToElement({view:"style",model:CT(n)}),s.for("upcast").add(PT(n,e)),s.for("downcast").elementToElement({model:"htmlStyle",view:(e,{writer:t})=>ET("style",e,t)}),s.for("downcast").add(IT(n)),t.stop()}))}}class ZT extends cf{static get requires(){return[NT]}static get pluginName(){return"ListElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("ListEditing"))return;const t=e.model.schema,n=e.conversion,i=e.plugins.get(NT),r=e.plugins.get("ListEditing"),s=e.plugins.get("ListUtils"),o=["ul","ol","li"];r.registerDowncastStrategy({scope:"item",attributeName:"htmlLiAttributes",setAttributeOnDowncast:_T}),r.registerDowncastStrategy({scope:"list",attributeName:"htmlUlAttributes",setAttributeOnDowncast:_T}),r.registerDowncastStrategy({scope:"list",attributeName:"htmlOlAttributes",setAttributeOnDowncast:_T}),i.on("register",((e,r)=>{if(!o.includes(r.view))return;if(e.stop(),t.checkAttribute("$block","htmlLiAttributes"))return;const s=o.map((e=>xT(e)));t.extend("$listItem",{allowAttributes:s}),n.for("upcast").add((e=>{e.on("element:ul",QT("htmlUlAttributes",i),{priority:"low"}),e.on("element:ol",QT("htmlOlAttributes",i),{priority:"low"}),e.on("element:li",QT("htmlLiAttributes",i),{priority:"low"})}))})),r.on("postFixer",((e,{listNodes:t,writer:n})=>{for(const{node:i,previousNodeInList:r}of t)if(r){if(r.getAttribute("listType")==i.getAttribute("listType")){const t=YT(r.getAttribute("listType")),s=r.getAttribute(t);!kd(i.getAttribute(t),s)&&n.model.schema.checkAttribute(i,t)&&(n.setAttribute(t,s,i),e.return=!0)}if(r.getAttribute("listItemId")==i.getAttribute("listItemId")){const t=r.getAttribute("htmlLiAttributes");!kd(i.getAttribute("htmlLiAttributes"),t)&&n.model.schema.checkAttribute(i,"htmlLiAttributes")&&(n.setAttribute("htmlLiAttributes",t,i),e.return=!0)}}})),r.on("postFixer",((e,{listNodes:t,writer:n})=>{for(const{node:i}of t){const t=i.getAttribute("listType");!s.isNumberedListType(t)&&i.getAttribute("htmlOlAttributes")&&(n.removeAttribute("htmlOlAttributes",i),e.return=!0),s.isNumberedListType(t)&&i.getAttribute("htmlUlAttributes")&&(n.removeAttribute("htmlUlAttributes",i),e.return=!0)}}))}afterInit(){const e=this.editor;if(!e.commands.get("indentList"))return;const t=e.commands.get("indentList");this.listenTo(t,"afterExecute",((t,n)=>{e.model.change((t=>{for(const i of n){const n=YT(i.getAttribute("listType"));e.model.schema.checkAttribute(i,n)&&t.setAttribute(n,{},i)}}))}))}}function QT(e,t){return(n,i,r)=>{const s=i.viewItem;i.modelRange||Object.assign(i,r.convertChildren(i.viewItem,i.modelCursor));const o=t.processViewAttributes(s,r);for(const t of i.modelRange.getItems({shallow:!0}))t.hasAttribute("listItemId")&&(t.hasAttribute("htmlUlAttributes")||t.hasAttribute("htmlOlAttributes")||r.writer.model.schema.checkAttribute(t,e)&&r.writer.setAttribute(e,o||{},t))}}function YT(e){return"numbered"===e||"customNumbered"==e?"htmlOlAttributes":"htmlUlAttributes"}class JT extends cf{static get requires(){return[NT,RT]}static get pluginName(){return"CustomElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.plugins.get(NT),t=this.editor.plugins.get(RT);e.on("register:$customElement",((n,i)=>{n.stop();const r=this.editor,s=r.model.schema,o=r.conversion,a=r.editing.view.domConverter.unsafeElements,l=r.data.htmlProcessor.domConverter.preElements;s.register(i.model,i.modelSchema),s.extend(i.model,{allowAttributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"],isContent:!0}),r.data.htmlProcessor.domConverter.registerRawContentMatcher({name:"template"}),o.for("upcast").elementToElement({view:/.*/,model:(n,s)=>{if("$comment"==n.name)return null;if(!function(e){try{document.createElement(e)}catch(e){return!1}return!0}(n.name))return null;if(t.getDefinitionsForView(n.name).size)return null;a.includes(n.name)||a.push(n.name),l.includes(n.name)||l.push(n.name);const o=s.writer.createElement(i.model,{htmlElementName:n.name}),c=e.processViewAttributes(n,s);let d;if(c&&s.writer.setAttribute("htmlCustomElementAttributes",c,o),n.is("element","template")&&n.getCustomProperty("$rawContent"))d=n.getCustomProperty("$rawContent");else{const e=new up(n.document).createDocumentFragment(n),t=r.data.htmlProcessor.domConverter.viewToDom(e),i=t.firstChild;for(;i.firstChild;)t.appendChild(i.firstChild);i.remove(),d=r.data.htmlProcessor.htmlWriter.getHtml(t)}s.writer.setAttribute("htmlContent",d,o);for(const{item:e}of r.editing.view.createRangeIn(n))s.consumable.consume(e,{name:!0});return o},converterPriority:"low"}),o.for("editingDowncast").elementToElement({model:{name:i.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(e,{writer:t})=>{const n=e.getAttribute("htmlElementName"),i=t.createRawElement(n);return e.hasAttribute("htmlCustomElementAttributes")&&_T(t,e.getAttribute("htmlCustomElementAttributes"),i),i}}),o.for("dataDowncast").elementToElement({model:{name:i.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(e,{writer:t})=>{const n=e.getAttribute("htmlElementName"),i=e.getAttribute("htmlContent"),r=t.createRawElement(n,null,((e,t)=>{t.setContentOf(e,i)}));return e.hasAttribute("htmlCustomElementAttributes")&&_T(t,e.getAttribute("htmlCustomElementAttributes"),r),r}})}))}}class XT extends cf{static get pluginName(){return"GeneralHtmlSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[NT,zT,$T,jT,WT,UT,qT,GT,KT,ZT,JT]}init(){const e=this.editor,t=e.plugins.get(NT);t.loadAllowedEmptyElementsConfig(e.config.get("htmlSupport.allowEmpty")||[]),t.loadAllowedConfig(e.config.get("htmlSupport.allow")||[]),t.loadDisallowedConfig(e.config.get("htmlSupport.disallow")||[])}getGhsAttributeNameForElement(e){const t=this.editor.plugins.get("DataSchema"),n=Array.from(t.getDefinitionsForView(e,!1)),i=n.find((e=>e.isInline&&!n[0].isObject));return i?i.model:xT(e)}addModelHtmlClass(e,t,n){const i=this.editor.model,r=this.getGhsAttributeNameForElement(e);i.change((e=>{for(const s of eS(i,n,r))kT(e,s,r,"classes",(e=>{for(const n of rc(t))e.add(n)}))}))}removeModelHtmlClass(e,t,n){const i=this.editor.model,r=this.getGhsAttributeNameForElement(e);i.change((e=>{for(const s of eS(i,n,r))kT(e,s,r,"classes",(e=>{for(const n of rc(t))e.delete(n)}))}))}setModelHtmlAttributes(e,t,n){const i=this.editor.model,r=this.getGhsAttributeNameForElement(e);i.change((e=>{for(const s of eS(i,n,r))kT(e,s,r,"attributes",(e=>{for(const[n,i]of Object.entries(t))e.set(n,i)}))}))}removeModelHtmlAttributes(e,t,n){const i=this.editor.model,r=this.getGhsAttributeNameForElement(e);i.change((e=>{for(const s of eS(i,n,r))kT(e,s,r,"attributes",(e=>{for(const n of rc(t))e.delete(n)}))}))}setModelHtmlStyles(e,t,n){const i=this.editor.model,r=this.getGhsAttributeNameForElement(e);i.change((e=>{for(const s of eS(i,n,r))kT(e,s,r,"styles",(e=>{for(const[n,i]of Object.entries(t))e.set(n,i)}))}))}removeModelHtmlStyles(e,t,n){const i=this.editor.model,r=this.getGhsAttributeNameForElement(e);i.change((e=>{for(const s of eS(i,n,r))kT(e,s,r,"styles",(e=>{for(const n of rc(t))e.delete(n)}))}))}}function*eS(e,t,n){if(t)if(!(Symbol.iterator in t)&&t.is("documentSelection")&&t.isCollapsed)e.schema.checkAttributeInSelection(t,n)&&(yield t);else for(const i of function(e,t,n){return!(Symbol.iterator in t)&&(t.is("node")||t.is("$text")||t.is("$textProxy"))?e.schema.checkAttribute(t,n)?[e.createRangeOn(t)]:[]:e.schema.getValidRanges(e.createSelection(t).getRanges(),n)}(e,t,n))yield*i.getItems({shallow:!0})}class tS extends cf{static get pluginName(){return"HtmlComment"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=new Map;e.data.processor.skipComments=!1,e.model.schema.addAttributeCheck(((e,t)=>{if(e.endsWith("$root")&&t.startsWith("$comment"))return!0})),e.conversion.for("upcast").elementToMarker({view:"$comment",model:e=>{const n=`$comment:${ka()}`,i=e.getCustomProperty("$rawContent");return t.set(n,i),n}}),e.conversion.for("dataDowncast").markerToElement({model:"$comment",view:(e,{writer:t})=>{let n;for(const t of this.editor.model.document.getRootNames())if(n=this.editor.model.document.getRoot(t),n.hasAttribute(e.markerName))break;const i=e.markerName,r=n.getAttribute(i),s=t.createUIElement("$comment");return t.setCustomProperty("$rawContent",r,s),s}}),e.model.document.registerPostFixer((n=>{let i=!1;const r=e.model.document.differ.getChangedMarkers().filter((e=>e.name.startsWith("$comment:")));for(const e of r){const{oldRange:r,newRange:s}=e.data;if(!r||!s||r.root!=s.root){if(r){const t=r.root;t.hasAttribute(e.name)&&(n.removeAttribute(e.name,t),i=!0)}if(s){const r=s.root;"$graveyard"==r.rootName?(n.removeMarker(e.name),i=!0):r.hasAttribute(e.name)||(n.setAttribute(e.name,t.get(e.name)||"",r),i=!0)}}}return i})),e.data.on("set",(()=>{for(const t of e.model.markers.getMarkersGroup("$comment"))this.removeHtmlComment(t.name)}),{priority:"high"}),e.model.on("deleteContent",((t,[n])=>{for(const t of n.getRanges()){const n=e.model.schema.getLimitElement(t),i=e.model.createPositionAt(n,0),r=e.model.createPositionAt(n,"end");let s;s=i.isTouching(t.start)&&r.isTouching(t.end)?this.getHtmlCommentsInRange(e.model.createRange(i,r)):this.getHtmlCommentsInRange(t,{skipBoundaries:!0});for(const e of s)this.removeHtmlComment(e)}}),{priority:"high"})}createHtmlComment(e,t){const n=ka(),i=this.editor.model,r=i.document.getRoot(e.root.rootName),s=`$comment:${n}`;return i.change((n=>{const i=n.createRange(e);return n.addMarker(s,{usingOperation:!0,affectsData:!0,range:i}),n.setAttribute(s,t,r),s}))}removeHtmlComment(e){const t=this.editor,n=t.model.markers.get(e);return!!n&&(t.model.change((e=>{e.removeMarker(n)})),!0)}getHtmlCommentData(e){const t=this.editor.model.markers.get(e);if(!t)return null;let n="";for(const t of this.editor.model.document.getRoots())if(t.hasAttribute(e)){n=t.getAttribute(e);break}return{content:n,position:t.getStart()}}getHtmlCommentsInRange(e,{skipBoundaries:t=!1}={}){const n=!t;return Array.from(this.editor.model.markers.getMarkersGroup("$comment")).filter((t=>function(e,t){const i=e.getRange().start;return(i.isAfter(t.start)||n&&i.isEqual(t.start))&&(i.isBefore(t.end)||n&&i.isEqual(t.end))}(t,e))).map((e=>e.name))}}class nS extends $m{toView(e){if(!/<(?:html|body|head|meta)(?:\s[^>]*)?>/i.test(e.trim().slice(0,1e4)))return super.toView(e);let t="",n="";e=(e=e.trim().replace(/<\?xml\s[^?]*\?>/i,(e=>(n=e,"")))).trim().replace(/^<!DOCTYPE\s[^>]*?>/i,(e=>(t=e,"")));const i=this._toDom(e),r=this.domConverter.domToView(i,{skipComments:this.skipComments}),s=new up(r.document);return s.setCustomProperty("$fullPageDocument",i.ownerDocument.documentElement.outerHTML,r),t&&s.setCustomProperty("$fullPageDocType",t,r),n&&s.setCustomProperty("$fullPageXmlDeclaration",n,r),r}toData(e){let t=super.toData(e);const n=e.getCustomProperty("$fullPageDocument"),i=e.getCustomProperty("$fullPageDocType"),r=e.getCustomProperty("$fullPageXmlDeclaration");return n&&(t=n.replace(/<\/body\s*>/,t+"$&"),i&&(t=i+"\n"+t),r&&(t=r+"\n"+t)),t}}class iS extends cf{static get pluginName(){return"FullPage"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=["$fullPageDocument","$fullPageDocType","$fullPageXmlDeclaration"];e.data.processor=new nS(e.data.viewDocument),e.model.schema.extend("$root",{allowAttributes:t}),e.data.on("toModel",((n,[i])=>{const r=e.model.document.getRoot();e.model.change((e=>{for(const n of t){const t=i.getCustomProperty(n);t&&e.setAttribute(n,t,r)}}))}),{priority:"low"}),e.data.on("toView",((e,[n])=>{if(!n.is("rootElement"))return;const i=n,r=e.return;if(!i.hasAttribute("$fullPageDocument"))return;const s=new up(r.document);for(const e of t){const t=i.getAttribute(e);t&&s.setCustomProperty(e,t,r)}}),{priority:"low"}),e.data.on("set",(()=>{const n=e.model.document.getRoot();e.model.change((e=>{for(const i of t)n.hasAttribute(i)&&e.removeAttribute(i,n)}))}),{priority:"high"}),e.data.on("get",((e,t)=>{t[0]||(t[0]={}),t[0].trim=!1}),{priority:"high"})}}const rS=function(e,t){var n=-1,i=Ms(e)?Array(e.length):[];return jC(e,(function(e,r,s){i[++n]=t(e,r,s)})),i},sS=function(e,t){return(wr(e)?Vc:rS)(e,hx(t))};function oS(e){return e.createContainerElement("figure",{class:"image"},[e.createEmptyElement("img"),e.createSlot("children")])}function aS(e,t){const n=e.plugins.get("ImageUtils"),i=e.plugins.has("ImageInlineEditing")&&e.plugins.has("ImageBlockEditing");return e=>n.isInlineImageView(e)?i&&("block"==e.getStyle("display")||e.findAncestor(n.isBlockImageView)?"imageBlock":"imageInline")!==t?null:r(e):null;function r(e){const t={name:!0};return e.hasAttribute("src")&&(t.attributes=["src"]),t}}function lS(e,t){const n=ac(t.getSelectedBlocks());return!n||e.isObject(n)||n.isEmpty&&"listItem"!=n.name?"imageBlock":"imageInline"}function cS(e){return e&&e.endsWith("px")?parseInt(e):null}function dS(e){const t=cS(e.getStyle("width")),n=cS(e.getStyle("height"));return!(!t||!n)}const uS=/^(image|image-inline)$/;class hS extends cf{_domEmitter=new(dl());static get pluginName(){return"ImageUtils"}static get isOfficialPlugin(){return!0}isImage(e){return this.isInlineImage(e)||this.isBlockImage(e)}isInlineImageView(e){return!!e&&e.is("element","img")}isBlockImageView(e){return!!e&&e.is("element","figure")&&e.hasClass("image")}insertImage(e={},t=null,n=null,i={}){const r=this.editor,s=r.model,o=s.document.selection,a=mS(r,t||o,n);e={...Object.fromEntries(o.getAttributes()),...e};for(const t in e)s.schema.checkAttribute(a,t)||delete e[t];return s.change((n=>{const{setImageSizes:r=!0}=i,o=n.createElement(a,e);return s.insertObject(o,t,null,{setSelection:"on",findOptimalPosition:t||"imageInline"==a?void 0:"auto"}),o.parent?(r&&this.setImageNaturalSizeAttributes(o),o):null}))}setImageNaturalSizeAttributes(e){const t=e.getAttribute("src");t&&(e.getAttribute("width")||e.getAttribute("height")||this.editor.model.change((n=>{const i=new ra.window.Image;this._domEmitter.listenTo(i,"load",(()=>{e.getAttribute("width")||e.getAttribute("height")||this.editor.model.enqueueChange(n.batch,(t=>{t.setAttribute("width",i.naturalWidth,e),t.setAttribute("height",i.naturalHeight,e)})),this._domEmitter.stopListening(i,"load")})),i.src=t})))}getClosestSelectedImageWidget(e){const t=e.getFirstPosition();if(!t)return null;const n=e.getSelectedElement();if(n&&this.isImageWidget(n))return n;let i=t.parent;for(;i;){if(i.is("element")&&this.isImageWidget(i))return i;i=i.parent}return null}getClosestSelectedImageElement(e){const t=e.getSelectedElement();return this.isImage(t)?t:e.getFirstPosition().findAncestor("imageBlock")}getImageWidgetFromImageView(e){return e.findAncestor({classes:uS})}isImageAllowed(){const e=this.editor.model.document.selection;return function(e,t){if("imageBlock"==mS(e,t,null)){const n=function(e,t){const n=Tk(e,t).start.parent;return n.isEmpty&&!n.is("element","$root")?n.parent:n}(t,e.model);if(e.model.schema.checkChild(n,"imageBlock"))return!0}else if(e.model.schema.checkChild(t.focus,"imageInline"))return!0;return!1}(this.editor,e)&&function(e){return[...e.focus.getAncestors()].every((e=>!e.is("element","imageBlock")))}(e)}toImageWidget(e,t,n){return t.setCustomProperty("image",!0,e),kk(e,t,{label:()=>{const t=this.findViewImgElement(e).getAttribute("alt");return t?`${t} ${n}`:n}})}isImageWidget(e){return!!e.getCustomProperty("image")&&_k(e)}isBlockImage(e){return!!e&&e.is("element","imageBlock")}isInlineImage(e){return!!e&&e.is("element","imageInline")}findViewImgElement(e){if(this.isInlineImageView(e))return e;const t=this.editor.editing.view;for(const{item:n}of t.createRangeIn(e))if(this.isInlineImageView(n))return n}destroy(){return this._domEmitter.stopListening(),super.destroy()}}function mS(e,t,n){const i=e.model.schema,r=e.config.get("image.insert.type");return e.plugins.has("ImageBlockEditing")?e.plugins.has("ImageInlineEditing")?n||("inline"===r?"imageInline":"auto"!==r?"imageBlock":t.is("selection")?lS(i,t):i.checkChild(t,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}const gS=new RegExp(String(/^(http(s)?:\/\/)?[\w-]+\.[\w.~:/[\]@!$&'()*+,;=%-]+/.source+/\.(jpg|jpeg|png|gif|ico|webp|JPG|JPEG|PNG|GIF|ICO|WEBP)/.source+/(\?[\w.~:/[\]@!$&'()*+,;=%-]*)?/.source+/(#[\w.~:/[\]@!$&'()*+,;=%-]*)?$/.source));class pS extends cf{static get requires(){return[Nx,hS,rA,qy]}static get pluginName(){return"AutoImage"}static get isOfficialPlugin(){return!0}_timeoutId;_positionToInsert;constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null}init(){const e=this.editor,t=e.model.document,n=e.plugins.get("ClipboardPipeline");this.listenTo(n,"inputTransformation",(()=>{const e=t.selection.getFirstRange(),n=Cg.fromPosition(e.start);n.stickiness="toPrevious";const i=Cg.fromPosition(e.end);i.stickiness="toNext",t.once("change:data",(()=>{this._embedImageBetweenPositions(n,i),n.detach(),i.detach()}),{priority:"high"})})),e.commands.get("undo").on("execute",(()=>{this._timeoutId&&(ra.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)}),{priority:"high"})}_embedImageBetweenPositions(e,t){const n=this.editor,i=new Bh(e,t),r=i.getWalker({ignoreElementEnd:!0}),s=Object.fromEntries(n.model.document.selection.getAttributes()),o=this.editor.plugins.get("ImageUtils");let a="";for(const e of r)e.item.is("$textProxy")&&(a+=e.item.data);a=a.trim(),a.match(gS)?(this._positionToInsert=Cg.fromPosition(e),this._timeoutId=setTimeout((()=>{n.commands.get("insertImage").isEnabled?(n.model.change((e=>{let t;this._timeoutId=null,e.remove(i),i.detach(),"$graveyard"!==this._positionToInsert.root.rootName&&(t=this._positionToInsert.toPosition()),o.insertImage({...s,src:a},t),this._positionToInsert.detach(),this._positionToInsert=null})),n.plugins.get("Delete").requestUndoOnBackspace()):i.detach()}),100)):i.detach()}}class fS extends uf{refresh(){const e=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled&&e.hasAttribute("alt")?this.value=e.getAttribute("alt"):this.value=!1}execute(e){const t=this.editor,n=t.plugins.get("ImageUtils"),i=t.model,r=n.getClosestSelectedImageElement(i.document.selection);i.change((t=>{t.setAttribute("alt",e.newValue,r)}))}}class bS extends cf{static get requires(){return[hS]}static get pluginName(){return"ImageTextAlternativeEditing"}static get isOfficialPlugin(){return!0}init(){this.editor.commands.add("imageTextAlternative",new fS(this.editor))}}class wS extends Lb{focusTracker;keystrokes;labeledInput;saveButtonView;cancelButtonView;_focusables;_focusCycler;constructor(e){super(e);const t=this.locale.t;this.focusTracker=new lc,this.keystrokes=new hc,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(t("Save"),Pf.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(t("Cancel"),Pf.cancel,"ck-button-cancel","cancel"),this._focusables=new mb,this._focusCycler=new Ub({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-text-alternative-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),this.keystrokes.listenTo(this.element),Fb({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(e,t,n,i){const r=new jb(this.locale);return r.set({label:e,icon:t,tooltip:!0}),r.extendTemplate({attributes:{class:n}}),i&&r.delegate("execute").to(this,i),r}_createLabeledInputView(){const e=this.locale.t,t=new Ew(this.locale,sv);return t.label=e("Text alternative"),t}}function vS(e){const t=e.editing.view,n=zw.defaultPositions,i=e.plugins.get("ImageUtils");return{target:t.domConverter.mapViewToDom(i.getClosestSelectedImageWidget(t.document.selection)),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast,n.viewportStickyNorth]}}class yS extends cf{_balloon;_form;static get requires(){return[sy]}static get pluginName(){return"ImageTextAlternativeUI"}static get isOfficialPlugin(){return!0}init(){this._createButton()}destroy(){super.destroy(),this._form&&this._form.destroy()}_createButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("imageTextAlternative",(n=>{const i=e.commands.get("imageTextAlternative"),r=new jb(n);return r.set({label:t("Change image text alternative"),icon:Pf.textAlternative,tooltip:!0}),r.bind("isEnabled").to(i,"isEnabled"),r.bind("isOn").to(i,"value",(e=>!!e)),this.listenTo(r,"execute",(()=>{this._showForm()})),r}))}_createForm(){const e=this.editor,t=e.editing.view.document,n=e.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(Bb(wS))(e.locale),this._form.render(),this.listenTo(this._form,"submit",(()=>{e.execute("imageTextAlternative",{newValue:this._form.labeledInput.fieldView.element.value}),this._hideForm(!0)})),this.listenTo(this._form,"cancel",(()=>{this._hideForm(!0)})),this._form.keystrokes.set("Esc",((e,t)=>{this._hideForm(!0),t()})),this.listenTo(e.ui,"update",(()=>{n.getClosestSelectedImageWidget(t.selection)?this._isVisible&&function(e){const t=e.plugins.get("ContextualBalloon");if(e.plugins.get("ImageUtils").getClosestSelectedImageWidget(e.editing.view.document.selection)){const n=vS(e);t.updatePosition(n)}}(e):this._hideForm(!0)})),Mb({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;this._form||this._createForm();const e=this.editor,t=e.commands.get("imageTextAlternative"),n=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:vS(e)}),n.fieldView.value=n.fieldView.element.value=t.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(e=!1){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus())}get _isVisible(){return!!this._balloon&&this._balloon.visibleView===this._form}get _isInBalloon(){return!!this._balloon&&this._balloon.hasView(this._form)}}class _S extends cf{static get requires(){return[bS,yS]}static get pluginName(){return"ImageTextAlternative"}static get isOfficialPlugin(){return!0}}function kS(e,t){const n=(t,n,i)=>{if(!i.consumable.consume(n.item,t.name))return;const r=i.writer,s=i.mapper.toViewElement(n.item),o=e.findViewImgElement(s);null===n.attributeNewValue?(r.removeAttribute("srcset",o),r.removeAttribute("sizes",o)):n.attributeNewValue&&(r.setAttribute("srcset",n.attributeNewValue,o),r.setAttribute("sizes","100vw",o))};return e=>{e.on(`attribute:srcset:${t}`,n)}}function xS(e,t,n){const i=(t,n,i)=>{if(!i.consumable.consume(n.item,t.name))return;const r=i.writer,s=i.mapper.toViewElement(n.item),o=e.findViewImgElement(s);r.setAttribute(n.attributeKey,n.attributeNewValue||"",o)};return e=>{e.on(`attribute:${n}:${t}`,i)}}class CS extends Zu{observe(e){this.listenTo(e,"load",((e,t)=>{const n=t.target;this.checkShouldIgnoreEventFromTarget(n)||"IMG"==n.tagName&&this._fireEvents(t)}),{useCapture:!0})}stopObserving(e){this.stopListening(e)}_fireEvents(e){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",e))}}class AS extends uf{constructor(e){super(e);const t=e.config.get("image.insert.type");e.plugins.has("ImageBlockEditing")||"block"===t&&Ea("image-block-plugin-required"),e.plugins.has("ImageInlineEditing")||"inline"===t&&Ea("image-inline-plugin-required")}refresh(){const e=this.editor.plugins.get("ImageUtils");this.isEnabled=e.isImageAllowed()}execute(e){const t=rc(e.source),n=this.editor.model.document.selection,i=this.editor.plugins.get("ImageUtils"),r=Object.fromEntries(n.getAttributes());t.forEach(((t,s)=>{const o=n.getSelectedElement();if("string"==typeof t&&(t={src:t}),s&&o&&i.isImage(o)){const n=this.editor.model.createPositionAfter(o);i.insertImage({...t,...r},n,e.imageType)}else e.breakBlock?i.insertImage({...t,...r},n.getFirstPosition(),e.imageType):i.insertImage({...t,...r},null,e.imageType)}))}}class ES extends uf{constructor(e){super(e),this.decorate("cleanupImage")}refresh(){const e=this.editor.plugins.get("ImageUtils"),t=this.editor.model.document.selection.getSelectedElement();this.isEnabled=e.isImage(t),this.value=this.isEnabled?t.getAttribute("src"):null}execute(e){const t=this.editor.model.document.selection.getSelectedElement(),n=this.editor.plugins.get("ImageUtils");this.editor.model.change((i=>{i.setAttribute("src",e.source,t),this.cleanupImage(i,t),n.setImageNaturalSizeAttributes(t)}))}cleanupImage(e,t){e.removeAttribute("srcset",t),e.removeAttribute("sizes",t),e.removeAttribute("sources",t),e.removeAttribute("width",t),e.removeAttribute("height",t),e.removeAttribute("alt",t)}}class TS extends cf{static get requires(){return[hS]}static get pluginName(){return"ImageEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.conversion;e.editing.view.addObserver(CS),t.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:"srcset"});const n=new AS(e),i=new ES(e);e.commands.add("insertImage",n),e.commands.add("replaceImageSource",i),e.commands.add("imageInsert",n)}}class SS extends cf{static get requires(){return[hS]}static get pluginName(){return"ImageSizeAttributes"}static get isOfficialPlugin(){return!0}afterInit(){this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline")}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["width","height"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["width","height"]})}_registerConverters(e){const t=this.editor,n=t.plugins.get("ImageUtils"),i="imageBlock"===e?"figure":"img";function r(t,i,r,s,o=!1){t.on(`attribute:${i}:${e}`,((t,i,a)=>{if(!a.consumable.consume(i.item,t.name))return;const l=a.writer,c=a.mapper.toViewElement(i.item),d=n.findViewImgElement(c);null!==i.attributeNewValue?l.setAttribute(r,i.attributeNewValue,d):l.removeAttribute(r,d);const u=i.item.getAttribute("width"),h=i.item.getAttribute("height"),m=u&&h;if(m&&o&&l.setAttribute("loading","lazy",d),i.item.hasAttribute("sources"))return;const g=i.item.hasAttribute("resizedWidth");("imageInline"!==e||g||s)&&m&&l.setStyle("aspect-ratio",`${u}/${h}`,d)}))}t.conversion.for("upcast").attributeToAttribute({view:{name:i,styles:{width:/.+/}},model:{key:"width",value:e=>dS(e)?cS(e.getStyle("width")):null}}).attributeToAttribute({view:{name:i,key:"width"},model:"width"}).attributeToAttribute({view:{name:i,styles:{height:/.+/}},model:{key:"height",value:e=>dS(e)?cS(e.getStyle("height")):null}}).attributeToAttribute({view:{name:i,key:"height"},model:"height"}),t.conversion.for("editingDowncast").add((e=>{r(e,"width","width",!0,!0),r(e,"height","height",!0,!0)})),t.conversion.for("dataDowncast").add((e=>{r(e,"width","width",!1),r(e,"height","height",!1)}))}}class PS extends uf{_modelElementName;constructor(e,t){super(e),this._modelElementName=t}refresh(){const e=this.editor.plugins.get("ImageUtils"),t=e.getClosestSelectedImageElement(this.editor.model.document.selection);"imageBlock"===this._modelElementName?this.isEnabled=e.isInlineImage(t):this.isEnabled=e.isBlockImage(t)}execute(e={}){const t=this.editor,n=this.editor.model,i=t.plugins.get("ImageUtils"),r=i.getClosestSelectedImageElement(n.document.selection),s=Object.fromEntries(r.getAttributes());return s.src||s.uploadId?n.change((t=>{const{setImageSizes:o=!0}=e,a=Array.from(n.markers).filter((e=>e.getRange().containsItem(r))),l=i.insertImage(s,n.createSelection(r,"on"),this._modelElementName,{setImageSizes:o});if(!l)return null;const c=t.createRangeOn(l);for(const e of a){const n=e.getRange(),i="$graveyard"!=n.root.rootName?n.getJoined(c,!0):c;t.updateMarker(e,{range:i})}return{oldElement:r,newElement:l}})):null}}class IS extends cf{static get requires(){return[hS]}static get pluginName(){return"ImagePlaceholder"}static get isOfficialPlugin(){return!0}afterInit(){this._setupSchema(),this._setupConversion(),this._setupLoadListener()}_setupSchema(){const e=this.editor.model.schema;e.isRegistered("imageBlock")&&e.extend("imageBlock",{allowAttributes:["placeholder"]}),e.isRegistered("imageInline")&&e.extend("imageInline",{allowAttributes:["placeholder"]})}_setupConversion(){const e=this.editor,t=e.conversion,n=e.plugins.get("ImageUtils");t.for("editingDowncast").add((e=>{e.on("attribute:placeholder",((e,t,i)=>{if(!i.consumable.test(t.item,e.name))return;if(!t.item.is("element","imageBlock")&&!t.item.is("element","imageInline"))return;i.consumable.consume(t.item,e.name);const r=i.writer,s=i.mapper.toViewElement(t.item),o=n.findViewImgElement(s);t.attributeNewValue?(r.addClass("image_placeholder",o),r.setStyle("background-image",`url(${t.attributeNewValue})`,o),r.setCustomProperty("editingPipeline:doNotReuseOnce",!0,o)):(r.removeClass("image_placeholder",o),r.removeStyle("background-image",o))}))}))}_setupLoadListener(){const e=this.editor,t=e.model,n=e.editing,i=n.view,r=e.plugins.get("ImageUtils");i.addObserver(CS),this.listenTo(i.document,"imageLoaded",((e,s)=>{const o=i.domConverter.mapDomToView(s.target);if(!o)return;const a=r.getImageWidgetFromImageView(o);if(!a)return;const l=n.mapper.toModelElement(a);l&&l.hasAttribute("placeholder")&&t.enqueueChange({isUndoable:!1},(e=>{e.removeAttribute("placeholder",l)}))}))}}class OS extends cf{static get requires(){return[TS,SS,hS,IS,vx]}static get pluginName(){return"ImageBlockEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),e.plugins.has("ImageInlineEditing")&&(e.commands.add("imageTypeBlock",new PS(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,n=e.conversion,i=e.plugins.get("ImageUtils");n.for("dataDowncast").elementToStructure({model:"imageBlock",view:(e,{writer:t})=>oS(t)}),n.for("editingDowncast").elementToStructure({model:"imageBlock",view:(e,{writer:n})=>i.toImageWidget(oS(n),n,t("image widget"))}),n.for("downcast").add(xS(i,"imageBlock","src")).add(xS(i,"imageBlock","alt")).add(kS(i,"imageBlock")),n.for("upcast").elementToElement({view:aS(e,"imageBlock"),model:(e,{writer:t})=>t.createElement("imageBlock",e.hasAttribute("src")?{src:e.getAttribute("src")}:void 0)}).add(function(e){const t=(t,n,i)=>{if(!i.consumable.test(n.viewItem,{name:!0,classes:"image"}))return;const r=e.findViewImgElement(n.viewItem);if(!r||!i.consumable.test(r,{name:!0}))return;i.consumable.consume(n.viewItem,{name:!0,classes:"image"});const s=ac(i.convertItem(r,n.modelCursor).modelRange.getItems());s?(i.convertChildren(n.viewItem,s),i.updateConversionResult(s,n)):i.consumable.revert(n.viewItem,{name:!0,classes:"image"})};return e=>{e.on("element:figure",t)}}(i))}_setupClipboardIntegration(){const e=this.editor,t=e.model,n=e.editing.view,i=e.plugins.get("ImageUtils"),r=e.plugins.get("ClipboardPipeline");this.listenTo(r,"inputTransformation",((r,s)=>{const o=Array.from(s.content.getChildren());let a;if(!o.every(i.isInlineImageView))return;a=s.targetRanges?e.editing.mapper.toModelRange(s.targetRanges[0]):t.document.selection.getFirstRange();const l=t.createSelection(a);if("imageBlock"===lS(t.schema,l)){const e=new up(n.document),t=o.map((t=>e.createElement("figure",{class:"image"},t)));s.content=e.createDocumentFragment(t)}})),this.listenTo(r,"contentInsertion",((e,n)=>{"paste"===n.method&&t.change((e=>{const t=e.createRangeIn(n.content);for(const e of t.getItems())e.is("element","imageBlock")&&i.setImageNaturalSizeAttributes(e)}))}))}}class VS extends Lb{focusTracker;keystrokes;_focusables;_focusCycler;children;constructor(e,t=[]){super(e),this.focusTracker=new lc,this.keystrokes=new hc,this._focusables=new mb,this.children=this.createCollection(),this._focusCycler=new Ub({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});for(const e of t)this.children.add(e),this._focusables.add(e),e instanceof ww&&this._focusables.addMany(e.children);this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-form"],tabindex:-1},children:this.children})}render(){super.render(),Fb({view:this});for(const e of this._focusables)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element);const e=e=>e.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}}class RS extends cf{static get pluginName(){return"ImageInsertUI"}static get isOfficialPlugin(){return!0}static get requires(){return[hS]}dropdownView;_integrations=new Map;constructor(e){super(e),e.config.define("image.insert.integrations",["upload","assetManager","url"])}init(){const e=this.editor,t=e.model.document.selection,n=e.plugins.get("ImageUtils");this.set("isImageSelected",!1),this.listenTo(e.model.document,"change",(()=>{this.isImageSelected=n.isImage(t.getSelectedElement())}));const i=e=>this._createToolbarComponent(e);e.ui.componentFactory.add("insertImage",i),e.ui.componentFactory.add("imageInsert",i),e.ui.componentFactory.add("menuBar:insertImage",(e=>this._createMenuBarComponent(e)))}registerIntegration({name:e,observable:t,buttonViewCreator:n,formViewCreator:i,menuBarButtonViewCreator:r,requiresForm:s=!1,override:o=!1}){this._integrations.has(e)&&!o&&Ea("image-insert-integration-exists",{name:e}),this._integrations.set(e,{observable:t,buttonViewCreator:n,menuBarButtonViewCreator:r,formViewCreator:i,requiresForm:s})}_createToolbarComponent(e){const t=this.editor,n=e.t,i=this._prepareIntegrations();if(!i.length)return null;let r;const s=i[0];if(1==i.length){if(!s.requiresForm)return s.buttonViewCreator(!0);r=s.buttonViewCreator(!0)}else{const t=s.buttonViewCreator(!1);r=new Qw(e,t),r.tooltip=!0,r.bind("label").to(this,"isImageSelected",(e=>n(e?"Replace image":"Insert image")))}const o=this.dropdownView=Yw(e,r),a=i.map((({observable:e})=>"function"==typeof e?e():e));return o.bind("isEnabled").toMany(a,"isEnabled",((...e)=>e.some((e=>e)))),o.once("change:isOpen",(()=>{const e=i.flatMap((({formViewCreator:e})=>e(1==i.length))),n=new VS(t.locale,e);o.panelView.children.add(n)})),o}_createMenuBarComponent(e){const t=e.t,n=this._prepareIntegrations();if(!n.length)return null;const i=n.flatMap((({menuBarButtonViewCreator:e})=>e(1==n.length))),r=new gy(e),s=new py(e);r.panelView.children.add(s),r.buttonView.set({icon:Pf.image,label:t("Image")});for(const t of i){const n=new Lv(e,r);n.children.add(t),s.items.add(n),t.delegate("execute").to(r)}return r}_prepareIntegrations(){const e=this.editor.config.get("image.insert.integrations"),t=[];if(!e.length)return Ea("image-insert-integrations-not-specified"),t;for(const n of e)this._integrations.has(n)?t.push(this._integrations.get(n)):["upload","assetManager","url"].includes(n)||Ea("image-insert-unknown-integration",{item:n});return t.length||Ea("image-insert-integrations-not-registered"),t}}class NS extends cf{static get requires(){return[OS,Dk,_S,RS]}static get pluginName(){return"ImageBlock"}static get isOfficialPlugin(){return!0}}class LS extends cf{static get requires(){return[TS,SS,hS,IS,vx]}static get pluginName(){return"ImageInlineEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.model.schema.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"],disallowIn:["caption"]}),this._setupConversion(),e.plugins.has("ImageBlockEditing")&&(e.commands.add("imageTypeInline",new PS(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,n=e.conversion,i=e.plugins.get("ImageUtils");n.for("dataDowncast").elementToElement({model:"imageInline",view:(e,{writer:t})=>t.createEmptyElement("img")}),n.for("editingDowncast").elementToStructure({model:"imageInline",view:(e,{writer:n})=>i.toImageWidget(function(e){return e.createContainerElement("span",{class:"image-inline"},e.createEmptyElement("img"))}(n),n,t("image widget"))}),n.for("downcast").add(xS(i,"imageInline","src")).add(xS(i,"imageInline","alt")).add(kS(i,"imageInline")),n.for("upcast").elementToElement({view:aS(e,"imageInline"),model:(e,{writer:t})=>t.createElement("imageInline",e.hasAttribute("src")?{src:e.getAttribute("src")}:void 0)})}_setupClipboardIntegration(){const e=this.editor,t=e.model,n=e.editing.view,i=e.plugins.get("ImageUtils"),r=e.plugins.get("ClipboardPipeline");this.listenTo(r,"inputTransformation",((r,s)=>{const o=Array.from(s.content.getChildren());let a;if(!o.every(i.isBlockImageView))return;a=s.targetRanges?e.editing.mapper.toModelRange(s.targetRanges[0]):t.document.selection.getFirstRange();const l=t.createSelection(a);if("imageInline"===lS(t.schema,l)){const e=new up(n.document),t=o.map((t=>1===t.childCount?(Array.from(t.getAttributes()).forEach((n=>e.setAttribute(...n,i.findViewImgElement(t)))),t.getChild(0)):t));s.content=e.createDocumentFragment(t)}})),this.listenTo(r,"contentInsertion",((e,n)=>{"paste"===n.method&&t.change((e=>{const t=e.createRangeIn(n.content);for(const e of t.getItems())e.is("element","imageInline")&&i.setImageNaturalSizeAttributes(e)}))}))}}class MS extends cf{static get requires(){return[LS,Dk,_S,RS]}static get pluginName(){return"ImageInline"}static get isOfficialPlugin(){return!0}}class BS extends cf{static get pluginName(){return"ImageCaptionUtils"}static get isOfficialPlugin(){return!0}static get requires(){return[hS]}getCaptionFromImageModelElement(e){for(const t of e.getChildren())if(t&&t.is("element","caption"))return t;return null}getCaptionFromModelSelection(e){const t=this.editor.plugins.get("ImageUtils"),n=e.getFirstPosition().findAncestor("caption");return n&&t.isBlockImage(n.parent)?n:null}matchImageCaptionViewElement(e){const t=this.editor.plugins.get("ImageUtils");return"figcaption"==e.name&&t.isBlockImageView(e.parent)?{name:!0}:null}}class FS extends uf{refresh(){const e=this.editor,t=e.plugins.get("ImageCaptionUtils"),n=e.plugins.get("ImageUtils");if(!e.plugins.has(OS))return this.isEnabled=!1,void(this.value=!1);const i=e.model.document.selection,r=i.getSelectedElement();if(!r){const e=t.getCaptionFromModelSelection(i);return this.isEnabled=!!e,void(this.value=!!e)}this.isEnabled=n.isImage(r),this.isEnabled?this.value=!!t.getCaptionFromImageModelElement(r):this.value=!1}execute(e={}){const{focusCaptionOnShow:t}=e;this.editor.model.change((e=>{this.value?this._hideImageCaption(e):this._showImageCaption(e,t)}))}_showImageCaption(e,t){const n=this.editor.model.document.selection,i=this.editor.plugins.get("ImageCaptionEditing"),r=this.editor.plugins.get("ImageUtils");let s=n.getSelectedElement();const o=i._getSavedCaption(s);r.isInlineImage(s)&&(this.editor.execute("imageTypeBlock"),s=n.getSelectedElement());const a=o||e.createElement("caption");e.append(a,s),t&&e.setSelection(a,"in")}_hideImageCaption(e){const t=this.editor,n=t.model.document.selection,i=t.plugins.get("ImageCaptionEditing"),r=t.plugins.get("ImageCaptionUtils");let s,o=n.getSelectedElement();o?s=r.getCaptionFromImageModelElement(o):(s=r.getCaptionFromModelSelection(n),o=s.parent),i._saveCaption(o,s),e.setSelection(o,"on"),e.remove(s)}}class DS extends cf{static get requires(){return[hS,BS]}static get pluginName(){return"ImageCaptionEditing"}static get isOfficialPlugin(){return!0}_savedCaptionsMap;constructor(e){super(e),this._savedCaptionsMap=new WeakMap}init(){const e=this.editor,t=e.model.schema;t.isRegistered("caption")?t.extend("caption",{allowIn:"imageBlock"}):t.register("caption",{allowIn:"imageBlock",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleImageCaption",new FS(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration(),this._registerCaptionReconversion()}_setupConversion(){const e=this.editor,t=e.editing.view,n=e.plugins.get("ImageUtils"),i=e.plugins.get("ImageCaptionUtils"),r=e.t;e.conversion.for("upcast").elementToElement({view:e=>i.matchImageCaptionViewElement(e),model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>n.isBlockImage(e.parent)?t.createContainerElement("figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(e,{writer:i})=>{if(!n.isBlockImage(e.parent))return null;const s=i.createEditableElement("figcaption");i.setCustomProperty("imageCaption",!0,s),s.placeholder=r("Enter image caption"),Ad({view:t,element:s,keepOnFocus:!0});const o=e.parent.getAttribute("alt");return Ek(s,i,{label:o?r("Caption for image: %0",[o]):r("Caption for the image")})}})}_setupImageTypeCommandsIntegration(){const e=this.editor,t=e.plugins.get("ImageUtils"),n=e.plugins.get("ImageCaptionUtils"),i=e.commands.get("imageTypeInline"),r=e.commands.get("imageTypeBlock"),s=e=>{if(!e.return)return;const{oldElement:i,newElement:r}=e.return;if(!i)return;if(t.isBlockImage(i)){const e=n.getCaptionFromImageModelElement(i);if(e)return void this._saveCaption(r,e)}const s=this._getSavedCaption(i);s&&this._saveCaption(r,s)};i&&this.listenTo(i,"execute",s,{priority:"low"}),r&&this.listenTo(r,"execute",s,{priority:"low"})}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?qh.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}_registerCaptionReconversion(){const e=this.editor,t=e.model,n=e.plugins.get("ImageUtils"),i=e.plugins.get("ImageCaptionUtils");t.document.on("change:data",(()=>{const r=t.document.differ.getChanges();for(const t of r){if("alt"!==t.attributeKey)continue;const r=t.range.start.nodeAfter;if(n.isBlockImage(r)){const t=i.getCaptionFromImageModelElement(r);if(!t)return;e.editing.reconvertItem(t)}}}))}}class zS extends cf{static get requires(){return[BS]}static get pluginName(){return"ImageCaptionUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view,n=e.plugins.get("ImageCaptionUtils"),i=e.t;e.ui.componentFactory.add("toggleImageCaption",(r=>{const s=e.commands.get("toggleImageCaption"),o=new jb(r);return o.set({icon:Pf.caption,tooltip:!0,isToggleable:!0}),o.bind("isOn","isEnabled").to(s,"value","isEnabled"),o.bind("label").to(s,"value",(e=>i(e?"Toggle caption off":"Toggle caption on"))),this.listenTo(o,"execute",(()=>{e.execute("toggleImageCaption",{focusCaptionOnShow:!0});const i=n.getCaptionFromModelSelection(e.model.document.selection);if(i){const n=e.editing.mapper.toViewElement(i);t.scrollToTheSelection(),t.change((e=>{e.addClass("image__caption_highlighted",n)}))}e.editing.view.focus()})),o}))}}class $S extends cf{static get requires(){return[DS,zS]}static get pluginName(){return"ImageCaption"}static get isOfficialPlugin(){return!0}}function jS(e){const t=e.map((e=>e.replace("+","\\+")));return new RegExp(`^image\\/(${t.join("|")})$`)}function HS(e,t){return e.type?e.type:t.match(/data:(image\/\w+);base64/)?t.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class WS extends cf{static get pluginName(){return"ImageUploadUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("uploadImage",(()=>this._createToolbarButton())),e.ui.componentFactory.add("imageUpload",(()=>this._createToolbarButton())),e.ui.componentFactory.add("menuBar:uploadImage",(()=>this._createMenuBarButton("standalone"))),e.plugins.has("ImageInsertUI")&&e.plugins.get("ImageInsertUI").registerIntegration({name:"upload",observable:()=>e.commands.get("uploadImage"),buttonViewCreator:()=>this._createToolbarButton(),formViewCreator:()=>this._createDropdownButton(),menuBarButtonViewCreator:e=>this._createMenuBarButton(e?"insertOnly":"insertNested")})}_createButton(e){const t=this.editor,n=t.locale,i=t.commands.get("uploadImage"),r=t.config.get("image.upload.types"),s=jS(r),o=new e(t.locale),a=n.t;return o.set({acceptedType:r.map((e=>`image/${e}`)).join(","),allowMultipleFiles:!0,label:a("Upload from computer"),icon:Pf.imageUpload}),o.bind("isEnabled").to(i),o.on("done",((e,n)=>{const i=Array.from(n).filter((e=>s.test(e.type)));i.length&&(t.execute("uploadImage",{file:i}),t.editing.view.focus())})),o}_createToolbarButton(){const e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),n=this.editor.commands.get("uploadImage"),i=this._createButton(mw);return i.tooltip=!0,i.bind("label").to(t,"isImageSelected",n,"isAccessAllowed",((t,n)=>e(n?t?"Replace image from computer":"Upload image from computer":"You have no image upload permissions."))),i}_createDropdownButton(){const e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),n=this._createButton(mw);return n.withText=!0,n.bind("label").to(t,"isImageSelected",(t=>e(t?"Replace from computer":"Upload from computer"))),n.on("execute",(()=>{t.dropdownView.isOpen=!1})),n}_createMenuBarButton(e){const t=this.editor.locale.t,n=this._createButton(by);switch(n.withText=!0,e){case"standalone":n.label=t("Image from computer");break;case"insertOnly":n.label=t("Image");break;case"insertNested":n.label=t("From computer")}return n}}class US extends cf{static get pluginName(){return"ImageUploadProgress"}static get isOfficialPlugin(){return!0}placeholder;constructor(e){super(e),this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}init(){const e=this.editor;e.plugins.has("ImageBlockEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",this.uploadStatusChange),e.plugins.has("ImageInlineEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",this.uploadStatusChange)}uploadStatusChange=(e,t,n)=>{const i=this.editor,r=t.item,s=r.getAttribute("uploadId");if(!n.consumable.consume(t.item,e.name))return;const o=i.plugins.get("ImageUtils"),a=i.plugins.get(Of),l=s?t.attributeNewValue:null,c=this.placeholder,d=i.editing.mapper.toViewElement(r),u=n.writer;if("reading"==l)return qS(d,u),void GS(o,c,d,u);if("uploading"==l){const e=a.loaders.get(s);return qS(d,u),void(e?(KS(d,u),function(e,t,n,i){const r=function(e){const t=e.createUIElement("div",{class:"ck-progress-bar"});return e.setCustomProperty("progressBar",!0,t),t}(t);t.insert(t.createPositionAt(e,"end"),r),n.on("change:uploadedPercent",((e,t,n)=>{i.change((e=>{e.setStyle("width",n+"%",r)}))}))}(d,u,e,i.editing.view),function(e,t,n,i){if(i.data){const r=e.findViewImgElement(t);n.setAttribute("src",i.data,r)}}(o,d,u,e)):GS(o,c,d,u))}"complete"==l&&a.loaders.get(s)&&function(e,t,n){const i=t.createUIElement("div",{class:"ck-image-upload-complete-icon"});t.insert(t.createPositionAt(e,"end"),i),setTimeout((()=>{n.change((e=>e.remove(e.createRangeOn(i))))}),3e3)}(d,u,i.editing.view),function(e,t){QS(e,t,"progressBar")}(d,u),KS(d,u),function(e,t){t.removeClass("ck-appear",e)}(d,u)}}function qS(e,t){e.hasClass("ck-appear")||t.addClass("ck-appear",e)}function GS(e,t,n,i){n.hasClass("ck-image-upload-placeholder")||i.addClass("ck-image-upload-placeholder",n);const r=e.findViewImgElement(n);r.getAttribute("src")!==t&&i.setAttribute("src",t,r),ZS(n,"placeholder")||i.insert(i.createPositionAfter(r),function(e){const t=e.createUIElement("div",{class:"ck-upload-placeholder-loader"});return e.setCustomProperty("placeholder",!0,t),t}(i))}function KS(e,t){e.hasClass("ck-image-upload-placeholder")&&t.removeClass("ck-image-upload-placeholder",e),QS(e,t,"placeholder")}function ZS(e,t){for(const n of e.getChildren())if(n.getCustomProperty(t))return n}function QS(e,t,n){const i=ZS(e,n);i&&t.remove(t.createRangeOn(i))}class YS extends uf{constructor(e){super(e),this.set("isAccessAllowed",!0)}refresh(){const e=this.editor,t=e.plugins.get("ImageUtils"),n=e.model.document.selection.getSelectedElement();this.isEnabled=t.isImageAllowed()||t.isImage(n)}execute(e){const t=rc(e.file),n=this.editor.model.document.selection,i=this.editor.plugins.get("ImageUtils"),r=Object.fromEntries(n.getAttributes());t.forEach(((e,t)=>{const s=n.getSelectedElement();if(t&&s&&i.isImage(s)){const t=this.editor.model.createPositionAfter(s);this._uploadImage(e,r,t)}else this._uploadImage(e,r)}))}_uploadImage(e,t,n){const i=this.editor,r=i.plugins.get(Of).createLoader(e),s=i.plugins.get("ImageUtils");r&&s.insertImage({...t,uploadId:r.id},n)}}class JS extends cf{static get requires(){return[Of,ny,vx,hS]}static get pluginName(){return"ImageUploadEditing"}static get isOfficialPlugin(){return!0}_uploadImageElements;_uploadedImages=new Map;constructor(e){super(e),e.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}init(){const e=this.editor,t=e.model.document,n=e.conversion,i=e.plugins.get(Of),r=e.plugins.get("ImageUtils"),s=e.plugins.get("ClipboardPipeline"),o=jS(e.config.get("image.upload.types")),a=new YS(e);e.commands.add("uploadImage",a),e.commands.add("imageUpload",a),n.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}).add((e=>e.on("element:img",((e,t,n)=>{if(!n.consumable.test(t.viewItem,{attributes:["data-ck-upload-id"]}))return;const r=t.viewItem.getAttribute("data-ck-upload-id");if(!r)return;const[s]=Array.from(t.modelRange.getItems({shallow:!0})),o=i.loaders.get(r);s&&(n.writer.setAttribute("uploadId",r,s),n.consumable.consume(t.viewItem,{attributes:["data-ck-upload-id"]}),o&&o.data&&n.writer.setAttribute("uploadStatus",o.status,s))}),{priority:"low"}))),this.listenTo(e.editing.view.document,"clipboardInput",((t,n)=>{if(i=n.dataTransfer,Array.from(i.types).includes("text/html")&&""!==i.getData("text/html"))return;var i;const r=Array.from(n.dataTransfer.files).filter((e=>!!e&&o.test(e.type)));if(r.length&&(t.stop(),e.model.change((t=>{n.targetRanges&&t.setSelection(n.targetRanges.map((t=>e.editing.mapper.toModelRange(t)))),e.execute("uploadImage",{file:r})})),!e.commands.get("uploadImage").isAccessAllowed)){const t=e.plugins.get("Notification"),n=e.locale.t;t.showWarning(n("You have no image upload permissions."),{namespace:"image"})}})),this.listenTo(s,"inputTransformation",((t,n)=>{const s=Array.from(e.editing.view.createRangeIn(n.content)).map((e=>e.item)).filter((e=>function(e,t){return!(!e.isInlineImageView(t)||!t.getAttribute("src")||!t.getAttribute("src").match(/^data:image\/\w+;base64,/g)&&!t.getAttribute("src").match(/^blob:/g))}(r,e)&&!e.getAttribute("uploadProcessed"))).map((e=>{return{promise:(t=e,new Promise(((e,n)=>{const i=t.getAttribute("src");fetch(i).then((e=>e.blob())).then((t=>{const n=HS(t,i),r=n.replace("image/",""),s=new File([t],`image.${r}`,{type:n});e(s)})).catch((t=>t&&"TypeError"===t.name?function(e){return function(e){return new Promise(((t,n)=>{const i=ra.document.createElement("img");i.addEventListener("load",(()=>{const e=ra.document.createElement("canvas");e.width=i.width,e.height=i.height,e.getContext("2d").drawImage(i,0,0),e.toBlob((e=>e?t(e):n()))})),i.addEventListener("error",(()=>n())),i.src=e}))}(e).then((t=>{const n=HS(t,e),i=n.replace("image/","");return new File([t],`image.${i}`,{type:n})}))}(i).then(e).catch(n):n(t)))}))),imageElement:e};var t}));if(!s.length)return;const o=new up(e.editing.view.document);for(const e of s){o.setAttribute("uploadProcessed",!0,e.imageElement);const t=i.createLoader(e.promise);t&&(o.setAttribute("src","",e.imageElement),o.setAttribute("uploadId",t.id,e.imageElement))}})),e.editing.view.document.on("dragover",((e,t)=>{t.preventDefault()})),t.on("change",(()=>{const n=t.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),r=new Set;for(const t of n)if("insert"==t.type&&"$text"!=t.name){const n=t.position.nodeAfter,s="$graveyard"==t.position.root.rootName;for(const t of XS(e,n)){const n=t.getAttribute("uploadId");if(!n)continue;const o=i.loaders.get(n);o?s?r.has(n)||Array.from(this._uploadImageElements.get(n)).every((e=>"$graveyard"==e.root.rootName))&&o.abort():(r.add(n),this._uploadImageElements.has(n)?this._uploadImageElements.get(n).add(t):this._uploadImageElements.set(n,new Set([t])),"idle"==o.status&&this._readAndUpload(o)):!s&&this._uploadedImages.has(n)&&e.model.enqueueChange({isUndoable:!1},(e=>{e.setAttribute("uploadStatus","complete",t),this.fire("uploadComplete",{data:this._uploadedImages.get(n),imageElement:t})}))}}})),this.on("uploadComplete",((e,{imageElement:t,data:n})=>{const i=n.urls?n.urls:n;this.editor.model.change((e=>{e.setAttribute("src",i.default,t),this._parseAndSetSrcsetAttributeOnImage(i,t,e),r.setImageNaturalSizeAttributes(t)}))}),{priority:"low"})}afterInit(){const e=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&(e.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this._registerConverters("imageBlock")),this.editor.plugins.has("ImageInlineEditing")&&(e.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]}),this._registerConverters("imageInline"))}_readAndUpload(e){const t=this.editor,n=t.model,i=t.locale.t,r=t.plugins.get(Of),s=t.plugins.get(ny),o=t.plugins.get("ImageUtils"),a=this._uploadImageElements;return n.enqueueChange({isUndoable:!1},(t=>{const n=a.get(e.id);for(const e of n)t.setAttribute("uploadStatus","reading",e)})),e.read().then((()=>{const r=e.upload();t.ui&&t.ui.ariaLiveAnnouncer.announce(i("Uploading image"));for(const i of a.get(e.id)){if(aa.isSafari){const e=t.editing.mapper.toViewElement(i),n=o.findViewImgElement(e);t.editing.view.once("render",(()=>{if(!n.parent)return;const e=t.editing.view.domConverter.mapViewToDom(n.parent);if(!e)return;const i=e.style.display;e.style.display="none",e._ckHack=e.offsetHeight,e.style.display=i}))}n.enqueueChange({isUndoable:!1},(e=>{e.setAttribute("uploadStatus","uploading",i)}))}return r})).then((r=>{n.enqueueChange({isUndoable:!1},(n=>{for(const t of a.get(e.id))n.setAttribute("uploadStatus","complete",t),this.fire("uploadComplete",{data:r,imageElement:t});t.ui&&t.ui.ariaLiveAnnouncer.announce(i("Image upload complete")),this._uploadedImages.set(e.id,r)})),l()})).catch((r=>{if(t.ui&&t.ui.ariaLiveAnnouncer.announce(i("Error during image upload")),"error"!==e.status&&"aborted"!==e.status)throw r;"error"==e.status&&r&&s.showWarning(r,{title:i("Upload failed"),namespace:"upload"}),n.enqueueChange({isUndoable:!1},(t=>{for(const n of a.get(e.id))"$graveyard"!==n.root.rootName&&t.remove(n)})),l()}));function l(){n.enqueueChange({isUndoable:!1},(t=>{for(const n of a.get(e.id))t.removeAttribute("uploadId",n),t.removeAttribute("uploadStatus",n);a.delete(e.id)})),r.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,n){let i=0;const r=Object.keys(e).filter((e=>{const t=parseInt(e,10);if(!isNaN(t))return i=Math.max(i,t),!0})).map((t=>`${e[t]} ${t}w`)).join(", ");if(""!=r){const e={srcset:r};t.hasAttribute("width")||t.hasAttribute("height")||(e.width=i),n.setAttributes(e,t)}}_registerConverters(e){const{conversion:t,plugins:n}=this.editor,i=n.get(Of),r=n.get(hS);t.for("dataDowncast").add((t=>{t.on(`attribute:uploadId:${e}`,((e,t,n)=>{if(!n.consumable.test(t.item,e.name))return;const s=i.loaders.get(t.attributeNewValue);if(!s||!s.data)return null;const o=n.mapper.toViewElement(t.item),a=r.findViewImgElement(o);a&&(n.consumable.consume(t.item,e.name),n.writer.setAttribute("data-ck-upload-id",s.id,a))}))}))}}function XS(e,t){const n=e.plugins.get("ImageUtils");return Array.from(e.model.createRangeOn(t)).filter((e=>n.isImage(e.item))).map((e=>e.item))}class eP extends cf{static get pluginName(){return"ImageUpload"}static get isOfficialPlugin(){return!0}static get requires(){return[JS,WS,US]}}class tP extends Lb{urlInputView;keystrokes;constructor(e){super(e),this.set("imageURLInputValue",""),this.set("isImageSelected",!1),this.set("isEnabled",!0),this.keystrokes=new hc,this.urlInputView=this._createUrlInputView(),this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-url"],tabindex:"-1"},children:[this.urlInputView,{tag:"div",attributes:{class:["ck","ck-image-insert-url__action-row"]}}]})}render(){super.render(),Fb({view:this}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.keystrokes.destroy()}_createUrlInputView(){const e=this.locale,t=e.t,n=new Ew(e,sv);return n.bind("label").to(this,"isImageSelected",(e=>t(e?"Update image URL":"Insert image via URL"))),n.bind("isEnabled").to(this),n.fieldView.inputMode="url",n.fieldView.placeholder="https://example.com/image.png",n.fieldView.bind("value").to(this,"imageURLInputValue",(e=>e||"")),n.fieldView.on("input",(()=>{this.imageURLInputValue=n.fieldView.element.value.trim()})),n}focus(){this.urlInputView.focus()}}class nP extends cf{_imageInsertUI;_formView;static get pluginName(){return"ImageInsertViaUrlUI"}static get isOfficialPlugin(){return!0}static get requires(){return[RS,nw]}init(){this.editor.ui.componentFactory.add("insertImageViaUrl",(()=>this._createToolbarButton())),this.editor.ui.componentFactory.add("menuBar:insertImageViaUrl",(()=>this._createMenuBarButton("standalone")))}afterInit(){this._imageInsertUI=this.editor.plugins.get("ImageInsertUI"),this._imageInsertUI.registerIntegration({name:"url",observable:()=>this.editor.commands.get("insertImage"),buttonViewCreator:()=>this._createToolbarButton(),formViewCreator:()=>this._createDropdownButton(),menuBarButtonViewCreator:e=>this._createMenuBarButton(e?"insertOnly":"insertNested")})}_createInsertUrlButton(e){const t=new e(this.editor.locale);return t.icon=Pf.imageUrl,t.on("execute",(()=>{this._showModal()})),t}_createToolbarButton(){const e=this.editor.locale.t,t=this._createInsertUrlButton(jb);return t.tooltip=!0,t.bind("label").to(this._imageInsertUI,"isImageSelected",(t=>e(t?"Update image URL":"Insert image via URL"))),t}_createDropdownButton(){const e=this.editor.locale.t,t=this._createInsertUrlButton(jb);return t.withText=!0,t.bind("label").to(this._imageInsertUI,"isImageSelected",(t=>e(t?"Update image URL":"Insert via URL"))),t}_createMenuBarButton(e){const t=this.editor.locale.t,n=this._createInsertUrlButton(sw);switch(n.withText=!0,e){case"standalone":n.label=t("Image via URL");break;case"insertOnly":n.label=t("Image");break;case"insertNested":n.label=t("Via URL")}return n}_createInsertUrlView(){const e=this.editor,t=e.locale,n=e.commands.get("replaceImageSource"),i=e.commands.get("insertImage"),r=new tP(t);return r.bind("isImageSelected").to(this._imageInsertUI),r.bind("isEnabled").toMany([i,n],"isEnabled",((...e)=>e.some((e=>e)))),r}_showModal(){const e=this.editor,t=e.locale.t,n=e.plugins.get("Dialog");this._formView||(this._formView=this._createInsertUrlView(),this._formView.on("submit",(()=>this._handleSave())));const i=e.commands.get("replaceImageSource");this._formView.imageURLInputValue=i.value||"",n.show({id:"insertImageViaUrl",title:this._imageInsertUI.isImageSelected?t("Update image URL"):t("Insert image via URL"),isModal:!0,content:this._formView,actionButtons:[{label:t("Cancel"),withText:!0,onExecute:()=>n.hide()},{label:t("Accept"),class:"ck-button-action",withText:!0,onExecute:()=>this._handleSave()}]})}_handleSave(){this.editor.commands.get("replaceImageSource").isEnabled?this.editor.execute("replaceImageSource",{source:this._formView.imageURLInputValue}):this.editor.execute("insertImage",{source:this._formView.imageURLInputValue}),this.editor.plugins.get("Dialog").hide()}}class iP extends cf{static get pluginName(){return"ImageInsertViaUrl"}static get isOfficialPlugin(){return!0}static get requires(){return[nP,RS]}}class rP extends cf{static get pluginName(){return"ImageInsert"}static get isOfficialPlugin(){return!0}static get requires(){return[eP,iP,RS]}}class sP extends uf{refresh(){const e=this.editor,t=e.plugins.get("ImageUtils").getClosestSelectedImageElement(e.model.document.selection);this.isEnabled=!!t,t&&t.hasAttribute("resizedWidth")?this.value={width:t.getAttribute("resizedWidth"),height:null}:this.value=null}execute(e){const t=this.editor,n=t.model,i=t.plugins.get("ImageUtils"),r=i.getClosestSelectedImageElement(n.document.selection);this.value={width:e.width,height:null},r&&n.change((t=>{t.setAttribute("resizedWidth",e.width,r),t.removeAttribute("resizedHeight",r),i.setImageNaturalSizeAttributes(r)}))}}class oP extends cf{static get requires(){return[hS]}static get pluginName(){return"ImageResizeEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:custom",value:"custom",icon:"custom"},{name:"resizeImage:25",value:"25",icon:"small"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"}]})}init(){const e=this.editor,t=new sP(e);this._registerConverters("imageBlock"),this._registerConverters("imageInline"),e.commands.add("resizeImage",t),e.commands.add("imageResize",t)}afterInit(){this._registerSchema()}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["resizedWidth","resizedHeight"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["resizedWidth","resizedHeight"]})}_registerConverters(e){const t=this.editor,n=t.plugins.get("ImageUtils");t.conversion.for("downcast").add((t=>t.on(`attribute:resizedWidth:${e}`,((e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;const i=n.writer,r=n.mapper.toViewElement(t.item);null!==t.attributeNewValue?(i.setStyle("width",t.attributeNewValue,r),i.addClass("image_resized",r)):(i.removeStyle("width",r),i.removeClass("image_resized",r))})))),t.conversion.for("dataDowncast").attributeToAttribute({model:{name:e,key:"resizedHeight"},view:e=>({key:"style",value:{height:e}})}),t.conversion.for("editingDowncast").add((t=>t.on(`attribute:resizedHeight:${e}`,((t,i,r)=>{if(!r.consumable.consume(i.item,t.name))return;const s=r.writer,o=r.mapper.toViewElement(i.item),a="imageInline"===e?n.findViewImgElement(o):o;null!==i.attributeNewValue?s.setStyle("height",i.attributeNewValue,a):s.removeStyle("height",a)})))),t.conversion.for("upcast").attributeToAttribute({view:{name:"imageBlock"===e?"figure":"img",styles:{width:/.+/}},model:{key:"resizedWidth",value:e=>dS(e)?null:e.getStyle("width")}}),t.conversion.for("upcast").attributeToAttribute({view:{name:"imageBlock"===e?"figure":"img",styles:{height:/.+/}},model:{key:"resizedHeight",value:e=>dS(e)?null:e.getStyle("height")}})}}const aP=(()=>({small:Pf.objectSizeSmall,medium:Pf.objectSizeMedium,large:Pf.objectSizeLarge,custom:Pf.objectSizeCustom,original:Pf.objectSizeFull}))();class lP extends cf{static get requires(){return[oP]}static get pluginName(){return"ImageResizeButtons"}static get isOfficialPlugin(){return!0}_resizeUnit;constructor(e){super(e),this._resizeUnit=e.config.get("image.resizeUnit")}init(){const e=this.editor,t=e.config.get("image.resizeOptions"),n=e.commands.get("resizeImage");this.bind("isEnabled").to(n);for(const e of t)this._registerImageResizeButton(e);this._registerImageResizeDropdown(t)}_registerImageResizeButton(e){const t=this.editor,{name:n,value:i,icon:r}=e;t.ui.componentFactory.add(n,(n=>{const s=new jb(n),o=t.commands.get("resizeImage"),a=this._getOptionLabelValue(e,!0);if(!aP[r])throw new Aa("imageresizebuttons-missing-icon",t,e);if(s.set({label:a,icon:aP[r],tooltip:a,isToggleable:!0}),s.bind("isEnabled").to(this),t.plugins.has("ImageCustomResizeUI")&&cP(e)){const e=t.plugins.get("ImageCustomResizeUI");this.listenTo(s,"execute",(()=>{e._showForm(this._resizeUnit)}))}else{const e=i?i+this._resizeUnit:null;s.bind("isOn").to(o,"value",dP(e)),this.listenTo(s,"execute",(()=>{t.execute("resizeImage",{width:e})}))}return s}))}_registerImageResizeDropdown(e){const t=this.editor,n=t.t,i=e.find((e=>!e.value)),r=r=>{const s=t.commands.get("resizeImage"),o=Yw(r,Rw),a=o.buttonView,l=n("Resize image");return a.set({tooltip:l,commandValue:i.value,icon:aP.medium,isToggleable:!0,label:this._getOptionLabelValue(i),withText:!0,class:"ck-resize-image-button",ariaLabel:l,ariaLabelledBy:void 0}),a.bind("label").to(s,"value",(e=>e&&e.width?e.width:this._getOptionLabelValue(i))),o.bind("isEnabled").to(this),ev(o,(()=>this._getResizeDropdownListItemDefinitions(e,s)),{ariaLabel:n("Image resize list"),role:"menu"}),this.listenTo(o,"execute",(e=>{"onClick"in e.source?e.source.onClick():(t.execute(e.source.commandName,{width:e.source.commandValue}),t.editing.view.focus())})),o};t.ui.componentFactory.add("resizeImage",r),t.ui.componentFactory.add("imageResize",r)}_getOptionLabelValue(e,t=!1){const n=this.editor.t;return e.label?e.label:t?cP(e)?n("Custom image size"):e.value?n("Resize image to %0",e.value+this._resizeUnit):n("Resize image to the original size"):cP(e)?n("Custom"):e.value?e.value+this._resizeUnit:n("Original")}_getResizeDropdownListItemDefinitions(e,t){const{editor:n}=this,i=new oc,r=e.map((e=>cP(e)?{...e,valueWithUnits:"custom"}:e.value?{...e,valueWithUnits:`${e.value}${this._resizeUnit}`}:{...e,valueWithUnits:null}));for(const e of r){let s=null;if(n.plugins.has("ImageCustomResizeUI")&&cP(e)){const i=n.plugins.get("ImageCustomResizeUI");s={type:"button",model:new iy({label:this._getOptionLabelValue(e),role:"menuitemradio",withText:!0,icon:null,onClick:()=>{i._showForm(this._resizeUnit)}})};const o=sS(r,"valueWithUnits");s.model.bind("isOn").to(t,"value",uP(o))}else s={type:"button",model:new iy({commandName:"resizeImage",commandValue:e.valueWithUnits,label:this._getOptionLabelValue(e),role:"menuitemradio",withText:!0,icon:null})},s.model.bind("isOn").to(t,"value",dP(e.valueWithUnits));s.model.bind("isEnabled").to(t,"isEnabled"),i.add(s)}return i}}function cP(e){return"custom"===e.value}function dP(e){return t=>null===e&&t===e||null!==t&&t.width===e}function uP(e){return t=>!e.some((e=>dP(e)(t)))}const hP="image_resized";class mP extends cf{static get requires(){return[qk,hS]}static get pluginName(){return"ImageResizeHandles"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.commands.get("resizeImage");this.bind("isEnabled").to(e),this._setupResizerCreator()}_setupResizerCreator(){const e=this.editor,t=e.editing.view,n=e.plugins.get("ImageUtils");t.addObserver(CS),this.listenTo(t.document,"imageLoaded",((i,r)=>{if(!r.target.matches("figure.image.ck-widget > img,figure.image.ck-widget > picture > img,figure.image.ck-widget > a > img,figure.image.ck-widget > a > picture > img,span.image-inline.ck-widget > img,span.image-inline.ck-widget > picture > img"))return;const s=e.editing.view.domConverter,o=s.domToView(r.target),a=n.getImageWidgetFromImageView(o);let l=this.editor.plugins.get(qk).getResizerByViewElement(a);if(l)return void l.redraw();const c=e.editing.mapper,d=c.toModelElement(a);l=e.plugins.get(qk).attachTo({unit:e.config.get("image.resizeUnit"),modelElement:d,viewElement:a,editor:e,getHandleHost:e=>e.querySelector("img"),getResizeHost:()=>s.mapViewToDom(c.toViewElement(d)),isCentered:()=>"alignCenter"==d.getAttribute("imageStyle"),onCommit(n){t.change((e=>{e.removeClass(hP,a)})),e.execute("resizeImage",{width:n})}}),l.on("updateSize",(()=>{a.hasClass(hP)||t.change((e=>{e.addClass(hP,a)}));const e="imageInline"===d.name?o:a;e.getStyle("height")&&t.change((t=>{t.removeStyle("height",e)}))})),l.bind("isEnabled").to(this)}))}}function gP(e){if(!e)return null;const[,t,n]=e.trim().match(/([.,\d]+)(%|px)$/)||[],i=Number.parseFloat(t);return Number.isNaN(i)?null:{value:i,unit:n}}function pP(e,t,n){return"px"===n?{value:t.value,unit:"px"}:{value:t.value/e*100,unit:"%"}}function fP(e){const{editing:t}=e,n=e.plugins.get("ImageUtils").getClosestSelectedImageElement(e.model.document.selection);if(!n)return null;const i=t.mapper.toViewElement(n);return{model:n,view:i,dom:t.view.domConverter.mapViewToDom(i)}}class bP extends Lb{focusTracker;keystrokes;unit;labeledInput;saveButtonView;cancelButtonView;_focusables;_focusCycler;_validators;constructor(e,t,n){super(e);const i=this.locale.t;this.focusTracker=new lc,this.keystrokes=new hc,this.unit=t,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(i("Save"),Pf.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(i("Cancel"),Pf.cancel,"ck-button-cancel","cancel"),this._focusables=new mb,this._validators=n,this._focusCycler=new Ub({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-custom-resize-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),this.keystrokes.listenTo(this.element),Fb({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(e,t,n,i){const r=new jb(this.locale);return r.set({label:e,icon:t,tooltip:!0}),r.extendTemplate({attributes:{class:n}}),i&&r.delegate("execute").to(this,i),r}_createLabeledInputView(){const e=this.locale.t,t=new Ew(this.locale,ov);return t.label=e("Resize image (in %0)",this.unit),t.fieldView.set({step:.1}),t}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.labeledInput.errorText=t,!1}return!0}resetFormStatus(){this.labeledInput.errorText=null}get rawSize(){const{element:e}=this.labeledInput.fieldView;return e?e.value:null}get parsedSize(){const{rawSize:e}=this;if(null===e)return null;const t=Number.parseFloat(e);return Number.isNaN(t)?null:t}get sizeWithUnits(){const{parsedSize:e,unit:t}=this;return null===e?null:`${e}${t}`}}class wP extends cf{_balloon;_form;static get requires(){return[sy]}static get pluginName(){return"ImageCustomResizeUI"}static get isOfficialPlugin(){return!0}destroy(){super.destroy(),this._form&&this._form.destroy()}_createForm(e){const t=this.editor;this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(Bb(bP))(t.locale,e,function(e){const t=e.t;return[e=>""===e.rawSize.trim()?t("The value must not be empty."):null===e.parsedSize?t("The value should be a plain number."):void 0]}(t)),this._form.render(),this.listenTo(this._form,"submit",(()=>{this._form.isValid()&&(t.execute("resizeImage",{width:this._form.sizeWithUnits}),this._hideForm(!0))})),this.listenTo(this._form.labeledInput,"change:errorText",(()=>{t.ui.update()})),this.listenTo(this._form,"cancel",(()=>{this._hideForm(!0)})),this._form.keystrokes.set("Esc",((e,t)=>{this._hideForm(!0),t()})),Mb({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(e){if(this._isVisible)return;this._form||this._createForm(e);const t=this.editor,n=this._form.labeledInput;this._form.disableCssTransitions(),this._form.resetFormStatus(),this._isInBalloon||this._balloon.add({view:this._form,position:vS(t)});const i=function(e,t){const n=fP(e);if(!n)return null;const i=gP(n.model.getAttribute("resizedWidth")||null);return i?i.unit===t?i:pP(Pk(n.dom),{value:new vl(n.dom).width},t):null}(t,e),r=i?i.value.toFixed(1):"",s=function(e,t){const n=fP(e);if(!n)return null;const i=Pk(n.dom),r=gP(window.getComputedStyle(n.dom).minWidth)||{value:1};return{unit:t,lower:Math.max(.1,pP(i,r,t).value),upper:"px"===t?i:100}}(t,e);n.fieldView.value=n.fieldView.element.value=r,s&&Object.assign(n.fieldView,{min:s.lower.toFixed(1),max:Math.ceil(s.upper).toFixed(1)}),this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(e=!1){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus())}get _isVisible(){return!!this._balloon&&this._balloon.visibleView===this._form}get _isInBalloon(){return!!this._balloon&&this._balloon.hasView(this._form)}}class vP extends cf{static get requires(){return[oP,mP,wP,lP]}static get pluginName(){return"ImageResize"}static get isOfficialPlugin(){return!0}}class yP extends uf{_defaultStyles;_styles;constructor(e,t){super(e),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(t.map((e=>{if(e.isDefault)for(const t of e.modelElements)this._defaultStyles[t]=e.name;return[e.name,e]})))}refresh(){const e=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled?e.hasAttribute("imageStyle")?this.value=e.getAttribute("imageStyle"):this.value=this._defaultStyles[e.name]:this.value=!1}execute(e={}){const t=this.editor,n=t.model,i=t.plugins.get("ImageUtils");n.change((t=>{const r=e.value,{setImageSizes:s=!0}=e;let o=i.getClosestSelectedImageElement(n.document.selection);r&&this.shouldConvertImageType(r,o)&&(this.editor.execute(i.isBlockImage(o)?"imageTypeInline":"imageTypeBlock",{setImageSizes:s}),o=i.getClosestSelectedImageElement(n.document.selection)),!r||this._styles.get(r).isDefault?t.removeAttribute("imageStyle",o):t.setAttribute("imageStyle",r,o),s&&i.setImageNaturalSizeAttributes(o)}))}shouldConvertImageType(e,t){return!this._styles.get(e).modelElements.includes(t.name)}}const _P={get inline(){return{name:"inline",title:"In line",icon:Pf.objectInline,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:Pf.objectLeft,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:Pf.objectBlockLeft,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:Pf.objectCenter,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:Pf.objectRight,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:Pf.objectBlockRight,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:Pf.objectCenter,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:Pf.objectRight,modelElements:["imageBlock"],className:"image-style-side"}}},kP=(()=>({full:Pf.objectFullWidth,left:Pf.objectBlockLeft,right:Pf.objectBlockRight,center:Pf.objectCenter,inlineLeft:Pf.objectLeft,inlineRight:Pf.objectRight,inline:Pf.objectInline}))(),xP=[{name:"imageStyle:wrapText",title:"Wrap text",defaultItem:"imageStyle:alignLeft",items:["imageStyle:alignLeft","imageStyle:alignRight"]},{name:"imageStyle:breakText",title:"Break text",defaultItem:"imageStyle:block",items:["imageStyle:alignBlockLeft","imageStyle:block","imageStyle:alignBlockRight"]}];function CP(e){Ea("image-style-configuration-definition-invalid",e)}var AP={normalizeStyles:function(e){return(e.configuredStyles.options||[]).map((e=>{return"string"==typeof(t="string"==typeof(t=e)?_P[t]?{..._P[t]}:{name:t}:function(e,t){const n={...t};for(const i in e)Object.prototype.hasOwnProperty.call(t,i)||(n[i]=e[i]);return n}(_P[t.name],t)).icon&&(t.icon=kP[t.icon]||t.icon),t;var t})).filter((t=>function(e,{isBlockPluginLoaded:t,isInlinePluginLoaded:n}){const{modelElements:i,name:r}=e;if(!(i&&i.length&&r))return CP({style:e}),!1;{const r=[t?"imageBlock":null,n?"imageInline":null];if(!i.some((e=>r.includes(e))))return Ea("image-style-missing-dependency",{style:e,missingPlugins:i.map((e=>"imageBlock"===e?"ImageBlockEditing":"ImageInlineEditing"))}),!1}return!0}(t,e)))},getDefaultStylesConfiguration:function(e,t){return e&&t?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:e?{options:["block","side"]}:t?{options:["inline","alignLeft","alignRight"]}:{}},getDefaultDropdownDefinitions:function(e){return e.has("ImageBlockEditing")&&e.has("ImageInlineEditing")?[...xP]:[]},warnInvalidStyle:CP,DEFAULT_OPTIONS:_P,DEFAULT_ICONS:kP,DEFAULT_DROPDOWN_DEFINITIONS:xP};function EP(e,t){for(const n of t)if(n.name===e)return n}class TP extends cf{static get pluginName(){return"ImageStyleEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[hS]}normalizedStyles;init(){const{normalizeStyles:e,getDefaultStylesConfiguration:t}=AP,n=this.editor,i=n.plugins.has("ImageBlockEditing"),r=n.plugins.has("ImageInlineEditing");n.config.define("image.styles",t(i,r)),this.normalizedStyles=e({configuredStyles:n.config.get("image.styles"),isBlockPluginLoaded:i,isInlinePluginLoaded:r}),this._setupConversion(i,r),this._setupPostFixer(),n.commands.add("imageStyle",new yP(n,this.normalizedStyles))}_setupConversion(e,t){const n=this.editor,i=n.model.schema,r=(s=this.normalizedStyles,(e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;const i=EP(t.attributeNewValue,s),r=EP(t.attributeOldValue,s),o=n.mapper.toViewElement(t.item),a=n.writer;r&&a.removeClass(r.className,o),i&&a.addClass(i.className,o)});var s;const o=function(e){const t={imageInline:e.filter((e=>!e.isDefault&&e.modelElements.includes("imageInline"))),imageBlock:e.filter((e=>!e.isDefault&&e.modelElements.includes("imageBlock")))};return(e,n,i)=>{if(!n.modelRange)return;const r=n.viewItem,s=ac(n.modelRange.getItems());if(s&&i.schema.checkAttribute(s,"imageStyle"))for(const e of t[s.name])i.consumable.consume(r,{classes:e.className})&&i.writer.setAttribute("imageStyle",e.name,s)}}(this.normalizedStyles);n.editing.downcastDispatcher.on("attribute:imageStyle",r),n.data.downcastDispatcher.on("attribute:imageStyle",r),e&&(i.extend("imageBlock",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:figure",o,{priority:"low"})),t&&(i.extend("imageInline",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:img",o,{priority:"low"}))}_setupPostFixer(){const e=this.editor,t=e.model.document,n=e.plugins.get(hS),i=new Map(this.normalizedStyles.map((e=>[e.name,e])));t.registerPostFixer((e=>{let r=!1;for(const s of t.differ.getChanges())if("insert"==s.type||"attribute"==s.type&&"imageStyle"==s.attributeKey){let t="insert"==s.type?s.position.nodeAfter:s.range.start.nodeAfter;if(t&&t.is("element","paragraph")&&t.childCount>0&&(t=t.getChild(0)),!n.isImage(t))continue;const o=t.getAttribute("imageStyle");if(!o)continue;const a=i.get(o);a&&a.modelElements.includes(t.name)||(e.removeAttribute("imageStyle",t),r=!0)}return r}))}}class SP extends cf{static get requires(){return[TP]}static get pluginName(){return"ImageStyleUI"}static get isOfficialPlugin(){return!0}get localizedDefaultStylesTitles(){const e=this.editor.t;return{"Wrap text":e("Wrap text"),"Break text":e("Break text"),"In line":e("In line"),"Full size image":e("Full size image"),"Side image":e("Side image"),"Left aligned image":e("Left aligned image"),"Centered image":e("Centered image"),"Right aligned image":e("Right aligned image")}}init(){const e=this.editor.plugins,t=this.editor.config.get("image.toolbar")||[],n=PP(e.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const e of n)this._createButton(e);const i=PP([...t.filter(or),...AP.getDefaultDropdownDefinitions(e)],this.localizedDefaultStylesTitles);for(const e of i)this._createDropdown(e,n)}_createDropdown(e,t){const n=this.editor.ui.componentFactory;n.add(e.name,(i=>{let r;const{defaultItem:s,items:o,title:a}=e,l=o.filter((e=>t.find((({name:t})=>IP(t)===e)))).map((e=>{const t=n.create(e);return e===s&&(r=t),t}));o.length!==l.length&&AP.warnInvalidStyle({dropdown:e});const c=Yw(i,Qw),d=c.buttonView,u=d.arrowView;return Jw(c,l,{enableActiveItemFocusOnDropdownOpen:!0}),d.set({label:OP(a,r.label),class:null,tooltip:!0}),u.unbind("label"),u.set({label:a}),d.bind("icon").toMany(l,"isOn",((...e)=>{const t=e.findIndex(qo);return t<0?r.icon:l[t].icon})),d.bind("label").toMany(l,"isOn",((...e)=>{const t=e.findIndex(qo);return OP(a,t<0?r.label:l[t].label)})),d.bind("isOn").toMany(l,"isOn",((...e)=>e.some(qo))),d.bind("class").toMany(l,"isOn",((...e)=>e.some(qo)?"ck-splitbutton_flatten":void 0)),d.on("execute",(()=>{l.some((({isOn:e})=>e))?c.isOpen=!c.isOpen:r.fire("execute")})),c.bind("isEnabled").toMany(l,"isEnabled",((...e)=>e.some(qo))),this.listenTo(c,"execute",(()=>{this.editor.editing.view.focus()})),c}))}_createButton(e){const t=e.name;this.editor.ui.componentFactory.add(IP(t),(n=>{const i=this.editor.commands.get("imageStyle"),r=new jb(n);return r.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0}),r.bind("isEnabled").to(i,"isEnabled"),r.bind("isOn").to(i,"value",(e=>e===t)),r.on("execute",this._executeCommand.bind(this,t)),r}))}_executeCommand(e){this.editor.execute("imageStyle",{value:e}),this.editor.editing.view.focus()}}function PP(e,t){for(const n of e)t[n.title]&&(n.title=t[n.title]);return e}function IP(e){return`imageStyle:${e}`}function OP(e,t){return(e?e+": ":"")+t}class VP extends cf{static get requires(){return[TP,SP]}static get pluginName(){return"ImageStyle"}static get isOfficialPlugin(){return!0}}class RP extends cf{static get requires(){return[zk,hS]}static get pluginName(){return"ImageToolbar"}static get isOfficialPlugin(){return!0}afterInit(){const e=this.editor,t=e.t,n=e.plugins.get(zk),i=e.plugins.get("ImageUtils");var r;n.register("image",{ariaLabel:t("Image toolbar"),items:(r=e.config.get("image.toolbar")||[],r.map((e=>or(e)?e.name:e))),getRelatedElement:e=>i.getClosestSelectedImageWidget(e)})}}class NP extends cf{static get requires(){return[TS,hS]}static get pluginName(){return"PictureEditing"}static get isOfficialPlugin(){return!0}afterInit(){const e=this.editor;e.plugins.has("ImageBlockEditing")&&e.model.schema.extend("imageBlock",{allowAttributes:["sources"]}),e.plugins.has("ImageInlineEditing")&&e.model.schema.extend("imageInline",{allowAttributes:["sources"]}),this._setupConversion(),this._setupImageUploadEditingIntegration()}_setupConversion(){const e=this.editor,t=e.conversion,n=e.plugins.get("ImageUtils");t.for("upcast").add(function(e){const t=["srcset","media","type","sizes"],n=(n,i,r)=>{const s=i.viewItem;if(!r.consumable.test(s,{name:!0}))return;const o=new Map;for(const e of s.getChildren())if(e.is("element","source")){const n={};for(const i of t)e.hasAttribute(i)&&r.consumable.test(e,{attributes:i})&&(n[i]=e.getAttribute(i));Object.keys(n).length&&o.set(e,n)}const a=e.findViewImgElement(s);if(!a)return;let l=i.modelCursor.parent;if(!l.is("element","imageBlock")){const e=r.convertItem(a,i.modelCursor);i.modelRange=e.modelRange,i.modelCursor=e.modelCursor,l=ac(e.modelRange.getItems())}r.consumable.consume(s,{name:!0});for(const[e,t]of o)r.consumable.consume(e,{attributes:Object.keys(t)});o.size&&r.writer.setAttribute("sources",Array.from(o.values()),l),r.convertChildren(s,l)};return e=>{e.on("element:picture",n)}}(n)),t.for("downcast").add(function(e){const t=(t,n,i)=>{if(!i.consumable.consume(n.item,t.name))return;const r=i.writer,s=i.mapper.toViewElement(n.item),o=e.findViewImgElement(s),a=n.attributeNewValue;if(a&&a.length){const e=[];let t=o.parent;for(;t&&t.is("attributeElement");){const n=t.parent;r.unwrap(r.createRangeOn(o),t),e.unshift(t),t=n}const n=o.parent.is("element","picture"),i=n?o.parent:r.createContainerElement("picture",null);n||r.insert(r.createPositionBefore(o),i),r.remove(r.createRangeIn(i)),r.insert(r.createPositionAt(i,"end"),a.map((e=>r.createEmptyElement("source",e)))),r.move(r.createRangeOn(o),r.createPositionAt(i,"end"));for(const t of e)r.wrap(r.createRangeOn(i),t)}else if(o.parent.is("element","picture")){const e=o.parent;r.move(r.createRangeOn(o),r.createPositionBefore(e)),r.remove(e)}};return e=>{e.on("attribute:sources:imageBlock",t),e.on("attribute:sources:imageInline",t)}}(n))}_setupImageUploadEditingIntegration(){const e=this.editor;if(!e.plugins.has("ImageUploadEditing"))return;const t=e.plugins.get("ImageUploadEditing");this.listenTo(t,"uploadComplete",((t,{imageElement:n,data:i})=>{const r=i.sources;r&&e.model.change((e=>{e.setAttributes({sources:r},n)}))}))}}class LP extends cf{static get pluginName(){return"IndentEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.commands.add("indent",new mf(e)),e.commands.add("outdent",new mf(e))}}class MP extends cf{static get pluginName(){return"IndentUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.locale,n=e.t,i="ltr"==t.uiLanguageDirection?Pf.indent:Pf.outdent,r="ltr"==t.uiLanguageDirection?Pf.outdent:Pf.indent;this._defineButton("indent",n("Increase indent"),i),this._defineButton("outdent",n("Decrease indent"),r)}_defineButton(e,t,n){const i=this.editor;i.ui.componentFactory.add(e,(()=>{const i=this._createButton(jb,e,t,n);return i.set({tooltip:!0}),i})),i.ui.componentFactory.add("menuBar:"+e,(()=>this._createButton(sw,e,t,n)))}_createButton(e,t,n,i){const r=this.editor,s=r.commands.get(t),o=new e(r.locale);return o.set({label:n,icon:i}),o.bind("isEnabled").to(s,"isEnabled"),this.listenTo(o,"execute",(()=>{r.execute(t),r.editing.view.focus()})),o}}class BP extends cf{static get pluginName(){return"Indent"}static get isOfficialPlugin(){return!0}static get requires(){return[LP,MP]}}class FP extends uf{_indentBehavior;constructor(e,t){super(e),this._indentBehavior=t}refresh(){const e=ac(this.editor.model.document.selection.getSelectedBlocks());e&&this._isIndentationChangeAllowed(e)?this.isEnabled=this._indentBehavior.checkEnabled(e.getAttribute("blockIndent")):this.isEnabled=!1}execute(){const e=this.editor.model,t=this._getBlocksToChange();e.change((e=>{for(const n of t){const t=n.getAttribute("blockIndent"),i=this._indentBehavior.getNextIndent(t);i?e.setAttribute("blockIndent",i,n):e.removeAttribute("blockIndent",n)}}))}_getBlocksToChange(){const e=this.editor.model.document.selection;return Array.from(e.getSelectedBlocks()).filter((e=>this._isIndentationChangeAllowed(e)))}_isIndentationChangeAllowed(e){const t=this.editor;return!!t.model.schema.checkAttribute(e,"blockIndent")&&(!t.plugins.has("ListUtils")||(!this._indentBehavior.isForward||!t.plugins.get("ListUtils").isListItemBlock(e)))}}class DP{isForward;offset;unit;constructor(e){this.isForward="forward"===e.direction,this.offset=e.offset,this.unit=e.unit}checkEnabled(e){const t=parseFloat(e||"0");return this.isForward||t>0}getNextIndent(e){const t=parseFloat(e||"0");if(e&&!e.endsWith(this.unit))return this.isForward?this.offset+this.unit:void 0;const n=t+(this.isForward?this.offset:-this.offset);return n>0?n+this.unit:void 0}}class zP{isForward;classes;constructor(e){this.isForward="forward"===e.direction,this.classes=e.classes}checkEnabled(e){const t=this.classes.indexOf(e);return this.isForward?t<this.classes.length-1:t>=0}getNextIndent(e){const t=this.classes.indexOf(e),n=this.isForward?1:-1;return this.classes[t+n]}}const $P=["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"];class jP extends cf{constructor(e){super(e),e.config.define("indentBlock",{offset:40,unit:"px"})}static get pluginName(){return"IndentBlock"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.config.get("indentBlock");t.classes&&t.classes.length?(this._setupConversionUsingClasses(t.classes),e.commands.add("indentBlock",new FP(e,new zP({direction:"forward",classes:t.classes}))),e.commands.add("outdentBlock",new FP(e,new zP({direction:"backward",classes:t.classes})))):(e.data.addStyleProcessorRules(Zp),this._setupConversionUsingOffset(),e.commands.add("indentBlock",new FP(e,new DP({direction:"forward",offset:t.offset,unit:t.unit}))),e.commands.add("outdentBlock",new FP(e,new DP({direction:"backward",offset:t.offset,unit:t.unit}))))}afterInit(){const e=this.editor,t=e.model.schema,n=e.commands.get("indent"),i=e.commands.get("outdent"),r=e.config.get("heading.options");(r&&r.map((e=>e.model))||$P).forEach((e=>{t.isRegistered(e)&&t.extend(e,{allowAttributes:"blockIndent"})})),t.setAttributeProperties("blockIndent",{isFormatting:!0}),n.registerChildCommand(e.commands.get("indentBlock")),i.registerChildCommand(e.commands.get("outdentBlock"))}_setupConversionUsingOffset(){const e=this.editor.conversion,t="rtl"===this.editor.locale.contentLanguageDirection?"margin-right":"margin-left";e.for("upcast").attributeToAttribute({view:{styles:{[t]:/[\s\S]+/}},model:{key:"blockIndent",value:e=>{if(!e.is("element","li"))return e.getStyle(t)}}}),e.for("downcast").attributeToAttribute({model:"blockIndent",view:e=>({key:"style",value:{[t]:e}})})}_setupConversionUsingClasses(e){const t={model:{key:"blockIndent",values:[]},view:{}};for(const n of e)t.model.values.push(n),t.view[n]={key:"class",value:[n]};this.editor.conversion.attributeToAttribute(t)}}function HP(e,t){return`${e}:${t=t||ic(e)}`}class WP extends uf{refresh(){const e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"language")}execute({languageCode:e,textDirection:t}={}){const n=this.editor.model,i=n.document.selection,r=!!e&&HP(e,t);n.change((e=>{if(i.isCollapsed)r?e.setSelectionAttribute("language",r):e.removeSelectionAttribute("language");else{const t=n.schema.getValidRanges(i.getRanges(),"language");for(const n of t)r?e.setAttribute("language",r,n):e.removeAttribute("language",n)}}))}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,n=e.document.selection;if(n.isCollapsed)return n.getAttribute("language")||!1;for(const e of n.getRanges())for(const n of e.getItems())if(t.checkAttribute(n,"language"))return n.getAttribute("language")||!1;return!1}}class UP extends cf{static get pluginName(){return"TextPartLanguageEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("language",{textPartLanguage:[{title:"Arabic",languageCode:"ar"},{title:"French",languageCode:"fr"},{title:"Spanish",languageCode:"es"}]})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"language"}),e.model.schema.setAttributeProperties("language",{copyOnEnter:!0}),this._defineConverters(),e.commands.add("textPartLanguage",new WP(e))}_defineConverters(){const e=this.editor.conversion;e.for("upcast").elementToAttribute({model:{key:"language",value:e=>HP(e.getAttribute("lang"),e.getAttribute("dir"))},view:{name:"span",attributes:{lang:/[\s\S]+/}}}),e.for("downcast").attributeToElement({model:"language",view:(e,{writer:t},n)=>{if(!e)return;if(!n.item.is("$textProxy")&&!n.item.is("documentSelection"))return;const{languageCode:i,textDirection:r}=function(e){const[t,n]=e.split(":");return{languageCode:t,textDirection:n}}(e);return t.createAttributeElement("span",{lang:i,dir:r})}})}}class qP extends cf{static get pluginName(){return"TextPartLanguageUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t,n=t("Choose language"),i=t("Language");e.ui.componentFactory.add("textPartLanguage",(t=>{const{definitions:r,titles:s}=this._getItemMetadata(),o=e.commands.get("textPartLanguage"),a=Yw(t);return ev(a,r,{ariaLabel:i,role:"menu"}),a.buttonView.set({ariaLabel:i,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:i}),a.extendTemplate({attributes:{class:["ck-text-fragment-language-dropdown"]}}),a.bind("isEnabled").to(o,"isEnabled"),a.buttonView.bind("label").to(o,"value",(e=>e&&s[e]||n)),a.buttonView.bind("ariaLabel").to(o,"value",(e=>{const t=e&&s[e];return t?`${t}, ${i}`:i})),this.listenTo(a,"execute",(t=>{o.execute({languageCode:t.source.languageCode,textDirection:t.source.textDirection}),e.editing.view.focus()})),a})),e.ui.componentFactory.add("menuBar:textPartLanguage",(n=>{const{definitions:r}=this._getItemMetadata(),s=e.commands.get("textPartLanguage"),o=new gy(n);o.buttonView.set({label:i});const a=new py(n);a.set({ariaLabel:t("Language"),role:"menu"});for(const e of r){if("button"!=e.type){a.items.add(new Lw(n));continue}const t=new Lv(n,o),i=new sw(n);i.set({role:"menuitemradio",isToggleable:!0}),i.bind(...Object.keys(e.model)).to(e.model),i.delegate("execute").to(o),t.children.add(i),a.items.add(t)}return o.bind("isEnabled").to(s,"isEnabled"),o.panelView.children.add(a),o.on("execute",(t=>{s.execute({languageCode:t.source.languageCode,textDirection:t.source.textDirection}),e.editing.view.focus()})),o}))}_getItemMetadata(){const e=this.editor,t=new oc,n={},i=e.commands.get("textPartLanguage"),r=e.config.get("language.textPartLanguage"),s=(0,e.locale.t)("Remove language");t.add({type:"button",model:new iy({label:s,languageCode:!1,withText:!0})}),t.add({type:"separator"});for(const e of r){const r={type:"button",model:new iy({label:e.title,languageCode:e.languageCode,role:"menuitemradio",textDirection:e.textDirection,withText:!0})},s=HP(e.languageCode,e.textDirection);r.model.bind("isOn").to(i,"value",(e=>e===s)),t.add(r),n[s]=e.title}return{definitions:t,titles:n}}}class GP extends cf{static get requires(){return[UP,qP]}static get pluginName(){return"TextPartLanguage"}static get isOfficialPlugin(){return!0}}class KP{_definitions=new Set;get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach((e=>this._definitions.add(e))):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",((e,t,n)=>{if(!n.consumable.test(t.item,"attribute:linkHref"))return;if(!t.item.is("selection")&&!n.schema.isInline(t.item))return;const i=n.writer,r=i.document.selection;for(const e of this._definitions){const s=i.createAttributeElement("a",e.attributes,{priority:5});e.classes&&i.addClass(e.classes,s);for(const t in e.styles)i.setStyle(t,e.styles[t],s);i.setCustomProperty("link",!0,s),e.callback(t.attributeNewValue)?t.item.is("selection")?i.wrap(r.getFirstRange(),s):i.wrap(n.mapper.toViewRange(t.range),s):i.unwrap(n.mapper.toViewRange(t.range),s)}}),{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:imageBlock",((e,t,{writer:n,mapper:i})=>{const r=i.toViewElement(t.item),s=Array.from(r.getChildren()).find((e=>e.is("element","a")));if(s)for(const e of this._definitions){const i=mc(e.attributes);if(e.callback(t.attributeNewValue)){for(const[e,t]of i)"class"===e?n.addClass(t,s):n.setAttribute(e,t,s);e.classes&&n.addClass(e.classes,s);for(const t in e.styles)n.setStyle(t,e.styles[t],s)}else{for(const[e,t]of i)"class"===e?n.removeClass(t,s):n.removeAttribute(e,s);e.classes&&n.removeClass(e.classes,s);for(const t in e.styles)n.removeStyle(t,s)}}}))}}}const ZP=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,QP=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,YP=/^((\w+:(\/{2,})?)|(\W))/i,JP=["https?","ftps?","mailto"],XP="Ctrl+K";function eI(e,{writer:t}){const n=t.createAttributeElement("a",{href:e},{priority:5});return t.setCustomProperty("link",!0,n),n}function tI(e,t=JP){const n=String(e),i=t.join("|");return function(e,t){return!!e.replace(ZP,"").match(t)}(n,new RegExp(`${"^(?:(?:<protocols>):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))".replace("<protocols>",i)}`,"i"))?n:"#"}function nI(e,t){return!!e&&t.checkAttribute(e.name,"linkHref")}function iI(e,t){const n=(i=e,QP.test(i)?"mailto:":t);var i;const r=!!n&&!rI(e);return e&&r?n+e:e}function rI(e){return YP.test(e)}function sI(e){window.open(e,"_blank","noopener")}function oI(e){const t=e.plugins.has("BookmarkEditing")?e.plugins.get("BookmarkEditing"):null;return{isScrollableToTarget:function(e){return!!e&&e.startsWith("#")&&!!t&&!!t.getElementForBookmarkId(e.slice(1))},scrollToTarget:function(n){const i=n.slice(1),r=t.getElementForBookmarkId(i);e.model.change((e=>{e.setSelection(r,"on")})),e.editing.view.scrollToTheSelection({alignToTop:!0,forceScroll:!0})}}}class aI extends uf{manualDecorators=new oc;automaticDecorators=new KP;restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document.selection,n=t.getSelectedElement()||ac(t.getSelectedBlocks());nI(n,e.schema)?(this.value=n.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(n,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}execute(e,t={}){const n=this.editor.model,i=n.document.selection,r=[],s=[];for(const e in t)t[e]?r.push(e):s.push(e);n.change((t=>{if(i.isCollapsed){const o=i.getFirstPosition();if(i.hasAttribute("linkHref")){const a=lI(i);let l=l_(o,"linkHref",i.getAttribute("linkHref"),n);i.getAttribute("linkHref")===a&&(l=this._updateLinkContent(n,t,l,e)),t.setAttribute("linkHref",e,l),r.forEach((e=>{t.setAttribute(e,!0,l)})),s.forEach((e=>{t.removeAttribute(e,l)})),t.setSelection(t.createPositionAfter(l.end.nodeBefore))}else if(""!==e){const s=mc(i.getAttributes());s.set("linkHref",e),r.forEach((e=>{s.set(e,!0)}));const{end:a}=n.insertContent(t.createText(e,s),o);t.setSelection(a)}["linkHref",...r,...s].forEach((e=>{t.removeSelectionAttribute(e)}))}else{const o=n.schema.getValidRanges(i.getRanges(),"linkHref"),a=[];for(const e of i.getSelectedBlocks())n.schema.checkAttribute(e,"linkHref")&&a.push(t.createRangeOn(e));const l=a.slice();for(const e of o)this._isRangeToUpdate(e,a)&&l.push(e);for(const o of l){let a=o;if(1===l.length){const r=lI(i);i.getAttribute("linkHref")===r&&(a=this._updateLinkContent(n,t,o,e),t.setSelection(t.createSelection(a)))}t.setAttribute("linkHref",e,a),r.forEach((e=>{t.setAttribute(e,!0,a)})),s.forEach((e=>{t.removeAttribute(e,a)}))}}}))}_getDecoratorStateFromModel(e){const t=this.editor.model,n=t.document.selection,i=n.getSelectedElement();return nI(i,t.schema)?i.getAttribute(e):n.getAttribute(e)}_isRangeToUpdate(e,t){for(const n of t)if(n.containsRange(e))return!1;return!0}_updateLinkContent(e,t,n,i){const r=t.createText(i,{linkHref:i});return e.insertContent(r,n)}}function lI(e){if(e.isCollapsed){const t=e.getFirstPosition();return t.textNode&&t.textNode.data}{const t=Array.from(e.getFirstRange().getItems());if(t.length>1)return null;const n=t[0];return n.is("$text")||n.is("$textProxy")?n.data:null}}class cI extends uf{refresh(){const e=this.editor.model,t=e.document.selection,n=t.getSelectedElement();nI(n,e.schema)?this.isEnabled=e.schema.checkAttribute(n,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){const e=this.editor,t=this.editor.model,n=t.document.selection,i=e.commands.get("link");t.change((e=>{const r=n.isCollapsed?[l_(n.getFirstPosition(),"linkHref",n.getAttribute("linkHref"),t)]:t.schema.getValidRanges(n.getRanges(),"linkHref");for(const t of r)if(e.removeAttribute("linkHref",t),i)for(const n of i.manualDecorators)e.removeAttribute(n.id,t)}))}}class dI extends(Ga()){id;defaultValue;label;attributes;classes;styles;constructor({id:e,label:t,attributes:n,classes:i,styles:r,defaultValue:s}){super(),this.id=e,this.set("value",void 0),this.defaultValue=s,this.label=t,this.attributes=n,this.classes=i,this.styles=r}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}const uI="automatic",hI=/^(https?:)?\/\//;class mI extends cf{static get pluginName(){return"LinkEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Qy,Ly,vx]}constructor(e){super(e),e.config.define("link",{allowCreatingEmptyLinks:!1,addTargetToExternalLinks:!1})}init(){const e=this.editor,t=this.editor.config.get("link.allowedProtocols");e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:eI}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(e,n)=>eI(tI(e,t),n)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:e=>e.getAttribute("href")}}),e.commands.add("link",new aI(e)),e.commands.add("unlink",new cI(e));const n=function(e,t){const n={"Open in a new tab":e("Open in a new tab"),Downloadable:e("Downloadable")};return t.forEach((e=>("label"in e&&n[e.label]&&(e.label=n[e.label]),e))),t}(e.t,function(e){const t=[];if(e)for(const[n,i]of Object.entries(e)){const e=Object.assign({},i,{id:`link${fT(n)}`});t.push(e)}return t}(e.config.get("link.decorators")));this._enableAutomaticDecorators(n.filter((e=>e.mode===uI))),this._enableManualDecorators(n.filter((e=>"manual"===e.mode))),e.plugins.get(Qy).registerAttribute("linkHref"),d_(e,"linkHref","a","ck-link_selected"),this._enableLinkOpen(),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration()}_enableAutomaticDecorators(e){const t=this.editor,n=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&n.add({id:"linkIsExternal",mode:uI,callback:e=>!!e&&hI.test(e),attributes:{target:"_blank",rel:"noopener noreferrer"}}),n.add(e),n.length&&t.conversion.for("downcast").add(n.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,n=t.commands.get("link").manualDecorators;e.forEach((e=>{t.model.schema.extend("$text",{allowAttributes:e.id});const i=new dI(e);n.add(i),t.conversion.for("downcast").attributeToElement({model:i.id,view:(e,{writer:t,schema:n},{item:r})=>{if((r.is("selection")||n.isInline(r))&&e){const e=t.createAttributeElement("a",i.attributes,{priority:5});i.classes&&t.addClass(i.classes,e);for(const n in i.styles)t.setStyle(n,i.styles[n],e);return t.setCustomProperty("link",!0,e),e}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...i._createPattern()},model:{key:i.id}})}))}_enableLinkOpen(){const e=this.editor,t=e.editing.view.document,n=oI(e);function i(e){n.isScrollableToTarget(e)?n.scrollToTarget(e):sI(e)}this.listenTo(t,"click",((e,t)=>{if(!(aa.isMac?t.domEvent.metaKey:t.domEvent.ctrlKey))return;let n=t.domTarget;if("a"!=n.tagName.toLowerCase()&&(n=n.closest("a")),!n)return;const r=n.getAttribute("href");r&&(e.stop(),t.preventDefault(),i(r))}),{context:"$capture"}),this.listenTo(t,"keydown",((t,n)=>{const r=e.commands.get("link").value;r&&n.keyCode===Zl.enter&&n.altKey&&(t.stop(),i(r))}))}_enableSelectionAttributesFixer(){const e=this.editor.model,t=e.document.selection;this.listenTo(t,"change:attribute",((n,{attributeKeys:i})=>{i.includes("linkHref")&&!t.hasAttribute("linkHref")&&e.change((t=>{var n;!function(e,t){e.removeSelectionAttribute("linkHref");for(const n of t)e.removeSelectionAttribute(n)}(t,(n=e.schema,n.getDefinition("$text").allowAttributes.filter((e=>e.startsWith("link")))))}))}))}_enableClipboardIntegration(){const e=this.editor,t=e.model,n=this.editor.config.get("link.defaultProtocol");n&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",((e,i)=>{t.change((e=>{const t=e.createRangeIn(i.content);for(const i of t.getItems())if(i.hasAttribute("linkHref")){const t=iI(i.getAttribute("linkHref"),n);e.setAttribute("linkHref",t,i)}}))}))}}class gI extends Lb{focusTracker=new lc;keystrokes=new hc;urlInputView;saveButtonView;cancelButtonView;_manualDecoratorSwitches;children;_validators;_focusables=new mb;_focusCycler;constructor(e,t,n){super(e);const i=e.t;this._validators=n,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),Pf.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(i("Cancel"),Pf.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t.manualDecorators),this._focusCycler=new Ub({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const r=["ck","ck-link-form","ck-responsive-form"];t.manualDecorators.length&&r.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:r,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce(((e,t)=>(e[t.name]=t.isOn,e)),{})}render(){super.render(),Fb({view:this}),[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null}_createUrlInput(){const e=this.locale.t,t=new Ew(this.locale,sv);return t.fieldView.inputMode="url",t.label=e("Link URL"),t}_createButton(e,t,n,i){const r=new jb(this.locale);return r.set({label:e,icon:t,tooltip:!0}),r.extendTemplate({attributes:{class:n}}),i&&r.delegate("execute").to(this,i),r}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const n of e.manualDecorators){const i=new hw(this.locale);i.set({name:n.id,label:n.label,withText:!0}),i.bind("isOn").toMany([n,e],"value",((e,t)=>void 0===t&&void 0===e?!!n.defaultValue:!!e)),i.on("execute",(()=>{n.set("value",!i.isOn)})),t.add(i)}return t}_createFormChildren(e){const t=this.createCollection();if(t.add(this.urlInputView),e.length){const e=new Lb;e.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map((e=>({tag:"li",children:[e],attributes:{class:["ck","ck-list__item"]}}))),attributes:{class:["ck","ck-reset","ck-list"]}}),t.add(e)}return t.add(this.saveButtonView),t.add(this.cancelButtonView),t}get url(){const{element:e}=this.urlInputView.fieldView;return e?e.value.trim():null}}class pI extends Lb{focusTracker=new lc;keystrokes=new hc;previewButtonView;unlinkButtonView;editButtonView;_focusables=new mb;_focusCycler;_linkConfig;_options;constructor(e,t={},n){super(e);const i=e.t;this._options=n,this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(i("Unlink"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184zm4.919 10.562-1.414 1.414a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.061-1.06l1.414 1.414 1.414-1.415a.75.75 0 0 1 1.061 1.061l-1.414 1.414 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414z"/></svg>',"unlink"),this.editButtonView=this._createButton(i("Edit link"),Pf.pencil,"edit"),this.set("href",void 0),this._linkConfig=t,this._focusCycler=new Ub({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-actions","ck-responsive-form"],tabindex:"-1"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render(),[this.previewButtonView,this.editButtonView,this.unlinkButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(e,t,n){const i=new jb(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i.delegate("execute").to(this,n),i}_createPreviewButton(){const e=new jb(this.locale),t=this.bindTemplate,n=this.t;return e.set({withText:!0}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",(e=>e&&tI(e,this._linkConfig.allowedProtocols))),target:"_blank",rel:"noopener noreferrer"},on:{click:t.to((e=>{this._options&&this._options.isScrollableToTarget(this.href)?(e.preventDefault(),this._options.scrollToTarget(this.href)):sI(this.href)}))}}),e.bind("tooltip").to(this,"href",(e=>this._options&&this._options.isScrollableToTarget(e)?n("Scroll to target"):n("Open link in new tab"))),e.bind("label").to(this,"href",(e=>e||n("This link has no URL"))),e.bind("isEnabled").to(this,"href",(e=>!!e)),e.template.tag="a",e}}var fI='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184z"/></svg>';const bI="link-ui";class wI extends cf{actionsView=null;formView=null;_balloon;static get requires(){return[sy]}static get pluginName(){return"LinkUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=this.editor.t;e.editing.view.addObserver(lp),this._balloon=e.plugins.get(sy),this._createToolbarLinkButton(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:bI,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:bI,view:(e,{writer:t})=>{if(!e.markerRange.isCollapsed)return null;const n=t.createUIElement("span");return t.addClass(["ck-fake-link-selection","ck-fake-link-selection_collapsed"],n),n}}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Create link"),keystroke:XP},{label:t("Move out of a link"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){const e=this.editor,t=new pI(e.locale,e.config.get("link"),oI(e)),n=e.commands.get("link"),i=e.commands.get("unlink");return t.bind("href").to(n,"value"),t.editButtonView.bind("isEnabled").to(n),t.unlinkButtonView.bind("isEnabled").to(i),this.listenTo(t,"edit",(()=>{this._addFormView()})),this.listenTo(t,"unlink",(()=>{e.execute("unlink"),this._hideUI()})),t.keystrokes.set("Esc",((e,t)=>{this._hideUI(),t()})),t.keystrokes.set(XP,((e,t)=>{this._addFormView(),t()})),t}_createFormView(){const e=this.editor,t=e.commands.get("link"),n=e.config.get("link.defaultProtocol"),i=new(Bb(gI))(e.locale,t,function(e){const t=e.t,n=e.config.get("link.allowCreatingEmptyLinks");return[e=>{if(!n&&!e.url.length)return t("Link URL must not be empty.")}]}(e));return i.urlInputView.fieldView.bind("value").to(t,"value"),i.urlInputView.bind("isEnabled").to(t,"isEnabled"),i.saveButtonView.bind("isEnabled").to(t,"isEnabled"),this.listenTo(i,"submit",(()=>{if(i.isValid()){const{value:t}=i.urlInputView.fieldView.element,r=iI(t,n);e.execute("link",r,i.getDecoratorSwitchesState()),this._closeFormView()}})),this.listenTo(i.urlInputView,"change:errorText",(()=>{e.ui.update()})),this.listenTo(i,"cancel",(()=>{this._closeFormView()})),i.keystrokes.set("Esc",((e,t)=>{this._closeFormView(),t()})),i}_createToolbarLinkButton(){const e=this.editor;e.ui.componentFactory.add("link",(()=>{const e=this._createButton(jb);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add("menuBar:link",(()=>{const e=this._createButton(sw);return e.set({role:"menuitemcheckbox"}),e}))}_createButton(e){const t=this.editor,n=t.locale,i=t.commands.get("link"),r=new e(t.locale),s=n.t;return r.set({label:s("Link"),icon:fI,keystroke:XP,isToggleable:!0}),r.bind("isEnabled").to(i,"isEnabled"),r.bind("isOn").to(i,"value",(e=>!!e)),this.listenTo(r,"execute",(()=>this._showUI(!0))),r}_enableBalloonActivators(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",(()=>{this._getSelectedLinkElement()&&this._showUI()})),e.keystrokes.set(XP,((t,n)=>{n(),e.commands.get("link").isEnabled&&this._showUI(!0)}))}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",((e,t)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),t())}),{priority:"high"}),this.editor.keystrokes.set("Esc",((e,t)=>{this._isUIVisible&&(this._hideUI(),t())})),Mb({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this.actionsView||this._createViews(),this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const e=this.editor.commands.get("link");this.formView.disableCssTransitions(),this.formView.resetFormStatus(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.formView.urlInputView.fieldView.value=e.value||"",this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions()}_closeFormView(){const e=this.editor.commands.get("link");e.restoreManualDecoratorStates(),void 0!==e.value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this.formView.urlInputView.fieldView.reset(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let n=this._getSelectedLinkElement(),i=s();const r=()=>{const e=this._getSelectedLinkElement(),t=s();n&&!e||!n&&t!==i?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),n=e,i=t};function s(){return t.selection.focus.getAncestors().reverse().find((e=>e.is("element")))}this.listenTo(e.ui,"update",r),this.listenTo(this._balloon,"change:visibleView",r)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _areActionsInPanel(){return!!this.actionsView&&this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return!!this.actionsView&&this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){const e=this._balloon.visibleView;return!!this.formView&&e==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=this.editor.model,n=e.document;let i;if(t.markers.has(bI)){const t=Array.from(this.editor.editing.mapper.markerNameToElements(bI)),n=e.createRange(e.createPositionBefore(t[0]),e.createPositionAfter(t[t.length-1]));i=e.domConverter.viewRangeToDom(n)}else i=()=>{const t=this._getSelectedLinkElement();return t?e.domConverter.mapViewToDom(t):e.domConverter.viewRangeToDom(n.selection.getFirstRange())};return{target:i}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,n=t.getSelectedElement();if(t.isCollapsed||n&&_k(n))return vI(t.getFirstPosition());{const n=t.getFirstRange().getTrimmed(),i=vI(n.start),r=vI(n.end);return i&&i==r&&e.createRangeIn(i).getTrimmed().isEqual(n)?i:null}}_showFakeVisualSelection(){const e=this.editor.model;e.change((t=>{const n=e.document.selection.getFirstRange();if(e.markers.has(bI))t.updateMarker(bI,{range:n});else if(n.start.isAtEnd){const i=n.start.getLastMatchingPosition((({item:t})=>!e.schema.isContent(t)),{boundaries:n});t.addMarker(bI,{usingOperation:!1,affectsData:!1,range:t.createRange(i,n.end)})}else t.addMarker(bI,{usingOperation:!1,affectsData:!1,range:n})}))}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(bI)&&e.change((e=>{e.removeMarker(bI)}))}}function vI(e){return e.getAncestors().find((e=>{return(t=e).is("attributeElement")&&!!t.getCustomProperty("link");var t}))||null}const yI=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(((?!www\\.)|(www\\.))(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.)+(?:[a-z\\u00a1-\\uffff]{2,63})))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i");class _I extends cf{static get requires(){return[qy,mI]}static get pluginName(){return"AutoLink"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.model.document.selection;e.on("change:range",(()=>{this.isEnabled=!e.anchor.parent.is("element","codeBlock")})),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling(),this._enablePasteLinking()}_expandLinkRange(e,t){return t.textNode&&t.textNode.hasAttribute("linkHref")?l_(t,"linkHref",t.textNode.getAttribute("linkHref"),e):null}_selectEntireLinks(e,t){const n=this.editor.model,i=n.document.selection,r=i.getFirstPosition(),s=i.getLastPosition();let o=t.getJoined(this._expandLinkRange(n,r)||t);o&&(o=o.getJoined(this._expandLinkRange(n,s)||t)),o&&(o.start.isBefore(r)||o.end.isAfter(s))&&e.setSelection(o)}_enablePasteLinking(){const e=this.editor,t=e.model,n=t.document.selection,i=e.plugins.get("ClipboardPipeline"),r=e.commands.get("link");i.on("inputTransformation",((e,i)=>{if(!this.isEnabled||!r.isEnabled||n.isCollapsed||"paste"!==i.method)return;if(n.rangeCount>1)return;const s=n.getFirstRange(),o=i.dataTransfer.getData("text/plain");if(!o)return;const a=o.match(yI);a&&a[2]===o&&(t.change((e=>{this._selectEntireLinks(e,s),r.execute(o)})),e.stop())}),{priority:"high"})}_enableTypingHandling(){const e=this.editor,t=new Zy(e.model,(e=>{let t=e;if(!function(e){return e.length>4&&" "===e[e.length-1]&&" "!==e[e.length-2]}(t))return;t=t.slice(0,-1),"!.:,;?".includes(t[t.length-1])&&(t=t.slice(0,-1));const n=kI(t);return n?{url:n,removedTrailingCharacters:e.length-t.length}:void 0}));t.on("matched:data",((t,n)=>{const{batch:i,range:r,url:s,removedTrailingCharacters:o}=n;if(!i.isTyping)return;const a=r.end.getShiftedBy(-o),l=a.getShiftedBy(-s.length),c=e.model.createRange(l,a);this._applyAutoLink(s,c)})),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,n=e.commands.get("enter");n&&n.on("execute",(()=>{const e=t.document.selection.getFirstPosition();if(!e.parent.previousSibling)return;const n=t.createRangeIn(e.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(n)}))}_enableShiftEnterHandling(){const e=this.editor,t=e.model,n=e.commands.get("shiftEnter");n&&n.on("execute",(()=>{const e=t.document.selection.getFirstPosition(),n=t.createRange(t.createPositionAt(e.parent,0),e.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(n)}))}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:n,range:i}=Ky(e,t),r=kI(n);if(r){const e=t.createRange(i.end.getShiftedBy(-r.length),i.end);this._applyAutoLink(r,e)}}_applyAutoLink(e,t){const n=this.editor.model,i=iI(e,this.editor.config.get("link.defaultProtocol"));this.isEnabled&&function(e,t){return t.schema.checkAttributeInSelection(t.createSelection(e),"linkHref")}(t,n)&&rI(i)&&!function(e){const t=e.start.nodeAfter;return!!t&&t.hasAttribute("linkHref")}(t)&&this._persistAutoLink(i,t)}_persistAutoLink(e,t){const n=this.editor.model,i=this.editor.plugins.get("Delete");n.enqueueChange((r=>{r.setAttribute("linkHref",e,t),n.enqueueChange((()=>{i.requestUndoOnBackspace()}))}))}}function kI(e){const t=yI.exec(e);return t?t[2]:null}class xI extends cf{static get requires(){return[mI,wI,_I]}static get pluginName(){return"Link"}static get isOfficialPlugin(){return!0}}class CI extends cf{static get requires(){return["ImageEditing","ImageUtils",mI]}static get pluginName(){return"LinkImageEditing"}static get isOfficialPlugin(){return!0}afterInit(){const e=this.editor,t=e.model.schema;e.plugins.has("ImageBlockEditing")&&t.extend("imageBlock",{allowAttributes:["linkHref"]}),e.conversion.for("upcast").add(function(e){const t=e.plugins.has("ImageInlineEditing"),n=e.plugins.get("ImageUtils");return e=>{e.on("element:a",((e,i,r)=>{const s=i.viewItem,o=n.findViewImgElement(s);if(!o)return;const a=o.findAncestor((e=>n.isBlockImageView(e)));if(t&&!a)return;if(!r.consumable.consume(s,{attributes:["href"]}))return;const l=s.getAttribute("href");if(!l)return;let c=i.modelCursor.parent;if(!c.is("element","imageBlock")){const e=r.convertItem(o,i.modelCursor);i.modelRange=e.modelRange,i.modelCursor=e.modelCursor,c=i.modelCursor.nodeBefore}c&&c.is("element","imageBlock")&&r.writer.setAttribute("linkHref",l,c)}),{priority:"high"})}}(e)),e.conversion.for("downcast").add(function(e){const t=e.plugins.get("ImageUtils");return e=>{e.on("attribute:linkHref:imageBlock",((e,n,i)=>{if(!i.consumable.consume(n.item,e.name))return;const r=i.mapper.toViewElement(n.item),s=i.writer,o=Array.from(r.getChildren()).find((e=>e.is("element","a"))),a=t.findViewImgElement(r),l=a.parent.is("element","picture")?a.parent:a;if(o)n.attributeNewValue?s.setAttribute("href",n.attributeNewValue,o):(s.move(s.createRangeOn(l),s.createPositionAt(r,0)),s.remove(o));else{const e=s.createContainerElement("a",{href:n.attributeNewValue});s.insert(s.createPositionAt(r,0),e),s.move(s.createRangeOn(l),s.createPositionAt(e,0))}}),{priority:"high"})}}(e)),this._enableAutomaticDecorators(),this._enableManualDecorators()}_enableAutomaticDecorators(){const e=this.editor,t=e.commands.get("link").automaticDecorators;t.length&&e.conversion.for("downcast").add(t.getDispatcherForLinkedImage())}_enableManualDecorators(){const e=this.editor,t=e.commands.get("link");for(const n of t.manualDecorators)e.plugins.has("ImageBlockEditing")&&e.model.schema.extend("imageBlock",{allowAttributes:n.id}),e.plugins.has("ImageInlineEditing")&&e.model.schema.extend("imageInline",{allowAttributes:n.id}),e.conversion.for("downcast").add(AI(n)),e.conversion.for("upcast").add(EI(e,n))}}function AI(e){return t=>{t.on(`attribute:${e.id}:imageBlock`,((t,n,i)=>{const r=i.mapper.toViewElement(n.item),s=Array.from(r.getChildren()).find((e=>e.is("element","a")));if(s){for(const[t,n]of mc(e.attributes))i.writer.setAttribute(t,n,s);e.classes&&i.writer.addClass(e.classes,s);for(const t in e.styles)i.writer.setStyle(t,e.styles[t],s)}}))}}function EI(e,t){const n=e.plugins.has("ImageInlineEditing"),i=e.plugins.get("ImageUtils");return e=>{e.on("element:a",((e,r,s)=>{const o=r.viewItem,a=i.findViewImgElement(o);if(!a)return;const l=a.findAncestor((e=>i.isBlockImageView(e)));if(n&&!l)return;const c=new Rd(t._createPattern()).match(o);if(!c)return;if(!s.consumable.consume(o,c.match))return;const d=r.modelCursor.nodeBefore||r.modelCursor.parent;s.writer.setAttribute(t.id,!0,d)}),{priority:"high"})}}class TI extends cf{static get requires(){return[mI,wI,"ImageBlockEditing"]}static get pluginName(){return"LinkImageUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",((t,n)=>{this._isSelectedLinkedImage(e.model.document.selection)&&(n.preventDefault(),t.stop())}),{priority:"high"}),this._createToolbarLinkImageButton()}_createToolbarLinkImageButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("linkImage",(n=>{const i=new jb(n),r=e.plugins.get("LinkUI"),s=e.commands.get("link");return i.set({isEnabled:!0,label:t("Link image"),icon:fI,keystroke:XP,tooltip:!0,isToggleable:!0}),i.bind("isEnabled").to(s,"isEnabled"),i.bind("isOn").to(s,"value",(e=>!!e)),this.listenTo(i,"execute",(()=>{this._isSelectedLinkedImage(e.model.document.selection)?r._addActionsView():r._showUI(!0)})),i}))}_isSelectedLinkedImage(e){const t=e.getSelectedElement();return this.editor.plugins.get("ImageUtils").isImage(t)&&t.hasAttribute("linkHref")}}class SI extends cf{static get requires(){return[CI,TI]}static get pluginName(){return"LinkImage"}static get isOfficialPlugin(){return!0}}class PI{_startElement;_referenceIndent;_isForward;_includeSelf;_sameAttributes;_sameIndent;_lowerIndent;_higherIndent;constructor(e,t){this._startElement=e,this._referenceIndent=e.getAttribute("listIndent"),this._isForward="forward"==t.direction,this._includeSelf=!!t.includeSelf,this._sameAttributes=rc(t.sameAttributes||[]),this._sameIndent=!!t.sameIndent,this._lowerIndent=!!t.lowerIndent,this._higherIndent=!!t.higherIndent}static first(e,t){return ac(new this(e,t)[Symbol.iterator]())}*[Symbol.iterator](){const e=[];for(const{node:t}of new II(this._getStartNode(),this._isForward?"forward":"backward")){const n=t.getAttribute("listIndent");if(n<this._referenceIndent){if(!this._lowerIndent)break;this._referenceIndent=n}else if(n>this._referenceIndent){if(!this._higherIndent)continue;if(!this._isForward){e.push(t);continue}}else{if(!this._sameIndent){if(this._higherIndent){e.length&&(yield*e,e.length=0);break}continue}if(this._sameAttributes.some((e=>t.getAttribute(e)!==this._startElement.getAttribute(e))))break}e.length&&(yield*e,e.length=0),yield t}}_getStartNode(){return this._includeSelf?this._startElement:this._isForward?this._startElement.nextSibling:this._startElement.previousSibling}}class II{_node;_isForward;_previousNodesByIndent=[];_previous=null;_previousNodeIndent=null;constructor(e,t="forward"){this._node=e,this._isForward="forward"===t}[Symbol.iterator](){return this}next(){if(!RI(this._node))return{done:!0,value:void 0};const e=this._node.getAttribute("listIndent");let t=null;if(this._previous){const n=this._previousNodeIndent;e>n?this._previousNodesByIndent[n]=this._previous:e<n?(t=this._previousNodesByIndent[e]||null,this._previousNodesByIndent.length=e):t=this._previous}const n={node:this._node,previous:this._previous,previousNodeInList:t};return this._previous=this._node,this._previousNodeIndent=e,this._node=this._isForward?this._node.nextSibling:this._node.previousSibling,{value:n,done:!1}}}class OI{_listHead;constructor(e){this._listHead=e}[Symbol.iterator](){return new II(this._listHead)}}class VI{static next(){return ka()}}function RI(e){return!!e&&e.is("element")&&e.hasAttribute("listItemId")}function NI(e,t={}){return[...LI(e,{...t,direction:"backward"}),...LI(e,{...t,direction:"forward"})]}function LI(e,t={}){const n="forward"==t.direction,i=Array.from(new PI(e,{...t,includeSelf:n,sameIndent:!0,sameAttributes:"listItemId"}));return n?i:i.reverse()}function MI(e,t){const n=new PI(e,{sameIndent:!0,sameAttributes:"listType",...t}),i=new PI(e,{sameIndent:!0,sameAttributes:"listType",includeSelf:!0,direction:"forward",...t});return[...Array.from(n).reverse(),...i]}function BI(e){return!PI.first(e,{sameIndent:!0,sameAttributes:"listItemId"})}function FI(e){return!PI.first(e,{direction:"forward",sameIndent:!0,sameAttributes:"listItemId"})}function DI(e,t={}){e=rc(e);const n=!1!==t.withNested,i=new Set;for(const t of e)for(const e of NI(t,{higherIndent:n}))i.add(e);return qI(i)}function zI(e){e=rc(e);const t=new Set;for(const n of e)for(const e of MI(n))t.add(e);return qI(t)}function $I(e,t){const n=LI(e,{direction:"forward"}),i=VI.next();for(const e of n)t.setAttribute("listItemId",i,e);return n}function jI(e,t,n){const i={};for(const[e,n]of t.getAttributes())e.startsWith("list")&&(i[e]=n);const r=LI(e,{direction:"forward"});for(const e of r)n.setAttributes(i,e);return r}function HI(e,t,{expand:n,indentBy:i=1}={}){e=rc(e);const r=n?DI(e):e;for(const e of r){const n=e.getAttribute("listIndent")+i;n<0?WI(e,t):t.setAttribute("listIndent",n,e)}return r}function WI(e,t){e=rc(e);for(const n of e)n.is("element","listItem")&&t.rename(n,"paragraph");for(const n of e)for(const e of n.getAttributeKeys())e.startsWith("list")&&t.removeAttribute(e,n);return e}function UI(e){if(!e.length)return!1;const t=e[0].getAttribute("listItemId");return!!t&&!e.some((e=>e.getAttribute("listItemId")!=t))}function qI(e){return Array.from(e).filter((e=>"$graveyard"!==e.root.rootName)).sort(((e,t)=>e.index-t.index))}function GI(e){const t=e.document.selection.getSelectedElement();return t&&e.schema.isObject(t)&&e.schema.isBlock(t)?t:null}function KI(e,t){return t.checkChild(e.parent,"listItem")&&t.checkChild(e,"$text")&&!t.isObject(e)}function ZI(e){return"numbered"==e||"customNumbered"==e}function QI(e,t,n){return LI(t,{direction:"forward"}).pop().index>e.index?jI(e,t,n):[]}class YI extends uf{_direction;constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=JI(e.document.selection);e.change((e=>{const n=[];UI(t)&&!BI(t[0])?("forward"==this._direction&&n.push(...HI(t,e)),n.push(...$I(t[0],e))):"forward"==this._direction?n.push(...HI(t,e,{expand:!0})):n.push(...function(e,t){const n=DI(e=rc(e)),i=new Set,r=Math.min(...n.map((e=>e.getAttribute("listIndent")))),s=new Map;for(const e of n)s.set(e,PI.first(e,{lowerIndent:!0}));for(const e of n){if(i.has(e))continue;i.add(e);const n=e.getAttribute("listIndent")-1;if(n<0)WI(e,t);else{if(e.getAttribute("listIndent")==r){const n=QI(e,s.get(e),t);for(const e of n)i.add(e);if(n.length)continue}t.setAttribute("listIndent",n,e)}}return qI(i)}(t,e));for(const t of n){if(!t.hasAttribute("listType"))continue;const n=PI.first(t,{sameIndent:!0});n&&e.setAttribute("listType",n.getAttribute("listType"),t)}this._fireAfterExecute(n)}))}_fireAfterExecute(e){this.fire("afterExecute",qI(new Set(e)))}_checkEnabled(){let e=JI(this.editor.model.document.selection),t=e[0];if(!t)return!1;if("backward"==this._direction)return!0;if(UI(e)&&!BI(e[0]))return!0;e=DI(e),t=e[0];const n=PI.first(t,{sameIndent:!0});return!!n&&n.getAttribute("listType")==t.getAttribute("listType")}}function JI(e){const t=Array.from(e.getSelectedBlocks()),n=t.findIndex((e=>!RI(e)));return-1!=n&&(t.length=n),t}class XI extends uf{type;_listWalkerOptions;constructor(e,t,n={}){super(e),this.type=t,this._listWalkerOptions=n.multiLevel?{higherIndent:!0,lowerIndent:!0,sameAttributes:[]}:void 0}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,n=t.document,i=GI(t),r=Array.from(n.selection.getSelectedBlocks()).filter((e=>t.schema.checkAttribute(e,"listType")||KI(e,t.schema))),s=void 0!==e.forceValue?!e.forceValue:this.value;t.change((o=>{if(s){const e=r[r.length-1],t=LI(e,{direction:"forward"}),n=[];t.length>1&&n.push(...$I(t[1],o)),n.push(...WI(r,o)),n.push(...function(e,t){const n=[];let i=Number.POSITIVE_INFINITY;for(const{node:r}of new II(e.nextSibling)){const e=r.getAttribute("listIndent");if(0==e)break;e<i&&(i=e);const s=e-i;t.setAttribute("listIndent",s,r),n.push(r)}return n}(e,o)),this._fireAfterExecute(n)}else if((i||n.selection.isCollapsed)&&RI(r[0])){const t=MI(i||r[0],this._listWalkerOptions);for(const n of t)o.setAttributes({...e.additionalAttributes,listType:this.type},n);this._fireAfterExecute(t)}else{const n=[];for(const i of r)if(i.hasAttribute("listType"))for(const t of DI(i,{withNested:!1}))t.getAttribute("listType")!=this.type&&(o.setAttributes({...e.additionalAttributes,listType:this.type},t),n.push(t));else!i.is("element","listItem")&&KI(i,t.schema)&&o.rename(i,"listItem"),o.setAttributes({...e.additionalAttributes,listIndent:0,listItemId:VI.next(),listType:this.type},i),n.push(i);this._fireAfterExecute(n)}}))}_fireAfterExecute(e){this.fire("afterExecute",qI(new Set(e)))}_getValue(){const e=this.editor.model.document.selection,t=Array.from(e.getSelectedBlocks());if(!t.length)return!1;for(const e of t)if(e.getAttribute("listType")!=this.type)return!1;return!0}_checkEnabled(){const e=this.editor.model,t=e.schema,n=e.document.selection,i=Array.from(n.getSelectedBlocks());if(!i.length)return!1;if(this.value)return!0;for(const e of i)if(t.checkAttribute(e,"listType")||KI(e,t))return!0;return!1}}class eO extends uf{_direction;constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute({shouldMergeOnBlocksContentLevel:e=!1}={}){const t=this.editor.model,n=t.document.selection,i=[];t.change((r=>{const{firstElement:s,lastElement:o}=this._getMergeSubjectElements(n,e),a=s.getAttribute("listIndent")||0,l=o.getAttribute("listIndent"),c=o.getAttribute("listItemId");if(a!=l){const e=(d=o,Array.from(new PI(d,{direction:"forward",higherIndent:!0})));i.push(...HI([o,...e],r,{indentBy:a-l,expand:a<l}))}var d;if(e){let e=n;n.isCollapsed&&(e=r.createSelection(r.createRange(r.createPositionAt(s,"end"),r.createPositionAt(o,0)))),t.deleteContent(e,{doNotResetEntireContent:n.isCollapsed});const a=e.getLastPosition().parent,l=a.nextSibling;i.push(a),l&&l!==o&&l.getAttribute("listItemId")==c&&i.push(...jI(l,a,r))}else i.push(...jI(o,s,r));this._fireAfterExecute(i)}))}_fireAfterExecute(e){this.fire("afterExecute",qI(new Set(e)))}_checkEnabled(){const e=this.editor.model,t=e.document.selection,n=GI(e);if(t.isCollapsed||n){const e=n||t.getFirstPosition().parent;if(!RI(e))return!1;const i="backward"==this._direction?e.previousSibling:e.nextSibling;if(!i)return!1;if(UI([e,i]))return!1}else{const e=t.getLastPosition(),n=t.getFirstPosition();if(e.parent===n.parent)return!1;if(!RI(e.parent))return!1}return!0}_getMergeSubjectElements(e,t){const n=GI(this.editor.model);let i,r;if(e.isCollapsed||n){const s=n||e.getFirstPosition().parent,o=BI(s);"backward"==this._direction?(r=s,i=o&&!t?PI.first(s,{sameIndent:!0,lowerIndent:!0}):s.previousSibling):(i=s,r=s.nextSibling)}else i=e.getFirstPosition().parent,r=e.getLastPosition().parent;return{firstElement:i,lastElement:r}}}class tO extends uf{_direction;constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){this.editor.model.change((e=>{const t=$I(this._getStartBlock(),e);this._fireAfterExecute(t)}))}_fireAfterExecute(e){this.fire("afterExecute",qI(new Set(e)))}_checkEnabled(){const e=this.editor.model.document.selection,t=this._getStartBlock();return e.isCollapsed&&RI(t)&&!BI(t)}_getStartBlock(){const e=this.editor.model.document.selection.getFirstPosition().parent;return"before"==this._direction?e:e.nextSibling}}class nO extends cf{static get pluginName(){return"ListUtils"}static get isOfficialPlugin(){return!0}expandListBlocksToCompleteList(e){return zI(e)}isFirstBlockOfListItem(e){return BI(e)}isListItemBlock(e){return RI(e)}expandListBlocksToCompleteItems(e,t={}){return DI(e,t)}isNumberedListType(e){return ZI(e)}}function iO(e){return e.is("element","ol")||e.is("element","ul")}function rO(e){return e.is("element","li")}function sO(e,t,n,i=lO(n,t)){return e.createAttributeElement(aO(n),null,{priority:2*t/100-100,id:i})}function oO(e,t,n){return e.createAttributeElement("li",null,{priority:(2*t+1)/100-100,id:n})}function aO(e){return"numbered"==e||"customNumbered"==e?"ol":"ul"}function lO(e,t){return`list-${e}-${t}`}function cO(e,t,n){const i=e.nodeBefore;if(RI(i)){let e=i;for(const{node:r}of new II(e,"backward")){if(e=r,n.has(e))return;if(n.add(e),t.has(i))return}t.add(e)}else{const n=e.nodeAfter;RI(n)&&t.add(n)}}function dO(e,t,n,{dataPipeline:i}={}){const r=function(e){return(t,n)=>{const i=[];for(const n of e)t.hasAttribute(n)&&i.push(`attribute:${n}`);return!!i.every((e=>!1!==n.test(t,e)))&&(i.forEach((e=>n.consume(t,e))),!0)}}(e);return(s,o,a)=>{const{writer:l,mapper:c,consumable:d}=a,u=o.item;if(!e.includes(o.attributeKey))return;if(!r(u,d))return;const h=function(e,t,n){const i=n.createRangeOn(e);return t.toViewRange(i).getTrimmed().end.nodeBefore}(u,c,n);hO(h,l,c),function(e,t){let n=e.parent;for(;n.is("attributeElement")&&["ul","ol","li"].includes(n.name);){const i=n.parent;t.unwrap(t.createRangeOn(e),n),n=i}}(h,l);const m=function(e,t,n,i,{dataPipeline:r}){let s=i.createRangeOn(t);if(!BI(e))return s;for(const o of n){if("itemMarker"!=o.scope)continue;const n=o.createElement(i,e,{dataPipeline:r});if(!n)continue;if(i.setCustomProperty("listItemMarker",!0,n),o.canInjectMarkerIntoElement&&o.canInjectMarkerIntoElement(e)?i.insert(i.createPositionAt(t,0),n):(i.insert(s.start,n),s=i.createRange(i.createPositionBefore(n),i.createPositionAfter(t))),!o.createWrapperElement||!o.canWrapElement)continue;const a=o.createWrapperElement(i,e,{dataPipeline:r});i.setCustomProperty("listItemWrapper",!0,a),o.canWrapElement(e)?s=i.wrap(s,a):(s=i.wrap(i.createRangeOn(n),a),s=i.createRange(s.start,i.createPositionAfter(t)))}return s}(u,h,t,l,{dataPipeline:i});!function(e,t,n,i){if(!e.hasAttribute("listIndent"))return;const r=e.getAttribute("listIndent");let s=e;for(let e=r;e>=0;e--){const r=oO(i,e,s.getAttribute("listItemId")),o=sO(i,e,s.getAttribute("listType"));for(const e of n)"list"!=e.scope&&"item"!=e.scope||!s.hasAttribute(e.attributeName)||e.setAttributeOnDowncast(i,s.getAttribute(e.attributeName),"list"==e.scope?o:r);if(t=i.wrap(t,r),t=i.wrap(t,o),0==e)break;if(s=PI.first(s,{lowerIndent:!0}),!s)break}}(u,m,t,l)}}function uO(e,{dataPipeline:t}={}){return(n,{writer:i})=>{if(!mO(n,e))return null;if(!t)return i.createContainerElement("span",{class:"ck-list-bogus-paragraph"});const r=i.createContainerElement("p");return i.setCustomProperty("dataPipeline:transparentRendering",!0,r),r}}function hO(e,t,n){for(;e.parent.is("attributeElement")&&e.parent.getCustomProperty("listItemWrapper");)t.unwrap(t.createRangeOn(e),e.parent);const i=[];r(t.createPositionBefore(e).getWalker({direction:"backward"})),r(t.createRangeIn(e).getWalker());for(const e of i)t.remove(e);function r(e){for(const{item:t}of e){if(t.is("element")&&n.toModelElement(t))break;t.is("element")&&t.getCustomProperty("listItemMarker")&&i.push(t)}}}function mO(e,t,n=NI(e)){if(!RI(e))return!1;for(const n of e.getAttributeKeys())if(!n.startsWith("selection:")&&!t.includes(n))return!1;return n.length<2}const gO=["listType","listIndent","listItemId"];class pO extends cf{_downcastStrategies=[];static get pluginName(){return"ListEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[sk,qy,nO,vx]}constructor(e){super(e),e.config.define("list.multiBlock",!0)}init(){const e=this.editor,t=e.model,n=e.config.get("list.multiBlock");if(e.plugins.has("LegacyListEditing"))throw new Aa("list-feature-conflict",this,{conflictPlugin:"LegacyListEditing"});t.schema.register("$listItem",{allowAttributes:gO}),n?(t.schema.extend("$container",{allowAttributesOf:"$listItem"}),t.schema.extend("$block",{allowAttributesOf:"$listItem"}),t.schema.extend("$blockObject",{allowAttributesOf:"$listItem"})):t.schema.register("listItem",{inheritAllFrom:"$block",allowAttributesOf:"$listItem"});for(const e of gO)t.schema.setAttributeProperties(e,{copyOnReplace:!0});e.commands.add("numberedList",new XI(e,"numbered")),e.commands.add("bulletedList",new XI(e,"bulleted")),e.commands.add("customNumberedList",new XI(e,"customNumbered",{multiLevel:!0})),e.commands.add("customBulletedList",new XI(e,"customBulleted",{multiLevel:!0})),e.commands.add("indentList",new YI(e,"forward")),e.commands.add("outdentList",new YI(e,"backward")),e.commands.add("splitListItemBefore",new tO(e,"before")),e.commands.add("splitListItemAfter",new tO(e,"after")),n&&(e.commands.add("mergeListItemBackward",new eO(e,"backward")),e.commands.add("mergeListItemForward",new eO(e,"forward"))),this._setupDeleteIntegration(),this._setupEnterIntegration(),this._setupTabIntegration(),this._setupClipboardIntegration(),this._setupAccessibilityIntegration()}afterInit(){const e=this.editor.commands,t=e.get("indent"),n=e.get("outdent");t&&t.registerChildCommand(e.get("indentList"),{priority:"high"}),n&&n.registerChildCommand(e.get("outdentList"),{priority:"lowest"}),this._setupModelPostFixing(),this._setupConversion()}registerDowncastStrategy(e){this._downcastStrategies.push(e)}getListAttributeNames(){return[...gO,...this._downcastStrategies.map((e=>e.attributeName))]}_setupDeleteIntegration(){const e=this.editor,t=e.commands.get("mergeListItemBackward"),n=e.commands.get("mergeListItemForward");this.listenTo(e.editing.view.document,"delete",((i,r)=>{const s=e.model.document.selection;GI(e.model)||e.model.change((()=>{const o=s.getFirstPosition();if(s.isCollapsed&&"backward"==r.direction){if(!o.isAtStart)return;const n=o.parent;if(!RI(n))return;if(PI.first(n,{sameAttributes:"listType",sameIndent:!0})||0!==n.getAttribute("listIndent")){if(!t||!t.isEnabled)return;t.execute({shouldMergeOnBlocksContentLevel:fO(e.model,"backward")})}else FI(n)||e.execute("splitListItemAfter"),e.execute("outdentList");r.preventDefault(),i.stop()}else{if(s.isCollapsed&&!s.getLastPosition().isAtEnd)return;if(!n||!n.isEnabled)return;n.execute({shouldMergeOnBlocksContentLevel:fO(e.model,"forward")}),r.preventDefault(),i.stop()}}))}),{context:"li"})}_setupEnterIntegration(){const e=this.editor,t=e.model,n=e.commands,i=n.get("enter");this.listenTo(e.editing.view.document,"enter",((n,i)=>{const r=t.document,s=r.selection.getFirstPosition().parent;if(r.selection.isCollapsed&&RI(s)&&s.isEmpty&&!i.isSoft){const t=BI(s),r=FI(s);t&&r?(e.execute("outdentList"),i.preventDefault(),n.stop()):t&&!r?(e.execute("splitListItemAfter"),i.preventDefault(),n.stop()):r&&(e.execute("splitListItemBefore"),i.preventDefault(),n.stop())}}),{context:"li"}),this.listenTo(i,"afterExecute",(()=>{const t=n.get("splitListItemBefore");t.refresh(),t.isEnabled&&2===NI(e.model.document.selection.getLastPosition().parent).length&&t.execute()}))}_setupTabIntegration(){const e=this.editor;this.listenTo(e.editing.view.document,"tab",((t,n)=>{const i=n.shiftKey?"outdentList":"indentList";this.editor.commands.get(i).isEnabled&&(e.execute(i),n.stopPropagation(),n.preventDefault(),t.stop())}),{context:"li"})}_setupConversion(){const e=this.editor,t=e.model,n=this.getListAttributeNames(),i=e.config.get("list.multiBlock"),r=i?"paragraph":"listItem";e.conversion.for("upcast").elementToElement({view:"li",model:(e,{writer:t})=>t.createElement(r,{listType:""})}).elementToElement({view:"p",model:(e,{writer:t})=>e.parent&&e.parent.is("element","li")?t.createElement(r,{listType:""}):null,converterPriority:"high"}).add((e=>{e.on("element:li",((e,t,n)=>{const{writer:i,schema:r}=n;if(!t.modelRange)return;const s=Array.from(t.modelRange.getItems({shallow:!0})).filter((e=>r.checkAttribute(e,"listItemId")));if(!s.length)return;const o=VI.next(),a=function(e){let t=0,n=e.parent;for(;n;){if(rO(n))t++;else{const e=n.previousSibling;e&&rO(e)&&t++}n=n.parent}return t}(t.viewItem);let l=t.viewItem.parent&&t.viewItem.parent.is("element","ol")?"numbered":"bulleted";const c=s[0].getAttribute("listType");c&&(l=c);const d={listItemId:o,listIndent:a,listType:l};for(const e of s)e.hasAttribute("listItemId")||i.setAttributes(d,e);s.length>1&&s[1].getAttribute("listItemId")!=d.listItemId&&n.keepEmptyElement(s[0])}))})),i||e.conversion.for("downcast").elementToElement({model:"listItem",view:"p"}),e.conversion.for("editingDowncast").elementToElement({model:r,view:uO(n),converterPriority:"high"}).add((e=>{var i;e.on("attribute",dO(n,this._downcastStrategies,t)),e.on("remove",(i=t.schema,(e,t,n)=>{const{writer:r,mapper:s}=n,o=e.name.split(":")[1];if(!i.checkAttribute(o,"listItemId"))return;const a=s.toViewPosition(t.position),l=t.position.getShiftedBy(t.length),c=s.toViewPosition(l,{isPhantom:!0}),d=r.createRange(a,c).getTrimmed().end.nodeBefore;d&&hO(d,r,s)}))})),e.conversion.for("dataDowncast").elementToElement({model:r,view:uO(n,{dataPipeline:!0}),converterPriority:"high"}).add((e=>{e.on("attribute",dO(n,this._downcastStrategies,t,{dataPipeline:!0}))}));const s=(o=this._downcastStrategies,a=e.editing.view,(e,t)=>{if(t.modelPosition.offset>0)return;const n=t.modelPosition.parent;if(!RI(n))return;if(!o.some((e=>"itemMarker"==e.scope&&e.canInjectMarkerIntoElement&&e.canInjectMarkerIntoElement(n))))return;const i=t.mapper.toViewElement(n),r=a.createRangeIn(i),s=r.getWalker();let l=r.start;for(const{item:e}of s){if(e.is("element")&&t.mapper.toModelElement(e)||e.is("$textProxy"))break;e.is("element")&&e.getCustomProperty("listItemMarker")&&(l=a.createPositionAfter(e),s.skip((({previousPosition:e})=>!e.isEqual(l))))}t.viewPosition=l});var o,a;e.editing.mapper.on("modelToViewPosition",s),e.data.mapper.on("modelToViewPosition",s),this.listenTo(t.document,"change:data",function(e,t,n,i){return()=>{const i=e.document.differ.getChanges(),o=[],a=new Set,l=new Set,c=new Set;for(const e of i)if("insert"==e.type&&"$text"!=e.name)cO(e.position,a,c),e.attributes.has("listItemId")?l.add(e.position.nodeAfter):cO(e.position.getShiftedBy(e.length),a,c);else if("remove"==e.type&&e.attributes.has("listItemId"))cO(e.position,a,c);else if("attribute"==e.type){const t=e.range.start.nodeAfter;n.includes(e.attributeKey)?(cO(e.range.start,a,c),null===e.attributeNewValue?(cO(e.range.start.getShiftedBy(1),a,c),s(t)&&o.push(t)):l.add(t)):RI(t)&&s(t)&&o.push(t)}for(const e of a.values())o.push(...r(e,l));for(const e of new Set(o))t.reconvertItem(e)};function r(e,t){const i=[],r=new Set,a=[];for(const{node:l,previous:c}of new II(e)){if(r.has(l))continue;const e=l.getAttribute("listIndent");c&&e<c.getAttribute("listIndent")&&(a.length=e+1),a[e]=Object.fromEntries(Array.from(l.getAttributes()).filter((([e])=>n.includes(e))));const d=LI(l,{direction:"forward"});for(const e of d)r.add(e),(s(e,d)||o(e,a,t))&&i.push(e)}return i}function s(e,r){const s=t.mapper.toViewElement(e);if(!s)return!1;if(i.fire("checkElement",{modelElement:e,viewElement:s}))return!0;if(!e.is("element","paragraph")&&!e.is("element","listItem"))return!1;const o=mO(e,n,r);return!(!o||!s.is("element","p"))||!(o||!s.is("element","span"))}function o(e,n,r){if(r.has(e))return!1;const s=t.mapper.toViewElement(e);let o=n.length-1;for(let e=s.parent;!e.is("editableElement");e=e.parent){const t=rO(e),r=iO(e);if(!r&&!t)continue;const s="checkAttributes:"+(t?"item":"list");if(i.fire(s,{viewElement:e,modelAttributes:n[o]}))break;if(r&&(o--,o<0))return!1}return!0}}(t,e.editing,n,this),{priority:"high"}),this.on("checkAttributes:item",((e,{viewElement:t,modelAttributes:n})=>{t.id!=n.listItemId&&(e.return=!0,e.stop())})),this.on("checkAttributes:list",((e,{viewElement:t,modelAttributes:n})=>{t.name==aO(n.listType)&&t.id==lO(n.listType,n.listIndent)||(e.return=!0,e.stop())}))}_setupModelPostFixing(){const e=this.editor.model,t=this.getListAttributeNames();e.document.registerPostFixer((n=>function(e,t,n,i){const r=e.document.differ.getChanges(),s=new Set,o=new Set,a=i.editor.config.get("list.multiBlock");let l=!1;for(const i of r){if("insert"==i.type&&"$text"!=i.name){const r=i.position.nodeAfter;if(!e.schema.checkAttribute(r,"listItemId"))for(const e of Array.from(r.getAttributeKeys()))n.includes(e)&&(t.removeAttribute(e,r),l=!0);cO(i.position,o,s),i.attributes.has("listItemId")||cO(i.position.getShiftedBy(i.length),o,s);for(const{item:t,previousPosition:n}of e.createRangeIn(r))RI(t)&&cO(n,o,s)}else"remove"==i.type?cO(i.position,o,s):"attribute"==i.type&&n.includes(i.attributeKey)&&(cO(i.range.start,o,s),null===i.attributeNewValue&&cO(i.range.start.getShiftedBy(1),o,s));if(!a&&"attribute"==i.type&&gO.includes(i.attributeKey)){const e=i.range.start.nodeAfter;null===i.attributeNewValue&&e&&e.is("element","listItem")?(t.rename(e,"paragraph"),l=!0):null===i.attributeOldValue&&e&&e.is("element")&&"listItem"!=e.name&&(t.rename(e,"listItem"),l=!0)}}const c=new Set;for(const e of o.values())l=i.fire("postFixer",{listNodes:new OI(e),listHead:e,writer:t,seenIds:c})||l;return l}(e,n,t,this))),this.on("postFixer",((e,{listNodes:t,writer:n})=>{e.return=function(e,t){let n=0,i=-1,r=null,s=!1;for(const{node:o}of e){const e=o.getAttribute("listIndent");if(e>n){let a;null===r?(r=e-n,a=n):(r>e&&(r=e),a=e-r),a>i+1&&(a=i+1),t.setAttribute("listIndent",a,o),s=!0,i=a}else r=null,n=e+1,i=e}return s}(t,n)||e.return}),{priority:"high"}),this.on("postFixer",((e,{listNodes:t,writer:n,seenIds:i})=>{e.return=function(e,t,n){const i=new Set;let r=!1;for(const{node:s}of e){if(i.has(s))continue;let e=s.getAttribute("listType"),o=s.getAttribute("listItemId");if(t.has(o)&&(o=VI.next()),t.add(o),s.is("element","listItem"))s.getAttribute("listItemId")!=o&&(n.setAttribute("listItemId",o,s),r=!0);else for(const t of LI(s,{direction:"forward"}))i.add(t),t.getAttribute("listType")!=e&&(o=VI.next(),e=t.getAttribute("listType")),t.getAttribute("listItemId")!=o&&(n.setAttribute("listItemId",o,t),r=!0)}return r}(t,i,n)||e.return}),{priority:"high"})}_setupClipboardIntegration(){const e=this.editor.model,t=this.editor.plugins.get("ClipboardPipeline");this.listenTo(e,"insertContent",function(e){return(t,[n,i])=>{const r=n.is("documentFragment")?Array.from(n.getChildren()):[n];if(!r.length)return;const s=(i?e.createSelection(i):e.document.selection).getFirstPosition();let o;if(RI(s.parent))o=s.parent;else{if(!RI(s.nodeBefore)||!RI(s.nodeAfter))return;o=s.nodeBefore}e.change((e=>{const t=o.getAttribute("listType"),n=o.getAttribute("listIndent"),i=r[0].getAttribute("listIndent")||0,s=Math.max(n-i,0);for(const n of r){const i=RI(n);o.is("element","listItem")&&n.is("element","paragraph")&&e.rename(n,"listItem"),e.setAttributes({listIndent:(i?n.getAttribute("listIndent"):0)+s,listItemId:i?n.getAttribute("listItemId"):VI.next(),listType:t},n)}}))}}(e),{priority:"high"}),this.listenTo(t,"outputTransformation",((t,n)=>{e.change((e=>{const t=Array.from(n.content.getChildren()),i=t[t.length-1];if(t.length>1&&i.is("element")&&i.isEmpty&&t.slice(0,-1).every(RI)&&e.remove(i),"copy"==n.method||"cut"==n.method){const t=Array.from(n.content.getChildren());UI(t)&&WI(t,e)}}))}))}_setupAccessibilityIntegration(){const e=this.editor,t=e.t;e.accessibility.addKeystrokeInfoGroup({id:"list",label:t("Keystrokes that can be used in a list"),keystrokes:[{label:t("Increase list item indent"),keystroke:"Tab"},{label:t("Decrease list item indent"),keystroke:"Shift+Tab"}]})}}function fO(e,t){const n=e.document.selection;if(!n.isCollapsed)return!GI(e);if("forward"===t)return!0;const i=n.getFirstPosition().parent,r=i.previousSibling;return!e.schema.isObject(r)&&(!!r.isEmpty||UI([i,r]))}function bO(e,t,n,i){e.ui.componentFactory.add(t,(()=>{const r=wO(jb,e,t,n,i);return r.set({tooltip:!0,isToggleable:!0}),r})),e.ui.componentFactory.add(`menuBar:${t}`,(()=>{const r=wO(sw,e,t,n,i);return r.set({role:"menuitemcheckbox",isToggleable:!0}),r}))}function wO(e,t,n,i,r){const s=t.commands.get(n),o=new e(t.locale);return o.set({label:i,icon:r}),o.bind("isOn","isEnabled").to(s,"value","isEnabled"),o.on("execute",(()=>{t.execute(n),t.editing.view.focus()})),o}class vO extends cf{static get pluginName(){return"ListUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.t;this.editor.ui.componentFactory.has("numberedList")||bO(this.editor,"numberedList",e("Numbered List"),Pf.numberedList),this.editor.ui.componentFactory.has("bulletedList")||bO(this.editor,"bulletedList",e("Bulleted List"),Pf.bulletedList)}}class yO extends cf{static get requires(){return[pO,vO]}static get pluginName(){return"List"}static get isOfficialPlugin(){return!0}}class _O extends uf{refresh(){const e=this._getValue();this.value=e,this.isEnabled=null!=e}execute({startIndex:e=1}={}){const t=this.editor.model,n=t.document;let i=Array.from(n.selection.getSelectedBlocks()).filter((e=>RI(e)&&ZI(e.getAttribute("listType"))));i=zI(i),t.change((t=>{for(const n of i)t.setAttribute("listStart",e>=0?e:1,n)}))}_getValue(){const e=ac(this.editor.model.document.selection.getSelectedBlocks());return e&&RI(e)&&ZI(e.getAttribute("listType"))?e.getAttribute("listStart"):null}}const kO={},xO={},CO={},AO=[{listStyle:"disc",typeAttribute:"disc",listType:"bulleted"},{listStyle:"circle",typeAttribute:"circle",listType:"bulleted"},{listStyle:"square",typeAttribute:"square",listType:"bulleted"},{listStyle:"decimal",typeAttribute:"1",listType:"numbered"},{listStyle:"decimal-leading-zero",typeAttribute:null,listType:"numbered"},{listStyle:"lower-roman",typeAttribute:"i",listType:"numbered"},{listStyle:"upper-roman",typeAttribute:"I",listType:"numbered"},{listStyle:"lower-alpha",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-alpha",typeAttribute:"A",listType:"numbered"},{listStyle:"lower-latin",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-latin",typeAttribute:"A",listType:"numbered"}];for(const{listStyle:e,typeAttribute:t,listType:n}of AO)kO[e]=n,xO[e]=t,t&&(CO[t]=e);function EO(){return AO.map((e=>e.listStyle))}function TO(e){return kO[e]||null}function SO(e){return CO[e]||null}function PO(e){return xO[e]||null}class IO extends uf{defaultType;_supportedTypes;constructor(e,t,n){super(e),this.defaultType=t,this._supportedTypes=n}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,n=t.document;t.change((t=>{this._tryToConvertItemsToList(e);let i=Array.from(n.selection.getSelectedBlocks()).filter((e=>e.hasAttribute("listType")));if(i.length){i=zI(i);for(const n of i)t.setAttribute("listStyle",e.type||this.defaultType,n)}}))}isStyleTypeSupported(e){return!this._supportedTypes||this._supportedTypes.includes(e)}_getValue(){const e=ac(this.editor.model.document.selection.getSelectedBlocks());return RI(e)?e.getAttribute("listStyle"):null}_checkEnabled(){const e=this.editor,t=e.commands.get("numberedList"),n=e.commands.get("bulletedList");return t.isEnabled||n.isEnabled}_tryToConvertItemsToList(e){if(!e.type)return;const t=TO(e.type);if(!t)return;const n=this.editor,i=`${t}List`;n.commands.get(i).value||n.execute(i)}}class OO extends uf{refresh(){const e=this._getValue();this.value=e,this.isEnabled=null!=e}execute(e={}){const t=this.editor.model,n=t.document;let i=Array.from(n.selection.getSelectedBlocks()).filter((e=>RI(e)&&"numbered"==e.getAttribute("listType")));i=zI(i),t.change((t=>{for(const n of i)t.setAttribute("listReversed",!!e.reversed,n)}))}_getValue(){const e=ac(this.editor.model.document.selection.getSelectedBlocks());return RI(e)&&"numbered"==e.getAttribute("listType")?e.getAttribute("listReversed"):null}}function VO(e){return(t,n,i)=>{const{writer:r,schema:s,consumable:o}=i;if(!1===o.test(n.viewItem,e.viewConsumables))return;n.modelRange||Object.assign(n,i.convertChildren(n.viewItem,n.modelCursor));let a=!1;for(const t of n.modelRange.getItems({shallow:!0}))s.checkAttribute(t,e.attributeName)&&e.appliesToListItem(t)&&(t.hasAttribute(e.attributeName)||(r.setAttribute(e.attributeName,e.getAttributeOnUpcast(n.viewItem),t),a=!0));a&&o.consume(n.viewItem,e.viewConsumables)}}class RO extends cf{static get pluginName(){return"ListPropertiesUtils"}static get isOfficialPlugin(){return!0}getAllSupportedStyleTypes(){return EO()}getListTypeFromListStyleType(e){return TO(e)}getListStyleTypeFromTypeAttribute(e){return SO(e)}getTypeAttributeFromListStyleType(e){return PO(e)}}function NO(e){const{startIndex:t,reversed:n,styles:i}=e;return{styles:LO(i),startIndex:t||!1,reversed:n||!1}}function LO(e){const t={listTypes:["bulleted","numbered"],useAttribute:!1};return!0===e||(e?Array.isArray(e)||"string"==typeof e?t.listTypes=rc(e):(t.listTypes=e.listTypes?rc(e.listTypes):t.listTypes,t.useAttribute=!!e.useAttribute,e.listStyleTypes&&(t.listStyleTypes=e.listStyleTypes)):t.listTypes=[]),t}const MO="default";class BO extends cf{static get requires(){return[pO,RO]}static get pluginName(){return"ListPropertiesEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("list.properties",{styles:!0,startIndex:!1,reversed:!1})}init(){const e=this.editor,t=e.model,n=e.plugins.get(pO),i=function(e){const t=[],n=NO(e);if(e.styles){const e=n.styles.useAttribute;t.push({attributeName:"listStyle",defaultValue:MO,viewConsumables:{styles:"list-style-type"},addCommand(t){let n=EO();e&&(n=n.filter((e=>!!PO(e)))),t.commands.add("listStyle",new IO(t,MO,n))},appliesToListItem:e=>"numbered"==e.getAttribute("listType")||"bulleted"==e.getAttribute("listType"),hasValidAttribute(e){if(!this.appliesToListItem(e))return!e.hasAttribute("listStyle");if(!e.hasAttribute("listStyle"))return!1;const t=e.getAttribute("listStyle");return t==MO||TO(t)==e.getAttribute("listType")},setAttributeOnDowncast(t,n,i){if(n&&n!==MO){if(!e)return void t.setStyle("list-style-type",n,i);{const e=PO(n);if(e)return void t.setAttribute("type",e,i)}}t.removeStyle("list-style-type",i),t.removeAttribute("type",i)},getAttributeOnUpcast(e){const t=e.getStyle("list-style-type");if(t)return function(e){switch(e){case"lower-alpha":return"lower-latin";case"upper-alpha":return"upper-latin";default:return e}}(t);const n=e.getAttribute("type");return n?SO(n):MO}})}return e.reversed&&t.push({attributeName:"listReversed",defaultValue:!1,viewConsumables:{attributes:"reversed"},addCommand(e){e.commands.add("listReversed",new OO(e))},appliesToListItem:e=>"numbered"==e.getAttribute("listType"),hasValidAttribute(e){return this.appliesToListItem(e)==e.hasAttribute("listReversed")},setAttributeOnDowncast(e,t,n){t?e.setAttribute("reversed","reversed",n):e.removeAttribute("reversed",n)},getAttributeOnUpcast:e=>e.hasAttribute("reversed")}),e.startIndex&&t.push({attributeName:"listStart",defaultValue:1,viewConsumables:{attributes:"start"},addCommand(e){e.commands.add("listStart",new _O(e))},appliesToListItem:e=>ZI(e.getAttribute("listType")),hasValidAttribute(e){return this.appliesToListItem(e)==e.hasAttribute("listStart")},setAttributeOnDowncast(e,t,n){0==t||t>1?e.setAttribute("start",t,n):e.removeAttribute("start",n)},getAttributeOnUpcast(e){const t=e.getAttribute("start");return t>=0?t:1}}),t}(e.config.get("list.properties"));for(const r of i)r.addCommand(e),t.schema.extend("$listItem",{allowAttributes:r.attributeName}),n.registerDowncastStrategy({scope:"list",attributeName:r.attributeName,setAttributeOnDowncast(e,t,n){r.setAttributeOnDowncast(e,t,n)}});e.conversion.for("upcast").add((e=>{for(const t of i)e.on("element:ol",VO(t)),e.on("element:ul",VO(t))})),n.on("checkAttributes:list",((e,{viewElement:t,modelAttributes:n})=>{for(const r of i)r.getAttributeOnUpcast(t)!=n[r.attributeName]&&(e.return=!0,e.stop())})),this.listenTo(e.commands.get("indentList"),"afterExecute",((e,n)=>{t.change((e=>{for(const t of n)for(const n of i)n.appliesToListItem(t)&&e.setAttribute(n.attributeName,n.defaultValue,t)}))})),n.on("postFixer",((e,{listNodes:t,writer:n})=>{for(const{node:r}of t)for(const t of i)t.hasValidAttribute(r)||(t.appliesToListItem(r)?n.setAttribute(t.attributeName,t.defaultValue,r):n.removeAttribute(t.attributeName,r),e.return=!0)})),n.on("postFixer",((e,{listNodes:t,writer:n})=>{for(const{node:r,previousNodeInList:s}of t)if(s&&s.getAttribute("listType")==r.getAttribute("listType"))for(const t of i){const{attributeName:i}=t;if(!t.appliesToListItem(r))continue;const o=s.getAttribute(i);r.getAttribute(i)!=o&&(n.setAttribute(i,o,r),e.return=!0)}}))}}class FO extends Lb{children;stylesView=null;additionalPropertiesCollapsibleView=null;startIndexFieldView=null;reversedSwitchButtonView=null;focusTracker=new lc;keystrokes=new hc;focusables=new mb;focusCycler;constructor(e,{enabledProperties:t,styleButtonViews:n,styleGridAriaLabel:i}){super(e);const r=["ck","ck-list-properties"];this.children=this.createCollection(),this.focusCycler=new Ub({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),n&&n.length?(this.stylesView=this._createStylesView(n,i),this.children.add(this.stylesView)):r.push("ck-list-properties_without-styles"),(t.startIndex||t.reversed)&&(this._addNumberedListPropertyViews(t),r.push("ck-list-properties_with-numbered-properties")),this.setTemplate({tag:"div",attributes:{class:r},children:this.children})}render(){if(super.render(),this.stylesView){this.focusables.add(this.stylesView),this.focusTracker.add(this.stylesView.element),(this.startIndexFieldView||this.reversedSwitchButtonView)&&(this.focusables.add(this.children.last.buttonView),this.focusTracker.add(this.children.last.buttonView.element));for(const e of this.stylesView.children)this.stylesView.focusTracker.add(e.element);Db({keystrokeHandler:this.stylesView.keystrokes,focusTracker:this.stylesView.focusTracker,gridItems:this.stylesView.children,numberOfColumns:()=>ra.window.getComputedStyle(this.stylesView.element).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}if(this.startIndexFieldView){this.focusables.add(this.startIndexFieldView),this.focusTracker.add(this.startIndexFieldView.element);const e=e=>e.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}this.reversedSwitchButtonView&&(this.focusables.add(this.reversedSwitchButtonView),this.focusTracker.add(this.reversedSwitchButtonView.element)),this.keystrokes.listenTo(this.element)}focus(){this.focusCycler.focusFirst()}focusLast(){this.focusCycler.focusLast()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createStylesView(e,t){const n=new Lb(this.locale);return n.children=n.createCollection(),n.children.addMany(e),n.setTemplate({tag:"div",attributes:{"aria-label":t,class:["ck","ck-list-styles-list"]},children:n.children}),n.children.delegate("execute").to(this),n.focus=function(){for(const e of this.children)if(e instanceof jb&&e.isOn)return void e.focus();this.children.first.focus()},n.focusTracker=new lc,n.keystrokes=new hc,n.render(),n.keystrokes.listenTo(n.element),n}_addNumberedListPropertyViews(e){const t=this.locale.t,n=[];e.startIndex&&(this.startIndexFieldView=this._createStartIndexField(),n.push(this.startIndexFieldView)),e.reversed&&(this.reversedSwitchButtonView=this._createReversedSwitchButton(),n.push(this.reversedSwitchButtonView)),this.stylesView?(this.additionalPropertiesCollapsibleView=new ww(this.locale,n),this.additionalPropertiesCollapsibleView.set({label:t("List properties"),isCollapsed:!0}),this.additionalPropertiesCollapsibleView.buttonView.bind("isEnabled").toMany(n,"isEnabled",((...e)=>e.some((e=>e)))),this.additionalPropertiesCollapsibleView.buttonView.on("change:isEnabled",((e,t,n)=>{n||(this.additionalPropertiesCollapsibleView.isCollapsed=!0)})),this.children.add(this.additionalPropertiesCollapsibleView)):this.children.addMany(n)}_createStartIndexField(){const e=this.locale.t,t=new Ew(this.locale,ov);return t.set({label:e("Start at"),class:"ck-numbered-list-properties__start-index"}),t.fieldView.set({min:0,step:1,value:1,inputMode:"numeric"}),t.fieldView.on("input",(()=>{const n=t.fieldView.element,i=n.valueAsNumber;Number.isNaN(i)?t.errorText=e("Invalid start index value."):n.checkValidity()?this.fire("listStart",{startIndex:i}):t.errorText=e("Start index must be greater than 0.")})),t}_createReversedSwitchButton(){const e=this.locale.t,t=new hw(this.locale);return t.set({withText:!0,label:e("Reversed order"),class:"ck-numbered-list-properties__reversed-order"}),t.delegate("execute").to(this,"listReversed"),t}}class DO extends cf{static get pluginName(){return"ListPropertiesUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.locale.t,n=e.config.get("list.properties"),i=NO(n),r=i.styles.listTypes;if(r.includes("bulleted")){const n=[{label:t("Toggle the disc list style"),tooltip:t("Disc"),type:"disc",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M11 27a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0-9a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0-9a3 3 0 1 1 0 6 3 3 0 0 1 0-6z"/></svg>'},{label:t("Toggle the circle list style"),tooltip:t("Circle"),type:"circle",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M11 27a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0-10a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0-10a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4z"/></svg>'},{label:t("Toggle the square list style"),tooltip:t("Square"),type:"square",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M14 27v6H8v-6h6zm0-9v6H8v-6h6zm0-9v6H8V9h6z"/></svg>'}],r=t("Bulleted List"),s=t("Bulleted list styles toolbar"),o="bulletedList";e.ui.componentFactory.add(o,zO({editor:e,normalizedConfig:i,parentCommandName:o,buttonLabel:r,buttonIcon:Pf.bulletedList,styleGridAriaLabel:s,styleDefinitions:n})),e.ui.componentFactory.add(`menuBar:${o}`,jO({editor:e,normalizedConfig:i,parentCommandName:o,buttonLabel:r,styleGridAriaLabel:s,styleDefinitions:n}))}if(r.includes("numbered")||n.startIndex||n.reversed){const n=[{label:t("Toggle the decimal list style"),tooltip:t("Decimal"),type:"decimal",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M10.29 15V8.531H9.286c-.14.393-.4.736-.778 1.03-.378.295-.728.495-1.05.6v1.121a4.257 4.257 0 0 0 1.595-.936V15h1.235zm3.343 0v-1.235h-1.235V15h1.235zM11.3 24v-1.147H8.848c.064-.111.148-.226.252-.343.104-.117.351-.354.74-.712.39-.357.66-.631.81-.821.225-.288.39-.562.494-.824.104-.263.156-.539.156-.829 0-.51-.182-.936-.545-1.279-.363-.342-.863-.514-1.499-.514-.58 0-1.063.148-1.45.444-.387.296-.617.784-.69 1.463l1.23.124c.024-.36.112-.619.264-.774.153-.155.358-.233.616-.233.26 0 .465.074.613.222.148.148.222.36.222.635 0 .25-.085.501-.255.756-.126.185-.468.536-1.024 1.055-.692.641-1.155 1.156-1.389 1.544-.234.389-.375.8-.422 1.233H11.3zm2.333 0v-1.235h-1.235V24h1.235zM9.204 34.11c.615 0 1.129-.2 1.542-.598.413-.398.62-.88.62-1.446 0-.39-.11-.722-.332-.997a1.5 1.5 0 0 0-.886-.532c.619-.337.928-.788.928-1.353 0-.399-.151-.756-.453-1.073-.366-.386-.852-.58-1.459-.58a2.25 2.25 0 0 0-.96.2 1.617 1.617 0 0 0-.668.55c-.16.232-.28.544-.358.933l1.138.194c.032-.282.123-.495.272-.642.15-.146.33-.22.54-.22.215 0 .386.065.515.194s.193.302.193.518c0 .255-.087.46-.263.613-.176.154-.43.227-.765.218l-.136 1.006c.22-.061.409-.092.567-.092.24 0 .444.09.61.272.168.182.251.428.251.739 0 .328-.087.589-.261.782a.833.833 0 0 1-.644.29.841.841 0 0 1-.607-.242c-.167-.16-.27-.394-.307-.698l-1.196.145c.062.542.285.98.668 1.316.384.335.868.503 1.45.503zm4.43-.11v-1.235h-1.236V34h1.235z"/></svg>'},{label:t("Toggle the decimal with leading zero list style"),tooltip:t("Decimal with leading zero"),type:"decimal-leading-zero",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M5.714 15.11c.624 0 1.11-.22 1.46-.66.421-.533.632-1.408.632-2.627 0-1.222-.21-2.096-.629-2.624-.351-.445-.839-.668-1.463-.668-.624 0-1.11.22-1.459.66-.422.533-.633 1.406-.633 2.619 0 1.236.192 2.095.576 2.577.384.482.89.723 1.516.723zm0-1.024a.614.614 0 0 1-.398-.14c-.115-.094-.211-.283-.287-.565-.077-.283-.115-.802-.115-1.558s.043-1.294.128-1.613c.064-.246.155-.417.272-.512a.617.617 0 0 1 .4-.143.61.61 0 0 1 .398.143c.116.095.211.284.288.567.076.283.114.802.114 1.558s-.043 1.292-.128 1.608c-.064.246-.155.417-.272.512a.617.617 0 0 1-.4.143zm6.078.914V8.531H10.79c-.14.393-.4.736-.778 1.03-.378.295-.728.495-1.05.6v1.121a4.257 4.257 0 0 0 1.595-.936V15h1.235zm3.344 0v-1.235h-1.235V15h1.235zm-9.422 9.11c.624 0 1.11-.22 1.46-.66.421-.533.632-1.408.632-2.627 0-1.222-.21-2.096-.629-2.624-.351-.445-.839-.668-1.463-.668-.624 0-1.11.22-1.459.66-.422.533-.633 1.406-.633 2.619 0 1.236.192 2.095.576 2.577.384.482.89.723 1.516.723zm0-1.024a.614.614 0 0 1-.398-.14c-.115-.094-.211-.283-.287-.565-.077-.283-.115-.802-.115-1.558s.043-1.294.128-1.613c.064-.246.155-.417.272-.512a.617.617 0 0 1 .4-.143.61.61 0 0 1 .398.143c.116.095.211.284.288.567.076.283.114.802.114 1.558s-.043 1.292-.128 1.608c-.064.246-.155.417-.272.512a.617.617 0 0 1-.4.143zm7.088.914v-1.147H10.35c.065-.111.149-.226.253-.343.104-.117.35-.354.74-.712.39-.357.66-.631.81-.821.225-.288.39-.562.493-.824.104-.263.156-.539.156-.829 0-.51-.181-.936-.544-1.279-.364-.342-.863-.514-1.499-.514-.58 0-1.063.148-1.45.444-.387.296-.617.784-.69 1.463l1.23.124c.024-.36.112-.619.264-.774.152-.155.357-.233.615-.233.261 0 .465.074.613.222.148.148.222.36.222.635 0 .25-.085.501-.255.756-.126.185-.467.536-1.024 1.055-.691.641-1.154 1.156-1.388 1.544-.235.389-.375.8-.422 1.233h4.328zm2.334 0v-1.235h-1.235V24h1.235zM5.714 34.11c.624 0 1.11-.22 1.46-.66.421-.533.632-1.408.632-2.627 0-1.222-.21-2.096-.629-2.624-.351-.445-.839-.668-1.463-.668-.624 0-1.11.22-1.459.66-.422.533-.633 1.406-.633 2.619 0 1.236.192 2.095.576 2.577.384.482.89.723 1.516.723zm0-1.024a.614.614 0 0 1-.398-.14c-.115-.094-.211-.283-.287-.565-.077-.283-.115-.802-.115-1.558s.043-1.294.128-1.613c.064-.246.155-.417.272-.512a.617.617 0 0 1 .4-.143.61.61 0 0 1 .398.143c.116.095.211.284.288.567.076.283.114.802.114 1.558s-.043 1.292-.128 1.608c-.064.246-.155.417-.272.512a.617.617 0 0 1-.4.143zm4.992 1.024c.616 0 1.13-.2 1.543-.598.413-.398.62-.88.62-1.446 0-.39-.111-.722-.332-.997a1.5 1.5 0 0 0-.886-.532c.618-.337.927-.788.927-1.353 0-.399-.15-.756-.452-1.073-.366-.386-.853-.58-1.46-.58a2.25 2.25 0 0 0-.96.2 1.617 1.617 0 0 0-.667.55c-.16.232-.28.544-.359.933l1.139.194c.032-.282.123-.495.272-.642.15-.146.33-.22.54-.22.214 0 .386.065.515.194s.193.302.193.518c0 .255-.088.46-.264.613-.175.154-.43.227-.764.218l-.136 1.006c.22-.061.408-.092.566-.092.24 0 .444.09.611.272.167.182.25.428.25.739 0 .328-.086.589-.26.782a.833.833 0 0 1-.644.29.841.841 0 0 1-.607-.242c-.167-.16-.27-.394-.308-.698l-1.195.145c.062.542.284.98.668 1.316.384.335.867.503 1.45.503zm4.43-.11v-1.235h-1.235V34h1.235z"/></svg>'},{label:t("Toggle the lower–roman list style"),tooltip:t("Lower–roman"),type:"lower-roman",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M11.88 8.7V7.558h-1.234V8.7h1.234zm0 5.3V9.333h-1.234V14h1.234zm2.5 0v-1.235h-1.234V14h1.235zm-4.75 4.7v-1.142H8.395V18.7H9.63zm0 5.3v-4.667H8.395V24H9.63zm2.5-5.3v-1.142h-1.234V18.7h1.235zm0 5.3v-4.667h-1.234V24h1.235zm2.501 0v-1.235h-1.235V24h1.235zM7.38 28.7v-1.142H6.145V28.7H7.38zm0 5.3v-4.667H6.145V34H7.38zm2.5-5.3v-1.142H8.646V28.7H9.88zm0 5.3v-4.667H8.646V34H9.88zm2.5-5.3v-1.142h-1.234V28.7h1.235zm0 5.3v-4.667h-1.234V34h1.235zm2.501 0v-1.235h-1.235V34h1.235z"/></svg>'},{label:t("Toggle the upper–roman list style"),tooltip:t("Upper-roman"),type:"upper-roman",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M11.916 15V8.558h-1.301V15h1.3zm2.465 0v-1.235h-1.235V15h1.235zM9.665 25v-6.442h-1.3V25h1.3zm2.5 0v-6.442h-1.3V25h1.3zm2.466 0v-1.235h-1.235V25h1.235zm-7.216 9v-6.442h-1.3V34h1.3zm2.5 0v-6.442h-1.3V34h1.3zm2.501 0v-6.442h-1.3V34h1.3zm2.465 0v-1.235h-1.235V34h1.235z"/></svg>'},{label:t("Toggle the lower–latin list style"),tooltip:t("Lower-latin"),type:"lower-latin",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M9.62 14.105c.272 0 .528-.05.768-.153s.466-.257.677-.462c.009.024.023.072.044.145.047.161.086.283.119.365h1.221a2.649 2.649 0 0 1-.222-.626c-.04-.195-.059-.498-.059-.908l.013-1.441c0-.536-.055-.905-.165-1.105-.11-.201-.3-.367-.569-.497-.27-.13-.68-.195-1.23-.195-.607 0-1.064.108-1.371.325-.308.217-.525.55-.65 1.002l1.12.202c.076-.217.176-.369.299-.455.123-.086.294-.13.514-.13.325 0 .546.05.663.152.118.101.176.27.176.508v.123c-.222.093-.622.194-1.2.303-.427.082-.755.178-.982.288-.227.11-.403.268-.53.474a1.327 1.327 0 0 0-.188.706c0 .398.138.728.415.988.277.261.656.391 1.136.391zm.368-.87a.675.675 0 0 1-.492-.189.606.606 0 0 1-.193-.448c0-.176.08-.32.241-.435.106-.07.33-.142.673-.215a7.19 7.19 0 0 0 .751-.19v.247c0 .296-.016.496-.048.602a.773.773 0 0 1-.295.409 1.07 1.07 0 0 1-.637.22zm4.645.765v-1.235h-1.235V14h1.235zM10.2 25.105c.542 0 1.003-.215 1.382-.646.38-.43.57-1.044.57-1.84 0-.771-.187-1.362-.559-1.774a1.82 1.82 0 0 0-1.41-.617c-.522 0-.973.216-1.354.65v-2.32H7.594V25h1.147v-.686a1.9 1.9 0 0 0 .67.592c.26.133.523.2.79.2zm-.299-.975c-.354 0-.638-.164-.852-.492-.153-.232-.229-.59-.229-1.073 0-.468.098-.818.295-1.048a.93.93 0 0 1 .738-.345c.302 0 .55.118.743.354.193.236.29.62.29 1.154 0 .5-.096.868-.288 1.1-.192.233-.424.35-.697.35zm4.478.87v-1.235h-1.234V25h1.234zm-4.017 9.105c.6 0 1.08-.142 1.437-.426.357-.284.599-.704.725-1.261l-1.213-.207c-.061.326-.167.555-.316.688a.832.832 0 0 1-.576.2.916.916 0 0 1-.75-.343c-.185-.228-.278-.62-.278-1.173 0-.498.091-.853.274-1.066.183-.212.429-.318.736-.318.232 0 .42.061.565.184.145.123.238.306.28.55l1.216-.22c-.146-.501-.387-.874-.722-1.119-.336-.244-.788-.366-1.356-.366-.695 0-1.245.214-1.653.643-.407.43-.61 1.03-.61 1.8 0 .762.202 1.358.608 1.788.406.431.95.646 1.633.646zM14.633 34v-1.235h-1.235V34h1.235z"/></svg>'},{label:t("Toggle the upper–latin list style"),tooltip:t("Upper-latin"),type:"upper-latin",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="m7.88 15 .532-1.463h2.575L11.549 15h1.415l-2.58-6.442H9.01L6.5 15h1.38zm2.69-2.549H8.811l.87-2.39.887 2.39zM14.88 15v-1.235h-1.234V15h1.234zM9.352 25c.83-.006 1.352-.02 1.569-.044.346-.038.636-.14.872-.305.236-.166.422-.387.558-.664.137-.277.205-.562.205-.855 0-.372-.106-.695-.317-.97-.21-.276-.512-.471-.905-.585a1.51 1.51 0 0 0 .661-.567 1.5 1.5 0 0 0 .244-.83c0-.28-.066-.53-.197-.754a1.654 1.654 0 0 0-.495-.539 1.676 1.676 0 0 0-.672-.266c-.25-.042-.63-.063-1.14-.063H7.158V25h2.193zm.142-3.88H8.46v-1.49h.747c.612 0 .983.007 1.112.022.217.026.38.102.49.226.11.125.165.287.165.486a.68.68 0 0 1-.192.503.86.86 0 0 1-.525.23 11.47 11.47 0 0 1-.944.023h.18zm.17 2.795H8.46v-1.723h1.05c.592 0 .977.03 1.154.092.177.062.313.16.406.295a.84.84 0 0 1 .14.492c0 .228-.06.41-.181.547a.806.806 0 0 1-.473.257c-.126.026-.423.04-.892.04zM14.88 25v-1.235h-1.234V25h1.234zm-5.018 9.11c.691 0 1.262-.17 1.711-.512.45-.341.772-.864.965-1.567l-1.261-.4c-.109.472-.287.818-.536 1.037-.25.22-.547.33-.892.33-.47 0-.85-.173-1.143-.519-.293-.345-.44-.925-.44-1.74 0-.767.15-1.322.447-1.665.297-.343.684-.514 1.162-.514.346 0 .64.096.881.29.242.193.4.457.477.79l1.288-.307c-.147-.516-.367-.911-.66-1.187-.492-.465-1.132-.698-1.92-.698-.902 0-1.63.296-2.184.89-.554.593-.83 1.426-.83 2.498 0 1.014.275 1.813.825 2.397.551.585 1.254.877 2.11.877zM14.88 34v-1.235h-1.234V34h1.234z"/></svg>'}],s=t("Numbered List"),o=t("Numbered list styles toolbar"),a="numberedList";e.ui.componentFactory.add(a,zO({editor:e,normalizedConfig:i,parentCommandName:a,buttonLabel:s,buttonIcon:Pf.numberedList,styleGridAriaLabel:o,styleDefinitions:n})),r.includes("numbered")&&e.ui.componentFactory.add(`menuBar:${a}`,jO({editor:e,normalizedConfig:i,parentCommandName:a,buttonLabel:s,styleGridAriaLabel:o,styleDefinitions:n}))}}}function zO({editor:e,normalizedConfig:t,parentCommandName:n,buttonLabel:i,buttonIcon:r,styleGridAriaLabel:s,styleDefinitions:o}){const a=e.commands.get(n);return l=>{const c=Yw(l,Qw),d=c.buttonView;return c.bind("isEnabled").to(a),c.class="ck-list-styles-dropdown",d.on("execute",(()=>{e.execute(n),e.editing.view.focus()})),d.set({label:i,icon:r,tooltip:!0,isToggleable:!0}),d.bind("isOn").to(a,"value",(e=>!!e)),c.once("change:isOpen",(()=>{const i=function({editor:e,normalizedConfig:t,dropdownView:n,parentCommandName:i,styleDefinitions:r,styleGridAriaLabel:s}){const o=e.locale,a={...t,..."numberedList"!=i?{startIndex:!1,reversed:!1}:null},l=i.replace("List","");let c=null;if(t.styles.listTypes.includes(l)){const n=e.commands.get("listStyle"),s=$O({editor:e,parentCommandName:i,listStyleCommand:n}),o=t.styles.listStyleTypes;let a=r;if(o){const e=o[l];e&&(a=r.filter((t=>e.includes(t.type))))}const d=HO(n);c=a.filter(d).map(s)}const d=new FO(o,{styleGridAriaLabel:s,enabledProperties:a,styleButtonViews:c});if(t.styles.listTypes.includes(l)&&nv(n,(()=>d.stylesView.children.find((e=>e.isOn)))),a.startIndex){const t=e.commands.get("listStart");d.startIndexFieldView.bind("isEnabled").to(t),d.startIndexFieldView.fieldView.bind("value").to(t),d.on("listStart",((t,n)=>e.execute("listStart",n)))}if(a.reversed){const t=e.commands.get("listReversed");d.reversedSwitchButtonView.bind("isEnabled").to(t),d.reversedSwitchButtonView.bind("isOn").to(t,"value",(e=>!!e)),d.on("listReversed",(()=>{const n=t.value;e.execute("listReversed",{reversed:!n})}))}return d.delegate("execute").to(n),d}({editor:e,normalizedConfig:t,dropdownView:c,parentCommandName:n,styleGridAriaLabel:s,styleDefinitions:o});c.panelView.children.add(i)})),c.on("execute",(()=>{e.editing.view.focus()})),c}}function $O({editor:e,listStyleCommand:t,parentCommandName:n}){const i=e.locale,r=e.commands.get(n);return({label:s,type:o,icon:a,tooltip:l})=>{const c=new jb(i);return c.set({label:s,icon:a,tooltip:l}),c.bind("isOn").to(t,"value",(e=>e===o)),c.on("execute",(()=>{r.value?t.value===o?e.execute(n):t.value!==o&&e.execute("listStyle",{type:o}):e.model.change((()=>{e.execute("listStyle",{type:o})}))})),c}}function jO({editor:e,normalizedConfig:t,parentCommandName:n,buttonLabel:i,styleGridAriaLabel:r,styleDefinitions:s}){return o=>{const a=new gy(o),l=e.commands.get(n),c=e.commands.get("listStyle"),d=HO(c),u=$O({editor:e,parentCommandName:n,listStyleCommand:c}),h=t.styles.listStyleTypes;let m=s;if(h){const e=h[l.type];e&&(m=s.filter((t=>e.includes(t.type))))}const g=m.filter(d).map(u),p=new FO(o,{styleGridAriaLabel:r,enabledProperties:{...t,startIndex:!1,reversed:!1},styleButtonViews:g});return p.delegate("execute").to(a),a.buttonView.set({label:i,icon:Pf[n]}),a.panelView.children.add(p),a.bind("isEnabled").to(l,"isEnabled"),a.on("execute",(()=>{e.editing.view.focus()})),a}}function HO(e){return"function"==typeof e.isStyleTypeSupported?t=>e.isStyleTypeSupported(t.type):()=>!0}class WO extends cf{static get requires(){return[BO,DO]}static get pluginName(){return"ListProperties"}static get isOfficialPlugin(){return!0}}class UO extends uf{constructor(e){super(e),this.on("execute",(()=>{this.refresh()}),{priority:"highest"})}refresh(){const e=this._getSelectedItems();this.value=this._getValue(e),this.isEnabled=!!e.length}execute(e={}){this.editor.model.change((t=>{const n=this._getSelectedItems(),i=void 0===e.forceValue?!this._getValue(n):e.forceValue;for(const e of n)i?t.setAttribute("todoListChecked",!0,e):t.removeAttribute("todoListChecked",e)}))}_getValue(e){return e.every((e=>e.getAttribute("todoListChecked")))}_getSelectedItems(){const e=this.editor.model,t=e.schema,n=e.document.selection.getFirstRange(),i=n.start.parent,r=[];t.checkAttribute(i,"todoListChecked")&&r.push(...NI(i));for(const e of n.getItems({shallow:!0}))t.checkAttribute(e,"todoListChecked")&&!r.includes(e)&&r.push(...NI(e));return r}}class qO extends Yu{domEventType=["change"];onDomEvent(e){if(e.target){const t=this.view.domConverter.mapDomToView(e.target);t&&t.is("element","input")&&"checkbox"==t.getAttribute("type")&&t.findAncestor({classes:"todo-list__label"})&&this.fire("todoCheckboxChange",e)}}}const GO=Jl("Ctrl+Enter");class KO extends cf{static get pluginName(){return"TodoListEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[pO]}init(){const e=this.editor,t=e.model,n=e.editing,i=e.plugins.get(pO),r=e.config.get("list.multiBlock")?"paragraph":"listItem";e.commands.add("todoList",new XI(e,"todo")),e.commands.add("checkTodoList",new UO(e)),n.view.addObserver(qO),t.schema.extend("$listItem",{allowAttributes:"todoListChecked"}),t.schema.addAttributeCheck((e=>{const t=e.last;if(!t.getAttribute("listItemId")||"todo"!=t.getAttribute("listType"))return!1}),"todoListChecked"),e.conversion.for("upcast").add((e=>{e.on("element:input",((e,t,n)=>{const i=t.modelCursor,r=i.parent,s=t.viewItem;if(!n.consumable.test(s,{name:!0}))return;if("checkbox"!=s.getAttribute("type")||!i.isAtStart||!r.hasAttribute("listType"))return;n.consumable.consume(s,{name:!0});const o=n.writer;o.setAttribute("listType","todo",r),t.viewItem.hasAttribute("checked")&&o.setAttribute("todoListChecked",!0,r),t.modelRange=o.createRange(i)})),e.on("element:li",((e,t,n)=>{const{writer:i,schema:r}=n;if(!t.modelRange)return;const s=Array.from(t.modelRange.getItems({shallow:!0})).filter((e=>"todo"===e.getAttribute("listType")&&r.checkAttribute(e,"listItemId"))).reduce(((e,t)=>{const n=t.getAttribute("listItemId");return e.has(n)||e.set(n,NI(t)),e}),new Map);for(const[,e]of s.entries())if(e.some((e=>e.getAttribute("todoListChecked"))))for(const t of e)i.setAttribute("todoListChecked",!0,t)}),{priority:"low"}),e.on("element:label",ZO({name:"label",classes:"todo-list__label"})),e.on("element:label",ZO({name:"label",classes:["todo-list__label","todo-list__label_without-description"]})),e.on("element:span",ZO({name:"span",classes:"todo-list__label__description"})),e.on("element:ul",function(){const e=new Rd({name:"ul",classes:"todo-list"});return(t,n,i)=>{const r=e.match(n.viewItem);if(!r)return;const s=r.match;s.name=!1,i.consumable.consume(n.viewItem,s)}}())})),e.conversion.for("downcast").elementToElement({model:r,view:(e,{writer:t})=>{if(QO(e,i.getListAttributeNames()))return t.createContainerElement("span",{class:"todo-list__label__description"})},converterPriority:"highest"}),i.registerDowncastStrategy({scope:"list",attributeName:"listType",setAttributeOnDowncast(e,t,n){"todo"==t?e.addClass("todo-list",n):e.removeClass("todo-list",n)}}),i.registerDowncastStrategy({scope:"itemMarker",attributeName:"todoListChecked",createElement(e,t,{dataPipeline:n}){if("todo"!=t.getAttribute("listType"))return null;const i=e.createUIElement("input",{type:"checkbox",...t.getAttribute("todoListChecked")?{checked:"checked"}:null,...n?{disabled:"disabled"}:{tabindex:"-1"}});if(n)return i;const r=e.createContainerElement("span",{contenteditable:"false"},i);return r.getFillerOffset=()=>null,r},canWrapElement:e=>QO(e,i.getListAttributeNames()),createWrapperElement(e,t,{dataPipeline:n}){const r=["todo-list__label"];return QO(t,i.getListAttributeNames())||r.push("todo-list__label_without-description"),e.createAttributeElement(n?"label":"span",{class:r.join(" ")})}}),i.on("checkElement",((e,{modelElement:t,viewElement:n})=>{const r=QO(t,i.getListAttributeNames());n.hasClass("todo-list__label__description")!=r&&(e.return=!0,e.stop())})),i.on("checkElement",((t,{modelElement:n,viewElement:i})=>{const r="todo"==n.getAttribute("listType")&&BI(n);let s=!1;const o=e.editing.view.createPositionBefore(i).getWalker({direction:"backward"});for(const{item:t}of o){if(t.is("element")&&e.editing.mapper.toModelElement(t))break;t.is("element","input")&&"checkbox"==t.getAttribute("type")&&(s=!0)}s!=r&&(t.return=!0,t.stop())})),i.on("postFixer",((e,{listNodes:t,writer:n})=>{for(const{node:i,previousNodeInList:r}of t){if(!r)continue;if(r.getAttribute("listItemId")!=i.getAttribute("listItemId"))continue;const t=r.hasAttribute("todoListChecked"),s=i.hasAttribute("todoListChecked");s&&!t?(n.removeAttribute("todoListChecked",i),e.return=!0):!s&&t&&(n.setAttribute("todoListChecked",!0,i),e.return=!0)}})),t.document.registerPostFixer((e=>{const n=t.document.differ.getChanges();let i=!1;for(const t of n)if("attribute"==t.type&&"listType"==t.attributeKey){const n=t.range.start.nodeAfter;"todo"==t.attributeOldValue&&n.hasAttribute("todoListChecked")&&(e.removeAttribute("todoListChecked",n),i=!0)}else if("insert"==t.type&&"$text"!=t.name)for(const{item:n}of e.createRangeOn(t.position.nodeAfter))n.is("element")&&"todo"!=n.getAttribute("listType")&&n.hasAttribute("todoListChecked")&&(e.removeAttribute("todoListChecked",n),i=!0);return i})),this.listenTo(n.view.document,"keydown",((t,n)=>{Yl(n)===GO&&(e.execute("checkTodoList"),t.stop())}),{priority:"high"}),this.listenTo(n.view.document,"todoCheckboxChange",((e,t)=>{const i=t.target;if(!i||!i.is("element","input"))return;const r=n.view.createPositionAfter(i),s=n.mapper.toModelPosition(r).parent;s&&RI(s)&&"todo"==s.getAttribute("listType")&&this._handleCheckmarkChange(s)})),this.listenTo(n.view.document,"arrowKey",function(e,t){return(n,i)=>{const r=ec(i.keyCode,t.contentLanguageDirection),s=e.schema,o=e.document.selection;if(!o.isCollapsed)return;const a=o.getFirstPosition(),l=a.parent;if("right"==r&&a.isAtEnd){const t=s.getNearestSelectionRange(e.createPositionAfter(l),"forward");if(!t)return;const r=t.start.parent;r&&RI(r)&&"todo"==r.getAttribute("listType")&&(e.change((e=>e.setSelection(t))),i.preventDefault(),i.stopPropagation(),n.stop())}else if("left"==r&&a.isAtStart&&RI(l)&&"todo"==l.getAttribute("listType")){const t=s.getNearestSelectionRange(e.createPositionBefore(l),"backward");if(!t)return;e.change((e=>e.setSelection(t))),i.preventDefault(),i.stopPropagation(),n.stop()}}}(t,e.locale),{context:"$text"}),this.listenTo(n.mapper,"viewToModelPosition",((e,n)=>{const i=n.viewPosition.parent,r=i.is("attributeElement","li")&&0==n.viewPosition.offset,s=YO(i)&&n.viewPosition.offset<=1,o=i.is("element","span")&&"false"==i.getAttribute("contenteditable")&&YO(i.parent);if(!r&&!s&&!o)return;const a=n.modelPosition.nodeAfter;a&&"todo"==a.getAttribute("listType")&&(n.modelPosition=t.createPositionAt(a,0))}),{priority:"low"}),this._initAriaAnnouncements()}_handleCheckmarkChange(e){const t=this.editor,n=t.model,i=Array.from(n.document.selection.getRanges());n.change((n=>{n.setSelection(e,"end"),t.execute("checkTodoList"),n.setSelection(i)}))}_initAriaAnnouncements(){const{model:e,ui:t,t:n}=this.editor;let i=null;t&&e.document.selection.on("change:range",(()=>{const r=e.document.selection.focus.parent,s=JO(i),o=JO(r);s&&!o?t.ariaLiveAnnouncer.announce(n("Leaving a to-do list")):!s&&o&&t.ariaLiveAnnouncer.announce(n("Entering a to-do list")),i=r}))}}function ZO(e){const t=new Rd(e);return(e,n,i)=>{const r=t.match(n.viewItem);r&&i.consumable.consume(n.viewItem,r.match)&&Object.assign(n,i.convertChildren(n.viewItem,n.modelCursor))}}function QO(e,t){return(e.is("element","paragraph")||e.is("element","listItem"))&&"todo"==e.getAttribute("listType")&&BI(e)&&function(e,t){for(const n of e.getAttributeKeys())if(!n.startsWith("selection:")&&!t.includes(n))return!1;return!0}(e,t)}function YO(e){return!!e&&e.is("attributeElement")&&e.hasClass("todo-list__label")}function JO(e){return!(!e||!e.is("element","paragraph")&&!e.is("element","listItem")||"todo"!=e.getAttribute("listType"))}class XO extends cf{static get pluginName(){return"TodoListUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.t;bO(this.editor,"todoList",e("To-do List"),Pf.todoList)}}class eV extends cf{static get requires(){return[KO,XO]}static get pluginName(){return"TodoList"}static get isOfficialPlugin(){return!0}}let tV={baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1};const nV=/[&<>"']/,iV=/[&<>"']/g,rV=/[<>"']|&(?!#?\w+;)/,sV=/[<>"']|&(?!#?\w+;)/g,oV={"&":"&","<":"<",">":">",'"':""","'":"'"},aV=e=>oV[e];function lV(e,t){if(t){if(nV.test(e))return e.replace(iV,aV)}else if(rV.test(e))return e.replace(sV,aV);return e}const cV=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function dV(e){return e.replace(cV,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const uV=/(^|[^\[])\^/g;function hV(e,t){e=e.source||e,t=t||"";const n={replace:(t,i)=>(i=(i=i.source||i).replace(uV,"$1"),e=e.replace(t,i),n),getRegex:()=>new RegExp(e,t)};return n}const mV=/[^\w:]/g,gV=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function pV(e,t,n){if(e){let e;try{e=decodeURIComponent(dV(n)).replace(mV,"").toLowerCase()}catch(e){return null}if(0===e.indexOf("javascript:")||0===e.indexOf("vbscript:")||0===e.indexOf("data:"))return null}t&&!gV.test(n)&&(n=function(e,t){fV[" "+e]||(bV.test(e)?fV[" "+e]=e+"/":fV[" "+e]=xV(e,"/",!0));const n=-1===(e=fV[" "+e]).indexOf(":");return"//"===t.substring(0,2)?n?t:e.replace(wV,"$1")+t:"/"===t.charAt(0)?n?t:e.replace(vV,"$1")+t:e+t}(t,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(e){return null}return n}const fV={},bV=/^[^:]+:\/*[^/]*$/,wV=/^([^:]+:)[\s\S]*$/,vV=/^([^:]+:\/*[^/]*)[\s\S]*$/,yV={exec:function(){}};function _V(e){let t,n,i=1;for(;i<arguments.length;i++)for(n in t=arguments[i],t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function kV(e,t){const n=e.replace(/\|/g,((e,t,n)=>{let i=!1,r=t;for(;--r>=0&&"\\"===n[r];)i=!i;return i?"|":" |"})).split(/ \|/);let i=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n}function xV(e,t,n){const i=e.length;if(0===i)return"";let r=0;for(;r<i;){const s=e.charAt(i-r-1);if(s!==t||n){if(s===t||!n)break;r++}else r++}return e.substr(0,i-r)}function CV(e){e&&e.sanitize&&!e.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function AV(e,t){if(t<1)return"";let n="";for(;t>1;)1&t&&(n+=e),t>>=1,e+=e;return n+e}function EV(e,t,n,i){const r=t.href,s=t.title?lV(t.title):null,o=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){i.state.inLink=!0;const e={type:"link",raw:n,href:r,title:s,text:o,tokens:i.inlineTokens(o,[])};return i.state.inLink=!1,e}return{type:"image",raw:n,href:r,title:s,text:lV(o)}}class TV{constructor(e){this.options=e||tV}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:xV(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t){const n=e.match(/^(\s+)(?:```)/);if(null===n)return t;const i=n[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[n]=t;return n.length>=i.length?e.slice(i.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim():t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=xV(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}const n={type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:[]};return this.lexer.inline(n.text,n.tokens),n}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const e=t[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:t[0],tokens:this.lexer.blockTokens(e,[]),text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n,i,r,s,o,a,l,c,d,u,h,m,g=t[1].trim();const p=g.length>1,f={type:"list",raw:"",ordered:p,start:p?+g.slice(0,-1):"",loose:!1,items:[]};g=p?`\\d{1,9}\\${g.slice(-1)}`:`\\${g}`,this.options.pedantic&&(g=p?g:"[*+-]");const b=new RegExp(`^( {0,3}${g})((?: [^\\n]*)?(?:\\n|$))`);for(;e&&(m=!1,t=b.exec(e))&&!this.rules.block.hr.test(e);){if(n=t[0],e=e.substring(n.length),c=t[2].split("\n",1)[0],d=e.split("\n",1)[0],this.options.pedantic?(s=2,h=c.trimLeft()):(s=t[2].search(/[^ ]/),s=s>4?1:s,h=c.slice(s),s+=t[1].length),a=!1,!c&&/^ *$/.test(d)&&(n+=d+"\n",e=e.substring(d.length+1),m=!0),!m){const t=new RegExp(`^ {0,${Math.min(3,s-1)}}(?:[*+-]|\\d{1,9}[.)])`);for(;e&&(u=e.split("\n",1)[0],c=u,this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!t.test(c));){if(c.search(/[^ ]/)>=s||!c.trim())h+="\n"+c.slice(s);else{if(a)break;h+="\n"+c}a||c.trim()||(a=!0),n+=u+"\n",e=e.substring(u.length+1)}}f.loose||(l?f.loose=!0:/\n *\n *$/.test(n)&&(l=!0)),this.options.gfm&&(i=/^\[[ xX]\] /.exec(h),i&&(r="[ ] "!==i[0],h=h.replace(/^\[[ xX]\] +/,""))),f.items.push({type:"list_item",raw:n,task:!!i,checked:r,loose:!1,text:h}),f.raw+=n}f.items[f.items.length-1].raw=n.trimRight(),f.items[f.items.length-1].text=h.trimRight(),f.raw=f.raw.trimRight();const w=f.items.length;for(o=0;o<w;o++){this.lexer.state.top=!1,f.items[o].tokens=this.lexer.blockTokens(f.items[o].text,[]);const e=f.items[o].tokens.filter((e=>"space"===e.type)),t=e.every((e=>{const t=e.raw.split("");let n=0;for(const e of t)if("\n"===e&&(n+=1),n>1)return!0;return!1}));!f.loose&&e.length&&t&&(f.loose=!0,f.items[o].loose=!0)}return f}}html(e){const t=this.rules.block.html.exec(e);if(t){const e={type:"html",raw:t[0],pre:!this.options.sanitizer&&("pre"===t[1]||"script"===t[1]||"style"===t[1]),text:t[0]};return this.options.sanitize&&(e.type="paragraph",e.text=this.options.sanitizer?this.options.sanitizer(t[0]):lV(t[0]),e.tokens=[],this.lexer.inline(e.text,e.tokens)),e}}def(e){const t=this.rules.block.def.exec(e);if(t)return t[3]&&(t[3]=t[3].substring(1,t[3].length-1)),{type:"def",tag:t[1].toLowerCase().replace(/\s+/g," "),raw:t[0],href:t[2],title:t[3]}}table(e){const t=this.rules.block.table.exec(e);if(t){const e={type:"table",header:kV(t[1]).map((e=>({text:e}))),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(e.header.length===e.align.length){e.raw=t[0];let n,i,r,s,o=e.align.length;for(n=0;n<o;n++)/^ *-+: *$/.test(e.align[n])?e.align[n]="right":/^ *:-+: *$/.test(e.align[n])?e.align[n]="center":/^ *:-+ *$/.test(e.align[n])?e.align[n]="left":e.align[n]=null;for(o=e.rows.length,n=0;n<o;n++)e.rows[n]=kV(e.rows[n],e.header.length).map((e=>({text:e})));for(o=e.header.length,i=0;i<o;i++)e.header[i].tokens=[],this.lexer.inlineTokens(e.header[i].text,e.header[i].tokens);for(o=e.rows.length,i=0;i<o;i++)for(s=e.rows[i],r=0;r<s.length;r++)s[r].tokens=[],this.lexer.inlineTokens(s[r].text,s[r].tokens);return e}}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t){const e={type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:[]};return this.lexer.inline(e.text,e.tokens),e}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e={type:"paragraph",raw:t[0],text:"\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1],tokens:[]};return this.lexer.inline(e.text,e.tokens),e}}text(e){const t=this.rules.block.text.exec(e);if(t){const e={type:"text",raw:t[0],text:t[0],tokens:[]};return this.lexer.inline(e.text,e.tokens),e}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:lV(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):lV(t[0]):t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const t=xV(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;const n=e.length;let i=0,r=0;for(;r<n;r++)if("\\"===e[r])r++;else if(e[r]===t[0])i++;else if(e[r]===t[1]&&(i--,i<0))return r;return-1}(t[2],"()");if(e>-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],i="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],i=e[3])}else i=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^</.test(n)&&(n=this.options.pedantic&&!/>$/.test(e)?n.slice(1):n.slice(1,-1)),EV(t,{href:n?n.replace(this.rules.inline._escapes,"$1"):n,title:i?i.replace(this.rules.inline._escapes,"$1"):i},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=(n[2]||n[1]).replace(/\s+/g," ");if(e=t[e.toLowerCase()],!e||!e.href){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return EV(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrong.lDelim.exec(e);if(!i)return;if(i[3]&&n.match(/[\p{L}\p{N}]/u))return;const r=i[1]||i[2]||"";if(!r||r&&(""===n||this.rules.inline.punctuation.exec(n))){const n=i[0].length-1;let r,s,o=n,a=0;const l="*"===i[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+n);null!=(i=l.exec(t));){if(r=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!r)continue;if(s=r.length,i[3]||i[4]){o+=s;continue}if((i[5]||i[6])&&n%3&&!((n+s)%3)){a+=s;continue}if(o-=s,o>0)continue;if(s=Math.min(s,s+o+a),Math.min(n,s)%2){const t=e.slice(1,n+i.index+s);return{type:"em",raw:e.slice(0,n+i.index+s+1),text:t,tokens:this.lexer.inlineTokens(t,[])}}const t=e.slice(2,n+i.index+s-1);return{type:"strong",raw:e.slice(0,n+i.index+s+1),text:t,tokens:this.lexer.inlineTokens(t,[])}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const n=/[^ ]/.test(e),i=/^ /.test(e)&&/ $/.test(e);return n&&i&&(e=e.substring(1,e.length-1)),e=lV(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2],[])}}autolink(e,t){const n=this.rules.inline.autolink.exec(e);if(n){let e,i;return"@"===n[2]?(e=lV(this.options.mangle?t(n[1]):n[1]),i="mailto:"+e):(e=lV(n[1]),i=e),{type:"link",raw:n[0],text:e,href:i,tokens:[{type:"text",raw:e,text:e}]}}}url(e,t){let n;if(n=this.rules.inline.url.exec(e)){let e,i;if("@"===n[2])e=lV(this.options.mangle?t(n[0]):n[0]),i="mailto:"+e;else{let t;do{t=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0]}while(t!==n[0]);e=lV(n[0]),i="www."===n[1]?"http://"+e:e}return{type:"link",raw:n[0],text:e,href:i,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e,t){const n=this.rules.inline.text.exec(e);if(n){let e;return e=this.lexer.state.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):lV(n[0]):n[0]:lV(this.options.smartypants?t(n[0]):n[0]),{type:"text",raw:n[0],text:e}}}}const SV={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)( [^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?<?([^\s>]+)>?(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:yV,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};SV.def=hV(SV.def).replace("label",SV._label).replace("title",SV._title).getRegex(),SV.bullet=/(?:[*+-]|\d{1,9}[.)])/,SV.listItemStart=hV(/^( *)(bull) */).replace("bull",SV.bullet).getRegex(),SV.list=hV(SV.list).replace(/bull/g,SV.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+SV.def.source+")").getRegex(),SV._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",SV._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,SV.html=hV(SV.html,"i").replace("comment",SV._comment).replace("tag",SV._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),SV.paragraph=hV(SV._paragraph).replace("hr",SV.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",SV._tag).getRegex(),SV.blockquote=hV(SV.blockquote).replace("paragraph",SV.paragraph).getRegex(),SV.normal=_V({},SV),SV.gfm=_V({},SV.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),SV.gfm.table=hV(SV.gfm.table).replace("hr",SV.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",SV._tag).getRegex(),SV.gfm.paragraph=hV(SV._paragraph).replace("hr",SV.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",SV.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",SV._tag).getRegex(),SV.pedantic=_V({},SV.normal,{html:hV("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",SV._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:yV,paragraph:hV(SV.normal._paragraph).replace("hr",SV.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",SV.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});const PV={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:yV,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^[^_*]*?\_\_[^_*]*?\*[^_*]*?(?=\_\_)|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?\_[^_*]*?(?=\*\*)|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:yV,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};function IV(e){return e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function OV(e){let t,n,i="";const r=e.length;for(t=0;t<r;t++)n=e.charCodeAt(t),Math.random()>.5&&(n="x"+n.toString(16)),i+="&#"+n+";";return i}PV._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",PV.punctuation=hV(PV.punctuation).replace(/punctuation/g,PV._punctuation).getRegex(),PV.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,PV.escapedEmSt=/\\\*|\\_/g,PV._comment=hV(SV._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),PV.emStrong.lDelim=hV(PV.emStrong.lDelim).replace(/punct/g,PV._punctuation).getRegex(),PV.emStrong.rDelimAst=hV(PV.emStrong.rDelimAst,"g").replace(/punct/g,PV._punctuation).getRegex(),PV.emStrong.rDelimUnd=hV(PV.emStrong.rDelimUnd,"g").replace(/punct/g,PV._punctuation).getRegex(),PV._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,PV._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,PV._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,PV.autolink=hV(PV.autolink).replace("scheme",PV._scheme).replace("email",PV._email).getRegex(),PV._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,PV.tag=hV(PV.tag).replace("comment",PV._comment).replace("attribute",PV._attribute).getRegex(),PV._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,PV._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,PV._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,PV.link=hV(PV.link).replace("label",PV._label).replace("href",PV._href).replace("title",PV._title).getRegex(),PV.reflink=hV(PV.reflink).replace("label",PV._label).replace("ref",SV._label).getRegex(),PV.nolink=hV(PV.nolink).replace("ref",SV._label).getRegex(),PV.reflinkSearch=hV(PV.reflinkSearch,"g").replace("reflink",PV.reflink).replace("nolink",PV.nolink).getRegex(),PV.normal=_V({},PV),PV.pedantic=_V({},PV.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:hV(/^!?\[(label)\]\((.*?)\)/).replace("label",PV._label).getRegex(),reflink:hV(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",PV._label).getRegex()}),PV.gfm=_V({},PV.normal,{escape:hV(PV.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),PV.gfm.url=hV(PV.gfm.url,"i").replace("email",PV.gfm._extended_email).getRegex(),PV.breaks=_V({},PV.gfm,{br:hV(PV.br).replace("{2,}","*").getRegex(),text:hV(PV.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});class VV{constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||tV,this.options.tokenizer=this.options.tokenizer||new TV,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:SV.normal,inline:PV.normal};this.options.pedantic?(t.block=SV.pedantic,t.inline=PV.pedantic):this.options.gfm&&(t.block=SV.gfm,this.options.breaks?t.inline=PV.breaks:t.inline=PV.gfm),this.tokenizer.rules=t}static get rules(){return{block:SV,inline:PV}}static lex(e,t){return new VV(t).lex(e)}static lexInline(e,t){return new VV(t).inlineTokens(e)}lex(e){let t;for(e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(e,this.tokens);t=this.inlineQueue.shift();)this.inlineTokens(t.src,t.tokens);return this.tokens}blockTokens(e,t=[]){let n,i,r,s;for(this.options.pedantic&&(e=e.replace(/^ +$/gm,""));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((i=>!!(n=i.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),i=t[t.length-1],!i||"paragraph"!==i.type&&"text"!==i.type?t.push(n):(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),i=t[t.length-1],!i||"paragraph"!==i.type&&"text"!==i.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(i.raw+="\n"+n.raw,i.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text);else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(r=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const n=e.slice(1);let i;this.options.extensions.startBlock.forEach((function(e){i=e.call({lexer:this},n),"number"==typeof i&&i>=0&&(t=Math.min(t,i))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(r)))i=t[t.length-1],s&&"paragraph"===i.type?(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n),s=r.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),i=t[t.length-1],i&&"text"===i.type?(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t){this.inlineQueue.push({src:e,tokens:t})}inlineTokens(e,t=[]){let n,i,r,s,o,a,l=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(s=this.tokenizer.rules.inline.reflinkSearch.exec(l));)e.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,s.index)+"["+AV("a",s[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(s=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,s.index)+"["+AV("a",s[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(s=this.tokenizer.rules.inline.escapedEmSt.exec(l));)l=l.slice(0,s.index)+"++"+l.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;e;)if(o||(a=""),o=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((i=>!!(n=i.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.escape(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(e))e=e.substring(n.raw.length),i=t[t.length-1],i&&"text"===n.type&&"text"===i.type?(i.raw+=n.raw,i.text+=n.text):t.push(n);else if(n=this.tokenizer.link(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(n.raw.length),i=t[t.length-1],i&&"text"===n.type&&"text"===i.type?(i.raw+=n.raw,i.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(e,l,a))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(e,OV))e=e.substring(n.raw.length),t.push(n);else if(this.state.inLink||!(n=this.tokenizer.url(e,OV))){if(r=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const n=e.slice(1);let i;this.options.extensions.startInline.forEach((function(e){i=e.call({lexer:this},n),"number"==typeof i&&i>=0&&(t=Math.min(t,i))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(r,IV))e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(a=n.raw.slice(-1)),o=!0,i=t[t.length-1],i&&"text"===i.type?(i.raw+=n.raw,i.text+=n.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(n.raw.length),t.push(n);return t}}class RV{constructor(e){this.options=e||tV}code(e,t,n){const i=(t||"").match(/\S*/)[0];if(this.options.highlight){const t=this.options.highlight(e,i);null!=t&&t!==e&&(n=!0,e=t)}return e=e.replace(/\n$/,"")+"\n",i?'<pre><code class="'+this.options.langPrefix+lV(i,!0)+'">'+(n?e:lV(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:lV(e,!0))+"</code></pre>\n"}blockquote(e){return"<blockquote>\n"+e+"</blockquote>\n"}html(e){return e}heading(e,t,n,i){return this.options.headerIds?"<h"+t+' id="'+this.options.headerPrefix+i.slug(n)+'">'+e+"</h"+t+">\n":"<h"+t+">"+e+"</h"+t+">\n"}hr(){return this.options.xhtml?"<hr/>\n":"<hr>\n"}list(e,t,n){const i=t?"ol":"ul";return"<"+i+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+i+">\n"}listitem(e){return"<li>"+e+"</li>\n"}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "}paragraph(e){return"<p>"+e+"</p>\n"}table(e,t){return t&&(t="<tbody>"+t+"</tbody>"),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}tablerow(e){return"<tr>\n"+e+"</tr>\n"}tablecell(e,t){const n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"</"+n+">\n"}strong(e){return"<strong>"+e+"</strong>"}em(e){return"<em>"+e+"</em>"}codespan(e){return"<code>"+e+"</code>"}br(){return this.options.xhtml?"<br/>":"<br>"}del(e){return"<del>"+e+"</del>"}link(e,t,n){if(null===(e=pV(this.options.sanitize,this.options.baseUrl,e)))return n;let i='<a href="'+lV(e)+'"';return t&&(i+=' title="'+t+'"'),i+=">"+n+"</a>",i}image(e,t,n){if(null===(e=pV(this.options.sanitize,this.options.baseUrl,e)))return n;let i='<img src="'+e+'" alt="'+n+'"';return t&&(i+=' title="'+t+'"'),i+=this.options.xhtml?"/>":">",i}text(e){return e}}class NV{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class LV{constructor(){this.seen={}}serialize(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(e,t){let n=e,i=0;if(this.seen.hasOwnProperty(n)){i=this.seen[e];do{i++,n=e+"-"+i}while(this.seen.hasOwnProperty(n))}return t||(this.seen[e]=i,this.seen[n]=0),n}slug(e,t={}){const n=this.serialize(e);return this.getNextSafeSlug(n,t.dryrun)}}class MV{constructor(e){this.options=e||tV,this.options.renderer=this.options.renderer||new RV,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new NV,this.slugger=new LV}static parse(e,t){return new MV(t).parse(e)}static parseInline(e,t){return new MV(t).parseInline(e)}parse(e,t=!0){let n,i,r,s,o,a,l,c,d,u,h,m,g,p,f,b,w,v,y,_="";const k=e.length;for(n=0;n<k;n++)if(u=e[n],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[u.type]&&(y=this.options.extensions.renderers[u.type].call({parser:this},u),!1!==y||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(u.type)))_+=y||"";else switch(u.type){case"space":continue;case"hr":_+=this.renderer.hr();continue;case"heading":_+=this.renderer.heading(this.parseInline(u.tokens),u.depth,dV(this.parseInline(u.tokens,this.textRenderer)),this.slugger);continue;case"code":_+=this.renderer.code(u.text,u.lang,u.escaped);continue;case"table":for(c="",l="",s=u.header.length,i=0;i<s;i++)l+=this.renderer.tablecell(this.parseInline(u.header[i].tokens),{header:!0,align:u.align[i]});for(c+=this.renderer.tablerow(l),d="",s=u.rows.length,i=0;i<s;i++){for(a=u.rows[i],l="",o=a.length,r=0;r<o;r++)l+=this.renderer.tablecell(this.parseInline(a[r].tokens),{header:!1,align:u.align[r]});d+=this.renderer.tablerow(l)}_+=this.renderer.table(c,d);continue;case"blockquote":d=this.parse(u.tokens),_+=this.renderer.blockquote(d);continue;case"list":for(h=u.ordered,m=u.start,g=u.loose,s=u.items.length,d="",i=0;i<s;i++)f=u.items[i],b=f.checked,w=f.task,p="",f.task&&(v=this.renderer.checkbox(b),g?f.tokens.length>0&&"paragraph"===f.tokens[0].type?(f.tokens[0].text=v+" "+f.tokens[0].text,f.tokens[0].tokens&&f.tokens[0].tokens.length>0&&"text"===f.tokens[0].tokens[0].type&&(f.tokens[0].tokens[0].text=v+" "+f.tokens[0].tokens[0].text)):f.tokens.unshift({type:"text",text:v}):p+=v),p+=this.parse(f.tokens,g),d+=this.renderer.listitem(p,w,b);_+=this.renderer.list(d,h,m);continue;case"html":_+=this.renderer.html(u.text);continue;case"paragraph":_+=this.renderer.paragraph(this.parseInline(u.tokens));continue;case"text":for(d=u.tokens?this.parseInline(u.tokens):u.text;n+1<k&&"text"===e[n+1].type;)u=e[++n],d+="\n"+(u.tokens?this.parseInline(u.tokens):u.text);_+=t?this.renderer.paragraph(d):d;continue;default:{const e='Token with "'+u.type+'" type was not found.';if(this.options.silent)return void console.error(e);throw new Error(e)}}return _}parseInline(e,t){t=t||this.renderer;let n,i,r,s="";const o=e.length;for(n=0;n<o;n++)if(i=e[n],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]&&(r=this.options.extensions.renderers[i.type].call({parser:this},i),!1!==r||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)))s+=r||"";else switch(i.type){case"escape":case"text":s+=t.text(i.text);break;case"html":s+=t.html(i.text);break;case"link":s+=t.link(i.href,i.title,this.parseInline(i.tokens,t));break;case"image":s+=t.image(i.href,i.title,i.text);break;case"strong":s+=t.strong(this.parseInline(i.tokens,t));break;case"em":s+=t.em(this.parseInline(i.tokens,t));break;case"codespan":s+=t.codespan(i.text);break;case"br":s+=t.br();break;case"del":s+=t.del(this.parseInline(i.tokens,t));break;default:{const e='Token with "'+i.type+'" type was not found.';if(this.options.silent)return void console.error(e);throw new Error(e)}}return s}}function BV(e,t,n){if(null==e)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");if("function"==typeof t&&(n=t,t=null),CV(t=_V({},BV.defaults,t||{})),n){const i=t.highlight;let r;try{r=VV.lex(e,t)}catch(e){return n(e)}const s=function(e){let s;if(!e)try{t.walkTokens&&BV.walkTokens(r,t.walkTokens),s=MV.parse(r,t)}catch(t){e=t}return t.highlight=i,e?n(e):n(null,s)};if(!i||i.length<3)return s();if(delete t.highlight,!r.length)return s();let o=0;return BV.walkTokens(r,(function(e){"code"===e.type&&(o++,setTimeout((()=>{i(e.text,e.lang,(function(t,n){if(t)return s(t);null!=n&&n!==e.text&&(e.text=n,e.escaped=!0),o--,0===o&&s()}))}),0))})),void(0===o&&s())}try{const n=VV.lex(e,t);return t.walkTokens&&BV.walkTokens(n,t.walkTokens),MV.parse(n,t)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",t.silent)return"<p>An error occurred:</p><pre>"+lV(e.message+"",!0)+"</pre>";throw e}}function FV(e,t){return Array(t+1).join(e)}BV.options=BV.setOptions=function(e){var t;return _V(BV.defaults,e),t=BV.defaults,tV=t,BV},BV.getDefaults=function(){return{baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}},BV.defaults=tV,BV.use=function(...e){const t=_V({},...e),n=BV.defaults.extensions||{renderers:{},childTokens:{}};let i;e.forEach((e=>{if(e.extensions&&(i=!0,e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if(e.renderer){const t=n.renderers?n.renderers[e.name]:null;n.renderers[e.name]=t?function(...n){let i=e.renderer.apply(this,n);return!1===i&&(i=t.apply(this,n)),i}:e.renderer}if(e.tokenizer){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");n[e.level]?n[e.level].unshift(e.tokenizer):n[e.level]=[e.tokenizer],e.start&&("block"===e.level?n.startBlock?n.startBlock.push(e.start):n.startBlock=[e.start]:"inline"===e.level&&(n.startInline?n.startInline.push(e.start):n.startInline=[e.start]))}e.childTokens&&(n.childTokens[e.name]=e.childTokens)}))),e.renderer){const n=BV.defaults.renderer||new RV;for(const t in e.renderer){const i=n[t];n[t]=(...r)=>{let s=e.renderer[t].apply(n,r);return!1===s&&(s=i.apply(n,r)),s}}t.renderer=n}if(e.tokenizer){const n=BV.defaults.tokenizer||new TV;for(const t in e.tokenizer){const i=n[t];n[t]=(...r)=>{let s=e.tokenizer[t].apply(n,r);return!1===s&&(s=i.apply(n,r)),s}}t.tokenizer=n}if(e.walkTokens){const n=BV.defaults.walkTokens;t.walkTokens=function(t){e.walkTokens.call(this,t),n&&n.call(this,t)}}i&&(t.extensions=n),BV.setOptions(t)}))},BV.walkTokens=function(e,t){for(const n of e)switch(t.call(BV,n),n.type){case"table":for(const e of n.header)BV.walkTokens(e.tokens,t);for(const e of n.rows)for(const n of e)BV.walkTokens(n.tokens,t);break;case"list":BV.walkTokens(n.items,t);break;default:BV.defaults.extensions&&BV.defaults.extensions.childTokens&&BV.defaults.extensions.childTokens[n.type]?BV.defaults.extensions.childTokens[n.type].forEach((function(e){BV.walkTokens(n[e],t)})):n.tokens&&BV.walkTokens(n.tokens,t)}},BV.parseInline=function(e,t){if(null==e)throw new Error("marked.parseInline(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");CV(t=_V({},BV.defaults,t||{}));try{const n=VV.lexInline(e,t);return t.walkTokens&&BV.walkTokens(n,t.walkTokens),MV.parseInline(n,t)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",t.silent)return"<p>An error occurred:</p><pre>"+lV(e.message+"",!0)+"</pre>";throw e}},BV.Parser=MV,BV.parser=MV.parse,BV.Renderer=RV,BV.TextRenderer=NV,BV.Lexer=VV,BV.lexer=VV.lex,BV.Tokenizer=TV,BV.Slugger=LV,BV.parse=BV,BV.options,BV.setOptions,BV.use,BV.walkTokens,BV.parseInline,MV.parse,VV.lex;var DV=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function zV(e){return WV(e,DV)}var $V=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function jV(e){return WV(e,$V)}var HV=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function WV(e,t){return t.indexOf(e.nodeName)>=0}function UV(e,t){return e.getElementsByTagName&&t.some((function(t){return e.getElementsByTagName(t).length}))}var qV={};function GV(e){return e?e.replace(/(\n+\s*)+/g,"\n"):""}function KV(e){for(var t in this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[],e.rules)this.array.push(e.rules[t])}function ZV(e,t,n){for(var i=0;i<e.length;i++){var r=e[i];if(QV(r,t,n))return r}}function QV(e,t,n){var i=e.filter;if("string"==typeof i){if(i===t.nodeName.toLowerCase())return!0}else if(Array.isArray(i)){if(i.indexOf(t.nodeName.toLowerCase())>-1)return!0}else{if("function"!=typeof i)throw new TypeError("`filter` needs to be a string, array, or function");if(i.call(e,t,n))return!0}}function YV(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function JV(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}qV.paragraph={filter:"p",replacement:function(e){return"\n\n"+e+"\n\n"}},qV.lineBreak={filter:"br",replacement:function(e,t,n){return n.br+"\n"}},qV.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,n){var i=Number(t.nodeName.charAt(1));return"setext"===n.headingStyle&&i<3?"\n\n"+e+"\n"+FV(1===i?"=":"-",e.length)+"\n\n":"\n\n"+FV("#",i)+" "+e+"\n\n"}},qV.blockquote={filter:"blockquote",replacement:function(e){return"\n\n"+(e=(e=e.replace(/^\n+|\n+$/g,"")).replace(/^/gm,"> "))+"\n\n"}},qV.list={filter:["ul","ol"],replacement:function(e,t){var n=t.parentNode;return"LI"===n.nodeName&&n.lastElementChild===t?"\n"+e:"\n\n"+e+"\n\n"}},qV.listItem={filter:"li",replacement:function(e,t,n){e=e.replace(/^\n+/,"").replace(/\n+$/,"\n").replace(/\n/gm,"\n ");var i=n.bulletListMarker+" ",r=t.parentNode;if("OL"===r.nodeName){var s=r.getAttribute("start"),o=Array.prototype.indexOf.call(r.children,t);i=(s?Number(s)+o:o+1)+". "}return i+e+(t.nextSibling&&!/\n$/.test(e)?"\n":"")}},qV.indentedCodeBlock={filter:function(e,t){return"indented"===t.codeBlockStyle&&"PRE"===e.nodeName&&e.firstChild&&"CODE"===e.firstChild.nodeName},replacement:function(e,t,n){return"\n\n "+t.firstChild.textContent.replace(/\n/g,"\n ")+"\n\n"}},qV.fencedCodeBlock={filter:function(e,t){return"fenced"===t.codeBlockStyle&&"PRE"===e.nodeName&&e.firstChild&&"CODE"===e.firstChild.nodeName},replacement:function(e,t,n){for(var i,r=((t.firstChild.getAttribute("class")||"").match(/language-(\S+)/)||[null,""])[1],s=t.firstChild.textContent,o=n.fence.charAt(0),a=3,l=new RegExp("^"+o+"{3,}","gm");i=l.exec(s);)i[0].length>=a&&(a=i[0].length+1);var c=FV(o,a);return"\n\n"+c+r+"\n"+s.replace(/\n$/,"")+"\n"+c+"\n\n"}},qV.horizontalRule={filter:"hr",replacement:function(e,t,n){return"\n\n"+n.hr+"\n\n"}},qV.inlineLink={filter:function(e,t){return"inlined"===t.linkStyle&&"A"===e.nodeName&&e.getAttribute("href")},replacement:function(e,t){var n=t.getAttribute("href");n&&(n=n.replace(/([()])/g,"\\$1"));var i=GV(t.getAttribute("title"));return i&&(i=' "'+i.replace(/"/g,'\\"')+'"'),"["+e+"]("+n+i+")"}},qV.referenceLink={filter:function(e,t){return"referenced"===t.linkStyle&&"A"===e.nodeName&&e.getAttribute("href")},replacement:function(e,t,n){var i,r,s=t.getAttribute("href"),o=GV(t.getAttribute("title"));switch(o&&(o=' "'+o+'"'),n.linkReferenceStyle){case"collapsed":i="["+e+"][]",r="["+e+"]: "+s+o;break;case"shortcut":i="["+e+"]",r="["+e+"]: "+s+o;break;default:var a=this.references.length+1;i="["+e+"]["+a+"]",r="["+a+"]: "+s+o}return this.references.push(r),i},references:[],append:function(e){var t="";return this.references.length&&(t="\n\n"+this.references.join("\n")+"\n\n",this.references=[]),t}},qV.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}},qV.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}},qV.code={filter:function(e){var t=e.previousSibling||e.nextSibling,n="PRE"===e.parentNode.nodeName&&!t;return"CODE"===e.nodeName&&!n},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",n="`",i=e.match(/`+/gm)||[];-1!==i.indexOf(n);)n+="`";return n+t+e+t+n}},qV.image={filter:"img",replacement:function(e,t){var n=GV(t.getAttribute("alt")),i=t.getAttribute("src")||"",r=GV(t.getAttribute("title"));return i?"+")":""}},KV.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){return e.isBlank?this.blankRule:(t=ZV(this.array,e,this.options))||(t=ZV(this._keep,e,this.options))||(t=ZV(this._remove,e,this.options))?t:this.defaultRule;var t},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};var XV,eR,tR="undefined"!=typeof window?window:{},nR=function(){var e=tR.DOMParser,t=!1;try{(new e).parseFromString("","text/html")&&(t=!0)}catch(e){}return t}()?tR.DOMParser:(XV=function(){},function(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch(t){tR.ActiveXObject&&(e=!0)}return e}()?XV.prototype.parseFromString=function(e){var t=new window.ActiveXObject("htmlfile");return t.designMode="on",t.open(),t.write(e),t.close(),t}:XV.prototype.parseFromString=function(e){var t=document.implementation.createHTMLDocument("");return t.open(),t.write(e),t.close(),t},XV);function iR(e,t){var n;return function(e){var t=e.element,n=e.isBlock,i=e.isVoid,r=e.isPre||function(e){return"PRE"===e.nodeName};if(t.firstChild&&!r(t)){for(var s=null,o=!1,a=null,l=JV(a,t,r);l!==t;){if(3===l.nodeType||4===l.nodeType){var c=l.data.replace(/[ \r\n\t]+/g," ");if(s&&!/ $/.test(s.data)||o||" "!==c[0]||(c=c.substr(1)),!c){l=YV(l);continue}l.data=c,s=l}else{if(1!==l.nodeType){l=YV(l);continue}n(l)||"BR"===l.nodeName?(s&&(s.data=s.data.replace(/ $/,"")),s=null,o=!1):i(l)||r(l)?(s=null,o=!0):s&&(o=!1)}var d=JV(a,l,r);a=l,l=d}s&&(s.data=s.data.replace(/ $/,""),s.data||YV(s))}}({element:n="string"==typeof e?(eR=eR||new nR).parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html").getElementById("turndown-root"):e.cloneNode(!0),isBlock:zV,isVoid:jV,isPre:t.preformattedCode?rR:null}),n}function rR(e){return"PRE"===e.nodeName||"CODE"===e.nodeName}function sR(e,t){return e.isBlock=zV(e),e.isCode="CODE"===e.nodeName||e.parentNode.isCode,e.isBlank=function(e){return!jV(e)&&!function(e){return WV(e,HV)}(e)&&/^\s*$/i.test(e.textContent)&&!function(e){return UV(e,$V)}(e)&&!function(e){return UV(e,HV)}(e)}(e),e.flankingWhitespace=function(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n,i={leading:(n=e.textContent.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/))[1],leadingAscii:n[2],leadingNonAscii:n[3],trailing:n[4],trailingNonAscii:n[5],trailingAscii:n[6]};return i.leadingAscii&&oR("left",e,t)&&(i.leading=i.leadingNonAscii),i.trailingAscii&&oR("right",e,t)&&(i.trailing=i.trailingNonAscii),{leading:i.leading,trailing:i.trailing}}(e,t),e}function oR(e,t,n){var i,r,s;return"left"===e?(i=t.previousSibling,r=/ $/):(i=t.nextSibling,r=/^ /),i&&(3===i.nodeType?s=r.test(i.nodeValue):n.preformattedCode&&"CODE"===i.nodeName?s=!1:1!==i.nodeType||zV(i)||(s=r.test(i.textContent))),s}var aR=Array.prototype.reduce,lR=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function cR(e){if(!(this instanceof cR))return new cR(e);var t={rules:qV,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(e,t){return t.isBlock?"\n\n":""},keepReplacement:function(e,t){return t.isBlock?"\n\n"+t.outerHTML+"\n\n":t.outerHTML},defaultReplacement:function(e,t){return t.isBlock?"\n\n"+e+"\n\n":e}};this.options=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])}return e}({},t,e),this.rules=new KV(this.options)}function dR(e){var t=this;return aR.call(e.childNodes,(function(e,n){var i="";return 3===(n=new sR(n,t.options)).nodeType?i=n.isCode?n.nodeValue:t.escape(n.nodeValue):1===n.nodeType&&(i=hR.call(t,n)),mR(e,i)}),"")}function uR(e){var t=this;return this.rules.forEach((function(n){"function"==typeof n.append&&(e=mR(e,n.append(t.options)))})),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function hR(e){var t=this.rules.forNode(e),n=dR.call(this,e),i=e.flankingWhitespace;return(i.leading||i.trailing)&&(n=n.trim()),i.leading+t.replacement(n,e,this.options)+i.trailing}function mR(e,t){var n=function(e){for(var t=e.length;t>0&&"\n"===e[t-1];)t--;return e.substring(0,t)}(e),i=t.replace(/^\n*/,""),r=Math.max(e.length-n.length,t.length-i.length);return n+"\n\n".substring(0,r)+i}cR.prototype={turndown:function(e){if(!function(e){return null!=e&&("string"==typeof e||e.nodeType&&(1===e.nodeType||9===e.nodeType||11===e.nodeType))}(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(""===e)return"";var t=dR.call(this,new iR(e,this.options));return uR.call(this,t)},use:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.use(e[t]);else{if("function"!=typeof e)throw new TypeError("plugin must be a Function or an Array of Functions");e(this)}return this},addRule:function(e,t){return this.rules.add(e,t),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return lR.reduce((function(e,t){return e.replace(t[0],t[1])}),e)}};const gR=cR;var pR=/highlight-(?:text|source)-([a-z0-9]+)/;function fR(e){e.addRule("highlightedCodeBlock",{filter:function(e){var t=e.firstChild;return"DIV"===e.nodeName&&pR.test(e.className)&&t&&"PRE"===t.nodeName},replacement:function(e,t,n){var i=((t.className||"").match(pR)||[null,""])[1];return"\n\n"+n.fence+i+"\n"+t.firstChild.textContent+"\n"+n.fence+"\n\n"}})}function bR(e){e.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(e){return"~"+e+"~"}})}var wR=Array.prototype.indexOf,vR=Array.prototype.every,yR={};function _R(e){var t,n,i=e.parentNode;return"THEAD"===i.nodeName||i.firstChild===e&&("TABLE"===i.nodeName||(n=(t=i).previousSibling,"TBODY"===t.nodeName&&(!n||"THEAD"===n.nodeName&&/^\s*$/i.test(n.textContent))))&&vR.call(e.childNodes,(function(e){return"TH"===e.nodeName}))}function kR(e,t){var n=" ";return 0===wR.call(t.parentNode.childNodes,t)&&(n="| "),n+e+" |"}function xR(e){for(var t in e.keep((function(e){return"TABLE"===e.nodeName&&!_R(e.rows[0])})),yR)e.addRule(t,yR[t])}function CR(e){e.addRule("taskListItems",{filter:function(e){return"checkbox"===e.type&&"LI"===e.parentNode.nodeName},replacement:function(e,t){return(t.checked?"[x]":"[ ]")+" "}})}function AR(e){e.use([fR,bR,xR,CR])}yR.tableCell={filter:["th","td"],replacement:function(e,t){return kR(e,t)}},yR.tableRow={filter:"tr",replacement:function(e,t){var n="",i={left:":--",right:"--:",center:":-:"};if(_R(t))for(var r=0;r<t.childNodes.length;r++){var s="---",o=(t.childNodes[r].getAttribute("align")||"").toLowerCase();o&&(s=i[o]||s),n+=kR(s,t.childNodes[r])}return"\n"+e+(n?"\n"+n:"")}},yR.table={filter:function(e){return"TABLE"===e.nodeName&&_R(e.rows[0])},replacement:function(e){return"\n\n"+(e=e.replace("\n\n","\n"))+"\n\n"}},yR.tableSection={filter:["thead","tbody","tfoot"],replacement:function(e){return e}};class ER{_parser;_options={gfm:!0,breaks:!0,tables:!0,xhtml:!0,headerIds:!1};constructor(){BV.use({tokenizer:{autolink:()=>null,url:()=>null},renderer:{checkbox(...e){return Object.getPrototypeOf(this).checkbox.call(this,...e).trimRight()},code(...e){return Object.getPrototypeOf(this).code.call(this,...e).replace("\n</code>","</code>")}}}),this._parser=BV}parse(e){return this._parser.parse(e,this._options)}}const TR=new RegExp(/\b(?:(?:https?|ftp):\/\/|www\.)/.source+/(?![-_])(?:[-_a-z0-9\u00a1-\uffff]{1,63}\.)+(?:[a-z\u00a1-\uffff]{2,63})/.source+/(?:[^\s<>]*)/.source,"gi");class SR extends gR{escape(e){const t=super.escape;function n(e){return(e=t(e)).replace(/</g,"\\<")}let i="",r=0;for(const t of this._matchAutolink(e)){const s=t.index;s>r&&(i+=n(e.substring(r,s)));const o=t[0];i+=o,r=s+o.length}return r<e.length&&(i+=n(e.substring(r,e.length))),i}*_matchAutolink(e){for(const t of e.matchAll(TR)){const e=t[0],n=this._autolinkFindEnd(e);yield Object.assign([e.substring(0,n)],{index:t.index})}}_autolinkFindEnd(e){let t=e.length;for(;t>0;){const n=e[t-1];if("?!.,:*_~'\"".includes(n))t--;else{if(")"!=n)break;{let n=0;for(let i=0;i<t;i++)"("==e[i]?n++:")"==e[i]&&n--;if(!(n<0))break;t--}}}return t}}class PR{_parser;constructor(){this._parser=this._createParser()}parse(e){return this._parser.turndown(e)}keep(e){this._parser.keep(e)}_createParser(){const e=new SR({codeBlockStyle:"fenced",hr:"---",headingStyle:"atx"});return e.use([AR,this._todoList]),e}_todoList(e){e.addRule("taskListItems",{filter:e=>"checkbox"===e.type&&("LI"===e.parentNode.nodeName||"LI"===e.parentNode.parentNode.nodeName),replacement:(e,t)=>(t.checked?"[x]":"[ ]")+" "})}}class IR{_htmlDP;_markdown2html;_html2markdown;constructor(e){this._htmlDP=new $m(e),this._markdown2html=new ER,this._html2markdown=new PR}keepHtml(e){this._html2markdown.keep([e])}toView(e){const t=this._markdown2html.parse(e);return this._htmlDP.toView(t)}toData(e){const t=this._htmlDP.toData(e);return this._html2markdown.parse(t)}registerRawContentMatcher(e){this._htmlDP.registerRawContentMatcher(e)}useFillerType(){}}class OR extends cf{constructor(e){super(e),e.data.processor=new IR(e.data.viewDocument)}static get pluginName(){return"Markdown"}static get isOfficialPlugin(){return!0}}const VR=["SPAN","BR","PRE","CODE"];class RR extends cf{_gfmDataProcessor;constructor(e){super(e),this._gfmDataProcessor=new IR(e.data.viewDocument)}static get pluginName(){return"PasteFromMarkdownExperimental"}static get isOfficialPlugin(){return!0}static get requires(){return[vx]}init(){const e=this.editor,t=e.editing.view.document,n=e.plugins.get("ClipboardPipeline");let i=!1;this.listenTo(t,"keydown",((e,t)=>{i=t.shiftKey})),this.listenTo(n,"inputTransformation",((e,t)=>{if(i)return;const n=t.dataTransfer.getData("text/html");if(!n){const e=t.dataTransfer.getData("text/plain");return void(t.content=this._gfmDataProcessor.toView(e))}const r=this._parseMarkdownFromHtml(n);r&&(t.content=this._gfmDataProcessor.toView(r))}))}_parseMarkdownFromHtml(e){const t=this._removeOsSpecificTags(e);if(!this._containsOnlyAllowedFirstLevelTags(t))return null;const n=this._removeFirstLevelWrapperTagsAndBrs(t);return this._containsAnyRemainingHtmlTags(n)?null:this._replaceHtmlReservedEntitiesWithCharacters(n)}_removeOsSpecificTags(e){return e.replace(/^<meta\b[^>]*>/,"").trim().replace(/^<html>/,"").replace(/<\/html>$/,"").trim().replace(/^<body>/,"").replace(/<\/body>$/,"").trim().replace(/^<!--StartFragment-->/,"").replace(/<!--EndFragment-->$/,"").trim()}_containsOnlyAllowedFirstLevelTags(e){const t=new DOMParser,{body:n}=t.parseFromString(e,"text/html");return Array.from(n.children).map((e=>e.tagName)).every((e=>VR.includes(e)))}_removeFirstLevelWrapperTagsAndBrs(e){const t=new DOMParser,{body:n}=t.parseFromString(e,"text/html"),i=n.querySelectorAll("br");for(const e of i)e.replaceWith("\n");const r=n.querySelectorAll(":scope > *");for(const e of r){const t=e.cloneNode(!0);e.replaceWith(...t.childNodes)}return n.innerHTML}_containsAnyRemainingHtmlTags(e){return e.includes("<")}_replaceHtmlReservedEntitiesWithCharacters(e){return e.replace(/>/g,">").replace(/</g,"<").replace(/ /g," ")}}function NR(e,t){const n=(n,i,r)=>{if(!r.consumable.consume(i.item,n.name))return;const s=i.attributeNewValue,o=r.writer,a=r.mapper.toViewElement(i.item),l=[...a.getChildren()].find((e=>e.getCustomProperty("media-content")));o.remove(l);const c=e.getMediaViewElement(o,s,t);o.insert(o.createPositionAt(a,0),c)};return e=>{e.on("attribute:url:media",n)}}function LR(e,t,n,i){return e.createContainerElement("figure",{class:"media"},[t.getMediaViewElement(e,n,i),e.createSlot()])}function MR(e){const t=e.getSelectedElement();return t&&t.is("element","media")?t:null}function BR(e,t,n,i){e.change((r=>{const s=r.createElement("media",{url:t});e.insertObject(s,n,null,{setSelection:"on",findOptimalPosition:i?"auto":void 0})}))}class FR extends uf{refresh(){const e=this.editor.model,t=e.document.selection,n=MR(t);this.value=n?n.getAttribute("url"):void 0,this.isEnabled=function(e){const t=e.getSelectedElement();return!!t&&"media"===t.name}(t)||function(e,t){let n=Tk(e,t).start.parent;return n.isEmpty&&!t.schema.isLimit(n)&&(n=n.parent),t.schema.checkChild(n,"media")}(t,e)}execute(e){const t=this.editor.model,n=t.document.selection,i=MR(n);i?t.change((t=>{t.setAttribute("url",e,i)})):BR(t,e,n,!0)}}class DR{locale;providerDefinitions;constructor(e,t){const n=t.providers,i=t.extraProviders||[],r=new Set(t.removeProviders),s=n.concat(i).filter((e=>{const t=e.name;return t?!r.has(t):(Ea("media-embed-no-provider-name",{provider:e}),!1)}));this.locale=e,this.providerDefinitions=s}hasMedia(e){return!!this._getMedia(e)}getMediaViewElement(e,t,n){return this._getMedia(t).getViewElement(e,n)}_getMedia(e){if(!e)return new zR(this.locale);e=e.trim();for(const t of this.providerDefinitions){const n=t.html,i=rc(t.url);for(const t of i){const i=this._getUrlMatches(e,t);if(i)return new zR(this.locale,e,i,n)}}return null}_getUrlMatches(e,t){let n=e.match(t);if(n)return n;let i=e.replace(/^https?:\/\//,"");return n=i.match(t),n||(i=i.replace(/^www\./,""),n=i.match(t),n||null)}}class zR{url;_locale;_match;_previewRenderer;constructor(e,t,n,i){this.url=this._getValidUrl(t),this._locale=e,this._match=n,this._previewRenderer=i}getViewElement(e,t){const n={};let i;if(t.renderForEditingView||t.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(n["data-oembed-url"]=this.url),t.renderForEditingView&&(n.class="ck-media__wrapper");const r=this._getPreviewHtml(t);i=e.createRawElement("div",n,((e,t)=>{t.setContentOf(e,r)}))}else this.url&&(n.url=this.url),i=e.createEmptyElement(t.elementName,n);return e.setCustomProperty("media-content",!0,i),i}_getPreviewHtml(e){return this._previewRenderer?this._previewRenderer(this._match):this.url&&e.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const e=new zb,t=this._locale.t;return e.content='<svg viewBox="0 0 64 42" xmlns="http://www.w3.org/2000/svg"><path d="M47.426 17V3.713L63.102 0v19.389h-.001l.001.272c0 1.595-2.032 3.43-4.538 4.098-2.506.668-4.538-.083-4.538-1.678 0-1.594 2.032-3.43 4.538-4.098.914-.244 2.032-.565 2.888-.603V4.516L49.076 7.447v9.556A1.014 1.014 0 0 0 49 17h-1.574zM29.5 17h-8.343a7.073 7.073 0 1 0-4.657 4.06v3.781H3.3a2.803 2.803 0 0 1-2.8-2.804V8.63a2.803 2.803 0 0 1 2.8-2.805h4.082L8.58 2.768A1.994 1.994 0 0 1 10.435 1.5h8.985c.773 0 1.477.448 1.805 1.149l1.488 3.177H26.7c1.546 0 2.8 1.256 2.8 2.805V17zm-11.637 0H17.5a1 1 0 0 0-1 1v.05A4.244 4.244 0 1 1 17.863 17zm29.684 2c.97 0 .953-.048.953.889v20.743c0 .953.016.905-.953.905H19.453c-.97 0-.953.048-.953-.905V19.89c0-.937-.016-.889.97-.889h28.077zm-4.701 19.338V22.183H24.154v16.155h18.692zM20.6 21.375v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616V37.53H20.6zm24.233-16.155v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615V37.53h-1.615zM29.485 25.283a.4.4 0 0 1 .593-.35l9.05 4.977a.4.4 0 0 1 0 .701l-9.05 4.978a.4.4 0 0 1-.593-.35v-9.956z"/></svg>',e.viewBox="0 0 64 42",new gb({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[e]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"_blank",rel:"noopener noreferrer",href:this.url,"data-cke-tooltip-text":t("Open media in new tab")},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]}]}]}).render().outerHTML}_getValidUrl(e){return e?e.match(/^https?/)?e:"https://"+e:null}}class $R extends cf{static get pluginName(){return"MediaEmbedEditing"}static get isOfficialPlugin(){return!0}registry;constructor(e){super(e),e.config.define("mediaEmbed",{elementName:"oembed",providers:[{name:"dailymotion",url:[/^dailymotion\.com\/video\/(\w+)/,/^dai.ly\/(\w+)/],html:e=>`<div style="position: relative; padding-bottom: 100%; height: 0; "><iframe src="https://www.dailymotion.com/embed/video/${e[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" width="480" height="270" allowfullscreen allow="autoplay"></iframe></div>`},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:e=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 126%;"><iframe src="https://open.spotify.com/embed/${e[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe></div>`},{name:"youtube",url:[/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)(?:&t=(\d+))?/,/^(?:m\.)?youtube\.com\/shorts\/([\w-]+)(?:\?t=(\d+))?/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)(?:\?t=(\d+))?/,/^youtube\.com\/embed\/([\w-]+)(?:\?start=(\d+))?/,/^youtu\.be\/([\w-]+)(?:\?t=(\d+))?/],html:e=>{const t=e[1],n=e[2];return`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;"><iframe src="https://www.youtube.com/embed/${t}${n?`?start=${n}`:""}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></div>`}},{name:"vimeo",url:[/^vimeo\.com\/(\d+)/,/^vimeo\.com\/[^/]+\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/album\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/channels\/[^/]+\/(\d+)/,/^vimeo\.com\/groups\/[^/]+\/videos\/(\d+)/,/^vimeo\.com\/ondemand\/[^/]+\/(\d+)/,/^player\.vimeo\.com\/video\/(\d+)/],html:e=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;"><iframe src="https://player.vimeo.com/video/${e[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>`},{name:"instagram",url:[/^instagram\.com\/p\/(\w+)/,/^instagram\.com\/reel\/(\w+)/]},{name:"twitter",url:[/^twitter\.com/,/^x\.com/]},{name:"googleMaps",url:[/^google\.com\/maps/,/^goo\.gl\/maps/,/^maps\.google\.com/,/^maps\.app\.goo\.gl/]},{name:"flickr",url:/^flickr\.com/},{name:"facebook",url:/^facebook\.com/}]}),this.registry=new DR(e.locale,e.config.get("mediaEmbed"))}init(){const e=this.editor,t=e.model.schema,n=e.t,i=e.conversion,r=e.config.get("mediaEmbed.previewsInData"),s=e.config.get("mediaEmbed.elementName"),o=this.registry;e.commands.add("mediaEmbed",new FR(e)),t.register("media",{inheritAllFrom:"$blockObject",allowAttributes:["url"]}),i.for("dataDowncast").elementToStructure({model:"media",view:(e,{writer:t})=>{const n=e.getAttribute("url");return LR(t,o,n,{elementName:s,renderMediaPreview:!!n&&r})}}),i.for("dataDowncast").add(NR(o,{elementName:s,renderMediaPreview:r})),i.for("editingDowncast").elementToStructure({model:"media",view:(e,{writer:t})=>{const i=e.getAttribute("url");return function(e,t,n){return t.setCustomProperty("media",!0,e),kk(e,t,{label:n})}(LR(t,o,i,{elementName:s,renderForEditingView:!0}),t,n("media widget"))}}),i.for("editingDowncast").add(NR(o,{elementName:s,renderForEditingView:!0})),i.for("upcast").elementToElement({view:e=>["oembed",s].includes(e.name)&&e.getAttribute("url")?{name:!0}:null,model:(e,{writer:t})=>{const n=e.getAttribute("url");return o.hasMedia(n)?t.createElement("media",{url:n}):null}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(e,{writer:t})=>{const n=e.getAttribute("data-oembed-url");return o.hasMedia(n)?t.createElement("media",{url:n}):null}}).add((e=>{e.on("element:figure",((e,t,n)=>{if(!n.consumable.consume(t.viewItem,{name:!0,classes:"media"}))return;const{modelRange:i,modelCursor:r}=n.convertChildren(t.viewItem,t.modelCursor);t.modelRange=i,t.modelCursor=r,ac(i.getItems())||n.consumable.revert(t.viewItem,{name:!0,classes:"media"})}))}))}}const jR=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class HR extends cf{static get requires(){return[Nx,qy,rA]}static get pluginName(){return"AutoMediaEmbed"}static get isOfficialPlugin(){return!0}_timeoutId;_positionToInsert;constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null}init(){const e=this.editor,t=e.model.document,n=e.plugins.get("ClipboardPipeline");this.listenTo(n,"inputTransformation",(()=>{const e=t.selection.getFirstRange(),n=Cg.fromPosition(e.start);n.stickiness="toPrevious";const i=Cg.fromPosition(e.end);i.stickiness="toNext",t.once("change:data",(()=>{this._embedMediaBetweenPositions(n,i),n.detach(),i.detach()}),{priority:"high"})})),e.commands.get("undo").on("execute",(()=>{this._timeoutId&&(ra.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)}),{priority:"high"})}_embedMediaBetweenPositions(e,t){const n=this.editor,i=n.plugins.get($R).registry,r=new Bh(e,t),s=r.getWalker({ignoreElementEnd:!0});let o="";for(const e of s)e.item.is("$textProxy")&&(o+=e.item.data);o=o.trim(),o.match(jR)&&i.hasMedia(o)&&n.commands.get("mediaEmbed").isEnabled?(this._positionToInsert=Cg.fromPosition(e),this._timeoutId=ra.window.setTimeout((()=>{n.model.change((e=>{this._timeoutId=null,e.remove(r),r.detach();let t=null;"$graveyard"!==this._positionToInsert.root.rootName&&(t=this._positionToInsert),BR(n.model,o,t,!1),this._positionToInsert.detach(),this._positionToInsert=null})),n.plugins.get(qy).requestUndoOnBackspace()}),100)):r.detach()}}class WR extends Lb{focusTracker;keystrokes;urlInputView;_validators;_urlInputViewInfoDefault;_urlInputViewInfoTip;constructor(e,t){super(t),this.focusTracker=new lc,this.keystrokes=new hc,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this._validators=e,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form","ck-responsive-form"],tabindex:"-1"},children:[this.urlInputView]})}render(){super.render(),Fb({view:this}),this.focusTracker.add(this.urlInputView.element),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.urlInputView.focus()}get url(){return this.urlInputView.fieldView.element.value.trim()}set url(e){this.urlInputView.fieldView.value=e.trim()}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null,this.urlInputView.infoText=this._urlInputViewInfoDefault}_createUrlInput(){const e=this.locale.t,t=new Ew(this.locale,sv),n=t.fieldView;return this._urlInputViewInfoDefault=e("Paste the media URL in the input."),this._urlInputViewInfoTip=e("Tip: Paste the URL into the content to embed faster."),t.label=e("Media URL"),t.infoText=this._urlInputViewInfoDefault,n.inputMode="url",n.on("input",(()=>{t.infoText=n.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=n.element.value.trim()})),t}}class UR extends cf{static get requires(){return[$R,nw]}static get pluginName(){return"MediaEmbedUI"}static get isOfficialPlugin(){return!0}_formView;init(){const e=this.editor;e.ui.componentFactory.add("mediaEmbed",(()=>{const e=this.editor.locale.t,t=this._createDialogButton(jb);return t.tooltip=!0,t.label=e("Insert media"),t})),e.ui.componentFactory.add("menuBar:mediaEmbed",(()=>{const e=this.editor.locale.t,t=this._createDialogButton(sw);return t.label=e("Media"),t}))}_createDialogButton(e){const t=this.editor,n=new e(t.locale),i=t.commands.get("mediaEmbed"),r=this.editor.plugins.get("Dialog");return n.icon='<svg viewBox="0 0 22 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.587 1.5c-.612 0-.601-.029-.601.551v14.84c0 .59-.01.559.591.559h18.846c.602 0 .591.03.591-.56V2.052c0-.58.01-.55-.591-.55H1.587Zm.701.971h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-14.24 1h13.008v12H4.467l.029-12Zm-2.208 1h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h1.003l-.029 1h-.974v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h.974v1h-.974v-1Zm16.448 0h1.003v1h-1.003v-1Z"/><path d="M8.374 6.648a.399.399 0 0 1 .395-.4.402.402 0 0 1 .2.049l5.148 2.824a.4.4 0 0 1 0 .7l-5.148 2.824a.403.403 0 0 1-.595-.35V6.648Z"/></svg>',n.bind("isEnabled").to(i,"isEnabled"),n.on("execute",(()=>{"mediaEmbed"===r.id?r.hide():this._showDialog()})),n}_showDialog(){const e=this.editor,t=e.plugins.get("Dialog"),n=e.commands.get("mediaEmbed"),i=e.locale.t;if(!this._formView){const t=e.plugins.get($R).registry;this._formView=new(Bb(WR))(function(e,t){return[t=>{if(!t.url.length)return e("The URL must not be empty.")},n=>{if(!t.hasMedia(n.url))return e("This media URL is not supported.")}]}(e.t,t),e.locale),this._formView.on("submit",(()=>this._handleSubmitForm()))}t.show({id:"mediaEmbed",title:i("Insert media"),content:this._formView,isModal:!0,onShow:()=>{this._formView.url=n.value||"",this._formView.resetFormStatus(),this._formView.urlInputView.fieldView.select()},actionButtons:[{label:i("Cancel"),withText:!0,onExecute:()=>t.hide()},{label:i("Accept"),class:"ck-button-action",withText:!0,onExecute:()=>this._handleSubmitForm()}]})}_handleSubmitForm(){const e=this.editor,t=e.plugins.get("Dialog");this._formView.isValid()&&(e.execute("mediaEmbed",this._formView.url),t.hide(),e.editing.view.focus())}}class qR extends cf{static get requires(){return[$R,UR,HR,Dk]}static get pluginName(){return"MediaEmbed"}static get isOfficialPlugin(){return!0}}const GR={"(":")","[":"]","{":"}"};class KR extends uf{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"mention")}execute(e){const t=this.editor.model,n=t.document.selection,i="string"==typeof e.mention?{id:e.mention}:e.mention,r=i.id,s=e.range||n.getFirstRange();if(!t.canEditAt(s))return;const o=e.text||r,a=QR({_text:o,id:r},i);if(!r.startsWith(e.marker))throw new Aa("mentioncommand-incorrect-id",this);t.change((e=>{const i=mc(n.getAttributes()),r=new Map(i.entries());r.set("mention",a);const l=t.insertContent(e.createText(o,r),s),c=l.start.nodeBefore,d=l.end.nodeAfter,u=d&&d.is("$text")&&d.data.startsWith(" ");let h=!1;if(c&&d&&c.is("$text")&&d.is("$text")){const e=c.data.slice(-1),t=e in GR,n=t&&d.data.startsWith(GR[e]);h=t&&n}h||u||t.insertContent(e.createText(" ",i),s.start.getShiftedBy(o.length))}))}}class ZR extends cf{static get pluginName(){return"MentionEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model,n=t.document;t.schema.extend("$text",{allowAttributes:"mention"}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",key:"data-mention",classes:"mention"},model:{key:"mention",value:e=>YR(e)}}),e.conversion.for("downcast").attributeToElement({model:"mention",view:XR}),e.conversion.for("downcast").add(JR),n.registerPostFixer((e=>function(e,t,n){const i=t.differ.getChanges();let r=!1;for(const t of i){if("attribute"==t.type)continue;const i=t.position;if("$text"==t.name){const t=i.textNode&&i.textNode.nextSibling;r=tN(i.textNode,e)||r,r=tN(t,e)||r,r=tN(i.nodeBefore,e)||r,r=tN(i.nodeAfter,e)||r}if("$text"!=t.name&&"insert"==t.type){const t=i.nodeAfter;for(const n of e.createRangeIn(t).getItems())r=tN(n,e)||r}if("insert"==t.type&&n.isInline(t.name)){const t=i.nodeAfter&&i.nodeAfter.nextSibling;r=tN(i.nodeBefore,e)||r,r=tN(t,e)||r}}return r}(e,n,t.schema))),n.registerPostFixer((e=>function(e,t){const n=t.differ.getChanges();let i=!1;for(const t of n)if("attribute"===t.type&&"mention"!=t.attributeKey){const n=t.range.start.nodeBefore,r=t.range.end.nodeAfter;for(const s of[n,r])eN(s)&&s.getAttribute(t.attributeKey)!=t.attributeNewValue&&(e.setAttribute(t.attributeKey,t.attributeNewValue,s),i=!0)}return i}(e,n))),n.registerPostFixer((e=>function(e,t){const n=t.selection,i=n.focus;return!!(n.isCollapsed&&n.hasAttribute("mention")&&function(e){const t=e.isAtStart;return e.nodeBefore&&e.nodeBefore.is("$text")||t}(i))&&(e.removeSelectionAttribute("mention"),!0)}(e,n))),e.commands.add("mention",new KR(e))}}function QR(e,t){return Object.assign({uid:ka()},e,t||{})}function YR(e,t){const n=e.getAttribute("data-mention"),i=e.getChild(0);if(i)return QR({id:n,_text:i.data},t)}function JR(e){e.on("attribute:mention",((e,t,n)=>{const i=t.attributeNewValue;if(!t.item.is("$textProxy")||!i)return;const r=t.range.start;(r.textNode||r.nodeAfter).data!=i._text&&n.consumable.consume(t.item,e.name)}),{priority:"highest"})}function XR(e,{writer:t}){if(!e)return;const n={class:"mention","data-mention":e.id},i={id:e.uid,priority:20};return t.createAttributeElement("span",n,i)}function eN(e){return!(!e||!e.is("$text")&&!e.is("$textProxy")||!e.hasAttribute("mention"))&&e.data!=e.getAttribute("mention")._text}function tN(e,t){return!!eN(e)&&(t.removeAttribute("mention",e),!0)}class nN extends Bw{selected;position;constructor(e){super(e),this.extendTemplate({attributes:{class:["ck-mentions"],tabindex:"-1"}})}selectFirst(){this.select(0)}selectNext(){const e=this.selected,t=this.items.getIndex(e);this.select(t+1)}selectPrevious(){const e=this.selected,t=this.items.getIndex(e);this.select(t-1)}select(e){let t=0;e>0&&e<this.items.length?t=e:e<0&&(t=this.items.length-1);const n=this.items.get(t);this.selected!==n&&(this.selected&&this.selected.removeHighlight(),n.highlight(),this.selected=n,this._isItemVisibleInScrolledArea(n)||(this.element.scrollTop=n.element.offsetTop))}executeSelected(){this.selected.fire("execute")}_isItemVisibleInScrolledArea(e){return new vl(this.element).contains(new vl(e.element))}}class iN extends Lb{domElement;constructor(e,t){super(e),this.template=void 0,this.domElement=t,this.domElement.classList.add("ck-button"),this.set("isOn",!1),this.on("change:isOn",((e,t,n)=>{n?(this.domElement.classList.add("ck-on"),this.domElement.classList.remove("ck-off")):(this.domElement.classList.add("ck-off"),this.domElement.classList.remove("ck-on"))})),this.listenTo(this.domElement,"click",(()=>{this.fire("execute")}))}render(){super.render(),this.element=this.domElement}focus(){this.domElement.focus()}}class rN extends Nw{item;marker;highlight(){this.children.first.isOn=!0}removeHighlight(){this.children.first.isOn=!1}}const sN=[Zl.arrowup,Zl.arrowdown,Zl.esc],oN=[Zl.enter,Zl.tab];class aN extends cf{_mentionsView;_mentionsConfigurations;_balloon;_items=new oc;_lastRequested;_requestFeedDebounced;static get pluginName(){return"MentionUI"}static get isOfficialPlugin(){return!0}static get requires(){return[sy]}constructor(e){super(e),this._mentionsView=this._createMentionView(),this._mentionsConfigurations=new Map,this._requestFeedDebounced=id(this._requestFeed,100),e.config.define("mention",{feeds:[]})}init(){const e=this.editor,t=e.config.get("mention.commitKeys")||oN,n=sN.concat(t);this._balloon=e.plugins.get(sy),e.editing.view.document.on("keydown",((e,i)=>{var r;r=i.keyCode,n.includes(r)&&this._isUIVisible&&(i.preventDefault(),e.stop(),i.keyCode==Zl.arrowdown&&this._mentionsView.selectNext(),i.keyCode==Zl.arrowup&&this._mentionsView.selectPrevious(),t.includes(i.keyCode)&&this._mentionsView.executeSelected(),i.keyCode==Zl.esc&&this._hideUIAndRemoveMarker())}),{priority:"highest"}),Mb({emitter:this._mentionsView,activator:()=>this._isUIVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUIAndRemoveMarker()});const i=e.config.get("mention.feeds");for(const e of i){const{feed:t,marker:n,dropdownLimit:i}=e;if(!hN(n))throw new Aa("mentionconfig-incorrect-marker",null,{marker:n});const r={marker:n,feedCallback:"function"==typeof t?t.bind(this.editor):uN(t),itemRenderer:e.itemRenderer,dropdownLimit:i};this._mentionsConfigurations.set(n,r)}this._setupTextWatcher(i),this.listenTo(e,"change:isReadOnly",(()=>{this._hideUIAndRemoveMarker()})),this.on("requestFeed:response",((e,t)=>this._handleFeedResponse(t))),this.on("requestFeed:error",(()=>this._hideUIAndRemoveMarker()))}destroy(){super.destroy(),this._mentionsView.destroy()}get _isUIVisible(){return this._balloon.visibleView===this._mentionsView}_createMentionView(){const e=this.editor.locale,t=new nN(e);return t.items.bindTo(this._items).using((n=>{const{item:i,marker:r}=n,{dropdownLimit:s}=this._mentionsConfigurations.get(r),o=s||this.editor.config.get("mention.dropdownLimit")||10;if(t.items.length>=o)return null;const a=new rN(e),l=this._renderItem(i,r);return l.delegate("execute").to(a),a.children.add(l),a.item=i,a.marker=r,a.on("execute",(()=>{t.fire("execute",{item:i,marker:r})})),a})),t.on("execute",((e,t)=>{const n=this.editor,i=n.model,r=t.item,s=t.marker,o=n.model.markers.get("mention"),a=i.createPositionAt(i.document.selection.focus),l=i.createPositionAt(o.getStart()),c=i.createRange(l,a);this._hideUIAndRemoveMarker(),n.execute("mention",{mention:r,text:r.text,marker:s,range:c}),n.editing.view.focus()})),t}_getItemRenderer(e){const{itemRenderer:t}=this._mentionsConfigurations.get(e);return t}_requestFeed(e,t){this._lastRequested=t;const{feedCallback:n}=this._mentionsConfigurations.get(e),i=n(t);i instanceof Promise?i.then((n=>{this._lastRequested==t?this.fire("requestFeed:response",{feed:n,marker:e,feedText:t}):this.fire("requestFeed:discarded",{feed:n,marker:e,feedText:t})})).catch((t=>{this.fire("requestFeed:error",{error:t}),Ea("mention-feed-callback-error",{marker:e})})):this.fire("requestFeed:response",{feed:i,marker:e,feedText:t})}_setupTextWatcher(e){const t=this.editor,n=e.map((e=>({...e,pattern:dN(e.marker,e.minimumCharacters||0)}))),i=new Zy(t.model,function(e){return t=>{const n=cN(e,t);if(!n)return!1;let i=0;0!==n.position&&(i=n.position-1);const r=t.substring(i);return n.pattern.test(r)}}(n));i.on("matched",((e,i)=>{const r=cN(n,i.text),s=t.model.document.selection.focus,o=t.model.createPositionAt(s.parent,r.position);if(function(e){const t=e.textNode&&e.textNode.hasAttribute("mention"),n=e.nodeBefore;return t||n&&n.is("$text")&&n.hasAttribute("mention")}(s)||function(e){const t=e.nodeAfter;return t&&t.is("$text")&&t.hasAttribute("mention")}(o))return void this._hideUIAndRemoveMarker();const a=function(e,t){let n=0;0!==e.position&&(n=e.position-1);const i=dN(e.marker,0);return t.substring(n).match(i)[2]}(r,i.text),l=r.marker.length+a.length,c=s.getShiftedBy(-l),d=s.getShiftedBy(-a.length),u=t.model.createRange(c,d);if(mN(t)){const e=t.model.markers.get("mention");t.model.change((t=>{t.updateMarker(e,{range:u})}))}else t.model.change((e=>{e.addMarker("mention",{range:u,usingOperation:!1,affectsData:!1})}));this._requestFeedDebounced(r.marker,a)})),i.on("unmatched",(()=>{this._hideUIAndRemoveMarker()}));const r=t.commands.get("mention");return i.bind("isEnabled").to(r),i}_handleFeedResponse(e){const{feed:t,marker:n}=e;if(!mN(this.editor))return;this._items.clear();for(const e of t){const t="object"!=typeof e?{id:e,text:e}:e;this._items.add({item:t,marker:n})}const i=this.editor.model.markers.get("mention");this._items.length?this._showOrUpdateUI(i):this._hideUIAndRemoveMarker()}_showOrUpdateUI(e){this._isUIVisible?this._balloon.updatePosition(this._getBalloonPanelPositionData(e,this._mentionsView.position)):this._balloon.add({view:this._mentionsView,position:this._getBalloonPanelPositionData(e,this._mentionsView.position),singleViewMode:!0}),this._mentionsView.position=this._balloon.view.position,this._mentionsView.selectFirst()}_hideUIAndRemoveMarker(){this._balloon.hasView(this._mentionsView)&&this._balloon.remove(this._mentionsView),mN(this.editor)&&this.editor.model.change((e=>e.removeMarker("mention"))),this._mentionsView.position=void 0}_renderItem(e,t){const n=this.editor;let i,r=e.id;const s=this._getItemRenderer(t);if(s){const t=s(e);"string"!=typeof t?i=new iN(n.locale,t):r=t}if(!i){const e=new jb(n.locale);e.label=r,e.withText=!0,i=e}return i}_getBalloonPanelPositionData(e,t){const n=this.editor,i=n.editing,r=i.view.domConverter,s=i.mapper;return{target:()=>{let t=e.getRange();"$graveyard"==t.start.root.rootName&&(t=n.model.document.selection.getFirstRange());const i=s.toViewRange(t);return vl.getDomRangeRects(r.viewRangeToDom(i)).pop()},limiter:()=>{const e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},positions:lN(t,n.locale.uiLanguageDirection)}}}function lN(e,t){const n={caret_se:e=>({top:e.bottom+3,left:e.right,name:"caret_se",config:{withArrow:!1}}),caret_ne:(e,t)=>({top:e.top-t.height-3,left:e.right,name:"caret_ne",config:{withArrow:!1}}),caret_sw:(e,t)=>({top:e.bottom+3,left:e.right-t.width,name:"caret_sw",config:{withArrow:!1}}),caret_nw:(e,t)=>({top:e.top-t.height-3,left:e.right-t.width,name:"caret_nw",config:{withArrow:!1}})};return Object.prototype.hasOwnProperty.call(n,e)?[n[e]]:"rtl"!==t?[n.caret_se,n.caret_sw,n.caret_ne,n.caret_nw]:[n.caret_sw,n.caret_se,n.caret_nw,n.caret_ne]}function cN(e,t){let n;for(const i of e){const e=t.lastIndexOf(i.marker);e>0&&!t.substring(e-1).match(i.pattern)||(!n||e>=n.position)&&(n={marker:i.marker,position:e,minimumCharacters:i.minimumCharacters,pattern:i.pattern})}return n}function dN(e,t){const n=0==t?"*":`{${t},}`,i=aa.features.isRegExpUnicodePropertySupported?"\\p{Ps}\\p{Pi}\"'":"\\(\\[{\"'";return e=e.replace(/[.*+?^${}()\-|[\]\\]/g,"\\$&"),new RegExp(`(?:^|[ ${i}])(${e})(.${n})$`,"u")}function uN(e){return t=>e.filter((e=>("string"==typeof e?e:String(e.id)).toLowerCase().includes(t.toLowerCase())))}function hN(e){return!!e}function mN(e){return e.model.markers.has("mention")}class gN extends cf{toMentionAttribute(e,t){return YR(e,t)}static get pluginName(){return"Mention"}static get isOfficialPlugin(){return!0}static get requires(){return[ZR,aN]}}class pN extends uf{refresh(){const e=this.editor.model,t=e.schema,n=e.document.selection;this.isEnabled=function(e,t,n){const i=function(e,t){const n=Tk(e,t).start.parent;return n.isEmpty&&!n.is("element","$root")?n.parent:n}(e,n);return t.checkChild(i,"pageBreak")}(n,t,e)}execute(){const e=this.editor.model;e.change((t=>{const n=t.createElement("pageBreak");e.insertObject(n,null,null,{setSelection:"after"})}))}}class fN extends cf{static get pluginName(){return"PageBreakEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model.schema,n=e.t,i=e.conversion;t.register("pageBreak",{inheritAllFrom:"$blockObject"}),i.for("dataDowncast").elementToStructure({model:"pageBreak",view:(e,{writer:t})=>t.createContainerElement("div",{class:"page-break",style:"page-break-after: always"},t.createContainerElement("span",{style:"display: none"}))}),i.for("editingDowncast").elementToStructure({model:"pageBreak",view:(e,{writer:t})=>{const i=n("Page break"),r=t.createContainerElement("div"),s=t.createRawElement("span",{class:"page-break__label"},(function(e){e.innerText=n("Page break")}));return t.addClass("page-break",r),t.insert(t.createPositionAt(r,0),s),function(e,t,n){return t.setCustomProperty("pageBreak",!0,e),kk(e,t,{label:n})}(r,t,i)}}),i.for("upcast").elementToElement({view:e=>{const t="always"==e.getStyle("page-break-before"),n="always"==e.getStyle("page-break-after");if(!t&&!n)return null;if(1==e.childCount){const t=e.getChild(0);if(!t.is("element","span")||"none"!=t.getStyle("display"))return null}else if(e.childCount>1)return null;return{name:!0}},model:"pageBreak",converterPriority:"high"}),e.commands.add("pageBreak",new pN(e))}}class bN extends cf{static get pluginName(){return"PageBreakUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("pageBreak",(()=>{const e=this._createButton(jb);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add("menuBar:pageBreak",(()=>this._createButton(sw)))}_createButton(e){const t=this.editor,n=t.locale,i=t.commands.get("pageBreak"),r=new e(t.locale),s=n.t;return r.set({label:s("Page break"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.598.687h1.5v5h-1.5zm14.5 0h1.5v5h-1.5z"/><path d="M19.598 4.187v1.5h-16v-1.5zm-16 14.569h1.5v-5h-1.5zm14.5 0h1.5v-5h-1.5z"/><path d="M19.598 15.256v-1.5h-16v1.5zM5.081 9h6v2h-6zm8 0h6v2h-6zm-9.483 1L0 12.5v-5z"/></svg>'}),r.bind("isEnabled").to(i,"isEnabled"),this.listenTo(r,"execute",(()=>{t.execute("pageBreak"),t.editing.view.focus()})),r}}class wN extends cf{static get requires(){return[fN,bN,Dk]}static get pluginName(){return"PageBreak"}static get isOfficialPlugin(){return!0}}function vN(e){return void 0!==e&&e.endsWith("px")}function yN(e){return e.toFixed(2).replace(/\.?0+$/,"")+"px"}function _N(e){const t=e.element.previousSibling;return(n=t||e.element.parent).is("element","ol")||n.is("element","ul");var n}function kN(e,t){const n=new RegExp(`@list l${e.id}:level${e.indent}\\s*({[^}]*)`,"gi"),i=/mso-level-number-format:([^;]{0,100});/gi,r=/mso-level-start-at:\s{0,100}([0-9]{0,10})\s{0,100};/gi,s=new RegExp(`@list\\s+l${e.id}:level\\d\\s*{[^{]*mso-level-text:"%\\d\\\\.`,"gi"),o=new RegExp(`@list l${e.id}:level\\d\\s*{[^{]*mso-level-number-format:`,"gi"),a=s.exec(t),l=o.exec(t),c=a&&!l,d=n.exec(t);let u="decimal",h="ol",m=null;if(d&&d[1]){const t=i.exec(d[1]);if(t&&t[1]&&(u=t[1].trim(),h="bullet"!==u&&"image"!==u?"ol":"ul"),"bullet"===u){const t=function(e){if("li"==e.name&&"ul"==e.parent.name&&e.parent.hasAttribute("type"))return e.parent.getAttribute("type");const t=function(e){if(e.getChild(0).is("$text"))return null;for(const t of e.getChildren()){if(!t.is("element","span"))continue;const e=t.getChild(0);if(e)return e.is("$text")?e:e.getChild(0)}return null}(e);if(!t)return null;const n=t._data;return"o"===n?"circle":"·"===n?"disc":"§"===n?"square":null}(e.element);t&&(u=t)}else{const e=r.exec(d[1]);e&&e[1]&&(m=parseInt(e[1]))}c&&(h="ol")}return{type:h,startIndex:m,style:xN(u),isLegalStyleList:c}}function xN(e){if(e.startsWith("arabic-leading-zero"))return"decimal-leading-zero";switch(e){case"alpha-upper":return"upper-alpha";case"alpha-lower":return"lower-alpha";case"roman-upper":return"upper-roman";case"roman-lower":return"lower-roman";case"circle":case"disc":case"square":return e;default:return null}}function CN(e,t,n){const i=t.createElement(e.type);return e.style&&t.setStyle("list-style-type",e.style,i),e.startIndex&&e.startIndex>1&&t.setAttribute("start",e.startIndex,i),e.isLegalStyleList&&n&&t.addClass("legal-list",i),i}function AN(e){const t=e.getStyle("mso-list");if(void 0===t)return{};const n=t.match(/(^|\s{1,100})l(\d+)/i),i=t.match(/\s{0,100}lfo(\d+)/i),r=t.match(/\s{0,100}level(\d+)/i);return n&&i&&r?{id:n[2],order:i[1],indent:parseInt(r[1])}:{indent:1}}function EN(e,t){const n=new Rd({name:"span",styles:{"mso-list":"Ignore"}}),i=t.createRangeIn(e);for(const e of i)"elementStart"===e.type&&n.match(e.item)&&t.remove(e.item)}function TN(e){const t=e.getStyle("margin-left");return void 0===t||t.endsWith("px")?t:function(e){const t=parseFloat(e);return e.endsWith("pt")?yN(96*t/72):e.endsWith("pc")?yN(12*t*96/72):e.endsWith("in")?yN(96*t):e.endsWith("cm")?yN(96*t/2.54):e.endsWith("mm")?yN(t/10*96/2.54):e}(t)}const SN=/<meta\s*name="?generator"?\s*content="?microsoft\s*word\s*\d+"?\/?>/i,PN=/xmlns:o="urn:schemas-microsoft-com/i;class IN{document;hasMultiLevelListPlugin;constructor(e,t=!1){this.document=e,this.hasMultiLevelListPlugin=t}isActive(e){return SN.test(e)||PN.test(e)}execute(e){const t=new up(this.document),{body:n,stylesString:i}=e._parsedData;!function(e,t){const n=[];for(const i of t.createRangeIn(e)){const e=i.item;e.is("element","a")&&!e.hasAttribute("href")&&(e.hasAttribute("id")||e.hasAttribute("name"))&&n.push(e)}for(const e of n){const n=e.parent.getChildIndex(e)+1,i=e.getChildren();t.insertChild(n,i,e.parent)}}(n,t),function(e,t,n){if(!e.childCount)return;const i=new up(e.document),r=function(e,t){const n=t.createRangeIn(e),i=[],r=new Set;for(const e of n.getItems()){if(!e.is("element")||!e.name.match(/^(p|h\d+|li|div)$/))continue;let t=TN(e);if(void 0===t||0!=parseFloat(t)||Array.from(e.getClassNames()).find((e=>e.startsWith("MsoList")))||(t=void 0),e.hasStyle("mso-list")||void 0!==t&&r.has(t)){const n=AN(e);i.push({element:e,id:n.id,order:n.order,indent:n.indent,marginLeft:t}),void 0!==t&&r.add(t)}else r.clear()}return i}(e,i);if(!r.length)return;const s={},o=[];for(const e of r)if(void 0!==e.indent){_N(e)||(o.length=0);const r=`${e.id}:${e.indent}`,a=Math.min(e.indent-1,o.length);if(a<o.length&&o[a].id!==e.id&&(o.length=a),a<o.length-1)o.length=a+1;else{const l=kN(e,t);if(a>o.length-1||o[a].listElement.name!=l.type){0==a&&"ol"==l.type&&void 0!==e.id&&s[r]&&(l.startIndex=s[r]);const t=CN(l,i,n);if(vN(e.marginLeft)&&(0==a||vN(o[a-1].marginLeft))){let n=e.marginLeft;a>0&&(n=yN(parseFloat(n)-parseFloat(o[a-1].marginLeft))),i.setStyle("padding-left",n,t)}if(0==o.length){const n=e.element.parent,r=n.getChildIndex(e.element)+1;i.insertChild(r,t,n)}else{const e=o[a-1].listItemElements;i.appendChild(t,e[e.length-1])}o[a]={...e,listElement:t,listItemElements:[]},0==a&&void 0!==e.id&&(s[r]=l.startIndex||1)}}const l="li"==e.element.name?e.element:i.createElement("li");i.appendChild(l,o[a].listElement),o[a].listItemElements.push(l),0==a&&void 0!==e.id&&s[r]++,e.element!=l&&i.appendChild(e.element,l),EN(e.element,i),i.removeStyle("text-indent",e.element),i.removeStyle("margin-left",e.element)}else{const t=o.find((t=>t.marginLeft==e.marginLeft));if(t){const n=t.listItemElements;i.appendChild(e.element,n[n.length-1]),i.removeStyle("margin-left",e.element)}else o.length=0}}(n,i,this.hasMultiLevelListPlugin),function(e,t){if(!e.childCount)return;const n=new up(e.document),i=function(e,t){const n=t.createRangeIn(e),i=new Rd({name:/v:(.+)/}),r=[];for(const e of n){if("elementStart"!=e.type)continue;const t=e.item,n=t.previousSibling,s=n&&n.is("element")?n.name:null,o=["Chart"],a=i.match(t),l=t.getAttribute("o:gfxdata"),c="v:shapetype"===s,d=l&&o.some((e=>t.getAttribute("id").includes(e)));a&&l&&!c&&!d&&r.push(e.item.getAttribute("id"))}return r}(e,n);!function(e,t,n){const i=n.createRangeIn(t),r=new Rd({name:"img"}),s=[];for(const t of i)if(t.item.is("element")&&r.match(t.item)){const n=t.item,i=n.getAttribute("v:shapes")?n.getAttribute("v:shapes").split(" "):[];i.length&&i.every((t=>e.indexOf(t)>-1))?s.push(n):n.getAttribute("src")||s.push(n)}for(const e of s)n.remove(e)}(i,e,n),function(e,t,n){const i=n.createRangeIn(t),r=[];for(const t of i)if("elementStart"==t.type&&t.item.is("element","v:shape")){const n=t.item.getAttribute("id");if(e.includes(n))continue;s(t.item.parent.getChildren(),n)||r.push(t.item)}for(const e of r){const t={src:o(e)};e.hasAttribute("alt")&&(t.alt=e.getAttribute("alt"));const i=n.createElement("img",t);n.insertChild(e.index+1,i,e.parent)}function s(e,t){for(const n of e)if(n.is("element")){if("img"==n.name&&n.getAttribute("v:shapes")==t)return!0;if(s(n.getChildren(),t))return!0}return!1}function o(e){for(const t of e.getChildren())if(t.is("element")&&t.getAttribute("src"))return t.getAttribute("src")}}(i,e,n),function(e,t){const n=t.createRangeIn(e),i=new Rd({name:/v:(.+)/}),r=[];for(const e of n)"elementStart"==e.type&&i.match(e.item)&&r.push(e.item);for(const e of r)t.remove(e)}(e,n);const r=function(e,t){const n=t.createRangeIn(e),i=new Rd({name:"img"}),r=[];for(const e of n)e.item.is("element")&&i.match(e.item)&&e.item.getAttribute("src").startsWith("file://")&&r.push(e.item);return r}(e,n);r.length&&function(e,t,n){if(e.length===t.length)for(let r=0;r<e.length;r++){const s=`data:${t[r].type};base64,${i=t[r].hex,btoa(i.match(/\w{2}/g).map((e=>String.fromCharCode(parseInt(e,16)))).join(""))}`;n.setAttribute("src",s,e[r])}var i}(r,function(e){if(!e)return[];const t=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,n=new RegExp("(?:("+t.source+"))([\\da-fA-F\\s]+)\\}","g"),i=e.match(n),r=[];if(i)for(const e of i){let n=!1;e.includes("\\pngblip")?n="image/png":e.includes("\\jpegblip")&&(n="image/jpeg"),n&&r.push({hex:e.replace(t,"").replace(/[^\da-fA-F]/g,""),type:n})}return r}(t),n)}(n,e.dataTransfer.getData("text/rtf")),function(e){const t=[],n=new up(e.document);for(const{item:i}of n.createRangeIn(e))if(i.is("element")){for(const e of i.getClassNames())/\bmso/gi.exec(e)&&n.removeClass(e,i);for(const e of i.getStyleNames())/\bmso/gi.exec(e)&&n.removeStyle(e,i);(i.is("element","w:sdt")||i.is("element","w:sdtpr")&&i.isEmpty||i.is("element","o:p")&&i.isEmpty)&&t.push(i)}for(const e of t){const t=e.parent,i=t.getChildIndex(e);n.insertChild(i,e.getChildren(),t),n.remove(e)}}(n),e.content=n}}function ON(e,t,n,{blockElements:i,inlineObjectElements:r}){let s=n.createPositionAt(e,"forward"==t?"after":"before");return s=s.getLastMatchingPosition((({item:e})=>e.is("element")&&!i.includes(e.name)&&!r.includes(e.name)),{direction:t}),"forward"==t?s.nodeAfter:s.nodeBefore}function VN(e,t){return!!e&&e.is("element")&&t.includes(e.name)}const RN=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class NN{document;constructor(e){this.document=e}isActive(e){return RN.test(e)}execute(e){const t=new up(this.document),{body:n}=e._parsedData;!function(e,t){for(const n of e.getChildren())if(n.is("element","b")&&"normal"===n.getStyle("font-weight")){const i=e.getChildIndex(n);t.remove(n),t.insertChild(i,n.getChildren(),e)}}(n,t),function(e,t){for(const n of t.createRangeIn(e)){const e=n.item;if(e.is("element","li")){const n=e.getChild(0);n&&n.is("element","p")&&t.unwrapElement(n)}}}(n,t),function(e,t){const n=new ou(t.document.stylesProcessor),i=new Uu(n,{renderingMode:"data"}),r=i.blockElements,s=i.inlineObjectElements,o=[];for(const n of t.createRangeIn(e)){const e=n.item;if(e.is("element","br")){const n=ON(e,"forward",t,{blockElements:r,inlineObjectElements:s}),i=ON(e,"backward",t,{blockElements:r,inlineObjectElements:s}),a=VN(n,r);(VN(i,r)||a)&&o.push(e)}}for(const e of o)e.hasClass("Apple-interchange-newline")?t.remove(e):t.replace(e,t.createElement("p"))}(n,t),e.content=n}}const LN=/<google-sheets-html-origin/i;class MN{document;constructor(e){this.document=e}isActive(e){return LN.test(e)}execute(e){const t=new up(this.document),{body:n}=e._parsedData;!function(e,t){for(const n of e.getChildren())if(n.is("element","google-sheets-html-origin")){const i=e.getChildIndex(n);t.remove(n),t.insertChild(i,n.getChildren(),e)}}(n,t),function(e,t){for(const n of e.getChildren())n.is("element","table")&&n.hasAttribute("xmlns")&&t.removeAttribute("xmlns",n)}(n,t),function(e,t){for(const n of e.getChildren())n.is("element","table")&&"0px"===n.getStyle("width")&&t.removeStyle("width",n)}(n,t),function(e,t){for(const n of Array.from(e.getChildren()))n.is("element","style")&&t.remove(n)}(n,t),e.content=n}}function BN(e){return e.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,((e,t)=>1===t.length?" ":Array(t.length+1).join(" ").substr(0,t.length)))}class FN extends cf{static get pluginName(){return"PasteFromOffice"}static get isOfficialPlugin(){return!0}static get requires(){return[vx]}init(){const e=this.editor,t=e.plugins.get("ClipboardPipeline"),n=e.editing.view.document,i=[],r=this.editor.plugins.has("MultiLevelList");i.push(new IN(n,r)),i.push(new NN(n)),i.push(new MN(n)),t.on("inputTransformation",((t,r)=>{if(r._isTransformedWithPasteFromOffice)return;if(e.model.document.selection.getFirstPosition().parent.is("element","codeBlock"))return;const s=r.dataTransfer.getData("text/html"),o=i.find((e=>e.isActive(s)));o&&(r._parsedData||(r._parsedData=function(e,t){const n=new DOMParser,i=function(e){return BN(BN(e)).replace(/(<span\s+style=['"]mso-spacerun:yes['"]>[^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<span\s+style=['"]mso-spacerun:yes['"]><\/span>/g,"").replace(/(<span\s+style=['"]letter-spacing:[^'"]+?['"]>)[\r\n]+(<\/span>)/g,"$1 $2").replace(/ <\//g," </").replace(/ <o:p><\/o:p>/g," <o:p></o:p>").replace(/<o:p>( |\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)</g,"><")}(function(e){const t="</body>",n=e.indexOf(t);if(n<0)return e;const i=e.indexOf("</html>",n+7);return e.substring(0,n+7)+(i>=0?e.substring(i):"")}(e=(e=e.replace(/<!--\[if gte vml 1]>/g,"")).replace(/<o:SmartTagType(?:\s+[^\s>=]+(?:="[^"]*")?)*\s*\/?>/gi,""))),r=n.parseFromString(i,"text/html");!function(e){e.querySelectorAll("span[style*=spacerun]").forEach((e=>{const t=e,n=t.innerText.length||0;t.innerText=Array(n+1).join(" ").substr(0,n)}))}(r);const s=r.body.innerHTML,o=function(e,t){const n=new ou(t),i=new Uu(n,{renderingMode:"data"}),r=e.createDocumentFragment(),s=e.body.childNodes;for(;s.length>0;)r.appendChild(s[0]);return i.domToView(r,{skipComments:!0})}(r,t),a=function(e){const t=[],n=[],i=Array.from(e.getElementsByTagName("style"));for(const e of i)e.sheet&&e.sheet.cssRules&&e.sheet.cssRules.length&&(t.push(e.sheet),n.push(e.innerHTML));return{styles:t,stylesString:n.join(" ")}}(r);return{body:o,bodyString:s,styles:a.styles,stylesString:a.stylesString}}(s,n.stylesProcessor)),o.execute(r),r._isTransformedWithPasteFromOffice=!0)}),{priority:"high"})}}const DN="removeFormat";class zN extends cf{static get pluginName(){return"RemoveFormatUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add(DN,(()=>{const e=this._createButton(jb);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add(`menuBar:${DN}`,(()=>this._createButton(sw)))}_createButton(e){const t=this.editor,n=t.locale,i=t.commands.get(DN),r=new e(t.locale),s=n.t;return r.set({label:s("Remove Format"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.69 14.915c.053.052.173.083.36.093a.366.366 0 0 1 .345.485l-.003.01a.738.738 0 0 1-.697.497h-2.67a.374.374 0 0 1-.353-.496l.013-.038a.681.681 0 0 1 .644-.458c.197-.012.325-.043.386-.093a.28.28 0 0 0 .072-.11L9.592 4.5H6.269c-.359-.017-.609.013-.75.09-.142.078-.289.265-.442.563-.192.29-.516.464-.864.464H4.17a.43.43 0 0 1-.407-.569L4.46 3h13.08l-.62 2.043a.81.81 0 0 1-.775.574h-.114a.486.486 0 0 1-.486-.486c.001-.284-.054-.464-.167-.54-.112-.076-.367-.106-.766-.091h-3.28l-2.68 10.257c-.006.074.007.127.038.158zM3 17h8a.5.5 0 1 1 0 1H3a.5.5 0 1 1 0-1zm11.299 1.17a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.06-1.06l1.415 1.414 1.414-1.415a.75.75 0 1 1 1.06 1.06l-1.413 1.415 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414-1.414 1.414z"/></svg>'}),r.bind("isEnabled").to(i,"isEnabled"),this.listenTo(r,"execute",(()=>{t.execute(DN),t.editing.view.focus()})),r}}class $N extends uf{refresh(){const e=this.editor.model;this.isEnabled=!!ac(this._getFormattingItems(e.document.selection,e.schema))}execute(){const e=this.editor.model,t=e.schema;e.change((n=>{for(const i of this._getFormattingItems(e.document.selection,t))if(i.is("selection"))for(const e of this._getFormattingAttributes(i,t))n.removeSelectionAttribute(e);else{const e=n.createRangeOn(i);for(const r of this._getFormattingAttributes(i,t))n.removeAttribute(r,e)}}))}*_getFormattingItems(e,t){const n=e=>!!ac(this._getFormattingAttributes(e,t));for(const i of e.getRanges())for(const e of i.getItems())!t.isBlock(e)&&n(e)&&(yield e);for(const t of e.getSelectedBlocks())n(t)&&(yield t);n(e)&&(yield e)}*_getFormattingAttributes(e,t){for(const[n]of e.getAttributes()){const e=t.getAttributeProperties(n);e&&e.isFormatting&&(yield n)}}}class jN extends cf{static get pluginName(){return"RemoveFormatEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.commands.add("removeFormat",new $N(e))}}class HN extends cf{static get requires(){return[jN,zN]}static get pluginName(){return"RemoveFormat"}static get isOfficialPlugin(){return!0}}class WN extends uf{constructor(e){super(e),this.affectsData=!1,this.value=!1}execute(){const e="ck-show-blocks",t=this.editor.editing.view;t.change((n=>{for(const i of t.document.roots)i.hasClass(e)?(n.removeClass(e,i),this.value=!1):(n.addClass(e,i),this.value=!0)}))}}class UN extends cf{static get pluginName(){return"ShowBlocksEditing"}static get isOfficialPlugin(){return!0}init(){const{editor:e}=this;e.commands.add("showBlocks",new WN(e))}}class qN extends cf{static get pluginName(){return"ShowBlocksUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("showBlocks",(()=>{const e=this._createButton(jb);return e.set({tooltip:!0,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m6.395 9.196 2.545-.007V6.498a.598.598 0 0 1 .598-.598h.299a.598.598 0 0 1 .598.598v6.877a.598.598 0 0 1-.598.598h-.299a.598.598 0 0 1-.598-.598v-2.691l-2.545.007v2.691a.598.598 0 0 1-.598.598h-.299a.598.598 0 0 1-.598-.598V6.505a.598.598 0 0 1 .598-.598h.299a.598.598 0 0 1 .598.598v2.691Z"/><path d="M15.094 13.417V6.462a.562.562 0 0 0-.562-.562h-.782a1 1 0 0 0-.39.08l-1.017.43a.562.562 0 0 0-.343.517v.197c0 .4.406.67.775.519l.819-.337v6.111c0 .31.251.562.561.562h.377c.31 0 .562-.251.562-.562Z"/><path d="M0 15.417v1.5h1.5v-1.5H0Z"/><path d="M18.5 15.417v1.5H20v-1.5h-1.5Z"/><path d="M18.5 12.333v1.5H20v-1.5h-1.5Z"/><path d="M18.5 9.25v1.5H20v-1.5h-1.5Z"/><path d="M18.5 6.167v1.5H20v-1.5h-1.5Z"/><path d="M0 18.5v.5a1 1 0 0 0 1 1h.5v-1.5H0Z"/><path d="M3.083 18.5V20h1.5v-1.5h-1.5Z"/><path d="M6.167 18.5V20h1.5v-1.5h-1.5Z"/><path d="M9.25 18.5V20h1.5v-1.5h-1.5Z"/><path d="M12.333 18.5V20h1.5v-1.5h-1.5Z"/><path d="M15.417 18.5V20h1.5v-1.5h-1.5Z"/><path d="M18.5 18.5V20h.5a1 1 0 0 0 1-1v-.5h-1.5Z"/><path clip-rule="evenodd" d="M0 1a1 1 0 0 1 1-1h18a1 1 0 0 1 1 1v3.583h-1.5V1.5h-17v12.333H0V1Z"/></svg>'}),e})),e.ui.componentFactory.add("menuBar:showBlocks",(()=>this._createButton(sw)))}_createButton(e){const t=this.editor,n=t.locale,i=t.commands.get("showBlocks"),r=new e(n),s=n.t;return r.set({label:s("Show blocks"),isToggleable:!0,role:"menuitemcheckbox"}),r.bind("isEnabled").to(i),r.bind("isOn").to(i,"value",i,"isEnabled",((e,t)=>e&&t)),this.listenTo(r,"execute",(()=>{t.execute("showBlocks"),t.editing.view.focus()})),r}}class GN extends cf{static get pluginName(){return"ShowBlocks"}static get isOfficialPlugin(){return!0}static get requires(){return[UN,qN]}}function KN(e,t,n=" "){return`${n.repeat(Math.max(0,t))}${e}`}const ZN="SourceEditingMode";class QN extends cf{static get pluginName(){return"SourceEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Sf]}_elementReplacer;_replacedRoots;_dataFromRoots;constructor(e){super(e),this.set("isSourceEditingMode",!1),this._elementReplacer=new Xa,this._replacedRoots=new Map,this._dataFromRoots=new Map,e.config.define("sourceEditing.allowCollaborationFeatures",!1)}init(){this._checkCompatibility();const e=this.editor,t=e.locale.t;e.ui.componentFactory.add("sourceEditing",(()=>{const e=this._createButton(jb);return e.set({label:t("Source"),icon:Pf.source,tooltip:!0,class:"ck-source-editing-button"}),e})),e.ui.componentFactory.add("menuBar:sourceEditing",(()=>{const e=this._createButton(sw);return e.set({label:t("Show source"),role:"menuitemcheckbox"}),e})),this._isAllowedToHandleSourceEditingMode()&&(this.on("change:isSourceEditingMode",((e,t,n)=>{n?(this._hideVisibleDialog(),this._showSourceEditing(),this._disableCommands()):(this._hideSourceEditing(),this._enableCommands())})),this.on("change:isEnabled",((e,t,n)=>this._handleReadOnlyMode(!n))),this.listenTo(e,"change:isReadOnly",((e,t,n)=>this._handleReadOnlyMode(n)))),e.data.on("get",(()=>{this.isSourceEditingMode&&this.updateEditorData()}),{priority:"high"})}updateEditorData(){const e=this.editor,t={};for(const[e,n]of this._replacedRoots){const i=this._dataFromRoots.get(e),r=n.dataset.value;i!==r&&(t[e]=r,this._dataFromRoots.set(e,r))}Object.keys(t).length&&e.data.set(t,{batchType:{isUndoable:!0},suppressErrorInCollaboration:!0})}_checkCompatibility(){const e=this.editor,t=e.config.get("sourceEditing.allowCollaborationFeatures");if(!t&&e.plugins.has("RealTimeCollaborativeEditing"))throw new Aa("source-editing-incompatible-with-real-time-collaboration",null);!t&&["CommentsEditing","TrackChangesEditing","RevisionHistory"].some((t=>e.plugins.has(t)))&&console.warn("You initialized the editor with the source editing feature and at least one of the collaboration features. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the collaboration features."),e.plugins.has("RestrictedEditingModeEditing")&&console.warn("You initialized the editor with the source editing feature and restricted editing feature. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the restricted editing feature.")}_showSourceEditing(){const e=this.editor,t=e.editing.view,n=e.model;n.change((e=>{e.setSelection(null),e.removeSelectionAttribute(n.document.selection.getAttributeKeys())}));for(const[n,r]of t.domRoots){const s=function(e){return e.startsWith("<")}(i=e.data.get({rootName:n}))?function(e){const t=[{name:"address",isVoid:!1},{name:"article",isVoid:!1},{name:"aside",isVoid:!1},{name:"blockquote",isVoid:!1},{name:"details",isVoid:!1},{name:"dialog",isVoid:!1},{name:"dd",isVoid:!1},{name:"div",isVoid:!1},{name:"dl",isVoid:!1},{name:"dt",isVoid:!1},{name:"fieldset",isVoid:!1},{name:"figcaption",isVoid:!1},{name:"figure",isVoid:!1},{name:"footer",isVoid:!1},{name:"form",isVoid:!1},{name:"h1",isVoid:!1},{name:"h2",isVoid:!1},{name:"h3",isVoid:!1},{name:"h4",isVoid:!1},{name:"h5",isVoid:!1},{name:"h6",isVoid:!1},{name:"header",isVoid:!1},{name:"hgroup",isVoid:!1},{name:"hr",isVoid:!0},{name:"li",isVoid:!1},{name:"main",isVoid:!1},{name:"nav",isVoid:!1},{name:"ol",isVoid:!1},{name:"p",isVoid:!1},{name:"section",isVoid:!1},{name:"table",isVoid:!1},{name:"tbody",isVoid:!1},{name:"td",isVoid:!1},{name:"th",isVoid:!1},{name:"thead",isVoid:!1},{name:"tr",isVoid:!1},{name:"ul",isVoid:!1}],n=t.map((e=>e.name)).join("|"),i=e.replace(new RegExp(`</?(${n})( .*?)?>`,"g"),"\n$&\n").replace(/<br[^>]*>/g,"$&\n").split("\n");let r=0,s=!1;return i.filter((e=>e.length)).map((e=>(s=function(e,t){return new RegExp("<pre( .*?)?>").test(e)?"first":new RegExp("</pre>").test(e)?"last":("first"===t||"middle"===t)&&"middle"}(e,s),function(e,t){return t.some((t=>!t.isVoid&&!!new RegExp(`<${t.name}( .*?)?>`).test(e)))}(e,t)?KN(e,r++):function(e,t){return t.some((t=>new RegExp(`</${t.name}>`).test(e)))}(e,t)?KN(e,--r):"middle"===s||"last"===s?e:KN(e,r)))).join("\n")}(i):i,o=il(r.ownerDocument,"textarea",{rows:"1","aria-label":"Source code editing area"}),a=il(r.ownerDocument,"div",{class:"ck-source-editing-area","data-value":s},[o]);o.value=s,o.setSelectionRange(0,0),o.addEventListener("input",(()=>{a.dataset.value=o.value,e.ui.update()})),t.change((e=>{const i=t.document.getRoot(n);e.addClass("ck-hidden",i)})),e.ui.setEditableElement("sourceEditing:"+n,o),this._replacedRoots.set(n,a),this._elementReplacer.replace(r,a),this._dataFromRoots.set(n,s)}var i;this._focusSourceEditing()}_hideSourceEditing(){const e=this.editor.editing.view;this.updateEditorData(),e.change((t=>{for(const[n]of this._replacedRoots)t.removeClass("ck-hidden",e.document.getRoot(n))})),this._elementReplacer.restore(),this._replacedRoots.clear(),this._dataFromRoots.clear(),e.focus()}_focusSourceEditing(){const e=this.editor,[t]=this._replacedRoots.values(),n=t.querySelector("textarea");e.editing.view.document.isFocused=!1,n.focus()}_disableCommands(){const e=this.editor;for(const t of e.commands.commands())t.forceDisabled(ZN);e.plugins.has("CommentsArchiveUI")&&e.plugins.get("CommentsArchiveUI").forceDisabled(ZN)}_enableCommands(){const e=this.editor;for(const t of e.commands.commands())t.clearForceDisabled(ZN);e.plugins.has("CommentsArchiveUI")&&e.plugins.get("CommentsArchiveUI").clearForceDisabled(ZN)}_handleReadOnlyMode(e){if(this.isSourceEditingMode)for(const[,t]of this._replacedRoots)t.querySelector("textarea").readOnly=e}_isAllowedToHandleSourceEditingMode(){const e=this.editor.ui.view.editable;return e&&!e.hasExternalElement}_hideVisibleDialog(){if(this.editor.plugins.has("Dialog")){const e=this.editor.plugins.get("Dialog");e.isOpen&&e.hide()}}_createButton(e){const t=this.editor,n=new e(t.locale);return n.set({withText:!0,isToggleable:!0}),n.bind("isOn").to(this,"isSourceEditingMode"),n.bind("isEnabled").to(this,"isEnabled",t,"isReadOnly",t.plugins.get(Sf),"hasAny",((e,t,n)=>!!e&&!t&&!n)),this.listenTo(n,"execute",(()=>{this.isSourceEditingMode=!this.isSourceEditingMode})),n}}class YN extends Lb{tiles;focusTracker;keystrokes;constructor(e){super(e),this.tiles=this.createCollection(),this.setTemplate({tag:"div",children:[{tag:"div",attributes:{class:["ck","ck-character-grid__tiles"]},children:this.tiles}],attributes:{class:["ck","ck-character-grid"]}}),this.focusTracker=new lc,this.keystrokes=new hc,Db({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.tiles,numberOfColumns:()=>ra.window.getComputedStyle(this.element.firstChild).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}createTile(e,t){const n=new jb(this.locale);return n.set({label:e,withText:!0,class:"ck-character-grid__tile"}),n.extendTemplate({attributes:{title:t},on:{mouseover:n.bindTemplate.to("mouseover"),focus:n.bindTemplate.to("focus")}}),n.on("mouseover",(()=>{this.fire("tileHover",{name:t,character:e})})),n.on("focus",(()=>{this.fire("tileFocus",{name:t,character:e})})),n.on("execute",(()=>{this.fire("execute",{name:t,character:e})})),n}render(){super.render();for(const e of this.tiles)this.focusTracker.add(e.element);this.tiles.on("change",((e,{added:t,removed:n})=>{if(t.length>0)for(const e of t)this.focusTracker.add(e.element);if(n.length>0)for(const e of n)this.focusTracker.remove(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.keystrokes.destroy()}focus(){this.tiles.first.focus()}}class JN extends Lb{constructor(e){super(e);const t=this.bindTemplate;this.set("character",null),this.set("name",null),this.bind("code").to(this,"character",XN),this.setTemplate({tag:"div",children:[{tag:"span",attributes:{class:["ck-character-info__name"]},children:[{text:t.to("name",(e=>e||""))}]},{tag:"span",attributes:{class:["ck-character-info__code"]},children:[{text:t.to("code")}]}],attributes:{class:["ck","ck-character-info"]}})}}function XN(e){return null===e?"":"U+"+("0000"+e.codePointAt(0).toString(16)).slice(-4)}class eL extends Lb{items;focusTracker;keystrokes;_focusCycler;categoriesView;gridView;infoView;constructor(e,t,n,i){super(e),this.categoriesView=t,this.gridView=n,this.infoView=i,this.items=this.createCollection(),this.focusTracker=new lc,this.keystrokes=new hc,this._focusCycler=new Ub({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",children:[this.categoriesView,this.gridView,this.infoView],attributes:{tabindex:"-1"}}),this.items.add(this.categoriesView),this.items.add(this.gridView)}render(){super.render(),this.focusTracker.add(this.categoriesView.element),this.focusTracker.add(this.gridView.element),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}}class tL extends Lb{_groupNames;_dropdownView;constructor(e,t){super(e),this.set("currentGroupName",Array.from(t.entries())[0][0]),this._groupNames=t,this._dropdownView=new Ew(e,av),this.setTemplate({tag:"div",attributes:{class:["ck","ck-character-categories"]},children:[this._dropdownView]})}render(){super.render(),this._setupDropdown()}focus(){this._dropdownView.focus()}_setupDropdown(){const e=new oc;for(const[t,n]of this._groupNames){const i={type:"button",model:new iy({name:t,label:n,role:"menuitemradio",withText:!0})};i.model.bind("isOn").to(this,"currentGroupName",(e=>e===t)),e.add(i)}const t=(0,this.locale.t)("Category");this._dropdownView.set({label:t,isEmpty:!1}),this._dropdownView.fieldView.panelPosition="rtl"===this.locale.uiLanguageDirection?"se":"sw",this._dropdownView.fieldView.buttonView.set({withText:!0,tooltip:t,ariaLabel:t,ariaLabelledBy:void 0,isOn:!1}),this._dropdownView.fieldView.buttonView.bind("label").to(this,"currentGroupName",(e=>this._groupNames.get(e))),this._dropdownView.fieldView.on("execute",(({source:e})=>{this.currentGroupName=e.name})),ev(this._dropdownView.fieldView,e,{ariaLabel:t,role:"menu"})}}const nL="All";class iL extends cf{_characters;_groups;_allSpecialCharactersGroupLabel;static get requires(){return[Gy,nw]}static get pluginName(){return"SpecialCharacters"}static get isOfficialPlugin(){return!0}constructor(e){super(e);const t=e.t;this._characters=new Map,this._groups=new Map,this._allSpecialCharactersGroupLabel=t("All")}init(){const e=this.editor;e.ui.componentFactory.add("specialCharacters",(()=>{const e=this._createDialogButton(jb);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add("menuBar:specialCharacters",(()=>this._createDialogButton(sw)))}addItems(e,t,n={label:e}){if(e===nL)throw new Aa("special-character-invalid-group-name",null);const i=this._getGroup(e,n.label);for(const e of t)i.items.add(e.title),this._characters.set(e.title,e.character)}getGroups(){const e=Array.from(this._groups.keys()),t=this.editor.config.get("specialCharacters.order")||[],n=t.find((t=>!e.includes(t)));if(n)throw new Aa("special-character-invalid-order-group-name",null,{invalidGroup:n});return new Set([...t,...e])}getCharactersForGroup(e){if(e===nL)return new Set(this._characters.keys());const t=this._groups.get(e);return t?t.items:void 0}getCharacter(e){return this._characters.get(e)}_getGroup(e,t){return this._groups.has(e)||this._groups.set(e,{items:new Set,label:t}),this._groups.get(e)}_updateGrid(e,t){t.tiles.clear();const n=this.getCharactersForGroup(e);for(const e of n){const n=this.getCharacter(e);t.tiles.add(t.createTile(n,e))}}_createDropdownPanelContent(e){const t=Array.from(this.getGroups()).map((e=>[e,this._groups.get(e).label])),n=new Map([[nL,this._allSpecialCharactersGroupLabel],...t]),i=new tL(e,n),r=new YN(e),s=new JN(e);return r.on("tileHover",((e,t)=>{s.set(t)})),r.on("tileFocus",((e,t)=>{s.set(t)})),i.on("change:currentGroupName",((e,t,n)=>{this._updateGrid(n,r)})),this._updateGrid(i.currentGroupName,r),{categoriesView:i,gridView:r,infoView:s}}_createDialogButton(e){const t=this.editor,n=t.locale,i=new e(t.locale),r=t.commands.get("insertText"),s=n.t,o=this.editor.plugins.get("Dialog");return i.set({label:s("Special characters"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 2.5a7.47 7.47 0 0 1 4.231 1.31 7.268 7.268 0 0 1 2.703 3.454 7.128 7.128 0 0 1 .199 4.353c-.39 1.436-1.475 2.72-2.633 3.677h2.013c0-.226.092-.443.254-.603a.876.876 0 0 1 1.229 0c.163.16.254.377.254.603v.853c0 .209-.078.41-.22.567a.873.873 0 0 1-.547.28l-.101.006h-4.695a.517.517 0 0 1-.516-.518v-1.265c0-.21.128-.398.317-.489a5.601 5.601 0 0 0 2.492-2.371 5.459 5.459 0 0 0 .552-3.693 5.53 5.53 0 0 0-1.955-3.2A5.71 5.71 0 0 0 10 4.206 5.708 5.708 0 0 0 6.419 5.46 5.527 5.527 0 0 0 4.46 8.663a5.457 5.457 0 0 0 .554 3.695 5.6 5.6 0 0 0 2.497 2.37.55.55 0 0 1 .317.49v1.264c0 .286-.23.518-.516.518H2.618a.877.877 0 0 1-.614-.25.845.845 0 0 1-.254-.603v-.853c0-.226.091-.443.254-.603a.876.876 0 0 1 1.228 0c.163.16.255.377.255.603h1.925c-1.158-.958-2.155-2.241-2.545-3.678a7.128 7.128 0 0 1 .199-4.352 7.268 7.268 0 0 1 2.703-3.455A7.475 7.475 0 0 1 10 2.5z"/></svg>',isToggleable:!0}),i.bind("isOn").to(o,"id",(e=>"specialCharacters"===e)),i.bind("isEnabled").to(r,"isEnabled"),i.on("execute",(()=>{"specialCharacters"!==o.id?this._showDialog():o.hide()})),i}_showDialog(){const e=this.editor,t=e.plugins.get("Dialog"),n=e.locale,i=n.t,{categoriesView:r,gridView:s,infoView:o}=this._createDropdownPanelContent(n),a=new eL(n,r,s,o);s.on("execute",((t,n)=>{e.execute("insertText",{text:n.character})})),t.show({id:"specialCharacters",title:i("Special characters"),className:"ck-special-characters",content:a,position:Xb})}}class rL extends cf{static get pluginName(){return"SpecialCharactersArrows"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Arrows",[{title:t("leftwards simple arrow"),character:"←"},{title:t("rightwards simple arrow"),character:"→"},{title:t("upwards simple arrow"),character:"↑"},{title:t("downwards simple arrow"),character:"↓"},{title:t("leftwards double arrow"),character:"⇐"},{title:t("rightwards double arrow"),character:"⇒"},{title:t("upwards double arrow"),character:"⇑"},{title:t("downwards double arrow"),character:"⇓"},{title:t("leftwards dashed arrow"),character:"⇠"},{title:t("rightwards dashed arrow"),character:"⇢"},{title:t("upwards dashed arrow"),character:"⇡"},{title:t("downwards dashed arrow"),character:"⇣"},{title:t("leftwards arrow to bar"),character:"⇤"},{title:t("rightwards arrow to bar"),character:"⇥"},{title:t("upwards arrow to bar"),character:"⤒"},{title:t("downwards arrow to bar"),character:"⤓"},{title:t("up down arrow with base"),character:"↨"},{title:t("back with leftwards arrow above"),character:"🔙"},{title:t("end with leftwards arrow above"),character:"🔚"},{title:t("on with exclamation mark with left right arrow above"),character:"🔛"},{title:t("soon with rightwards arrow above"),character:"🔜"},{title:t("top with upwards arrow above"),character:"🔝"}],{label:t("Arrows")})}}class sL extends cf{static get pluginName(){return"SpecialCharactersText"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Text",[{character:"‹",title:t("Single left-pointing angle quotation mark")},{character:"›",title:t("Single right-pointing angle quotation mark")},{character:"«",title:t("Left-pointing double angle quotation mark")},{character:"»",title:t("Right-pointing double angle quotation mark")},{character:"‘",title:t("Left single quotation mark")},{character:"’",title:t("Right single quotation mark")},{character:"“",title:t("Left double quotation mark")},{character:"”",title:t("Right double quotation mark")},{character:"‚",title:t("Single low-9 quotation mark")},{character:"„",title:t("Double low-9 quotation mark")},{character:"¡",title:t("Inverted exclamation mark")},{character:"¿",title:t("Inverted question mark")},{character:"‥",title:t("Two dot leader")},{character:"…",title:t("Horizontal ellipsis")},{character:"‡",title:t("Double dagger")},{character:"‰",title:t("Per mille sign")},{character:"‱",title:t("Per ten thousand sign")},{character:"‼",title:t("Double exclamation mark")},{character:"⁈",title:t("Question exclamation mark")},{character:"⁉",title:t("Exclamation question mark")},{character:"⁇",title:t("Double question mark")},{character:"©",title:t("Copyright sign")},{character:"®",title:t("Registered sign")},{character:"™",title:t("Trade mark sign")},{character:"§",title:t("Section sign")},{character:"¶",title:t("Paragraph sign")},{character:"⁋",title:t("Reversed paragraph sign")}],{label:t("Text")})}}class oL extends cf{static get pluginName(){return"SpecialCharactersMathematical"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Mathematical",[{character:"<",title:t("Less-than sign")},{character:">",title:t("Greater-than sign")},{character:"≤",title:t("Less-than or equal to")},{character:"≥",title:t("Greater-than or equal to")},{character:"–",title:t("En dash")},{character:"—",title:t("Em dash")},{character:"¯",title:t("Macron")},{character:"‾",title:t("Overline")},{character:"°",title:t("Degree sign")},{character:"−",title:t("Minus sign")},{character:"±",title:t("Plus-minus sign")},{character:"÷",title:t("Division sign")},{character:"⁄",title:t("Fraction slash")},{character:"×",title:t("Multiplication sign")},{character:"ƒ",title:t("Latin small letter f with hook")},{character:"∫",title:t("Integral")},{character:"∑",title:t("N-ary summation")},{character:"∞",title:t("Infinity")},{character:"√",title:t("Square root")},{character:"∼",title:t("Tilde operator")},{character:"≅",title:t("Approximately equal to")},{character:"≈",title:t("Almost equal to")},{character:"≠",title:t("Not equal to")},{character:"≡",title:t("Identical to")},{character:"∈",title:t("Element of")},{character:"∉",title:t("Not an element of")},{character:"∋",title:t("Contains as member")},{character:"∏",title:t("N-ary product")},{character:"∧",title:t("Logical and")},{character:"∨",title:t("Logical or")},{character:"¬",title:t("Not sign")},{character:"∩",title:t("Intersection")},{character:"∪",title:t("Union")},{character:"∂",title:t("Partial differential")},{character:"∀",title:t("For all")},{character:"∃",title:t("There exists")},{character:"∅",title:t("Empty set")},{character:"∇",title:t("Nabla")},{character:"∗",title:t("Asterisk operator")},{character:"∝",title:t("Proportional to")},{character:"∠",title:t("Angle")},{character:"¼",title:t("Vulgar fraction one quarter")},{character:"½",title:t("Vulgar fraction one half")},{character:"¾",title:t("Vulgar fraction three quarters")}],{label:t("Mathematical")})}}class aL extends cf{static get pluginName(){return"SpecialCharactersLatin"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Latin",[{character:"Ā",title:t("Latin capital letter a with macron")},{character:"ā",title:t("Latin small letter a with macron")},{character:"Ă",title:t("Latin capital letter a with breve")},{character:"ă",title:t("Latin small letter a with breve")},{character:"Ą",title:t("Latin capital letter a with ogonek")},{character:"ą",title:t("Latin small letter a with ogonek")},{character:"Ć",title:t("Latin capital letter c with acute")},{character:"ć",title:t("Latin small letter c with acute")},{character:"Ĉ",title:t("Latin capital letter c with circumflex")},{character:"ĉ",title:t("Latin small letter c with circumflex")},{character:"Ċ",title:t("Latin capital letter c with dot above")},{character:"ċ",title:t("Latin small letter c with dot above")},{character:"Č",title:t("Latin capital letter c with caron")},{character:"č",title:t("Latin small letter c with caron")},{character:"Ď",title:t("Latin capital letter d with caron")},{character:"ď",title:t("Latin small letter d with caron")},{character:"Đ",title:t("Latin capital letter d with stroke")},{character:"đ",title:t("Latin small letter d with stroke")},{character:"Ē",title:t("Latin capital letter e with macron")},{character:"ē",title:t("Latin small letter e with macron")},{character:"Ĕ",title:t("Latin capital letter e with breve")},{character:"ĕ",title:t("Latin small letter e with breve")},{character:"Ė",title:t("Latin capital letter e with dot above")},{character:"ė",title:t("Latin small letter e with dot above")},{character:"Ę",title:t("Latin capital letter e with ogonek")},{character:"ę",title:t("Latin small letter e with ogonek")},{character:"Ě",title:t("Latin capital letter e with caron")},{character:"ě",title:t("Latin small letter e with caron")},{character:"Ĝ",title:t("Latin capital letter g with circumflex")},{character:"ĝ",title:t("Latin small letter g with circumflex")},{character:"Ğ",title:t("Latin capital letter g with breve")},{character:"ğ",title:t("Latin small letter g with breve")},{character:"Ġ",title:t("Latin capital letter g with dot above")},{character:"ġ",title:t("Latin small letter g with dot above")},{character:"Ģ",title:t("Latin capital letter g with cedilla")},{character:"ģ",title:t("Latin small letter g with cedilla")},{character:"Ĥ",title:t("Latin capital letter h with circumflex")},{character:"ĥ",title:t("Latin small letter h with circumflex")},{character:"Ħ",title:t("Latin capital letter h with stroke")},{character:"ħ",title:t("Latin small letter h with stroke")},{character:"Ĩ",title:t("Latin capital letter i with tilde")},{character:"ĩ",title:t("Latin small letter i with tilde")},{character:"Ī",title:t("Latin capital letter i with macron")},{character:"ī",title:t("Latin small letter i with macron")},{character:"Ĭ",title:t("Latin capital letter i with breve")},{character:"ĭ",title:t("Latin small letter i with breve")},{character:"Į",title:t("Latin capital letter i with ogonek")},{character:"į",title:t("Latin small letter i with ogonek")},{character:"İ",title:t("Latin capital letter i with dot above")},{character:"ı",title:t("Latin small letter dotless i")},{character:"IJ",title:t("Latin capital ligature ij")},{character:"ij",title:t("Latin small ligature ij")},{character:"Ĵ",title:t("Latin capital letter j with circumflex")},{character:"ĵ",title:t("Latin small letter j with circumflex")},{character:"Ķ",title:t("Latin capital letter k with cedilla")},{character:"ķ",title:t("Latin small letter k with cedilla")},{character:"ĸ",title:t("Latin small letter kra")},{character:"Ĺ",title:t("Latin capital letter l with acute")},{character:"ĺ",title:t("Latin small letter l with acute")},{character:"Ļ",title:t("Latin capital letter l with cedilla")},{character:"ļ",title:t("Latin small letter l with cedilla")},{character:"Ľ",title:t("Latin capital letter l with caron")},{character:"ľ",title:t("Latin small letter l with caron")},{character:"Ŀ",title:t("Latin capital letter l with middle dot")},{character:"ŀ",title:t("Latin small letter l with middle dot")},{character:"Ł",title:t("Latin capital letter l with stroke")},{character:"ł",title:t("Latin small letter l with stroke")},{character:"Ń",title:t("Latin capital letter n with acute")},{character:"ń",title:t("Latin small letter n with acute")},{character:"Ņ",title:t("Latin capital letter n with cedilla")},{character:"ņ",title:t("Latin small letter n with cedilla")},{character:"Ň",title:t("Latin capital letter n with caron")},{character:"ň",title:t("Latin small letter n with caron")},{character:"ʼn",title:t("Latin small letter n preceded by apostrophe")},{character:"Ŋ",title:t("Latin capital letter eng")},{character:"ŋ",title:t("Latin small letter eng")},{character:"Ō",title:t("Latin capital letter o with macron")},{character:"ō",title:t("Latin small letter o with macron")},{character:"Ŏ",title:t("Latin capital letter o with breve")},{character:"ŏ",title:t("Latin small letter o with breve")},{character:"Ő",title:t("Latin capital letter o with double acute")},{character:"ő",title:t("Latin small letter o with double acute")},{character:"Œ",title:t("Latin capital ligature oe")},{character:"œ",title:t("Latin small ligature oe")},{character:"Ŕ",title:t("Latin capital letter r with acute")},{character:"ŕ",title:t("Latin small letter r with acute")},{character:"Ŗ",title:t("Latin capital letter r with cedilla")},{character:"ŗ",title:t("Latin small letter r with cedilla")},{character:"Ř",title:t("Latin capital letter r with caron")},{character:"ř",title:t("Latin small letter r with caron")},{character:"Ś",title:t("Latin capital letter s with acute")},{character:"ś",title:t("Latin small letter s with acute")},{character:"Ŝ",title:t("Latin capital letter s with circumflex")},{character:"ŝ",title:t("Latin small letter s with circumflex")},{character:"Ş",title:t("Latin capital letter s with cedilla")},{character:"ş",title:t("Latin small letter s with cedilla")},{character:"Š",title:t("Latin capital letter s with caron")},{character:"š",title:t("Latin small letter s with caron")},{character:"Ţ",title:t("Latin capital letter t with cedilla")},{character:"ţ",title:t("Latin small letter t with cedilla")},{character:"Ť",title:t("Latin capital letter t with caron")},{character:"ť",title:t("Latin small letter t with caron")},{character:"Ŧ",title:t("Latin capital letter t with stroke")},{character:"ŧ",title:t("Latin small letter t with stroke")},{character:"Ũ",title:t("Latin capital letter u with tilde")},{character:"ũ",title:t("Latin small letter u with tilde")},{character:"Ū",title:t("Latin capital letter u with macron")},{character:"ū",title:t("Latin small letter u with macron")},{character:"Ŭ",title:t("Latin capital letter u with breve")},{character:"ŭ",title:t("Latin small letter u with breve")},{character:"Ů",title:t("Latin capital letter u with ring above")},{character:"ů",title:t("Latin small letter u with ring above")},{character:"Ű",title:t("Latin capital letter u with double acute")},{character:"ű",title:t("Latin small letter u with double acute")},{character:"Ų",title:t("Latin capital letter u with ogonek")},{character:"ų",title:t("Latin small letter u with ogonek")},{character:"Ŵ",title:t("Latin capital letter w with circumflex")},{character:"ŵ",title:t("Latin small letter w with circumflex")},{character:"Ŷ",title:t("Latin capital letter y with circumflex")},{character:"ŷ",title:t("Latin small letter y with circumflex")},{character:"Ÿ",title:t("Latin capital letter y with diaeresis")},{character:"Ź",title:t("Latin capital letter z with acute")},{character:"ź",title:t("Latin small letter z with acute")},{character:"Ż",title:t("Latin capital letter z with dot above")},{character:"ż",title:t("Latin small letter z with dot above")},{character:"Ž",title:t("Latin capital letter z with caron")},{character:"ž",title:t("Latin small letter z with caron")},{character:"ſ",title:t("Latin small letter long s")}],{label:t("Latin")})}}class lL extends cf{static get pluginName(){return"SpecialCharactersCurrency"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Currency",[{character:"$",title:t("Dollar sign")},{character:"€",title:t("Euro sign")},{character:"¥",title:t("Yen sign")},{character:"£",title:t("Pound sign")},{character:"¢",title:t("Cent sign")},{character:"₠",title:t("Euro-currency sign")},{character:"₡",title:t("Colon sign")},{character:"₢",title:t("Cruzeiro sign")},{character:"₣",title:t("French franc sign")},{character:"₤",title:t("Lira sign")},{character:"¤",title:t("Currency sign")},{character:"₿",title:t("Bitcoin sign")},{character:"₥",title:t("Mill sign")},{character:"₦",title:t("Naira sign")},{character:"₧",title:t("Peseta sign")},{character:"₨",title:t("Rupee sign")},{character:"₩",title:t("Won sign")},{character:"₪",title:t("New sheqel sign")},{character:"₫",title:t("Dong sign")},{character:"₭",title:t("Kip sign")},{character:"₮",title:t("Tugrik sign")},{character:"₯",title:t("Drachma sign")},{character:"₰",title:t("German penny sign")},{character:"₱",title:t("Peso sign")},{character:"₲",title:t("Guarani sign")},{character:"₳",title:t("Austral sign")},{character:"₴",title:t("Hryvnia sign")},{character:"₵",title:t("Cedi sign")},{character:"₶",title:t("Livre tournois sign")},{character:"₷",title:t("Spesmilo sign")},{character:"₸",title:t("Tenge sign")},{character:"₹",title:t("Indian rupee sign")},{character:"₺",title:t("Turkish lira sign")},{character:"₻",title:t("Nordic mark sign")},{character:"₼",title:t("Manat sign")},{character:"₽",title:t("Ruble sign")}],{label:t("Currency")})}}class cL extends cf{static get pluginName(){return"SpecialCharactersEssentials"}static get isOfficialPlugin(){return!0}static get requires(){return[lL,sL,oL,rL,aL]}}class dL extends jb{styleDefinition;previewView;constructor(e,t){super(e),this.styleDefinition=t,this.previewView=this._createPreview(),this.set({label:t.name,class:"ck-style-grid__button",withText:!0}),this.extendTemplate({attributes:{role:"option"}}),this.children.add(this.previewView,0)}_createPreview(){const e=new Lb(this.locale);return e.setTemplate({tag:"div",attributes:{class:["ck","ck-reset_all-excluded","ck-style-grid__button__preview","ck-content"],"aria-hidden":"true"},children:[this.styleDefinition.previewTemplate]}),e}}class uL extends Lb{focusTracker;keystrokes;children;constructor(e,t){super(e),this.focusTracker=new lc,this.keystrokes=new hc,this.set("activeStyles",[]),this.set("enabledStyles",[]),this.children=this.createCollection(),this.children.delegate("execute").to(this);for(const n of t){const t=new dL(e,n);this.children.add(t)}this.on("change:activeStyles",(()=>{for(const e of this.children)e.isOn=this.activeStyles.includes(e.styleDefinition.name)})),this.on("change:enabledStyles",(()=>{for(const e of this.children)e.isEnabled=this.enabledStyles.includes(e.styleDefinition.name)})),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-grid"],role:"listbox"},children:this.children})}render(){super.render();for(const e of this.children)this.focusTracker.add(e.element);Db({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.children,numberOfColumns:3,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection}),this.keystrokes.listenTo(this.element)}focus(){this.children.first.focus()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}}class hL extends Lb{gridView;labelView;constructor(e,t,n){super(e),this.labelView=new ow(e),this.labelView.text=t,this.gridView=new uL(e,n),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel__style-group"],role:"group","aria-labelledby":this.labelView.id},children:[this.labelView,this.gridView]})}}class mL extends Lb{focusTracker;keystrokes;children;blockStylesGroupView;inlineStylesGroupView;_focusables;_focusCycler;constructor(e,t){super(e);const n=e.t;this.focusTracker=new lc,this.keystrokes=new hc,this.children=this.createCollection(),this.blockStylesGroupView=new hL(e,n("Block styles"),t.block),this.inlineStylesGroupView=new hL(e,n("Text styles"),t.inline),this.set("activeStyles",[]),this.set("enabledStyles",[]),this._focusables=new mb,this._focusCycler=new Ub({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:["shift + tab"],focusNext:["tab"]}}),t.block.length&&this.children.add(this.blockStylesGroupView),t.inline.length&&this.children.add(this.inlineStylesGroupView),this.blockStylesGroupView.gridView.delegate("execute").to(this),this.inlineStylesGroupView.gridView.delegate("execute").to(this),this.blockStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this,"activeStyles","enabledStyles"),this.inlineStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this,"activeStyles","enabledStyles"),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel"]},children:this.children})}render(){super.render(),this._focusables.add(this.blockStylesGroupView.gridView),this._focusables.add(this.inlineStylesGroupView.gridView),this.focusTracker.add(this.blockStylesGroupView.gridView.element),this.focusTracker.add(this.inlineStylesGroupView.gridView.element),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}const gL=["caption","colgroup","dd","dt","figcaption","legend","li","optgroup","option","rp","rt","summary","tbody","td","tfoot","th","thead","tr"];class pL extends cf{_htmlSupport;static get pluginName(){return"StyleUtils"}static get isOfficialPlugin(){return!0}constructor(e){super(e),this.decorate("isStyleEnabledForBlock"),this.decorate("isStyleActiveForBlock"),this.decorate("getAffectedBlocks"),this.decorate("isStyleEnabledForInlineSelection"),this.decorate("isStyleActiveForInlineSelection"),this.decorate("getAffectedInlineSelectable"),this.decorate("getStylePreview"),this.decorate("configureGHSDataFilter")}init(){this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport")}normalizeConfig(e,t=[]){const n={block:[],inline:[]};for(const i of t){const t=[],r=[];for(const n of e.getDefinitionsForView(i.element)){const e="appliesToBlock"in n&&n.appliesToBlock;if(n.isBlock||e){if("string"==typeof e)t.push(e);else if(n.isBlock){const e=n;t.push(n.model),e.paragraphLikeModel&&t.push(e.paragraphLikeModel)}}else r.push(n.model)}const s=this.getStylePreview(i,[{text:"AaBbCcDdEeFfGgHhIiJj"}]);t.length?n.block.push({...i,previewTemplate:s,modelElements:t,isBlock:!0}):n.inline.push({...i,previewTemplate:s,ghsAttributes:r})}return n}isStyleEnabledForBlock(e,t){const n=this.editor.model,i=this._htmlSupport.getGhsAttributeNameForElement(e.element);return!!n.schema.checkAttribute(t,i)&&e.modelElements.includes(t.name)}isStyleActiveForBlock(e,t){const n=this._htmlSupport.getGhsAttributeNameForElement(e.element),i=t.getAttribute(n);return this.hasAllClasses(i,e.classes)}getAffectedBlocks(e,t){return e.modelElements.includes(t.name)?[t]:null}isStyleEnabledForInlineSelection(e,t){const n=this.editor.model;for(const i of e.ghsAttributes)if(n.schema.checkAttributeInSelection(t,i))return!0;return!1}isStyleActiveForInlineSelection(e,t){for(const n of e.ghsAttributes){const i=this._getValueFromFirstAllowedNode(t,n);if(this.hasAllClasses(i,e.classes))return!0}return!1}getAffectedInlineSelectable(e,t){return t}getStylePreview(e,t){const{element:n,classes:i}=e;return{tag:(r=n,gL.includes(r)?"div":n),attributes:{class:i},children:t};var r}hasAllClasses(e,t){return or(e)&&(n=e,Boolean(n.classes)&&Array.isArray(n.classes))&&t.every((t=>e.classes.includes(t)));var n}configureGHSDataFilter({block:e,inline:t}){const n=this.editor.plugins.get("DataFilter");n.loadAllowedConfig(e.map(fL)),n.loadAllowedConfig(t.map(fL))}_getValueFromFirstAllowedNode(e,t){const n=this.editor.model.schema;if(e.isCollapsed)return e.getAttribute(t);for(const i of e.getRanges())for(const e of i.getItems())if(n.checkAttribute(e,t))return e.getAttribute(t);return null}}function fL({element:e,classes:t}){return{name:e,classes:t}}class bL extends cf{static get pluginName(){return"StyleUI"}static get isOfficialPlugin(){return!0}static get requires(){return[pL]}init(){const e=this.editor,t=e.plugins.get("DataSchema"),n=e.plugins.get("StyleUtils"),i=e.config.get("style.definitions"),r=n.normalizeConfig(t,i);e.ui.componentFactory.add("style",(t=>{const n=t.t,i=Yw(t),s=e.commands.get("style");return i.once("change:isOpen",(()=>{const e=new mL(t,r);i.panelView.children.add(e),e.delegate("execute").to(i),e.bind("activeStyles").to(s,"value"),e.bind("enabledStyles").to(s,"enabledStyles")})),i.bind("isEnabled").to(s),i.buttonView.withText=!0,i.buttonView.bind("label").to(s,"value",(e=>e.length>1?n("Multiple styles"):1===e.length?e[0]:n("Styles"))),i.bind("class").to(s,"value",(e=>{const t=["ck-style-dropdown"];return e.length>1&&t.push("ck-style-dropdown_multiple-active"),t.join(" ")})),i.on("execute",(t=>{e.execute("style",{styleName:t.source.styleDefinition.name}),e.editing.view.focus()})),i}))}}class wL extends uf{_styleDefinitions;_styleUtils;constructor(e,t){super(e),this.set("value",[]),this.set("enabledStyles",[]),this._styleDefinitions=t,this._styleUtils=this.editor.plugins.get(pL)}refresh(){const e=this.editor.model,t=e.document.selection,n=new Set,i=new Set;for(const e of this._styleDefinitions.inline)this._styleUtils.isStyleEnabledForInlineSelection(e,t)&&i.add(e.name),this._styleUtils.isStyleActiveForInlineSelection(e,t)&&n.add(e.name);const r=ac(t.getSelectedBlocks())||t.getFirstPosition().parent;if(r){const t=r.getAncestors({includeSelf:!0,parentFirst:!0});for(const r of t){if(r.is("rootElement"))break;for(const e of this._styleDefinitions.block)this._styleUtils.isStyleEnabledForBlock(e,r)&&(i.add(e.name),this._styleUtils.isStyleActiveForBlock(e,r)&&n.add(e.name));if(e.schema.isObject(r))break}}this.enabledStyles=Array.from(i).sort(),this.isEnabled=this.enabledStyles.length>0,this.value=this.isEnabled?Array.from(n).sort():[]}execute({styleName:e,forceValue:t}){if(!this.enabledStyles.includes(e))return void Ea("style-command-executed-with-incorrect-style-name");const n=this.editor.model,i=n.document.selection,r=this.editor.plugins.get("GeneralHtmlSupport"),s=[...this._styleDefinitions.inline,...this._styleDefinitions.block],o=s.filter((({name:e})=>this.value.includes(e))),a=s.find((({name:t})=>t==e)),l=void 0===t?!this.value.includes(a.name):t;n.change((()=>{let e;e=function(e){return"isBlock"in e}(a)?this._findAffectedBlocks(function(e){const t=Array.from(e.getSelectedBlocks());return t.length?t:[e.getFirstPosition().parent]}(i),a):[this._styleUtils.getAffectedInlineSelectable(a,i)];for(const t of e)l?r.addModelHtmlClass(a.element,a.classes,t):r.removeModelHtmlClass(a.element,vL(o,a),t)}))}_findAffectedBlocks(e,t){const n=new Set;for(const i of e){const e=i.getAncestors({includeSelf:!0,parentFirst:!0});for(const i of e){if(i.is("rootElement"))break;const e=this._styleUtils.getAffectedBlocks(t,i);if(e){for(const t of e)n.add(t);break}}}return n}}function vL(e,t){return e.reduce(((e,n)=>n.name===t.name?e:e.filter((e=>!n.classes.includes(e)))),t.classes)}class yL extends cf{_listUtils;_styleUtils;_htmlSupport;static get pluginName(){return"ListStyleSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[pL,"GeneralHtmlSupport"]}init(){const e=this.editor;e.plugins.has("ListEditing")&&(this._styleUtils=e.plugins.get(pL),this._listUtils=this.editor.plugins.get("ListUtils"),this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",((e,[t,n])=>{this._isStyleEnabledForBlock(t,n)&&(e.return=!0,e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForBlock",((e,[t,n])=>{this._isStyleActiveForBlock(t,n)&&(e.return=!0,e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",((e,[t,n])=>{const i=this._getAffectedBlocks(t,n);i&&(e.return=i,e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"getStylePreview",((e,[t,n])=>{const i=this._getStylePreview(t,n);i&&(e.return=i,e.stop())}),{priority:"high"}))}_isStyleEnabledForBlock(e,t){const n=this.editor.model;if(!["ol","ul","li"].includes(e.element))return!1;if(!this._listUtils.isListItemBlock(t))return!1;const i=this._htmlSupport.getGhsAttributeNameForElement(e.element);if("ol"==e.element||"ul"==e.element){if(!n.schema.checkAttribute(t,i))return!1;const r=this._listUtils.isNumberedListType(t.getAttribute("listType"))?"ol":"ul";return e.element==r}return n.schema.checkAttribute(t,i)}_isStyleActiveForBlock(e,t){const n=this._htmlSupport.getGhsAttributeNameForElement(e.element),i=t.getAttribute(n);return this._styleUtils.hasAllClasses(i,e.classes)}_getAffectedBlocks(e,t){return this._isStyleEnabledForBlock(e,t)?"li"==e.element?this._listUtils.expandListBlocksToCompleteItems(t,{withNested:!1}):this._listUtils.expandListBlocksToCompleteList(t):null}_getStylePreview(e,t){const{element:n,classes:i}=e;return"ol"==n||"ul"==n?{tag:n,attributes:{class:i},children:[{tag:"li",children:t}]}:"li"==n?{tag:"ol",children:[{tag:n,attributes:{class:i},children:t}]}:null}}class _L extends cf{_tableUtils;_styleUtils;static get pluginName(){return"TableStyleSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[pL]}init(){const e=this.editor;e.plugins.has("TableEditing")&&(this._styleUtils=e.plugins.get(pL),this._tableUtils=this.editor.plugins.get("TableUtils"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",((e,[t,n])=>{this._isApplicable(t,n)&&(e.return=this._isStyleEnabledForBlock(t,n),e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",((e,[t,n])=>{this._isApplicable(t,n)&&(e.return=this._getAffectedBlocks(t,n),e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"configureGHSDataFilter",((e,[{block:t}])=>{this.editor.plugins.get("DataFilter").loadAllowedConfig(t.filter((e=>"figcaption"==e.element)).map((e=>({name:"caption",classes:e.classes}))))})))}_isApplicable(e,t){return["td","th"].includes(e.element)?"tableCell"==t.name:!!["thead","tbody"].includes(e.element)&&"table"==t.name}_isStyleEnabledForBlock(e,t){if(["td","th"].includes(e.element)){const n=this._tableUtils.getCellLocation(t),i=t.parent.parent,r=i.getAttribute("headingRows")||0,s=i.getAttribute("headingColumns")||0,o=n.row<r||n.column<s;return"th"==e.element?o:!o}if(["thead","tbody"].includes(e.element)){const n=t.getAttribute("headingRows")||0;return"thead"==e.element?n>0:n<this._tableUtils.getRows(t)}return!1}_getAffectedBlocks(e,t){return this._isStyleEnabledForBlock(e,t)?[t]:null}}class kL extends cf{_styleUtils;_htmlSupport;static get pluginName(){return"LinkStyleSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[pL,"GeneralHtmlSupport"]}init(){const e=this.editor;e.plugins.has("LinkEditing")&&(this._styleUtils=e.plugins.get(pL),this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport"),this.listenTo(this._styleUtils,"isStyleEnabledForInlineSelection",((e,[t,n])=>{"a"==t.element&&(e.return=this._isStyleEnabled(t,n),e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForInlineSelection",((e,[t,n])=>{"a"==t.element&&(e.return=this._isStyleActive(t,n),e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedInlineSelectable",((e,[t,n])=>{if("a"!=t.element)return;const i=this._getAffectedSelectable(t,n);i&&(e.return=i,e.stop())}),{priority:"high"}))}_isStyleEnabled(e,t){const n=this.editor.model;if(t.isCollapsed)return t.hasAttribute("linkHref");for(const e of t.getRanges())for(const t of e.getItems())if((t.is("$textProxy")||n.schema.isInline(t))&&t.hasAttribute("linkHref"))return!0;return!1}_isStyleActive(e,t){const n=this.editor.model,i=this._htmlSupport.getGhsAttributeNameForElement(e.element);if(t.isCollapsed){if(t.hasAttribute("linkHref")){const n=t.getAttribute(i);if(this._styleUtils.hasAllClasses(n,e.classes))return!0}return!1}for(const r of t.getRanges())for(const t of r.getItems())if((t.is("$textProxy")||n.schema.isInline(t))&&t.hasAttribute("linkHref")){const n=t.getAttribute(i);return this._styleUtils.hasAllClasses(n,e.classes)}return!1}_getAffectedSelectable(e,t){const n=this.editor.model;if(t.isCollapsed){const e=t.getAttribute("linkHref");return l_(t.getFirstPosition(),"linkHref",e,n)}const i=[];for(const e of t.getRanges()){const t=n.createRange(xL(e.start,"linkHref",!0,n),xL(e.end,"linkHref",!1,n));for(const e of t.getItems())(e.is("$textProxy")||n.schema.isInline(e))&&e.hasAttribute("linkHref")&&i.push(this.editor.model.createRangeOn(e))}return function(e){for(let t=1;t<e.length;t++){const n=e[t-1].getJoined(e[t]);n&&e.splice(--t,2,n)}return e}(i)}}function xL(e,t,n,i){const r=e.textNode||(n?e.nodeAfter:e.nodeBefore);return r&&r.hasAttribute(t)?c_(e,t,r.getAttribute(t),n,i):e}class CL extends cf{static get pluginName(){return"StyleEditing"}static get isOfficialPlugin(){return!0}static get requires(){return["GeneralHtmlSupport",pL,yL,_L,kL]}init(){const e=this.editor,t=e.plugins.get("DataSchema"),n=e.plugins.get("StyleUtils"),i=e.config.get("style.definitions"),r=n.normalizeConfig(t,i);e.commands.add("style",new wL(e,r)),n.configureGHSDataFilter(r)}}class AL extends cf{static get pluginName(){return"Style"}static get isOfficialPlugin(){return!0}static get requires(){return[CL,bL]}}function EL(e,t){const{modelAttribute:n,styleName:i,viewElement:r,defaultValue:s,reduceBoxSides:o=!1,shouldUpcast:a=()=>!0}=t;e.for("upcast").attributeToAttribute({view:{name:r,styles:{[i]:/[\s\S]+/}},model:{key:n,value:e=>{if(!a(e))return;const t=e.getNormalizedStyle(i),n=o?IL(t):t;return s!==n?n:void 0}}})}function TL(e,t,n,i){e.for("upcast").add((e=>e.on("element:"+t,((e,t,r)=>{if(!t.modelRange)return;const s=["border-top-width","border-top-color","border-top-style","border-bottom-width","border-bottom-color","border-bottom-style","border-right-width","border-right-color","border-right-style","border-left-width","border-left-color","border-left-style"].filter((e=>t.viewItem.hasStyle(e)));if(!s.length)return;const o={styles:s};if(!r.consumable.test(t.viewItem,o))return;const a=[...t.modelRange.getItems({shallow:!0})].pop();r.consumable.consume(t.viewItem,o);const l={style:t.viewItem.getNormalizedStyle("border-style"),color:t.viewItem.getNormalizedStyle("border-color"),width:t.viewItem.getNormalizedStyle("border-width")},c={style:IL(l.style),color:IL(l.color),width:IL(l.width)};c.style!==i.style&&r.writer.setAttribute(n.style,c.style,a),c.color!==i.color&&r.writer.setAttribute(n.color,c.color,a),c.width!==i.width&&r.writer.setAttribute(n.width,c.width,a)}))))}function SL(e,t){const{modelElement:n,modelAttribute:i,styleName:r}=t;e.for("downcast").attributeToAttribute({model:{name:n,key:i},view:e=>({key:"style",value:{[r]:e}})})}function PL(e,t){const{modelAttribute:n,styleName:i}=t;e.for("downcast").add((e=>e.on(`attribute:${n}:table`,((e,t,n)=>{const{item:r,attributeNewValue:s}=t,{mapper:o,writer:a}=n;if(!n.consumable.consume(t.item,e.name))return;const l=[...o.toViewElement(r).getChildren()].find((e=>e.is("element","table")));s?a.setStyle(i,s,l):a.removeStyle(i,l)}))))}function IL(e){if(!e)return;const t=["top","right","bottom","left"];if(!t.every((t=>e[t])))return e;const n=e.top;return t.every((t=>e[t]===n))?n:e}function OL(e,t,n,i,r=1){null!=t&&null!=r&&t>r?i.setAttribute(e,t,n):i.removeAttribute(e,n)}function VL(e,t,n={}){const i=e.createElement("tableCell",n);return e.insertElement("paragraph",i),e.insert(i,t),i}function RL(e,t){const n=t.parent.parent,i=parseInt(n.getAttribute("headingColumns")||"0"),{column:r}=e.getCellLocation(t);return!!i&&r<i}function NL(e,t,n){const{modelAttribute:i}=n;e.extend("tableCell",{allowAttributes:[i]}),EL(t,{viewElement:/^(td|th)$/,...n}),SL(t,{modelElement:"tableCell",...n})}function LL(e){const t=e.getSelectedElement();return t&&t.is("element","table")?t:e.getFirstPosition().findAncestor("table")}function ML(e){return t=>{t.on(`element:${e}`,((e,t,{writer:n})=>{if(!t.modelRange)return;const i=t.modelRange.start.nodeAfter,r=n.createPositionAt(i,0);if(t.viewItem.isEmpty)return void n.insertElement("paragraph",r);const s=Array.from(i.getChildren());if(s.every((e=>e.is("element","$marker")))){const e=n.createElement("paragraph");n.insert(e,n.createPositionAt(i,0));for(const t of s)n.move(n.createRangeOn(t),n.createPositionAt(e,"end"))}}),{priority:"low"})}}function BL(e){let t=0,n=0;const i=Array.from(e.getChildren()).filter((e=>"th"===e.name||"td"===e.name));for(;n<i.length&&"th"===i[n].name;){const e=i[n];t+=parseInt(e.getAttribute("colspan")||"1"),n++}return t}class FL{_table;_startRow;_endRow;_startColumn;_endColumn;_includeAllSlots;_skipRows;_row;_rowIndex;_column;_cellIndex;_spannedCells;_nextCellAtColumn;_jumpedToStartRow=!1;constructor(e,t={}){this._table=e,this._startRow=void 0!==t.row?t.row:t.startRow||0,this._endRow=void 0!==t.row?t.row:t.endRow,this._startColumn=void 0!==t.column?t.column:t.startColumn||0,this._endColumn=void 0!==t.column?t.column:t.endColumn,this._includeAllSlots=!!t.includeAllSlots,this._skipRows=new Set,this._row=0,this._rowIndex=0,this._column=0,this._cellIndex=0,this._spannedCells=new Map,this._nextCellAtColumn=-1}[Symbol.iterator](){return this}next(){this._canJumpToStartRow()&&this._jumpToNonSpannedRowClosestToStartRow();const e=this._table.getChild(this._rowIndex);if(!e||this._isOverEndRow())return{done:!0,value:void 0};if(!e.is("element","tableRow"))return this._rowIndex++,this.next();if(this._isOverEndColumn())return this._advanceToNextRow();let t=null;const n=this._getSpanned();if(n)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(n.cell,n.row,n.column));else{const n=e.getChild(this._cellIndex);if(!n)return this._advanceToNextRow();const i=parseInt(n.getAttribute("colspan")||"1"),r=parseInt(n.getAttribute("rowspan")||"1");(i>1||r>1)&&this._recordSpans(n,r,i),this._shouldSkipSlot()||(t=this._formatOutValue(n)),this._nextCellAtColumn=this._column+i}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,t||this.next()}skipRow(e){this._skipRows.add(e)}_advanceToNextRow(){return this._row++,this._rowIndex++,this._column=0,this._cellIndex=0,this._nextCellAtColumn=-1,this.next()}_isOverEndRow(){return void 0!==this._endRow&&this._row>this._endRow}_isOverEndColumn(){return void 0!==this._endColumn&&this._column>this._endColumn}_formatOutValue(e,t=this._row,n=this._column){return{done:!1,value:new DL(this,e,t,n)}}_shouldSkipSlot(){const e=this._skipRows.has(this._row),t=this._row<this._startRow,n=this._column<this._startColumn,i=void 0!==this._endColumn&&this._column>this._endColumn;return e||t||n||i}_getSpanned(){const e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,n){const i={cell:e,row:this._row,column:this._column};for(let e=this._row;e<this._row+t;e++)for(let t=this._column;t<this._column+n;t++)e==this._row&&t==this._column||this._markSpannedCell(e,t,i)}_markSpannedCell(e,t,n){this._spannedCells.has(e)||this._spannedCells.set(e,new Map),this._spannedCells.get(e).set(t,n)}_canJumpToStartRow(){return!!this._startRow&&this._startRow>0&&!this._jumpedToStartRow}_jumpToNonSpannedRowClosestToStartRow(){const e=this._getRowLength(0);for(let t=this._startRow;!this._jumpedToStartRow;t--)e===this._getRowLength(t)&&(this._row=t,this._rowIndex=t,this._jumpedToStartRow=!0)}_getRowLength(e){return[...this._table.getChild(e).getChildren()].reduce(((e,t)=>e+parseInt(t.getAttribute("colspan")||"1")),0)}}class DL{cell;row;column;cellAnchorRow;cellAnchorColumn;_cellIndex;_rowIndex;_table;constructor(e,t,n,i){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=n,this.cellAnchorColumn=i,this._cellIndex=e._cellIndex,this._rowIndex=e._rowIndex,this._table=e._table}get isAnchor(){return this.row===this.cellAnchorRow&&this.column===this.cellAnchorColumn}get cellWidth(){return parseInt(this.cell.getAttribute("colspan")||"1")}get cellHeight(){return parseInt(this.cell.getAttribute("rowspan")||"1")}get rowIndex(){return this._rowIndex}getPositionBefore(){return this._table.root.document.model.createPositionAt(this._table.getChild(this.row),this._cellIndex)}}function zL(e,t){return(n,{writer:i})=>{const r=n.getAttribute("headingRows")||0,s=i.createContainerElement("table",null,[]),o=i.createContainerElement("figure",{class:"table"},s);r>0&&i.insert(i.createPositionAt(s,"end"),i.createContainerElement("thead",null,i.createSlot((e=>e.is("element","tableRow")&&e.index<r)))),r<e.getRows(n)&&i.insert(i.createPositionAt(s,"end"),i.createContainerElement("tbody",null,i.createSlot((e=>e.is("element","tableRow")&&e.index>=r))));for(const{positionOffset:e,filter:n}of t.additionalSlots)i.insert(i.createPositionAt(s,e),i.createSlot(n));return i.insert(i.createPositionAt(s,"after"),i.createSlot((e=>!e.is("element","tableRow")&&!t.additionalSlots.some((({filter:t})=>t(e)))))),t.asWidget?function(e,t){return t.setCustomProperty("table",!0,e),kk(e,t,{hasSelectionHandle:!0})}(o,i):o}}function $L(e={}){return(t,{writer:n})=>{const i=t.parent,r=i.parent,s=r.getChildIndex(i),o=new FL(r,{row:s}),a=r.getAttribute("headingRows")||0,l=r.getAttribute("headingColumns")||0;let c=null;for(const i of o)if(i.cell==t){const t=i.row<a||i.column<l?"th":"td";c=e.asWidget?Ek(n.createEditableElement(t),n):n.createContainerElement(t);break}return c}}function jL(e={}){return(t,{writer:n})=>{if(!t.parent.is("element","tableCell"))return null;if(!HL(t))return null;if(e.asWidget)return n.createContainerElement("span",{class:"ck-table-bogus-paragraph"});{const e=n.createContainerElement("p");return n.setCustomProperty("dataPipeline:transparentRendering",!0,e),e}}}function HL(e){return 1==e.parent.childCount&&!!e.getAttributeKeys().next().done}class WL extends uf{refresh(){const e=this.editor.model,t=e.document.selection,n=e.schema;this.isEnabled=function(e,t){const n=e.getFirstPosition().parent,i=n===n.root?n:n.parent;return t.checkChild(i,"table")}(t,n)}execute(e={}){const t=this.editor,n=t.model,i=t.plugins.get("TableUtils"),r=t.config.get("table.defaultHeadings.rows"),s=t.config.get("table.defaultHeadings.columns");void 0===e.headingRows&&r&&(e.headingRows=r),void 0===e.headingColumns&&s&&(e.headingColumns=s),n.change((t=>{const r=i.createTable(t,e);n.insertObject(r,null,null,{findOptimalPosition:"auto"}),t.setSelection(t.createPositionAt(r.getNodeByPath([0,0,0]),0))}))}}class UL extends uf{order;constructor(e,t={}){super(e),this.order=t.order||"below"}refresh(){const e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){const e=this.editor,t=e.model.document.selection,n=e.plugins.get("TableUtils"),i="above"===this.order,r=n.getSelectionAffectedTableCells(t),s=n.getRowIndexes(r),o=i?s.first:s.last,a=r[0].findAncestor("table");n.insertRows(a,{at:i?o:o+1,copyStructureFromAbove:!i})}}class qL extends uf{order;constructor(e,t={}){super(e),this.order=t.order||"right"}refresh(){const e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){const e=this.editor,t=e.model.document.selection,n=e.plugins.get("TableUtils"),i="left"===this.order,r=n.getSelectionAffectedTableCells(t),s=n.getColumnIndexes(r),o=i?s.first:s.last,a=r[0].findAncestor("table");n.insertColumns(a,{columns:1,at:i?o:o+1})}}class GL extends uf{direction;constructor(e,t={}){super(e),this.direction=t.direction||"horizontally"}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=1===e.length}execute(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection)[0];"horizontally"===this.direction?e.splitCellHorizontally(t,2):e.splitCellVertically(t,2)}}function KL(e,t,n){const{startRow:i,startColumn:r,endRow:s,endColumn:o}=t,a=n.createElement("table"),l=s-i+1;for(let e=0;e<l;e++)n.insertElement("tableRow",a,"end");const c=[...new FL(e,{startRow:i,endRow:s,startColumn:r,endColumn:o,includeAllSlots:!0})];for(const{row:e,column:t,cell:l,isAnchor:d,cellAnchorRow:u,cellAnchorColumn:h}of c){const c=e-i,m=a.getChild(c);if(d){const i=n.cloneElement(l);n.append(i,m),XL(i,e,t,s,o,n)}else(u<i||h<r)&&VL(n,n.createPositionAt(m,"end"))}return function(e,t,n,i,r){const s=parseInt(t.getAttribute("headingRows")||"0");s>0&&OL("headingRows",s-n,e,r,0);const o=parseInt(t.getAttribute("headingColumns")||"0");o>0&&OL("headingColumns",o-i,e,r,0)}(a,e,i,r,n),a}function ZL(e,t,n=0){const i=[],r=new FL(e,{startRow:n,endRow:t-1});for(const e of r){const{row:n,cellHeight:r}=e;n<t&&t<=n+r-1&&i.push(e)}return i}function QL(e,t,n){const i=e.parent,r=i.parent,s=i.index,o=t-s,a={},l=parseInt(e.getAttribute("rowspan"))-o;l>1&&(a.rowspan=l);const c=parseInt(e.getAttribute("colspan")||"1");c>1&&(a.colspan=c);const d=s+o,u=[...new FL(r,{startRow:s,endRow:d,includeAllSlots:!0})];let h,m=null;for(const t of u){const{row:i,column:r,cell:s}=t;s===e&&void 0===h&&(h=r),void 0!==h&&h===r&&i===d&&(m=VL(n,t.getPositionBefore(),a))}return OL("rowspan",o,e,n),m}function YL(e,t){const n=[],i=new FL(e);for(const e of i){const{column:i,cellWidth:r}=e;i<t&&t<=i+r-1&&n.push(e)}return n}function JL(e,t,n,i){const r=n-t,s={},o=parseInt(e.getAttribute("colspan"))-r;o>1&&(s.colspan=o);const a=parseInt(e.getAttribute("rowspan")||"1");a>1&&(s.rowspan=a);const l=VL(i,i.createPositionAfter(e),s);return OL("colspan",r,e,i),l}function XL(e,t,n,i,r,s){const o=parseInt(e.getAttribute("colspan")||"1"),a=parseInt(e.getAttribute("rowspan")||"1");n+o-1>r&&OL("colspan",r-n+1,e,s,1),t+a-1>i&&OL("rowspan",i-t+1,e,s,1)}function eM(e,t){const n=t.getColumns(e),i=new Array(n).fill(0);for(const{column:t}of new FL(e))i[t]++;const r=i.reduce(((e,t,n)=>t?e:[...e,n]),[]);if(r.length>0){const n=r[r.length-1];return t.removeColumns(e,{at:n}),!0}return!1}function tM(e,t){const n=[],i=t.getRows(e);for(let t=0;t<i;t++)e.getChild(t).isEmpty&&n.push(t);if(n.length>0){const i=n[n.length-1];return t.removeRows(e,{at:i}),!0}return!1}function nM(e,t){eM(e,t)||tM(e,t)}function iM(e,t){const n=Array.from(new FL(e,{startColumn:t.firstColumn,endColumn:t.lastColumn,row:t.lastRow}));if(n.every((({cellHeight:e})=>1===e)))return t.lastRow;const i=n[0].cellHeight-1;return t.lastRow+i}function rM(e,t){const n=Array.from(new FL(e,{startRow:t.firstRow,endRow:t.lastRow,column:t.lastColumn}));if(n.every((({cellWidth:e})=>1===e)))return t.lastColumn;const i=n[0].cellWidth-1;return t.lastColumn+i}class sM extends uf{direction;isHorizontal;constructor(e,t){super(e),this.direction=t.direction,this.isHorizontal="right"==this.direction||"left"==this.direction}refresh(){const e=this._getMergeableCell();this.value=e,this.isEnabled=!!e}execute(){const e=this.editor.model,t=e.document,n=this.editor.plugins.get("TableUtils").getTableCellsContainingSelection(t.selection)[0],i=this.value,r=this.direction;e.change((e=>{const t="right"==r||"down"==r,s=t?n:i,o=t?i:n,a=o.parent;!function(e,t,n){oM(e)||(oM(t)&&n.remove(n.createRangeIn(t)),n.move(n.createRangeIn(e),n.createPositionAt(t,"end"))),n.remove(e)}(o,s,e);const l=this.isHorizontal?"colspan":"rowspan",c=parseInt(n.getAttribute(l)||"1"),d=parseInt(i.getAttribute(l)||"1");e.setAttribute(l,c+d,s),e.setSelection(e.createRangeIn(s));const u=this.editor.plugins.get("TableUtils");nM(a.findAncestor("table"),u)}))}_getMergeableCell(){const e=this.editor.model.document,t=this.editor.plugins.get("TableUtils"),n=t.getTableCellsContainingSelection(e.selection)[0];if(!n)return;const i=this.isHorizontal?function(e,t,n){const i=e.parent.parent,r="right"==t?e.nextSibling:e.previousSibling,s=(i.getAttribute("headingColumns")||0)>0;if(!r)return;const o="right"==t?e:r,a="right"==t?r:e,{column:l}=n.getCellLocation(o),{column:c}=n.getCellLocation(a),d=parseInt(o.getAttribute("colspan")||"1"),u=RL(n,o),h=RL(n,a);return s&&u!=h?void 0:l+d===c?r:void 0}(n,this.direction,t):function(e,t,n){const i=e.parent,r=i.parent,s=r.getChildIndex(i);if("down"==t&&s===n.getRows(r)-1||"up"==t&&0===s)return null;const o=parseInt(e.getAttribute("rowspan")||"1"),a=r.getAttribute("headingRows")||0;if(a&&("down"==t&&s+o===a||"up"==t&&s===a))return null;const l=parseInt(e.getAttribute("rowspan")||"1"),c="down"==t?s+l:s,d=[...new FL(r,{endRow:c})],u=d.find((t=>t.cell===e)).column,h=d.find((({row:e,cellHeight:n,column:i})=>i===u&&("down"==t?e===c:c===e+n)));return h&&h.cell?h.cell:null}(n,this.direction,t);if(!i)return;const r=this.isHorizontal?"rowspan":"colspan",s=parseInt(n.getAttribute(r)||"1");return parseInt(i.getAttribute(r)||"1")===s?i:void 0}}function oM(e){const t=e.getChild(0);return 1==e.childCount&&t.is("element","paragraph")&&t.isEmpty}class aM extends uf{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),n=t[0];if(n){const i=n.findAncestor("table"),r=e.getRows(i)-1,s=e.getRowIndexes(t),o=0===s.first&&s.last===r;this.isEnabled=!o}else this.isEnabled=!1}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),n=t.getSelectionAffectedTableCells(e.document.selection),i=t.getRowIndexes(n),r=n[0],s=r.findAncestor("table"),o=t.getCellLocation(r).column;e.change((e=>{const n=i.last-i.first+1;t.removeRows(s,{at:i.first,rows:n});const r=function(e,t,n,i){const r=e.getChild(Math.min(t,i-1));let s=r.getChild(0),o=0;for(const e of r.getChildren()){if(o>n)return s;s=e,o+=parseInt(e.getAttribute("colspan")||"1")}return s}(s,i.first,o,t.getRows(s));e.setSelection(e.createPositionAt(r,0))}))}}class lM extends uf{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),n=t[0];if(n){const i=n.findAncestor("table"),r=e.getColumns(i),{first:s,last:o}=e.getColumnIndexes(t);this.isEnabled=o-s<r-1}else this.isEnabled=!1}execute(){const e=this.editor.plugins.get("TableUtils"),[t,n]=function(e,t){const n=t.getSelectionAffectedTableCells(e),i=n[0],r=n.pop(),s=[i,r];return i.isBefore(r)?s:s.reverse()}(this.editor.model.document.selection,e),i=t.parent.parent,r=[...new FL(i)],s={first:r.find((e=>e.cell===t)).column,last:r.find((e=>e.cell===n)).column},o=function(e,t,n,i){return parseInt(n.getAttribute("colspan")||"1")>1?n:t.previousSibling||n.nextSibling?n.nextSibling||t.previousSibling:i.first?e.reverse().find((({column:e})=>e<i.first)).cell:e.reverse().find((({column:e})=>e>i.last)).cell}(r,t,n,s);this.editor.model.change((t=>{const n=s.last-s.first+1;e.removeColumns(i,{at:s.first,columns:n}),t.setSelection(t.createPositionAt(o,0))}))}}class cM extends uf{refresh(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,n=e.getSelectionAffectedTableCells(t.document.selection),i=n.length>0;this.isEnabled=i,this.value=i&&n.every((e=>this._isInHeading(e,e.parent.parent)))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),n=this.editor.model,i=t.getSelectionAffectedTableCells(n.document.selection),r=i[0].findAncestor("table"),{first:s,last:o}=t.getRowIndexes(i),a=this.value?s:o+1,l=r.getAttribute("headingRows")||0;n.change((e=>{if(a){const t=ZL(r,a,a>l?l:0);for(const{cell:n}of t)QL(n,a,e)}OL("headingRows",a,r,e,0)}))}_isInHeading(e,t){const n=parseInt(t.getAttribute("headingRows")||"0");return!!n&&e.parent.index<n}}class dM extends uf{refresh(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),n=t.getSelectionAffectedTableCells(e.document.selection),i=n.length>0;this.isEnabled=i,this.value=i&&n.every((e=>RL(t,e)))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),n=this.editor.model,i=t.getSelectionAffectedTableCells(n.document.selection),r=i[0].findAncestor("table"),{first:s,last:o}=t.getColumnIndexes(i),a=this.value?s:o+1;n.change((e=>{if(a){const t=YL(r,a);for(const{cell:n,column:i}of t)JL(n,i,a,e)}OL("headingColumns",a,r,e,0)}))}}function uM(e,t){const n=hM(e,"tbody",t)||hM(e,"thead",t);return mM(t.editing.view.domConverter.mapViewToDom(n))}function hM(e,t,n){return[...[...n.editing.mapper.toViewElement(e).getChildren()].find((e=>e.is("element","table"))).getChildren()].find((e=>e.is("element",t)))}function mM(e){const t=ra.window.getComputedStyle(e);return"border-box"===t.boxSizing?parseFloat(t.width)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)-parseFloat(t.borderLeftWidth)-parseFloat(t.borderRightWidth):parseFloat(t.width)}function gM(e){const t=Math.pow(10,2),n="number"==typeof e?e:parseFloat(e);return Math.round(n*t)/t}function pM(e){return e.map((e=>"number"==typeof e?e:parseFloat(e))).filter((e=>!Number.isNaN(e))).reduce(((e,t)=>e+t),0)}function fM(e){let t=function(e){const t=e.filter((e=>"auto"===e)).length;if(0===t)return e.map((e=>gM(e)));const n=pM(e),i=Math.max((100-n)/t,5);return e.map((e=>"auto"===e?i:e)).map((e=>gM(e)))}(e.map((e=>"auto"===e?e:parseFloat(e.replace("%","")))));const n=pM(t);return 100!==n&&(t=t.map((e=>gM(100*e/n))).map(((e,t,n)=>t!==n.length-1?e:gM(e+100-pM(n))))),t.map((e=>e+"%"))}function bM(e){const t=ra.window.getComputedStyle(e);return"border-box"===t.boxSizing?parseInt(t.width):parseFloat(t.width)+parseFloat(t.paddingLeft)+parseFloat(t.paddingRight)+parseFloat(t.borderWidth)}function wM(e,t,n,i){for(let r=0;r<Math.max(n.length,e.length);r++){const s=e[r],o=n[r];o?s?i.setAttribute("columnWidth",o,s):i.appendElement("tableColumn",{columnWidth:o},t):i.remove(s)}}function vM(e){if(e.is("element","tableColumnGroup"))return e;const t=e.getChildren();return Array.from(t).find((e=>e.is("element","tableColumnGroup")))}function yM(e){const t=vM(e);return t?Array.from(t.getChildren()):[]}class _M extends cf{static get pluginName(){return"TableUtils"}static get isOfficialPlugin(){return!0}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(e){const t=e.parent,n=t.parent,i=n.getChildIndex(t),r=new FL(n,{row:i});for(const{cell:t,row:n,column:i}of r)if(t===e)return{row:n,column:i}}createTable(e,t){const n=e.createElement("table"),i=t.rows||2,r=t.columns||2;return kM(e,n,0,i,r),t.headingRows&&OL("headingRows",Math.min(t.headingRows,i),n,e,0),t.headingColumns&&OL("headingColumns",Math.min(t.headingColumns,r),n,e,0),n}insertRows(e,t={}){const n=this.editor.model,i=t.at||0,r=t.rows||1,s=void 0!==t.copyStructureFromAbove,o=t.copyStructureFromAbove?i-1:i,a=this.getRows(e),l=this.getColumns(e);if(i>a)throw new Aa("tableutils-insertrows-insert-out-of-range",this,{options:t});n.change((t=>{const n=e.getAttribute("headingRows")||0;if(n>i&&OL("headingRows",n+r,e,t,0),!s&&(0===i||i===a))return void kM(t,e,i,r,l);const c=s?Math.max(i,o):i,d=new FL(e,{endRow:c}),u=new Array(l).fill(1);for(const{row:e,column:n,cellHeight:a,cellWidth:l,cell:c}of d){const d=e+a-1,h=e<=o&&o<=d;e<i&&i<=d?(t.setAttribute("rowspan",a+r,c),u[n]=-l):s&&h&&(u[n]=l)}for(let n=0;n<r;n++){const n=t.createElement("tableRow");t.insert(n,e,i);for(let e=0;e<u.length;e++){const i=u[e],r=t.createPositionAt(n,"end");i>0&&VL(t,r,i>1?{colspan:i}:void 0),e+=Math.abs(i)-1}}}))}insertColumns(e,t={}){const n=this.editor.model,i=t.at||0,r=t.columns||1;n.change((t=>{const n=e.getAttribute("headingColumns");i<n&&t.setAttribute("headingColumns",n+r,e);const s=this.getColumns(e);if(0===i||s===i){for(const n of e.getChildren())n.is("element","tableRow")&&xM(r,t,t.createPositionAt(n,i?"end":0));return}const o=new FL(e,{column:i,includeAllSlots:!0});for(const e of o){const{row:n,cell:s,cellAnchorColumn:a,cellAnchorRow:l,cellWidth:c,cellHeight:d}=e;if(a<i){t.setAttribute("colspan",c+r,s);const e=l+d-1;for(let t=n;t<=e;t++)o.skipRow(t)}else xM(r,t,e.getPositionBefore())}}))}removeRows(e,t){const n=this.editor.model,i=t.rows||1,r=this.getRows(e),s=t.at,o=s+i-1;if(o>r-1)throw new Aa("tableutils-removerows-row-index-out-of-range",this,{table:e,options:t});n.change((t=>{const n={first:s,last:o},{cellsToMove:i,cellsToTrim:r}=function(e,{first:t,last:n}){const i=new Map,r=[];for(const{row:s,column:o,cellHeight:a,cell:l}of new FL(e,{endRow:n})){const e=s+a-1;if(s>=t&&s<=n&&e>n){const e=a-(n-s+1);i.set(o,{cell:l,rowspan:e})}if(s<t&&e>=t){let i;i=e>=n?n-t+1:e-t+1,r.push({cell:l,rowspan:a-i})}}return{cellsToMove:i,cellsToTrim:r}}(e,n);i.size&&function(e,t,n,i){const r=[...new FL(e,{includeAllSlots:!0,row:t})],s=e.getChild(t);let o;for(const{column:e,cell:t,isAnchor:a}of r)if(n.has(e)){const{cell:t,rowspan:r}=n.get(e),a=o?i.createPositionAfter(o):i.createPositionAt(s,0);i.move(i.createRangeOn(t),a),OL("rowspan",r,t,i),o=t}else a&&(o=t)}(e,o+1,i,t);for(let n=o;n>=s;n--)t.remove(e.getChild(n));for(const{rowspan:e,cell:n}of r)OL("rowspan",e,n,t);!function(e,{first:t,last:n},i){const r=e.getAttribute("headingRows")||0;t<r&&OL("headingRows",n<r?r-(n-t+1):t,e,i,0)}(e,n,t),eM(e,this)||tM(e,this)}))}removeColumns(e,t){const n=this.editor.model,i=t.at,r=t.columns||1,s=t.at+r-1;n.change((t=>{!function(e,t,n){const i=e.getAttribute("headingColumns")||0;if(i&&t.first<i){const r=Math.min(i-1,t.last)-t.first+1;n.setAttribute("headingColumns",i-r,e)}}(e,{first:i,last:s},t);const n=yM(e);for(let r=s;r>=i;r--){for(const{cell:n,column:i,cellWidth:s}of[...new FL(e)])i<=r&&s>1&&i+s>r?OL("colspan",s-1,n,t):i===r&&t.remove(n);if(n[r]){const e=0===r?n[1]:n[r-1],i=parseFloat(n[r].getAttribute("columnWidth")),s=parseFloat(e.getAttribute("columnWidth"));t.remove(n[r]),t.setAttribute("columnWidth",i+s+"%",e)}}tM(e,this)||eM(e,this)}))}splitCellVertically(e,t=2){const n=this.editor.model,i=e.parent.parent,r=parseInt(e.getAttribute("rowspan")||"1"),s=parseInt(e.getAttribute("colspan")||"1");n.change((n=>{if(s>1){const{newCellsSpan:i,updatedSpan:o}=CM(s,t);OL("colspan",o,e,n);const a={};i>1&&(a.colspan=i),r>1&&(a.rowspan=r),xM(s>t?t-1:s-1,n,n.createPositionAfter(e),a)}if(s<t){const o=t-s,a=[...new FL(i)],{column:l}=a.find((({cell:t})=>t===e)),c=a.filter((({cell:t,cellWidth:n,column:i})=>t!==e&&i===l||i<l&&i+n>l));for(const{cell:e,cellWidth:t}of c)n.setAttribute("colspan",t+o,e);const d={};r>1&&(d.rowspan=r),xM(o,n,n.createPositionAfter(e),d);const u=i.getAttribute("headingColumns")||0;u>l&&OL("headingColumns",u+o,i,n)}}))}splitCellHorizontally(e,t=2){const n=this.editor.model,i=e.parent,r=i.parent,s=r.getChildIndex(i),o=parseInt(e.getAttribute("rowspan")||"1"),a=parseInt(e.getAttribute("colspan")||"1");n.change((n=>{if(o>1){const i=[...new FL(r,{startRow:s,endRow:s+o-1,includeAllSlots:!0})],{newCellsSpan:l,updatedSpan:c}=CM(o,t);OL("rowspan",c,e,n);const{column:d}=i.find((({cell:t})=>t===e)),u={};l>1&&(u.rowspan=l),a>1&&(u.colspan=a);let h=0;for(const e of i){const{column:t,row:i}=e,r=t===d;h>=l&&r&&(h=0),i>=s+c&&r&&(h||xM(1,n,e.getPositionBefore(),u),h++)}}if(o<t){const i=t-o,l=[...new FL(r,{startRow:0,endRow:s})];for(const{cell:t,cellHeight:r,row:o}of l)if(t!==e&&o+r>s){const e=r+i;n.setAttribute("rowspan",e,t)}const c={};a>1&&(c.colspan=a),kM(n,r,s+1,i,1,c);const d=r.getAttribute("headingRows")||0;d>s&&OL("headingRows",d+i,r,n)}}))}getColumns(e){return[...e.getChild(0).getChildren()].filter((e=>e.is("element","tableCell"))).reduce(((e,t)=>e+parseInt(t.getAttribute("colspan")||"1")),0)}getRows(e){return Array.from(e.getChildren()).reduce(((e,t)=>t.is("element","tableRow")?e+1:e),0)}createTableWalker(e,t={}){return new FL(e,t)}getSelectedTableCells(e){const t=[];for(const n of this.sortRanges(e.getRanges())){const e=n.getContainedElement();e&&e.is("element","tableCell")&&t.push(e)}return t}getTableCellsContainingSelection(e){const t=[];for(const n of e.getRanges()){const e=n.start.findAncestor("tableCell");e&&t.push(e)}return t}getSelectionAffectedTableCells(e){const t=this.getSelectedTableCells(e);return t.length?t:this.getTableCellsContainingSelection(e)}getRowIndexes(e){const t=e.map((e=>e.parent.index));return this._getFirstLastIndexesObject(t)}getColumnIndexes(e){const t=e[0].findAncestor("table"),n=[...new FL(t)].filter((t=>e.includes(t.cell))).map((e=>e.column));return this._getFirstLastIndexesObject(n)}isSelectionRectangular(e){if(e.length<2||!this._areCellInTheSameTableSection(e))return!1;const t=new Set,n=new Set;let i=0;for(const r of e){const{row:e,column:s}=this.getCellLocation(r),o=parseInt(r.getAttribute("rowspan"))||1,a=parseInt(r.getAttribute("colspan"))||1;t.add(e),n.add(s),o>1&&t.add(e+o-1),a>1&&n.add(s+a-1),i+=o*a}const r=function(e,t){const n=Array.from(e.values()),i=Array.from(t.values());return(Math.max(...n)-Math.min(...n)+1)*(Math.max(...i)-Math.min(...i)+1)}(t,n);return r==i}sortRanges(e){return Array.from(e).sort(AM)}_getFirstLastIndexesObject(e){const t=e.sort(((e,t)=>e-t));return{first:t[0],last:t[t.length-1]}}_areCellInTheSameTableSection(e){const t=e[0].findAncestor("table"),n=this.getRowIndexes(e),i=parseInt(t.getAttribute("headingRows"))||0;if(!this._areIndexesInSameSection(n,i))return!1;const r=this.getColumnIndexes(e),s=parseInt(t.getAttribute("headingColumns"))||0;return this._areIndexesInSameSection(r,s)}_areIndexesInSameSection({first:e,last:t},n){return e<n==t<n}}function kM(e,t,n,i,r,s={}){for(let o=0;o<i;o++){const i=e.createElement("tableRow");e.insert(i,t,n),xM(r,e,e.createPositionAt(i,"end"),s)}}function xM(e,t,n,i={}){for(let r=0;r<e;r++)VL(t,n,i)}function CM(e,t){if(e<t)return{newCellsSpan:1,updatedSpan:1};const n=Math.floor(e/t);return{newCellsSpan:n,updatedSpan:e-n*t+n}}function AM(e,t){const n=e.start,i=t.start;return n.isBefore(i)?-1:1}class EM extends uf{refresh(){const e=this.editor.plugins.get(_M),t=e.getSelectedTableCells(this.editor.model.document.selection);this.isEnabled=e.isSelectionRectangular(t)}execute(){const e=this.editor.model,t=this.editor.plugins.get(_M);e.change((n=>{const i=t.getSelectedTableCells(e.document.selection),r=i.shift(),{mergeWidth:s,mergeHeight:o}=function(e,t,n){let i=0,r=0;for(const e of t){const{row:t,column:s}=n.getCellLocation(e);i=PM(e,s,i,"colspan"),r=PM(e,t,r,"rowspan")}const{row:s,column:o}=n.getCellLocation(e);return{mergeWidth:i-o,mergeHeight:r-s}}(r,i,t);OL("colspan",s,r,n),OL("rowspan",o,r,n);for(const e of i)TM(e,r,n);nM(r.findAncestor("table"),t),n.setSelection(r,"in")}))}}function TM(e,t,n){SM(e)||(SM(t)&&n.remove(n.createRangeIn(t)),n.move(n.createRangeIn(e),n.createPositionAt(t,"end"))),n.remove(e)}function SM(e){const t=e.getChild(0);return 1==e.childCount&&t.is("element","paragraph")&&t.isEmpty}function PM(e,t,n,i){const r=parseInt(e.getAttribute(i)||"1");return Math.max(n,t+r)}class IM extends uf{constructor(e){super(e),this.affectsData=!1}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),n=t.getSelectionAffectedTableCells(e.document.selection),i=t.getRowIndexes(n),r=n[0].findAncestor("table"),s=[];for(let t=i.first;t<=i.last;t++)for(const n of r.getChild(t).getChildren())s.push(e.createRangeOn(n));e.change((e=>{e.setSelection(s)}))}}class OM extends uf{constructor(e){super(e),this.affectsData=!1}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,n=e.getSelectionAffectedTableCells(t.document.selection),i=n[0],r=n.pop(),s=i.findAncestor("table"),o=e.getCellLocation(i),a=e.getCellLocation(r),l=Math.min(o.column,a.column),c=Math.max(o.column,a.column),d=[];for(const e of new FL(s,{startColumn:l,endColumn:c}))d.push(t.createRangeOn(e.cell));t.change((e=>{e.setSelection(d)}))}}function VM(e,t){let n=!1;const i=function(e){const t=parseInt(e.getAttribute("headingRows")||"0"),n=Array.from(e.getChildren()).reduce(((e,t)=>t.is("element","tableRow")?e+1:e),0),i=[];for(const{row:r,cell:s,cellHeight:o}of new FL(e)){if(o<2)continue;const e=r<t?t:n;if(r+o>e){const t=e-r;i.push({cell:s,rowspan:t})}}return i}(e);if(i.length){n=!0;for(const e of i)OL("rowspan",e.rowspan,e.cell,t,1)}return n}function RM(e,t){let n=!1;const i=function(e){const t=new Array(e.childCount).fill(0);for(const{rowIndex:n}of new FL(e,{includeAllSlots:!0}))t[n]++;return t}(e),r=[];for(const[t,n]of i.entries())!n&&e.getChild(t).is("element","tableRow")&&r.push(t);if(r.length){n=!0;for(const n of r.reverse())t.remove(e.getChild(n)),i.splice(n,1)}const s=i.filter(((t,n)=>e.getChild(n).is("element","tableRow"))),o=s[0];if(!s.every((e=>e===o))){const i=s.reduce(((e,t)=>t>e?t:e),0);for(const[r,o]of s.entries()){const s=i-o;if(s){for(let n=0;n<s;n++)VL(t,t.createPositionAt(e.getChild(r),"end"));n=!0}}}return n}function NM(e){if("attribute"!==e.type)return!1;const t=e.attributeKey;return"headingRows"===t||"colspan"===t||"rowspan"===t}function LM(e,t){let n=!1;for(const i of e.getChildren())i.is("element","tableRow")&&(n=MM(i,t)||n);return n}function MM(e,t){let n=!1;for(const i of e.getChildren())n=BM(i,t)||n;return n}function BM(e,t){if(0==e.childCount)return t.insertElement("paragraph",e),!0;const n=Array.from(e.getChildren()).filter((e=>e.is("$text")));for(const e of n)t.wrap(t.createRangeOn(e),"paragraph");return!!n.length}function FM(e){return!!e.position.parent.is("element","tableCell")&&("insert"==e.type&&"$text"==e.name||"remove"==e.type)}function DM(e,t){if(!e.is("element","paragraph"))return!1;const n=t.toViewElement(e);return!!n&&HL(e)!==n.is("element","span")}class zM extends cf{_additionalSlots;static get pluginName(){return"TableEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[_M]}constructor(e){super(e),this._additionalSlots=[]}init(){const e=this.editor,t=e.model,n=t.schema,i=e.conversion,r=e.plugins.get(_M);n.register("table",{inheritAllFrom:"$blockObject",allowAttributes:["headingRows","headingColumns"]}),n.register("tableRow",{allowIn:"table",isLimit:!0}),n.register("tableCell",{allowContentOf:"$container",allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),i.for("upcast").add((e=>{e.on("element:figure",((e,t,n)=>{if(!n.consumable.test(t.viewItem,{name:!0,classes:"table"}))return;const i=function(e){for(const t of e.getChildren())if(t.is("element","table"))return t}(t.viewItem);if(!i||!n.consumable.test(i,{name:!0}))return;n.consumable.consume(t.viewItem,{name:!0,classes:"table"});const r=ac(n.convertItem(i,t.modelCursor).modelRange.getItems());r?(n.convertChildren(t.viewItem,n.writer.createPositionAt(r,"end")),n.updateConversionResult(r,t)):n.consumable.revert(t.viewItem,{name:!0,classes:"table"})}))})),i.for("upcast").add((e=>{e.on("element:table",((e,t,n)=>{const i=t.viewItem;if(!n.consumable.test(i,{name:!0}))return;const{rows:r,headingRows:s,headingColumns:o}=function(e){let t,n=0;const i=[],r=[];let s;for(const o of Array.from(e.getChildren())){if("tbody"!==o.name&&"thead"!==o.name&&"tfoot"!==o.name)continue;"thead"!==o.name||s||(s=o);const e=Array.from(o.getChildren()).filter((e=>e.is("element","tr")));let a=null;for(const l of e){const e=Array.from(l.getChildren()).filter((e=>e.is("element","td")||e.is("element","th")));if(s&&o===s||"tbody"===o.name&&e.length>0&&(null===a||e.length===a)&&e.every((e=>e.is("element","th"))))n++,i.push(l);else{r.push(l);const e=BL(l);(!t||e<t)&&(t=e)}a=Math.max(a||0,e.length)}}return{headingRows:n,headingColumns:t||0,rows:[...i,...r]}}(i),a={};o&&(a.headingColumns=o),s&&(a.headingRows=s);const l=n.writer.createElement("table",a);if(n.safeInsert(l,t.modelCursor)){if(n.consumable.consume(i,{name:!0}),r.forEach((e=>n.convertItem(e,n.writer.createPositionAt(l,"end")))),n.convertChildren(i,n.writer.createPositionAt(l,"end")),l.isEmpty){const e=n.writer.createElement("tableRow");n.writer.insert(e,n.writer.createPositionAt(l,"end")),VL(n.writer,n.writer.createPositionAt(e,"end"))}n.updateConversionResult(l,t)}}))})),i.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:zL(r,{asWidget:!0,additionalSlots:this._additionalSlots})}),i.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:zL(r,{additionalSlots:this._additionalSlots})}),i.for("upcast").elementToElement({model:"tableRow",view:"tr"}),i.for("upcast").add((e=>{e.on("element:tr",((e,t)=>{t.viewItem.isEmpty&&0==t.modelCursor.index&&e.stop()}),{priority:"high"})})),i.for("downcast").elementToElement({model:"tableRow",view:(e,{writer:t})=>e.isEmpty?t.createEmptyElement("tr"):t.createContainerElement("tr")}),i.for("upcast").elementToElement({model:"tableCell",view:"td"}),i.for("upcast").elementToElement({model:"tableCell",view:"th"}),i.for("upcast").add(ML("td")),i.for("upcast").add(ML("th")),i.for("editingDowncast").elementToElement({model:"tableCell",view:$L({asWidget:!0})}),i.for("dataDowncast").elementToElement({model:"tableCell",view:$L()}),i.for("editingDowncast").elementToElement({model:"paragraph",view:jL({asWidget:!0}),converterPriority:"high"}),i.for("dataDowncast").elementToElement({model:"paragraph",view:jL(),converterPriority:"high"}),i.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),i.for("upcast").attributeToAttribute({model:{key:"colspan",value:$M("colspan")},view:"colspan"}),i.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),i.for("upcast").attributeToAttribute({model:{key:"rowspan",value:$M("rowspan")},view:"rowspan"}),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.commands.add("insertTable",new WL(e)),e.commands.add("insertTableRowAbove",new UL(e,{order:"above"})),e.commands.add("insertTableRowBelow",new UL(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new qL(e,{order:"left"})),e.commands.add("insertTableColumnRight",new qL(e,{order:"right"})),e.commands.add("removeTableRow",new aM(e)),e.commands.add("removeTableColumn",new lM(e)),e.commands.add("splitTableCellVertically",new GL(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new GL(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new EM(e)),e.commands.add("mergeTableCellRight",new sM(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new sM(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new sM(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new sM(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new dM(e)),e.commands.add("setTableRowHeader",new cM(e)),e.commands.add("selectTableRow",new IM(e)),e.commands.add("selectTableColumn",new OM(e)),function(e){e.document.registerPostFixer((t=>function(e,t){const n=t.document.differ.getChanges();let i=!1;const r=new Set;for(const t of n){let n=null;"insert"==t.type&&"table"==t.name&&(n=t.position.nodeAfter),"insert"!=t.type&&"remove"!=t.type||"tableRow"!=t.name&&"tableCell"!=t.name||(n=t.position.findAncestor("table")),NM(t)&&(n=t.range.start.findAncestor("table")),n&&!r.has(n)&&(i=VM(n,e)||i,i=RM(n,e)||i,r.add(n))}return i}(t,e)))}(t),function(e){e.document.registerPostFixer((t=>function(e,t){const n=t.document.differ.getChanges();let i=!1;for(const t of n)"insert"==t.type&&"table"==t.name&&(i=LM(t.position.nodeAfter,e)||i),"insert"==t.type&&"tableRow"==t.name&&(i=MM(t.position.nodeAfter,e)||i),"insert"==t.type&&"tableCell"==t.name&&(i=BM(t.position.nodeAfter,e)||i),"remove"!=t.type&&"insert"!=t.type||!FM(t)||(i=BM(t.position.parent,e)||i);return i}(t,e)))}(t),this.listenTo(t.document,"change:data",(()=>{!function(e,t){const n=e.document.differ;for(const e of n.getChanges()){let n,i=!1;if("attribute"==e.type){const t=e.range.start.nodeAfter;if(!t||!t.is("element","table"))continue;if("headingRows"!=e.attributeKey&&"headingColumns"!=e.attributeKey)continue;n=t,i="headingRows"==e.attributeKey}else"tableRow"!=e.name&&"tableCell"!=e.name||(n=e.position.findAncestor("table"),i="tableRow"==e.name);if(!n)continue;const r=n.getAttribute("headingRows")||0,s=n.getAttribute("headingColumns")||0,o=new FL(n);for(const e of o){const n=e.row<r||e.column<s?"th":"td",o=t.mapper.toViewElement(e.cell);o&&o.is("element")&&o.name!=n&&t.reconvertItem(i?e.cell.parent:e.cell)}}}(t,e.editing),function(e,t){const n=e.document.differ,i=new Set;for(const e of n.getChanges()){const t="attribute"==e.type?e.range.start.parent:e.position.parent;t.is("element","tableCell")&&i.add(t)}for(const e of i.values()){const n=Array.from(e.getChildren()).filter((e=>DM(e,t.mapper)));for(const e of n)t.reconvertItem(e)}}(t,e.editing)}))}registerAdditionalSlot(e){this._additionalSlots.push(e)}}function $M(e){return t=>{const n=parseInt(t.getAttribute(e));return Number.isNaN(n)||n<=0?null:n}}class jM extends Lb{items;keystrokes;focusTracker;constructor(e){super(e);const t=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new hc,this.focusTracker=new lc,this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",((e,t)=>`${t} × ${e}`)),this.setTemplate({tag:"div",attributes:{class:["ck"]},children:[{tag:"div",attributes:{class:["ck-insert-table-dropdown__grid"]},on:{"mouseover@.ck-insert-table-dropdown-grid-box":t.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck","ck-insert-table-dropdown__label"],"aria-hidden":!0},children:[{text:t.to("label")}]}],on:{mousedown:t.to((e=>{e.preventDefault()})),click:t.to((()=>{this.fire("execute")}))}}),this.on("boxover",((e,t)=>{const{row:n,column:i}=t.target.dataset;this.items.get(10*(parseInt(n,10)-1)+(parseInt(i,10)-1)).focus()})),this.focusTracker.on("change:focusedElement",((e,t,n)=>{if(!n)return;const{row:i,column:r}=n.dataset;this.set({rows:parseInt(i),columns:parseInt(r)})})),this.on("change:columns",(()=>this._highlightGridBoxes())),this.on("change:rows",(()=>this._highlightGridBoxes()))}render(){super.render(),Db({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:10,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});for(const e of this.items)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element)}reset(){this.set({rows:1,columns:1})}focus(){this.items.get(0).focus()}focusLast(){this.items.get(0).focus()}_highlightGridBoxes(){const e=this.rows,t=this.columns;this.items.map(((n,i)=>{const r=Math.floor(i/10)<e&&i%10<t;n.set("isOn",r)}))}_createGridButton(e,t,n,i){const r=new jb(e);return r.set({label:i,class:"ck-insert-table-dropdown-grid-box"}),r.extendTemplate({attributes:{"data-row":t,"data-column":n}}),r}_createGridCollection(){const e=[];for(let t=0;t<100;t++){const n=Math.floor(t/10),i=t%10,r=`${n+1} × ${i+1}`;e.push(this._createGridButton(this.locale,n+1,i+1,r))}return this.createCollection(e)}}class HM extends cf{static get pluginName(){return"TableUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=this.editor.t,n="ltr"===e.locale.contentLanguageDirection;e.ui.componentFactory.add("insertTable",(n=>{const i=e.commands.get("insertTable"),r=Yw(n);let s;return r.bind("isEnabled").to(i),r.buttonView.set({icon:Pf.table,label:t("Insert table"),tooltip:!0}),r.on("change:isOpen",(()=>{s||(s=new jM(n),r.panelView.children.add(s),s.delegate("execute").to(r),r.on("execute",(()=>{e.execute("insertTable",{rows:s.rows,columns:s.columns}),e.editing.view.focus()})))})),r})),e.ui.componentFactory.add("menuBar:insertTable",(n=>{const i=e.commands.get("insertTable"),r=new gy(n),s=new jM(n);return s.delegate("execute").to(r),r.on("change:isOpen",((e,t,n)=>{n||s.reset()})),s.on("execute",(()=>{e.execute("insertTable",{rows:s.rows,columns:s.columns}),e.editing.view.focus()})),r.buttonView.set({label:t("Table"),icon:Pf.table}),r.panelView.children.add(s),r.bind("isEnabled").to(i),r})),e.ui.componentFactory.add("tableColumn",(e=>{const i=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:t("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:n?"insertTableColumnLeft":"insertTableColumnRight",label:t("Insert column left")}},{type:"button",model:{commandName:n?"insertTableColumnRight":"insertTableColumnLeft",label:t("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:t("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:t("Select column")}}];return this._prepareDropdown(t("Column"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M18 7v1H2V7h16zm0 5v1H2v-1h16z" opacity=".6"/><path d="M14 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1zm-2 1H8v4h4V2zm0 6H8v4h4V8zm0 6H8v4h4v-4z"/></svg>',i,e)})),e.ui.componentFactory.add("tableRow",(e=>{const n=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:t("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:t("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:t("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:t("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:t("Select row")}}];return this._prepareDropdown(t("Row"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v16h-1V2z" opacity=".6"/><path d="M1 6h18a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm1 2v4h4V8H2zm6 0v4h4V8H8zm6 0v4h4V8h-4z"/></svg>',n,e)})),e.ui.componentFactory.add("mergeTableCells",(e=>{const i=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("Merge cell up")}},{type:"button",model:{commandName:n?"mergeTableCellRight":"mergeTableCellLeft",label:t("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("Merge cell down")}},{type:"button",model:{commandName:n?"mergeTableCellLeft":"mergeTableCellRight",label:t("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:t("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:t("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(t("Merge cells"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v7h-1V2zm6 5v1H2V7h16zM8 12v1H2v-1h6z" opacity=".6"/><path d="M7 7h12a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1zm1 2v9h10V9H8z"/></svg>',i,e)}))}_prepareDropdown(e,t,n,i){const r=this.editor,s=Yw(i),o=this._fillDropdownWithListOptions(s,n);return s.buttonView.set({label:e,icon:t,tooltip:!0}),s.bind("isEnabled").toMany(o,"isEnabled",((...e)=>e.some((e=>e)))),this.listenTo(s,"execute",(e=>{r.execute(e.source.commandName),e.source instanceof hw||r.editing.view.focus()})),s}_prepareMergeSplitButtonDropdown(e,t,n,i){const r=this.editor,s=Yw(i,Qw),o="mergeTableCells",a=r.commands.get(o),l=this._fillDropdownWithListOptions(s,n);return s.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),s.bind("isEnabled").toMany([a,...l],"isEnabled",((...e)=>e.some((e=>e)))),this.listenTo(s.buttonView,"execute",(()=>{r.execute(o),r.editing.view.focus()})),this.listenTo(s,"execute",(e=>{r.execute(e.source.commandName),r.editing.view.focus()})),s}_fillDropdownWithListOptions(e,t){const n=this.editor,i=[],r=new oc;for(const e of t)WM(e,n,i,r);return ev(e,r),i}}function WM(e,t,n,i){if("button"===e.type||"switchbutton"===e.type){const i=e.model=new iy(e.model),{commandName:r,bindIsOn:s}=e.model,o=t.commands.get(r);n.push(o),i.set({commandName:r}),i.bind("isEnabled").to(o),s&&i.bind("isOn").to(o,"value"),i.set({withText:!0})}i.add(e)}class UM extends cf{static get pluginName(){return"TableSelection"}static get isOfficialPlugin(){return!0}static get requires(){return[_M,_M]}init(){const e=this.editor,t=e.model,n=e.editing.view;this.listenTo(t,"deleteContent",((e,t)=>this._handleDeleteContent(e,t)),{priority:"high"}),this.listenTo(n.document,"insertText",((e,t)=>this._handleInsertTextEvent(e,t)),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){const e=this.editor.plugins.get(_M),t=this.editor.model.document.selection,n=e.getSelectedTableCells(t);return 0==n.length?null:n}getSelectionAsFragment(){const e=this.editor.plugins.get(_M),t=this.getSelectedTableCells();return t?this.editor.model.change((n=>{const i=n.createDocumentFragment(),{first:r,last:s}=e.getColumnIndexes(t),{first:o,last:a}=e.getRowIndexes(t),l=t[0].findAncestor("table");let c=a,d=s;if(e.isSelectionRectangular(t)){const e={firstColumn:r,lastColumn:s,firstRow:o,lastRow:a};c=iM(l,e),d=rM(l,e)}const u=KL(l,{startRow:o,startColumn:r,endRow:c,endColumn:d},n);return n.insert(u,i,0),i})):null}setCellSelection(e,t){const n=this._getCellsToSelect(e,t);this.editor.model.change((e=>{e.setSelection(n.cells.map((t=>e.createRangeOn(t))),{backward:n.backward})}))}getFocusCell(){const e=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return e&&e.is("element","tableCell")?e:null}getAnchorCell(){const e=ac(this.editor.model.document.selection.getRanges()).getContainedElement();return e&&e.is("element","tableCell")?e:null}_defineSelectionConverter(){const e=this.editor,t=new Set;e.conversion.for("editingDowncast").add((e=>e.on("selection",((e,n,i)=>{const r=i.writer;!function(e){for(const n of t)e.removeClass("ck-editor__editable_selected",n);t.clear()}(r);const s=this.getSelectedTableCells();if(!s)return;for(const e of s){const n=i.mapper.toViewElement(e);r.addClass("ck-editor__editable_selected",n),t.add(n)}const o=i.mapper.toViewElement(s[s.length-1]);r.setSelection(o,0)}),{priority:"lowest"})))}_enablePluginDisabling(){const e=this.editor;this.on("change:isEnabled",(()=>{if(!this.isEnabled){const t=this.getSelectedTableCells();if(!t)return;e.model.change((n=>{const i=n.createPositionAt(t[0],0),r=e.model.schema.getNearestSelectionRange(i);n.setSelection(r)}))}}))}_handleDeleteContent(e,t){const n=this.editor.plugins.get(_M),i=t[0],r=t[1],s=this.editor.model,o=!r||"backward"==r.direction,a=n.getSelectedTableCells(i);a.length&&(e.stop(),s.change((e=>{const t=a[o?a.length-1:0];s.change((e=>{for(const t of a)s.deleteContent(e.createSelection(t,"in"))}));const n=s.schema.getNearestSelectionRange(e.createPositionAt(t,0));i.is("documentSelection")?e.setSelection(n):i.setTo(n)})))}_handleInsertTextEvent(e,t){const n=this.editor,i=this.getSelectedTableCells();if(!i)return;const r=n.editing.view,s=n.editing.mapper,o=i.map((e=>r.createRangeOn(s.toViewElement(e))));t.selection=r.createSelection(o)}_getCellsToSelect(e,t){const n=this.editor.plugins.get("TableUtils"),i=n.getCellLocation(e),r=n.getCellLocation(t),s=Math.min(i.row,r.row),o=Math.max(i.row,r.row),a=Math.min(i.column,r.column),l=Math.max(i.column,r.column),c=new Array(o-s+1).fill(null).map((()=>[])),d={startRow:s,endRow:o,startColumn:a,endColumn:l};for(const{row:t,cell:n}of new FL(e.findAncestor("table"),d))c[t-s].push(n);const u=r.row<i.row,h=r.column<i.column;return u&&c.reverse(),h&&c.forEach((e=>e.reverse())),{cells:c.flat(),backward:u||h}}}class qM extends cf{static get pluginName(){return"TableClipboard"}static get isOfficialPlugin(){return!0}static get requires(){return[wx,vx,UM,_M]}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"copy",((e,t)=>this._onCopyCut(e,t))),this.listenTo(t,"cut",((e,t)=>this._onCopyCut(e,t))),this.listenTo(e.model,"insertContent",((e,[t,n])=>this._onInsertContent(e,t,n)),{priority:"high"}),this.decorate("_replaceTableSlotCell")}_onCopyCut(e,t){const n=this.editor.editing.view,i=this.editor.plugins.get(UM),r=this.editor.plugins.get(wx);i.getSelectedTableCells()&&("cut"!=e.name||this.editor.model.canEditAt(this.editor.model.document.selection))&&(t.preventDefault(),e.stop(),this.editor.model.enqueueChange({isUndoable:"cut"===e.name},(()=>{const s=r._copySelectedFragmentWithMarkers(e.name,this.editor.model.document.selection,(()=>i.getSelectionAsFragment()));n.document.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:this.editor.data.toView(s),method:e.name})})))}_onInsertContent(e,t,n){if(n&&!n.is("documentSelection"))return;const i=this.editor.model,r=this.editor.plugins.get(_M),s=this.editor.plugins.get(wx),o=this.getTableIfOnlyTableInContent(t,i);if(!o)return;const a=r.getSelectionAffectedTableCells(i.document.selection);a.length?(e.stop(),t.is("documentFragment")?s._pasteMarkersIntoTransformedElement(t.markers,(e=>this._replaceSelectedCells(o,a,e))):this.editor.model.change((e=>{this._replaceSelectedCells(o,a,e)}))):nM(o,r)}_replaceSelectedCells(e,t,n){const i=this.editor.plugins.get(_M),r={width:i.getColumns(e),height:i.getRows(e)},s=function(e,t,n,i){const r=e[0].findAncestor("table"),s=i.getColumnIndexes(e),o=i.getRowIndexes(e),a={firstColumn:s.first,lastColumn:s.last,firstRow:o.first,lastRow:o.last},l=1===e.length;return l&&(a.lastRow+=t.height-1,a.lastColumn+=t.width-1,function(e,t,n,i){const r=i.getColumns(e),s=i.getRows(e);n>r&&i.insertColumns(e,{at:r,columns:n-r}),t>s&&i.insertRows(e,{at:s,rows:t-s})}(r,a.lastRow+1,a.lastColumn+1,i)),l||!i.isSelectionRectangular(e)?function(e,t,n){const{firstRow:i,lastRow:r,firstColumn:s,lastColumn:o}=t,a={first:i,last:r},l={first:s,last:o};KM(e,s,a,n),KM(e,o+1,a,n),GM(e,i,l,n),GM(e,r+1,l,n,i)}(r,a,n):(a.lastRow=iM(r,a),a.lastColumn=rM(r,a)),a}(t,r,n,i),o=s.lastRow-s.firstRow+1,a=s.lastColumn-s.firstColumn+1;e=KL(e,{startRow:0,startColumn:0,endRow:Math.min(o,r.height)-1,endColumn:Math.min(a,r.width)-1},n);const l=t[0].findAncestor("table"),c=this._replaceSelectedCellsWithPasted(e,r,l,s,n);if(this.editor.plugins.get("TableSelection").isEnabled){const e=i.sortRanges(c.map((e=>n.createRangeOn(e))));n.setSelection(e)}else n.setSelection(c[0],0);return l}_replaceSelectedCellsWithPasted(e,t,n,i,r){const{width:s,height:o}=t,a=function(e,t,n){const i=new Array(n).fill(null).map((()=>new Array(t).fill(null)));for(const{column:t,row:n,cell:r}of new FL(e))i[n][t]=r;return i}(e,s,o),l=[...new FL(n,{startRow:i.firstRow,endRow:i.lastRow,startColumn:i.firstColumn,endColumn:i.lastColumn,includeAllSlots:!0})],c=[];let d;for(const e of l){const{row:t,column:n}=e;n===i.firstColumn&&(d=e.getPositionBefore());const l=t-i.firstRow,u=n-i.firstColumn,h=a[l%o][u%s],m=h?r.cloneElement(h):null,g=this._replaceTableSlotCell(e,m,d,r);g&&(XL(g,t,n,i.lastRow,i.lastColumn,r),c.push(g),d=r.createPositionAfter(g))}const u=parseInt(n.getAttribute("headingRows")||"0"),h=parseInt(n.getAttribute("headingColumns")||"0"),m=i.firstRow<u&&u<=i.lastRow,g=i.firstColumn<h&&h<=i.lastColumn;if(m){const e=GM(n,u,{first:i.firstColumn,last:i.lastColumn},r,i.firstRow);c.push(...e)}if(g){const e=KM(n,h,{first:i.firstRow,last:i.lastRow},r);c.push(...e)}return c}_replaceTableSlotCell(e,t,n,i){const{cell:r,isAnchor:s}=e;return s&&i.remove(r),t?(i.insert(t,n),t):null}getTableIfOnlyTableInContent(e,t){if(!e.is("documentFragment")&&!e.is("element"))return null;if(e.is("element","table"))return e;if(1==e.childCount&&e.getChild(0).is("element","table"))return e.getChild(0);const n=t.createRangeIn(e);for(const e of n.getItems())if(e.is("element","table")){const i=t.createRange(n.start,t.createPositionBefore(e));if(t.hasContent(i,{ignoreWhitespaces:!0}))return null;const r=t.createRange(t.createPositionAfter(e),n.end);return t.hasContent(r,{ignoreWhitespaces:!0})?null:e}return null}}function GM(e,t,n,i,r=0){if(!(t<1))return ZL(e,t,r).filter((({column:e,cellWidth:t})=>ZM(e,t,n))).map((({cell:e})=>QL(e,t,i)))}function KM(e,t,n,i){if(!(t<1))return YL(e,t).filter((({row:e,cellHeight:t})=>ZM(e,t,n))).map((({cell:e,column:n})=>JL(e,n,t,i)))}function ZM(e,t,n){const i=e+t-1,{first:r,last:s}=n;return e>=r&&e<=s||e<r&&i>=r}class QM extends cf{static get pluginName(){return"TableKeyboard"}static get isOfficialPlugin(){return!0}static get requires(){return[UM,_M]}init(){const e=this.editor,t=e.editing.view.document,n=e.t;this.listenTo(t,"arrowKey",((...e)=>this._onArrowKey(...e)),{context:"table"}),this.listenTo(t,"tab",((...e)=>this._handleTabOnSelectedTable(...e)),{context:"figure"}),this.listenTo(t,"tab",((...e)=>this._handleTab(...e)),{context:["th","td"]}),e.accessibility.addKeystrokeInfoGroup({id:"table",label:n("Keystrokes that can be used in a table cell"),keystrokes:[{label:n("Move the selection to the next cell"),keystroke:"Tab"},{label:n("Move the selection to the previous cell"),keystroke:"Shift+Tab"},{label:n("Insert a new table row (when in the last cell of a table)"),keystroke:"Tab"},{label:n("Navigate through the table"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]}]})}_handleTabOnSelectedTable(e,t){const n=this.editor,i=n.model.document.selection.getSelectedElement();i&&i.is("element","table")&&(t.preventDefault(),t.stopPropagation(),e.stop(),n.model.change((e=>{e.setSelection(e.createRangeIn(i.getChild(0).getChild(0)))})))}_handleTab(e,t){const n=this.editor,i=this.editor.plugins.get(_M),r=this.editor.plugins.get("TableSelection"),s=n.model.document.selection,o=!t.shiftKey;let a=i.getTableCellsContainingSelection(s)[0];if(a||(a=r.getFocusCell()),!a)return;t.preventDefault(),t.stopPropagation(),e.stop();const l=a.parent,c=l.parent,d=c.getChildIndex(l),u=l.getChildIndex(a),h=0===u;if(!o&&h&&0===d)return void n.model.change((e=>{e.setSelection(e.createRangeOn(c))}));const m=u===l.childCount-1,g=d===i.getRows(c)-1;if(o&&g&&m&&(n.execute("insertTableRowBelow"),d===i.getRows(c)-1))return void n.model.change((e=>{e.setSelection(e.createRangeOn(c))}));let p;if(o&&m){const e=c.getChild(d+1);p=e.getChild(0)}else if(!o&&h){const e=c.getChild(d-1);p=e.getChild(e.childCount-1)}else p=l.getChild(u+(o?1:-1));n.model.change((e=>{e.setSelection(e.createRangeIn(p))}))}_onArrowKey(e,t){const n=this.editor,i=ec(t.keyCode,n.locale.contentLanguageDirection);this._handleArrowKeys(i,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){const n=this.editor.plugins.get(_M),i=this.editor.plugins.get("TableSelection"),r=this.editor.model,s=r.document.selection,o=["right","down"].includes(e),a=n.getSelectedTableCells(s);if(a.length){let n;return n=t?i.getFocusCell():o?a[a.length-1]:a[0],this._navigateFromCellInDirection(n,e,t),!0}const l=s.focus.findAncestor("tableCell");if(!l)return!1;if(!s.isCollapsed)if(t){if(s.isBackward==o&&!s.containsEntireContent(l))return!1}else{const e=s.getSelectedElement();if(!e||!r.schema.isObject(e))return!1}return!!this._isSelectionAtCellEdge(s,l,o)&&(this._navigateFromCellInDirection(l,e,t),!0)}_isSelectionAtCellEdge(e,t,n){const i=this.editor.model,r=this.editor.model.schema,s=n?e.getLastPosition():e.getFirstPosition();if(!r.getLimitElement(s).is("element","tableCell"))return i.createPositionAt(t,n?"end":0).isTouching(s);const o=i.createSelection(s);return i.modifySelection(o,{direction:n?"forward":"backward"}),s.isEqual(o.focus)}_navigateFromCellInDirection(e,t,n=!1){const i=this.editor.model,r=e.findAncestor("table"),s=[...new FL(r,{includeAllSlots:!0})],{row:o,column:a}=s[s.length-1],l=s.find((({cell:t})=>t==e));let{row:c,column:d}=l;switch(t){case"left":d--;break;case"up":c--;break;case"right":d+=l.cellWidth;break;case"down":c+=l.cellHeight}if(c<0||c>o||d<0&&c<=0||d>a&&c>=o)return void i.change((e=>{e.setSelection(e.createRangeOn(r))}));d<0?(d=n?0:a,c--):d>a&&(d=n?a:0,c++);const u=s.find((e=>e.row==c&&e.column==d)).cell,h=["right","down"].includes(t),m=this.editor.plugins.get("TableSelection");if(n&&m.isEnabled){const t=m.getAnchorCell()||e;m.setCellSelection(t,u)}else{const e=i.createPositionAt(u,h?0:"end");i.change((t=>{t.setSelection(e)}))}}}class YM extends Yu{domEventType=["mousemove","mouseleave"];onDomEvent(e){this.fire(e.type,e)}}class JM extends cf{static get pluginName(){return"TableMouse"}static get isOfficialPlugin(){return!0}static get requires(){return[UM,_M]}init(){this.editor.editing.view.addObserver(YM),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const e=this.editor,t=e.plugins.get(_M);let n=!1;const i=e.plugins.get(UM);this.listenTo(e.editing.view.document,"mousedown",((r,s)=>{const o=e.model.document.selection;if(!this.isEnabled||!i.isEnabled)return;if(!s.domEvent.shiftKey)return;const a=i.getAnchorCell()||t.getTableCellsContainingSelection(o)[0];if(!a)return;const l=this._getModelTableCellFromDomEvent(s);l&&XM(a,l)&&(n=!0,i.setCellSelection(a,l),s.preventDefault())})),this.listenTo(e.editing.view.document,"mouseup",(()=>{n=!1})),this.listenTo(e.editing.view.document,"selectionChange",(e=>{n&&e.stop()}),{priority:"highest"})}_enableMouseDragSelection(){const e=this.editor;let t,n,i=!1,r=!1;const s=e.plugins.get(UM);this.listenTo(e.editing.view.document,"mousedown",((e,n)=>{this.isEnabled&&s.isEnabled&&(n.domEvent.shiftKey||n.domEvent.ctrlKey||n.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(n)))})),this.listenTo(e.editing.view.document,"mousemove",((e,o)=>{if(!o.domEvent.buttons)return;if(!t)return;const a=this._getModelTableCellFromDomEvent(o);a&&XM(t,a)&&(n=a,i||n==t||(i=!0)),i&&(r=!0,s.setCellSelection(t,n),o.preventDefault())})),this.listenTo(e.editing.view.document,"mouseup",(()=>{i=!1,r=!1,t=null,n=null})),this.listenTo(e.editing.view.document,"selectionChange",(e=>{r&&e.stop()}),{priority:"highest"})}_getModelTableCellFromDomEvent(e){const t=e.target,n=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(n).parent.findAncestor("tableCell",{includeSelf:!0})}}function XM(e,t){return e.parent.parent==t.parent.parent}class eB extends cf{static get requires(){return[zM,HM,UM,JM,QM,qM,Dk]}static get pluginName(){return"Table"}static get isOfficialPlugin(){return!0}}function tB(e){return nB(e)||iB(e)}function nB(e){const t=e.getSelectedElement();return t&&rB(t)?t:null}function iB(e){const t=e.getFirstPosition();if(!t)return null;let n=t.parent;for(;n;){if(n.is("element")&&rB(n))return n;n=n.parent}return null}function rB(e){return!!e.getCustomProperty("table")&&_k(e)}class sB extends cf{static get requires(){return[zk]}static get pluginName(){return"TableToolbar"}static get isOfficialPlugin(){return!0}afterInit(){const e=this.editor,t=e.t,n=e.plugins.get(zk),i=e.config.get("table.contentToolbar"),r=e.config.get("table.tableToolbar");i&&n.register("tableContent",{ariaLabel:t("Table toolbar"),items:i,getRelatedElement:iB}),r&&n.register("table",{ariaLabel:t("Table toolbar"),items:r,getRelatedElement:nB})}}class oB extends Lb{options;focusTracker;focusCycler;_focusables;dropdownView;inputView;keystrokes;_stillTyping;constructor(e,t){super(e),this.set("value",""),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isEmpty",!0),this.options=t,this.focusTracker=new lc,this._focusables=new mb,this.dropdownView=this._createDropdownView(),this.inputView=this._createInputTextView(),this.keystrokes=new hc,this._stillTyping=!1,this.focusCycler=new Ub({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-input-color"]},children:[this.dropdownView,this.inputView]}),this.on("change:value",((e,t,n)=>this._setInputValue(n)))}render(){super.render(),[this.inputView,this.dropdownView.buttonView].forEach((e=>{this.focusTracker.add(e.element),this._focusables.add(e)})),this.keystrokes.listenTo(this.element)}focus(e){-1===e?this.focusCycler.focusLast():this.focusCycler.focusFirst()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createDropdownView(){const e=this.locale,t=e.t,n=this.bindTemplate,i=this._createColorSelector(e),r=Yw(e),s=new Lb;return s.setTemplate({tag:"span",attributes:{class:["ck","ck-input-color__button__preview"],style:{backgroundColor:n.to("value")}},children:[{tag:"span",attributes:{class:["ck","ck-input-color__button__preview__no-color-indicator",n.if("value","ck-hidden",(e=>""!=e))]}}]}),r.buttonView.extendTemplate({attributes:{class:"ck-input-color__button"}}),r.buttonView.children.add(s),r.buttonView.label=t("Color picker"),r.buttonView.tooltip=!0,r.panelPosition="rtl"===e.uiLanguageDirection?"se":"sw",r.panelView.children.add(i),r.bind("isEnabled").to(this,"isReadOnly",(e=>!e)),r.on("change:isOpen",((e,t,n)=>{n&&(i.updateSelectedColors(),i.showColorGridsFragment())})),r}_createInputTextView(){const e=this.locale,t=new Pw(e);return t.extendTemplate({on:{blur:t.bindTemplate.to("blur")}}),t.value=this.value,t.bind("isReadOnly","hasError").to(this),this.bind("isFocused","isEmpty").to(t),t.on("input",(()=>{const e=t.element.value,n=this.options.colorDefinitions.find((t=>e===t.label));this._stillTyping=!0,this.value=n&&n.color||e})),t.on("blur",(()=>{this._stillTyping=!1,this._setInputValue(t.element.value)})),t.delegate("input").to(this),t}_createColorSelector(e){const t=e.t,n=this.options.defaultColorValue||"",i=t(n?"Restore default":"Remove color"),r=new bv(e,{colors:this.options.colorDefinitions,columns:this.options.columns,removeButtonLabel:i,colorPickerLabel:t("Color picker"),colorPickerViewConfig:!1!==this.options.colorPickerConfig&&{...this.options.colorPickerConfig,hideInput:!0}});r.appendUI(),r.on("execute",((e,t)=>{"colorPickerSaveButton"!==t.source?(this.value=t.value||n,this.fire("input"),"colorPicker"!==t.source&&(this.dropdownView.isOpen=!1)):this.dropdownView.isOpen=!1}));let s=this.value;return r.on("colorPicker:cancel",(()=>{this.value=s,this.fire("input"),this.dropdownView.isOpen=!1})),r.colorGridsFragmentView.colorPickerButtonView.on("execute",(()=>{s=this.value})),r.bind("selectedColor").to(this,"value"),r}_setInputValue(e){if(!this._stillTyping){const t=aB(e),n=this.options.colorDefinitions.find((e=>t===aB(e.color)));this.inputView.value=n?n.label:e||""}}}function aB(e){return e.replace(/([(,])\s+/g,"$1").replace(/^\s+|\s+(?=[),\s]|$)/g,"").replace(/,|\s/g," ")}const lB=e=>""===e;function cB(e){return{none:e("None"),solid:e("Solid"),dotted:e("Dotted"),dashed:e("Dashed"),double:e("Double"),groove:e("Groove"),ridge:e("Ridge"),inset:e("Inset"),outset:e("Outset")}}function dB(e){return e('The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".')}function uB(e){return e('The value is invalid. Try "10px" or "2em" or simply "2".')}function hB(e){return e=e.trim().toLowerCase(),lB(e)||vp(e)}function mB(e){return e=e.trim(),lB(e)||vB(e)||xp(e)||Ap(e)}function gB(e){return e=e.trim(),lB(e)||vB(e)||xp(e)}function pB(e,t){const n=new oc,i=cB(e.t);for(const r in i){const s={type:"button",model:new iy({_borderStyleValue:r,label:i[r],role:"menuitemradio",withText:!0})};"none"===r?s.model.bind("isOn").to(e,"borderStyle",(e=>"none"===t?!e:e===r)):s.model.bind("isOn").to(e,"borderStyle",(e=>e===r)),n.add(s)}return n}function fB(e){const{view:t,icons:n,toolbar:i,labels:r,propertyName:s,nameToValue:o,defaultValue:a}=e;for(const e in r){const l=new jb(t.locale);l.set({role:"radio",isToggleable:!0,label:r[e],icon:n[e],tooltip:r[e]});const c=o?o(e):e;l.bind("isOn").to(t,s,(e=>{let t=e;return""===e&&a&&(t=a),c===t})),l.on("execute",(()=>{t[s]=c})),i.items.add(l)}}const bB=[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}];function wB(e){return(t,n,i)=>{const r=new oB(t.locale,{colorDefinitions:(s=e.colorConfig,s.map((e=>({color:e.model,label:e.label,options:{hasBorder:e.hasBorder}})))),columns:e.columns,defaultColorValue:e.defaultColorValue,colorPickerConfig:e.colorPickerConfig});var s;return r.inputView.set({id:n,ariaDescribedById:i}),r.bind("isReadOnly").to(t,"isEnabled",(e=>!e)),r.bind("hasError").to(t,"errorText",(e=>!!e)),r.on("input",(()=>{t.errorText=null})),t.bind("isEmpty","isFocused").to(r),r}}function vB(e){const t=parseFloat(e);return!Number.isNaN(t)&&e===String(t)}class yB extends Lb{children;constructor(e,t={}){super(e);const n=this.bindTemplate;this.set("class",t.class||null),this.children=this.createCollection(),t.children&&t.children.forEach((e=>this.children.add(e))),this.set("_role",null),this.set("_ariaLabelledBy",null),t.labelView&&this.set({_role:"group",_ariaLabelledBy:t.labelView.id}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__row",n.to("class")],role:n.to("_role"),"aria-labelledby":n.to("_ariaLabelledBy")},children:this.children})}}class _B extends Lb{options;focusTracker;keystrokes;children;borderStyleDropdown;borderWidthInput;borderColorInput;backgroundInput;paddingInput;widthInput;heightInput;horizontalAlignmentToolbar;verticalAlignmentToolbar;saveButtonView;cancelButtonView;_focusables;_focusCycler;constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=t;const{borderStyleDropdown:n,borderWidthInput:i,borderColorInput:r,borderRowLabel:s}=this._createBorderFields(),{backgroundRowLabel:o,backgroundInput:a}=this._createBackgroundFields(),{widthInput:l,operatorLabel:c,heightInput:d,dimensionsLabel:u}=this._createDimensionFields(),{horizontalAlignmentToolbar:h,verticalAlignmentToolbar:m,alignmentLabel:g}=this._createAlignmentFields();this.focusTracker=new lc,this.keystrokes=new hc,this.children=this.createCollection(),this.borderStyleDropdown=n,this.borderWidthInput=i,this.borderColorInput=r,this.backgroundInput=a,this.paddingInput=this._createPaddingField(),this.widthInput=l,this.heightInput=d,this.horizontalAlignmentToolbar=h,this.verticalAlignmentToolbar=m;const{saveButtonView:p,cancelButtonView:f}=this._createActionButtons();this.saveButtonView=p,this.cancelButtonView=f,this._focusables=new mb,this._focusCycler=new Ub({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Wb(e,{label:this.t("Cell properties")})),this.children.add(new yB(e,{labelView:s,children:[s,n,r,i],class:"ck-table-form__border-row"})),this.children.add(new yB(e,{labelView:o,children:[o,a],class:"ck-table-form__background-row"})),this.children.add(new yB(e,{children:[new yB(e,{labelView:u,children:[u,l,c,d],class:"ck-table-form__dimensions-row"}),new yB(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new yB(e,{labelView:g,children:[g,h,m],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new yB(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-cell-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),Fb({view:this}),[this.borderColorInput,this.backgroundInput].forEach((e=>{this._focusCycler.chain(e.fieldView.focusCycler)})),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.paddingInput,this.horizontalAlignmentToolbar,this.verticalAlignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=this.options.defaultTableCellProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},n=wB({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),i=this.locale,r=this.t,s=r("Style"),o=new ow(i);o.text=r("Border");const a=cB(r),l=new Ew(i,av);l.set({label:s,class:"ck-table-form__border-style"}),l.fieldView.buttonView.set({ariaLabel:s,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:s}),l.fieldView.buttonView.bind("label").to(this,"borderStyle",(e=>a[e||"none"])),l.fieldView.on("execute",(e=>{this.borderStyle=e.source._borderStyleValue})),l.bind("isEmpty").to(this,"borderStyle",(e=>!e)),ev(l.fieldView,pB(this,t.style),{role:"menu",ariaLabel:s});const c=new Ew(i,sv);c.set({label:r("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",kB),c.fieldView.on("input",(()=>{this.borderWidth=c.fieldView.element.value}));const d=new Ew(i,n);return d.set({label:r("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",kB),d.fieldView.on("input",(()=>{this.borderColor=d.fieldView.value})),this.on("change:borderStyle",((e,n,i,r)=>{kB(i)||(this.borderColor="",this.borderWidth=""),kB(r)||(this.borderColor=t.color,this.borderWidth=t.width)})),{borderRowLabel:o,borderStyleDropdown:l,borderColorInput:d,borderWidthInput:c}}_createBackgroundFields(){const e=this.locale,t=this.t,n=new ow(e);n.text=t("Background");const i=wB({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),r=new Ew(e,i);return r.set({label:t("Color"),class:"ck-table-cell-properties-form__background"}),r.fieldView.bind("value").to(this,"backgroundColor"),r.fieldView.on("input",(()=>{this.backgroundColor=r.fieldView.value})),{backgroundRowLabel:n,backgroundInput:r}}_createDimensionFields(){const e=this.locale,t=this.t,n=new ow(e);n.text=t("Dimensions");const i=new Ew(e,sv);i.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",(()=>{this.width=i.fieldView.element.value}));const r=new Lb(e);r.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const s=new Ew(e,sv);return s.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),s.fieldView.bind("value").to(this,"height"),s.fieldView.on("input",(()=>{this.height=s.fieldView.element.value})),{dimensionsLabel:n,widthInput:i,operatorLabel:r,heightInput:s}}_createPaddingField(){const e=this.locale,t=this.t,n=new Ew(e,sv);return n.set({label:t("Padding"),class:"ck-table-cell-properties-form__padding"}),n.fieldView.bind("value").to(this,"padding"),n.fieldView.on("input",(()=>{this.padding=n.fieldView.element.value})),n}_createAlignmentFields(){const e=this.locale,t=this.t,n=new ow(e),i={left:Pf.alignLeft,center:Pf.alignCenter,right:Pf.alignRight,justify:Pf.alignJustify,top:Pf.alignTop,middle:Pf.alignMiddle,bottom:Pf.alignBottom};n.text=t("Table cell text alignment");const r=new qw(e),s="rtl"===e.contentLanguageDirection;r.set({isCompact:!0,role:"radiogroup",ariaLabel:t("Horizontal text alignment toolbar")}),fB({view:this,icons:i,toolbar:r,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:e=>{if(s){if("left"===e)return"right";if("right"===e)return"left"}return e},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});const o=new qw(e);return o.set({isCompact:!0,role:"radiogroup",ariaLabel:t("Vertical text alignment toolbar")}),fB({view:this,icons:i,toolbar:o,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:r,verticalAlignmentToolbar:o,alignmentLabel:n}}_createActionButtons(){const e=this.locale,t=this.t,n=new jb(e),i=new jb(e),r=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return n.set({label:t("Save"),icon:Pf.check,class:"ck-button-save",type:"submit",withText:!0}),n.bind("isEnabled").toMany(r,"errorText",((...e)=>e.every((e=>!e)))),i.set({label:t("Cancel"),icon:Pf.cancel,class:"ck-button-cancel",withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:n,cancelButtonView:i}}get _horizontalAlignmentLabels(){const e=this.locale,t=this.t,n=t("Align cell text to the left"),i=t("Align cell text to the center"),r=t("Align cell text to the right"),s=t("Justify cell text");return"rtl"===e.uiLanguageDirection?{right:r,center:i,left:n,justify:s}:{left:n,center:i,right:r,justify:s}}get _verticalAlignmentLabels(){const e=this.t;return{top:e("Align cell text to the top"),middle:e("Align cell text to the middle"),bottom:e("Align cell text to the bottom")}}}function kB(e){return"none"!==e}const xB=(()=>[zw.defaultPositions.northArrowSouth,zw.defaultPositions.northArrowSouthWest,zw.defaultPositions.northArrowSouthEast,zw.defaultPositions.southArrowNorth,zw.defaultPositions.southArrowNorthWest,zw.defaultPositions.southArrowNorthEast,zw.defaultPositions.viewportStickyNorth])();function CB(e,t){const n=e.plugins.get("ContextualBalloon"),i=e.editing.view.document.selection;let r;"cell"===t?iB(i)&&(r=EB(e)):tB(i)&&(r=AB(e)),r&&n.updatePosition(r)}function AB(e){const t=LL(e.model.document.selection),n=e.editing.mapper.toViewElement(t);return{target:e.editing.view.domConverter.mapViewToDom(n),positions:xB}}function EB(e){const t=e.editing.mapper,n=e.editing.view.domConverter,i=e.model.document.selection;if(i.rangeCount>1)return{target:()=>function(e,t){const n=t.editing.mapper,i=t.editing.view.domConverter,r=Array.from(e).map((e=>{const t=TB(e.start),r=n.toViewElement(t);return new vl(i.mapViewToDom(r))}));return vl.getBoundingRect(r)}(i.getRanges(),e),positions:xB};const r=TB(i.getFirstPosition()),s=t.toViewElement(r);return{target:n.mapViewToDom(s),positions:xB}}function TB(e){return e.nodeAfter&&e.nodeAfter.is("element","tableCell")?e.nodeAfter:e.findAncestor("tableCell")}function SB(e){if(!e||!or(e))return e;const{top:t,right:n,bottom:i,left:r}=e;return t==n&&n==i&&i==r?t:void 0}function PB(e,t){const n=parseFloat(e);return Number.isNaN(n)||String(n)!==String(e)?e:`${n}${t}`}function IB(e,t={}){const n={borderStyle:"none",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",...e};return t.includeAlignmentProperty&&!n.alignment&&(n.alignment="center"),t.includePaddingProperty&&!n.padding&&(n.padding=""),t.includeVerticalAlignmentProperty&&!n.verticalAlignment&&(n.verticalAlignment="middle"),t.includeHorizontalAlignmentProperty&&!n.horizontalAlignment&&(n.horizontalAlignment=t.isRightToLeftContent?"right":"left"),n}function OB(e,t){return IB({borderStyle:"double",borderColor:"hsl(0, 0%, 70%)",borderWidth:"1px",...e},t)}function VB(e,t){return IB({borderStyle:"solid",borderColor:"hsl(0, 0%, 75%)",borderWidth:"1px",...e},t)}const RB={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",height:"tableCellHeight",width:"tableCellWidth",padding:"tableCellPadding",backgroundColor:"tableCellBackgroundColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"};class NB extends cf{_defaultTableCellProperties;_balloon;view;_undoStepBatch;_isReady;static get requires(){return[sy]}static get pluginName(){return"TableCellPropertiesUI"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("table.tableCellProperties",{borderColors:bB,backgroundColors:bB})}init(){const e=this.editor,t=e.t;this._defaultTableCellProperties=VB(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection}),this._balloon=e.plugins.get(sy),this.view=null,this._isReady=!1,e.ui.componentFactory.add("tableCellProperties",(n=>{const i=new jb(n);i.set({label:t("Cell properties"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.105 18-.17 1H2.5A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1h15A1.5 1.5 0 0 1 19 2.5v9.975l-.85-.124-.15-.302V8h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5h3.105zM2 12h5V8H2v4zm10-4H8v4h4V8zM2 2v5h5V2H2zm0 16h5v-5H2v5zM13 7h5V2h-5v5zM8 2v5h4V2H8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM13 6a1 1 0 0 1 1 1v3.172a2.047 2.047 0 0 0-.293.443l-.858 1.736-1.916.28-.151.027A1.976 1.976 0 0 0 9.315 14H7a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm-1 2H8v4h4V8z"/></svg>',tooltip:!0}),this.listenTo(i,"execute",(()=>this._showView()));const r=Object.values(RB).map((t=>e.commands.get(t)));return i.bind("isEnabled").toMany(r,"isEnabled",((...e)=>e.some((e=>e)))),i}))}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(){const e=this.editor,t=e.config.get("table.tableCellProperties"),n=yw(t.borderColors),i=vw(e.locale,n),r=yw(t.backgroundColors),s=vw(e.locale,r),o=!1!==t.colorPicker,a=new _B(e.locale,{borderColors:i,backgroundColors:s,defaultTableCellProperties:this._defaultTableCellProperties,colorPickerConfig:!!o&&(t.colorPicker||{})}),l=e.t;a.render(),this.listenTo(a,"submit",(()=>{this._hideView()})),this.listenTo(a,"cancel",(()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()})),a.keystrokes.set("Esc",((e,t)=>{this._hideView(),t()})),Mb({emitter:a,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const c=dB(l),d=uB(l);return a.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),a.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:a.borderColorInput,commandName:"tableCellBorderColor",errorText:c,validator:hB})),a.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:a.borderWidthInput,commandName:"tableCellBorderWidth",errorText:d,validator:gB})),a.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:a.paddingInput,commandName:"tableCellPadding",errorText:d,validator:mB})),a.on("change:width",this._getValidatedPropertyChangeCallback({viewField:a.widthInput,commandName:"tableCellWidth",errorText:d,validator:mB})),a.on("change:height",this._getValidatedPropertyChangeCallback({viewField:a.heightInput,commandName:"tableCellHeight",errorText:d,validator:mB})),a.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:a.backgroundInput,commandName:"tableCellBackgroundColor",errorText:c,validator:hB})),a.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),a.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment")),a}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableCellBorderStyle");Object.entries(RB).map((([t,n])=>{const i=this._defaultTableCellProperties[t]||"";return[t,e.get(n).value||i]})).forEach((([e,n])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,n)})),this._isReady=!0}_showView(){const e=this.editor;this.view||(this.view=this._createPropertiesView()),this.listenTo(e.ui,"update",(()=>{this._updateView()})),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:EB(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const e=this.editor;iB(e.editing.view.document.selection)?this._isViewVisible&&CB(e,"cell"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,n,i)=>{this._isReady&&this.editor.execute(e,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:n,validator:i,errorText:r}=e,s=id((()=>{n.errorText=r}),500);return(e,r,o)=>{s.cancel(),this._isReady&&(i(o)?(this.editor.execute(t,{value:o,batch:this._undoStepBatch}),n.errorText=null):s())}}}class LB extends uf{attributeName;_defaultValue;constructor(e,t,n){super(e),this.attributeName=t,this._defaultValue=n}refresh(){const e=this.editor,t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e.model.document.selection);this.isEnabled=!!t.length,this.value=this._getSingleValue(t)}execute(e={}){const{value:t,batch:n}=e,i=this.editor.model,r=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(i.document.selection),s=this._getValueToSet(t);i.enqueueChange(n,(e=>{s?r.forEach((t=>e.setAttribute(this.attributeName,s,t))):r.forEach((t=>e.removeAttribute(this.attributeName,t)))}))}_getAttribute(e){if(!e)return;const t=e.getAttribute(this.attributeName);return t!==this._defaultValue?t:void 0}_getValueToSet(e){if(e!==this._defaultValue)return e}_getSingleValue(e){const t=this._getAttribute(e[0]);return e.every((e=>this._getAttribute(e)===t))?t:void 0}}class MB extends LB{constructor(e,t){super(e,"tableCellWidth",t)}_getValueToSet(e){if((e=PB(e,"px"))!==this._defaultValue)return e}}class BB extends cf{static get pluginName(){return"TableCellWidthEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[zM]}init(){const e=this.editor,t=VB(e.config.get("table.tableCellProperties.defaultProperties"));NL(e.model.schema,e.conversion,{modelAttribute:"tableCellWidth",styleName:"width",defaultValue:t.width}),e.commands.add("tableCellWidth",new MB(e,t.width))}}class FB extends LB{constructor(e,t){super(e,"tableCellPadding",t)}_getAttribute(e){if(!e)return;const t=SB(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){const t=PB(e,"px");if(t!==this._defaultValue)return t}}class DB extends LB{constructor(e,t){super(e,"tableCellHeight",t)}_getValueToSet(e){const t=PB(e,"px");if(t!==this._defaultValue)return t}}class zB extends LB{constructor(e,t){super(e,"tableCellBackgroundColor",t)}}class $B extends LB{constructor(e,t){super(e,"tableCellVerticalAlignment",t)}}class jB extends LB{constructor(e,t){super(e,"tableCellHorizontalAlignment",t)}}class HB extends LB{constructor(e,t){super(e,"tableCellBorderStyle",t)}_getAttribute(e){if(!e)return;const t=SB(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class WB extends LB{constructor(e,t){super(e,"tableCellBorderColor",t)}_getAttribute(e){if(!e)return;const t=SB(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class UB extends LB{constructor(e,t){super(e,"tableCellBorderWidth",t)}_getAttribute(e){if(!e)return;const t=SB(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){const t=PB(e,"px");if(t!==this._defaultValue)return t}}const qB=/^(top|middle|bottom)$/,GB=/^(left|center|right|justify)$/;class KB extends cf{static get pluginName(){return"TableCellPropertiesEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[zM,BB]}init(){const e=this.editor,t=e.model.schema,n=e.conversion;e.config.define("table.tableCellProperties.defaultProperties",{});const i=VB(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection});e.data.addStyleProcessorRules(Dp),function(e,t,n){const i={width:"tableCellBorderWidth",color:"tableCellBorderColor",style:"tableCellBorderStyle"};e.extend("tableCell",{allowAttributes:Object.values(i)}),TL(t,"td",i,n),TL(t,"th",i,n),SL(t,{modelElement:"tableCell",modelAttribute:i.style,styleName:"border-style"}),SL(t,{modelElement:"tableCell",modelAttribute:i.color,styleName:"border-color"}),SL(t,{modelElement:"tableCell",modelAttribute:i.width,styleName:"border-width"})}(t,n,{color:i.borderColor,style:i.borderStyle,width:i.borderWidth}),e.commands.add("tableCellBorderStyle",new HB(e,i.borderStyle)),e.commands.add("tableCellBorderColor",new WB(e,i.borderColor)),e.commands.add("tableCellBorderWidth",new UB(e,i.borderWidth)),NL(t,n,{modelAttribute:"tableCellHeight",styleName:"height",defaultValue:i.height}),e.commands.add("tableCellHeight",new DB(e,i.height)),e.data.addStyleProcessorRules(Qp),NL(t,n,{modelAttribute:"tableCellPadding",styleName:"padding",reduceBoxSides:!0,defaultValue:i.padding}),e.commands.add("tableCellPadding",new FB(e,i.padding)),e.data.addStyleProcessorRules(Fp),NL(t,n,{modelAttribute:"tableCellBackgroundColor",styleName:"background-color",defaultValue:i.backgroundColor}),e.commands.add("tableCellBackgroundColor",new zB(e,i.backgroundColor)),function(e,t,n){e.extend("tableCell",{allowAttributes:["tableCellHorizontalAlignment"]}),t.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellHorizontalAlignment"},view:e=>({key:"style",value:{"text-align":e}})}),t.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"text-align":GB}},model:{key:"tableCellHorizontalAlignment",value:e=>{const t=e.getStyle("text-align");return t===n?null:t}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{align:GB}},model:{key:"tableCellHorizontalAlignment",value:e=>{const t=e.getAttribute("align");return t===n?null:t}}})}(t,n,i.horizontalAlignment),e.commands.add("tableCellHorizontalAlignment",new jB(e,i.horizontalAlignment)),function(e,t,n){e.extend("tableCell",{allowAttributes:["tableCellVerticalAlignment"]}),t.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellVerticalAlignment"},view:e=>({key:"style",value:{"vertical-align":e}})}),t.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"vertical-align":qB}},model:{key:"tableCellVerticalAlignment",value:e=>{const t=e.getStyle("vertical-align");return t===n?null:t}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{valign:qB}},model:{key:"tableCellVerticalAlignment",value:e=>{const t=e.getAttribute("valign");return t===n?null:t}}})}(t,n,i.verticalAlignment),e.commands.add("tableCellVerticalAlignment",new $B(e,i.verticalAlignment))}}class ZB extends cf{static get pluginName(){return"TableCellProperties"}static get isOfficialPlugin(){return!0}static get requires(){return[KB,NB]}}class QB extends uf{attributeName;_defaultValue;constructor(e,t,n){super(e),this.attributeName=t,this._defaultValue=n}refresh(){const e=LL(this.editor.model.document.selection);this.isEnabled=!!e,this.value=this._getValue(e)}execute(e={}){const t=this.editor.model,n=t.document.selection,{value:i,batch:r}=e,s=LL(n),o=this._getValueToSet(i);t.enqueueChange(r,(e=>{o?e.setAttribute(this.attributeName,o,s):e.removeAttribute(this.attributeName,s)}))}_getValue(e){if(!e)return;const t=e.getAttribute(this.attributeName);return t!==this._defaultValue?t:void 0}_getValueToSet(e){if(e!==this._defaultValue)return e}}class YB extends QB{constructor(e,t){super(e,"tableBackgroundColor",t)}}class JB extends QB{constructor(e,t){super(e,"tableBorderColor",t)}_getValue(e){if(!e)return;const t=SB(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class XB extends QB{constructor(e,t){super(e,"tableBorderStyle",t)}_getValue(e){if(!e)return;const t=SB(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class eF extends QB{constructor(e,t){super(e,"tableBorderWidth",t)}_getValue(e){if(!e)return;const t=SB(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){const t=PB(e,"px");if(t!==this._defaultValue)return t}}class tF extends QB{constructor(e,t){super(e,"tableWidth",t)}_getValueToSet(e){if((e=PB(e,"px"))!==this._defaultValue)return e}}class nF extends QB{constructor(e,t){super(e,"tableHeight",t)}_getValueToSet(e){if((e=PB(e,"px"))!==this._defaultValue)return e}}class iF extends QB{constructor(e,t){super(e,"tableAlignment",t)}}const rF=/^(left|center|right)$/,sF=/^(left|none|right)$/;class oF extends cf{static get pluginName(){return"TablePropertiesEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[zM]}init(){const e=this.editor,t=e.model.schema,n=e.conversion;e.config.define("table.tableProperties.defaultProperties",{});const i=OB(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0});e.data.addStyleProcessorRules(Dp),function(e,t,n){const i={width:"tableBorderWidth",color:"tableBorderColor",style:"tableBorderStyle"};e.extend("table",{allowAttributes:Object.values(i)}),TL(t,"table",i,n),PL(t,{modelAttribute:i.color,styleName:"border-color"}),PL(t,{modelAttribute:i.style,styleName:"border-style"}),PL(t,{modelAttribute:i.width,styleName:"border-width"})}(t,n,{color:i.borderColor,style:i.borderStyle,width:i.borderWidth}),e.commands.add("tableBorderColor",new JB(e,i.borderColor)),e.commands.add("tableBorderStyle",new XB(e,i.borderStyle)),e.commands.add("tableBorderWidth",new eF(e,i.borderWidth)),function(e,t,n){e.extend("table",{allowAttributes:["tableAlignment"]}),t.for("downcast").attributeToAttribute({model:{name:"table",key:"tableAlignment"},view:e=>({key:"style",value:{float:"center"===e?"none":e}}),converterPriority:"high"}),t.for("upcast").attributeToAttribute({view:{name:/^(table|figure)$/,styles:{float:sF}},model:{key:"tableAlignment",value:e=>{let t=e.getStyle("float");return"none"===t&&(t="center"),t===n?null:t}}}).attributeToAttribute({view:{attributes:{align:rF}},model:{name:"table",key:"tableAlignment",value:e=>{const t=e.getAttribute("align");return t===n?null:t}}})}(t,n,i.alignment),e.commands.add("tableAlignment",new iF(e,i.alignment)),aF(t,n,{modelAttribute:"tableWidth",styleName:"width",defaultValue:i.width}),e.commands.add("tableWidth",new tF(e,i.width)),aF(t,n,{modelAttribute:"tableHeight",styleName:"height",defaultValue:i.height}),e.commands.add("tableHeight",new nF(e,i.height)),e.data.addStyleProcessorRules(Fp),function(e,t,n){const{modelAttribute:i}=n;e.extend("table",{allowAttributes:[i]}),EL(t,{viewElement:"table",...n}),PL(t,n)}(t,n,{modelAttribute:"tableBackgroundColor",styleName:"background-color",defaultValue:i.backgroundColor}),e.commands.add("tableBackgroundColor",new YB(e,i.backgroundColor))}}function aF(e,t,n){const{modelAttribute:i}=n;e.extend("table",{allowAttributes:[i]}),EL(t,{viewElement:/^(table|figure)$/,shouldUpcast:e=>!("table"==e.name&&"figure"==e.parent.name),...n}),SL(t,{modelElement:"table",...n})}class lF extends Lb{options;focusTracker;keystrokes;children;borderStyleDropdown;borderWidthInput;borderColorInput;backgroundInput;widthInput;heightInput;alignmentToolbar;saveButtonView;cancelButtonView;_focusables;_focusCycler;constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=t;const{borderStyleDropdown:n,borderWidthInput:i,borderColorInput:r,borderRowLabel:s}=this._createBorderFields(),{backgroundRowLabel:o,backgroundInput:a}=this._createBackgroundFields(),{widthInput:l,operatorLabel:c,heightInput:d,dimensionsLabel:u}=this._createDimensionFields(),{alignmentToolbar:h,alignmentLabel:m}=this._createAlignmentFields();this.focusTracker=new lc,this.keystrokes=new hc,this.children=this.createCollection(),this.borderStyleDropdown=n,this.borderWidthInput=i,this.borderColorInput=r,this.backgroundInput=a,this.widthInput=l,this.heightInput=d,this.alignmentToolbar=h;const{saveButtonView:g,cancelButtonView:p}=this._createActionButtons();this.saveButtonView=g,this.cancelButtonView=p,this._focusables=new mb,this._focusCycler=new Ub({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Wb(e,{label:this.t("Table properties")})),this.children.add(new yB(e,{labelView:s,children:[s,n,r,i],class:"ck-table-form__border-row"})),this.children.add(new yB(e,{labelView:o,children:[o,a],class:"ck-table-form__background-row"})),this.children.add(new yB(e,{children:[new yB(e,{labelView:u,children:[u,l,c,d],class:"ck-table-form__dimensions-row"}),new yB(e,{labelView:m,children:[m,h],class:"ck-table-properties-form__alignment-row"})]})),this.children.add(new yB(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),Fb({view:this}),[this.borderColorInput,this.backgroundInput].forEach((e=>{this._focusCycler.chain(e.fieldView.focusCycler)})),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.alignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=this.options.defaultTableProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},n=wB({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),i=this.locale,r=this.t,s=r("Style"),o=new ow(i);o.text=r("Border");const a=cB(r),l=new Ew(i,av);l.set({label:s,class:"ck-table-form__border-style"}),l.fieldView.buttonView.set({ariaLabel:s,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:s}),l.fieldView.buttonView.bind("label").to(this,"borderStyle",(e=>a[e||"none"])),l.fieldView.on("execute",(e=>{this.borderStyle=e.source._borderStyleValue})),l.bind("isEmpty").to(this,"borderStyle",(e=>!e)),ev(l.fieldView,pB(this,t.style),{role:"menu",ariaLabel:s});const c=new Ew(i,sv);c.set({label:r("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",cF),c.fieldView.on("input",(()=>{this.borderWidth=c.fieldView.element.value}));const d=new Ew(i,n);return d.set({label:r("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",cF),d.fieldView.on("input",(()=>{this.borderColor=d.fieldView.value})),this.on("change:borderStyle",((e,n,i,r)=>{cF(i)||(this.borderColor="",this.borderWidth=""),cF(r)||(this.borderColor=t.color,this.borderWidth=t.width)})),{borderRowLabel:o,borderStyleDropdown:l,borderColorInput:d,borderWidthInput:c}}_createBackgroundFields(){const e=this.locale,t=this.t,n=new ow(e);n.text=t("Background");const i=wB({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),r=new Ew(e,i);return r.set({label:t("Color"),class:"ck-table-properties-form__background"}),r.fieldView.bind("value").to(this,"backgroundColor"),r.fieldView.on("input",(()=>{this.backgroundColor=r.fieldView.value})),{backgroundRowLabel:n,backgroundInput:r}}_createDimensionFields(){const e=this.locale,t=this.t,n=new ow(e);n.text=t("Dimensions");const i=new Ew(e,sv);i.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",(()=>{this.width=i.fieldView.element.value}));const r=new Lb(e);r.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const s=new Ew(e,sv);return s.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),s.fieldView.bind("value").to(this,"height"),s.fieldView.on("input",(()=>{this.height=s.fieldView.element.value})),{dimensionsLabel:n,widthInput:i,operatorLabel:r,heightInput:s}}_createAlignmentFields(){const e=this.locale,t=this.t,n=new ow(e);n.text=t("Alignment");const i=new qw(e);return i.set({role:"radiogroup",isCompact:!0,ariaLabel:t("Table alignment toolbar")}),fB({view:this,icons:{left:Pf.objectLeft,center:Pf.objectCenter,right:Pf.objectRight},toolbar:i,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:n,alignmentToolbar:i}}_createActionButtons(){const e=this.locale,t=this.t,n=new jb(e),i=new jb(e),r=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return n.set({label:t("Save"),icon:Pf.check,class:"ck-button-save",type:"submit",withText:!0}),n.bind("isEnabled").toMany(r,"errorText",((...e)=>e.every((e=>!e)))),i.set({label:t("Cancel"),icon:Pf.cancel,class:"ck-button-cancel",withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:n,cancelButtonView:i}}get _alignmentLabels(){const e=this.locale,t=this.t,n=t("Align table to the left"),i=t("Center table"),r=t("Align table to the right");return"rtl"===e.uiLanguageDirection?{right:r,center:i,left:n}:{left:n,center:i,right:r}}}function cF(e){return"none"!==e}const dF={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class uF extends cf{_defaultTableProperties;_balloon;view=null;_undoStepBatch;_isReady;static get requires(){return[sy]}static get pluginName(){return"TablePropertiesUI"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("table.tableProperties",{borderColors:bB,backgroundColors:bB})}init(){const e=this.editor,t=e.t;this._defaultTableProperties=OB(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),this._balloon=e.plugins.get(sy),e.ui.componentFactory.add("tableProperties",(n=>{const i=new jb(n);i.set({label:t("Table properties"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8 2v5h4V2h1v5h5v1h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5H7v-5H2v-1h5V8H2V7h5V2h1zm4 6H8v4h4V8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM17 1a2 2 0 0 1 2 2v9.475l-.85-.124-.857-1.736a2.048 2.048 0 0 0-.292-.44L17 3H3v14h7.808l.402.392L10.935 19H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14z"/></svg>',tooltip:!0}),this.listenTo(i,"execute",(()=>this._showView()));const r=Object.values(dF).map((t=>e.commands.get(t)));return i.bind("isEnabled").toMany(r,"isEnabled",((...e)=>e.some((e=>e)))),i}))}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(){const e=this.editor,t=e.config.get("table.tableProperties"),n=yw(t.borderColors),i=vw(e.locale,n),r=yw(t.backgroundColors),s=vw(e.locale,r),o=!1!==t.colorPicker,a=new lF(e.locale,{borderColors:i,backgroundColors:s,defaultTableProperties:this._defaultTableProperties,colorPickerConfig:!!o&&(t.colorPicker||{})}),l=e.t;a.render(),this.listenTo(a,"submit",(()=>{this._hideView()})),this.listenTo(a,"cancel",(()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()})),a.keystrokes.set("Esc",((e,t)=>{this._hideView(),t()})),Mb({emitter:a,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const c=dB(l),d=uB(l);return a.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),a.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:a.borderColorInput,commandName:"tableBorderColor",errorText:c,validator:hB})),a.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:a.borderWidthInput,commandName:"tableBorderWidth",errorText:d,validator:gB})),a.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:a.backgroundInput,commandName:"tableBackgroundColor",errorText:c,validator:hB})),a.on("change:width",this._getValidatedPropertyChangeCallback({viewField:a.widthInput,commandName:"tableWidth",errorText:d,validator:mB})),a.on("change:height",this._getValidatedPropertyChangeCallback({viewField:a.heightInput,commandName:"tableHeight",errorText:d,validator:mB})),a.on("change:alignment",this._getPropertyChangeCallback("tableAlignment")),a}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableBorderStyle");Object.entries(dF).map((([t,n])=>{const i=t,r=this._defaultTableProperties[i]||"";return[i,e.get(n).value||r]})).forEach((([e,n])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,n)})),this._isReady=!0}_showView(){const e=this.editor;this.view||(this.view=this._createPropertiesView()),this.listenTo(e.ui,"update",(()=>{this._updateView()})),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:AB(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const e=this.editor;tB(e.editing.view.document.selection)?this._isViewVisible&&CB(e,"table"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,n,i)=>{this._isReady&&this.editor.execute(e,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:n,validator:i,errorText:r}=e,s=id((()=>{n.errorText=r}),500);return(e,r,o)=>{s.cancel(),this._isReady&&(i(o)?(this.editor.execute(t,{value:o,batch:this._undoStepBatch}),n.errorText=null):s())}}}class hF extends cf{static get pluginName(){return"TableProperties"}static get isOfficialPlugin(){return!0}static get requires(){return[oF,uF]}}function mF(e){return!!e&&e.is("element","table")}function gF(e){for(const t of e.getChildren())if(t.is("element","caption"))return t;return null}function pF(e){const t=e.parent;return"figcaption"==e.name&&t&&t.is("element","figure")&&t.hasClass("table")||"caption"==e.name&&t&&t.is("element","table")?{name:!0}:null}class fF extends uf{refresh(){const e=LL(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled?this.value=!!gF(e):this.value=!1}execute({focusCaptionOnShow:e=!1}={}){this.editor.model.change((t=>{this.value?this._hideTableCaption(t):this._showTableCaption(t,e)}))}_showTableCaption(e,t){const n=this.editor.model,i=LL(n.document.selection),r=this.editor.plugins.get("TableCaptionEditing")._getSavedCaption(i)||e.createElement("caption");n.insertContent(r,i,"end"),t&&e.setSelection(r,"in")}_hideTableCaption(e){const t=this.editor.model,n=LL(t.document.selection),i=this.editor.plugins.get("TableCaptionEditing"),r=gF(n);i._saveCaption(n,r),t.deleteContent(e.createSelection(r,"on"))}}class bF extends cf{_savedCaptionsMap;static get pluginName(){return"TableCaptionEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),this._savedCaptionsMap=new WeakMap}init(){const e=this.editor,t=e.model.schema,n=e.editing.view,i=e.t;var r;t.isRegistered("caption")?t.extend("caption",{allowIn:"table"}):t.register("caption",{allowIn:"table",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleTableCaption",new fF(this.editor)),e.conversion.for("upcast").elementToElement({view:pF,model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>mF(e.parent)?t.createContainerElement("figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>{if(!mF(e.parent))return null;const r=t.createEditableElement("figcaption");return t.setCustomProperty("tableCaption",!0,r),r.placeholder=i("Enter table caption"),Ad({view:n,element:r,keepOnFocus:!0}),Ek(r,t)}}),(r=e.model).document.registerPostFixer((e=>function(e,t){const n=t.document.differ.getChanges();let i=!1;for(const t of n){if("insert"!=t.type)continue;const n=t.position.parent;if(n.is("element","table")||"table"==t.name){const r="table"==t.name?t.position.nodeAfter:n,s=Array.from(r.getChildren()).filter((e=>e.is("element","caption"))),o=s.shift();if(!o)continue;for(const t of s)e.move(e.createRangeIn(t),o,"end"),e.remove(t);o.nextSibling&&(e.move(e.createRangeOn(o),r,"end"),i=!0),i=!!s.length||i}}return i}(e,r)))}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?qh.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}}class wF extends cf{static get pluginName(){return"TableCaptionUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view,n=e.t;e.ui.componentFactory.add("toggleTableCaption",(i=>{const r=e.commands.get("toggleTableCaption"),s=new jb(i);return s.set({icon:Pf.caption,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.bind("label").to(r,"value",(e=>n(e?"Toggle caption off":"Toggle caption on"))),this.listenTo(s,"execute",(()=>{if(e.execute("toggleTableCaption",{focusCaptionOnShow:!0}),r.value){const n=function(e){const t=LL(e);return t?gF(t):null}(e.model.document.selection),i=e.editing.mapper.toViewElement(n);if(!i)return;t.scrollToTheSelection(),t.change((e=>{e.addClass("table__caption_highlighted",i)}))}e.editing.view.focus()})),s}))}}class vF extends cf{static get pluginName(){return"TableCaption"}static get isOfficialPlugin(){return!0}static get requires(){return[bF,wF]}}class yF extends uf{refresh(){this.isEnabled=!0}execute(e={}){const{model:t,plugins:n}=this.editor;let{table:i=t.document.selection.getSelectedElement(),columnWidths:r,tableWidth:s}=e;r&&(r=Array.isArray(r)?r:r.split(",")),t.change((e=>{s?e.setAttribute("tableWidth",s,i):e.removeAttribute("tableWidth",i);const t=n.get("TableColumnResizeEditing").getColumnGroupElement(i);if(!r&&!t)return;if(!r)return e.remove(t);const o=fM(r);if(t)Array.from(t.getChildren()).forEach(((t,n)=>e.setAttribute("columnWidth",o[n],t)));else{const t=e.createElement("tableColumnGroup");o.forEach((n=>e.appendElement("tableColumn",{columnWidth:n},t))),e.append(t,i)}}))}}class _F extends cf{_isResizingActive;_resizingData;_domEmitter;_tableUtilsPlugin;static get requires(){return[zM,_M]}static get pluginName(){return"TableColumnResizeEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),this._isResizingActive=!1,this.set("_isResizingAllowed",!0),this._resizingData=null,this._domEmitter=new(dl()),this._tableUtilsPlugin=e.plugins.get("TableUtils"),this.on("change:_isResizingAllowed",((t,n,i)=>{const r=i?"removeClass":"addClass";e.editing.view.change((t=>{for(const n of e.editing.view.document.roots)t[r]("ck-column-resize_disabled",e.editing.view.document.getRoot(n.rootName))}))}))}init(){this._extendSchema(),this._registerPostFixer(),this._registerConverters(),this._registerResizingListeners(),this._registerResizerInserter();const e=this.editor,t=e.plugins.get("TableColumnResize");e.plugins.get("TableEditing").registerAdditionalSlot({filter:e=>e.is("element","tableColumnGroup"),positionOffset:0});const n=new yF(e);e.commands.add("resizeTableWidth",n),e.commands.add("resizeColumnWidths",n),this.bind("_isResizingAllowed").to(e,"isReadOnly",t,"isEnabled",n,"isEnabled",((e,t,n)=>!e&&t&&n))}destroy(){this._domEmitter.stopListening(),super.destroy()}getColumnGroupElement(e){return vM(e)}getTableColumnElements(e){return yM(e)}getTableColumnsWidths(e){return function(e){return yM(e).map((e=>e.getAttribute("columnWidth")))}(e)}_extendSchema(){this.editor.model.schema.extend("table",{allowAttributes:["tableWidth"]}),this.editor.model.schema.register("tableColumnGroup",{allowIn:"table",isLimit:!0}),this.editor.model.schema.register("tableColumn",{allowIn:"tableColumnGroup",allowAttributes:["columnWidth","colSpan"],isLimit:!0})}_registerPostFixer(){const e=this.editor.model;function t(e,t,n){const i=n._tableUtilsPlugin.getColumns(t);if(0==i-e.length)return e;const r=e.map((e=>Number(e.replace("%","")))),s=function(e,t){const n=new Set;for(const i of e.getChanges())if("insert"==i.type&&i.position.nodeAfter&&"tableCell"==i.position.nodeAfter.name&&i.position.nodeAfter.getAncestors().includes(t))n.add(i.position.nodeAfter);else if("remove"==i.type){const e=i.position.nodeBefore||i.position.nodeAfter;"tableCell"==e.name&&e.getAncestors().includes(t)&&n.add(e)}return n}(n.editor.model.document.differ,t);for(const e of s){const s=i-r.length;if(0===s)continue;const c=s>0,d=n._tableUtilsPlugin.getCellLocation(e).column;if(c){const e=(l=(o=t,a=n.editor,4e3/uM(o,a)),Array(s).fill(l));r.splice(d,0,...e)}else{const e=r.splice(d,Math.abs(s));r[d]+=pM(e)}}var o,a,l;return r.map((e=>e+"%"))}e.document.registerPostFixer((n=>{let i=!1;for(const r of function(e){const t=new Set;for(const n of e.document.differ.getChanges()){let i=null;switch(n.type){case"insert":i=["table","tableRow","tableCell"].includes(n.name)?n.position:null;break;case"remove":i=["tableRow","tableCell"].includes(n.name)?n.position:null;break;case"attribute":n.range.start.nodeAfter&&(i=["table","tableRow","tableCell"].includes(n.range.start.nodeAfter.name)?n.range.start:null)}if(!i)continue;const r=i.nodeAfter&&i.nodeAfter.is("element","table")?i.nodeAfter:i.findAncestor("table");for(const n of e.createRangeOn(r).getItems())n.is("element","table")&&vM(n)&&t.add(n)}return t}(e)){const e=this.getColumnGroupElement(r),s=this.getTableColumnElements(e),o=this.getTableColumnsWidths(e);let a=fM(o);a=t(a,r,this),kd(o,a)||(wM(s,e,a,n),i=!0)}return i}))}_registerConverters(){const e=this.editor.conversion;var t;e.for("upcast").attributeToAttribute({view:{name:"figure",key:"style",value:{width:/[\s\S]+/}},model:{name:"table",key:"tableWidth",value:e=>e.getStyle("width")}}),e.for("downcast").attributeToAttribute({model:{name:"table",key:"tableWidth"},view:e=>({name:"figure",key:"style",value:{width:e}})}),e.elementToElement({model:"tableColumnGroup",view:"colgroup"}),e.elementToElement({model:"tableColumn",view:"col"}),e.for("downcast").add((e=>e.on("insert:table",((e,t,n)=>{const i=n.writer,r=t.item,s=n.mapper.toViewElement(r),o=s.is("element","table")?s:Array.from(s.getChildren()).find((e=>e.is("element","table")));vM(r)?i.addClass("ck-table-resized",o):i.removeClass("ck-table-resized",o)}),{priority:"low"}))),e.for("upcast").add((t=this._tableUtilsPlugin,e=>e.on("element:colgroup",((e,n,i)=>{const r=n.modelCursor.findAncestor("table"),s=vM(r);if(!s)return;const o=yM(s),a=t.getColumns(r);let l=(c=s,d=i.writer,yM(c).reduce(((e,t)=>{const n=t.getAttribute("columnWidth"),i=t.getAttribute("colSpan");if(!i)return e.push(n),e;for(let t=0;t<i;t++)e.push(n);return d.removeAttribute("colSpan",t),e}),[]));var c,d;l=Array.from({length:a},((e,t)=>l[t]||"auto")),(l.length!=o.length||l.includes("auto"))&&wM(o,s,fM(l),i.writer)}),{priority:"low"}))),e.for("upcast").attributeToAttribute({view:{name:"col",styles:{width:/.*/}},model:{key:"columnWidth",value:e=>{const t=e.getStyle("width");return t&&(t.endsWith("%")||t.endsWith("pt"))?t:"auto"}}}),e.for("upcast").attributeToAttribute({view:{name:"col",key:"span"},model:"colSpan"}),e.for("downcast").attributeToAttribute({model:{name:"tableColumn",key:"columnWidth"},view:e=>({key:"style",value:{width:e}})})}_registerResizingListeners(){const e=this.editor.editing.view;e.addObserver(YM),e.document.on("mousedown",this._onMouseDownHandler.bind(this),{priority:"high"}),this._domEmitter.listenTo(ra.window.document,"mousemove",Yp(this._onMouseMoveHandler.bind(this),50)),this._domEmitter.listenTo(ra.window.document,"mouseup",this._onMouseUpHandler.bind(this))}_onMouseDownHandler(e,t){const n=t.target;if(!n.hasClass("ck-table-column-resizer"))return;if(!this._isResizingAllowed)return;const i=this.editor,r=i.editing.mapper.toModelElement(n.findAncestor("figure"));if(!i.model.canEditAt(r))return;t.preventDefault(),e.stop();const s=function(e,t,n){const i=Array(t.getColumns(e)),r=new FL(e);for(const e of r){const t=n.editing.mapper.toViewElement(e.cell),r=bM(n.editing.view.domConverter.mapViewToDom(t));(!i[e.column]||r<i[e.column])&&(i[e.column]=gM(r))}return i}(r,this._tableUtilsPlugin,i),o=n.findAncestor("table"),a=i.editing.view;Array.from(o.getChildren()).find((e=>e.is("element","colgroup")))||a.change((e=>{!function(e,t,n){const i=e.createContainerElement("colgroup");for(let n=0;n<t.length;n++){const r=e.createEmptyElement("col"),s=`${gM(t[n]/pM(t)*100)}%`;e.setStyle("width",s,r),e.insert(e.createPositionAt(i,"end"),r)}e.insert(e.createPositionAt(n,0),i)}(e,s,o)})),this._isResizingActive=!0,this._resizingData=this._getResizingData(t,s),a.change((e=>function(e,t,n){const i=n.widths.viewFigureWidth/n.widths.viewFigureParentWidth;e.addClass("ck-table-resized",t),e.addClass("ck-table-column-resizer__active",n.elements.viewResizer),e.setStyle("width",`${gM(100*i)}%`,t.findAncestor("figure"))}(e,o,this._resizingData)))}_onMouseMoveHandler(e,t){if(!this._isResizingActive)return;if(!this._isResizingAllowed)return void this._onMouseUpHandler();const{columnPosition:n,flags:{isRightEdge:i,isTableCentered:r,isLtrContent:s},elements:{viewFigure:o,viewLeftColumn:a,viewRightColumn:l},widths:{viewFigureParentWidth:c,tableWidth:d,leftColumnWidth:u,rightColumnWidth:h}}=this._resizingData,m=40-u,g=i?c-d:h-40,p=(s?1:-1)*(i&&r?2:1),f=(b=(t.clientX-n)*p,w=Math.min(m,0),v=Math.max(g,0),gM(b<=w?w:b>=v?v:b));var b,w,v;0!==f&&this.editor.editing.view.change((e=>{const t=gM(100*(u+f)/d);if(e.setStyle("width",`${t}%`,a),i){const t=gM(100*(d+f)/c);e.setStyle("width",`${t}%`,o)}else{const t=gM(100*(h-f)/d);e.setStyle("width",`${t}%`,l)}}))}_onMouseUpHandler(){if(!this._isResizingActive)return;const{viewResizer:e,modelTable:t,viewFigure:n,viewColgroup:i}=this._resizingData.elements,r=this.editor,s=r.editing.view,o=this.getColumnGroupElement(t),a=Array.from(i.getChildren()).filter((e=>e.is("view:element"))),l=o?this.getTableColumnsWidths(o):null,c=a.map((e=>e.getStyle("width"))),d=!kd(l,c),u=t.getAttribute("tableWidth"),h=n.getStyle("width"),m=u!==h;(d||m)&&(this._isResizingAllowed?r.execute("resizeTableWidth",{table:t,tableWidth:`${gM(h)}%`,columnWidths:c}):s.change((e=>{if(l)for(const t of a)e.setStyle("width",l.shift(),t);else e.remove(i);m&&(u?e.setStyle("width",u,n):e.removeStyle("width",n)),l||u||e.removeClass("ck-table-resized",[...n.getChildren()].find((e=>"table"===e.name)))}))),s.change((t=>{t.removeClass("ck-table-column-resizer__active",e)})),this._isResizingActive=!1,this._resizingData=null}_getResizingData(e,t){const n=this.editor,i=e.domEvent.clientX,r=e.target,s=r.findAncestor("td")||r.findAncestor("th"),o=n.editing.mapper.toModelElement(s),a=o.findAncestor("table"),l=function(e,t){const n=t.getCellLocation(e).column;return{leftEdge:n,rightEdge:n+(e.getAttribute("colspan")||1)-1}}(o,this._tableUtilsPlugin).rightEdge,c=l===this._tableUtilsPlugin.getColumns(a)-1,d=!a.hasAttribute("tableAlignment"),u="rtl"!==n.locale.contentLanguageDirection,h=s.findAncestor("table"),m=h.findAncestor("figure"),g=[...h.getChildren()].find((e=>e.is("element","colgroup"))),p=g.getChild(l),f=c?void 0:g.getChild(l+1);return{columnPosition:i,flags:{isRightEdge:c,isTableCentered:d,isLtrContent:u},elements:{viewResizer:r,modelTable:a,viewFigure:m,viewColgroup:g,viewLeftColumn:p,viewRightColumn:f},widths:{viewFigureParentWidth:mM(n.editing.view.domConverter.mapViewToDom(m.parent)),viewFigureWidth:mM(n.editing.view.domConverter.mapViewToDom(m)),tableWidth:uM(a,n),leftColumnWidth:t[l],rightColumnWidth:c?void 0:t[l+1]}}}_registerResizerInserter(){this.editor.conversion.for("editingDowncast").add((e=>{e.on("insert:tableCell",((e,t,n)=>{const i=t.item,r=n.mapper.toViewElement(i),s=n.writer;s.insert(s.createPositionAt(r,"end"),s.createUIElement("div",{class:"ck-table-column-resizer"}))}),{priority:"lowest"})}))}}class kF extends cf{static get requires(){return[_F,BB]}static get pluginName(){return"TableColumnResize"}static get isOfficialPlugin(){return!0}}function xF(e){if(e.is("$text")||e.is("$textProxy"))return e.data;const t=e;let n="",i=null;for(const e of t.getChildren()){const t=xF(e);i&&i.is("element")&&(n+="\n"),n+=t,i=e}return n}class CF extends cf{_config;_outputView;_wordsMatchRegExp;constructor(e){super(e),this.set("characters",0),this.set("words",0),Object.defineProperties(this,{characters:{get(){return this.characters=this._getCharacters(this._getText())}},words:{get(){return this.words=this._getWords(this._getText())}}}),this.set("_wordsLabel",void 0),this.set("_charactersLabel",void 0),this._config=e.config.get("wordCount")||{},this._outputView=void 0,this._wordsMatchRegExp=aa.features.isRegExpUnicodePropertySupported?new RegExp("([\\p{L}\\p{N}]+\\S?)+","gu"):/([a-zA-Z0-9À-ž]+\S?)+/gu}static get pluginName(){return"WordCount"}static get isOfficialPlugin(){return!0}init(){this.editor.model.document.on("change:data",Yp(this._refreshStats.bind(this),250)),"function"==typeof this._config.onUpdate&&this.on("update",((e,t)=>{this._config.onUpdate(t)})),zo(this._config.container)&&this._config.container.appendChild(this.wordCountContainer)}destroy(){this._outputView&&(this._outputView.element.remove(),this._outputView.destroy()),super.destroy()}get wordCountContainer(){const e=this.editor,t=e.t,n=e.config.get("wordCount.displayWords"),i=e.config.get("wordCount.displayCharacters"),r=gb.bind(this,this),s=[];return this._outputView||(this._outputView=new Lb,(n||void 0===n)&&(this.bind("_wordsLabel").to(this,"words",(e=>t("Words: %0",e))),s.push({tag:"div",children:[{text:[r.to("_wordsLabel")]}],attributes:{class:"ck-word-count__words"}})),(i||void 0===i)&&(this.bind("_charactersLabel").to(this,"characters",(e=>t("Characters: %0",e))),s.push({tag:"div",children:[{text:[r.to("_charactersLabel")]}],attributes:{class:"ck-word-count__characters"}})),this._outputView.setTemplate({tag:"div",attributes:{class:["ck","ck-word-count"]},children:s}),this._outputView.render()),this._outputView.element}_getText(){let e="";for(const t of this.editor.model.document.getRoots())""!==e&&(e+="\n"),e+=xF(t);return e}_getCharacters(e){return e.replace(/\n/g,"").length}_getWords(e){return(e.match(this._wordsMatchRegExp)||[]).length}_refreshStats(){const e=this._getText(),t=this.words=this._getWords(e),n=this.characters=this._getCharacters(e);this.fire("update",{words:t,characters:n})}}var AF=o(270);i()(AF.A,{insert:"head",singleton:!1}),AF.A.locals;const EF="GPL";function TF(n){const i=(0,e.useRef)(null),r=(0,e.useRef)(null),[s,o]=(0,e.useState)(!1),{i18n:a}=N();(0,e.useEffect)((()=>(o(!0),()=>o(!1))),[]);const{editorConfig:l}=(0,e.useMemo)((()=>s?{editorConfig:{toolbar:{items:["heading","|","fontSize","fontFamily","fontColor","fontBackgroundColor","|","bold","italic","underline","strikethrough","|","specialCharacters","insertImage","horizontalLine","pageBreak","link","mediaEmbed","insertTable","highlight","htmlEmbed","|","alignment","|","bulletedList","numberedList","todoList","outdent","indent"],shouldNotGroupWhenFull:!1},plugins:[Py,g_,pS,_I,f_,uy,fk,x_,rx,S_,Xx,sA,yA,eE,QA,MA,UA,iS,XT,dE,pE,vE,tS,AE,NS,$S,MS,rP,iP,vP,VP,_S,RP,eP,BP,jP,R_,xI,SI,yO,WO,OR,qR,gN,wN,rE,RR,FN,NP,HN,GN,QN,iL,rL,lL,cL,aL,oL,sL,F_,AL,H_,K_,eB,vF,ZB,kF,hF,sB,GP,o_,eV,X_,CF],balloonToolbar:["bold","italic","|","link","insertImage","|","bulletedList","numberedList"],extraPlugins:n.extraPlugins,mediaEmbed:{previewsInData:!0,providers:[{name:"youtube",url:/^https:\/\/www\.youtube\.com\/watch\?v=([\w-]+)/,html:e=>`<div style="position: relative; padding-bottom: 56.25%; height: 0;"><iframe src="https://www.youtube.com/embed/${e[1]}" style="position: absolute; width: 100%; height: 100%; left: 0;" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></div>`}]},fontFamily:{options:n.fontFamily||["Default","Arial","Courier New","Inter","Roboto","Times New Roman","Source Serif 4"],supportAllValues:!0},fontSize:{options:n.fontSize||[10,12,14,"default",18,20,22,24],supportAllValues:!0},fontColor:{columns:6,colors:n.fontColors||[{color:"var(--neutral-text-title-color)",label:"title"},{color:"var(--neutral-text-subtitle-color)",label:"subtitle"},{color:"var(--neutral-text-body-color)",label:"body"},{color:"var(--neutral-text-placeholder-color)",label:"placeholder"},{color:"var(--neutral-text-disabled-color)",label:"disabled"},{color:"var(--neutral-text-stable-color)",label:"stable"},{color:"var(--primary-main-color)",label:"primay"},{color:"var(--warning-main-color)",label:"warning"},{color:"var(--success-main-color)",label:"success"},{color:"var(--secondary3-main-color)",label:"secondary3"},{color:"var(--secondary4-main-color)",label:"secondary4"},{color:"var(--secondary5-main-color)",label:"secondary5"},{color:"var(--infor-main-color)",label:"infor"},{color:"var(--error-main-color)",label:"error"}]},fontBackgroundColor:{columns:6,colors:n.fontBgColors||[{color:"var(--neutral-main-background-color)",label:"main"},{color:"var(--neutral-main-reverse-background-color)",label:"main-reverse"},{color:"var(--neutral-absolute-background-color)",label:"absolute"},{color:"var(--neutral-absolute-reverse-background-color)",label:"absolute-reverse"},{color:"var(--primary-background)",label:"primay-bg"},{color:"var(--warning-background)",label:"warning-bg"},{color:"var(--success-background)",label:"success-bg"},{color:"var(--secondary3-background)",label:"secondary3-bg"},{color:"var(--secondary4-background)",label:"secondary4-bg"},{color:"var(--secondary5-background)",label:"secondary5-bg"},{color:"var(--infor-background)",label:"infor-bg"},{color:"var(--error-background)",label:"error-bg"}]},heading:{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h1",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h2",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h3",title:"Heading 3",class:"ck-heading_heading3"},{model:"heading4",view:"h4",title:"Heading 4",class:"ck-heading_heading4"},{model:"heading5",view:"h5",title:"Heading 5",class:"ck-heading_heading5"},{model:"heading6",view:"h6",title:"Heading 6",class:"ck-heading_heading6"}]},htmlSupport:{allow:[{name:/^.*$/,styles:!0,attributes:!0,classes:!0}]},image:{toolbar:["toggleImageCaption","imageTextAlternative","|","imageStyle:inline","imageStyle:wrapText","imageStyle:breakText","|","resizeImage"]},language:"vi",licenseKey:EF,link:{addTargetToExternalLinks:!0,defaultProtocol:"https://",decorators:{toggleDownloadable:{mode:"manual",label:"Downloadable",attributes:{download:"file"}}}},menuBar:{isVisible:n.menuBar},placeholder:n.placeholder,table:{contentToolbar:["tableColumn","tableRow","mergeTableCells","tableProperties","tableCellProperties"]}}}:{}),[s,a.language]);return t().createElement("div",{ref:i,className:`col editor-container editor-container_classic-editor editor-container_include-style ${n.className??""} ${n.helperText?.length?"helper-text":""}`,"helper-text":n.helperText,style:n.style?{"--helper-text-color":n.helperTextColor??"#e14337",...n.style}:{"--helper-text-color":n.helperTextColor??"#e14337"}},t().createElement("div",{className:"editor-container__editor"},t().createElement("div",{ref:r},l&&t().createElement(ir,{onReady:n.onReady,onAfterDestroy:n.onAfterDestroy,onFocus:n.onFocus,onChange:n.onChange,onBlur:n.onBlur,editor:nC,onError:n.onError,config:l,data:n.value,disabled:n.disabled}))))}const SF=e=>"string"==typeof e,PF=()=>{let e,t;const n=new Promise(((n,i)=>{e=n,t=i}));return n.resolve=e,n.reject=t,n},IF=e=>null==e?"":""+e,OF=/###/g,VF=e=>e&&e.indexOf("###")>-1?e.replace(OF,"."):e,RF=e=>!e||SF(e),NF=(e,t,n)=>{const i=SF(t)?t.split("."):t;let r=0;for(;r<i.length-1;){if(RF(e))return{};const t=VF(i[r]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++r}return RF(e)?{}:{obj:e,k:VF(i[r])}},LF=(e,t,n)=>{const{obj:i,k:r}=NF(e,t,Object);if(void 0!==i||1===t.length)return void(i[r]=n);let s=t[t.length-1],o=t.slice(0,t.length-1),a=NF(e,o,Object);for(;void 0===a.obj&&o.length;)s=`${o[o.length-1]}.${s}`,o=o.slice(0,o.length-1),a=NF(e,o,Object),a?.obj&&void 0!==a.obj[`${a.k}.${s}`]&&(a.obj=void 0);a.obj[`${a.k}.${s}`]=n},MF=(e,t)=>{const{obj:n,k:i}=NF(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,i))return n[i]},BF=(e,t,n)=>{for(const i in t)"__proto__"!==i&&"constructor"!==i&&(i in e?SF(e[i])||e[i]instanceof String||SF(t[i])||t[i]instanceof String?n&&(e[i]=t[i]):BF(e[i],t[i],n):e[i]=t[i]);return e},FF=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var DF={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const zF=e=>SF(e)?e.replace(/[&<>"'\/]/g,(e=>DF[e])):e,$F=[" ",",","?","!",";"],jF=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}(20),HF=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}const i=t.split(n);let r=e;for(let e=0;e<i.length;){if(!r||"object"!=typeof r)return;let t,s="";for(let o=e;o<i.length;++o)if(o!==e&&(s+=n),s+=i[o],t=r[s],void 0!==t){if(["string","number","boolean"].indexOf(typeof t)>-1&&o<i.length-1)continue;e+=o-e+1;break}r=t}return r},WF=e=>e?.replace("_","-"),UF={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class qF{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||UF,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}warn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}error(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}deprecate(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,n,i){return i&&!this.debug?null:(SF(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new qF(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new qF(this.logger,e)}}var GF=new qF;class KF{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach((e=>{this.observers[e]||(this.observers[e]=new Map);const n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)})),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];this.observers[e]&&Array.from(this.observers[e].entries()).forEach((e=>{let[t,i]=e;for(let e=0;e<i;e++)t(...n)})),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach((t=>{let[i,r]=t;for(let t=0;t<r;t++)i.apply(i,[e,...n])}))}}class ZF extends KF{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,s=void 0!==i.ignoreJSONStructure?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let o;e.indexOf(".")>-1?o=e.split("."):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):SF(n)&&r?o.push(...n.split(r)):o.push(n)));const a=MF(this.data,o);return!a&&!t&&!n&&e.indexOf(".")>-1&&(e=o[0],t=o[1],n=o.slice(2).join(".")),!a&&s&&SF(n)?HF(this.data?.[e]?.[t],n,r):a}addResource(e,t,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1};const s=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator;let o=[e,t];n&&(o=o.concat(s?n.split(s):n)),e.indexOf(".")>-1&&(o=e.split("."),i=t,t=o[1]),this.addNamespaces(t),LF(this.data,o,i),r.silent||this.emit("added",e,t,n,i)}addResources(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(const i in n)(SF(n[i])||Array.isArray(n[i]))&&this.addResource(e,t,i,n[i],{silent:!0});i.silent||this.emit("added",e,t,n)}addResourceBundle(e,t,n,i,r){let s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1,skipCopy:!1},o=[e,t];e.indexOf(".")>-1&&(o=e.split("."),i=n,n=t,t=o[1]),this.addNamespaces(t);let a=MF(this.data,o)||{};s.skipCopy||(n=JSON.parse(JSON.stringify(n))),i?BF(a,n,r):a={...a,...n},LF(this.data,o,a),s.silent||this.emit("added",e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((e=>t[e]&&Object.keys(t[e]).length>0))}toJSON(){return this.data}}var QF={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,i,r){return e.forEach((e=>{t=this.processors[e]?.process(t,n,i,r)??t})),t}};const YF={},JF=e=>!SF(e)&&"boolean"!=typeof e&&"number"!=typeof e;class XF extends KF{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n,i;super(),n=e,i=this,["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"].forEach((e=>{n[e]&&(i[e]=n[e])})),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=GF.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;const n=this.resolve(e,t);return void 0!==n?.res}extractFromKey(e,t){let n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");const i=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let r=t.ns||this.options.defaultNS||[];const s=n&&e.indexOf(n)>-1,o=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||((e,t,n)=>{t=t||"",n=n||"";const i=$F.filter((e=>t.indexOf(e)<0&&n.indexOf(e)<0));if(0===i.length)return!0;const r=jF.getRegExp(`(${i.map((e=>"?"===e?"\\?":e)).join("|")})`);let s=!r.test(e);if(!s){const t=e.indexOf(n);t>0&&!r.test(e.substring(0,t))&&(s=!0)}return s})(e,n,i));if(s&&!o){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:SF(r)?[r]:r};const s=e.split(n);(n!==i||n===i&&this.options.ns.indexOf(s[0])>-1)&&(r=s.shift()),e=s.join(i)}return{key:e,namespaces:SF(r)?[r]:r}}translate(e,t,n){if("object"!=typeof t&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof t&&(t={...t}),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);const i=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,{key:s,namespaces:o}=this.extractFromKey(e[e.length-1],t),a=o[o.length-1],l=t.lng||this.language,c=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if("cimode"===l?.toLowerCase()){if(c){const e=t.nsSeparator||this.options.nsSeparator;return i?{res:`${a}${e}${s}`,usedKey:s,exactUsedKey:s,usedLng:l,usedNS:a,usedParams:this.getUsedParamsDetails(t)}:`${a}${e}${s}`}return i?{res:s,usedKey:s,exactUsedKey:s,usedLng:l,usedNS:a,usedParams:this.getUsedParamsDetails(t)}:s}const d=this.resolve(e,t);let u=d?.res;const h=d?.usedKey||s,m=d?.exactUsedKey||s,g=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,p=!this.i18nFormat||this.i18nFormat.handleAsObject,f=void 0!==t.count&&!SF(t.count),b=XF.hasDefaultValue(t),w=f?this.pluralResolver.getSuffix(l,t.count,t):"",v=t.ordinal&&f?this.pluralResolver.getSuffix(l,t.count,{ordinal:!1}):"",y=f&&!t.ordinal&&0===t.count,_=y&&t[`defaultValue${this.options.pluralSeparator}zero`]||t[`defaultValue${w}`]||t[`defaultValue${v}`]||t.defaultValue;let k=u;p&&!u&&b&&(k=_);const x=JF(k),C=Object.prototype.toString.apply(k);if(!(p&&k&&x&&["[object Number]","[object Function]","[object RegExp]"].indexOf(C)<0)||SF(g)&&Array.isArray(k))if(p&&SF(g)&&Array.isArray(u))u=u.join(g),u&&(u=this.extendTranslation(u,e,t,n));else{let i=!1,o=!1;!this.isValidLookup(u)&&b&&(i=!0,u=_),this.isValidLookup(u)||(o=!0,u=s);const c=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&o?void 0:u,h=b&&_!==u&&this.options.updateMissing;if(o||i||h){if(this.logger.log(h?"updateKey":"missingKey",l,a,s,h?_:u),r){const e=this.resolve(s,{...t,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const n=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&n&&n[0])for(let t=0;t<n.length;t++)e.push(n[t]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(t.lng||this.language):e.push(t.lng||this.language);const i=(e,n,i)=>{const r=b&&i!==u?i:c;this.options.missingKeyHandler?this.options.missingKeyHandler(e,a,n,r,h,t):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,a,n,r,h,t),this.emit("missingKey",e,a,n,u)};this.options.saveMissing&&(this.options.saveMissingPlurals&&f?e.forEach((e=>{const n=this.pluralResolver.getSuffixes(e,t);y&&t[`defaultValue${this.options.pluralSeparator}zero`]&&n.indexOf(`${this.options.pluralSeparator}zero`)<0&&n.push(`${this.options.pluralSeparator}zero`),n.forEach((n=>{i([e],s+n,t[`defaultValue${n}`]||_)}))})):i(e,s,_))}u=this.extendTranslation(u,e,t,d,n),o&&u===s&&this.options.appendNamespaceToMissingKey&&(u=`${a}:${s}`),(o||i)&&this.options.parseMissingKeyHandler&&(u=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${a}:${s}`:s,i?u:void 0))}else{if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,k,{...t,ns:o}):`key '${s} (${this.language})' returned an object instead of string.`;return i?(d.res=e,d.usedParams=this.getUsedParamsDetails(t),d):e}if(r){const e=Array.isArray(k),n=e?[]:{},i=e?m:h;for(const e in k)if(Object.prototype.hasOwnProperty.call(k,e)){const s=`${i}${r}${e}`;n[e]=b&&!u?this.translate(s,{...t,defaultValue:JF(_)?_[e]:void 0,joinArrays:!1,ns:o}):this.translate(s,{...t,joinArrays:!1,ns:o}),n[e]===s&&(n[e]=k[e])}u=n}}return i?(d.res=u,d.usedParams=this.getUsedParamsDetails(t),d):u}extendTranslation(e,t,n,i,r){var s=this;if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const o=SF(e)&&(void 0!==n?.interpolation?.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let a;if(o){const t=e.match(this.interpolator.nestingRegexp);a=t&&t.length}let l=n.replace&&!SF(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),e=this.interpolator.interpolate(e,l,n.lng||this.language||i.usedLng,n),o){const t=e.match(this.interpolator.nestingRegexp);a<(t&&t.length)&&(n.nest=!1)}!n.lng&&i&&i.res&&(n.lng=this.language||i.usedLng),!1!==n.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,i=new Array(e),o=0;o<e;o++)i[o]=arguments[o];return r?.[0]!==i[0]||n.context?s.translate(...i,t):(s.logger.warn(`It seems you are nesting recursively key: ${i[0]} in key: ${t[0]}`),null)}),n)),n.interpolation&&this.interpolator.reset()}const o=n.postProcess||this.options.postProcess,a=SF(o)?[o]:o;return null!=e&&a?.length&&!1!==n.applyPostProcessor&&(e=QF.handle(a,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e){let t,n,i,r,s,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return SF(e)&&(e=[e]),e.forEach((e=>{if(this.isValidLookup(t))return;const a=this.extractFromKey(e,o),l=a.key;n=l;let c=a.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));const d=void 0!==o.count&&!SF(o.count),u=d&&!o.ordinal&&0===o.count,h=void 0!==o.context&&(SF(o.context)||"number"==typeof o.context)&&""!==o.context,m=o.lngs?o.lngs:this.languageUtils.toResolveHierarchy(o.lng||this.language,o.fallbackLng);c.forEach((e=>{this.isValidLookup(t)||(s=e,YF[`${m[0]}-${e}`]||!this.utils?.hasLoadedNamespace||this.utils?.hasLoadedNamespace(s)||(YF[`${m[0]}-${e}`]=!0,this.logger.warn(`key "${n}" for languages "${m.join(", ")}" won't get resolved as namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),m.forEach((n=>{if(this.isValidLookup(t))return;r=n;const s=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(s,l,n,e,o);else{let e;d&&(e=this.pluralResolver.getSuffix(n,o.count,o));const t=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(s.push(l+e),o.ordinal&&0===e.indexOf(i)&&s.push(l+e.replace(i,this.options.pluralSeparator)),u&&s.push(l+t)),h){const n=`${l}${this.options.contextSeparator}${o.context}`;s.push(n),d&&(s.push(n+e),o.ordinal&&0===e.indexOf(i)&&s.push(n+e.replace(i,this.options.pluralSeparator)),u&&s.push(n+t))}}let a;for(;a=s.pop();)this.isValidLookup(t)||(i=a,t=this.getResource(n,e,a,o))})))}))})),{res:t,usedKey:n,exactUsedKey:i,usedLng:r,usedNS:s}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,i):this.resourceStore.getResource(e,t,n,i)}getUsedParamsDetails(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!SF(e.replace);let i=n?e.replace:e;if(n&&void 0!==e.count&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!n){i={...i};for(const e of t)delete i[e]}return i}static hasDefaultValue(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&"defaultValue"===t.substring(0,12)&&void 0!==e[t])return!0;return!1}}class eD{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=GF.create("languageUtils")}getScriptPartFromCode(e){if(!(e=WF(e))||e.indexOf("-")<0)return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=WF(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(SF(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(e){}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach((e=>{if(t)return;const n=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(n)||(t=n)})),!t&&this.options.supportedLngs&&e.forEach((e=>{if(t)return;const n=this.getLanguagePartFromCode(e);if(this.isSupportedCode(n))return t=n;t=this.options.supportedLngs.find((e=>e===n?e:e.indexOf("-")<0&&n.indexOf("-")<0?void 0:e.indexOf("-")>0&&n.indexOf("-")<0&&e.substring(0,e.indexOf("-"))===n||0===e.indexOf(n)&&n.length>1?e:void 0))})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),SF(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}toResolveHierarchy(e,t){const n=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],r=e=>{e&&(this.isSupportedCode(e)?i.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return SF(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&r(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&r(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&r(this.getLanguagePartFromCode(e))):SF(e)&&r(this.formatLanguageCode(e)),n.forEach((e=>{i.indexOf(e)<0&&r(this.formatLanguageCode(e))})),i}}const tD={zero:0,one:1,two:2,few:3,many:4,other:5},nD={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class iD{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=GF.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=WF("dev"===e?"en":e),i=t.ordinal?"ordinal":"cardinal",r=JSON.stringify({cleanedCode:n,type:i});if(r in this.pluralRulesCache)return this.pluralRulesCache[r];let s;try{s=new Intl.PluralRules(n,{type:i})}catch(n){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),nD;if(!e.match(/-|_/))return nD;const i=this.languageUtils.getLanguagePartFromCode(e);s=this.getRule(i,t)}return this.pluralRulesCache[r]=s,s}needsPlural(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,t);return n||(n=this.getRule("dev",t)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map((e=>`${t}${e}`))}getSuffixes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,t);return n||(n=this.getRule("dev",t)),n?n.resolvedOptions().pluralCategories.sort(((e,t)=>tD[e]-tD[t])).map((e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`)):[]}getSuffix(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=this.getRule(e,n);return i?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,n))}}const rD=function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=((e,t,n)=>{const i=MF(e,n);return void 0!==i?i:MF(t,n)})(e,t,n);return!s&&r&&SF(n)&&(s=HF(e,n,i),void 0===s&&(s=HF(t,n,i))),s},sD=e=>e.replace(/\$/g,"$$$$");class oD{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=GF.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:n,useRawValueToEscape:i,prefix:r,prefixEscaped:s,suffix:o,suffixEscaped:a,formatSeparator:l,unescapeSuffix:c,unescapePrefix:d,nestingPrefix:u,nestingPrefixEscaped:h,nestingSuffix:m,nestingSuffixEscaped:g,nestingOptionsSeparator:p,maxReplaces:f,alwaysFormat:b}=e.interpolation;this.escape=void 0!==t?t:zF,this.escapeValue=void 0===n||n,this.useRawValueToEscape=void 0!==i&&i,this.prefix=r?FF(r):s||"{{",this.suffix=o?FF(o):a||"}}",this.formatSeparator=l||",",this.unescapePrefix=c?"":d||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=u?FF(u):h||FF("$t("),this.nestingSuffix=m?FF(m):g||FF(")"),this.nestingOptionsSeparator=p||",",this.maxReplaces=f||1e3,this.alwaysFormat=void 0!==b&&b,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,t,n,i){let r,s,o;const a=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(e.indexOf(this.formatSeparator)<0){const r=rD(t,a,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(r,void 0,n,{...i,...t,interpolationkey:e}):r}const r=e.split(this.formatSeparator),s=r.shift().trim(),o=r.join(this.formatSeparator).trim();return this.format(rD(t,a,s,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...i,...t,interpolationkey:s})};this.resetRegExp();const c=i?.missingInterpolationHandler||this.options.missingInterpolationHandler,d=void 0!==i?.interpolation?.skipOnVariables?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>sD(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?sD(this.escape(e)):sD(e)}].forEach((t=>{for(o=0;r=t.regex.exec(e);){const n=r[1].trim();if(s=l(n),void 0===s)if("function"==typeof c){const t=c(e,r,i);s=SF(t)?t:""}else if(i&&Object.prototype.hasOwnProperty.call(i,n))s="";else{if(d){s=r[0];continue}this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),s=""}else SF(s)||this.useRawValueToEscape||(s=IF(s));const a=t.safeValue(s);if(e=e.replace(r[0],a),d?(t.regex.lastIndex+=s.length,t.regex.lastIndex-=r[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}})),e}nest(e,t){let n,i,r,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=(e,t)=>{const n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;const i=e.split(new RegExp(`${n}[ ]*{`));let s=`{${i[1]}`;e=i[0],s=this.interpolate(s,r);const o=s.match(/'/g),a=s.match(/"/g);((o?.length??0)%2==0&&!a||a.length%2!=0)&&(s=s.replace(/'/g,'"'));try{r=JSON.parse(s),t&&(r={...t,...r})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${s}`}return r.defaultValue&&r.defaultValue.indexOf(this.prefix)>-1&&delete r.defaultValue,e};for(;n=this.nestingRegexp.exec(e);){let a=[];r={...s},r=r.replace&&!SF(r.replace)?r.replace:r,r.applyPostProcessor=!1,delete r.defaultValue;let l=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){const e=n[1].split(this.formatSeparator).map((e=>e.trim()));n[1]=e.shift(),a=e,l=!0}if(i=t(o.call(this,n[1].trim(),r),r),i&&n[0]===e&&!SF(i))return i;SF(i)||(i=IF(i)),i||(this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`),i=""),l&&(i=a.reduce(((e,t)=>this.format(e,t,s.lng,{...s,interpolationkey:n[1].trim()})),i.trim())),e=e.replace(n[0],i),this.regexp.lastIndex=0}return e}}const aD=e=>{const t={};return(n,i,r)=>{let s=r;r&&r.interpolationkey&&r.formatParams&&r.formatParams[r.interpolationkey]&&r[r.interpolationkey]&&(s={...s,[r.interpolationkey]:void 0});const o=i+JSON.stringify(s);let a=t[o];return a||(a=e(WF(i),r),t[o]=a),a(n)}};class lD{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=GF.create("formatter"),this.options=e,this.formats={number:aD(((e,t)=>{const n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)})),currency:aD(((e,t)=>{const n=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>n.format(e)})),datetime:aD(((e,t)=>{const n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)})),relativetime:aD(((e,t)=>{const n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||"day")})),list:aD(((e,t)=>{const n=new Intl.ListFormat(e,{...t});return e=>n.format(e)}))},this.init(e)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};this.formatSeparator=t.interpolation.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=aD(t)}format(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=t.split(this.formatSeparator);if(r.length>1&&r[0].indexOf("(")>1&&r[0].indexOf(")")<0&&r.find((e=>e.indexOf(")")>-1))){const e=r.findIndex((e=>e.indexOf(")")>-1));r[0]=[r[0],...r.splice(1,e)].join(this.formatSeparator)}return r.reduce(((e,t)=>{const{formatName:r,formatOptions:s}=(e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const i=e.split("(");t=i[0].toLowerCase().trim();const r=i[1].substring(0,i[1].length-1);"currency"===t&&r.indexOf(":")<0?n.currency||(n.currency=r.trim()):"relativetime"===t&&r.indexOf(":")<0?n.range||(n.range=r.trim()):r.split(";").forEach((e=>{if(e){const[t,...i]=e.split(":"),r=i.join(":").trim().replace(/^'+|'+$/g,""),s=t.trim();n[s]||(n[s]=r),"false"===r&&(n[s]=!1),"true"===r&&(n[s]=!0),isNaN(r)||(n[s]=parseInt(r,10))}}))}return{formatName:t,formatOptions:n}})(t);if(this.formats[r]){let t=e;try{const o=i?.formatParams?.[i.interpolationkey]||{},a=o.locale||o.lng||i.locale||i.lng||n;t=this.formats[r](e,a,{...s,...i,...o})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${r}`),e}),e)}}class cD extends KF{constructor(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=i,this.logger=GF.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,i.backend,i)}queueLoad(e,t,n,i){const r={},s={},o={},a={};return e.forEach((e=>{let i=!0;t.forEach((t=>{const o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(1===this.state[o]?void 0===s[o]&&(s[o]=!0):(this.state[o]=1,i=!1,void 0===s[o]&&(s[o]=!0),void 0===r[o]&&(r[o]=!0),void 0===a[t]&&(a[t]=!0)))})),i||(o[e]=!0)})),(Object.keys(r).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(r),pending:Object.keys(s),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(a)}}loaded(e,t,n){const i=e.split("|"),r=i[0],s=i[1];t&&this.emit("failedLoading",r,s,t),!t&&n&&this.store.addResourceBundle(r,s,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);const o={};this.queue.forEach((n=>{((e,t,n)=>{const{obj:i,k:r}=NF(e,t,Object);i[r]=i[r]||[],i[r].push(n)})(n.loaded,[r],s),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach((e=>{o[e]||(o[e]={});const t=n.loaded[e];t.length&&t.forEach((t=>{void 0===o[e][t]&&(o[e][t]=!0)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",o),this.queue=this.queue.filter((e=>!e.done))}read(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,s=arguments.length>5?arguments[5]:void 0;if(!e.length)return s(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:i,wait:r,callback:s});this.readingCalls++;const o=(o,a)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}o&&a&&i<this.maxRetries?setTimeout((()=>{this.read.call(this,e,t,n,i+1,2*r,s)}),r):s(o,a)},a=this.backend[n].bind(this.backend);if(2!==a.length)return a(e,t,o);try{const n=a(e,t);n&&"function"==typeof n.then?n.then((e=>o(null,e))).catch(o):o(null,n)}catch(e){o(e)}}prepareLoading(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();SF(e)&&(e=this.languageUtils.toResolveHierarchy(e)),SF(t)&&(t=[t]);const r=this.queueLoad(e,t,n,i);if(!r.toLoad.length)return r.pending.length||i(),null;r.toLoad.forEach((e=>{this.loadOne(e)}))}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const n=e.split("|"),i=n[0],r=n[1];this.read(i,r,"read",void 0,void 0,((n,s)=>{n&&this.logger.warn(`${t}loading namespace ${r} for language ${i} failed`,n),!n&&s&&this.logger.log(`${t}loaded namespace ${r} for language ${i}`,s),this.loaded(e,n,s)}))}saveMissing(e,t,n,i,r){let s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:()=>{};if(!this.services?.utils?.hasLoadedNamespace||this.services?.utils?.hasLoadedNamespace(t)){if(null!=n&&""!==n){if(this.backend?.create){const a={...s,isUpdate:r},l=this.backend.create.bind(this.backend);if(l.length<6)try{let r;r=5===l.length?l(e,t,n,i,a):l(e,t,n,i),r&&"function"==typeof r.then?r.then((e=>o(null,e))).catch(o):o(null,r)}catch(e){o(e)}else l(e,t,n,i,o,a)}e&&e[0]&&this.store.addResource(e[0],t,n,i)}}else this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")}}const dD=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),SF(e[1])&&(t.defaultValue=e[1]),SF(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const n=e[3]||e[2];Object.keys(n).forEach((e=>{t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),uD=e=>(SF(e.ns)&&(e.ns=[e.ns]),SF(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),SF(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),"boolean"==typeof e.initImmediate&&(e.initAsync=e.initImmediate),e),hD=()=>{};class mD extends KF{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;var n;if(super(),this.options=uD(e),this.services={},this.logger=GF,this.modules={external:[]},n=this,Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach((e=>{"function"==typeof n[e]&&(n[e]=n[e].bind(n))})),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout((()=>{this.init(e,t)}),0)}}init(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,"function"==typeof t&&(n=t,t={}),null==t.defaultNS&&t.ns&&(SF(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const i=dD();this.options={...i,...this.options,...uD(t)},this.options.interpolation={...i.interpolation,...this.options.interpolation},void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator);const r=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let t;this.modules.logger?GF.init(r(this.modules.logger),this.options):GF.init(null,this.options),t=this.modules.formatter?this.modules.formatter:lD;const n=new eD(this.options);this.store=new ZF(this.options.resources,this.options);const s=this.services;s.logger=GF,s.resourceStore=this.store,s.languageUtils=n,s.pluralResolver=new iD(n,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!t||this.options.interpolation.format&&this.options.interpolation.format!==i.interpolation.format||(s.formatter=r(t),s.formatter.init(s,this.options),this.options.interpolation.format=s.formatter.format.bind(s.formatter)),s.interpolator=new oD(this.options),s.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},s.backendConnector=new cD(r(this.modules.backend),s.resourceStore,s,this.options),s.backendConnector.on("*",(function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];e.emit(t,...i)})),this.modules.languageDetector&&(s.languageDetector=r(this.modules.languageDetector),s.languageDetector.init&&s.languageDetector.init(s,this.options.detection,this.options)),this.modules.i18nFormat&&(s.i18nFormat=r(this.modules.i18nFormat),s.i18nFormat.init&&s.i18nFormat.init(this)),this.translator=new XF(this.services,this.options),this.translator.on("*",(function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];e.emit(t,...i)})),this.modules.external.forEach((e=>{e.init&&e.init(this)}))}if(this.format=this.options.interpolation.format,n||(n=hD),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((t=>{this[t]=function(){return e.store[t](...arguments)}})),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((t=>{this[t]=function(){return e.store[t](...arguments),e}}));const s=PF(),o=()=>{const e=(e,t)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),s.resolve(t),n(e,t)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?o():setTimeout(o,0),s}loadResources(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hD;const n=SF(e)?e:this.language;if("function"==typeof e&&(t=e),!this.options.resources||this.options.partialBundledLanguages){if("cimode"===n?.toLowerCase()&&(!this.options.preload||0===this.options.preload.length))return t();const e=[],i=t=>{t&&"cimode"!==t&&this.services.languageUtils.toResolveHierarchy(t).forEach((t=>{"cimode"!==t&&e.indexOf(t)<0&&e.push(t)}))};n?i(n):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((e=>i(e))),this.options.preload?.forEach?.((e=>i(e))),this.services.backendConnector.load(e,this.options.ns,(e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),t(e)}))}else t(null)}reloadResources(e,t,n){const i=PF();return"function"==typeof e&&(n=e,e=void 0),"function"==typeof t&&(n=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),n||(n=hD),this.services.backendConnector.reload(e,t,(e=>{i.resolve(),n(e)})),i}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&QF.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(let e=0;e<this.languages.length;e++){const t=this.languages[e];if(!(["cimode","dev"].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}}changeLanguage(e,t){var n=this;this.isLanguageChangingTo=e;const i=PF();this.emit("languageChanging",e);const r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},s=(e,s)=>{s?(r(s),this.translator.changeLanguage(s),this.isLanguageChangingTo=void 0,this.emit("languageChanged",s),this.logger.log("languageChanged",s)):this.isLanguageChangingTo=void 0,i.resolve((function(){return n.t(...arguments)})),t&&t(e,(function(){return n.t(...arguments)}))},o=t=>{e||t||!this.services.languageDetector||(t=[]);const n=SF(t)?t:this.services.languageUtils.getBestMatchFromCodes(t);n&&(this.language||r(n),this.translator.language||this.translator.changeLanguage(n),this.services.languageDetector?.cacheUserLanguage?.(n)),this.loadResources(n,(e=>{s(e,n)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),i}getFixedT(e,t,n){var i=this;const r=function(e,t){let s;if("object"!=typeof t){for(var o=arguments.length,a=new Array(o>2?o-2:0),l=2;l<o;l++)a[l-2]=arguments[l];s=i.options.overloadTranslationOptionHandler([e,t].concat(a))}else s={...t};s.lng=s.lng||r.lng,s.lngs=s.lngs||r.lngs,s.ns=s.ns||r.ns,""!==s.keyPrefix&&(s.keyPrefix=s.keyPrefix||n||r.keyPrefix);const c=i.options.keySeparator||".";let d;return d=s.keyPrefix&&Array.isArray(e)?e.map((e=>`${s.keyPrefix}${c}${e}`)):s.keyPrefix?`${s.keyPrefix}${c}${e}`:e,i.t(d,s)};return SF(e)?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=n,r}t(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.translator?.translate(...t)}exists(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.translator?.exists(...t)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const n=t.lng||this.resolvedLanguage||this.languages[0],i=!!this.options&&this.options.fallbackLng,r=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;const s=(e,t)=>{const n=this.services.backendConnector.state[`${e}|${t}`];return-1===n||0===n||2===n};if(t.precheck){const e=t.precheck(this,s);if(void 0!==e)return e}return!(!this.hasResourceBundle(n,e)&&this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages)&&(!s(n,e)||i&&!s(r,e)))}loadNamespaces(e,t){const n=PF();return this.options.ns?(SF(e)&&(e=[e]),e.forEach((e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)})),this.loadResources((e=>{n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){const n=PF();SF(e)&&(e=[e]);const i=this.options.preload||[],r=e.filter((e=>i.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e)));return r.length?(this.options.preload=i.concat(r),this.loadResources((e=>{n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";const t=this.services?.languageUtils||new eD(dD());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){return new mD(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}cloneInstance(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hD;const n=e.forkResourceStore;n&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},r=new mD(i);if(void 0===e.debug&&void 0===e.prefix||(r.logger=r.logger.clone(e)),["store","services","language"].forEach((e=>{r[e]=this[e]})),r.services={...this.services},r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},n){const e=Object.keys(this.store.data).reduce(((e,t)=>(e[t]={...this.store.data[t]},Object.keys(e[t]).reduce(((n,i)=>(n[i]={...e[t][i]},n)),{}))),{});r.store=new ZF(e,i),r.services.resourceStore=r.store}return r.translator=new XF(r.services,i),r.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];r.emit(e,...n)})),r.init(i,t),r.translator.options=i,r.translator.backendConnector.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const gD=mD.createInstance();gD.createInstance=mD.createInstance,gD.createInstance,gD.dir,gD.init,gD.loadResources,gD.reloadResources,gD.use,gD.changeLanguage,gD.getFixedT,gD.t,gD.exists,gD.setDefaultNamespace,gD.hasLoadedNamespace,gD.loadNamespaces,gD.loadLanguages,gD.use(I).init({resources:{en:{translation:{su:"Su",mo:"Mo",tu:"Tu",we:"We",th:"Th",fr:"Fr",sa:"Sa",yesterday:"Yesterday",lastWeek:"Last week",lastMonth:"Last month",lastYear:"Last year",january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December",today:"Today",apply:"Apply",cancel:"Cancel",submit:"Submit",limitFileError:"File {{file.name}} exceeds the maximum size of {{sizeTitle}}",limitFileWarning:"File size should not exceed {{sizeTitle}}.",uploadFileAction:"Click or drag and drop to upload file",file:"File",remove:"Remove",choose:"Choose",select:"Select",add:"Add",all:"All",noResultFound:"No result found",ofItems:"of {{totalItem}} items",page:"Page",go:"Go to",or:"Or",username:"Username",password:"Password",dontHaveAccount:"Don't have an account?",forgotPassword:"Forgot your password?",login:"Log in",loginTo:"Log in to",signup:"Sign up",signupFor:"Sign up for","start-date":"Start date","end-date":"End date",reset:"Reset",date:"Date",on:"On",daily:"Daily",weekly:"Weekly",monthly:"Monthly",last:"Last"}},vi:{translation:{su:"CN",mo:"T2",tu:"T3",we:"T4",th:"T5",fr:"T6",sa:"T7",yesterday:"Hôm qua",lastWeek:"Tuần trước",lastMonth:"Tháng trước",lastYear:"Năm trước",january:"Tháng 1",february:"Tháng 2",march:"Tháng 3",april:"Tháng 4",may:"Tháng 5",june:"Tháng 6",july:"Tháng 7",august:"Tháng 8",september:"Tháng 9",october:"Tháng 10",november:"Tháng 11",december:"Tháng 12",today:"Hôm nay",apply:"Áp dụng",cancel:"Hủy",submit:"Xác nhận",limitFileError:"Tệp {{name}} vượt quá dung lượng tối đa {{sizeTitle}}",limitFileWarning:"Tệp không được vượt quá {{sizeTitle}}.",uploadFileAction:"Nhấn hoặc kéo vào để tải tệp lên",file:"Tệp",remove:"Xóa",choose:"Chọn",select:"Chọn",add:"Thêm",all:"Tất cả",noResultFound:"Không tìm thấy kết quả",ofItems:"trên {{totalItem}} kết quả",page:"Trang",go:"Đi tới",or:"Hoặc",username:"Tên đăng nhập",password:"Mật khẩu",dontHaveAccount:"Chưa có tài khoản?",forgotPassword:"Quên mật khẩu?",login:"Đăng nhập",loginTo:"Đăng nhập vào",signup:"Đăng ký",signupFor:"Đăng ký","start-date":"Ngày bắt đầu","end-date":"Ngày kết thúc",reset:"Mặc định",date:"Ngày",on:"Vào",daily:"Hàng ngày",weekly:"Hàng tuần",monthly:"Hàng tháng",last:"Cuối tháng"}}},lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}})})(),a})()));
|