=128&&u("not-basic"),t.push(e.charCodeAt(o));for(let h=l>0?l+1:0;h=o&&u("invalid-input");const l=(d=e.charCodeAt(h++))-48<10?d-22:d-65<26?d-65:d-97<26?d-97:r;(l>=r||l>c((n-i)/t))&&u("overflow"),i+=l*t;const p=s<=a?1:s>=a+26?26:s-a;if(lc(n/g)&&u("overflow"),t*=g}const p=t.length+1;a=f(i-l,p,0==l),c(i/p)>n-s&&u("overflow"),s+=c(i/p),i%=p,t.splice(i++,0,s)}var d;return String.fromCodePoint(...t)},k=function(e){const t=[];let o=(e=p(e)).length,i=128,s=0,a=72;for(const o of e)o<128&&t.push(d(o));let l=t.length,h=l;for(l&&t.push("-");h=i&&tc((n-s)/p)&&u("overflow"),s+=(o-i)*p,i=o;for(const o of e)if(on&&u("overflow"),o==i){let e=s;for(let o=r;;o+=r){const n=o<=a?1:o>=a+26?26:o-a;if(e{"use strict";var t=[];function o(e){for(var o=-1,n=0;n{"use strict";var t={};e.exports=function(e,o){var n=function(e){if(void 0===t[e]){var o=document.querySelector(e);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(e){o=null}t[e]=o}return t[e]}(e);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(o)}},9216:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},8575:e=>{"use strict";e.exports=function(e,t){Object.keys(t).forEach((function(o){e.setAttribute(o,t[o])}))}},9037:e=>{"use strict";var t,o=(t=[],function(e,o){return t[e]=o,t.filter(Boolean).join("\n")});function n(e,t,n,r){var i;if(n)i="";else{i="",r.supports&&(i+="@supports (".concat(r.supports,") {")),r.media&&(i+="@media ".concat(r.media," {"));var s=void 0!==r.layer;s&&(i+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),i+=r.css,s&&(i+="}"),r.media&&(i+="}"),r.supports&&(i+="}")}if(e.styleSheet)e.styleSheet.cssText=o(t,i);else{var a=document.createTextNode(i),l=e.childNodes;l[t]&&e.removeChild(l[t]),l.length?e.insertBefore(a,l[t]):e.appendChild(a)}}var r={singleton:null,singletonCounter:0};e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=r.singletonCounter++,o=r.singleton||(r.singleton=e.insertStyleElement(e));return{update:function(e){n(o,t,!1,e)},remove:function(e){n(o,t,!0,e)}}}},9413:e=>{e.exports=/[\0-\x1F\x7F-\x9F]/},2326:e=>{e.exports=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/},3189:e=>{e.exports=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/},5045:e=>{e.exports=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/},4205:(e,t,o)=>{"use strict";t.Any=o(9369),t.Cc=o(9413),t.Cf=o(2326),t.P=o(3189),t.Z=o(5045)},9369:e=>{e.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/},8491:e=>{"use strict";e.exports="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbD0iI2ZmZiIgZD0ibTExLjA3NyAxNSAuOTkxLTEuNDE2YS43NS43NSAwIDEgMSAxLjIyOS44NmwtMS4xNDggMS42NGEuNzQ4Ljc0OCAwIDAgMS0uMjE3LjIwNiA1LjI1MSA1LjI1MSAwIDAgMS04LjUwMy01Ljk1NS43NDEuNzQxIDAgMCAxIC4xMi0uMjc0bDEuMTQ3LTEuNjM5YS43NS43NSAwIDEgMSAxLjIyOC44Nkw0LjkzMyAxMC43bC4wMDYuMDAzYTMuNzUgMy43NSAwIDAgMCA2LjEzMiA0LjI5NGwuMDA2LjAwNHptNS40OTQtNS4zMzVhLjc0OC43NDggMCAwIDEtLjEyLjI3NGwtMS4xNDcgMS42MzlhLjc1Ljc1IDAgMSAxLTEuMjI4LS44NmwuODYtMS4yM2EzLjc1IDMuNzUgMCAwIDAtNi4xNDQtNC4zMDFsLS44NiAxLjIyOWEuNzUuNzUgMCAwIDEtMS4yMjktLjg2bDEuMTQ4LTEuNjRhLjc0OC43NDggMCAwIDEgLjIxNy0uMjA2IDUuMjUxIDUuMjUxIDAgMCAxIDguNTAzIDUuOTU1em0tNC41NjMtMi41MzJhLjc1Ljc1IDAgMCAxIC4xODQgMS4wNDVsLTMuMTU1IDQuNTA1YS43NS43NSAwIDEgMS0xLjIyOS0uODZsMy4xNTUtNC41MDZhLjc1Ljc1IDAgMCAxIDEuMDQ1LS4xODR6Ii8+PC9zdmc+"},9323:e=>{"use strict";e.exports=JSON.parse('{"Aacute":"Á","aacute":"á","Abreve":"Ă","abreve":"ă","ac":"∾","acd":"∿","acE":"∾̳","Acirc":"Â","acirc":"â","acute":"´","Acy":"А","acy":"а","AElig":"Æ","aelig":"æ","af":"","Afr":"𝔄","afr":"𝔞","Agrave":"À","agrave":"à","alefsym":"ℵ","aleph":"ℵ","Alpha":"Α","alpha":"α","Amacr":"Ā","amacr":"ā","amalg":"⨿","amp":"&","AMP":"&","andand":"⩕","And":"⩓","and":"∧","andd":"⩜","andslope":"⩘","andv":"⩚","ang":"∠","ange":"⦤","angle":"∠","angmsdaa":"⦨","angmsdab":"⦩","angmsdac":"⦪","angmsdad":"⦫","angmsdae":"⦬","angmsdaf":"⦭","angmsdag":"⦮","angmsdah":"⦯","angmsd":"∡","angrt":"∟","angrtvb":"⊾","angrtvbd":"⦝","angsph":"∢","angst":"Å","angzarr":"⍼","Aogon":"Ą","aogon":"ą","Aopf":"𝔸","aopf":"𝕒","apacir":"⩯","ap":"≈","apE":"⩰","ape":"≊","apid":"≋","apos":"\'","ApplyFunction":"","approx":"≈","approxeq":"≊","Aring":"Å","aring":"å","Ascr":"𝒜","ascr":"𝒶","Assign":"≔","ast":"*","asymp":"≈","asympeq":"≍","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","awconint":"∳","awint":"⨑","backcong":"≌","backepsilon":"϶","backprime":"‵","backsim":"∽","backsimeq":"⋍","Backslash":"∖","Barv":"⫧","barvee":"⊽","barwed":"⌅","Barwed":"⌆","barwedge":"⌅","bbrk":"⎵","bbrktbrk":"⎶","bcong":"≌","Bcy":"Б","bcy":"б","bdquo":"„","becaus":"∵","because":"∵","Because":"∵","bemptyv":"⦰","bepsi":"϶","bernou":"ℬ","Bernoullis":"ℬ","Beta":"Β","beta":"β","beth":"ℶ","between":"≬","Bfr":"𝔅","bfr":"𝔟","bigcap":"⋂","bigcirc":"◯","bigcup":"⋃","bigodot":"⨀","bigoplus":"⨁","bigotimes":"⨂","bigsqcup":"⨆","bigstar":"★","bigtriangledown":"▽","bigtriangleup":"△","biguplus":"⨄","bigvee":"⋁","bigwedge":"⋀","bkarow":"⤍","blacklozenge":"⧫","blacksquare":"▪","blacktriangle":"▴","blacktriangledown":"▾","blacktriangleleft":"◂","blacktriangleright":"▸","blank":"␣","blk12":"▒","blk14":"░","blk34":"▓","block":"█","bne":"=⃥","bnequiv":"≡⃥","bNot":"⫭","bnot":"⌐","Bopf":"𝔹","bopf":"𝕓","bot":"⊥","bottom":"⊥","bowtie":"⋈","boxbox":"⧉","boxdl":"┐","boxdL":"╕","boxDl":"╖","boxDL":"╗","boxdr":"┌","boxdR":"╒","boxDr":"╓","boxDR":"╔","boxh":"─","boxH":"═","boxhd":"┬","boxHd":"╤","boxhD":"╥","boxHD":"╦","boxhu":"┴","boxHu":"╧","boxhU":"╨","boxHU":"╩","boxminus":"⊟","boxplus":"⊞","boxtimes":"⊠","boxul":"┘","boxuL":"╛","boxUl":"╜","boxUL":"╝","boxur":"└","boxuR":"╘","boxUr":"╙","boxUR":"╚","boxv":"│","boxV":"║","boxvh":"┼","boxvH":"╪","boxVh":"╫","boxVH":"╬","boxvl":"┤","boxvL":"╡","boxVl":"╢","boxVL":"╣","boxvr":"├","boxvR":"╞","boxVr":"╟","boxVR":"╠","bprime":"‵","breve":"˘","Breve":"˘","brvbar":"¦","bscr":"𝒷","Bscr":"ℬ","bsemi":"⁏","bsim":"∽","bsime":"⋍","bsolb":"⧅","bsol":"\\\\","bsolhsub":"⟈","bull":"•","bullet":"•","bump":"≎","bumpE":"⪮","bumpe":"≏","Bumpeq":"≎","bumpeq":"≏","Cacute":"Ć","cacute":"ć","capand":"⩄","capbrcup":"⩉","capcap":"⩋","cap":"∩","Cap":"⋒","capcup":"⩇","capdot":"⩀","CapitalDifferentialD":"ⅅ","caps":"∩︀","caret":"⁁","caron":"ˇ","Cayleys":"ℭ","ccaps":"⩍","Ccaron":"Č","ccaron":"č","Ccedil":"Ç","ccedil":"ç","Ccirc":"Ĉ","ccirc":"ĉ","Cconint":"∰","ccups":"⩌","ccupssm":"⩐","Cdot":"Ċ","cdot":"ċ","cedil":"¸","Cedilla":"¸","cemptyv":"⦲","cent":"¢","centerdot":"·","CenterDot":"·","cfr":"𝔠","Cfr":"ℭ","CHcy":"Ч","chcy":"ч","check":"✓","checkmark":"✓","Chi":"Χ","chi":"χ","circ":"ˆ","circeq":"≗","circlearrowleft":"↺","circlearrowright":"↻","circledast":"⊛","circledcirc":"⊚","circleddash":"⊝","CircleDot":"⊙","circledR":"®","circledS":"Ⓢ","CircleMinus":"⊖","CirclePlus":"⊕","CircleTimes":"⊗","cir":"○","cirE":"⧃","cire":"≗","cirfnint":"⨐","cirmid":"⫯","cirscir":"⧂","ClockwiseContourIntegral":"∲","CloseCurlyDoubleQuote":"”","CloseCurlyQuote":"’","clubs":"♣","clubsuit":"♣","colon":":","Colon":"∷","Colone":"⩴","colone":"≔","coloneq":"≔","comma":",","commat":"@","comp":"∁","compfn":"∘","complement":"∁","complexes":"ℂ","cong":"≅","congdot":"⩭","Congruent":"≡","conint":"∮","Conint":"∯","ContourIntegral":"∮","copf":"𝕔","Copf":"ℂ","coprod":"∐","Coproduct":"∐","copy":"©","COPY":"©","copysr":"℗","CounterClockwiseContourIntegral":"∳","crarr":"↵","cross":"✗","Cross":"⨯","Cscr":"𝒞","cscr":"𝒸","csub":"⫏","csube":"⫑","csup":"⫐","csupe":"⫒","ctdot":"⋯","cudarrl":"⤸","cudarrr":"⤵","cuepr":"⋞","cuesc":"⋟","cularr":"↶","cularrp":"⤽","cupbrcap":"⩈","cupcap":"⩆","CupCap":"≍","cup":"∪","Cup":"⋓","cupcup":"⩊","cupdot":"⊍","cupor":"⩅","cups":"∪︀","curarr":"↷","curarrm":"⤼","curlyeqprec":"⋞","curlyeqsucc":"⋟","curlyvee":"⋎","curlywedge":"⋏","curren":"¤","curvearrowleft":"↶","curvearrowright":"↷","cuvee":"⋎","cuwed":"⋏","cwconint":"∲","cwint":"∱","cylcty":"⌭","dagger":"†","Dagger":"‡","daleth":"ℸ","darr":"↓","Darr":"↡","dArr":"⇓","dash":"‐","Dashv":"⫤","dashv":"⊣","dbkarow":"⤏","dblac":"˝","Dcaron":"Ď","dcaron":"ď","Dcy":"Д","dcy":"д","ddagger":"‡","ddarr":"⇊","DD":"ⅅ","dd":"ⅆ","DDotrahd":"⤑","ddotseq":"⩷","deg":"°","Del":"∇","Delta":"Δ","delta":"δ","demptyv":"⦱","dfisht":"⥿","Dfr":"𝔇","dfr":"𝔡","dHar":"⥥","dharl":"⇃","dharr":"⇂","DiacriticalAcute":"´","DiacriticalDot":"˙","DiacriticalDoubleAcute":"˝","DiacriticalGrave":"`","DiacriticalTilde":"˜","diam":"⋄","diamond":"⋄","Diamond":"⋄","diamondsuit":"♦","diams":"♦","die":"¨","DifferentialD":"ⅆ","digamma":"ϝ","disin":"⋲","div":"÷","divide":"÷","divideontimes":"⋇","divonx":"⋇","DJcy":"Ђ","djcy":"ђ","dlcorn":"⌞","dlcrop":"⌍","dollar":"$","Dopf":"𝔻","dopf":"𝕕","Dot":"¨","dot":"˙","DotDot":"⃜","doteq":"≐","doteqdot":"≑","DotEqual":"≐","dotminus":"∸","dotplus":"∔","dotsquare":"⊡","doublebarwedge":"⌆","DoubleContourIntegral":"∯","DoubleDot":"¨","DoubleDownArrow":"⇓","DoubleLeftArrow":"⇐","DoubleLeftRightArrow":"⇔","DoubleLeftTee":"⫤","DoubleLongLeftArrow":"⟸","DoubleLongLeftRightArrow":"⟺","DoubleLongRightArrow":"⟹","DoubleRightArrow":"⇒","DoubleRightTee":"⊨","DoubleUpArrow":"⇑","DoubleUpDownArrow":"⇕","DoubleVerticalBar":"∥","DownArrowBar":"⤓","downarrow":"↓","DownArrow":"↓","Downarrow":"⇓","DownArrowUpArrow":"⇵","DownBreve":"̑","downdownarrows":"⇊","downharpoonleft":"⇃","downharpoonright":"⇂","DownLeftRightVector":"⥐","DownLeftTeeVector":"⥞","DownLeftVectorBar":"⥖","DownLeftVector":"↽","DownRightTeeVector":"⥟","DownRightVectorBar":"⥗","DownRightVector":"⇁","DownTeeArrow":"↧","DownTee":"⊤","drbkarow":"⤐","drcorn":"⌟","drcrop":"⌌","Dscr":"𝒟","dscr":"𝒹","DScy":"Ѕ","dscy":"ѕ","dsol":"⧶","Dstrok":"Đ","dstrok":"đ","dtdot":"⋱","dtri":"▿","dtrif":"▾","duarr":"⇵","duhar":"⥯","dwangle":"⦦","DZcy":"Џ","dzcy":"џ","dzigrarr":"⟿","Eacute":"É","eacute":"é","easter":"⩮","Ecaron":"Ě","ecaron":"ě","Ecirc":"Ê","ecirc":"ê","ecir":"≖","ecolon":"≕","Ecy":"Э","ecy":"э","eDDot":"⩷","Edot":"Ė","edot":"ė","eDot":"≑","ee":"ⅇ","efDot":"≒","Efr":"𝔈","efr":"𝔢","eg":"⪚","Egrave":"È","egrave":"è","egs":"⪖","egsdot":"⪘","el":"⪙","Element":"∈","elinters":"⏧","ell":"ℓ","els":"⪕","elsdot":"⪗","Emacr":"Ē","emacr":"ē","empty":"∅","emptyset":"∅","EmptySmallSquare":"◻","emptyv":"∅","EmptyVerySmallSquare":"▫","emsp13":" ","emsp14":" ","emsp":" ","ENG":"Ŋ","eng":"ŋ","ensp":" ","Eogon":"Ę","eogon":"ę","Eopf":"𝔼","eopf":"𝕖","epar":"⋕","eparsl":"⧣","eplus":"⩱","epsi":"ε","Epsilon":"Ε","epsilon":"ε","epsiv":"ϵ","eqcirc":"≖","eqcolon":"≕","eqsim":"≂","eqslantgtr":"⪖","eqslantless":"⪕","Equal":"⩵","equals":"=","EqualTilde":"≂","equest":"≟","Equilibrium":"⇌","equiv":"≡","equivDD":"⩸","eqvparsl":"⧥","erarr":"⥱","erDot":"≓","escr":"ℯ","Escr":"ℰ","esdot":"≐","Esim":"⩳","esim":"≂","Eta":"Η","eta":"η","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","euro":"€","excl":"!","exist":"∃","Exists":"∃","expectation":"ℰ","exponentiale":"ⅇ","ExponentialE":"ⅇ","fallingdotseq":"≒","Fcy":"Ф","fcy":"ф","female":"♀","ffilig":"ffi","fflig":"ff","ffllig":"ffl","Ffr":"𝔉","ffr":"𝔣","filig":"fi","FilledSmallSquare":"◼","FilledVerySmallSquare":"▪","fjlig":"fj","flat":"♭","fllig":"fl","fltns":"▱","fnof":"ƒ","Fopf":"𝔽","fopf":"𝕗","forall":"∀","ForAll":"∀","fork":"⋔","forkv":"⫙","Fouriertrf":"ℱ","fpartint":"⨍","frac12":"½","frac13":"⅓","frac14":"¼","frac15":"⅕","frac16":"⅙","frac18":"⅛","frac23":"⅔","frac25":"⅖","frac34":"¾","frac35":"⅗","frac38":"⅜","frac45":"⅘","frac56":"⅚","frac58":"⅝","frac78":"⅞","frasl":"⁄","frown":"⌢","fscr":"𝒻","Fscr":"ℱ","gacute":"ǵ","Gamma":"Γ","gamma":"γ","Gammad":"Ϝ","gammad":"ϝ","gap":"⪆","Gbreve":"Ğ","gbreve":"ğ","Gcedil":"Ģ","Gcirc":"Ĝ","gcirc":"ĝ","Gcy":"Г","gcy":"г","Gdot":"Ġ","gdot":"ġ","ge":"≥","gE":"≧","gEl":"⪌","gel":"⋛","geq":"≥","geqq":"≧","geqslant":"⩾","gescc":"⪩","ges":"⩾","gesdot":"⪀","gesdoto":"⪂","gesdotol":"⪄","gesl":"⋛︀","gesles":"⪔","Gfr":"𝔊","gfr":"𝔤","gg":"≫","Gg":"⋙","ggg":"⋙","gimel":"ℷ","GJcy":"Ѓ","gjcy":"ѓ","gla":"⪥","gl":"≷","glE":"⪒","glj":"⪤","gnap":"⪊","gnapprox":"⪊","gne":"⪈","gnE":"≩","gneq":"⪈","gneqq":"≩","gnsim":"⋧","Gopf":"𝔾","gopf":"𝕘","grave":"`","GreaterEqual":"≥","GreaterEqualLess":"⋛","GreaterFullEqual":"≧","GreaterGreater":"⪢","GreaterLess":"≷","GreaterSlantEqual":"⩾","GreaterTilde":"≳","Gscr":"𝒢","gscr":"ℊ","gsim":"≳","gsime":"⪎","gsiml":"⪐","gtcc":"⪧","gtcir":"⩺","gt":">","GT":">","Gt":"≫","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","Hacek":"ˇ","hairsp":" ","half":"½","hamilt":"ℋ","HARDcy":"Ъ","hardcy":"ъ","harrcir":"⥈","harr":"↔","hArr":"⇔","harrw":"↭","Hat":"^","hbar":"ℏ","Hcirc":"Ĥ","hcirc":"ĥ","hearts":"♥","heartsuit":"♥","hellip":"…","hercon":"⊹","hfr":"𝔥","Hfr":"ℌ","HilbertSpace":"ℋ","hksearow":"⤥","hkswarow":"⤦","hoarr":"⇿","homtht":"∻","hookleftarrow":"↩","hookrightarrow":"↪","hopf":"𝕙","Hopf":"ℍ","horbar":"―","HorizontalLine":"─","hscr":"𝒽","Hscr":"ℋ","hslash":"ℏ","Hstrok":"Ħ","hstrok":"ħ","HumpDownHump":"≎","HumpEqual":"≏","hybull":"⁃","hyphen":"‐","Iacute":"Í","iacute":"í","ic":"","Icirc":"Î","icirc":"î","Icy":"И","icy":"и","Idot":"İ","IEcy":"Е","iecy":"е","iexcl":"¡","iff":"⇔","ifr":"𝔦","Ifr":"ℑ","Igrave":"Ì","igrave":"ì","ii":"ⅈ","iiiint":"⨌","iiint":"∭","iinfin":"⧜","iiota":"℩","IJlig":"IJ","ijlig":"ij","Imacr":"Ī","imacr":"ī","image":"ℑ","ImaginaryI":"ⅈ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","Im":"ℑ","imof":"⊷","imped":"Ƶ","Implies":"⇒","incare":"℅","in":"∈","infin":"∞","infintie":"⧝","inodot":"ı","intcal":"⊺","int":"∫","Int":"∬","integers":"ℤ","Integral":"∫","intercal":"⊺","Intersection":"⋂","intlarhk":"⨗","intprod":"⨼","InvisibleComma":"","InvisibleTimes":"","IOcy":"Ё","iocy":"ё","Iogon":"Į","iogon":"į","Iopf":"𝕀","iopf":"𝕚","Iota":"Ι","iota":"ι","iprod":"⨼","iquest":"¿","iscr":"𝒾","Iscr":"ℐ","isin":"∈","isindot":"⋵","isinE":"⋹","isins":"⋴","isinsv":"⋳","isinv":"∈","it":"","Itilde":"Ĩ","itilde":"ĩ","Iukcy":"І","iukcy":"і","Iuml":"Ï","iuml":"ï","Jcirc":"Ĵ","jcirc":"ĵ","Jcy":"Й","jcy":"й","Jfr":"𝔍","jfr":"𝔧","jmath":"ȷ","Jopf":"𝕁","jopf":"𝕛","Jscr":"𝒥","jscr":"𝒿","Jsercy":"Ј","jsercy":"ј","Jukcy":"Є","jukcy":"є","Kappa":"Κ","kappa":"κ","kappav":"ϰ","Kcedil":"Ķ","kcedil":"ķ","Kcy":"К","kcy":"к","Kfr":"𝔎","kfr":"𝔨","kgreen":"ĸ","KHcy":"Х","khcy":"х","KJcy":"Ќ","kjcy":"ќ","Kopf":"𝕂","kopf":"𝕜","Kscr":"𝒦","kscr":"𝓀","lAarr":"⇚","Lacute":"Ĺ","lacute":"ĺ","laemptyv":"⦴","lagran":"ℒ","Lambda":"Λ","lambda":"λ","lang":"⟨","Lang":"⟪","langd":"⦑","langle":"⟨","lap":"⪅","Laplacetrf":"ℒ","laquo":"«","larrb":"⇤","larrbfs":"⤟","larr":"←","Larr":"↞","lArr":"⇐","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","latail":"⤙","lAtail":"⤛","lat":"⪫","late":"⪭","lates":"⪭︀","lbarr":"⤌","lBarr":"⤎","lbbrk":"❲","lbrace":"{","lbrack":"[","lbrke":"⦋","lbrksld":"⦏","lbrkslu":"⦍","Lcaron":"Ľ","lcaron":"ľ","Lcedil":"Ļ","lcedil":"ļ","lceil":"⌈","lcub":"{","Lcy":"Л","lcy":"л","ldca":"⤶","ldquo":"“","ldquor":"„","ldrdhar":"⥧","ldrushar":"⥋","ldsh":"↲","le":"≤","lE":"≦","LeftAngleBracket":"⟨","LeftArrowBar":"⇤","leftarrow":"←","LeftArrow":"←","Leftarrow":"⇐","LeftArrowRightArrow":"⇆","leftarrowtail":"↢","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVectorBar":"⥙","LeftDownVector":"⇃","LeftFloor":"⌊","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","leftrightarrow":"↔","LeftRightArrow":"↔","Leftrightarrow":"⇔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","LeftRightVector":"⥎","LeftTeeArrow":"↤","LeftTee":"⊣","LeftTeeVector":"⥚","leftthreetimes":"⋋","LeftTriangleBar":"⧏","LeftTriangle":"⊲","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVectorBar":"⥘","LeftUpVector":"↿","LeftVectorBar":"⥒","LeftVector":"↼","lEg":"⪋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","lescc":"⪨","les":"⩽","lesdot":"⩿","lesdoto":"⪁","lesdotor":"⪃","lesg":"⋚︀","lesges":"⪓","lessapprox":"⪅","lessdot":"⋖","lesseqgtr":"⋚","lesseqqgtr":"⪋","LessEqualGreater":"⋚","LessFullEqual":"≦","LessGreater":"≶","lessgtr":"≶","LessLess":"⪡","lesssim":"≲","LessSlantEqual":"⩽","LessTilde":"≲","lfisht":"⥼","lfloor":"⌊","Lfr":"𝔏","lfr":"𝔩","lg":"≶","lgE":"⪑","lHar":"⥢","lhard":"↽","lharu":"↼","lharul":"⥪","lhblk":"▄","LJcy":"Љ","ljcy":"љ","llarr":"⇇","ll":"≪","Ll":"⋘","llcorner":"⌞","Lleftarrow":"⇚","llhard":"⥫","lltri":"◺","Lmidot":"Ŀ","lmidot":"ŀ","lmoustache":"⎰","lmoust":"⎰","lnap":"⪉","lnapprox":"⪉","lne":"⪇","lnE":"≨","lneq":"⪇","lneqq":"≨","lnsim":"⋦","loang":"⟬","loarr":"⇽","lobrk":"⟦","longleftarrow":"⟵","LongLeftArrow":"⟵","Longleftarrow":"⟸","longleftrightarrow":"⟷","LongLeftRightArrow":"⟷","Longleftrightarrow":"⟺","longmapsto":"⟼","longrightarrow":"⟶","LongRightArrow":"⟶","Longrightarrow":"⟹","looparrowleft":"↫","looparrowright":"↬","lopar":"⦅","Lopf":"𝕃","lopf":"𝕝","loplus":"⨭","lotimes":"⨴","lowast":"∗","lowbar":"_","LowerLeftArrow":"↙","LowerRightArrow":"↘","loz":"◊","lozenge":"◊","lozf":"⧫","lpar":"(","lparlt":"⦓","lrarr":"⇆","lrcorner":"⌟","lrhar":"⇋","lrhard":"⥭","lrm":"","lrtri":"⊿","lsaquo":"‹","lscr":"𝓁","Lscr":"ℒ","lsh":"↰","Lsh":"↰","lsim":"≲","lsime":"⪍","lsimg":"⪏","lsqb":"[","lsquo":"‘","lsquor":"‚","Lstrok":"Ł","lstrok":"ł","ltcc":"⪦","ltcir":"⩹","lt":"<","LT":"<","Lt":"≪","ltdot":"⋖","lthree":"⋋","ltimes":"⋉","ltlarr":"⥶","ltquest":"⩻","ltri":"◃","ltrie":"⊴","ltrif":"◂","ltrPar":"⦖","lurdshar":"⥊","luruhar":"⥦","lvertneqq":"≨︀","lvnE":"≨︀","macr":"¯","male":"♂","malt":"✠","maltese":"✠","Map":"⤅","map":"↦","mapsto":"↦","mapstodown":"↧","mapstoleft":"↤","mapstoup":"↥","marker":"▮","mcomma":"⨩","Mcy":"М","mcy":"м","mdash":"—","mDDot":"∺","measuredangle":"∡","MediumSpace":" ","Mellintrf":"ℳ","Mfr":"𝔐","mfr":"𝔪","mho":"℧","micro":"µ","midast":"*","midcir":"⫰","mid":"∣","middot":"·","minusb":"⊟","minus":"−","minusd":"∸","minusdu":"⨪","MinusPlus":"∓","mlcp":"⫛","mldr":"…","mnplus":"∓","models":"⊧","Mopf":"𝕄","mopf":"𝕞","mp":"∓","mscr":"𝓂","Mscr":"ℳ","mstpos":"∾","Mu":"Μ","mu":"μ","multimap":"⊸","mumap":"⊸","nabla":"∇","Nacute":"Ń","nacute":"ń","nang":"∠⃒","nap":"≉","napE":"⩰̸","napid":"≋̸","napos":"ʼn","napprox":"≉","natural":"♮","naturals":"ℕ","natur":"♮","nbsp":" ","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","Ncaron":"Ň","ncaron":"ň","Ncedil":"Ņ","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","Ncy":"Н","ncy":"н","ndash":"–","nearhk":"⤤","nearr":"↗","neArr":"⇗","nearrow":"↗","ne":"≠","nedot":"≐̸","NegativeMediumSpace":"","NegativeThickSpace":"","NegativeThinSpace":"","NegativeVeryThinSpace":"","nequiv":"≢","nesear":"⤨","nesim":"≂̸","NestedGreaterGreater":"≫","NestedLessLess":"≪","NewLine":"\\n","nexist":"∄","nexists":"∄","Nfr":"𝔑","nfr":"𝔫","ngE":"≧̸","nge":"≱","ngeq":"≱","ngeqq":"≧̸","ngeqslant":"⩾̸","nges":"⩾̸","nGg":"⋙̸","ngsim":"≵","nGt":"≫⃒","ngt":"≯","ngtr":"≯","nGtv":"≫̸","nharr":"↮","nhArr":"⇎","nhpar":"⫲","ni":"∋","nis":"⋼","nisd":"⋺","niv":"∋","NJcy":"Њ","njcy":"њ","nlarr":"↚","nlArr":"⇍","nldr":"‥","nlE":"≦̸","nle":"≰","nleftarrow":"↚","nLeftarrow":"⇍","nleftrightarrow":"↮","nLeftrightarrow":"⇎","nleq":"≰","nleqq":"≦̸","nleqslant":"⩽̸","nles":"⩽̸","nless":"≮","nLl":"⋘̸","nlsim":"≴","nLt":"≪⃒","nlt":"≮","nltri":"⋪","nltrie":"⋬","nLtv":"≪̸","nmid":"∤","NoBreak":"","NonBreakingSpace":" ","nopf":"𝕟","Nopf":"ℕ","Not":"⫬","not":"¬","NotCongruent":"≢","NotCupCap":"≭","NotDoubleVerticalBar":"∦","NotElement":"∉","NotEqual":"≠","NotEqualTilde":"≂̸","NotExists":"∄","NotGreater":"≯","NotGreaterEqual":"≱","NotGreaterFullEqual":"≧̸","NotGreaterGreater":"≫̸","NotGreaterLess":"≹","NotGreaterSlantEqual":"⩾̸","NotGreaterTilde":"≵","NotHumpDownHump":"≎̸","NotHumpEqual":"≏̸","notin":"∉","notindot":"⋵̸","notinE":"⋹̸","notinva":"∉","notinvb":"⋷","notinvc":"⋶","NotLeftTriangleBar":"⧏̸","NotLeftTriangle":"⋪","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangleBar":"⧐̸","NotRightTriangle":"⋫","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","nparallel":"∦","npar":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","nprec":"⊀","npreceq":"⪯̸","npre":"⪯̸","nrarrc":"⤳̸","nrarr":"↛","nrArr":"⇏","nrarrw":"↝̸","nrightarrow":"↛","nRightarrow":"⇏","nrtri":"⋫","nrtrie":"⋭","nsc":"⊁","nsccue":"⋡","nsce":"⪰̸","Nscr":"𝒩","nscr":"𝓃","nshortmid":"∤","nshortparallel":"∦","nsim":"≁","nsime":"≄","nsimeq":"≄","nsmid":"∤","nspar":"∦","nsqsube":"⋢","nsqsupe":"⋣","nsub":"⊄","nsubE":"⫅̸","nsube":"⊈","nsubset":"⊂⃒","nsubseteq":"⊈","nsubseteqq":"⫅̸","nsucc":"⊁","nsucceq":"⪰̸","nsup":"⊅","nsupE":"⫆̸","nsupe":"⊉","nsupset":"⊃⃒","nsupseteq":"⊉","nsupseteqq":"⫆̸","ntgl":"≹","Ntilde":"Ñ","ntilde":"ñ","ntlg":"≸","ntriangleleft":"⋪","ntrianglelefteq":"⋬","ntriangleright":"⋫","ntrianglerighteq":"⋭","Nu":"Ν","nu":"ν","num":"#","numero":"№","numsp":" ","nvap":"≍⃒","nvdash":"⊬","nvDash":"⊭","nVdash":"⊮","nVDash":"⊯","nvge":"≥⃒","nvgt":">⃒","nvHarr":"⤄","nvinfin":"⧞","nvlArr":"⤂","nvle":"≤⃒","nvlt":"<⃒","nvltrie":"⊴⃒","nvrArr":"⤃","nvrtrie":"⊵⃒","nvsim":"∼⃒","nwarhk":"⤣","nwarr":"↖","nwArr":"⇖","nwarrow":"↖","nwnear":"⤧","Oacute":"Ó","oacute":"ó","oast":"⊛","Ocirc":"Ô","ocirc":"ô","ocir":"⊚","Ocy":"О","ocy":"о","odash":"⊝","Odblac":"Ő","odblac":"ő","odiv":"⨸","odot":"⊙","odsold":"⦼","OElig":"Œ","oelig":"œ","ofcir":"⦿","Ofr":"𝔒","ofr":"𝔬","ogon":"˛","Ograve":"Ò","ograve":"ò","ogt":"⧁","ohbar":"⦵","ohm":"Ω","oint":"∮","olarr":"↺","olcir":"⦾","olcross":"⦻","oline":"‾","olt":"⧀","Omacr":"Ō","omacr":"ō","Omega":"Ω","omega":"ω","Omicron":"Ο","omicron":"ο","omid":"⦶","ominus":"⊖","Oopf":"𝕆","oopf":"𝕠","opar":"⦷","OpenCurlyDoubleQuote":"“","OpenCurlyQuote":"‘","operp":"⦹","oplus":"⊕","orarr":"↻","Or":"⩔","or":"∨","ord":"⩝","order":"ℴ","orderof":"ℴ","ordf":"ª","ordm":"º","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oS":"Ⓢ","Oscr":"𝒪","oscr":"ℴ","Oslash":"Ø","oslash":"ø","osol":"⊘","Otilde":"Õ","otilde":"õ","otimesas":"⨶","Otimes":"⨷","otimes":"⊗","Ouml":"Ö","ouml":"ö","ovbar":"⌽","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","para":"¶","parallel":"∥","par":"∥","parsim":"⫳","parsl":"⫽","part":"∂","PartialD":"∂","Pcy":"П","pcy":"п","percnt":"%","period":".","permil":"‰","perp":"⊥","pertenk":"‱","Pfr":"𝔓","pfr":"𝔭","Phi":"Φ","phi":"φ","phiv":"ϕ","phmmat":"ℳ","phone":"☎","Pi":"Π","pi":"π","pitchfork":"⋔","piv":"ϖ","planck":"ℏ","planckh":"ℎ","plankv":"ℏ","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plus":"+","plusdo":"∔","plusdu":"⨥","pluse":"⩲","PlusMinus":"±","plusmn":"±","plussim":"⨦","plustwo":"⨧","pm":"±","Poincareplane":"ℌ","pointint":"⨕","popf":"𝕡","Popf":"ℙ","pound":"£","prap":"⪷","Pr":"⪻","pr":"≺","prcue":"≼","precapprox":"⪷","prec":"≺","preccurlyeq":"≼","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","pre":"⪯","prE":"⪳","precsim":"≾","prime":"′","Prime":"″","primes":"ℙ","prnap":"⪹","prnE":"⪵","prnsim":"⋨","prod":"∏","Product":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","Proportional":"∝","Proportion":"∷","propto":"∝","prsim":"≾","prurel":"⊰","Pscr":"𝒫","pscr":"𝓅","Psi":"Ψ","psi":"ψ","puncsp":" ","Qfr":"𝔔","qfr":"𝔮","qint":"⨌","qopf":"𝕢","Qopf":"ℚ","qprime":"⁗","Qscr":"𝒬","qscr":"𝓆","quaternions":"ℍ","quatint":"⨖","quest":"?","questeq":"≟","quot":"\\"","QUOT":"\\"","rAarr":"⇛","race":"∽̱","Racute":"Ŕ","racute":"ŕ","radic":"√","raemptyv":"⦳","rang":"⟩","Rang":"⟫","rangd":"⦒","range":"⦥","rangle":"⟩","raquo":"»","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarr":"→","Rarr":"↠","rArr":"⇒","rarrfs":"⤞","rarrhk":"↪","rarrlp":"↬","rarrpl":"⥅","rarrsim":"⥴","Rarrtl":"⤖","rarrtl":"↣","rarrw":"↝","ratail":"⤚","rAtail":"⤜","ratio":"∶","rationals":"ℚ","rbarr":"⤍","rBarr":"⤏","RBarr":"⤐","rbbrk":"❳","rbrace":"}","rbrack":"]","rbrke":"⦌","rbrksld":"⦎","rbrkslu":"⦐","Rcaron":"Ř","rcaron":"ř","Rcedil":"Ŗ","rcedil":"ŗ","rceil":"⌉","rcub":"}","Rcy":"Р","rcy":"р","rdca":"⤷","rdldhar":"⥩","rdquo":"”","rdquor":"”","rdsh":"↳","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","Re":"ℜ","rect":"▭","reg":"®","REG":"®","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","rfisht":"⥽","rfloor":"⌋","rfr":"𝔯","Rfr":"ℜ","rHar":"⥤","rhard":"⇁","rharu":"⇀","rharul":"⥬","Rho":"Ρ","rho":"ρ","rhov":"ϱ","RightAngleBracket":"⟩","RightArrowBar":"⇥","rightarrow":"→","RightArrow":"→","Rightarrow":"⇒","RightArrowLeftArrow":"⇄","rightarrowtail":"↣","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVectorBar":"⥕","RightDownVector":"⇂","RightFloor":"⌋","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","RightTeeArrow":"↦","RightTee":"⊢","RightTeeVector":"⥛","rightthreetimes":"⋌","RightTriangleBar":"⧐","RightTriangle":"⊳","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVectorBar":"⥔","RightUpVector":"↾","RightVectorBar":"⥓","RightVector":"⇀","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"","rmoustache":"⎱","rmoust":"⎱","rnmid":"⫮","roang":"⟭","roarr":"⇾","robrk":"⟧","ropar":"⦆","ropf":"𝕣","Ropf":"ℝ","roplus":"⨮","rotimes":"⨵","RoundImplies":"⥰","rpar":")","rpargt":"⦔","rppolint":"⨒","rrarr":"⇉","Rrightarrow":"⇛","rsaquo":"›","rscr":"𝓇","Rscr":"ℛ","rsh":"↱","Rsh":"↱","rsqb":"]","rsquo":"’","rsquor":"’","rthree":"⋌","rtimes":"⋊","rtri":"▹","rtrie":"⊵","rtrif":"▸","rtriltri":"⧎","RuleDelayed":"⧴","ruluhar":"⥨","rx":"℞","Sacute":"Ś","sacute":"ś","sbquo":"‚","scap":"⪸","Scaron":"Š","scaron":"š","Sc":"⪼","sc":"≻","sccue":"≽","sce":"⪰","scE":"⪴","Scedil":"Ş","scedil":"ş","Scirc":"Ŝ","scirc":"ŝ","scnap":"⪺","scnE":"⪶","scnsim":"⋩","scpolint":"⨓","scsim":"≿","Scy":"С","scy":"с","sdotb":"⊡","sdot":"⋅","sdote":"⩦","searhk":"⤥","searr":"↘","seArr":"⇘","searrow":"↘","sect":"§","semi":";","seswar":"⤩","setminus":"∖","setmn":"∖","sext":"✶","Sfr":"𝔖","sfr":"𝔰","sfrown":"⌢","sharp":"♯","SHCHcy":"Щ","shchcy":"щ","SHcy":"Ш","shcy":"ш","ShortDownArrow":"↓","ShortLeftArrow":"←","shortmid":"∣","shortparallel":"∥","ShortRightArrow":"→","ShortUpArrow":"↑","shy":"","Sigma":"Σ","sigma":"σ","sigmaf":"ς","sigmav":"ς","sim":"∼","simdot":"⩪","sime":"≃","simeq":"≃","simg":"⪞","simgE":"⪠","siml":"⪝","simlE":"⪟","simne":"≆","simplus":"⨤","simrarr":"⥲","slarr":"←","SmallCircle":"∘","smallsetminus":"∖","smashp":"⨳","smeparsl":"⧤","smid":"∣","smile":"⌣","smt":"⪪","smte":"⪬","smtes":"⪬︀","SOFTcy":"Ь","softcy":"ь","solbar":"⌿","solb":"⧄","sol":"/","Sopf":"𝕊","sopf":"𝕤","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","Sqrt":"√","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","square":"□","Square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","squarf":"▪","squ":"□","squf":"▪","srarr":"→","Sscr":"𝒮","sscr":"𝓈","ssetmn":"∖","ssmile":"⌣","sstarf":"⋆","Star":"⋆","star":"☆","starf":"★","straightepsilon":"ϵ","straightphi":"ϕ","strns":"¯","sub":"⊂","Sub":"⋐","subdot":"⪽","subE":"⫅","sube":"⊆","subedot":"⫃","submult":"⫁","subnE":"⫋","subne":"⊊","subplus":"⪿","subrarr":"⥹","subset":"⊂","Subset":"⋐","subseteq":"⊆","subseteqq":"⫅","SubsetEqual":"⊆","subsetneq":"⊊","subsetneqq":"⫋","subsim":"⫇","subsub":"⫕","subsup":"⫓","succapprox":"⪸","succ":"≻","succcurlyeq":"≽","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","SuchThat":"∋","sum":"∑","Sum":"∑","sung":"♪","sup1":"¹","sup2":"²","sup3":"³","sup":"⊃","Sup":"⋑","supdot":"⪾","supdsub":"⫘","supE":"⫆","supe":"⊇","supedot":"⫄","Superset":"⊃","SupersetEqual":"⊇","suphsol":"⟉","suphsub":"⫗","suplarr":"⥻","supmult":"⫂","supnE":"⫌","supne":"⊋","supplus":"⫀","supset":"⊃","Supset":"⋑","supseteq":"⊇","supseteqq":"⫆","supsetneq":"⊋","supsetneqq":"⫌","supsim":"⫈","supsub":"⫔","supsup":"⫖","swarhk":"⤦","swarr":"↙","swArr":"⇙","swarrow":"↙","swnwar":"⤪","szlig":"ß","Tab":"\\t","target":"⌖","Tau":"Τ","tau":"τ","tbrk":"⎴","Tcaron":"Ť","tcaron":"ť","Tcedil":"Ţ","tcedil":"ţ","Tcy":"Т","tcy":"т","tdot":"⃛","telrec":"⌕","Tfr":"𝔗","tfr":"𝔱","there4":"∴","therefore":"∴","Therefore":"∴","Theta":"Θ","theta":"θ","thetasym":"ϑ","thetav":"ϑ","thickapprox":"≈","thicksim":"∼","ThickSpace":" ","ThinSpace":" ","thinsp":" ","thkap":"≈","thksim":"∼","THORN":"Þ","thorn":"þ","tilde":"˜","Tilde":"∼","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","timesbar":"⨱","timesb":"⊠","times":"×","timesd":"⨰","tint":"∭","toea":"⤨","topbot":"⌶","topcir":"⫱","top":"⊤","Topf":"𝕋","topf":"𝕥","topfork":"⫚","tosa":"⤩","tprime":"‴","trade":"™","TRADE":"™","triangle":"▵","triangledown":"▿","triangleleft":"◃","trianglelefteq":"⊴","triangleq":"≜","triangleright":"▹","trianglerighteq":"⊵","tridot":"◬","trie":"≜","triminus":"⨺","TripleDot":"⃛","triplus":"⨹","trisb":"⧍","tritime":"⨻","trpezium":"⏢","Tscr":"𝒯","tscr":"𝓉","TScy":"Ц","tscy":"ц","TSHcy":"Ћ","tshcy":"ћ","Tstrok":"Ŧ","tstrok":"ŧ","twixt":"≬","twoheadleftarrow":"↞","twoheadrightarrow":"↠","Uacute":"Ú","uacute":"ú","uarr":"↑","Uarr":"↟","uArr":"⇑","Uarrocir":"⥉","Ubrcy":"Ў","ubrcy":"ў","Ubreve":"Ŭ","ubreve":"ŭ","Ucirc":"Û","ucirc":"û","Ucy":"У","ucy":"у","udarr":"⇅","Udblac":"Ű","udblac":"ű","udhar":"⥮","ufisht":"⥾","Ufr":"𝔘","ufr":"𝔲","Ugrave":"Ù","ugrave":"ù","uHar":"⥣","uharl":"↿","uharr":"↾","uhblk":"▀","ulcorn":"⌜","ulcorner":"⌜","ulcrop":"⌏","ultri":"◸","Umacr":"Ū","umacr":"ū","uml":"¨","UnderBar":"_","UnderBrace":"⏟","UnderBracket":"⎵","UnderParenthesis":"⏝","Union":"⋃","UnionPlus":"⊎","Uogon":"Ų","uogon":"ų","Uopf":"𝕌","uopf":"𝕦","UpArrowBar":"⤒","uparrow":"↑","UpArrow":"↑","Uparrow":"⇑","UpArrowDownArrow":"⇅","updownarrow":"↕","UpDownArrow":"↕","Updownarrow":"⇕","UpEquilibrium":"⥮","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","UpperLeftArrow":"↖","UpperRightArrow":"↗","upsi":"υ","Upsi":"ϒ","upsih":"ϒ","Upsilon":"Υ","upsilon":"υ","UpTeeArrow":"↥","UpTee":"⊥","upuparrows":"⇈","urcorn":"⌝","urcorner":"⌝","urcrop":"⌎","Uring":"Ů","uring":"ů","urtri":"◹","Uscr":"𝒰","uscr":"𝓊","utdot":"⋰","Utilde":"Ũ","utilde":"ũ","utri":"▵","utrif":"▴","uuarr":"⇈","Uuml":"Ü","uuml":"ü","uwangle":"⦧","vangrt":"⦜","varepsilon":"ϵ","varkappa":"ϰ","varnothing":"∅","varphi":"ϕ","varpi":"ϖ","varpropto":"∝","varr":"↕","vArr":"⇕","varrho":"ϱ","varsigma":"ς","varsubsetneq":"⊊︀","varsubsetneqq":"⫋︀","varsupsetneq":"⊋︀","varsupsetneqq":"⫌︀","vartheta":"ϑ","vartriangleleft":"⊲","vartriangleright":"⊳","vBar":"⫨","Vbar":"⫫","vBarv":"⫩","Vcy":"В","vcy":"в","vdash":"⊢","vDash":"⊨","Vdash":"⊩","VDash":"⊫","Vdashl":"⫦","veebar":"⊻","vee":"∨","Vee":"⋁","veeeq":"≚","vellip":"⋮","verbar":"|","Verbar":"‖","vert":"|","Vert":"‖","VerticalBar":"∣","VerticalLine":"|","VerticalSeparator":"❘","VerticalTilde":"≀","VeryThinSpace":" ","Vfr":"𝔙","vfr":"𝔳","vltri":"⊲","vnsub":"⊂⃒","vnsup":"⊃⃒","Vopf":"𝕍","vopf":"𝕧","vprop":"∝","vrtri":"⊳","Vscr":"𝒱","vscr":"𝓋","vsubnE":"⫋︀","vsubne":"⊊︀","vsupnE":"⫌︀","vsupne":"⊋︀","Vvdash":"⊪","vzigzag":"⦚","Wcirc":"Ŵ","wcirc":"ŵ","wedbar":"⩟","wedge":"∧","Wedge":"⋀","wedgeq":"≙","weierp":"℘","Wfr":"𝔚","wfr":"𝔴","Wopf":"𝕎","wopf":"𝕨","wp":"℘","wr":"≀","wreath":"≀","Wscr":"𝒲","wscr":"𝓌","xcap":"⋂","xcirc":"◯","xcup":"⋃","xdtri":"▽","Xfr":"𝔛","xfr":"𝔵","xharr":"⟷","xhArr":"⟺","Xi":"Ξ","xi":"ξ","xlarr":"⟵","xlArr":"⟸","xmap":"⟼","xnis":"⋻","xodot":"⨀","Xopf":"𝕏","xopf":"𝕩","xoplus":"⨁","xotime":"⨂","xrarr":"⟶","xrArr":"⟹","Xscr":"𝒳","xscr":"𝓍","xsqcup":"⨆","xuplus":"⨄","xutri":"△","xvee":"⋁","xwedge":"⋀","Yacute":"Ý","yacute":"ý","YAcy":"Я","yacy":"я","Ycirc":"Ŷ","ycirc":"ŷ","Ycy":"Ы","ycy":"ы","yen":"¥","Yfr":"𝔜","yfr":"𝔶","YIcy":"Ї","yicy":"ї","Yopf":"𝕐","yopf":"𝕪","Yscr":"𝒴","yscr":"𝓎","YUcy":"Ю","yucy":"ю","yuml":"ÿ","Yuml":"Ÿ","Zacute":"Ź","zacute":"ź","Zcaron":"Ž","zcaron":"ž","Zcy":"З","zcy":"з","Zdot":"Ż","zdot":"ż","zeetrf":"ℨ","ZeroWidthSpace":"","Zeta":"Ζ","zeta":"ζ","zfr":"𝔷","Zfr":"ℨ","ZHcy":"Ж","zhcy":"ж","zigrarr":"⇝","zopf":"𝕫","Zopf":"ℤ","Zscr":"𝒵","zscr":"𝓏","zwj":"","zwnj":""}')}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={id:n,exports:{}};return e[n](i,i.exports,o),i.exports}o.m=e,o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},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.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),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.b=document.baseURI||self.location.href;var n={};return(()=>{"use strict";const e=function(){try{return navigator.userAgent.toLowerCase()}catch(e){return""}}(),t={isMac:r(e),isWindows:function(e){return e.indexOf("windows")>-1}(e),isGecko:function(e){return!!e.match(/gecko\/\d+/)}(e),isSafari:function(e){return e.indexOf(" applewebkit/")>-1&&-1===e.indexOf("chrome")}(e),isiOS:function(e){return!!e.match(/iphone|ipad/i)||r(e)&&navigator.maxTouchPoints>0}(e),isAndroid:function(e){return e.indexOf("android")>-1}(e),isBlink:function(e){return e.indexOf("chrome/")>-1&&e.indexOf("edge/")<0}(e),features:{isRegExpUnicodePropertySupported:function(){let e=!1;try{e=0==="ć".search(new RegExp("[\\p{L}]","u"))}catch(e){}return e}()}},n=t;function r(e){return e.indexOf("macintosh")>-1}function i(e,t,o,n){o=o||function(e,t){return e===t};const r=Array.isArray(e)?e:Array.prototype.slice.call(e),i=Array.isArray(t)?t:Array.prototype.slice.call(t),l=function(e,t,o){const n=s(e,t,o);if(-1===n)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const r=a(e,n),i=a(t,n),l=s(r,i,o),c=e.length-l,d=t.length-l;return{firstIndex:n,lastIndexOld:c,lastIndexNew:d}}(r,i,o),c=n?function(e,t){const{firstIndex:o,lastIndexOld:n,lastIndexNew:r}=e;if(-1===o)return Array(t).fill("equal");let i=[];o>0&&(i=i.concat(Array(o).fill("equal")));r-o>0&&(i=i.concat(Array(r-o).fill("insert")));n-o>0&&(i=i.concat(Array(n-o).fill("delete")));r0&&o.push({index:n,type:"insert",values:e.slice(n,i)});r-n>0&&o.push({index:n+(i-n),type:"delete",howMany:r-n});return o}(i,l);return c}function s(e,t,o){for(let n=0;n200||r>200||n+r>300)return l.fastDiff(e,t,o,!0);let i,s;if(rl?-1:1;u[n+d]&&(u[n]=u[n+d].slice(0)),u[n]||(u[n]=[]),u[n].push(r>l?i:s);let p=Math.max(r,l),g=p-n;for(;gd;g--)h[g]=p(g);h[d]=p(d),m++}while(h[d]!==c);return u[d].slice(1)}l.fastDiff=i;const c=function(){return function e(){e.called=!0}};class d{constructor(e,t){this.source=e,this.name=t,this.path=[],this.stop=c(),this.off=c()}}const u=new Array(256).fill("").map(((e,t)=>("0"+t.toString(16)).slice(-2)));function h(){const e=4294967296*Math.random()>>>0,t=4294967296*Math.random()>>>0,o=4294967296*Math.random()>>>0,n=4294967296*Math.random()>>>0;return"e"+u[e>>0&255]+u[e>>8&255]+u[e>>16&255]+u[e>>24&255]+u[t>>0&255]+u[t>>8&255]+u[t>>16&255]+u[t>>24&255]+u[o>>0&255]+u[o>>8&255]+u[o>>16&255]+u[o>>24&255]+u[n>>0&255]+u[n>>8&255]+u[n>>16&255]+u[n>>24&255]}const p={get(e="normal"){return"number"!=typeof e?this[e]||this.normal:e},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5};function g(e,t){const o=p.get(t.priority);for(let n=0;n{if("object"==typeof t&&null!==t){if(o.has(t))return`[object ${t.constructor.name}]`;o.add(t)}return t},r=t?` ${JSON.stringify(t,n)}`:"",i=k(e);return e+r+i}(e,o)),this.name="CKEditorError",this.context=t,this.data=o}is(e){return"CKEditorError"===e}static rethrowUnexpectedError(e,t){if(e.is&&e.is("CKEditorError"))throw e;const o=new f(e.message,t);throw o.stack=e.stack,o}}function b(e,t){console.warn(...w(e,t))}function k(e){return`\nRead more: ${m}#error-${e}`}function w(e,t){const o=k(e);return t?[e,t,o]:[e,o]}const y="38.0.1",A=new Date(2023,4,23),C="object"==typeof window?window:o.g;if(C.CKEDITOR_VERSION)throw new f("ckeditor-duplicated-modules",null);C.CKEDITOR_VERSION=y;const v=Symbol("listeningTo"),x=Symbol("emitterId"),E=Symbol("delegations"),D=S(Object);function S(e){if(!e)return D;return class extends e{on(e,t,o){this.listenTo(this,e,t,o)}once(e,t,o){let n=!1;this.listenTo(this,e,((e,...o)=>{n||(n=!0,e.off(),t.call(this,e,...o))}),o)}off(e,t){this.stopListening(this,e,t)}listenTo(e,t,o,n={}){let r,i;this[v]||(this[v]={});const s=this[v];B(e)||T(e);const a=B(e);(r=s[a])||(r=s[a]={emitter:e,callbacks:{}}),(i=r.callbacks[t])||(i=r.callbacks[t]=[]),i.push(o),function(e,t,o,n,r){t._addEventListener?t._addEventListener(o,n,r):e._addEventListener.call(t,o,n,r)}(this,e,t,o,n)}stopListening(e,t,o){const n=this[v];let r=e&&B(e);const i=n&&r?n[r]:void 0,s=i&&t?i.callbacks[t]:void 0;if(!(!n||e&&!i||t&&!s))if(o){M(this,e,t,o);-1!==s.indexOf(o)&&(1===s.length?delete i.callbacks[t]:M(this,e,t,o))}else if(s){for(;o=s.pop();)M(this,e,t,o);delete i.callbacks[t]}else if(i){for(t in i.callbacks)this.stopListening(e,t);delete n[r]}else{for(r in n)this.stopListening(n[r].emitter);delete this[v]}}fire(e,...t){try{const o=e instanceof d?e:new d(this,e),n=o.name;let r=R(this,n);if(o.path.push(this),r){const e=[o,...t];r=Array.from(r);for(let t=0;t{this[E]||(this[E]=new Map),e.forEach((e=>{const n=this[E].get(e);n?n.set(t,o):this[E].set(e,new Map([[t,o]]))}))}}}stopDelegating(e,t){if(this[E])if(e)if(t){const o=this[E].get(e);o&&o.delete(t)}else this[E].delete(e);else this[E].clear()}_addEventListener(e,t,o){!function(e,t){const o=I(e);if(o[t])return;let n=t,r=null;const i=[];for(;""!==n&&!o[n];)o[n]={callbacks:[],childEvents:[]},i.push(o[n]),r&&o[n].childEvents.push(r),r=n,n=n.substr(0,n.lastIndexOf(":"));if(""!==n){for(const e of i)e.callbacks=o[n].callbacks.slice();o[n].childEvents.push(r)}}(this,e);const n=P(this,e),r={callback:t,priority:p.get(o.priority)};for(const e of n)g(e,r)}_removeEventListener(e,t){const o=P(this,e);for(const e of o)for(let o=0;o-1?R(e,t.substr(0,t.lastIndexOf(":"))):null}function z(e,t,o){for(let[n,r]of e){r?"function"==typeof r&&(r=r(t.name)):r=t.name;const e=new d(t.source,r);e.path=[...t.path],n.fire(e,...o)}}function M(e,t,o,n){t._removeEventListener?t._removeEventListener(o,n):e._removeEventListener.call(t,o,n)}["on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach((e=>{S[e]=D.prototype[e]}));const N=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},F=Symbol("observableProperties"),O=Symbol("boundObservables"),V=Symbol("boundProperties"),L=Symbol("decoratedMethods"),j=Symbol("decoratedOriginal"),q=H(S());function H(e){if(!e)return q;return class extends e{set(e,t){if(N(e))return void Object.keys(e).forEach((t=>{this.set(t,e[t])}),this);W(this);const o=this[F];if(e in this&&!o.has(e))throw new f("observable-set-cannot-override",this);Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>o.get(e),set(t){const n=o.get(e);let r=this.fire(`set:${e}`,e,t,n);void 0===r&&(r=t),n===r&&o.has(e)||(o.set(e,r),this.fire(`change:${e}`,e,r,n))}}),this[e]=t}bind(...e){if(!e.length||!G(e))throw new f("observable-bind-wrong-properties",this);if(new Set(e).size!==e.length)throw new f("observable-bind-duplicate-properties",this);W(this);const t=this[V];e.forEach((e=>{if(t.has(e))throw new f("observable-bind-rebind",this)}));const o=new Map;return e.forEach((e=>{const n={property:e,to:[]};t.set(e,n),o.set(e,n)})),{to:$,toMany:U,_observable:this,_bindProperties:e,_to:[],_bindings:o}}unbind(...e){if(!this[F])return;const t=this[V],o=this[O];if(e.length){if(!G(e))throw new f("observable-unbind-wrong-properties",this);e.forEach((e=>{const n=t.get(e);n&&(n.to.forEach((([e,t])=>{const r=o.get(e),i=r[t];i.delete(n),i.size||delete r[t],Object.keys(r).length||(o.delete(e),this.stopListening(e,"change"))})),t.delete(e))}))}else o.forEach(((e,t)=>{this.stopListening(t,"change")})),o.clear(),t.clear()}decorate(e){W(this);const t=this[e];if(!t)throw new f("observablemixin-cannot-decorate-undefined",this,{object:this,methodName:e});this.on(e,((e,o)=>{e.return=t.apply(this,o)})),this[e]=function(...t){return this.fire(e,t)},this[e][j]=t,this[L]||(this[L]=[]),this[L].push(e)}stopListening(e,t,o){if(!e&&this[L]){for(const e of this[L])this[e]=this[e][j];delete this[L]}super.stopListening(e,t,o)}}}function W(e){e[F]||(Object.defineProperty(e,F,{value:new Map}),Object.defineProperty(e,O,{value:new Map}),Object.defineProperty(e,V,{value:new Map}))}function $(...e){const t=function(...e){if(!e.length)throw new f("observable-bind-to-parse-error",null);const t={to:[]};let o;"function"==typeof e[e.length-1]&&(t.callback=e.pop());return e.forEach((e=>{if("string"==typeof e)o.properties.push(e);else{if("object"!=typeof e)throw new f("observable-bind-to-parse-error",null);o={observable:e,properties:[]},t.to.push(o)}})),t}(...e),o=Array.from(this._bindings.keys()),n=o.length;if(!t.callback&&t.to.length>1)throw new f("observable-bind-to-no-callback",this);if(n>1&&t.callback)throw new f("observable-bind-to-extra-callback",this);var r;t.to.forEach((e=>{if(e.properties.length&&e.properties.length!==n)throw new f("observable-bind-to-properties-length",this);e.properties.length||(e.properties=this._bindProperties)})),this._to=t.to,t.callback&&(this._bindings.get(o[0]).callback=t.callback),r=this._observable,this._to.forEach((e=>{const t=r[O];let o;t.get(e.observable)||r.listenTo(e.observable,"change",((n,i)=>{o=t.get(e.observable)[i],o&&o.forEach((e=>{K(r,e.property)}))}))})),function(e){let t;e._bindings.forEach(((o,n)=>{e._to.forEach((r=>{t=r.properties[o.callback?0:e._bindProperties.indexOf(n)],o.to.push([r.observable,t]),function(e,t,o,n){const r=e[O],i=r.get(o),s=i||{};s[n]||(s[n]=new Set);s[n].add(t),i||r.set(o,s)}(e._observable,o,r.observable,t)}))}))}(this),this._bindProperties.forEach((e=>{K(this._observable,e)}))}function U(e,t,o){if(this._bindings.size>1)throw new f("observable-bind-to-many-not-one-binding",this);this.to(...function(e,t){const o=e.map((e=>[e,t]));return Array.prototype.concat.apply([],o)}(e,t),o)}function G(e){return e.every((e=>"string"==typeof e))}function K(e,t){const o=e[V].get(t);let n;o.callback?n=o.callback.apply(e,o.to.map((e=>e[0][e[1]]))):(n=o.to[0],n=n[0][n[1]]),Object.prototype.hasOwnProperty.call(e,t)?e[t]=n:e.set(t,n)}function Z(e){let t=0;for(const o of e)t++;return t}function J(e,t){const o=Math.min(e.length,t.length);for(let n=0;n{H[e]=q.prototype[e]}));const Y="object"==typeof global&&global&&global.Object===Object&&global;var X="object"==typeof self&&self&&self.Object===Object&&self;const ee=Y||X||Function("return this")();const te=ee.Symbol;var oe=Object.prototype,ne=oe.hasOwnProperty,re=oe.toString,ie=te?te.toStringTag:void 0;const se=function(e){var t=ne.call(e,ie),o=e[ie];try{e[ie]=void 0;var n=!0}catch(e){}var r=re.call(e);return n&&(t?e[ie]=o:delete e[ie]),r};var ae=Object.prototype.toString;const le=function(e){return ae.call(e)};var ce=te?te.toStringTag:void 0;const de=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ce&&ce in Object(e)?se(e):le(e)};const ue=Array.isArray;const he=function(e){return null!=e&&"object"==typeof e};const pe=function(e){return"string"==typeof e||!ue(e)&&he(e)&&"[object String]"==de(e)};function ge(e,t,o={},n=[]){const r=o&&o.xmlns,i=r?e.createElementNS(r,t):e.createElement(t);for(const e in o)i.setAttribute(e,o[e]);!pe(n)&&Q(n)||(n=[n]);for(let t of n)pe(t)&&(t=e.createTextNode(t)),i.appendChild(t);return i}const me=function(e,t){return function(o){return e(t(o))}};const fe=me(Object.getPrototypeOf,Object);var be=Function.prototype,ke=Object.prototype,we=be.toString,_e=ke.hasOwnProperty,ye=we.call(Object);const Ae=function(e){if(!he(e)||"[object Object]"!=de(e))return!1;var t=fe(e);if(null===t)return!0;var o=_e.call(t,"constructor")&&t.constructor;return"function"==typeof o&&o instanceof o&&we.call(o)==ye};const Ce=function(){this.__data__=[],this.size=0};const ve=function(e,t){return e===t||e!=e&&t!=t};const xe=function(e,t){for(var o=e.length;o--;)if(ve(e[o][0],t))return o;return-1};var Ee=Array.prototype.splice;const De=function(e){var t=this.__data__,o=xe(t,e);return!(o<0)&&(o==t.length-1?t.pop():Ee.call(t,o,1),--this.size,!0)};const Se=function(e){var t=this.__data__,o=xe(t,e);return o<0?void 0:t[o][1]};const Te=function(e){return xe(this.__data__,e)>-1};const Be=function(e,t){var o=this.__data__,n=xe(o,e);return n<0?(++this.size,o.push([e,t])):o[n][1]=t,this};function Ie(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991};var jt={};jt["[object Float32Array]"]=jt["[object Float64Array]"]=jt["[object Int8Array]"]=jt["[object Int16Array]"]=jt["[object Int32Array]"]=jt["[object Uint8Array]"]=jt["[object Uint8ClampedArray]"]=jt["[object Uint16Array]"]=jt["[object Uint32Array]"]=!0,jt["[object Arguments]"]=jt["[object Array]"]=jt["[object ArrayBuffer]"]=jt["[object Boolean]"]=jt["[object DataView]"]=jt["[object Date]"]=jt["[object Error]"]=jt["[object Function]"]=jt["[object Map]"]=jt["[object Number]"]=jt["[object Object]"]=jt["[object RegExp]"]=jt["[object Set]"]=jt["[object String]"]=jt["[object WeakMap]"]=!1;const qt=function(e){return he(e)&&Lt(e.length)&&!!jt[de(e)]};const Ht=function(e){return function(t){return e(t)}};var Wt="object"==typeof exports&&exports&&!exports.nodeType&&exports,$t=Wt&&"object"==typeof module&&module&&!module.nodeType&&module,Ut=$t&&$t.exports===Wt&&Y.process;const Gt=function(){try{var e=$t&&$t.require&&$t.require("util").types;return e||Ut&&Ut.binding&&Ut.binding("util")}catch(e){}}();var Kt=Gt&&Gt.isTypedArray;const Zt=Kt?Ht(Kt):qt;var Jt=Object.prototype.hasOwnProperty;const Qt=function(e,t){var o=ue(e),n=!o&&Pt(e),r=!o&&!n&&Ft(e),i=!o&&!n&&!r&&Zt(e),s=o||n||r||i,a=s?Dt(e.length,String):[],l=a.length;for(var c in e)!t&&!Jt.call(e,c)||s&&("length"==c||r&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Vt(c,l))||a.push(c);return a};var Yt=Object.prototype;const Xt=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Yt)};const eo=me(Object.keys,Object);var to=Object.prototype.hasOwnProperty;const oo=function(e){if(!Xt(e))return eo(e);var t=[];for(var o in Object(e))to.call(e,o)&&"constructor"!=o&&t.push(o);return t};const no=function(e){return null!=e&&Lt(e.length)&&!Fe(e)};const ro=function(e){return no(e)?Qt(e):oo(e)};const io=function(e,t){return e&&Et(t,ro(t),e)};const so=function(e){var t=[];if(null!=e)for(var o in Object(e))t.push(o);return t};var ao=Object.prototype.hasOwnProperty;const lo=function(e){if(!N(e))return so(e);var t=Xt(e),o=[];for(var n in e)("constructor"!=n||!t&&ao.call(e,n))&&o.push(n);return o};const co=function(e){return no(e)?Qt(e,!0):lo(e)};const uo=function(e,t){return e&&Et(t,co(t),e)};var ho="object"==typeof exports&&exports&&!exports.nodeType&&exports,po=ho&&"object"==typeof module&&module&&!module.nodeType&&module,go=po&&po.exports===ho?ee.Buffer:void 0,mo=go?go.allocUnsafe:void 0;const fo=function(e,t){if(t)return e.slice();var o=e.length,n=mo?mo(o):new e.constructor(o);return e.copy(n),n};const bo=function(e,t){var o=-1,n=e.length;for(t||(t=Array(n));++o{this._setToTarget(e,n,t[n],o)}))}}function An(e){return wn(e,Cn)}function Cn(e){return _n(e)?e:void 0}function vn(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 xn(e){const t=Object.prototype.toString.apply(e);return"[object Window]"==t||"[object global]"==t}const En=Dn(S());function Dn(e){if(!e)return En;return class extends e{listenTo(e,t,o,n={}){if(vn(e)||xn(e)){const r={capture:!!n.useCapture,passive:!!n.usePassive},i=this._getProxyEmitter(e,r)||new Sn(e,r);this.listenTo(i,t,o,n)}else super.listenTo(e,t,o,n)}stopListening(e,t,o){if(vn(e)||xn(e)){const n=this._getAllProxyEmitters(e);for(const e of n)this.stopListening(e,t,o)}else super.stopListening(e,t,o)}_getProxyEmitter(e,t){return function(e,t){const o=e[v];return o&&o[t]?o[t].emitter:null}(this,Tn(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))}}}["_getProxyEmitter","_getAllProxyEmitters","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach((e=>{Dn[e]=En.prototype[e]}));class Sn extends(S()){constructor(e,t){super(),T(this,Tn(e,t)),this._domNode=e,this._options=t}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,o){this.attach(e),S().prototype._addEventListener.call(this,e,t,o)}_removeEventListener(e,t){S().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 Tn(e,t){let o=function(e){return e["data-ck-expando"]||(e["data-ck-expando"]=h())}(e);for(const e of Object.keys(t).sort())t[e]&&(o+="-"+e);return o}let Bn;try{Bn={window,document}}catch(e){Bn={window:{},document:{}}}const In=Bn;function Pn(e){const t=[];let o=e;for(;o&&o.nodeType!=Node.DOCUMENT_NODE;)t.unshift(o),o=o.parentNode;return t}function Rn(e){return"[object Text]"==Object.prototype.toString.call(e)}function zn(e){return"[object Range]"==Object.prototype.toString.apply(e)}function Mn(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)}}const Nn=["top","right","bottom","left","width","height"];class Fn{constructor(e){const t=zn(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),Ln(e)||t)if(t){const t=Fn.getDomRangeRects(e);On(this,Fn.getBoundingRect(t))}else On(this,e.getBoundingClientRect());else if(xn(e)){const{innerWidth:t,innerHeight:o}=e;On(this,{top:0,right:t,bottom:o,left:0,width:t,height:o})}else On(this,e)}clone(){return new Fn(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};return t.width=t.right-t.left,t.height=t.bottom-t.top,t.width<0||t.height<0?null:new Fn(t)}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(!Vn(e)){let o=e.parentNode||e.commonAncestorContainer;for(;o&&!Vn(o);){const e=new Fn(o),n=t.getIntersection(e);if(!n)return null;n.getArea(){for(const t of e){const e=jn._getElementCallbacks(t.target);if(e)for(const o of e)o(t)}}))}}function qn(e,t){e instanceof HTMLTextAreaElement&&(e.value=t),e.innerHTML=t}function Hn(e){return t=>t+e}function Wn(e){let t=0;for(;e.previousSibling;)e=e.previousSibling,t++;return t}function $n(e,t,o){e.insertBefore(o,e.childNodes[t]||null)}function Un(e){return e&&e.nodeType===Node.COMMENT_NODE}function Gn(e){return!!(e&&e.getClientRects&&e.getClientRects().length)}function Kn({element:e,target:t,positions:o,limiter:n,fitInViewport:r,viewportOffsetConfig:i}){Fe(t)&&(t=t()),Fe(n)&&(n=n());const s=function(e){return e&&e.parentNode?e.offsetParent===In.document.body?null:e.offsetParent:null}(e),a=new Fn(e),l=new Fn(t);let c;const d=r&&function(e){e=Object.assign({top:0,bottom:0,left:0,right:0},e);const t=new Fn(In.window);return t.top+=e.top,t.height-=e.top,t.bottom-=e.bottom,t.height-=e.bottom,t}(i)||null,u={targetRect:l,elementRect:a,positionedElementAncestor:s,viewportRect:d};if(n||r){const e=n&&new Fn(n).getVisible();Object.assign(u,{limiterRect:e,viewportRect:d}),c=function(e,t){const{elementRect:o}=t,n=o.getArea(),r=e.map((e=>new Jn(e,t))).filter((e=>!!e.name));let i=0,s=null;for(const e of r){const{limiterIntersectionArea:t,viewportIntersectionArea:o}=e;if(t===n)return e;const r=o**2+t**2;r>i&&(i=r,s=e)}return s}(o,u)||new Jn(o[0],u)}else c=new Jn(o[0],u);return c}function Zn(e){const{scrollX:t,scrollY:o}=In.window;return e.clone().moveBy(t,o)}jn._observerInstance=null,jn._elementCallbacks=null;class Jn{constructor(e,t){const o=e(t.targetRect,t.elementRect,t.viewportRect);if(!o)return;const{left:n,top:r,name:i,config:s}=o;this.name=i,this.config=s,this._positioningFunctionCorrdinates={left:n,top:r},this._options=t}get left(){return this._absoluteRect.left}get top(){return this._absoluteRect.top}get limiterIntersectionArea(){const e=this._options.limiterRect;if(e){const t=this._options.viewportRect;if(!t)return e.getIntersectionArea(this._rect);{const o=e.getIntersection(t);if(o)return o.getIntersectionArea(this._rect)}}return 0}get viewportIntersectionArea(){const e=this._options.viewportRect;return e?e.getIntersectionArea(this._rect):0}get _rect(){return this._cachedRect||(this._cachedRect=this._options.elementRect.clone().moveTo(this._positioningFunctionCorrdinates.left,this._positioningFunctionCorrdinates.top)),this._cachedRect}get _absoluteRect(){return this._cachedAbsoluteRect||(this._cachedAbsoluteRect=Zn(this._rect),this._options.positionedElementAncestor&&function(e,t){const o=Zn(new Fn(t)),n=Mn(t);let r=0,i=0;r-=o.left,i-=o.top,r+=t.scrollLeft,i+=t.scrollTop,r-=n.left,i-=n.top,e.moveBy(r,i)}(this._cachedAbsoluteRect,this._options.positionedElementAncestor)),this._cachedAbsoluteRect}}function Qn(e){const t=e.parentNode;t&&t.removeChild(e)}function Yn({window:e,rect:t,alignToTop:o,forceScroll:n,viewportOffset:r}){const i=t.clone().moveBy(0,r),s=t.clone().moveBy(0,-r),a=new Fn(e).excludeScrollbarsAndBorders(),l=o&&n,c=[s,i].every((e=>a.contains(e)));let{scrollX:d,scrollY:u}=e;const h=d,p=u;l?u-=a.top-t.top+r:c||(tr(s,a)?u-=a.top-t.top+r:er(i,a)&&(u+=o?t.top-a.top-r:t.bottom-a.bottom+r)),c||(or(t,a)?d-=a.left-t.left+r:nr(t,a)&&(d+=t.right-a.right+r)),d==h&&u===p||e.scrollTo(d,u)}function Xn({parent:e,getRect:t,alignToTop:o,forceScroll:n,ancestorOffset:r=0}){const i=rr(e),s=o&&n;let a,l,c;for(;e!=i.document.body;)l=t(),a=new Fn(e).excludeScrollbarsAndBorders(),c=a.contains(l),s?e.scrollTop-=a.top-l.top+r:c||(tr(l,a)?e.scrollTop-=a.top-l.top+r:er(l,a)&&(e.scrollTop+=o?l.top-a.top-r:l.bottom-a.bottom+r)),c||(or(l,a)?e.scrollLeft-=a.left-l.left+r:nr(l,a)&&(e.scrollLeft+=l.right-a.right+r)),e=e.parentNode}function er(e,t){return e.bottom>t.bottom}function tr(e,t){return e.topt.right}function rr(e){return zn(e)?e.startContainer.ownerDocument.defaultView:e.ownerDocument.defaultView}function ir(e){if(zn(e)){let t=e.commonAncestorContainer;return Rn(t)&&(t=t.parentNode),t}return e.parentNode}function sr(e,t){const o=rr(e),n=new Fn(e);if(o===t)return n;{let e=o;for(;e!=t;){const t=e.frameElement,o=new Fn(t).excludeScrollbarsAndBorders();n.moveBy(o.left,o.top),e=e.parent}}return n}const ar={ctrl:"⌃",cmd:"⌘",alt:"⌥",shift:"⇧"},lr={ctrl:"Ctrl+",alt:"Alt+",shift:"Shift+"},cr=function(){const e={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;for(const t of"`-=[];',./\\")e[t]=t.charCodeAt(0);return e}(),dr=Object.fromEntries(Object.entries(cr).map((([e,t])=>[t,e.charAt(0).toUpperCase()+e.slice(1)])));function ur(e){let t;if("string"==typeof e){if(t=cr[e.toLowerCase()],!t)throw new f("keyboard-unknown-key",null,{key:e})}else t=e.keyCode+(e.altKey?cr.alt:0)+(e.ctrlKey?cr.ctrl:0)+(e.shiftKey?cr.shift:0)+(e.metaKey?cr.cmd:0);return t}function hr(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 ur(e.slice(0,-1));const t=ur(e);return n.isMac&&t==cr.ctrl?cr.cmd:t}(e):e)).reduce(((e,t)=>t+e),0)}function pr(e){let t=hr(e);return Object.entries(n.isMac?ar:lr).reduce(((e,[o,n])=>(0!=(t&cr[o])&&(t&=~cr[o],e+=n),e)),"")+(t?dr[t]:"")}function gr(e,t){const o="ltr"===t;switch(e){case cr.arrowleft:return o?"left":"right";case cr.arrowright:return o?"right":"left";case cr.arrowup:return"up";case cr.arrowdown:return"down"}}function mr(e){return Array.isArray(e)?e:[e]}function fr(e,t,o=1){if("number"!=typeof o)throw new f("translation-service-quantity-not-a-number",null,{quantity:o});const n=Object.keys(In.window.CKEDITOR_TRANSLATIONS).length;1===n&&(e=Object.keys(In.window.CKEDITOR_TRANSLATIONS)[0]);const r=t.id||t.string;if(0===n||!function(e,t){return!!In.window.CKEDITOR_TRANSLATIONS[e]&&!!In.window.CKEDITOR_TRANSLATIONS[e].dictionary[t]}(e,r))return 1!==o?t.plural:t.string;const i=In.window.CKEDITOR_TRANSLATIONS[e].dictionary,s=In.window.CKEDITOR_TRANSLATIONS[e].getPluralForm||(e=>1===e?0:1),a=i[r];if("string"==typeof a)return a;return a[Number(s(o))]}In.window.CKEDITOR_TRANSLATIONS||(In.window.CKEDITOR_TRANSLATIONS={});const br=["ar","ara","fa","per","fas","he","heb","ku","kur","ug","uig"];function kr(e){return br.includes(e)?"rtl":"ltr"}class wr{constructor({uiLanguage:e="en",contentLanguage:t}={}){this.uiLanguage=e,this.contentLanguage=t||this.uiLanguage,this.uiLanguageDirection=kr(this.uiLanguage),this.contentLanguageDirection=kr(this.contentLanguage),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=mr(t),"string"==typeof e&&(e={string:e});const o=!!e.plural?t[0]:1;return function(e,t){return e.replace(/%(\d+)/g,((e,o)=>othis._items.length||t<0)throw new f("collection-add-item-invalid-index",this);let o=0;for(const n of e){const e=this._getItemIdBeforeAdding(n),r=t+o;this._items.splice(r,0,n),this._itemMap.set(e,n),this.fire("add",n,r),o++}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 f("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,o]=this._remove(e);return this.fire("change",{added:[],removed:[t],index:o}),t}map(e,t){return this._items.map(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 f("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,o=(o,n,r)=>{const i=t._bindToCollection==this,s=t._bindToInternalToExternalMap.get(n);if(i&&s)this._bindToExternalToInternalMap.set(n,s),this._bindToInternalToExternalMap.set(s,n);else{const o=e(n);if(!o)return void this._skippedIndexesFromExternal.push(r);let i=r;for(const e of this._skippedIndexesFromExternal)r>e&&i--;for(const e of t._skippedIndexesFromExternal)i>=e&&i++;this._bindToExternalToInternalMap.set(n,o),this._bindToInternalToExternalMap.set(o,n),this.add(o,i);for(let e=0;e{const n=this._bindToExternalToInternalMap.get(t);n&&this.remove(n),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce(((e,t)=>(ot&&e.push(t),e)),[])}))}_getItemIdBeforeAdding(e){const t=this._idProperty;let o;if(t in e){if(o=e[t],"string"!=typeof o)throw new f("collection-add-invalid-id",this);if(this.get(o))throw new f("collection-add-item-already-exists",this)}else e[t]=o=h();return o}_remove(e){let t,o,n,r=!1;const i=this._idProperty;if("string"==typeof e?(o=e,n=this._itemMap.get(o),r=!n,n&&(t=this._items.indexOf(n))):"number"==typeof e?(t=e,n=this._items[t],r=!n,n&&(o=n[i])):(n=e,o=n[i],t=this._items.indexOf(n),r=-1==t||!this._itemMap.get(o)),r)throw new f("collection-remove-404",this);this._items.splice(t,1),this._itemMap.delete(o);const s=this._bindToInternalToExternalMap.get(n);return this._bindToInternalToExternalMap.delete(n),this._bindToExternalToInternalMap.delete(s),this.fire("remove",n,t),[n,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}}function yr(e){const t=e.next();return t.done?null:t.value}class Ar extends(Dn(H())){constructor(){super(),this._elements=new Set,this._nextEventLoopTimeout=null,this.set("isFocused",!1),this.set("focusedElement",null)}add(e){if(this._elements.has(e))throw new f("focustracker-add-element-already-exist",this);this.listenTo(e,"focus",(()=>this._focus(e)),{useCapture:!0}),this.listenTo(e,"blur",(()=>this._blur()),{useCapture:!0}),this._elements.add(e)}remove(e){e===this.focusedElement&&this._blur(),this._elements.has(e)&&(this.stopListening(e),this._elements.delete(e))}destroy(){this.stopListening()}_focus(e){clearTimeout(this._nextEventLoopTimeout),this.focusedElement=e,this.isFocused=!0}_blur(){clearTimeout(this._nextEventLoopTimeout),this._nextEventLoopTimeout=setTimeout((()=>{this.focusedElement=null,this.isFocused=!1}),0)}}class Cr{constructor(){this._listener=new(Dn())}listenTo(e){this._listener.listenTo(e,"keydown",((e,t)=>{this._listener.fire("_keydown:"+ur(t),t)}))}set(e,t,o={}){const n=hr(e),r=o.priority;this._listener.listenTo(this._listener,"_keydown:"+n,((e,o)=>{t(o,(()=>{o.preventDefault(),o.stopPropagation(),e.stop()})),e.return=!0}),{priority:r})}press(e){return!!this._listener.fire("_keydown:"+ur(e),e)}stopListening(e){this._listener.stopListening(e)}destroy(){this.stopListening()}}function vr(e){return Q(e)?new Map(e):function(e){const t=new Map;for(const o in e)t.set(o,e[o]);return t}(e)}function xr(e,t){let o;function n(...r){n.cancel(),o=setTimeout((()=>e(...r)),t)}return n.cancel=()=>{clearTimeout(o)},n}function Er(e,t){return!!(o=e.charAt(t-1))&&1==o.length&&/[\ud800-\udbff]/.test(o)&&function(e){return!!e&&1==e.length&&/[\udc00-\udfff]/.test(e)}(e.charAt(t));var o}function Dr(e,t){return!!(o=e.charAt(t))&&1==o.length&&/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test(o);var o}const Sr=function(){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")}();function Tr(e,t){const o=String(e).matchAll(Sr);return Array.from(o).some((e=>e.index{this.refresh()})),this.listenTo(e,"change:isReadOnly",(()=>{this.refresh()})),this.on("set:isEnabled",(t=>{this.affectsData&&(e.isReadOnly||this._isEnabledBasedOnSelection&&!e.model.canEditAt(e.model.document.selection))&&(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",Rr,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",Rr),this.refresh())}execute(...e){}destroy(){this.stopListening()}}function Rr(e){e.return=!1,e.stop()}class zr extends(S()){constructor(e,t=[],o=[]){super(),this._plugins=new Map,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 o)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 f("plugincollection-plugin-not-loaded",this._context,{plugin:t})}return t}has(e){return this._plugins.has(e)}init(e,t=[],o=[]){const n=this,r=this._context;!function e(t,o=new Set){t.forEach((t=>{a(t)&&(o.has(t)||(o.add(t),t.pluginName&&!n._availablePlugins.has(t.pluginName)&&n._availablePlugins.set(t.pluginName,t),t.requires&&e(t.requires,o)))}))}(e),u(e);const i=[...function e(t,o=new Set){return t.map((e=>a(e)?e:n._availablePlugins.get(e))).reduce(((t,n)=>o.has(n)?t:(o.add(n),n.requires&&(u(n.requires,n),e(n.requires,o).forEach((e=>t.add(e)))),t.add(n))),new Set)}(e.filter((e=>!c(e,t))))];!function(e,t){for(const o of t){if("function"!=typeof o)throw new f("plugincollection-replace-plugin-invalid-type",null,{pluginItem:o});const t=o.pluginName;if(!t)throw new f("plugincollection-replace-plugin-missing-name",null,{pluginItem:o});if(o.requires&&o.requires.length)throw new f("plugincollection-plugin-for-replacing-cannot-have-dependencies",null,{pluginName:t});const r=n._availablePlugins.get(t);if(!r)throw new f("plugincollection-plugin-for-replacing-not-exist",null,{pluginName:t});const i=e.indexOf(r);if(-1===i){if(n._contextPlugins.has(r))return;throw new f("plugincollection-plugin-for-replacing-not-loaded",null,{pluginName:t})}if(r.requires&&r.requires.length)throw new f("plugincollection-replaced-plugin-cannot-have-dependencies",null,{pluginName:t});e.splice(i,1,o),n._availablePlugins.set(t,o)}}(i,o);const s=function(e){return e.map((e=>{let t=n._contextPlugins.get(e);return t=t||new e(r),n._add(e,t),t}))}(i);return h(s,"init").then((()=>h(s,"afterInit"))).then((()=>s));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,o=null){e.map((e=>a(e)?e:n._availablePlugins.get(e)||e)).forEach((e=>{!function(e,t){if(a(e))return;if(t)throw new f("plugincollection-soft-required",r,{missingPlugin:e,requiredBy:d(t)});throw new f("plugincollection-plugin-not-found",r,{plugin:e})}(e,o),function(e,t){if(!l(t))return;if(l(e))return;throw new f("plugincollection-context-required",r,{plugin:d(e),requiredBy:d(t)})}(e,o),function(e,o){if(!o)return;if(!c(e,t))return;throw new f("plugincollection-required",r,{plugin:d(e),requiredBy:d(o)})}(e,o)}))}function h(e,t){return e.reduce(((e,o)=>o[t]?n._contextPlugins.has(o)?e:e.then(o[t].bind(o)):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 o=e.pluginName;if(o){if(this._plugins.has(o))throw new f("plugincollection-plugin-name-conflict",null,{pluginName:o,plugin1:this._plugins.get(o).constructor,plugin2:e});this._plugins.set(o,t)}}}class Mr{constructor(e){this._contextOwner=null,this.config=new yn(e,this.constructor.defaultConfig);const t=this.constructor.builtinPlugins;this.config.define("plugins",t),this.plugins=new zr(this,t);const o=this.config.get("language")||{};this.locale=new wr({uiLanguage:"string"==typeof o?o:o.ui,contentLanguage:this.config.get("language.content")}),this.t=this.locale.t,this.editors=new _r}initPlugins(){const e=this.config.get("plugins")||[],t=this.config.get("substitutePlugins")||[];for(const o of e.concat(t)){if("function"!=typeof o)throw new f("context-initplugins-constructor-only",null,{Plugin:o});if(!0!==o.isContextPlugin)throw new f("context-initplugins-invalid-plugin",null,{Plugin:o})}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 f("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 o=new this(e);t(o.initPlugins().then((()=>o)))}))}}class Nr extends(H()){constructor(e){super(),this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return!0}}var Fr=o(3379),Or=o.n(Fr),Vr=o(9037),Lr=o.n(Vr),jr=o(569),qr=o.n(jr),Hr=o(8575),Wr=o.n(Hr),$r=o(9216),Ur=o.n($r),Gr=o(8894),Kr={attributes:{"data-cke":!0}};Kr.setAttributes=Wr(),Kr.insert=qr().bind(null,"head"),Kr.domAPI=Lr(),Kr.insertStyleElement=Ur();Or()(Gr.Z,Kr);Gr.Z&&Gr.Z.locals&&Gr.Z.locals;const Zr=new WeakMap;function Jr({view:e,element:t,text:o,isDirectHost:n=!0,keepOnFocus:r=!1}){const i=e.document;Zr.has(i)||(Zr.set(i,new Map),i.registerPostFixer((e=>Yr(i,e))),i.on("change:isComposing",(()=>{e.change((e=>Yr(i,e)))}),{priority:"high"})),Zr.get(i).set(t,{text:o,isDirectHost:n,keepOnFocus:r,hostElement:n?t:null}),e.change((e=>Yr(i,e)))}function Qr(e,t){return!!t.hasClass("ck-placeholder")&&(e.removeClass("ck-placeholder",t),!0)}function Yr(e,t){const o=Zr.get(e),n=[];let r=!1;for(const[e,i]of o)i.isDirectHost&&(n.push(e),Xr(t,e,i)&&(r=!0));for(const[e,i]of o){if(i.isDirectHost)continue;const o=ei(e);o&&(n.includes(o)||(i.hostElement=o,Xr(t,e,i)&&(r=!0)))}return r}function Xr(e,t,o){const{text:n,isDirectHost:r,hostElement:i}=o;let s=!1;i.getAttribute("data-placeholder")!==n&&(e.setAttribute("data-placeholder",n,i),s=!0);return(r||1==t.childCount)&&function(e,t){if(!e.isAttached())return!1;const o=Array.from(e.getChildren()).some((e=>!e.is("uiElement")));if(o)return!1;const n=e.document,r=n.selection.anchor;return!(n.isComposing&&r&&r.parent===e||!t&&n.isFocused&&(!r||r.parent===e))}(i,o.keepOnFocus)?function(e,t){return!t.hasClass("ck-placeholder")&&(e.addClass("ck-placeholder",t),!0)}(e,i)&&(s=!0):Qr(e,i)&&(s=!0),s}function ei(e){if(e.childCount){const t=e.getChild(0);if(t.is("element")&&!t.is("uiElement")&&!t.is("attributeElement"))return t}return null}class ti{is(){throw new Error("is() method is abstract")}}const oi=function(e){return kn(e,4)};class ni extends(S(ti)){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 f("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 o=e.includeSelf?this:this.parent;for(;o;)t[e.parentFirst?"push":"unshift"](o),o=o.parent;return t}getCommonAncestor(e,t={}){const o=this.getAncestors(t),n=e.getAncestors(t);let r=0;for(;o[r]==n[r]&&o[r];)r++;return 0===r?null:o[r-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),o=e.getPath(),n=J(t,o);switch(n){case"prefix":return!0;case"extension":return!1;default:return t[n]e.data.length)throw new f("view-textproxy-wrong-offsetintext",this);if(o<0||t+o>e.data.length)throw new f("view-textproxy-wrong-length",this);this.data=e.data.substring(t,t+o),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 o=e.includeSelf?this.textNode:this.parent;for(;null!==o;)t[e.parentFirst?"push":"unshift"](o),o=o.parent;return t}}ii.prototype.is=function(e){return"$textProxy"===e||"view:$textProxy"===e||"textProxy"===e||"view:textProxy"===e};class si{constructor(...e){this._patterns=[],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 o=ai(t,e);if(o)return{element:t,pattern:e,match:o}}return null}matchAll(...e){const t=[];for(const o of e)for(const e of this._patterns){const n=ai(o,e);n&&t.push({element:o,pattern:e,match:n})}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 ai(e,t){if("function"==typeof t)return t(e);const o={};return t.name&&(o.name=function(e,t){if(e instanceof RegExp)return!!t.match(e);return e===t}(t.name,e.name),!o.name)||t.attributes&&(o.attributes=function(e,t){const o=new Set(t.getAttributeKeys());Ae(e)?(void 0!==e.style&&b("matcher-pattern-deprecated-attributes-style-key",e),void 0!==e.class&&b("matcher-pattern-deprecated-attributes-class-key",e)):(o.delete("style"),o.delete("class"));return li(e,o,(e=>t.getAttribute(e)))}(t.attributes,e),!o.attributes)||t.classes&&(o.classes=function(e,t){return li(e,t.getClassNames(),(()=>{}))}(t.classes,e),!o.classes)||t.styles&&(o.styles=function(e,t){return li(e,t.getStyleNames(!0),(e=>t.getStyle(e)))}(t.styles,e),!o.styles)?null:o}function li(e,t,o){const n=function(e){if(Array.isArray(e))return e.map((e=>Ae(e)?(void 0!==e.key&&void 0!==e.value||b("matcher-pattern-missing-key-or-value",e),[e.key,e.value]):[e,!0]));if(Ae(e))return Object.entries(e);return[[e,!0]]}(e),r=Array.from(t),i=[];if(n.forEach((([e,t])=>{r.forEach((n=>{(function(e,t){return!0===e||e===t||e instanceof RegExp&&t.match(e)})(e,n)&&function(e,t,o){if(!0===e)return!0;const n=o(t);return e===n||e instanceof RegExp&&!!String(n).match(e)}(t,n,o)&&i.push(n)}))})),n.length&&!(i.lengthr?0:r+t),(o=o>r?r:o)<0&&(o+=r),r=t>o?0:o-t>>>0,t>>>=0;for(var i=Array(r);++n0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}};const Zi=Ki(Ui);const Ji=function(e,t){return Zi(Wi(e,t,ji),e+"")};const Qi=function(e,t,o){if(!N(o))return!1;var n=typeof t;return!!("number"==n?no(o)&&Vt(t,o.length):"string"==n&&t in o)&&ve(o[t],e)};const Yi=function(e){return Ji((function(t,o){var n=-1,r=o.length,i=r>1?o[r-1]:void 0,s=r>2?o[2]:void 0;for(i=e.length>3&&"function"==typeof i?(r--,i):void 0,s&&Qi(o[0],o[1],s)&&(i=r<3?void 0:i,r=1),t=Object(t);++nt===e));return Array.isArray(t)}set(e,t){if(N(e))for(const[t,o]of Object.entries(e))this._styleProcessor.toNormalizedForm(t,o,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles)}remove(e){const t=is(e);Pi(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]&&!N(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){if(this.isEmpty)return[];if(e)return this._styleProcessor.getStyleNames(this._styles);return this._getStylesEntries().map((([e])=>e))}clear(){this._styles={}}_getStylesEntries(){const e=[],t=Object.keys(this._styles);for(const o of t)e.push(...this._styleProcessor.getReducedForm(o,this._styles));return e}_cleanEmptyObjectsOnPath(e){const t=e.split(".");if(!(t.length>1))return;const o=t.splice(0,t.length-1).join("."),n=Ri(this._styles,o);if(!n)return;!Array.from(Object.keys(n)).length&&this.remove(o)}}class rs{constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,o){if(N(t))ss(o,is(e),t);else if(this._normalizers.has(e)){const n=this._normalizers.get(e),{path:r,value:i}=n(t);ss(o,r,i)}else ss(o,e,t)}getNormalized(e,t){if(!e)return es({},t);if(void 0!==t[e])return t[e];if(this._extractors.has(e)){const o=this._extractors.get(e);if("string"==typeof o)return Ri(t,o);const n=o(e,t);if(n)return n}return Ri(t,is(e))}getReducedForm(e,t){const o=this.getNormalized(e,t);if(void 0===o)return[];if(this._reducers.has(e)){return this._reducers.get(e)(o)}return[[e,o]]}getStyleNames(e){const t=Array.from(this._consumables.keys()).filter((t=>{const o=this.getNormalized(t,e);return o&&"object"==typeof o?Object.keys(o).length:o})),o=new Set([...t,...Object.keys(e)]);return Array.from(o.values())}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 o of t)this._mapStyleNames(o,[e])}_mapStyleNames(e,t){this._consumables.has(e)||this._consumables.set(e,[]),this._consumables.get(e).push(...t)}}function is(e){return e.replace("-",".")}function ss(e,t,o){let n=o;N(o)&&(n=es({},Ri(e,t),o)),os(e,t,n)}class as extends ni{constructor(e,t,o,n){if(super(e),this._unsafeAttributesToRender=[],this._customProperties=new Map,this.name=t,this._attrs=function(e){const t=vr(e);for(const[e,o]of t)null===o?t.delete(e):"string"!=typeof o&&t.set(e,String(o));return t}(o),this._children=[],n&&this._insertChild(0,n),this._classes=new Set,this._attrs.has("class")){const e=this._attrs.get("class");ls(this._classes,e),this._attrs.delete("class")}this._styles=new ns(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(e){if(!(e instanceof as))return!1;if(this===e)return!0;if(this.name!=e.name)return!1;if(this._attrs.size!==e._attrs.size||this._classes.size!==e._classes.size||this._styles.size!==e._styles.size)return!1;for(const[t,o]of this._attrs)if(!e._attrs.has(t)||e._attrs.get(t)!==o)return!1;for(const t of this._classes)if(!e._classes.has(t))return!1;for(const t of this._styles.getStyleNames())if(!e._styles.has(t)||e._styles.getAsString(t)!==this._styles.getAsString(t))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 si(...e);let o=this.parent;for(;o&&!o.is("documentFragment");){if(t.match(o))return o;o=o.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(),o=Array.from(this._attrs).map((e=>`${e[0]}="${e[1]}"`)).sort().join(" ");return this.name+(""==e?"":` class="${e}"`)+(t?` style="${t}"`:"")+(""==o?"":` ${o}`)}shouldRenderUnsafeAttribute(e){return this._unsafeAttributesToRender.includes(e)}_clone(e=!1){const t=[];if(e)for(const o of this.getChildren())t.push(o._clone(e));const o=new this.constructor(this.document,this.name,this._attrs,t);return o._classes=new Set(this._classes),o._styles.set(this._styles.getNormalized()),o._customProperties=new Map(this._customProperties),o.getFillerOffset=this.getFillerOffset,o._unsafeAttributesToRender=this._unsafeAttributesToRender,o}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange("children",this);let o=0;const n=function(e,t){if("string"==typeof t)return[new ri(e,t)];Q(t)||(t=[t]);return Array.from(t).map((t=>"string"==typeof t?new ri(e,t):t instanceof ii?new ri(e,t.data):t))}(this.document,t);for(const t of n)null!==t.parent&&t._remove(),t.parent=this,t.document=this.document,this._children.splice(e,0,t),e++,o++;return o}_removeChildren(e,t=1){this._fireChange("children",this);for(let o=e;o0&&(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 mr(e))this._classes.add(t)}_removeClass(e){this._fireChange("attributes",this);for(const t of mr(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 mr(e))this._styles.remove(t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}}function ls(e,t){const o=t.split(/\s+/);e.clear(),o.forEach((t=>e.add(t)))}as.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 cs extends as{constructor(e,t,o,n){super(e,t,o,n),this.getFillerOffset=ds}}function ds(){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}cs.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 us extends(H(cs)){constructor(e,t,o,n){super(e,t,o,n),this.set("isReadOnly",!1),this.set("isFocused",!1),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()}}us.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 hs=Symbol("rootName");class ps extends us{constructor(e,t){super(e,t),this.rootName="main"}get rootName(){return this.getCustomProperty(hs)}set rootName(e){this._setCustomProperty(hs,e)}set _name(e){this.name=e}}ps.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};class gs{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new f("view-tree-walker-no-start-position",null);if(e.direction&&"forward"!=e.direction&&"backward"!=e.direction)throw new f("view-tree-walker-unknown-direction",e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,e.startPosition?this._position=ms._createAt(e.startPosition):this._position=ms._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,o;do{o=this.position,t=this.next()}while(!t.done&&e(t.value));t.done||(this._position=o)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){let e=this.position.clone();const t=this.position,o=e.parent;if(null===o.parent&&e.offset===o.childCount)return{done:!0,value:void 0};if(o===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0,value:void 0};let n;if(o instanceof ri){if(e.isAtEnd)return this._position=ms._createAfter(o),this._next();n=o.data[e.offset]}else n=o.getChild(e.offset);if(n instanceof as)return this.shallow?e.offset++:e=new ms(n,0),this._position=e,this._formatReturnValue("elementStart",n,t,e,1);if(n instanceof ri){if(this.singleCharacters)return e=new ms(n,0),this._position=e,this._next();{let o,r=n.data.length;return n==this._boundaryEndParent?(r=this.boundaries.end.offset,o=new ii(n,0,r),e=ms._createAfter(o)):(o=new ii(n,0,n.data.length),e.offset++),this._position=e,this._formatReturnValue("text",o,t,e,r)}}if("string"==typeof n){let n;if(this.singleCharacters)n=1;else{n=(o===this._boundaryEndParent?this.boundaries.end.offset:o.data.length)-e.offset}const r=new ii(o,e.offset,n);return e.offset+=n,this._position=e,this._formatReturnValue("text",r,t,e,n)}return e=ms._createAfter(o),this._position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",o,t,e)}_previous(){let e=this.position.clone();const t=this.position,o=e.parent;if(null===o.parent&&0===e.offset)return{done:!0,value:void 0};if(o==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0,value:void 0};let n;if(o instanceof ri){if(e.isAtStart)return this._position=ms._createBefore(o),this._previous();n=o.data[e.offset-1]}else n=o.getChild(e.offset-1);if(n instanceof as)return this.shallow?(e.offset--,this._position=e,this._formatReturnValue("elementStart",n,t,e,1)):(e=new ms(n,n.childCount),this._position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",n,t,e));if(n instanceof ri){if(this.singleCharacters)return e=new ms(n,n.data.length),this._position=e,this._previous();{let o,r=n.data.length;if(n==this._boundaryStartParent){const t=this.boundaries.start.offset;o=new ii(n,t,n.data.length-t),r=o.data.length,e=ms._createBefore(o)}else o=new ii(n,0,n.data.length),e.offset--;return this._position=e,this._formatReturnValue("text",o,t,e,r)}}if("string"==typeof n){let n;if(this.singleCharacters)n=1;else{const t=o===this._boundaryStartParent?this.boundaries.start.offset:0;n=e.offset-t}e.offset-=n;const r=new ii(o,e.offset,n);return this._position=e,this._formatReturnValue("text",r,t,e,n)}return e=ms._createBefore(o),this._position=e,this._formatReturnValue("elementStart",o,t,e,1)}_formatReturnValue(e,t,o,n,r){return t instanceof ii&&(t.offsetInText+t.data.length==t.textNode.data.length&&("forward"!=this.direction||this.boundaries&&this.boundaries.end.isEqual(this.position)?o=ms._createAfter(t.textNode):(n=ms._createAfter(t.textNode),this._position=n)),0===t.offsetInText&&("backward"!=this.direction||this.boundaries&&this.boundaries.start.isEqual(this.position)?o=ms._createBefore(t.textNode):(n=ms._createBefore(t.textNode),this._position=n))),{done:!1,value:{type:e,item:t,previousPosition:o,nextPosition:n,length:r}}}}class ms extends ti{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 us);){if(!e.parent)return null;e=e.parent}return e}getShiftedBy(e){const t=ms._createAt(this),o=t.offset+e;return t.offset=o<0?0:o,t}getLastMatchingPosition(e,t={}){t.startPosition=this;const o=new gs(t);return o.skip(e),o.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const t=this.getAncestors(),o=e.getAncestors();let n=0;for(;t[n]==o[n]&&t[n];)n++;return 0===n?null:t[n-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():[],o=e.parent.is("node")?e.parent.getPath():[];t.push(this.offset),o.push(e.offset);const n=J(t,o);switch(n){case"prefix":return"before";case"extension":return"after";default:return t[n]0?new this(o,n):new this(n,o)}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(ms._createBefore(e),t)}}function bs(e){return!(!e.item.is("attributeElement")&&!e.item.is("uiElement"))}fs.prototype.is=function(e){return"range"===e||"view:range"===e};class ks extends(S(ti)){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 o=!1;for(const n of e._ranges)if(t.isEqual(n)){o=!0;break}if(!o)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const t=Z(this.getRanges());if(t!=Z(e.getRanges()))return!1;if(0==t)return!0;for(let t of this.getRanges()){t=t.getTrimmed();let o=!1;for(let n of e.getRanges())if(n=n.getTrimmed(),t.start.isEqual(n.start)&&t.end.isEqual(n.end)){o=!0;break}if(!o)return!1}return!0}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}setTo(...e){let[t,o,n]=e;if("object"==typeof o&&(n=o,o=void 0),null===t)this._setRanges([]),this._setFakeOptions(n);else if(t instanceof ks||t instanceof ws)this._setRanges(t.getRanges(),t.isBackward),this._setFakeOptions({fake:t.isFake,label:t.fakeSelectionLabel});else if(t instanceof fs)this._setRanges([t],n&&n.backward),this._setFakeOptions(n);else if(t instanceof ms)this._setRanges([new fs(t)]),this._setFakeOptions(n);else if(t instanceof ni){const e=!!n&&!!n.backward;let r;if(void 0===o)throw new f("view-selection-setto-required-second-parameter",this);r="in"==o?fs._createIn(t):"on"==o?fs._createOn(t):new fs(ms._createAt(t,o)),this._setRanges([r],e),this._setFakeOptions(n)}else{if(!Q(t))throw new f("view-selection-setto-not-selectable",this);this._setRanges(t,n&&n.backward),this._setFakeOptions(n)}this.fire("change")}setFocus(e,t){if(null===this.anchor)throw new f("view-selection-setfocus-no-ranges",this);const o=ms._createAt(e,t);if("same"==o.compareWith(this.focus))return;const n=this.anchor;this._ranges.pop(),"before"==o.compareWith(n)?this._addRange(new fs(o,n),!0):this._addRange(new fs(n,o)),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 fs))throw new f("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 f("view-selection-range-intersects",this,{addedRange:e,intersectingRange:t});this._ranges.push(new fs(e.start,e.end))}}ks.prototype.is=function(e){return"selection"===e||"view:selection"===e};class ws extends(S(ti)){constructor(...e){super(),this._selection=new ks,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)}}ws.prototype.is=function(e){return"selection"===e||"documentSelection"==e||"view:selection"==e||"view:documentSelection"==e};class _s extends d{constructor(e,t,o){super(e,t),this.startRange=o,this._eventPhase="none",this._currentTarget=null}get eventPhase(){return this._eventPhase}get currentTarget(){return this._currentTarget}}const ys=Symbol("bubbling contexts");function As(e){return class extends e{fire(e,...t){try{const o=e instanceof d?e:new d(this,e),n=Es(this);if(!n.size)return;if(Cs(o,"capturing",this),vs(n,"$capture",o,...t))return o.return;const r=o.startRange||this.selection.getFirstRange(),i=r?r.getContainedElement():null,s=!!i&&Boolean(xs(n,i));let a=i||function(e){if(!e)return null;const t=e.start.parent,o=e.end.parent,n=t.getPath(),r=o.getPath();return n.length>r.length?t:o}(r);if(Cs(o,"atTarget",a),!s){if(vs(n,"$text",o,...t))return o.return;Cs(o,"bubbling",a)}for(;a;){if(a.is("rootElement")){if(vs(n,"$root",o,...t))return o.return}else if(a.is("element")&&vs(n,a.name,o,...t))return o.return;if(vs(n,a,o,...t))return o.return;a=a.parent,Cs(o,"bubbling",a)}return Cs(o,"bubbling",this),vs(n,"$document",o,...t),o.return}catch(e){f.rethrowUnexpectedError(e,this)}}_addEventListener(e,t,o){const n=mr(o.context||"$document"),r=Es(this);for(const i of n){let n=r.get(i);n||(n=new(S()),r.set(i,n)),this.listenTo(n,e,t,o)}}_removeEventListener(e,t){const o=Es(this);for(const n of o.values())this.stopListening(n,e,t)}}}{const e=As(Object);["fire","_addEventListener","_removeEventListener"].forEach((t=>{As[t]=e.prototype[t]}))}function Cs(e,t,o){e instanceof _s&&(e._eventPhase=t,e._currentTarget=o)}function vs(e,t,o,...n){const r="string"==typeof t?e.get(t):xs(e,t);return!!r&&(r.fire(o,...n),o.stop.called)}function xs(e,t){for(const[o,n]of e)if("function"==typeof o&&o(t))return n;return null}function Es(e){return e[ys]||(e[ys]=new Map),e[ys]}class Ds extends(As(H())){constructor(e){super(),this._postFixers=new Set,this.selection=new ws,this.roots=new _r({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.map((e=>e.destroy())),this.stopListening()}_callPostFixers(e){let t=!1;do{for(const o of this._postFixers)if(t=o(e),t)break}while(t)}}class Ss extends as{constructor(e,t,o,n){super(e,t,o,n),this._priority=10,this._id=null,this._clonesGroup=null,this.getFillerOffset=Ts}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(null===this.id)throw new f("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 Ts(){if(Bs(this))return null;let e=this.parent;for(;e&&e.is("attributeElement");){if(Bs(e)>1)return null;e=e.parent}return!e||Bs(e)>1?null:this.childCount}function Bs(e){return Array.from(e.getChildren()).filter((e=>!e.is("uiElement"))).length}Ss.DEFAULT_PRIORITY=10,Ss.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 Is extends as{constructor(e,t,o,n){super(e,t,o,n),this.getFillerOffset=Ps}_insertChild(e,t){if(t&&(t instanceof ni||Array.from(t).length>0))throw new f("view-emptyelement-cannot-add",[this,t]);return 0}}function Ps(){return null}Is.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 Rs extends as{constructor(e,t,o,n){super(e,t,o,n),this.getFillerOffset=Ms}_insertChild(e,t){if(t&&(t instanceof ni||Array.from(t).length>0))throw new f("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 zs(e){e.document.on("arrowKey",((t,o)=>function(e,t,o){if(t.keyCode==cr.arrowright){const e=t.domTarget.ownerDocument.defaultView.getSelection(),n=1==e.rangeCount&&e.getRangeAt(0).collapsed;if(n||t.shiftKey){const t=e.focusNode,r=e.focusOffset,i=o.domPositionToView(t,r);if(null===i)return;let s=!1;const a=i.getLastMatchingPosition((e=>(e.item.is("uiElement")&&(s=!0),!(!e.item.is("uiElement")&&!e.item.is("attributeElement")))));if(s){const t=o.viewPositionToDom(a);n?e.collapse(t.parent,t.offset):e.extend(t.parent,t.offset)}}}}(0,o,e.domConverter)),{priority:"low"})}function Ms(){return null}Rs.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 Ns extends as{constructor(e,t,o,n){super(e,t,o,n),this.getFillerOffset=Fs}_insertChild(e,t){if(t&&(t instanceof ni||Array.from(t).length>0))throw new f("view-rawelement-cannot-add",[this,t]);return 0}render(e,t){}}function Fs(){return null}Ns.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};class Os extends(S(ti)){constructor(e,t){super(),this._children=[],this._customProperties=new Map,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(){}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);let o=0;const n=function(e,t){if("string"==typeof t)return[new ri(e,t)];Q(t)||(t=[t]);return Array.from(t).map((t=>"string"==typeof t?new ri(e,t):t instanceof ii?new ri(e,t.data):t))}(this.document,t);for(const t of n)null!==t.parent&&t._remove(),t.parent=this,this._children.splice(e,0,t),e++,o++;return o}_removeChildren(e,t=1){this._fireChange("children",this);for(let o=e;o{const o=e[e.length-1],n=!t.is("uiElement");return o&&o.breakAttributes==n?o.nodes.push(t):e.push({breakAttributes:n,nodes:[t]}),e}),[]);let n=null,r=e;for(const{nodes:e,breakAttributes:t}of o){const o=this._insertNodes(r,e,t);n||(n=o.start),r=o.end}return n?new fs(n,r):new fs(e)}remove(e){const t=e instanceof fs?e:fs._createOn(e);if(Ks(t,this.document),t.isCollapsed)return new Os(this.document);const{start:o,end:n}=this._breakAttributesRange(t,!0),r=o.parent,i=n.offset-o.offset,s=r._removeChildren(o.offset,i);for(const e of s)this._removeFromClonedElementsGroup(e);const a=this.mergeAttributes(o);return t.start=a,t.end=a.clone(),new Os(this.document,s)}clear(e,t){Ks(e,this.document);const o=e.getWalker({direction:"backward",ignoreElementEnd:!0});for(const n of o){const o=n.item;let r;if(o.is("element")&&t.isSimilar(o))r=fs._createOn(o);else if(!n.nextPosition.isAfter(e.start)&&o.is("$textProxy")){const e=o.getAncestors().find((e=>e.is("element")&&t.isSimilar(e)));e&&(r=fs._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 o;if(t.isAfter(e.end)){const n=(t=this._breakAttributes(t,!0)).parent,r=n.childCount;e=this._breakAttributesRange(e,!0),o=this.remove(e),t.offset+=n.childCount-r}else o=this.remove(e);return this.insert(t,o)}wrap(e,t){if(!(t instanceof Ss))throw new f("view-writer-wrap-invalid-attribute",this.document);if(Ks(e,this.document),e.isCollapsed){let n=e.start;n.parent.is("element")&&(o=n.parent,!Array.from(o.getChildren()).some((e=>!e.is("uiElement"))))&&(n=n.getLastMatchingPosition((e=>e.item.is("uiElement")))),n=this._wrapPosition(n,t);const r=this.document.selection;return r.isCollapsed&&r.getFirstPosition().isEqual(e.start)&&this.setSelection(n),new fs(n)}return this._wrapRange(e,t);var o}unwrap(e,t){if(!(t instanceof Ss))throw new f("view-writer-unwrap-invalid-attribute",this.document);if(Ks(e,this.document),e.isCollapsed)return e;const{start:o,end:n}=this._breakAttributesRange(e,!0),r=o.parent,i=this._unwrapChildren(r,o.offset,n.offset,t),s=this.mergeAttributes(i.start);s.isEqual(i.start)||i.end.offset--;const a=this.mergeAttributes(i.end);return new fs(s,a)}rename(e,t){const o=new cs(this.document,e,t.getAttributes());return this.insert(ms._createAfter(t),o),this.move(fs._createIn(t),ms._createAt(o,0)),this.remove(fs._createOn(t)),o}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,t){return ms._createAt(e,t)}createPositionAfter(e){return ms._createAfter(e)}createPositionBefore(e){return ms._createBefore(e)}createRange(e,t){return new fs(e,t)}createRangeOn(e){return fs._createOn(e)}createRangeIn(e){return fs._createIn(e)}createSelection(...e){return new ks(...e)}createSlot(e="children"){if(!this._slotFactory)throw new f("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,o){let n,r;if(n=o?Ls(e):e.parent.is("$text")?e.parent.parent:e.parent,!n)throw new f("view-writer-invalid-position-container",this.document);r=o?this._breakAttributes(e,!0):e.parent.is("$text")?Hs(e):e;const i=n._insertChild(r.offset,t);for(const e of t)this._addToClonedElementsGroup(e);const s=r.getShiftedBy(i),a=this.mergeAttributes(r);a.isEqual(r)||s.offset--;const l=this.mergeAttributes(s);return new fs(a,l)}_wrapChildren(e,t,o,n){let r=t;const i=[];for(;r!1,e.parent._insertChild(e.offset,o);const n=new fs(e,e.getShiftedBy(1));this.wrap(n,t);const r=new ms(o.parent,o.index);o._remove();const i=r.nodeBefore,s=r.nodeAfter;return i instanceof ri&&s instanceof ri?Ws(i,s):qs(r)}_wrapAttributeElement(e,t){if(!Zs(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const o of e.getAttributeKeys())if("class"!==o&&"style"!==o&&t.hasAttribute(o)&&t.getAttribute(o)!==e.getAttribute(o))return!1;for(const o of e.getStyleNames())if(t.hasStyle(o)&&t.getStyle(o)!==e.getStyle(o))return!1;for(const o of e.getAttributeKeys())"class"!==o&&"style"!==o&&(t.hasAttribute(o)||this.setAttribute(o,e.getAttribute(o),t));for(const o of e.getStyleNames())t.hasStyle(o)||this.setStyle(o,e.getStyle(o),t);for(const o of e.getClassNames())t.hasClass(o)||this.addClass(o,t);return!0}_unwrapAttributeElement(e,t){if(!Zs(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const o of e.getAttributeKeys())if("class"!==o&&"style"!==o&&(!t.hasAttribute(o)||t.getAttribute(o)!==e.getAttribute(o)))return!1;if(!t.hasClass(...e.getClassNames()))return!1;for(const o of e.getStyleNames())if(!t.hasStyle(o)||t.getStyle(o)!==e.getStyle(o))return!1;for(const o of e.getAttributeKeys())"class"!==o&&"style"!==o&&this.removeAttribute(o,t);return this.removeClass(Array.from(e.getClassNames()),t),this.removeStyle(Array.from(e.getStyleNames()),t),!0}_breakAttributesRange(e,t=!1){const o=e.start,n=e.end;if(Ks(e,this.document),e.isCollapsed){const o=this._breakAttributes(e.start,t);return new fs(o,o)}const r=this._breakAttributes(n,t),i=r.parent.childCount,s=this._breakAttributes(o,t);return r.offset+=r.parent.childCount-i,new fs(s,r)}_breakAttributes(e,t=!1){const o=e.offset,n=e.parent;if(e.parent.is("emptyElement"))throw new f("view-writer-cannot-break-empty-element",this.document);if(e.parent.is("uiElement"))throw new f("view-writer-cannot-break-ui-element",this.document);if(e.parent.is("rawElement"))throw new f("view-writer-cannot-break-raw-element",this.document);if(!t&&n.is("$text")&&Gs(n.parent))return e.clone();if(Gs(n))return e.clone();if(n.is("$text"))return this._breakAttributes(Hs(e),t);if(o==n.childCount){const e=new ms(n.parent,n.index+1);return this._breakAttributes(e,t)}if(0===o){const e=new ms(n.parent,n.index);return this._breakAttributes(e,t)}{const e=n.index+1,r=n._clone();n.parent._insertChild(e,r),this._addToClonedElementsGroup(r);const i=n.childCount-o,s=n._removeChildren(o,i);r._appendChild(s);const a=new ms(n.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 o=this._cloneGroups.get(t);o||(o=new Set,this._cloneGroups.set(t,o)),o.add(e),e._clonesGroup=o}_removeFromClonedElementsGroup(e){if(e.is("element"))for(const t of e.getChildren())this._removeFromClonedElementsGroup(t);const t=e.id;if(!t)return;const o=this._cloneGroups.get(t);o&&o.delete(e)}}function Ls(e){let t=e.parent;for(;!Gs(t);){if(!t)return;t=t.parent}return t}function js(e,t){return e.priorityt.priority)&&e.getIdentity()o instanceof e)))throw new f("view-writer-insert-invalid-node-type",t);o.is("$text")||Us(o.getChildren(),t)}}function Gs(e){return e&&(e.is("containerElement")||e.is("documentFragment"))}function Ks(e,t){const o=Ls(e.start),n=Ls(e.end);if(!o||!n||o!==n)throw new f("view-writer-invalid-range-container",t)}function Zs(e,t){return null===e.id&&null===t.id}const Js=e=>e.createTextNode(" "),Qs=e=>{const t=e.createElement("span");return t.dataset.ckeFiller="true",t.innerText=" ",t},Ys=e=>{const t=e.createElement("br");return t.dataset.ckeFiller="true",t},Xs=7,ea="".repeat(Xs);function ta(e){return Rn(e)&&e.data.substr(0,Xs)===ea}function oa(e){return e.data.length==Xs&&ta(e)}function na(e){return ta(e)?e.data.slice(Xs):e.data}function ra(e,t){if(t.keyCode==cr.arrowleft){const e=t.domTarget.ownerDocument.defaultView.getSelection();if(1==e.rangeCount&&e.getRangeAt(0).collapsed){const t=e.getRangeAt(0).startContainer,o=e.getRangeAt(0).startOffset;ta(t)&&o<=Xs&&e.collapse(t,0)}}}var ia=o(4401),sa={attributes:{"data-cke":!0}};sa.setAttributes=Wr(),sa.insert=qr().bind(null,"head"),sa.domAPI=Lr(),sa.insertStyleElement=Ur();Or()(ia.Z,sa);ia.Z&&ia.Z.locals&&ia.Z.locals;class aa extends(H()){constructor(e,t){super(),this.domDocuments=new Set,this.markedAttributes=new Set,this.markedChildren=new Set,this.markedTexts=new Set,this._inlineFiller=null,this._fakeSelectionContainer=null,this.domConverter=e,this.selection=t,this.set("isFocused",!1),this.set("isSelecting",!1),n.isBlink&&!n.isAndroid&&this.on("change:isSelecting",(()=>{this.isSelecting||this.render()})),this.set("isComposing",!1),this.on("change:isComposing",(()=>{this.isComposing||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 f("view-renderer-unknown-type",this)}this.markedChildren.add(t)}}}render(){if(this.isComposing&&!n.isAndroid)return;let e=null;const t=!(n.isBlink&&!n.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=ms._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),o=t.parent.ownerDocument;ta(t.parent)?this._inlineFiller=t.parent:this._inlineFiller=la(o,t.parent,t.offset)}else this._inlineFiller=null;this._updateFocus(),this._updateSelection(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){if(!this.domConverter.mapViewToDom(e))return;const t=Array.from(this.domConverter.mapViewToDom(e).childNodes),o=Array.from(this.domConverter.viewChildrenToDom(e,{withChildren:!1})),n=this._diffNodeLists(t,o),r=this._findUpdateActions(n,t,o,ca);if(-1!==r.indexOf("update")){const n={equal:0,insert:0,delete:0};for(const i of r)if("update"===i){const r=n.equal+n.insert,i=n.equal+n.delete,s=e.getChild(r);!s||s.is("uiElement")||s.is("rawElement")||this._updateElementMappings(s,t[i]),Qn(o[r]),n.equal++}else n[i]++}}_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")?ms._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&&Rn(t.parent)&&ta(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!ta(e))throw new f("view-renderer-filler-was-lost",this);oa(e)?e.remove():e.data=e.data.substr(Xs),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=e.parent,o=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;if(o===t.getFillerOffset())return!1;const r=e.nodeBefore,i=e.nodeAfter;return!(r instanceof ri||i instanceof ri)&&(!n.isAndroid||!r&&!i)}_updateText(e,t){const o=this.domConverter.findCorrespondingDomText(e);let n=this.domConverter.viewToDom(e).data;const r=t.inlineFillerPosition;r&&r.parent==e.parent&&r.offset==e.index&&(n=ea+n),ha(o,n)}_updateAttrs(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const o=Array.from(t.attributes).map((e=>e.name)),n=e.getAttributeKeys();for(const o of n)this.domConverter.setDomElementAttribute(t,o,e.getAttribute(o),e);for(const n of o)e.hasAttribute(n)||this.domConverter.removeDomElementAttribute(t,n)}_updateChildren(e,t){const o=this.domConverter.mapViewToDom(e);if(!o)return;if(n.isAndroid){let e=null;for(const t of Array.from(o.childNodes)){if(e&&Rn(e)&&Rn(t)){o.normalize();break}e=t}}const r=t.inlineFillerPosition,i=o.childNodes,s=Array.from(this.domConverter.viewChildrenToDom(e,{bind:!0}));r&&r.parent===e&&la(o.ownerDocument,s,r.offset);const a=this._diffNodeLists(i,s),l=this._findUpdateActions(a,i,s,da);let c=0;const d=new Set;for(const e of l)"delete"===e?(d.add(i[c]),Qn(i[c])):"equal"!==e&&"update"!==e||c++;c=0;for(const e of l)"insert"===e?($n(o,c,s[c]),c++):"update"===e?(ha(i[c],s[c].data),c++):"equal"===e&&(this._markDescendantTextToSync(this.domConverter.domToView(s[c])),c++);for(const e of d)e.parentNode||this.domConverter.unbindDomElement(e)}_diffNodeLists(e,t){return e=function(e,t){const o=Array.from(e);if(0==o.length||!t)return o;const n=o[o.length-1];n==t&&o.pop();return o}(e,this._fakeSelectionContainer),l(e,t,ua.bind(null,this.domConverter))}_findUpdateActions(e,t,o,n){if(-1===e.indexOf("insert")||-1===e.indexOf("delete"))return e;let r=[],i=[],s=[];const a={equal:0,insert:0,delete:0};for(const c of e)"insert"===c?s.push(o[a.equal+a.insert]):"delete"===c?i.push(t[a.equal+a.delete]):(r=r.concat(l(i,s,n).map((e=>"equal"===e?"update":e))),r.push("equal"),i=[],s=[]),a[c]++;return r.concat(l(i,s,n).map((e=>"equal"===e?"update":e)))}_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(n.isBlink&&!n.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&&n.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 o=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(o,this.selection),!this._fakeSelectionNeedsUpdate(e))return;o.parentElement&&o.parentElement==e||e.appendChild(o),o.textContent=this.selection.fakeSelectionLabel||" ";const n=t.getSelection(),r=t.createRange();n.removeAllRanges(),r.selectNodeContents(o),n.addRange(r)}_updateDomSelection(e){const t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;const o=this.domConverter.viewPositionToDom(this.selection.anchor),r=this.domConverter.viewPositionToDom(this.selection.focus);t.collapse(o.parent,o.offset),t.extend(r.parent,r.offset),n.isGecko&&function(e,t){const o=e.parent;if(o.nodeType!=Node.ELEMENT_NODE||e.offset!=o.childNodes.length-1)return;const n=o.childNodes[e.offset];n&&"BR"==n.tagName&&t.addRange(t.getRangeAt(0))}(r,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,o=e.ownerDocument.getSelection();return!t||t.parentElement!==e||(o.anchorNode!==t&&!t.contains(o.anchorNode)||t.textContent!==this.selection.fakeSelectionLabel)}_removeDomSelection(){for(const e of this.domDocuments){const t=e.getSelection();if(t.rangeCount){const o=e.activeElement,n=this.domConverter.mapDomToView(o);o&&n&&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 la(e,t,o){const n=t instanceof Array?t:t.childNodes,r=n[o];if(Rn(r))return r.data=ea+r.data,r;{const r=e.createTextNode(ea);return Array.isArray(t)?n.splice(o,0,r):$n(t,o,r),r}}function ca(e,t){return vn(e)&&vn(t)&&!Rn(e)&&!Rn(t)&&!Un(e)&&!Un(t)&&e.tagName.toLowerCase()===t.tagName.toLowerCase()}function da(e,t){return vn(e)&&vn(t)&&Rn(e)&&Rn(t)}function ua(e,t,o){return t===o||(Rn(t)&&Rn(o)?t.data===o.data:!(!e.isBlockFiller(t)||!e.isBlockFiller(o)))}function ha(e,t){const o=e.data;if(o==t)return;const n=i(o,t);for(const t of n)"insert"===t.type?e.insertData(t.index,t.values.join("")):e.deleteData(t.index,t.howMany)}const pa=Ys(In.document),ga=Js(In.document),ma=Qs(In.document),fa="data-ck-unsafe-attribute-",ba="data-ck-unsafe-element";class ka{constructor(e,{blockFillerMode:t,renderingMode:o="editing"}={}){this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap,this._rawContentElementMatcher=new si,this._encounteredRawContentDomNodes=new WeakSet,this.document=e,this.renderingMode=o,this.blockFillerMode=t||("editing"===o?"br":"nbsp"),this.preElements=["pre"],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?In.document:In.document.implementation.createHTMLDocument("")}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new ks(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 Array.from(e.children))this.unbindDomElement(t)}}bindDocumentFragments(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}shouldRenderAttribute(e,t,o){return"data"===this.renderingMode||!(e=e.toLowerCase()).startsWith("on")&&(("srcdoc"!==e||!t.match(/\bon\S+\s*=|javascript:|<\s*\/*script/i))&&("img"===o&&("src"===e||"srcset"===e)||("source"===o&&"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 o=(new DOMParser).parseFromString(t,"text/html"),n=o.createDocumentFragment(),r=o.body.childNodes;for(;r.length>0;)n.appendChild(r[0]);const i=o.createTreeWalker(n,NodeFilter.SHOW_ELEMENT),s=[];let a;for(;a=i.nextNode();)s.push(a);for(const e of s){for(const t of e.getAttributeNames())this.setDomElementAttribute(e,t,e.getAttribute(t));const t=e.tagName.toLowerCase();this._shouldRenameElement(t)&&(ya(t),e.replaceWith(this._createReplacementDomElement(t,e)))}for(;e.firstChild;)e.firstChild.remove();e.append(n)}viewToDom(e,t={}){if(e.is("$text")){const t=this._processDataFromViewText(e);return this._domDocument.createTextNode(t)}{if(this.mapViewToDom(e))return this.mapViewToDom(e);let o;if(e.is("documentFragment"))o=this._domDocument.createDocumentFragment(),t.bind&&this.bindDocumentFragments(o,e);else{if(e.is("uiElement"))return o="$comment"===e.name?this._domDocument.createComment(e.getCustomProperty("$rawContent")):e.render(this._domDocument,this),t.bind&&this.bindElements(o,e),o;this._shouldRenameElement(e.name)?(ya(e.name),o=this._createReplacementDomElement(e.name)):o=e.hasAttribute("xmlns")?this._domDocument.createElementNS(e.getAttribute("xmlns"),e.name):this._domDocument.createElement(e.name),e.is("rawElement")&&e.render(o,this),t.bind&&this.bindElements(o,e);for(const t of e.getAttributeKeys())this.setDomElementAttribute(o,t,e.getAttribute(t),e)}if(!1!==t.withChildren)for(const n of this.viewChildrenToDom(e,t))o.appendChild(n);return o}}setDomElementAttribute(e,t,o,n){const r=this.shouldRenderAttribute(t,o,e.tagName.toLowerCase())||n&&n.shouldRenderUnsafeAttribute(t);r||b("domconverter-unsafe-attribute-detected",{domElement:e,key:t,value:o}),function(e){try{In.document.createAttribute(e)}catch(e){return!1}return!0}(t)?(e.hasAttribute(t)&&!r?e.removeAttribute(t):e.hasAttribute(fa+t)&&r&&e.removeAttribute(fa+t),e.setAttribute(r?t:fa+t,o)):b("domconverter-invalid-attribute-detected",{domElement:e,key:t,value:o})}removeDomElementAttribute(e,t){t!=ba&&(e.removeAttribute(t),e.removeAttribute(fa+t))}*viewChildrenToDom(e,t={}){const o=e.getFillerOffset&&e.getFillerOffset();let n=0;for(const r of e.getChildren()){o===n&&(yield this._getBlockFiller());const e=r.is("element")&&!!r.getCustomProperty("dataPipeline:transparentRendering")&&!yr(r.getAttributes());e&&"data"==this.renderingMode?yield*this.viewChildrenToDom(r,t):(e&&b("domconverter-transparent-rendering-unsupported-in-editing-pipeline",{viewElement:r}),yield this.viewToDom(r,t)),n++}o===n&&(yield this._getBlockFiller())}viewRangeToDom(e){const t=this.viewPositionToDom(e.start),o=this.viewPositionToDom(e.end),n=this._domDocument.createRange();return n.setStart(t.parent,t.offset),n.setEnd(o.parent,o.offset),n}viewPositionToDom(e){const t=e.parent;if(t.is("$text")){const o=this.findCorrespondingDomText(t);if(!o)return null;let n=e.offset;return ta(o)&&(n+=Xs),{parent:o,offset:n}}{let o,n,r;if(0===e.offset){if(o=this.mapViewToDom(t),!o)return null;r=o.childNodes[0]}else{const t=e.nodeBefore;if(n=t.is("$text")?this.findCorrespondingDomText(t):this.mapViewToDom(t),!n)return null;o=n.parentNode,r=n.nextSibling}if(Rn(r)&&ta(r))return{parent:r,offset:Xs};return{parent:o,offset:n?Wn(n)+1:0}}}domToView(e,t={}){if(this.isBlockFiller(e))return null;const o=this.getHostViewElement(e);if(o)return o;if(Un(e)&&t.skipComments)return null;if(Rn(e)){if(oa(e))return null;{const t=this._processDataFromDomText(e);return""===t?null:new ri(this.document,t)}}{if(this.mapDomToView(e))return this.mapDomToView(e);let o;if(this.isDocumentFragment(e))o=new Os(this.document),t.bind&&this.bindDocumentFragments(e,o);else{o=this._createViewElement(e,t),t.bind&&this.bindElements(e,o);const n=e.attributes;if(n)for(let e=n.length,t=0;t{const{scrollLeft:t,scrollTop:o}=e;n.push([t,o])})),t.focus(),wa(t,(e=>{const[t,o]=n.shift();e.scrollLeft=t,e.scrollTop=o})),In.window.scrollTo(e,o)}}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(pa):!("BR"!==e.tagName||!_a(e,this.blockElements)||1!==e.parentNode.childNodes.length)||(e.isEqualNode(ma)||function(e,t){const o=e.isEqualNode(ga);return o&&_a(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 o=t.collapsed;return t.detach(),o}getHostViewElement(e){const t=Pn(e);for(t.pop();t.length;){const e=t.pop(),o=this._domToViewMapping.get(e);if(o&&(o.is("uiElement")||o.is("rawElement")))return o}return null}isDomSelectionCorrect(e){return this._isDomSelectionPositionCorrect(e.anchorNode,e.anchorOffset)&&this._isDomSelectionPositionCorrect(e.focusNode,e.focusOffset)}registerRawContentMatcher(e){this._rawContentElementMatcher.add(e)}_getBlockFiller(){switch(this.blockFillerMode){case"nbsp":return Js(this._domDocument);case"markedNbsp":return Qs(this._domDocument);case"br":return Ys(this._domDocument)}}_isDomSelectionPositionCorrect(e,t){if(Rn(e)&&ta(e)&&tthis.preElements.includes(e.name))))return t;if(" "==t.charAt(0)){const o=this._getTouchingInlineViewNode(e,!1);!(o&&o.is("$textProxy")&&this._nodeEndsWithSpace(o))&&o||(t=" "+t.substr(1))}if(" "==t.charAt(t.length-1)){const o=this._getTouchingInlineViewNode(e,!0),n=o&&o.is("$textProxy")&&" "==o.data.charAt(0);" "!=t.charAt(t.length-2)&&o&&!n||(t=t.substr(0,t.length-1)+" ")}return t.replace(/ {2}/g," ")}_nodeEndsWithSpace(e){if(e.getAncestors().some((e=>this.preElements.includes(e.name))))return!1;const t=this._processDataFromViewText(e);return" "==t.charAt(t.length-1)}_processDataFromDomText(e){let t=e.data;if(function(e,t){const o=Pn(e);return o.some((e=>e.tagName&&t.includes(e.tagName.toLowerCase())))}(e,this.preElements))return na(e);t=t.replace(/[ \n\t\r]{1,}/g," ");const o=this._getTouchingInlineDomNode(e,!1),n=this._getTouchingInlineDomNode(e,!0),r=this._checkShouldLeftTrimDomText(e,o),i=this._checkShouldRightTrimDomText(e,n);r&&(t=t.replace(/^ /,"")),i&&(t=t.replace(/ $/,"")),t=na(new Text(t)),t=t.replace(/ \u00A0/g," ");const s=n&&this.isElement(n)&&"BR"!=n.tagName,a=n&&Rn(n)&&" "==n.data.charAt(0);return(/( |\u00A0)\u00A0$/.test(t)||!n||s||a)&&(t=t.replace(/\u00A0$/," ")),(r||o&&this.isElement(o)&&"BR"!=o.tagName)&&(t=t.replace(/^\u00A0/," ")),t}_checkShouldLeftTrimDomText(e,t){return!t||(this.isElement(t)?"BR"===t.tagName:!this._encounteredRawContentDomNodes.has(e.previousSibling)&&/[^\S\u00A0]/.test(t.data.charAt(t.data.length-1)))}_checkShouldRightTrimDomText(e,t){return!t&&!ta(e)}_getTouchingInlineViewNode(e,t){const o=new gs({startPosition:t?ms._createAfter(e):ms._createBefore(e),direction:t?"forward":"backward"});for(const e of o){if(e.item.is("element")&&this.inlineObjectElements.includes(e.item.name))return e.item;if(e.item.is("containerElement"))return null;if(e.item.is("element","br"))return null;if(e.item.is("$textProxy"))return e.item}return null}_getTouchingInlineDomNode(e,t){if(!e.parentNode)return null;const o=t?"firstChild":"lastChild",n=t?"nextSibling":"previousSibling";let r=!0,i=e;do{if(!r&&i[o]?i=i[o]:i[n]?(i=i[n],r=!1):(i=i.parentNode,r=!0),!i||this._isBlockElement(i))return null}while(!Rn(i)&&"BR"!=i.tagName&&!this._isInlineObjectElement(i));return i}_isBlockElement(e){return this.isElement(e)&&this.blockElements.includes(e.tagName.toLowerCase())}_isInlineObjectElement(e){return this.isElement(e)&&this.inlineObjectElements.includes(e.tagName.toLowerCase())}_createViewElement(e,t){if(Un(e))return new Rs(this.document,"$comment");const o=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();return new as(this.document,o)}_isViewElementWithRawContent(e,t){return!1!==t.withChildren&&!!this._rawContentElementMatcher.match(e)}_shouldRenameElement(e){const t=e.toLowerCase();return"editing"===this.renderingMode&&this.unsafeElements.includes(t)}_createReplacementDomElement(e,t){const o=this._domDocument.createElement("span");if(o.setAttribute(ba,e),t){for(;t.firstChild;)o.appendChild(t.firstChild);for(const e of t.getAttributeNames())o.setAttribute(e,t.getAttribute(e))}return o}}function wa(e,t){let o=e;for(;o;)t(o),o=o.parentElement}function _a(e,t){const o=e.parentNode;return!!o&&!!o.tagName&&t.includes(o.tagName.toLowerCase())}function ya(e){"script"===e&&b("domconverter-unsafe-script-element-detected"),"style"===e&&b("domconverter-unsafe-style-element-detected")}class Aa extends(Dn()){constructor(e){super(),this._isEnabled=!1,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] *")}}var Ca=Yi((function(e,t){Et(t,co(t),e)}));const va=Ca;class xa{constructor(e,t,o){this.view=e,this.document=e.document,this.domEvent=t,this.domTarget=t.target,va(this,o)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}}class Ea extends Aa{constructor(){super(...arguments),this.useCapture=!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})}))}stopObserving(e){this.stopListening(e)}fire(e,t,o){this.isEnabled&&this.document.fire(e,new xa(this.view,t,o))}}class Da extends Ea{constructor(){super(...arguments),this.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 ur(this)}};this.fire(e.type,e,t)}}const Sa=function(){return ee.Date.now()};var Ta=/\s/;const Ba=function(e){for(var t=e.length;t--&&Ta.test(e.charAt(t)););return t};var Ia=/^\s+/;const Pa=function(e){return e?e.slice(0,Ba(e)+1).replace(Ia,""):e};var Ra=/^[-+]0x[0-9a-f]+$/i,za=/^0b[01]+$/i,Ma=/^0o[0-7]+$/i,Na=parseInt;const Fa=function(e){if("number"==typeof e)return e;if(ci(e))return NaN;if(N(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=N(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Pa(e);var o=za.test(e);return o||Ma.test(e)?Na(e.slice(2),o?2:8):Ra.test(e)?NaN:+e};var Oa=Math.max,Va=Math.min;const La=function(e,t,o){var n,r,i,s,a,l,c=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var o=n,i=r;return n=r=void 0,c=t,s=e.apply(i,o)}function g(e){var o=e-l;return void 0===l||o>=t||o<0||u&&e-c>=i}function m(){var e=Sa();if(g(e))return f(e);a=setTimeout(m,function(e){var o=t-(e-l);return u?Va(o,i-(e-c)):o}(e))}function f(e){return a=void 0,h&&n?p(e):(n=r=void 0,s)}function b(){var e=Sa(),o=g(e);if(n=arguments,r=this,l=e,o){if(void 0===a)return function(e){return c=e,a=setTimeout(m,t),d?p(e):s}(l);if(u)return clearTimeout(a),a=setTimeout(m,t),p(l)}return void 0===a&&(a=setTimeout(m,t)),s}return t=Fa(t)||0,N(o)&&(d=!!o.leading,i=(u="maxWait"in o)?Oa(Fa(o.maxWait)||0,t):i,h="trailing"in o?!!o.trailing:h),b.cancel=function(){void 0!==a&&clearTimeout(a),c=0,n=l=r=a=void 0},b.flush=function(){return void 0===a?s:f(Sa())},b};class ja extends Aa{constructor(e){super(e),this._fireSelectionChangeDoneDebounced=La((e=>{this.document.fire("selectionChangeDone",e)}),200)}observe(){const e=this.document;e.on("arrowKey",((t,o)=>{e.selection.isFake&&this.isEnabled&&o.preventDefault()}),{context:"$capture"}),e.on("arrowKey",((t,o)=>{e.selection.isFake&&this.isEnabled&&this._handleSelectionMove(o.keyCode)}),{priority:"lowest"})}stopObserving(){}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const t=this.document.selection,o=new ks(t.getRanges(),{backward:t.isBackward,fake:!1});e!=cr.arrowleft&&e!=cr.arrowup||o.setTo(o.getFirstPosition()),e!=cr.arrowright&&e!=cr.arrowdown||o.setTo(o.getLastPosition());const n={oldSelection:t,newSelection:o,domSelection:null};this.document.fire("selectionChange",n),this._fireSelectionChangeDoneDebounced(n)}}const qa=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};const Ha=function(e){return this.__data__.has(e)};function Wa(e){var t=-1,o=null==e?0:e.length;for(this.__data__=new bt;++ta))return!1;var c=i.get(e),d=i.get(t);if(c&&d)return c==t&&d==e;var u=-1,h=!0,p=2&o?new $a:void 0;for(i.set(e,t),i.set(t,e);++u{this._isFocusChanging=!0,this._renderTimeoutId=setTimeout((()=>{this.flush(),e.change((()=>{}))}),50)})),t.on("blur",((o,n)=>{const r=t.selection.editableElement;null!==r&&r!==n.target||(t.isFocused=!1,this._isFocusChanging=!1,e.change((()=>{})))}))}flush(){this._isFocusChanging&&(this._isFocusChanging=!1,this.document.isFocused=!0)}onDomEvent(e){this.fire(e.type,e)}destroy(){this._renderTimeoutId&&clearTimeout(this._renderTimeoutId),super.destroy()}}class hl extends Aa{constructor(e){super(e),this.mutationObserver=e.getObserver(cl),this.focusObserver=e.getObserver(ul),this.selection=this.document.selection,this.domConverter=e.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=La((e=>{this.document.fire("selectionChangeDone",e)}),200),this._clearInfiniteLoopInterval=setInterval((()=>this._clearInfiniteLoop()),1e3),this._documentIsSelectingInactivityTimeoutDebounced=La((()=>this.document.isSelecting=!1),5e3),this._loopbackCounter=0}observe(e){const t=e.ownerDocument,o=()=>{this.document.isSelecting&&(this._handleSelectionChange(null,t),this.document.isSelecting=!1,this._documentIsSelectingInactivityTimeoutDebounced.cancel())};this.listenTo(e,"selectstart",(()=>{this.document.isSelecting=!0,this._documentIsSelectingInactivityTimeoutDebounced()}),{priority:"highest"}),this.listenTo(e,"keydown",o,{priority:"highest",useCapture:!0}),this.listenTo(e,"keyup",o,{priority:"highest",useCapture:!0}),this._documents.has(t)||(this.listenTo(t,"mouseup",o,{priority:"highest",useCapture:!0}),this.listenTo(t,"selectionchange",((e,o)=>{this.document.isComposing&&!n.isAndroid||(this._handleSelectionChange(o,t),this._documentIsSelectingInactivityTimeoutDebounced())})),this._documents.add(t))}stopObserving(e){this.stopListening(e)}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel(),this._documentIsSelectingInactivityTimeoutDebounced.cancel()}_reportInfiniteLoop(){}_handleSelectionChange(e,t){if(!this.isEnabled)return;const o=t.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(o.anchorNode))return;this.mutationObserver.flush();const n=this.domConverter.domSelectionToView(o);if(0!=n.rangeCount){if(this.view.hasDomSelection=!0,!this.selection.isEqual(n)||!this.domConverter.isDomSelectionCorrect(o))if(++this._loopbackCounter>60)this._reportInfiniteLoop();else if(this.focusObserver.flush(),this.selection.isSimilar(n))this.view.forceRender();else{const e={oldSelection:this.selection,newSelection:n,domSelection:o};this.document.fire("selectionChange",e),this._fireSelectionChangeDoneDebounced(e)}}else this.view.hasDomSelection=!1}_clearInfiniteLoop(){this._loopbackCounter=0}}class pl extends Ea{constructor(e){super(e),this.domEventType=["compositionstart","compositionupdate","compositionend"];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 gl{constructor(e,t={}){this._files=t.cacheFiles?ml(e):null,this._native=e}get files(){return this._files||(this._files=ml(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,o){this._native.setDragImage(e,t,o)}get isCanceled(){return"none"==this._native.dropEffect||!!this._native.mozUserCancelled}}function ml(e){const t=Array.from(e.files||[]),o=Array.from(e.items||[]);return t.length?t:o.filter((e=>"file"===e.kind)).map((e=>e.getAsFile()))}class fl extends Ea{constructor(){super(...arguments),this.domEventType="beforeinput"}onDomEvent(e){const t=e.getTargetRanges(),o=this.view,r=o.document;let i=null,s=null,a=[];if(e.dataTransfer&&(i=new gl(e.dataTransfer)),null!==e.data?s=e.data:i&&(s=i.getData("text/plain")),r.selection.isFake)a=Array.from(r.selection.getRanges());else if(t.length)a=t.map((e=>o.domConverter.domRangeToView(e)));else if(n.isAndroid){const t=e.target.ownerDocument.defaultView.getSelection();a=Array.from(o.domConverter.domSelectionToView(t).getRanges())}if(n.isAndroid&&"insertCompositionText"==e.inputType&&s&&s.endsWith("\n"))this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:[o.createRange(a[0].end)]});else if("insertText"==e.inputType&&s&&s.includes("\n")){const t=s.split(/\n{1,2}/g);let o=a;for(let n=0;n{if(this.isEnabled&&((o=t.keyCode)==cr.arrowright||o==cr.arrowleft||o==cr.arrowup||o==cr.arrowdown)){const o=new _s(this.document,"arrowKey",this.document.selection.getFirstRange());this.document.fire(o,t),o.stop.called&&e.stop()}var o}))}observe(){}stopObserving(){}}class kl extends Aa{constructor(e){super(e);const t=this.document;t.on("keydown",((e,o)=>{if(!this.isEnabled||o.keyCode!=cr.tab||o.ctrlKey)return;const n=new _s(t,"tab",t.selection.getFirstRange());t.fire(n,o),n.stop.called&&e.stop()}))}observe(){}stopObserving(){}}class wl extends(H()){constructor(e){super(),this.domRoots=new Map,this._initialDomRootAttributes=new WeakMap,this._observers=new Map,this._ongoingChange=!1,this._postFixersInProgress=!1,this._renderingDisabled=!1,this._hasChangedSinceTheLastRendering=!1,this.document=new Ds(e),this.domConverter=new ka(this.document),this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new aa(this.domConverter,this.document.selection),this._renderer.bind("isFocused","isSelecting","isComposing").to(this.document,"isFocused","isSelecting","isComposing"),this._writer=new Vs(this.document),this.addObserver(cl),this.addObserver(ul),this.addObserver(hl),this.addObserver(Da),this.addObserver(ja),this.addObserver(pl),this.addObserver(bl),this.addObserver(fl),this.addObserver(kl),this.document.on("arrowKey",ra,{priority:"low"}),zs(this),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}))}attachDomRoot(e,t="main"){const o=this.document.getRoot(t);o._name=e.tagName.toLowerCase();const n={};for(const{name:t,value:r}of Array.from(e.attributes))n[t]=r,"class"===t?this._writer.addClass(r.split(" "),o):this._writer.setAttribute(t,r,o);this._initialDomRootAttributes.set(e,n);const r=()=>{this._writer.setAttribute("contenteditable",(!o.isReadOnly).toString(),o),o.isReadOnly?this._writer.addClass("ck-read-only",o):this._writer.removeClass("ck-read-only",o)};r(),this.domRoots.set(t,e),this.domConverter.bindElements(e,o),this._renderer.markToSync("children",o),this._renderer.markToSync("attributes",o),this._renderer.domDocuments.add(e.ownerDocument),o.on("change:children",((e,t)=>this._renderer.markToSync("children",t))),o.on("change:attributes",((e,t)=>this._renderer.markToSync("attributes",t))),o.on("change:text",((e,t)=>this._renderer.markToSync("text",t))),o.on("change:isReadOnly",(()=>this.change(r))),o.on("change",(()=>{this._hasChangedSinceTheLastRendering=!0}));for(const o of this._observers.values())o.observe(e,t)}detachDomRoot(e){const t=this.domRoots.get(e);Array.from(t.attributes).forEach((({name:e})=>t.removeAttribute(e)));const o=this._initialDomRootAttributes.get(t);for(const e in o)t.setAttribute(e,o[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,o]of this.domRoots)t.observe(o,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:o=20,ancestorOffset:n=20}={}){const r=this.document.selection.getFirstRange();r&&function({target:e,viewportOffset:t=0,ancestorOffset:o=0,alignToTop:n,forceScroll:r}){const i=rr(e);let s=i,a=null;for(;s;){let l;l=ir(s==i?e:a),Xn({parent:l,getRect:()=>sr(e,s),alignToTop:n,ancestorOffset:o,forceScroll:r});const c=sr(e,s);if(Yn({window:s,rect:c,viewportOffset:t,alignToTop:n,forceScroll:r}),s.parent!=s){if(a=s.frameElement,s=s.parent,!a)return}else s=null}}({target:this.domConverter.viewRangeToDom(r),viewportOffset:o,ancestorOffset:n,alignToTop:e,forceScroll:t})}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 f("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){f.rethrowUnexpectedError(e,this)}}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.getObserver(ul).flush(),this.change((()=>{}))}destroy(){for(const e of this._observers.values())e.destroy();this.document.destroy(),this.stopListening()}createPositionAt(e,t){return ms._createAt(e,t)}createPositionAfter(e){return ms._createAfter(e)}createPositionBefore(e){return ms._createBefore(e)}createRange(e,t){return new fs(e,t)}createRangeOn(e){return fs._createOn(e)}createRangeIn(e){return fs._createIn(e)}createSelection(...e){return new ks(...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 _l{is(){throw new Error("is() method is abstract")}}class yl extends _l{constructor(e){super(),this.parent=null,this._attrs=vr(e)}get document(){return null}get index(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildIndex(this)))throw new f("model-node-not-found-in-parent",this);return e}get startOffset(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildStartOffset(this)))throw new f("model-node-not-found-in-parent",this);return e}get offsetSize(){return 1}get endOffset(){return this.parent?this.startOffset+this.offsetSize:null}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 o=e.includeSelf?this:this.parent;for(;o;)t[e.parentFirst?"push":"unshift"](o),o=o.parent;return t}getCommonAncestor(e,t={}){const o=this.getAncestors(t),n=e.getAncestors(t);let r=0;for(;o[r]==n[r]&&o[r];)r++;return 0===r?null:o[r-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),o=e.getPath(),n=J(t,o);switch(n){case"prefix":return!0;case"extension":return!1;default:return t[n](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=vr(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}}yl.prototype.is=function(e){return"node"===e||"model:node"===e};class Al{constructor(e){this._nodes=[],e&&this._insertNodes(0,e)}[Symbol.iterator](){return this._nodes[Symbol.iterator]()}get length(){return this._nodes.length}get maxOffset(){return this._nodes.reduce(((e,t)=>e+t.offsetSize),0)}getNode(e){return this._nodes[e]||null}getNodeIndex(e){const t=this._nodes.indexOf(e);return-1==t?null:t}getNodeStartOffset(e){const t=this.getNodeIndex(e);return null===t?null:this._nodes.slice(0,t).reduce(((e,t)=>e+t.offsetSize),0)}indexToOffset(e){if(e==this._nodes.length)return this.maxOffset;const t=this._nodes[e];if(!t)throw new f("model-nodelist-index-out-of-bounds",this);return this.getNodeStartOffset(t)}offsetToIndex(e){let t=0;for(const o of this._nodes){if(e>=t&&e1e4)return e.slice(0,o).concat(t).concat(e.slice(o+n,e.length));{const r=Array.from(e);return r.splice(o,n,...t),r}}(this._nodes,Array.from(t),e,0)}_removeNodes(e,t=1){return this._nodes.splice(e,t)}toJSON(){return this._nodes.map((e=>e.toJSON()))}}class Cl extends yl{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 Cl(this.data,this.getAttributes())}static fromJSON(e){return new Cl(e.data,e.attributes)}}Cl.prototype.is=function(e){return"$text"===e||"model:$text"===e||"text"===e||"model:text"===e||"node"===e||"model:node"===e};class vl extends _l{constructor(e,t,o){if(super(),this.textNode=e,t<0||t>e.offsetSize)throw new f("model-textproxy-wrong-offsetintext",this);if(o<0||t+o>e.offsetSize)throw new f("model-textproxy-wrong-length",this);this.data=e.data.substring(t,t+o),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 o=e.includeSelf?this:this.parent;for(;o;)t[e.parentFirst?"push":"unshift"](o),o=o.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()}}vl.prototype.is=function(e){return"$textProxy"===e||"model:$textProxy"===e||"textProxy"===e||"model:textProxy"===e};class xl extends yl{constructor(e,t,o){super(t),this._children=new Al,this.name=e,o&&this._insertChild(0,o)}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)}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 o of e)t=t.getChild(t.offsetToIndex(o));return t}findAncestor(e,t={}){let o=t.includeSelf?this:this.parent;for(;o;){if(o.name===e)return o;o=o.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?Array.from(this._children).map((e=>e._clone(!0))):void 0;return new xl(this.name,this.getAttributes(),t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const o=function(e){if("string"==typeof e)return[new Cl(e)];Q(e)||(e=[e]);return Array.from(e).map((e=>"string"==typeof e?new Cl(e):e instanceof vl?new Cl(e.data,e.getAttributes()):e))}(t);for(const e of o)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,o)}_removeChildren(e,t=1){const o=this._children._removeNodes(e,t);for(const e of o)e.parent=null;return o}static fromJSON(e){let t;if(e.children){t=[];for(const o of e.children)o.name?t.push(xl.fromJSON(o)):t.push(Cl.fromJSON(o))}return new xl(e.name,e.attributes,t)}}xl.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 El{constructor(e){if(!e||!e.boundaries&&!e.startPosition)throw new f("model-tree-walker-no-start-position",null);const t=e.direction||"forward";if("forward"!=t&&"backward"!=t)throw new f("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=Sl._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,o,n,r;do{n=this.position,r=this._visitedParent,({done:t,value:o}=this.next())}while(!t&&e(o));t||(this._position=n,this._visitedParent=r)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){const e=this.position,t=this.position.clone(),o=this._visitedParent;if(null===o.parent&&t.offset===o.maxOffset)return{done:!0,value:void 0};if(o===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0,value:void 0};const n=Tl(t,o),r=n||Bl(t,o,n);if(r instanceof xl)return this.shallow?t.offset++:(t.path.push(0),this._visitedParent=r),this._position=t,Dl("elementStart",r,e,t,1);if(r instanceof Cl){let n;if(this.singleCharacters)n=1;else{let e=r.endOffset;this._boundaryEndParent==o&&this.boundaries.end.offsete&&(e=this.boundaries.start.offset),n=t.offset-e}const r=t.offset-i.startOffset,s=new vl(i,r-n,n);return t.offset-=n,this._position=t,Dl("text",s,e,t,n)}return t.path.pop(),this._position=t,this._visitedParent=o.parent,Dl("elementStart",o,e,t,1)}}function Dl(e,t,o,n,r){return{done:!1,value:{type:e,item:t,previousPosition:o,nextPosition:n,length:r}}}class Sl extends _l{constructor(e,t,o="toNone"){if(super(),!e.is("element")&&!e.is("documentFragment"))throw new f("model-position-root-invalid",e);if(!(t instanceof Array)||0===t.length)throw new f("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=o}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;t1)return!1;if(1===t)return Pl(e,this,o);if(-1===t)return Pl(this,e,o)}return this.path.length===e.path.length||(this.path.length>e.path.length?Rl(this.path,t):Rl(e.path,t))}hasSameParentAs(e){if(this.root!==e.root)return!1;return"same"==J(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=Sl._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 o;return t.containsPosition(this)||t.start.isEqual(this)?(o=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(o=o._getTransformedByDeletion(e.deletionPosition,1))):o=this.isEqual(e.deletionPosition)?Sl._createAt(e.deletionPosition):this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),o}_getTransformedByDeletion(e,t){const o=Sl._createAt(this);if(this.root!=e.root)return o;if("same"==J(e.getParentPath(),this.getParentPath())){if(e.offsetthis.offset)return null;o.offset-=t}}else if("prefix"==J(e.getParentPath(),this.getParentPath())){const n=e.path.length-1;if(e.offset<=this.path[n]){if(e.offset+t>this.path[n])return null;o.path[n]-=t}}return o}_getTransformedByInsertion(e,t){const o=Sl._createAt(this);if(this.root!=e.root)return o;if("same"==J(e.getParentPath(),this.getParentPath()))(e.offset=t;){if(e.path[n]+r!==o.maxOffset)return!1;r=1,n--,o=o.parent}return!0}(e,o+1))}function Rl(e,t){for(;tt+1;){const t=n.maxOffset-o.offset;0!==t&&e.push(new zl(o,o.getShiftedBy(t))),o.path=o.path.slice(0,-1),o.offset++,n=n.parent}for(;o.path.length<=this.end.path.length;){const t=this.end.path[o.path.length-1],n=t-o.offset;0!==n&&e.push(new zl(o,o.getShiftedBy(n))),o.offset=t,o.path.push(0)}return e}getWalker(e={}){return e.boundaries=this,new El(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new El(e);for(const e of t)yield e.item}*getPositions(e={}){e.boundaries=this;const t=new El(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 zl(this.start,this.end)]}getTransformedByOperations(e){const t=[new zl(this.start,this.end)];for(const o of e)for(let e=0;e0?new this(o,n):new this(n,o)}static _createIn(e){return new this(Sl._createAt(e,0),Sl._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(Sl._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(0===e.length)throw new f("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 o=e.indexOf(t),n=new this(t.start,t.end);if(o>0)for(let t=o-1;e[t].end.isEqual(n.start);t++)n.start=Sl._createAt(e[t].start);for(let t=o+1;t{if(t.viewPosition)return;const o=this._modelToViewMapping.get(t.modelPosition.parent);if(!o)throw new f("mapping-model-position-view-parent-not-found",this,{modelPosition:t.modelPosition});t.viewPosition=this.findPositionIn(o,t.modelPosition.offset)}),{priority:"low"}),this.on("viewToModelPosition",((e,t)=>{if(t.modelPosition)return;const o=this.findMappedViewAncestor(t.viewPosition),n=this._viewToModelMapping.get(o),r=this._toModelOffset(t.viewPosition.parent,t.viewPosition.offset,o);t.modelPosition=Sl._createAt(n,r)}),{priority:"low"})}bindElements(e,t){this._modelToViewMapping.set(e,t),this._viewToModelMapping.set(t,e)}unbindViewElement(e,t={}){const o=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._modelToViewMapping.get(o)==e&&this._modelToViewMapping.delete(o))}unbindModelElement(e){const t=this.toViewElement(e);this._modelToViewMapping.delete(e),this._viewToModelMapping.get(t)==e&&this._viewToModelMapping.delete(t)}bindElementToMarker(e,t){const o=this._markerNameToElements.get(t)||new Set;o.add(e);const n=this._elementToMarkerNames.get(e)||new Set;n.add(t),this._markerNameToElements.set(t,o),this._elementToMarkerNames.set(e,n)}unbindElementFromMarkerName(e,t){const o=this._markerNameToElements.get(t);o&&(o.delete(e),0==o.size&&this._markerNameToElements.delete(t));const n=this._elementToMarkerNames.get(e);n&&(n.delete(t),0==n.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 zl(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new fs(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 o={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",o),o.viewPosition}markerNameToElements(e){const t=this._markerNameToElements.get(e);if(!t)return null;const o=new Set;for(const e of t)if(e.is("attributeElement"))for(const t of e.getElementsWithSameId())o.add(t);else o.add(e);return o}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,o){if(o!=e){return this._toModelOffset(e.parent,e.index,o)+this._toModelOffset(e,t,e)}if(e.is("$text"))return t;let n=0;for(let o=0;o1?t[0]+":"+t[1]:t[0]}class Ol extends(S()){constructor(e){super(),this._conversionApi={dispatcher:this,...e},this._firedEventsMap=new WeakMap}convertChanges(e,t,o){const n=this._createConversionApi(o,e.getRefreshedItems());for(const t of e.getMarkersToRemove())this._convertMarkerRemove(t.name,t.range,n);const r=this._reduceChanges(e.getChanges());for(const e of r)"insert"===e.type?this._convertInsert(zl._createFromPositionAndShift(e.position,e.length),n):"reinsert"===e.type?this._convertReinsert(zl._createFromPositionAndShift(e.position,e.length),n):"remove"===e.type?this._convertRemove(e.position,e.length,e.name,n):this._convertAttribute(e.range,e.attributeKey,e.attributeOldValue,e.attributeNewValue,n);for(const e of n.mapper.flushUnboundMarkerNames()){const o=t.get(e).getRange();this._convertMarkerRemove(e,o,n),this._convertMarkerAdd(e,o,n)}for(const t of e.getMarkersToAdd())this._convertMarkerAdd(t.name,t.range,n);n.mapper.flushDeferredBindings(),n.consumable.verifyAllConsumed("insert")}convert(e,t,o,n={}){const r=this._createConversionApi(o,void 0,n);this._convertInsert(e,r);for(const[e,o]of t)this._convertMarkerAdd(e,o,r);r.consumable.verifyAllConsumed("insert")}convertSelection(e,t,o){const n=Array.from(t.getMarkersAtPosition(e.getFirstPosition())),r=this._createConversionApi(o);if(this._addConsumablesForSelection(r.consumable,e,n),this.fire("selection",{selection:e},r),e.isCollapsed){for(const t of n){const o=t.getRange();if(!Vl(e.getFirstPosition(),t,r.mapper))continue;const n={item:e,markerName:t.name,markerRange:o};r.consumable.test(e,"addMarker:"+t.name)&&this.fire(`addMarker:${t.name}`,n,r)}for(const t of e.getAttributeKeys()){const o={item:e,range:e.getFirstRange(),attributeKey:t,attributeOldValue:null,attributeNewValue:e.getAttribute(t)};r.consumable.test(e,"attribute:"+o.attributeKey)&&this.fire(`attribute:${o.attributeKey}:$text`,o,r)}}}_convertInsert(e,t,o={}){o.doNotAddConsumables||this._addConsumablesForInsert(t.consumable,Array.from(e));for(const o of Array.from(e.getWalker({shallow:!0})).map(Ll))this._testAndFire("insert",o,t)}_convertRemove(e,t,o,n){this.fire(`remove:${o}`,{position:e,length:t},n)}_convertAttribute(e,t,o,n,r){this._addConsumablesForRange(r.consumable,e,`attribute:${t}`);for(const i of e){const e={item:i.item,range:zl._createFromPositionAndShift(i.previousPosition,i.length),attributeKey:t,attributeOldValue:o,attributeNewValue:n};this._testAndFire(`attribute:${t}`,e,r)}}_convertReinsert(e,t){const o=Array.from(e.getWalker({shallow:!0}));this._addConsumablesForInsert(t.consumable,o);for(const e of o.map(Ll))this._testAndFire("insert",{...e,reconversion:!0},t)}_convertMarkerAdd(e,t,o){if("$graveyard"==t.root.rootName)return;const n=`addMarker:${e}`;if(o.consumable.add(t,n),this.fire(n,{markerName:e,markerRange:t},o),o.consumable.consume(t,n)){this._addConsumablesForRange(o.consumable,t,n);for(const r of t.getItems()){if(!o.consumable.test(r,n))continue;const i={item:r,range:zl._createOn(r),markerName:e,markerRange:t};this.fire(n,i,o)}}}_convertMarkerRemove(e,t,o){"$graveyard"!=t.root.rootName&&this.fire(`removeMarker:${e}`,{markerName:e,markerRange:t},o)}_reduceChanges(e){const t={changes:e};return this.fire("reduceChanges",t),t.changes}_addConsumablesForInsert(e,t){for(const o of t){const t=o.item;if(null===e.test(t,"insert")){e.add(t,"insert");for(const o of t.getAttributeKeys())e.add(t,"attribute:"+o)}}return e}_addConsumablesForRange(e,t,o){for(const n of t.getItems())e.add(n,o);return e}_addConsumablesForSelection(e,t,o){e.add(t,"selection");for(const n of o)e.add(t,"addMarker:"+n.name);for(const o of t.getAttributeKeys())e.add(t,"attribute:"+o);return e}_testAndFire(e,t,o){const n=function(e,t){const o=t.item.is("element")?t.item.name:"$text";return`${e}:${o}`}(e,t),r=t.item.is("$textProxy")?o.consumable._getSymbolForTextProxy(t.item):t.item,i=this._firedEventsMap.get(o),s=i.get(r);if(s){if(s.has(n))return;s.add(n)}else i.set(r,new Set([n]));this.fire(n,t,o)}_testAndFireAddAttributes(e,t){const o={item:e,range:zl._createOn(e)};for(const e of o.item.getAttributeKeys())o.attributeKey=e,o.attributeOldValue=null,o.attributeNewValue=o.item.getAttribute(e),this._testAndFire(`attribute:${e}`,o,t)}_createConversionApi(e,t=new Set,o={}){const n={...this._conversionApi,consumable:new Nl,writer:e,options:o,convertItem:e=>this._convertInsert(zl._createOn(e),n),convertChildren:e=>this._convertInsert(zl._createIn(e),n,{doNotAddConsumables:!0}),convertAttributes:e=>this._testAndFireAddAttributes(e,n),canReuseView:e=>!t.has(n.mapper.toModelElement(e))};return this._firedEventsMap.set(n,new Map),n}}function Vl(e,t,o){const n=t.getRange(),r=Array.from(e.getAncestors());r.shift(),r.reverse();return!r.some((e=>{if(n.containsItem(e)){return!!o.toViewElement(e).getCustomProperty("addHighlight")}}))}function Ll(e){return{item:e.item,range:zl._createFromPositionAndShift(e.previousPosition,e.length)}}class jl extends(S(_l)){constructor(...e){super(),this._lastRangeBackward=!1,this._attrs=new Map,this._ranges=[],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 o=!1;for(const n of e._ranges)if(t.isEqual(n)){o=!0;break}if(!o)return!1}return!0}*getRanges(){for(const e of this._ranges)yield new zl(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 zl(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 zl(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,o,n]=e;if("object"==typeof o&&(n=o,o=void 0),null===t)this._setRanges([]);else if(t instanceof jl)this._setRanges(t.getRanges(),t.isBackward);else if(t&&"function"==typeof t.getRanges)this._setRanges(t.getRanges(),t.isBackward);else if(t instanceof zl)this._setRanges([t],!!n&&!!n.backward);else if(t instanceof Sl)this._setRanges([new zl(t)]);else if(t instanceof yl){const e=!!n&&!!n.backward;let r;if("in"==o)r=zl._createIn(t);else if("on"==o)r=zl._createOn(t);else{if(void 0===o)throw new f("model-selection-setto-required-second-parameter",[this,t]);r=new zl(Sl._createAt(t,o))}this._setRanges([r],e)}else{if(!Q(t))throw new f("model-selection-setto-not-selectable",[this,t]);this._setRanges(t,n&&!!n.backward)}}_setRanges(e,t=!1){const o=Array.from(e),n=o.some((t=>{if(!(t instanceof zl))throw new f("model-selection-set-ranges-not-range",[this,e]);return this._ranges.every((e=>!e.isEqual(t)))}));(o.length!==this._ranges.length||n)&&(this._replaceAllRanges(o),this._lastRangeBackward=!!t,this.fire("change:range",{directChange:!0}))}setFocus(e,t){if(null===this.anchor)throw new f("model-selection-setfocus-no-ranges",[this,e]);const o=Sl._createAt(e,t);if("same"==o.compareWith(this.focus))return;const n=this.anchor;this._ranges.length&&this._popRange(),"before"==o.compareWith(n)?(this._pushRange(new zl(o,n)),this._lastRangeBackward=!0):(this._pushRange(new zl(n,o)),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 o=Wl(t.start,e);Ul(o,t)&&(yield o);for(const o of t.getWalker()){const n=o.item;"elementEnd"==o.type&&Hl(n,e,t)&&(yield n)}const n=Wl(t.end,e);Gl(n,t)&&(yield n)}}containsEntireContent(e=this.anchor.root){const t=Sl._createAt(e,0),o=Sl._createAt(e,"end");return t.isTouching(this.getFirstPosition())&&o.isTouching(this.getLastPosition())}_pushRange(e){this._checkRange(e),this._ranges.push(new zl(e.start,e.end))}_checkRange(e){for(let t=0;t0;)this._popRange()}_popRange(){this._ranges.pop()}}function ql(e,t){return!t.has(e)&&(t.add(e),e.root.document.model.schema.isBlock(e)&&!!e.parent)}function Hl(e,t,o){return ql(e,t)&&$l(e,o)}function Wl(e,t){const o=e.parent.root.document.model.schema,n=e.parent.getAncestors({parentFirst:!0,includeSelf:!0});let r=!1;const i=n.find((e=>!r&&(r=o.isLimit(e),!r&&ql(e,t))));return n.forEach((e=>t.add(e))),i}function $l(e,t){const o=function(e){const t=e.root.document.model.schema;let o=e.parent;for(;o;){if(t.isBlock(o))return o;o=o.parent}}(e);if(!o)return!0;return!t.containsRange(zl._createOn(o),!0)}function Ul(e,t){return!!e&&(!(!t.isCollapsed&&!e.isEmpty)||!t.start.isTouching(Sl._createAt(e,e.maxOffset))&&$l(e,t))}function Gl(e,t){return!!e&&(!(!t.isCollapsed&&!e.isEmpty)||!t.end.isTouching(Sl._createAt(e,0))&&$l(e,t))}jl.prototype.is=function(e){return"selection"===e||"model:selection"===e};class Kl extends(S(zl)){constructor(e,t){super(e,t),Zl.call(this)}detach(){this.stopListening()}toRange(){return new zl(this.start,this.end)}static fromRange(e){return new Kl(e.start,e.end)}}function Zl(){this.listenTo(this.root.document.model,"applyOperation",((e,t)=>{const o=t[0];o.isDocumentOperation&&Jl.call(this,o)}),{priority:"low"})}function Jl(e){const t=this.getTransformedByOperation(e),o=zl._createFromRanges(t),n=!o.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 i=null;if(n){"$graveyard"==o.root.rootName&&(i="remove"==e.type?e.sourcePosition:e.deletionPosition);const t=this.toRange();this.start=o.start,this.end=o.end,this.fire("change:range",t,{deletionPosition:i})}else r&&this.fire("change:content",this.toRange(),{deletionPosition:i})}Kl.prototype.is=function(e){return"liveRange"===e||"model:liveRange"===e||"range"==e||"model:range"===e};const Ql="selection:";class Yl extends(S(_l)){constructor(e){super(),this._selection=new Xl(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 Ql+e}static _isStoreAttributeKey(e){return e.startsWith(Ql)}}Yl.prototype.is=function(e){return"selection"===e||"model:selection"==e||"documentSelection"==e||"model:documentSelection"==e};class Xl extends jl{constructor(e){super(),this.markers=new _r({idProperty:"name"}),this._attributePriority=new Map,this._selectionRestorePosition=null,this._hasChangedRange=!1,this._overriddenGravityRegister=new Set,this._observedMarkers=new Set,this._model=e.model,this._document=e,this.listenTo(this._model,"applyOperation",((e,t)=>{const o=t[0];o.isDocumentOperation&&"marker"!=o.type&&"rename"!=o.type&&"noop"!=o.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,o,n)=>{this._updateMarker(t,n)})),this.listenTo(this._document,"change",((e,t)=>{!function(e,t){const o=e.document.differ;for(const n of o.getChanges()){if("insert"!=n.type)continue;const o=n.position.parent;n.length===o.maxOffset&&e.enqueueChange(t,(e=>{const t=Array.from(o.getAttributeKeys()).filter((e=>e.startsWith(Ql)));for(const n of t)e.removeAttribute(n,o)}))}}(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{if(this._hasChangedRange=!0,t.root==this._document.graveyard){this._selectionRestorePosition=n.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 o=t.name.split(":",1)[0];if(!this._observedMarkers.has(o))continue;const n=t.getRange();for(const o of this.getRanges())n.containsRange(o,!o.isCollapsed)&&e.push(t)}const o=Array.from(this.markers);for(const o of e)this.markers.has(o)||(this.markers.add(o),t=!0);for(const o of Array.from(this.markers))e.includes(o)||(this.markers.remove(o),t=!0);t&&this.fire("change:marker",{oldMarkers:o,directChange:!1})}_updateMarker(e,t){const o=e.name.split(":",1)[0];if(!this._observedMarkers.has(o))return;let n=!1;const r=Array.from(this.markers),i=this.markers.has(e);if(t){let o=!1;for(const e of this.getRanges())if(t.containsRange(e,!e.isCollapsed)){o=!0;break}o&&!i?(this.markers.add(e),n=!0):!o&&i&&(this.markers.remove(e),n=!0)}else i&&(this.markers.remove(e),n=!0);n&&this.fire("change:marker",{oldMarkers:r,directChange:!1})}_updateAttributes(e){const t=vr(this._getSurroundingAttributes()),o=vr(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 n=[];for(const[e,t]of this.getAttributes())o.has(e)&&o.get(e)===t||n.push(e);for(const[e]of o)this.hasAttribute(e)||n.push(e);n.length>0&&this.fire("change:attribute",{attributeKeys:n,directChange:!1})}_setAttribute(e,t,o=!0){const n=o?"normal":"low";if("low"==n&&"normal"==this._attributePriority.get(e))return!1;return super.getAttribute(e)!==t&&(this._attrs.set(e,t),this._attributePriority.set(e,n),!0)}_removeAttribute(e,t=!0){const o=t?"normal":"low";return("low"!=o||"normal"!=this._attributePriority.get(e))&&(this._attributePriority.set(e,o),!!super.hasAttribute(e)&&(this._attrs.delete(e),!0))}_setAttributesTo(e){const t=new Set;for(const[t,o]of this.getAttributes())e.get(t)!==o&&this._removeAttribute(t,!1);for(const[o,n]of e){this._setAttribute(o,n,!1)&&t.add(o)}return t}*getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const t of e.getAttributeKeys())if(t.startsWith(Ql)){const o=t.substr(10);yield[o,e.getAttribute(t)]}}_getSurroundingAttributes(){const e=this.getFirstPosition(),t=this._model.schema;let o=null;if(this.isCollapsed){const n=e.textNode?e.textNode:e.nodeBefore,r=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(o=ec(n)),o||(o=ec(r)),!this.isGravityOverridden&&!o){let e=n;for(;e&&!t.isInline(e)&&!o;)e=e.previousSibling,o=ec(e)}if(!o){let e=r;for(;e&&!t.isInline(e)&&!o;)e=e.nextSibling,o=ec(e)}o||(o=this.getStoredAttributes())}else{const e=this.getFirstRange();for(const n of e){if(n.item.is("element")&&t.isObject(n.item))break;if("text"==n.type){o=n.item.getAttributes();break}}}return o}_fixGraveyardSelection(e){const t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t)}}function ec(e){return e instanceof vl||e instanceof Cl?e.getAttributes():null}class tc{constructor(e){this._dispatchers=e}add(e){for(const t of this._dispatchers)e(t);return this}}const oc=function(e){return kn(e,5)};class nc extends tc{elementToElement(e){return this.add(function(e){const t=sc(e.model),o=ac(e.view,"container");t.attributes.length&&(t.children=!0);return n=>{n.on(`insert:${t.name}`,function(e,t=mc){return(o,n,r)=>{if(!t(n.item,r.consumable,{preflight:!0}))return;const i=e(n.item,r,n);if(!i)return;t(n.item,r.consumable);const s=r.mapper.toViewPosition(n.range.start);r.mapper.bindElements(n.item,i),r.writer.insert(s,i),r.convertAttributes(n.item),pc(i,n.item.getChildren(),r,{reconversion:n.reconversion})}}(o,hc(t)),{priority:e.converterPriority||"normal"}),(t.children||t.attributes.length)&&n.on("reduceChanges",uc(t),{priority:"low"})}}(e))}elementToStructure(e){return this.add(function(e){const t=sc(e.model),o=ac(e.view,"container");return t.children=!0,n=>{if(n._conversionApi.schema.checkChild(t.name,"$text"))throw new f("conversion-element-to-structure-disallowed-text",n,{elementName:t.name});var r,i;n.on(`insert:${t.name}`,(r=o,i=hc(t),(e,t,o)=>{if(!i(t.item,o.consumable,{preflight:!0}))return;const n=new Map;o.writer._registerSlotFactory(function(e,t,o){return(n,r)=>{const i=n.createContainerElement("$slot");let s=null;if("children"===r)s=Array.from(e.getChildren());else{if("function"!=typeof r)throw new f("conversion-slot-mode-unknown",o.dispatcher,{modeOrFilter:r});s=Array.from(e.getChildren()).filter((e=>r(e)))}return t.set(i,s),i}}(t.item,n,o));const s=r(t.item,o,t);if(o.writer._clearSlotFactory(),!s)return;!function(e,t,o){const n=Array.from(t.values()).flat(),r=new Set(n);if(r.size!=n.length)throw new f("conversion-slot-filter-overlap",o.dispatcher,{element:e});if(r.size!=e.childCount)throw new f("conversion-slot-filter-incomplete",o.dispatcher,{element:e})}(t.item,n,o),i(t.item,o.consumable);const a=o.mapper.toViewPosition(t.range.start);o.mapper.bindElements(t.item,s),o.writer.insert(a,s),o.convertAttributes(t.item),function(e,t,o,n){o.mapper.on("modelToViewPosition",s,{priority:"highest"});let r=null,i=null;for([r,i]of t)pc(e,i,o,n),o.writer.move(o.writer.createRangeIn(r),o.writer.createPositionBefore(r)),o.writer.remove(r);function s(e,t){const o=t.modelPosition.nodeAfter,n=i.indexOf(o);n<0||(t.viewPosition=t.mapper.findPositionIn(r,n))}o.mapper.off("modelToViewPosition",s)}(s,n,o,{reconversion:t.reconversion})}),{priority:e.converterPriority||"normal"}),n.on("reduceChanges",uc(t),{priority:"low"})}}(e))}attributeToElement(e){return this.add(function(e){e=oc(e);let t=e.model;"string"==typeof t&&(t={key:t});let o=`attribute:${t.key}`;t.name&&(o+=":"+t.name);if(t.values)for(const o of t.values)e.view[o]=ac(e.view[o],"attribute");else e.view=ac(e.view,"attribute");const n=lc(e);return t=>{t.on(o,function(e){return(t,o,n)=>{if(!n.consumable.test(o.item,t.name))return;const r=e(o.attributeOldValue,n,o),i=e(o.attributeNewValue,n,o);if(!r&&!i)return;n.consumable.consume(o.item,t.name);const s=n.writer,a=s.document.selection;if(o.item instanceof jl||o.item instanceof Yl)s.wrap(a.getFirstRange(),i);else{let e=n.mapper.toViewRange(o.range);null!==o.attributeOldValue&&r&&(e=s.unwrap(e,r)),null!==o.attributeNewValue&&i&&s.wrap(e,i)}}}(n),{priority:e.converterPriority||"normal"})}}(e))}attributeToAttribute(e){return this.add(function(e){e=oc(e);let t=e.model;"string"==typeof t&&(t={key:t});let o=`attribute:${t.key}`;t.name&&(o+=":"+t.name);if(t.values)for(const o of t.values)e.view[o]=cc(e.view[o]);else e.view=cc(e.view);const n=lc(e);return t=>{var r;t.on(o,(r=n,(e,t,o)=>{if(!o.consumable.test(t.item,e.name))return;const n=r(t.attributeOldValue,o,t),i=r(t.attributeNewValue,o,t);if(!n&&!i)return;o.consumable.consume(t.item,e.name);const s=o.mapper.toViewElement(t.item),a=o.writer;if(!s)throw new f("conversion-attribute-to-attribute-on-text",o.dispatcher,t);if(null!==t.attributeOldValue&&n)if("class"==n.key){const e=mr(n.value);for(const t of e)a.removeClass(t,s)}else if("style"==n.key){const e=Object.keys(n.value);for(const t of e)a.removeStyle(t,s)}else a.removeAttribute(n.key,s);if(null!==t.attributeNewValue&&i)if("class"==i.key){const e=mr(i.value);for(const t of e)a.addClass(t,s)}else if("style"==i.key){const e=Object.keys(i.value);for(const t of e)a.setStyle(t,i.value[t],s)}else a.setAttribute(i.key,i.value,s)}),{priority:e.converterPriority||"normal"})}}(e))}markerToElement(e){return this.add(function(e){const t=ac(e.view,"ui");return o=>{var n;o.on(`addMarker:${e.model}`,(n=t,(e,t,o)=>{t.isOpening=!0;const r=n(t,o);t.isOpening=!1;const i=n(t,o);if(!r||!i)return;const s=t.markerRange;if(s.isCollapsed&&!o.consumable.consume(s,e.name))return;for(const t of s)if(!o.consumable.consume(t.item,e.name))return;const a=o.mapper,l=o.writer;l.insert(a.toViewPosition(s.start),r),o.mapper.bindElementToMarker(r,t.markerName),s.isCollapsed||(l.insert(a.toViewPosition(s.end),i),o.mapper.bindElementToMarker(i,t.markerName)),e.stop()}),{priority:e.converterPriority||"normal"}),o.on(`removeMarker:${e.model}`,((e,t,o)=>{const n=o.mapper.markerNameToElements(t.markerName);if(n){for(const e of n)o.mapper.unbindElementFromMarkerName(e,t.markerName),o.writer.clear(o.writer.createRangeOn(e),e);o.writer.clearClonedElementsGroup(t.markerName),e.stop()}}),{priority:e.converterPriority||"normal"})}}(e))}markerToHighlight(e){return this.add(function(e){return t=>{var o;t.on(`addMarker:${e.model}`,(o=e.view,(e,t,n)=>{if(!t.item)return;if(!(t.item instanceof jl||t.item instanceof Yl||t.item.is("$textProxy")))return;const r=dc(o,t,n);if(!r)return;if(!n.consumable.consume(t.item,e.name))return;const i=n.writer,s=rc(i,r),a=i.document.selection;if(t.item instanceof jl||t.item instanceof Yl)i.wrap(a.getFirstRange(),s);else{const e=n.mapper.toViewRange(t.range),o=i.wrap(e,s);for(const e of o.getItems())if(e.is("attributeElement")&&e.isSimilar(s)){n.mapper.bindElementToMarker(e,t.markerName);break}}}),{priority:e.converterPriority||"normal"}),t.on(`addMarker:${e.model}`,function(e){return(t,o,n)=>{if(!o.item)return;if(!(o.item instanceof xl))return;const r=dc(e,o,n);if(!r)return;if(!n.consumable.test(o.item,t.name))return;const i=n.mapper.toViewElement(o.item);if(i&&i.getCustomProperty("addHighlight")){n.consumable.consume(o.item,t.name);for(const e of zl._createIn(o.item))n.consumable.consume(e.item,t.name);i.getCustomProperty("addHighlight")(i,r,n.writer),n.mapper.bindElementToMarker(i,o.markerName)}}}(e.view),{priority:e.converterPriority||"normal"}),t.on(`removeMarker:${e.model}`,function(e){return(t,o,n)=>{if(o.markerRange.isCollapsed)return;const r=dc(e,o,n);if(!r)return;const i=rc(n.writer,r),s=n.mapper.markerNameToElements(o.markerName);if(s){for(const e of s)if(n.mapper.unbindElementFromMarkerName(e,o.markerName),e.is("attributeElement"))n.writer.unwrap(n.writer.createRangeOn(e),i);else{e.getCustomProperty("removeHighlight")(e,r.id,n.writer)}n.writer.clearClonedElementsGroup(o.markerName),t.stop()}}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}markerToData(e){return this.add(function(e){e=oc(e);const t=e.model;let o=e.view;o||(o=o=>({group:t,name:o.substr(e.model.length+1)}));return n=>{var r;n.on(`addMarker:${t}`,(r=o,(e,t,o)=>{const n=r(t.markerName,o);if(!n)return;const i=t.markerRange;o.consumable.consume(i,e.name)&&(ic(i,!1,o,t,n),ic(i,!0,o,t,n),e.stop())}),{priority:e.converterPriority||"normal"}),n.on(`removeMarker:${t}`,function(e){return(t,o,n)=>{const r=e(o.markerName,n);if(!r)return;const i=n.mapper.markerNameToElements(o.markerName);if(i){for(const e of i)n.mapper.unbindElementFromMarkerName(e,o.markerName),e.is("containerElement")?(s(`data-${r.group}-start-before`,e),s(`data-${r.group}-start-after`,e),s(`data-${r.group}-end-before`,e),s(`data-${r.group}-end-after`,e)):n.writer.clear(n.writer.createRangeOn(e),e);n.writer.clearClonedElementsGroup(o.markerName),t.stop()}function s(e,t){if(t.hasAttribute(e)){const o=new Set(t.getAttribute(e).split(","));o.delete(r.name),0==o.size?n.writer.removeAttribute(e,t):n.writer.setAttribute(e,Array.from(o).join(","),t)}}}}(o),{priority:e.converterPriority||"normal"})}}(e))}}function rc(e,t){const o=e.createAttributeElement("span",t.attributes);return t.classes&&o._addClass(t.classes),"number"==typeof t.priority&&(o._priority=t.priority),o._id=t.id,o}function ic(e,t,o,n,r){const i=t?e.start:e.end,s=i.nodeAfter&&i.nodeAfter.is("element")?i.nodeAfter:null,a=i.nodeBefore&&i.nodeBefore.is("element")?i.nodeBefore:null;if(s||a){let e,i;t&&s||!t&&!a?(e=s,i=!0):(e=a,i=!1);const l=o.mapper.toViewElement(e);if(l)return void function(e,t,o,n,r,i){const s=`data-${i.group}-${t?"start":"end"}-${o?"before":"after"}`,a=e.hasAttribute(s)?e.getAttribute(s).split(","):[];a.unshift(i.name),n.writer.setAttribute(s,a.join(","),e),n.mapper.bindElementToMarker(e,r.markerName)}(l,t,i,o,n,r)}!function(e,t,o,n,r){const i=`${r.group}-${t?"start":"end"}`,s=r.name?{name:r.name}:null,a=o.writer.createUIElement(i,s);o.writer.insert(e,a),o.mapper.bindElementToMarker(a,n.markerName)}(o.mapper.toViewPosition(i),t,o,n,r)}function sc(e){return"string"==typeof e&&(e={name:e}),e.attributes?Array.isArray(e.attributes)||(e.attributes=[e.attributes]):e.attributes=[],e.children=!!e.children,e}function ac(e,t){return"function"==typeof e?e:(o,n)=>function(e,t,o){"string"==typeof e&&(e={name:e});let n;const r=t.writer,i=Object.assign({},e.attributes);if("container"==o)n=r.createContainerElement(e.name,i);else if("attribute"==o){const t={priority:e.priority||Ss.DEFAULT_PRIORITY};n=r.createAttributeElement(e.name,i,t)}else n=r.createUIElement(e.name,i);if(e.styles){const t=Object.keys(e.styles);for(const o of t)r.setStyle(o,e.styles[o],n)}if(e.classes){const t=e.classes;if("string"==typeof t)r.addClass(t,n);else for(const e of t)r.addClass(e,n)}return n}(e,n,t)}function lc(e){return e.model.values?(t,o,n)=>{const r=e.view[t];return r?r(t,o,n):null}:e.view}function cc(e){return"string"==typeof e?t=>({key:e,value:t}):"object"==typeof e?e.value?()=>e:t=>({key:e.key,value:t}):e}function dc(e,t,o){const n="function"==typeof e?e(t,o):e;return n?(n.priority||(n.priority=10),n.id||(n.id=t.markerName),n):null}function uc(e){const t=function(e){return(t,o)=>{if(!t.is("element",e.name))return!1;if("attribute"==o.type){if(e.attributes.includes(o.attributeKey))return!0}else if(e.children)return!0;return!1}}(e);return(e,o)=>{const n=[];o.reconvertedElements||(o.reconvertedElements=new Set);for(const e of o.changes){const r="attribute"==e.type?e.range.start.nodeAfter:e.position.parent;if(r&&t(r,e)){if(!o.reconvertedElements.has(r)){o.reconvertedElements.add(r);const e=Sl._createBefore(r);let t=n.length;for(let o=n.length-1;o>=0;o--){const r=n[o],i=("attribute"==r.type?r.range.start:r.position).compareWith(e);if("before"==i||"remove"==r.type&&"same"==i)break;t=o}n.splice(t,0,{type:"remove",name:r.name,position:e,length:1},{type:"reinsert",name:r.name,position:e,length:1})}}else n.push(e)}o.changes=n}}function hc(e){return(t,o,n={})=>{const r=["insert"];for(const o of e.attributes)t.hasAttribute(o)&&r.push(`attribute:${o}`);return!!r.every((e=>o.test(t,e)))&&(n.preflight||r.forEach((e=>o.consume(t,e))),!0)}}function pc(e,t,o,n){for(const r of t)gc(e.root,r,o,n)||o.convertItem(r)}function gc(e,t,o,n){const{writer:r,mapper:i}=o;if(!n.reconversion)return!1;const s=i.toViewElement(t);return!(!s||s.root==e)&&(!!o.canReuseView(s)&&(r.move(r.createRangeOn(s),i.toViewPosition(Sl._createBefore(t))),!0))}function mc(e,t,{preflight:o}={}){return o?t.test(e,"insert"):t.consume(e,"insert")}function fc(e){const{schema:t,document:o}=e.model;for(const n of o.getRootNames()){const r=o.getRoot(n);if(r.isEmpty&&!t.checkChild(r,"$text")&&t.checkChild(r,"paragraph"))return e.insertElement("paragraph",r),!0}return!1}function bc(e,t,o){const n=o.createContext(e);return!!o.checkChild(n,"paragraph")&&!!o.checkChild(n.push("paragraph"),t)}function kc(e,t){const o=t.createElement("paragraph");return t.insert(o,e),t.createPositionAt(o,0)}class wc extends tc{elementToElement(e){return this.add(_c(e))}elementToAttribute(e){return this.add(function(e){e=oc(e),Cc(e);const t=vc(e,!1),o=yc(e.view),n=o?`element:${o}`:"element";return o=>{o.on(n,t,{priority:e.converterPriority||"low"})}}(e))}attributeToAttribute(e){return this.add(function(e){e=oc(e);let t=null;("string"==typeof e.view||e.view.key)&&(t=function(e){"string"==typeof e.view&&(e.view={key:e.view});const t=e.view.key;let o;if("class"==t||"style"==t){o={["class"==t?"classes":"styles"]:e.view.value}}else{o={attributes:{[t]:void 0===e.view.value?/[\s\S]*/:e.view.value}}}e.view.name&&(o.name=e.view.name);return e.view=o,t}(e));Cc(e,t);const o=vc(e,!0);return t=>{t.on("element",o,{priority:e.converterPriority||"low"})}}(e))}elementToMarker(e){return this.add(function(e){const t=function(e){return(t,o)=>{const n="string"==typeof e?e:e(t,o);return o.writer.createElement("$marker",{"data-name":n})}}(e.model);return _c({...e,model:t})}(e))}dataToMarker(e){return this.add(function(e){e=oc(e),e.model||(e.model=t=>t?e.view+":"+t:e.view);const t={view:e.view,model:e.model},o=Ac(xc(t,"start")),n=Ac(xc(t,"end"));return r=>{r.on(`element:${e.view}-start`,o,{priority:e.converterPriority||"normal"}),r.on(`element:${e.view}-end`,n,{priority:e.converterPriority||"normal"});const i=p.get("low"),s=p.get("highest"),a=p.get(e.converterPriority)/s;r.on("element",function(e){return(t,o,n)=>{const r=`data-${e.view}`;function i(t,r){for(const i of r){const r=e.model(i,n),s=n.writer.createElement("$marker",{"data-name":r});n.writer.insert(s,t),o.modelCursor.isEqual(t)?o.modelCursor=o.modelCursor.getShiftedBy(1):o.modelCursor=o.modelCursor._getTransformedByInsertion(t,1),o.modelRange=o.modelRange._getTransformedByInsertion(t,1)[0]}}(n.consumable.test(o.viewItem,{attributes:r+"-end-after"})||n.consumable.test(o.viewItem,{attributes:r+"-start-after"})||n.consumable.test(o.viewItem,{attributes:r+"-end-before"})||n.consumable.test(o.viewItem,{attributes:r+"-start-before"}))&&(o.modelRange||Object.assign(o,n.convertChildren(o.viewItem,o.modelCursor)),n.consumable.consume(o.viewItem,{attributes:r+"-end-after"})&&i(o.modelRange.end,o.viewItem.getAttribute(r+"-end-after").split(",")),n.consumable.consume(o.viewItem,{attributes:r+"-start-after"})&&i(o.modelRange.end,o.viewItem.getAttribute(r+"-start-after").split(",")),n.consumable.consume(o.viewItem,{attributes:r+"-end-before"})&&i(o.modelRange.start,o.viewItem.getAttribute(r+"-end-before").split(",")),n.consumable.consume(o.viewItem,{attributes:r+"-start-before"})&&i(o.modelRange.start,o.viewItem.getAttribute(r+"-start-before").split(",")))}}(t),{priority:i+a})}}(e))}}function _c(e){const t=Ac(e=oc(e)),o=yc(e.view),n=o?`element:${o}`:"element";return o=>{o.on(n,t,{priority:e.converterPriority||"normal"})}}function yc(e){return"string"==typeof e?e:"object"==typeof e&&"string"==typeof e.name?e.name:null}function Ac(e){const t=new si(e.view);return(o,n,r)=>{const i=t.match(n.viewItem);if(!i)return;const s=i.match;if(s.name=!0,!r.consumable.test(n.viewItem,s))return;const a=function(e,t,o){return e instanceof Function?e(t,o):o.writer.createElement(e)}(e.model,n.viewItem,r);a&&r.safeInsert(a,n.modelCursor)&&(r.consumable.consume(n.viewItem,s),r.convertChildren(n.viewItem,a),r.updateConversionResult(a,n))}}function Cc(e,t=null){const o=null===t||(e=>e.getAttribute(t)),n="object"!=typeof e.model?e.model:e.model.key,r="object"!=typeof e.model||void 0===e.model.value?o:e.model.value;e.model={key:n,value:r}}function vc(e,t){const o=new si(e.view);return(n,r,i)=>{if(!r.modelRange&&t)return;const s=o.match(r.viewItem);if(!s)return;if(!function(e,t){const o="function"==typeof e?e(t):e;if("object"==typeof o&&!yc(o))return!1;return!o.classes&&!o.attributes&&!o.styles}(e.view,r.viewItem)?delete s.match.name:s.match.name=!0,!i.consumable.test(r.viewItem,s.match))return;const a=e.model.key,l="function"==typeof e.model.value?e.model.value(r.viewItem,i):e.model.value;if(null===l)return;r.modelRange||Object.assign(r,i.convertChildren(r.viewItem,r.modelCursor));const c=function(e,t,o,n){let r=!1;for(const i of Array.from(e.getItems({shallow:o})))n.schema.checkAttribute(i,t.key)&&(r=!0,i.hasAttribute(t.key)||n.writer.setAttribute(t.key,t.value,i));return r}(r.modelRange,{key:a,value:l},t,i);c&&(i.consumable.test(r.viewItem,{name:!0})&&(s.match.name=!0),i.consumable.consume(r.viewItem,s.match))}}function xc(e,t){return{view:`${e.view}-${t}`,model:(t,o)=>{const n=t.getAttribute("name"),r=e.model(n,o);return o.writer.createElement("$marker",{"data-name":r})}}}function Ec(e){e.document.registerPostFixer((t=>function(e,t){const o=t.document.selection,n=t.schema,r=[];let i=!1;for(const e of o.getRanges()){const t=Dc(e,n);t&&!t.isEqual(e)?(r.push(t),i=!0):r.push(e)}i&&e.setSelection(function(e){const t=[...e],o=new Set;let n=1;for(;n!o.has(t)))}(r),{backward:o.isBackward});return!1}(t,e)))}function Dc(e,t){return e.isCollapsed?function(e,t){const o=e.start,n=t.getNearestSelectionRange(o);if(!n){const e=o.getAncestors().reverse().find((e=>t.isObject(e)));return e?zl._createOn(e):null}if(!n.isCollapsed)return n;const r=n.start;if(o.isEqual(r))return null;return new zl(r)}(e,t):function(e,t){const{start:o,end:n}=e,r=t.checkChild(o,"$text"),i=t.checkChild(n,"$text"),s=t.getLimitElement(o),a=t.getLimitElement(n);if(s===a){if(r&&i)return null;if(function(e,t,o){const n=e.nodeAfter&&!o.isLimit(e.nodeAfter)||o.checkChild(e,"$text"),r=t.nodeBefore&&!o.isLimit(t.nodeBefore)||o.checkChild(t,"$text");return n||r}(o,n,t)){const e=o.nodeAfter&&t.isSelectable(o.nodeAfter)?null:t.getNearestSelectionRange(o,"forward"),r=n.nodeBefore&&t.isSelectable(n.nodeBefore)?null:t.getNearestSelectionRange(n,"backward"),i=e?e.start:o,s=r?r.end:n;return new zl(i,s)}}const l=s&&!s.is("rootElement"),c=a&&!a.is("rootElement");if(l||c){const e=o.nodeAfter&&n.nodeBefore&&o.nodeAfter.parent===n.nodeBefore.parent,r=l&&(!e||!Tc(o.nodeAfter,t)),i=c&&(!e||!Tc(n.nodeBefore,t));let d=o,u=n;return r&&(d=Sl._createBefore(Sc(s,t))),i&&(u=Sl._createAfter(Sc(a,t))),new zl(d,u)}return null}(e,t)}function Sc(e,t){let o=e,n=o;for(;t.isLimit(n)&&n.parent;)o=n,n=n.parent;return o}function Tc(e,t){return e&&t.isSelectable(e)}class Bc extends(H()){constructor(e,t){super(),this.model=e,this.view=new wl(t),this.mapper=new Ml,this.downcastDispatcher=new Ol({mapper:this.mapper,schema:e.schema});const o=this.model.document,r=o.selection,i=this.model.markers;var s,a,l;this.listenTo(this.model,"_beforeChanges",(()=>{this.view._disableRendering(!0)}),{priority:"highest"}),this.listenTo(this.model,"_afterChanges",(()=>{this.view._disableRendering(!1)}),{priority:"lowest"}),this.listenTo(o,"change",(()=>{this.view.change((e=>{this.downcastDispatcher.convertChanges(o.differ,i,e),this.downcastDispatcher.convertSelection(r,i,e)}))}),{priority:"low"}),this.listenTo(this.view.document,"selectionChange",function(e,t){return(o,n)=>{const r=n.newSelection,i=[];for(const e of r.getRanges())i.push(t.toModelRange(e));const s=e.createSelection(i,{backward:r.isBackward});s.isEqual(e.document.selection)||e.change((e=>{e.setSelection(s)}))}}(this.model,this.mapper)),this.listenTo(this.view.document,"beforeinput",(s=this.mapper,a=this.model.schema,l=this.view,(e,t)=>{if(!l.document.isComposing||n.isAndroid)for(let e=0;e{if(!o.consumable.consume(t.item,e.name))return;const n=o.writer,r=o.mapper.toViewPosition(t.range.start),i=n.createText(t.item.data);n.insert(r,i)}),{priority:"lowest"}),this.downcastDispatcher.on("insert",((e,t,o)=>{o.convertAttributes(t.item),t.reconversion||!t.item.is("element")||t.item.isEmpty||o.convertChildren(t.item)}),{priority:"lowest"}),this.downcastDispatcher.on("remove",((e,t,o)=>{const n=o.mapper.toViewPosition(t.position),r=t.position.getShiftedBy(t.length),i=o.mapper.toViewPosition(r,{isPhantom:!0}),s=o.writer.createRange(n,i),a=o.writer.remove(s.getTrimmed());for(const e of o.writer.createRangeIn(a).getItems())o.mapper.unbindViewElement(e,{defer:!0})}),{priority:"low"}),this.downcastDispatcher.on("selection",((e,t,o)=>{const n=o.writer,r=n.document.selection;for(const e of r.getRanges())e.isCollapsed&&e.end.parent.isAttached()&&o.writer.mergeAttributes(e.start);n.setSelection(null)}),{priority:"high"}),this.downcastDispatcher.on("selection",((e,t,o)=>{const n=t.selection;if(n.isCollapsed)return;if(!o.consumable.consume(n,"selection"))return;const r=[];for(const e of n.getRanges())r.push(o.mapper.toViewRange(e));o.writer.setSelection(r,{backward:n.isBackward})}),{priority:"low"}),this.downcastDispatcher.on("selection",((e,t,o)=>{const n=t.selection;if(!n.isCollapsed)return;if(!o.consumable.consume(n,"selection"))return;const r=o.writer,i=n.getFirstPosition(),s=o.mapper.toViewPosition(i),a=r.breakAttributes(s);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 ps(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,o=this.model.markers.get(t);if(!o)throw new f("editingcontroller-reconvertmarker-marker-not-exist",this,{markerName:t});this.model.change((()=>{this.model.markers._refresh(o)}))}reconvertItem(e){this.model.change((()=>{this.model.document.differ._refreshItem(e)}))}}class Ic{constructor(){this._consumables=new Map}add(e,t){let o;e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):(this._consumables.has(e)?o=this._consumables.get(e):(o=new Rc(e),this._consumables.set(e,o)),o.add(t))}test(e,t){const o=this._consumables.get(e);return void 0===o?null:e.is("$text")||e.is("documentFragment")?o:o.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 o=this._consumables.get(e);void 0!==o&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):o.revert(t))}static consumablesFromElement(e){const t={element:e,name:!0,attributes:[],classes:[],styles:[]},o=e.getAttributeKeys();for(const e of o)"style"!=e&&"class"!=e&&t.attributes.push(e);const n=e.getClassNames();for(const e of n)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 Ic),e.is("$text"))return t.add(e),t;e.is("element")&&t.add(e,Ic.consumablesFromElement(e)),e.is("documentFragment")&&t.add(e);for(const o of e.getChildren())t=Ic.createFrom(o,t);return t}}const Pc=["attributes","classes","styles"];class Rc{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 Pc)t in e&&this._add(t,e[t])}test(e){if(e.name&&!this._canConsumeName)return this._canConsumeName;for(const t of Pc)if(t in e){const o=this._test(t,e[t]);if(!0!==o)return o}return!0}consume(e){e.name&&(this._canConsumeName=!1);for(const t of Pc)t in e&&this._consume(t,e[t])}revert(e){e.name&&(this._canConsumeName=!0);for(const t of Pc)t in e&&this._revert(t,e[t])}_add(e,t){const o=ue(t)?t:[t],n=this._consumables[e];for(const t of o){if("attributes"===e&&("class"===t||"style"===t))throw new f("viewconsumable-invalid-attribute",this);if(n.set(t,!0),"styles"===e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))n.set(e,!0)}}_test(e,t){const o=ue(t)?t:[t],n=this._consumables[e];for(const t of o)if("attributes"!==e||"class"!==t&&"style"!==t){const e=n.get(t);if(void 0===e)return null;if(!e)return!1}else{const e="class"==t?"classes":"styles",o=this._test(e,[...this._consumables[e].keys()]);if(!0!==o)return o}return!0}_consume(e,t){const o=ue(t)?t:[t],n=this._consumables[e];for(const t of o)if("attributes"!==e||"class"!==t&&"style"!==t){if(n.set(t,!1),"styles"==e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))n.set(e,!1)}else{const e="class"==t?"classes":"styles";this._consume(e,[...this._consumables[e].keys()])}}_revert(e,t){const o=ue(t)?t:[t],n=this._consumables[e];for(const t of o)if("attributes"!==e||"class"!==t&&"style"!==t){!1===n.get(t)&&n.set(t,!0)}else{const e="class"==t?"classes":"styles";this._revert(e,[...this._consumables[e].keys()])}}}class zc extends(H()){constructor(){super(),this._sourceDefinitions={},this._attributeProperties={},this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",((e,t)=>{t[0]=new Mc(t[0])}),{priority:"highest"}),this.on("checkChild",((e,t)=>{t[0]=new Mc(t[0]),t[1]=this.getDefinition(t[1])}),{priority:"highest"})}register(e,t){if(this._sourceDefinitions[e])throw new f("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 f("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(t,e)}checkAttribute(e,t){const o=this.getDefinition(e.last);return!!o&&o.allowAttributes.includes(t)}checkMerge(e,t){if(e instanceof Sl){const t=e.nodeBefore,o=e.nodeAfter;if(!(t instanceof xl))throw new f("schema-check-merge-no-element-before",this);if(!(o instanceof xl))throw new f("schema-check-merge-no-element-after",this);return this.checkMerge(t,o)}for(const o of t.getChildren())if(!this.checkChild(e,o))return!1;return!0}addChildCheck(e){this.on("checkChild",((t,[o,n])=>{if(!n)return;const r=e(o,n);"boolean"==typeof r&&(t.stop(),t.return=r)}),{priority:"high"})}addAttributeCheck(e){this.on("checkAttribute",((t,[o,n])=>{const r=e(o,n);"boolean"==typeof r&&(t.stop(),t.return=r)}),{priority:"high"})}setAttributeProperties(e,t){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),t)}getAttributeProperties(e){return this._attributeProperties[e]||{}}getLimitElement(e){let t;if(e instanceof Sl)t=e.parent;else{t=(e instanceof zl?[e]:Array.from(e.getRanges())).reduce(((e,t)=>{const o=t.getCommonAncestor();return e?e.getCommonAncestor(o,{includeSelf:!0}):o}),null)}for(;!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){const o=[...e.getFirstPosition().getAncestors(),new Cl("",e.getAttributes())];return this.checkAttribute(o,t)}{const o=e.getRanges();for(const e of o)for(const o of e)if(this.checkAttribute(o.item,t))return!0}return!1}*getValidRanges(e,t){e=function*(e){for(const t of e)yield*t.getMinimalFlatRanges()}(e);for(const o of e)yield*this._getValidRangesForRange(o,t)}getNearestSelectionRange(e,t="both"){if(this.checkChild(e,"$text"))return new zl(e);let o,n;const r=e.getAncestors().reverse().find((e=>this.isLimit(e)))||e.root;"both"!=t&&"backward"!=t||(o=new El({boundaries:zl._createIn(r),startPosition:e,direction:"backward"})),"both"!=t&&"forward"!=t||(n=new El({boundaries:zl._createIn(r),startPosition:e}));for(const e of function*(e,t){let o=!1;for(;!o;){if(o=!0,e){const t=e.next();t.done||(o=!1,yield{walker:e,value:t.value})}if(t){const e=t.next();e.done||(o=!1,yield{walker:t,value:e.value})}}}(o,n)){const t=e.walker==o?"elementEnd":"elementStart",n=e.value;if(n.type==t&&this.isObject(n.item))return zl._createOn(n.item);if(this.checkChild(n.nextPosition,"$text"))return new zl(n.nextPosition)}return null}findAllowedParent(e,t){let o=e.parent;for(;o;){if(this.checkChild(o,t))return o;if(this.isLimit(o))return null;o=o.parent}return null}setAllowedAttributes(e,t,o){const n=o.model;for(const[r,i]of Object.entries(t))n.schema.checkAttribute(e,r)&&o.setAttribute(r,i,e)}removeDisallowedAttributes(e,t){for(const o of e)if(o.is("$text"))Kc(this,o,t);else{const e=zl._createIn(o).getPositions();for(const o of e){Kc(this,o.nodeBefore||o.parent,t)}}}getAttributesWithProperty(e,t,o){const n={};for(const[r,i]of e.getAttributes()){const e=this.getAttributeProperties(r);void 0!==e[t]&&(void 0!==o&&o!==e[t]||(n[r]=i))}return n}createContext(e){return new Mc(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},t=this._sourceDefinitions,o=Object.keys(t);for(const n of o)e[n]=Nc(t[n],n);for(const t of o)Fc(e,t);for(const t of o)Oc(e,t);for(const t of o)Vc(e,t);for(const t of o)Lc(e,t),jc(e,t);for(const t of o)qc(e,t),Hc(e,t),Wc(e,t);this._compiledDefinitions=e}_checkContextMatch(e,t,o=t.length-1){const n=t.getItem(o);if(e.allowIn.includes(n.name)){if(0==o)return!0;{const e=this.getDefinition(n);return this._checkContextMatch(e,t,o-1)}}return!1}*_getValidRangesForRange(e,t){let o=e.start,n=e.start;for(const r of e.getItems({shallow:!0}))r.is("element")&&(yield*this._getValidRangesForRange(zl._createIn(r),t)),this.checkAttribute(r,t)||(o.isEqual(n)||(yield new zl(o,n)),o=Sl._createAfter(r)),n=Sl._createAfter(r);o.isEqual(n)||(yield new zl(o,n))}}class Mc{constructor(e){if(e instanceof Mc)return e;let t;t="string"==typeof e?[e]:Array.isArray(e)?e:e.getAncestors({includeSelf:!0}),this._items=t.map(Gc)}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 Mc([e]);return t._items=[...this._items,...t._items],t}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 Nc(e,t){const o={name:t,allowIn:[],allowContentOf:[],allowWhere:[],allowAttributes:[],allowAttributesOf:[],allowChildren:[],inheritTypesFrom:[]};return function(e,t){for(const o of e){const e=Object.keys(o).filter((e=>e.startsWith("is")));for(const n of e)t[n]=!!o[n]}}(e,o),$c(e,o,"allowIn"),$c(e,o,"allowContentOf"),$c(e,o,"allowWhere"),$c(e,o,"allowAttributes"),$c(e,o,"allowAttributesOf"),$c(e,o,"allowChildren"),$c(e,o,"inheritTypesFrom"),function(e,t){for(const o of e){const e=o.inheritAllFrom;e&&(t.allowContentOf.push(e),t.allowWhere.push(e),t.allowAttributesOf.push(e),t.inheritTypesFrom.push(e))}}(e,o),o}function Fc(e,t){const o=e[t];for(const n of o.allowChildren){const o=e[n];o&&o.allowIn.push(t)}o.allowChildren.length=0}function Oc(e,t){for(const o of e[t].allowContentOf)if(e[o]){Uc(e,o).forEach((e=>{e.allowIn.push(t)}))}delete e[t].allowContentOf}function Vc(e,t){for(const o of e[t].allowWhere){const n=e[o];if(n){const o=n.allowIn;e[t].allowIn.push(...o)}}delete e[t].allowWhere}function Lc(e,t){for(const o of e[t].allowAttributesOf){const n=e[o];if(n){const o=n.allowAttributes;e[t].allowAttributes.push(...o)}}delete e[t].allowAttributesOf}function jc(e,t){const o=e[t];for(const t of o.inheritTypesFrom){const n=e[t];if(n){const e=Object.keys(n).filter((e=>e.startsWith("is")));for(const t of e)t in o||(o[t]=n[t])}}delete o.inheritTypesFrom}function qc(e,t){const o=e[t],n=o.allowIn.filter((t=>e[t]));o.allowIn=Array.from(new Set(n))}function Hc(e,t){const o=e[t];for(const n of o.allowIn){e[n].allowChildren.push(t)}}function Wc(e,t){const o=e[t];o.allowAttributes=Array.from(new Set(o.allowAttributes))}function $c(e,t,o){for(const n of e){const e=n[o];"string"==typeof e?t[o].push(e):Array.isArray(e)&&t[o].push(...e)}}function Uc(e,t){const o=e[t];return(n=e,Object.keys(n).map((e=>n[e]))).filter((e=>e.allowIn.includes(o.name)));var n}function Gc(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 Kc(e,t,o){for(const n of t.getAttributeKeys())e.checkAttribute(t,n)||o.removeAttribute(n,t)}class Zc extends(S()){constructor(e){super(),this._splitParts=new Map,this._cursorParents=new Map,this._modelCursor=null,this._emptyElementsToKeep=new Set,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,o=["$root"]){this.fire("viewCleanup",e),this._modelCursor=function(e,t){let o;for(const n of new Mc(e)){const e={};for(const t of n.getAttributeKeys())e[t]=n.getAttribute(t);const r=t.createElement(n.name,e);o&&t.insert(r,o),o=Sl._createAt(r,0)}return o}(o,t),this.conversionApi.writer=t,this.conversionApi.consumable=Ic.createFrom(e),this.conversionApi.store={};const{modelRange:n}=this._convertItem(e,this._modelCursor),r=t.createDocumentFragment();if(n){this._removeEmptyElements();for(const e of Array.from(this._modelCursor.parent.getChildren()))t.append(e,r);r.markers=function(e,t){const o=new Set,n=new Map,r=zl._createIn(e).getItems();for(const e of r)e.is("element","$marker")&&o.add(e);for(const e of o){const o=e.getAttribute("data-name"),r=t.createPositionBefore(e);n.has(o)?n.get(o).end=r.clone():n.set(o,new zl(r.clone())),t.remove(e)}return n}(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 o={viewItem:e,modelCursor:t,modelRange:null};if(e.is("element")?this.fire(`element:${e.name}`,o,this.conversionApi):e.is("$text")?this.fire("text",o,this.conversionApi):this.fire("documentFragment",o,this.conversionApi),o.modelRange&&!(o.modelRange instanceof zl))throw new f("view-conversion-dispatcher-incorrect-result",this);return{modelRange:o.modelRange,modelCursor:o.modelCursor}}_convertChildren(e,t){let o=t.is("position")?t:Sl._createAt(t,0);const n=new zl(o);for(const t of Array.from(e.getChildren())){const e=this._convertItem(t,o);e.modelRange instanceof zl&&(n.end=e.modelRange.end,o=e.modelCursor)}return{modelRange:n,modelCursor:o}}_safeInsert(e,t){const o=this._splitToAllowedParent(e,t);return!!o&&(this.conversionApi.writer.insert(e,o.position),!0)}_updateConversionResult(e,t){const o=this._getSplitParts(e),n=this.conversionApi.writer;t.modelRange||(t.modelRange=n.createRange(n.createPositionBefore(e),n.createPositionAfter(o[o.length-1])));const r=this._cursorParents.get(e);t.modelCursor=r?n.createPositionAt(r,0):t.modelRange.end}_splitToAllowedParent(e,t){const{schema:o,writer:n}=this.conversionApi;let r=o.findAllowedParent(t,e);if(r){if(r===t.parent)return{position:t};this._modelCursor.parent.getAncestors().includes(r)&&(r=null)}if(!r)return bc(t,e,o)?{position:kc(t,n)}:null;const i=this.conversionApi.writer.split(t,r),s=[];for(const e of i.range.getWalker())if("elementEnd"==e.type)s.push(e.item);else{const t=s.pop(),o=e.item;this._registerSplitPair(t,o)}const a=i.range.end.parent;return this._cursorParents.set(e,a),{position:i.position,cursorParent:a}}_registerSplitPair(e,t){this._splitParts.has(e)||this._splitParts.set(e,[e]);const o=this._splitParts.get(e);this._splitParts.set(t,o),o.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(){let e=!1;for(const t of this._splitParts.keys())t.isEmpty&&!this._emptyElementsToKeep.has(t)&&(this.conversionApi.writer.remove(t),this._splitParts.delete(t),e=!0);e&&this._removeEmptyElements()}}class Jc{getHtml(e){const t=document.implementation.createHTMLDocument("").createElement("div");return t.appendChild(e),t.innerHTML}}class Qc{constructor(e){this.skipComments=!0,this.domParser=new DOMParser,this.domConverter=new ka(e,{renderingMode:"data"}),this.htmlWriter=new Jc}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){e.match(/<(?:html|body|head|meta)(?:\s[^>]*)?>/i)||(e=`${e}`);const t=this.domParser.parseFromString(e,"text/html"),o=t.createDocumentFragment(),n=t.body.childNodes;for(;n.length>0;)o.appendChild(n[0]);return o}}class Yc extends(S()){constructor(e,t){super(),this.model=e,this.mapper=new Ml,this.downcastDispatcher=new Ol({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",((e,t,o)=>{if(!o.consumable.consume(t.item,e.name))return;const n=o.writer,r=o.mapper.toViewPosition(t.range.start),i=n.createText(t.item.data);n.insert(r,i)}),{priority:"lowest"}),this.downcastDispatcher.on("insert",((e,t,o)=>{o.convertAttributes(t.item),t.reconversion||!t.item.is("element")||t.item.isEmpty||o.convertChildren(t.item)}),{priority:"lowest"}),this.upcastDispatcher=new Zc({schema:e.schema}),this.viewDocument=new Ds(t),this.stylesProcessor=t,this.htmlProcessor=new Qc(this.viewDocument),this.processor=this.htmlProcessor,this._viewWriter=new Vs(this.viewDocument),this.upcastDispatcher.on("text",((e,t,{schema:o,consumable:n,writer:r})=>{let i=t.modelCursor;if(!n.test(t.viewItem))return;if(!o.checkChild(i,"$text")){if(!bc(i,"$text",o))return;if(0==t.viewItem.data.trim().length)return;const e=i.nodeBefore;i=kc(i,r),e&&e.is("element","$marker")&&(r.move(r.createRangeOn(e),i),i=r.createPositionAfter(e))}n.consume(t.viewItem);const s=r.createText(t.viewItem.data);r.insert(s,i),t.modelRange=r.createRange(i,i.getShiftedBy(s.offsetSize)),t.modelCursor=t.modelRange.end}),{priority:"lowest"}),this.upcastDispatcher.on("element",((e,t,o)=>{if(!t.modelRange&&o.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:n}=o.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=n}}),{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",((e,t,o)=>{if(!t.modelRange&&o.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:n}=o.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=n}}),{priority:"lowest"}),H().prototype.decorate.call(this,"init"),H().prototype.decorate.call(this,"set"),H().prototype.decorate.call(this,"get"),H().prototype.decorate.call(this,"toView"),H().prototype.decorate.call(this,"toModel"),this.on("init",(()=>{this.fire("ready")}),{priority:"lowest"}),this.on("ready",(()=>{this.model.enqueueChange({isUndoable:!1},fc)}),{priority:"lowest"})}get(e={}){const{rootName:t="main",trim:o="empty"}=e;if(!this._checkIfRootsExists([t]))throw new f("datacontroller-get-non-existent-root",this);const n=this.model.document.getRoot(t);return n.isAttached()||b("datacontroller-get-detached-root",this),"empty"!==o||this.model.hasContent(n,{ignoreWhitespaces:!0})?this.stringify(n,e):""}stringify(e,t={}){const o=this.toView(e,t);return this.processor.toData(o)}toView(e,t={}){const o=this.viewDocument,n=this._viewWriter;this.mapper.clearBindings();const r=zl._createIn(e),i=new Os(o);this.mapper.bindElements(e,i);const s=e.is("documentFragment")?e.markers:function(e){const t=[],o=e.root.document;if(!o)return new Map;const n=zl._createIn(e);for(const e of o.model.markers){const o=e.getRange(),r=o.isCollapsed,i=o.start.isEqual(n.start)||o.end.isEqual(n.end);if(r&&i)t.push([e.name,o]);else{const r=n.getIntersection(o);r&&t.push([e.name,r])}}return t.sort((([e,t],[o,n])=>{if("after"!==t.end.compareWith(n.start))return 1;if("before"!==t.start.compareWith(n.end))return-1;switch(t.start.compareWith(n.start)){case"before":return 1;case"after":return-1;default:switch(t.end.compareWith(n.end)){case"before":return 1;case"after":return-1;default:return o.localeCompare(e)}}})),new Map(t)}(e);return this.downcastDispatcher.convert(r,s,n,t),i}init(e){if(this.model.document.version)throw new f("datacontroller-init-document-not-empty",this);let t={};if("string"==typeof e?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new f("datacontroller-init-non-existent-root",this);return this.model.enqueueChange({isUndoable:!1},(e=>{for(const o of Object.keys(t)){const n=this.model.document.getRoot(o);e.insert(this.parse(t[o],n),n,0)}})),Promise.resolve()}set(e,t={}){let o={};if("string"==typeof e?o.main=e:o=e,!this._checkIfRootsExists(Object.keys(o)))throw new f("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(o)){const n=this.model.document.getRoot(t);e.remove(e.createRangeIn(n)),e.insert(this.parse(o[t],n),n,0)}}))}parse(e,t="$root"){const o=this.processor.toView(e);return this.toModel(o,t)}toModel(e,t="$root"){return this.model.change((o=>this.upcastDispatcher.convert(e,o,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 Xc{constructor(e,t){this._helpers=new Map,this._downcast=mr(e),this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=mr(t),this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(e,t){const o=this._downcast.includes(t);if(!this._upcast.includes(t)&&!o)throw new f("conversion-add-alias-dispatcher-not-registered",this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:o})}for(e){if(!this._helpers.has(e))throw new f("conversion-for-unknown-group",this);return this._helpers.get(e)}elementToElement(e){this.for("downcast").elementToElement(e);for(const{model:t,view:o}of ed(e))this.for("upcast").elementToElement({model:t,view:o,converterPriority:e.converterPriority})}attributeToElement(e){this.for("downcast").attributeToElement(e);for(const{model:t,view:o}of ed(e))this.for("upcast").elementToAttribute({view:o,model:t,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(const{model:t,view:o}of ed(e))this.for("upcast").attributeToAttribute({view:o,model:t})}_createConversionHelpers({name:e,dispatchers:t,isDowncast:o}){if(this._helpers.has(e))throw new f("conversion-group-exists",this);const n=o?new nc(t):new wc(t);this._helpers.set(e,n)}}function*ed(e){if(e.model.values)for(const t of e.model.values){const o={key:e.model.key,value:t},n=e.view[t],r=e.upcastAlso?e.upcastAlso[t]:void 0;yield*td(o,n,r)}else yield*td(e.model,e.view,e.upcastAlso)}function*td(e,t,o){if(yield{model:e,view:t},o)for(const t of mr(o))yield{model:e,view:t}}class od{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 nd(e,t){const o=sd(t),n=o.reduce(((e,t)=>e+t.offsetSize),0),r=e.parent;ld(e);const i=e.index;return r._insertChild(i,o),ad(r,i+o.length),ad(r,i),new zl(e,e.getShiftedBy(n))}function rd(e){if(!e.isFlat)throw new f("operation-utils-remove-range-not-flat",this);const t=e.start.parent;ld(e.start),ld(e.end);const o=t._removeChildren(e.start.index,e.end.index-e.start.index);return ad(t,e.start.index),o}function id(e,t){if(!e.isFlat)throw new f("operation-utils-move-range-not-flat",this);const o=rd(e);return nd(t=t._getTransformedByDeletion(e.start,e.end.offset-e.start.offset),o)}function sd(e){const t=[];!function e(o){if("string"==typeof o)t.push(new Cl(o));else if(o instanceof vl)t.push(new Cl(o.data,o.getAttributes()));else if(o instanceof yl)t.push(o);else if(Q(o))for(const t of o)e(t)}(e);for(let e=1;ee.maxOffset)throw new f("move-operation-nodes-do-not-exist",this);if(e===t&&o=o&&this.targetPosition.path[e]e._clone(!0)))),t=new ud(this.position,e,this.baseVersion);return t.shouldReceiveAttributes=this.shouldReceiveAttributes,t}getReversed(){const e=this.position.root.document.graveyard,t=new Sl(e,[0]);return new dd(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffsete._clone(!0)))),nd(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 o=[];for(const t of e.nodes)t.name?o.push(xl.fromJSON(t)):o.push(Cl.fromJSON(t));const n=new ud(Sl.fromJSON(e.position,t),o,e.baseVersion);return n.shouldReceiveAttributes=e.shouldReceiveAttributes,n}}class hd extends od{constructor(e,t,o,n,r){super(r),this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=t,this.insertionPosition=o,this.graveyardPosition=n?n.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 Sl(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new zl(this.splitPosition,e)}get affectedSelectable(){const e=[zl._createFromPositionAndShift(this.splitPosition,0),zl._createFromPositionAndShift(this.insertionPosition,0)];return this.graveyardPosition&&e.push(zl._createFromPositionAndShift(this.graveyardPosition,0)),e}clone(){return new hd(this.splitPosition,this.howMany,this.insertionPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.splitPosition.root.document.graveyard,t=new Sl(e,[0]);return new pd(this.moveTargetPosition,this.howMany,this.splitPosition,t,this.baseVersion+1)}_validate(){const e=this.splitPosition.parent,t=this.splitPosition.offset;if(!e||e.maxOffset{if(e.key===t.key&&e.range.start.hasSameParentAs(t.range.start)){const n=e.range.getDifference(t.range).map((t=>new fd(t,e.key,e.oldValue,e.newValue,0))),r=e.range.getIntersection(t.range);return r&&o.aIsStrong&&n.push(new fd(r,t.key,t.newValue,e.newValue,0)),0==n.length?[new bd(0)]:n}return[e]})),vd(fd,ud,((e,t)=>{if(e.range.start.hasSameParentAs(t.position)&&e.range.containsPosition(t.position)){const o=e.range._getTransformedByInsertion(t.position,t.howMany,!t.shouldReceiveAttributes).map((t=>new fd(t,e.key,e.oldValue,e.newValue,e.baseVersion)));if(t.shouldReceiveAttributes){const n=Id(t,e.key,e.oldValue);n&&o.unshift(n)}return o}return e.range=e.range._getTransformedByInsertion(t.position,t.howMany,!1)[0],[e]})),vd(fd,pd,((e,t)=>{const o=[];e.range.start.hasSameParentAs(t.deletionPosition)&&(e.range.containsPosition(t.deletionPosition)||e.range.start.isEqual(t.deletionPosition))&&o.push(zl._createFromPositionAndShift(t.graveyardPosition,1));const n=e.range._getTransformedByMergeOperation(t);return n.isCollapsed||o.push(n),o.map((t=>new fd(t,e.key,e.oldValue,e.newValue,e.baseVersion)))})),vd(fd,dd,((e,t)=>{const o=function(e,t){const o=zl._createFromPositionAndShift(t.sourcePosition,t.howMany);let n=null,r=[];o.containsRange(e,!0)?n=e:e.start.hasSameParentAs(o.start)?(r=e.getDifference(o),n=e.getIntersection(o)):r=[e];const i=[];for(let e of r){e=e._getTransformedByDeletion(t.sourcePosition,t.howMany);const o=t.getMovedRangeStart(),n=e.start.hasSameParentAs(o),r=e._getTransformedByInsertion(o,t.howMany,n);i.push(...r)}n&&i.push(n._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany,!1)[0]);return i}(e.range,t);return o.map((t=>new fd(t,e.key,e.oldValue,e.newValue,e.baseVersion)))})),vd(fd,hd,((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 o=e.clone();return o.range=new zl(t.moveTargetPosition.clone(),e.range.end._getCombined(t.splitPosition,t.moveTargetPosition)),e.range.end=t.splitPosition.clone(),e.range.end.stickiness="toPrevious",[e,o]}return e.range=e.range._getTransformedBySplitOperation(t),[e]})),vd(ud,fd,((e,t)=>{const o=[e];if(e.shouldReceiveAttributes&&e.position.hasSameParentAs(t.range.start)&&t.range.containsPosition(e.position)){const n=Id(e,t.key,t.newValue);n&&o.push(n)}return o})),vd(ud,ud,((e,t,o)=>(e.position.isEqual(t.position)&&o.aIsStrong||(e.position=e.position._getTransformedByInsertOperation(t)),[e]))),vd(ud,dd,((e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e]))),vd(ud,hd,((e,t)=>(e.position=e.position._getTransformedBySplitOperation(t),[e]))),vd(ud,pd,((e,t)=>(e.position=e.position._getTransformedByMergeOperation(t),[e]))),vd(gd,ud,((e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByInsertOperation(t)[0]),e.newRange&&(e.newRange=e.newRange._getTransformedByInsertOperation(t)[0]),[e]))),vd(gd,gd,((e,t,o)=>{if(e.name==t.name){if(!o.aIsStrong)return[new bd(0)];e.oldRange=t.newRange?t.newRange.clone():null}return[e]})),vd(gd,pd,((e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByMergeOperation(t)),e.newRange&&(e.newRange=e.newRange._getTransformedByMergeOperation(t)),[e]))),vd(gd,dd,((e,t,o)=>{if(e.oldRange&&(e.oldRange=zl._createFromRanges(e.oldRange._getTransformedByMoveOperation(t))),e.newRange){if(o.abRelation){const n=zl._createFromRanges(e.newRange._getTransformedByMoveOperation(t));if("left"==o.abRelation.side&&t.targetPosition.isEqual(e.newRange.start))return e.newRange.end=n.end,e.newRange.start.path=o.abRelation.path,[e];if("right"==o.abRelation.side&&t.targetPosition.isEqual(e.newRange.end))return e.newRange.start=n.start,e.newRange.end.path=o.abRelation.path,[e]}e.newRange=zl._createFromRanges(e.newRange._getTransformedByMoveOperation(t))}return[e]})),vd(gd,hd,((e,t,o)=>{if(e.oldRange&&(e.oldRange=e.oldRange._getTransformedBySplitOperation(t)),e.newRange){if(o.abRelation){const n=e.newRange._getTransformedBySplitOperation(t);return e.newRange.start.isEqual(t.splitPosition)&&o.abRelation.wasStartBeforeMergedElement?e.newRange.start=Sl._createAt(t.insertionPosition):e.newRange.start.isEqual(t.splitPosition)&&!o.abRelation.wasInLeftElement&&(e.newRange.start=Sl._createAt(t.moveTargetPosition)),e.newRange.end.isEqual(t.splitPosition)&&o.abRelation.wasInRightElement?e.newRange.end=Sl._createAt(t.moveTargetPosition):e.newRange.end.isEqual(t.splitPosition)&&o.abRelation.wasEndBeforeMergedElement?e.newRange.end=Sl._createAt(t.insertionPosition):e.newRange.end=n.end,[e]}e.newRange=e.newRange._getTransformedBySplitOperation(t)}return[e]})),vd(pd,ud,((e,t)=>(e.sourcePosition.hasSameParentAs(t.position)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByInsertOperation(t),e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t),[e]))),vd(pd,pd,((e,t,o)=>{if(e.sourcePosition.isEqual(t.sourcePosition)&&e.targetPosition.isEqual(t.targetPosition)){if(o.bWasUndone){const o=t.graveyardPosition.path.slice();return o.push(0),e.sourcePosition=new Sl(t.graveyardPosition.root,o),e.howMany=0,[e]}return[new bd(0)]}if(e.sourcePosition.isEqual(t.sourcePosition)&&!e.targetPosition.isEqual(t.targetPosition)&&!o.bWasUndone&&"splitAtSource"!=o.abRelation){const n="$graveyard"==e.targetPosition.root.rootName,r="$graveyard"==t.targetPosition.root.rootName;if(r&&!n||!(n&&!r)&&o.aIsStrong){const o=t.targetPosition._getTransformedByMergeOperation(t),n=e.targetPosition._getTransformedByMergeOperation(t);return[new dd(o,e.howMany,n,0)]}return[new bd(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)&&o.aIsStrong||(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]})),vd(pd,dd,((e,t,o)=>{const n=zl._createFromPositionAndShift(t.sourcePosition,t.howMany);return"remove"==t.type&&!o.bWasUndone&&!o.forceWeakRemove&&e.deletionPosition.hasSameParentAs(t.sourcePosition)&&n.containsPosition(e.sourcePosition)?[new bd(0)]:(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.graveyardPosition.isEqual(t.targetPosition)||(e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)),[e])})),vd(pd,hd,((e,t,o)=>{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)){const n=0!=t.howMany,r=t.graveyardPosition&&e.deletionPosition.isEqual(t.graveyardPosition);if(n||r||"mergeTargetNotMoved"==o.abRelation)return e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),[e]}if(e.sourcePosition.isEqual(t.splitPosition)){if("mergeSourceNotMoved"==o.abRelation)return e.howMany=0,e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e];if("mergeSameElement"==o.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]})),vd(dd,ud,((e,t)=>{const o=zl._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByInsertOperation(t,!1)[0];return e.sourcePosition=o.start,e.howMany=o.end.offset-o.start.offset,e.targetPosition.isEqual(t.position)||(e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t)),[e]})),vd(dd,dd,((e,t,o)=>{const n=zl._createFromPositionAndShift(e.sourcePosition,e.howMany),r=zl._createFromPositionAndShift(t.sourcePosition,t.howMany);let i,s=o.aIsStrong,a=!o.aIsStrong;if("insertBefore"==o.abRelation||"insertAfter"==o.baRelation?a=!0:"insertAfter"!=o.abRelation&&"insertBefore"!=o.baRelation||(a=!1),i=e.targetPosition.isEqual(t.targetPosition)&&a?e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany):e.targetPosition._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),Pd(e,t)&&Pd(t,e))return[t.getReversed()];if(n.containsPosition(t.targetPosition)&&n.containsRange(r,!0))return n.start=n.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),n.end=n.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),Rd([n],i);if(r.containsPosition(e.targetPosition)&&r.containsRange(n,!0))return n.start=n.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),n.end=n.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),Rd([n],i);const l=J(e.sourcePosition.getParentPath(),t.sourcePosition.getParentPath());if("prefix"==l||"extension"==l)return n.start=n.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),n.end=n.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),Rd([n],i);"remove"!=e.type||"remove"==t.type||o.aWasUndone||o.forceWeakRemove?"remove"==e.type||"remove"!=t.type||o.bWasUndone||o.forceWeakRemove||(s=!1):s=!0;const c=[],d=n.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 o="same"==J(e.start.getParentPath(),t.getMovedRangeStart().getParentPath()),n=e._getTransformedByInsertion(t.getMovedRangeStart(),t.howMany,o);c.push(...n)}const u=n.getIntersection(r);return null!==u&&s&&(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(n.start)||r.start.isEqual(n.start)?c.unshift(u):c.push(u):c.splice(1,0,u)),0===c.length?[new bd(e.baseVersion)]:Rd(c,i)})),vd(dd,hd,((e,t,o)=>{let n=e.targetPosition.clone();e.targetPosition.isEqual(t.insertionPosition)&&t.graveyardPosition&&"moveTargetAfter"!=o.abRelation||(n=e.targetPosition._getTransformedBySplitOperation(t));const r=zl._createFromPositionAndShift(e.sourcePosition,e.howMany);if(r.end.isEqual(t.insertionPosition))return t.graveyardPosition||e.howMany++,e.targetPosition=n,[e];if(r.start.hasSameParentAs(t.splitPosition)&&r.containsPosition(t.splitPosition)){let e=new zl(t.splitPosition,r.end);e=e._getTransformedBySplitOperation(t);return Rd([new zl(r.start,t.splitPosition),e],n)}e.targetPosition.isEqual(t.splitPosition)&&"insertAtSource"==o.abRelation&&(n=t.moveTargetPosition),e.targetPosition.isEqual(t.insertionPosition)&&"insertBetween"==o.abRelation&&(n=e.targetPosition);const i=[r._getTransformedBySplitOperation(t)];if(t.graveyardPosition){const n=r.start.isEqual(t.graveyardPosition)||r.containsPosition(t.graveyardPosition);e.howMany>1&&n&&!o.aWasUndone&&i.push(zl._createFromPositionAndShift(t.insertionPosition,1))}return Rd(i,n)})),vd(dd,pd,((e,t,o)=>{const n=zl._createFromPositionAndShift(e.sourcePosition,e.howMany);if(t.deletionPosition.hasSameParentAs(e.sourcePosition)&&n.containsPosition(t.sourcePosition))if("remove"!=e.type||o.forceWeakRemove){if(1==e.howMany)return o.bWasUndone?(e.sourcePosition=t.graveyardPosition.clone(),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]):[new bd(0)]}else if(!o.aWasUndone){const o=[];let n=t.graveyardPosition.clone(),r=t.targetPosition._getTransformedByMergeOperation(t);e.howMany>1&&(o.push(new dd(e.sourcePosition,e.howMany-1,e.targetPosition,0)),n=n._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany-1),r=r._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany-1));const i=t.deletionPosition._getCombined(e.sourcePosition,e.targetPosition),s=new dd(n,1,i,0),a=s.getMovedRangeStart().path.slice();a.push(0);const l=new Sl(s.targetPosition.root,a);r=r._getTransformedByMove(n,i,1);const c=new dd(r,t.howMany,l,0);return o.push(s),o.push(c),o}const r=zl._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]})),vd(kd,ud,((e,t)=>(e.position=e.position._getTransformedByInsertOperation(t),[e]))),vd(kd,pd,((e,t)=>e.position.isEqual(t.deletionPosition)?(e.position=t.graveyardPosition.clone(),e.position.stickiness="toNext",[e]):(e.position=e.position._getTransformedByMergeOperation(t),[e]))),vd(kd,dd,((e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e]))),vd(kd,kd,((e,t,o)=>{if(e.position.isEqual(t.position)){if(!o.aIsStrong)return[new bd(0)];e.oldName=t.newName}return[e]})),vd(kd,hd,((e,t)=>{if("same"==J(e.position.path,t.splitPosition.getParentPath())&&!t.graveyardPosition){const t=new kd(e.position.getShiftedBy(1),e.oldName,e.newName,0);return[e,t]}return e.position=e.position._getTransformedBySplitOperation(t),[e]})),vd(wd,wd,((e,t,o)=>{if(e.root===t.root&&e.key===t.key){if(!o.aIsStrong||e.newValue===t.newValue)return[new bd(0)];e.oldValue=t.newValue}return[e]})),vd(_d,_d,((e,t,o)=>e.rootName!==t.rootName||e.isAdd!==t.isAdd||o.bWasUndone?[e]:[new bd(0)])),vd(hd,ud,((e,t)=>(e.splitPosition.hasSameParentAs(t.position)&&e.splitPosition.offset{if(!e.graveyardPosition&&!o.bWasUndone&&e.splitPosition.hasSameParentAs(t.sourcePosition)){const o=t.graveyardPosition.path.slice();o.push(0);const n=new Sl(t.graveyardPosition.root,o),r=hd.getInsertionPosition(new Sl(t.graveyardPosition.root,o)),i=new hd(n,0,r,null,0);return e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=hd.getInsertionPosition(e.splitPosition),e.graveyardPosition=i.insertionPosition.clone(),e.graveyardPosition.stickiness="toNext",[i,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=hd.getInsertionPosition(e.splitPosition),e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]})),vd(hd,dd,((e,t,o)=>{const n=zl._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.graveyardPosition){const r=n.start.isEqual(e.graveyardPosition)||n.containsPosition(e.graveyardPosition);if(!o.bWasUndone&&r){const o=e.splitPosition._getTransformedByMoveOperation(t),n=e.graveyardPosition._getTransformedByMoveOperation(t),r=n.path.slice();r.push(0);const i=new Sl(n.root,r);return[new dd(o,e.howMany,i,0)]}e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)}const r=e.splitPosition.isEqual(t.targetPosition);if(r&&("insertAtSource"==o.baRelation||"splitBefore"==o.abRelation))return e.howMany+=t.howMany,e.splitPosition=e.splitPosition._getTransformedByDeletion(t.sourcePosition,t.howMany),e.insertionPosition=hd.getInsertionPosition(e.splitPosition),[e];if(r&&o.abRelation&&o.abRelation.howMany){const{howMany:t,offset:n}=o.abRelation;return e.howMany+=t,e.splitPosition=e.splitPosition.getShiftedBy(n),[e]}if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&n.containsPosition(e.splitPosition)){const o=t.howMany-(e.splitPosition.offset-t.sourcePosition.offset);return e.howMany-=o,e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset{if(e.splitPosition.isEqual(t.splitPosition)){if(!e.graveyardPosition&&!t.graveyardPosition)return[new bd(0)];if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition))return[new bd(0)];if("splitBefore"==o.abRelation)return e.howMany=0,e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t),[e]}if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition)){const n="$graveyard"==e.splitPosition.root.rootName,r="$graveyard"==t.splitPosition.root.rootName;if(r&&!n||!(n&&!r)&&o.aIsStrong){const o=[];return t.howMany&&o.push(new dd(t.moveTargetPosition,t.howMany,t.splitPosition,0)),e.howMany&&o.push(new dd(e.splitPosition,e.howMany,e.moveTargetPosition,0)),o}return[new bd(0)]}if(e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t)),e.splitPosition.isEqual(t.insertionPosition)&&"splitBefore"==o.abRelation)return e.howMany++,[e];if(t.splitPosition.isEqual(e.insertionPosition)&&"splitBefore"==o.baRelation){const o=t.insertionPosition.path.slice();o.push(0);const n=new Sl(t.insertionPosition.root,o);return[e,new dd(e.insertionPosition,1,n,0)]}return e.splitPosition.hasSameParentAs(t.splitPosition)&&e.splitPosition.offset{const o=t[0];o.isDocumentOperation&&Nd.call(this,o)}),{priority:"low"})}function Nd(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)}}zd.prototype.is=function(e){return"livePosition"===e||"model:livePosition"===e||"position"==e||"model:position"===e};class Fd{constructor(e={}){"string"==typeof e&&(e="transparent"===e?{isUndoable:!1}:{},b("batch-constructor-deprecated-string-type"));const{isUndoable:t=!0,isLocal:o=!0,isUndo:n=!1,isTyping:r=!1}=e;this.operations=[],this.isUndoable=t,this.isLocal=o,this.isUndo=n,this.isTyping=r}get type(){return b("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.batch=this,this.operations.push(e),e}}class Od{constructor(e){this._changesInElement=new Map,this._elementSnapshots=new Map,this._changedMarkers=new Map,this._changedRoots=new Map,this._changeCount=0,this._cachedChanges=null,this._cachedChangesWithGraveyard=null,this._refreshedItems=new Set,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),o=this._isInInsertedElement(t.targetPosition.parent);e||this._markRemove(t.sourcePosition.parent,t.sourcePosition.offset,t.howMany),o||this._markInsert(t.targetPosition.parent,t.getMovedRangeStart().offset,t.howMany);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=zl._createFromPositionAndShift(t.position,1);for(const t of this._markerCollection.getMarkersIntersectingRange(e)){const e=t.getData();this.bufferMarkerChange(t.name,e,e)}break}case"split":{const e=t.splitPosition.parent;this._isInInsertedElement(e)||this._markRemove(e,t.splitPosition.offset,t.howMany),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);break}case"merge":{const e=t.sourcePosition.parent;this._isInInsertedElement(e.parent)||this._markRemove(e.parent,e.startOffset,1);const o=t.graveyardPosition.parent;this._markInsert(o,t.graveyardPosition.offset,1);const n=t.targetPosition.parent;this._isInInsertedElement(n)||this._markInsert(n,t.targetPosition.offset,e.maxOffset);break}case"detachRoot":case"addRoot":this._bufferRootStateChange(t.rootName,t.isAdd);break;case"addRootAttribute":case"removeRootAttribute":case"changeRootAttribute":{const e=t.root.rootName;this._bufferRootAttributeChange(e,t.key,t.oldValue,t.newValue);break}}this._cachedChanges=null}bufferMarkerChange(e,t,o){const n=this._changedMarkers.get(e);n?(n.newMarkerData=o,null==n.oldMarkerData.range&&null==o.range&&this._changedMarkers.delete(e)):this._changedMarkers.set(e,{newMarkerData:o,oldMarkerData:t})}getMarkersToRemove(){const e=[];for(const[t,o]of this._changedMarkers)null!=o.oldMarkerData.range&&e.push({name:t,range:o.oldMarkerData.range});return e}getMarkersToAdd(){const e=[];for(const[t,o]of this._changedMarkers)null!=o.newMarkerData.range&&e.push({name:t,range:o.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._changesInElement.size>0)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 o=e.range&&!t.range,n=!e.range&&t.range,r=e.range&&t.range&&!e.range.isEqual(t.range);if(o||n||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 o=this._changesInElement.get(e).sort(((e,t)=>e.offset===t.offset?e.type!=t.type?"remove"==e.type?-1:1:0:e.offsete.position.root!=t.position.root?e.position.root.rootNamee));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(jd),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._elementSnapshots.clear(),this._changedMarkers.clear(),this._changedRoots.clear(),this._refreshedItems=new Set,this._cachedChanges=null}_bufferRootStateChange(e,t){if(!this._changedRoots.has(e))return void this._changedRoots.set(e,{name:e,state:t?"attached":"detached"});const o=this._changedRoots.get(e);void 0!==o.state?(delete o.state,void 0===o.attributes&&this._changedRoots.delete(e)):o.state=t?"attached":"detached"}_bufferRootAttributeChange(e,t,o,n){const r=this._changedRoots.get(e)||{name:e},i=r.attributes||{};if(i[t]){const e=i[t];n===e.oldValue?delete i[t]:e.newValue=n}else i[t]={oldValue:o,newValue:n};0===Object.entries(i).length?(delete r.attributes,void 0===r.state&&this._changedRoots.delete(e)):(r.attributes=i,this._changedRoots.set(e,r))}_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);const t=zl._createOn(e);for(const e of this._markerCollection.getMarkersIntersectingRange(t)){const t=e.getData();this.bufferMarkerChange(e.name,t,t)}this._cachedChanges=null}_markInsert(e,t,o){const n={type:"insert",offset:t,howMany:o,count:this._changeCount++};this._markChange(e,n)}_markRemove(e,t,o){const n={type:"remove",offset:t,howMany:o,count:this._changeCount++};this._markChange(e,n),this._removeAllNestedChanges(e,t,o)}_markAttribute(e){const t={type:"attribute",offset:e.startOffset,howMany:e.offsetSize,count:this._changeCount++};this._markChange(e.parent,t)}_markChange(e,t){this._makeSnapshot(e);const o=this._getChangesForElement(e);this._handleChange(t,o),o.push(t);for(let e=0;eo.offset){if(n>r){const e={type:"attribute",offset:r,howMany:n-r,count:this._changeCount++};this._handleChange(e,t),t.push(e)}e.nodesToHandle=o.offset-e.offset,e.howMany=e.nodesToHandle}else e.offset>=o.offset&&e.offsetr?(e.nodesToHandle=n-r,e.offset=r):e.nodesToHandle=0);if("remove"==o.type&&e.offseto.offset){const r={type:"attribute",offset:o.offset,howMany:n-o.offset,count:this._changeCount++};this._handleChange(r,t),t.push(r),e.nodesToHandle=o.offset-e.offset,e.howMany=e.nodesToHandle}"attribute"==o.type&&(e.offset>=o.offset&&n<=r?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=o.offset&&n>=r&&(o.howMany=0))}}e.howMany=e.nodesToHandle,delete e.nodesToHandle}_getInsertDiff(e,t,o){return{type:"insert",position:Sl._createAt(e,t),name:o.name,attributes:new Map(o.attributes),length:1,changeCount:this._changeCount++}}_getRemoveDiff(e,t,o){return{type:"remove",position:Sl._createAt(e,t),name:o.name,attributes:new Map(o.attributes),length:1,changeCount:this._changeCount++}}_getAttributesDiff(e,t,o){const n=[];o=new Map(o);for(const[r,i]of t){const t=o.has(r)?o.get(r):null;t!==i&&n.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:r,attributeOldValue:i,attributeNewValue:t,changeCount:this._changeCount++}),o.delete(r)}for(const[t,r]of o)n.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:t,attributeOldValue:null,attributeNewValue:r,changeCount:this._changeCount++});return n}_isInInsertedElement(e){const t=e.parent;if(!t)return!1;const o=this._changesInElement.get(t),n=e.startOffset;if(o)for(const e of o)if("insert"==e.type&&n>=e.offset&&nn){for(let t=0;tthis._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 f("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 o=this._operations[0];void 0===e&&(e=o.baseVersion);let n=t-1;for(const[t,o]of this._gaps)e>t&&et&&nthis.lastOperation.baseVersion)return[];let r=this._baseVersionToOperationIndex.get(e);void 0===r&&(r=0);let i=this._baseVersionToOperationIndex.get(n);return void 0===i&&(i=this._operations.length-1),this._operations.slice(r,i+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 Hd extends xl{constructor(e,t,o="main"){super(t),this._isAttached=!0,this._document=e,this.rootName=o}get document(){return this._document}isAttached(){return this._isAttached}toJSON(){return this.rootName}}Hd.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 Wd="$graveyard";class $d extends(S()){constructor(e){super(),this.model=e,this.history=new qd,this.selection=new Yl(this),this.roots=new _r({idProperty:"rootName"}),this.differ=new Od(e.markers),this.isReadOnly=!1,this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=!1,this.createRoot("$root",Wd),this.listenTo(e,"applyOperation",((e,t)=>{const o=t[0];o.isDocumentOperation&&this.differ.bufferOperation(o)}),{priority:"high"}),this.listenTo(e,"applyOperation",((e,t)=>{const o=t[0];o.isDocumentOperation&&this.history.addOperation(o)}),{priority:"low"}),this.listenTo(this.selection,"change",(()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0})),this.listenTo(e.markers,"update",((e,t,o,n,r)=>{const i={...t.getData(),range:n};this.differ.bufferMarkerChange(t.name,r,i),null===o&&t.on("change",((e,o)=>{const n=t.getData();this.differ.bufferMarkerChange(t.name,{...n,range:o},n)}))})),this.registerPostFixer((e=>{let t=!1;for(const o of this.roots)o.isAttached()||o.isEmpty||(e.remove(e.createRangeIn(o)),t=!0);for(const o of this.model.markers)o.getRange().root.isAttached()||(e.removeMarker(o),t=!0);return t}))}get version(){return this.history.version}set version(e){this.history.version=e}get graveyard(){return this.getRoot(Wd)}createRoot(e="$root",t="main"){if(this.roots.get(t))throw new f("model-document-createroot-name-exists",this,{name:t});const o=new Hd(this,e,t);return this.roots.add(o),o}destroy(){this.selection.destroy(),this.stopListening()}getRoot(e="main"){return this.roots.get(e)}getRootNames(e=!1){return Array.from(this.roots).filter((t=>t.rootName!=Wd&&(e||t.isAttached()))).map((e=>e.rootName))}registerPostFixer(e){this._postFixers.add(e)}toJSON(){const e=oi(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(){for(const e of this.roots)if(e!==this.graveyard)return e;return this.graveyard}_getDefaultRange(){const e=this._getDefaultRoot(),t=this.model,o=t.schema,n=t.createPositionFromPath(e,[0]);return o.getNearestSelectionRange(n)||t.createRange(n)}_validateSelectionRange(e){return Ud(e.start)&&Ud(e.end)}_callPostFixers(e){let t=!1;do{for(const o of this._postFixers)if(this.selection.refresh(),t=o(e),t)break}while(t)}}function Ud(e){const t=e.textNode;if(t){const o=t.data,n=e.offset-t.startOffset;return!Er(o,n)&&!Dr(o,n)}return!0}class Gd extends(S()){constructor(){super(...arguments),this._markers=new Map}[Symbol.iterator](){return this._markers.values()}has(e){const t=e instanceof Kd?e.name:e;return this._markers.has(t)}get(e){return this._markers.get(e)||null}_set(e,t,o=!1,n=!1){const r=e instanceof Kd?e.name:e;if(r.includes(","))throw new f("markercollection-incorrect-marker-name",this);const i=this._markers.get(r);if(i){const e=i.getData(),s=i.getRange();let a=!1;return s.isEqual(t)||(i._attachLiveRange(Kl.fromRange(t)),a=!0),o!=i.managedUsingOperations&&(i._managedUsingOperations=o,a=!0),"boolean"==typeof n&&n!=i.affectsData&&(i._affectsData=n,a=!0),a&&this.fire(`update:${r}`,i,s,t,e),i}const s=Kl.fromRange(t),a=new Kd(r,s,o,n);return this._markers.set(r,a),this.fire(`update:${r}`,a,null,t,{...a.getData(),range:null}),a}_remove(e){const t=e instanceof Kd?e.name:e,o=this._markers.get(t);return!!o&&(this._markers.delete(t),this.fire(`update:${t}`,o,o.getRange(),null,o.getData()),this._destroyMarker(o),!0)}_refresh(e){const t=e instanceof Kd?e.name:e,o=this._markers.get(t);if(!o)throw new f("markercollection-refresh-marker-not-exists",this);const n=o.getRange();this.fire(`update:${t}`,o,n,n,o.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 Kd extends(S(_l)){constructor(e,t,o,n){super(),this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=o,this._affectsData=n}get managedUsingOperations(){if(!this._liveRange)throw new f("marker-destroyed",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new f("marker-destroyed",this);return this._affectsData}getData(){return{range:this.getRange(),affectsData:this.affectsData,managedUsingOperations:this.managedUsingOperations}}getStart(){if(!this._liveRange)throw new f("marker-destroyed",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new f("marker-destroyed",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new f("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}}Kd.prototype.is=function(e){return"marker"===e||"model:marker"===e};class Zd extends od{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 f("detach-operation-on-document-node",this)}_execute(){rd(zl._createFromPositionAndShift(this.sourcePosition,this.howMany))}static get className(){return"DetachOperation"}}class Jd extends _l{constructor(e){super(),this.markers=new Map,this._children=new Al,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)}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 o of e)t=t.getChild(t.offsetToIndex(o));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 o of e)o.name?t.push(xl.fromJSON(o)):t.push(Cl.fromJSON(o));return new Jd(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const o=function(e){if("string"==typeof e)return[new Cl(e)];Q(e)||(e=[e]);return Array.from(e).map((e=>"string"==typeof e?new Cl(e):e instanceof vl?new Cl(e.data,e.getAttributes()):e))}(t);for(const e of o)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,o)}_removeChildren(e,t=1){const o=this._children._removeNodes(e,t);for(const e of o)e.parent=null;return o}}Jd.prototype.is=function(e){return"documentFragment"===e||"model:documentFragment"===e};class Qd{constructor(e,t){this.model=e,this.batch=t}createText(e,t){return new Cl(e,t)}createElement(e,t){return new xl(e,t)}createDocumentFragment(){return new Jd}cloneElement(e,t=!0){return e._clone(t)}insert(e,t,o=0){if(this._assertWriterUsedCorrectly(),e instanceof Cl&&""==e.data)return;const n=Sl._createAt(t,o);if(e.parent){if(ou(e.root,n.root))return void this.move(zl._createOn(e),n);if(e.root.document)throw new f("model-writer-insert-forbidden-move",this);this.remove(e)}const r=n.root.document?n.root.document.version:null,i=new ud(n,e,r);if(e instanceof Cl&&(i.shouldReceiveAttributes=!0),this.batch.addOperation(i),this.model.applyOperation(i),e instanceof Jd)for(const[t,o]of e.markers){const e=Sl._createAt(o.root,0),r={range:new zl(o.start._getCombined(e,n),o.end._getCombined(e,n)),usingOperation:!0,affectsData:!0};this.model.markers.has(t)?this.updateMarker(t,r):this.addMarker(t,r)}}insertText(e,t,o,n){t instanceof Jd||t instanceof xl||t instanceof Sl?this.insert(this.createText(e),t,o):this.insert(this.createText(e,t),o,n)}insertElement(e,t,o,n){t instanceof Jd||t instanceof xl||t instanceof Sl?this.insert(this.createElement(e),t,o):this.insert(this.createElement(e,t),o,n)}append(e,t){this.insert(e,t,"end")}appendText(e,t,o){t instanceof Jd||t instanceof xl?this.insert(this.createText(e),t,"end"):this.insert(this.createText(e,t),o,"end")}appendElement(e,t,o){t instanceof Jd||t instanceof xl?this.insert(this.createElement(e),t,"end"):this.insert(this.createElement(e,t),o,"end")}setAttribute(e,t,o){if(this._assertWriterUsedCorrectly(),o instanceof zl){const n=o.getMinimalFlatRanges();for(const o of n)Yd(this,e,t,o)}else Xd(this,e,t,o)}setAttributes(e,t){for(const[o,n]of vr(e))this.setAttribute(o,n,t)}removeAttribute(e,t){if(this._assertWriterUsedCorrectly(),t instanceof zl){const o=t.getMinimalFlatRanges();for(const t of o)Yd(this,e,null,t)}else Xd(this,e,null,t)}clearAttributes(e){this._assertWriterUsedCorrectly();const t=e=>{for(const t of e.getAttributeKeys())this.removeAttribute(t,e)};if(e instanceof zl)for(const o of e.getItems())t(o);else t(e)}move(e,t,o){if(this._assertWriterUsedCorrectly(),!(e instanceof zl))throw new f("writer-move-invalid-range",this);if(!e.isFlat)throw new f("writer-move-range-not-flat",this);const n=Sl._createAt(t,o);if(n.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!ou(e.root,n.root))throw new f("writer-move-different-document",this);const r=e.root.document?e.root.document.version:null,i=new dd(e.start,e.end.offset-e.start.offset,n,r);this.batch.addOperation(i),this.model.applyOperation(i)}remove(e){this._assertWriterUsedCorrectly();const t=(e instanceof zl?e:zl._createOn(e)).getMinimalFlatRanges().reverse();for(const e of t)this._addOperationForAffectedMarkers("move",e),tu(e.start,e.end.offset-e.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();const t=e.nodeBefore,o=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(t instanceof xl))throw new f("writer-merge-no-element-before",this);if(!(o instanceof xl))throw new f("writer-merge-no-element-after",this);e.root.document?this._merge(e):this._mergeDetached(e)}createPositionFromPath(e,t,o){return this.model.createPositionFromPath(e,t,o)}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,o=e.nodeAfter;this.move(zl._createIn(o),Sl._createAt(t,"end")),this.remove(o)}_merge(e){const t=Sl._createAt(e.nodeBefore,"end"),o=Sl._createAt(e.nodeAfter,0),n=e.root.document.graveyard,r=new Sl(n,[0]),i=e.root.document.version,s=new pd(o,e.nodeAfter.maxOffset,t,r,i);this.batch.addOperation(s),this.model.applyOperation(s)}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof xl))throw new f("writer-rename-not-element-instance",this);const o=e.root.document?e.root.document.version:null,n=new kd(Sl._createBefore(e),e.name,t,o);this.batch.addOperation(n),this.model.applyOperation(n)}split(e,t){this._assertWriterUsedCorrectly();let o,n,r=e.parent;if(!r.parent)throw new f("writer-split-element-no-parent",this);if(t||(t=r.parent),!e.parent.getAncestors({includeSelf:!0}).includes(t))throw new f("writer-split-invalid-limit-element",this);do{const t=r.root.document?r.root.document.version:null,i=r.maxOffset-e.offset,s=hd.getInsertionPosition(e),a=new hd(e,i,s,null,t);this.batch.addOperation(a),this.model.applyOperation(a),o||n||(o=r,n=e.parent.nextSibling),r=(e=this.createPositionAfter(e.parent)).parent}while(r!==t);return{position:e,range:new zl(Sl._createAt(o,"end"),Sl._createAt(n,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new f("writer-wrap-range-not-flat",this);const o=t instanceof xl?t:new xl(t);if(o.childCount>0)throw new f("writer-wrap-element-not-empty",this);if(null!==o.parent)throw new f("writer-wrap-element-attached",this);this.insert(o,e.start);const n=new zl(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(n,Sl._createAt(o,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),null===e.parent)throw new f("writer-unwrap-element-no-parent",this);this.move(zl._createIn(e),this.createPositionAfter(e)),this.remove(e)}addMarker(e,t){if(this._assertWriterUsedCorrectly(),!t||"boolean"!=typeof t.usingOperation)throw new f("writer-addmarker-no-usingoperation",this);const o=t.usingOperation,n=t.range,r=void 0!==t.affectsData&&t.affectsData;if(this.model.markers.has(e))throw new f("writer-addmarker-marker-exists",this);if(!n)throw new f("writer-addmarker-no-range",this);return o?(eu(this,e,null,n,r),this.model.markers.get(e)):this.model.markers._set(e,n,o,r)}updateMarker(e,t){this._assertWriterUsedCorrectly();const o="string"==typeof e?e:e.name,n=this.model.markers.get(o);if(!n)throw new f("writer-updatemarker-marker-not-exists",this);if(!t)return b("writer-updatemarker-reconvert-using-editingcontroller",{markerName:o}),void this.model.markers._refresh(n);const r="boolean"==typeof t.usingOperation,i="boolean"==typeof t.affectsData,s=i?t.affectsData:n.affectsData;if(!r&&!t.range&&!i)throw new f("writer-updatemarker-wrong-options",this);const a=n.getRange(),l=t.range?t.range:a;r&&t.usingOperation!==n.managedUsingOperations?t.usingOperation?eu(this,o,null,l,s):(eu(this,o,a,null,s),this.model.markers._set(o,l,void 0,s)):n.managedUsingOperations?eu(this,o,a,l,s):this.model.markers._set(o,l,void 0,s)}removeMarker(e){this._assertWriterUsedCorrectly();const t="string"==typeof e?e:e.name;if(!this.model.markers.has(t))throw new f("writer-removemarker-no-marker",this);const o=this.model.markers.get(t);if(!o.managedUsingOperations)return void this.model.markers._remove(t);eu(this,t,o.getRange(),null,o.affectsData)}addRoot(e,t="$root"){this._assertWriterUsedCorrectly();const o=this.model.document.getRoot(e);if(o&&o.isAttached())throw new f("writer-addroot-root-exists",this);const n=this.model.document,r=new _d(e,t,!0,n,n.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 f("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 o=this.model.document,n=new _d(t.rootName,t.name,!1,o,o.version);this.batch.addOperation(n),this.model.applyOperation(n)}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,o]of vr(e))this._setSelectionAttribute(t,o)}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 o=this.model.document.selection;if(o.isCollapsed&&o.anchor.parent.isEmpty){const n=Yl._getStoreAttributeKey(e);this.setAttribute(n,t,o.anchor.parent)}o._setAttribute(e,t)}_removeSelectionAttribute(e){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const o=Yl._getStoreAttributeKey(e);this.removeAttribute(o,t.anchor.parent)}t._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new f("writer-incorrect-use",this)}_addOperationForAffectedMarkers(e,t){for(const o of this.model.markers){if(!o.managedUsingOperations)continue;const n=o.getRange();let r=!1;if("move"===e){const e=t;r=e.containsPosition(n.start)||e.start.isEqual(n.start)||e.containsPosition(n.end)||e.end.isEqual(n.end)}else{const e=t,o=e.nodeBefore,i=e.nodeAfter,s=n.start.parent==o&&n.start.isAtEnd,a=n.end.parent==i&&0==n.end.offset,l=n.end.nodeAfter==i,c=n.start.nodeAfter==i;r=s||a||l||c}r&&this.updateMarker(o.name,{range:n})}}}function Yd(e,t,o,n){const r=e.model,i=r.document;let s,a,l,c=n.start;for(const e of n.getWalker({shallow:!0}))l=e.item.getAttribute(t),s&&a!=l&&(a!=o&&d(),c=s),s=e.nextPosition,a=l;function d(){const n=new zl(c,s),l=n.root.document?i.version:null,d=new fd(n,t,a,o,l);e.batch.addOperation(d),r.applyOperation(d)}s instanceof Sl&&s!=c&&a!=o&&d()}function Xd(e,t,o,n){const r=e.model,i=r.document,s=n.getAttribute(t);let a,l;if(s!=o){if(n.root===n){const e=n.document?i.version:null;l=new wd(n,t,s,o,e)}else{a=new zl(Sl._createBefore(n),e.createPositionAfter(n));const r=a.root.document?i.version:null;l=new fd(a,t,s,o,r)}e.batch.addOperation(l),r.applyOperation(l)}}function eu(e,t,o,n,r){const i=e.model,s=i.document,a=new gd(t,o,n,i.markers,!!r,s.version);e.batch.addOperation(a),i.applyOperation(a)}function tu(e,t,o,n){let r;if(e.root.document){const o=n.document,i=new Sl(o.graveyard,[0]);r=new dd(e,t,i,o.version)}else r=new Zd(e,t);o.addOperation(r),n.applyOperation(r)}function ou(e,t){return e===t||e instanceof Hd&&t instanceof Hd}function nu(e,t,o={}){if(t.isCollapsed)return;const n=t.getFirstRange();if("$graveyard"==n.root.rootName)return;const r=e.schema;e.change((e=>{if(!o.doNotResetEntireContent&&function(e,t){const o=e.getLimitElement(t);if(!t.containsEntireContent(o))return!1;const n=t.getFirstRange();if(n.start.parent==n.end.parent)return!1;return e.checkChild(o,"paragraph")}(r,t))return void function(e,t){const o=e.model.schema.getLimitElement(t);e.remove(e.createRangeIn(o)),au(e,e.createPositionAt(o,0),t)}(e,t);const i={};if(!o.doNotAutoparagraph){const e=t.getSelectedElement();e&&Object.assign(i,r.getAttributesWithProperty(e,"copyOnReplace",!0))}const[s,a]=function(e){const t=e.root.document.model,o=e.start;let n=e.end;if(t.hasContent(e,{ignoreMarkers:!0})){const o=function(e){const t=e.parent,o=t.root.document.model.schema,n=t.getAncestors({parentFirst:!0,includeSelf:!0});for(const e of n){if(o.isLimit(e))return null;if(o.isBlock(e))return e}}(n);if(o&&n.isTouching(t.createPositionAt(o,0))){const o=t.createSelection(e);t.modifySelection(o,{direction:"backward"});const r=o.getLastPosition(),i=t.createRange(r,n);t.hasContent(i,{ignoreMarkers:!0})||(n=r)}}return[zd.fromPosition(o,"toPrevious"),zd.fromPosition(n,"toNext")]}(n);s.isTouching(a)||e.remove(e.createRange(s,a)),o.leaveUnmerged||(!function(e,t,o){const n=e.model;if(!su(e.model.schema,t,o))return;const[r,i]=function(e,t){const o=e.getAncestors(),n=t.getAncestors();let r=0;for(;o[r]&&o[r]==n[r];)r++;return[o[r],n[r]]}(t,o);if(!r||!i)return;!n.hasContent(r,{ignoreMarkers:!0})&&n.hasContent(i,{ignoreMarkers:!0})?iu(e,t,o,r.parent):ru(e,t,o,r.parent)}(e,s,a),r.removeDisallowedAttributes(s.parent.getChildren(),e)),lu(e,t,s),!o.doNotAutoparagraph&&function(e,t){const o=e.checkChild(t,"$text"),n=e.checkChild(t,"paragraph");return!o&&n}(r,s)&&au(e,s,t,i),s.detach(),a.detach()}))}function ru(e,t,o,n){const r=t.parent,i=o.parent;if(r!=n&&i!=n){for(t=e.createPositionAfter(r),(o=e.createPositionBefore(i)).isEqual(t)||e.insert(i,t),e.merge(t);o.parent.isEmpty;){const t=o.parent;o=e.createPositionBefore(t),e.remove(t)}su(e.model.schema,t,o)&&ru(e,t,o,n)}}function iu(e,t,o,n){const r=t.parent,i=o.parent;if(r!=n&&i!=n){for(t=e.createPositionAfter(r),(o=e.createPositionBefore(i)).isEqual(t)||e.insert(r,o);t.parent.isEmpty;){const o=t.parent;t=e.createPositionBefore(o),e.remove(o)}o=e.createPositionBefore(i),function(e,t){const o=t.nodeBefore,n=t.nodeAfter;o.name!=n.name&&e.rename(o,n.name);e.clearAttributes(o),e.setAttributes(Object.fromEntries(n.getAttributes()),o),e.merge(t)}(e,o),su(e.model.schema,t,o)&&iu(e,t,o,n)}}function su(e,t,o){const n=t.parent,r=o.parent;return n!=r&&(!e.isLimit(n)&&!e.isLimit(r)&&function(e,t,o){const n=new zl(e,t);for(const e of n.getWalker())if(o.isLimit(e.item))return!1;return!0}(t,o,e))}function au(e,t,o,n={}){const r=e.createElement("paragraph");e.model.schema.setAllowedAttributes(r,n,e),e.insert(r,t),lu(e,o,e.createPositionAt(r,0))}function lu(e,t,o){t instanceof Yl?e.setSelection(o):t.setTo(o)}function cu(e,t){const o=[];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=>{o.push(e.start.parent),t.remove(e)})),o.forEach((e=>{let o=e;for(;o.parent&&o.isEmpty;){const e=t.createRangeOn(o);o=o.parent,t.remove(e)}}))}class du{constructor(e,t,o){this._firstNode=null,this._lastNode=null,this._lastAutoParagraph=null,this._filterAttributesOf=[],this._affectedStart=null,this._affectedEnd=null,this._nodeToSelect=null,this.model=e,this.writer=t,this.position=o,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),o=this.writer.createPositionAfter(e);if(o.isAfter(t)){if(this._lastNode=e,this.position.parent!=e||!this.position.isAtEnd)throw new f("insertcontent-invalid-insertion-position",this);this.position=o,this._setAffectedBoundaries(this.position)}}getSelectionRange(){return this._nodeToSelect?zl._createOn(this._nodeToSelect):this.model.schema.getNearestSelectionRange(this.position)}getAffectedRange(){return this._affectedStart?new zl(this._affectedStart,this._affectedEnd):null}destroy(){this._affectedStart&&this._affectedStart.detach(),this._affectedEnd&&this._affectedEnd.detach()}_handleNode(e){if(this.schema.isObject(e))return void this._handleObject(e);let t=this._checkAndAutoParagraphToAllowedPosition(e);t||(t=this._checkAndSplitToAllowedPosition(e),t)?(this._appendToFragment(e),this._firstNode||(this._firstNode=e),this._lastNode=e):this._handleDisallowedNode(e)}_insertPartialFragment(){if(this._documentFragment.isEmpty)return;const e=zd.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()}_handleObject(e){this._checkAndSplitToAllowedPosition(e)?this._appendToFragment(e):this._tryAutoparagraphing(e)}_handleDisallowedNode(e){e.is("element")?this.handleNodes(e.getChildren()):this._tryAutoparagraphing(e)}_appendToFragment(e){if(!this.schema.checkChild(this.position,e))throw new f("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=zd.fromPosition(e,"toPrevious")),this._affectedEnd&&!this._affectedEnd.isBefore(e)||(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=zd.fromPosition(e,"toNext"))}_mergeOnLeft(){const e=this._firstNode;if(!(e instanceof xl))return;if(!this._canMergeLeft(e))return;const t=zd._createBefore(e);t.stickiness="toNext";const o=zd.fromPosition(this.position,"toNext");this._affectedStart.isEqual(t)&&(this._affectedStart.detach(),this._affectedStart=zd._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=zd._createAt(t.nodeBefore,"end","toNext")),this.position=o.toPosition(),o.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_mergeOnRight(){const e=this._lastNode;if(!(e instanceof xl))return;if(!this._canMergeRight(e))return;const t=zd._createAfter(e);if(t.stickiness="toNext",!this.position.isEqual(t))throw new f("insertcontent-invalid-insertion-position",this);this.position=Sl._createAt(t.nodeBefore,"end");const o=zd.fromPosition(this.position,"toPrevious");this._affectedEnd.isEqual(t)&&(this._affectedEnd.detach(),this._affectedEnd=zd._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=zd._createAt(t.nodeBefore,0,"toPrevious")),this.position=o.toPosition(),o.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_canMergeLeft(e){const t=e.previousSibling;return t instanceof xl&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(t,e)}_canMergeRight(e){const t=e.nextSibling;return t instanceof xl&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(e,t)}_tryAutoparagraphing(e){const t=this.writer.createElement("paragraph");this._getAllowedIn(this.position.parent,t)&&this.schema.checkChild(t,e)&&(t._appendChild(e),this._handleNode(t))}_checkAndAutoParagraphToAllowedPosition(e){if(this.schema.checkChild(this.position.parent,e))return!0;if(!this.schema.checkChild(this.position.parent,"paragraph")||!this.schema.checkChild("paragraph",e))return!1;this._insertPartialFragment();const t=this.writer.createElement("paragraph");return this.writer.insert(t,this.position),this._setAffectedBoundaries(this.position),this._lastAutoParagraph=t,this.position=this.writer.createPositionAt(t,0),!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!0}_getAllowedIn(e,t){return this.schema.checkChild(e,t)?e:this.schema.isLimit(e)?null:this._getAllowedIn(e.parent,t)}}function uu(e,t,o="auto"){const n=e.getSelectedElement();if(n&&t.schema.isObject(n)&&!t.schema.isInline(n))return"before"==o||"after"==o?t.createRange(t.createPositionAt(n,o)):t.createRangeOn(n);const r=yr(e.getSelectedBlocks());if(!r)return t.createRange(e.focus);if(r.isEmpty)return t.createRange(t.createPositionAt(r,0));const i=t.createPositionAfter(r);return e.focus.isTouching(i)?t.createRange(i):t.createRange(t.createPositionBefore(r))}function hu(e,t,o,n={}){if(!e.schema.isObject(t))throw new f("insertobject-element-not-an-object",e,{object:t});const r=o||e.document.selection;let i=r;n.findOptimalPosition&&e.schema.isBlock(t)&&(i=e.createSelection(uu(r,e,n.findOptimalPosition)));const s=yr(r.getSelectedBlocks()),a={};return s&&Object.assign(a,e.schema.getAttributesWithProperty(s,"copyOnReplace",!0)),e.change((o=>{i.isCollapsed||e.deleteContent(i,{doNotAutoparagraph:!0});let r=t;const s=i.anchor.parent;!e.schema.checkChild(s,t)&&e.schema.checkChild(s,"paragraph")&&e.schema.checkChild("paragraph",t)&&(r=o.createElement("paragraph"),o.insert(t,r)),e.schema.setAllowedAttributes(r,a,o);const l=e.insertContent(r,i);return l.isCollapsed||n.setSelection&&function(e,t,o,n){const r=e.model;if("on"==o)return void e.setSelection(t,"on");if("after"!=o)throw new f("insertobject-invalid-place-parameter-value",r);let i=t.nextSibling;if(r.schema.isInline(t))return void e.setSelection(t,"after");const s=i&&r.schema.checkChild(i,"$text");!s&&r.schema.checkChild(t.parent,"paragraph")&&(i=e.createElement("paragraph"),r.schema.setAllowedAttributes(i,n,e),r.insertContent(i,e.createPositionAfter(t)));i&&e.setSelection(i,0)}(o,t,n.setSelection,a),l}))}const pu=' ,.?!:;"-()';function gu(e,t){const{isForward:o,walker:n,unit:r,schema:i,treatEmojiAsSingleUnit:s}=e,{type:a,item:l,nextPosition:c}=t;if("text"==a)return"word"===e.unit?function(e,t){let o=e.position.textNode;o||(o=t?e.position.nodeAfter:e.position.nodeBefore);for(;o&&o.is("$text");){const n=e.position.offset-o.startOffset;if(bu(o,n,t))o=t?e.position.nodeAfter:e.position.nodeBefore;else{if(fu(o.data,n,t))break;e.next()}}return e.position}(n,o):function(e,t,o){const n=e.position.textNode;if(n){const r=n.data;let i=e.position.offset-n.startOffset;for(;Er(r,i)||"character"==t&&Dr(r,i)||o&&Tr(r,i);)e.next(),i=e.position.offset-n.startOffset}return e.position}(n,r,s);if(a==(o?"elementStart":"elementEnd")){if(i.isSelectable(l))return Sl._createAt(l,o?"after":"before");if(i.checkChild(c,"$text"))return c}else{if(i.isLimit(l))return void n.skip((()=>!0));if(i.checkChild(c,"$text"))return c}}function mu(e,t){const o=e.root,n=Sl._createAt(o,t?"end":0);return t?new zl(e,n):new zl(n,e)}function fu(e,t,o){const n=t+(o?0:-1);return pu.includes(e.charAt(n))}function bu(e,t,o){return t===(o?e.offsetSize:0)}class ku extends(H()){constructor(){super(),this.markers=new Gd,this.document=new $d(this),this.schema=new zc,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(((e,t)=>{if("$marker"===t.name)return!0})),Ec(this),this.document.registerPostFixer(fc),this.on("insertContent",((e,[t,o])=>{e.return=function(e,t,o){return e.change((n=>{const r=o||e.document.selection;r.isCollapsed||e.deleteContent(r,{doNotAutoparagraph:!0});const i=new du(e,n,r.anchor),s=[];let a;if(t.is("documentFragment")){if(t.markers.size){const e=[];for(const[o,n]of t.markers){const{start:t,end:r}=n,i=t.isEqual(r);e.push({position:t,name:o,isCollapsed:i},{position:r,name:o,isCollapsed:i})}e.sort((({position:e},{position:t})=>e.isBefore(t)?1:-1));for(const{position:o,name:r,isCollapsed:i}of e){let e=null,a=null;const l=o.parent===t&&o.isAtStart,c=o.parent===t&&o.isAtEnd;l||c?i&&(a=l?"start":"end"):(e=n.createElement("$marker"),n.insert(e,o)),s.push({name:r,element:e,collapsed:a})}}a=t.getChildren()}else a=[t];i.handleNodes(a);let l=i.getSelectionRange();if(t.is("documentFragment")&&s.length){const e=l?Kl.fromRange(l):null,t={};for(let e=s.length-1;e>=0;e--){const{name:o,element:r,collapsed:a}=s[e],l=!t[o];if(l&&(t[o]=[]),r){const e=n.createPositionAt(r,"before");t[o].push(e),n.remove(r)}else{const e=i.getAffectedRange();if(!e){a&&t[o].push(i.position);continue}a?t[o].push(e[a]):t[o].push(l?e.start:e.end)}}for(const[e,[o,r]]of Object.entries(t))o&&r&&o.root===r.root&&n.addMarker(e,{usingOperation:!0,affectsData:!0,range:new zl(o,r)});e&&(l=e.toRange(),e.detach())}l&&(r instanceof Yl?n.setSelection(l):r.setTo(l));const c=i.getAffectedRange()||e.createRange(r.anchor);return i.destroy(),c}))}(this,t,o)})),this.on("insertObject",((e,[t,o,n])=>{e.return=hu(this,t,o,n)})),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 Fd,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(e){f.rethrowUnexpectedError(e,this)}}enqueueChange(e,t){try{e?"function"==typeof e?(t=e,e=new Fd):e instanceof Fd||(e=new Fd(e)):e=new Fd,this._pendingChanges.push({batch:e,callback:t}),1==this._pendingChanges.length&&this._runPendingChanges()}catch(e){f.rethrowUnexpectedError(e,this)}}applyOperation(e){e._execute()}insertContent(e,t,o,...n){const r=wu(t,o);return this.fire("insertContent",[e,r,o,...n])}insertObject(e,t,o,n,...r){const i=wu(t,o);return this.fire("insertObject",[e,i,n,n,...r])}deleteContent(e,t){nu(this,e,t)}modifySelection(e,t){!function(e,t,o={}){const n=e.schema,r="backward"!=o.direction,i=o.unit?o.unit:"character",s=!!o.treatEmojiAsSingleUnit,a=t.focus,l=new El({boundaries:mu(a,r),singleCharacters:!0,direction:r?"forward":"backward"}),c={walker:l,schema:n,isForward:r,unit:i,treatEmojiAsSingleUnit:s};let d;for(;d=l.next();){if(d.done)return;const o=gu(c,d.value);if(o)return void(t instanceof Yl?e.change((e=>{e.setSelectionFocus(o)})):t.setFocus(o))}}(this,e,t)}getSelectedContent(e){return function(e,t){return e.change((e=>{const o=e.createDocumentFragment(),n=t.getFirstRange();if(!n||n.isCollapsed)return o;const r=n.start.root,i=n.start.getCommonPath(n.end),s=r.getNodeByPath(i);let a;a=n.start.parent==n.end.parent?n:e.createRange(e.createPositionAt(s,n.start.path[i.length]),e.createPositionAt(s,n.end.path[i.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(),o):e.append(e.cloneElement(t,!0),o);if(a!=n){const t=n._getTransformedByMove(a.start,e.createPositionAt(o,0),l)[0],r=e.createRange(e.createPositionAt(o,0),t.start);cu(e.createRange(t.end,e.createPositionAt(o,"end")),e),cu(r,e)}return o}))}(this,e)}hasContent(e,t={}){const o=e instanceof zl?e:zl._createIn(e);if(o.isCollapsed)return!1;const{ignoreWhitespaces:n=!1,ignoreMarkers:r=!1}=t;if(!r)for(const e of this.markers.getMarkersIntersectingRange(o))if(e.affectsData)return!0;for(const e of o.getItems())if(this.schema.isContent(e)){if(!e.is("$textProxy"))return!0;if(!n)return!0;if(-1!==e.data.search(/\S/))return!0}return!1}canEditAt(e){const t=wu(e);return this.fire("canEditAt",[t])}createPositionFromPath(e,t,o){return new Sl(e,t,o)}createPositionAt(e,t){return Sl._createAt(e,t)}createPositionAfter(e){return Sl._createAfter(e)}createPositionBefore(e){return Sl._createBefore(e)}createRange(e,t){return new zl(e,t)}createRangeIn(e){return zl._createIn(e)}createRangeOn(e){return zl._createOn(e)}createSelection(...e){return new jl(...e)}createBatch(e){return new Fd(e)}createOperationFromJSON(e){return Ad.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 Qd(this,t);const o=this._pendingChanges[0].callback(this._currentWriter);e.push(o),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 wu(e,t){if(e)return e instanceof jl||e instanceof Yl?e:e instanceof yl?t||0===t?new jl(e,t):e.is("rootElement")?new jl(e,"in"):new jl(e,"on"):new jl(e)}class _u extends Ea{constructor(){super(...arguments),this.domEventType="click"}onDomEvent(e){this.fire(e.type,e)}}class yu extends Ea{constructor(){super(...arguments),this.domEventType=["mousedown","mouseup","mouseover","mouseout"]}onDomEvent(e){this.fire(e.type,e)}}class Au{constructor(e){this.document=e}createDocumentFragment(e){return new Os(this.document,e)}createElement(e,t,o){return new as(this.document,e,t,o)}createText(e){return new ri(this.document,e)}clone(e,t=!1){return e._clone(t)}appendChild(e,t){return t._appendChild(e)}insertChild(e,t,o){return o._insertChild(e,t)}removeChildren(e,t,o){return o._removeChildren(e,t)}remove(e){const t=e.parent;return t?this.removeChildren(t.getChildIndex(e),1,t):[]}replace(e,t){const o=e.parent;if(o){const n=o.getChildIndex(e);return this.removeChildren(n,1,o),this.insertChild(n,t,o),!0}return!1}unwrapElement(e){const t=e.parent;if(t){const o=t.getChildIndex(e);this.remove(e),this.insertChild(o,e.getChildren(),t)}}rename(e,t){const o=new as(this.document,e,t.getAttributes(),t.getChildren());return this.replace(t,o)?o:null}setAttribute(e,t,o){o._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,o){Ae(e)&&void 0===o?t._setStyle(e):o._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,o){o._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}createPositionAt(e,t){return ms._createAt(e,t)}createPositionAfter(e){return ms._createAfter(e)}createPositionBefore(e){return ms._createBefore(e)}createRange(e,t){return new fs(e,t)}createRangeOn(e){return fs._createOn(e)}createRangeIn(e){return fs._createIn(e)}createSelection(...e){return new ks(...e)}}const Cu=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,vu=/^rgb\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}[0-9]{1,3}[ %]?\)$/i,xu=/^rgba\([ ]?([0-9]{1,3}[ %]?,[ ]?){3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,Eu=/^hsl\([ ]?([0-9]{1,3}[ %]?[,]?[ ]*){3}(1|[0-9]+%|[0]?\.?[0-9]+)?\)$/i,Du=/^hsla\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,Su=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 Tu(e){return e.startsWith("#")?Cu.test(e):e.startsWith("rgb")?vu.test(e)||xu.test(e):e.startsWith("hsl")?Eu.test(e)||Du.test(e):Su.has(e.toLowerCase())}const Bu=["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset"];function Iu(e){return Bu.includes(e)}const Pu=/^([+-]?[0-9]*([.][0-9]+)?(px|cm|mm|in|pc|pt|ch|em|ex|rem|vh|vw|vmin|vmax)|0)$/;function Ru(e){return Pu.test(e)}const zu=/^[+-]?[0-9]*([.][0-9]+)?%$/;const Mu=["repeat-x","repeat-y","repeat","space","round","no-repeat"];function Nu(e){return Mu.includes(e)}const Fu=["center","top","bottom","left","right"];function Ou(e){return Fu.includes(e)}const Vu=["fixed","scroll","local"];function Lu(e){return Vu.includes(e)}const ju=/^url\(/;function qu(e){return ju.test(e)}function Hu(e=""){if(""===e)return{top:void 0,right:void 0,bottom:void 0,left:void 0};const t=Uu(e),o=t[0],n=t[2]||o,r=t[1]||o;return{top:o,bottom:n,right:r,left:t[3]||r}}function Wu(e){return t=>{const{top:o,right:n,bottom:r,left:i}=t,s=[];return[o,n,i,r].every((e=>!!e))?s.push([e,$u(t)]):(o&&s.push([e+"-top",o]),n&&s.push([e+"-right",n]),r&&s.push([e+"-bottom",r]),i&&s.push([e+"-left",i])),s}}function $u({top:e,right:t,bottom:o,left:n}){const r=[];return n!==t?r.push(e,t,o,n):o!==e?r.push(e,t,o):t!==e?r.push(e,t):r.push(e),r.join(" ")}function Uu(e){return e.replace(/, /g,",").split(" ").map((e=>e.replace(/,/g,", ")))}function Gu(e){e.setNormalizer("background",(e=>{const t={},o=Uu(e);for(const e of o)Nu(e)?(t.repeat=t.repeat||[],t.repeat.push(e)):Ou(e)?(t.position=t.position||[],t.position.push(e)):Lu(e)?t.attachment=e:Tu(e)?t.color=e:qu(e)&&(t.image=e);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 Ku(e){e.setNormalizer("border",(e=>{const{color:t,style:o,width:n}=th(e);return{path:"border",value:{color:Hu(t),style:Hu(o),width:Hu(n)}}})),e.setNormalizer("border-top",Zu("top")),e.setNormalizer("border-right",Zu("right")),e.setNormalizer("border-bottom",Zu("bottom")),e.setNormalizer("border-left",Zu("left")),e.setNormalizer("border-color",Ju("color")),e.setNormalizer("border-width",Ju("width")),e.setNormalizer("border-style",Ju("style")),e.setNormalizer("border-top-color",Yu("color","top")),e.setNormalizer("border-top-style",Yu("style","top")),e.setNormalizer("border-top-width",Yu("width","top")),e.setNormalizer("border-right-color",Yu("color","right")),e.setNormalizer("border-right-style",Yu("style","right")),e.setNormalizer("border-right-width",Yu("width","right")),e.setNormalizer("border-bottom-color",Yu("color","bottom")),e.setNormalizer("border-bottom-style",Yu("style","bottom")),e.setNormalizer("border-bottom-width",Yu("width","bottom")),e.setNormalizer("border-left-color",Yu("color","left")),e.setNormalizer("border-left-style",Yu("style","left")),e.setNormalizer("border-left-width",Yu("width","left")),e.setExtractor("border-top",Xu("top")),e.setExtractor("border-right",Xu("right")),e.setExtractor("border-bottom",Xu("bottom")),e.setExtractor("border-left",Xu("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",Wu("border-color")),e.setReducer("border-style",Wu("border-style")),e.setReducer("border-width",Wu("border-width")),e.setReducer("border-top",oh("top")),e.setReducer("border-right",oh("right")),e.setReducer("border-bottom",oh("bottom")),e.setReducer("border-left",oh("left")),e.setReducer("border",function(){return t=>{const o=eh(t,"top"),n=eh(t,"right"),r=eh(t,"bottom"),i=eh(t,"left"),s=[o,n,r,i],a={width:e(s,"width"),style:e(s,"style"),color:e(s,"color")},l=nh(a,"all");if(l.length)return l;const c=Object.entries(a).reduce(((e,[t,o])=>(o&&(e.push([`border-${t}`,o]),s.forEach((e=>delete e[t]))),e)),[]);return[...c,...nh(o,"top"),...nh(n,"right"),...nh(r,"bottom"),...nh(i,"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 Zu(e){return t=>{const{color:o,style:n,width:r}=th(t),i={};return void 0!==o&&(i.color={[e]:o}),void 0!==n&&(i.style={[e]:n}),void 0!==r&&(i.width={[e]:r}),{path:"border",value:i}}}function Ju(e){return t=>({path:"border",value:Qu(t,e)})}function Qu(e,t){return{[t]:Hu(e)}}function Yu(e,t){return o=>({path:"border",value:{[e]:{[t]:o}}})}function Xu(e){return(t,o)=>{if(o.border)return eh(o.border,e)}}function eh(e,t){const o={};return e.width&&e.width[t]&&(o.width=e.width[t]),e.style&&e.style[t]&&(o.style=e.style[t]),e.color&&e.color[t]&&(o.color=e.color[t]),o}function th(e){const t={},o=Uu(e);for(const e of o)Ru(e)||/thin|medium|thick/.test(e)?t.width=e:Iu(e)?t.style=e:t.color=e;return t}function oh(e){return t=>nh(t,e)}function nh(e,t){const o=[];if(e&&e.width&&o.push("width"),e&&e.style&&o.push("style"),e&&e.color&&o.push("color"),3==o.length){const n=o.map((t=>e[t])).join(" ");return["all"==t?["border",n]:[`border-${t}`,n]]}return"all"==t?[]:o.map((o=>[`border-${t}-${o}`,e[o]]))}function rh(e){var t;e.setNormalizer("padding",(t="padding",e=>({path:t,value:Hu(e)}))),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",Wu("padding")),e.setStyleRelation("padding",["padding-top","padding-right","padding-bottom","padding-left"])}class ih{constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const o=this.get(e);if(!o)throw new f("commandcollection-command-not-found",this,{commandName:e});return o.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 sh extends Cr{constructor(e){super(),this.editor=e}set(e,t,o={}){if("string"==typeof t){const e=t;t=(t,o)=>{this.editor.execute(e),o()}}super.set(e,t,o)}}class ah extends(H()){constructor(e={}){super();const t=this.constructor,o=e.language||t.defaultConfig&&t.defaultConfig.language;this._context=e.context||new Mr({language:o}),this._context._addEditor(this,!e.context);const n=Array.from(t.builtinPlugins||[]);this.config=new yn(e,t.defaultConfig),this.config.define("plugins",n),this.config.define(this._context._getEditorConfig()),this.plugins=new zr(this,n,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this._readOnlyLocks=new Set,this.commands=new ih,this.set("state","initializing"),this.once("ready",(()=>this.state="ready"),{priority:"high"}),this.once("destroy",(()=>this.state="destroyed"),{priority:"high"}),this.model=new ku,this.on("change:isReadOnly",(()=>{this.model.document.isReadOnly=this.isReadOnly}));const r=new rs;this.data=new Yc(this.model,r),this.editing=new Bc(this.model,r),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new Xc([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 sh(this),this.keystrokes.listenTo(this.editing.view.document)}get isReadOnly(){return this._readOnlyLocks.size>0}set isReadOnly(e){throw new f("editor-isreadonly-has-no-setter")}enableReadOnlyMode(e){if("string"!=typeof e&&"symbol"!=typeof e)throw new f("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 f("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))}initPlugins(){const e=this.config,t=e.get("plugins"),o=e.get("removePlugins")||[],n=e.get("extraPlugins")||[],r=e.get("substitutePlugins")||[];return this.plugins.init(t.concat(n),o,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){f.rethrowUnexpectedError(e,this)}}focus(){this.editing.view.focus()}static create(...e){throw new Error("This is an abstract method.")}}function lh(e){return class extends e{setData(e){this.data.set(e)}getData(e){return this.data.get(e)}}}{const e=lh(Object);lh.setData=e.prototype.setData,lh.getData=e.prototype.getData}function ch(e){return class extends e{updateSourceElement(e=this.data.get()){if(!this.sourceElement)throw new f("editor-missing-sourceelement",this);const t=this.config.get("updateSourceElementOnDestroy"),o=this.sourceElement instanceof HTMLTextAreaElement;qn(this.sourceElement,t||o?e:"")}}}ch.updateSourceElement=ch(Object).prototype.updateSourceElement;class dh extends Nr{static get pluginName(){return"PendingActions"}init(){this.set("hasAny",!1),this._actions=new _r({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(e){if("string"!=typeof e)throw new f("pendingactions-add-invalid-message",this);const t=new(H());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 uh={bold:' ',cancel:' ',caption:' ',check:' ',cog:' ',eraser:' ',image:' ',lowVision:' ',importExport:' ',paragraph:' ',plus:' ',text:' ',alignBottom:' ',alignMiddle:' ',alignTop:' ',alignLeft:' ',alignCenter:' ',alignRight:' ',alignJustify:' ',objectLeft:' ',objectCenter:' ',objectRight:' ',objectFullWidth:' ',objectInline:' ',objectBlockLeft:' ',objectBlockRight:' ',objectSizeFull:' ',objectSizeLarge:' ',objectSizeSmall:' ',objectSizeMedium:' ',pencil:' ',pilcrow:' ',quote:' ',threeVerticalDots:' '};class hh{constructor(e){if(this.crashes=[],this.state="initializing",this._now=Date.now,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 o=this._listeners[e]||[];for(const e of o)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 o=this._shouldRestart();this.state="crashed",this._fire("stateChange"),this._fire("error",{error:e,causesRestart:o}),o?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(){if(this.crashes.length<=this._crashNumberLimit)return!0;return(this.crashes[this.crashes.length-1].date-this.crashes[this.crashes.length-1-this._crashNumberLimit].date)/this._crashNumberLimit>this._minimumNonErrorTimePeriod}}function ph(e,t=new Set){const o=[e],n=new Set;let r=0;for(;o.length>r;){const e=o[r++];if(!n.has(e)&&gh(e)&&!t.has(e))if(n.add(e),Symbol.iterator in e)try{for(const t of e)o.push(t)}catch(e){}else for(const t in e)"defaultValue"!==t&&o.push(e[t])}return n}function gh(e){const t=Object.prototype.toString.call(e),o=typeof e;return!("number"===o||"boolean"===o||"string"===o||"symbol"===o||"function"===o||"[object Date]"===t||"[object RegExp]"===t||"[object Module]"===t||null==e||e._watchdogExcluded||e instanceof EventTarget||e instanceof Event)}function mh(e,t,o=new Set){if(e===t&&("object"==typeof(n=e)&&null!==n))return!0;var n;const r=ph(e,o),i=ph(t,o);for(const e of r)if(i.has(e))return!0;return!1}const fh=function(e,t,o){var n=!0,r=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return N(o)&&(n="leading"in o?!!o.leading:n,r="trailing"in o?!!o.trailing:r),La(e,t,{leading:n,maxWait:t,trailing:r})};class bh extends hh{constructor(e,t={}){super(t),this._editor=null,this._throttledSave=fh(this._save.bind(this),"number"==typeof t.saveInterval?t.saveInterval:5e3),e&&(this._creator=(t,o)=>e.create(t,o)),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((()=>{if("string"==typeof this._elementOrData)return this.create(this._data,this._config,this._config.context);{const e=Object.assign({},this._config,{initialData:this._data});return this.create(this._elementOrData,e,e.context)}})).then((()=>{this._fire("restart")}))}create(e=this._elementOrData,t=this._config,o){return Promise.resolve().then((()=>(super._startErrorHandling(),this._elementOrData=e,this._config=this._cloneEditorConfiguration(t)||{},this._config.context=o,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.state="ready",this._fire("stateChange")}))}destroy(){return Promise.resolve().then((()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy())))}_destroy(){return Promise.resolve().then((()=>{this._stopErrorHandling(),this._throttledSave.flush();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._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={};for(const t of this._editor.model.document.getRootNames())e[t]=this._editor.data.get({rootName:t});return e}_isErrorComingFromThisItem(e){return mh(this._editor,e.context,this._excludedProps)}_cloneEditorConfiguration(e){return wn(e,((e,t)=>_n(e)||"context"===t?e:void 0))}}const kh=Symbol("MainQueueId");class wh{constructor(){this._onEmptyCallbacks=[],this._queues=new Map,this._activeActions=0}onEmpty(e){this._onEmptyCallbacks.push(e)}enqueue(e,t){const o=e===kh;this._activeActions++,this._queues.get(e)||this._queues.set(e,Promise.resolve());const n=(o?Promise.all(this._queues.values()):Promise.all([this._queues.get(kh),this._queues.get(e)])).then(t),r=n.catch((()=>{}));return this._queues.set(e,r),n.finally((()=>{this._activeActions--,this._queues.get(e)===r&&0===this._activeActions&&this._onEmptyCallbacks.forEach((e=>e()))}))}}function _h(e){return Array.isArray(e)?e:[e]}function yh({emitter:e,activator:t,callback:o,contextElements:n}){e.listenTo(document,"mousedown",((e,r)=>{if(!t())return;const i="function"==typeof r.composedPath?r.composedPath():[],s="function"==typeof n?n():n;for(const e of s)if(e.contains(r.target)||i.includes(e))return;o()}))}function Ah(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 Ch({view:e}){e.listenTo(e.element,"submit",((t,o)=>{o.preventDefault(),e.fire("submit")}),{useCapture:!0})}function vh({keystrokeHandler:e,focusTracker:t,gridItems:o,numberOfColumns:n,uiLanguageDirection:r}){const i="number"==typeof n?()=>n:n;function s(e){return n=>{const r=o.find((e=>e.element===t.focusedElement)),i=o.getIndex(r),s=e(i,o);o.get(s).focus(),n.stopPropagation(),n.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",s(((e,t)=>"rtl"===r?l(e,t.length):a(e,t.length)))),e.set("arrowleft",s(((e,t)=>"rtl"===r?a(e,t.length):l(e,t.length)))),e.set("arrowup",s(((e,t)=>{let o=e-i();return o<0&&(o=e+i()*Math.floor(t.length/i()),o>t.length-1&&(o-=i())),o}))),e.set("arrowdown",s(((e,t)=>{let o=e+i();return o>t.length-1&&(o=e%i()),o})))}class xh extends _r{constructor(e=[]){super(e,{idProperty:"viewUid"}),this.on("add",((e,t,o)=>{this._renderViewIntoCollectionParent(t,o)})),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 f("ui-viewcollection-delegate-wrong-events",this);return{to:t=>{for(const o of this)for(const n of e)o.delegate(n).to(t);this.on("add",((o,n)=>{for(const o of e)n.delegate(o).to(t)})),this.on("remove",((o,n)=>{for(const o of e)n.stopDelegating(o,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)}}var Eh=o(6150),Dh={attributes:{"data-cke":!0}};Dh.setAttributes=Wr(),Dh.insert=qr().bind(null,"head"),Dh.domAPI=Lr(),Dh.insertStyleElement=Ur();Or()(Eh.Z,Dh);Eh.Z&&Eh.Z.locals&&Eh.Z.locals;class Sh extends(Dn(H())){constructor(e){super(),this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new _r,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",((t,o)=>{o.locale=e,o.t=e&&e.t})),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=Th.bind(this,this)}createCollection(e){const t=new xh(e);return this._viewCollections.add(t),t}registerChild(e){Q(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t)}deregisterChild(e){Q(e)||(e=[e]);for(const t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new Th(e)}extendTemplate(e){Th.extend(this.template,e)}render(){if(this.isRendered)throw new f("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)}}class Th extends(S()){constructor(e){super(),Object.assign(this,Vh(Oh(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 f("ui-template-revert-not-applied",[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){yield*function*e(t){if(t.children)for(const o of t.children)$h(o)?yield o:Uh(o)&&(yield*e(o))}(this)}static bind(e,t){return{to:(o,n)=>new Ih({eventNameOrFunction:o,attribute:o,observable:e,emitter:t,callback:n}),if:(o,n,r)=>new Ph({observable:e,emitter:t,attribute:o,valueIfTrue:n,callback:r})}}static extend(e,t){if(e._isRendered)throw new f("template-extend-render",[this,e]);Hh(e,Vh(Oh(t)))}_renderNode(e){let t;if(t=e.node?this.tag&&this.text:this.tag?this.text:!this.text,t)throw new f("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(""),Rh(this.text)?this._bindToObservable({schema:this.text,updater:Mh(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){if(!this.attributes)return;const t=e.node,o=e.revertData;for(const n in this.attributes){const r=t.getAttribute(n),i=this.attributes[n];o&&(o.attributes[n]=r);const s=Kh(i)?i[0].ns:null;if(Rh(i)){const a=Kh(i)?i[0].value:i;o&&Zh(n)&&a.unshift(r),this._bindToObservable({schema:a,updater:Nh(t,n,s),data:e})}else if("style"==n&&"string"!=typeof i[0])this._renderStyleAttribute(i[0],e);else{o&&r&&Zh(n)&&i.unshift(r);const e=i.map((e=>e&&e.value||e)).reduce(((e,t)=>e.concat(t)),[]).reduce(jh,"");Wh(e)||t.setAttributeNS(s,n,e)}}}_renderStyleAttribute(e,t){const o=t.node;for(const n in e){const r=e[n];Rh(r)?this._bindToObservable({schema:[r],updater:Fh(o,n),data:t}):o.style[n]=r}}_renderElementChildren(e){const t=e.node,o=e.intoFragment?document.createDocumentFragment():t,n=e.isApplying;let r=0;for(const i of this.children)if(Gh(i)){if(!n){i.setParent(t);for(const e of i)o.appendChild(e.element)}}else if($h(i))n||(i.isRendered||i.render(),o.appendChild(i.element));else if(vn(i))o.appendChild(i);else if(n){const t={children:[],bindings:[],attributes:{}};e.revertData.children.push(t),i._renderNode({intoFragment:!1,node:o.childNodes[r++],isApplying:!0,revertData:t})}else o.appendChild(i.render());e.intoFragment&&t.appendChild(o)}_setUpListeners(e){if(this.eventListeners)for(const t in this.eventListeners){const o=this.eventListeners[t].map((o=>{const[n,r]=t.split("@");return o.activateDomEventListener(n,r,e)}));e.revertData&&e.revertData.bindings.push(o)}}_bindToObservable({schema:e,updater:t,data:o}){const n=o.revertData;zh(e,t,o);const r=e.filter((e=>!Wh(e))).filter((e=>e.observable)).map((n=>n.activateAttributeListener(e,t,o)));n&&n.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 o=e;for(const e in t.attributes){const n=t.attributes[e];null===n?o.removeAttribute(e):o.setAttribute(e,n)}for(let e=0;ezh(e,t,o);return this.emitter.listenTo(this.observable,`change:${this.attribute}`,n),()=>{this.emitter.stopListening(this.observable,`change:${this.attribute}`,n)}}}class Ih extends Bh{constructor(e){super(e),this.eventNameOrFunction=e.eventNameOrFunction}activateDomEventListener(e,t,o){const n=(e,o)=>{t&&!o.target.matches(t)||("function"==typeof this.eventNameOrFunction?this.eventNameOrFunction(o):this.observable.fire(this.eventNameOrFunction,o))};return this.emitter.listenTo(o.node,e,n),()=>{this.emitter.stopListening(o.node,e,n)}}}class Ph extends Bh{constructor(e){super(e),this.valueIfTrue=e.valueIfTrue}getValue(e){return!Wh(super.getValue(e))&&(this.valueIfTrue||!0)}}function Rh(e){return!!e&&(e.value&&(e=e.value),Array.isArray(e)?e.some(Rh):e instanceof Bh)}function zh(e,t,{node:o}){const n=function(e,t){return e.map((e=>e instanceof Bh?e.getValue(t):e))}(e,o);let r;r=1==e.length&&e[0]instanceof Ph?n[0]:n.reduce(jh,""),Wh(r)?t.remove():t.set(r)}function Mh(e){return{set(t){e.textContent=t},remove(){e.textContent=""}}}function Nh(e,t,o){return{set(n){e.setAttributeNS(o,t,n)},remove(){e.removeAttributeNS(o,t)}}}function Fh(e,t){return{set(o){e.style[t]=o},remove(){e.style[t]=null}}}function Oh(e){return wn(e,(e=>{if(e&&(e instanceof Bh||Uh(e)||$h(e)||Gh(e)))return e}))}function Vh(e){if("string"==typeof e?e=function(e){return{text:[e]}}(e):e.text&&function(e){e.text=mr(e.text)}(e),e.on&&(e.eventListeners=function(e){for(const t in e)Lh(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=mr(e[t].value)),Lh(e,t)}(e.attributes);const t=[];if(e.children)if(Gh(e.children))t.push(e.children);else for(const o of e.children)Uh(o)||$h(o)||vn(o)?t.push(o):t.push(new Th(o));e.children=t}return e}function Lh(e,t){e[t]=mr(e[t])}function jh(e,t){return Wh(t)?e:Wh(e)?t:`${e} ${t}`}function qh(e,t){for(const o in t)e[o]?e[o].push(...t[o]):e[o]=t[o]}function Hh(e,t){if(t.attributes&&(e.attributes||(e.attributes={}),qh(e.attributes,t.attributes)),t.eventListeners&&(e.eventListeners||(e.eventListeners={}),qh(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 f("ui-template-extend-children-mismatch",e);let o=0;for(const n of t.children)Hh(e.children[o++],n)}}function Wh(e){return!e&&0!==e}function $h(e){return e instanceof Sh}function Uh(e){return e instanceof Th}function Gh(e){return e instanceof xh}function Kh(e){return N(e[0])&&e[0].ns}function Zh(e){return"class"==e||"style"==e}class Jh extends xh{constructor(e,t=[]){super(t),this.locale=e}attachToDom(){this._bodyCollectionContainer=new Th({tag:"div",attributes:{class:["ck","ck-reset_all","ck-body","ck-rounded-corners"],dir:this.locale.uiLanguageDirection},children:this}).render();let e=document.querySelector(".ck-body-wrapper");e||(e=ge(document,"div",{class:"ck-body-wrapper"}),document.body.appendChild(e)),e.appendChild(this._bodyCollectionContainer)}detachFromDom(){super.destroy(),this._bodyCollectionContainer&&this._bodyCollectionContainer.remove();const e=document.querySelector(".ck-body-wrapper");e&&0==e.childElementCount&&e.remove()}}var Qh=o(1174),Yh={attributes:{"data-cke":!0}};Yh.setAttributes=Wr(),Yh.insert=qr().bind(null,"head"),Yh.domAPI=Lr(),Yh.insertStyleElement=Ur();Or()(Qh.Z,Yh);Qh.Z&&Qh.Z.locals&&Qh.Z.locals;class Xh extends Sh{constructor(){super();const e=this.bindTemplate;this.set("content",""),this.set("viewBox","0 0 20 20"),this.set("fillColor",""),this.set("isColorInherited",!0),this.setTemplate({tag:"svg",ns:"http://www.w3.org/2000/svg",attributes:{class:["ck","ck-icon","ck-reset_all-excluded",e.if("isColorInherited","ck-icon_inherit-color")],viewBox:e.to("viewBox")}})}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:o}of Array.from(e.attributes))Xh.presentationalAttributeNames.includes(t)&&this.element.setAttribute(t,o);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}))}}Xh.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"];var ep=o(4499),tp={attributes:{"data-cke":!0}};tp.setAttributes=Wr(),tp.insert=qr().bind(null,"head"),tp.domAPI=Lr(),tp.insertStyleElement=Ur();Or()(ep.Z,tp);ep.Z&&ep.Z.locals&&ep.Z.locals;class op extends Sh{constructor(e){super(e),this._focusDelayed=null;const t=this.bindTemplate,o=h();this.set("ariaChecked",void 0),this.set("ariaLabel",void 0),this.set("ariaLabelledBy",`ck-editor__aria-label_${o}`),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._createLabelView(),this.iconView=new Xh,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",t.to("class"),t.if("isEnabled","ck-disabled",(e=>!e)),t.if("isVisible","ck-hidden",(e=>!e)),t.to("isOn",(e=>e?"ck-on":"ck-off")),t.if("withText","ck-button_with-text"),t.if("withKeystroke","ck-button_with-keystroke")],role:t.to("role"),type:t.to("type",(e=>e||"button")),tabindex:t.to("tabindex"),"aria-label":t.to("ariaLabel"),"aria-labelledby":t.to("ariaLabelledBy"),"aria-disabled":t.if("isEnabled",!0,(e=>!e)),"aria-checked":t.to("isOn"),"aria-pressed":t.to("isOn",(e=>!!this.isToggleable&&String(!!e))),"data-cke-tooltip-text":t.to("_tooltipString"),"data-cke-tooltip-position":t.to("tooltipPosition")},children:this.children,on:{click:t.to((e=>{this.isEnabled?this.fire("execute"):e.preventDefault()}))}};n.isSafari&&(this._focusDelayed||(this._focusDelayed=xr((()=>this.focus()),0)),r.on.mousedown=t.to((()=>{this._focusDelayed()})),r.on.mouseup=t.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()}_createLabelView(){const e=new Sh,t=this.bindTemplate;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:t.to("labelStyle"),id:this.ariaLabelledBy},children:[{text:t.to("label")}]}),e}_createKeystrokeView(){const e=new Sh;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",(e=>pr(e)))}]}),e}_getTooltipString(e,t,o){return e?"string"==typeof e?e:(o&&(o=pr(o)),e instanceof Function?e(t,o):`${t}${o?` (${o})`:""}`):""}}var np=o(9681),rp={attributes:{"data-cke":!0}};rp.setAttributes=Wr(),rp.insert=qr().bind(null,"head"),rp.domAPI=Lr(),rp.insertStyleElement=Ur();Or()(np.Z,rp);np.Z&&np.Z.locals&&np.Z.locals;class ip extends op{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 Sh;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}function sp(e,t){const o=e.t,n={Black:o("Black"),"Dim grey":o("Dim grey"),Grey:o("Grey"),"Light grey":o("Light grey"),White:o("White"),Red:o("Red"),Orange:o("Orange"),Yellow:o("Yellow"),"Light green":o("Light green"),Green:o("Green"),Aquamarine:o("Aquamarine"),Turquoise:o("Turquoise"),"Light blue":o("Light blue"),Blue:o("Blue"),Purple:o("Purple")};return t.map((e=>{const t=n[e.label];return t&&t!=e.label&&(e.label=t),e}))}function ap(e){return e.map(lp).filter((e=>!!e))}function lp(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 cp extends op{constructor(e){super(e);const t=this.bindTemplate;this.set("color",void 0),this.set("hasBorder",!1),this.icon=' ',this.extendTemplate({attributes:{style:{backgroundColor:t.to("color")},class:["ck","ck-color-grid__tile",t.if("hasBorder","ck-color-table__color-tile_bordered")]}})}render(){super.render(),this.iconView.fillColor="hsl(0, 0%, 100%)"}}var dp=o(4923),up={attributes:{"data-cke":!0}};up.setAttributes=Wr(),up.insert=qr().bind(null,"head"),up.domAPI=Lr(),up.insertStyleElement=Ur();Or()(dp.Z,up);dp.Z&&dp.Z.locals&&dp.Z.locals;class hp extends Sh{constructor(e,t){super(e);const o=t&&t.colorDefinitions?t.colorDefinitions:[];this.columns=t&&t.columns?t.columns:5;const n={gridTemplateColumns:`repeat( ${this.columns}, 1fr)`};this.set("selectedColor",void 0),this.items=this.createCollection(),this.focusTracker=new Ar,this.keystrokes=new Cr,this.items.on("add",((e,t)=>{t.isOn=t.color===this.selectedColor})),o.forEach((e=>{const t=new cp;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:n}}),this.on("change:selectedColor",((e,t,o)=>{for(const e of this.items)e.isOn=e.color===o}))}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),vh({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()}}o(8874);o(2085);var pp=o(2751),gp={attributes:{"data-cke":!0}};gp.setAttributes=Wr(),gp.insert=qr().bind(null,"head"),gp.domAPI=Lr(),gp.insertStyleElement=Ur();Or()(pp.Z,gp);pp.Z&&pp.Z.locals&&pp.Z.locals;class mp extends Sh{constructor(e){super(e),this.set("text",void 0),this.set("for",void 0),this.id=`ck-editor__label_${h()}`;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")}]})}}var fp=o(8111),bp={attributes:{"data-cke":!0}};bp.setAttributes=Wr(),bp.insert=qr().bind(null,"head"),bp.domAPI=Lr(),bp.insertStyleElement=Ur();Or()(fp.Z,bp);fp.Z&&fp.Z.locals&&fp.Z.locals;class kp extends Sh{constructor(e,t){super(e);const o=`ck-labeled-field-view-${h()}`,n=`ck-labeled-field-view-status-${h()}`;this.fieldView=t(this,o,n),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(o),this.statusView=this._createStatusView(n),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 mp(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createStatusView(e){const t=new Sh(this.locale),o=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view__status",o.if("errorText","ck-labeled-field-view__status_error"),o.if("_statusText","ck-hidden",(e=>!e))],id:e,role:o.if("errorText","alert")},children:[{text:o.to("_statusText")}]}),t}focus(){this.fieldView.focus()}}var wp=o(6985),_p={attributes:{"data-cke":!0}};_p.setAttributes=Wr(),_p.insert=qr().bind(null,"head"),_p.domAPI=Lr(),_p.insertStyleElement=Ur();Or()(wp.Z,_p);wp.Z&&wp.Z.locals&&wp.Z.locals;class yp extends Sh{constructor(e){super(e),this.set("value",void 0),this.set("id",void 0),this.set("placeholder",void 0),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById",void 0),this.focusTracker=new Ar,this.bind("isFocused").to(this.focusTracker),this.set("isEmpty",!0),this.set("inputMode","text");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"),readonly:t.to("isReadOnly"),inputmode:t.to("inputMode"),"aria-invalid":t.if("hasError",!0),"aria-describedby":t.to("ariaDescribedById")},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,o)=>{this._setDomElementValue(o),this._updateIsEmpty()}))}destroy(){super.destroy(),this.focusTracker.destroy()}select(){this.element.select()}focus(){this.element.focus()}_updateIsEmpty(){this.isEmpty=!this.element.value}_setDomElementValue(e){this.element.value=e||0===e?e:""}}class Ap extends yp{constructor(e){super(e),this.extendTemplate({attributes:{type:"text",class:["ck-input-text"]}})}}class Cp extends Sh{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")]},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():b("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()}}}var vp=o(3488),xp={attributes:{"data-cke":!0}};xp.setAttributes=Wr(),xp.insert=qr().bind(null,"head"),xp.domAPI=Lr(),xp.insertStyleElement=Ur();Or()(vp.Z,xp);vp.Z&&vp.Z.locals&&vp.Z.locals;class Ep extends Sh{constructor(e,t,o){super(e);const n=this.bindTemplate;this.buttonView=t,this.panelView=o,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class",void 0),this.set("id",void 0),this.set("panelPosition","auto"),this.keystrokes=new Cr,this.focusTracker=new Ar,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",n.to("class"),n.if("isEnabled","ck-disabled",(e=>!e))],id:n.to("id"),"aria-describedby":n.to("ariaDescribedById")},children:[t,o]}),t.extendTemplate({attributes:{class:["ck-dropdown__button"],"data-cke-tooltip-disabled":n.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.panelView.bind("isVisible").to(this,"isOpen"),this.on("change:isOpen",((e,t,o)=>{o&&("auto"===this.panelPosition?this.panelView.position=Ep._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions}).name: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:o,southWest:n,northEast:r,northWest:i,southMiddleEast:s,southMiddleWest:a,northMiddleEast:l,northMiddleWest:c}=Ep.defaultPanelPositions;return"rtl"!==this.locale.uiLanguageDirection?[o,n,s,a,e,r,i,l,c,t]:[n,o,a,s,e,i,r,c,l,t]}}Ep.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"})},Ep._getOptimalPosition=Kn;const Dp=' ';class Sp extends op{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 Xh;return e.content=Dp,e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}class Tp{constructor(e){if(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 o=e.actions[t];"string"==typeof o&&(o=[o]);for(const n of o)e.keystrokeHandler.set(n,((e,o)=>{this[t](),o()}))}}get first(){return this.focusables.find(Bp)||null}get last(){return this.focusables.filter(Bp).slice(-1)[0]||null}get next(){return this._getFocusableItem(1)}get previous(){return this._getFocusableItem(-1)}get current(){let e=null;return null===this.focusTracker.focusedElement?null:(this.focusables.find(((t,o)=>{const n=t.element===this.focusTracker.focusedElement;return n&&(e=o),n})),e)}focusFirst(){this._focus(this.first)}focusLast(){this._focus(this.last)}focusNext(){this._focus(this.next)}focusPrevious(){this._focus(this.previous)}_focus(e){e&&e.focus()}_getFocusableItem(e){const t=this.current,o=this.focusables.length;if(!o)return null;if(null===t)return this[1===e?"first":"last"];let n=(t+o+e)%o;do{const t=this.focusables.get(n);if(Bp(t))return t;n=(n+o+e)%o}while(n!==t);return null}}function Bp(e){return!(!e.focus||!Gn(e.element))}class Ip extends Sh{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}class Pp extends Sh{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__line-break"]}})}}var Rp=o(5571),zp={attributes:{"data-cke":!0}};zp.setAttributes=Wr(),zp.insert=qr().bind(null,"head"),zp.domAPI=Lr(),zp.insertStyleElement=Ur();Or()(Rp.Z,zp);Rp.Z&&Rp.Z.locals&&Rp.Z.locals;const{threeVerticalDots:Mp}=uh,Np={alignLeft:uh.alignLeft,bold:uh.bold,importExport:uh.importExport,paragraph:uh.paragraph,plus:uh.plus,text:uh.text,threeVerticalDots:uh.threeVerticalDots};class Fp extends Sh{constructor(e,t){super(e);const o=this.bindTemplate,n=this.t;this.options=t||{},this.set("ariaLabel",n("Editor toolbar")),this.set("maxWidth","auto"),this.items=this.createCollection(),this.focusTracker=new Ar,this.keystrokes=new Cr,this.set("class",void 0),this.set("isCompact",!1),this.itemsView=new Op(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection();const r="rtl"===e.uiLanguageDirection;this._focusCycler=new Tp({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:[r?"arrowright":"arrowleft","arrowup"],focusNext:[r?"arrowleft":"arrowright","arrowdown"]}});const i=["ck","ck-toolbar",o.to("class"),o.if("isCompact","ck-toolbar_compact")];var s;this.options.shouldGroupWhenFull&&this.options.isFloating&&i.push("ck-toolbar_floating"),this.setTemplate({tag:"div",attributes:{class:i,role:"toolbar","aria-label":o.to("ariaLabel"),style:{maxWidth:o.to("maxWidth")},tabindex:-1},children:this.children,on:{mousedown:(s=this,s.bindTemplate.to((e=>{e.target===s.element&&e.preventDefault()})))}}),this._behavior=this.options.shouldGroupWhenFull?new Lp(this):new Vp(this)}render(){super.render(),this.focusTracker.add(this.element);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),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,o){this.items.addMany(this._buildItemsFromConfig(e,t,o))}_buildItemsFromConfig(e,t,o){const n=function(e){return Array.isArray(e)?{items:e,removeItems:[]}:e?Object.assign({items:[],removeItems:[]},e):{items:[],removeItems:[]}}(e),r=o||n.removeItems;return this._cleanItemsConfiguration(n.items,t,r).map((e=>N(e)?this._createNestedToolbarDropdown(e,t,r):"|"===e?new Ip:"-"===e?new Pp:t.create(e))).filter((e=>!!e))}_cleanItemsConfiguration(e,t,o){const n=e.filter(((e,n,r)=>"|"===e||-1===o.indexOf(e)&&("-"===e?!this.options.shouldGroupWhenFull||(b("toolbarview-line-break-ignored-when-grouping-items",r),!1):!(!N(e)&&!t.has(e))||(b("toolbarview-item-unavailable",{item:e}),!1))));return this._cleanSeparatorsAndLineBreaks(n)}_cleanSeparatorsAndLineBreaks(e){const t=e=>"-"!==e&&"|"!==e,o=e.length,n=e.findIndex(t);if(-1===n)return[];const r=o-e.slice().reverse().findIndex(t);return e.slice(n,r).filter(((e,o,n)=>{if(t(e))return!0;return!(o>0&&n[o-1]===e)}))}_createNestedToolbarDropdown(e,t,o){let{label:n,icon:r,items:i,tooltip:s=!0,withText:a=!1}=e;if(i=this._cleanItemsConfiguration(i,t,o),!i.length)return null;const l=Xp(this.locale);return n||b("toolbarview-nested-toolbar-dropdown-missing-label",e),l.class="ck-toolbar__nested-toolbar-dropdown",l.buttonView.set({label:n,tooltip:s,withText:!!a}),!1!==r?l.buttonView.icon=Np[r]||r||Mp:l.buttonView.withText=!0,eg(l,(()=>l.toolbarView._buildItemsFromConfig(i,t,o))),l}}class Op extends Sh{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class Vp{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=>e)),e.extendTemplate({attributes:{class:[t.if("isVertical","ck-toolbar_vertical")]}})}render(){}destroy(){}}class Lp{constructor(e){this.resizeObserver=null,this.cachedPadding=null,this.shouldUpdateGroupingOnNextResize=!1,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._updateFocusCycleableItems.bind(this)),e.children.on("change",this._updateFocusCycleableItems.bind(this)),e.items.on("change",((e,t)=>{const o=t.index,n=Array.from(t.added);for(const e of t.removed)o>=this.ungroupedItems.length?this.groupedItems.remove(e):this.ungroupedItems.remove(e);for(let e=o;ethis.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(!Gn(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,o=new Fn(e.lastChild),n=new Fn(e);if(!this.cachedPadding){const o=In.window.getComputedStyle(e),n="ltr"===t?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(o[n])}return"ltr"===t?o.right>n.right-this.cachedPadding:o.left{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 Ip),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,o=Xp(e);return o.class="ck-toolbar__grouped-dropdown",o.panelPosition="ltr"===e.uiLanguageDirection?"sw":"se",eg(o,this.groupedItems),o.buttonView.set({label:t("Show more items"),tooltip:!0,tooltipPosition:"rtl"===e.uiLanguageDirection?"se":"sw",icon:Mp}),o}_updateFocusCycleableItems(){this.viewFocusables.clear(),this.ungroupedItems.map((e=>{this.viewFocusables.add(e)})),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}var jp=o(1162),qp={attributes:{"data-cke":!0}};qp.setAttributes=Wr(),qp.insert=qr().bind(null,"head"),qp.domAPI=Lr(),qp.insertStyleElement=Ur();Or()(jp.Z,qp);jp.Z&&jp.Z.locals&&jp.Z.locals;class Hp extends Sh{constructor(e){super(e);const t=this.bindTemplate;this.items=this.createCollection(),this.focusTracker=new Ar,this.keystrokes=new Cr,this._focusCycler=new Tp({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this.set("ariaLabel",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")},children:this.items})}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)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}class Wp extends Sh{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.focus()}}class $p extends Sh{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}var Up=o(66),Gp={attributes:{"data-cke":!0}};Gp.setAttributes=Wr(),Gp.insert=qr().bind(null,"head"),Gp.domAPI=Lr(),Gp.insertStyleElement=Ur();Or()(Up.Z,Gp);Up.Z&&Up.Z.locals&&Up.Z.locals;class Kp extends Sh{constructor(e){super(e);const t=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(),this.arrowView=this._createArrowView(),this.keystrokes=new Cr,this.focusTracker=new Ar,this.setTemplate({tag:"div",attributes:{class:["ck","ck-splitbutton",t.to("class"),t.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(){const e=new op;return e.bind("icon","isEnabled","isOn","isToggleable","keystroke","label","tabindex","tooltip","tooltipPosition","type","withText").to(this),e.extendTemplate({attributes:{class:"ck-splitbutton__action"}}),e.delegate("execute").to(this),e}_createArrowView(){const e=new op,t=e.bindTemplate;return e.icon=Dp,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}}var Zp=o(5075),Jp={attributes:{"data-cke":!0}};Jp.setAttributes=Wr(),Jp.insert=qr().bind(null,"head"),Jp.domAPI=Lr(),Jp.insertStyleElement=Ur();Or()(Zp.Z,Jp);Zp.Z&&Zp.Z.locals&&Zp.Z.locals;var Qp=o(6875),Yp={attributes:{"data-cke":!0}};Yp.setAttributes=Wr(),Yp.insert=qr().bind(null,"head"),Yp.domAPI=Lr(),Yp.insertStyleElement=Ur();Or()(Qp.Z,Yp);Qp.Z&&Qp.Z.locals&&Qp.Z.locals;function Xp(e,t=Sp){const o=new t(e),n=new Cp(e),r=new Ep(e,o,n);return o.bind("isEnabled").to(r),o instanceof Kp?o.arrowView.bind("isOn").to(r,"isOpen"):o.bind("isOn").to(r,"isOpen"),function(e){(function(e){e.on("render",(()=>{yh({emitter:e,activator:()=>e.isOpen,callback:()=>{e.isOpen=!1},contextElements:[e.element]})}))})(e),function(e){e.on("execute",(t=>{t.source instanceof ip||(e.isOpen=!1)}))}(e),function(e){e.focusTracker.on("change:isFocused",((t,o,n)=>{e.isOpen&&!n&&(e.isOpen=!1)}))}(e),function(e){e.keystrokes.set("arrowdown",((t,o)=>{e.isOpen&&(e.panelView.focus(),o())})),e.keystrokes.set("arrowup",((t,o)=>{e.isOpen&&(e.panelView.focusLast(),o())}))}(e),function(e){e.on("change:isOpen",((t,o,n)=>{if(n)return;const r=e.panelView.element;r&&r.contains(In.document.activeElement)&&e.buttonView.focus()}))}(e),function(e){e.on("change:isOpen",((t,o,n)=>{n&&e.panelView.focus()}),{priority:"low"})}(e)}(r),r}function eg(e,t,o={}){e.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),e.isOpen?tg(e,t,o):e.once("change:isOpen",(()=>tg(e,t,o)),{priority:"highest"}),o.enableActiveItemFocusOnDropdownOpen&&rg(e,(()=>e.toolbarView.items.find((e=>e.isOn))))}function tg(e,t,o){const n=e.locale,r=n.t,i=e.toolbarView=new Fp(n),s="function"==typeof t?t():t;i.ariaLabel=o.ariaLabel||r("Dropdown toolbar"),o.maxWidth&&(i.maxWidth=o.maxWidth),o.class&&(i.class=o.class),o.isCompact&&(i.isCompact=o.isCompact),o.isVertical&&(i.isVertical=!0),s instanceof xh?i.items.bindTo(s).using((e=>e)):i.items.addMany(s),e.panelView.children.add(i),i.items.delegate("execute").to(e)}function og(e,t,o={}){e.isOpen?ng(e,t,o):e.once("change:isOpen",(()=>ng(e,t,o)),{priority:"highest"}),rg(e,(()=>e.listView.items.find((e=>e instanceof Wp&&e.children.first.isOn))))}function ng(e,t,o){const n=e.locale,r=e.listView=new Hp(n),i="function"==typeof t?t():t;r.ariaLabel=o.ariaLabel,r.role=o.role,r.items.bindTo(i).using((e=>{if("separator"===e.type)return new $p(n);if("button"===e.type||"switchbutton"===e.type){const t=new Wp(n);let o;return o="button"===e.type?new op(n):new ip(n),o.bind(...Object.keys(e.model)).to(e.model),o.delegate("execute").to(t),t.children.add(o),t}return null})),e.panelView.children.add(r),r.items.delegate("execute").to(e)}function rg(e,t){e.on("change:isOpen",(()=>{if(!e.isOpen)return;const o=t();o&&("function"==typeof o.focus?o.focus():b("ui-dropdown-focus-child-on-open-child-missing-focus",{view:o}))}),{priority:p.low-10})}function ig(e,t,o){const n=new Ap(e.locale);return n.set({id:t,ariaDescribedById:o}),n.bind("isReadOnly").to(e,"isEnabled",(e=>!e)),n.bind("hasError").to(e,"errorText",(e=>!!e)),n.on("input",(()=>{e.errorText=null})),e.bind("isEmpty","isFocused","placeholder").to(n),n}function sg(e,t,o){const n=Xp(e.locale);return n.set({id:t,ariaDescribedById:o}),n.bind("isEnabled").to(e),n}const ag=(e,t=0,o=1)=>e>o?o:eMath.round(o*e)/o,cg=(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?lg(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?lg(parseInt(e.substring(6,8),16)/255,2):1})),dg=({h:e,s:t,v:o,a:n})=>{const r=(200-t)*o/100;return{h:lg(e),s:lg(r>0&&r<200?t*o/100/(r<=100?r:200-r)*100:0),l:lg(r/2),a:lg(n,2)}},ug=e=>{const{h:t,s:o,l:n}=dg(e);return`hsl(${t}, ${o}%, ${n}%)`},hg=({h:e,s:t,v:o,a:n})=>{e=e/360*6,t/=100,o/=100;const r=Math.floor(e),i=o*(1-t),s=o*(1-(e-r)*t),a=o*(1-(1-e+r)*t),l=r%6;return{r:lg(255*[o,s,i,i,a,o][l]),g:lg(255*[a,o,o,s,i,i][l]),b:lg(255*[i,i,a,o,o,s][l]),a:lg(n,2)}},pg=e=>{const t=e.toString(16);return t.length<2?"0"+t:t},gg=({r:e,g:t,b:o,a:n})=>{const r=n<1?pg(lg(255*n)):"";return"#"+pg(e)+pg(t)+pg(o)+r},mg=({r:e,g:t,b:o,a:n})=>{const r=Math.max(e,t,o),i=r-Math.min(e,t,o),s=i?r===e?(t-o)/i:r===t?2+(o-e)/i:4+(e-t)/i:0;return{h:lg(60*(s<0?s+6:s)),s:lg(r?i/r*100:0),v:lg(r/255*100),a:n}},fg=(e,t)=>{if(e===t)return!0;for(const o in e)if(e[o]!==t[o])return!1;return!0},bg={},kg=e=>{let t=bg[e];return t||(t=document.createElement("template"),t.innerHTML=e,bg[e]=t),t},wg=(e,t,o)=>{e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))};let _g=!1;const yg=e=>"touches"in e,Ag=(e,t)=>{const o=yg(t)?t.touches[0]:t,n=e.el.getBoundingClientRect();wg(e.el,"move",e.getMove({x:ag((o.pageX-(n.left+window.pageXOffset))/n.width),y:ag((o.pageY-(n.top+window.pageYOffset))/n.height)}))};class Cg{constructor(e,t,o,n){const r=kg(``);e.appendChild(r.content.cloneNode(!0));const i=e.querySelector(`[part=${t}]`);i.addEventListener("mousedown",this),i.addEventListener("touchstart",this),i.addEventListener("keydown",this),this.el=i,this.xy=n,this.nodes=[i.firstChild,i]}set dragging(e){const t=e?document.addEventListener:document.removeEventListener;t(_g?"touchmove":"mousemove",this),t(_g?"touchend":"mouseup",this)}handleEvent(e){switch(e.type){case"mousedown":case"touchstart":if(e.preventDefault(),!(e=>!(_g&&!yg(e)||(_g||(_g=yg(e)),0)))(e)||!_g&&0!=e.button)return;this.el.focus(),Ag(this,e),this.dragging=!0;break;case"mousemove":case"touchmove":e.preventDefault(),Ag(this,e);break;case"mouseup":case"touchend":this.dragging=!1;break;case"keydown":((e,t)=>{const o=t.keyCode;o>40||e.xy&&o<37||o<33||(t.preventDefault(),wg(e.el,"move",e.getMove({x:39===o?.01:37===o?-.01:34===o?.05:33===o?-.05:35===o?1:36===o?-1:0,y:40===o?.01:38===o?-.01:0},!0)))})(this,e)}}style(e){e.forEach(((e,t)=>{for(const o in e)this.nodes[t].style.setProperty(o,e[o])}))}}class vg extends Cg{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:ug({h:e,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuenow",`${lg(e)}`)}getMove(e,t){return{h:t?ag(this.h+360*e.x,0,360):360*e.x}}}class xg extends Cg{constructor(e){super(e,"saturation",'aria-label="Color"',!0)}update(e){this.hsva=e,this.style([{top:100-e.v+"%",left:`${e.s}%`,color:ug(e)},{"background-color":ug({h:e.h,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuetext",`Saturation ${lg(e.s)}%, Brightness ${lg(e.v)}%`)}getMove(e,t){return{s:t?ag(this.hsva.s+100*e.x,0,100):100*e.x,v:t?ag(this.hsva.v-100*e.y,0,100):Math.round(100-100*e.y)}}}const Eg=Symbol("same"),Dg=Symbol("color"),Sg=Symbol("hsva"),Tg=Symbol("update"),Bg=Symbol("parts"),Ig=Symbol("css"),Pg=Symbol("sliders");class Rg extends HTMLElement{static get observedAttributes(){return["color"]}get[Ig](){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[Pg](){return[xg,vg]}get color(){return this[Dg]}set color(e){if(!this[Eg](e)){const t=this.colorModel.toHsva(e);this[Tg](t),this[Dg]=e}}constructor(){super();const e=kg(``),t=this.attachShadow({mode:"open"});t.appendChild(e.content.cloneNode(!0)),t.addEventListener("move",this),this[Bg]=this[Pg].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,o){const n=this.colorModel.fromAttr(o);this[Eg](n)||(this.color=n)}handleEvent(e){const t=this[Sg],o={...t,...e.detail};let n;this[Tg](o),fg(o,t)||this[Eg](n=this.colorModel.fromHsva(o))||(this[Dg]=n,wg(this,"color-changed",{value:n}))}[Eg](e){return this.color&&this.colorModel.equal(e,this.color)}[Tg](e){this[Sg]=e,this[Bg].forEach((t=>t.update(e)))}}const zg={defaultColor:"#000",toHsva:e=>mg(cg(e)),fromHsva:({h:e,s:t,v:o})=>gg(hg({h:e,s:t,v:o,a:1})),equal:(e,t)=>e.toLowerCase()===t.toLowerCase()||fg(cg(e),cg(t)),fromAttr:e=>e};class Mg extends Rg{get colorModel(){return zg}}customElements.define("hex-color-picker",class extends Mg{});var Ng=o(2191),Fg={attributes:{"data-cke":!0}};Fg.setAttributes=Wr(),Fg.insert=qr().bind(null,"head"),Fg.domAPI=Lr(),Fg.insertStyleElement=Ur();Or()(Ng.Z,Fg);Ng.Z&&Ng.Z.locals&&Ng.Z.locals;class Og{constructor(e){this._components=new Map,this.editor=e}*names(){for(const e of this._components.values())yield e.originalName}add(e,t){this._components.set(Vg(e),{callback:t,originalName:e})}create(e){if(!this.has(e))throw new f("componentfactory-item-missing",this,{name:e});return this._components.get(Vg(e)).callback(this.editor.locale)}has(e){return this._components.has(Vg(e))}}function Vg(e){return String(e).toLowerCase()}var Lg=o(8245),jg={attributes:{"data-cke":!0}};jg.setAttributes=Wr(),jg.insert=qr().bind(null,"head"),jg.domAPI=Lr(),jg.insertStyleElement=Ur();Or()(Lg.Z,jg);Lg.Z&&Lg.Z.locals&&Lg.Z.locals;const qg=Hn("px"),Hg=In.document.body;class Wg extends Sh{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.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",qg),left:t.to("left",qg)}},children:this.content})}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(e){this.show();const t=Wg.defaultPositions,o=Object.assign({},{element:this.element,positions:[t.southArrowNorth,t.southArrowNorthMiddleWest,t.southArrowNorthMiddleEast,t.southArrowNorthWest,t.southArrowNorthEast,t.northArrowSouth,t.northArrowSouthMiddleWest,t.northArrowSouthMiddleEast,t.northArrowSouthWest,t.northArrowSouthEast,t.viewportStickyNorth],limiter:Hg,fitInViewport:!0},e),n=Wg._getOptimalPosition(o),r=parseInt(n.left),i=parseInt(n.top),s=n.name,a=n.config||{},{withArrow:l=!0}=a;this.top=i,this.left=r,this.position=s,this.withArrow=l}pin(e){this.unpin(),this._pinWhenIsVisibleCallback=()=>{this.isVisible?this._startPinning(e):this._stopPinning()},this._startPinning(e),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){this.attachTo(e);const t=$g(e.target),o=e.limiter?$g(e.limiter):Hg;this.listenTo(In.document,"scroll",((n,r)=>{const i=r.target,s=t&&i.contains(t),a=o&&i.contains(o);!s&&!a&&t&&o||this.attachTo(e)}),{useCapture:!0}),this.listenTo(In.window,"resize",(()=>{this.attachTo(e)}))}_stopPinning(){this.stopListening(In.document,"scroll"),this.stopListening(In.window,"resize")}}function $g(e){return _n(e)?e:zn(e)?e.commonAncestorContainer:"function"==typeof e?$g(e()):null}function Ug(e={}){const{sideOffset:t=Wg.arrowSideOffset,heightOffset:o=Wg.arrowHeightOffset,stickyVerticalOffset:n=Wg.stickyVerticalOffset,config:r}=e;return{northWestArrowSouthWest:(e,o)=>({top:i(e,o),left:e.left-t,name:"arrow_sw",...r&&{config:r}}),northWestArrowSouthMiddleWest:(e,o)=>({top:i(e,o),left:e.left-.25*o.width-t,name:"arrow_smw",...r&&{config:r}}),northWestArrowSouth:(e,t)=>({top:i(e,t),left:e.left-t.width/2,name:"arrow_s",...r&&{config:r}}),northWestArrowSouthMiddleEast:(e,o)=>({top:i(e,o),left:e.left-.75*o.width+t,name:"arrow_sme",...r&&{config:r}}),northWestArrowSouthEast:(e,o)=>({top:i(e,o),left:e.left-o.width+t,name:"arrow_se",...r&&{config:r}}),northArrowSouthWest:(e,o)=>({top:i(e,o),left:e.left+e.width/2-t,name:"arrow_sw",...r&&{config:r}}),northArrowSouthMiddleWest:(e,o)=>({top:i(e,o),left:e.left+e.width/2-.25*o.width-t,name:"arrow_smw",...r&&{config:r}}),northArrowSouth:(e,t)=>({top:i(e,t),left:e.left+e.width/2-t.width/2,name:"arrow_s",...r&&{config:r}}),northArrowSouthMiddleEast:(e,o)=>({top:i(e,o),left:e.left+e.width/2-.75*o.width+t,name:"arrow_sme",...r&&{config:r}}),northArrowSouthEast:(e,o)=>({top:i(e,o),left:e.left+e.width/2-o.width+t,name:"arrow_se",...r&&{config:r}}),northEastArrowSouthWest:(e,o)=>({top:i(e,o),left:e.right-t,name:"arrow_sw",...r&&{config:r}}),northEastArrowSouthMiddleWest:(e,o)=>({top:i(e,o),left:e.right-.25*o.width-t,name:"arrow_smw",...r&&{config:r}}),northEastArrowSouth:(e,t)=>({top:i(e,t),left:e.right-t.width/2,name:"arrow_s",...r&&{config:r}}),northEastArrowSouthMiddleEast:(e,o)=>({top:i(e,o),left:e.right-.75*o.width+t,name:"arrow_sme",...r&&{config:r}}),northEastArrowSouthEast:(e,o)=>({top:i(e,o),left:e.right-o.width+t,name:"arrow_se",...r&&{config:r}}),southWestArrowNorthWest:e=>({top:s(e),left:e.left-t,name:"arrow_nw",...r&&{config:r}}),southWestArrowNorthMiddleWest:(e,o)=>({top:s(e),left:e.left-.25*o.width-t,name:"arrow_nmw",...r&&{config:r}}),southWestArrowNorth:(e,t)=>({top:s(e),left:e.left-t.width/2,name:"arrow_n",...r&&{config:r}}),southWestArrowNorthMiddleEast:(e,o)=>({top:s(e),left:e.left-.75*o.width+t,name:"arrow_nme",...r&&{config:r}}),southWestArrowNorthEast:(e,o)=>({top:s(e),left:e.left-o.width+t,name:"arrow_ne",...r&&{config:r}}),southArrowNorthWest:e=>({top:s(e),left:e.left+e.width/2-t,name:"arrow_nw",...r&&{config:r}}),southArrowNorthMiddleWest:(e,o)=>({top:s(e),left:e.left+e.width/2-.25*o.width-t,name:"arrow_nmw",...r&&{config:r}}),southArrowNorth:(e,t)=>({top:s(e),left:e.left+e.width/2-t.width/2,name:"arrow_n",...r&&{config:r}}),southArrowNorthMiddleEast:(e,o)=>({top:s(e),left:e.left+e.width/2-.75*o.width+t,name:"arrow_nme",...r&&{config:r}}),southArrowNorthEast:(e,o)=>({top:s(e),left:e.left+e.width/2-o.width+t,name:"arrow_ne",...r&&{config:r}}),southEastArrowNorthWest:e=>({top:s(e),left:e.right-t,name:"arrow_nw",...r&&{config:r}}),southEastArrowNorthMiddleWest:(e,o)=>({top:s(e),left:e.right-.25*o.width-t,name:"arrow_nmw",...r&&{config:r}}),southEastArrowNorth:(e,t)=>({top:s(e),left:e.right-t.width/2,name:"arrow_n",...r&&{config:r}}),southEastArrowNorthMiddleEast:(e,o)=>({top:s(e),left:e.right-.75*o.width+t,name:"arrow_nme",...r&&{config:r}}),southEastArrowNorthEast:(e,o)=>({top:s(e),left:e.right-o.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-o,name:"arrow_e",...r&&{config:r}}),eastArrowWest:(e,t)=>({top:e.top+e.height/2-t.height/2,left:e.right+o,name:"arrow_w",...r&&{config:r}}),viewportStickyNorth:(e,t,o)=>e.getIntersection(o)?{top:o.top+n,left:e.left+e.width/2-t.width/2,name:"arrowless",config:{withArrow:!1,...r}}:null};function i(e,t){return e.top-t.height-o}function s(e){return e.bottom+o}}Wg.arrowSideOffset=25,Wg.arrowHeightOffset=10,Wg.stickyVerticalOffset=20,Wg._getOptimalPosition=Kn,Wg.defaultPositions=Ug();var Gg=o(9948),Kg={attributes:{"data-cke":!0}};Kg.setAttributes=Wr(),Kg.insert=qr().bind(null,"head"),Kg.domAPI=Lr(),Kg.insertStyleElement=Ur();Or()(Gg.Z,Kg);Gg.Z&&Gg.Z.locals&&Gg.Z.locals;const Zg="ck-tooltip";class Jg extends(Dn()){constructor(e){if(super(),this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this._resizeObserver=null,Jg._editors.add(e),Jg._instance)return Jg._instance;Jg._instance=this,this.tooltipTextView=new Sh(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 Wg(e.locale),this.balloonPanelView.class=Zg,this.balloonPanelView.content.add(this.tooltipTextView),this._pinTooltipDebounced=La(this._pinTooltip,600),this.listenTo(In.document,"mouseenter",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(In.document,"mouseleave",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(In.document,"focus",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(In.document,"blur",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(In.document,"scroll",this._onScroll.bind(this),{useCapture:!0}),this._watchdogExcluded=!0}destroy(e){const t=e.ui.view&&e.ui.view.body;Jg._editors.delete(e),this.stopListening(e.ui),t&&t.has(this.balloonPanelView)&&t.remove(this.balloonPanelView),Jg._editors.size||(this._unpinTooltip(),this.balloonPanelView.destroy(),this.stopListening(),Jg._instance=null)}static getPositioningFunctions(e){const t=Jg.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]}_onEnterOrFocus(e,{target:t}){const o=Qg(t);var n;o&&(o!==this._currentElementWithTooltip&&(this._unpinTooltip(),this._pinTooltipDebounced(o,{text:(n=o).dataset.ckeTooltipText,position:n.dataset.ckeTooltipPosition||"s",cssClass:n.dataset.ckeTooltipClass||""})))}_onLeaveOrBlur(e,{target:t,relatedTarget:o}){if("mouseleave"===e.name){if(!_n(t))return;if(this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;const e=Qg(t),n=Qg(o);e&&e!==n&&this._unpinTooltip()}else{if(this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;this._unpinTooltip()}}_onScroll(e,{target:t}){this._currentElementWithTooltip&&(t.contains(this.balloonPanelView.element)&&t.contains(this._currentElementWithTooltip)||this._unpinTooltip())}_pinTooltip(e,{text:t,position:o,cssClass:n}){const r=yr(Jg._editors.values()).ui.view.body;r.has(this.balloonPanelView)||r.add(this.balloonPanelView),this.tooltipTextView.text=t,this.balloonPanelView.pin({target:e,positions:Jg.getPositioningFunctions(o)}),this._resizeObserver=new jn(e,(()=>{Gn(e)||this._unpinTooltip()})),this.balloonPanelView.class=[Zg,n].filter((e=>e)).join(" ");for(const e of Jg._editors)this.listenTo(e.ui,"update",this._updateTooltipPosition.bind(this),{priority:"low"});this._currentElementWithTooltip=e,this._currentTooltipPosition=o}_unpinTooltip(){this._pinTooltipDebounced.cancel(),this.balloonPanelView.unpin();for(const e of Jg._editors)this.stopListening(e.ui,"update");this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this._resizeObserver&&this._resizeObserver.destroy()}_updateTooltipPosition(){Gn(this._currentElementWithTooltip)?this.balloonPanelView.pin({target:this._currentElementWithTooltip,positions:Jg.getPositioningFunctions(this._currentTooltipPosition)}):this._unpinTooltip()}}function Qg(e){return _n(e)?e.closest("[data-cke-tooltip-text]:not([data-cke-tooltip-disabled])"):null}Jg.defaultBalloonPositions=Ug({heightOffset:5,sideOffset:13}),Jg._editors=new Set,Jg._instance=null;const Yg=50,Xg=350,em="Powered by",tm={top:-99999,left:-99999,name:"invalid",config:{withArrow:!1}};class om extends(Dn()){constructor(e){super(),this.editor=e,this._balloonView=null,this._lastFocusedEditableElement=null,this._showBalloonThrottled=fh(this._showBalloon.bind(this),50,{leading:!0}),e.on("ready",this._handleEditorReady.bind(this))}destroy(){const e=this._balloonView;e&&(e.unpin(),this._balloonView=null),this._showBalloonThrottled.cancel(),this.stopListening()}_handleEditorReady(){const e=this.editor;"VALID"!==function(e){function t(e){return e.match(/^[a-zA-Z0-9+/=$]+$/g)&&e.length>=40&&e.length<=255?"VALID":"INVALID"}let o="",n="";if(!e)return"INVALID";try{o=atob(e)}catch(e){return"INVALID"}const r=o.split("-"),i=r[0],s=r[1];if(!s)return t(e);try{atob(s)}catch(o){try{if(atob(i),!atob(i).length)return t(e)}catch(o){return t(e)}}if(i.length<40||i.length>255)return"INVALID";try{atob(i)}catch(e){return"INVALID"}try{n=atob(s)}catch(e){return"INVALID"}if(8!==n.length)return"INVALID";const a=Number(n.substring(0,4)),l=Number(n.substring(4,6))-1,c=Number(n.substring(6,8)),d=new Date(a,l,c);return d{this._updateLastFocusedEditableElement(),o?this._showBalloon():this._hideBalloon()})),e.ui.focusTracker.on("change:focusedElement",((e,t,o)=>{this._updateLastFocusedEditableElement(),o&&this._showBalloon()})),e.ui.on("update",(()=>{this._showBalloonThrottled()})))}_createBalloonView(){const e=this.editor,t=this._balloonView=new Wg,o=im(e),n=new nm(e.locale,o.label);t.content.add(n),t.set({class:"ck-powered-by-balloon"}),e.ui.view.body.add(t),e.ui.focusTracker.add(t.element),this._balloonView=t}_showBalloon(){if(!this._lastFocusedEditableElement)return;const e=function(e,t){const o=im(e),n="right"===o.side?function(e,t){return rm(e,t,((e,o)=>e.left+e.width-o.width-t.horizontalOffset))}(t,o):function(e,t){return rm(e,t,(e=>e.left+t.horizontalOffset))}(t,o);return{target:t,positions:[n]}}(this.editor,this._lastFocusedEditableElement);e&&(this._balloonView||this._createBalloonView(),this._balloonView.pin(e))}_hideBalloon(){this._balloonView&&this._balloonView.unpin()}_updateLastFocusedEditableElement(){const e=this.editor,t=e.ui.focusTracker.isFocused,o=e.ui.focusTracker.focusedElement;if(!t||!o)return void(this._lastFocusedEditableElement=null);const n=Array.from(e.ui.getEditableElementsNames()).map((t=>e.ui.getEditableElement(t)));n.includes(o)?this._lastFocusedEditableElement=o:this._lastFocusedEditableElement=n[0]}}class nm extends Sh{constructor(e,t){super(e);const o=new Xh,n=this.bindTemplate;o.set({content:' \n',isColorInherited:!1}),o.extendTemplate({attributes:{style:{width:"53px",height:"10px"}}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-powered-by"],"aria-hidden":!0},children:[{tag:"a",attributes:{href:"https://ckeditor.com/?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]}]:[],o],on:{dragstart:n.to((e=>e.preventDefault()))}}]})}}function rm(e,t,o){return(n,r)=>{const i=n.getVisible();if(!i)return tm;if(n.widthe.bottom)return tm}}return{top:s,left:a,name:`position_${t.position}-side_${t.side}`,config:{withArrow:!1}}}}function im(e){const t=e.config.get("ui.poweredBy"),o=t&&t.position||"border";return{position:o,label:em,verticalOffset:"inside"===o?5:0,horizontalOffset:5,side:"ltr"===e.locale.contentLanguageDirection?"right":"left",...t}}class sm extends(H()){constructor(e){super(),this.isReady=!1,this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[],this.editor=e,this.componentFactory=new Og(e),this.focusTracker=new Ar,this.tooltipManager=new Jg(e),this.poweredBy=new om(e),this.set("viewportOffset",this._readViewportOffsetFromConfig()),this.once("ready",(()=>{this.isReady=!0})),this.listenTo(e.editing.view.document,"layoutChanged",(()=>this.update())),this._initFocusTracking()}get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy(),this.tooltipManager.destroy(this.editor),this.poweredBy.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 o=()=>{this.editor.editing.view.getDomRoot(e)||this.editor.keystrokes.listenTo(t)};this.isReady?o():this.once("ready",o)}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.element),this.editor.keystrokes.listenTo(e.element)):e.once("render",(()=>{this.focusTracker.add(e.element),this.editor.keystrokes.listenTo(e.element)})),this._focusableToolbarDefinitions.push({toolbarView:e,options:t})}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}_readViewportOffsetFromConfig(){const e=this.editor,t=e.config.get("ui.viewportOffset");if(t)return t;const o=e.config.get("toolbar.viewportTopOffset");return o?(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:o}):{top:0}}_initFocusTracking(){const e=this.editor,t=e.editing.view;let o,n;e.keystrokes.set("Alt+F10",((e,r)=>{const i=this.focusTracker.focusedElement;Array.from(this._editableElementsMap.values()).includes(i)&&!Array.from(t.domRoots.values()).includes(i)&&(o=i);const s=this._getCurrentFocusedToolbarDefinition();s&&n||(n=this._getFocusableCandidateToolbarDefinitions());for(let e=0;e{const r=this._getCurrentFocusedToolbarDefinition();r&&(o?(o.focus(),o=null):e.editing.view.focus(),r.options.afterBlur&&r.options.afterBlur(),n())}))}_getFocusableCandidateToolbarDefinitions(){const e=[];for(const t of this._focusableToolbarDefinitions){const{toolbarView:o,options:n}=t;(Gn(o.element)||n.beforeFocus)&&e.push(t)}return e.sort(((e,t)=>am(e)-am(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:o}}=e;return o&&o(),!!Gn(t.element)&&(t.focus(),!0)}}function am(e){const{toolbarView:t,options:o}=e;let n=10;return Gn(t.element)&&n--,o.isContextual&&n--,n}var lm=o(4547),cm={attributes:{"data-cke":!0}};cm.setAttributes=Wr(),cm.insert=qr().bind(null,"head"),cm.domAPI=Lr(),cm.insertStyleElement=Ur();Or()(lm.Z,cm);lm.Z&&lm.Z.locals&&lm.Z.locals;class dm extends Sh{constructor(e){super(e),this.body=new Jh(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}class um extends Sh{constructor(e,t,o){super(e),this.name=null,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=o,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((o=>{const n=e.document.getRoot(t.name);o.addClass(t.isFocused?"ck-focused":"ck-blurred",n),o.removeClass(t.isFocused?"ck-blurred":"ck-focused",n)}))}e.isRenderingInProgress?function o(n){e.once("change:isRenderingInProgress",((e,r,i)=>{i?o(n):t(n)}))}(this):t(this)}}class hm extends um{constructor(e,t,o,n={}){super(e,t,o);const r=e.t;this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}}),this._generateLabel=n.label||(()=>r("Editor editing area: %0",this.name))}render(){super.render();const e=this._editingView;e.change((t=>{const o=e.document.getRoot(this.name);t.setAttribute("aria-label",this._generateLabel(this),o)}))}}var pm=o(5523),gm={attributes:{"data-cke":!0}};gm.setAttributes=Wr(),gm.insert=qr().bind(null,"head"),gm.domAPI=Lr(),gm.insertStyleElement=Ur();Or()(pm.Z,gm);pm.Z&&pm.Z.locals&&pm.Z.locals;class mm extends Sh{constructor(e,t={}){super(e);const o=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",o.to("class")]},children:this.children});const n=new Sh(e);n.setTemplate({tag:"h2",attributes:{class:["ck","ck-form__header__label"]},children:[{text:o.to("label")}]}),this.children.add(n)}}class fm extends Nr{static get pluginName(){return"Notification"}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 bm extends(H()){constructor(e,t){super(),t&&va(this,t),e&&this.set(e)}}var km=o(1757),wm={attributes:{"data-cke":!0}};wm.setAttributes=Wr(),wm.insert=qr().bind(null,"head"),wm.domAPI=Lr(),wm.insertStyleElement=Ur();Or()(km.Z,wm);km.Z&&km.Z.locals&&km.Z.locals;var _m=o(3553),ym={attributes:{"data-cke":!0}};ym.setAttributes=Wr(),ym.insert=qr().bind(null,"head"),ym.domAPI=Lr(),ym.insertStyleElement=Ur();Or()(_m.Z,ym);_m.Z&&_m.Z.locals&&_m.Z.locals;const Am=Hn("px");class Cm extends Br{static get pluginName(){return"ContextualBalloon"}constructor(e){super(e),this._viewToStack=new Map,this._idToStack=new Map,this._view=null,this._rotatorView=null,this._fakePanelsView=null,this.positionLimiter=()=>{const e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},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 f("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 o=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),o.set(e.view,e),this._viewToStack.set(e.view,o),o===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new f("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._getBalloonPosition()),this._fakePanelsView.updatePosition()}showStack(e){this.visibleStack=e;const t=this._idToStack.get(e);if(!t)throw new f("contextualballoon-showstack-stack-not-exist",this);this._visibleStack!==t&&this._showView(Array.from(t.values()).pop())}_createPanelView(){this._view=new Wg(this.editor.locale),this.editor.ui.view.body.add(this._view),this.editor.ui.focusTracker.add(this._view.element),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 vm(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,o)=>{if(o<2)return"";const n=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("%0 of %1",[n,o])})),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 xm(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:o=!0,singleViewMode:n=!1}){this.view.class=t,this.view.withArrow=o,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition(),n&&(this._singleViewMode=!0)}_getBalloonPosition(){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}}class vm extends Sh{constructor(e){super(e);const t=e.t,o=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new Ar,this.buttonPrevView=this._createButtonView(t("Previous"),' '),this.buttonNextView=this._createButtonView(t("Next"),' '),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",o.to("isNavigationVisible",(e=>e?"":"ck-hidden"))]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:o.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 o=new op(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o}}class xm extends Sh{constructor(e,t){super(e);const o=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",o.to("numberOfPanels",(e=>e?"":"ck-hidden"))],style:{top:o.to("top",Am),left:o.to("left",Am),width:o.to("width",Am),height:o.to("height",Am)}},children:this.content}),this.on("change:numberOfPanels",((e,t,o,n)=>{o>n?this._addPanels(o-n):this._removePanels(n-o),this.updatePosition()}))}_addPanels(e){for(;e--;){const e=new Sh;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:o,height:n}=new Fn(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:o,height:n})}}}var Em=o(3609),Dm={attributes:{"data-cke":!0}};Dm.setAttributes=Wr(),Dm.insert=qr().bind(null,"head"),Dm.domAPI=Lr(),Dm.insertStyleElement=Ur();Or()(Em.Z,Dm);Em.Z&&Em.Z.locals&&Em.Z.locals,Hn("px");Hn("px");var Sm=o(6706),Tm={attributes:{"data-cke":!0}};Tm.setAttributes=Wr(),Tm.insert=qr().bind(null,"head"),Tm.domAPI=Lr(),Tm.insertStyleElement=Ur();Or()(Sm.Z,Tm);Sm.Z&&Sm.Z.locals&&Sm.Z.locals,Hn("px");Hn("px");const{pilcrow:Bm}=uh;class Im extends sm{constructor(e,t){super(e),this.view=t}init(){const e=this.editor,t=this.view,o=e.editing.view,n=t.editable,r=o.document.getRoot();n.name=r.rootName,t.render();const i=n.element;this.setEditableElement(n.name,i),t.editable.bind("isFocused").to(this.focusTracker),o.attachDomRoot(i),this._initPlaceholder(),this._initToolbar(),this.fire("ready")}destroy(){super.destroy();const e=this.view;this.editor.editing.view.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){const e=this.editor,t=this.view;t.toolbar.fillFromConfig(e.config.get("toolbar"),this.componentFactory),this.addToolbar(t.toolbar)}_initPlaceholder(){const e=this.editor,t=e.editing.view,o=t.document.getRoot(),n=(e.sourceElement,e.config.get("placeholder"));if(n){const e="string"==typeof n?n:n[o.rootName];e&&Jr({view:t,element:o,text:e,isDirectHost:!1,keepOnFocus:!0})}}}class Pm extends dm{constructor(e,t,o={}){super(e);const n=e.t;this.toolbar=new Fp(e,{shouldGroupWhenFull:o.shouldToolbarGroupWhenFull}),this.editable=new hm(e,t,o.editableElement,{label:e=>n("Rich Text Editor. Editing area: %0",e.name)}),this.toolbar.extendTemplate({attributes:{class:["ck-reset_all","ck-rounded-corners"],dir:e.uiLanguageDirection}})}render(){super.render(),this.registerChild([this.toolbar,this.editable])}}class Rm extends(lh(ch(ah))){constructor(e,t={}){if(!zm(e)&&void 0!==t.initialData)throw new f("editor-create-initial-data",null);super(t),void 0===this.config.get("initialData")&&this.config.set("initialData",function(e){return zm(e)?(t=e,t instanceof HTMLTextAreaElement?t.value:t.innerHTML):e;var t}(e)),zm(e)&&(this.sourceElement=e,function(e,t){if(t.ckeditorInstance)throw new f("editor-source-element-already-used",e);t.ckeditorInstance=e,e.once("destroy",(()=>{delete t.ckeditorInstance}))}(this,e)),this.model.document.createRoot();const o=!this.config.get("toolbar.shouldNotGroupWhenFull"),n=new Pm(this.locale,this.editing.view,{editableElement:this.sourceElement,shouldToolbarGroupWhenFull:o});this.ui=new Im(this,n)}destroy(){const e=this.getData();return this.ui.destroy(),super.destroy().then((()=>{this.sourceElement&&this.updateSourceElement(e)}))}static create(e,t={}){return new Promise((o=>{if(zm(e)&&"TEXTAREA"===e.tagName)throw new f("editor-wrong-element",null);const n=new this(e,t);o(n.initPlugins().then((()=>n.ui.init())).then((()=>n.data.init(n.config.get("initialData")))).then((()=>n.fire("ready"))).then((()=>n)))}))}}function zm(e){return _n(e)}Rm.Context=Mr,Rm.EditorWatchdog=bh,Rm.ContextWatchdog=class extends hh{constructor(e,t={}){super(t),this._watchdogs=new Map,this._context=null,this._contextProps=new Set,this._actionQueues=new wh,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(kh,(()=>(this._contextConfig=e,this._create())))}getItem(e){return this._getWatchdog(e)._item}getItemState(e){return this._getWatchdog(e).state}add(e){const t=_h(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 bh(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",((o,{error:n,causesRestart:r})=>{this._fire("itemError",{itemId:e.id,error:n}),r&&this._actionQueues.enqueue(e.id,(()=>new Promise((o=>{const n=()=>{t.off("restart",n),this._fire("itemRestart",{itemId:e.id}),o()};t.on("restart",n)}))))})),t.create(e.sourceElementOrData,e.config,this._context);throw new Error(`Not supported item type: '${e.type}'.`)})))))}remove(e){const t=_h(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(kh,(()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy())))}_restart(){return this._actionQueues.enqueue(kh,(()=>(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=ph(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 mh(this._context,e.context)}};class Mm extends(S()){constructor(){super(...arguments),this._stack=[]}add(e,t){const o=this._stack,n=o[0];this._insertDescriptor(e);const r=o[0];n===r||Nm(n,r)||this.fire("change:top",{oldDescriptor:n,newDescriptor:r,writer:t})}remove(e,t){const o=this._stack,n=o[0];this._removeDescriptor(e);const r=o[0];n===r||Nm(n,r)||this.fire("change:top",{oldDescriptor:n,newDescriptor:r,writer:t})}_insertDescriptor(e){const t=this._stack,o=t.findIndex((t=>t.id===e.id));if(Nm(e,t[o]))return;o>-1&&t.splice(o,1);let n=0;for(;t[n]&&Fm(t[n],e);)n++;t.splice(n,0,e)}_removeDescriptor(e){const t=this._stack,o=t.findIndex((t=>t.id===e));o>-1&&t.splice(o,1)}}function Nm(e,t){return e&&t&&e.priority==t.priority&&Om(e.classes)==Om(t.classes)}function Fm(e,t){return e.priority>t.priority||!(e.priorityOm(t.classes)}function Om(e){return Array.isArray(e)?e.sort().join(","):e}const Vm="widget-type-around";function Lm(e,t,o){return!!e&&$m(e)&&!o.isInline(t)}function jm(e){return e.getAttribute(Vm)}const qm=' ',Hm="ck-widget",Wm="ck-widget_selected";function $m(e){return!!e.is("element")&&!!e.getCustomProperty("widget")}function Um(e,t,o={}){if(!e.is("containerElement"))throw new f("widget-to-widget-wrong-element-type",null,{element:e});return t.setAttribute("contenteditable","false",e),t.addClass(Hm,e),t.setCustomProperty("widget",!0,e),e.getFillerOffset=Qm,t.setCustomProperty("widgetLabel",[],e),o.label&&function(e,t){const o=e.getCustomProperty("widgetLabel");o.push(t)}(e,o.label),o.hasSelectionHandle&&function(e,t){const o=t.createUIElement("div",{class:"ck ck-widget__selection-handle"},(function(e){const t=this.toDomElement(e),o=new Xh;return o.set("content",qm),o.render(),t.appendChild(o.element),t}));t.insert(t.createPositionAt(e,0),o),t.addClass(["ck-widget_with-selection-handle"],e)}(e,t),Zm(e,t),e}function Gm(e,t,o){if(t.classes&&o.addClass(mr(t.classes),e),t.attributes)for(const n in t.attributes)o.setAttribute(n,t.attributes[n],e)}function Km(e,t,o){if(t.classes&&o.removeClass(mr(t.classes),e),t.attributes)for(const n in t.attributes)o.removeAttribute(n,e)}function Zm(e,t,o=Gm,n=Km){const r=new Mm;r.on("change:top",((t,r)=>{r.oldDescriptor&&n(e,r.oldDescriptor,r.writer),r.newDescriptor&&o(e,r.newDescriptor,r.writer)}));t.setCustomProperty("addHighlight",((e,t,o)=>r.add(t,o)),e),t.setCustomProperty("removeHighlight",((e,t,o)=>r.remove(t,o)),e)}function Jm(e,t,o={}){return t.addClass(["ck-editor__editable","ck-editor__nested-editable"],e),t.setAttribute("role","textbox",e),o.label&&t.setAttribute("aria-label",o.label,e),t.setAttribute("contenteditable",e.isReadOnly?"false":"true",e),e.on("change:isReadOnly",((o,n,r)=>{t.setAttribute("contenteditable",r?"false":"true",e)})),e.on("change:isFocused",((o,n,r)=>{r?t.addClass("ck-editor__nested-editable_focused",e):t.removeClass("ck-editor__nested-editable_focused",e)})),Zm(e,t),e}function Qm(){return null}class Ym extends Br{static get pluginName(){return"OPMacroToc"}static get buttonName(){return"insertToc"}init(){const e=this.editor,t=e.model,o=e.conversion;t.schema.register("op-macro-toc",{allowWhere:"$block",isBlock:!0,isLimit:!0}),o.for("upcast").elementToElement({view:{name:"macro",classes:"toc"},model:"op-macro-toc"}),o.for("editingDowncast").elementToElement({model:"op-macro-toc",view:(e,{writer:t})=>Um(this.createTocViewElement(t),t,{label:this.label})}),o.for("dataDowncast").elementToElement({model:"op-macro-toc",view:(e,{writer:t})=>this.createTocDataElement(t)}),e.ui.componentFactory.add(Ym.buttonName,(t=>{const o=new op(t);return o.set({label:this.label,withText:!0}),o.on("execute",(()=>{e.model.change((t=>{const o=t.createElement("op-macro-toc",{});e.model.insertContent(o,e.model.document.selection)}))})),o}))}get label(){return window.I18n.t("js.editor.macro.toc")}createTocViewElement(e){const t=e.createText(this.label),o=e.createContainerElement("div");return e.insert(e.createPositionAt(o,0),t),o}createTocDataElement(e){return e.createContainerElement("macro",{class:"toc"})}}const Xm=Symbol("isOPEmbeddedTable");function ef(e){const t=e.getSelectedElement();return!(!t||!function(e){return!!e.getCustomProperty(Xm)&&$m(e)}(t))}function tf(e){return _.get(e.config,"_config.openProject.context.resource")}function of(e){return _.get(e.config,"_config.openProject.pluginContext")}function nf(e,t){return of(e).services[t]}function rf(e){return nf(e,"pathHelperService")}class sf extends Br{static get pluginName(){return"EmbeddedTableEditing"}static get buttonName(){return"insertEmbeddedTable"}init(){const e=this.editor,t=e.model,o=e.conversion,n=of(e);this.text={button:window.I18n.t("js.editor.macro.embedded_table.button"),macro_text:window.I18n.t("js.editor.macro.embedded_table.text")},t.schema.register("op-macro-embedded-table",{allowWhere:"$block",allowAttributes:["opEmbeddedTableQuery"],isBlock:!0,isObject:!0}),o.for("upcast").elementToElement({view:{name:"macro",classes:"embedded-table"},model:(e,{writer:t})=>{const o=e.getAttribute("data-query-props");return t.createElement("op-macro-embedded-table",{opEmbeddedTableQuery:o?JSON.parse(o):{}})}}),o.for("editingDowncast").elementToElement({model:"op-macro-embedded-table",view:(e,{writer:t})=>{return o=this.createEmbeddedTableView(t),n=t,this.label,n.setCustomProperty(Xm,!0,o),Um(o,n,{label:"your label here"});var o,n}}),o.for("dataDowncast").elementToElement({model:"op-macro-embedded-table",view:(e,{writer:t})=>this.createEmbeddedTableDataElement(e,t)}),e.ui.componentFactory.add(sf.buttonName,(t=>{const o=new op(t);return o.set({label:this.text.button,withText:!0}),o.on("execute",(()=>n.runInZone((()=>{n.services.externalQueryConfiguration.show({currentQuery:{},callback:t=>e.model.change((o=>{const n=o.createElement("op-macro-embedded-table",{opEmbeddedTableQuery:t});e.model.insertContent(n,e.model.document.selection)}))})})))),o}))}createEmbeddedTableView(e){const t=e.createText(this.text.macro_text),o=e.createContainerElement("div");return e.insert(e.createPositionAt(o,0),t),o}createEmbeddedTableDataElement(e,t){const o=e.getAttribute("opEmbeddedTableQuery")||{};return t.createContainerElement("macro",{class:"embedded-table","data-query-props":JSON.stringify(o)})}}class af{constructor(e,t=20){this._batch=null,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 lf extends Pr{constructor(e,t){super(e),this._buffer=new af(e.model,t),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,o=t.document,n=e.text||"",r=n.length;let i=o.selection;if(e.selection?i=e.selection:e.range&&(i=t.createSelection(e.range)),!t.canEditAt(i))return;const s=e.resultRange;t.enqueueChange(this._buffer.batch,(e=>{this._buffer.lock(),t.deleteContent(i),n&&t.insertContent(e.createText(n,o.selection.getAttributes()),i),s?e.setSelection(s):i.is("documentSelection")||e.setSelection(i),this._buffer.unlock(),this._buffer.input(r)}))}}const cf=["insertText","insertReplacementText"];class df extends Aa{constructor(e){super(e),n.isAndroid&&cf.push("insertCompositionText");const t=e.document;t.on("beforeinput",((o,n)=>{if(!this.isEnabled)return;const{data:r,targetRanges:i,inputType:s,domEvent:a}=n;if(!cf.includes(s))return;const l=new d(t,"insertText");t.fire(l,new xa(e,a,{text:r,selection:e.createSelection(i)})),l.stop.called&&o.stop()})),t.on("compositionend",((o,{data:r,domEvent:i})=>{this.isEnabled&&!n.isAndroid&&r&&t.fire("insertText",new xa(e,i,{text:r,selection:t.selection}))}),{priority:"lowest"})}observe(){}stopObserving(){}}class uf extends Br{static get pluginName(){return"Input"}init(){const e=this.editor,t=e.model,o=e.editing.view,r=t.document.selection;o.addObserver(df);const i=new lf(e,e.config.get("typing.undoStep")||20);e.commands.add("insertText",i),e.commands.add("input",i),this.listenTo(o.document,"insertText",((r,i)=>{o.document.isComposing||i.preventDefault();const{text:s,selection:a,resultRange:l}=i,c=Array.from(a.getRanges()).map((t=>e.editing.mapper.toModelRange(t)));let d=s;if(n.isAndroid){const e=Array.from(c[0].getItems()).reduce(((e,t)=>e+(t.is("$textProxy")?t.data:"")),"");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=""))}const u={text:d,selection:t.createSelection(c)};l&&(u.resultRange=e.editing.mapper.toModelRange(l)),e.execute("insertText",u)})),n.isAndroid?this.listenTo(o.document,"keydown",((e,n)=>{!r.isCollapsed&&229==n.keyCode&&o.document.isComposing&&hf(t,i)})):this.listenTo(o.document,"compositionstart",(()=>{r.isCollapsed||hf(t,i)}))}}function hf(e,t){if(!t.isEnabled)return;const o=t.buffer;o.lock(),e.enqueueChange(o.batch,(()=>{e.deleteContent(e.document.selection)})),o.unlock()}class pf extends Pr{constructor(e,t){super(e),this.direction=t,this._buffer=new af(e.model,e.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,o=t.document;t.enqueueChange(this._buffer.batch,(n=>{this._buffer.lock();const r=n.createSelection(e.selection||o.selection);if(!t.canEditAt(r))return;const i=e.sequence||1,s=r.isCollapsed;if(r.isCollapsed&&t.modifySelection(r,{direction:this.direction,unit:e.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(i))return void this._replaceEntireContentWithParagraph(n);if(this._shouldReplaceFirstBlockWithParagraph(r,i))return void this.editor.execute("paragraph",{selection:r});if(r.isCollapsed)return;let a=0;r.getFirstRange().getMinimalFlatRanges().forEach((e=>{a+=Z(e.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))})),t.deleteContent(r,{doNotResetEntireContent:s,direction:this.direction}),this._buffer.input(a),n.setSelection(r),this._buffer.unlock()}))}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,o=t.document.selection,n=t.schema.getLimitElement(o);if(!(o.isCollapsed&&o.containsEntireContent(n)))return!1;if(!t.schema.checkChild(n,"paragraph"))return!1;const r=n.getChild(0);return!r||!r.is("element","paragraph")}_replaceEntireContentWithParagraph(e){const t=this.editor.model,o=t.document.selection,n=t.schema.getLimitElement(o),r=e.createElement("paragraph");e.remove(e.createRangeIn(n)),e.insert(r,n),e.setSelection(r,0)}_shouldReplaceFirstBlockWithParagraph(e,t){const o=this.editor.model;if(t>1||"backward"!=this.direction)return!1;if(!e.isCollapsed)return!1;const n=e.getFirstPosition(),r=o.schema.getLimitElement(n),i=r.getChild(0);return n.parent==i&&(!!e.containsEntireContent(i)&&(!!o.schema.checkChild(r,"paragraph")&&"paragraph"!=i.name))}}const gf="word",mf="selection",ff="backward",bf="forward",kf={deleteContent:{unit:mf,direction:ff},deleteContentBackward:{unit:"codePoint",direction:ff},deleteWordBackward:{unit:gf,direction:ff},deleteHardLineBackward:{unit:mf,direction:ff},deleteSoftLineBackward:{unit:mf,direction:ff},deleteContentForward:{unit:"character",direction:bf},deleteWordForward:{unit:gf,direction:bf},deleteHardLineForward:{unit:mf,direction:bf},deleteSoftLineForward:{unit:mf,direction:bf}};class wf extends Aa{constructor(e){super(e);const t=e.document;let o=0;t.on("keydown",(()=>{o++})),t.on("keyup",(()=>{o=0})),t.on("beforeinput",((r,i)=>{if(!this.isEnabled)return;const{targetRanges:s,domEvent:a,inputType:l}=i,c=kf[l];if(!c)return;const d={direction:c.direction,unit:c.unit,sequence:o};d.unit==mf&&(d.selectionToRemove=e.createSelection(s[0])),"deleteContentBackward"===l&&(n.isAndroid&&(d.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 o=0;for(const{nextPosition:e}of t){if(e.parent.is("$text")){const t=e.parent.data,n=e.offset;if(Er(t,n)||Dr(t,n)||Tr(t,n))continue;o++}else o++;if(o>1)return!0}return!1}(s)&&(d.unit=mf,d.selectionToRemove=e.createSelection(s)));const u=new _s(t,"delete",s[0]);t.fire(u,new xa(e,a,d)),u.stop.called&&r.stop()})),n.isBlink&&function(e){const t=e.view,o=t.document;let n=null,r=!1;function i(e){return e==cr.backspace||e==cr.delete}function s(e){return e==cr.backspace?ff:bf}o.on("keydown",((e,{keyCode:t})=>{n=t,r=!1})),o.on("keyup",((a,{keyCode:l,domEvent:c})=>{const d=o.selection,u=e.isEnabled&&l==n&&i(l)&&!d.isCollapsed&&!r;if(n=null,u){const e=d.getFirstRange(),n=new _s(o,"delete",e),r={unit:mf,direction:s(l),selectionToRemove:d};o.fire(n,new xa(t,c,r))}})),o.on("beforeinput",((e,{inputType:t})=>{const o=kf[t];i(n)&&o&&o.direction==s(n)&&(r=!0)}),{priority:"high"}),o.on("beforeinput",((e,{inputType:t,data:o})=>{n==cr.delete&&"insertText"==t&&""==o&&e.stop()}),{priority:"high"})}(this)}observe(){}stopObserving(){}}class _f extends Br{static get pluginName(){return"Delete"}init(){const e=this.editor,t=e.editing.view,o=t.document,n=e.model.document;t.addObserver(wf),this._undoOnBackspace=!1;const r=new pf(e,"forward");e.commands.add("deleteForward",r),e.commands.add("forwardDelete",r),e.commands.add("delete",new pf(e,"backward")),this.listenTo(o,"delete",((n,r)=>{o.isComposing||r.preventDefault();const{direction:i,sequence:s,selectionToRemove:a,unit:l}=r,c="forward"===i?"deleteForward":"delete",d={sequence:s};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(o,"delete",((t,o)=>{this._undoOnBackspace&&"backward"==o.direction&&1==o.sequence&&"codePoint"==o.unit&&(this._undoOnBackspace=!1,e.execute("undo"),o.preventDefault(),t.stop())}),{context:"$capture"}),this.listenTo(n,"change",(()=>{this._undoOnBackspace=!1})))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class yf extends Br{static get requires(){return[uf,_f]}static get pluginName(){return"Typing"}}function Af(e,t){let o=e.start;return{text:Array.from(e.getItems()).reduce(((e,n)=>n.is("$text")||n.is("$textProxy")?e+n.data:(o=t.createPositionAfter(n),"")),""),range:t.createRange(o,e.end)}}class Cf extends(H()){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:o})=>{o&&(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 o=this.model,n=o.document.selection,r=o.createRange(o.createPositionAt(n.focus.parent,0),n.focus),{text:i,range:s}=Af(r,o),a=this.testCallback(i);if(!a&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!a,a){const o=Object.assign(t,{text:i,range:s});"object"==typeof a&&Object.assign(o,a),this.fire(`matched:${e}`,o)}}}class vf extends Br{static get pluginName(){return"TwoStepCaretMovement"}constructor(e){super(e),this.attributes=new Set,this._overrideUid=null}init(){const e=this.editor,t=e.model,o=e.editing.view,n=e.locale,r=t.document.selection;this.listenTo(o.document,"arrowKey",((e,t)=>{if(!r.isCollapsed)return;if(t.shiftKey||t.altKey||t.ctrlKey)return;const o=t.keyCode==cr.arrowright,i=t.keyCode==cr.arrowleft;if(!o&&!i)return;const s=n.contentLanguageDirection;let a=!1;a="ltr"===s&&o||"rtl"===s&&i?this._handleForwardMovement(t):this._handleBackwardMovement(t),!0===a&&e.stop()}),{context:"$text",priority:"highest"}),this._isNextGravityRestorationSkipped=!1,this.listenTo(r,"change:range",((e,t)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!t.directChange&&Sf(r.getFirstPosition(),this.attributes)||this._restoreGravity())}))}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,o=this.editor.model.document.selection,n=o.getFirstPosition();return!this._isGravityOverridden&&((!n.isAtStart||!xf(o,t))&&(!!Sf(n,t)&&(Df(e),this._overrideGravity(),!0)))}_handleBackwardMovement(e){const t=this.attributes,o=this.editor.model,n=o.document.selection,r=n.getFirstPosition();return this._isGravityOverridden?(Df(e),this._restoreGravity(),Ef(o,t,r),!0):r.isAtStart?!!xf(n,t)&&(Df(e),Ef(o,t,r),!0):!!function(e,t){const o=e.getShiftedBy(-1);return Sf(o,t)}(r,t)&&(r.isAtEnd&&!xf(n,t)&&Sf(r,t)?(Df(e),Ef(o,t,r),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1))}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 xf(e,t){for(const o of t)if(e.hasAttribute(o))return!0;return!1}function Ef(e,t,o){const n=o.nodeBefore;e.change((e=>{n?e.setSelectionAttribute(n.getAttributes()):e.removeSelectionAttribute(t)}))}function Df(e){e.preventDefault()}function Sf(e,t){const{nodeBefore:o,nodeAfter:n}=e;for(const e of t){const t=o?o.getAttribute(e):void 0;if((n?n.getAttribute(e):void 0)!==t)return!0}return!1}Tf('"'),Tf("'"),Tf("'"),Tf('"'),Tf('"'),Tf("'");function Tf(e){return new RegExp(`(^|\\s)(${e})([^${e}]*)(${e})$`)}function Bf(e,t,o,n){return n.createRange(If(e,t,o,!0,n),If(e,t,o,!1,n))}function If(e,t,o,n,r){let i=e.textNode||(n?e.nodeBefore:e.nodeAfter),s=null;for(;i&&i.getAttribute(t)==o;)s=i,i=n?i.previousSibling:i.nextSibling;return s?r.createPositionAt(s,n?"before":"after"):e}function Pf(e,t,o,n){const r=e.editing.view,i=new Set;r.document.registerPostFixer((r=>{const s=e.model.document.selection;let a=!1;if(s.hasAttribute(t)){const l=Bf(s.getFirstPosition(),t,s.getAttribute(t),e.model),c=e.editing.mapper.toViewRange(l);for(const e of c.getItems())e.is("element",o)&&!e.hasClass(n)&&(r.addClass(n,e),i.add(e),a=!0)}return a})),e.conversion.for("editingDowncast").add((e=>{function t(){r.change((e=>{for(const t of i.values())e.removeClass(n,t),i.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*Rf(e,t){for(const o of t)o&&e.getAttributeProperties(o[0]).copyOnEnter&&(yield o)}class zf extends Pr{execute(){this.editor.model.change((e=>{this.enterBlock(e),this.fire("afterExecute",{writer:e})}))}enterBlock(e){const t=this.editor.model,o=t.document.selection,n=t.schema,r=o.isCollapsed,i=o.getFirstRange(),s=i.start.parent,a=i.end.parent;if(n.isLimit(s)||n.isLimit(a))return r||s!=a||t.deleteContent(o),!1;if(r){const t=Rf(e.model.schema,o.getAttributes());return Mf(e,i.start),e.setSelectionAttribute(t),!0}{const n=!(i.start.isAtStart&&i.end.isAtEnd),r=s==a;if(t.deleteContent(o,{leaveUnmerged:n}),n){if(r)return Mf(e,o.focus),!0;e.setSelection(a,0)}}return!1}}function Mf(e,t){e.split(t),e.setSelection(t.parent.nextSibling,0)}const Nf={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class Ff extends Aa{constructor(e){super(e);const t=this.document;let o=!1;t.on("keydown",((e,t)=>{o=t.shiftKey})),t.on("beforeinput",((r,i)=>{if(!this.isEnabled)return;let s=i.inputType;n.isSafari&&o&&"insertParagraph"==s&&(s="insertLineBreak");const a=i.domEvent,l=Nf[s];if(!l)return;const c=new _s(t,"enter",i.targetRanges[0]);t.fire(c,new xa(e,a,{isSoft:l.isSoft})),c.stop.called&&r.stop()}))}observe(){}stopObserving(){}}class Of extends Br{static get pluginName(){return"Enter"}init(){const e=this.editor,t=e.editing.view,o=t.document;t.addObserver(Ff),e.commands.add("enter",new zf(e)),this.listenTo(o,"enter",((n,r)=>{o.isComposing||r.preventDefault(),r.isSoft||(e.execute("enter"),t.scrollToTheSelection())}),{priority:"low"})}}class Vf extends Pr{execute(){const e=this.editor.model,t=e.document;e.change((o=>{!function(e,t,o){const n=o.isCollapsed,r=o.getFirstRange(),i=r.start.parent,s=r.end.parent,a=i==s;if(n){const n=Rf(e.schema,o.getAttributes());Lf(e,t,r.end),t.removeSelectionAttribute(o.getAttributeKeys()),t.setSelectionAttribute(n)}else{const n=!(r.start.isAtStart&&r.end.isAtEnd);e.deleteContent(o,{leaveUnmerged:n}),a?Lf(e,t,o.focus):n&&t.setSelection(s,0)}}(e,o,t.selection),this.fire("afterExecute",{writer:o})}))}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=function(e,t){if(t.rangeCount>1)return!1;const o=t.anchor;if(!o||!e.checkChild(o,"softBreak"))return!1;const n=t.getFirstRange(),r=n.start.parent,i=n.end.parent;if((jf(r,e)||jf(i,e))&&r!==i)return!1;return!0}(e.schema,t.selection)}}function Lf(e,t,o){const n=t.createElement("softBreak");e.insertContent(n,o),t.setSelection(n,"after")}function jf(e,t){return!e.is("rootElement")&&(t.isLimit(e)||jf(e.parent,t))}class qf extends Br{static get pluginName(){return"ShiftEnter"}init(){const e=this.editor,t=e.model.schema,o=e.conversion,n=e.editing.view,r=n.document;t.register("softBreak",{allowWhere:"$text",isInline:!0}),o.for("upcast").elementToElement({model:"softBreak",view:"br"}),o.for("downcast").elementToElement({model:"softBreak",view:(e,{writer:t})=>t.createEmptyElement("br")}),n.addObserver(Ff),e.commands.add("shiftEnter",new Vf(e)),this.listenTo(r,"enter",((t,o)=>{r.isComposing||o.preventDefault(),o.isSoft&&(e.execute("shiftEnter"),n.scrollToTheSelection())}),{priority:"low"})}}var Hf=o(5137),Wf={attributes:{"data-cke":!0}};Wf.setAttributes=Wr(),Wf.insert=qr().bind(null,"head"),Wf.domAPI=Lr(),Wf.insertStyleElement=Ur();Or()(Hf.Z,Wf);Hf.Z&&Hf.Z.locals&&Hf.Z.locals;const $f=["before","after"],Uf=(new DOMParser).parseFromString(' ',"image/svg+xml").firstChild,Gf="ck-widget__type-around_disabled";class Kf extends Br{constructor(){super(...arguments),this._currentFakeCaretModelElement=null}static get pluginName(){return"WidgetTypeAround"}static get requires(){return[Of,_f]}init(){const e=this.editor,t=e.editing.view;this.on("change:isEnabled",((o,n,r)=>{t.change((e=>{for(const o of t.document.roots)r?e.removeClass(Gf,o):e.addClass(Gf,o)})),r||e.model.change((e=>{e.removeSelectionAttribute(Vm)}))})),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 o=this.editor,n=o.editing.view,r=o.model.schema.getAttributesWithProperty(e,"copyOnReplace",!0);o.execute("insertParagraph",{position:o.model.createPositionAt(e,t),attributes:r}),n.focus(),n.scrollToTheSelection()}_listenToIfEnabled(e,t,o,n){this.listenTo(e,t,((...e)=>{this.isEnabled&&o(...e)}),n)}_insertParagraphAccordingToFakeCaretPosition(){const e=this.editor.model.document.selection,t=jm(e);if(!t)return!1;const o=e.getSelectedElement();return this._insertParagraph(o,t),!0}_enableTypeAroundUIInjection(){const e=this.editor,t=e.model.schema,o=e.locale.t,n={before:o("Insert paragraph before block"),after:o("Insert paragraph after block")};e.editing.downcastDispatcher.on("insert",((e,r,i)=>{const s=i.mapper.toViewElement(r.item);if(s&&Lm(s,r.item,t)){!function(e,t,o){const n=e.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},(function(e){const o=this.toDomElement(e);return function(e,t){for(const o of $f){const n=new Th({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${o}`],title:t[o],"aria-hidden":"true"},children:[e.ownerDocument.importNode(Uf,!0)]});e.appendChild(n.render())}}(o,t),function(e){const t=new Th({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});e.appendChild(t.render())}(o),o}));e.insert(e.createPositionAt(o,"end"),n)}(i.writer,n,s);s.getCustomProperty("widgetLabel").push((()=>this.isEnabled?o("Press Enter to type after or press Shift + Enter to type before the widget"):""))}}),{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const e=this.editor,t=e.model,o=t.document.selection,n=t.schema,r=e.editing.view;function i(e){return`ck-widget_type-around_show-fake-caret_${e}`}this._listenToIfEnabled(r.document,"arrowKey",((e,t)=>{this._handleArrowKeyPress(e,t)}),{context:[$m,"$text"],priority:"high"}),this._listenToIfEnabled(o,"change:range",((t,o)=>{o.directChange&&e.model.change((e=>{e.removeSelectionAttribute(Vm)}))})),this._listenToIfEnabled(t.document,"change:data",(()=>{const t=o.getSelectedElement();if(t){if(Lm(e.editing.mapper.toViewElement(t),t,n))return}e.model.change((e=>{e.removeSelectionAttribute(Vm)}))})),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",((e,t,o)=>{const r=o.writer;if(this._currentFakeCaretModelElement){const e=o.mapper.toViewElement(this._currentFakeCaretModelElement);e&&(r.removeClass($f.map(i),e),this._currentFakeCaretModelElement=null)}const s=t.selection.getSelectedElement();if(!s)return;const a=o.mapper.toViewElement(s);if(!Lm(a,s,n))return;const l=jm(t.selection);l&&(r.addClass(i(l),a),this._currentFakeCaretModelElement=s)})),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",((t,o,n)=>{n||e.model.change((e=>{e.removeSelectionAttribute(Vm)}))}))}_handleArrowKeyPress(e,t){const o=this.editor,n=o.model,r=n.document.selection,i=n.schema,s=o.editing.view,a=function(e,t){const o=gr(e,t);return"down"===o||"right"===o}(t.keyCode,o.locale.contentLanguageDirection),l=s.document.selection.getSelectedElement();let c;Lm(l,o.editing.mapper.toModelElement(l),i)?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,o=jm(t.document.selection);return t.change((t=>{if(!o)return t.setSelectionAttribute(Vm,e?"after":"before"),!0;if(!(o===(e?"after":"before")))return t.removeSelectionAttribute(Vm),!0;return!1}))}_handleArrowKeyPressWhenSelectionNextToAWidget(e){const t=this.editor,o=t.model,n=o.schema,r=t.plugins.get("Widget"),i=r._getObjectElementNextToSelection(e);return!!Lm(t.editing.mapper.toViewElement(i),i,n)&&(o.change((t=>{r._setSelectionOverElement(i),t.setSelectionAttribute(Vm,e?"before":"after")})),!0)}_handleArrowKeyPressWhenNonCollapsedSelection(e){const t=this.editor,o=t.model,n=o.schema,r=t.editing.mapper,i=o.document.selection,s=e?i.getLastPosition().nodeBefore:i.getFirstPosition().nodeAfter;return!!Lm(r.toViewElement(s),s,n)&&(o.change((t=>{t.setSelection(s,"on"),t.setSelectionAttribute(Vm,e?"after":"before")})),!0)}_enableInsertingParagraphsOnButtonClick(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"mousedown",((o,n)=>{const r=n.domTarget.closest(".ck-widget__type-around__button");if(!r)return;const i=function(e){return e.classList.contains("ck-widget__type-around__button_before")?"before":"after"}(r),s=function(e,t){const o=e.closest(".ck-widget");return t.mapDomToView(o)}(r,t.domConverter),a=e.editing.mapper.toModelElement(s);this._insertParagraph(a,i),n.preventDefault(),o.stop()}))}_enableInsertingParagraphsOnEnterKeypress(){const e=this.editor,t=e.model.document.selection,o=e.editing.view;this._listenToIfEnabled(o.document,"enter",((o,n)=>{if("atTarget"!=o.eventPhase)return;const r=t.getSelectedElement(),i=e.editing.mapper.toViewElement(r),s=e.model.schema;let a;this._insertParagraphAccordingToFakeCaretPosition()?a=!0:Lm(i,r,s)&&(this._insertParagraph(r,n.isSoft?"before":"after"),a=!0),a&&(n.preventDefault(),o.stop())}),{context:$m})}_enableInsertingParagraphsOnTypingKeystroke(){const e=this.editor.editing.view.document;this._listenToIfEnabled(e,"insertText",((t,o)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(o.selection=e.selection)}),{priority:"high"}),n.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,o=e.model,n=o.schema;this._listenToIfEnabled(t.document,"delete",((t,r)=>{if("atTarget"!=t.eventPhase)return;const i=jm(o.document.selection);if(!i)return;const s=r.direction,a=o.document.selection.getSelectedElement(),l="forward"==s;if("before"===i===l)e.execute("delete",{selection:o.createSelection(a,"on")});else{const t=n.getNearestSelectionRange(o.createPositionAt(a,i),s);if(t)if(t.isCollapsed){const r=o.createSelection(t.start);if(o.modifySelection(r,{direction:s}),r.focus.isEqual(t.start)){const e=function(e,t){let o=t;for(const n of t.getAncestors({parentFirst:!0})){if(n.childCount>1||e.isLimit(n))break;o=n}return o}(n,t.start.parent);o.deleteContent(o.createSelection(e,"on"),{doNotAutoparagraph:!0})}else o.change((o=>{o.setSelection(t),e.execute(l?"deleteForward":"delete")}))}else o.change((o=>{o.setSelection(t),e.execute(l?"deleteForward":"delete")}))}r.preventDefault(),t.stop()}),{context:$m})}_enableInsertContentIntegration(){const e=this.editor,t=this.editor.model,o=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",((e,[n,r])=>{if(r&&!r.is("documentSelection"))return;const i=jm(o);return i?(e.stop(),t.change((e=>{const r=o.getSelectedElement(),s=t.createPositionAt(r,i),a=e.createSelection(s),l=t.insertContent(n,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,o)=>{const[,n,r={}]=o;if(n&&!n.is("documentSelection"))return;const i=jm(t);i&&(r.findOptimalPosition=i,o[3]=r)}),{priority:"high"})}_enableDeleteContentIntegration(){const e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"deleteContent",((e,[o])=>{if(o&&!o.is("documentSelection"))return;jm(t)&&e.stop()}),{priority:"high"})}}function Zf(e){const t=e.model;return(o,n)=>{const r=n.keyCode==cr.arrowup,i=n.keyCode==cr.arrowdown,s=n.shiftKey,a=t.document.selection;if(!r&&!i)return;const l=i;if(s&&function(e,t){return!e.isCollapsed&&e.isBackward==t}(a,l))return;const c=function(e,t,o){const n=e.model;if(o){const e=t.isCollapsed?t.focus:t.getLastPosition(),o=Jf(n,e,"forward");if(!o)return null;const r=n.createRange(e,o),i=Qf(n.schema,r,"backward");return i?n.createRange(e,i):null}{const e=t.isCollapsed?t.focus:t.getFirstPosition(),o=Jf(n,e,"backward");if(!o)return null;const r=n.createRange(o,e),i=Qf(n.schema,r,"forward");return i?n.createRange(i,e):null}}(e,a,l);if(c){if(c.isCollapsed){if(a.isCollapsed)return;if(s)return}(c.isCollapsed||function(e,t,o){const n=e.model,r=e.view.domConverter;if(o){const e=n.createSelection(t.start);n.modifySelection(e),e.focus.isAtEnd||t.start.isEqual(e.focus)||(t=n.createRange(e.focus,t.end))}const i=e.mapper.toViewRange(t),s=r.viewRangeToDom(i),a=Fn.getDomRangeRects(s);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 o=l?c.end:c.start;if(s){const n=t.createSelection(a.anchor);n.setFocus(o),e.setSelection(n)}else e.setSelection(o)})),o.stop(),n.preventDefault(),n.stopPropagation())}}}function Jf(e,t,o){const n=e.schema,r=e.createRangeIn(t.root),i="forward"==o?"elementStart":"elementEnd";for(const{previousPosition:e,item:s,type:a}of r.getWalker({startPosition:t,direction:o})){if(n.isLimit(s)&&!n.isInline(s))return e;if(a==i&&n.isBlock(s))return null}return null}function Qf(e,t,o){const n="backward"==o?t.end:t.start;if(e.checkChild(n,"$text"))return n;for(const{nextPosition:n}of t.getWalker({direction:o}))if(e.checkChild(n,"$text"))return n;return null}var Yf=o(6507),Xf={attributes:{"data-cke":!0}};Xf.setAttributes=Wr(),Xf.insert=qr().bind(null,"head"),Xf.domAPI=Lr(),Xf.insertStyleElement=Ur();Or()(Yf.Z,Xf);Yf.Z&&Yf.Z.locals&&Yf.Z.locals;class eb extends Br{constructor(){super(...arguments),this._previouslySelected=new Set}static get pluginName(){return"Widget"}static get requires(){return[Kf,_f]}init(){const e=this.editor,t=e.editing.view,o=t.document;this.editor.editing.downcastDispatcher.on("selection",((t,o,n)=>{const r=n.writer,i=o.selection;if(i.isCollapsed)return;const s=i.getSelectedElement();if(!s)return;const a=e.editing.mapper.toViewElement(s);var l;$m(a)&&(n.consumable.consume(i,"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,o)=>{this._clearPreviouslySelectedWidgets(o.writer);const n=o.writer,r=n.document.selection;let i=null;for(const e of r.getRanges())for(const t of e){const e=t.item;$m(e)&&!tb(e,i)&&(n.addClass(Wm,e),this._previouslySelected.add(e),i=e)}}),{priority:"low"}),t.addObserver(yu),this.listenTo(o,"mousedown",((...e)=>this._onMousedown(...e))),this.listenTo(o,"arrowKey",((...e)=>{this._handleSelectionChangeOnArrowKeyPress(...e)}),{context:[$m,"$text"]}),this.listenTo(o,"arrowKey",((...e)=>{this._preventDefaultOnArrowKeyPress(...e)}),{context:"$root"}),this.listenTo(o,"arrowKey",Zf(this.editor.editing),{context:"$text"}),this.listenTo(o,"delete",((e,t)=>{this._handleDelete("forward"==t.direction)&&(t.preventDefault(),e.stop())}),{context:"$root"})}_onMousedown(e,t){const o=this.editor,r=o.editing.view,i=r.document;let s=t.target;if(function(e){let t=e;for(;t;){if(t.is("editableElement")&&!t.is("rootElement"))return!0;if($m(t))return!1;t=t.parent}return!1}(s)){if((n.isSafari||n.isGecko)&&t.domEvent.detail>=3){const e=o.editing.mapper,n=s.is("attributeElement")?s.findAncestor((e=>!e.is("attributeElement"))):s,r=e.toModelElement(n);t.preventDefault(),this.editor.model.change((e=>{e.setSelection(r,"in")}))}return}if(!$m(s)&&(s=s.findAncestor($m),!s))return;n.isAndroid&&t.preventDefault(),i.isFocused||r.focus();const a=o.editing.mapper.toModelElement(s);this._setSelectionOverElement(a)}_handleSelectionChangeOnArrowKeyPress(e,t){const o=t.keyCode,n=this.editor.model,r=n.schema,i=n.document.selection,s=i.getSelectedElement(),a=gr(o,this.editor.locale.contentLanguageDirection),l="down"==a||"right"==a,c="up"==a||"down"==a;if(s&&r.isObject(s)){const o=l?i.getLastPosition():i.getFirstPosition(),s=r.getNearestSelectionRange(o,l?"forward":"backward");return void(s&&(n.change((e=>{e.setSelection(s)})),t.preventDefault(),e.stop()))}if(!i.isCollapsed&&!t.shiftKey){const o=i.getFirstPosition(),s=i.getLastPosition(),a=o.nodeAfter,c=s.nodeBefore;return void((a&&r.isObject(a)||c&&r.isObject(c))&&(n.change((e=>{e.setSelection(l?s:o)})),t.preventDefault(),e.stop()))}if(!i.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 o=this.editor.model,n=o.schema,r=o.document.selection.getSelectedElement();r&&n.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 o=this._getObjectElementNextToSelection(e);return o?(this.editor.model.change((e=>{let n=t.anchor.parent;for(;n.isEmpty;){const t=n;n=t.parent,e.remove(t)}this._setSelectionOverElement(o)})),!0):void 0}_setSelectionOverElement(e){this.editor.model.change((t=>{t.setSelection(t.createRangeOn(e))}))}_getObjectElementNextToSelection(e){const t=this.editor.model,o=t.schema,n=t.document.selection,r=t.createSelection(n);if(t.modifySelection(r,{direction:e?"forward":"backward"}),r.isEqual(n))return null;const i=e?r.focus.nodeBefore:r.focus.nodeAfter;return i&&o.isObject(i)?i:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass(Wm,t);this._previouslySelected.clear()}}function tb(e,t){return!!t&&Array.from(e.getAncestors()).includes(t)}class ob extends Br{constructor(){super(...arguments),this._toolbarDefinitions=new Map}static get requires(){return[Cm]}static get pluginName(){return"WidgetToolbarRepository"}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||!$m(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:o,getRelatedElement:n,balloonClassName:r="ck-toolbar-container"}){if(!o.length)return void b("widget-toolbar-no-items",{toolbarId:e});const i=this.editor,s=i.t,a=new Fp(i.locale);if(a.ariaLabel=t||s("Widget toolbar"),this._toolbarDefinitions.has(e))throw new f("widget-toolbar-duplicated",this,{toolbarId:e});const l={view:a,getRelatedElement:n,balloonClassName:r,itemsConfig:o,initialized:!1};i.ui.addToolbar(a,{isContextual:!0,beforeFocus:()=>{const e=n(i.editing.view.document.selection);e&&this._showToolbar(l,e)},afterBlur:()=>{this._hideToolbar(l)}}),this._toolbarDefinitions.set(e,l)}_updateToolbarsVisibility(){let e=0,t=null,o=null;for(const n of this._toolbarDefinitions.values()){const r=n.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&r)if(this.editor.ui.focusTracker.isFocused){const i=r.getAncestors().length;i>e&&(e=i,t=r,o=n)}else this._isToolbarVisible(n)&&this._hideToolbar(n);else this._isToolbarInBalloon(n)&&this._hideToolbar(n)}o&&this._showToolbar(o,t)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(e,t){this._isToolbarVisible(e)?nb(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:rb(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);nb(this.editor,t)}})))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function nb(e,t){const o=e.plugins.get("ContextualBalloon"),n=rb(e,t);o.updatePosition(n)}function rb(e,t){const o=e.editing.view,n=Wg.defaultPositions;return{target:o.domConverter.mapViewToDom(t),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast,n.viewportStickyNorth]}}class ib extends(H()){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,o){const n=new Fn(t);this.activeHandlePosition=function(e){const t=["top-left","top-right","bottom-right","bottom-left"];for(const o of t)if(e.classList.contains(sb(o)))return o}(e),this._referenceCoordinates=function(e,t){const o=new Fn(e),n=t.split("-"),r={x:"right"==n[1]?o.right:o.left,y:"bottom"==n[0]?o.bottom:o.top};return r.x+=e.ownerDocument.defaultView.scrollX,r.y+=e.ownerDocument.defaultView.scrollY,r}(t,function(e){const t=e.split("-"),o={top:"bottom",bottom:"top",left:"right",right:"left"};return`${o[t[0]]}-${o[t[1]]}`}(this.activeHandlePosition)),this._originalWidth=n.width,this._originalHeight=n.height,this._aspectRatio=n.width/n.height;const r=o.style.width;r&&r.match(/^\d+(\.\d*)?%$/)?this._originalWidthPercents=parseFloat(r):this._originalWidthPercents=function(e,t){const o=e.parentElement;let n=parseFloat(o.ownerDocument.defaultView.getComputedStyle(o).width);const r=5;let i=0,s=o;for(;isNaN(n);){if(s=s.parentElement,++i>r)return 0;n=parseFloat(o.ownerDocument.defaultView.getComputedStyle(s).width)}return t.width/n*100}(o,n)}update(e){this.proposedWidth=e.width,this.proposedHeight=e.height,this.proposedWidthPercents=e.widthPercents,this.proposedHandleHostWidth=e.handleHostWidth,this.proposedHandleHostHeight=e.handleHostHeight}}function sb(e){return`ck-widget__resizer__handle-${e}`}class ab extends Sh{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,o,n)=>"px"===e.unit?`${t}×${o}`:`${n}%`)),this.bind("_viewPosition").to(t,"activeHandlePosition",t,"proposedHandleHostWidth",t,"proposedHandleHostHeight",((e,t,o)=>t<50||o<50?"above-center":e))}_dismiss(){this.unbind(),this._isVisible=!1}}class lb extends(H()){constructor(e){super(),this._viewResizerWrapper=null,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((o=>{const n=o.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},(function(t){const o=this.toDomElement(t);return e._appendHandles(o),e._appendSizeUI(o),o}));o.insert(o.createPositionAt(t,"end"),n),o.addClass("ck-widget_with-resizer",t),this._viewResizerWrapper=n,this.isVisible||this.hide()})),this.on("change:isVisible",(()=>{this.isVisible?(this.show(),this.redraw()):this.hide()}))}begin(e){this._state=new ib(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 o=this._options.unit||"%",n=("%"===o?t.widthPercents:t.width)+o;e.setStyle("width",n,this._options.viewElement)}));const o=this._getHandleHost(),n=new Fn(o),r=Math.round(n.width),i=Math.round(n.height),s=new Fn(o);t.width=Math.round(s.width),t.height=Math.round(s.height),this.redraw(n),this.state.update({...t,handleHostWidth:r,handleHostHeight:i})}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(!((o=t)&&o.ownerDocument&&o.ownerDocument.contains(o)))return;var o;const n=t.parentElement,r=this._getHandleHost(),i=this._viewResizerWrapper,s=[i.getStyle("width"),i.getStyle("height"),i.getStyle("left"),i.getStyle("top")];let a;if(n.isSameNode(r)){const t=e||new Fn(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"!==J(s,a)&&this._options.editor.editing.view.change((e=>{e.setStyle({width:a[0],height:a[1],left:a[2],top:a[3]},i)}))}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,o={x:(n=e).pageX,y:n.pageY};var n;const r=!this._options.isCentered||this._options.isCentered(this),i={x:t._referenceCoordinates.x-(o.x+t.originalWidth),y:o.y-t.originalHeight-t._referenceCoordinates.y};r&&t.activeHandlePosition.endsWith("-right")&&(i.x=o.x-(t._referenceCoordinates.x+t.originalWidth)),r&&(i.x*=2);let s=Math.abs(t.originalWidth+i.x),a=Math.abs(t.originalHeight+i.y);return"width"==(s/t.aspectRatio>a?"width":"height")?a=s/t.aspectRatio:s=a*t.aspectRatio,{width:Math.round(s),height:Math.round(a),widthPercents:Math.min(Math.round(t.originalWidthPercents/t.originalWidth*s*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 n of t)e.appendChild(new Th({tag:"div",attributes:{class:"ck-widget__resizer__handle "+(o=n,`ck-widget__resizer__handle-${o}`)}}).render());var o}_appendSizeUI(e){this._sizeView=new ab,this._sizeView.render(),e.appendChild(this._sizeView.element)}}var cb=o(2263),db={attributes:{"data-cke":!0}};db.setAttributes=Wr(),db.insert=qr().bind(null,"head"),db.domAPI=Lr(),db.insertStyleElement=Ur();Or()(cb.Z,db);cb.Z&&cb.Z.locals&&cb.Z.locals;class ub extends Br{constructor(){super(...arguments),this._resizers=new Map}static get pluginName(){return"WidgetResize"}init(){const e=this.editor.editing,t=In.window.document;this.set("selectedResizer",null),this.set("_activeResizer",null),e.view.addObserver(yu),this._observer=new(Dn()),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=fh((()=>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(In.window,"resize",this._redrawSelectedResizerThrottled);const o=this.editor.editing.view.document.selection;o.on("change",(()=>{const e=o.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 lb(e),o=this.editor.plugins;if(t.attach(),o.has("WidgetToolbarRepository")){const e=o.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 n=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(n)==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 o=t.domTarget;lb.isResizeHandle(o)&&(this._activeResizer=this._getResizerByHandle(o)||null,this._activeResizer&&(this._activeResizer.begin(o),e.stop(),t.preventDefault()))}_mouseMoveListener(e,t){this._activeResizer&&this._activeResizer.updateSize(t)}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null)}}function hb(e,t,o){e.ui.componentFactory.add(t,(t=>{const n=new op(t);return n.set({label:I18n.t("js.button_edit"),icon:' \n',tooltip:!0}),n.on("execute",(()=>{const t=e.model.document.selection.getSelectedElement();t&&o(t)})),n}))}const pb="ck-toolbar-container";function gb(e,t,o,n){const r=t.config.get(o+".toolbar");if(!r||!r.length)return;const i=t.plugins.get("ContextualBalloon"),s=new Fp(t.locale);function a(){t.ui.focusTracker.isFocused&&n(t.editing.view.document.selection)?c()?function(e,t){const o=e.plugins.get("ContextualBalloon");if(t(e.editing.view.document.selection)){const t=mb(e);o.updatePosition(t)}}(t,n):i.hasView(s)||i.add({view:s,position:mb(t),balloonClassName:pb}):l()}function l(){c()&&i.remove(s)}function c(){return i.visibleView==s}s.fillFromConfig(r,t.ui.componentFactory),e.listenTo(t.editing.view,"render",a),e.listenTo(t.ui.focusTracker,"change:isFocused",a,{priority:"low"})}function mb(e){const t=e.editing.view,o=Wg.defaultPositions;return{target:t.domConverter.viewToDom(t.document.selection.getSelectedElement()),positions:[o.northArrowSouth,o.northArrowSouthWest,o.northArrowSouthEast,o.southArrowNorth,o.southArrowNorthWest,o.southArrowNorthEast]}}class fb extends Br{static get requires(){return[Cm]}static get pluginName(){return"EmbeddedTableToolbar"}init(){const e=this.editor,t=this.editor.model,o=of(e);hb(e,"opEditEmbeddedTableQuery",(e=>{const n=o.services.externalQueryConfiguration,r=e.getAttribute("opEmbeddedTableQuery")||{};o.runInZone((()=>{n.show({currentQuery:r,callback:o=>t.change((t=>{t.setAttribute("opEmbeddedTableQuery",o,e)}))})}))}))}afterInit(){gb(this,this.editor,"OPMacroEmbeddedTable",ef)}}const bb=Symbol("isWpButtonMacroSymbol");function kb(e){const t=e.getSelectedElement();return!(!t||!function(e){return!!e.getCustomProperty(bb)&&$m(e)}(t))}class wb extends Br{static get pluginName(){return"OPMacroWpButtonEditing"}static get buttonName(){return"insertWorkPackageButton"}init(){const e=this.editor,t=e.model,o=e.conversion,n=of(e);t.schema.register("op-macro-wp-button",{allowWhere:["$block"],allowAttributes:["type","classes"],isBlock:!0,isLimit:!0}),o.for("upcast").elementToElement({view:{name:"macro",classes:"create_work_package_link"},model:(e,{writer:t})=>{const o=e.getAttribute("data-type")||"",n=e.getAttribute("data-classes")||"";return t.createElement("op-macro-wp-button",{type:o,classes:n})}}),o.for("editingDowncast").elementToElement({model:"op-macro-wp-button",view:(e,{writer:t})=>this.createMacroViewElement(e,t)}),o.for("dataDowncast").elementToElement({model:"op-macro-wp-button",view:(e,{writer:t})=>t.createContainerElement("macro",{class:"create_work_package_link","data-type":e.getAttribute("type")||"","data-classes":e.getAttribute("classes")||""})}),e.ui.componentFactory.add(wb.buttonName,(t=>{const o=new op(t);return o.set({label:window.I18n.t("js.editor.macro.work_package_button.button"),withText:!0}),o.on("execute",(()=>{n.services.macros.configureWorkPackageButton().then((t=>e.model.change((o=>{const n=o.createElement("op-macro-wp-button",{});o.setAttribute("type",t.type,n),o.setAttribute("classes",t.classes,n),e.model.insertContent(n,e.model.document.selection)}))))})),o}))}macroLabel(e){return e?window.I18n.t("js.editor.macro.work_package_button.with_type",{typename:e}):window.I18n.t("js.editor.macro.work_package_button.without_type")}createMacroViewElement(e,t){e.getAttribute("type");const o=e.getAttribute("classes")||"",n=this.macroLabel(),r=t.createText(n),i=t.createContainerElement("span",{class:o});return t.insert(t.createPositionAt(i,0),r),function(e,t,o){return t.setCustomProperty(bb,!0,e),Um(e,t,{label:o})}(i,t,{label:n})}}class _b extends Br{static get requires(){return[Cm]}static get pluginName(){return"OPMacroWpButtonToolbar"}init(){const e=this.editor,t=(this.editor.model,of(e));hb(e,"opEditWpMacroButton",(o=>{const n=t.services.macros,r=o.getAttribute("type"),i=o.getAttribute("classes");n.configureWorkPackageButton(r,i).then((t=>e.model.change((e=>{e.setAttribute("classes",t.classes,o),e.setAttribute("type",t.type,o)}))))}))}afterInit(){gb(this,this.editor,"OPMacroWpButton",kb)}}class yb extends(H()){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(((o,n)=>{t.onload=()=>{const e=t.result;this._data=e,o(e)},t.onerror=()=>{n("error")},t.onabort=()=>{n("aborted")},this._reader.readAsDataURL(e)}))}abort(){this._reader.abort()}}class Ab extends Br{constructor(){super(...arguments),this.loaders=new _r,this._loadersMap=new Map,this._pendingAction=null}static get pluginName(){return"FileRepository"}static get requires(){return[dh]}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 b("filerepository-no-upload-adapter"),null;const t=new Cb(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 Cb?e:this.getLoader(e);t._destroy(),this.loaders.remove(t),this._loadersMap.forEach(((e,o)=>{e===t&&this._loadersMap.delete(o)}))}_updatePendingAction(){const e=this.editor.plugins.get(dh);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t,o=e=>`${t("Upload in progress")} ${parseInt(e)}%.`;this._pendingAction=e.add(o(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",o)}}else e.remove(this._pendingAction),this._pendingAction=null}}class Cb extends(H()){constructor(e,t){super(),this.id=h(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=t(this),this._reader=new yb,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 f("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 f("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(((o,n)=>{t.rejecter=n,t.isFulfilled=!1,e.then((e=>{t.isFulfilled=!0,o(e)})).catch((e=>{t.isFulfilled=!0,n(e)}))})),t}}class vb extends Sh{constructor(e){super(e),this.buttonView=new op(e),this._fileInputView=new xb(e),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.setTemplate({tag:"span",attributes:{class:"ck-file-dialog-button"},children:[this.buttonView,this._fileInputView]}),this.buttonView.on("execute",(()=>{this._fileInputView.open()}))}focus(){this.buttonView.focus()}}class xb extends Sh{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()}}class Eb{constructor(e,t,o){this.loader=e,this.resource=t,this.editor=o}upload(){const e=this.resource,t=nf(this.editor,"attachmentsResourceService");return e?this.loader.file.then((o=>t.attachFiles(e,[o]).toPromise().then((e=>(this.editor.model.fire("op:attachment-added",e),this.buildResponse(e[0])))).catch((e=>{console.error("Failed upload %O",e)})))):(console.warn("resource not available in this CKEditor instance"),Promise.reject("Not possible to upload attachments without resource"))}buildResponse(e){return{default:e._links.staticDownloadLocation.href}}abort(){return!1}}class Db extends Ea{constructor(e){super(e),this.domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"];const t=this.document;function o(e){return(o,n)=>{n.preventDefault();const r=n.dropRange?[n.dropRange]:null,i=new d(t,e);t.fire(i,{dataTransfer:n.dataTransfer,method:o.name,targetRanges:r,target:n.target,domEvent:n.domEvent}),i.stop.called&&n.stopPropagation()}}this.listenTo(t,"paste",o("clipboardInput"),{priority:"low"}),this.listenTo(t,"drop",o("clipboardInput"),{priority:"low"}),this.listenTo(t,"dragover",o("dragging"),{priority:"low"})}onDomEvent(e){const t="clipboardData"in e?e.clipboardData:e.dataTransfer,o="drop"==e.type||"paste"==e.type,n={dataTransfer:new gl(t,{cacheFiles:o})};"drop"!=e.type&&"dragover"!=e.type||(n.dropRange=function(e,t){const o=t.target.ownerDocument,n=t.clientX,r=t.clientY;let i;o.caretRangeFromPoint&&o.caretRangeFromPoint(n,r)?i=o.caretRangeFromPoint(n,r):t.rangeParent&&(i=o.createRange(),i.setStart(t.rangeParent,t.rangeOffset),i.collapse(!0));if(i)return e.domConverter.domRangeToView(i);return null}(this.view,e)),this.fire(e.type,e,n)}}const Sb=["figcaption","li"];function Tb(e){let t="";if(e.is("$text")||e.is("$textProxy"))t=e.data;else if(e.is("element","img")&&e.hasAttribute("alt"))t=e.getAttribute("alt");else if(e.is("element","br"))t="\n";else{let o=null;for(const n of e.getChildren()){const e=Tb(n);o&&(o.is("containerElement")||n.is("containerElement"))&&(Sb.includes(o.name)||Sb.includes(n.name)?t+="\n":t+="\n\n"),t+=e,o=n}}return t}class Bb extends Br{static get pluginName(){return"ClipboardPipeline"}init(){this.editor.editing.view.addObserver(Db),this._setupPasteDrop(),this._setupCopyCut()}_setupPasteDrop(){const e=this.editor,t=e.model,o=e.editing.view,n=o.document;this.listenTo(n,"clipboardInput",((t,o)=>{"paste"!=o.method||e.model.canEditAt(e.model.document.selection)||t.stop()}),{priority:"highest"}),this.listenTo(n,"clipboardInput",((e,t)=>{const n=t.dataTransfer;let r;if(t.content)r=t.content;else{let e="";n.getData("text/html")?e=function(e){return e.replace(/(\s+)<\/span>/g,((e,t)=>1==t.length?" ":t)).replace(//g,"")}(n.getData("text/html")):n.getData("text/plain")&&(((i=(i=n.getData("text/plain")).replace(/