tinymce-rails 6.1.0 → 7.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -11
  3. data/app/assets/source/tinymce/tinymce.js +10358 -7311
  4. data/lib/tinymce/rails/asset_installer/copy_no_preserve.rb +1 -1
  5. data/lib/tinymce/rails/asset_installer.rb +4 -4
  6. data/lib/tinymce/rails/asset_manifest/json_manifest.rb +62 -0
  7. data/lib/tinymce/rails/asset_manifest/null_manifest.rb +12 -0
  8. data/lib/tinymce/rails/asset_manifest/propshaft_manifest.rb +43 -0
  9. data/lib/tinymce/rails/asset_manifest/yaml_manifest.rb +43 -0
  10. data/lib/tinymce/rails/asset_manifest.rb +7 -104
  11. data/lib/tinymce/rails/configuration.rb +6 -1
  12. data/lib/tinymce/rails/configuration_file.rb +2 -1
  13. data/lib/tinymce/rails/engine.rb +15 -2
  14. data/lib/tinymce/rails/helper.rb +19 -5
  15. data/lib/tinymce/rails/propshaft/asset.rb +11 -0
  16. data/lib/tinymce/rails/version.rb +2 -2
  17. data/lib/tinymce/rails.rb +2 -2
  18. data/vendor/assets/javascripts/tinymce/icons/default/icons.js +1 -1
  19. data/vendor/assets/javascripts/tinymce/langs/readme.md +3 -0
  20. data/vendor/assets/javascripts/tinymce/license.md +6 -0
  21. data/vendor/assets/javascripts/tinymce/models/dom/model.js +2 -2
  22. data/vendor/assets/javascripts/tinymce/plugins/accordion/plugin.js +4 -0
  23. data/vendor/assets/javascripts/tinymce/plugins/advlist/plugin.js +2 -2
  24. data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.js +2 -2
  25. data/vendor/assets/javascripts/tinymce/plugins/autolink/plugin.js +2 -2
  26. data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.js +2 -2
  27. data/vendor/assets/javascripts/tinymce/plugins/autosave/plugin.js +2 -2
  28. data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.js +2 -2
  29. data/vendor/assets/javascripts/tinymce/plugins/code/plugin.js +1 -1
  30. data/vendor/assets/javascripts/tinymce/plugins/codesample/plugin.js +2 -2
  31. data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.js +2 -2
  32. data/vendor/assets/javascripts/tinymce/plugins/emoticons/plugin.js +2 -2
  33. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.js +2 -2
  34. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/ar.js +93 -0
  35. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/bg_BG.js +93 -0
  36. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/ca.js +93 -0
  37. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/cs.js +93 -0
  38. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/da.js +93 -0
  39. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/de.js +93 -0
  40. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/el.js +93 -0
  41. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/en.js +93 -0
  42. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/es.js +93 -0
  43. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/eu.js +93 -0
  44. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/fa.js +93 -0
  45. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/fi.js +93 -0
  46. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/fr_FR.js +93 -0
  47. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/he_IL.js +93 -0
  48. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/hi.js +93 -0
  49. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/hr.js +93 -0
  50. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/hu_HU.js +93 -0
  51. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/id.js +93 -0
  52. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/it.js +93 -0
  53. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/ja.js +93 -0
  54. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/kk.js +93 -0
  55. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/ko_KR.js +93 -0
  56. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/ms.js +93 -0
  57. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/nb_NO.js +93 -0
  58. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/nl.js +93 -0
  59. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/pl.js +93 -0
  60. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/pt_BR.js +93 -0
  61. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/pt_PT.js +93 -0
  62. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/ro.js +93 -0
  63. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/ru.js +93 -0
  64. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/sk.js +93 -0
  65. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/sl_SI.js +93 -0
  66. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/sv_SE.js +93 -0
  67. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/th_TH.js +93 -0
  68. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/tr.js +93 -0
  69. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/uk.js +93 -0
  70. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/vi.js +93 -0
  71. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/zh_CN.js +87 -0
  72. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/zh_TW.js +93 -0
  73. data/vendor/assets/javascripts/tinymce/plugins/help/plugin.js +2 -2
  74. data/vendor/assets/javascripts/tinymce/plugins/image/plugin.js +2 -2
  75. data/vendor/assets/javascripts/tinymce/plugins/importcss/plugin.js +2 -2
  76. data/vendor/assets/javascripts/tinymce/plugins/insertdatetime/plugin.js +2 -2
  77. data/vendor/assets/javascripts/tinymce/plugins/link/plugin.js +2 -2
  78. data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +2 -2
  79. data/vendor/assets/javascripts/tinymce/plugins/media/plugin.js +2 -2
  80. data/vendor/assets/javascripts/tinymce/plugins/nonbreaking/plugin.js +2 -2
  81. data/vendor/assets/javascripts/tinymce/plugins/pagebreak/plugin.js +2 -2
  82. data/vendor/assets/javascripts/tinymce/plugins/preview/plugin.js +2 -2
  83. data/vendor/assets/javascripts/tinymce/plugins/quickbars/plugin.js +2 -2
  84. data/vendor/assets/javascripts/tinymce/plugins/save/plugin.js +2 -2
  85. data/vendor/assets/javascripts/tinymce/plugins/searchreplace/plugin.js +2 -2
  86. data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +2 -2
  87. data/vendor/assets/javascripts/tinymce/plugins/visualblocks/plugin.js +2 -2
  88. data/vendor/assets/javascripts/tinymce/plugins/visualchars/plugin.js +2 -2
  89. data/vendor/assets/javascripts/tinymce/plugins/wordcount/plugin.js +2 -2
  90. data/vendor/assets/javascripts/tinymce/skins/content/dark/content.js +1 -0
  91. data/vendor/assets/javascripts/tinymce/skins/content/default/content.js +1 -0
  92. data/vendor/assets/javascripts/tinymce/skins/content/document/content.js +1 -0
  93. data/vendor/assets/javascripts/tinymce/skins/content/tinymce-5/content.js +1 -0
  94. data/vendor/assets/javascripts/tinymce/skins/content/tinymce-5-dark/content.js +1 -0
  95. data/vendor/assets/javascripts/tinymce/skins/content/writer/content.js +1 -0
  96. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.css +1 -1
  97. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.css +1 -1
  98. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.js +1 -0
  99. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.min.css +1 -1
  100. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.js +1 -0
  101. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.min.css +1 -1
  102. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.css +1 -1
  103. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.js +1 -0
  104. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.min.css +1 -1
  105. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.shadowdom.js +1 -0
  106. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.css +1 -1
  107. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.inline.css +1 -1
  108. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.inline.js +1 -0
  109. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -1
  110. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.js +1 -0
  111. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.min.css +1 -1
  112. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.css +1 -1
  113. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.js +1 -0
  114. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
  115. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.shadowdom.js +1 -0
  116. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.css +1 -1
  117. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.inline.css +1 -1
  118. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.inline.js +1 -0
  119. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -1
  120. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.js +1 -0
  121. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.min.css +1 -1
  122. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.css +1 -1
  123. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.js +1 -0
  124. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.min.css +1 -1
  125. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.shadowdom.js +1 -0
  126. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.css +1 -1
  127. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.inline.css +1 -1
  128. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.inline.js +1 -0
  129. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -1
  130. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.js +1 -0
  131. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -1
  132. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.css +1 -1
  133. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.js +1 -0
  134. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -1
  135. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.js +1 -0
  136. data/vendor/assets/javascripts/tinymce/themes/silver/theme.js +384 -2
  137. data/vendor/assets/javascripts/tinymce/tinymce.d.ts +934 -516
  138. data/vendor/assets/javascripts/tinymce/tinymce.js +383 -2
  139. metadata +75 -10
  140. data/LICENSE +0 -19
  141. data/vendor/assets/javascripts/tinymce/langs/README.md +0 -3
  142. data/vendor/assets/javascripts/tinymce/license.txt +0 -21
  143. data/vendor/assets/javascripts/tinymce/plugins/template/plugin.js +0 -4
  144. /data/app/assets/{javascripts → sprockets}/tinymce/preinit.js.erb +0 -0
  145. /data/app/assets/{javascripts → sprockets}/tinymce.js +0 -0
@@ -1,4 +1,385 @@
1
1
  /**
2
- * TinyMCE version 6.1.0 (2022-06-29)
2
+ * TinyMCE version 7.6.0 (2024-12-11)
3
3
  */
4
- !function(){"use strict";var e=function(e){if(null===e)return"null";if(void 0===e)return"undefined";var t=typeof e;return"object"===t&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"===t&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":t},t=function(e){return{eq:e}},n=t((function(e,t){return e===t})),o=function(e){return t((function(t,n){if(t.length!==n.length)return!1;for(var o=t.length,r=0;r<o;r++)if(!e.eq(t[r],n[r]))return!1;return!0}))},r=function(e){return t((function(r,s){var a=Object.keys(r),i=Object.keys(s);if(!function(e,n){return function(e,n){return t((function(t,o){return e.eq(n(t),n(o))}))}(o(e),(function(e){return function(e,t){return Array.prototype.slice.call(e).sort(t)}(e,n)}))}(n).eq(a,i))return!1;for(var l=a.length,d=0;d<l;d++){var c=a[d];if(!e.eq(r[c],s[c]))return!1}return!0}))},s=t((function(t,n){if(t===n)return!0;var a=e(t);return a===e(n)&&(function(e){return-1!==["undefined","boolean","number","string","function","xml","null"].indexOf(e)}(a)?t===n:"array"===a?o(s).eq(t,n):"object"===a&&r(s).eq(t,n))}));const a=Object.getPrototypeOf,i=(e,t,n)=>{var o;return!!n(e,t.prototype)||(null===(o=e.constructor)||void 0===o?void 0:o.name)===t.name},l=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&i(e,String,((e,t)=>t.isPrototypeOf(e)))?"string":t})(t)===e,d=e=>t=>typeof t===e,c=e=>t=>e===t,u=(e,t)=>f(e)&&i(e,t,((e,t)=>a(e)===t)),m=l("string"),f=l("object"),g=e=>u(e,Object),p=l("array"),h=c(null),b=d("boolean"),v=c(void 0),y=e=>null==e,C=e=>!y(e),w=d("function"),x=d("number"),k=(e,t)=>{if(p(e)){for(let n=0,o=e.length;n<o;++n)if(!t(e[n]))return!1;return!0}return!1},S=()=>{},_=(e,t)=>(...n)=>e(t.apply(null,n)),E=(e,t)=>n=>e(t(n)),N=e=>()=>e,R=e=>e,A=(e,t)=>e===t;function O(e,...t){return(...n)=>{const o=t.concat(n);return e.apply(null,o)}}const T=e=>t=>!e(t),B=e=>e(),D=e=>{e()},P=N(!1),L=N(!0);class M{constructor(e,t){this.tag=e,this.value=t}static some(e){return new M(!0,e)}static none(){return M.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?M.some(e(this.value)):M.none()}bind(e){return this.tag?e(this.value):M.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:M.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return C(e)?M.some(e):M.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}M.singletonNone=new M(!1);const I=Array.prototype.slice,F=Array.prototype.indexOf,U=Array.prototype.push,z=(e,t)=>F.call(e,t),j=(e,t)=>z(e,t)>-1,V=(e,t)=>{for(let n=0,o=e.length;n<o;n++)if(t(e[n],n))return!0;return!1},H=(e,t)=>{const n=e.length,o=new Array(n);for(let r=0;r<n;r++){const n=e[r];o[r]=t(n,r)}return o},$=(e,t)=>{for(let n=0,o=e.length;n<o;n++)t(e[n],n)},q=(e,t)=>{for(let n=e.length-1;n>=0;n--)t(e[n],n)},W=(e,t)=>{const n=[],o=[];for(let r=0,s=e.length;r<s;r++){const s=e[r];(t(s,r)?n:o).push(s)}return{pass:n,fail:o}},K=(e,t)=>{const n=[];for(let o=0,r=e.length;o<r;o++){const r=e[o];t(r,o)&&n.push(r)}return n},G=(e,t,n)=>(q(e,((e,o)=>{n=t(n,e,o)})),n),Y=(e,t,n)=>($(e,((e,o)=>{n=t(n,e,o)})),n),X=(e,t,n)=>{for(let o=0,r=e.length;o<r;o++){const r=e[o];if(t(r,o))return M.some(r);if(n(r,o))break}return M.none()},Q=(e,t)=>X(e,t,P),J=(e,t)=>{for(let n=0,o=e.length;n<o;n++)if(t(e[n],n))return M.some(n);return M.none()},Z=e=>{const t=[];for(let n=0,o=e.length;n<o;++n){if(!p(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);U.apply(t,e[n])}return t},ee=(e,t)=>Z(H(e,t)),te=(e,t)=>{for(let n=0,o=e.length;n<o;++n)if(!0!==t(e[n],n))return!1;return!0},ne=e=>{const t=I.call(e,0);return t.reverse(),t},oe=(e,t)=>K(e,(e=>!j(t,e))),re=(e,t)=>{const n={};for(let o=0,r=e.length;o<r;o++){const r=e[o];n[String(r)]=t(r,o)}return n},se=(e,t)=>{const n=I.call(e,0);return n.sort(t),n},ae=(e,t)=>t>=0&&t<e.length?M.some(e[t]):M.none(),ie=e=>ae(e,0),le=e=>ae(e,e.length-1),de=w(Array.from)?Array.from:e=>I.call(e),ce=(e,t)=>{for(let n=0;n<e.length;n++){const o=t(e[n],n);if(o.isSome())return o}return M.none()},ue=Object.keys,me=Object.hasOwnProperty,fe=(e,t)=>{const n=ue(e);for(let o=0,r=n.length;o<r;o++){const r=n[o];t(e[r],r)}},ge=(e,t)=>pe(e,((e,n)=>({k:n,v:t(e,n)}))),pe=(e,t)=>{const n={};return fe(e,((e,o)=>{const r=t(e,o);n[r.k]=r.v})),n},he=e=>(t,n)=>{e[n]=t},be=(e,t,n,o)=>(fe(e,((e,r)=>{(t(e,r)?n:o)(e,r)})),{}),ve=(e,t)=>{const n={};return be(e,t,he(n),S),n},ye=(e,t)=>{const n=[];return fe(e,((e,o)=>{n.push(t(e,o))})),n},Ce=e=>ye(e,R),we=(e,t)=>xe(e,t)?M.from(e[t]):M.none(),xe=(e,t)=>me.call(e,t),ke=(e,t)=>xe(e,t)&&void 0!==e[t]&&null!==e[t],Se=e=>{const t={};return $(e,(e=>{t[e]={}})),ue(t)},_e=Array.isArray,Ee=(e,t,n)=>{let o,r;if(!e)return!1;if(n=n||e,void 0!==e.length){for(o=0,r=e.length;o<r;o++)if(!1===t.call(n,e[o],o,e))return!1}else for(o in e)if(xe(e,o)&&!1===t.call(n,e[o],o,e))return!1;return!0},Ne=(e,t)=>{const n=[];return Ee(e,((o,r)=>{n.push(t(o,r,e))})),n},Re=(e,t)=>{const n=[];return Ee(e,((o,r)=>{t&&!t(o,r,e)||n.push(o)})),n},Ae=(e,t)=>{if(e)for(let n=0,o=e.length;n<o;n++)if(e[n]===t)return n;return-1},Oe=(e,t,n,o)=>{let r=v(n)?e[0]:n;for(let n=0;n<e.length;n++)r=t.call(o,r,e[n],n);return r},Te=(e,t,n)=>{let o,r;for(o=0,r=e.length;o<r;o++)if(t.call(n,e[o],o,e))return o;return-1},Be=e=>e[e.length-1],De=e=>{let t,n=!1;return(...o)=>(n||(n=!0,t=e.apply(null,o)),t)},Pe=()=>Le(0,0),Le=(e,t)=>({major:e,minor:t}),Me={nu:Le,detect:(e,t)=>{const n=String(t).toLowerCase();return 0===e.length?Pe():((e,t)=>{const n=((e,t)=>{for(let n=0;n<e.length;n++){const o=e[n];if(o.test(t))return o}})(e,t);if(!n)return{major:0,minor:0};const o=e=>Number(t.replace(n,"$"+e));return Le(o(1),o(2))})(e,n)},unknown:Pe},Ie=(e,t)=>{const n=String(t).toLowerCase();return Q(e,(e=>e.search(n)))},Fe=(e,t,n)=>""===t||e.length>=t.length&&e.substr(n,n+t.length)===t,Ue=(e,t)=>-1!==e.indexOf(t),ze=(e,t)=>Fe(e,t,0),je=(e,t)=>Fe(e,t,e.length-t.length),Ve=e=>t=>t.replace(e,""),He=Ve(/^\s+|\s+$/g),$e=Ve(/^\s+/g),qe=Ve(/\s+$/g),We=e=>e.length>0,Ke=e=>!We(e),Ge=(e,t=10)=>{const n=parseInt(e,t);return isNaN(n)?M.none():M.some(n)},Ye=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Xe=e=>t=>Ue(t,e),Qe=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>Ue(e,"edge/")&&Ue(e,"chrome")&&Ue(e,"safari")&&Ue(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Ye],search:e=>Ue(e,"chrome")&&!Ue(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>Ue(e,"msie")||Ue(e,"trident")},{name:"Opera",versionRegexes:[Ye,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Xe("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Xe("firefox")},{name:"Safari",versionRegexes:[Ye,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(Ue(e,"safari")||Ue(e,"mobile/"))&&Ue(e,"applewebkit")}],Je=[{name:"Windows",search:Xe("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>Ue(e,"iphone")||Ue(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Xe("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:Xe("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Xe("linux"),versionRegexes:[]},{name:"Solaris",search:Xe("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Xe("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:Xe("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],Ze={browsers:N(Qe),oses:N(Je)},et="Edge",tt="Chromium",nt="Opera",ot="Firefox",rt="Safari",st=e=>{const t=e.current,n=e.version,o=e=>()=>t===e;return{current:t,version:n,isEdge:o(et),isChromium:o(tt),isIE:o("IE"),isOpera:o(nt),isFirefox:o(ot),isSafari:o(rt)}},at=()=>st({current:void 0,version:Me.unknown()}),it=st,lt=(N(et),N(tt),N("IE"),N(nt),N(ot),N(rt),"Windows"),dt="Android",ct="Linux",ut="macOS",mt="Solaris",ft="FreeBSD",gt="ChromeOS",pt=e=>{const t=e.current,n=e.version,o=e=>()=>t===e;return{current:t,version:n,isWindows:o(lt),isiOS:o("iOS"),isAndroid:o(dt),isMacOS:o(ut),isLinux:o(ct),isSolaris:o(mt),isFreeBSD:o(ft),isChromeOS:o(gt)}},ht=()=>pt({current:void 0,version:Me.unknown()}),bt=pt,vt=(N(lt),N("iOS"),N(dt),N(ct),N(ut),N(mt),N(ft),N(gt),e=>window.matchMedia(e).matches);let yt=De((()=>((e,t,n)=>{const o=Ze.browsers(),r=Ze.oses(),s=t.bind((e=>((e,t)=>ce(t.brands,(t=>{const n=t.brand.toLowerCase();return Q(e,(e=>{var t;return n===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())})).map((e=>({current:e.name,version:Me.nu(parseInt(t.version,10),0)})))})))(o,e))).orThunk((()=>((e,t)=>Ie(e,t).map((e=>{const n=Me.detect(e.versionRegexes,t);return{current:e.name,version:n}})))(o,e))).fold(at,it),a=((e,t)=>Ie(e,t).map((e=>{const n=Me.detect(e.versionRegexes,t);return{current:e.name,version:n}})))(r,e).fold(ht,bt),i=((e,t,n,o)=>{const r=e.isiOS()&&!0===/ipad/i.test(n),s=e.isiOS()&&!r,a=e.isiOS()||e.isAndroid(),i=a||o("(pointer:coarse)"),l=r||!s&&a&&o("(min-device-width:768px)"),d=s||a&&!l,c=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(n),u=!d&&!l&&!c;return{isiPad:N(r),isiPhone:N(s),isTablet:N(l),isPhone:N(d),isTouch:N(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:N(c),isDesktop:N(u)}})(a,s,e,n);return{browser:s,os:a,deviceType:i}})(navigator.userAgent,M.from(navigator.userAgentData),vt)));const Ct=()=>yt(),wt=navigator.userAgent,xt=Ct(),kt=xt.browser,St=xt.os,_t=xt.deviceType,Et=-1!==wt.indexOf("Windows Phone"),Nt={transparentSrc:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",documentMode:kt.isIE()?document.documentMode||7:10,cacheSuffix:null,container:null,canHaveCSP:!kt.isIE(),windowsPhone:Et,browser:{current:kt.current,version:kt.version,isChromium:kt.isChromium,isEdge:kt.isEdge,isFirefox:kt.isFirefox,isIE:kt.isIE,isOpera:kt.isOpera,isSafari:kt.isSafari},os:{current:St.current,version:St.version,isAndroid:St.isAndroid,isChromeOS:St.isChromeOS,isFreeBSD:St.isFreeBSD,isiOS:St.isiOS,isLinux:St.isLinux,isMacOS:St.isMacOS,isSolaris:St.isSolaris,isWindows:St.isWindows},deviceType:{isDesktop:_t.isDesktop,isiPad:_t.isiPad,isiPhone:_t.isiPhone,isPhone:_t.isPhone,isTablet:_t.isTablet,isTouch:_t.isTouch,isWebView:_t.isWebView}},Rt=/^\s*|\s*$/g,At=e=>null==e?"":(""+e).replace(Rt,""),Ot=(e,t)=>t?!("array"!==t||!_e(e))||typeof e===t:void 0!==e,Tt=function(e,t,n,o){o=o||this,e&&(n&&(e=e[n]),Ee(e,((e,r)=>{if(!1===t.call(o,e,r,n))return!1;Tt(e,t,n,o)})))},Bt={trim:At,isArray:_e,is:Ot,toArray:e=>{if(_e(e))return e;{const t=[];for(let n=0,o=e.length;n<o;n++)t[n]=e[n];return t}},makeMap:(e,t,n)=>{let o;for(t=t||",","string"==typeof(e=e||[])&&(e=e.split(t)),n=n||{},o=e.length;o--;)n[e[o]]={};return n},each:Ee,map:Ne,grep:Re,inArray:Ae,hasOwn:xe,extend:(e,...t)=>{for(let n=0;n<t.length;n++){const o=t[n];for(const t in o)if(xe(o,t)){const n=o[t];void 0!==n&&(e[t]=n)}}return e},walk:Tt,resolve:(e,t)=>{let n,o;for(t=t||window,n=0,o=(e=e.split(".")).length;n<o&&(t=t[e[n]]);n++);return t},explode:(e,t)=>!e||Ot(e,"array")?e:Ne(e.split(t||","),At),_addCacheSuffix:e=>{const t=Nt.cacheSuffix;return t&&(e+=(-1===e.indexOf("?")?"?":"&")+t),e}},Dt=(e,t,n=A)=>e.exists((e=>n(e,t))),Pt=(e,t,n)=>e.isSome()&&t.isSome()?M.some(n(e.getOrDie(),t.getOrDie())):M.none(),Lt=(e,t)=>e?M.some(t):M.none();"undefined"!=typeof window?window:Function("return this;")();const Mt=e=>e.dom.nodeName.toLowerCase(),It=e=>e.dom.nodeType,Ft=e=>t=>It(t)===e,Ut=Ft(1),zt=Ft(3),jt=Ft(9),Vt=Ft(11),Ht=e=>t=>Ut(t)&&Mt(t)===e,$t=(e,t,n)=>{if(!(m(n)||b(n)||x(n)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",n,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,n+"")},qt=(e,t,n)=>{$t(e.dom,t,n)},Wt=(e,t)=>{const n=e.dom;fe(t,((e,t)=>{$t(n,t,e)}))},Kt=(e,t)=>{const n=e.dom.getAttribute(t);return null===n?void 0:n},Gt=(e,t)=>M.from(Kt(e,t)),Yt=(e,t)=>{const n=e.dom;return!(!n||!n.hasAttribute)&&n.hasAttribute(t)},Xt=(e,t)=>{e.dom.removeAttribute(t)},Qt=e=>Y(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}),Jt=(e,t)=>{const n=Kt(e,t);return void 0===n||""===n?[]:n.split(" ")},Zt=e=>void 0!==e.dom.classList,en=e=>Jt(e,"class"),tn=(e,t)=>((e,t,n)=>{const o=Jt(e,t).concat([n]);return qt(e,t,o.join(" ")),!0})(e,"class",t),nn=(e,t)=>((e,t,n)=>{const o=K(Jt(e,t),(e=>e!==n));return o.length>0?qt(e,t,o.join(" ")):Xt(e,t),!1})(e,"class",t),on=(e,t)=>{Zt(e)?e.dom.classList.add(t):tn(e,t)},rn=e=>{0===(Zt(e)?e.dom.classList:en(e)).length&&Xt(e,"class")},sn=(e,t)=>{Zt(e)?e.dom.classList.remove(t):nn(e,t),rn(e)},an=(e,t)=>Zt(e)&&e.dom.classList.contains(t),ln=e=>void 0!==e.style&&w(e.style.getPropertyValue),dn=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},cn=(e,t)=>{const n=(t||document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||n.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return dn(n.childNodes[0])},un=(e,t)=>{const n=(t||document).createElement(e);return dn(n)},mn=(e,t)=>{const n=(t||document).createTextNode(e);return dn(n)},fn=dn,gn=(e,t,n)=>M.from(e.dom.elementFromPoint(t,n)).map(dn),pn=(e,t)=>{const n=[],o=e=>(n.push(e),t(e));let r=t(e);do{r=r.bind(o)}while(r.isSome());return n},hn=(e,t)=>{const n=e.dom;if(1!==n.nodeType)return!1;{const e=n;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},bn=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,vn=(e,t)=>e.dom===t.dom,yn=(e,t)=>{const n=e.dom,o=t.dom;return n!==o&&n.contains(o)},Cn=e=>fn(e.dom.ownerDocument),wn=e=>jt(e)?e:Cn(e),xn=e=>fn(wn(e).dom.defaultView),kn=e=>M.from(e.dom.parentNode).map(fn),Sn=e=>M.from(e.dom.previousSibling).map(fn),_n=e=>M.from(e.dom.nextSibling).map(fn),En=e=>ne(pn(e,Sn)),Nn=e=>pn(e,_n),Rn=e=>H(e.dom.childNodes,fn),An=(e,t)=>{const n=e.dom.childNodes;return M.from(n[t]).map(fn)},On=e=>An(e,0),Tn=e=>An(e,e.dom.childNodes.length-1),Bn=e=>e.dom.childNodes.length,Dn=e=>Vt(e)&&C(e.dom.host),Pn=w(Element.prototype.attachShadow)&&w(Node.prototype.getRootNode),Ln=N(Pn),Mn=Pn?e=>fn(e.dom.getRootNode()):wn,In=e=>Dn(e)?e:(e=>{const t=e.dom.head;if(null==t)throw new Error("Head is not available yet");return fn(t)})(wn(e)),Fn=e=>fn(e.dom.host),Un=e=>{if(Ln()&&C(e.target)){const t=fn(e.target);if(Ut(t)&&zn(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return ie(t)}}return M.from(e.target)},zn=e=>C(e.dom.shadowRoot),jn=e=>{const t=zt(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const n=t.ownerDocument;return(e=>{const t=Mn(e);return Dn(t)?M.some(t):M.none()})(fn(t)).fold((()=>n.body.contains(t)),E(jn,Fn))},Vn=(e,t,n)=>{if(!m(n))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",n,":: Element ",e),new Error("CSS value must be a string: "+n);ln(e)&&e.style.setProperty(t,n)},Hn=(e,t,n)=>{const o=e.dom;Vn(o,t,n)},$n=(e,t)=>{const n=e.dom;fe(t,((e,t)=>{Vn(n,t,e)}))},qn=(e,t)=>{const n=e.dom,o=window.getComputedStyle(n).getPropertyValue(t);return""!==o||jn(e)?o:Wn(n,t)},Wn=(e,t)=>ln(e)?e.style.getPropertyValue(t):"",Kn=(e,t)=>{const n=e.dom,o=Wn(n,t);return M.from(o).filter((e=>e.length>0))},Gn=e=>{const t={},n=e.dom;if(ln(n))for(let e=0;e<n.style.length;e++){const o=n.style.item(e);t[o]=n.style[o]}return t},Yn=(e,t)=>{((e,t)=>{ln(e)&&e.style.removeProperty(t)})(e.dom,t),Dt(Gt(e,"style").map(He),"")&&Xt(e,"style")},Xn=(e,t)=>{kn(e).each((n=>{n.dom.insertBefore(t.dom,e.dom)}))},Qn=(e,t)=>{_n(e).fold((()=>{kn(e).each((e=>{Zn(e,t)}))}),(e=>{Xn(e,t)}))},Jn=(e,t)=>{On(e).fold((()=>{Zn(e,t)}),(n=>{e.dom.insertBefore(t.dom,n.dom)}))},Zn=(e,t)=>{e.dom.appendChild(t.dom)},eo=(e,t)=>{$(t,(t=>{Zn(e,t)}))},to=e=>{e.dom.textContent="",$(Rn(e),(e=>{no(e)}))},no=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},oo=e=>{const t=Rn(e);var n,o;t.length>0&&(n=e,$(o=t,((e,t)=>{const r=0===t?n:o[t-1];Qn(r,e)}))),no(e)},ro=e=>e.dom.innerHTML,so=(e,t)=>{const n=Cn(e).dom,o=fn(n.createDocumentFragment()),r=((e,t)=>{const n=(t||document).createElement("div");return n.innerHTML=e,Rn(fn(n))})(t,n);eo(o,r),to(e),Zn(e,o)},ao=(e,t,n,o)=>((e,t,n,o,r)=>{const s=((e,t)=>n=>{e(n)&&t((e=>{const t=fn(Un(e).getOr(e.target)),n=()=>e.stopPropagation(),o=()=>e.preventDefault(),r=_(o,n);return((e,t,n,o,r,s,a)=>({target:e,x:t,y:n,stop:o,prevent:r,kill:s,raw:a}))(t,e.clientX,e.clientY,n,o,r,e)})(n))})(n,o);return e.dom.addEventListener(t,s,false),{unbind:O(io,e,t,s,false)}})(e,t,n,o),io=(e,t,n,o)=>{e.dom.removeEventListener(t,n,o)},lo=(e,t)=>({left:e,top:t,translate:(n,o)=>lo(e+n,t+o)}),co=lo,uo=(e,t)=>void 0!==e?e:void 0!==t?t:0,mo=e=>{const t=e.dom,n=t.ownerDocument.body;return n===t?co(n.offsetLeft,n.offsetTop):jn(e)?(e=>{const t=e.getBoundingClientRect();return co(t.left,t.top)})(t):co(0,0)},fo=e=>{const t=void 0!==e?e.dom:document,n=t.body.scrollLeft||t.documentElement.scrollLeft,o=t.body.scrollTop||t.documentElement.scrollTop;return co(n,o)},go=(e,t,n)=>{const o=(void 0!==n?n.dom:document).defaultView;o&&o.scrollTo(e,t)},po=(e,t)=>{Ct().browser.isSafari()&&w(e.dom.scrollIntoViewIfNeeded)?e.dom.scrollIntoViewIfNeeded(!1):e.dom.scrollIntoView(t)},ho=(e,t,n,o)=>({x:e,y:t,width:n,height:o,right:e+n,bottom:t+o}),bo=e=>{const t=void 0===e?window:e,n=t.document,o=fo(fn(n));return(e=>{const t=void 0===e?window:e;return Ct().browser.isFirefox()?M.none():M.from(t.visualViewport)})(t).fold((()=>{const e=t.document.documentElement,n=e.clientWidth,r=e.clientHeight;return ho(o.left,o.top,n,r)}),(e=>ho(Math.max(e.pageLeft,o.left),Math.max(e.pageTop,o.top),e.width,e.height)))},vo=e=>t=>!!t&&t.nodeType===e,yo=e=>!!e&&!Object.getPrototypeOf(e),Co=vo(1),wo=e=>{const t=e.map((e=>e.toLowerCase()));return e=>{if(e&&e.nodeName){const n=e.nodeName.toLowerCase();return j(t,n)}return!1}},xo=(e,t)=>{const n=t.toLowerCase().split(" ");return t=>{if(Co(t))for(let o=0;o<n.length;o++){const r=t.ownerDocument.defaultView.getComputedStyle(t,null);if((r?r.getPropertyValue(e):null)===n[o])return!0}return!1}},ko=e=>t=>Co(t)&&t.hasAttribute(e),So=e=>Co(e)&&e.hasAttribute("data-mce-bogus"),_o=e=>Co(e)&&"TABLE"===e.tagName,Eo=e=>t=>{if(Co(t)){if(t.contentEditable===e)return!0;if(t.getAttribute("data-mce-contenteditable")===e)return!0}return!1},No=wo(["textarea","input"]),Ro=vo(3),Ao=vo(4),Oo=vo(7),To=vo(8),Bo=vo(9),Do=vo(11),Po=wo(["br"]),Lo=wo(["img"]),Mo=Eo("true"),Io=Eo("false"),Fo=wo(["td","th"]),Uo=wo(["video","audio","object","embed"]),zo=Ct().browser,jo=e=>Q(e,Ut),Vo=(e,t)=>e.children&&j(e.children,t);var Ho=(e,t,n,o,r)=>e(n,o)?M.some(n):w(r)&&r(n)?M.none():t(n,o,r);const $o=(e,t,n)=>{let o=e.dom;const r=w(n)?n:P;for(;o.parentNode;){o=o.parentNode;const e=fn(o);if(t(e))return M.some(e);if(r(e))break}return M.none()},qo=(e,t,n)=>Ho(((e,t)=>t(e)),$o,e,t,n),Wo=(e,t,n)=>$o(e,(e=>hn(e,t)),n),Ko=(e,t)=>((e,t)=>{const n=void 0===t?document:t.dom;return bn(n)?M.none():M.from(n.querySelector(e)).map(fn)})(t,e),Go=(e,t,n)=>Ho(((e,t)=>hn(e,t)),Wo,e,t,n),Yo=(e,t={})=>{let n=0;const o={},r=fn(e),s=wn(r),a=t.maxLoadTime||5e3,i=i=>new Promise(((l,d)=>{let c;const u=Bt._addCacheSuffix(i),m=(e=>we(o,e).getOrThunk((()=>({id:"mce-u"+n++,passed:[],failed:[],count:0}))))(u);o[u]=m,m.count++;const f=(e,t)=>{$(e,D),m.status=t,m.passed=[],m.failed=[],c&&(c.onload=null,c.onerror=null,c=null)},g=()=>f(m.passed,2),p=()=>f(m.failed,3),h=()=>{var t;t=h,(()=>{const t=e.styleSheets;let n=t.length;for(;n--;){const e=t[n].ownerNode;if(e&&e.id===c.id)return g(),!0}return!1})()||(Date.now()-v<a?setTimeout(t):p())};if(l&&m.passed.push(l),d&&m.failed.push(d),1===m.status)return;if(2===m.status)return void g();if(3===m.status)return void p();m.status=1;const b=un("link",s.dom);Wt(b,{rel:"stylesheet",type:"text/css",id:m.id});const v=Date.now();var y;t.contentCssCors&&qt(b,"crossOrigin","anonymous"),t.referrerPolicy&&qt(b,"referrerpolicy",t.referrerPolicy),c=b.dom,c.onload=h,c.onerror=p,y=b,Zn(In(r),y),qt(b,"href",u)})),l=e=>{const t=Bt._addCacheSuffix(e);we(o,t).each((e=>{0==--e.count&&(delete o[t],(e=>{const t=In(r);Ko(t,"#"+e).each(no)})(e.id))}))};return{load:i,loadAll:e=>Promise.allSettled(H(e,(e=>i(e).then(N(e))))).then((e=>{const t=W(e,(e=>"fulfilled"===e.status));return t.fail.length>0?Promise.reject(H(t.fail,(e=>e.reason))):H(t.pass,(e=>e.value))})),unload:l,unloadAll:e=>{$(e,(e=>{l(e)}))},_setReferrerPolicy:e=>{t.referrerPolicy=e}}},Xo=(()=>{const e=new WeakMap;return{forElement:(t,n)=>{const o=Mn(t).dom;return M.from(e.get(o)).getOrThunk((()=>{const t=Yo(o,n);return e.set(o,t),t}))}}})();class Qo{constructor(e,t){this.node=e,this.rootNode=t,this.current=this.current.bind(this),this.next=this.next.bind(this),this.prev=this.prev.bind(this),this.prev2=this.prev2.bind(this)}current(){return this.node}next(e){return this.node=this.findSibling(this.node,"firstChild","nextSibling",e),this.node}prev(e){return this.node=this.findSibling(this.node,"lastChild","previousSibling",e),this.node}prev2(e){return this.node=this.findPreviousNode(this.node,e),this.node}findSibling(e,t,n,o){let r,s;if(e){if(!o&&e[t])return e[t];if(e!==this.rootNode){if(r=e[n],r)return r;for(s=e.parentNode;s&&s!==this.rootNode;s=s.parentNode)if(r=s[n],r)return r}}}findPreviousNode(e,t){let n,o,r;if(e){if(n=e.previousSibling,this.rootNode&&n===this.rootNode)return;if(n){if(!t)for(r=n.lastChild;r;r=r.lastChild)if(!r.lastChild)return r;return n}if(o=e.parentNode,o&&o!==this.rootNode)return o}}}const Jo=["pre"].concat(["h1","h2","h3","h4","h5","h6"]),Zo=e=>{let t;return n=>(t=t||re(e,L),xe(t,Mt(n)))},er=Zo(["article","aside","details","div","dt","figcaption","footer","form","fieldset","header","hgroup","html","main","nav","section","summary","body","p","dl","multicol","dd","figure","address","center","blockquote","h1","h2","h3","h4","h5","h6","listing","xmp","pre","plaintext","menu","dir","ul","ol","li","hr","table","tbody","thead","tfoot","th","tr","td","caption"]),tr=e=>Ut(e)&&!er(e),nr=e=>Ut(e)&&"br"===Mt(e),or=Zo(["h1","h2","h3","h4","h5","h6","p","div","address","pre","form","blockquote","center","dir","fieldset","header","footer","article","section","hgroup","aside","nav","figure"]),rr=Zo(["ul","ol","dl"]),sr=Zo(["li","dd","dt"]),ar=Zo(["thead","tbody","tfoot"]),ir=Zo(["td","th"]),lr=Zo(["pre","script","textarea","style"]),dr=Zo(Jo),cr=e=>dr(e)||tr(e),ur=(e,t,n)=>Wo(e,t,n).isSome(),mr="\ufeff",fr="\xa0",gr=e=>e===mr,pr=mr,hr=gr,br=e=>e.replace(/\uFEFF/g,""),vr=Co,yr=Ro,Cr=e=>(yr(e)&&(e=e.parentNode),vr(e)&&e.hasAttribute("data-mce-caret")),wr=e=>yr(e)&&hr(e.data),xr=e=>Cr(e)||wr(e),kr=e=>e.firstChild!==e.lastChild||!Po(e.firstChild),Sr=e=>{const t=e.container();return!!Ro(t)&&(t.data.charAt(e.offset())===pr||e.isAtStart()&&wr(t.previousSibling))},_r=e=>{const t=e.container();return!!Ro(t)&&(t.data.charAt(e.offset()-1)===pr||e.isAtEnd()&&wr(t.nextSibling))},Er=e=>yr(e)&&e.data[0]===pr,Nr=e=>yr(e)&&e.data[e.data.length-1]===pr,Rr=e=>e&&e.hasAttribute("data-mce-caret")?((e=>{const t=e.getElementsByTagName("br"),n=t[t.length-1];So(n)&&n.parentNode.removeChild(n)})(e),e.removeAttribute("data-mce-caret"),e.removeAttribute("data-mce-bogus"),e.removeAttribute("style"),e.removeAttribute("data-mce-style"),e.removeAttribute("_moz_abspos"),e):null,Ar=e=>Cr(e.startContainer),Or=Mo,Tr=Io,Br=Po,Dr=Ro,Pr=wo(["script","style","textarea"]),Lr=wo(["img","input","textarea","hr","iframe","video","audio","object","embed"]),Mr=wo(["table"]),Ir=xr,Fr=e=>!Ir(e)&&(Dr(e)?!Pr(e.parentNode):Lr(e)||Br(e)||Mr(e)||Ur(e)),Ur=e=>!1===(e=>Co(e)&&"true"===e.getAttribute("unselectable"))(e)&&Tr(e),zr=(e,t)=>Fr(e)&&((e,t)=>{for(e=e.parentNode;e&&e!==t;e=e.parentNode){if(Ur(e))return!1;if(Or(e))return!0}return!0})(e,t),jr=/^[ \t\r\n]*$/,Vr=e=>jr.test(e),Hr=e=>"\n"===e||"\r"===e,$r=(e,t=4,n=!0,o=!0)=>{const r=((e,t)=>t<=0?"":new Array(t+1).join(" "))(0,t),s=e.replace(/\t/g,r),a=Y(s,((e,t)=>(e=>-1!==" \f\t\v".indexOf(e))(t)||t===fr?e.pcIsSpace||""===e.str&&n||e.str.length===s.length-1&&o||((e,t)=>t<e.length&&t>=0&&Hr(e[t]))(s,e.str.length+1)?{pcIsSpace:!1,str:e.str+fr}:{pcIsSpace:!0,str:e.str+" "}:{pcIsSpace:Hr(t),str:e.str+t}),{pcIsSpace:!1,str:""});return a.str},qr=(e,t)=>Fr(e)&&!1===((e,t)=>Ro(e)&&Vr(e.data)&&!1===((e,t)=>{const n=fn(t),o=fn(e);return ur(o,"pre,code",O(vn,n))})(e,t))(e,t)||(e=>Co(e)&&"A"===e.nodeName&&!e.hasAttribute("href")&&(e.hasAttribute("name")||e.hasAttribute("id")))(e)||Wr(e),Wr=ko("data-mce-bookmark"),Kr=ko("data-mce-bogus"),Gr=("data-mce-bogus","all",e=>Co(e)&&"all"===e.getAttribute("data-mce-bogus"));const Yr=(e,t=!0)=>((e,t)=>{let n=0;if(qr(e,e))return!1;{let o=e.firstChild;if(!o)return!0;const r=new Qo(o,e);do{if(t){if(Gr(o)){o=r.next(!0);continue}if(Kr(o)){o=r.next();continue}}if(Po(o))n++,o=r.next();else{if(qr(o,e))return!1;o=r.next()}}while(o);return n<=1}})(e.dom,t),Xr=(e,t)=>C(e)&&(qr(e,t)||tr(fn(e))),Qr=e=>(e=>"span"===e.nodeName.toLowerCase())(e)&&"bookmark"===e.getAttribute("data-mce-type"),Jr=(e,t,n)=>{const o=n||t;if(Co(t)&&Qr(t))return t;const r=t.childNodes;for(let t=r.length-1;t>=0;t--)Jr(e,r[t],o);if(Co(t)){const e=t.childNodes;1===e.length&&Qr(e[0])&&t.parentNode.insertBefore(e[0],t)}return(e=>Do(e)||Bo(e))(t)||qr(t,o)||(e=>!!Co(e)&&e.childNodes.length>0)(t)||((e,t)=>Ro(e)&&e.data.length>0&&((e,t)=>{const n=new Qo(e,t).prev(!1),o=new Qo(e,t).next(!1),r=v(n)||Xr(n,t),s=v(o)||Xr(o,t);return r&&s})(e,t))(t,o)||e.remove(t),t},Zr=Bt.makeMap,es=/[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,ts=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,ns=/[<>&\"\']/g,os=/&#([a-z0-9]+);?|&([a-z0-9]+);/gi,rs={128:"\u20ac",130:"\u201a",131:"\u0192",132:"\u201e",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02c6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017d",145:"\u2018",146:"\u2019",147:"\u201c",148:"\u201d",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02dc",153:"\u2122",154:"\u0161",155:"\u203a",156:"\u0153",158:"\u017e",159:"\u0178"},ss={'"':"&quot;","'":"&#39;","<":"&lt;",">":"&gt;","&":"&amp;","`":"&#96;"},as={"&lt;":"<","&gt;":">","&amp;":"&","&quot;":'"',"&apos;":"'"},is=(e,t)=>{let n,o,r;const s={};if(e){for(e=e.split(","),t=t||10,n=0;n<e.length;n+=2)o=String.fromCharCode(parseInt(e[n],t)),ss[o]||(r="&"+e[n+1]+";",s[o]=r,s[r]=o);return s}},ls=is("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32),ds=(e,t)=>e.replace(t?es:ts,(e=>ss[e]||e)),cs=(e,t)=>e.replace(t?es:ts,(e=>e.length>1?"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";":ss[e]||"&#"+e.charCodeAt(0)+";")),us=(e,t,n)=>(n=n||ls,e.replace(t?es:ts,(e=>ss[e]||n[e]||e))),ms={encodeRaw:ds,encodeAllRaw:e=>(""+e).replace(ns,(e=>ss[e]||e)),encodeNumeric:cs,encodeNamed:us,getEncodeFunc:(e,t)=>{const n=is(t)||ls,o=Zr(e.replace(/\+/g,","));return o.named&&o.numeric?(e,t)=>e.replace(t?es:ts,(e=>void 0!==ss[e]?ss[e]:void 0!==n[e]?n[e]:e.length>1?"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";":"&#"+e.charCodeAt(0)+";")):o.named?t?(e,t)=>us(e,t,n):us:o.numeric?cs:ds},decode:e=>e.replace(os,((e,t)=>t?(t="x"===t.charAt(0).toLowerCase()?parseInt(t.substr(1),16):parseInt(t,10))>65535?(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t))):rs[t]||String.fromCharCode(t):as[e]||ls[e]||(e=>{const t=un("div").dom;return t.innerHTML=e,t.textContent||t.innerText||e})(e)))},fs={},gs={},ps=Bt.makeMap,hs=Bt.each,bs=Bt.extend,vs=Bt.explode,ys=Bt.inArray,Cs=(e,t)=>(e=Bt.trim(e))?e.split(t||" "):[],ws=(e,t)=>{const n=ps(e," ",ps(e.toUpperCase()," "));return bs(n,t)},xs=e=>ws("td th li dt dd figcaption caption details summary",e.getTextBlockElements()),ks=(e,t)=>{let n;return e&&(n={},"string"==typeof e&&(e={"*":e}),hs(e,((e,o)=>{n[o]=n[o.toUpperCase()]="map"===t?ps(e,/[, ]/):vs(e,/[, ]/)}))),n},Ss=e=>{var t;const n={},o={};let r=[];const s={},a={},i=(t,n,o)=>{let r=e[t];return r?r=ps(r,/[, ]/,ps(r.toUpperCase(),/[, ]/)):(r=fs[t],r||(r=ws(n,o),fs[t]=r)),r},l=null!==(t=(e=e||{}).schema)&&void 0!==t?t:"html5",d=(e=>{const t={};let n,o,r,s,a,i;const l=(e,o="",r="")=>{const s=Cs(r),a=Cs(e);let i=a.length;for(;i--;){const e=Cs([n,o].join(" "));t[a[i]]={attributes:re(e,(()=>({}))),attributesOrder:e,children:re(s,N(gs))}}},d=(e,n)=>{const o=Cs(e),r=Cs(n);let s=o.length;for(;s--;){const e=t[o[s]];for(let t=0,n=r.length;t<n;t++)e.attributes[r[t]]={},e.attributesOrder.push(r[t])}};return fs[e]?fs[e]:(n="id accesskey class dir lang style tabindex title role",o="address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul",r="a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd label map noscript object q s samp script select small span strong sub sup textarea u var #text #comment","html4"!==e&&(n+=" contenteditable contextmenu draggable dropzone hidden spellcheck translate",o+=" article aside details dialog figure main header footer hgroup section nav",r+=" audio canvas command datalist mark meter output picture progress time wbr video ruby bdi keygen"),"html5-strict"!==e&&(n+=" xml:lang",i="acronym applet basefont big font strike tt",r=[r,i].join(" "),hs(Cs(i),(e=>{l(e,"",r)})),a="center dir isindex noframes",o=[o,a].join(" "),s=[o,r].join(" "),hs(Cs(a),(e=>{l(e,"",s)}))),s=s||[o,r].join(" "),l("html","manifest","head body"),l("head","","base command link meta noscript script style title"),l("title hr noscript br"),l("base","href target"),l("link","href rel media hreflang type sizes hreflang"),l("meta","name http-equiv content charset"),l("style","media type scoped"),l("script","src async defer type charset"),l("body","onafterprint onbeforeprint onbeforeunload onblur onerror onfocus onhashchange onload onmessage onoffline ononline onpagehide onpageshow onpopstate onresize onscroll onstorage onunload",s),l("address dt dd div caption","",s),l("h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn","",r),l("blockquote","cite",s),l("ol","reversed start type","li"),l("ul","","li"),l("li","value",s),l("dl","","dt dd"),l("a","href target rel media hreflang type",r),l("q","cite",r),l("ins del","cite datetime",s),l("img","src sizes srcset alt usemap ismap width height"),l("iframe","src name width height",s),l("embed","src type width height"),l("object","data type typemustmatch name usemap form width height",[s,"param"].join(" ")),l("param","name value"),l("map","name",[s,"area"].join(" ")),l("area","alt coords shape href target rel media hreflang type"),l("table","border","caption colgroup thead tfoot tbody tr"+("html4"===e?" col":"")),l("colgroup","span","col"),l("col","span"),l("tbody thead tfoot","","tr"),l("tr","","td th"),l("td","colspan rowspan headers",s),l("th","colspan rowspan headers scope abbr",s),l("form","accept-charset action autocomplete enctype method name novalidate target",s),l("fieldset","disabled form name",[s,"legend"].join(" ")),l("label","form for",r),l("input","accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate formtarget height list max maxlength min multiple name pattern readonly required size src step type value width"),l("button","disabled form formaction formenctype formmethod formnovalidate formtarget name type value","html4"===e?s:r),l("select","disabled form multiple name required size","option optgroup"),l("optgroup","disabled label","option"),l("option","disabled label selected value"),l("textarea","cols dirname disabled form maxlength name readonly required rows wrap"),l("menu","type label",[s,"li"].join(" ")),l("noscript","",s),"html4"!==e&&(l("wbr"),l("ruby","",[r,"rt rp"].join(" ")),l("figcaption","",s),l("mark rt rp summary bdi","",r),l("canvas","width height",s),l("video","src crossorigin poster preload autoplay mediagroup loop muted controls width height buffered",[s,"track source"].join(" ")),l("audio","src crossorigin preload autoplay mediagroup loop muted controls buffered volume",[s,"track source"].join(" ")),l("picture","","img source"),l("source","src srcset type media sizes"),l("track","kind src srclang label default"),l("datalist","",[r,"option"].join(" ")),l("article section nav aside main header footer","",s),l("hgroup","","h1 h2 h3 h4 h5 h6"),l("figure","",[s,"figcaption"].join(" ")),l("time","datetime",r),l("dialog","open",s),l("command","type label icon disabled checked radiogroup command"),l("output","for form name",r),l("progress","value max",r),l("meter","value min max low high optimum",r),l("details","open",[s,"summary"].join(" ")),l("keygen","autofocus challenge disabled form keytype name")),"html5-strict"!==e&&(d("script","language xml:space"),d("style","xml:space"),d("object","declare classid code codebase codetype archive standby align border hspace vspace"),d("embed","align name hspace vspace"),d("param","valuetype type"),d("a","charset name rev shape coords"),d("br","clear"),d("applet","codebase archive code object alt name width height align hspace vspace"),d("img","name longdesc align border hspace vspace"),d("iframe","longdesc frameborder marginwidth marginheight scrolling align"),d("font basefont","size color face"),d("input","usemap align"),d("select"),d("textarea"),d("h1 h2 h3 h4 h5 h6 div p legend caption","align"),d("ul","type compact"),d("li","type"),d("ol dl menu dir","compact"),d("pre","width xml:space"),d("hr","align noshade size width"),d("isindex","prompt"),d("table","summary width frame rules cellspacing cellpadding align bgcolor"),d("col","width align char charoff valign"),d("colgroup","width align char charoff valign"),d("thead","align char charoff valign"),d("tr","align char charoff valign bgcolor"),d("th","axis align char charoff valign nowrap bgcolor width height"),d("form","accept"),d("td","abbr axis scope align char charoff valign nowrap bgcolor width height"),d("tfoot","align char charoff valign"),d("tbody","align char charoff valign"),d("area","nohref"),d("body","background bgcolor text link vlink alink")),"html4"!==e&&(d("input button select textarea","autofocus"),d("input textarea","placeholder"),d("a","download"),d("link script img","crossorigin"),d("img","loading"),d("iframe","sandbox seamless allowfullscreen loading")),"html4"!==e&&$([t.video,t.audio],(e=>{delete e.children.audio,delete e.children.video})),hs(Cs("a form meter progress dfn"),(e=>{t[e]&&delete t[e].children[e]})),delete t.caption.children.table,delete t.script,fs[e]=t,t)})(l);!1===e.verify_html&&(e.valid_elements="*[*]");const c=ks(e.valid_styles),u=ks(e.invalid_styles,"map"),m=ks(e.valid_classes,"map"),f=i("whitespace_elements","pre script noscript style textarea video audio iframe object code"),g=i("self_closing_elements","colgroup dd dt li option p td tfoot th thead tr"),p=i("void_elements","area base basefont br col frame hr img input isindex link meta param embed source wbr track"),h=i("boolean_attributes","checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls allowfullscreen"),b="td th iframe video audio object script code",v=i("non_empty_elements",b+" pre",p),y=i("move_caret_before_on_enter_elements",b+" table",p),C=i("text_block_elements","h1 h2 h3 h4 h5 h6 p div address pre form blockquote center dir fieldset header footer article section hgroup aside main nav figure"),w=i("block_elements","hr table tbody thead tfoot th tr td li ol ul caption dl dt dd noscript menu isindex option datalist select optgroup figcaption details summary",C),x=i("text_inline_elements","span strong b em i font s strike u var cite dfn code mark q sup sub samp");hs("script noscript iframe noframes noembed title style textarea xmp plaintext".split(" "),(e=>{a[e]=new RegExp("</"+e+"[^>]*>","gi")}));const k=e=>new RegExp("^"+e.replace(/([?+*])/g,".$1")+"$"),S=e=>{let t,o,s,a,i,l,d,c,u,m,f,g,p,h,b,v,y,C;const w=/^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)])?$/,x=/^([!\-])?(\w+[\\:]:\w+|[^=~<]+)?(?:([=~<])(.*))?$/,S=/[*?+]/;if(e){const _=Cs(e,",");for(n["@"]&&(v=n["@"].attributes,y=n["@"].attributesOrder),t=0,o=_.length;t<o;t++)if(i=w.exec(_[t]),i){if(h=i[1],u=i[2],b=i[3],c=i[5],g={},p=[],l={attributes:g,attributesOrder:p},"#"===h&&(l.paddEmpty=!0),"-"===h&&(l.removeEmpty=!0),"!"===i[4]&&(l.removeEmptyAttrs=!0),v&&(fe(v,((e,t)=>{g[t]=e})),p.push.apply(p,y)),c)for(c=Cs(c,"|"),s=0,a=c.length;s<a;s++)if(i=x.exec(c[s]),i){if(d={},f=i[1],m=i[2].replace(/[\\:]:/g,":"),h=i[3],C=i[4],"!"===f&&(l.attributesRequired=l.attributesRequired||[],l.attributesRequired.push(m),d.required=!0),"-"===f){delete g[m],p.splice(ys(p,m),1);continue}h&&("="===h&&(l.attributesDefault=l.attributesDefault||[],l.attributesDefault.push({name:m,value:C}),d.defaultValue=C),"~"===h&&(l.attributesForced=l.attributesForced||[],l.attributesForced.push({name:m,value:C}),d.forcedValue=C),"<"===h&&(d.validValues=ps(C,"?"))),S.test(m)?(l.attributePatterns=l.attributePatterns||[],d.pattern=k(m),l.attributePatterns.push(d)):(g[m]||p.push(m),g[m]=d)}v||"@"!==u||(v=g,y=p),b&&(l.outputName=u,n[b]=l),S.test(u)?(l.pattern=k(u),r.push(l)):n[u]=l}}},_=e=>{r=[],$(ue(n),(e=>{delete n[e]})),S(e),hs(d,((e,t)=>{o[t]=e.children}))},E=e=>{const t=/^(~)?(.+)$/;e&&(fs.text_block_elements=fs.block_elements=null,hs(Cs(e,","),(e=>{const r=t.exec(e),a="~"===r[1],i=a?"span":"div",l=r[2];if(o[l]=o[i],s[l]=i,v[l.toUpperCase()]={},v[l]={},a||(w[l.toUpperCase()]={},w[l]={}),!n[l]){let e=n[i];e=bs({},e),delete e.removeEmptyAttrs,delete e.removeEmpty,n[l]=e}hs(o,((e,t)=>{e[i]&&(o[t]=e=bs({},o[t]),e[l]=e[i])}))})))},R=e=>{const t=/^([+\-]?)([A-Za-z0-9_\-.\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]+)\[([^\]]+)]$/;fs[l]=null,e&&hs(Cs(e,","),(e=>{const n=t.exec(e);let r,s;n&&(s=n[1],r=s?o[n[2]]:o[n[2]]={"#comment":{}},r=o[n[2]],hs(Cs(n[3],"|"),(e=>{"-"===s?delete r[e]:r[e]={}})))}))},A=e=>{let t,o=n[e];if(o)return o;for(t=r.length;t--;)if(o=r[t],o.pattern.test(e))return o};e.valid_elements?_(e.valid_elements):(hs(d,((e,t)=>{n[t]={attributes:e.attributes,attributesOrder:e.attributesOrder},o[t]=e.children})),hs(Cs("strong/b em/i"),(e=>{const t=Cs(e,"/");n[t[1]].outputName=t[0]})),hs(x,((t,o)=>{n[o]&&(e.padd_empty_block_inline_children&&(n[o].paddInEmptyBlock=!0),n[o].removeEmpty=!0)})),hs(Cs("ol ul blockquote a table tbody"),(e=>{n[e]&&(n[e].removeEmpty=!0)})),hs(Cs("p h1 h2 h3 h4 h5 h6 th td pre div address caption li"),(e=>{n[e].paddEmpty=!0})),hs(Cs("span"),(e=>{n[e].removeEmptyAttrs=!0}))),E(e.custom_elements),R(e.valid_children),S(e.extended_valid_elements),R("+ol[ul|ol],+ul[ul|ol]"),hs({dd:"dl",dt:"dl",li:"ul ol",td:"tr",th:"tr",tr:"tbody thead tfoot",tbody:"table",thead:"table",tfoot:"table",legend:"fieldset",area:"map",param:"video audio object"},((e,t)=>{n[t]&&(n[t].parentsRequired=Cs(e))})),e.invalid_elements&&hs(vs(e.invalid_elements),(e=>{n[e]&&delete n[e]})),A("span")||S("span[!data-mce-type|*]");const O=N(c),T=N(u),B=N(m),D=N(h),P=N(w),L=N(C),M=N(x),I=N(Object.seal(p)),F=N(g),U=N(v),z=N(y),j=N(f),V=N(Object.seal(a)),H=N(s);return{type:l,children:o,elements:n,getValidStyles:O,getValidClasses:B,getBlockElements:P,getInvalidStyles:T,getVoidElements:I,getTextBlockElements:L,getTextInlineElements:M,getBoolAttrs:D,getElementRule:A,getSelfClosingElements:F,getNonEmptyElements:U,getMoveCaretBeforeOnEnterElements:z,getWhitespaceElements:j,getSpecialElements:V,isValidChild:(e,t)=>{const n=o[e.toLowerCase()];return!(!n||!n[t.toLowerCase()])},isValid:(e,t)=>{let n,o;const r=A(e);if(r){if(!t)return!0;if(r.attributes[t])return!0;if(n=r.attributePatterns,n)for(o=n.length;o--;)if(n[o].pattern.test(t))return!0}return!1},getCustomElements:H,addValidElements:S,setValidElements:_,addCustomElements:E,addValidChildren:R}},_s=(e,t)=>{const n=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,o=/\s*([^:]+):\s*([^;]+);?/g,r=/\s+$/;let s;const a={};let i,l;e=e||{},t&&(i=t.getValidStyles(),l=t.getInvalidStyles());const d="\\\" \\' \\; \\: ; : \ufeff".split(" ");for(s=0;s<d.length;s++)a[d[s]]="\ufeff"+s,a["\ufeff"+s]=d[s];const c={parse:t=>{const i={};let l,d,u,m;const f=e.url_converter,g=e.url_converter_scope||c,p=(e,t,n)=>{const o=i[e+"-top"+t];if(!o)return;const r=i[e+"-right"+t];if(!r)return;const a=i[e+"-bottom"+t];if(!a)return;const l=i[e+"-left"+t];if(!l)return;const d=[o,r,a,l];for(s=d.length-1;s--&&d[s]===d[s+1];);s>-1&&n||(i[e+t]=-1===s?d[0]:d.join(" "),delete i[e+"-top"+t],delete i[e+"-right"+t],delete i[e+"-bottom"+t],delete i[e+"-left"+t])},h=e=>{let t,n=i[e];if(n){for(n=n.split(" "),t=n.length;t--;)if(n[t]!==n[0])return!1;return i[e]=n[0],!0}},b=e=>(m=!0,a[e]),v=(e,t)=>(m&&(e=e.replace(/\uFEFF[0-9]/g,(e=>a[e]))),t||(e=e.replace(/\\([\'\";:])/g,"$1")),e),y=e=>String.fromCharCode(parseInt(e.slice(1),16)),C=e=>e.replace(/\\[0-9a-f]+/gi,y),w=(t,n,o,r,s,a)=>{if(s=s||a)return"'"+(s=v(s)).replace(/\'/g,"\\'")+"'";if(n=v(n||o||r),!e.allow_script_urls){const t=n.replace(/[\s\r\n]+/g,"");if(/(java|vb)script:/i.test(t))return"";if(!e.allow_svg_data_urls&&/^data:image\/svg/i.test(t))return""}return f&&(n=f.call(g,n,"style")),"url('"+n.replace(/\'/g,"\\'")+"')"};if(t){for(t=(t=t.replace(/[\u0000-\u001F]/g,"")).replace(/\\[\"\';:\uFEFF]/g,b).replace(/\"[^\"]+\"|\'[^\']+\'/g,(e=>e.replace(/[;:]/g,b)));l=o.exec(t);)if(o.lastIndex=l.index+l[0].length,d=l[1].replace(r,"").toLowerCase(),u=l[2].replace(r,""),d&&u){if(d=C(d),u=C(u),-1!==d.indexOf("\ufeff")||-1!==d.indexOf('"'))continue;if(!e.allow_script_urls&&("behavior"===d||/expression\s*\(|\/\*|\*\//.test(u)))continue;"font-weight"===d&&"700"===u?u="bold":"color"!==d&&"background-color"!==d||(u=u.toLowerCase()),u=u.replace(n,w),i[d]=m?v(u,!0):u}p("border","",!0),p("border","-width"),p("border","-color"),p("border","-style"),p("padding",""),p("margin",""),"border",k="border-style",S="border-color",h(x="border-width")&&h(k)&&h(S)&&(i.border=i[x]+" "+i[k]+" "+i[S],delete i[x],delete i[k],delete i[S]),"medium none"===i.border&&delete i.border,"none"===i["border-image"]&&delete i["border-image"]}var x,k,S;return i},serialize:(e,t)=>{let n="";const o=t=>{let o;const r=i[t];if(r)for(let s=0,a=r.length;s<a;s++)t=r[s],o=e[t],o&&(n+=(n.length>0?" ":"")+t+": "+o+";")};return t&&i?(o("*"),o(t)):fe(e,((e,o)=>{!e||l&&!((e,t)=>{let n=l["*"];return!(n&&n[e]||(n=l[t],n&&n[e]))})(o,t)||(n+=(n.length>0?" ":"")+o+": "+e+";")})),n}};return c},Es={keyLocation:!0,layerX:!0,layerY:!0,returnValue:!0,webkitMovementX:!0,webkitMovementY:!0,keyIdentifier:!0,mozPressure:!0},Ns=(e,t)=>{const n=null!=t?t:{};for(const t in e)xe(Es,t)||(n[t]=e[t]);return C(n.composedPath)&&(n.composedPath=()=>e.composedPath()),n},Rs=(e,t,n,o)=>{var r;const s=Ns(t,o);return s.type=e,y(s.target)&&(s.target=null!==(r=s.srcElement)&&void 0!==r?r:n),(e=>y(e.preventDefault)||(e=>e instanceof Event||w(e.initEvent))(e))(t)&&(s.preventDefault=()=>{s.defaultPrevented=!0,s.isDefaultPrevented=L,w(t.preventDefault)&&t.preventDefault()},s.stopPropagation=()=>{s.cancelBubble=!0,s.isPropagationStopped=L,w(t.stopPropagation)&&t.stopPropagation()},s.stopImmediatePropagation=()=>{s.isImmediatePropagationStopped=L,s.stopPropagation()},(e=>e.isDefaultPrevented===L||e.isDefaultPrevented===P)(s)||(s.isDefaultPrevented=!0===s.defaultPrevented?L:P,s.isPropagationStopped=!0===s.cancelBubble?L:P,s.isImmediatePropagationStopped=P)),s},As=/^(?:mouse|contextmenu)|click/,Os=(e,t,n,o)=>{e.addEventListener?e.addEventListener(t,n,o||!1):e.attachEvent&&e.attachEvent("on"+t,n)},Ts=(e,t,n,o)=>{e.removeEventListener?e.removeEventListener(t,n,o||!1):e.detachEvent&&e.detachEvent("on"+t,n)},Bs=(e,t)=>{const n=Rs(e.type,e,document,t);if((e=>C(e)&&As.test(e.type))(e)&&v(e.pageX)&&!v(e.clientX)){const t=n.target.ownerDocument||document,o=t.documentElement,r=t.body,s=n;s.pageX=e.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),s.pageY=e.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)}return n},Ds=(e,t,n)=>{const o=e.document,r={type:"ready"};if(n.domLoaded)return void t(r);const s=()=>{Ts(e,"DOMContentLoaded",s),Ts(e,"load",s),n.domLoaded||(n.domLoaded=!0,t(r)),e=null};"complete"===o.readyState||"interactive"===o.readyState&&o.body?s():Os(e,"DOMContentLoaded",s),n.domLoaded||Os(e,"load",s)};class Ps{constructor(){this.domLoaded=!1,this.events={},this.count=1,this.expando="mce-data-"+(+new Date).toString(32),this.hasMouseEnterLeave="onmouseenter"in document.documentElement,this.hasFocusIn="onfocusin"in document.documentElement,this.count=1}bind(e,t,n,o){const r=this;let s,a,i,l,d,c,u;const m=window,f=e=>{r.executeHandlers(Bs(e||m.event),s)};if(!e||3===e.nodeType||8===e.nodeType)return;e[r.expando]?s=e[r.expando]:(s=r.count++,e[r.expando]=s,r.events[s]={}),o=o||e;const g=t.split(" ");for(i=g.length;i--;)l=g[i],c=f,d=u=!1,"DOMContentLoaded"===l&&(l="ready"),r.domLoaded&&"ready"===l&&"complete"===e.readyState?n.call(o,Bs({type:l})):(r.hasMouseEnterLeave||(d=r.mouseEnterLeave[l],d&&(c=e=>{const t=e.currentTarget;let n=e.relatedTarget;if(n&&t.contains)n=t.contains(n);else for(;n&&n!==t;)n=n.parentNode;n||((e=Bs(e||m.event)).type="mouseout"===e.type?"mouseleave":"mouseenter",e.target=t,r.executeHandlers(e,s))})),r.hasFocusIn||"focusin"!==l&&"focusout"!==l||(u=!0,d="focusin"===l?"focus":"blur",c=e=>{(e=Bs(e||m.event)).type="focus"===e.type?"focusin":"focusout",r.executeHandlers(e,s)}),a=r.events[s][l],a?"ready"===l&&r.domLoaded?n(Bs({type:l})):a.push({func:n,scope:o}):(r.events[s][l]=a=[{func:n,scope:o}],a.fakeName=d,a.capture=u,a.nativeHandler=c,"ready"===l?Ds(e,c,r):Os(e,d||l,c,u)));return e=a=null,n}unbind(e,t,n){let o,r,s,a,i;if(!e||3===e.nodeType||8===e.nodeType)return this;const l=e[this.expando];if(l){if(i=this.events[l],t){const l=t.split(" ");for(r=l.length;r--;)if(a=l[r],o=i[a],o){if(n)for(s=o.length;s--;)if(o[s].func===n){const e=o.nativeHandler,t=o.fakeName,n=o.capture;o=o.slice(0,s).concat(o.slice(s+1)),o.nativeHandler=e,o.fakeName=t,o.capture=n,i[a]=o}n&&0!==o.length||(delete i[a],Ts(e,o.fakeName||a,o.nativeHandler,o.capture))}}else fe(i,((t,n)=>{Ts(e,t.fakeName||n,t.nativeHandler,t.capture)})),i={};for(a in i)if(xe(i,a))return this;delete this.events[l];try{delete e[this.expando]}catch(t){e[this.expando]=null}}return this}fire(e,t,n){return this.dispatch(e,t,n)}dispatch(e,t,n){let o;if(!e||3===e.nodeType||8===e.nodeType)return this;const r=Bs({type:t,target:e},n);do{o=e[this.expando],o&&this.executeHandlers(r,o),e=e.parentNode||e.ownerDocument||e.defaultView||e.parentWindow}while(e&&!r.isPropagationStopped());return this}clean(e){let t,n;if(!e||3===e.nodeType||8===e.nodeType)return this;if(e[this.expando]&&this.unbind(e),e.getElementsByTagName||(e=e.document),e&&e.getElementsByTagName)for(this.unbind(e),n=e.getElementsByTagName("*"),t=n.length;t--;)(e=n[t])[this.expando]&&this.unbind(e);return this}destroy(){this.events={}}cancel(e){return e&&(e.preventDefault(),e.stopImmediatePropagation()),!1}executeHandlers(e,t){const n=this.events[t],o=n&&n[e.type];if(o)for(let t=0,n=o.length;t<n;t++){const n=o[t];if(n&&!1===n.func.call(n.scope,e)&&e.preventDefault(),e.isImmediatePropagationStopped())return}}}Ps.Event=new Ps;const Ls=Bt.each,Ms=Bt.grep,Is="data-mce-style",Fs=(e,t,n)=>{y(n)||""===n?Xt(e,t):qt(e,t,n)},Us=(e,t)=>{const n=Kt(t,"style"),o=e.serialize(e.parse(n),Mt(t));Fs(t,Is,o)},zs=(e,t)=>{let n,o,r=0;if(e)for(n=e.nodeType,e=e.previousSibling;e;e=e.previousSibling)o=e.nodeType,(!t||3!==o||o!==n&&e.nodeValue.length)&&(r++,n=o);return r},js=Bt.makeMap("fill-opacity font-weight line-height opacity orphans widows z-index zoom"," "),Vs=e=>e.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase())),Hs=(e,t={})=>{const n={},o=window,r={};let s=0;const a=Xo.forElement(fn(e),{contentCssCors:t.contentCssCors,referrerPolicy:t.referrerPolicy}),i=[],l=t.schema?t.schema:Ss({}),d=_s({url_converter:t.url_converter,url_converter_scope:t.url_converter_scope},t.schema),c=t.ownEvents?new Ps:Ps.Event,u=l.getBlockElements(),g=t=>t&&e&&m(t)?e.getElementById(t):t,h=e=>{const t=g(e);return C(t)?fn(t):null},b=(e,t,n)=>{let o;const r=h(e);if(C(r)&&Ut(r)){const e=J[t];o=e&&e.get?e.get(r.dom,t):Kt(r,t)}return C(o)?o:null!=n?n:""},v=e=>{const t=g(e);return y(t)?[]:t.attributes},k=(e,n,o)=>{P(e,(e=>{if(Co(e)){const r=fn(e);""===o&&(o=null);const s=Kt(r,n),a=J[n];a&&a.set?a.set(r.dom,o,n):Fs(r,n,o),s!==o&&t.onSetAttrib&&t.onSetAttrib({attrElm:r,attrName:n,attrValue:o})}}))},_=()=>t.root_element||e.body,E=(t,n)=>((e,t,n)=>{let o=0,r=0;const s=e.ownerDocument;if(n=n||e,t){if(n===e&&t.getBoundingClientRect&&"static"===qn(fn(e),"position")){const n=t.getBoundingClientRect();return o=n.left+(s.documentElement.scrollLeft||e.scrollLeft)-s.documentElement.clientLeft,r=n.top+(s.documentElement.scrollTop||e.scrollTop)-s.documentElement.clientTop,{x:o,y:r}}let a=t;for(;a&&a!==n&&a.nodeType&&!Vo(a,n);){const e=a;o+=e.offsetLeft||0,r+=e.offsetTop||0,a=e.offsetParent}for(a=t.parentNode;a&&a!==n&&a.nodeType&&!Vo(a,n);)o-=a.scrollLeft||0,r-=a.scrollTop||0,a=a.parentNode;r+=(e=>zo.isFirefox()&&"table"===Mt(e)?jo(Rn(e)).filter((e=>"caption"===Mt(e))).bind((e=>jo(Nn(e)).map((t=>{const n=t.dom.offsetTop,o=e.dom.offsetTop,r=e.dom.offsetHeight;return n<=o?-r:0})))).getOr(0):0)(fn(t))}return{x:o,y:r}})(e.body,g(t),n),R=(e,n,o)=>{const r=(e,t)=>m(e)?e:x(e)?xe(js,t)?e+"":e+"px":ge(e,r),s=(e,t,n)=>{const o=Vs(t);y(n)||""===n?Yn(e,o):Hn(e,o,r(n,o))};P(e,(e=>{const r=fn(e);m(n)?s(r,n,o):fe(n,((e,t)=>{s(r,t,e)})),t.update_styles&&Us(d,r)}))},A=(e,t,n)=>{const o=g(e);if(!y(o)&&Co(o))return n?qn(fn(o),Vs(t)):("float"===(t=t.replace(/-(\D)/g,((e,t)=>t.toUpperCase())))&&(t="cssFloat"),o.style?o.style[t]:void 0)},O=e=>{let t,n;const o=g(e);return t=A(o,"width"),n=A(o,"height"),-1===t.indexOf("px")&&(t=0),-1===n.indexOf("px")&&(n=0),{w:parseInt(t,10)||o.offsetWidth||o.clientWidth,h:parseInt(n,10)||o.offsetHeight||o.clientHeight}},T=(e,t)=>{if(!e)return!1;const n=p(e)?e:[e];return V(n,(e=>hn(fn(e),t)))},B=(e,t,n,o)=>{const r=[];let s,a=g(e);for(o=void 0===o,n=n||("BODY"!==_().nodeName?_().parentNode:null),m(t)&&(s=t,t="*"===t?Co:e=>T(e,s));a&&!(a===n||y(a.nodeType)||Bo(a)||Do(a));){if(!t||t(a)){if(!o)return[a];r.push(a)}a=a.parentNode}return o?r:null},D=(e,t,n)=>{let o=t;if(e)for(m(t)&&(o=e=>T(e,t)),e=e[n];e;e=e[n])if(w(o)&&o(e))return e;return null},P=function(e,t,n){const o=null!=n?n:this,r=m(e)?g(e):e;if(!r)return!1;if(p(r)&&(r.length||0===r.length)){const e=[];return Ls(r,((n,r)=>{n&&e.push(t.call(o,m(n)?g(n):n,r))})),e}return t.call(o,r)},L=(e,t)=>{P(e,(e=>{fe(t,((t,n)=>{k(e,n,t)}))}))},M=(e,t)=>{P(e,(e=>{const n=fn(e);so(n,t)}))},I=(t,n,o,r,s)=>P(t,(t=>{const a=m(n)?e.createElement(n):n;return C(o)&&L(a,o),r&&(!m(r)&&r.nodeType?a.appendChild(r):m(r)&&M(a,r)),s?a:t.appendChild(a)})),F=(t,n,o)=>I(e.createElement(t),t,n,o,!0),U=ms.encodeAllRaw,z=(e,t)=>P(e,(e=>{const n=fn(e);return t&&$(Rn(n),(e=>{zt(e)&&0===e.dom.length?no(e):Xn(n,e)})),no(n),n.dom})),H=(e,t,n)=>{P(e,(e=>{if(Co(e)){const o=fn(e),r=t.split(" ");$(r,(e=>{C(n)?(n?on:sn)(o,e):((e,t)=>{const n=Zt(e)?e.dom.classList.toggle(t):((e,t)=>j(en(e),t)?nn(e,t):tn(e,t))(e,t);rn(e)})(o,e)}))}}))},q=(e,t,n)=>P(t,(t=>(p(t)&&(e=e.cloneNode(!0)),n&&Ls(Ms(t.childNodes),(t=>{e.appendChild(t)})),t.parentNode.replaceChild(e,t)))),W=e=>{if(Co(e)){const t="a"===e.nodeName.toLowerCase()&&!b(e,"href")&&b(e,"id");if(b(e,"name")||b(e,"data-mce-bookmark")||t)return!0}return!1},K=()=>e.createRange(),G=(n,r,s,a)=>{if(p(n)){let e=n.length;const t=[];for(;e--;)t[e]=G(n[e],r,s,a);return t}return!t.collect||n!==e&&n!==o||i.push([n,r,s,a]),c.bind(n,r,s,a||Q)},Y=(t,n,r)=>{if(p(t)){let e=t.length;const o=[];for(;e--;)o[e]=Y(t[e],n,r);return o}if(i.length>0&&(t===e||t===o)){let e=i.length;for(;e--;){const o=i[e];t!==o[0]||n&&n!==o[1]||r&&r!==o[2]||c.unbind(o[0],o[1],o[2])}}return c.unbind(t,n,r)},X=e=>{if(e&&Co(e)){const t=e.getAttribute("data-mce-contenteditable");return t&&"inherit"!==t?t:"inherit"!==e.contentEditable?e.contentEditable:null}return null},Q={doc:e,settings:t,win:o,files:r,stdMode:!0,boxModel:!0,styleSheetLoader:a,boundEvents:i,styles:d,schema:l,events:c,isBlock:e=>m(e)?xe(u,e):Co(e)&&xe(u,e.nodeName),root:null,clone:(e,t)=>e.cloneNode(t),getRoot:_,getViewPort:e=>{const t=bo(e);return{x:t.x,y:t.y,w:t.width,h:t.height}},getRect:e=>{const t=g(e),n=E(t),o=O(t);return{x:n.x,y:n.y,w:o.w,h:o.h}},getSize:O,getParent:(e,t,n)=>{const o=B(e,t,n,!1);return o&&o.length>0?o[0]:null},getParents:B,get:g,getNext:(e,t)=>D(e,t,"nextSibling"),getPrev:(e,t)=>D(e,t,"previousSibling"),select:(n,o)=>{var r,s;const a=null!==(s=null!==(r=g(o))&&void 0!==r?r:t.root_element)&&void 0!==s?s:e;return de(a.querySelectorAll(n))},is:T,add:I,create:F,createHTML:(e,t,n="")=>{let o,r="";for(o in r+="<"+e,t)ke(t,o)&&(r+=" "+o+'="'+U(t[o])+'"');return Ke(n)&&xe(l.getVoidElements(),e)?r+" />":r+">"+n+"</"+e+">"},createFragment:t=>{let n;const o=e.createElement("div"),r=e.createDocumentFragment();for(r.appendChild(o),t&&(o.innerHTML=t);n=o.firstChild;)r.appendChild(n);return r.removeChild(o),r},remove:z,setStyle:R,getStyle:A,setStyles:(e,t)=>{R(e,t)},removeAllAttribs:e=>P(e,(e=>{const t=e.attributes;for(let n=t.length-1;n>=0;n--)e.removeAttributeNode(t.item(n))})),setAttrib:k,setAttribs:L,getAttrib:b,getPos:E,parseStyle:e=>d.parse(e),serializeStyle:(e,t)=>d.serialize(e,t),addStyle:t=>{let o,r;if(Q!==Hs.DOM&&e===document){if(n[t])return;n[t]=!0}r=e.getElementById("mceDefaultStyles"),r||(r=e.createElement("style"),r.id="mceDefaultStyles",r.type="text/css",o=e.getElementsByTagName("head")[0],o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r)),r.styleSheet?r.styleSheet.cssText+=t:r.appendChild(e.createTextNode(t))},loadCSS:e=>{e||(e=""),$(e.split(","),(e=>{r[e]=!0,a.load(e).catch(S)}))},addClass:(e,t)=>{H(e,t,!0)},removeClass:(e,t)=>{H(e,t,!1)},hasClass:(e,t)=>{const n=h(e),o=t.split(" ");return te(o,(e=>an(n,e)))},toggleClass:H,show:e=>{P(e,(e=>Yn(fn(e),"display")))},hide:e=>{P(e,(e=>Hn(fn(e),"display","none")))},isHidden:e=>{const t=h(e);return Dt(Kn(t,"display"),"none")},uniqueId:e=>(e||"mce_")+s++,setHTML:M,getOuterHTML:e=>{const t=h(e);return Co(t.dom)?t.dom.outerHTML:(e=>{const t=un("div"),n=fn(e.dom.cloneNode(!0));return Zn(t,n),ro(t)})(t)},setOuterHTML:(e,t)=>{P(e,(e=>{Co(e)&&(e.outerHTML=t)}))},decode:ms.decode,encode:U,insertAfter:(e,t)=>{const n=g(t);return P(e,(e=>{const t=n.parentNode,o=n.nextSibling;return o?t.insertBefore(e,o):t.appendChild(e),e}))},replace:q,rename:(e,t)=>{let n;return e.nodeName!==t.toUpperCase()&&(n=F(t),Ls(v(e),(t=>{k(n,t.nodeName,b(e,t.nodeName))})),q(n,e,!0)),n||e},findCommonAncestor:(e,t)=>{let n,o=e;for(;o;){for(n=t;n&&o!==n;)n=n.parentNode;if(o===n)break;o=o.parentNode}return!o&&e.ownerDocument?e.ownerDocument.documentElement:o},run:P,getAttribs:v,isEmpty:(e,t)=>{let n,o,r=0;if(W(e))return!1;if(e=e.firstChild){const s=new Qo(e,e.parentNode),a=l?l.getWhitespaceElements():{};t=t||(l?l.getNonEmptyElements():null);do{if(n=e.nodeType,Co(e)){const n=e.getAttribute("data-mce-bogus");if(n){e=s.next("all"===n);continue}if(o=e.nodeName.toLowerCase(),t&&t[o]){if("br"===o){r++,e=s.next();continue}return!1}if(W(e))return!1}if(8===n)return!1;if(3===n&&!Vr(e.nodeValue))return!1;if(3===n&&e.parentNode&&a[e.parentNode.nodeName]&&Vr(e.nodeValue))return!1;e=s.next()}while(e)}return r<=1},createRng:K,nodeIndex:zs,split:(e,t,n)=>{let o,r,s,a=K();if(e&&t)return a.setStart(e.parentNode,zs(e)),a.setEnd(t.parentNode,zs(t)),o=a.extractContents(),a=K(),a.setStart(t.parentNode,zs(t)+1),a.setEnd(e.parentNode,zs(e)+1),r=a.extractContents(),s=e.parentNode,s.insertBefore(Jr(Q,o),e),n?s.insertBefore(n,e):s.insertBefore(t,e),s.insertBefore(Jr(Q,r),e),z(e),n||t},bind:G,unbind:Y,fire:(e,t,n)=>c.dispatch(e,t,n),dispatch:(e,t,n)=>c.dispatch(e,t,n),getContentEditable:X,getContentEditableParent:e=>{const t=_();let n=null;for(;e&&e!==t&&(n=X(e),null===n);e=e.parentNode);return n},destroy:()=>{if(i.length>0){let e=i.length;for(;e--;){const t=i[e];c.unbind(t[0],t[1],t[2])}}fe(r,((e,t)=>{a.unload(t),delete r[t]}))},isChildOf:(e,t)=>e===t||t.contains(e),dumpRng:e=>"startContainer: "+e.startContainer.nodeName+", startOffset: "+e.startOffset+", endContainer: "+e.endContainer.nodeName+", endOffset: "+e.endOffset},J=((e,t,n)=>{const o=t.keep_values,r={set:(e,o,r)=>{const s=fn(e);w(t.url_converter)&&C(o)&&(o=t.url_converter.call(t.url_converter_scope||n(),o,r,e[0])),Fs(s,"data-mce-"+r,o),Fs(s,r,o)},get:(e,t)=>{const n=fn(e);return Kt(n,"data-mce-"+t)||Kt(n,t)}},s={style:{set:(t,n)=>{const r=fn(t);f(n)?$n(r,n):(o&&Fs(r,Is,n),Xt(r,"style"),m(n)&&$n(r,e.parse(n)))},get:t=>{const n=fn(t),o=Kt(n,Is)||Kt(n,"style");return e.serialize(e.parse(o),Mt(n))}}};return o&&(s.href=s.src=r),s})(d,t,N(Q));return Q};Hs.DOM=Hs(document),Hs.nodeIndex=zs;const $s=Hs.DOM;class qs{constructor(e={}){this.states={},this.queue=[],this.scriptLoadedCallbacks={},this.queueLoadedCallbacks=[],this.loading=!1,this.settings=e}_setReferrerPolicy(e){this.settings.referrerPolicy=e}loadScript(e){return new Promise(((t,n)=>{const o=$s;let r;const s=()=>{o.remove(a),r&&(r.onerror=r.onload=r=null)},a=o.uniqueId();r=document.createElement("script"),r.id=a,r.type="text/javascript",r.src=Bt._addCacheSuffix(e),this.settings.referrerPolicy&&o.setAttrib(r,"referrerpolicy",this.settings.referrerPolicy),r.onload=()=>{s(),t()},r.onerror=()=>{s(),n("Failed to load script: "+e)},(document.getElementsByTagName("head")[0]||document.body).appendChild(r)}))}isDone(e){return 2===this.states[e]}markDone(e){this.states[e]=2}add(e){const t=this;return t.queue.push(e),void 0===t.states[e]&&(t.states[e]=0),new Promise(((n,o)=>{t.scriptLoadedCallbacks[e]||(t.scriptLoadedCallbacks[e]=[]),t.scriptLoadedCallbacks[e].push({resolve:n,reject:o})}))}load(e){return this.add(e)}remove(e){delete this.states[e],delete this.scriptLoadedCallbacks[e]}loadQueue(){const e=this.queue;return this.queue=[],this.loadScripts(e)}loadScripts(e){const t=this,n=(e,n)=>{we(t.scriptLoadedCallbacks,n).each((t=>{$(t,(t=>t[e](n)))})),delete t.scriptLoadedCallbacks[n]},o=e=>{const t=K(e,(e=>"rejected"===e.status));return t.length>0?Promise.reject(ee(t,(({reason:e})=>p(e)?e:[e]))):Promise.resolve()},r=e=>Promise.allSettled(H(e,(e=>2===t.states[e]?(n("resolve",e),Promise.resolve()):3===t.states[e]?(n("reject",e),Promise.reject(e)):(t.states[e]=1,t.loadScript(e).then((()=>{t.states[e]=2,n("resolve",e);const s=t.queue;if(s.length>0)return t.queue=[],r(s).then(o)}),(()=>(t.states[e]=3,n("reject",e),Promise.reject(e)))))))),s=e=>(t.loading=!0,r(e).then((e=>{t.loading=!1;const n=t.queueLoadedCallbacks.shift();return M.from(n).each(D),o(e)}))),a=Se(e);return t.loading?new Promise(((e,n)=>{t.queueLoadedCallbacks.push((()=>s(a).then(e,n)))})):s(a)}}qs.ScriptLoader=new qs;const Ws=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},Ks={},Gs=Ws("en"),Ys=()=>we(Ks,Gs.get()),Xs={getData:()=>ge(Ks,(e=>({...e}))),setCode:e=>{e&&Gs.set(e)},getCode:()=>Gs.get(),add:(e,t)=>{let n=Ks[e];n||(Ks[e]=n={}),fe(t,((e,t)=>{n[t.toLowerCase()]=e}))},translate:e=>{const t=Ys().getOr({}),n=e=>w(e)?Object.prototype.toString.call(e):o(e)?"":""+e,o=e=>""===e||null==e,r=e=>{const o=n(e);return we(t,o.toLowerCase()).map(n).getOr(o)},s=e=>e.replace(/{context:\w+}$/,"");if(o(e))return"";if(f(a=e)&&xe(a,"raw"))return n(e.raw);var a;if((e=>p(e)&&e.length>1)(e)){const t=e.slice(1);return s(r(e[0]).replace(/\{([0-9]+)\}/g,((e,o)=>xe(t,o)?n(t[o]):e)))}return s(r(e))},isRtl:()=>Ys().bind((e=>we(e,"_dir"))).exists((e=>"rtl"===e)),hasCode:e=>xe(Ks,e)},Qs=()=>{const e=[],t={},n={},o=[],r=(e,t)=>{const n=K(o,(n=>n.name===e&&n.state===t));$(n,(e=>e.resolve()))},s=e=>xe(t,e),a=(e,n)=>{const o=Xs.getCode();!o||n&&-1===(","+(n||"")+",").indexOf(","+o+",")||qs.ScriptLoader.add(t[e]+"/langs/"+o+".js")},i=(e,t="added")=>"added"===t&&(e=>xe(n,e))(e)||"loaded"===t&&s(e)?Promise.resolve():new Promise((n=>{o.push({name:e,state:t,resolve:n})}));return{items:e,urls:t,lookup:n,get:e=>{if(n[e])return n[e].instance},requireLangPack:(e,t)=>{!1!==Qs.languageLoad&&(s(e)?a(e,t):i(e,"loaded").then((()=>a(e,t))))},add:(t,o)=>(e.push(o),n[t]={instance:o},r(t,"added"),o),remove:e=>{delete t[e],delete n[e]},createUrl:(e,t)=>m(t)?m(e)?{prefix:"",resource:t,suffix:""}:{prefix:e.prefix,resource:t,suffix:e.suffix}:t,load:(e,o)=>{if(t[e])return Promise.resolve();let s=m(o)?o:o.prefix+o.resource+o.suffix;0!==s.indexOf("/")&&-1===s.indexOf("://")&&(s=Qs.baseURL+"/"+s),t[e]=s.substring(0,s.lastIndexOf("/"));const a=()=>(r(e,"loaded"),Promise.resolve());return n[e]?a():qs.ScriptLoader.add(s).then(a)},waitFor:i}};Qs.languageLoad=!0,Qs.baseURL="",Qs.PluginManager=Qs(),Qs.ThemeManager=Qs(),Qs.ModelManager=Qs();const Js=()=>{const e=(e=>{const t=Ws(M.none()),n=()=>t.get().each(e);return{clear:()=>{n(),t.set(M.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{n(),t.set(M.some(e))}}})(S);return{...e,on:t=>e.get().each(t)}},Zs=(e,t)=>{let n=null;return{cancel:()=>{h(n)||(clearTimeout(n),n=null)},throttle:(...o)=>{h(n)&&(n=setTimeout((()=>{n=null,e.apply(null,o)}),t))}}},ea=(e,t)=>{let n=null;const o=()=>{h(n)||(clearTimeout(n),n=null)};return{cancel:o,throttle:(...r)=>{o(),n=setTimeout((()=>{n=null,e.apply(null,r)}),t)}}},ta=(e,t)=>{let n=[];return $(Rn(e),(e=>{t(e)&&(n=n.concat([e])),n=n.concat(ta(e,t))})),n},na=(e,t)=>((e,t)=>{const n=void 0===t?document:t.dom;return bn(n)?[]:H(n.querySelectorAll(e),fn)})(t,e),oa=N("mce-annotation"),ra=N("data-mce-annotation"),sa=N("data-mce-annotation-uid"),aa=N("data-mce-annotation-active"),ia=N("data-mce-annotation-classes"),la=N("data-mce-annotation-attrs"),da=e=>t=>vn(t,e),ca=(e,t)=>{const n=e.selection.getRng(),o=fn(n.startContainer),r=fn(e.getBody()),s=t.fold((()=>"."+oa()),(e=>`[${ra()}="${e}"]`)),a=An(o,n.startOffset).getOr(o),i=Go(a,s,da(r)),l=(e,t)=>Yt(e,t)?M.some(Kt(e,t)):M.none();return i.bind((t=>l(t,`${sa()}`).bind((n=>l(t,`${ra()}`).map((t=>{const o=ma(e,n);return{uid:n,name:t,elements:o}}))))))},ua=(e,t)=>Yt(e,"data-mce-bogus")||ur(e,'[data-mce-bogus="all"]',da(t)),ma=(e,t)=>{const n=fn(e.getBody()),o=na(n,`[${sa()}="${t}"]`);return K(o,(e=>!ua(e,n)))},fa=(e,t)=>{const n=fn(e.getBody()),o=na(n,`[${ra()}="${t}"]`),r={};return $(o,(e=>{if(!ua(e,n)){const t=Kt(e,sa()),n=we(r,t).getOr([]);r[t]=n.concat([e])}})),r};let ga=0;const pa=e=>{const t=(new Date).getTime(),n=Math.floor(1e9*Math.random());return ga++,e+"_"+n+ga+String(t)},ha=(e,t)=>fn(e.dom.cloneNode(t)),ba=e=>ha(e,!1),va=e=>ha(e,!0),ya=(e,t,n=P)=>{const o=new Qo(e,t),r=e=>{let t;do{t=o[e]()}while(t&&!Ro(t)&&!n(t));return M.from(t).filter(Ro)};return{current:()=>M.from(o.current()).filter(Ro),next:()=>r("next"),prev:()=>r("prev"),prev2:()=>r("prev2")}},Ca=(e,t)=>{const n=t||(t=>e.isBlock(t)||Po(t)||Io(t)),o=(e,t,n,r)=>{if(Ro(e)){const n=r(e,t,e.data);if(-1!==n)return M.some({container:e,offset:n})}return n().bind((e=>o(e.container,e.offset,n,r)))};return{backwards:(e,t,r,s)=>{const a=ya(e,s,n);return o(e,t,(()=>a.prev().map((e=>({container:e,offset:e.length})))),r).getOrNull()},forwards:(e,t,r,s)=>{const a=ya(e,s,n);return o(e,t,(()=>a.next().map((e=>({container:e,offset:0})))),r).getOrNull()}}},wa=Math.round,xa=e=>e?{left:wa(e.left),top:wa(e.top),bottom:wa(e.bottom),right:wa(e.right),width:wa(e.width),height:wa(e.height)}:{left:0,top:0,bottom:0,right:0,width:0,height:0},ka=(e,t)=>(e=xa(e),t||(e.left=e.left+e.width),e.right=e.left,e.width=0,e),Sa=(e,t,n)=>e>=0&&e<=Math.min(t.height,n.height)/2,_a=(e,t)=>{const n=Math.min(t.height/2,e.height/2);return e.bottom-n<t.top||!(e.top>t.bottom)&&Sa(t.top-e.bottom,e,t)},Ea=(e,t)=>e.top>t.bottom||!(e.bottom<t.top)&&Sa(t.bottom-e.top,e,t),Na=(e,t,n)=>{const o=Math.max(Math.min(t,e.left+e.width),e.left),r=Math.max(Math.min(n,e.top+e.height),e.top);return Math.sqrt((t-o)*(t-o)+(n-r)*(n-r))},Ra=e=>{const t=e.startContainer,n=e.startOffset;return t===e.endContainer&&t.hasChildNodes()&&e.endOffset===n+1?t.childNodes[n]:null},Aa=(e,t)=>{if(Co(e)&&e.hasChildNodes()){const n=e.childNodes,o=((e,t,n)=>Math.min(Math.max(e,0),n))(t,0,n.length-1);return n[o]}return e},Oa=new RegExp("[\u0300-\u036f\u0483-\u0487\u0488-\u0489\u0591-\u05bd\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05c7\u0610-\u061a\u064b-\u065f\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7-\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08e3-\u0902\u093a\u093c\u0941-\u0948\u094d\u0951-\u0957\u0962-\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2-\u09e3\u0a01-\u0a02\u0a3c\u0a41-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a51\u0a70-\u0a71\u0a75\u0a81-\u0a82\u0abc\u0ac1-\u0ac5\u0ac7-\u0ac8\u0acd\u0ae2-\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62-\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c00\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56\u0c62-\u0c63\u0c81\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc-\u0ccd\u0cd5-\u0cd6\u0ce2-\u0ce3\u0d01\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62-\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb-\u0ebc\u0ec8-\u0ecd\u0f18-\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86-\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039-\u103a\u103d-\u103e\u1058-\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085-\u1086\u108d\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17b4-\u17b5\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927-\u1928\u1932\u1939-\u193b\u1a17-\u1a18\u1a1b\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1ab0-\u1abd\u1abe\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80-\u1b81\u1ba2-\u1ba5\u1ba8-\u1ba9\u1bab-\u1bad\u1be6\u1be8-\u1be9\u1bed\u1bef-\u1bf1\u1c2c-\u1c33\u1c36-\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1cf4\u1cf8-\u1cf9\u1dc0-\u1df5\u1dfc-\u1dff\u200c-\u200d\u20d0-\u20dc\u20dd-\u20e0\u20e1\u20e2-\u20e4\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302d\u302e-\u302f\u3099-\u309a\ua66f\ua670-\ua672\ua674-\ua67d\ua69e-\ua69f\ua6f0-\ua6f1\ua802\ua806\ua80b\ua825-\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\ua9e5\uaa29-\uaa2e\uaa31-\uaa32\uaa35-\uaa36\uaa43\uaa4c\uaa7c\uaab0\uaab2-\uaab4\uaab7-\uaab8\uaabe-\uaabf\uaac1\uaaec-\uaaed\uaaf6\uabe5\uabe8\uabed\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\uff9e-\uff9f]"),Ta=e=>"string"==typeof e&&e.charCodeAt(0)>=768&&Oa.test(e),Ba=Co,Da=Fr,Pa=xo("display","block table"),La=xo("float","left right"),Ma=((...e)=>t=>{for(let n=0;n<e.length;n++)if(!e[n](t))return!1;return!0})(Ba,Da,T(La)),Ia=T(xo("white-space","pre pre-line pre-wrap")),Fa=Ro,Ua=Po,za=Hs.nodeIndex,ja=(e,t)=>t<0&&Co(e)&&e.hasChildNodes()?void 0:Aa(e,t),Va=e=>"createRange"in e?e.createRange():Hs.DOM.createRng(),Ha=e=>e&&/[\r\n\t ]/.test(e),$a=e=>!!e.setStart&&!!e.setEnd,qa=e=>{const t=e.startContainer,n=e.startOffset;if(Ha(e.toString())&&Ia(t.parentNode)&&Ro(t)){const e=t.data;if(Ha(e[n-1])||Ha(e[n+1]))return!0}return!1},Wa=e=>0===e.left&&0===e.right&&0===e.top&&0===e.bottom,Ka=e=>{let t;const n=e.getClientRects();return t=n.length>0?xa(n[0]):xa(e.getBoundingClientRect()),!$a(e)&&Ua(e)&&Wa(t)?(e=>{const t=e.ownerDocument,n=Va(t),o=t.createTextNode(fr),r=e.parentNode;r.insertBefore(o,e),n.setStart(o,0),n.setEnd(o,1);const s=xa(n.getBoundingClientRect());return r.removeChild(o),s})(e):Wa(t)&&$a(e)?(e=>{const t=e.startContainer,n=e.endContainer,o=e.startOffset,r=e.endOffset;if(t===n&&Ro(n)&&0===o&&1===r){const t=e.cloneRange();return t.setEndAfter(n),Ka(t)}return null})(e):t},Ga=(e,t)=>{const n=ka(e,t);return n.width=1,n.right=n.left+1,n},Ya=(e,t,n)=>{const o=()=>(n||(n=(e=>{const t=[],n=e=>{var n,o;0!==e.height&&(t.length>0&&(n=e,o=t[t.length-1],n.left===o.left&&n.top===o.top&&n.bottom===o.bottom&&n.right===o.right)||t.push(e))},o=(e,o)=>{const r=Va(e.ownerDocument);if(o<e.data.length){if(Ta(e.data[o]))return t;if(Ta(e.data[o-1])&&(r.setStart(e,o),r.setEnd(e,o+1),!qa(r)))return n(Ga(Ka(r),!1)),t}o>0&&(r.setStart(e,o-1),r.setEnd(e,o),qa(r)||n(Ga(Ka(r),!1))),o<e.data.length&&(r.setStart(e,o),r.setEnd(e,o+1),qa(r)||n(Ga(Ka(r),!0)))},r=e.container(),s=e.offset();if(Fa(r))return o(r,s),t;if(Ba(r))if(e.isAtEnd()){const e=ja(r,s);Fa(e)&&o(e,e.data.length),Ma(e)&&!Ua(e)&&n(Ga(Ka(e),!1))}else{const a=ja(r,s);if(Fa(a)&&o(a,0),Ma(a)&&e.isAtEnd())return n(Ga(Ka(a),!1)),t;const i=ja(e.container(),e.offset()-1);Ma(i)&&!Ua(i)&&(Pa(i)||Pa(a)||!Ma(a))&&n(Ga(Ka(i),!1)),Ma(a)&&n(Ga(Ka(a),!0))}return t})(Ya(e,t))),n);return{container:N(e),offset:N(t),toRange:()=>{const n=Va(e.ownerDocument);return n.setStart(e,t),n.setEnd(e,t),n},getClientRects:o,isVisible:()=>o().length>0,isAtStart:()=>(Fa(e),0===t),isAtEnd:()=>Fa(e)?t>=e.data.length:t>=e.childNodes.length,isEqual:n=>n&&e===n.container()&&t===n.offset(),getNode:n=>ja(e,n?t-1:t)}};Ya.fromRangeStart=e=>Ya(e.startContainer,e.startOffset),Ya.fromRangeEnd=e=>Ya(e.endContainer,e.endOffset),Ya.after=e=>Ya(e.parentNode,za(e)+1),Ya.before=e=>Ya(e.parentNode,za(e)),Ya.isAbove=(e,t)=>Pt(ie(t.getClientRects()),le(e.getClientRects()),_a).getOr(!1),Ya.isBelow=(e,t)=>Pt(le(t.getClientRects()),ie(e.getClientRects()),Ea).getOr(!1),Ya.isAtStart=e=>!!e&&e.isAtStart(),Ya.isAtEnd=e=>!!e&&e.isAtEnd(),Ya.isTextPosition=e=>!!e&&Ro(e.container()),Ya.isElementPosition=e=>!1===Ya.isTextPosition(e);const Xa=(e,t)=>{Ro(t)&&0===t.data.length&&e.remove(t)},Qa=(e,t,n)=>{Do(n)?((e,t,n)=>{const o=M.from(n.firstChild),r=M.from(n.lastChild);t.insertNode(n),o.each((t=>Xa(e,t.previousSibling))),r.each((t=>Xa(e,t.nextSibling)))})(e,t,n):((e,t,n)=>{t.insertNode(n),Xa(e,n.previousSibling),Xa(e,n.nextSibling)})(e,t,n)},Ja=Ro,Za=So,ei=Hs.nodeIndex,ti=e=>{const t=e.parentNode;return Za(t)?ti(t):t},ni=e=>e?Oe(e.childNodes,((e,t)=>(Za(t)&&"BR"!==t.nodeName?e=e.concat(ni(t)):e.push(t),e)),[]):[],oi=e=>t=>e===t,ri=e=>{let t;return t=Ja(e)?"text()":e.nodeName.toLowerCase(),t+"["+(e=>{let t,n;t=ni(ti(e)),n=Te(t,oi(e),e),t=t.slice(0,n+1);const o=Oe(t,((e,n,o)=>(Ja(n)&&Ja(t[o-1])&&e++,e)),0);return t=Re(t,wo([e.nodeName])),n=Te(t,oi(e),e),n-o})(e)+"]"},si=(e,t)=>{let n,o,r,s,a,i=[];return n=t.container(),o=t.offset(),Ja(n)?r=((e,t)=>{for(;(e=e.previousSibling)&&Ja(e);)t+=e.data.length;return t})(n,o):(s=n.childNodes,o>=s.length?(r="after",o=s.length-1):r="before",n=s[o]),i.push(ri(n)),a=((e,t,n)=>{const o=[];for(t=t.parentNode;t!==e;t=t.parentNode)o.push(t);return o})(e,n),a=Re(a,T(So)),i=i.concat(Ne(a,(e=>ri(e)))),i.reverse().join("/")+","+r},ai=(e,t)=>{let n;if(!t)return null;const o=t.split(","),r=o[0].split("/");n=o.length>1?o[1]:"before";const s=Oe(r,((e,t)=>{const n=/([\w\-\(\)]+)\[([0-9]+)\]/.exec(t);return n?("text()"===n[1]&&(n[1]="#text"),((e,t,n)=>{let o=ni(e);return o=Re(o,((e,t)=>!Ja(e)||!Ja(o[t-1]))),o=Re(o,wo([t])),o[n]})(e,n[1],parseInt(n[2],10))):null}),e);return s?Ja(s)?((e,t)=>{let n,o=e,r=0;for(;Ja(o);){if(n=o.data.length,t>=r&&t<=r+n){e=o,t-=r;break}if(!Ja(o.nextSibling)){e=o,t=n;break}r+=n,o=o.nextSibling}return Ja(e)&&t>e.data.length&&(t=e.data.length),Ya(e,t)})(s,parseInt(n,10)):(n="after"===n?ei(s)+1:ei(s),Ya(s.parentNode,n)):null},ii=Io,li=(e,t,n,o,r)=>{let s=o[r?"startContainer":"endContainer"],a=o[r?"startOffset":"endOffset"];const i=[];let l,d=0;const c=e.getRoot();for(Ro(s)?i.push(n?((e,t,n)=>{let o,r;for(r=e(t.data.slice(0,n)).length,o=t.previousSibling;o&&Ro(o);o=o.previousSibling)r+=e(o.data).length;return r})(t,s,a):a):(l=s.childNodes,a>=l.length&&l.length&&(d=1,a=Math.max(0,l.length-1)),i.push(e.nodeIndex(l[a],n)+d));s&&s!==c;s=s.parentNode)i.push(e.nodeIndex(s,n));return i},di=(e,t,n)=>{let o=0;return Bt.each(e.select(t),(e=>{if("all"!==e.getAttribute("data-mce-bogus"))return e!==n&&void o++})),o},ci=(e,t)=>{let n,o;const r=t?"start":"end";if(n=e[r+"Container"],o=e[r+"Offset"],Co(n)&&"TR"===n.nodeName){const r=n.childNodes;n=r[Math.min(t?o:o-1,r.length-1)],n&&(o=t?0:n.childNodes.length,e["set"+(t?"Start":"End")](n,o))}},ui=e=>(ci(e,!0),ci(e,!1),e),mi=(e,t)=>{let n;if(Co(e)&&(e=Aa(e,t),ii(e)))return e;if(xr(e)){if(Ro(e)&&Cr(e)&&(e=e.parentNode),n=e.previousSibling,ii(n))return n;if(n=e.nextSibling,ii(n))return n}},fi=(e,t,n)=>{const o=n.getNode();let r=o?o.nodeName:null;const s=n.getRng();if(ii(o)||"IMG"===r)return{name:r,index:di(n.dom,r,o)};const a=(e=>mi(e.startContainer,e.startOffset)||mi(e.endContainer,e.endOffset))(s);return a?(r=a.tagName,{name:r,index:di(n.dom,r,a)}):((e,t,n,o)=>{const r=t.dom,s=li(r,e,n,o,!0),a=t.isForward(),i=Ar(o)?{isFakeCaret:!0}:{};return t.isCollapsed()?{start:s,forward:a,...i}:{start:s,end:li(r,e,n,o,!1),forward:a,...i}})(e,n,t,s)},gi=(e,t,n)=>{const o={"data-mce-type":"bookmark",id:t,style:"overflow:hidden;line-height:0px"};return n?e.create("span",o,"&#xFEFF;"):e.create("span",o)},pi=(e,t)=>{const n=e.dom;let o=e.getRng();const r=n.uniqueId(),s=e.isCollapsed(),a=e.getNode(),i=a.nodeName,l=e.isForward();if("IMG"===i)return{name:i,index:di(n,i,a)};const d=ui(o.cloneRange());if(!s){d.collapse(!1);const e=gi(n,r+"_end",t);Qa(n,d,e)}o=ui(o),o.collapse(!0);const c=gi(n,r+"_start",t);return Qa(n,o,c),e.moveToBookmark({id:r,keep:!0,forward:l}),{id:r,forward:l}},hi=O(fi,R,!0),bi=e=>{const t=t=>t(e),n=N(e),o=()=>r,r={tag:!0,inner:e,fold:(t,n)=>n(e),isValue:L,isError:P,map:t=>yi.value(t(e)),mapError:o,bind:t,exists:t,forall:t,getOr:n,or:o,getOrThunk:n,orThunk:o,getOrDie:n,each:t=>{t(e)},toOptional:()=>M.some(e)};return r},vi=e=>{const t=()=>n,n={tag:!1,inner:e,fold:(t,n)=>t(e),isValue:P,isError:L,map:t,mapError:t=>yi.error(t(e)),bind:t,exists:P,forall:L,getOr:R,or:R,getOrThunk:B,orThunk:B,getOrDie:(o=String(e),()=>{throw new Error(o)}),each:S,toOptional:M.none};var o;return n},yi={value:bi,error:vi,fromOption:(e,t)=>e.fold((()=>vi(t)),bi)},Ci=e=>{if(!p(e))throw new Error("cases must be an array");if(0===e.length)throw new Error("there must be at least one case");const t=[],n={};return $(e,((o,r)=>{const s=ue(o);if(1!==s.length)throw new Error("one and only one name per case");const a=s[0],i=o[a];if(void 0!==n[a])throw new Error("duplicate key detected:"+a);if("cata"===a)throw new Error("cannot have a case named cata (sorry)");if(!p(i))throw new Error("case arguments must be an array");t.push(a),n[a]=(...n)=>{const o=n.length;if(o!==i.length)throw new Error("Wrong number of arguments to case "+a+". Expected "+i.length+" ("+i+"), got "+o);return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);return t[r].apply(null,n)},match:e=>{const o=ue(e);if(t.length!==o.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+o.join(","));if(!te(t,(e=>j(o,e))))throw new Error("Not all branches were specified when using match. Specified: "+o.join(", ")+"\nRequired: "+t.join(", "));return e[a].apply(null,n)},log:e=>{console.log(e,{constructors:t,constructor:a,params:n})}}}})),n};Ci([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const wi=e=>"inline-command"===e.type||"inline-format"===e.type,xi=e=>"block-command"===e.type||"block-format"===e.type,ki=e=>{const t=t=>yi.error({message:t,pattern:e}),n=(n,o,r)=>{if(void 0!==e.format){let r;if(p(e.format)){if(!te(e.format,m))return t(n+" pattern has non-string items in the `format` array");r=e.format}else{if(!m(e.format))return t(n+" pattern has non-string `format` parameter");r=[e.format]}return yi.value(o(r))}return void 0!==e.cmd?m(e.cmd)?yi.value(r(e.cmd,e.value)):t(n+" pattern has non-string `cmd` parameter"):t(n+" pattern is missing both `format` and `cmd` parameters")};if(!f(e))return t("Raw pattern is not an object");if(!m(e.start))return t("Raw pattern is missing `start` parameter");if(void 0!==e.end){if(!m(e.end))return t("Inline pattern has non-string `end` parameter");if(0===e.start.length&&0===e.end.length)return t("Inline pattern has empty `start` and `end` parameters");let o=e.start,r=e.end;return 0===r.length&&(r=o,o=""),n("Inline",(e=>({type:"inline-format",start:o,end:r,format:e})),((e,t)=>({type:"inline-command",start:o,end:r,cmd:e,value:t})))}return void 0!==e.replacement?m(e.replacement)?0===e.start.length?t("Replacement pattern has empty `start` parameter"):yi.value({type:"inline-command",start:"",end:e.start,cmd:"mceInsertContent",value:e.replacement}):t("Replacement pattern has non-string `replacement` parameter"):0===e.start.length?t("Block pattern has empty `start` parameter"):n("Block",(t=>({type:"block-format",start:e.start,format:t[0]})),((t,n)=>({type:"block-command",start:e.start,cmd:t,value:n})))},Si=e=>(e=>se(e,((e,t)=>e.start.length===t.start.length?0:e.start.length>t.start.length?-1:1)))(K(e,xi)),_i=e=>K(e,wi),Ei=e=>{const t=(e=>{const t=[],n=[];return $(e,(e=>{e.fold((e=>{t.push(e)}),(e=>{n.push(e)}))})),{errors:t,values:n}})(H(e,ki));return $(t.errors,(e=>console.error(e.message,e.pattern))),t.values},Ni=Ct().deviceType,Ri=Ni.isTouch(),Ai=Hs.DOM,Oi=e=>u(e,RegExp),Ti=e=>t=>t.options.get(e),Bi=e=>m(e)||f(e),Di=(e,t="")=>n=>{const o=m(n);if(o){if(-1!==n.indexOf("=")){const r=(e=>{const t=e.indexOf("=")>0?e.split(/[;,](?![^=;,]*(?:[;,]|$))/):e.split(",");return Y(t,((e,t)=>{const n=t.split("="),o=n[0],r=n.length>1?n[1]:o;return e[He(o)]=He(r),e}),{})})(n);return{value:we(r,e.id).getOr(t),valid:o}}return{value:n,valid:o}}return{valid:!1,message:"Must be a string."}},Pi=Ti("iframe_attrs"),Li=Ti("doctype"),Mi=Ti("document_base_url"),Ii=Ti("body_id"),Fi=Ti("body_class"),Ui=Ti("content_security_policy"),zi=Ti("br_in_pre"),ji=Ti("forced_root_block"),Vi=Ti("forced_root_block_attrs"),Hi=Ti("newline_behavior"),$i=Ti("br_newline_selector"),qi=Ti("no_newline_selector"),Wi=Ti("keep_styles"),Ki=Ti("end_container_on_empty_block"),Gi=Ti("automatic_uploads"),Yi=Ti("images_reuse_filename"),Xi=Ti("images_replace_blob_uris"),Qi=Ti("icons"),Ji=Ti("icons_url"),Zi=Ti("images_upload_url"),el=Ti("images_upload_base_path"),tl=Ti("images_upload_credentials"),nl=Ti("images_upload_handler"),ol=Ti("content_css_cors"),rl=Ti("referrer_policy"),sl=Ti("language"),al=Ti("language_url"),il=Ti("indent_use_margin"),ll=Ti("indentation"),dl=Ti("content_css"),cl=Ti("content_style"),ul=Ti("font_css"),ml=Ti("directionality"),fl=Ti("inline_boundaries_selector"),gl=Ti("object_resizing"),pl=Ti("resize_img_proportional"),hl=Ti("placeholder"),bl=Ti("event_root"),vl=Ti("service_message"),yl=Ti("theme"),Cl=Ti("theme_url"),wl=Ti("model"),xl=Ti("model_url"),kl=Ti("inline_boundaries"),Sl=Ti("formats"),_l=Ti("preview_styles"),El=Ti("format_empty_lines"),Nl=Ti("custom_ui_selector"),Rl=Ti("inline"),Al=Ti("hidden_input"),Ol=Ti("submit_patch"),Tl=Ti("add_form_submit_trigger"),Bl=Ti("add_unload_trigger"),Dl=Ti("custom_undo_redo_levels"),Pl=Ti("disable_nodechange"),Ll=Ti("readonly"),Ml=Ti("content_css_cors"),Il=Ti("plugins"),Fl=Ti("external_plugins"),Ul=Ti("block_unsupported_drop"),zl=Ti("visual"),jl=Ti("visual_table_class"),Vl=Ti("visual_anchor_class"),Hl=Ti("iframe_aria_text"),$l=Ti("setup"),ql=Ti("init_instance_callback"),Wl=Ti("urlconverter_callback"),Kl=Ti("auto_focus"),Gl=Ti("browser_spellcheck"),Yl=Ti("protect"),Xl=Ti("paste_block_drop"),Ql=Ti("paste_data_images"),Jl=Ti("paste_preprocess"),Zl=Ti("paste_postprocess"),ed=Ti("paste_webkit_styles"),td=Ti("paste_remove_styles_if_webkit"),nd=Ti("paste_merge_formats"),od=Ti("smart_paste"),rd=Ti("paste_as_text"),sd=Ti("paste_tab_spaces"),ad=Ti("allow_html_data_urls"),id=Ti("text_patterns"),ld=Ti("noneditable_class"),dd=Ti("editable_class"),cd=Ti("noneditable_regexp"),ud=e=>Bt.explode(e.options.get("images_file_types")),md=Ti("table_tab_navigation"),fd=Co,gd=Ro,pd=e=>{const t=e.parentNode;t&&t.removeChild(e)},hd=e=>{const t=br(e);return{count:e.length-t.length,text:t}},bd=e=>{let t;for(;-1!==(t=e.data.lastIndexOf(pr));)e.deleteData(t,1)},vd=(e,t)=>(Cd(e),t),yd=(e,t)=>Ya.isTextPosition(t)?((e,t)=>gd(e)&&t.container()===e?((e,t)=>{const n=hd(e.data.substr(0,t.offset())),o=hd(e.data.substr(t.offset()));return(n.text+o.text).length>0?(bd(e),Ya(e,t.offset()-n.count)):t})(e,t):vd(e,t))(e,t):((e,t)=>t.container()===e.parentNode?((e,t)=>{const n=t.container(),o=((e,t)=>{const n=z(e,t);return-1===n?M.none():M.some(n)})(de(n.childNodes),e).map((e=>e<t.offset()?Ya(n,t.offset()-1):t)).getOr(t);return Cd(e),o})(e,t):vd(e,t))(e,t),Cd=e=>{fd(e)&&xr(e)&&(kr(e)?e.removeAttribute("data-mce-caret"):pd(e)),gd(e)&&(bd(e),0===e.data.length&&pd(e))},wd=Io,xd=Uo,kd=Fo,Sd=(e,t,n)=>{const o=ka(t.getBoundingClientRect(),n);let r,s;if("BODY"===e.tagName){const t=e.ownerDocument.documentElement;r=e.scrollLeft||t.scrollLeft,s=e.scrollTop||t.scrollTop}else{const t=e.getBoundingClientRect();r=e.scrollLeft-t.left,s=e.scrollTop-t.top}o.left+=r,o.right+=r,o.top+=s,o.bottom+=s,o.width=1;let a=t.offsetWidth-t.clientWidth;return a>0&&(n&&(a*=-1),o.left+=a,o.right+=a),o},_d=(e,t,n,o)=>{const r=Js();let s,a;const i=ji(e),l=e.dom,d=()=>{(e=>{const t=na(fn(e),"*[contentEditable=false],video,audio,embed,object");for(let e=0;e<t.length;e++){const n=t[e].dom;let o=n.previousSibling;if(Nr(o)){const e=o.data;1===e.length?o.parentNode.removeChild(o):o.deleteData(e.length-1,1)}o=n.nextSibling,Er(o)&&(1===o.data.length?o.parentNode.removeChild(o):o.deleteData(0,1))}})(t),a&&(Cd(a),a=null),r.on((e=>{l.remove(e.caret),r.clear()})),s&&(clearInterval(s),s=void 0)};return{show:(e,c)=>{let u;if(d(),kd(c))return null;if(!n(c))return a=((e,t)=>{const n=e.ownerDocument.createTextNode(pr),o=e.parentNode;if(t){const t=e.previousSibling;if(yr(t)){if(xr(t))return t;if(Nr(t))return t.splitText(t.data.length-1)}o.insertBefore(n,e)}else{const t=e.nextSibling;if(yr(t)){if(xr(t))return t;if(Er(t))return t.splitText(1),t}e.nextSibling?o.insertBefore(n,e.nextSibling):o.appendChild(n)}return n})(c,e),u=c.ownerDocument.createRange(),Nd(a.nextSibling)?(u.setStart(a,0),u.setEnd(a,0)):(u.setStart(a,1),u.setEnd(a,1)),u;{a=((e,t,n)=>{const o=t.ownerDocument.createElement(e);o.setAttribute("data-mce-caret",n?"before":"after"),o.setAttribute("data-mce-bogus","all"),o.appendChild((()=>{const e=document.createElement("br");return e.setAttribute("data-mce-bogus","1"),e})());const r=t.parentNode;return n?r.insertBefore(o,t):t.nextSibling?r.insertBefore(o,t.nextSibling):r.appendChild(o),o})(i,c,e);const n=Sd(t,c,e);l.setStyle(a,"top",n.top);const d=l.create("div",{class:"mce-visual-caret","data-mce-bogus":"all"});l.setStyles(d,{...n}),l.add(t,d),r.set({caret:d,element:c,before:e}),e&&l.addClass(d,"mce-visual-caret-before"),s=setInterval((()=>{r.on((e=>{o()?l.toggleClass(e.caret,"mce-visual-caret-hidden"):l.addClass(e.caret,"mce-visual-caret-hidden")}))}),500),u=c.ownerDocument.createRange(),u.setStart(a,0),u.setEnd(a,0)}return u},hide:d,getCss:()=>".mce-visual-caret {position: absolute;background-color: black;background-color: currentcolor;}.mce-visual-caret-hidden {display: none;}*[data-mce-caret] {position: absolute;left: -1000px;right: auto;top: 0;margin: 0;padding: 0;}",reposition:()=>{r.on((e=>{const n=Sd(t,e.element,e.before);l.setStyles(e.caret,{...n})}))},destroy:()=>clearInterval(s)}},Ed=()=>Nt.browser.isFirefox(),Nd=e=>wd(e)||xd(e),Rd=e=>Nd(e)||_o(e)&&Ed(),Ad=Mo,Od=Io,Td=Uo,Bd=xo("display","block table table-cell table-caption list-item"),Dd=xr,Pd=Cr,Ld=Co,Md=Fr,Id=e=>e>0,Fd=e=>e<0,Ud=(e,t)=>{let n;for(;n=e(t);)if(!Pd(n))return n;return null},zd=(e,t,n,o,r)=>{const s=new Qo(e,o),a=Od(e)||Pd(e);if(Fd(t)){if(a&&n(e=Ud(s.prev.bind(s),!0)))return e;for(;e=Ud(s.prev.bind(s),r);)if(n(e))return e}if(Id(t)){if(a&&n(e=Ud(s.next.bind(s),!0)))return e;for(;e=Ud(s.next.bind(s),r);)if(n(e))return e}return null},jd=(e,t)=>{for(;e&&e!==t;){if(Bd(e))return e;e=e.parentNode}return null},Vd=(e,t,n)=>jd(e.container(),n)===jd(t.container(),n),Hd=(e,t)=>{if(!t)return null;const n=t.container(),o=t.offset();return Ld(n)?n.childNodes[o+e]:null},$d=(e,t)=>{const n=t.ownerDocument.createRange();return e?(n.setStartBefore(t),n.setEndBefore(t)):(n.setStartAfter(t),n.setEndAfter(t)),n},qd=(e,t,n)=>jd(t,e)===jd(n,e),Wd=(e,t,n)=>{const o=e?"previousSibling":"nextSibling";for(;n&&n!==t;){let e=n[o];if(Dd(e)&&(e=e[o]),Od(e)||Td(e)){if(qd(t,e,n))return e;break}if(Md(e))break;n=n.parentNode}return null},Kd=O($d,!0),Gd=O($d,!1),Yd=(e,t,n)=>{let o;const r=O(Wd,!0,t),s=O(Wd,!1,t);let a=n.startContainer;const i=n.startOffset;if(Cr(a)){Ld(a)||(a=a.parentNode);const e=a.getAttribute("data-mce-caret");if("before"===e&&(o=a.nextSibling,Rd(o)))return Kd(o);if("after"===e&&(o=a.previousSibling,Rd(o)))return Gd(o)}if(!n.collapsed)return n;if(Ro(a)){if(Dd(a)){if(1===e){if(o=s(a),o)return Kd(o);if(o=r(a),o)return Gd(o)}if(-1===e){if(o=r(a),o)return Gd(o);if(o=s(a),o)return Kd(o)}return n}if(Nr(a)&&i>=a.data.length-1)return 1===e&&(o=s(a),o)?Kd(o):n;if(Er(a)&&i<=1)return-1===e&&(o=r(a),o)?Gd(o):n;if(i===a.data.length)return o=s(a),o?Kd(o):n;if(0===i)return o=r(a),o?Gd(o):n}return n},Xd=(e,t)=>M.from(Hd(e?0:-1,t)).filter(Od),Qd=(e,t,n)=>{const o=Yd(e,t,n);return-1===e?Ya.fromRangeStart(o):Ya.fromRangeEnd(o)},Jd=e=>M.from(e.getNode()).map(fn),Zd=(e,t)=>{for(;t=e(t);)if(t.isVisible())return t;return t},ec=(e,t)=>{const n=Vd(e,t);return!(n||!Po(e.getNode()))||n};var tc;!function(e){e[e.Backwards=-1]="Backwards",e[e.Forwards=1]="Forwards"}(tc||(tc={}));const nc=Io,oc=Ro,rc=Co,sc=Po,ac=Fr,ic=e=>Lr(e)||(e=>!!Ur(e)&&!0!==Y(de(e.getElementsByTagName("*")),((e,t)=>e||Or(t)),!1))(e),lc=zr,dc=(e,t)=>e.hasChildNodes()&&t<e.childNodes.length?e.childNodes[t]:null,cc=(e,t)=>{if(Id(e)){if(ac(t.previousSibling)&&!oc(t.previousSibling))return Ya.before(t);if(oc(t))return Ya(t,0)}if(Fd(e)){if(ac(t.nextSibling)&&!oc(t.nextSibling))return Ya.after(t);if(oc(t))return Ya(t,t.data.length)}return Fd(e)?sc(t)?Ya.before(t):Ya.after(t):Ya.before(t)},uc=(e,t,n)=>{let o,r,s,a;if(!rc(n)||!t)return null;if(t.isEqual(Ya.after(n))&&n.lastChild){if(a=Ya.after(n.lastChild),Fd(e)&&ac(n.lastChild)&&rc(n.lastChild))return sc(n.lastChild)?Ya.before(n.lastChild):a}else a=t;const i=a.container();let l=a.offset();if(oc(i)){if(Fd(e)&&l>0)return Ya(i,--l);if(Id(e)&&l<i.length)return Ya(i,++l);o=i}else{if(Fd(e)&&l>0&&(r=dc(i,l-1),ac(r)))return!ic(r)&&(s=zd(r,e,lc,r),s)?oc(s)?Ya(s,s.data.length):Ya.after(s):oc(r)?Ya(r,r.data.length):Ya.before(r);if(Id(e)&&l<i.childNodes.length&&(r=dc(i,l),ac(r)))return sc(r)?((e,t)=>{const n=t.nextSibling;return n&&ac(n)?oc(n)?Ya(n,0):Ya.before(n):uc(tc.Forwards,Ya.after(t),e)})(n,r):!ic(r)&&(s=zd(r,e,lc,r),s)?oc(s)?Ya(s,0):Ya.before(s):oc(r)?Ya(r,0):Ya.after(r);o=r||a.getNode()}if((Id(e)&&a.isAtEnd()||Fd(e)&&a.isAtStart())&&(o=zd(o,e,L,n,!0),lc(o,n)))return cc(e,o);r=zd(o,e,lc,n);const d=Be(K(((e,t)=>{const n=[];for(;e&&e!==t;)n.push(e),e=e.parentNode;return n})(i,n),nc));return!d||r&&d.contains(r)?r?cc(e,r):null:(a=Id(e)?Ya.after(d):Ya.before(d),a)},mc=e=>({next:t=>uc(tc.Forwards,t,e),prev:t=>uc(tc.Backwards,t,e)}),fc=e=>Ya.isTextPosition(e)?0===e.offset():Fr(e.getNode()),gc=e=>{if(Ya.isTextPosition(e)){const t=e.container();return e.offset()===t.data.length}return Fr(e.getNode(!0))},pc=(e,t)=>!Ya.isTextPosition(e)&&!Ya.isTextPosition(t)&&e.getNode()===t.getNode(!0),hc=(e,t,n)=>{const o=mc(t);return M.from(e?o.next(n):o.prev(n))},bc=(e,t,n)=>hc(e,t,n).bind((o=>Vd(n,o,t)&&((e,t,n)=>{return e?!pc(t,n)&&(o=t,!(!Ya.isTextPosition(o)&&Po(o.getNode())))&&gc(t)&&fc(n):!pc(n,t)&&fc(t)&&gc(n);var o})(e,n,o)?hc(e,t,o):M.some(o))),vc=(e,t,n,o)=>bc(e,t,n).bind((n=>o(n)?vc(e,t,n,o):M.some(n))),yc=(e,t)=>{const n=e?t.firstChild:t.lastChild;return Ro(n)?M.some(Ya(n,e?0:n.data.length)):n?Fr(n)?M.some(e?Ya.before(n):Po(o=n)?Ya.before(o):Ya.after(o)):((e,t,n)=>{const o=e?Ya.before(n):Ya.after(n);return hc(e,t,o)})(e,t,n):M.none();var o},Cc=O(hc,!0),wc=O(hc,!1),xc=O(yc,!0),kc=O(yc,!1),Sc="_mce_caret",_c=e=>Co(e)&&e.id===Sc,Ec=(e,t)=>{for(;t&&t!==e;){if(t.id===Sc)return t;t=t.parentNode}return null},Nc=e=>xe(e,"name"),Rc=e=>Bt.isArray(e.start),Ac=e=>!(!Nc(e)&&b(e.forward))||e.forward,Oc=(e,t)=>(Co(t)&&e.isBlock(t)&&!t.innerHTML&&(t.innerHTML='<br data-mce-bogus="1" />'),t),Tc=(e,t)=>kc(e).fold(P,(e=>(t.setStart(e.container(),e.offset()),t.setEnd(e.container(),e.offset()),!0))),Bc=(e,t,n)=>!(!(e=>!1===e.hasChildNodes())(t)||!Ec(e,t)||(((e,t)=>{const n=e.ownerDocument.createTextNode(pr);e.appendChild(n),t.setStart(n,0),t.setEnd(n,0)})(t,n),0)),Dc=(e,t,n,o)=>{const r=n[t?"start":"end"];let s,a,i,l;const d=e.getRoot();if(r){for(i=r[0],a=d,s=r.length-1;s>=1;s--){if(l=a.childNodes,Bc(d,a,o))return!0;if(r[s]>l.length-1)return!!Bc(d,a,o)||Tc(a,o);a=l[r[s]]}3===a.nodeType&&(i=Math.min(r[0],a.nodeValue.length)),1===a.nodeType&&(i=Math.min(r[0],a.childNodes.length)),t?o.setStart(a,i):o.setEnd(a,i)}return!0},Pc=e=>Ro(e)&&e.data.length>0,Lc=(e,t,n)=>{let o,r,s,a,i=e.get(n.id+"_"+t);const l=n.keep;let d,c;if(i){if(o=i.parentNode,"start"===t?(l?i.hasChildNodes()?(o=i.firstChild,r=1):Pc(i.nextSibling)?(o=i.nextSibling,r=0):Pc(i.previousSibling)?(o=i.previousSibling,r=i.previousSibling.data.length):(o=i.parentNode,r=e.nodeIndex(i)+1):r=e.nodeIndex(i),d=o,c=r):(l?i.hasChildNodes()?(o=i.firstChild,r=1):Pc(i.previousSibling)?(o=i.previousSibling,r=i.previousSibling.data.length):(o=i.parentNode,r=e.nodeIndex(i)):r=e.nodeIndex(i),d=o,c=r),!l){for(a=i.previousSibling,s=i.nextSibling,Bt.each(Bt.grep(i.childNodes),(e=>{Ro(e)&&(e.nodeValue=e.nodeValue.replace(/\uFEFF/g,""))}));i=e.get(n.id+"_"+t);)e.remove(i,!0);a&&s&&a.nodeType===s.nodeType&&Ro(a)&&!Nt.browser.isOpera()&&(r=a.nodeValue.length,a.appendData(s.nodeValue),e.remove(s),d=a,c=r)}return M.some(Ya(d,c))}return M.none()},Mc=(e,t,n)=>((e,t,n)=>2===t?fi(br,n,e):3===t?(e=>{const t=e.getRng();return{start:si(e.dom.getRoot(),Ya.fromRangeStart(t)),end:si(e.dom.getRoot(),Ya.fromRangeEnd(t)),forward:e.isForward()}})(e):t?(e=>({rng:e.getRng(),forward:e.isForward()}))(e):pi(e,!1))(e,t,n),Ic=(e,t)=>{((e,t)=>{const n=e.dom;if(t){if(Rc(t))return((e,t)=>{const n=e.createRng();return Dc(e,!0,t,n)&&Dc(e,!1,t,n)?M.some({range:n,forward:Ac(t)}):M.none()})(n,t);if((e=>m(e.start))(t))return M.some(((e,t)=>{const n=e.createRng(),o=ai(e.getRoot(),t.start);n.setStart(o.container(),o.offset());const r=ai(e.getRoot(),t.end);return n.setEnd(r.container(),r.offset()),{range:n,forward:Ac(t)}})(n,t));if((e=>xe(e,"id"))(t))return((e,t)=>{const n=Lc(e,"start",t),o=Lc(e,"end",t);return Pt(n,o.or(n),((n,o)=>{const r=e.createRng();return r.setStart(Oc(e,n.container()),n.offset()),r.setEnd(Oc(e,o.container()),o.offset()),{range:r,forward:Ac(t)}}))})(n,t);if(Nc(t))return((e,t)=>M.from(e.select(t.name)[t.index]).map((t=>{const n=e.createRng();return n.selectNode(t),{range:n,forward:!0}})))(n,t);if((e=>xe(e,"rng"))(t))return M.some({range:t.rng,forward:Ac(t)})}return M.none()})(e,t).each((({range:t,forward:n})=>{e.setRng(t,n)}))},Fc=e=>Co(e)&&"SPAN"===e.tagName&&"bookmark"===e.getAttribute("data-mce-type"),Uc=(fr,e=>"\xa0"===e);const zc=e=>""!==e&&-1!==" \f\n\r\t\v".indexOf(e),jc=e=>!zc(e)&&!Uc(e)&&!gr(e),Vc=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},Hc=e=>(e=>({value:e}))(Vc(e.red)+Vc(e.green)+Vc(e.blue)),$c=/^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i,qc=/^\s*rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?(?:\.\d+)?)\s*\)\s*$/i,Wc=(e,t,n,o)=>({red:e,green:t,blue:n,alpha:o}),Kc=(e,t,n,o)=>{const r=parseInt(e,10),s=parseInt(t,10),a=parseInt(n,10),i=parseFloat(o);return Wc(r,s,a,i)},Gc=e=>(e=>{if("transparent"===e)return M.some(Wc(0,0,0,0));const t=$c.exec(e);if(null!==t)return M.some(Kc(t[1],t[2],t[3],"1"));const n=qc.exec(e);return null!==n?M.some(Kc(n[1],n[2],n[3],n[4])):M.none()})(e).map(Hc).map((e=>"#"+e.value)).getOr(e),Yc=e=>!!e.nodeType,Xc=(e,t,n)=>{const o=n.startOffset;let r=n.startContainer;var s;if((r!==n.endContainer||!(s=r.childNodes[o])||!/^(IMG)$/.test(s.nodeName))&&Co(r)){const s=r.childNodes;let a;o<s.length?(r=s[o],a=new Qo(r,e.getParent(r,e.isBlock))):(r=s[s.length-1],a=new Qo(r,e.getParent(r,e.isBlock)),a.next(!0));for(let e=a.current();e;e=a.next())if(Ro(e)&&!eu(e))return n.setStart(e,0),void t.setRng(n)}},Qc=(e,t,n)=>{if(e){const o=t?"nextSibling":"previousSibling";for(e=n?e:e[o];e;e=e[o])if(Co(e)||!eu(e))return e}},Jc=(e,t)=>(Yc(t)&&(t=t.nodeName),!!e.schema.getTextBlockElements()[t.toLowerCase()]),Zc=(e,t,n)=>e.schema.isValidChild(t,n),eu=(e,t=!1)=>{if(C(e)&&Ro(e)){const n=t?e.data.replace(/ /g,"\xa0"):e.data;return Vr(n)}return!1},tu=(e,t)=>(w(e)?e=e(t):C(t)&&(e=e.replace(/%(\w+)/g,((e,n)=>t[n]||e))),e),nu=(e,t)=>(t=t||"",e=""+((e=e||"").nodeName||e),t=""+(t.nodeName||t),e.toLowerCase()===t.toLowerCase()),ou=(e,t)=>("color"!==t&&"backgroundColor"!==t||(e=Gc(e)),"fontWeight"===t&&700===e&&(e="bold"),"fontFamily"===t&&(e=e.replace(/[\'\"]/g,"").replace(/,\s+/g,",")),""+e),ru=(e,t,n)=>ou(e.getStyle(t,n),n),su=(e,t)=>{let n;return e.getParent(t,(t=>(n=e.getStyle(t,"text-decoration"),n&&"none"!==n))),n},au=(e,t,n)=>e.getParents(t,n,e.getRoot()),iu=e=>ke(e,"block"),lu=e=>ke(e,"selector"),du=e=>ke(e,"inline"),cu=e=>lu(e)&&!1!==e.expand&&!du(e),uu=Fc,mu=au,fu=eu,gu=Jc,pu=(e,t)=>{let n=t;for(;n;){if(Co(n)&&e.getContentEditable(n))return"false"===e.getContentEditable(n)?n:t;n=n.parentNode}return t},hu=(e,t,n,o)=>{const r=t.data;for(let t=n;e?t>=0:t<r.length;e?t--:t++)if(o(r.charAt(t)))return e?t+1:t;return-1},bu=(e,t,n)=>hu(e,t,n,(e=>Uc(e)||zc(e))),vu=(e,t,n)=>hu(e,t,n,jc),yu=(e,t,n,o,r,s)=>{let a;const i=e.getParent(n,e.isBlock)||t,l=(t,n,o)=>{const s=Ca(e),l=r?s.backwards:s.forwards;return M.from(l(t,n,((e,t)=>uu(e.parentNode)?-1:(a=e,o(r,e,t))),i))};return l(n,o,bu).bind((e=>s?l(e.container,e.offset+(r?-1:0),vu):M.some(e))).orThunk((()=>a?M.some({container:a,offset:r?0:a.length}):M.none()))},Cu=(e,t,n,o,r)=>{Ro(o)&&Ke(o.data)&&o[r]&&(o=o[r]);const s=mu(e,o);for(let o=0;o<s.length;o++)for(let r=0;r<t.length;r++){const a=t[r];if((!C(a.collapsed)||a.collapsed===n.collapsed)&&lu(a)&&e.is(s[o],a.selector))return s[o]}return o},wu=(e,t,n,o)=>{let r=n;const s=e.dom,a=s.getRoot(),i=t[0];if(iu(i)&&(r=i.wrapper?null:s.getParent(n,i.block,a)),!r){const t=s.getParent(n,"LI,TD,TH");r=s.getParent(Ro(n)?n.parentNode:n,(t=>t!==a&&gu(e,t)),t)}if(r&&iu(i)&&i.wrapper&&(r=mu(s,r,"ul,ol").reverse()[0]||r),!r)for(r=n;r[o]&&!s.isBlock(r[o])&&(r=r[o],!nu(r,"br")););return r||n},xu=(e,t,n,o)=>{const r=n.parentNode;return!C(n[o])&&(!(r!==t&&!y(r)&&!e.isBlock(r))||xu(e,t,r,o))},ku=(e,t,n,o,r)=>{let s=n;const a=r?"previousSibling":"nextSibling",i=e.getRoot();if(Ro(n)&&!fu(n)&&(r?o>0:o<n.data.length))return n;for(;;){if(!t[0].block_expand&&e.isBlock(s))return s;for(let t=s[a];t;t=t[a]){const n=Ro(t)&&!xu(e,i,t,a);if(!uu(t)&&(!Po(l=t)||!l.getAttribute("data-mce-bogus")||l.nextSibling)&&!fu(t,n))return s}if(s===i||s.parentNode===i){n=s;break}s=s.parentNode}var l;return n},Su=e=>uu(e.parentNode)||uu(e),_u=(e,t,n,o=!1)=>{let{startContainer:r,startOffset:s,endContainer:a,endOffset:i}=t;const l=e.dom,d=n[0];return Co(r)&&r.hasChildNodes()&&(r=Aa(r,s),Ro(r)&&(s=0)),Co(a)&&a.hasChildNodes()&&(a=Aa(a,t.collapsed?i:i-1),Ro(a)&&(i=a.nodeValue.length)),r=pu(l,r),a=pu(l,a),Su(r)&&(r=uu(r)?r:r.parentNode,r=t.collapsed?r.previousSibling||r:r.nextSibling||r,Ro(r)&&(s=t.collapsed?r.length:0)),Su(a)&&(a=uu(a)?a:a.parentNode,a=t.collapsed?a.nextSibling||a:a.previousSibling||a,Ro(a)&&(i=t.collapsed?0:a.length)),t.collapsed&&(yu(l,e.getBody(),r,s,!0,o).each((({container:e,offset:t})=>{r=e,s=t})),yu(l,e.getBody(),a,i,!1,o).each((({container:e,offset:t})=>{a=e,i=t}))),(du(d)||d.block_expand)&&(du(d)&&Ro(r)&&0!==s||(r=ku(l,n,r,s,!0)),du(d)&&Ro(a)&&i!==a.nodeValue.length||(a=ku(l,n,a,i,!1))),cu(d)&&(r=Cu(l,n,t,r,"previousSibling"),a=Cu(l,n,t,a,"nextSibling")),(iu(d)||lu(d))&&(r=wu(e,n,r,"previousSibling"),a=wu(e,n,a,"nextSibling"),iu(d)&&(l.isBlock(r)||(r=ku(l,n,r,s,!0)),l.isBlock(a)||(a=ku(l,n,a,i,!1)))),Co(r)&&(s=l.nodeIndex(r),r=r.parentNode),Co(a)&&(i=l.nodeIndex(a)+1,a=a.parentNode),{startContainer:r,startOffset:s,endContainer:a,endOffset:i}},Eu=(e,t,n)=>{const o=t.startOffset,r=Aa(t.startContainer,o),s=t.endOffset,a=Aa(t.endContainer,s-1),i=e=>{const t=e[0];Ro(t)&&t===r&&o>=t.data.length&&e.splice(0,1);const n=e[e.length-1];return 0===s&&e.length>0&&n===a&&Ro(n)&&e.splice(e.length-1,1),e},l=(e,t,n)=>{const o=[];for(;e&&e!==n;e=e[t])o.push(e);return o},d=(t,n)=>e.getParent(t,(e=>e.parentNode===n),n),c=(e,t,o)=>{const r=o?"nextSibling":"previousSibling";for(let s=e,a=s.parentNode;s&&s!==t;s=a){a=s.parentNode;const t=l(s===e?s:s[r],r);t.length&&(o||t.reverse(),n(i(t)))}};if(r===a)return n(i([r]));const u=e.findCommonAncestor(r,a);if(e.isChildOf(r,a))return c(r,u,!0);if(e.isChildOf(a,r))return c(a,u);const m=d(r,u)||r,f=d(a,u)||a;c(r,m,!0);const g=l(m===r?m:m.nextSibling,"nextSibling",f===a?f.nextSibling:f);g.length&&n(i(g)),c(a,f)},Nu=e=>{const t=[];if(e)for(let n=0;n<e.rangeCount;n++)t.push(e.getRangeAt(n));return t},Ru=(e,t)=>{const n=na(t,"td[data-mce-selected],th[data-mce-selected]");return n.length>0?n:(e=>K((e=>ee(e,(e=>{const t=Ra(e);return t?[fn(t)]:[]})))(e),ir))(e)},Au=e=>Ru(Nu(e.selection.getSel()),fn(e.getBody())),Ou=(e,t)=>Wo(e,"table",t),Tu=e=>On(e).fold(N([e]),(t=>[e].concat(Tu(t)))),Bu=e=>Tn(e).fold(N([e]),(t=>"br"===Mt(t)?Sn(t).map((t=>[e].concat(Bu(t)))).getOr([]):[e].concat(Bu(t)))),Du=(e,t)=>Pt((e=>{const t=e.startContainer,n=e.startOffset;return Ro(t)?0===n?M.some(fn(t)):M.none():M.from(t.childNodes[n]).map(fn)})(t),(e=>{const t=e.endContainer,n=e.endOffset;return Ro(t)?n===t.data.length?M.some(fn(t)):M.none():M.from(t.childNodes[n-1]).map(fn)})(t),((t,n)=>{const o=Q(Tu(e),O(vn,t)),r=Q(Bu(e),O(vn,n));return o.isSome()&&r.isSome()})).getOr(!1),Pu=(e,t,n,o)=>{const r=n,s=new Qo(n,r),a=ve(e.schema.getMoveCaretBeforeOnEnterElements(),((e,t)=>!j(["td","th","table"],t.toLowerCase())));do{if(Ro(n)&&0!==Bt.trim(n.nodeValue).length)return void(o?t.setStart(n,0):t.setEnd(n,n.nodeValue.length));if(a[n.nodeName])return void(o?t.setStartBefore(n):"BR"===n.nodeName?t.setEndBefore(n):t.setEndAfter(n))}while(n=o?s.next():s.prev());"BODY"===r.nodeName&&(o?t.setStart(r,0):t.setEnd(r,r.childNodes.length))},Lu=e=>{const t=e.selection.getSel();return t&&t.rangeCount>0},Mu=(e,t)=>{const n=Au(e);n.length>0?$(n,(n=>{const o=n.dom,r=e.dom.createRng();r.setStartBefore(o),r.setEndAfter(o),t(r,!0)})):t(e.selection.getRng(),!1)},Iu=(e,t,n)=>{const o=pi(e,t);n(o),e.moveToBookmark(o)},Fu=((e,t)=>{const n=t=>e(t)?M.from(t.dom.nodeValue):M.none();return{get:t=>{if(!e(t))throw new Error("Can only get text value of a text node");return n(t).getOr("")},getOption:n,set:(t,n)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=n}}})(zt),Uu=e=>Fu.get(e),zu=e=>Fu.getOption(e),ju=['pre[class*=language-][contenteditable="false"]',"figure.image","div[data-ephox-embed-iri]","div.tiny-pageembed","div.mce-toc","div[data-mce-toc]"],Vu=(e,t,n,o,r,s)=>{const{uid:a=t,...i}=n;on(e,oa()),qt(e,`${sa()}`,a),qt(e,`${ra()}`,o);const{attributes:l={},classes:d=[]}=r(a,i);if(Wt(e,l),((e,t)=>{$(t,(t=>{on(e,t)}))})(e,d),s){d.length>0&&qt(e,`${ia()}`,d.join(","));const t=ue(l);t.length>0&&qt(e,`${la()}`,t.join(","))}},Hu=(e,t,n,o,r)=>{const s=un("span",e);return Vu(s,t,n,o,r,!1),s},$u=(e,t,n,o,r,s)=>{const a=[],i=Hu(e.getDoc(),n,s,o,r),l=Js(),d=()=>{l.clear()},c=e=>{$(e,u)},u=t=>{switch(((e,t,n,o)=>kn(t).fold((()=>"skipping"),(r=>"br"===o||(e=>zt(e)&&Uu(e)===pr)(t)?"valid":(e=>Ut(e)&&an(e,oa()))(t)?"existing":_c(t.dom)?"caret":V(ju,(e=>hn(t,e)))?"valid-block":Zc(e,n,o)&&Zc(e,Mt(r),n)?"valid":"invalid-child")))(e,t,"span",Mt(t))){case"invalid-child":{d();const e=Rn(t);c(e),d();break}case"valid-block":d(),Vu(t,n,s,o,r,!0);break;case"valid":{const e=l.get().getOrThunk((()=>{const e=ba(i);return a.push(e),l.set(e),e}));((e,t)=>{Xn(e,t),Zn(t,e)})(t,e);break}}};return Eu(e.dom,t,(e=>{d(),(e=>{const t=H(e,fn);c(t)})(e)})),a},qu=e=>{const t=(()=>{const e={};return{register:(t,n)=>{e[t]={name:t,settings:n}},lookup:t=>we(e,t).map((e=>e.settings)),getNames:()=>ue(e)}})();((e,t)=>{const n=ra(),o=e=>M.from(e.attr(n)).bind(t.lookup),r=e=>{var t,n;e.attr(sa(),null),e.attr(ra(),null),e.attr(aa(),null);const o=M.from(e.attr(la())).map((e=>e.split(","))).getOr([]),r=M.from(e.attr(ia())).map((e=>e.split(","))).getOr([]);$(o,(t=>e.attr(t,null)));const s=null!==(n=null===(t=e.attr("class"))||void 0===t?void 0:t.split(" "))&&void 0!==n?n:[],a=oe(s,[oa()].concat(r));e.attr("class",a.length>0?a.join(" "):null),e.attr(ia(),null),e.attr(la(),null)};e.serializer.addTempAttr(aa()),e.serializer.addAttributeFilter(n,(e=>{for(const t of e)o(t).each((e=>{!1===e.persistent&&("span"===t.name?t.unwrap():r(t))}))}))})(e,t);const n=((e,t)=>{const n=Ws({}),o=()=>({listeners:[],previous:Js()}),r=(e,t)=>{s(e,(e=>(t(e),e)))},s=(e,t)=>{const r=n.get(),s=t(we(r,e).getOrThunk(o));r[e]=s,n.set(r)},a=(t,n)=>{$(ma(e,t),(e=>{n?qt(e,aa(),"true"):Xt(e,aa())}))},i=ea((()=>{const n=se(t.getNames());$(n,(t=>{s(t,(n=>{const o=n.previous.get();return ca(e,M.some(t)).fold((()=>{o.each((e=>{(e=>{r(e,(t=>{$(t.listeners,(t=>t(!1,e)))}))})(t),n.previous.clear(),a(e,!1)}))}),(({uid:e,name:t,elements:s})=>{Dt(o,e)||(o.each((e=>a(e,!1))),((e,t,n)=>{r(e,(o=>{$(o.listeners,(o=>o(!0,e,{uid:t,nodes:H(n,(e=>e.dom))})))}))})(t,e,s),n.previous.set(e),a(e,!0))})),{previous:n.previous,listeners:n.listeners}}))}))}),30);return e.on("remove",(()=>{i.cancel()})),e.on("NodeChange",(()=>{i.throttle()})),{addListener:(e,t)=>{s(e,(e=>({previous:e.previous,listeners:e.listeners.concat([t])})))}}})(e,t),o=Ht("span"),r=e=>{$(e,(e=>{o(e)?oo(e):(e=>{sn(e,oa()),Xt(e,`${sa()}`),Xt(e,`${ra()}`),Xt(e,`${aa()}`);const t=Gt(e,`${la()}`).map((e=>e.split(","))).getOr([]),n=Gt(e,`${ia()}`).map((e=>e.split(","))).getOr([]);var o;$(t,(t=>Xt(e,t))),o=e,$(n,(e=>{sn(o,e)})),Xt(e,`${ia()}`),Xt(e,`${la()}`)})(e)}))};return{register:(e,n)=>{t.register(e,n)},annotate:(n,o)=>{t.lookup(n).each((t=>{((e,t,n,o)=>{e.undoManager.transact((()=>{const r=e.selection,s=r.getRng(),a=Au(e).length>0,i=pa("mce-annotation");if(s.collapsed&&!a&&((e,t)=>{const n=_u(e,t,[{inline:"span"}]);t.setStart(n.startContainer,n.startOffset),t.setEnd(n.endContainer,n.endOffset),e.selection.setRng(t)})(e,s),r.getRng().collapsed&&!a){const s=Hu(e.getDoc(),i,o,t,n.decorate);so(s,fr),r.getRng().insertNode(s.dom),r.select(s.dom)}else Iu(r,!1,(()=>{Mu(e,(r=>{$u(e,r,i,t,n.decorate,o)}))}))}))})(e,n,t,o)}))},annotationChanged:(e,t)=>{n.addListener(e,t)},remove:t=>{const n=e.selection.getBookmark();ca(e,M.some(t)).each((({elements:e})=>{r(e)})),e.selection.moveToBookmark(n)},removeAll:t=>{const n=e.selection.getBookmark();fe(fa(e,t),((e,t)=>{r(e)})),e.selection.moveToBookmark(n)},getAll:t=>{const n=fa(e,t);return ge(n,(e=>H(e,(e=>e.dom))))}}},Wu=e=>({getBookmark:O(Mc,e),moveToBookmark:O(Ic,e)});Wu.isBookmarkNode=Fc;const Ku=(e,t,n)=>!n.collapsed&&V(n.getClientRects(),(n=>((e,t,n)=>t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom)(n,e,t))),Gu=(e,t,n)=>e.dispatch(t,n),Yu=(e,t,n,o)=>e.dispatch("FormatApply",{format:t,node:n,vars:o}),Xu=(e,t,n,o)=>e.dispatch("FormatRemove",{format:t,node:n,vars:o}),Qu=(e,t)=>e.dispatch("SetContent",t),Ju=(e,t)=>e.dispatch("GetContent",t),Zu=(e,t)=>e.dispatch("PastePlainTextToggle",{state:t}),em={BACKSPACE:8,DELETE:46,DOWN:40,ENTER:13,ESC:27,LEFT:37,RIGHT:39,SPACEBAR:32,TAB:9,UP:38,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,modifierPressed:e=>e.shiftKey||e.ctrlKey||e.altKey||em.metaKeyPressed(e),metaKeyPressed:e=>Nt.os.isMacOS()||Nt.os.isiOS()?e.metaKey:e.ctrlKey&&!e.altKey},tm="data-mce-selected",nm=Math.abs,om=Math.round,rm={nw:[0,0,-1,-1],ne:[1,0,1,-1],se:[1,1,1,1],sw:[0,1,-1,1]},sm=(e,t)=>{const n=t.dom,o=t.getDoc(),r=document,s=t.getBody();let a,i,l,d,c,u,m,f,g,p,h,b,v,y,w;const x=e=>C(e)&&(Lo(e)||n.is(e,"figure.image")),k=e=>Uo(e)||n.hasClass(e,"mce-preview-object"),S=e=>{const n=e.target;((e,t)=>{if((e=>"longpress"===e.type||0===e.type.indexOf("touch"))(e)){const n=e.touches[0];return x(e.target)&&!Ku(n.clientX,n.clientY,t)}return x(e.target)&&!Ku(e.clientX,e.clientY,t)})(e,t.selection.getRng())&&!e.isDefaultPrevented()&&t.selection.select(n)},_=e=>n.is(e,"figure.image")?[e.querySelector("img")]:n.hasClass(e,"mce-preview-object")&&C(e.firstElementChild)?[e,e.firstElementChild]:[e],E=e=>{const o=gl(t);return!!o&&"false"!==e.getAttribute("data-mce-resize")&&e!==t.getBody()&&(n.hasClass(e,"mce-preview-object")?hn(fn(e.firstElementChild),o):hn(fn(e),o))},N=(e,o,r)=>{if(C(r)){const s=_(e);$(s,(e=>{e.style[o]||!t.schema.isValid(e.nodeName.toLowerCase(),o)?n.setStyle(e,o,r):n.setAttrib(e,o,""+r)}))}},R=(e,t,n)=>{N(e,"width",t),N(e,"height",n)},A=e=>{let o,r,c,C,S;o=e.screenX-u,r=e.screenY-m,b=o*d[2]+f,v=r*d[3]+g,b=b<5?5:b,v=v<5?5:v,c=(x(a)||k(a))&&!1!==pl(t)?!em.modifierPressed(e):em.modifierPressed(e),c&&(nm(o)>nm(r)?(v=om(b*p),b=om(v/p)):(b=om(v/p),v=om(b*p))),R(i,b,v),C=d.startPos.x+o,S=d.startPos.y+r,C=C>0?C:0,S=S>0?S:0,n.setStyles(l,{left:C,top:S,display:"block"}),l.innerHTML=b+" &times; "+v,d[2]<0&&i.clientWidth<=b&&n.setStyle(i,"left",void 0+(f-b)),d[3]<0&&i.clientHeight<=v&&n.setStyle(i,"top",void 0+(g-v)),o=s.scrollWidth-y,r=s.scrollHeight-w,o+r!==0&&n.setStyles(l,{left:C-o,top:S-r}),h||(((e,t,n,o,r)=>{e.dispatch("ObjectResizeStart",{target:t,width:n,height:o,origin:r})})(t,a,f,g,"corner-"+d.name),h=!0)},O=()=>{const e=h;h=!1,e&&(N(a,"width",b),N(a,"height",v)),n.unbind(o,"mousemove",A),n.unbind(o,"mouseup",O),r!==o&&(n.unbind(r,"mousemove",A),n.unbind(r,"mouseup",O)),n.remove(i),n.remove(l),n.remove(c),T(a),e&&(((e,t,n,o,r)=>{e.dispatch("ObjectResized",{target:t,width:n,height:o,origin:r})})(t,a,b,v,"corner-"+d.name),n.setAttrib(a,"style",n.getAttrib(a,"style"))),t.nodeChanged()},T=e=>{M();const h=n.getPos(e,s),C=h.x,x=h.y,S=e.getBoundingClientRect(),N=S.width||S.right-S.left,T=S.height||S.bottom-S.top;a!==e&&(D(),a=e,b=v=0);const B=t.dispatch("ObjectSelected",{target:e});E(e)&&!B.isDefaultPrevented()?fe(rm,((e,t)=>{let h;h=n.get("mceResizeHandle"+t),h&&n.remove(h),h=n.add(s,"div",{id:"mceResizeHandle"+t,"data-mce-bogus":"all",class:"mce-resizehandle",unselectable:!0,style:"cursor:"+t+"-resize; margin:0; padding:0"}),n.bind(h,"mousedown",(h=>{h.stopImmediatePropagation(),h.preventDefault(),(h=>{const b=_(a)[0];var v;u=h.screenX,m=h.screenY,f=b.clientWidth,g=b.clientHeight,p=g/f,d=e,d.name=t,d.startPos={x:N*e[0]+C,y:T*e[1]+x},y=s.scrollWidth,w=s.scrollHeight,c=n.add(s,"div",{class:"mce-resize-backdrop","data-mce-bogus":"all"}),n.setStyles(c,{position:"fixed",left:"0",top:"0",width:"100%",height:"100%"}),i=k(v=a)?n.create("img",{src:Nt.transparentSrc}):v.cloneNode(!0),n.addClass(i,"mce-clonedresizable"),n.setAttrib(i,"data-mce-bogus","all"),i.contentEditable="false",n.setStyles(i,{left:C,top:x,margin:0}),R(i,N,T),i.removeAttribute(tm),s.appendChild(i),n.bind(o,"mousemove",A),n.bind(o,"mouseup",O),r!==o&&(n.bind(r,"mousemove",A),n.bind(r,"mouseup",O)),l=n.add(s,"div",{class:"mce-resize-helper","data-mce-bogus":"all"},f+" &times; "+g)})(h)})),e.elm=h,n.setStyles(h,{left:N*e[0]+C-h.offsetWidth/2,top:T*e[1]+x-h.offsetHeight/2})})):D(!1)},B=Zs(T,0),D=(e=!0)=>{B.cancel(),M(),a&&e&&a.removeAttribute(tm),fe(rm,((e,t)=>{const o=n.get("mceResizeHandle"+t);o&&(n.unbind(o),n.remove(o))}))},P=(e,t)=>C(e)&&n.isChildOf(e,t),L=o=>{if(h||t.removed||t.composing)return;const r="mousedown"===o.type?o.target:e.getNode(),a=Go(fn(r),"table,img,figure.image,hr,video,span.mce-preview-object").map((e=>e.dom)).getOrUndefined(),i=C(a)?n.getAttrib(a,tm,"1"):"1";if($(n.select("img[data-mce-selected],hr[data-mce-selected]"),(e=>{e.removeAttribute(tm)})),P(a,s)){I();const t=e.getStart(!0);if(P(t,a)&&P(e.getEnd(!0),a))return n.setAttrib(a,tm,i),void B.throttle(a)}D()},M=()=>{fe(rm,(e=>{e.elm&&(n.unbind(e.elm),delete e.elm)}))},I=()=>{try{t.getDoc().execCommand("enableObjectResizing",!1,"false")}catch(e){}};return t.on("init",(()=>{I(),t.on("NodeChange ResizeEditor ResizeWindow ResizeContent drop",L),t.on("keyup compositionend",(e=>{a&&"TABLE"===a.nodeName&&L(e)})),t.on("hide blur",D),t.on("contextmenu longpress",S,!0)})),t.on("remove",M),{isResizable:E,showResizeRect:T,hideResizeRect:D,updateResizeRect:L,destroy:()=>{B.cancel(),a=i=c=null}}},am=(e,t,n)=>{const o=e.document.createRange();var r;return r=o,t.fold((e=>{r.setStartBefore(e.dom)}),((e,t)=>{r.setStart(e.dom,t)}),(e=>{r.setStartAfter(e.dom)})),((e,t)=>{t.fold((t=>{e.setEndBefore(t.dom)}),((t,n)=>{e.setEnd(t.dom,n)}),(t=>{e.setEndAfter(t.dom)}))})(o,n),o},im=(e,t,n,o,r)=>{const s=e.document.createRange();return s.setStart(t.dom,n),s.setEnd(o.dom,r),s},lm=Ci([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),dm=(e,t,n)=>t(fn(n.startContainer),n.startOffset,fn(n.endContainer),n.endOffset);lm.ltr,lm.rtl;const cm=(e,t,n,o)=>({start:e,soffset:t,finish:n,foffset:o}),um=document.caretPositionFromPoint?(e,t,n)=>{var o,r;return M.from(null===(r=(o=e.dom).caretPositionFromPoint)||void 0===r?void 0:r.call(o,t,n)).bind((t=>{if(null===t.offsetNode)return M.none();const n=e.dom.createRange();return n.setStart(t.offsetNode,t.offset),n.collapse(),M.some(n)}))}:document.caretRangeFromPoint?(e,t,n)=>{var o,r;return M.from(null===(r=(o=e.dom).caretRangeFromPoint)||void 0===r?void 0:r.call(o,t,n))}:M.none,mm=Ci([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),fm={before:mm.before,on:mm.on,after:mm.after,cata:(e,t,n,o)=>e.fold(t,n,o),getStart:e=>e.fold(R,R,R)},gm=Ci([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),pm={domRange:gm.domRange,relative:gm.relative,exact:gm.exact,exactFromRange:e=>gm.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>fn(e.startContainer),relative:(e,t)=>fm.getStart(e),exact:(e,t,n,o)=>e}))(e);return xn(t)},range:cm},hm=(e,t)=>{const n=Mt(e);return"input"===n?fm.after(e):j(["br","img"],n)?0===t?fm.before(e):fm.after(e):fm.on(e,t)},bm=(e,t)=>{const n=e.fold(fm.before,hm,fm.after),o=t.fold(fm.before,hm,fm.after);return pm.relative(n,o)},vm=(e,t,n,o)=>{const r=hm(e,t),s=hm(n,o);return pm.relative(r,s)},ym=(e,t)=>{const n=(t||document).createDocumentFragment();return $(e,(e=>{n.appendChild(e.dom)})),fn(n)},Cm=e=>{const t=pm.getWin(e).dom,n=(e,n,o,r)=>im(t,e,n,o,r),o=(e=>e.match({domRange:e=>{const t=fn(e.startContainer),n=fn(e.endContainer);return vm(t,e.startOffset,n,e.endOffset)},relative:bm,exact:vm}))(e);return((e,t)=>{const n=((e,t)=>t.match({domRange:e=>({ltr:N(e),rtl:M.none}),relative:(t,n)=>({ltr:De((()=>am(e,t,n))),rtl:De((()=>M.some(am(e,n,t))))}),exact:(t,n,o,r)=>({ltr:De((()=>im(e,t,n,o,r))),rtl:De((()=>M.some(im(e,o,r,t,n))))})}))(e,t);return((e,t)=>{const n=t.ltr();return n.collapsed?t.rtl().filter((e=>!1===e.collapsed)).map((e=>lm.rtl(fn(e.endContainer),e.endOffset,fn(e.startContainer),e.startOffset))).getOrThunk((()=>dm(0,lm.ltr,n))):dm(0,lm.ltr,n)})(0,n)})(t,o).match({ltr:n,rtl:n})},wm=(e,t,n)=>{return(o=n.defaultView,r=e,s=t,((e,t,n)=>{const o=fn(e.document);return um(o,t,n).map((e=>cm(fn(e.startContainer),e.startOffset,fn(e.endContainer),e.endOffset)))})(o,r,s)).map((e=>{const t=n.createRange();return t.setStart(e.start.dom,e.soffset),t.setEnd(e.finish.dom,e.foffset),t})).getOrUndefined();var o,r,s},xm=(e,t)=>e&&t&&e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset,km=(e,t,n)=>null!==((e,t,n)=>{for(;e&&e!==t;){if(n(e))return e;e=e.parentNode}return null})(e,t,n),Sm=(e,t,n)=>km(e,t,(e=>e.nodeName===n)),_m=e=>e&&"TABLE"===e.nodeName,Em=e=>e&&/^(TD|TH|CAPTION)$/.test(e.nodeName),Nm=(e,t)=>xr(e)&&!1===km(e,t,_c),Rm=(e,t,n)=>{const o=new Qo(t,e.getParent(t.parentNode,e.isBlock)||e.getRoot());for(;t=o[n?"prev":"next"]();)if(Po(t))return!0},Am=(e,t,n,o,r)=>{let s;const a=e.getRoot();let i;const l=e.schema.getNonEmptyElements(),d=e.getParent(r.parentNode,e.isBlock)||a;if(o&&Po(r)&&t&&e.isEmpty(d))return M.some(Ya(r.parentNode,e.nodeIndex(r)));const c=new Qo(r,d);for(;i=c[o?"prev":"next"]();){if("false"===e.getContentEditableParent(i)||Nm(i,a))return M.none();if(Ro(i)&&i.nodeValue.length>0)return!1===Sm(i,a,"A")?M.some(Ya(i,o?i.nodeValue.length:0)):M.none();if(e.isBlock(i)||l[i.nodeName.toLowerCase()])return M.none();s=i}return To(s)?M.none():n&&s?M.some(Ya(s,0)):M.none()},Om=(e,t,n,o)=>{let r,s;const a=e.getRoot();let i,l,d=!1;r=o[(n?"start":"end")+"Container"],s=o[(n?"start":"end")+"Offset"];const c=Co(r)&&s===r.childNodes.length,u=e.schema.getNonEmptyElements();if(l=n,xr(r))return M.none();if(Co(r)&&s>r.childNodes.length-1&&(l=!1),Bo(r)&&(r=a,s=0),r===a){if(l&&(i=r.childNodes[s>0?s-1:0],i)){if(xr(i))return M.none();if(u[i.nodeName]||_m(i))return M.none()}if(r.hasChildNodes()){if(s=Math.min(!l&&s>0?s-1:s,r.childNodes.length-1),r=r.childNodes[s],s=Ro(r)&&c?r.data.length:0,!t&&r===a.lastChild&&_m(r))return M.none();if(((e,t)=>{for(;t&&t!==e;){if(Io(t))return!0;t=t.parentNode}return!1})(a,r)||xr(r))return M.none();if(r.hasChildNodes()&&!1===_m(r)){i=r;const t=new Qo(r,a);do{if(Io(i)||xr(i)){d=!1;break}if(Ro(i)&&i.nodeValue.length>0){s=l?0:i.nodeValue.length,r=i,d=!0;break}if(u[i.nodeName.toLowerCase()]&&!Em(i)){s=e.nodeIndex(i),r=i.parentNode,l||s++,d=!0;break}}while(i=l?t.next():t.prev())}}}return t&&(Ro(r)&&0===s&&Am(e,c,t,!0,r).each((e=>{r=e.container(),s=e.offset(),d=!0})),Co(r)&&(i=r.childNodes[s],i||(i=r.childNodes[s-1]),!i||!Po(i)||((e,t)=>e.previousSibling&&"A"===e.previousSibling.nodeName)(i)||Rm(e,i,!1)||Rm(e,i,!0)||Am(e,c,t,!0,i).each((e=>{r=e.container(),s=e.offset(),d=!0})))),l&&!t&&Ro(r)&&s===r.nodeValue.length&&Am(e,c,t,!1,r).each((e=>{r=e.container(),s=e.offset(),d=!0})),d?M.some(Ya(r,s)):M.none()},Tm=(e,t)=>{const n=t.collapsed,o=t.cloneRange(),r=Ya.fromRangeStart(t);return Om(e,n,!0,o).each((e=>{n&&Ya.isAbove(r,e)||o.setStart(e.container(),e.offset())})),n||Om(e,n,!1,o).each((e=>{o.setEnd(e.container(),e.offset())})),n&&o.collapse(!0),xm(t,o)?M.none():M.some(o)},Bm=(e,t)=>e.splitText(t),Dm=e=>{let t=e.startContainer,n=e.startOffset,o=e.endContainer,r=e.endOffset;return t===o&&Ro(t)?n>0&&n<t.nodeValue.length&&(o=Bm(t,n),t=o.previousSibling,r>n?(r-=n,t=o=Bm(o,r).previousSibling,r=o.nodeValue.length,n=0):r=0):(Ro(t)&&n>0&&n<t.nodeValue.length&&(t=Bm(t,n),n=0),Ro(o)&&r>0&&r<o.nodeValue.length&&(o=Bm(o,r).previousSibling,r=o.nodeValue.length)),{startContainer:t,startOffset:n,endContainer:o,endOffset:r}},Pm=e=>({walk:(t,n)=>Eu(e,t,n),split:Dm,normalize:t=>Tm(e,t).fold(P,(e=>(t.setStart(e.startContainer,e.startOffset),t.setEnd(e.endContainer,e.endOffset),!0)))});Pm.compareRanges=xm,Pm.getCaretRangeFromPoint=wm,Pm.getSelectedNode=Ra,Pm.getNode=Aa;const Lm=((e,t)=>{const n=t=>{const n=(e=>{const t=e.dom;return jn(e)?t.getBoundingClientRect().height:t.offsetHeight})(t);if(n<=0||null===n){const n=qn(t,e);return parseFloat(n)||0}return n},o=(e,t)=>Y(t,((t,n)=>{const o=qn(e,n),r=void 0===o?0:parseInt(o,10);return isNaN(r)?t:t+r}),0);return{set:(t,n)=>{if(!x(n)&&!n.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+n);const o=t.dom;ln(o)&&(o.style[e]=n+"px")},get:n,getOuter:n,aggregate:o,max:(e,t,n)=>{const r=o(e,n);return t>r?t-r:0}}})("height"),Mm=()=>fn(document),Im=(e,t)=>e.view(t).fold(N([]),(t=>{const n=e.owner(t),o=Im(e,n);return[t].concat(o)}));var Fm=Object.freeze({__proto__:null,view:e=>{var t;return(e.dom===document?M.none():M.from(null===(t=e.dom.defaultView)||void 0===t?void 0:t.frameElement)).map(fn)},owner:e=>wn(e)});const Um=e=>"textarea"===Mt(e),zm=(e,t)=>{const n=(e=>{const t=e.dom.ownerDocument,n=t.body,o=t.defaultView,r=t.documentElement;if(n===e.dom)return co(n.offsetLeft,n.offsetTop);const s=uo(null==o?void 0:o.pageYOffset,r.scrollTop),a=uo(null==o?void 0:o.pageXOffset,r.scrollLeft),i=uo(r.clientTop,n.clientTop),l=uo(r.clientLeft,n.clientLeft);return mo(e).translate(a-l,s-i)})(e),o=(e=>Lm.get(e))(e);return{element:e,bottom:n.top+o,height:o,pos:n,cleanup:t}},jm=(e,t,n,o)=>{qm(e,((r,s)=>Hm(e,t,n,o)),n)},Vm=(e,t,n,o,r)=>{const s={elm:o.element.dom,alignToTop:r};((e,t)=>e.dispatch("ScrollIntoView",t).isDefaultPrevented())(e,s)||(n(t,fo(t).top,o,r),((e,t)=>{e.dispatch("AfterScrollIntoView",t)})(e,s))},Hm=(e,t,n,o)=>{const r=fn(e.getBody()),s=fn(e.getDoc());r.dom.offsetWidth;const a=((e,t)=>{const n=((e,t)=>{const n=Rn(e);if(0===n.length||Um(e))return{element:e,offset:t};if(t<n.length&&!Um(n[t]))return{element:n[t],offset:0};{const o=n[n.length-1];return Um(o)?{element:e,offset:t}:"img"===Mt(o)?{element:o,offset:1}:zt(o)?{element:o,offset:Uu(o).length}:{element:o,offset:Rn(o).length}}})(e,t),o=cn('<span data-mce-bogus="all" style="display: inline-block;">\ufeff</span>');return Xn(n.element,o),zm(o,(()=>no(o)))})(fn(n.startContainer),n.startOffset);Vm(e,s,t,a,o),a.cleanup()},$m=(e,t,n,o)=>{const r=fn(e.getDoc());Vm(e,r,n,(e=>zm(fn(e),S))(t),o)},qm=(e,t,n)=>{const o=n.startContainer,r=n.startOffset,s=n.endContainer,a=n.endOffset;t(fn(o),fn(s));const i=e.dom.createRng();i.setStart(o,r),i.setEnd(s,a),e.selection.setRng(n)},Wm=(e,t,n,o)=>{const r=e.pos;if(n)go(r.left,r.top,o);else{const n=r.top-t+e.height;go(r.left,n,o)}},Km=(e,t,n,o,r)=>{const s=n+t,a=o.pos.top,i=o.bottom,l=i-a>=n;a<t?Wm(o,n,!1!==r,e):a>s?Wm(o,n,l?!1!==r:!0===r,e):i>s&&!l&&Wm(o,n,!0===r,e)},Gm=(e,t,n,o)=>{const r=e.dom.defaultView.innerHeight;Km(e,t,r,n,o)},Ym=(e,t,n,o)=>{const r=e.dom.defaultView.innerHeight;Km(e,t,r,n,o);const s=(e=>{const t=Mm(),n=fo(t),o=((e,t)=>{const n=t.owner(e);return Im(t,n)})(e,Fm),r=mo(e),s=G(o,((e,t)=>{const n=mo(t);return{left:e.left+n.left,top:e.top+n.top}}),{left:0,top:0});return co(s.left+r.left+n.left,s.top+r.top+n.top)})(n.element),a=bo(window);s.top<a.y?po(n.element,!1!==o):s.top>a.bottom&&po(n.element,!0===o)},Xm=(e,t,n)=>jm(e,Gm,t,n),Qm=(e,t,n)=>$m(e,t,Gm,n),Jm=(e,t,n)=>jm(e,Ym,t,n),Zm=(e,t,n)=>$m(e,t,Ym,n),ef=(e,t,n)=>{(e.inline?Xm:Jm)(e,t,n)},tf=e=>e.dom.focus(),nf=e=>{const t=Mn(e).dom;return e.dom===t.activeElement},of=(e=Mm())=>M.from(e.dom.activeElement).map(fn),rf=(e,t)=>{const n=zt(t)?Uu(t).length:Rn(t).length+1;return e>n?n:e<0?0:e},sf=e=>pm.range(e.start,rf(e.soffset,e.start),e.finish,rf(e.foffset,e.finish)),af=(e,t)=>!yo(t.dom)&&(yn(e,t)||vn(e,t)),lf=e=>t=>af(e,t.start)&&af(e,t.finish),df=e=>pm.range(fn(e.startContainer),e.startOffset,fn(e.endContainer),e.endOffset),cf=e=>{const t=document.createRange();try{return t.setStart(e.start.dom,e.soffset),t.setEnd(e.finish.dom,e.foffset),M.some(t)}catch(e){return M.none()}},uf=e=>{const t=(e=>e.inline)(e)?(n=fn(e.getBody()),(e=>{const t=e.getSelection();return(t&&0!==t.rangeCount?M.from(t.getRangeAt(0)):M.none()).map(df)})(xn(n).dom).filter(lf(n))):M.none();var n;e.bookmark=t.isSome()?t:e.bookmark},mf=e=>(e.bookmark?e.bookmark:M.none()).bind((t=>{return n=fn(e.getBody()),o=t,M.from(o).filter(lf(n)).map(sf);var n,o})).bind(cf),ff={isEditorUIElement:e=>{const t=e.className.toString();return-1!==t.indexOf("tox-")||-1!==t.indexOf("mce-")}},gf={setEditorTimeout:(e,t,n)=>((e,t)=>(x(t)||(t=0),setTimeout(e,t)))((()=>{e.removed||t()}),n),setEditorInterval:(e,t,n)=>{const o=((e,t)=>(x(t)||(t=0),setInterval(e,t)))((()=>{e.removed?clearInterval(o):t()}),n);return o}};let pf;const hf=Hs.DOM,bf=(e,t)=>{const n=Nl(e),o=hf.getParent(t,(t=>(e=>ff.isEditorUIElement(e))(t)||!!n&&e.dom.is(t,n)));return null!==o},vf=(e,t)=>{const n=t.editor;(e=>{const t=Zs((()=>{uf(e)}),0);e.on("init",(()=>{e.inline&&((e,t)=>{const n=()=>{t.throttle()};Hs.DOM.bind(document,"mouseup",n),e.on("remove",(()=>{Hs.DOM.unbind(document,"mouseup",n)}))})(e,t),((e,t)=>{((e,t)=>{e.on("mouseup touchend",(e=>{t.throttle()}))})(e,t),e.on("keyup NodeChange AfterSetSelectionRange",(t=>{(e=>"nodechange"===e.type&&e.selectionChange)(t)||uf(e)}))})(e,t)})),e.on("remove",(()=>{t.cancel()}))})(n),n.on("focusin",(()=>{const t=e.focusedEditor;t!==n&&(t&&t.dispatch("blur",{focusedEditor:n}),e.setActive(n),e.focusedEditor=n,n.dispatch("focus",{blurredEditor:t}),n.focus(!0))})),n.on("focusout",(()=>{gf.setEditorTimeout(n,(()=>{const t=e.focusedEditor;bf(n,(e=>{try{const t=Mn(fn(e.getElement()));return of(t).fold((()=>document.body),(e=>e.dom))}catch(e){return document.body}})(n))||t!==n||(n.dispatch("blur",{focusedEditor:null}),e.focusedEditor=null)}))})),pf||(pf=t=>{const n=e.activeEditor;n&&Un(t).each((t=>{t.ownerDocument===document&&(t===document.body||bf(n,t)||e.focusedEditor!==n||(n.dispatch("blur",{focusedEditor:null}),e.focusedEditor=null))}))},hf.bind(document,"focusin",pf))},yf=(e,t)=>{e.focusedEditor===t.editor&&(e.focusedEditor=null),e.activeEditor||(hf.unbind(document,"focusin",pf),pf=null)},Cf=(e,t)=>{((e,t)=>(e=>e.collapsed?M.from(Aa(e.startContainer,e.startOffset)).map(fn):M.none())(t).bind((t=>ar(t)?M.some(t):!1===yn(e,t)?M.some(e):M.none())))(fn(e.getBody()),t).bind((e=>xc(e.dom))).fold((()=>{e.selection.normalize()}),(t=>e.selection.setRng(t.toRange())))},wf=e=>{if(e.setActive)try{e.setActive()}catch(t){e.focus()}else e.focus()},xf=e=>e.inline?(e=>{const t=e.getBody();return t&&(n=fn(t),nf(n)||(o=n,of(Mn(o)).filter((e=>o.dom.contains(e.dom)))).isSome());var n,o})(e):(e=>e.iframeElement&&nf(fn(e.iframeElement)))(e),kf=e=>e.editorManager.setActive(e),Sf=(e,t,n,o,r)=>{const s=n?t.startContainer:t.endContainer,a=n?t.startOffset:t.endOffset;return M.from(s).map(fn).map((e=>o&&t.collapsed?e:An(e,r(e,a)).getOr(e))).bind((e=>Ut(e)?M.some(e):kn(e).filter(Ut))).map((e=>e.dom)).getOr(e)},_f=(e,t,n)=>Sf(e,t,!0,n,((e,t)=>Math.min(Bn(e),t))),Ef=(e,t,n)=>Sf(e,t,!1,n,((e,t)=>t>0?t-1:t)),Nf=(e,t)=>{const n=e;for(;e&&Ro(e)&&0===e.length;)e=t?e.nextSibling:e.previousSibling;return e||n},Rf=(e,t)=>H(t,(t=>{const n=e.dispatch("GetSelectionRange",{range:t});return n.range!==t?n.range:t})),Af=["img","br"],Of=e=>{const t=zu(e).filter((e=>0!==e.trim().length||e.indexOf(fr)>-1)).isSome();return t||j(Af,Mt(e))},Tf="[data-mce-autocompleter]",Bf=(e,t)=>{if(Df(fn(e.getBody())).isNone()){const o=cn('<span data-mce-autocompleter="1" data-mce-bogus="1"></span>',e.getDoc());Zn(o,fn(t.extractContents())),t.insertNode(o.dom),kn(o).each((e=>e.dom.normalize())),(n=o,((e,t)=>{const n=e=>{const o=Rn(e);for(let e=o.length-1;e>=0;e--){const r=o[e];if(t(r))return M.some(r);const s=n(r);if(s.isSome())return s}return M.none()};return n(e)})(n,Of)).map((t=>{e.selection.setCursorLocation(t.dom,(e=>"img"===Mt(e)?1:zu(e).fold((()=>Rn(e).length),(e=>e.length)))(t))}))}var n},Df=e=>Ko(e,Tf),Pf={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11},Lf=(e,t,n)=>{const o=n?"lastChild":"firstChild",r=n?"prev":"next";if(e[o])return e[o];if(e!==t){let n=e[r];if(n)return n;for(let o=e.parent;o&&o!==t;o=o.parent)if(n=o[r],n)return n}},Mf=e=>{if(!Vr(e.value))return!1;const t=e.parent;return!t||"span"===t.name&&!t.attr("style")||!/^[ ]+$/.test(e.value)},If=e=>{const t="a"===e.name&&!e.attr("href")&&e.attr("id");return e.attr("name")||e.attr("id")&&!e.firstChild||e.attr("data-mce-bookmark")||t};class Ff{constructor(e,t){this.name=e,this.type=t,1===t&&(this.attributes=[],this.attributes.map={})}static create(e,t){const n=new Ff(e,Pf[e]||1);return t&&fe(t,((e,t)=>{n.attr(t,e)})),n}replace(e){const t=this;return e.parent&&e.remove(),t.insert(e,t),t.remove(),t}attr(e,t){const n=this;let o;if("string"!=typeof e)return null!=e&&fe(e,((e,t)=>{n.attr(t,e)})),n;if(o=n.attributes){if(void 0!==t){if(null===t){if(e in o.map){delete o.map[e];let t=o.length;for(;t--;)if(o[t].name===e)return o.splice(t,1),n}return n}if(e in o.map){let n=o.length;for(;n--;)if(o[n].name===e){o[n].value=t;break}}else o.push({name:e,value:t});return o.map[e]=t,n}return o.map[e]}}clone(){const e=this,t=new Ff(e.name,e.type);let n;if(n=e.attributes){const e=[];e.map={};for(let t=0,o=n.length;t<o;t++){const o=n[t];"id"!==o.name&&(e[e.length]={name:o.name,value:o.value},e.map[o.name]=o.value)}t.attributes=e}return t.value=e.value,t}wrap(e){const t=this;return t.parent.insert(e,t),e.append(t),t}unwrap(){const e=this;for(let t=e.firstChild;t;){const n=t.next;e.insert(t,e,!0),t=n}e.remove()}remove(){const e=this,t=e.parent,n=e.next,o=e.prev;return t&&(t.firstChild===e?(t.firstChild=n,n&&(n.prev=null)):o.next=n,t.lastChild===e?(t.lastChild=o,o&&(o.next=null)):n.prev=o,e.parent=e.next=e.prev=null),e}append(e){const t=this;e.parent&&e.remove();const n=t.lastChild;return n?(n.next=e,e.prev=n,t.lastChild=e):t.lastChild=t.firstChild=e,e.parent=t,e}insert(e,t,n){e.parent&&e.remove();const o=t.parent||this;return n?(t===o.firstChild?o.firstChild=e:t.prev.next=e,e.prev=t.prev,e.next=t,t.prev=e):(t===o.lastChild?o.lastChild=e:t.next.prev=e,e.next=t.next,e.prev=t,t.next=e),e.parent=o,e}getAll(e){const t=this,n=[];for(let o=t.firstChild;o;o=Lf(o,t))o.name===e&&n.push(o);return n}children(){const e=[];for(let t=this.firstChild;t;t=t.next)e.push(t);return e}empty(){const e=this;if(e.firstChild){const t=[];for(let n=e.firstChild;n;n=Lf(n,e))t.push(n);let n=t.length;for(;n--;){const e=t[n];e.parent=e.firstChild=e.lastChild=e.next=e.prev=null}}return e.firstChild=e.lastChild=null,e}isEmpty(e,t={},n){const o=this;let r=o.firstChild;if(If(o))return!1;if(r)do{if(1===r.type){if(r.attr("data-mce-bogus"))continue;if(e[r.name])return!1;if(If(r))return!1}if(8===r.type)return!1;if(3===r.type&&!Mf(r))return!1;if(3===r.type&&r.parent&&t[r.parent.name]&&Vr(r.value))return!1;if(n&&n(r))return!1}while(r=Lf(r,o));return!0}walk(e){return Lf(this,null,e)}}const Uf=(e,t,n=0)=>{const o=e.toLowerCase();if(-1!==o.indexOf("[if ",n)&&((e,t)=>/^\s*\[if [\w\W]+\]>.*<!\[endif\](--!?)?>/.test(e.substr(t)))(o,n)){const e=o.indexOf("[endif]",n);return o.indexOf(">",e)}if(t){const e=o.indexOf(">",n);return-1!==e?e:o.length}{const t=/--!?>/g;t.lastIndex=n;const r=t.exec(e);return r?r.index+r[0].length:o.length}},zf=(e,t,n)=>{const o=/<([!?\/])?([A-Za-z0-9\-_:.]+)/g,r=/(?:\s(?:[^'">]+(?:"[^"]*"|'[^']*'))*[^"'>]*(?:"[^">]*|'[^'>]*)?|\s*|\/)>/g,s=e.getVoidElements();let a=1,i=n;for(;0!==a;)for(o.lastIndex=i;;){const e=o.exec(t);if(null===e)return i;if("!"===e[1]){i=ze(e[2],"--")?Uf(t,!1,e.index+"!--".length):Uf(t,!0,e.index+1);break}{r.lastIndex=o.lastIndex;const n=r.exec(t);if(h(n)||n.index!==o.lastIndex)continue;"/"===e[1]?a-=1:xe(s,e[2])||(a+=1),i=o.lastIndex+n[0].length;break}}return i},jf=(e,t)=>{const n=/<(\w+) [^>]*data-mce-bogus="all"[^>]*>/g,o=e.schema;let r=((e,t)=>{const n=new RegExp(["\\s?("+e.join("|")+')="[^"]+"'].join("|"),"gi");return t.replace(n,"")})(e.getTempAttrs(),t);const s=o.getVoidElements();let a;for(;a=n.exec(r);){const e=n.lastIndex,t=a[0].length;let i;i=s[a[1]]?e:zf(o,r,e),r=r.substring(0,e-t)+r.substring(i),n.lastIndex=e-t}return br(r)},Vf=jf,Hf=Bt.each,$f=e=>({compare:(t,n)=>{if(t.nodeName!==n.nodeName)return!1;const o=t=>{const n={};return Hf(e.getAttribs(t),(o=>{const r=o.nodeName.toLowerCase();0!==r.indexOf("_")&&"style"!==r&&0!==r.indexOf("data-")&&(n[r]=e.getAttrib(t,r))})),n},r=(e,t)=>{let n,o;for(o in e)if(xe(e,o)){if(n=t[o],void 0===n)return!1;if(e[o]!==n)return!1;delete t[o]}for(o in t)if(xe(t,o))return!1;return!0};return!(!r(o(t),o(n))||!r(e.parseStyle(e.getAttrib(t,"style")),e.parseStyle(e.getAttrib(n,"style")))||Fc(t)||Fc(n))}}),qf=Bt.makeMap,Wf=e=>{const t=[],n=(e=e||{}).indent,o=qf(e.indent_before||""),r=qf(e.indent_after||""),s=ms.getEncodeFunc(e.entity_encoding||"raw",e.entities),a="xhtml"!==e.element_format;return{start:(e,i,l)=>{let d,c,u,m;if(n&&o[e]&&t.length>0&&(m=t[t.length-1],m.length>0&&"\n"!==m&&t.push("\n")),t.push("<",e),i)for(d=0,c=i.length;d<c;d++)u=i[d],t.push(" ",u.name,'="',s(u.value,!0),'"');t[t.length]=!l||a?">":" />",l&&n&&r[e]&&t.length>0&&(m=t[t.length-1],m.length>0&&"\n"!==m&&t.push("\n"))},end:e=>{let o;t.push("</",e,">"),n&&r[e]&&t.length>0&&(o=t[t.length-1],o.length>0&&"\n"!==o&&t.push("\n"))},text:(e,n)=>{e.length>0&&(t[t.length]=n?e:s(e))},cdata:e=>{t.push("<![CDATA[",e,"]]>")},comment:e=>{t.push("\x3c!--",e,"--\x3e")},pi:(e,o)=>{o?t.push("<?",e," ",s(o),"?>"):t.push("<?",e,"?>"),n&&t.push("\n")},doctype:e=>{t.push("<!DOCTYPE",e,">",n?"\n":"")},reset:()=>{t.length=0},getContent:()=>t.join("").replace(/\n$/,"")}},Kf=(e,t=Ss())=>{const n=Wf(e);return(e=e||{}).validate=!("validate"in e)||e.validate,{serialize:o=>{const r=e.validate,s={3:e=>{n.text(e.value,e.raw)},8:e=>{n.comment(e.value)},7:e=>{n.pi(e.name,e.value)},10:e=>{n.doctype(e.value)},4:e=>{n.cdata(e.value)},11:e=>{if(e=e.firstChild)do{a(e)}while(e=e.next)}};n.reset();const a=e=>{const o=s[e.type];if(o)o(e);else{const o=e.name,s=o in t.getVoidElements();let i=e.attributes;if(r&&i&&i.length>1){const n=[];n.map={};const o=t.getElementRule(e.name);if(o){for(let e=0,t=o.attributesOrder.length;e<t;e++){const t=o.attributesOrder[e];if(t in i.map){const e=i.map[t];n.map[t]=e,n.push({name:t,value:e})}}for(let e=0,t=i.length;e<t;e++){const t=i[e].name;if(!(t in n.map)){const e=i.map[t];n.map[t]=e,n.push({name:t,value:e})}}i=n}}if(n.start(o,i,s),!s){let t=e.firstChild;if(t){"pre"!==o&&"textarea"!==o||3!==t.type||"\n"!==t.value[0]||n.text("\n",!0);do{a(t)}while(t=t.next)}n.end(o)}}};return 1!==o.type||e.inner?3===o.type?s[3](o):s[11](o):a(o),n.getContent()}}},Gf=new Set;$(["margin","margin-left","margin-right","margin-top","margin-bottom","padding","padding-left","padding-right","padding-top","padding-bottom","border","border-width","border-style","border-color","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","float","position","left","right","top","bottom","z-index","display","transform","width","max-width","min-width","height","max-height","min-height","overflow","overflow-x","overflow-y","text-overflow","vertical-align","transition","transition-delay","transition-duration","transition-property","transition-timing-function"],(e=>{Gf.add(e)}));const Yf=["font","text-decoration","text-emphasis"],Xf=(e,t)=>ue(e.parseStyle(e.getAttrib(t,"style"))),Qf=(e,t,n)=>{const o=Xf(e,t),r=Xf(e,n),s=o=>{var r,s;const a=null!==(r=e.getStyle(t,o))&&void 0!==r?r:"",i=null!==(s=e.getStyle(n,o))&&void 0!==s?s:"";return We(a)&&We(i)&&a!==i};return V(o,(e=>{const t=t=>V(t,(t=>t===e));if(!t(r)&&t(Yf)){const e=K(r,(e=>V(Yf,(t=>ze(e,t)))));return V(e,s)}return s(e)}))},Jf=(e,t,n)=>M.from(n.container()).filter(Ro).exists((o=>{const r=e?0:-1;return t(o.data.charAt(n.offset()+r))})),Zf=O(Jf,!0,zc),eg=O(Jf,!1,zc),tg=e=>{const t=e.container();return Ro(t)&&(0===t.data.length||hr(t.data)&&Wu.isBookmarkNode(t.parentNode))},ng=(e,t)=>n=>M.from(Hd(e?0:-1,n)).filter(t).isSome(),og=e=>Lo(e)&&"block"===qn(fn(e),"display"),rg=e=>Io(e)&&!(e=>Co(e)&&"all"===e.getAttribute("data-mce-bogus"))(e),sg=ng(!0,og),ag=ng(!1,og),ig=ng(!0,Uo),lg=ng(!1,Uo),dg=ng(!0,_o),cg=ng(!1,_o),ug=ng(!0,rg),mg=ng(!1,rg),fg=e=>{to(e),Zn(e,cn('<br data-mce-bogus="1">'))},gg=e=>{Tn(e).each((t=>{Sn(t).each((n=>{er(e)&&nr(t)&&er(n)&&no(t)}))}))},pg=(e,t)=>((e,t,n)=>{return yn(t,e)?(o=((e,t)=>{const n=w(t)?t:P;let o=e.dom;const r=[];for(;null!==o.parentNode&&void 0!==o.parentNode;){const e=o.parentNode,t=fn(e);if(r.push(t),!0===n(t))break;o=e}return r})(e,(e=>n(e)||vn(e,t))),o.slice(0,-1)):[];var o})(e,t,P),hg=(e,t)=>[e].concat(pg(e,t)),bg=(e,t,n)=>vc(e,t,n,tg),vg=(e,t)=>Q(hg(fn(t.container()),e),er),yg=(e,t,n)=>bg(e,t.dom,n).forall((e=>vg(t,n).fold((()=>!1===Vd(e,n,t.dom)),(o=>!1===Vd(e,n,t.dom)&&yn(o,fn(e.container())))))),Cg=(e,t,n)=>vg(t,n).fold((()=>bg(e,t.dom,n).forall((e=>!1===Vd(e,n,t.dom)))),(t=>bg(e,t.dom,n).isNone())),wg=O(Cg,!1),xg=O(Cg,!0),kg=O(yg,!1),Sg=O(yg,!0),_g=e=>Jd(e).exists(nr),Eg=(e,t,n)=>{const o=K(hg(fn(n.container()),t),er),r=ie(o).getOr(t);return hc(e,r.dom,n).filter(_g)},Ng=(e,t)=>Jd(t).exists(nr)||Eg(!0,e,t).isSome(),Rg=(e,t)=>(e=>M.from(e.getNode(!0)).map(fn))(t).exists(nr)||Eg(!1,e,t).isSome(),Ag=O(Eg,!1),Og=O(Eg,!0),Tg=e=>Ya.isTextPosition(e)&&!e.isAtStart()&&!e.isAtEnd(),Bg=(e,t)=>{const n=K(hg(fn(t.container()),e),er);return ie(n).getOr(e)},Dg=(e,t)=>Tg(t)?eg(t):eg(t)||wc(Bg(e,t).dom,t).exists(eg),Pg=(e,t)=>Tg(t)?Zf(t):Zf(t)||Cc(Bg(e,t).dom,t).exists(Zf),Lg=e=>Jd(e).bind((e=>qo(e,Ut))).exists((e=>(e=>j(["pre","pre-wrap"],e))(qn(e,"white-space")))),Mg=(e,t)=>!Lg(t)&&(wg(e,t)||kg(e,t)||Rg(e,t)||Dg(e,t)),Ig=(e,t)=>!Lg(t)&&(xg(e,t)||Sg(e,t)||Ng(e,t)||Pg(e,t)||((e,t)=>{const n=Cc(e.dom,t).getOr(t),o=(e=>t=>{return n=new Qo(t,e).next(),C(n)&&Io(n)&&Bd(n);var n})(e.dom);return t.isAtEnd()&&(o(t.container())||o(n.container()))})(e,t)),Fg=(e,t)=>Mg(e,t)||Ig(e,(e=>{const t=e.container(),n=e.offset();return Ro(t)&&n<t.data.length?Ya(t,n+1):e})(t)),Ug=(e,t)=>Uc(e.charAt(t)),zg=e=>{const t=e.container();return Ro(t)&&Ue(t.data,fr)},jg=(e,t)=>M.some(t).filter(zg).bind((t=>{const n=t.container(),o=((e,t)=>{const n=t.data,o=Ya(t,0);return!(!Ug(n,0)||Fg(e,o)||(t.data=" "+n.slice(1),0))})(e,n)||(e=>{const t=e.data,n=(e=>{const t=e.split("");return H(t,((e,n)=>Uc(e)&&n>0&&n<t.length-1&&jc(t[n-1])&&jc(t[n+1])?" ":e)).join("")})(t);return n!==t&&(e.data=n,!0)})(n)||((e,t)=>{const n=t.data,o=Ya(t,n.length-1);return!(!Ug(n,n.length-1)||Fg(e,o)||(t.data=n.slice(0,-1)+" ",0))})(e,n);return o?M.some(t):M.none()})),Vg=(e,t,n)=>{if(0===n)return;const o=fn(e),r=$o(o,er).getOr(o),s=e.data.slice(t,t+n),a=t+n>=e.data.length&&Ig(r,Ya(e,e.data.length)),i=0===t&&Mg(r,Ya(e,0));e.replaceData(t,n,$r(s,4,i,a))},Hg=(e,t)=>{const n=e.data.slice(t),o=n.length-$e(n).length;Vg(e,t,o)},$g=(e,t)=>{const n=e.data.slice(0,t),o=n.length-qe(n).length;Vg(e,t-o,o)},qg=(e,t,n,o=!0)=>{const r=qe(e.data).length,s=o?e:t,a=o?t:e;return o?s.appendData(a.data):s.insertData(0,a.data),no(fn(a)),n&&Hg(s,r),s},Wg=(e,t)=>((e,t)=>{const n=e.container(),o=e.offset();return!1===Ya.isTextPosition(e)&&n===t.parentNode&&o>Ya.before(t).offset()})(t,e)?Ya(t.container(),t.offset()-1):t,Kg=e=>{return Fr(e.previousSibling)?M.some((t=e.previousSibling,Ro(t)?Ya(t,t.data.length):Ya.after(t))):e.previousSibling?kc(e.previousSibling):M.none();var t},Gg=e=>{return Fr(e.nextSibling)?M.some((t=e.nextSibling,Ro(t)?Ya(t,0):Ya.before(t))):e.nextSibling?xc(e.nextSibling):M.none();var t},Yg=(e,t,n)=>((e,t,n)=>e?((e,t)=>Gg(t).orThunk((()=>Kg(t))).orThunk((()=>((e,t)=>Cc(e,Ya.after(t)).fold((()=>wc(e,Ya.before(t))),M.some))(e,t))))(t,n):((e,t)=>Kg(t).orThunk((()=>Gg(t))).orThunk((()=>((e,t)=>{const n=Ya.before(t.previousSibling?t.previousSibling:t.parentNode);return wc(e,n).fold((()=>Cc(e,Ya.after(t))),M.some)})(e,t))))(t,n))(e,t,n).map(O(Wg,n)),Xg=(e,t,n)=>{n.fold((()=>{e.focus()}),(n=>{e.selection.setRng(n.toRange(),t)}))},Qg=(e,t)=>t&&xe(e.schema.getBlockElements(),Mt(t)),Jg=e=>{if(Yr(e)){const t=cn('<br data-mce-bogus="1">');return to(e),Zn(e,t),M.some(Ya.before(t.dom))}return M.none()},Zg=(e,t,n,o=!0)=>{const r=Yg(t,e.getBody(),n.dom),s=$o(n,O(Qg,e),(a=e.getBody(),e=>e.dom===a));var a;const i=((e,t,n)=>{const o=Sn(e).filter(zt),r=_n(e).filter(zt);return no(e),(s=o,a=r,i=t,l=(e,t,o)=>{const r=e.dom,s=t.dom,a=r.data.length;return qg(r,s,n),o.container()===s?Ya(r,a):o},s.isSome()&&a.isSome()&&i.isSome()?M.some(l(s.getOrDie(),a.getOrDie(),i.getOrDie())):M.none()).orThunk((()=>(n&&(o.each((e=>$g(e.dom,e.dom.length))),r.each((e=>Hg(e.dom,0)))),t)));var s,a,i,l})(n,r,((e,t)=>xe(e.schema.getTextInlineElements(),Mt(t)))(e,n));e.dom.isEmpty(e.getBody())?(e.setContent(""),e.selection.setCursorLocation()):s.bind(Jg).fold((()=>{o&&Xg(e,t,i)}),(n=>{o&&Xg(e,t,M.some(n))}))},ep=/[\u0591-\u07FF\uFB1D-\uFDFF\uFE70-\uFEFC]/,tp=(e,t)=>hn(fn(t),fl(e)),np=(e,t,n)=>{const o=((e,t,n)=>K(Hs.DOM.getParents(n.container(),"*",t),e))(e,t,n);return M.from(o[o.length-1])},op=(e,t)=>{if(!t)return t;const n=t.container(),o=t.offset();return e?wr(n)?Ro(n.nextSibling)?Ya(n.nextSibling,0):Ya.after(n):Sr(t)?Ya(n,o+1):t:wr(n)?Ro(n.previousSibling)?Ya(n.previousSibling,n.previousSibling.data.length):Ya.before(n):_r(t)?Ya(n,o-1):t},rp=O(op,!0),sp=O(op,!1),ap=(e,t)=>{const n=e=>e.stopImmediatePropagation();e.on("beforeinput input",n,!0),e.getDoc().execCommand(t),e.off("beforeinput input",n)},ip=e=>ap(e,"Delete"),lp=e=>or(e)||sr(e),dp=(e,t)=>yn(e,t)?qo(t,lp,(e=>t=>vn(e,fn(t.dom.parentNode)))(e)):M.none(),cp=e=>{e.dom.isEmpty(e.getBody())&&(e.setContent(""),(e=>{const t=e.getBody(),n=t.firstChild&&e.dom.isBlock(t.firstChild)?t.firstChild:t;e.selection.setCursorLocation(n,0)})(e))},up=e=>{var t;return(8===It(t=e)||"#comment"===Mt(t)?Sn(e):Tn(e)).bind(up).orThunk((()=>M.some(e)))},mp=(e,t,n,o=!0)=>{t.deleteContents();const r=up(n).getOr(n),s=fn(e.dom.getParent(r.dom,e.dom.isBlock));if(Yr(s)&&(fg(s),o&&e.selection.setCursorLocation(s.dom,0)),!vn(n,s)){const e=Dt(kn(s),n)?[]:kn(a=s).map(Rn).map((e=>K(e,(e=>!vn(a,e))))).getOr([]);$(e.concat(Rn(n)),(e=>{vn(e,s)||yn(e,s)||!Yr(e)||no(e)}))}var a},fp=e=>na(e,"td,th"),gp=(e,t)=>({start:e,end:t}),pp=Ci([{singleCellTable:["rng","cell"]},{fullTable:["table"]},{partialTable:["cells","outsideDetails"]},{multiTable:["startTableCells","endTableCells","betweenRng"]}]),hp=(e,t)=>Go(fn(e),"td,th",t),bp=e=>!vn(e.start,e.end),vp=(e,t)=>Ou(e.start,t).bind((n=>Ou(e.end,t).bind((e=>Lt(vn(n,e),n))))),yp=e=>t=>vp(t,e).map((e=>((e,t,n)=>({rng:e,table:t,cells:n}))(t,e,fp(e)))),Cp=(e,t,n,o)=>{if(n.collapsed||!e.forall(bp))return M.none();if(t.isSameTable){const t=e.bind(yp(o));return M.some({start:t,end:t})}{const e=hp(n.startContainer,o),t=hp(n.endContainer,o),r=e.bind((e=>t=>Ou(t,e).bind((e=>le(fp(e)).map((e=>gp(t,e))))))(o)).bind(yp(o)),s=t.bind((e=>t=>Ou(t,e).bind((e=>ie(fp(e)).map((e=>gp(e,t))))))(o)).bind(yp(o));return M.some({start:r,end:s})}},wp=(e,t)=>J(e,(e=>vn(e,t))),xp=e=>Pt(wp(e.cells,e.rng.start),wp(e.cells,e.rng.end),((t,n)=>e.cells.slice(t,n+1))),kp=(e,t)=>{const{startTable:n,endTable:o}=t,r=e.cloneRange();return n.each((e=>r.setStartAfter(e.dom))),o.each((e=>r.setEndBefore(e.dom))),r},Sp=(e,t)=>{const n=(e=>t=>vn(e,t))(e),o=((e,t)=>{const n=hp(e.startContainer,t),o=hp(e.endContainer,t);return Pt(n,o,gp)})(t,n),r=((e,t)=>{const n=e=>Ou(fn(e),t),o=n(e.startContainer),r=n(e.endContainer),s=o.isSome(),a=r.isSome(),i=Pt(o,r,vn).getOr(!1);return{startTable:o,endTable:r,isStartInTable:s,isEndInTable:a,isSameTable:i,isMultiTable:!i&&s&&a}})(t,n);return((e,t,n)=>e.exists((e=>((e,t)=>!bp(e)&&vp(e,t).exists((e=>{const t=e.dom.rows;return 1===t.length&&1===t[0].cells.length})))(e,n)&&Du(e.start,t))))(o,t,n)?o.map((e=>pp.singleCellTable(t,e.start))):r.isMultiTable?((e,t,n,o)=>Cp(e,t,n,o).bind((({start:e,end:o})=>{const r=e.bind(xp).getOr([]),s=o.bind(xp).getOr([]);if(r.length>0&&s.length>0){const e=kp(n,t);return M.some(pp.multiTable(r,s,e))}return M.none()})))(o,r,t,n):((e,t,n,o)=>Cp(e,t,n,o).bind((({start:e,end:t})=>e.or(t))).bind((e=>{const{isSameTable:o}=t,r=xp(e).getOr([]);if(o&&e.cells.length===r.length)return M.some(pp.fullTable(e.table));if(r.length>0){if(o)return M.some(pp.partialTable(r,M.none()));{const e=kp(n,t);return M.some(pp.partialTable(r,M.some({...t,rng:e})))}}return M.none()})))(o,r,t,n)},_p=e=>$(e,(e=>{Xt(e,"contenteditable"),fg(e)})),Ep=(e,t,n,o)=>{const r=n.cloneRange();o?(r.setStart(n.startContainer,n.startOffset),r.setEndAfter(t.dom.lastChild)):(r.setStartBefore(t.dom.firstChild),r.setEnd(n.endContainer,n.endOffset)),Op(e,r,t,!1).each((e=>e()))},Np=e=>{const t=Au(e),n=fn(e.selection.getNode());Fo(n.dom)&&Yr(n)?e.selection.setCursorLocation(n.dom,0):e.selection.collapse(!0),t.length>1&&V(t,(e=>vn(e,n)))&&qt(n,"data-mce-selected","1")},Rp=(e,t,n)=>M.some((()=>{const o=e.selection.getRng(),r=n.bind((({rng:n,isStartInTable:r})=>{const s=((e,t)=>M.from(e.dom.getParent(t,e.dom.isBlock)).map(fn))(e,r?n.endContainer:n.startContainer);n.deleteContents(),((e,t,n)=>{n.each((n=>{t?no(n):(fg(n),e.selection.setCursorLocation(n.dom,0))}))})(e,r,s.filter(Yr));const a=r?t[0]:t[t.length-1];return Ep(e,a,o,r),Yr(a)?M.none():M.some(r?t.slice(1):t.slice(0,-1))})).getOr(t);_p(r),Np(e)})),Ap=(e,t,n,o)=>M.some((()=>{const r=e.selection.getRng(),s=t[0],a=n[n.length-1];Ep(e,s,r,!0),Ep(e,a,r,!1);const i=Yr(s)?t:t.slice(1),l=Yr(a)?n:n.slice(0,-1);_p(i.concat(l)),o.deleteContents(),Np(e)})),Op=(e,t,n,o=!0)=>M.some((()=>{mp(e,t,n,o)})),Tp=(e,t)=>M.some((()=>Zg(e,!1,t))),Bp=(e,t)=>Q(hg(t,e),ir),Dp=(e,t)=>Q(hg(t,e),Ht("caption")),Pp=(e,t)=>M.some((()=>{fg(t),e.selection.setCursorLocation(t.dom,0)})),Lp=(e,t)=>e?dg(t):cg(t),Mp=(e,t,n)=>{const o=fn(e.getBody());return Dp(o,n).fold((()=>((e,t,n,o)=>{const r=Ya.fromRangeStart(e.selection.getRng());return Bp(n,o).bind((o=>Yr(o)?Pp(e,o):((e,t,n,o,r)=>bc(n,e.getBody(),r).bind((e=>Bp(t,fn(e.getNode())).bind((e=>vn(e,o)?M.none():M.some(S))))))(e,n,t,o,r)))})(e,t,o,n).orThunk((()=>Lt(((e,t)=>{const n=Ya.fromRangeStart(e.selection.getRng());return Lp(t,n)||hc(t,e.getBody(),n).exists((e=>Lp(t,e)))})(e,t),S)))),(n=>((e,t,n,o)=>{const r=Ya.fromRangeStart(e.selection.getRng());return Yr(o)?Pp(e,o):((e,t,n,o,r)=>bc(n,e.getBody(),r).fold((()=>M.some(S)),(s=>((e,t,n,o)=>xc(e.dom).bind((r=>kc(e.dom).map((e=>t?n.isEqual(r)&&o.isEqual(e):n.isEqual(e)&&o.isEqual(r))))).getOr(!0))(o,n,r,s)?((e,t)=>Pp(e,t))(e,o):((e,t,n)=>Dp(e,fn(n.getNode())).fold((()=>M.some(S)),(e=>Lt(!vn(e,t),S))))(t,o,s))))(e,n,t,o,r)})(e,t,o,n)))},Ip=(e,t)=>{const n=fn(e.selection.getStart(!0)),o=Au(e);return e.selection.isCollapsed()&&0===o.length?Mp(e,t,n):((e,t,n)=>{const o=fn(e.getBody()),r=e.selection.getRng();return 0!==n.length?Rp(e,n,M.none()):((e,t,n,o)=>Dp(t,o).fold((()=>((e,t,n)=>Sp(t,n).bind((t=>t.fold(O(Op,e),O(Tp,e),O(Rp,e),O(Ap,e)))))(e,t,n)),(t=>((e,t)=>Pp(e,t))(e,t))))(e,o,r,t)})(e,n,o)},Fp=(e,t)=>{for(;t&&t!==e;){if(Mo(t)||Io(t))return t;t=t.parentNode}return null},Up=(e,t)=>{t(e),e.firstChild&&Up(e.firstChild,t),e.next&&Up(e.next,t)},zp=(e,t,n,o)=>{const r=n.name;for(let t=0,s=e.length;t<s;t++){const s=e[t];if(s.name===r){const e=o.nodes[r];e?e.nodes.push(n):o.nodes[r]={filter:s,nodes:[n]}}}if(n.attributes)for(let e=0,r=t.length;e<r;e++){const r=t[e],s=r.name;if(s in n.attributes.map){const e=o.attributes[s];e?e.nodes.push(n):o.attributes[s]={filter:r,nodes:[n]}}}},jp=(e,t)=>{const n=e=>{fe(e,(e=>{const n=K(e.nodes,(e=>C(e.parent)));$(e.filter.callbacks,(o=>{o(n,e.filter.name,t)}))}))};n(e.nodes),n(e.attributes)},Vp=(e,t,n,o={})=>{const r=((e,t,n)=>{const o={nodes:{},attributes:{}};return n.firstChild&&Up(n.firstChild,(n=>{zp(e,t,n,o)})),o})(e,t,n);jp(r,o)},Hp=(e,t,n,o)=>{t.insert&&n[o.name]?o.empty().append(new Ff("br",1)):o.empty().append(new Ff("#text",3)).value=fr},$p=(e,t)=>e&&e.firstChild&&e.firstChild===e.lastChild&&e.firstChild.name===t,qp=(e,t,n,o)=>o.isEmpty(t,n,(t=>((e,t)=>{const n=e.getElementRule(t.name);return n&&n.paddEmpty})(e,t))),Wp=(e,t,n=e.parent)=>{if(t.getSpecialElements()[e.name])e.empty().remove();else{const o=e.children();for(const e of o)t.isValidChild(n.name,e.name)||Wp(e,t,n);e.unwrap()}},Kp=(e,t,n=S)=>{const o=t.getTextBlockElements(),r=t.getNonEmptyElements(),s=t.getWhitespaceElements(),a=Bt.makeMap("tr,td,th,tbody,thead,tfoot,table"),i=new Set;for(let l=0;l<e.length;l++){const d=e[l];let c,u,m;if(!d.parent||i.has(d))continue;if(o[d.name]&&"li"===d.parent.name){let e=d.next;for(;e&&o[e.name];)e.name="li",i.add(e),d.parent.insert(e,d.parent),e=e.next;d.unwrap();continue}const f=[d];for(c=d.parent;c&&!t.isValidChild(c.name,d.name)&&!a[c.name];c=c.parent)f.push(c);if(c&&f.length>1)if(t.isValidChild(c.name,d.name)){f.reverse(),u=f[0].clone(),n(u);let e=u;for(let o=0;o<f.length-1;o++){t.isValidChild(e.name,f[o].name)?(m=f[o].clone(),n(m),e.append(m)):m=e;for(let e=f[o].firstChild;e&&e!==f[o+1];){const t=e.next;m.append(e),e=t}e=m}qp(t,r,s,u)?c.insert(d,f[0],!0):(c.insert(u,f[0],!0),c.insert(d,u)),c=f[0],(qp(t,r,s,c)||$p(c,"br"))&&c.empty().remove()}else Wp(d,t);else if(d.parent){if("li"===d.name){let e=d.prev;if(e&&("ul"===e.name||"ol"===e.name)){e.append(d);continue}if(e=d.next,e&&("ul"===e.name||"ol"===e.name)){e.insert(d,e.firstChild,!0);continue}const t=new Ff("ul",1);n(t),d.wrap(t);continue}if(t.isValidChild(d.parent.name,"div")&&t.isValidChild("div",d.name)){const e=new Ff("div",1);n(e),d.wrap(e)}else Wp(d,t)}}},Gp=e=>e.collapsed?e:(e=>{const t=Ya.fromRangeStart(e),n=Ya.fromRangeEnd(e),o=e.commonAncestorContainer;return hc(!1,o,n).map((r=>!Vd(t,n,o)&&Vd(t,r,o)?((e,t,n,o)=>{const r=document.createRange();return r.setStart(e,t),r.setEnd(n,o),r})(t.container(),t.offset(),r.container(),r.offset()):e)).getOr(e)})(e),Yp=(e,t)=>{let n=t.firstChild,o=t.lastChild;return n&&"meta"===n.name&&(n=n.next),o&&"mce_marker"===o.attr("id")&&(o=o.prev),((e,t)=>{const n=e.getNonEmptyElements();return t&&(t.isEmpty(n)||((e,t)=>e.getBlockElements()[t.name]&&(e=>e.firstChild&&e.firstChild===e.lastChild)(t)&&(e=>"br"===e.name||e.value===fr)(t.firstChild))(e,t))})(e,o)&&(o=o.prev),!(!n||n!==o||"ul"!==n.name&&"ol"!==n.name)},Xp=e=>{return e.length>0&&(!(n=e[e.length-1]).firstChild||(t=n)&&t.firstChild&&t.firstChild===t.lastChild&&(e=>e.data===fr||Po(e))(t.firstChild))?e.slice(0,-1):e;var t,n},Qp=(e,t)=>{const n=e.getParent(t,e.isBlock);return n&&"LI"===n.nodeName?n:null},Jp=(e,t)=>{const n=Ya.after(e),o=mc(t).prev(n);return o?o.toRange():null},Zp=(e,t,n,o)=>{const r=((e,t,n)=>{const o=t.serialize(n);return(e=>{const t=e.firstChild,n=e.lastChild;return t&&"META"===t.nodeName&&t.parentNode.removeChild(t),n&&"mce_marker"===n.id&&n.parentNode.removeChild(n),e})(e.createFragment(o))})(t,e,o),s=Qp(t,n.startContainer),a=Xp((i=r.firstChild,K(i.childNodes,(e=>"LI"===e.nodeName))));var i;const l=t.getRoot(),d=e=>{const o=Ya.fromRangeStart(n),r=mc(t.getRoot()),a=1===e?r.prev(o):r.next(o);return!a||Qp(t,a.getNode())!==s};return d(1)?((e,t,n)=>{const o=e.parentNode;return Bt.each(t,(t=>{o.insertBefore(t,e)})),((e,t)=>{const n=Ya.before(e),o=mc(t).next(n);return o?o.toRange():null})(e,n)})(s,a,l):d(2)?((e,t,n,o)=>(o.insertAfter(t.reverse(),e),Jp(t[0],n)))(s,a,l,t):((e,t,n,o)=>{const r=((e,t)=>{const n=t.cloneRange(),o=t.cloneRange();return n.setStartBefore(e),o.setEndAfter(e),[n.cloneContents(),o.cloneContents()]})(e,o),s=e.parentNode;return s.insertBefore(r[0],e),Bt.each(t,(t=>{s.insertBefore(t,e)})),s.insertBefore(r[1],e),s.removeChild(e),Jp(t[t.length-1],n)})(s,a,l,n)},eh=["pre"],th=Fo,nh=(e,t,n)=>{let o,r,s;const a=e.selection,i=e.dom,l=e.parser,d=n.merge,c=Kf({validate:!0},e.schema),u='<span id="mce_marker" data-mce-type="bookmark">&#xFEFF;</span>';-1===t.indexOf("{$caret}")&&(t+="{$caret}"),t=t.replace(/\{\$caret\}/,u),r=a.getRng();const m=r.startContainer||(r.parentElement?r.parentElement():null),f=e.getBody();m===f&&a.isCollapsed()&&i.isBlock(f.firstChild)&&((e,t)=>t&&!e.schema.getVoidElements()[t.nodeName])(e,f.firstChild)&&i.isEmpty(f.firstChild)&&(r=i.createRng(),r.setStart(f.firstChild,0),r.setEnd(f.firstChild,0),a.setRng(r)),a.isCollapsed()||(e=>{const t=e.dom,n=Gp(e.selection.getRng());e.selection.setRng(n);const o=t.getParent(n.startContainer,th);((e,t,n)=>null!==n&&n===e.getParent(t.endContainer,th)&&Du(fn(n),t))(t,n,o)?Op(e,n,fn(o)):e.getDoc().execCommand("Delete",!1,null)})(e),o=a.getNode();const g={context:o.nodeName.toLowerCase(),data:n.data,insert:!0},p=l.parse(t,g);if(!0===n.paste&&Yp(e.schema,p)&&((e,t)=>!!Qp(e,t))(i,o))return r=Zp(c,i,a.getRng(),p),a.setRng(r),t;if(!0===n.paste&&((e,t)=>{const n=e.firstChild,o=j(eh,n.name),r=n.name===t.tagName.toLowerCase();return n===("bookmark"===e.lastChild.attr("data-mce-type")?e.lastChild.prev:e.lastChild)&&o&&r})(p,o)&&p.firstChild.unwrap(),(e=>{let t=e;for(;t=t.walk();)1===t.type&&t.attr("data-mce-fragment","1")})(p),s=p.lastChild,"mce_marker"===s.attr("id")){const t=s;for(s=s.prev;s;s=s.walk(!0))if(3===s.type||!i.isBlock(s.name)){e.schema.isValidChild(s.parent.name,"span")&&s.parent.insert(t,s,"br"===s.name);break}}if(e._selectionOverrides.showBlockCaretContainer(o),g.invalid){e.selection.setContent(u),o=a.getNode();const n=e.getBody();for(9===o.nodeType?o=s=n:s=o;s!==n;)o=s,s=s.parentNode;t=o===n?n.innerHTML:i.getOuterHTML(o);const r=l.parse(t);for(let e=r;e;e=e.walk())if("mce_marker"===e.attr("id")){e.replace(p);break}const d=p.children(),m=p.parent.name;p.unwrap();const f=K(d,(t=>!e.schema.isValidChild(m,t.name)));Kp(f,e.schema),Vp(l.getNodeFilters(),l.getAttributeFilters(),r),t=c.serialize(r),o===n?i.setHTML(n,t):i.setOuterHTML(o,t)}else t=c.serialize(p),((e,t,n)=>{if("all"===n.getAttribute("data-mce-bogus"))n.parentNode.insertBefore(e.dom.createFragment(t),n);else{const o=n.firstChild,r=n.lastChild;!o||o===r&&"BR"===o.nodeName?e.dom.setHTML(n,t):e.selection.setContent(t,{no_events:!0})}})(e,t,o);var h;return((e,t)=>{const n=e.schema.getTextInlineElements(),o=e.dom;if(t){const t=e.getBody(),r=$f(o);Bt.each(o.select("*[data-mce-fragment]"),(e=>{if(C(n[e.nodeName.toLowerCase()])&&((e,t)=>te(Xf(e,t),(e=>!(e=>Gf.has(e))(e))))(o,e))for(let n=e.parentNode;C(n)&&n!==t&&!Qf(o,e,n);n=n.parentNode)if(r.compare(n,e)){o.remove(e,!0);break}}))}})(e,d),((e,t)=>{let n;const o=e.dom,r=e.selection;if(!t)return;r.scrollIntoView(t);const s=Fp(e.getBody(),t);if("false"===o.getContentEditable(s))return o.remove(t),void r.select(s);let a=o.createRng();const i=t.previousSibling;if(Ro(i)){a.setStart(i,i.nodeValue.length);const e=t.nextSibling;Ro(e)&&(i.appendData(e.data),e.parentNode.removeChild(e))}else a.setStartBefore(t),a.setEndBefore(t);const l=o.getParent(t,o.isBlock);o.remove(t),l&&o.isEmpty(l)&&(to(fn(l)),a.setStart(l,0),a.setEnd(l,0),th(l)||(e=>!!e.getAttribute("data-mce-fragment"))(l)||!(n=(t=>{let n=Ya.fromRangeStart(t);if(n=mc(e.getBody()).next(n),n)return n.toRange()})(a))?o.add(l,o.create("br",{"data-mce-bogus":"1"})):(a=n,o.remove(l))),r.setRng(a)})(e,i.get("mce_marker")),h=e.getBody(),Bt.each(h.getElementsByTagName("*"),(e=>{e.removeAttribute("data-mce-fragment")})),((e,t)=>{M.from(e.getParent(t,"td,th")).map(fn).each(gg)})(i,a.getStart()),t},oh=e=>e instanceof Ff,rh=(e,t,n)=>{e.dom.setHTML(e.getBody(),t),!0!==n&&(e=>{xf(e)&&xc(e.getBody()).each((t=>{const n=t.getNode(),o=_o(n)?xc(n).getOr(t):t;e.selection.setRng(o.toRange())}))})(e)},sh=(e,t)=>((e,t)=>{const n=e.dom;return n.parentNode?((e,t)=>Q(e.dom.childNodes,(e=>t(fn(e)))).map(fn))(fn(n.parentNode),(n=>!vn(e,n)&&t(n))):M.none()})(e,t).isSome(),ah=e=>w(e)?e:P,ih=(e,t,n)=>{const o=t(e),r=ah(n);return o.orThunk((()=>r(e)?M.none():((e,t,n)=>{let o=e.dom;const r=ah(n);for(;o.parentNode;){o=o.parentNode;const e=fn(o),n=t(e);if(n.isSome())return n;if(r(e))break}return M.none()})(e,t,r)))},lh=nu,dh=(e,t,n)=>{const o=e.formatter.get(n);if(o)for(let n=0;n<o.length;n++){const r=o[n];if(lu(r)&&!1===r.inherit&&e.dom.is(t,r.selector))return!0}return!1},ch=(e,t,n,o,r)=>{const s=e.dom.getRoot();return t!==s&&(t=e.dom.getParent(t,(t=>!!dh(e,t,n)||t.parentNode===s||!!fh(e,t,n,o,!0))),!!fh(e,t,n,o,r))},uh=(e,t,n)=>!(!du(n)||!lh(t,n.inline))||!(!iu(n)||!lh(t,n.block))||!!lu(n)&&Co(t)&&e.is(t,n.selector),mh=(e,t,n,o,r,s)=>{const a=n[o];if(w(n.onmatch))return n.onmatch(t,n,o);if(a)if(v(a.length)){for(const i in a)if(xe(a,i)){const l="attributes"===o?e.getAttrib(t,i):ru(e,t,i),d=tu(a[i],s),c=y(l)||Ke(l);if(c&&y(d))continue;if(r&&c&&!n.exact)return!1;if((!r||n.exact)&&!lh(l,ou(d,i)))return!1}}else for(let n=0;n<a.length;n++)if("attributes"===o?e.getAttrib(t,a[n]):ru(e,t,a[n]))return!0;return!0},fh=(e,t,n,o,r)=>{const s=e.formatter.get(n),a=e.dom;if(s&&t)for(let n=0;n<s.length;n++){const i=s[n];if(uh(e.dom,t,i)&&mh(a,t,i,"attributes",r,o)&&mh(a,t,i,"styles",r,o)){const n=i.classes;if(n)for(let r=0;r<n.length;r++)if(!e.dom.hasClass(t,tu(n[r],o)))return;return i}}},gh=(e,t,n,o,r)=>{if(o)return ch(e,o,t,n,r);if(o=e.selection.getNode(),ch(e,o,t,n,r))return!0;const s=e.selection.getStart();return!(s===o||!ch(e,s,t,n,r))},ph=pr,hh="_mce_caret",bh=e=>(e=>{const t=[];for(;e;){if(3===e.nodeType&&e.nodeValue!==ph||e.childNodes.length>1)return[];1===e.nodeType&&t.push(e),e=e.firstChild}return t})(e).length>0,vh=e=>{if(e){const t=new Qo(e,e);for(e=t.current();e;e=t.next())if(Ro(e))return e}return null},yh=e=>{const t=un("span");return Wt(t,{id:hh,"data-mce-bogus":"1","data-mce-type":"format-caret"}),e&&Zn(t,mn(ph)),t},Ch=(e,t,n=!0)=>{const o=e.dom,r=e.selection;if(bh(t))Zg(e,!1,fn(t),n);else{const e=r.getRng(),n=o.getParent(t,o.isBlock),s=e.startContainer,a=e.startOffset,i=e.endContainer,l=e.endOffset,d=(e=>{const t=vh(e);return t&&t.nodeValue.charAt(0)===ph&&t.deleteData(0,1),t})(t);o.remove(t,!0),s===d&&a>0&&e.setStart(d,a-1),i===d&&l>0&&e.setEnd(d,l-1),n&&o.isEmpty(n)&&fg(fn(n)),r.setRng(e)}},wh=(e,t,n=!0)=>{const o=e.dom,r=e.selection;if(t)Ch(e,t,n);else if(!(t=Ec(e.getBody(),r.getStart())))for(;t=o.get(hh);)Ch(e,t,!1)},xh=(e,t)=>(e.appendChild(t),t),kh=(e,t)=>{const n=G(e,((e,t)=>xh(e,t.cloneNode(!1))),t);return xh(n,n.ownerDocument.createTextNode(ph))},Sh=(e,t,n,o)=>{const a=e.dom,i=e.selection;let l,d,c;const u=[],m=i.getRng(),f=m.startContainer,g=m.startOffset;for(d=f,3===f.nodeType&&(g!==f.nodeValue.length&&(l=!0),d=d.parentNode);d;){if(fh(e,d,t,n,o)){c=d;break}d.nextSibling&&(l=!0),u.push(d),d=d.parentNode}if(c)if(l){const r=i.getBookmark();m.collapse(!0);let s=_u(e,m,e.formatter.get(t),!0);s=Dm(s),e.formatter.remove(t,n,s,o),i.moveToBookmark(r)}else{const l=Ec(e.getBody(),c),d=yh(!1).dom;((e,t,n)=>{const o=e.dom,r=o.getParent(n,O(Jc,e));r&&o.isEmpty(r)?n.parentNode.replaceChild(t,n):((e=>{const t=na(e,"br"),n=K((e=>{const t=[];let n=e.dom;for(;n;)t.push(fn(n)),n=n.lastChild;return t})(e).slice(-1),nr);t.length===n.length&&$(n,no)})(fn(n)),o.isEmpty(n)?n.parentNode.replaceChild(t,n):o.insertAfter(t,n))})(e,d,null!==l?l:c);const m=((e,t,n,o,a,i)=>{const l=e.formatter,d=e.dom,c=K(ue(l.get()),(e=>e!==o&&!Ue(e,"removeformat"))),u=((e,t,n)=>Y(n,((n,o)=>{const r=((e,t)=>V(e.formatter.get(t),(e=>{const t=e=>e.length>1&&"%"===e.charAt(0);return V(["styles","attributes"],(n=>we(e,n).exists((e=>{const n=p(e)?e:Ce(e);return V(n,t)}))))})))(e,o);return e.formatter.matchNode(t,o,{},r)?n.concat([o]):n}),[]))(e,n,c);if(K(u,(t=>!((e,t,n)=>{const o=["inline","block","selector","attributes","styles","classes"],a=e=>ve(e,((e,t)=>V(o,(e=>e===t))));return V(e.formatter.get(t),(t=>{const o=a(t);return V(e.formatter.get(n),(e=>{const t=a(e);return((e,t,n=s)=>r(n).eq(e,t))(o,t)}))}))})(e,t,o))).length>0){const e=n.cloneNode(!1);return d.add(t,e),l.remove(o,a,e,i),d.remove(e),M.some(e)}return M.none()})(e,d,c,t,n,o),f=kh(u.concat(m.toArray()),d);Ch(e,l,!1),i.setCursorLocation(f,1),a.isEmpty(c)&&a.remove(c)}},_h=(e,t)=>{const n=e.schema.getTextInlineElements();return xe(n,Mt(t))&&!_c(t.dom)&&!So(t.dom)},Eh={},Nh=Re,Rh=Ee;Eh.pre||(Eh.pre=[]),Eh.pre.push((e=>{const t=e.selection.getRng();let n;const o=e=>r(e.previousSibling)&&-1!==Ae(n,e.previousSibling),r=wo(["pre"]);t.collapsed||(n=e.selection.getSelectedBlocks(),Rh(Nh(Nh(n,r),o),(e=>{((e,t)=>{const n=fn(t),o=wn(n).dom;no(n),eo(fn(e),[un("br",o),un("br",o),...Rn(n)])})(e.previousSibling,e)})))}));const Ah=Bt.each,Oh=e=>Co(e)&&!Fc(e)&&!_c(e)&&!So(e),Th=(e,t)=>{for(let n=e;n;n=n[t]){if(Ro(n)&&We(n.data))return e;if(Co(n)&&!Fc(n))return n}return e},Bh=(e,t,n)=>{const o=$f(e);if(t&&n&&(t=Th(t,"previousSibling"),n=Th(n,"nextSibling"),o.compare(t,n))){for(let e=t.nextSibling;e&&e!==n;){const n=e;e=e.nextSibling,t.appendChild(n)}return e.remove(n),Bt.each(Bt.grep(n.childNodes),(e=>{t.appendChild(e)})),t}return n},Dh=(e,t,n,o)=>{if(o&&!1!==t.merge_siblings){const t=Bh(e,Qc(o),o);Bh(e,t,Qc(t,!0))}},Ph=(e,t,n)=>{Ah(e.childNodes,(e=>{Oh(e)&&(t(e)&&n(e),e.hasChildNodes()&&Ph(e,t,n))}))},Lh=(e,t)=>n=>!(!n||!ru(e,n,t)),Mh=(e,t,n)=>o=>{e.setStyle(o,t,n),""===o.getAttribute("style")&&o.removeAttribute("style"),((e,t)=>{"SPAN"===t.nodeName&&0===e.getAttribs(t).length&&e.remove(t,!0)})(e,o)},Ih=Ci([{keep:[]},{rename:["name"]},{removed:[]}]),Fh=/^(src|href|style)$/,Uh=Bt.each,zh=nu,jh=(e,t,n)=>e.isChildOf(t,n)&&t!==n&&!e.isBlock(n),Vh=(e,t,n)=>{let o=t[n?"startContainer":"endContainer"],r=t[n?"startOffset":"endOffset"];if(Co(o)){const e=o.childNodes.length-1;!n&&r&&r--,o=o.childNodes[r>e?e:r]}return Ro(o)&&n&&r>=o.nodeValue.length&&(o=new Qo(o,e.getBody()).next()||o),Ro(o)&&!n&&0===r&&(o=new Qo(o,e.getBody()).prev()||o),o},Hh=(e,t)=>{const n=t?"firstChild":"lastChild";if((e=>/^(TR|TH|TD)$/.test(e.nodeName))(e)&&e[n]){const t=e[n];return"TR"===e.nodeName&&t[n]||t}return e},$h=(e,t,n,o)=>{const r=e.create(n,o);return t.parentNode.insertBefore(r,t),r.appendChild(t),r},qh=(e,t,n,o,r)=>{const s=fn(t),a=fn(e.create(o,r)),i=n?Nn(s):En(s);return eo(a,i),n?(Xn(s,a),Jn(a,s)):(Qn(s,a),Zn(a,s)),a.dom},Wh=(e,t,n,o,r)=>{let s;const a=e.dom;if(!uh(a,o,t)&&!((e,t)=>t.links&&"A"===e.nodeName)(o,t))return Ih.keep();const i=o;if(du(t)&&"all"===t.remove&&p(t.preserve_attributes)){const e=K(a.getAttribs(i),(e=>j(t.preserve_attributes,e.name.toLowerCase())));if(a.removeAllAttribs(i),$(e,(e=>a.setAttrib(i,e.name,e.value))),e.length>0)return Ih.rename("span")}if("all"!==t.remove){Uh(t.styles,((e,o)=>{e=ou(tu(e,n),o+""),x(o)&&(o=e,r=null),(t.remove_similar||!r||zh(ru(a,r,o),e))&&a.setStyle(i,o,""),s=!0})),s&&""===a.getAttrib(i,"style")&&(i.removeAttribute("style"),i.removeAttribute("data-mce-style")),Uh(t.attributes,((e,o)=>{let s;if(e=tu(e,n),x(o)&&(o=e,r=null),t.remove_similar||!r||zh(a.getAttrib(r,o),e)){if("class"===o&&(e=a.getAttrib(i,o))&&(s="",$(e.split(/\s+/),(e=>{/mce\-\w+/.test(e)&&(s+=(s?" ":"")+e)})),s))return void a.setAttrib(i,o,s);if(Fh.test(o)&&i.removeAttribute("data-mce-"+o),"style"===o&&wo(["li"])(i)&&"none"===a.getStyle(i,"list-style-type"))return i.removeAttribute(o),void a.setStyle(i,"list-style-type","none");"class"===o&&i.removeAttribute("className"),i.removeAttribute(o)}})),Uh(t.classes,(e=>{e=tu(e,n),r&&!a.hasClass(r,e)||a.removeClass(i,e)}));const e=a.getAttribs(i);for(let t=0;t<e.length;t++){const n=e[t].nodeName;if(0!==n.indexOf("_")&&0!==n.indexOf("data-"))return Ih.keep()}}return"none"!==t.remove?(((e,t,n)=>{const o=t.parentNode;let r;const s=e.dom,a=ji(e);iu(n)&&o===s.getRoot()&&(n.list_block&&zh(t,n.list_block)||$(de(t.childNodes),(t=>{Zc(e,a,t.nodeName.toLowerCase())?r?r.appendChild(t):(r=$h(s,t,a),s.setAttribs(r,Vi(e))):r=null}))),(e=>lu(e)&&du(e)&&Dt(we(e,"mixed"),!0))(n)&&!zh(n.inline,t)||s.remove(t,!0)})(e,i,t),Ih.removed()):Ih.keep()},Kh=(e,t,n,o,r)=>Wh(e,t,n,o,r).fold(P,(t=>(e.dom.rename(o,t),!0)),L),Gh=(e,t,n,o)=>Wh(e,t,n,o,o).fold(N(o),(t=>(e.dom.createFragment().appendChild(o),e.dom.rename(o,t))),N(null)),Yh=(e,t,n,o,r)=>{const s=e.formatter.get(t),a=s[0];let i=!0;const l=e.dom,d=e.selection,c=o=>{const i=((e,t,n,o,r)=>{let s;return $(au(e.dom,t.parentNode).reverse(),(t=>{if(!s&&"_start"!==t.id&&"_end"!==t.id){const a=fh(e,t,n,o,r);a&&!1!==a.split&&(s=t)}})),s})(e,o,t,n,r);return((e,t,n,o,r,s,a,i)=>{let l,d,c;const u=e.dom;if(n){const s=n.parentNode;for(let n=o.parentNode;n&&n!==s;n=n.parentNode){l=u.clone(n,!1);for(let n=0;n<t.length&&(l=Gh(e,t[n],i,l),null!==l);n++);l&&(d&&l.appendChild(d),c||(c=l),d=l)}a.mixed&&u.isBlock(n)||(o=u.split(n,o)),d&&(r.parentNode.insertBefore(d,r),c.appendChild(r),du(a)&&Dh(u,a,0,d))}return o})(e,s,i,o,o,0,a,n)},u=t=>V(s,(o=>Kh(e,o,n,t,t))),m=t=>{let n=!0,o=!1;Co(t)&&l.getContentEditable(t)&&(n=i,i="true"===l.getContentEditable(t),o=!0);const r=de(t.childNodes);if(i&&!o){const e=u(t)||V(s,(e=>uh(l,t,e))),n=t.parentNode;!e&&C(n)&&cu(a)&&u(n)}if(a.deep&&r.length){for(let e=0;e<r.length;e++)m(r[e]);o&&(i=n)}$(["underline","line-through","overline"],(n=>{Co(t)&&e.dom.getStyle(t,"text-decoration")===n&&t.parentNode&&su(l,t.parentNode)===n&&Kh(e,{deep:!1,exact:!0,inline:"span",styles:{textDecoration:n}},null,t)}))},f=e=>{const t=l.get(e?"_start":"_end");let n=t[e?"firstChild":"lastChild"];return(e=>Fc(e)&&Co(e)&&("_start"===e.id||"_end"===e.id))(n)&&(n=n[e?"firstChild":"lastChild"]),Ro(n)&&0===n.data.length&&(n=e?t.previousSibling||t.nextSibling:t.nextSibling||t.previousSibling),l.remove(t,!0),n},g=t=>{let n,o,r=_u(e,t,s,t.collapsed);if(a.split){if(r=Dm(r),n=Vh(e,r,!0),o=Vh(e,r),n!==o){if(n=Hh(n,!0),o=Hh(o,!1),jh(l,n,o)){const e=M.from(n.firstChild).getOr(n);return c(qh(l,e,!0,"span",{id:"_start","data-mce-type":"bookmark"})),void f(!0)}if(jh(l,o,n)){const e=M.from(o.lastChild).getOr(o);return c(qh(l,e,!1,"span",{id:"_end","data-mce-type":"bookmark"})),void f(!1)}n=$h(l,n,"span",{id:"_start","data-mce-type":"bookmark"}),o=$h(l,o,"span",{id:"_end","data-mce-type":"bookmark"});const e=l.createRng();e.setStartAfter(n),e.setEndBefore(o),Eu(l,e,(e=>{$(e,(e=>{Fc(e)||Fc(e.parentNode)||c(e)}))})),c(n),c(o),n=f(!0),o=f()}else n=o=c(n);r.startContainer=n.parentNode?n.parentNode:n,r.startOffset=l.nodeIndex(n),r.endContainer=o.parentNode?o.parentNode:o,r.endOffset=l.nodeIndex(o)+1}Eu(l,r,(e=>{$(e,m)}))};if(o){if(Yc(o)){const e=l.createRng();e.setStartBefore(o),e.setEndAfter(o),g(e)}else g(o);Xu(e,t,o,n)}else if("false"!==l.getContentEditable(d.getNode()))d.isCollapsed()&&du(a)&&!Au(e).length?Sh(e,t,n,r):(Iu(d,!0,(()=>{Mu(e,g)})),du(a)&&gh(e,t,n,d.getStart())&&Xc(l,d,d.getRng()),e.nodeChanged()),Xu(e,t,o,n);else{o=d.getNode();for(let t=0;t<s.length&&(!s[t].ceFalseOverride||!Kh(e,s[t],n,o,o));t++);Xu(e,t,o,n)}},Xh=Bt.each,Qh=Bt.each,Jh=e=>Co(e)&&!Fc(e)&&!_c(e)&&!So(e),Zh=(e,t,n,o)=>{const r=e.formatter.get(t),s=r[0],a=!o&&e.selection.isCollapsed(),i=e.dom,l=e.selection,d=(e,t=s)=>{if(w(t.onformat)&&t.onformat(e,t,n,o),Qh(t.styles,((t,o)=>{i.setStyle(e,o,tu(t,n))})),t.styles){const t=i.getAttrib(e,"style");t&&i.setAttrib(e,"data-mce-style",t)}Qh(t.attributes,((t,o)=>{i.setAttrib(e,o,tu(t,n))})),Qh(t.classes,(t=>{t=tu(t,n),i.hasClass(e,t)||i.addClass(e,t)}))},c=(e,t)=>{let n=!1;return Qh(e,(e=>!!lu(e)&&(C(e.collapsed)&&e.collapsed!==a?void 0:i.is(t,e.selector)&&!_c(t)?(d(t,e),n=!0,!1):void 0))),n},u=e=>{if(m(e)){const t=i.create(e);return d(t),t}return null},f=(o,a,i)=>{const l=[];let m=!0;const f=s.inline||s.block,g=u(f);Eu(o,a,(a=>{let u;const p=a=>{let h=!1,b=m;const v=a.nodeName.toLowerCase(),y=a.parentNode,w=y.nodeName.toLowerCase();if(Co(a)&&o.getContentEditable(a)&&(b=m,m="true"===o.getContentEditable(a),h=!0),Po(a)&&!((e,t,n,o)=>{if(El(e)&&du(t)){const t=xs(e.schema),r=sh(fn(n),(e=>_c(e.dom)));return ke(t,o)&&Yr(fn(n.parentNode),!1)&&!r}return!1})(e,s,a,w))return u=null,void(iu(s)&&o.remove(a));if(iu(s)&&s.wrapper&&fh(e,a,t,n))u=null;else{if(m&&!h&&iu(s)&&!s.wrapper&&Jc(e,v)&&Zc(e,w,f)){const e=o.rename(a,f);return d(e),l.push(e),void(u=null)}if(lu(s)){let e=c(r,a);if(!e&&C(y)&&cu(s)&&(e=c(r,y)),!du(s)||e)return void(u=null)}!m||h||!Zc(e,f,v)||!Zc(e,w,f)||!i&&Ro(a)&&hr(a.data)||_c(a)||du(s)&&o.isBlock(a)?(u=null,$(de(a.childNodes),p),h&&(m=b),u=null):(u||(u=o.clone(g,!1),a.parentNode.insertBefore(u,a),l.push(u)),u.appendChild(a))}};$(a,p)})),!0===s.links&&$(l,(e=>{const t=e=>{"A"===e.nodeName&&d(e,s),$(de(e.childNodes),t)};t(e)})),$(l,(a=>{const i=(e=>{let t=0;return $(e.childNodes,(e=>{(e=>C(e)&&Ro(e)&&0===e.length)(e)||Fc(e)||t++})),t})(a);!(l.length>1)&&o.isBlock(a)||0!==i?(du(s)||iu(s)&&s.wrapper)&&(s.exact||1!==i||(a=(e=>{const t=Q(e.childNodes,Jh).filter((e=>uh(o,e,s)));return t.map((t=>{const n=o.clone(t,!1);return d(n),o.replace(n,e,!0),o.remove(t,!0),n})).getOr(e)})(a)),((e,t,n,o)=>{Xh(t,(t=>{du(t)&&Xh(e.dom.select(t.inline,o),(o=>{Oh(o)&&Kh(e,t,n,o,t.exact?o:null)})),((e,t,n)=>{if(t.clear_child_styles){const o=t.links?"*:not(a)":"*";Ah(e.select(o,n),(n=>{Oh(n)&&Ah(t.styles,((t,o)=>{e.setStyle(n,o,"")}))}))}})(e.dom,t,o)}))})(e,r,n,a),((e,t,n,o,r)=>{fh(e,r.parentNode,n,o)&&Kh(e,t,o,r)||t.merge_with_parents&&e.dom.getParent(r.parentNode,(s=>{if(fh(e,s,n,o))return Kh(e,t,o,r),!0}))})(e,s,t,n,a),((e,t,n,o)=>{t.styles&&t.styles.backgroundColor&&Ph(o,Lh(e,"fontSize"),Mh(e,"backgroundColor",tu(t.styles.backgroundColor,n)))})(o,s,n,a),((e,t,n,o)=>{const r=t=>{if(1===t.nodeType&&t.parentNode&&1===t.parentNode.nodeType){const n=su(e,t.parentNode);e.getStyle(t,"color")&&n?e.setStyle(t,"text-decoration",n):e.getStyle(t,"text-decoration")===n&&e.setStyle(t,"text-decoration",null)}};t.styles&&(t.styles.color||t.styles.textDecoration)&&(Bt.walk(o,r,"childNodes"),r(o))})(o,s,0,a),((e,t,n,o)=>{!du(t)||"sub"!==t.inline&&"sup"!==t.inline||(Ph(o,Lh(e,"fontSize"),Mh(e,"fontSize","")),e.remove(e.select("sup"===t.inline?"sub":"sup",o),!0))})(o,s,0,a),Dh(o,s,0,a)):o.remove(a,!0)}))};if("false"!==i.getContentEditable(l.getNode())){if(s){if(o)if(Yc(o)){if(!c(r,o)){const t=i.createRng();t.setStartBefore(o),t.setEndAfter(o),f(i,_u(e,t,r),!0)}}else f(i,o,!0);else a&&du(s)&&!Au(e).length?((e,t,n)=>{let o,r;const s=e.selection,a=s.getRng();let i=a.startOffset;const l=a.startContainer.nodeValue;o=Ec(e.getBody(),s.getStart()),o&&(r=vh(o));const d=/[^\s\u00a0\u00ad\u200b\ufeff]/;if(l&&i>0&&i<l.length&&d.test(l.charAt(i))&&d.test(l.charAt(i-1))){const o=s.getBookmark();a.collapse(!0);let r=_u(e,a,e.formatter.get(t));r=Dm(r),e.formatter.apply(t,n,r),s.moveToBookmark(o)}else o&&r.nodeValue===ph||(c=e.getDoc(),u=yh(!0).dom,o=c.importNode(u,!0),r=o.firstChild,a.insertNode(o),i=1),e.formatter.apply(t,n,o),s.setCursorLocation(r,i);var c,u})(e,t,n):(l.setRng(Gp(l.getRng())),Iu(l,!0,(()=>{Mu(e,((t,n)=>{const o=n?t:_u(e,t,r);f(i,o,!1)}))})),Xc(i,l,l.getRng()),e.nodeChanged());((e,t)=>{Rh(Eh[e],(e=>{e(t)}))})(t,e)}Yu(e,t,o,n)}else{o=l.getNode();for(let e=0,t=r.length;e<t;e++){const t=r[e];if(t.ceFalseOverride&&lu(t)&&i.is(o,t.selector)){d(o,t);break}}Yu(e,t,o,n)}},eb=e=>xe(e,"vars"),tb=e=>e.selection.getStart(),nb=(e,t,n,o,r)=>X(t,(t=>{const s=e.formatter.matchNode(t,n,null!=r?r:{},o);return!v(s)}),(t=>!!dh(e,t,n)||!o&&C(e.formatter.matchNode(t,n,r,!0)))),ob=(e,t)=>{const n=null!=t?t:tb(e);return K(au(e.dom,n),(e=>Co(e)&&!So(e)))},rb=(e,t,n)=>{const o=ob(e,t);fe(n,((n,r)=>{const s=n=>{const s=nb(e,o,r,n.similar,eb(n)?n.vars:void 0),a=s.isSome();if(n.state.get()!==a){n.state.set(a);const e=s.getOr(t);eb(n)?n.callback(a,{node:e,format:r,parents:o}):$(n.callbacks,(t=>t(a,{node:e,format:r,parents:o})))}};$([n.withSimilar,n.withoutSimilar],s),$(n.withVars,s)}))};function sb(e){return sb="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sb(e)}function ab(e,t){return ab=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ab(e,t)}function ib(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function lb(e,t,n){return lb=ib()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var r=new(Function.bind.apply(e,o));return n&&ab(r,n.prototype),r},lb.apply(null,arguments)}function db(e){return function(e){if(Array.isArray(e))return cb(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return cb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cb(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function cb(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var ub=Object.hasOwnProperty,mb=Object.setPrototypeOf,fb=Object.isFrozen,gb=Object.getPrototypeOf,pb=Object.getOwnPropertyDescriptor,hb=Object.freeze,bb=Object.seal,vb=Object.create,yb="undefined"!=typeof Reflect&&Reflect,Cb=yb.apply,wb=yb.construct;Cb||(Cb=function(e,t,n){return e.apply(t,n)}),hb||(hb=function(e){return e}),bb||(bb=function(e){return e}),wb||(wb=function(e,t){return lb(e,db(t))});var xb,kb=Db(Array.prototype.forEach),Sb=Db(Array.prototype.pop),_b=Db(Array.prototype.push),Eb=Db(String.prototype.toLowerCase),Nb=Db(String.prototype.match),Rb=Db(String.prototype.replace),Ab=Db(String.prototype.indexOf),Ob=Db(String.prototype.trim),Tb=Db(RegExp.prototype.test),Bb=(xb=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return wb(xb,t)});function Db(e){return function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return Cb(e,t,o)}}function Pb(e,t){mb&&mb(e,null);for(var n=t.length;n--;){var o=t[n];if("string"==typeof o){var r=Eb(o);r!==o&&(fb(t)||(t[n]=r),o=r)}e[o]=!0}return e}function Lb(e){var t,n=vb(null);for(t in e)Cb(ub,e,[t])&&(n[t]=e[t]);return n}function Mb(e,t){for(;null!==e;){var n=pb(e,t);if(n){if(n.get)return Db(n.get);if("function"==typeof n.value)return Db(n.value)}e=gb(e)}return function(e){return console.warn("fallback value for",e),null}}var Ib=hb(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Fb=hb(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ub=hb(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),zb=hb(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),jb=hb(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),Vb=hb(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Hb=hb(["#text"]),$b=hb(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),qb=hb(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Wb=hb(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Kb=hb(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Gb=bb(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Yb=bb(/<%[\w\W]*|[\w\W]*%>/gm),Xb=bb(/^data-[\-\w.\u00B7-\uFFFF]/),Qb=bb(/^aria-[\-\w]+$/),Jb=bb(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Zb=bb(/^(?:\w+script|data):/i),ev=bb(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),tv=bb(/^html$/i),nv=function(){return"undefined"==typeof window?null:window},ov=function(e,t){if("object"!==sb(e)||"function"!=typeof e.createPolicy)return null;var n=null,o="data-tt-policy-suffix";t.currentScript&&t.currentScript.hasAttribute(o)&&(n=t.currentScript.getAttribute(o));var r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}},rv=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:nv(),n=function(t){return e(t)};if(n.version="2.3.8",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;var o=t.document,r=t.document,s=t.DocumentFragment,a=t.HTMLTemplateElement,i=t.Node,l=t.Element,d=t.NodeFilter,c=t.NamedNodeMap,u=void 0===c?t.NamedNodeMap||t.MozNamedAttrMap:c,m=t.HTMLFormElement,f=t.DOMParser,g=t.trustedTypes,p=l.prototype,h=Mb(p,"cloneNode"),b=Mb(p,"nextSibling"),v=Mb(p,"childNodes"),y=Mb(p,"parentNode");if("function"==typeof a){var C=r.createElement("template");C.content&&C.content.ownerDocument&&(r=C.content.ownerDocument)}var w=ov(g,o),x=w?w.createHTML(""):"",k=r,S=k.implementation,_=k.createNodeIterator,E=k.createDocumentFragment,N=k.getElementsByTagName,R=o.importNode,A={};try{A=Lb(r).documentMode?r.documentMode:{}}catch(e){}var O={};n.isSupported="function"==typeof y&&S&&void 0!==S.createHTMLDocument&&9!==A;var T,B,D=Gb,P=Yb,L=Xb,M=Qb,I=Zb,F=ev,U=Jb,z=null,j=Pb({},[].concat(db(Ib),db(Fb),db(Ub),db(jb),db(Hb))),V=null,H=Pb({},[].concat(db($b),db(qb),db(Wb),db(Kb))),$=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),q=null,W=null,K=!0,G=!0,Y=!1,X=!1,Q=!1,J=!1,Z=!1,ee=!1,te=!1,ne=!1,oe=!0,re=!0,se=!1,ae={},ie=null,le=Pb({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),de=null,ce=Pb({},["audio","video","img","source","image","track"]),ue=null,me=Pb({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fe="http://www.w3.org/1998/Math/MathML",ge="http://www.w3.org/2000/svg",pe="http://www.w3.org/1999/xhtml",he=pe,be=!1,ve=["application/xhtml+xml","text/html"],ye="text/html",Ce=null,we=r.createElement("form"),xe=function(e){return e instanceof RegExp||e instanceof Function},ke=function(e){Ce&&Ce===e||(e&&"object"===sb(e)||(e={}),e=Lb(e),z="ALLOWED_TAGS"in e?Pb({},e.ALLOWED_TAGS):j,V="ALLOWED_ATTR"in e?Pb({},e.ALLOWED_ATTR):H,ue="ADD_URI_SAFE_ATTR"in e?Pb(Lb(me),e.ADD_URI_SAFE_ATTR):me,de="ADD_DATA_URI_TAGS"in e?Pb(Lb(ce),e.ADD_DATA_URI_TAGS):ce,ie="FORBID_CONTENTS"in e?Pb({},e.FORBID_CONTENTS):le,q="FORBID_TAGS"in e?Pb({},e.FORBID_TAGS):{},W="FORBID_ATTR"in e?Pb({},e.FORBID_ATTR):{},ae="USE_PROFILES"in e&&e.USE_PROFILES,K=!1!==e.ALLOW_ARIA_ATTR,G=!1!==e.ALLOW_DATA_ATTR,Y=e.ALLOW_UNKNOWN_PROTOCOLS||!1,X=e.SAFE_FOR_TEMPLATES||!1,Q=e.WHOLE_DOCUMENT||!1,ee=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,ne=e.RETURN_TRUSTED_TYPE||!1,Z=e.FORCE_BODY||!1,oe=!1!==e.SANITIZE_DOM,re=!1!==e.KEEP_CONTENT,se=e.IN_PLACE||!1,U=e.ALLOWED_URI_REGEXP||U,he=e.NAMESPACE||pe,e.CUSTOM_ELEMENT_HANDLING&&xe(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&($.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&xe(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&($.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&($.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),T=T=-1===ve.indexOf(e.PARSER_MEDIA_TYPE)?ye:e.PARSER_MEDIA_TYPE,B="application/xhtml+xml"===T?function(e){return e}:Eb,X&&(G=!1),te&&(ee=!0),ae&&(z=Pb({},db(Hb)),V=[],!0===ae.html&&(Pb(z,Ib),Pb(V,$b)),!0===ae.svg&&(Pb(z,Fb),Pb(V,qb),Pb(V,Kb)),!0===ae.svgFilters&&(Pb(z,Ub),Pb(V,qb),Pb(V,Kb)),!0===ae.mathMl&&(Pb(z,jb),Pb(V,Wb),Pb(V,Kb))),e.ADD_TAGS&&(z===j&&(z=Lb(z)),Pb(z,e.ADD_TAGS)),e.ADD_ATTR&&(V===H&&(V=Lb(V)),Pb(V,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&Pb(ue,e.ADD_URI_SAFE_ATTR),e.FORBID_CONTENTS&&(ie===le&&(ie=Lb(ie)),Pb(ie,e.FORBID_CONTENTS)),re&&(z["#text"]=!0),Q&&Pb(z,["html","head","body"]),z.table&&(Pb(z,["tbody"]),delete q.tbody),hb&&hb(e),Ce=e)},Se=Pb({},["mi","mo","mn","ms","mtext"]),_e=Pb({},["foreignobject","desc","title","annotation-xml"]),Ee=Pb({},["title","style","font","a","script"]),Ne=Pb({},Fb);Pb(Ne,Ub),Pb(Ne,zb);var Re=Pb({},jb);Pb(Re,Vb);var Ae=function(e){var t=y(e);t&&t.tagName||(t={namespaceURI:pe,tagName:"template"});var n=Eb(e.tagName),o=Eb(t.tagName);return e.namespaceURI===ge?t.namespaceURI===pe?"svg"===n:t.namespaceURI===fe?"svg"===n&&("annotation-xml"===o||Se[o]):Boolean(Ne[n]):e.namespaceURI===fe?t.namespaceURI===pe?"math"===n:t.namespaceURI===ge?"math"===n&&_e[o]:Boolean(Re[n]):e.namespaceURI===pe&&!(t.namespaceURI===ge&&!_e[o])&&!(t.namespaceURI===fe&&!Se[o])&&!Re[n]&&(Ee[n]||!Ne[n])},Oe=function(e){_b(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=x}catch(t){e.remove()}}},Te=function(e,t){try{_b(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){_b(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!V[e])if(ee||te)try{Oe(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Be=function(e){var t,n;if(Z)e="<remove></remove>"+e;else{var o=Nb(e,/^[\r\n\t ]+/);n=o&&o[0]}"application/xhtml+xml"===T&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");var s=w?w.createHTML(e):e;if(he===pe)try{t=(new f).parseFromString(s,T)}catch(e){}if(!t||!t.documentElement){t=S.createDocument(he,"template",null);try{t.documentElement.innerHTML=be?"":s}catch(e){}}var a=t.body||t.documentElement;return e&&n&&a.insertBefore(r.createTextNode(n),a.childNodes[0]||null),he===pe?N.call(t,Q?"html":"body")[0]:Q?t.documentElement:a},De=function(e){return _.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT,null,!1)},Pe=function(e){return e instanceof m&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore)},Le=function(e){return"object"===sb(i)?e instanceof i:e&&"object"===sb(e)&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Me=function(e,t,o){O[e]&&kb(O[e],(function(e){e.call(n,t,o,Ce)}))},Ie=function(e){var t;if(Me("beforeSanitizeElements",e,null),Pe(e))return Oe(e),!0;if(Tb(/[\u0080-\uFFFF]/,e.nodeName))return Oe(e),!0;var o=B(e.nodeName);if(Me("uponSanitizeElement",e,{tagName:o,allowedTags:z}),e.hasChildNodes()&&!Le(e.firstElementChild)&&(!Le(e.content)||!Le(e.content.firstElementChild))&&Tb(/<[/\w]/g,e.innerHTML)&&Tb(/<[/\w]/g,e.textContent))return Oe(e),!0;if("select"===o&&Tb(/<template/i,e.innerHTML))return Oe(e),!0;if(!z[o]||q[o]){if(!q[o]&&Ue(o)){if($.tagNameCheck instanceof RegExp&&Tb($.tagNameCheck,o))return!1;if($.tagNameCheck instanceof Function&&$.tagNameCheck(o))return!1}if(re&&!ie[o]){var r=y(e)||e.parentNode,s=v(e)||e.childNodes;if(s&&r)for(var a=s.length-1;a>=0;--a)r.insertBefore(h(s[a],!0),b(e))}return Oe(e),!0}return e instanceof l&&!Ae(e)?(Oe(e),!0):"noscript"!==o&&"noembed"!==o||!Tb(/<\/no(script|embed)/i,e.innerHTML)?(X&&3===e.nodeType&&(t=e.textContent,t=Rb(t,D," "),t=Rb(t,P," "),e.textContent!==t&&(_b(n.removed,{element:e.cloneNode()}),e.textContent=t)),Me("afterSanitizeElements",e,null),!1):(Oe(e),!0)},Fe=function(e,t,n){if(oe&&("id"===t||"name"===t)&&(n in r||n in we))return!1;if(G&&!W[t]&&Tb(L,t));else if(K&&Tb(M,t));else if(!V[t]||W[t]){if(!(Ue(e)&&($.tagNameCheck instanceof RegExp&&Tb($.tagNameCheck,e)||$.tagNameCheck instanceof Function&&$.tagNameCheck(e))&&($.attributeNameCheck instanceof RegExp&&Tb($.attributeNameCheck,t)||$.attributeNameCheck instanceof Function&&$.attributeNameCheck(t))||"is"===t&&$.allowCustomizedBuiltInElements&&($.tagNameCheck instanceof RegExp&&Tb($.tagNameCheck,n)||$.tagNameCheck instanceof Function&&$.tagNameCheck(n))))return!1}else if(ue[t]);else if(Tb(U,Rb(n,F,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Ab(n,"data:")||!de[e])if(Y&&!Tb(I,Rb(n,F,"")));else if(n)return!1;return!0},Ue=function(e){return e.indexOf("-")>0},ze=function(e){var t,n,o,r;Me("beforeSanitizeAttributes",e,null);var s=e.attributes;if(s){var a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:V};for(r=s.length;r--;){var i=t=s[r],l=i.name,d=i.namespaceURI;n="value"===l?t.value:Ob(t.value),o=B(l);var c=n;if(a.attrName=o,a.attrValue=n,a.keepAttr=!0,a.forceKeepAttr=void 0,Me("uponSanitizeAttribute",e,a),n=a.attrValue,!a.forceKeepAttr)if(a.keepAttr)if(Tb(/\/>/i,n))Te(l,e);else{X&&(n=Rb(n,D," "),n=Rb(n,P," "));var u=B(e.nodeName);if(Fe(u,o,n)){if(n!==c)try{d?e.setAttributeNS(d,l,n):e.setAttribute(l,n)}catch(t){Te(l,e)}}else Te(l,e)}else Te(l,e)}Me("afterSanitizeAttributes",e,null)}},je=function e(t){var n,o=De(t);for(Me("beforeSanitizeShadowDOM",t,null);n=o.nextNode();)Me("uponSanitizeShadowNode",n,null),Ie(n)||(n.content instanceof s&&e(n.content),ze(n));Me("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e,r){var a,l,d,c,u;if((be=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Le(e)){if("function"!=typeof e.toString)throw Bb("toString is not a function");if("string"!=typeof(e=e.toString()))throw Bb("dirty is not a string, aborting")}if(!n.isSupported){if("object"===sb(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof e)return t.toStaticHTML(e);if(Le(e))return t.toStaticHTML(e.outerHTML)}return e}if(J||ke(r),n.removed=[],"string"==typeof e&&(se=!1),se){if(e.nodeName){var m=B(e.nodeName);if(!z[m]||q[m])throw Bb("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof i)1===(l=(a=Be("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===l.nodeName||"HTML"===l.nodeName?a=l:a.appendChild(l);else{if(!ee&&!X&&!Q&&-1===e.indexOf("<"))return w&&ne?w.createHTML(e):e;if(!(a=Be(e)))return ee?null:ne?x:""}a&&Z&&Oe(a.firstChild);for(var f=De(se?e:a);d=f.nextNode();)3===d.nodeType&&d===c||Ie(d)||(d.content instanceof s&&je(d.content),ze(d),c=d);if(c=null,se)return e;if(ee){if(te)for(u=E.call(a.ownerDocument);a.firstChild;)u.appendChild(a.firstChild);else u=a;return V.shadowroot&&(u=R.call(o,u,!0)),u}var g=Q?a.outerHTML:a.innerHTML;return Q&&z["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&Tb(tv,a.ownerDocument.doctype.name)&&(g="<!DOCTYPE "+a.ownerDocument.doctype.name+">\n"+g),X&&(g=Rb(g,D," "),g=Rb(g,P," ")),w&&ne?w.createHTML(g):g},n.setConfig=function(e){ke(e),J=!0},n.clearConfig=function(){Ce=null,J=!1},n.isValidAttribute=function(e,t,n){Ce||ke({});var o=B(e),r=B(t);return Fe(o,r,n)},n.addHook=function(e,t){"function"==typeof t&&(O[e]=O[e]||[],_b(O[e],t))},n.removeHook=function(e){if(O[e])return Sb(O[e])},n.removeHooks=function(e){O[e]&&(O[e]=[])},n.removeAllHooks=function(){O={}},n}();const sv=Bt.explode,av=()=>{const e={};return{addFilter:(t,n)=>{$(sv(t),(t=>{xe(e,t)||(e[t]={name:t,callbacks:[]}),e[t].callbacks.push(n)}))},getFilters:()=>Ce(e),removeFilter:(t,n)=>{$(sv(t),(t=>{if(xe(e,t))if(C(n)){const o=e[t],r=K(o.callbacks,(e=>e!==n));r.length>0?o.callbacks=r:delete e[t]}else delete e[t]}))}}},iv=(e,t,n)=>{const o=_s();t.convert_fonts_to_spans&&((e,t,n)=>{e.addNodeFilter("font",(e=>{$(e,(e=>{const o=t.parse(e.attr("style")),r=e.attr("color"),s=e.attr("face"),a=e.attr("size");r&&(o.color=r),s&&(o["font-family"]=s),a&&(o["font-size"]=n[parseInt(e.attr("size"),10)-1]),e.name="span",e.attr("style",t.serialize(o)),((e,t)=>{$(["color","face","size"],(t=>{e.attr(t,null)}))})(e)}))}))})(e,o,Bt.explode(t.font_size_legacy_values)),((e,t,n)=>{e.addNodeFilter("strike",(e=>{const o="html4"!==t.type;$(e,(e=>{if(o)e.name="s";else{const t=n.parse(e.attr("style"));t["text-decoration"]="line-through",e.name="span",e.attr("style",n.serialize(t))}}))}))})(e,n,o)},lv=e=>{const[t,...n]=e.split(","),o=n.join(","),r=/data:([^/]+\/[^;]+)(;.+)?/.exec(t);if(r){const e=";base64"===r[2],t=e?(e=>{const t=/([a-z0-9+\/=\s]+)/i.exec(e);return t?t[1]:""})(o):decodeURIComponent(o);return M.some({type:r[1],data:t,base64Encoded:e})}return M.none()},dv=(e,t,n=!0)=>{let o=t;if(n)try{o=atob(t)}catch(e){return M.none()}const r=new Uint8Array(o.length);for(let e=0;e<r.length;e++)r[e]=o.charCodeAt(e);return M.some(new Blob([r],{type:e}))},cv=e=>new Promise(((t,n)=>{const o=new FileReader;o.onloadend=()=>{t(o.result)},o.onerror=()=>{n(o.error.message)},o.readAsDataURL(e)}));let uv=0;const mv=(e,t,n)=>lv(e).bind((({data:e,type:o,base64Encoded:r})=>{if(t&&!r)return M.none();{const t=r?e:btoa(e);return n(t,o)}})),fv=(e,t,n)=>{const o=e.create("blobid"+uv++,t,n);return e.add(o),o},gv=(e,t,n=!1)=>mv(t,n,((t,n)=>M.from(e.getByData(t,n)).orThunk((()=>dv(n,t).map((n=>fv(e,n,t))))))),pv=Bt.each,hv=Bt.trim,bv="source protocol authority userInfo user password host port relative path directory file query anchor".split(" "),vv={ftp:21,http:80,https:443,mailto:25},yv=["img","video"],Cv=(e,t,n)=>{const o=(e=>{try{return decodeURIComponent(e)}catch(t){return unescape(e)}})(t);return!e.allow_script_urls&&(!!/((java|vb)script|mhtml):/i.test(o)||!e.allow_html_data_urls&&(/^data:image\//i.test(o)?((e,t)=>C(e)?!e:!C(t)||!j(yv,t))(e.allow_svg_data_urls,n)&&/^data:image\/svg\+xml/i.test(o):/^data:/i.test(o)))};class wv{constructor(e,t){e=hv(e),this.settings=t||{};const n=this.settings.base_uri,o=this;if(/^([\w\-]+):([^\/]{2})/i.test(e)||/^\s*#/.test(e))return void(o.source=e);const r=0===e.indexOf("//");if(0!==e.indexOf("/")||r||(e=(n&&n.protocol||"http")+"://mce_host"+e),!/^[\w\-]*:?\/\//.test(e)){const t=this.settings.base_uri?this.settings.base_uri.path:new wv(document.location.href).directory;if(this.settings.base_uri&&""==this.settings.base_uri.protocol)e="//mce_host"+o.toAbsPath(t,e);else{const r=/([^#?]*)([#?]?.*)/.exec(e);e=(n&&n.protocol||"http")+"://mce_host"+o.toAbsPath(t,r[1])+r[2]}}e=e.replace(/@@/g,"(mce_at)");const s=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?(\[[a-zA-Z0-9:.%]+\]|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);pv(bv,((e,t)=>{let n=s[t];n&&(n=n.replace(/\(mce_at\)/g,"@@")),o[e]=n})),n&&(o.protocol||(o.protocol=n.protocol),o.userInfo||(o.userInfo=n.userInfo),o.port||"mce_host"!==o.host||(o.port=n.port),o.host&&"mce_host"!==o.host||(o.host=n.host),o.source=""),r&&(o.protocol="")}static parseDataUri(e){let t;const n=decodeURIComponent(e).split(","),o=/data:([^;]+)/.exec(n[0]);return o&&(t=o[1]),{type:t,data:n[1]}}static isDomSafe(e,t,n={}){if(n.allow_script_urls)return!0;{const o=ms.decode(e).replace(/[\s\u0000-\u001F]+/g,"");return!Cv(n,o,t)}}static getDocumentBaseUrl(e){let t;return t=0!==e.protocol.indexOf("http")&&"file:"!==e.protocol?e.href:e.protocol+"//"+e.host+e.pathname,/^[^:]+:\/\/\/?[^\/]+\//.test(t)&&(t=t.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(t)||(t+="/")),t}setPath(e){const t=/^(.*?)\/?(\w+)?$/.exec(e);this.path=t[0],this.directory=t[1],this.file=t[2],this.source="",this.getURI()}toRelative(e){let t;if("./"===e)return e;const n=new wv(e,{base_uri:this});if("mce_host"!==n.host&&this.host!==n.host&&n.host||this.port!==n.port||this.protocol!==n.protocol&&""!==n.protocol)return n.getURI();const o=this.getURI(),r=n.getURI();return o===r||"/"===o.charAt(o.length-1)&&o.substr(0,o.length-1)===r?o:(t=this.toRelPath(this.path,n.path),n.query&&(t+="?"+n.query),n.anchor&&(t+="#"+n.anchor),t)}toAbsolute(e,t){const n=new wv(e,{base_uri:this});return n.getURI(t&&this.isSameOrigin(n))}isSameOrigin(e){if(this.host==e.host&&this.protocol==e.protocol){if(this.port==e.port)return!0;const t=vv[this.protocol];if(t&&(this.port||t)==(e.port||t))return!0}return!1}toRelPath(e,t){let n,o,r=0,s="";const a=e.substring(0,e.lastIndexOf("/")).split("/"),i=t.split("/");if(a.length>=i.length)for(n=0,o=a.length;n<o;n++)if(n>=i.length||a[n]!==i[n]){r=n+1;break}if(a.length<i.length)for(n=0,o=i.length;n<o;n++)if(n>=a.length||a[n]!==i[n]){r=n+1;break}if(1===r)return t;for(n=0,o=a.length-(r-1);n<o;n++)s+="../";for(n=r-1,o=i.length;n<o;n++)s+=n!==r-1?"/"+i[n]:i[n];return s}toAbsPath(e,t){let n,o,r=0,s=[];const a=/\/$/.test(t)?"/":"";let i=e.split("/");const l=t.split("/");for(pv(i,(e=>{e&&s.push(e)})),i=s,n=l.length-1,s=[];n>=0;n--)0!==l[n].length&&"."!==l[n]&&(".."!==l[n]?r>0?r--:s.push(l[n]):r++);return n=i.length-r,o=n<=0?ne(s).join("/"):i.slice(0,n).join("/")+"/"+ne(s).join("/"),0!==o.indexOf("/")&&(o="/"+o),a&&o.lastIndexOf("/")!==o.length-1&&(o+=a),o}getURI(e=!1){let t;return this.source&&!e||(t="",e||(this.protocol?t+=this.protocol+"://":t+="//",this.userInfo&&(t+=this.userInfo+"@"),this.host&&(t+=this.host),this.port&&(t+=":"+this.port)),this.path&&(t+=this.path),this.query&&(t+="?"+this.query),this.anchor&&(t+="#"+this.anchor),this.source=t),this.source}}const xv=Bt.makeMap,kv=Bt.extend,Sv={IN_PLACE:!0,ALLOW_UNKNOWN_PROTOCOLS:!0,ALLOWED_TAGS:["#comment","#cdata-section","body"],ALLOWED_ATTR:[]},_v=Bt.makeMap("src,href,data,background,action,formaction,poster,xlink:href"),Ev="data-mce-type",Nv=(e,t)=>{const n=rv(),o=e.validate;let r=0;return n.addHook("uponSanitizeElement",((n,s)=>{var a,i;8===n.nodeType&&!e.allow_conditional_comments&&/^\[if/i.test(n.nodeValue)&&(n.nodeValue=" "+n.nodeValue);const l=s.tagName;if(1!==n.nodeType||"body"===l)return;const d=fn(n),c=Yt(d,Ev),u=Kt(d,"data-mce-bogus");if(!c&&m(u))return void("all"===u?no(d):oo(d));const f=t.getElementRule(l.toLowerCase());if(!o||f){if(s.allowedTags[l]=!0,o&&!c){if($(null!==(a=f.attributesForced)&&void 0!==a?a:[],(e=>{qt(d,e.name,"{$uid}"===e.value?"mce_"+r++:e.value)})),$(null!==(i=f.attributesDefault)&&void 0!==i?i:[],(e=>{Yt(d,e.name)||qt(d,e.name,"{$uid}"===e.value?"mce_"+r++:e.value)})),f.attributesRequired&&!V(f.attributesRequired,(e=>Yt(d,e))))return void oo(d);if(f.removeEmptyAttrs&&(e=>{const t=e.dom.attributes;return null==t||0===t.length})(d))return void oo(d);f.outputName&&f.outputName!==l.toLowerCase()&&((e,t)=>{const n=((e,t)=>{const n=un(t),o=Qt(e);return Wt(n,o),n})(e,t);Qn(e,n);const o=Rn(e);eo(n,o),no(e)})(d,f.outputName)}}else oo(d)})),n.addHook("uponSanitizeAttribute",((n,r)=>{const s=n.tagName.toLowerCase(),{attrName:a,attrValue:i}=r;r.keepAttr=!o||t.isValid(s,a)||ze(a,"data-")||ze(a,"aria-"),a in _v&&Cv(e,i,s)&&(r.keepAttr=!1),r.keepAttr?(r.allowedAttributes[a]=!0,a in t.getBoolAttrs()&&(r.attrValue=a),e.allow_svg_data_urls&&ze(i,"data:image/svg+xml")&&(r.forceKeepAttr=!0)):!n.hasAttribute(Ev)||"id"!==a&&"class"!==a&&"style"!==a||(r.forceKeepAttr=!0)})),n},Rv=(e,t,n)=>{const o=e.name,r=o in n&&"title"!==o&&"textarea"!==o,s=t.childNodes;for(let t=0,o=s.length;t<o;t++){const o=s[t],a=new Ff(o.nodeName.toLowerCase(),o.nodeType);if(Co(o)){const e=o.attributes;for(let t=0,n=e.length;t<n;t++){const n=e[t];a.attr(n.name,n.value)}}else Ro(o)?(a.value=o.data,r&&(a.raw=!0)):(To(o)||Ao(o)||Oo(o))&&(a.value=o.data);Rv(a,o,n),e.append(a)}},Av=(e={},t=Ss())=>{const n=av(),o=av(),r={validate:!0,root_name:"body",...e},s=new DOMParser,a=Nv(r,t),i=n.addFilter,l=n.getFilters,d=n.removeFilter,c=o.addFilter,u=o.getFilters,m=o.removeFilter,f={schema:t,addAttributeFilter:c,getAttributeFilters:u,removeAttributeFilter:m,addNodeFilter:i,getNodeFilters:l,removeNodeFilter:d,parse:(e,n={})=>{var o;const i=r.validate,d=null!==(o=n.context)&&void 0!==o?o:r.root_name,c=((e,n,o="html")=>{const i="xhtml"===o?"application/xhtml+xml":"text/html",l=xe(t.getSpecialElements(),n.toLowerCase()),d=l?`<${n}>${e}</${n}>`:e,c="xhtml"===o?`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>${d}</body></html>`:`<body>${d}</body>`,u=s.parseFromString(c,i).body;return a.sanitize(u,((e,t)=>{const n={...Sv};return n.PARSER_MEDIA_TYPE=t,e.allow_script_urls?n.ALLOWED_URI_REGEXP=/.*/:e.allow_html_data_urls&&(n.ALLOWED_URI_REGEXP=/^(?!(\w+script|mhtml):)/i),n})(r,i)),a.removed=[],l?u.firstChild:u})(e,d,n.format),m=new Ff(d,11);Rv(m,c,t.getSpecialElements());const[f,g]=((e,t,n,o)=>{const r=n.validate,s=t.getNonEmptyElements(),a=t.getWhitespaceElements(),i=kv(xv("script,style,head,html,body,title,meta,param"),t.getBlockElements()),l=xs(t),d=/[ \t\r\n]+/g,c=/^[ \t\r\n]+/,u=/[ \t\r\n]+$/,m=e=>{for(e=e.parent;C(e);){if(e.name in a)return!0;e=e.parent}return!1},f=(t,n)=>{const r=n?t.prev:t.next;return!C(r)&&t.parent.name in i&&(t.parent!==e||o.isRootContent)};return[e=>{if(3===e.type&&!m(e)){let t=e.value;t=t.replace(d," "),(((e,t)=>e&&(e.name in t||"br"===e.name))(e.prev,i)||f(e,!0))&&(t=t.replace(c,"")),0===t.length?e.remove():e.value=t}},e=>{var n;if(1===e.type){const n=t.getElementRule(e.name);if(r&&n){const r=qp(t,s,a,e);n.paddInEmptyBlock&&r&&(e=>{let n=e;for(;C(n);){if(n.name in l)return qp(t,s,a,n);n=n.parent}return!1})(e)?Hp(0,o,i,e):n.removeEmpty&&r?i[e.name]?e.remove():e.unwrap():n.paddEmpty&&(r||(e=>$p(e,"#text")&&e.firstChild.value===fr)(e))&&Hp(0,o,i,e)}}else if(3===e.type&&!m(e)){let t=e.value;(i[null===(n=e.next)||void 0===n?void 0:n.name]||f(e,!1))&&(t=t.replace(u,"")),0===t.length?e.remove():e.value=t}}]})(m,t,r,n),p=[],h=i?e=>((e,n)=>{const o=e.parent;o&&t.children[e.name]&&!t.isValidChild(o.name,e.name)&&n.push(e)})(e,p):S,b={nodes:{},attributes:{}},v=e=>zp(l(),u(),e,b);if(((e,t,n)=>{const o=[];for(let n=e,r=n;C(n);r=n,n=n.walk())$(t,(e=>e(n))),y(n.parent)&&n!==e?n=r:o.push(n);for(let e=o.length-1;e>=0;e--){const t=o[e];$(n,(e=>e(t)))}})(m,[f,v],[g,h]),p.reverse(),i&&p.length>0)if(n.context){const{pass:e,fail:o}=W(p,(e=>e.parent===m));Kp(o,t,v),n.invalid=e.length>0}else Kp(p,t,v);const w=((e,t)=>{var n;const o=null!==(n=t.forced_root_block)&&void 0!==n?n:e.forced_root_block;return!1===o?"":!0===o?"p":o})(r,n);return w&&("body"===m.name||n.isRootContent)&&((e,n)=>{const o=kv(xv("script,style,head,html,body,title,meta,param"),t.getBlockElements()),s=/^[ \t\r\n]+/,a=/[ \t\r\n]+$/;let i=e.firstChild,l=null;const d=e=>{e&&(i=e.firstChild,i&&3===i.type&&(i.value=i.value.replace(s,"")),i=e.lastChild,i&&3===i.type&&(i.value=i.value.replace(a,"")))};if(t.isValidChild(e.name,n.toLowerCase())){for(;i;){const t=i.next;3===i.type||1===i.type&&"p"!==i.name&&!o[i.name]&&!i.attr(Ev)?(l||(l=new Ff(n,1),l.attr(r.forced_root_block_attrs),e.insert(l,i)),l.append(i)):(d(l),l=null),i=t}d(l)}})(m,w),n.invalid||jp(b,n),m}};return((e,t)=>{const n=e.schema;t.remove_trailing_brs&&e.addNodeFilter("br",((e,t,o)=>{const r=Bt.extend({},n.getBlockElements()),s=n.getNonEmptyElements(),a=n.getWhitespaceElements();r.body=1;for(let t=0,i=e.length;t<i;t++){let i=e[t],l=i.parent;if(r[i.parent.name]&&i===l.lastChild){let e=i.prev;for(;e;){const t=e.name;if("span"!==t||"bookmark"!==e.attr("data-mce-type")){"br"===t&&(i=null);break}e=e.prev}if(i&&(i.remove(),qp(n,s,a,l))){const e=n.getElementRule(l.name);e&&(e.removeEmpty?l.remove():e.paddEmpty&&Hp(0,o,r,l))}}else{let e=i;for(;l&&l.firstChild===e&&l.lastChild===e&&(e=l,!r[l.name]);)l=l.parent;if(e===l){const e=new Ff("#text",3);e.value=fr,i.replace(e)}}}})),e.addAttributeFilter("href",(e=>{let n=e.length;const o=e=>{const t=e?Bt.trim(e):"";return/\b(noopener)\b/g.test(t)?t:(e=>e.split(" ").filter((e=>e.length>0)).concat(["noopener"]).sort().join(" "))(t)};if(!t.allow_unsafe_link_target)for(;n--;){const t=e[n];"a"===t.name&&"_blank"===t.attr("target")&&t.attr("rel",o(t.attr("rel")))}})),t.allow_html_in_named_anchor||e.addAttributeFilter("id,name",(e=>{let t,n,o,r,s=e.length;for(;s--;)if(r=e[s],"a"===r.name&&r.firstChild&&!r.attr("href")){o=r.parent,t=r.lastChild;do{n=t.prev,o.insert(t,r),t=n}while(t)}})),t.fix_list_elements&&e.addNodeFilter("ul,ol",(e=>{let t,n,o=e.length;for(;o--;)if(t=e[o],n=t.parent,"ul"===n.name||"ol"===n.name)if(t.prev&&"li"===t.prev.name)t.prev.append(t);else{const e=new Ff("li",1);e.attr("style","list-style-type: none"),t.wrap(e)}})),t.validate&&n.getValidClasses()&&e.addAttributeFilter("class",(e=>{const t=n.getValidClasses();let o=e.length;for(;o--;){const n=e[o],r=n.attr("class").split(" ");let s="";for(let e=0;e<r.length;e++){const o=r[e];let a=!1,i=t["*"];i&&i[o]&&(a=!0),i=t[n.name],!a&&i&&i[o]&&(a=!0),a&&(s&&(s+=" "),s+=o)}s.length||(s=null),n.attr("class",s)}})),((e,t)=>{const{blob_cache:n}=t,o=e=>{const t=e.attr("src");(e=>e.attr("src")===Nt.transparentSrc||C(e.attr("data-mce-placeholder")))(e)||(e=>C(e.attr("data-mce-bogus")))(e)||gv(n,t,!0).each((t=>{e.attr("src",t.blobUri())}))};n&&e.addAttributeFilter("src",(e=>$(e,o)))})(e,t)})(f,r),((e,t,n)=>{t.inline_styles&&iv(e,t,n)})(f,r,t),f},Ov=(e,t)=>{const n=(e=>oh(e)?Kf({validate:!1}).serialize(e):e)(e),o=t(n);if(o.isDefaultPrevented())return o;if(oh(e)){if(o.content!==n){const t=Av({validate:!1,forced_root_block:!1}).parse(o.content,{context:e.name});return{...o,content:t}}return{...o,content:e}}return o},Tv=(e,t)=>{if(t.no_events)return yi.value(t);{const n=((e,t)=>e.dispatch("BeforeGetContent",t))(e,t);return n.isDefaultPrevented()?yi.error(Ju(e,{content:"",...n}).content):yi.value(n)}},Bv=(e,t,n)=>n.no_events?t:Ov(t,(t=>Ju(e,{...n,content:t}))).content,Dv=(e,t)=>{if(t.no_events)return yi.value(t);{const n=Ov(t.content,(n=>((e,t)=>e.dispatch("BeforeSetContent",t))(e,{...t,content:n})));return n.isDefaultPrevented()?(Qu(e,n),yi.error(void 0)):yi.value(n)}},Pv=(e,t,n)=>{n.no_events||Qu(e,{...n,content:t})},Lv=(e,t,n)=>({element:e,width:t,rows:n}),Mv=(e,t)=>({element:e,cells:t}),Iv=(e,t)=>({x:e,y:t}),Fv=(e,t)=>{const n=parseInt(Kt(e,t),10);return isNaN(n)?1:n},Uv=(e,t,n)=>{const o=e.rows;return!!(o[n]?o[n].cells:[])[t]},zv=e=>Y(e,((e,t)=>t.cells.length>e?t.cells.length:e),0),jv=(e,t)=>{const n=e.rows;for(let e=0;e<n.length;e++){const o=n[e].cells;for(let n=0;n<o.length;n++)if(vn(o[n],t))return M.some(Iv(n,e))}return M.none()},Vv=(e,t,n,o,r)=>{const s=[],a=e.rows;for(let e=n;e<=r;e++){const n=a[e].cells,r=t<o?n.slice(t,o+1):n.slice(o,t+1);s.push(Mv(a[e].element,r))}return s},Hv=e=>((e,t)=>{const n=ba(e.element),o=un("tbody");return eo(o,t),Zn(n,o),n})(e,(e=>H(e.rows,(e=>{const t=H(e.cells,(e=>{const t=va(e);return Xt(t,"colspan"),Xt(t,"rowspan"),t})),n=ba(e.element);return eo(n,t),n})))(e)),$v=(e,t)=>{const n=fn(t.commonAncestorContainer),o=hg(n,e),r=K(o,cr),s=((e,t)=>Q(e,(e=>"li"===Mt(e)&&Du(e,t))).fold(N([]),(t=>(e=>Q(e,(e=>"ul"===Mt(e)||"ol"===Mt(e))))(e).map((e=>{const t=un(Mt(e)),n=ve(Gn(e),((e,t)=>ze(t,"list-style")));return $n(t,n),[un("li"),t]})).getOr([]))))(o,t),a=r.concat(s.length?s:(e=>sr(e)?kn(e).filter(rr).fold(N([]),(t=>[e,t])):rr(e)?[e]:[])(n));return H(a,ba)},qv=()=>ym([]),Wv=(e,t)=>((e,t)=>Wo(t,"table",O(vn,e)))(e,t[0]).bind((e=>{const n=t[0],o=t[t.length-1],r=(e=>{const t=Lv(ba(e),0,[]);return $(na(e,"tr"),((e,n)=>{$(na(e,"td,th"),((o,r)=>{((e,t,n,o,r)=>{const s=Fv(r,"rowspan"),a=Fv(r,"colspan"),i=e.rows;for(let e=n;e<n+s;e++){i[e]||(i[e]=Mv(va(o),[]));for(let o=t;o<t+a;o++)i[e].cells[o]=e===n&&o===t?r:ba(r)}})(t,((e,t,n)=>{for(;Uv(e,t,n);)t++;return t})(t,r,n),n,e,o)}))})),Lv(t.element,zv(t.rows),t.rows)})(e);return((e,t,n)=>jv(e,t).bind((t=>jv(e,n).map((n=>((e,t,n)=>{const o=t.x,r=t.y,s=n.x,a=n.y,i=r<a?Vv(e,o,r,s,a):Vv(e,o,a,s,r);return Lv(e.element,zv(i),i)})(e,t,n))))))(r,n,o).map((e=>ym([Hv(e)])))})).getOrThunk(qv),Kv=(e,t)=>{const n=Ru(t,e);return n.length>0?Wv(e,n):((e,t)=>t.length>0&&t[0].collapsed?qv():((e,t)=>((e,t)=>{const n=Y(t,((e,t)=>(Zn(t,e),t)),e);return t.length>0?ym([n]):n})(fn(t.cloneContents()),$v(e,t)))(e,t[0]))(e,t)},Gv=(e,t)=>t>=0&&t<e.length&&zc(e.charAt(t)),Yv=e=>br(e.innerText),Xv=e=>Co(e)?e.outerHTML:Ro(e)?ms.encodeRaw(e.data,!1):To(e)?"\x3c!--"+e.data+"--\x3e":"",Qv=(e,t)=>(((e,t)=>{let n=0;$(e,(e=>{0===e[0]?n++:1===e[0]?(((e,t,n)=>{const o=(e=>{let t;const n=document.createElement("div"),o=document.createDocumentFragment();for(e&&(n.innerHTML=e);t=n.firstChild;)o.appendChild(t);return o})(t);if(e.hasChildNodes()&&n<e.childNodes.length){const t=e.childNodes[n];t.parentNode.insertBefore(o,t)}else e.appendChild(o)})(t,e[1],n),n++):2===e[0]&&((e,t)=>{if(e.hasChildNodes()&&t<e.childNodes.length){const n=e.childNodes[t];n.parentNode.removeChild(n)}})(t,n)}))})(((e,t)=>{const n=e.length+t.length+2,o=new Array(n),r=new Array(n),s=(n,o,r,a,l)=>{const d=i(n,o,r,a);if(null===d||d.start===o&&d.diag===o-a||d.end===n&&d.diag===n-r){let s=n,i=r;for(;s<o||i<a;)s<o&&i<a&&e[s]===t[i]?(l.push([0,e[s]]),++s,++i):o-n>a-r?(l.push([2,e[s]]),++s):(l.push([1,t[i]]),++i)}else{s(n,d.start,r,d.start-d.diag,l);for(let t=d.start;t<d.end;++t)l.push([0,e[t]]);s(d.end,o,d.end-d.diag,a,l)}},a=(n,o,r,s)=>{let a=n;for(;a-o<s&&a<r&&e[a]===t[a-o];)++a;return((e,t,n)=>({start:e,end:t,diag:n}))(n,a,o)},i=(n,s,i,l)=>{const d=s-n,c=l-i;if(0===d||0===c)return null;const u=d-c,m=c+d,f=(m%2==0?m:m+1)/2;let g,p,h,b,v;for(o[1+f]=n,r[1+f]=s+1,g=0;g<=f;++g){for(p=-g;p<=g;p+=2){for(h=p+f,p===-g||p!==g&&o[h-1]<o[h+1]?o[h]=o[h+1]:o[h]=o[h-1]+1,b=o[h],v=b-n+i-p;b<s&&v<l&&e[b]===t[v];)o[h]=++b,++v;if(u%2!=0&&u-g<=p&&p<=u+g&&r[h-u]<=o[h])return a(r[h-u],p+n-i,s,l)}for(p=u-g;p<=u+g;p+=2){for(h=p+f-u,p===u-g||p!==u+g&&r[h+1]<=r[h-1]?r[h]=r[h+1]-1:r[h]=r[h-1],b=r[h]-1,v=b-n+i-p;b>=n&&v>=i&&e[b]===t[v];)r[h]=b--,v--;if(u%2==0&&-g<=p&&p<=g&&r[h]<=o[h+u])return a(r[h],p+n-i,s,l)}}},l=[];return s(0,e.length,0,t.length,l),l})(H(de(t.childNodes),Xv),e),t),t),Jv=De((()=>document.implementation.createHTMLDocument("undo"))),Zv=e=>{const t=(n=e.getBody(),K(H(de(n.childNodes),Xv),(e=>e.length>0)));var n;const o=ee(t,(t=>{const n=jf(e.serializer,t);return n.length>0?[n]:[]})),r=o.join("");return(e=>-1!==e.indexOf("</iframe>"))(r)?(e=>({type:"fragmented",fragments:e,content:"",bookmark:null,beforeBookmark:null}))(o):(e=>({type:"complete",fragments:null,content:e,bookmark:null,beforeBookmark:null}))(r)},ey=(e,t,n)=>{const o=n?t.beforeBookmark:t.bookmark;"fragmented"===t.type?Qv(t.fragments,e.getBody()):e.setContent(t.content,{format:"raw",no_selection:!C(o)||!Rc(o)||!o.isFakeCaret}),e.selection.moveToBookmark(o)},ty=e=>"fragmented"===e.type?e.fragments.join(""):e.content,ny=e=>{const t=un("body",Jv());return so(t,ty(e)),$(na(t,"*[data-mce-bogus]"),oo),ro(t)},oy=(e,t)=>!(!e||!t)&&(!!((e,t)=>ty(e)===ty(t))(e,t)||((e,t)=>ny(e)===ny(t))(e,t)),ry=e=>0===e.get(),sy=(e,t,n)=>{ry(n)&&(e.typing=t)},ay=(e,t)=>{e.typing&&(sy(e,!1,t),e.add())},iy=e=>({init:{bindEvents:S},undoManager:{beforeChange:(t,n)=>((e,t,n)=>{ry(t)&&n.set(hi(e.selection))})(e,t,n),add:(t,n,o,r,s,a)=>((e,t,n,o,r,s,a)=>{const i=Zv(e);if(s=s||{},s=Bt.extend(s,i),!1===ry(o)||e.removed)return null;const l=t.data[n.get()];if(e.dispatch("BeforeAddUndo",{level:s,lastLevel:l,originalEvent:a}).isDefaultPrevented())return null;if(l&&oy(l,s))return null;t.data[n.get()]&&r.get().each((e=>{t.data[n.get()].beforeBookmark=e}));const d=Dl(e);if(d&&t.data.length>d){for(let e=0;e<t.data.length-1;e++)t.data[e]=t.data[e+1];t.data.length--,n.set(t.data.length)}s.bookmark=hi(e.selection),n.get()<t.data.length-1&&(t.data.length=n.get()+1),t.data.push(s),n.set(t.data.length-1);const c={level:s,lastLevel:l,originalEvent:a};return n.get()>0?(e.setDirty(!0),e.dispatch("AddUndo",c),e.dispatch("change",c)):e.dispatch("AddUndo",c),s})(e,t,n,o,r,s,a),undo:(t,n,o)=>((e,t,n,o)=>{let r;return t.typing&&(t.add(),t.typing=!1,sy(t,!1,n)),o.get()>0&&(o.set(o.get()-1),r=t.data[o.get()],ey(e,r,!0),e.setDirty(!0),e.dispatch("Undo",{level:r})),r})(e,t,n,o),redo:(t,n)=>((e,t,n)=>{let o;return t.get()<n.length-1&&(t.set(t.get()+1),o=n[t.get()],ey(e,o,!1),e.setDirty(!0),e.dispatch("Redo",{level:o})),o})(e,t,n),clear:(t,n)=>((e,t,n)=>{t.data=[],n.set(0),t.typing=!1,e.dispatch("ClearUndos")})(e,t,n),reset:e=>(e=>{e.clear(),e.add()})(e),hasUndo:(t,n)=>((e,t,n)=>n.get()>0||t.typing&&t.data[0]&&!oy(Zv(e),t.data[0]))(e,t,n),hasRedo:(e,t)=>((e,t)=>t.get()<e.data.length-1&&!e.typing)(e,t),transact:(e,t,n)=>((e,t,n)=>(ay(e,t),e.beforeChange(),e.ignore(n),e.add()))(e,t,n),ignore:(e,t)=>((e,t)=>{try{e.set(e.get()+1),t()}finally{e.set(e.get()-1)}})(e,t),extra:(t,n,o,r)=>((e,t,n,o,r)=>{if(t.transact(o)){const o=t.data[n.get()].bookmark,s=t.data[n.get()-1];ey(e,s,!0),t.transact(r)&&(t.data[n.get()-1].beforeBookmark=o)}})(e,t,n,o,r)},formatter:{match:(t,n,o,r)=>gh(e,t,n,o,r),matchAll:(t,n)=>((e,t,n)=>{const o=[],r={},s=e.selection.getStart();return e.dom.getParent(s,(s=>{for(let a=0;a<t.length;a++){const i=t[a];!r[i]&&fh(e,s,i,n)&&(r[i]=!0,o.push(i))}}),e.dom.getRoot()),o})(e,t,n),matchNode:(t,n,o,r)=>fh(e,t,n,o,r),canApply:t=>((e,t)=>{const n=e.formatter.get(t),o=e.dom;if(n){const t=e.selection.getStart(),r=au(o,t);for(let e=n.length-1;e>=0;e--){const t=n[e];if(!lu(t))return!0;for(let e=r.length-1;e>=0;e--)if(o.is(r[e],t.selector))return!0}}return!1})(e,t),closest:t=>((e,t)=>{const n=t=>vn(t,fn(e.getBody()));return M.from(e.selection.getStart(!0)).bind((o=>ih(fn(o),(n=>ce(t,(t=>((t,n)=>fh(e,t.dom,n)?M.some(n):M.none())(n,t)))),n))).getOrNull()})(e,t),apply:(t,n,o)=>Zh(e,t,n,o),remove:(t,n,o,r)=>Yh(e,t,n,o,r),toggle:(t,n,o)=>((e,t,n,o)=>{const r=e.formatter.get(t);!gh(e,t,n,o)||"toggle"in r[0]&&!r[0].toggle?Zh(e,t,n,o):Yh(e,t,n,o)})(e,t,n,o),formatChanged:(t,n,o,r,s)=>((e,t,n,o,r,s)=>(null===t.get()&&((e,t)=>{e.set({}),t.on("NodeChange",(n=>{rb(t,n.element,e.get())})),t.on("FormatApply FormatRemove",(n=>{const o=M.from(n.node).map((e=>Yc(e)?e:e.startContainer)).bind((e=>Co(e)?M.some(e):M.from(e.parentElement))).getOrThunk((()=>tb(t)));rb(t,o,e.get())}))})(t,e),((e,t,n,o,r,s)=>{const a=t.get();$(n.split(","),(t=>{const n=we(a,t).getOrThunk((()=>{const e={withSimilar:{state:Ws(!1),similar:!0,callbacks:[]},withoutSimilar:{state:Ws(!1),similar:!1,callbacks:[]},withVars:[]};return a[t]=e,e})),i=()=>{const n=ob(e);return nb(e,n,t,r,s).isSome()};if(v(s)){const e=r?n.withSimilar:n.withoutSimilar;e.callbacks.push(o),1===e.callbacks.length&&e.state.set(i())}else n.withVars.push({state:Ws(i()),similar:r,vars:s,callback:o})})),t.set(a)})(e,t,n,o,r,s),{unbind:()=>((e,t,n)=>{const o=e.get();$(t.split(","),(e=>we(o,e).each((t=>{o[e]={withSimilar:{...t.withSimilar,callbacks:K(t.withSimilar.callbacks,(e=>e!==n))},withoutSimilar:{...t.withoutSimilar,callbacks:K(t.withoutSimilar.callbacks,(e=>e!==n))},withVars:K(t.withVars,(e=>e.callback!==n))}})))),e.set(o)})(t,n,o)}))(e,t,n,o,r,s)},editor:{getContent:t=>((e,t)=>M.from(e.getBody()).fold(N("tree"===t.format?new Ff("body",11):""),(n=>((e,t,n)=>{let o;return"raw"===t.format?o=Bt.trim(Vf(e.serializer,n.innerHTML)):"text"===t.format?(o=br(n.innerText),o="\n"===o?"":o):o="tree"===t.format?e.serializer.serialize(n,t):((e,t)=>{const n=ji(e),o=new RegExp(`^(<${n}[^>]*>(&nbsp;|&#160;|\\s|\xa0|<br \\/>|)<\\/${n}>[\r\n]*|<br \\/>[\r\n]*)$`);return t.replace(o,"")})(e,e.serializer.serialize(n,t)),"text"!==t.format&&!lr(fn(n))&&m(o)?Bt.trim(o):o})(e,t,n))))(e,t),setContent:(t,n)=>((e,t,n)=>M.from(e.getBody()).map((o=>oh(t)?((e,t,n,o)=>{Vp(e.parser.getNodeFilters(),e.parser.getAttributeFilters(),n);const r=Kf({validate:!1},e.schema).serialize(n),s=lr(fn(t))?r:Bt.trim(r);return rh(e,s,o.no_selection),{content:n,html:s}})(e,o,t,n):((e,t,n,o)=>{if(0===n.length||/^\s+$/.test(n)){const r='<br data-mce-bogus="1">';"TABLE"===t.nodeName?n="<tr><td>"+r+"</td></tr>":/^(UL|OL)$/.test(t.nodeName)&&(n="<li>"+r+"</li>");const s=ji(e);return e.schema.isValidChild(t.nodeName.toLowerCase(),s.toLowerCase())?(n=r,n=e.dom.createHTML(s,Vi(e),n)):n||(n=r),rh(e,n,o.no_selection),{content:n,html:n}}{"raw"!==o.format&&(n=Kf({validate:!1},e.schema).serialize(e.parser.parse(n,{isRootContent:!0,insert:!0})));const r=lr(fn(t))?n:Bt.trim(n);return rh(e,r,o.no_selection),{content:r,html:r}}})(e,o,t,n))).getOr({content:t,html:oh(n.content)?"":n.content}))(e,t,n),insertContent:(t,n)=>nh(e,t,n),addVisual:t=>((e,t)=>{const n=e.dom,o=C(t)?t:e.getBody();v(e.hasVisual)&&(e.hasVisual=zl(e)),$(n.select("table,a",o),(t=>{switch(t.nodeName){case"TABLE":const o=jl(e),r=n.getAttrib(t,"border");r&&"0"!==r||!e.hasVisual?n.removeClass(t,o):n.addClass(t,o);break;case"A":if(!n.getAttrib(t,"href")){const o=n.getAttrib(t,"name")||t.id,r=Vl(e);o&&e.hasVisual?n.addClass(t,r):n.removeClass(t,r)}}})),e.dispatch("VisualAid",{element:t,hasVisual:e.hasVisual})})(e,t)},selection:{getContent:(t,n)=>((e,t,n={})=>{const o=((e,t)=>({...e,format:t,get:!0,selection:!0,getInner:!0}))(n,t);return Tv(e,o).fold(R,(t=>{const n=((e,t)=>{if("text"===t.format)return(e=>M.from(e.selection.getRng()).map((t=>{const n=M.from(e.dom.getParent(t.commonAncestorContainer,e.dom.isBlock)),o=e.getBody(),r=(e=>e.map((e=>e.nodeName)).getOr("div").toLowerCase())(n),s=e.dom.add(o,r,{"data-mce-bogus":"all",style:"overflow: hidden; opacity: 0;"},t.cloneContents()),a=Yv(s),i=br(s.textContent);if(e.dom.remove(s),Gv(i,0)||Gv(i,i.length-1)){const e=n.getOr(o),t=Yv(e),r=t.indexOf(a);return-1===r?a:(Gv(t,r-1)?" ":"")+a+(Gv(t,r+a.length)?" ":"")}return a})).getOr(""))(e);{const n=((e,t)=>{const n=e.selection.getRng(),o=e.dom.create("body"),r=e.selection.getSel(),s=Rf(e,Nu(r)),a=t.contextual?Kv(fn(e.getBody()),s).dom:n.cloneContents();return a&&o.appendChild(a),e.selection.serializer.serialize(o,t)})(e,t);return"tree"===t.format?n:e.selection.isCollapsed()?"":n}})(e,t);return Bv(e,n,t)}))})(e,t,n)},autocompleter:{addDecoration:t=>Bf(e,t),removeDecoration:()=>((e,t)=>Df(t).each((t=>{const n=e.selection.getBookmark();oo(t),e.selection.moveToBookmark(n)})))(e,fn(e.getBody()))},raw:{getModel:()=>M.none()}}),ly=e=>xe(e.plugins,"rtc"),dy=e=>e.rtcInstance?e.rtcInstance:iy(e),cy=e=>{const t=e.rtcInstance;if(t)return t;throw new Error("Failed to get RTC instance not yet initialized.")},uy=e=>cy(e).init.bindEvents(),my=e=>0===e.dom.length?(no(e),M.none()):M.some(e),fy=(e,t,n,o)=>{e.bind((e=>((o?$g:Hg)(e.dom,o?e.dom.length:0),t.filter(zt).map((t=>((e,t,n,o)=>{const r=e.dom,s=t.dom,a=o?r.length:s.length;o?(qg(r,s,!1,!o),n.setStart(s,a)):(qg(s,r,!1,!o),n.setEnd(s,a))})(e,t,n,o)))))).orThunk((()=>{const e=((e,t)=>e.filter((e=>Wu.isBookmarkNode(e.dom))).bind(t?_n:Sn))(t,o).or(t).filter(zt);return e.map((e=>((e,t)=>{kn(e).each((n=>{const o=e.dom;t&&Mg(n,Ya(o,0))?Hg(o,0):!t&&Ig(n,Ya(o,o.length))&&$g(o,o.length)}))})(e,o)))}))},gy=(e,t,n)=>{if(e&&xe(e,t)){const o=K(e[t],(e=>e!==n));0===o.length?delete e[t]:e[t]=o}},py=e=>!(!e||!e.ownerDocument)&&yn(fn(e.ownerDocument),fn(e)),hy=(e,t,n,o)=>{let r,s;const{selectorChangedWithUnbind:a}=((e,t)=>{let n,o;const r=(t,n)=>Q(n,(n=>e.is(n,t))),s=t=>e.getParents(t,null,e.getRoot());return{selectorChangedWithUnbind:(e,a)=>(n||(n={},o={},t.on("NodeChange",(e=>{const t=e.element,a=s(t),i={};Bt.each(n,((e,t)=>{r(t,a).each((n=>{o[t]||($(e,(e=>{e(!0,{node:n,selector:t,parents:a})})),o[t]=e),i[t]=e}))})),Bt.each(o,((e,n)=>{i[n]||(delete o[n],Bt.each(e,(e=>{e(!1,{node:t,selector:n,parents:a})})))}))}))),n[e]||(n[e]=[]),n[e].push(a),r(e,s(t.selection.getStart())).each((()=>{o[e]=n[e]})),{unbind:()=>{gy(n,e,a),gy(o,e,a)}})}})(e,o),i=(e,t)=>((e,t,n={})=>{const o=((e,t)=>({format:"html",...e,set:!0,selection:!0,content:t}))(n,t);Dv(e,o).each((t=>{const n=((e,t)=>{if("raw"!==t.format){const n=e.selection.getRng(),o=e.dom.getParent(n.commonAncestorContainer,e.dom.isBlock),r=o?{context:o.nodeName.toLowerCase()}:{},s=e.parser.parse(t.content,{forced_root_block:!1,...r,...t});return Kf({validate:!1},e.schema).serialize(s)}return t.content})(e,t),o=e.selection.getRng();((e,t)=>{const n=M.from(t.firstChild).map(fn),o=M.from(t.lastChild).map(fn);e.deleteContents(),e.insertNode(t);const r=n.bind(Sn).filter(zt).bind(my),s=o.bind(_n).filter(zt).bind(my);fy(r,n,e,!0),fy(s,o,e,!1),e.collapse(!1)})(o,o.createContextualFragment(n)),e.selection.setRng(o),ef(e,o),Pv(e,n,t)}))})(o,e,t),l=e=>{const t=c();t.collapse(!!e),u(t)},d=()=>t.getSelection?t.getSelection():t.document.selection,c=()=>{let n,a,i;const l=(e,t,n)=>{try{return t.compareBoundaryPoints(e,n)}catch(e){return-1}},c=t.document;if(void 0!==o.bookmark&&!1===xf(o)){const e=mf(o);if(e.isSome())return e.map((e=>Rf(o,[e])[0])).getOr(c.createRange())}try{(n=d())&&!yo(n.anchorNode)&&(a=n.rangeCount>0?n.getRangeAt(0):n.createRange?n.createRange():c.createRange(),a=Rf(o,[a])[0])}catch(e){}return a||(a=c.createRange()),a.setStart&&9===a.startContainer.nodeType&&a.collapsed&&(i=e.getRoot(),a.setStart(i,0),a.setEnd(i,0)),r&&s&&(0===l(a.START_TO_START,a,r)&&0===l(a.END_TO_END,a,r)?a=s:(r=null,s=null)),a},u=(e,t)=>{let n;if(!(e=>!!e&&py(e.startContainer)&&py(e.endContainer))(e))return;const a=d();if(e=o.dispatch("SetSelectionRange",{range:e,forward:t}).range,a){s=e;try{a.removeAllRanges(),a.addRange(e)}catch(e){}!1===t&&a.extend&&(a.collapse(e.endContainer,e.endOffset),a.extend(e.startContainer,e.startOffset)),r=a.rangeCount>0?a.getRangeAt(0):null}!e.collapsed&&e.startContainer===e.endContainer&&a.setBaseAndExtent&&e.endOffset-e.startOffset<2&&e.startContainer.hasChildNodes()&&(n=e.startContainer.childNodes[e.startOffset],n&&"IMG"===n.tagName&&(a.setBaseAndExtent(e.startContainer,e.startOffset,e.endContainer,e.endOffset),a.anchorNode===e.startContainer&&a.focusNode===e.endContainer||a.setBaseAndExtent(n,0,n,1))),o.dispatch("AfterSetSelectionRange",{range:e,forward:t})},m=()=>{const t=d(),n=null==t?void 0:t.anchorNode,o=null==t?void 0:t.focusNode;if(!t||!n||!o||yo(n)||yo(o))return!0;const r=e.createRng(),s=e.createRng();try{r.setStart(n,t.anchorOffset),r.collapse(!0),s.setStart(o,t.focusOffset),s.collapse(!0)}catch(e){return!0}return r.compareBoundaryPoints(r.START_TO_START,s)<=0},f={bookmarkManager:null,controlSelection:null,dom:e,win:t,serializer:n,editor:o,collapse:l,setCursorLocation:(t,n)=>{const r=e.createRng();C(t)&&C(n)?(r.setStart(t,n),r.setEnd(t,n),u(r),l(!1)):(Pu(e,r,o.getBody(),!0),u(r))},getContent:e=>((e,t={})=>((e,t,n)=>cy(e).selection.getContent(t,n))(e,t.format?t.format:"html",t))(o,e),setContent:i,getBookmark:(e,t)=>g.getBookmark(e,t),moveToBookmark:e=>g.moveToBookmark(e),select:(t,n)=>(((e,t,n)=>M.from(t).map((t=>{const o=e.nodeIndex(t),r=e.createRng();return r.setStart(t.parentNode,o),r.setEnd(t.parentNode,o+1),n&&(Pu(e,r,t,!0),Pu(e,r,t,!1)),r})))(e,t,n).each(u),t),isCollapsed:()=>{const e=c(),t=d();return!(!e||e.item)&&(e.compareEndPoints?0===e.compareEndPoints("StartToEnd",e):!t||e.collapsed)},isForward:m,setNode:t=>(i(e.getOuterHTML(t)),t),getNode:()=>((e,t)=>{let n,o,r;if(!t)return e;o=t.startContainer,r=t.endContainer;const s=t.startOffset,a=t.endOffset;return n=t.commonAncestorContainer,!t.collapsed&&(o===r&&a-s<2&&o.hasChildNodes()&&(n=o.childNodes[s]),3===o.nodeType&&3===r.nodeType&&(o=o.length===s?Nf(o.nextSibling,!0):o.parentNode,r=0===a?Nf(r.previousSibling,!1):r.parentNode,o&&o===r))?o:n&&3===n.nodeType?n.parentNode:n})(o.getBody(),c()),getSel:d,setRng:u,getRng:c,getStart:e=>_f(o.getBody(),c(),e),getEnd:e=>Ef(o.getBody(),c(),e),getSelectedBlocks:(t,n)=>((e,t,n,o)=>{let r;const s=[],a=e.getRoot();if(n=e.getParent(n||_f(a,t,t.collapsed),e.isBlock),o=e.getParent(o||Ef(a,t,t.collapsed),e.isBlock),n&&n!==a&&s.push(n),n&&o&&n!==o){r=n;const t=new Qo(n,a);for(;(r=t.next())&&r!==o;)e.isBlock(r)&&s.push(r)}return o&&n!==o&&o!==a&&s.push(o),s})(e,c(),t,n),normalize:()=>{const t=c(),n=d();if(!(Nu(n).length>1)&&Lu(o)){const n=Tm(e,t);return n.each((e=>{u(e,m())})),n.getOr(t)}return t},selectorChanged:(e,t)=>(a(e,t),f),selectorChangedWithUnbind:a,getScrollContainer:()=>{let t,n=e.getRoot();for(;n&&"BODY"!==n.nodeName;){if(n.scrollHeight>n.clientHeight){t=n;break}n=n.parentNode}return t},scrollIntoView:(e,t)=>{C(e)?((e,t,n)=>{(e.inline?Qm:Zm)(e,t,n)})(o,e,t):ef(o,c(),t)},placeCaretAt:(e,t)=>u(wm(e,t,o.getDoc())),getBoundingClientRect:()=>{const e=c();return e.collapsed?Ya.fromRangeStart(e).getClientRects()[0]:e.getBoundingClientRect()},destroy:()=>{t=r=s=null,p.destroy()}},g=Wu(f),p=sm(f,o);return f.bookmarkManager=g,f.controlSelection=p,f},by=(e,t,n)=>{-1===Bt.inArray(t,n)&&(e.addAttributeFilter(n,((e,t)=>{let n=e.length;for(;n--;)e[n].attr(t,null)})),t.push(n))},vy=(e,t)=>{const n=["data-mce-selected"],o=t&&t.dom?t.dom:Hs.DOM,r=t&&t.schema?t.schema:Ss(e);e.entity_encoding=e.entity_encoding||"named",e.remove_trailing_brs=!("remove_trailing_brs"in e)||e.remove_trailing_brs;const s=Av(e,r);return((e,t,n)=>{e.addAttributeFilter("data-mce-tabindex",((e,t)=>{let n=e.length;for(;n--;){const o=e[n];o.attr("tabindex",o.attr("data-mce-tabindex")),o.attr(t,null)}})),e.addAttributeFilter("src,href,style",((e,o)=>{const r="data-mce-"+o,s=t.url_converter,a=t.url_converter_scope;let i=e.length;for(;i--;){const t=e[i];let l=t.attr(r);void 0!==l?(t.attr(o,l.length>0?l:null),t.attr(r,null)):(l=t.attr(o),"style"===o?l=n.serializeStyle(n.parseStyle(l),t.name):s&&(l=s.call(a,l,o,t.name)),t.attr(o,l.length>0?l:null))}})),e.addAttributeFilter("class",(e=>{let t=e.length;for(;t--;){const n=e[t];let o=n.attr("class");o&&(o=n.attr("class").replace(/(?:^|\s)mce-item-\w+(?!\S)/g,""),n.attr("class",o.length>0?o:null))}})),e.addAttributeFilter("data-mce-type",((e,t,n)=>{let o=e.length;for(;o--;){const t=e[o];if("bookmark"===t.attr("data-mce-type")&&!n.cleanup){const e=M.from(t.firstChild).exists((e=>!hr(e.value)));e?t.unwrap():t.remove()}}})),e.addNodeFilter("noscript",(e=>{let t=e.length;for(;t--;){const n=e[t].firstChild;n&&(n.value=ms.decode(n.value))}})),e.addNodeFilter("script,style",((e,n)=>{const o=e=>e.replace(/(<!--\[CDATA\[|\]\]-->)/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*((<!--)?(\s*\/\/)?\s*<!\[CDATA\[|(<!--\s*)?\/\*\s*<!\[CDATA\[\s*\*\/|(\/\/)?\s*<!--|\/\*\s*<!--\s*\*\/)\s*[\r\n]*/gi,"").replace(/\s*(\/\*\s*\]\]>\s*\*\/(-->)?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"");let r=e.length;for(;r--;){const s=e[r],a=s.firstChild?s.firstChild.value:"";if("script"===n){const e=s.attr("type");e&&s.attr("type","mce-no/type"===e?null:e.replace(/^mce\-/,"")),"xhtml"===t.element_format&&a.length>0&&(s.firstChild.value="// <![CDATA[\n"+o(a)+"\n// ]]>")}else"xhtml"===t.element_format&&a.length>0&&(s.firstChild.value="\x3c!--\n"+o(a)+"\n--\x3e")}})),e.addNodeFilter("#comment",(e=>{let o=e.length;for(;o--;){const r=e[o];t.preserve_cdata&&0===r.value.indexOf("[CDATA[")?(r.name="#cdata",r.type=4,r.value=n.decode(r.value.replace(/^\[CDATA\[|\]\]$/g,""))):0===r.value.indexOf("mce:protected ")&&(r.name="#text",r.type=3,r.raw=!0,r.value=unescape(r.value).substr(14))}})),e.addNodeFilter("xml:namespace,input",((e,t)=>{let n=e.length;for(;n--;){const o=e[n];7===o.type?o.remove():1===o.type&&("input"!==t||o.attr("type")||o.attr("type","text"))}})),e.addAttributeFilter("data-mce-type",(t=>{$(t,(t=>{"format-caret"===t.attr("data-mce-type")&&(t.isEmpty(e.schema.getNonEmptyElements())?t.remove():t.unwrap())}))})),e.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style,data-mce-selected,data-mce-expando,data-mce-type,data-mce-resize,data-mce-placeholder",((e,t)=>{let n=e.length;for(;n--;)e[n].attr(t,null)}))})(s,e,o),{schema:r,addNodeFilter:s.addNodeFilter,addAttributeFilter:s.addAttributeFilter,serialize:(n,a={})=>{const i={format:"html",...a},l=((e,t,n)=>((e,t)=>e&&e.hasEventListeners("PreProcess")&&!t.no_events)(e,n)?((e,t,n)=>{let o;const r=e.dom;let s=t.cloneNode(!0);const a=document.implementation;if(a.createHTMLDocument){const e=a.createHTMLDocument("");Bt.each("BODY"===s.nodeName?s.childNodes:[s],(t=>{e.body.appendChild(e.importNode(t,!0))})),s="BODY"!==s.nodeName?e.body.firstChild:e.body,o=r.doc,r.doc=e}return((e,t)=>{e.dispatch("PreProcess",t)})(e,{...n,node:s}),o&&(r.doc=o),s})(e,t,n):t)(t,n,i),d=((e,t,n)=>{const o=br(n.getInner?t.innerHTML:e.getOuterHTML(t));return n.selection||lr(fn(t))?o:Bt.trim(o)})(o,l,i),c=((e,t,n)=>{const o=n.selection?{forced_root_block:!1,...n}:n,r=e.parse(t,o);return(e=>{const t=e=>e&&"br"===e.name,n=e.lastChild;if(t(n)){const e=n.prev;t(e)&&(n.remove(),e.remove())}})(r),r})(s,d,i);return"tree"===i.format?c:((e,t,n,o,r)=>{const s=((e,t,n)=>Kf(e,t).serialize(n))(t,n,o);return((e,t,n)=>{if(!t.no_events&&e){const o=((e,t)=>e.dispatch("PostProcess",t))(e,{...t,content:n});return o.content}return n})(e,r,s)})(t,e,r,c,i)},addRules:r.addValidElements,setRules:r.setValidElements,addTempAttr:O(by,s,n),getTempAttrs:N(n),getNodeFilters:s.getNodeFilters,getAttributeFilters:s.getAttributeFilters,removeNodeFilter:s.removeNodeFilter,removeAttributeFilter:s.removeAttributeFilter}},yy=(e,t)=>{const n=vy(e,t);return{schema:n.schema,addNodeFilter:n.addNodeFilter,addAttributeFilter:n.addAttributeFilter,serialize:n.serialize,addRules:n.addRules,setRules:n.setRules,addTempAttr:n.addTempAttr,getTempAttrs:n.getTempAttrs,getNodeFilters:n.getNodeFilters,getAttributeFilters:n.getAttributeFilters,removeNodeFilter:n.removeNodeFilter,removeAttributeFilter:n.removeAttributeFilter}},Cy=(e,t,n={})=>{const o=((e,t)=>({format:"html",...e,set:!0,content:t}))(n,t);return Dv(e,o).map((t=>{const n=((e,t,n)=>dy(e).editor.setContent(t,n))(e,t.content,t);return Pv(e,n.html,t),n.content})).getOr(t)},wy="autoresize_on_init,content_editable_state,padd_empty_with_br,block_elements,boolean_attributes,editor_deselector,editor_selector,elements,file_browser_callback_types,filepicker_validator_handler,force_hex_style_colors,force_p_newlines,gecko_spellcheck,images_dataimg_filter,media_scripts,mode,move_caret_before_on_enter_elements,non_empty_elements,self_closing_elements,short_ended_elements,special,spellchecker_select_languages,spellchecker_whitelist,tab_focus,tabfocus_elements,table_responsive_width,text_block_elements,text_inline_elements,toolbar_drawer,types,validate,whitespace_elements,paste_enable_default_filters,paste_filter_drop,paste_word_valid_elements,paste_retain_style_properties,paste_convert_word_fake_lists".split(","),xy="bbcode,colorpicker,contextmenu,fullpage,legacyoutput,spellchecker,textcolor".split(","),ky=e=>{const t=K(wy,(t=>xe(e,t))),n=e.forced_root_block;return!1!==n&&""!==n||t.push("forced_root_block (false only)"),se(t)},Sy=e=>{const t=Bt.makeMap(e.plugins," "),n=K(xy,(e=>xe(t,e)));return se(n)},_y=Hs.DOM,Ey=e=>M.from(e).each((e=>e.destroy())),Ny=(()=>{const e={};return{add:(t,n)=>{e[t]=n},get:t=>e[t]?e[t]:{icons:{}},has:t=>xe(e,t)}})(),Ry=Qs.ModelManager,Ay=(e,t)=>t.dom[e],Oy=(e,t)=>parseInt(qn(t,e),10),Ty=O(Ay,"clientWidth"),By=O(Ay,"clientHeight"),Dy=O(Oy,"margin-top"),Py=O(Oy,"margin-left"),Ly=e=>{const t=[],n=()=>{const t=e.theme;return t&&t.getNotificationManagerImpl?t.getNotificationManagerImpl():(()=>{const e=()=>{throw new Error("Theme did not provide a NotificationManager implementation.")};return{open:e,close:e,getArgs:e}})()},o=()=>M.from(t[0]),r=()=>{$(t,(e=>{e.reposition()}))},s=e=>{J(t,(t=>t===e)).each((e=>{t.splice(e,1)}))},a=(a,i=!0)=>{if(!e.removed&&(e=>{return(t=e.inline?e.getBody():e.getContentAreaContainer(),M.from(t).map(fn)).map(jn).getOr(!1);var t})(e))return i&&e.dispatch("BeforeOpenNotification",{notification:a}),Q(t,(e=>{return t=n().getArgs(e),o=a,!(t.type!==o.type||t.text!==o.text||t.progressBar||t.timeout||o.progressBar||o.timeout);var t,o})).getOrThunk((()=>{e.editorManager.setActive(e);const i=n().open(a,(()=>{s(i),r(),o().fold((()=>e.focus()),(e=>tf(fn(e.getEl()))))}));return(e=>{t.push(e)})(i),r(),e.dispatch("OpenNotification",{notification:{...i}}),i}))},i=N(t);return(e=>{e.on("SkinLoaded",(()=>{const t=vl(e);t&&a({text:t,type:"warning",timeout:0},!1),r()})),e.on("show ResizeEditor ResizeWindow NodeChange",(()=>{requestAnimationFrame(r)})),e.on("remove",(()=>{$(t.slice(),(e=>{n().close(e)}))}))})(e),{open:a,close:()=>{o().each((e=>{n().close(e),s(e),r()}))},getNotifications:i}},My=Qs.PluginManager,Iy=Qs.ThemeManager,Fy=e=>{let t=[];const n=()=>{const t=e.theme;return t&&t.getWindowManagerImpl?t.getWindowManagerImpl():(()=>{const e=()=>{throw new Error("Theme did not provide a WindowManager implementation.")};return{open:e,openUrl:e,alert:e,confirm:e,close:e,getParams:e,setParams:e}})()},o=(e,t)=>(...n)=>t?t.apply(e,n):void 0,r=n=>{(t=>{e.dispatch("CloseWindow",{dialog:t})})(n),t=K(t,(e=>e!==n)),0===t.length&&e.focus()},s=n=>{e.editorManager.setActive(e),uf(e),e.ui.show();const o=n();return(n=>{t.push(n),(t=>{e.dispatch("OpenWindow",{dialog:t})})(n)})(o),o};return e.on("remove",(()=>{$(t,(e=>{n().close(e)}))})),{open:(e,t)=>s((()=>n().open(e,t,r))),openUrl:e=>s((()=>n().openUrl(e,r))),alert:(e,t,r)=>{const s=n();s.alert(e,o(r||s,t))},confirm:(e,t,r)=>{const s=n();s.confirm(e,o(r||s,t))},close:()=>{M.from(t[t.length-1]).each((e=>{n().close(e),r(e)}))}}},Uy=(e,t)=>{e.notificationManager.open({type:"error",text:t})},zy=(e,t)=>{e._skinLoaded?Uy(e,t):e.on("SkinLoaded",(()=>{Uy(e,t)}))},jy=(e,t,n)=>{Gu(e,t,{message:n}),console.error(n)},Vy=(e,t,n)=>n?`Failed to load ${e}: ${n} from url ${t}`:`Failed to load ${e} url: ${t}`,Hy=(e,...t)=>{const n=window.console;n&&(n.error?n.error(e,...t):n.log(e,...t))},$y=(e,t)=>{const n=e.editorManager.baseURL+"/skins/content",o=`content${e.editorManager.suffix}.css`,r=!0===e.inline;return H(t,(t=>(e=>/^[a-z0-9\-]+$/i.test(e))(t)&&!r?`${n}/${t}/${o}`:e.documentBaseURI.toAbsolute(t)))},qy=L,Wy=(e,t)=>{const n={};return{findAll:(o,r=L)=>{const s=K((e=>e?de(e.getElementsByTagName("img")):[])(o),(t=>{const n=t.src;return!t.hasAttribute("data-mce-bogus")&&!t.hasAttribute("data-mce-placeholder")&&!(!n||n===Nt.transparentSrc)&&(ze(n,"blob:")?!e.isUploaded(n)&&r(t):!!ze(n,"data:")&&r(t))})),a=H(s,(e=>{const o=e.src;if(xe(n,o))return n[o].then((t=>m(t)?t:{image:e,blobInfo:t.blobInfo}));{const r=((e,t)=>{const n=()=>Promise.reject("Invalid data URI");if(ze(t,"blob:")){const s=e.getByUri(t);return C(s)?Promise.resolve(s):(o=t,ze(o,"blob:")?(e=>fetch(e).then((e=>e.ok?e.blob():Promise.reject())).catch((()=>Promise.reject(`Cannot convert ${e} to Blob. Resource might not exist or is inaccessible.`))))(o):ze(o,"data:")?(r=o,new Promise(((e,t)=>{lv(r).bind((({type:e,data:t,base64Encoded:n})=>dv(e,t,n))).fold((()=>t("Invalid data URI")),e)}))):Promise.reject("Unknown URI format")).then((t=>cv(t).then((o=>mv(o,!1,(n=>M.some(fv(e,t,n)))).getOrThunk(n)))))}var o,r;return ze(t,"data:")?gv(e,t).fold(n,(e=>Promise.resolve(e))):Promise.reject("Unknown image data format")})(t,o).then((t=>(delete n[o],{image:e,blobInfo:t}))).catch((e=>(delete n[o],e)));return n[o]=r,r}}));return Promise.all(a)}}},Ky=()=>{let e={};const t=(e,t)=>({status:e,resultUri:t}),n=t=>t in e;return{hasBlobUri:n,getResultUri:t=>{const n=e[t];return n?n.resultUri:null},isPending:t=>!!n(t)&&1===e[t].status,isUploaded:t=>!!n(t)&&2===e[t].status,markPending:n=>{e[n]=t(1,null)},markUploaded:(n,o)=>{e[n]=t(2,o)},removeFailed:t=>{delete e[t]},destroy:()=>{e={}}}};let Gy=0;const Yy=(e,t)=>{const n={},o=(e,n)=>new Promise(((o,r)=>{const s=new XMLHttpRequest;s.open("POST",t.url),s.withCredentials=t.credentials,s.upload.onprogress=e=>{n(e.loaded/e.total*100)},s.onerror=()=>{r("Image upload failed due to a XHR Transport error. Code: "+s.status)},s.onload=()=>{if(s.status<200||s.status>=300)return void r("HTTP Error: "+s.status);const e=JSON.parse(s.responseText);var n,a;e&&m(e.location)?o((n=t.basePath,a=e.location,n?n.replace(/\/$/,"")+"/"+a.replace(/^\//,""):a)):r("Invalid JSON: "+s.responseText)};const a=new FormData;a.append("file",e.blob(),e.filename()),s.send(a)})),r=(e,t)=>({url:t,blobInfo:e,status:!0}),s=(e,t)=>({url:"",blobInfo:e,status:!1,error:t}),a=(e,t)=>{Bt.each(n[e],(e=>{e(t)})),delete n[e]};return!1===w(t.handler)&&(t.handler=o),{upload:(i,l)=>t.url||t.handler!==o?((o,i)=>(o=Bt.grep(o,(t=>!e.isUploaded(t.blobUri()))),Promise.all(Bt.map(o,(o=>e.isPending(o.blobUri())?(e=>{const t=e.blobUri();return new Promise((e=>{n[t]=n[t]||[],n[t].push(e)}))})(o):((t,n,o)=>(e.markPending(t.blobUri()),new Promise((i=>{let l,d;try{const c=()=>{l&&(l.close(),d=S)},u=n=>{c(),e.markUploaded(t.blobUri(),n),a(t.blobUri(),r(t,n)),i(r(t,n))},f=n=>{c(),e.removeFailed(t.blobUri()),a(t.blobUri(),s(t,n)),i(s(t,n))};d=e=>{e<0||e>100||M.from(l).orThunk((()=>M.from(o).map(B))).each((t=>{l=t,t.progressBar.value(e)}))},n(t,d).then(u,(e=>{f(m(e)?{message:e}:e)}))}catch(e){i(s(t,e))}}))))(o,t.handler,i))))))(i,l):new Promise((e=>{e([])}))}},Xy=e=>()=>e.notificationManager.open({text:e.translate("Image uploading..."),type:"info",timeout:-1,progressBar:!0}),Qy=(e,t)=>Yy(t,{url:Zi(e),basePath:el(e),credentials:tl(e),handler:nl(e)}),Jy=e=>{const t=(()=>{let e=[];const t=e=>{if(!e.blob||!e.base64)throw new Error("blob and base64 representations of the image are required for BlobInfo to be created");const t=e.id||"blobid"+Gy+++(()=>{const e=()=>Math.round(4294967295*Math.random()).toString(36);return"s"+(new Date).getTime().toString(36)+e()+e()+e()})(),n=e.name||t,o=e.blob;var r;return{id:N(t),name:N(n),filename:N(e.filename||n+"."+(r=o.type,{"image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/png":"png","image/apng":"apng","image/avif":"avif","image/svg+xml":"svg","image/webp":"webp","image/bmp":"bmp","image/tiff":"tiff"}[r.toLowerCase()]||"dat")),blob:N(o),base64:N(e.base64),blobUri:N(e.blobUri||URL.createObjectURL(o)),uri:N(e.uri)}},n=t=>Q(e,t).getOrUndefined(),o=e=>n((t=>t.id()===e));return{create:(e,n,o,r,s)=>{if(m(e))return t({id:e,name:r,filename:s,blob:n,base64:o});if(f(e))return t(e);throw new Error("Unknown input type")},add:t=>{o(t.id())||e.push(t)},get:o,getByUri:e=>n((t=>t.blobUri()===e)),getByData:(e,t)=>n((n=>n.base64()===e&&n.blob().type===t)),findFirst:n,removeByUri:t=>{e=K(e,(e=>e.blobUri()!==t||(URL.revokeObjectURL(e.blobUri()),!1)))},destroy:()=>{$(e,(e=>{URL.revokeObjectURL(e.blobUri())})),e=[]}}})();let n,o;const r=Ky(),s=[],a=t=>n=>e.selection?t(n):[],i=(e,t,n)=>{let o=0;do{o=e.indexOf(t,o),-1!==o&&(e=e.substring(0,o)+n+e.substr(o+t.length),o+=n.length-t.length+1)}while(-1!==o);return e},l=(e,t,n)=>{const o=`src="${n}"${n===Nt.transparentSrc?' data-mce-placeholder="1"':""}`;return e=i(e,`src="${t}"`,o),i(e,'data-mce-src="'+t+'"','data-mce-src="'+n+'"')},d=(t,n)=>{$(e.undoManager.data,(e=>{"fragmented"===e.type?e.fragments=H(e.fragments,(e=>l(e,t,n))):e.content=l(e.content,t,n)}))},c=()=>(n||(n=Qy(e,r)),p().then(a((o=>{const r=H(o,(e=>e.blobInfo));return n.upload(r,Xy(e)).then(a((n=>{const r=[];let s=!1;const a=H(n,((n,a)=>{const i=o[a].blobInfo,l=o[a].image;let c=!1;return n.status&&Xi(e)?(n.url&&!Ue(l.src,n.url)&&(s=!0),t.removeByUri(l.src),ly(e)||((t,n)=>{const o=e.convertURL(n,"src");var r;d(t.src,n),Wt(fn(t),{src:Yi(e)?(r=n,r+(-1===r.indexOf("?")?"?":"&")+(new Date).getTime()):n,"data-mce-src":o})})(l,n.url)):n.error&&(n.error.remove&&(d(l.getAttribute("src"),Nt.transparentSrc),r.push(l),c=!0),((e,t)=>{zy(e,Xs.translate(["Failed to upload image: {0}",t]))})(e,n.error.message)),{element:l,status:n.status,uploadUri:n.url,blobInfo:i,removed:c}}));return r.length>0&&!ly(e)?e.undoManager.transact((()=>{$(r,(n=>{e.dom.remove(n),t.removeByUri(n.src)}))})):s&&e.undoManager.dispatchChange(),a})))})))),u=()=>Gi(e)?c():Promise.resolve([]),g=e=>te(s,(t=>t(e))),p=()=>(o||(o=Wy(r,t)),o.findAll(e.getBody(),g).then(a((t=>{const n=K(t,(t=>!m(t)||(zy(e,t),!1)));return ly(e)||$(n,(e=>{d(e.image.src,e.blobInfo.blobUri()),e.image.src=e.blobInfo.blobUri(),e.image.removeAttribute("data-mce-src")})),n})))),h=n=>n.replace(/src="(blob:[^"]+)"/g,((n,o)=>{const s=r.getResultUri(o);if(s)return'src="'+s+'"';let a=t.getByUri(o);return a||(a=Y(e.editorManager.get(),((e,t)=>e||t.editorUpload&&t.editorUpload.blobCache.getByUri(o)),null)),a?'src="data:'+a.blob().type+";base64,"+a.base64()+'"':n}));return e.on("SetContent",(()=>{Gi(e)?u():p()})),e.on("RawSaveContent",(e=>{e.content=h(e.content)})),e.on("GetContent",(e=>{e.source_view||"raw"===e.format||"tree"===e.format||(e.content=h(e.content))})),e.on("PostRender",(()=>{e.parser.addNodeFilter("img",(e=>{$(e,(e=>{const n=e.attr("src");if(t.getByUri(n))return;const o=r.getResultUri(n);o&&e.attr("src",o)}))}))})),{blobCache:t,addFilter:e=>{s.push(e)},uploadImages:c,uploadImagesAuto:u,scanForImages:p,destroy:()=>{t.destroy(),r.destroy(),o=n=null}}},Zy={remove_similar:!0,inherit:!1},eC={selector:"td,th",...Zy},tC={tablecellbackgroundcolor:{styles:{backgroundColor:"%value"},...eC},tablecellverticalalign:{styles:{"vertical-align":"%value"},...eC},tablecellbordercolor:{styles:{borderColor:"%value"},...eC},tablecellclass:{classes:["%value"],...eC},tableclass:{selector:"table",classes:["%value"],...Zy},tablecellborderstyle:{styles:{borderStyle:"%value"},...eC},tablecellborderwidth:{styles:{borderWidth:"%value"},...eC}},nC=N(tC),oC=Bt.each,rC=Hs.DOM,sC=(e,t)=>{let n,o,r;const s=t&&t.schema||Ss({}),a=e=>{o="string"==typeof e?{name:e,classes:[],attrs:{}}:e;const t=rC.create(o.name);return((e,t)=>{t.classes.length&&rC.addClass(e,t.classes.join(" ")),rC.setAttribs(e,t.attrs)})(t,o),t},i=(e,t,n)=>{let o,r;const l=t.length>0&&t[0],d=l&&l.name,c=((e,t)=>{const n="string"!=typeof e?e.nodeName.toLowerCase():e,o=s.getElementRule(n),r=o&&o.parentsRequired;return!(!r||!r.length)&&(t&&-1!==Bt.inArray(r,t)?t:r[0])})(e,d);if(c)d===c?(r=t[0],t=t.slice(1)):r=c;else if(l)r=t[0],t=t.slice(1);else if(!n)return e;return r&&(o=a(r),o.appendChild(e)),n&&(o||(o=rC.create("div"),o.appendChild(e)),Bt.each(n,(t=>{const n=a(t);o.insertBefore(n,e)}))),i(o,t,r&&r.siblings)};return e&&e.length?(o=e[0],n=a(o),r=rC.create("div"),r.appendChild(i(n,e.slice(1),o.siblings)),r):""},aC=e=>{let t;const n={classes:[],attrs:{}};return"*"!==(e=n.selector=Bt.trim(e))&&(t=e.replace(/(?:([#\.]|::?)([\w\-]+)|(\[)([^\]]+)\]?)/g,((e,t,o,r,s)=>{switch(t){case"#":n.attrs.id=o;break;case".":n.classes.push(o);break;case":":-1!==Bt.inArray("checked disabled enabled read-only required".split(" "),o)&&(n.attrs[o]=o)}if("["===r){const e=s.match(/([\w\-]+)(?:\=\"([^\"]+))?/);e&&(n.attrs[e[1]]=e[2])}return""}))),n.name=t||"div",n},iC=(e,t)=>{let n,o,r,s="",a=_l(e);if(""===a)return"";const i=e=>e.replace(/%(\w+)/g,"");if("string"==typeof t){if(!(t=e.formatter.get(t)))return;t=t[0]}if("preview"in t){const e=we(t,"preview");if(Dt(e,!1))return"";a=e.getOr(a)}n=t.block||t.inline||"span";const l=(d=t.selector)&&"string"==typeof d?(d=(d=d.split(/\s*,\s*/)[0]).replace(/\s*(~\+|~|\+|>)\s*/g,"$1"),Bt.map(d.split(/(?:>|\s+(?![^\[\]]+\]))/),(e=>{const t=Bt.map(e.split(/(?:~\+|~|\+)/),aC),n=t.pop();return t.length&&(n.siblings=t),n})).reverse()):[];var d;l.length?(l[0].name||(l[0].name=n),n=t.selector,o=sC(l,e)):o=sC([n],e);const c=rC.select(n,o)[0]||o.firstChild;return oC(t.styles,((e,t)=>{const n=i(e);n&&rC.setStyle(c,t,n)})),oC(t.attributes,((e,t)=>{const n=i(e);n&&rC.setAttrib(c,t,n)})),oC(t.classes,(e=>{const t=i(e);rC.hasClass(c,t)||rC.addClass(c,t)})),e.dispatch("PreviewFormats"),rC.setStyles(o,{position:"absolute",left:-65535}),e.getBody().appendChild(o),r=rC.getStyle(e.getBody(),"fontSize",!0),r=/px$/.test(r)?parseInt(r,10):0,oC(a.split(" "),(t=>{let n=rC.getStyle(c,t,!0);if(!("background-color"===t&&/transparent|rgba\s*\([^)]+,\s*0\)/.test(n)&&(n=rC.getStyle(e.getBody(),t,!0),"#ffffff"===Gc(n).toLowerCase())||"color"===t&&"#000000"===Gc(n).toLowerCase())){if("font-size"===t&&/em|%$/.test(n)){if(0===r)return;n=parseFloat(n)/(/%$/.test(n)?100:1)*r+"px"}"border"===t&&n&&(s+="padding:0 2px;"),s+=t+":"+n+";"}})),e.dispatch("AfterPreviewFormats"),rC.remove(o),s},lC=e=>{const t=(e=>{const t={},n=(e,o)=>{e&&(m(e)?(p(o)||(o=[o]),$(o,(e=>{v(e.deep)&&(e.deep=!lu(e)),v(e.split)&&(e.split=!lu(e)||du(e)),v(e.remove)&&lu(e)&&!du(e)&&(e.remove="none"),lu(e)&&du(e)&&(e.mixed=!0,e.block_expand=!0),m(e.classes)&&(e.classes=e.classes.split(/\s+/))})),t[e]=o):fe(e,((e,t)=>{n(t,e)})))};return n((e=>{const t=e.dom,n=e.schema.type,o={valigntop:[{selector:"td,th",styles:{verticalAlign:"top"}}],valignmiddle:[{selector:"td,th",styles:{verticalAlign:"middle"}}],valignbottom:[{selector:"td,th",styles:{verticalAlign:"bottom"}}],alignleft:[{selector:"figure.image",collapsed:!1,classes:"align-left",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"left"},inherit:!1,preview:!1},{selector:"img,audio,video",collapsed:!1,styles:{float:"left"},preview:"font-family font-size"},{selector:"table",collapsed:!1,styles:{marginLeft:"0px",marginRight:"auto"},onformat:e=>{t.setStyle(e,"float",null)},preview:"font-family font-size"}],aligncenter:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"center"},inherit:!1,preview:"font-family font-size"},{selector:"figure.image",collapsed:!1,classes:"align-center",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"img,audio,video",collapsed:!1,styles:{display:"block",marginLeft:"auto",marginRight:"auto"},preview:!1},{selector:"table",collapsed:!1,styles:{marginLeft:"auto",marginRight:"auto"},preview:"font-family font-size"}],alignright:[{selector:"figure.image",collapsed:!1,classes:"align-right",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"right"},inherit:!1,preview:"font-family font-size"},{selector:"img,audio,video",collapsed:!1,styles:{float:"right"},preview:"font-family font-size"},{selector:"table",collapsed:!1,styles:{marginRight:"0px",marginLeft:"auto"},onformat:e=>{t.setStyle(e,"float",null)},preview:"font-family font-size"}],alignjustify:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"justify"},inherit:!1,preview:"font-family font-size"}],bold:[{inline:"strong",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all",preserve_attributes:["class","style"]}],italic:[{inline:"em",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all",preserve_attributes:["class","style"]}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:!0},{inline:"u",remove:"all",preserve_attributes:["class","style"]}],strikethrough:(()=>{const e={inline:"span",styles:{textDecoration:"line-through"},exact:!0},t={inline:"strike",remove:"all",preserve_attributes:["class","style"]},o={inline:"s",remove:"all",preserve_attributes:["class","style"]};return"html4"!==n?[o,e,t]:[e,o,t]})(),forecolor:{inline:"span",styles:{color:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},fontname:{inline:"span",toggle:!1,styles:{fontFamily:"%value"},clear_child_styles:!0},fontsize:{inline:"span",toggle:!1,styles:{fontSize:"%value"},clear_child_styles:!0},lineheight:{selector:"h1,h2,h3,h4,h5,h6,p,li,td,th,div",styles:{lineHeight:"%value"}},fontsize_class:{inline:"span",attributes:{class:"%value"}},blockquote:{block:"blockquote",wrapper:!0,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},code:{inline:"code"},link:{inline:"a",selector:"a",remove:"all",split:!0,deep:!0,onmatch:(e,t,n)=>Co(e)&&e.hasAttribute("href"),onformat:(e,n,o)=>{Bt.each(o,((n,o)=>{t.setAttrib(e,o,n)}))}},lang:{inline:"span",clear_child_styles:!0,remove_similar:!0,attributes:{lang:"%value","data-mce-lang":e=>{var t;return null!==(t=null==e?void 0:e.customValue)&&void 0!==t?t:null}}},removeformat:[{selector:"b,strong,em,i,font,u,strike,s,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins,small",remove:"all",split:!0,expand:!1,block_expand:!0,deep:!0},{selector:"span",attributes:["style","class"],remove:"empty",split:!0,expand:!1,deep:!0},{selector:"*",attributes:["style","class"],split:!1,expand:!1,deep:!0}]};return Bt.each("p h1 h2 h3 h4 h5 h6 div address pre dt dd samp".split(/\s/),(e=>{o[e]={block:e,remove:"all"}})),o})(e)),n(nC()),n(Sl(e)),{get:e=>C(e)?t[e]:t,has:e=>xe(t,e),register:n,unregister:e=>(e&&t[e]&&delete t[e],t)}})(e),n=Ws(null);return(e=>{e.addShortcut("meta+b","","Bold"),e.addShortcut("meta+i","","Italic"),e.addShortcut("meta+u","","Underline");for(let t=1;t<=6;t++)e.addShortcut("access+"+t,"",["FormatBlock",!1,"h"+t]);e.addShortcut("access+7","",["FormatBlock",!1,"p"]),e.addShortcut("access+8","",["FormatBlock",!1,"div"]),e.addShortcut("access+9","",["FormatBlock",!1,"address"])})(e),(e=>{e.on("mouseup keydown",(t=>{((e,t)=>{const n=e.selection,o=e.getBody();wh(e,null,!1),8!==t&&46!==t||!n.isCollapsed()||n.getStart().innerHTML!==ph||wh(e,Ec(o,n.getStart())),37!==t&&39!==t||wh(e,Ec(o,n.getStart()))})(e,t.keyCode)}))})(e),{get:t.get,has:t.has,register:t.register,unregister:t.unregister,apply:(t,n,o)=>{((e,t,n,o)=>{cy(e).formatter.apply(t,n,o)})(e,t,n,o)},remove:(t,n,o,r)=>{((e,t,n,o,r)=>{cy(e).formatter.remove(t,n,o,r)})(e,t,n,o,r)},toggle:(t,n,o)=>{((e,t,n,o)=>{cy(e).formatter.toggle(t,n,o)})(e,t,n,o)},match:(t,n,o,r)=>((e,t,n,o,r)=>cy(e).formatter.match(t,n,o,r))(e,t,n,o,r),closest:t=>((e,t)=>cy(e).formatter.closest(t))(e,t),matchAll:(t,n)=>((e,t,n)=>cy(e).formatter.matchAll(t,n))(e,t,n),matchNode:(t,n,o,r)=>((e,t,n,o,r)=>cy(e).formatter.matchNode(t,n,o,r))(e,t,n,o,r),canApply:t=>((e,t)=>cy(e).formatter.canApply(t))(e,t),formatChanged:(t,o,r,s)=>((e,t,n,o,r,s)=>cy(e).formatter.formatChanged(t,n,o,r,s))(e,n,t,o,r,s),getCssText:O(iC,e)}},dC=e=>{switch(e.toLowerCase()){case"undo":case"redo":case"mcefocus":return!0;default:return!1}},cC=e=>{const t=Js(),n=Ws(0),o=Ws(0),r={data:[],typing:!1,beforeChange:()=>{((e,t,n)=>{cy(e).undoManager.beforeChange(t,n)})(e,n,t)},add:(s,a)=>((e,t,n,o,r,s,a)=>cy(e).undoManager.add(t,n,o,r,s,a))(e,r,o,n,t,s,a),dispatchChange:()=>{e.setDirty(!0),e.dispatch("change",{level:Zv(e),lastLevel:ae(r.data,o.get()).getOrUndefined()})},undo:()=>((e,t,n,o)=>cy(e).undoManager.undo(t,n,o))(e,r,n,o),redo:()=>((e,t,n)=>cy(e).undoManager.redo(t,n))(e,o,r.data),clear:()=>{((e,t,n)=>{cy(e).undoManager.clear(t,n)})(e,r,o)},reset:()=>{((e,t)=>{cy(e).undoManager.reset(t)})(e,r)},hasUndo:()=>((e,t,n)=>cy(e).undoManager.hasUndo(t,n))(e,r,o),hasRedo:()=>((e,t,n)=>cy(e).undoManager.hasRedo(t,n))(e,r,o),transact:t=>((e,t,n,o)=>cy(e).undoManager.transact(t,n,o))(e,r,n,t),ignore:t=>{((e,t,n)=>{cy(e).undoManager.ignore(t,n)})(e,n,t)},extra:(t,n)=>{((e,t,n,o,r)=>{cy(e).undoManager.extra(t,n,o,r)})(e,r,o,t,n)}};return ly(e)||((e,t,n)=>{const o=Ws(!1),r=e=>{sy(t,!1,n),t.add({},e)};e.on("init",(()=>{t.add()})),e.on("BeforeExecCommand",(e=>{const o=e.command;dC(o)||(ay(t,n),t.beforeChange())})),e.on("ExecCommand",(e=>{const t=e.command;dC(t)||r(e)})),e.on("ObjectResizeStart cut",(()=>{t.beforeChange()})),e.on("SaveContent ObjectResized blur",r),e.on("dragend",r),e.on("keyup",(n=>{const s=n.keyCode;n.isDefaultPrevented()||((s>=33&&s<=36||s>=37&&s<=40||45===s||n.ctrlKey)&&(r(),e.nodeChanged()),46!==s&&8!==s||e.nodeChanged(),o.get()&&t.typing&&!1===oy(Zv(e),t.data[0])&&(!1===e.isDirty()&&e.setDirty(!0),e.dispatch("TypingUndo"),o.set(!1),e.nodeChanged()))})),e.on("keydown",(e=>{const s=e.keyCode;if(e.isDefaultPrevented())return;if(s>=33&&s<=36||s>=37&&s<=40||45===s)return void(t.typing&&r(e));const a=e.ctrlKey&&!e.altKey||e.metaKey;!(s<16||s>20)||224===s||91===s||t.typing||a||(t.beforeChange(),sy(t,!0,n),t.add({},e),o.set(!0))})),e.on("mousedown",(e=>{t.typing&&r(e)})),e.on("input",(e=>{var t;e.inputType&&("insertReplacementText"===e.inputType||"insertText"===(t=e).inputType&&null===t.data||(e=>"insertFromPaste"===e.inputType||"insertFromDrop"===e.inputType)(e))&&r(e)})),e.on("AddUndo Undo Redo ClearUndos",(t=>{t.isDefaultPrevented()||e.nodeChanged()}))})(e,r,n),(e=>{e.addShortcut("meta+z","","Undo"),e.addShortcut("meta+y,meta+shift+z","","Redo")})(e),r},uC=[9,27,em.HOME,em.END,19,20,44,144,145,33,34,45,16,17,18,91,92,93,em.DOWN,em.UP,em.LEFT,em.RIGHT].concat(Nt.browser.isFirefox()?[224]:[]),mC="data-mce-placeholder",fC=e=>"keydown"===e.type||"keyup"===e.type,gC=e=>{const t=e.keyCode;return t===em.BACKSPACE||t===em.DELETE},pC=(e,t)=>({from:e,to:t}),hC=(e,t)=>{const n=fn(e),o=fn(t.container());return dp(n,o).map((e=>((e,t)=>({block:e,position:t}))(e,t)))},bC=e=>{const t=Rn(e);return J(t,er).fold(N(t),(e=>t.slice(0,e)))},vC=e=>{const t=bC(e);return $(t,no),t},yC=(e,t)=>{const n=hg(t,e);return Q(n.reverse(),(e=>Yr(e))).each(no)},CC=(e,t,n,o)=>{if(Yr(n))return fg(n),xc(n.dom);0===K(En(o),(e=>!Yr(e))).length&&Yr(t)&&Xn(o,un("br"));const r=wc(n.dom,Ya.before(o.dom));return $(vC(t),(e=>{Xn(o,e)})),yC(e,t),r},wC=(e,t,n)=>{if(Yr(n))return no(n),Yr(t)&&fg(t),xc(t.dom);const o=kc(n.dom);return $(vC(t),(e=>{Zn(n,e)})),yC(e,t),o},xC=(e,t)=>{yc(e,t.dom).map((e=>e.getNode())).map(fn).filter(nr).each(no)},kC=(e,t,n)=>(xC(!0,t),xC(!1,n),((e,t)=>yn(t,e)?((e,t)=>{const n=hg(t,e);return M.from(n[n.length-1])})(t,e):M.none())(t,n).fold(O(wC,e,t,n),O(CC,e,t,n))),SC=(e,t,n,o)=>t?kC(e,o,n):kC(e,n,o),_C=(e,t)=>{const n=fn(e.getBody()),o=((e,t,n)=>n.collapsed?((e,t,n)=>{const o=hC(e,Ya.fromRangeStart(n)),r=o.bind((n=>hc(t,e,n.position).bind((n=>hC(e,n).map((n=>((e,t,n)=>Po(n.position.getNode())&&!1===Yr(n.block)?yc(!1,n.block.dom).bind((o=>o.isEqual(n.position)?hc(t,e,o).bind((t=>hC(e,t))):M.some(n))).getOr(n):n)(e,t,n)))))));return Pt(o,r,pC).filter((e=>(e=>!1===vn(e.from.block,e.to.block))(e)&&(e=>kn(e.from.block).bind((t=>kn(e.to.block).filter((e=>vn(t,e))))).isSome())(e)&&(e=>!1===Io(e.from.block.dom)&&!1===Io(e.to.block.dom))(e)))})(e,t,n):M.none())(n.dom,t,e.selection.getRng()).map((o=>()=>{SC(n,t,o.from.block,o.to.block).each((t=>{e.selection.setRng(t.toRange())}))}));return o},EC=(e,t)=>{const n=fn(t),o=O(vn,e);return $o(n,ir,o).isSome()},NC=e=>{const t=fn(e.getBody());return((e,t)=>{const n=wc(e.dom,Ya.fromRangeStart(t)).isNone(),o=Cc(e.dom,Ya.fromRangeEnd(t)).isNone();return!((e,t)=>EC(e,t.startContainer)||EC(e,t.endContainer))(e,t)&&n&&o})(t,e.selection.getRng())?(e=>M.some((()=>{e.setContent(""),e.selection.setCursorLocation()})))(e):((e,t)=>{const n=t.getRng();return Pt(dp(e,fn(n.startContainer)),dp(e,fn(n.endContainer)),((o,r)=>!1===vn(o,r)?M.some((()=>{n.deleteContents(),SC(e,!0,o,r).each((e=>{t.setRng(e.toRange())}))})):M.none())).getOr(M.none())})(t,e.selection)},RC=(e,t)=>e.selection.isCollapsed()?M.none():NC(e),AC=Mo,OC=Io,TC=(e,t,n,o,r)=>M.from(t._selectionOverrides.showCaret(e,n,o,r)),BC=(e,t)=>e.dispatch("BeforeObjectSelected",{target:t}).isDefaultPrevented()?M.none():M.some((e=>{const t=e.ownerDocument.createRange();return t.selectNode(e),t})(t)),DC=(e,t,n)=>t.collapsed?((e,t,n)=>{const o=Yd(1,e.getBody(),t),r=Ya.fromRangeStart(o),s=r.getNode();if(Nd(s))return TC(1,e,s,!r.isAtEnd(),!1);const a=r.getNode(!0);if(Nd(a))return TC(1,e,a,!1,!1);const i=e.dom.getParent(r.getNode(),(e=>OC(e)||AC(e)));return Nd(i)?TC(1,e,i,!1,n):M.none()})(e,t,n).getOr(t):t,PC=e=>ug(e)||ig(e),LC=e=>mg(e)||lg(e),MC=(e,t,n,o,r,s)=>{TC(o,e,s.getNode(!r),r,!0).each((n=>{if(t.collapsed){const e=t.cloneRange();r?e.setEnd(n.startContainer,n.startOffset):e.setStart(n.endContainer,n.endOffset),e.deleteContents()}else t.deleteContents();e.selection.setRng(n)})),((e,t)=>{Ro(t)&&0===t.data.length&&e.remove(t)})(e.dom,n)},IC=(e,t)=>((e,t)=>{const n=e.selection.getRng();if(!Ro(n.commonAncestorContainer))return M.none();const o=t?tc.Forwards:tc.Backwards,r=mc(e.getBody()),s=O(Zd,t?r.next:r.prev),a=t?PC:LC,i=Qd(o,e.getBody(),n),l=op(t,s(i));if(!l||!ec(i,l))return M.none();if(a(l))return M.some((()=>MC(e,n,i.getNode(),o,t,l)));const d=s(l);return d&&a(d)&&ec(l,d)?M.some((()=>MC(e,n,i.getNode(),o,t,d))):M.none()})(e,t),FC=(e,t)=>{const n=e.getBody();return t?xc(n).filter(ug):kc(n).filter(mg)},UC=e=>{const t=e.selection.getRng();return!t.collapsed&&(FC(e,!0).exists((e=>e.isEqual(Ya.fromRangeStart(t))))||FC(e,!1).exists((e=>e.isEqual(Ya.fromRangeEnd(t)))))},zC=Ci([{remove:["element"]},{moveToElement:["element"]},{moveToPosition:["position"]}]),jC=(e,t,n)=>hc(t,e,n).bind((o=>{return r=o.getNode(),ir(fn(r))||sr(fn(r))||((e,t,n,o)=>{const r=t=>tr(fn(t))&&!Vd(n,o,e);return Xd(!t,n).fold((()=>Xd(t,o).fold(P,r)),r)})(e,t,n,o)?M.none():t&&Io(o.getNode())||!1===t&&Io(o.getNode(!0))?((e,t,n,o)=>{const r=o.getNode(!1===t);return dp(fn(e),fn(n.getNode())).map((e=>Yr(e)?zC.remove(e.dom):zC.moveToElement(r))).orThunk((()=>M.some(zC.moveToElement(r))))})(e,t,n,o):t&&mg(n)||!1===t&&ug(n)?M.some(zC.moveToPosition(o)):M.none();var r})),VC=(e,t)=>M.from(Fp(e.getBody(),t)),HC=(e,t)=>{const n=e.selection.getNode();return VC(e,n).filter(Io).fold((()=>((e,t,n)=>{const o=Yd(t?1:-1,e,n),r=Ya.fromRangeStart(o),s=fn(e);return!1===t&&mg(r)?M.some(zC.remove(r.getNode(!0))):t&&ug(r)?M.some(zC.remove(r.getNode())):!1===t&&ug(r)&&Rg(s,r)?Ag(s,r).map((e=>zC.remove(e.getNode()))):t&&mg(r)&&Ng(s,r)?Og(s,r).map((e=>zC.remove(e.getNode()))):((e,t,n)=>((e,t)=>{const n=t.getNode(!1===e),o=e?"after":"before";return Co(n)&&n.getAttribute("data-mce-caret")===o})(t,n)?((e,t)=>e&&Io(t.nextSibling)?M.some(zC.moveToElement(t.nextSibling)):!1===e&&Io(t.previousSibling)?M.some(zC.moveToElement(t.previousSibling)):M.none())(t,n.getNode(!1===t)).fold((()=>jC(e,t,n)),M.some):jC(e,t,n).bind((t=>((e,t,n)=>n.fold((e=>M.some(zC.remove(e))),(e=>M.some(zC.moveToElement(e))),(n=>Vd(t,n,e)?M.none():M.some(zC.moveToPosition(n)))))(e,n,t))))(e,t,r)})(e.getBody(),t,e.selection.getRng()).map((n=>()=>n.fold(((e,t)=>n=>(e._selectionOverrides.hideFakeCaret(),Zg(e,t,fn(n)),!0))(e,t),((e,t)=>n=>{const o=t?Ya.before(n):Ya.after(n);return e.selection.setRng(o.toRange()),!0})(e,t),(e=>t=>(e.selection.setRng(t.toRange()),!0))(e))))),(()=>M.some(S)))},$C=e=>{const t=e.dom,n=e.selection,o=Fp(e.getBody(),n.getNode());if(Mo(o)&&t.isBlock(o)&&t.isEmpty(o)){const e=t.create("br",{"data-mce-bogus":"1"});t.setHTML(o,""),o.appendChild(e),n.setRng(Ya.before(e).toRange())}return!0},qC=(e,t)=>e.selection.isCollapsed()?HC(e,t):((e,t)=>{const n=e.selection.getNode();return Io(n)&&!Fo(n)?VC(e,n.parentNode).filter(Io).fold((()=>M.some((()=>{var n;n=fn(e.getBody()),$(na(n,".mce-offscreen-selection"),no),Zg(e,t,fn(e.selection.getNode())),cp(e)}))),(()=>M.some(S))):UC(e)?M.some((()=>{mp(e,e.selection.getRng(),fn(e.getBody()))})):M.none()})(e,t),WC=(e,t)=>e.selection.isCollapsed()?((e,t)=>{const n=Ya.fromRangeStart(e.selection.getRng());return hc(t,e.getBody(),n).filter((e=>t?sg(e):ag(e))).bind((e=>M.from(Hd(t?0:-1,e)))).map((t=>()=>e.selection.select(t)))})(e,t):M.none(),KC=Ro,GC=e=>KC(e)&&e.data[0]===pr,YC=e=>KC(e)&&e.data[e.data.length-1]===pr,XC=e=>e.ownerDocument.createTextNode(pr),QC=(e,t)=>e?(e=>{if(KC(e.previousSibling))return YC(e.previousSibling)||e.previousSibling.appendData(pr),e.previousSibling;if(KC(e))return GC(e)||e.insertData(0,pr),e;{const t=XC(e);return e.parentNode.insertBefore(t,e),t}})(t):(e=>{if(KC(e.nextSibling))return GC(e.nextSibling)||e.nextSibling.insertData(0,pr),e.nextSibling;if(KC(e))return YC(e)||e.appendData(pr),e;{const t=XC(e);return e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t),t}})(t),JC=O(QC,!0),ZC=O(QC,!1),ew=(e,t)=>Ro(e.container())?QC(t,e.container()):QC(t,e.getNode()),tw=(e,t)=>{const n=t.get();return n&&e.container()===n&&wr(n)},nw=(e,t)=>t.fold((t=>{Cd(e.get());const n=JC(t);return e.set(n),M.some(Ya(n,n.length-1))}),(t=>xc(t).map((t=>{if(tw(t,e))return Ya(e.get(),1);{Cd(e.get());const n=ew(t,!0);return e.set(n),Ya(n,1)}}))),(t=>kc(t).map((t=>{if(tw(t,e))return Ya(e.get(),e.get().length-1);{Cd(e.get());const n=ew(t,!1);return e.set(n),Ya(n,n.length-1)}}))),(t=>{Cd(e.get());const n=ZC(t);return e.set(n),M.some(Ya(n,1))})),ow=(e,t)=>{for(let n=0;n<e.length;n++){const o=e[n].apply(null,t);if(o.isSome())return o}return M.none()},rw=Ci([{before:["element"]},{start:["element"]},{end:["element"]},{after:["element"]}]),sw=(e,t)=>jd(t,e)||e,aw=(e,t,n)=>{const o=rp(n),r=sw(t,o.container());return np(e,r,o).fold((()=>Cc(r,o).bind(O(np,e,r)).map((e=>rw.before(e)))),M.none)},iw=(e,t)=>null===Ec(e,t),lw=(e,t,n)=>np(e,t,n).filter(O(iw,t)),dw=(e,t,n)=>{const o=sp(n);return lw(e,t,o).bind((e=>wc(e,o).isNone()?M.some(rw.start(e)):M.none()))},cw=(e,t,n)=>{const o=rp(n);return lw(e,t,o).bind((e=>Cc(e,o).isNone()?M.some(rw.end(e)):M.none()))},uw=(e,t,n)=>{const o=sp(n),r=sw(t,o.container());return np(e,r,o).fold((()=>wc(r,o).bind(O(np,e,r)).map((e=>rw.after(e)))),M.none)},mw=e=>{return!1===(t=gw(e),"rtl"===Hs.DOM.getStyle(t,"direction",!0)||(e=>ep.test(e))(t.textContent));var t},fw=(e,t,n)=>ow([aw,dw,cw,uw],[e,t,n]).filter(mw),gw=e=>e.fold(R,R,R,R),pw=e=>e.fold(N("before"),N("start"),N("end"),N("after")),hw=e=>e.fold(rw.before,rw.before,rw.after,rw.after),bw=e=>e.fold(rw.start,rw.start,rw.end,rw.end),vw=(e,t,n,o,r,s)=>Pt(np(t,n,o),np(t,n,r),((t,o)=>t!==o&&((e,t,n)=>{const o=jd(t,e),r=jd(n,e);return o&&o===r})(n,t,o)?rw.after(e?t:o):s)).getOr(s),yw=(e,t)=>e.fold(L,(e=>{return o=t,!(pw(n=e)===pw(o)&&gw(n)===gw(o));var n,o})),Cw=(e,t)=>e?t.fold(_(M.some,rw.start),M.none,_(M.some,rw.after),M.none):t.fold(M.none,_(M.some,rw.before),M.none,_(M.some,rw.end)),ww=(e,t,n)=>{const o=e?1:-1;return t.setRng(Ya(n.container(),n.offset()+o).toRange()),t.getSel().modify("move",e?"forward":"backward","word"),!0};var xw;!function(e){e[e.Br=0]="Br",e[e.Block=1]="Block",e[e.Wrap=2]="Wrap",e[e.Eol=3]="Eol"}(xw||(xw={}));const kw=(e,t)=>e===tc.Backwards?ne(t):t,Sw=(e,t,n)=>e===tc.Forwards?t.next(n):t.prev(n),_w=(e,t,n,o)=>Po(o.getNode(t===tc.Forwards))?xw.Br:!1===Vd(n,o)?xw.Block:xw.Wrap,Ew=(e,t,n,o)=>{const r=mc(n);let s=o;const a=[];for(;s;){const n=Sw(t,r,s);if(!n)break;if(Po(n.getNode(!1)))return t===tc.Forwards?{positions:kw(t,a).concat([n]),breakType:xw.Br,breakAt:M.some(n)}:{positions:kw(t,a),breakType:xw.Br,breakAt:M.some(n)};if(n.isVisible()){if(e(s,n)){const e=_w(0,t,s,n);return{positions:kw(t,a),breakType:e,breakAt:M.some(n)}}a.push(n),s=n}else s=n}return{positions:kw(t,a),breakType:xw.Eol,breakAt:M.none()}},Nw=(e,t,n,o)=>t(n,o).breakAt.map((o=>{const r=t(n,o).positions;return e===tc.Backwards?r.concat(o):[o].concat(r)})).getOr([]),Rw=(e,t)=>Y(e,((e,n)=>e.fold((()=>M.some(n)),(o=>Pt(ie(o.getClientRects()),ie(n.getClientRects()),((e,r)=>{const s=Math.abs(t-e.left);return Math.abs(t-r.left)<=s?n:o})).or(e)))),M.none()),Aw=(e,t)=>ie(t.getClientRects()).bind((t=>Rw(e,t.left))),Ow=O(Ew,Ya.isAbove,-1),Tw=O(Ew,Ya.isBelow,1),Bw=O(Nw,-1,Ow),Dw=O(Nw,1,Tw),Pw=(e,t)=>Aw(Bw(e,t),t),Lw=(e,t)=>Aw(Dw(e,t),t),Mw=Io,Iw=(e,t)=>Math.abs(e.left-t),Fw=(e,t)=>Math.abs(e.right-t),Uw=(e,t)=>Oe(e,((e,n)=>{const o=Math.min(Iw(e,t),Fw(e,t)),r=Math.min(Iw(n,t),Fw(n,t));return r===o&&ke(n,"node")&&Mw(n.node)||r<o?n:e})),zw=e=>{const t=t=>H(t,(t=>{const n=xa(t);return n.node=e,n}));if(Co(e))return t(e.getClientRects());if(Ro(e)){const n=e.ownerDocument.createRange();return n.setStart(e,0),n.setEnd(e,e.data.length),t(n.getClientRects())}return[]},jw=e=>ee(e,zw);var Vw;!function(e){e[e.Up=-1]="Up",e[e.Down=1]="Down"}(Vw||(Vw={}));const Hw=(e,t,n,o,r,s)=>{let a=0;const i=[],l=o=>{let s=jw([o]);-1===e&&(s=s.reverse());for(let e=0;e<s.length;e++){const o=s[e];if(!n(o,d)){if(i.length>0&&t(o,Be(i))&&a++,o.line=a,r(o))return!0;i.push(o)}}},d=Be(s.getClientRects());if(!d)return i;const c=s.getNode();return l(c),((e,t,n,o)=>{for(;o=zd(o,e,zr,t);)if(n(o))return})(e,o,l,c),i},$w=O(Hw,Vw.Up,_a,Ea),qw=O(Hw,Vw.Down,Ea,_a),Ww=e=>t=>((e,t)=>t.line>e)(e,t),Kw=e=>t=>((e,t)=>t.line===e)(e,t),Gw=(e,t)=>{e.selection.setRng(t),ef(e,e.selection.getRng())},Yw=(e,t,n)=>M.some(DC(e,t,n)),Xw=(e,t,n,o,r,s)=>{const a=t===tc.Forwards,i=mc(e.getBody()),l=O(Zd,a?i.next:i.prev),d=a?o:r;if(!n.collapsed){const o=Ra(n);if(s(o))return TC(t,e,o,t===tc.Backwards,!1);if(UC(e)){const e=n.cloneRange();return e.collapse(t===tc.Backwards),M.from(e)}}const c=Qd(t,e.getBody(),n);if(d(c))return BC(e,c.getNode(!a));const u=op(a,l(c)),m=Ar(n);if(!u)return m?M.some(n):M.none();if(d(u))return TC(t,e,u.getNode(!a),a,!1);const f=l(u);return f&&d(f)&&ec(u,f)?TC(t,e,f.getNode(!a),a,!1):m?Yw(e,u.toRange(),!1):M.none()},Qw=(e,t,n,o,r,s)=>{const a=Qd(t,e.getBody(),n),i=Be(a.getClientRects()),l=t===Vw.Down,d=e.getBody();if(!i)return M.none();if(UC(e)){const e=l?Ya.fromRangeEnd(n):Ya.fromRangeStart(n);return(l?Lw:Pw)(d,e).orThunk((()=>M.from(e))).map((e=>e.toRange()))}const c=(l?qw:$w)(d,Ww(1),a),u=K(c,Kw(1)),m=i.left,f=Uw(u,m);if(f&&s(f.node)){const n=Math.abs(m-f.left),o=Math.abs(m-f.right);return TC(t,e,f.node,n<o,!1)}let g;if(g=o(a)?a.getNode():r(a)?a.getNode(!0):Ra(n),g){const n=((e,t,n,o)=>{const r=mc(t);let s,a,i,l;const d=[];let c=0;const u=e=>Be(e.getClientRects());1===e?(s=r.next,a=Ea,i=_a,l=Ya.after(o)):(s=r.prev,a=_a,i=Ea,l=Ya.before(o));const m=u(l);do{if(!l.isVisible())continue;const e=u(l);if(i(e,m))continue;d.length>0&&a(e,Be(d))&&c++;const t=xa(e);if(t.position=l,t.line=c,n(t))return d;d.push(t)}while(l=s(l));return d})(t,d,Ww(1),g);let o=Uw(K(n,Kw(1)),m);if(o)return Yw(e,o.position.toRange(),!1);if(o=Be(K(n,Kw(0))),o)return Yw(e,o.position.toRange(),!1)}return 0===u.length?Jw(e,l).filter(l?r:o).map((t=>DC(e,t.toRange(),!1))):M.none()},Jw=(e,t)=>{const n=e.selection.getRng(),o=t?Ya.fromRangeEnd(n):Ya.fromRangeStart(n),r=(s=o.container(),a=e.getBody(),$o(fn(s),(e=>Ad(e.dom)),(e=>e.dom===a)).map((e=>e.dom)).getOr(a));var s,a;if(t){const e=Tw(r,o);return le(e.positions)}{const e=Ow(r,o);return ie(e.positions)}},Zw=(e,t,n)=>Jw(e,t).filter(n).exists((t=>(e.selection.setRng(t.toRange()),!0))),ex=(e,t)=>{const n=e.dom.createRng();n.setStart(t.container(),t.offset()),n.setEnd(t.container(),t.offset()),e.selection.setRng(n)},tx=(e,t)=>{e?t.setAttribute("data-mce-selected","inline-boundary"):t.removeAttribute("data-mce-selected")},nx=(e,t,n)=>nw(t,n).map((t=>(ex(e,t),n))),ox=(e,t,n)=>{const o=e.getBody(),r=((e,t,n)=>{const o=Ya.fromRangeStart(e);if(e.collapsed)return o;{const r=Ya.fromRangeEnd(e);return n?wc(t,r).getOr(r):Cc(t,o).getOr(o)}})(e.selection.getRng(),o,n);return((e,t,n,o)=>{const r=op(e,o),s=fw(t,n,r);return fw(t,n,r).bind(O(Cw,e)).orThunk((()=>((e,t,n,o,r)=>{const s=op(e,r);return hc(e,n,s).map(O(op,e)).fold((()=>o.map(hw)),(r=>fw(t,n,r).map(O(vw,e,t,n,s,r)).filter(O(yw,o)))).filter(mw)})(e,t,n,s,o)))})(n,O(tp,e),o,r).bind((n=>nx(e,t,n)))},rx=(e,t,n)=>!!kl(e)&&ox(e,t,n).isSome(),sx=(e,t,n)=>!!kl(t)&&((e,t)=>{const n=t.selection.getRng(),o=e?Ya.fromRangeEnd(n):Ya.fromRangeStart(n);return!!(e=>w(e.selection.getSel().modify))(t)&&(e&&Sr(o)?ww(!0,t.selection,o):!(e||!_r(o))&&ww(!1,t.selection,o))})(e,t),ax=e=>{const t=Ws(null),n=O(tp,e);return e.on("NodeChange",(o=>{kl(e)&&(((e,t,n)=>{const o=H(na(fn(t.getRoot()),'*[data-mce-selected="inline-boundary"]'),(e=>e.dom)),r=K(o,e),s=K(n,e);$(oe(r,s),O(tx,!1)),$(oe(s,r),O(tx,!0))})(n,e.dom,o.parents),((e,t)=>{if(e.selection.isCollapsed()&&!0!==e.composing&&t.get()){const n=Ya.fromRangeStart(e.selection.getRng());Ya.isTextPosition(n)&&!1===(e=>Sr(e)||_r(e))(n)&&(ex(e,yd(t.get(),n)),t.set(null))}})(e,t),((e,t,n,o)=>{if(t.selection.isCollapsed()){const r=K(o,e);$(r,(o=>{const r=Ya.fromRangeStart(t.selection.getRng());fw(e,t.getBody(),r).bind((e=>nx(t,n,e)))}))}})(n,e,t,o.parents))})),t},ix=O(sx,!0),lx=O(sx,!1),dx=(e,t,n)=>{if(kl(e)){const o=Jw(e,t).getOrThunk((()=>{const n=e.selection.getRng();return t?Ya.fromRangeEnd(n):Ya.fromRangeStart(n)}));return fw(O(tp,e),e.getBody(),o).exists((t=>{const o=hw(t);return nw(n,o).exists((t=>(ex(e,t),!0)))}))}return!1},cx=(e,t)=>n=>nw(t,n).map((t=>()=>ex(e,t))),ux=(e,t,n,o)=>{const r=e.getBody(),s=O(tp,e);e.undoManager.ignore((()=>{e.selection.setRng(((e,t)=>{const n=document.createRange();return n.setStart(e.container(),e.offset()),n.setEnd(t.container(),t.offset()),n})(n,o)),ip(e),fw(s,r,Ya.fromRangeStart(e.selection.getRng())).map(bw).bind(cx(e,t)).each(D)})),e.nodeChanged()},mx=(e,t,n)=>{if(e.selection.isCollapsed()&&kl(e)){const o=Ya.fromRangeStart(e.selection.getRng());return((e,t,n,o)=>{const r=((e,t)=>jd(t,e)||e)(e.getBody(),o.container()),s=O(tp,e),a=fw(s,r,o);return a.bind((e=>n?e.fold(N(M.some(bw(e))),M.none,N(M.some(hw(e))),M.none):e.fold(M.none,N(M.some(hw(e))),M.none,N(M.some(bw(e)))))).map(cx(e,t)).getOrThunk((()=>{const i=bc(n,r,o),l=i.bind((e=>fw(s,r,e)));return Pt(a,l,(()=>np(s,r,o).bind((t=>(e=>Pt(xc(e),kc(e),((t,n)=>{const o=op(!0,t),r=op(!1,n);return Cc(e,o).forall((e=>e.isEqual(r)))})).getOr(!0))(t)?M.some((()=>{Zg(e,n,fn(t))})):M.none())))).getOrThunk((()=>l.bind((()=>i.map((r=>()=>{n?ux(e,t,o,r):ux(e,t,r,o)}))))))}))})(e,t,n,o)}return M.none()},fx=e=>1===Bn(e),gx=(e,t)=>{const n=fn(e.getBody()),o=fn(e.selection.getStart()),r=K(((e,t)=>{const n=hg(t,e);return J(n,er).fold(N(n),(e=>n.slice(0,e)))})(n,o),fx);return le(r).bind((n=>{const o=Ya.fromRangeStart(e.selection.getRng());return!((e,t,n)=>Pt(xc(n),kc(n),((o,r)=>{const s=op(!0,o),a=op(!1,r),i=op(!1,t);return e?Cc(n,i).exists((e=>e.isEqual(a)&&t.isEqual(s))):wc(n,i).exists((e=>e.isEqual(s)&&t.isEqual(a)))})).getOr(!0))(t,o,n.dom)||_c((s=n).dom)&&bh(s.dom)?M.none():M.some((()=>((e,t,n,o)=>{const r=O(_h,t),s=H(K(o,r),(e=>e.dom));if(0===s.length)Zg(t,e,n);else{const e=((e,t)=>{const n=yh(!1),o=kh(t,n.dom);return Xn(fn(e),n),no(fn(e)),Ya(o,0)})(n.dom,s);t.selection.setRng(e.toRange())}})(t,e,n,r)));var s}))},px=(e,t)=>e.selection.isCollapsed()?gx(e,t):M.none(),hx=(e,t,n)=>M.some((()=>{e._selectionOverrides.hideFakeCaret(),Zg(e,t,fn(n))})),bx=(e,t)=>e.selection.isCollapsed()?((e,t)=>{const n=t?ig:lg,o=t?tc.Forwards:tc.Backwards,r=Qd(o,e.getBody(),e.selection.getRng());return n(r)?hx(e,t,r.getNode(!t)):M.from(op(t,r)).filter((e=>n(e)&&ec(r,e))).map((n=>()=>hx(e,t,n.getNode(!t))))})(e,t):((e,t)=>{const n=e.selection.getNode();return Uo(n)?hx(e,t,n):M.none()})(e,t),vx=e=>{const t=parseInt(e,10);return isNaN(t)?0:t},yx=(e,t)=>(e||"table"===Mt(t)?"margin":"padding")+("rtl"===qn(t,"direction")?"-right":"-left"),Cx=e=>{const t=xx(e);return!e.mode.isReadOnly()&&(t.length>1||((e,t)=>te(t,(t=>{const n=yx(il(e),t),o=Kn(t,n).map(vx).getOr(0);return"false"!==e.dom.getContentEditable(t.dom)&&o>0})))(e,t))},wx=e=>rr(e)||sr(e),xx=e=>{return K((t=e.selection.getSelectedBlocks(),H(t,fn)),(e=>!wx(e)&&!(e=>kn(e).exists(wx))(e)&&qo(e,(e=>Mo(e.dom)||Io(e.dom))).exists((e=>Mo(e.dom)))));var t},kx=(e,t)=>{const{dom:n}=e,o=ll(e),r=/[a-z%]+$/i.exec(o)[0],s=parseInt(o,10),a=il(e);$(xx(e),(e=>{((e,t,n,o,r,s)=>{const a=yx(n,fn(s));if("outdent"===t){const t=Math.max(0,vx(s.style[a])-o);e.setStyle(s,a,t?t+r:"")}else{const t=vx(s.style[a])+o+r;e.setStyle(s,a,t)}})(n,t,a,s,r,e.dom)}))},Sx=e=>kx(e,"outdent"),_x=e=>{if(e.selection.isCollapsed()&&Cx(e)){const t=e.dom,n=e.selection.getRng(),o=Ya.fromRangeStart(n),r=t.getParent(n.startContainer,t.isBlock);if(null!==r&&wg(fn(r),o))return M.some((()=>Sx(e)))}return M.none()},Ex=(e,t,n)=>ce([_x,qC,IC,(e,n)=>mx(e,t,n),_C,Ip,WC,bx,RC,px],(t=>t(e,n))),Nx=(e,t)=>{e.addCommand("delete",(()=>{((e,t)=>{Ex(e,t,!1).fold((()=>{ip(e),cp(e)}),D)})(e,t)})),e.addCommand("forwardDelete",(()=>{((e,t)=>{Ex(e,t,!0).fold((()=>(e=>ap(e,"ForwardDelete"))(e)),D)})(e,t)}))},Rx=e=>void 0===e.touches||1!==e.touches.length?M.none():M.some(e.touches[0]),Ax=(e,t)=>xe(e,t.nodeName),Ox=(e,t)=>!!Ro(t)||!!Co(t)&&!Ax(e,t)&&!Fc(t),Tx=(e,t)=>{if(Ro(t)){if(0===t.nodeValue.length)return!0;if(/^\s+$/.test(t.nodeValue)&&(!t.nextSibling||Ax(e,t.nextSibling)))return!0}return!1},Bx=e=>{const t=e.dom,n=e.selection,o=e.schema,r=o.getBlockElements();let s=n.getStart();const a=e.getBody();let i,l,d;const c=ji(e);if(!s||!Co(s))return;const u=a.nodeName.toLowerCase();if(!o.isValidChild(u,c.toLowerCase())||((e,t,n)=>V(pg(fn(n),fn(t)),(t=>Ax(e,t.dom))))(r,a,s))return;const m=n.getRng(),f=m.startContainer,g=m.startOffset,p=m.endContainer,h=m.endOffset,b=xf(e);for(s=a.firstChild;s;)if(Ox(r,s)){if(Tx(r,s)){l=s,s=s.nextSibling,t.remove(l);continue}i||(i=t.create(c,Vi(e)),s.parentNode.insertBefore(i,s),d=!0),l=s,s=s.nextSibling,i.appendChild(l)}else i=null,s=s.nextSibling;d&&b&&(m.setStart(f,g),m.setEnd(p,h),n.setRng(m),e.nodeChanged())},Dx=e=>t=>-1!==(" "+t.attr("class")+" ").indexOf(e),Px=(e,t,n)=>function(o){const r=arguments,s=r[r.length-2],a=s>0?t.charAt(s-1):"";if('"'===a)return o;if(">"===a){const e=t.lastIndexOf("<",s);if(-1!==e&&-1!==t.substring(e,s).indexOf('contenteditable="false"'))return o}return'<span class="'+n+'" data-mce-content="'+e.dom.encode(r[0])+'">'+e.dom.encode("string"==typeof r[1]?r[1]:r[0])+"</span>"},Lx=(e,t)=>{t.hasAttribute("data-mce-caret")&&(Rr(t),e.selection.setRng(e.selection.getRng()),e.selection.scrollIntoView(t))},Mx=(e,t)=>{const n=(e=>Ko(fn(e.getBody()),"*[data-mce-caret]").map((e=>e.dom)).getOrNull())(e);if(n)return"compositionstart"===t.type?(t.preventDefault(),t.stopPropagation(),void Lx(e,n)):void(kr(n)&&(Lx(e,n),e.undoManager.add()))},Ix=Io,Fx=(e,t,n)=>{const o=mc(e.getBody()),r=O(Zd,1===t?o.next:o.prev);if(n.collapsed){const o=e.dom.getParent(n.startContainer,"PRE");if(!o)return;if(!r(Ya.fromRangeStart(n))){const n=fn((e=>{const t=e.dom.create(ji(e));return t.innerHTML='<br data-mce-bogus="1">',t})(e));1===t?Qn(fn(o),n):Xn(fn(o),n),e.selection.select(n.dom,!0),e.selection.collapse()}}},Ux=(e,t)=>((e,t)=>{const n=t?tc.Forwards:tc.Backwards,o=e.selection.getRng();return((e,t,n)=>Xw(t,e,n,ug,mg,Ix))(n,e,o).orThunk((()=>(Fx(e,n,o),M.none())))})(e,t).exists((t=>(Gw(e,t),!0))),zx=(e,t)=>((e,t)=>{const n=t?1:-1,o=e.selection.getRng();return((e,t,n)=>Qw(t,e,n,(e=>ug(e)||dg(e)),(e=>mg(e)||cg(e)),Ix))(n,e,o).orThunk((()=>(Fx(e,n,o),M.none())))})(e,t).exists((t=>(Gw(e,t),!0))),jx=(e,t)=>Zw(e,t,t?mg:ug),Vx=(e,t)=>FC(e,!t).map((n=>{const o=n.toRange(),r=e.selection.getRng();return t?o.setStart(r.startContainer,r.startOffset):o.setEnd(r.endContainer,r.endOffset),o})).exists((t=>(Gw(e,t),!0))),Hx=e=>j(["figcaption"],Mt(e)),$x=(e,t)=>{const n=fn(e.getBody()),o=Ya.fromRangeStart(e.selection.getRng()),r=ji(e),s=Vi(e);return((e,t)=>{const n=O(vn,t);return qo(fn(e.container()),er,n).filter(Hx)})(o,n).exists((()=>{if(((e,t,n)=>t?((e,t)=>Tw(e,t).breakAt.isNone())(e.dom,n):((e,t)=>Ow(e,t).breakAt.isNone())(e.dom,n))(n,t,o)){const o=((e,t,n,o)=>{const r=un(n),s=un("br");return Wt(r,o),Zn(r,s),((e,t,n)=>{n?Zn(e,t):Jn(e,t)})(e,r,t),(e=>{const t=document.createRange();return t.setStartBefore(e.dom),t.setEndBefore(e.dom),t})(s)})(n,t,r,s);return e.selection.setRng(o),!0}return!1}))},qx=(e,t)=>!!e.selection.isCollapsed()&&$x(e,t),Wx={shiftKey:!1,altKey:!1,ctrlKey:!1,metaKey:!1,keyCode:0},Kx=(e,t)=>t.keyCode===e.keyCode&&t.shiftKey===e.shiftKey&&t.altKey===e.altKey&&t.ctrlKey===e.ctrlKey&&t.metaKey===e.metaKey,Gx=(e,...t)=>()=>e.apply(null,t),Yx=(e,t)=>Q(((e,t)=>ee((e=>H(e,(e=>({...Wx,action:S,...e}))))(e),(e=>Kx(e,t)?[e]:[])))(e,t),(e=>e.action())),Xx=(e,t)=>ce(((e,t)=>ee((e=>H(e,(e=>({...Wx,action:()=>M.none(),...e}))))(e),(e=>Kx(e,t)?[e]:[])))(e,t),(e=>e.action())),Qx=(e,t)=>{const n=t?tc.Forwards:tc.Backwards,o=e.selection.getRng();return Xw(e,n,o,ig,lg,Uo).exists((t=>(Gw(e,t),!0)))},Jx=(e,t)=>{const n=t?1:-1,o=e.selection.getRng();return Qw(e,n,o,ig,lg,Uo).exists((t=>(Gw(e,t),!0)))},Zx=(e,t)=>Zw(e,t,t?lg:ig),ek=Ci([{none:["current"]},{first:["current"]},{middle:["current","target"]},{last:["current"]}]),tk={...ek,none:e=>ek.none(e)},nk=(e,t,n)=>ee(Rn(e),(e=>hn(e,t)?n(e)?[e]:[]:nk(e,t,n))),ok=(e,t)=>Go(e,"table",t),rk=(e,t,n,o,r=L)=>{const s=1===o;if(!s&&n<=0)return tk.first(e[0]);if(s&&n>=e.length-1)return tk.last(e[e.length-1]);{const s=n+o,a=e[s];return r(a)?tk.middle(t,a):rk(e,t,s,o,r)}},sk=(e,t)=>ok(e,t).bind((t=>{const n=nk(t,"th,td",L);return J(n,(t=>vn(e,t))).map((e=>({index:e,all:n})))})),ak=(e,t=!1)=>{return jn(e)?e.dom.isContentEditable:(n=e,Go(n,"[contenteditable]")).fold(N(t),(e=>"true"===ik(e)));var n},ik=e=>e.dom.contentEditable,lk=(e,t,n,o,r)=>{const s=na(fn(n),"td,th,caption").map((e=>e.dom)),a=K(((e,t)=>ee(t,(t=>{const n=((e,t)=>({left:e.left-t,top:e.top-t,right:e.right+-2,bottom:e.bottom+-2,width:e.width+t,height:e.height+t}))(xa(t.getBoundingClientRect()),-1);return[{x:n.left,y:e(n),cell:t},{x:n.right,y:e(n),cell:t}]})))(e,s),(e=>t(e,r)));return((e,t,n)=>Y(e,((e,o)=>e.fold((()=>M.some(o)),(e=>{const r=Math.sqrt(Math.abs(e.x-t)+Math.abs(e.y-n)),s=Math.sqrt(Math.abs(o.x-t)+Math.abs(o.y-n));return M.some(s<r?o:e)}))),M.none()))(a,o,r).map((e=>e.cell))},dk=O(lk,(e=>e.bottom),((e,t)=>e.y<t)),ck=O(lk,(e=>e.top),((e,t)=>e.y>t)),uk=(e,t,n)=>{const o=e(t,n);return(e=>e.breakType===xw.Wrap&&0===e.positions.length)(o)||!Po(n.getNode())&&(e=>e.breakType===xw.Br&&1===e.positions.length)(o)?!((e,t,n)=>n.breakAt.exists((n=>e(t,n).breakAt.isSome())))(e,t,o):o.breakAt.isNone()},mk=O(uk,Ow),fk=O(uk,Tw),gk=(e,t,n,o)=>{const r=e.selection.getRng(),s=t?1:-1;return!(!Ed()||!((e,t,n)=>{const o=Ya.fromRangeStart(t);return yc(!e,n).exists((e=>e.isEqual(o)))})(t,r,n)||(TC(s,e,n,!t,!1).each((t=>{Gw(e,t)})),0))},pk=(e,t,n)=>{const o=((e,t)=>{const n=t.getNode(e);return Co(n)&&"TABLE"===n.nodeName?M.some(n):M.none()})(!!t,n),r=!1===t;o.fold((()=>Gw(e,n.toRange())),(o=>yc(r,e.getBody()).filter((e=>e.isEqual(n))).fold((()=>Gw(e,n.toRange())),(n=>((e,t,n)=>{const o=ji(t);t.undoManager.transact((()=>{const r=un(o);Wt(r,Vi(t)),Zn(r,un("br")),e?Qn(fn(n),r):Xn(fn(n),r);const s=t.dom.createRng();s.setStart(r.dom,0),s.setEnd(r.dom,0),Gw(t,s)}))})(t,e,o)))))},hk=(e,t,n,o)=>{const r=e.selection.getRng(),s=Ya.fromRangeStart(r),a=e.getBody();if(!t&&mk(o,s)){const o=((e,t,n)=>((e,t)=>ie(t.getClientRects()).bind((t=>dk(e,t.left,t.top))).bind((e=>{return Aw(kc(n=e).map((e=>Ow(n,e).positions.concat(e))).getOr([]),t);var n})))(t,n).orThunk((()=>ie(n.getClientRects()).bind((n=>Rw(Bw(e,Ya.before(t)),n.left))))).getOr(Ya.before(t)))(a,n,s);return pk(e,t,o),!0}if(t&&fk(o,s)){const o=((e,t,n)=>((e,t)=>le(t.getClientRects()).bind((t=>ck(e,t.left,t.top))).bind((e=>{return Aw(xc(n=e).map((e=>[e].concat(Tw(n,e).positions))).getOr([]),t);var n})))(t,n).orThunk((()=>ie(n.getClientRects()).bind((n=>Rw(Dw(e,Ya.after(t)),n.left))))).getOr(Ya.after(t)))(a,n,s);return pk(e,t,o),!0}return!1},bk=(e,t,n)=>M.from(e.dom.getParent(e.selection.getNode(),"td,th")).bind((o=>M.from(e.dom.getParent(o,"table")).map((r=>n(e,t,r,o))))).getOr(!1),vk=(e,t)=>bk(e,t,gk),yk=(e,t)=>bk(e,t,hk),Ck=(e,t,n)=>n.fold(M.none,M.none,((e,t)=>{return(n=t,((e,t)=>{const n=e=>{for(let o=0;o<e.childNodes.length;o++){const r=fn(e.childNodes[o]);if(t(r))return M.some(r);const s=n(e.childNodes[o]);if(s.isSome())return s}return M.none()};return n(e.dom)})(n,Of)).map((e=>(e=>{const t=pm.exact(e,0,e,0);return Cm(t)})(e)));var n}),(n=>(e.execCommand("mceTableInsertRowAfter"),wk(e,t,n)))),wk=(e,t,n)=>{return Ck(e,t,(r=ak,sk(o=n,void 0).fold((()=>tk.none(o)),(e=>rk(e.all,o,e.index,1,r)))));var o,r},xk=(e,t,n)=>{return Ck(e,t,(r=ak,sk(o=n,void 0).fold((()=>tk.none()),(e=>rk(e.all,o,e.index,-1,r)))));var o,r},kk=(e,t)=>{const n=["table","li","dl"],o=fn(e.getBody()),r=e=>{const t=Mt(e);return vn(e,o)||j(n,t)},s=e.selection.getRng();return((e,t)=>((e,t,n=P)=>n(t)?M.none():j(e,Mt(t))?M.some(t):Wo(t,e.join(","),(e=>hn(e,"table")||n(e))))(["td","th"],e,t))(fn(t?s.endContainer:s.startContainer),r).map((n=>(ok(n,r).each((t=>{e.model.table.clearSelectedCells(t.dom)})),e.selection.collapse(!t),(t?wk:xk)(e,r,n).each((t=>{e.selection.setRng(t)})),!0))).getOr(!1)},Sk=(e,t)=>({container:e,offset:t}),_k=Hs.DOM,Ek=e=>t=>e===t?-1:0,Nk=(e,t,n)=>{if(Ro(e)&&t>=0)return M.some(Sk(e,t));{const o=Ca(_k);return M.from(o.backwards(e,t,Ek(e),n)).map((e=>Sk(e.container,e.container.data.length)))}},Rk=(e,t,n)=>{if(!Ro(e))return M.none();const o=e.textContent;if(t>=0&&t<=o.length)return M.some(Sk(e,t));{const o=Ca(_k);return M.from(o.backwards(e,t,Ek(e),n)).bind((e=>{const o=e.container.data;return Rk(e.container,t+o.length,n)}))}},Ak=(e,t,n)=>{if(!Ro(e))return M.none();const o=e.textContent;if(t<=o.length)return M.some(Sk(e,t));{const r=Ca(_k);return M.from(r.forwards(e,t,Ek(e),n)).bind((e=>Ak(e.container,t-o.length,n)))}},Ok=(e,t,n,o,r)=>{const s=Ca(e,(e=>t=>e.isBlock(t)||j(["BR","IMG","HR","INPUT"],t.nodeName)||"false"===e.getContentEditable(t))(e));return M.from(s.backwards(t,n,o,r))},Tk=e=>e.toString().replace(/\u00A0/g," ").replace(/\uFEFF/g,""),Bk=e=>""!==e&&-1!==" \xa0\f\n\r\t\v".indexOf(e),Dk=(e,t)=>e.substring(t.length),Pk=(e,t,n,o=0)=>{return(r=fn(t.startContainer),Go(r,Tf)).fold((()=>((e,t,n,o=0)=>{if(!(r=t).collapsed||3!==r.startContainer.nodeType)return M.none();var r;const s=e.getParent(t.startContainer,e.isBlock)||e.getRoot();return Ok(e,t.startContainer,t.startOffset,((e,t,o)=>((e,t,n)=>{let o;for(o=t-1;o>=0;o--){const t=e.charAt(o);if(Bk(t))return M.none();if(t===n)break}return M.some(o)})(o,t,n).getOr(t)),s).bind((e=>{const r=t.cloneRange();if(r.setStart(e.container,e.offset),r.setEnd(t.endContainer,t.endOffset),r.collapsed)return M.none();const s=Tk(r);return 0!==s.lastIndexOf(n)||Dk(s,n).length<o?M.none():M.some({text:Dk(s,n),range:r,triggerChar:n})}))})(e,t,n,o)),(t=>{const o=e.createRng();o.selectNode(t.dom);const r=Tk(o);return M.some({range:o,text:Dk(r,n),triggerChar:n})}));var r},Lk=e=>{if((e=>3===e.nodeType)(e))return Sk(e,e.data.length);{const t=e.childNodes;return t.length>0?Lk(t[t.length-1]):Sk(e,t.length)}},Mk=(e,t)=>{const n=e.childNodes;return n.length>0&&t<n.length?Mk(n[t],0):n.length>0&&(e=>1===e.nodeType)(e)&&n.length===t?Lk(n[n.length-1]):Sk(e,t)},Ik=(e,t,n,o={})=>{const r=t(),s=e.selection.getRng().startContainer.nodeValue,a=K(r.lookupByChar(n.triggerChar),(t=>n.text.length>=t.minChars&&t.matches.getOrThunk((()=>(e=>t=>{const n=Mk(t.startContainer,t.startOffset);return!((e,t)=>{const n=e.getParent(t.container,e.isBlock);return Ok(e,t.container,t.offset,((e,t)=>0===t?-1:t),n).filter((e=>{const t=e.container.data.charAt(e.offset-1);return!Bk(t)})).isSome()})(e,n)})(e.dom)))(n.range,s,n.text)));if(0===a.length)return M.none();const i=Promise.all(H(a,(e=>e.fetch(n.text,e.maxResults,o).then((t=>({matchText:n.text,items:t,columns:e.columns,onAction:e.onAction,highlightOn:e.highlightOn}))))));return M.some({lookupData:i,context:n})};var Fk;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(Fk||(Fk={}));const Uk=(e,t,n)=>e.stype===Fk.Error?t(e.serror):n(e.svalue),zk=e=>({stype:Fk.Value,svalue:e}),jk=e=>({stype:Fk.Error,serror:e}),Vk=Uk,Hk=e=>f(e)&&ue(e).length>100?" removed due to size":JSON.stringify(e,null,2),$k=(e,t)=>jk([{path:e,getErrorInfo:t}]),qk=(e,t)=>({extract:(n,o)=>we(o,e).fold((()=>((e,t)=>$k(e,(()=>'Choice schema did not contain choice key: "'+t+'"')))(n,e)),(e=>((e,t,n,o)=>we(n,o).fold((()=>((e,t,n)=>$k(e,(()=>'The chosen schema: "'+n+'" did not exist in branches: '+Hk(t))))(e,n,o)),(n=>n.extract(e.concat(["branch: "+o]),t))))(n,o,t,e))),toString:()=>"chooseOn("+e+"). Possible values: "+ue(t)}),Wk=e=>(...t)=>{if(0===t.length)throw new Error("Can't merge zero objects");const n={};for(let o=0;o<t.length;o++){const r=t[o];for(const t in r)xe(r,t)&&(n[t]=e(n[t],r[t]))}return n},Kk=Wk(((e,t)=>g(e)&&g(t)?Kk(e,t):t)),Gk=(Wk(((e,t)=>t)),e=>({tag:"defaultedThunk",process:N(e)})),Yk=e=>{const t=(e=>{const t=[],n=[];return $(e,(e=>{Uk(e,(e=>n.push(e)),(e=>t.push(e)))})),{values:t,errors:n}})(e);return t.errors.length>0?(n=t.errors,_(jk,Z)(n)):zk(t.values);var n},Xk=(e,t,n)=>{switch(e.tag){case"field":return t(e.key,e.newKey,e.presence,e.prop);case"custom":return n(e.newKey,e.instantiator)}},Qk=e=>({extract:(t,n)=>{return o=e(n),r=e=>((e,t)=>$k(e,N(t)))(t,e),o.stype===Fk.Error?r(o.serror):o;var o,r},toString:N("val")}),Jk=Qk(zk),Zk=(e,t,n,o)=>o(we(e,t).getOrThunk((()=>n(e)))),eS=(e,t,n,o,r)=>{const s=e=>r.extract(t.concat([o]),e),a=e=>e.fold((()=>zk(M.none())),(e=>{const n=r.extract(t.concat([o]),e);return s=n,a=M.some,s.stype===Fk.Value?{stype:Fk.Value,svalue:a(s.svalue)}:s;var s,a}));switch(e.tag){case"required":return((e,t,n,o)=>we(t,n).fold((()=>((e,t,n)=>$k(e,(()=>'Could not find valid *required* value for "'+t+'" in '+Hk(n))))(e,n,t)),o))(t,n,o,s);case"defaultedThunk":return Zk(n,o,e.process,s);case"option":return((e,t,n)=>n(we(e,t)))(n,o,a);case"defaultedOptionThunk":return((e,t,n,o)=>o(we(e,t).map((t=>!0===t?n(e):t))))(n,o,e.process,a);case"mergeWithThunk":return Zk(n,o,N({}),(t=>{const o=Kk(e.process(n),t);return s(o)}))}},tS=e=>({extract:(t,n)=>((e,t,n)=>{const o={},r=[];for(const s of n)Xk(s,((n,s,a,i)=>{const l=eS(a,e,t,n,i);Vk(l,(e=>{r.push(...e)}),(e=>{o[s]=e}))}),((e,n)=>{o[e]=n(t)}));return r.length>0?jk(r):zk(o)})(t,n,e),toString:()=>{const t=H(e,(e=>Xk(e,((e,t,n,o)=>e+" -> "+o.toString()),((e,t)=>"state("+e+")"))));return"obj{\n"+t.join("\n")+"}"}}),nS=e=>({extract:(t,n)=>{const o=H(n,((n,o)=>e.extract(t.concat(["["+o+"]"]),n)));return Yk(o)},toString:()=>"array("+e.toString()+")"}),oS=(e,t,n)=>{return o=((e,t,n)=>((e,t)=>e.stype===Fk.Error?{stype:Fk.Error,serror:t(e.serror)}:e)(t.extract([e],n),(e=>({input:n,errors:e}))))(e,t,n),Uk(o,yi.error,yi.value);var o},rS=(e,t)=>qk(e,ge(t,tS)),sS=N(Jk),aS=(e,t)=>Qk((n=>{const o=typeof n;return e(n)?zk(n):jk(`Expected type: ${t} but got: ${o}`)})),iS=aS(x,"number"),lS=aS(m,"string"),dS=aS(b,"boolean"),cS=aS(w,"function"),uS=(e,t,n,o)=>({tag:"field",key:e,newKey:t,presence:n,prop:o}),mS=(e,t)=>({tag:"custom",newKey:e,instantiator:t}),fS=(e,t)=>uS(e,e,{tag:"required",process:{}},t),gS=e=>fS(e,lS),pS=e=>fS(e,cS),hS=(e,t)=>uS(e,e,{tag:"option",process:{}},t),bS=e=>hS(e,lS),vS=(e,t,n)=>uS(e,e,Gk(t),n),yS=(e,t)=>vS(e,t,iS),CS=(e,t,n)=>vS(e,t,(e=>{return t=t=>j(e,t)?yi.value(t):yi.error(`Unsupported value: "${t}", choose one of "${e.join(", ")}".`),Qk((e=>t(e).fold(jk,zk)));var t})(n)),wS=(e,t)=>vS(e,t,dS),xS=(e,t)=>vS(e,t,cS),kS=gS("type"),SS=pS("fetch"),_S=pS("onAction"),ES=xS("onSetup",(()=>S)),NS=bS("text"),RS=bS("icon"),AS=bS("tooltip"),OS=bS("label"),TS=wS("active",!1),BS=wS("enabled",!0),DS=wS("primary",!1),PS=e=>((e,t)=>vS("type",t,lS))(0,e),LS=tS([kS,gS("ch"),yS("minChars",1),(1,((e,t)=>uS(e,e,Gk(1),sS()))("columns")),yS("maxResults",10),("matches",hS("matches",cS)),SS,_S,(MS=lS,vS("highlightOn",[],nS(MS)))]);var MS;const IS=[BS,AS,RS,NS,ES],FS=[TS].concat(IS),US=[xS("predicate",P),CS("scope","node",["node","editor"]),CS("position","selection",["node","selection","line"])],zS=IS.concat([PS("contextformbutton"),DS,_S,mS("original",R)]),jS=FS.concat([PS("contextformbutton"),DS,_S,mS("original",R)]),VS=IS.concat([PS("contextformbutton")]),HS=FS.concat([PS("contextformtogglebutton")]),$S=rS("type",{contextformbutton:zS,contextformtogglebutton:jS});tS([PS("contextform"),xS("initValue",N("")),OS,((e,t)=>uS(e,e,{tag:"required",process:{}},nS(t)))("commands",$S),hS("launch",rS("type",{contextformbutton:VS,contextformtogglebutton:HS}))].concat(US));const qS=e=>{const t=e.ui.registry.getAll().popups,n=ge(t,(e=>{return(t=e,oS("Autocompleter",LS,t)).fold((e=>{throw new Error("Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:N("... (only showing first ten failures)")}]):e;return H(t,(e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo()))})((t=e).errors).join("\n")+"\n\nInput object: "+Hk(t.input));var t}),R);var t})),o=Se(ye(n,(e=>e.ch))),r=Ce(n);return{dataset:n,triggerChars:o,lookupByChar:e=>K(r,(t=>t.ch===e))}},WS=e=>{const t=Js(),n=Ws(!1),o=t.isSet,r=()=>{o()&&((e=>{cy(e).autocompleter.removeDecoration()})(e),(e=>{e.dispatch("AutocompleterEnd")})(e),n.set(!1),t.clear())},s=De((()=>qS(e))),a=a=>{(n=>t.get().map((t=>Pk(e.dom,e.selection.getRng(),t.triggerChar).bind((t=>Ik(e,s,t,n))))).getOrThunk((()=>((e,t)=>{const n=t(),o=e.selection.getRng();return((e,t,n)=>ce(n.triggerChars,(n=>Pk(e,t,n))))(e.dom,o,n).bind((n=>Ik(e,t,n)))})(e,s))))(a).fold(r,(s=>{(n=>{o()||(((e,t)=>{cy(e).autocompleter.addDecoration(t)})(e,n.range),t.set({triggerChar:n.triggerChar,matchLength:n.text.length}))})(s.context),s.lookupData.then((o=>{t.get().map((a=>{const i=s.context;a.triggerChar===i.triggerChar&&(i.text.length-a.matchLength>=10?r():(t.set({...a,matchLength:i.text.length}),n.get()?((e,t)=>{e.dispatch("AutocompleterUpdate",t)})(e,{lookupData:o}):(n.set(!0),((e,t)=>{e.dispatch("AutocompleterStart",t)})(e,{lookupData:o}))))}))}))}))};e.addCommand("mceAutocompleterReload",((e,t)=>{const n=f(t)?t.fetchOptions:{};a(n)})),e.addCommand("mceAutocompleterClose",r),((e,t)=>{const n=ea(t.load,50);e.on("keypress compositionend",(e=>{27!==e.which&&n.throttle()})),e.on("keydown",(e=>{const o=e.which;8===o?n.throttle():27===o&&t.cancelIfNecessary()})),e.on("remove",n.cancel)})(e,{cancelIfNecessary:r,load:a})},KS=e=>(t,n,o={})=>{const r=t.getBody(),s={bubbles:!0,composed:!0,data:null,isComposing:!1,detail:0,view:null,target:r,currentTarget:r,eventPhase:Event.AT_TARGET,originalTarget:r,explicitOriginalTarget:r,isTrusted:!1,srcElement:r,cancelable:!1,preventDefault:S,inputType:n},a=Ns(new InputEvent(e));return t.dispatch(e,{...a,...s,...o})},GS=KS("input"),YS=KS("beforeinput"),XS=(e,t)=>{let n,o=t;const r=e.dom,s=e.schema.getMoveCaretBeforeOnEnterElements();if(!t)return;if(/^(LI|DT|DD)$/.test(t.nodeName)){const e=(e=>{for(;e;){if(1===e.nodeType||3===e.nodeType&&e.data&&/[\r\n\s]/.test(e.data))return e;e=e.nextSibling}})(t.firstChild);e&&/^(UL|OL|DL)$/.test(e.nodeName)&&t.insertBefore(r.doc.createTextNode(fr),t.firstChild)}const a=r.createRng();if(t.normalize(),t.hasChildNodes()){const e=new Qo(t,t);for(;n=e.current();){if(Ro(n)){a.setStart(n,0),a.setEnd(n,0);break}if(s[n.nodeName.toLowerCase()]){a.setStartBefore(n),a.setEndBefore(n);break}o=n,n=e.next()}n||(a.setStart(o,0),a.setEnd(o,0))}else Po(t)?t.nextSibling&&r.isBlock(t.nextSibling)?(a.setStartBefore(t),a.setEndBefore(t)):(a.setStartAfter(t),a.setEndAfter(t)):(a.setStart(t,0),a.setEnd(t,0));e.selection.setRng(a),ef(e,a)},QS=e=>M.from(e.dom.getParent(e.selection.getStart(!0),e.dom.isBlock)),JS=(e,t)=>e&&e.parentNode&&e.parentNode.nodeName===t,ZS=e=>e&&/^(OL|UL|LI)$/.test(e.nodeName),e_=e=>{const t=e.parentNode;return/^(LI|DT|DD)$/.test(t.nodeName)?t:e},t_=(e,t,n)=>{let o=e[n?"firstChild":"lastChild"];for(;o&&!Co(o);)o=o[n?"nextSibling":"previousSibling"];return o===t},n_=(e,t)=>t&&"A"===t.nodeName&&e.isEmpty(t),o_=e=>{e.innerHTML='<br data-mce-bogus="1">'},r_=(e,t)=>e.nodeName===t||e.previousSibling&&e.previousSibling.nodeName===t,s_=(e,t)=>t&&e.isBlock(t)&&!/^(TD|TH|CAPTION|FORM)$/.test(t.nodeName)&&!/^(fixed|absolute)/i.test(t.style.position)&&"true"!==e.getContentEditable(t),a_=(e,t,n)=>!1===Ro(t)?n:e?1===n&&t.data.charAt(n-1)===pr?0:n:n===t.data.length-1&&t.data.charAt(n)===pr?t.data.length:n,i_=(e,t)=>{const n=e.getRoot();let o,r;for(o=t;o!==n&&"false"!==e.getContentEditable(o);)"true"===e.getContentEditable(o)&&(r=o),o=o.parentNode;return o!==n?r:n},l_=(e,t)=>{ji(e).toLowerCase()===t.tagName.toLowerCase()&&((e,t,n)=>{const o=e.dom;M.from(n.style).map(o.parseStyle).each((e=>{const n={...Gn(fn(t)),...e};o.setStyles(t,n)}));const r=M.from(n.class).map((e=>e.split(/\s+/))),s=M.from(t.className).map((e=>K(e.split(/\s+/),(e=>""!==e))));Pt(r,s,((e,n)=>{const r=K(n,(t=>!j(e,t))),s=[...e,...r];o.setAttrib(t,"class",s.join(" "))}));const a=["style","class"],i=ve(n,((e,t)=>!j(a,t)));o.setAttribs(t,i)})(e,t,Vi(e))},d_={insert:(e,t)=>{let n,o,r,s,a,i,l,d,c;const u=e.dom,f=e.schema,g=f.getNonEmptyElements(),p=e.selection.getRng(),h=ji(e),b=t=>{let n,r,a,i=o;const l=f.getTextInlineElements();if(n=t||"TABLE"===d||"HR"===d?u.create(t||h):s.cloneNode(!1),a=n,!1===Wi(e))u.setAttrib(n,"style",null),u.setAttrib(n,"class",null);else do{if(l[i.nodeName]){if(_c(i)||Fc(i))continue;r=i.cloneNode(!1),u.setAttrib(r,"id",""),n.hasChildNodes()?(r.appendChild(n.firstChild),n.appendChild(r)):(a=r,n.appendChild(r))}}while((i=i.parentNode)&&i!==k);return l_(e,n),o_(a),n},v=e=>{let t,n;const a=a_(e,o,r);if(Ro(o)&&(e?a>0:a<o.nodeValue.length))return!1;if(o.parentNode===s&&c&&!e)return!0;if(e&&Co(o)&&o===s.firstChild)return!0;if(r_(o,"TABLE")||r_(o,"HR"))return c&&!e||!c&&e;const i=new Qo(o,s);for(Ro(o)&&(e&&0===a?i.prev():e||a!==o.nodeValue.length||i.next());t=i.current();){if(Co(t)){if(!t.getAttribute("data-mce-bogus")&&(n=t.nodeName.toLowerCase(),g[n]&&"br"!==n))return!1}else if(Ro(t)&&!Vr(t.nodeValue))return!1;e?i.prev():i.next()}return!0},C=()=>{a=/^(H[1-6]|PRE|FIGURE)$/.test(d)&&"HGROUP"!==S?b(h):b(),((e,t)=>{const n=Ki(e);return!y(t)&&(m(n)?j(Bt.explode(n),t.nodeName.toLowerCase()):n)})(e,l)&&s_(u,l)&&u.isEmpty(s)?a=u.split(l,s):u.insertAfter(a,s),XS(e,a)};Tm(u,p).each((e=>{p.setStart(e.startContainer,e.startOffset),p.setEnd(e.endContainer,e.endOffset)})),o=p.startContainer,r=p.startOffset;const w=!(!t||!t.shiftKey),x=!(!t||!t.ctrlKey);Co(o)&&o.hasChildNodes()&&(c=r>o.childNodes.length-1,o=o.childNodes[Math.min(r,o.childNodes.length-1)]||o,r=c&&Ro(o)?o.nodeValue.length:0);const k=i_(u,o);if(!k)return;w||(o=((e,t,n,o,r)=>{let s,a,i,l,d,c;const u=e.dom,m=i_(u,o);if(a=u.getParent(o,u.isBlock),!a||!s_(u,a)){if(a=a||m,c=a===e.getBody()||(e=>e&&/^(TD|TH|CAPTION)$/.test(e.nodeName))(a)?a.nodeName.toLowerCase():a.parentNode.nodeName.toLowerCase(),!a.hasChildNodes())return s=u.create(t),l_(e,s),a.appendChild(s),n.setStart(s,0),n.setEnd(s,0),s;for(l=o;l.parentNode!==a;)l=l.parentNode;for(;l&&!u.isBlock(l);)i=l,l=l.previousSibling;if(i&&e.schema.isValidChild(c,t.toLowerCase())){for(s=u.create(t),l_(e,s),i.parentNode.insertBefore(s,i),l=i;l&&!u.isBlock(l);)d=l.nextSibling,s.appendChild(l),l=d;n.setStart(o,r),n.setEnd(o,r)}}return o})(e,h,p,o,r)),s=u.getParent(o,u.isBlock),l=s?u.getParent(s.parentNode,u.isBlock):null,d=s?s.nodeName.toUpperCase():"";const S=l?l.nodeName.toUpperCase():"";"LI"!==S||x||(s=l,l=l.parentNode,d=S),/^(LI|DT|DD)$/.test(d)&&u.isEmpty(s)?((e,t,n,o,r)=>{const s=e.dom,a=e.selection.getRng();if(n===e.getBody())return;var i;ZS(i=n)&&ZS(i.parentNode)&&(r="LI");let l=t(r);if(t_(n,o,!0)&&t_(n,o,!1))if(JS(n,"LI")){const e=e_(n);s.insertAfter(l,e),(e=>{var t;return(null===(t=e.parentNode)||void 0===t?void 0:t.firstChild)===e})(n)?s.remove(e):s.remove(n)}else s.replace(l,n);else if(t_(n,o,!0))JS(n,"LI")?(s.insertAfter(l,e_(n)),l.appendChild(s.doc.createTextNode(" ")),l.appendChild(n)):n.parentNode.insertBefore(l,n),s.remove(o);else if(t_(n,o,!1))s.insertAfter(l,e_(n)),s.remove(o);else{n=e_(n);const e=a.cloneRange();e.setStartAfter(o),e.setEndAfter(n);const t=e.extractContents();"LI"===r&&((e,t)=>e.firstChild&&"LI"===e.firstChild.nodeName)(t)?(l=t.firstChild,s.insertAfter(t,n)):(s.insertAfter(t,n),s.insertAfter(l,n)),s.remove(o)}XS(e,l)})(e,b,l,s,h):s!==e.getBody()&&(Cr(s)?(a=Rr(s),u.isEmpty(s)&&o_(s),l_(e,a),XS(e,a)):v()?C():v(!0)?(a=s.parentNode.insertBefore(b(),s),XS(e,r_(s,"HR")?a:s)):(n=(e=>{const t=e.cloneRange();return t.setStart(e.startContainer,a_(!0,e.startContainer,e.startOffset)),t.setEnd(e.endContainer,a_(!1,e.endContainer,e.endOffset)),t})(p).cloneRange(),n.setEndAfter(s),i=n.extractContents(),(e=>{$(ta(fn(e),zt),(e=>{const t=e.dom;t.nodeValue=br(t.nodeValue)}))})(i),(e=>{do{Ro(e)&&(e.nodeValue=e.nodeValue.replace(/^[\r\n]+/,"")),e=e.firstChild}while(e)})(i),a=i.firstChild,u.insertAfter(i,s),((e,t,n)=>{let o=n;const r=[];let s;if(o){for(;o=o.firstChild;){if(e.isBlock(o))return;Co(o)&&!t[o.nodeName.toLowerCase()]&&r.push(o)}for(s=r.length;s--;)o=r[s],(!o.hasChildNodes()||o.firstChild===o.lastChild&&""===o.firstChild.nodeValue||n_(e,o))&&e.remove(o)}})(u,g,a),((e,t)=>{t.normalize();const n=t.lastChild;n&&!/^(left|right)$/gi.test(e.getStyle(n,"float",!0))||e.add(t,"br")})(u,s),u.isEmpty(s)&&o_(s),a.normalize(),u.isEmpty(a)?(u.remove(a),C()):(l_(e,a),XS(e,a))),u.setAttrib(a,"id",""),e.dispatch("NewBlock",{newBlock:a}))},fakeEventName:"insertParagraph"},c_=(e,t,n)=>{const o=e.dom.createRng();n?(o.setStartBefore(t),o.setEndBefore(t)):(o.setStartAfter(t),o.setEndAfter(t)),e.selection.setRng(o),ef(e,o)},u_=(e,t)=>{const n=un("br");Xn(fn(t),n),e.undoManager.add()},m_=(e,t)=>{f_(e.getBody(),t)||Qn(fn(t),un("br"));const n=un("br");Qn(fn(t),n),c_(e,n.dom,!1),e.undoManager.add()},f_=(e,t)=>{return n=Ya.after(t),!!Po(n.getNode())||Cc(e,Ya.after(t)).map((e=>Po(e.getNode()))).getOr(!1);var n},g_=e=>e&&"A"===e.nodeName&&"href"in e,p_=e=>e.fold(P,g_,g_,P),h_=(e,t)=>{t.fold(S,O(u_,e),O(m_,e),S)},b_={insert:(e,t)=>{const n=(e=>{const t=O(tp,e),n=Ya.fromRangeStart(e.selection.getRng());return fw(t,e.getBody(),n).filter(p_)})(e);n.isSome()?n.each(O(h_,e)):((e,t)=>{const n=e.selection,o=e.dom,r=n.getRng();let s,a;Tm(o,r).each((e=>{r.setStart(e.startContainer,e.startOffset),r.setEnd(e.endContainer,e.endOffset)}));let i=r.startOffset,l=r.startContainer;if(1===l.nodeType&&l.hasChildNodes()){const e=i>l.childNodes.length-1;l=l.childNodes[Math.min(i,l.childNodes.length-1)]||l,i=e&&3===l.nodeType?l.nodeValue.length:0}let d=o.getParent(l,o.isBlock);const c=d?o.getParent(d.parentNode,o.isBlock):null,u=c?c.nodeName.toUpperCase():"",m=!(!t||!t.ctrlKey);"LI"!==u||m||(d=c),l&&3===l.nodeType&&i>=l.nodeValue.length&&(((e,t,n)=>{const o=new Qo(t,n);let r;const s=e.getNonEmptyElements();for(;r=o.next();)if(s[r.nodeName.toLowerCase()]||r.length>0)return!0})(e.schema,l,d)||(s=o.create("br"),r.insertNode(s),r.setStartAfter(s),r.setEndAfter(s),a=!0)),s=o.create("br"),Qa(o,r,s),c_(e,s,a),e.undoManager.add()})(e,t)},fakeEventName:"insertLineBreak"},v_=(e,t)=>QS(e).filter((e=>t.length>0&&hn(fn(e),t))).isSome(),y_=Ci([{br:[]},{block:[]},{none:[]}]),C_=(e,t)=>(e=>v_(e,qi(e)))(e),w_=e=>(t,n)=>(e=>QS(e).filter((e=>sr(fn(e)))).isSome())(t)===e,x_=(e,t)=>(n,o)=>{const r=(e=>QS(e).fold(N(""),(e=>e.nodeName.toUpperCase())))(n)===e.toUpperCase();return r===t},k_=e=>x_("pre",e),S_=e=>(t,n)=>zi(t)===e,__=(e,t)=>(e=>v_(e,$i(e)))(e),E_=(e,t)=>t,N_=e=>{const t=ji(e),n=((e,t)=>{const n=e.getRoot();let o,r;for(o=t;o!==n&&"false"!==e.getContentEditable(o);)"true"===e.getContentEditable(o)&&(r=o),o=o.parentNode;return o!==n?r:n})(e.dom,e.selection.getStart());return n&&e.schema.isValidChild(n.nodeName,t)},R_=(e,t)=>(n,o)=>Y(e,((e,t)=>e&&t(n,o)),!0)?M.some(t):M.none(),A_=(e,t,n)=>{t.selection.isCollapsed()||ip(t),C(n)&&YS(t,e.fakeEventName).isDefaultPrevented()||(e.insert(t,n),C(n)&&GS(t,e.fakeEventName))},O_=(e,t)=>{const n=()=>A_(b_,e,t),o=()=>A_(d_,e,t),r=((e,t)=>ow([R_([C_],y_.none()),R_([x_("summary",!0)],y_.br()),R_([k_(!0),S_(!1),E_],y_.br()),R_([k_(!0),S_(!1)],y_.block()),R_([k_(!0),S_(!0),E_],y_.block()),R_([k_(!0),S_(!0)],y_.br()),R_([w_(!0),E_],y_.br()),R_([w_(!0)],y_.block()),R_([__],y_.br()),R_([E_],y_.br()),R_([N_],y_.block())],[e,!(!t||!t.shiftKey)]).getOr(y_.none()))(e,t);switch(Hi(e)){case"linebreak":r.fold(n,n,S);break;case"block":r.fold(o,o,S);break;case"invert":r.fold(o,n,S);break;default:r.fold(n,o,S)}},T_=Ct(),B_=e=>e.stopImmediatePropagation(),D_=e=>e.keyCode===em.PAGE_UP||e.keyCode===em.PAGE_DOWN,P_=(e,t,n)=>{n&&!e.get()?t.on("NodeChange",B_,!0):!n&&e.get()&&t.off("NodeChange",B_),e.set(n)},L_=(e,t)=>{const n=t.container(),o=t.offset();return Ro(n)?(n.insertData(o,e),M.some(Ya(n,o+e.length))):Jd(t).map((n=>{const o=mn(e);return t.isAtEnd()?Qn(n,o):Xn(n,o),Ya(o.dom,e.length)}))},M_=O(L_,fr),I_=O(L_," "),F_=(e,t)=>n=>((e,t)=>!Lg(t)&&(((e,t)=>((e,t)=>wc(e.dom,t).isNone())(e,t)||((e,t)=>Cc(e.dom,t).isNone())(e,t)||wg(e,t)||xg(e,t)||Rg(e,t)||Ng(e,t))(e,t)||Dg(e,t)||Pg(e,t)))(e,n)?M_(t):I_(t),U_=e=>{const t=Ya.fromRangeStart(e.selection.getRng()),n=fn(e.getBody());if(e.selection.isCollapsed()){const o=O(tp,e),r=Ya.fromRangeStart(e.selection.getRng());return fw(o,e.getBody(),r).bind((e=>t=>t.fold((t=>wc(e.dom,Ya.before(t))),(e=>xc(e)),(e=>kc(e)),(t=>Cc(e.dom,Ya.after(t)))))(n)).map((o=>()=>F_(n,t)(o).each((e=>t=>(e.selection.setRng(t.toRange()),e.nodeChanged(),!0))(e))))}return M.none()},z_=e=>md(e)?[{keyCode:em.TAB,action:Gx(kk,e,!0)},{keyCode:em.TAB,shiftKey:!0,action:Gx(kk,e,!1)}]:[],j_=e=>{if(e.addShortcut("Meta+P","","mcePrint"),WS(e),ly(e))return Ws(null);{const t=ax(e);return(e=>{e.on("keyup compositionstart",O(Mx,e))})(e),((e,t)=>{e.on("keydown",(n=>{!1===n.isDefaultPrevented()&&((e,t,n)=>{const o=Nt.os.isMacOS()||Nt.os.isiOS();Yx([{keyCode:em.RIGHT,action:Gx(Ux,e,!0)},{keyCode:em.LEFT,action:Gx(Ux,e,!1)},{keyCode:em.UP,action:Gx(zx,e,!1)},{keyCode:em.DOWN,action:Gx(zx,e,!0)},...o?[{keyCode:em.UP,action:Gx(Vx,e,!1),metaKey:!0,shiftKey:!0},{keyCode:em.DOWN,action:Gx(Vx,e,!0),metaKey:!0,shiftKey:!0}]:[],{keyCode:em.RIGHT,action:Gx(vk,e,!0)},{keyCode:em.LEFT,action:Gx(vk,e,!1)},{keyCode:em.UP,action:Gx(yk,e,!1)},{keyCode:em.DOWN,action:Gx(yk,e,!0)},{keyCode:em.RIGHT,action:Gx(Qx,e,!0)},{keyCode:em.LEFT,action:Gx(Qx,e,!1)},{keyCode:em.UP,action:Gx(Jx,e,!1)},{keyCode:em.DOWN,action:Gx(Jx,e,!0)},{keyCode:em.RIGHT,action:Gx(rx,e,t,!0)},{keyCode:em.LEFT,action:Gx(rx,e,t,!1)},{keyCode:em.RIGHT,ctrlKey:!o,altKey:o,action:Gx(ix,e,t)},{keyCode:em.LEFT,ctrlKey:!o,altKey:o,action:Gx(lx,e,t)},{keyCode:em.UP,action:Gx(qx,e,!1)},{keyCode:em.DOWN,action:Gx(qx,e,!0)}],n).each((e=>{n.preventDefault()}))})(e,t,n)}))})(e,t),((e,t)=>{e.on("keydown",(n=>{!1===n.isDefaultPrevented()&&((e,t,n)=>{const o=n.keyCode===em.BACKSPACE?"deleteContentBackward":"deleteContentForward";Xx([{keyCode:em.BACKSPACE,action:Gx(_x,e)},{keyCode:em.BACKSPACE,action:Gx(qC,e,!1)},{keyCode:em.DELETE,action:Gx(qC,e,!0)},{keyCode:em.BACKSPACE,action:Gx(IC,e,!1)},{keyCode:em.DELETE,action:Gx(IC,e,!0)},{keyCode:em.BACKSPACE,action:Gx(mx,e,t,!1)},{keyCode:em.DELETE,action:Gx(mx,e,t,!0)},{keyCode:em.BACKSPACE,action:Gx(Ip,e,!1)},{keyCode:em.DELETE,action:Gx(Ip,e,!0)},{keyCode:em.BACKSPACE,action:Gx(WC,e,!1)},{keyCode:em.DELETE,action:Gx(WC,e,!0)},{keyCode:em.BACKSPACE,action:Gx(bx,e,!1)},{keyCode:em.DELETE,action:Gx(bx,e,!0)},{keyCode:em.BACKSPACE,action:Gx(RC,e,!1)},{keyCode:em.DELETE,action:Gx(RC,e,!0)},{keyCode:em.BACKSPACE,action:Gx(_C,e,!1)},{keyCode:em.DELETE,action:Gx(_C,e,!0)},{keyCode:em.BACKSPACE,action:Gx(px,e,!1)},{keyCode:em.DELETE,action:Gx(px,e,!0)}],n).each((t=>{n.preventDefault(),YS(e,o).isDefaultPrevented()||(t(),GS(e,o))}))})(e,t,n)})),e.on("keyup",(t=>{!1===t.isDefaultPrevented()&&((e,t)=>{Yx([{keyCode:em.BACKSPACE,action:Gx($C,e)},{keyCode:em.DELETE,action:Gx($C,e)}],t)})(e,t)}))})(e,t),(e=>{e.on("keydown",(t=>{t.keyCode===em.ENTER&&((e,t)=>{var n;t.isDefaultPrevented()||(t.preventDefault(),(n=e.undoManager).typing&&(n.typing=!1,n.add()),e.undoManager.transact((()=>{O_(e,t)})))})(e,t)}))})(e),(e=>{e.on("keydown",(t=>{!1===t.isDefaultPrevented()&&((e,t)=>{Xx([{keyCode:em.SPACEBAR,action:Gx(U_,e)}],t).each((n=>{t.preventDefault(),YS(e,"insertText",{data:" "}).isDefaultPrevented()||(n(),GS(e,"insertText",{data:" "}))}))})(e,t)}))})(e),(e=>{e.on("input",(t=>{!1===t.isComposing&&(e=>{const t=fn(e.getBody());e.selection.isCollapsed()&&jg(t,Ya.fromRangeStart(e.selection.getRng())).each((t=>{e.selection.setRng(t.toRange())}))})(e)}))})(e),(e=>{e.on("keydown",(t=>{!1===t.isDefaultPrevented()&&((e,t)=>{Yx([...z_(e)],t).each((e=>{t.preventDefault()}))})(e,t)}))})(e),((e,t)=>{e.on("keydown",(n=>{!1===n.isDefaultPrevented()&&((e,t,n)=>{const o=Nt.os.isMacOS()||Nt.os.isiOS();Yx([{keyCode:em.END,action:Gx(jx,e,!0)},{keyCode:em.HOME,action:Gx(jx,e,!1)},...o?[]:[{keyCode:em.HOME,action:Gx(Vx,e,!1),ctrlKey:!0,shiftKey:!0},{keyCode:em.END,action:Gx(Vx,e,!0),ctrlKey:!0,shiftKey:!0}],{keyCode:em.END,action:Gx(Zx,e,!0)},{keyCode:em.HOME,action:Gx(Zx,e,!1)},{keyCode:em.END,action:Gx(dx,e,!0,t)},{keyCode:em.HOME,action:Gx(dx,e,!1,t)}],n).each((e=>{n.preventDefault()}))})(e,t,n)}))})(e,t),((e,t)=>{if(T_.os.isMacOS())return;const n=Ws(!1);e.on("keydown",(t=>{D_(t)&&P_(n,e,!0)})),e.on("keyup",(o=>{!1===o.isDefaultPrevented()&&((e,t,n)=>{Yx([{keyCode:em.PAGE_UP,action:Gx(dx,e,!1,t)},{keyCode:em.PAGE_DOWN,action:Gx(dx,e,!0,t)}],n)})(e,t,o),D_(o)&&n.get()&&(P_(n,e,!1),e.nodeChanged())}))})(e,t),t}};class V_{constructor(e){let t;this.lastPath=[],this.editor=e;const n=this;"onselectionchange"in e.getDoc()||e.on("NodeChange click mouseup keyup focus",(n=>{const o=e.selection.getRng(),r={startContainer:o.startContainer,startOffset:o.startOffset,endContainer:o.endContainer,endOffset:o.endOffset};"nodechange"!==n.type&&xm(r,t)||e.dispatch("SelectionChange"),t=r})),e.on("contextmenu",(()=>{e.dispatch("SelectionChange")})),e.on("SelectionChange",(()=>{const t=e.selection.getStart(!0);t&&Lu(e)&&!n.isSameElementPath(t)&&e.dom.isChildOf(t,e.getBody())&&e.nodeChanged({selectionChange:!0})})),e.on("mouseup",(t=>{!t.isDefaultPrevented()&&Lu(e)&&("IMG"===e.selection.getNode().nodeName?gf.setEditorTimeout(e,(()=>{e.nodeChanged()})):e.nodeChanged())}))}nodeChanged(e){const t=this.editor.selection;let n,o,r;this.editor.initialized&&t&&!Pl(this.editor)&&!this.editor.mode.isReadOnly()&&(r=this.editor.getBody(),n=t.getStart(!0)||r,n.ownerDocument===this.editor.getDoc()&&this.editor.dom.isChildOf(n,r)||(n=r),o=[],this.editor.dom.getParent(n,(e=>{if(e===r)return!0;o.push(e)})),(e=e||{}).element=n,e.parents=o,this.editor.dispatch("NodeChange",e))}isSameElementPath(e){let t;const n=this.editor,o=ne(n.dom.getParents(e,L,n.getBody()));if(o.length===this.lastPath.length){for(t=o.length;t>=0&&o[t]===this.lastPath[t];t--);if(-1===t)return this.lastPath=o,!0}return this.lastPath=o,!1}}const H_=N("x-tinymce/html"),$_="\x3c!-- x-tinymce/html --\x3e",q_=e=>$_+e,W_=e=>-1!==e.indexOf($_),K_="%MCEPASTEBIN%",G_=e=>e.dom.get("mcepastebin"),Y_=e=>e&&"mcepastebin"===e.id,X_=e=>e===K_,Q_=(e,t)=>(Bt.each(t,(t=>{e=u(t,RegExp)?e.replace(t,""):e.replace(t[0],t[1])})),e),J_=e=>Q_(e,[/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/gi,/<!--StartFragment-->|<!--EndFragment-->/g,[/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,(e,t,n)=>t||n?fr:" "],/<br class="Apple-interchange-newline">/g,/<br>$/i]),Z_=(e,t)=>({content:e,cancelled:t}),eE=(e,t)=>(e.insertContent(t,{merge:nd(e),paste:!0}),!0),tE=e=>/^https?:\/\/[\w\-\/+=.,!;:&%@^~(){}?#]+$/i.test(e),nE=(e,t,n)=>!(e.selection.isCollapsed()||!tE(t))&&((e,t,n)=>(e.undoManager.extra((()=>{n(e,t)}),(()=>{e.execCommand("mceInsertLink",!1,t)})),!0))(e,t,n),oE=(e,t,n)=>!!((e,t)=>tE(t)&&V(ud(e),(e=>je(t.toLowerCase(),`.${e.toLowerCase()}`))))(e,t)&&((e,t,n)=>(e.undoManager.extra((()=>{n(e,t)}),(()=>{e.insertContent('<img src="'+t+'">')})),!0))(e,t,n),rE=(e=>{let t=0;return()=>"mceclip"+t++})(),sE=(e,t,n,o)=>{const r=((e,t,n)=>((e,t,n)=>{const o=((e,t,n)=>e.dispatch("PastePreProcess",{content:t,internal:n}))(e,t,n),r=((e,t)=>{const n=Av({},e.schema);n.addNodeFilter("meta",(e=>{Bt.each(e,(e=>{e.remove()}))}));const o=n.parse(t,{forced_root_block:!1,isRootContent:!0});return Kf({validate:!0},e.schema).serialize(o)})(e,o.content);return e.hasEventListeners("PastePostProcess")&&!o.isDefaultPrevented()?((e,t,n)=>{const o=e.dom.create("div",{style:"display:none"},t),r=((e,t,n)=>e.dispatch("PastePostProcess",{node:t,internal:n}))(e,o,n);return Z_(r.node.innerHTML,r.isDefaultPrevented())})(e,r,n):Z_(r,o.isDefaultPrevented())})(e,t,n))(e,t,n);!1===r.cancelled&&((e,t,n)=>{n||!od(e)?eE(e,t):((e,t)=>{Bt.each([nE,oE,eE],(n=>!0!==n(e,t,eE)))})(e,t)})(e,r.content,o)},aE=(e,t,n)=>{const o=n||W_(t);sE(e,(e=>e.replace($_,""))(t),o,!1)},iE=(e,t)=>{const n=e.dom.encode(t).replace(/\r\n/g,"\n"),o=((e,t,n)=>{const o=e.split(/\n\n/),r=((e,t)=>{let n="<"+e;const o=ye(t,((e,t)=>t+'="'+ms.encodeAllRaw(e)+'"'));return o.length&&(n+=" "+o.join(" ")),n+">"})(t,n),s="</"+t+">",a=H(o,(e=>e.split(/\n/).join("<br />")));return 1===a.length?a[0]:H(a,(e=>r+e+s)).join("")})($r(n,sd(e)),ji(e),Vi(e));sE(e,o,!1,!0)},lE=e=>{const t={};if(e&&e.types)for(let n=0;n<e.types.length;n++){const o=e.types[n];try{t[o]=e.getData(o)}catch(e){t[o]=""}}return t},dE=(e,t)=>t in e&&e[t].length>0,cE=e=>dE(e,"text/html")||dE(e,"text/plain"),uE=(e,t,n)=>{const o="paste"===t.type?t.clipboardData:t.dataTransfer;var r;if(Ql(e)&&o){const s=((e,t)=>{const n=t.items?ee(de(t.items),(e=>"file"===e.kind?[e.getAsFile()]:[])):[],o=t.files?de(t.files):[];return K(n.length>0?n:o,(e=>{const t=ud(e);return e=>ze(e.type,"image/")&&V(t,(t=>(e=>{const t=e.toLowerCase(),n={jpg:"jpeg",jpe:"jpeg",jfi:"jpeg",jif:"jpeg",jfif:"jpeg",pjpeg:"jpeg",pjp:"jpeg",svg:"svg+xml"};return Bt.hasOwn(n,t)?"image/"+n[t]:"image/"+t})(t)===e.type))})(e))})(e,o);if(s.length>0)return t.preventDefault(),(r=s,Promise.all(H(r,(e=>cv(e).then((t=>({file:e,uri:t}))))))).then((t=>{n&&e.selection.setRng(n),$(t,(t=>{((e,t)=>{lv(t.uri).each((({data:n,type:o,base64Encoded:r})=>{const s=r?n:btoa(n),a=t.file,i=e.editorUpload.blobCache,l=i.getByData(s,o),d=null!=l?l:((e,t,n,o)=>{const r=rE(),s=Yi(e)&&C(n.name),a=s?((e,t)=>{const n=t.match(/([\s\S]+?)(?:\.[a-z0-9.]+)$/i);return C(n)?e.dom.encode(n[1]):null})(e,n.name):r,i=s?n.name:void 0,l=t.create(r,n,o,a,i);return t.add(l),l})(e,i,a,s);aE(e,`<img src="${d.blobUri()}">`,!1)}))})(e,t)}))})),!0}return!1},mE=(e,t,n,o)=>{let r=J_(n);const s=dE(t,H_())||W_(n),a=!s&&(e=>!/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(e))(r),i=tE(r);(X_(r)||!r.length||a&&!i)&&(o=!0),(o||i)&&(r=dE(t,"text/plain")&&a?t["text/plain"]:(e=>{const t=Ss(),n=Av({},t);let o="";const r=t.getVoidElements(),s=Bt.makeMap("script noscript style textarea video audio iframe object"," "),a=t.getBlockElements(),i=e=>{const n=e.name,l=e;if("br"!==n){if("wbr"!==n)if(r[n]&&(o+=" "),s[n])o+=" ";else{if(3===e.type&&(o+=e.value),!(e.name in t.getVoidElements())&&(e=e.firstChild))do{i(e)}while(e=e.next);a[n]&&l.next&&(o+="\n","p"===n&&(o+="\n"))}}else o+="\n"};return e=Q_(e,[/<!\[[^\]]+\]>/g]),i(n.parse(e)),o})(r)),X_(r)||(o?iE(e,r):aE(e,r,s))},fE=(e,t,n)=>{((e,t,n)=>{let o;e.on("keydown",(e=>{(e=>em.metaKeyPressed(e)&&86===e.keyCode||e.shiftKey&&45===e.keyCode)(e)&&!e.isDefaultPrevented()&&(o=e.shiftKey&&86===e.keyCode)})),e.on("paste",(r=>{if(r.isDefaultPrevented()||(e=>{var t,n;return Nt.os.isAndroid()&&0===(null===(n=null===(t=e.clipboardData)||void 0===t?void 0:t.items)||void 0===n?void 0:n.length)})(r))return;const s="text"===n.get()||o;o=!1;const a=lE(r.clipboardData);!cE(a)&&uE(e,r,t.getLastRng()||e.selection.getRng())||(dE(a,"text/html")?(r.preventDefault(),mE(e,a,a["text/html"],s)):(t.create(),gf.setEditorTimeout(e,(()=>{const n=t.getHtml();t.remove(),mE(e,a,n,s)}),0)))}))})(e,t,n),(e=>{const t=e=>ze(e,"webkit-fake-url"),n=e=>ze(e,"data:");e.parser.addNodeFilter("img",((o,r,s)=>{if(!Ql(e)&&(e=>{var t;return!0===(null===(t=e.data)||void 0===t?void 0:t.paste)})(s))for(const r of o){const o=r.attr("src");m(o)&&!r.attr("data-mce-object")&&o!==Nt.transparentSrc&&(t(o)||!ad(e)&&n(o))&&r.remove()}}))})(e)},gE=(e,t,n,o)=>{((e,t,n)=>{try{return e.clearData(),e.setData("text/html",t),e.setData("text/plain",n),e.setData(H_(),t),!0}catch(e){return!1}})(e.clipboardData,t.html,t.text)?(e.preventDefault(),o()):n(t.html,o)},pE=e=>(t,n)=>{const{dom:o,selection:r}=e,s=o.create("div",{contenteditable:"false","data-mce-bogus":"all"}),a=o.create("div",{contenteditable:"true"},t);o.setStyles(s,{position:"fixed",top:"0",left:"-3000px",width:"1000px",overflow:"hidden"}),s.appendChild(a),o.add(e.getBody(),s);const i=r.getRng();a.focus();const l=o.createRng();l.selectNodeContents(a),r.setRng(l),gf.setEditorTimeout(e,(()=>{r.setRng(i),o.remove(s),n()}),0)},hE=e=>({html:q_(e.selection.getContent({contextual:!0})),text:e.selection.getContent({format:"text"})}),bE=e=>!e.selection.isCollapsed()||(e=>!!e.dom.getParent(e.selection.getStart(),"td[data-mce-selected],th[data-mce-selected]",e.getBody()))(e),vE=(e,t)=>{var n,o;return Pm.getCaretRangeFromPoint(null!==(n=t.clientX)&&void 0!==n?n:0,null!==(o=t.clientY)&&void 0!==o?o:0,e.getDoc())},yE=(e,t)=>{e.focus(),t&&e.selection.setRng(t)},CE=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,wE=e=>Bt.trim(e).replace(CE,Gc).toLowerCase(),xE=(e,t,n)=>{const o=ed(e);if(n||"all"===o||!td(e))return t;const r=o?o.split(/[, ]/):[];if(r&&"none"!==o){const n=e.dom,o=e.selection.getNode();t=t.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,((e,t,s,a)=>{const i=n.parseStyle(n.decode(s)),l={};for(let e=0;e<r.length;e++){const t=i[r[e]];let s=t,a=n.getStyle(o,r[e],!0);/color/.test(r[e])&&(s=wE(s),a=wE(a)),a!==s&&(l[r[e]]=t)}const d=n.serializeStyle(l,"span");return d?t+' style="'+d+'"'+a:t+a}))}else t=t.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,"$1$3");return t=t.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi,((e,t,n,o)=>t+' style="'+n+'"'+o)),t},kE=e=>{const t=Ws(!1),n=Ws(rd(e)?"text":"html"),o=(e=>{const t=Ws(null);return{create:()=>((e,t)=>{const{dom:n,selection:o}=e,r=e.getBody();t.set(o.getRng());const s=n.add(e.getBody(),"div",{id:"mcepastebin",class:"mce-pastebin",contentEditable:!0,"data-mce-bogus":"all",style:"position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0"},K_);Nt.browser.isFirefox()&&n.setStyle(s,"left","rtl"===n.getStyle(r,"direction",!0)?65535:-65535),n.bind(s,"beforedeactivate focusin focusout",(e=>{e.stopPropagation()})),s.focus(),o.select(s,!0)})(e,t),remove:()=>((e,t)=>{const n=e.dom;if(G_(e)){let o;const r=t.get();for(;o=G_(e);)n.remove(o),n.unbind(o);r&&e.selection.setRng(r)}t.set(null)})(e,t),getEl:()=>G_(e),getHtml:()=>(e=>{const t=e.dom,n=(e,n)=>{e.appendChild(n),t.remove(n,!0)},[o,...r]=K(e.getBody().childNodes,Y_);$(r,(e=>{n(o,e)}));const s=t.select("div[id=mcepastebin]",o);for(let e=s.length-1;e>=0;e--){const r=t.create("div");o.insertBefore(r,s[e]),n(r,s[e])}return o?o.innerHTML:""})(e),getLastRng:t.get}})(e);(e=>{(Nt.browser.isChromium()||Nt.browser.isSafari())&&((e,t)=>{e.on("PastePreProcess",(n=>{n.content=t(e,n.content,n.internal)}))})(e,xE)})(e),((e,t)=>{e.addCommand("mceTogglePlainTextPaste",(()=>{((e,t)=>{"text"===t.get()?(t.set("html"),Zu(e,!1)):(t.set("text"),Zu(e,!0)),e.focus()})(e,t)})),e.addCommand("mceInsertClipboardContent",((t,n)=>{n.html&&aE(e,n.html,n.internal),n.text&&iE(e,n.text)}))})(e,n),(e=>{const t=t=>n=>{t(e,n)},n=Jl(e);w(n)&&e.on("PastePreProcess",t(n));const o=Zl(e);w(o)&&e.on("PastePostProcess",t(o))})(e),e.on("PreInit",(()=>{(e=>{e.on("cut",(e=>t=>{!t.isDefaultPrevented()&&bE(e)&&gE(t,hE(e),pE(e),(()=>{if(Nt.browser.isChromium()||Nt.browser.isFirefox()){const t=e.selection.getRng();gf.setEditorTimeout(e,(()=>{e.selection.setRng(t),e.execCommand("Delete")}),0)}else e.execCommand("Delete")}))})(e)),e.on("copy",(e=>t=>{!t.isDefaultPrevented()&&bE(e)&&gE(t,hE(e),pE(e),S)})(e))})(e),((e,t)=>{Xl(e)&&e.on("dragend dragover draggesture dragdrop drop drag",(e=>{e.preventDefault(),e.stopPropagation()})),Ql(e)||e.on("drop",(e=>{const t=e.dataTransfer;t&&(e=>V(e.files,(e=>/^image\//.test(e.type))))(t)&&e.preventDefault()})),e.on("drop",(n=>{if(n.isDefaultPrevented()||t.get())return;const o=vE(e,n);if(y(o))return;const r=lE(n.dataTransfer),s=dE(r,H_());if((!cE(r)||(e=>{const t=e["text/plain"];return!!t&&0===t.indexOf("file://")})(r))&&uE(e,n,o))return;const a=r[H_()],i=a||r["text/html"]||r["text/plain"];i&&(n.preventDefault(),gf.setEditorTimeout(e,(()=>{e.undoManager.transact((()=>{a&&e.execCommand("Delete"),yE(e,o);const t=J_(i);r["text/html"]?aE(e,t,s):iE(e,t)}))})))})),e.on("dragstart",(e=>{t.set(!0)})),e.on("dragover dragend",(n=>{Ql(e)&&!1===t.get()&&(n.preventDefault(),yE(e,vE(e,n))),"dragend"===n.type&&t.set(!1)}))})(e,t),fE(e,o,n)}))},SE=Po,_E=Ro,EE=e=>Io(e.dom),NE=e=>t=>vn(fn(e),t),RE=(e,t)=>qo(fn(e),EE,NE(t)),AE=(e,t,n)=>{const o=new Qo(e,t),r=n?o.next.bind(o):o.prev.bind(o);let s=e;for(let t=n?e:r();t&&!SE(t);t=r())Fr(t)&&(s=t);return s},OE=e=>{const t=((e,t)=>{const n=Ya.fromRangeStart(e).getNode(),o=((e,t)=>qo(fn(e),(e=>(e=>Mo(e.dom))(e)||er(e)),NE(t)).getOr(fn(t)).dom)(n,t),r=AE(n,o,!1),s=AE(n,o,!0),a=document.createRange();return RE(r,o).fold((()=>{_E(r)?a.setStart(r,0):a.setStartBefore(r)}),(e=>a.setStartBefore(e.dom))),RE(s,o).fold((()=>{_E(s)?a.setEnd(s,s.data.length):a.setEndAfter(s)}),(e=>a.setEndAfter(e.dom))),a})(e.selection.getRng(),e.getBody());e.selection.setRng(Gp(t))};var TE;!function(e){e.Before="before",e.After="after"}(TE||(TE={}));const BE=(e,t)=>Math.abs(e.left-t),DE=(e,t)=>Math.abs(e.right-t),PE=(e,t)=>(e=>Y(e,((e,t)=>e.fold((()=>M.some(t)),(e=>{const n=Math.min(t.left,e.left),o=Math.min(t.top,e.top),r=Math.max(t.right,e.right),s=Math.max(t.bottom,e.bottom);return M.some({top:o,right:r,bottom:s,left:n,width:r-n,height:s-o})}))),M.none()))(K(e,(e=>{return(n=t)>=(o=e).top&&n<=o.bottom;var n,o}))).fold((()=>[[],e]),(t=>{const{pass:n,fail:o}=W(e,(e=>((e,t)=>{const n=((e,t)=>Math.max(0,Math.min(e.bottom,t.bottom)-Math.max(e.top,t.top)))(e,t)/Math.min(e.height,t.height);return((e,t)=>e.top<t.bottom&&e.bottom>t.top)(e,t)&&n>.5})(e,t)));return[n,o]})),LE=(e,t,n)=>t>e.left&&t<e.right?0:Math.min(Math.abs(e.left-t),Math.abs(e.right-t)),ME=(e,t,n)=>{const o=e=>Fr(e.node)?M.some(e):Co(e.node)?ME(de(e.node.childNodes),t,n):M.none(),r=(e,r)=>{const s=se(e,((e,o)=>r(e,t,n)-r(o,t,n)));return((e,r)=>{if(e.length>=2){const s=o(e[0]).getOr(e[0]),a=o(e[1]).getOr(e[1]);if(Math.abs(r(s,t,n)-r(a,t,n))<2){if(Ro(s.node))return M.some(s);if(Ro(a.node))return M.some(a)}}return M.none()})(s,r).orThunk((()=>ce(s,o)))},[s,a]=PE(jw(e),n),{pass:i,fail:l}=W(a,(e=>e.top<n));return r(s,LE).orThunk((()=>r(l,Na))).orThunk((()=>r(i,Na)))},IE=(e,t,n)=>((e,t,n)=>{const o=fn(e),r=wn(o),s=gn(r,t,n).filter((e=>yn(o,e))).getOr(o);return((e,t,n,o)=>{const r=(t,s)=>s.fold((()=>ME(de(t.dom.childNodes),n,o)),(e=>{const r=K(de(t.dom.childNodes),(t=>t!==e.dom));return ME(r,n,o)})).orThunk((()=>{var n;return(vn(t,e)?M.none():(n=t,M.from(n.dom.parentElement).map(fn))).bind((e=>r(e,M.some(t))))}));return r(t,M.none())})(o,s,t,n)})(e,t,n).filter((e=>Rd(e.node))).map((e=>((e,t)=>({node:e.node,position:BE(e,t)<DE(e,t)?TE.Before:TE.After}))(e,t))),FE=e=>{const t=e.getBoundingClientRect(),n=e.ownerDocument,o=n.documentElement,r=n.defaultView;return{top:t.top+r.pageYOffset-o.clientTop,left:t.left+r.pageXOffset-o.clientLeft}},UE=Io,zE=Mo,jE=(e,t,n,o)=>{const r=e.dom,s=t.cloneNode(!0);r.setStyles(s,{width:n,height:o}),r.setAttrib(s,"data-mce-selected",null);const a=r.create("div",{class:"mce-drag-container","data-mce-bogus":"all",unselectable:"on",contenteditable:"false"});return r.setStyles(a,{position:"absolute",opacity:.5,overflow:"hidden",border:0,padding:0,margin:0,width:n,height:o}),r.setStyles(s,{margin:0,boxSizing:"border-box"}),a.appendChild(s),a},VE=e=>{e&&e.parentNode&&e.parentNode.removeChild(e)},HE=e=>{e.on((e=>{VE(e.ghost)})),e.clear()},$E=e=>{const t=Js(),n=Hs.DOM,o=document,r=((e,t)=>n=>{if((e=>0===e.button)(n)){const s=Q(t.dom.getParents(n.target),((...e)=>t=>{for(let n=0;n<e.length;n++)if(e[n](t))return!0;return!1})(UE,zE)).getOr(null);if(o=t.getBody(),UE(r=s)&&r!==o){const o=t.dom.getPos(s),r=t.getBody(),a=t.getDoc().documentElement;e.set({element:s,dragging:!1,screenX:n.screenX,screenY:n.screenY,maxX:(t.inline?r.scrollWidth:a.offsetWidth)-2,maxY:(t.inline?r.scrollHeight:a.offsetHeight)-2,relX:n.pageX-o.x,relY:n.pageY-o.y,width:s.offsetWidth,height:s.offsetHeight,ghost:jE(t,s,s.offsetWidth,s.offsetHeight)})}}var o,r})(t,e),s=((e,t)=>{const n=Zs(((e,n)=>{t._selectionOverrides.hideFakeCaret(),t.selection.placeCaretAt(e,n)}),0);return t.on("remove",n.cancel),o=>e.on((e=>{const r=Math.max(Math.abs(o.screenX-e.screenX),Math.abs(o.screenY-e.screenY));if(!e.dragging&&r>10){if(t.dispatch("dragstart",{target:e.element}).isDefaultPrevented())return;e.dragging=!0,t.focus()}if(e.dragging){const r=((e,t)=>({pageX:t.pageX-e.relX,pageY:t.pageY+5}))(e,((e,t)=>{return n=(e=>e.inline?FE(e.getBody()):{left:0,top:0})(e),o=(e=>{const t=e.getBody();return e.inline?{left:t.scrollLeft,top:t.scrollTop}:{left:0,top:0}})(e),r=((e,t)=>{if(t.target.ownerDocument!==e.getDoc()){const n=FE(e.getContentAreaContainer()),o=(e=>{const t=e.getBody(),n=e.getDoc().documentElement,o={left:t.scrollLeft,top:t.scrollTop},r={left:t.scrollLeft||n.scrollLeft,top:t.scrollTop||n.scrollTop};return e.inline?o:r})(e);return{left:t.pageX-n.left+o.left,top:t.pageY-n.top+o.top}}return{left:t.pageX,top:t.pageY}})(e,t),{pageX:r.left-n.left+o.left,pageY:r.top-n.top+o.top};var n,o,r})(t,o));s=e.ghost,a=t.getBody(),s.parentNode!==a&&a.appendChild(s),((e,t,n,o,r,s)=>{let a=0,i=0;e.style.left=t.pageX+"px",e.style.top=t.pageY+"px",t.pageX+n>r&&(a=t.pageX+n-r),t.pageY+o>s&&(i=t.pageY+o-s),e.style.width=n-a+"px",e.style.height=o-i+"px"})(e.ghost,r,e.width,e.height,e.maxX,e.maxY),n.throttle(o.clientX,o.clientY)}var s,a}))})(t,e),a=((e,t)=>n=>{e.on((e=>{if(e.dragging){if(((e,t,n)=>t!==n&&!e.dom.isChildOf(t,n)&&!UE(t))(t,(e=>{const t=e.getSel().getRangeAt(0).startContainer;return 3===t.nodeType?t.parentNode:t})(t.selection),e.element)){const o=(e=>{const t=e.cloneNode(!0);return t.removeAttribute("data-mce-selected"),t})(e.element);t.dispatch("drop",{clientX:n.clientX,clientY:n.clientY}).isDefaultPrevented()||t.undoManager.transact((()=>{VE(e.element),t.insertContent(t.dom.getOuterHTML(o)),t._selectionOverrides.hideFakeCaret()}))}t.dispatch("dragend")}})),HE(e)})(t,e),i=((e,t)=>()=>{e.on((e=>{e.dragging&&t.dispatch("dragend")})),HE(e)})(t,e);e.on("mousedown",r),e.on("mousemove",s),e.on("mouseup",a),n.bind(o,"mousemove",s),n.bind(o,"mouseup",i),e.on("remove",(()=>{n.unbind(o,"mousemove",s),n.unbind(o,"mouseup",i)})),e.on("keydown",(e=>{e.keyCode===em.ESC&&i()}))},qE=Io,WE=(e,t)=>Fp(e.getBody(),t),KE=e=>{const t=e.selection,n=e.dom,o=n.isBlock,r=e.getBody(),s=_d(e,r,o,(()=>xf(e))),a="sel-"+n.uniqueId(),i="data-mce-selected";let l;const d=e=>e!==r&&(qE(e)||Uo(e))&&n.isChildOf(e,r),c=(n,o,r,a=!0)=>e.dispatch("ShowCaret",{target:o,direction:n,before:r}).isDefaultPrevented()?null:(a&&t.scrollIntoView(o,-1===n),s.show(r,o)),u=e=>xr(e)||Er(e)||Nr(e),m=e=>u(e.startContainer)||u(e.endContainer),f=t=>{const o=e.schema.getVoidElements(),r=n.createRng(),s=t.startContainer,a=t.startOffset,i=t.endContainer,l=t.endOffset;return xe(o,s.nodeName.toLowerCase())?0===a?r.setStartBefore(s):r.setStartAfter(s):r.setStart(s,a),xe(o,i.nodeName.toLowerCase())?0===l?r.setEndBefore(i):r.setEndAfter(i):r.setEnd(i,l),r},g=(o,s)=>{if(!o)return null;if(o.collapsed){if(!m(o)){const e=s?1:-1,t=Qd(e,r,o),n=t.getNode(!s);if(Rd(n))return c(e,n,!!s&&!t.isAtEnd(),!1);const a=t.getNode(s);if(Rd(a))return c(e,a,!s&&!t.isAtEnd(),!1)}return null}let u=o.startContainer,f=o.startOffset;const g=o.endOffset;if(3===u.nodeType&&0===f&&qE(u.parentNode)&&(u=u.parentNode,f=n.nodeIndex(u),u=u.parentNode),1!==u.nodeType)return null;if(g===f+1&&u===o.endContainer){const o=u.childNodes[f];if(d(o))return(o=>{const r=o.cloneNode(!0),s=e.dispatch("ObjectSelected",{target:o,targetClone:r});if(s.isDefaultPrevented())return null;const d=((o,r)=>{const s=fn(e.getBody()),i=e.getDoc(),l=Ko(s,"#"+a).getOrThunk((()=>{const e=cn('<div data-mce-bogus="all" class="mce-offscreen-selection"></div>',i);return qt(e,"id",a),Zn(s,e),e})),d=n.createRng();to(l),eo(l,[mn(fr,i),fn(r),mn(fr,i)]),d.setStart(l.dom.firstChild,1),d.setEnd(l.dom.lastChild,0),$n(l,{top:n.getPos(o,e.getBody()).y+"px"}),tf(l);const c=t.getSel();return c.removeAllRanges(),c.addRange(d),d})(o,s.targetClone),c=fn(o);return $(na(fn(e.getBody()),"*[data-mce-selected]"),(e=>{vn(c,e)||Xt(e,i)})),n.getAttrib(o,i)||o.setAttribute(i,"1"),l=o,h(),d})(o)}return null},p=()=>{l&&l.removeAttribute(i),Ko(fn(e.getBody()),"#"+a).each(no),l=null},h=()=>{s.hide()};return ly(e)||(e.on("click",(t=>{const n=WE(e,t.target);n&&qE(n)&&(t.preventDefault(),e.focus())})),e.on("blur NewBlock",p),e.on("ResizeWindow FullscreenStateChanged",s.reposition),e.on("tap",(t=>{const n=t.target,o=WE(e,n);qE(o)?(t.preventDefault(),BC(e,o).each(g)):d(n)&&BC(e,n).each(g)}),!0),e.on("mousedown",(o=>{const s=o.target;if(s!==r&&"HTML"!==s.nodeName&&!n.isChildOf(s,r))return;if(!1===((e,t,n)=>{const o=fn(e.getBody()),r=e.inline?o:fn(wn(o).dom.documentElement),s=((e,t,n,o)=>{const r=(e=>e.dom.getBoundingClientRect())(t);return{x:n-(e?r.left+t.dom.clientLeft+Py(t):0),y:o-(e?r.top+t.dom.clientTop+Dy(t):0)}})(e.inline,r,t,n);return((e,t,n)=>{const o=Ty(e),r=By(e);return t>=0&&n>=0&&t<=o&&n<=r})(r,s.x,s.y)})(e,o.clientX,o.clientY))return;p(),h();const a=WE(e,s);qE(a)?(o.preventDefault(),BC(e,a).each(g)):IE(r,o.clientX,o.clientY).each((n=>{var r;o.preventDefault(),(r=c(1,n.node,n.position===TE.Before,!1))&&t.setRng(r),Co(a)?a.focus():e.getBody().focus()}))})),e.on("keypress",(e=>{em.modifierPressed(e)||qE(t.getNode())&&e.preventDefault()})),e.on("GetSelectionRange",(e=>{let t=e.range;if(l){if(!l.parentNode)return void(l=null);t=t.cloneRange(),t.selectNode(l),e.range=t}})),e.on("SetSelectionRange",(e=>{e.range=f(e.range);const t=g(e.range,e.forward);t&&(e.range=t)})),e.on("AfterSetSelectionRange",(e=>{const t=e.range,o=t.startContainer.parentNode;var r;m(t)||"mcepastebin"===o.id||h(),r=o,n.hasClass(r,"mce-offscreen-selection")||p()})),(e=>{$E(e),Ul(e)&&(e=>{const t=t=>{if(!t.isDefaultPrevented()){const n=t.dataTransfer;n&&(j(n.types,"Files")||n.files.length>0)&&(t.preventDefault(),"drop"===t.type&&zy(e,"Dropped file type is not supported"))}},n=n=>{bf(e,n.target)&&t(n)},o=()=>{const o=Hs.DOM,r=e.dom,s=document,a=e.inline?e.getBody():e.getDoc(),i=["drop","dragover"];$(i,(e=>{o.bind(s,e,n),r.bind(a,e,t)})),e.on("remove",(()=>{$(i,(e=>{o.unbind(s,e,n),r.unbind(a,e,t)}))}))};e.on("init",(()=>{gf.setEditorTimeout(e,o,0)}))})(e)})(e),(e=>{const t=Zs((()=>{if(!e.removed&&e.getBody().contains(document.activeElement)){const t=e.selection.getRng();if(t.collapsed){const n=DC(e,t,!1);e.selection.setRng(n)}}}),0);e.on("focus",(()=>{t.throttle()})),e.on("blur",(()=>{t.cancel()}))})(e),(e=>{e.on("init",(()=>{e.on("focusin",(t=>{const n=t.target;if(Uo(n)){const t=Fp(e.getBody(),n),o=Io(t)?t:n;e.selection.getNode()!==o&&BC(e,o).each((t=>e.selection.setRng(t)))}}))}))})(e)),{showCaret:c,showBlockCaretContainer:e=>{e.hasAttribute("data-mce-caret")&&(Rr(e),t.scrollIntoView(e))},hideFakeCaret:h,destroy:()=>{s.destroy(),l=null}}},GE=(e,t,n)=>{if(Ro(t)&&(n<0||n>t.data.length))return[];const o=[n];let r=t;for(;r!==e&&r.parentNode;){const e=r.parentNode;for(let t=0;t<e.childNodes.length;t++)if(e.childNodes[t]===r){o.push(t);break}r=e}return r===e?o.reverse():[]},YE=(e,t,n,o,r)=>({start:GE(e,t,n),end:GE(e,o,r)}),XE=(e,t)=>{const n=t.slice(),o=n.pop();return Y(n,((e,t)=>e.bind((e=>M.from(e.childNodes[t])))),M.some(e)).bind((e=>Ro(e)&&(o<0||o>e.data.length)?M.none():M.some({node:e,offset:o})))},QE=(e,t)=>XE(e,t.start).bind((({node:n,offset:o})=>XE(e,t.end).map((({node:e,offset:t})=>{const r=document.createRange();return r.setStart(n,o),r.setEnd(e,t),r})))),JE=(e,t,n)=>{if(t&&e.isEmpty(t)&&!n(t)){const o=t.parentNode;e.remove(t),JE(e,o,n)}},ZE=(e,t,n,o=!0)=>{const r=t.startContainer.parentNode,s=t.endContainer.parentNode;t.deleteContents(),o&&!n(t.startContainer)&&(Ro(t.startContainer)&&0===t.startContainer.data.length&&e.remove(t.startContainer),Ro(t.endContainer)&&0===t.endContainer.data.length&&e.remove(t.endContainer),JE(e,r,n),r!==s&&JE(e,s,n))},eN=(e,t)=>M.from(e.dom.getParent(t.startContainer,e.dom.isBlock)),tN=(e,t,n)=>{((e,t,n)=>{if(Ro(e)&&0>=e.length)return M.some(Sk(e,0));{const t=Ca(_k);return M.from(t.forwards(e,0,Ek(e),n)).map((e=>Sk(e.container,0)))}})(t,0,t).each((o=>{const r=o.container;Ak(r,n.start.length,t).each((n=>{const o=e.createRng();o.setStart(r,0),o.setEnd(n.container,n.offset),ZE(e,o,(e=>e===t))}))}))},nN=(e,t)=>e.create("span",{"data-mce-type":"bookmark",id:t}),oN=(e,t)=>{const n=e.createRng();return n.setStartAfter(t.start),n.setEndBefore(t.end),n},rN=(e,t,n)=>{const o=QE(e.getRoot(),n).getOrDie("Unable to resolve path range"),r=o.startContainer,s=o.endContainer,a=0===o.endOffset?s:s.splitText(o.endOffset),i=0===o.startOffset?r:r.splitText(o.startOffset);return{prefix:t,end:a.parentNode.insertBefore(nN(e,t+"-end"),a),start:i.parentNode.insertBefore(nN(e,t+"-start"),i)}},sN=(e,t,n)=>{JE(e,e.get(t.prefix+"-end"),n),JE(e,e.get(t.prefix+"-start"),n)},aN=e=>0===e.start.length,iN=(e,t,n,o)=>{const r=t.start;var s;return Ok(e,o.container,o.offset,(s=r,(e,t)=>{const n=e.data.substring(0,t),o=n.lastIndexOf(s.charAt(s.length-1)),r=n.lastIndexOf(s);return-1!==r?r+s.length:-1!==o?o+1:-1}),n).bind((o=>{if(o.offset>=r.length){const t=e.createRng();return t.setStart(o.container,o.offset-r.length),t.setEnd(o.container,o.offset),M.some(t)}{const s=o.offset-r.length;return Rk(o.container,s,n).map((t=>{const n=e.createRng();return n.setStart(t.container,t.offset),n.setEnd(o.container,o.offset),n})).filter((e=>e.toString()===r)).orThunk((()=>iN(e,t,n,Sk(o.container,0))))}}))},lN=(e,t,n)=>{const o=e.dom,r=o.getRoot(),s=n.pattern,a=n.position.container,i=n.position.offset;return Rk(a,i-n.pattern.end.length,t).bind((l=>{const d=YE(r,l.container,l.offset,a,i);if(aN(s))return M.some({matches:[{pattern:s,startRng:d,endRng:d}],position:l});{const a=dN(e,n.remainingPatterns,l.container,l.offset,t),i=a.getOr({matches:[],position:l}),c=i.position,u=((e,t,n,o,r,s=!1)=>{if(0===t.start.length&&!s){const t=e.createRng();return t.setStart(n,o),t.setEnd(n,o),M.some(t)}return Nk(n,o,r).bind((n=>iN(e,t,r,n).bind((e=>{if(s){if(e.endContainer===n.container&&e.endOffset===n.offset)return M.none();if(0===n.offset&&e.endContainer.textContent.length===e.endOffset)return M.none()}return M.some(e)}))))})(o,s,c.container,c.offset,t,a.isNone());return u.map((e=>{const t=((e,t)=>YE(e,t.startContainer,t.startOffset,t.endContainer,t.endOffset))(r,e);return{matches:i.matches.concat([{pattern:s,startRng:t,endRng:d}]),position:Sk(e.startContainer,e.startOffset)}}))}}))},dN=(e,t,n,o,r)=>{const s=e.dom;return Nk(n,o,s.getRoot()).bind((a=>{const i=s.createRng();i.setStart(r,0),i.setEnd(n,o);const l=i.toString();for(let n=0;n<t.length;n++){const o=t[n];if(!je(l,o.end))continue;const s=t.slice();s.splice(n,1);const i=lN(e,r,{pattern:o,remainingPatterns:s,position:a});if(i.isSome())return i}return M.none()}))},cN=(e,t,n)=>{e.selection.setRng(n),"inline-format"===t.type?$(t.format,(t=>{e.formatter.apply(t)})):e.execCommand(t.cmd,!1,t.value)},uN=(e,t,n)=>{const o=e.selection.getRng();return!1===o.collapsed?[]:eN(e,o).bind((r=>{const s=Math.max(0,o.startOffset-(n?1:0));return dN(e,t,o.startContainer,s,r)})).fold((()=>[]),(e=>e.matches))},mN=(e,t)=>{if(0===t.length)return;const n=e.dom,o=e.selection.getBookmark(),r=((e,t)=>{const n=pa("mce_textpattern"),o=G(t,((t,o)=>{const r=rN(e,n+`_end${t.length}`,o.endRng);return t.concat([{...o,endMarker:r}])}),[]);return G(o,((t,r)=>{const s=o.length-t.length-1,a=aN(r.pattern)?r.endMarker:rN(e,n+`_start${s}`,r.startRng);return t.concat([{...r,startMarker:a}])}),[])})(n,t);$(r,(t=>{const o=n.getParent(t.startMarker.start,n.isBlock),r=e=>e===o;aN(t.pattern)?((e,t,n,o)=>{const r=oN(e.dom,n);ZE(e.dom,r,o),cN(e,t,r)})(e,t.pattern,t.endMarker,r):((e,t,n,o,r)=>{const s=e.dom,a=oN(s,o),i=oN(s,n);ZE(s,i,r),ZE(s,a,r);const l={prefix:n.prefix,start:n.end,end:o.start},d=oN(s,l);cN(e,t,d)})(e,t.pattern,t.startMarker,t.endMarker,r),sN(n,t.endMarker,r),sN(n,t.startMarker,r)})),e.selection.moveToBookmark(o)},fN=(e,t)=>{if(!e.selection.isCollapsed()||!(e=>e.inlinePatterns.length>0||e.blockPatterns.length>0)(t))return!1;const n=uN(e,t.inlinePatterns,!1),o=((e,t)=>{const n=e.dom,o=e.selection.getRng();return eN(e,o).filter((t=>{const o=ji(e),r=n.is(t,o);return null!==t&&r})).bind((e=>{const o=e.textContent,r=((e,t)=>{const n=t.replace(fr," ");return Q(e,(e=>0===t.indexOf(e.start)||0===n.indexOf(e.start)))})(t,o);return r.map((t=>Bt.trim(o).length===t.start.length?[]:[{pattern:t,range:YE(n.getRoot(),e,0,e,0)}]))})).getOr([])})(e,t.blockPatterns);return(o.length>0||n.length>0)&&(e.undoManager.add(),e.undoManager.extra((()=>{e.execCommand("mceInsertNewLine")}),(()=>{e.insertContent(mr),mN(e,n),((e,t)=>{if(0===t.length)return;const n=e.selection.getBookmark();$(t,(t=>((e,t)=>{const n=e.dom,o=t.pattern,r=QE(n.getRoot(),t.range).getOrDie("Unable to resolve path range");return eN(e,r).each((t=>{"block-format"===o.type?((e,t)=>{const n=t.get(e);return p(n)&&ie(n).exists((e=>xe(e,"block")))})(o.format,e.formatter)&&e.undoManager.transact((()=>{tN(e.dom,t,o),e.formatter.apply(o.format)})):"block-command"===o.type&&e.undoManager.transact((()=>{tN(e.dom,t,o),e.execCommand(o.cmd,!1,o.value)}))})),!0})(e,t))),e.selection.moveToBookmark(n)})(e,o);const t=e.selection.getRng(),r=Nk(t.startContainer,t.startOffset,e.dom.getRoot());e.execCommand("mceInsertNewLine"),r.each((t=>{const n=t.container;n.data.charAt(t.offset-1)===mr&&(n.deleteData(t.offset-1,1),JE(e.dom,n.parentNode,(t=>t===e.dom.getRoot())))}))})),!0)},gN=(e,t)=>{if(t.length>0){const n=uN(e,t,!0);n.length>0&&e.undoManager.transact((()=>{mN(e,n)}))}},pN=(e,t,n)=>{for(let o=0;o<e.length;o++)if(n(e[o],t))return!0;return!1},hN=e=>{const t=[",",".",";",":","!","?"],n=[32],o=()=>_i(id(e));e.on("keydown",(t=>{var n;13!==t.keyCode||em.modifierPressed(t)||fN(e,(n=id(e),{inlinePatterns:_i(n),blockPatterns:Si(n)}))&&t.preventDefault()}),!0),e.on("keyup",(t=>{pN(n,t,((e,t)=>e===t.keyCode&&!1===em.modifierPressed(t)))&&gN(e,o())})),e.on("keypress",(n=>{pN(t,n,((e,t)=>e.charCodeAt(0)===t.charCode))&&gf.setEditorTimeout(e,(()=>{gN(e,o())}))}))},bN=e=>{const t=Bt.each,n=em.BACKSPACE,o=em.DELETE,r=e.dom,s=e.selection,a=e.parser,i=Nt.browser,l=i.isFirefox(),d=i.isChromium()||i.isSafari(),c=Nt.deviceType.isiPhone()||Nt.deviceType.isiPad(),u=Nt.os.isMacOS()||Nt.os.isiOS(),m=(t,n)=>{try{e.getDoc().execCommand(t,!1,n)}catch(e){}},f=e=>e.isDefaultPrevented(),g=()=>{e.shortcuts.add("meta+a",null,"SelectAll")},p=()=>{e.inline||r.bind(e.getDoc(),"mousedown mouseup",(t=>{let n;if(t.target===e.getDoc().documentElement)if(n=s.getRng(),e.getBody().focus(),"mousedown"===t.type){if(xr(n.startContainer))return;s.placeCaretAt(t.clientX,t.clientY)}else s.setRng(n)}))},h=()=>{Range.prototype.getClientRects||e.on("mousedown",(t=>{if(!f(t)&&"HTML"===t.target.nodeName){const t=e.getBody();t.blur(),gf.setEditorTimeout(e,(()=>{t.focus()}))}}))},b=()=>{const t=Vl(e);e.on("click",(n=>{const o=n.target;/^(IMG|HR)$/.test(o.nodeName)&&"false"!==r.getContentEditableParent(o)&&(n.preventDefault(),e.selection.select(o),e.nodeChanged()),"A"===o.nodeName&&r.hasClass(o,t)&&0===o.childNodes.length&&(n.preventDefault(),s.select(o))}))},v=()=>{e.on("keydown",(e=>{if(!f(e)&&e.keyCode===n&&s.isCollapsed()&&0===s.getRng().startOffset){const t=s.getNode().previousSibling;if(t&&t.nodeName&&"table"===t.nodeName.toLowerCase())return e.preventDefault(),!1}}))},y=()=>{Ll(e)||e.on("BeforeExecCommand mousedown",(()=>{m("StyleWithCSS",!1),m("enableInlineTableEditing",!1),gl(e)||m("enableObjectResizing",!1)}))},C=()=>{e.contentStyles.push("img:-moz-broken {-moz-force-broken-image-icon:1;min-width:24px;min-height:24px}")},w=()=>{e.inline||e.on("keydown",(()=>{document.activeElement===document.body&&e.getWin().focus()}))},x=()=>{e.inline||(e.contentStyles.push("body {min-height: 150px}"),e.on("click",(t=>{let n;"HTML"===t.target.nodeName&&(n=e.selection.getRng(),e.getBody().focus(),e.selection.setRng(n),e.selection.normalize(),e.nodeChanged())})))},k=()=>{u&&e.on("keydown",(t=>{!em.metaKeyPressed(t)||t.shiftKey||37!==t.keyCode&&39!==t.keyCode||(t.preventDefault(),e.selection.getSel().modify("move",37===t.keyCode?"backward":"forward","lineboundary"))}))},_=()=>{e.on("click",(e=>{let t=e.target;do{if("A"===t.tagName)return void e.preventDefault()}while(t=t.parentNode)})),e.contentStyles.push(".mce-content-body {-webkit-touch-callout: none}")},E=()=>{e.on("init",(()=>{e.dom.bind(e.getBody(),"submit",(e=>{e.preventDefault()}))}))},N=S;return ly(e)?(d&&(p(),b(),E(),g(),c&&(w(),x(),_())),l&&(h(),y(),C(),k())):(e.on("keydown",(t=>{let n,o;if(f(t)||t.keyCode!==em.BACKSPACE)return;n=s.getRng();const a=n.startContainer,i=n.startOffset,l=r.getRoot();if(o=a,n.collapsed&&0===i){for(;o&&o.parentNode&&o.parentNode.firstChild===o&&o.parentNode!==l;)o=o.parentNode;"BLOCKQUOTE"===o.tagName&&(e.formatter.toggle("blockquote",null,o),n=r.createRng(),n.setStart(a,0),n.setEnd(a,0),s.setRng(n))}})),(()=>{const t=e=>{const t=r.create("body"),n=e.cloneContents();return t.appendChild(n),s.serializer.serialize(t,{format:"html"})};e.on("keydown",(s=>{const a=s.keyCode;let i,l;if(!f(s)&&(a===o||a===n)){if(i=e.selection.isCollapsed(),l=e.getBody(),i&&!r.isEmpty(l))return;if(!i&&!(n=>{const o=t(n),s=r.createRng();return s.selectNode(e.getBody()),o===t(s)})(e.selection.getRng()))return;s.preventDefault(),e.setContent(""),l.firstChild&&r.isBlock(l.firstChild)?e.selection.setCursorLocation(l.firstChild,0):e.selection.setCursorLocation(l,0),e.nodeChanged()}}))})(),Nt.windowsPhone||e.on("keyup focusin mouseup",(t=>{em.modifierPressed(t)||(e=>{const t=e.getBody(),n=e.selection.getRng();return n.startContainer===n.endContainer&&n.startContainer===t&&0===n.startOffset&&n.endOffset===t.childNodes.length})(e)||s.normalize()}),!0),d&&(p(),b(),e.on("init",(()=>{m("DefaultParagraphSeparator",ji(e))})),E(),v(),a.addNodeFilter("br",(e=>{let t=e.length;for(;t--;)"Apple-interchange-newline"===e[t].attr("class")&&e[t].remove()})),c?(w(),x(),_()):g()),l&&(e.on("keydown",(t=>{if(!f(t)&&t.keyCode===n){if(!e.getBody().getElementsByTagName("hr").length)return;if(s.isCollapsed()&&0===s.getRng().startOffset){const e=s.getNode(),n=e.previousSibling;if("HR"===e.nodeName)return r.remove(e),void t.preventDefault();n&&n.nodeName&&"hr"===n.nodeName.toLowerCase()&&(r.remove(n),t.preventDefault())}}})),h(),(()=>{const n=()=>{const n=r.getAttribs(s.getStart().cloneNode(!1));return()=>{const o=s.getStart();o!==e.getBody()&&(r.setAttrib(o,"style",null),t(n,(e=>{o.setAttributeNode(e.cloneNode(!0))})))}},o=()=>!s.isCollapsed()&&r.getParent(s.getStart(),r.isBlock)!==r.getParent(s.getEnd(),r.isBlock);e.on("keypress",(t=>{let r;if(!f(t)&&(8===t.keyCode||46===t.keyCode)&&o())return r=n(),e.getDoc().execCommand("delete",!1,null),r(),t.preventDefault(),!1})),r.bind(e.getDoc(),"cut",(t=>{let r;!f(t)&&o()&&(r=n(),gf.setEditorTimeout(e,(()=>{r()})))}))})(),y(),e.on("SetContent ExecCommand",(e=>{"setcontent"!==e.type&&"mceInsertLink"!==e.command||t(r.select("a"),(e=>{let t=e.parentNode;const n=r.getRoot();if(t.lastChild===e){for(;t&&!r.isBlock(t);){if(t.parentNode.lastChild!==t||t===n)return;t=t.parentNode}r.add(t,"br",{"data-mce-bogus":1})}}))})),C(),k(),v())),{refreshContentEditable:N,isHidden:()=>{if(!l||e.removed)return!1;const t=e.selection.getSel();return!t||!t.rangeCount||0===t.rangeCount}}},vN=Hs.DOM,yN=e=>e.inline?e.getElement().nodeName.toLowerCase():void 0,CN=e=>ve(e,(e=>!1===v(e))),wN=e=>{const t=e.options.get,n=e.editorUpload.blobCache;return CN({allow_conditional_comments:t("allow_conditional_comments"),allow_html_data_urls:t("allow_html_data_urls"),allow_svg_data_urls:t("allow_svg_data_urls"),allow_html_in_named_anchor:t("allow_html_in_named_anchor"),allow_script_urls:t("allow_script_urls"),allow_unsafe_link_target:t("allow_unsafe_link_target"),convert_fonts_to_spans:t("convert_fonts_to_spans"),fix_list_elements:t("fix_list_elements"),font_size_legacy_values:t("font_size_legacy_values"),forced_root_block:t("forced_root_block"),forced_root_block_attrs:t("forced_root_block_attrs"),preserve_cdata:t("preserve_cdata"),remove_trailing_brs:t("remove_trailing_brs"),inline_styles:t("inline_styles"),root_name:yN(e),validate:!0,blob_cache:n,document:e.getDoc()})},xN=e=>{const t=e.options.get;return CN({custom_elements:t("custom_elements"),extended_valid_elements:t("extended_valid_elements"),invalid_elements:t("invalid_elements"),invalid_styles:t("invalid_styles"),schema:t("schema"),valid_children:t("valid_children"),valid_classes:t("valid_classes"),valid_elements:t("valid_elements"),valid_styles:t("valid_styles"),verify_html:t("verify_html"),padd_empty_block_inline_children:t("format_empty_lines")})},kN=e=>e.inline?e.ui.styleSheetLoader:e.dom.styleSheetLoader,SN=e=>{const t=kN(e),n=ul(e),o=e.contentCSS,r=()=>{t.unloadAll(o),e.inline||e.ui.styleSheetLoader.unloadAll(n)},s=()=>{e.removed?r():e.on("remove",r)};if(e.contentStyles.length>0){let t="";Bt.each(e.contentStyles,(e=>{t+=e+"\r\n"})),e.dom.addStyle(t)}const a=Promise.all(((e,t,n)=>{const o=[kN(e).loadAll(t)];return e.inline?o:o.concat([e.ui.styleSheetLoader.loadAll(n)])})(e,o,n)).then(s).catch(s),i=cl(e);return i&&((e,t)=>{const n=fn(e.getBody()),o=In(Mn(n)),r=un("style");qt(r,"type","text/css"),Zn(r,mn(t)),Zn(o,r),e.on("remove",(()=>{no(r)}))})(e,i),a},_N=e=>{!0!==e.removed&&((e=>{ly(e)||e.load({initial:!0,format:"html"}),e.startContent=e.getContent({format:"raw"})})(e),(e=>{e.bindPendingEventDelegates(),e.initialized=!0,(e=>{e.dispatch("Init")})(e),e.focus(!0),(e=>{const t=e.dom.getRoot();e.inline||Lu(e)&&e.selection.getStart(!0)!==t||xc(t).each((t=>{const n=t.getNode(),o=_o(n)?xc(n).getOr(t):t;e.selection.setRng(o.toRange())}))})(e),e.nodeChanged({initial:!0});const t=ql(e);w(t)&&t.call(e,e),(e=>{const t=Kl(e);t&&gf.setEditorTimeout(e,(()=>{let n;n=!0===t?e:e.editorManager.get(t),n.destroyed||n.focus()}),100)})(e)})(e))},EN=e=>{const t=e.getElement();let n=e.getDoc();e.inline&&(vN.addClass(t,"mce-content-body"),e.contentDocument=n=document,e.contentWindow=window,e.bodyElement=t,e.contentAreaContainer=t);const o=e.getBody();o.disabled=!0,e.readonly=Ll(e),e.readonly||(e.inline&&"static"===vN.getStyle(o,"position",!0)&&(o.style.position="relative"),o.contentEditable="true"),o.disabled=!1,e.editorUpload=Jy(e),e.schema=Ss(xN(e)),e.dom=Hs(n,{keep_values:!0,url_converter:e.convertURL,url_converter_scope:e,update_styles:!0,root_element:e.inline?e.getBody():null,collect:()=>e.inline,schema:e.schema,contentCssCors:ol(e),referrerPolicy:rl(e),onSetAttrib:t=>{e.dispatch("SetAttrib",t)}}),e.parser=(e=>{const t=Av(wN(e),e.schema);return t.addAttributeFilter("src,href,style,tabindex",((t,n)=>{let o,r,s=t.length;const a=e.dom,i="data-mce-"+n;for(;s--;)if(o=t[s],r=o.attr(n),r&&!o.attr(i)){if(0===r.indexOf("data:")||0===r.indexOf("blob:"))continue;"style"===n?(r=a.serializeStyle(a.parseStyle(r),o.name),r.length||(r=null),o.attr(i,r),o.attr(n,r)):"tabindex"===n?(o.attr(i,r),o.attr(n,null)):o.attr(i,e.convertURL(r,n,o.name))}})),t.addNodeFilter("script",(e=>{let t=e.length;for(;t--;){const n=e[t],o=n.attr("type")||"no/type";0!==o.indexOf("mce-")&&n.attr("type","mce-"+o)}})),e.options.get("preserve_cdata")&&t.addNodeFilter("#cdata",(t=>{let n=t.length;for(;n--;){const o=t[n];o.type=8,o.name="#comment",o.value="[CDATA["+e.dom.encode(o.value)+"]]"}})),t.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",(t=>{let n=t.length;const o=e.schema.getNonEmptyElements();for(;n--;){const e=t[n];e.isEmpty(o)&&0===e.getAll("br").length&&e.append(new Ff("br",1))}})),t})(e),e.serializer=yy((e=>{const t=e.options.get;return{...wN(e),...xN(e),...CN({url_converter:t("url_converter"),url_converter_scope:t("url_converter_scope"),element_format:t("element_format"),entities:t("entities"),entity_encoding:t("entity_encoding"),indent:t("indent"),indent_after:t("indent_after"),indent_before:t("indent_before")})}})(e),e),e.selection=hy(e.dom,e.getWin(),e.serializer,e),e.annotator=qu(e),e.formatter=lC(e),e.undoManager=cC(e),e._nodeChangeDispatcher=new V_(e),e._selectionOverrides=KE(e),(e=>{const t=Js(),n=Ws(!1),o=ea((t=>{e.dispatch("longpress",{...t,type:"longpress"}),n.set(!0)}),400);e.on("touchstart",(e=>{Rx(e).each((r=>{o.cancel();const s={x:r.clientX,y:r.clientY,target:e.target};o.throttle(e),n.set(!1),t.set(s)}))}),!0),e.on("touchmove",(r=>{o.cancel(),Rx(r).each((o=>{t.on((r=>{((e,t)=>{const n=Math.abs(e.clientX-t.x),o=Math.abs(e.clientY-t.y);return n>5||o>5})(o,r)&&(t.clear(),n.set(!1),e.dispatch("longpresscancel"))}))}))}),!0),e.on("touchend touchcancel",(r=>{o.cancel(),"touchcancel"!==r.type&&t.get().filter((e=>e.target.isEqualNode(r.target))).each((()=>{n.get()?r.preventDefault():e.dispatch("tap",{...r,type:"tap"})}))}),!0)})(e),(e=>{(e=>{e.on("click",(t=>{e.dom.getParent(t.target,"details")&&t.preventDefault()}))})(e),(e=>{e.parser.addNodeFilter("details",(e=>{$(e,(e=>{e.attr("data-mce-open",e.attr("open")),e.attr("open","open")}))})),e.serializer.addNodeFilter("details",(e=>{$(e,(e=>{const t=e.attr("data-mce-open");e.attr("open",m(t)?t:null),e.attr("data-mce-open",null)}))}))})(e)})(e),(e=>{const t="contenteditable",n=" "+Bt.trim(dd(e))+" ",o=" "+Bt.trim(ld(e))+" ",r=Dx(n),s=Dx(o),a=cd(e);a.length>0&&e.on("BeforeSetContent",(t=>{((e,t,n)=>{let o=t.length,r=n.content;if("raw"!==n.format){for(;o--;)r=r.replace(t[o],Px(e,r,ld(e)));n.content=r}})(e,a,t)})),e.parser.addAttributeFilter("class",(e=>{let n=e.length;for(;n--;){const o=e[n];r(o)?o.attr(t,"true"):s(o)&&o.attr(t,"false")}})),e.serializer.addAttributeFilter(t,(e=>{let n=e.length;for(;n--;){const o=e[n];(r(o)||s(o))&&(a.length>0&&o.attr("data-mce-content")?(o.name="#text",o.type=3,o.raw=!0,o.value=o.attr("data-mce-content")):o.attr(t,null))}}))})(e),ly(e)||((e=>{e.on("mousedown",(t=>{t.detail>=3&&(t.preventDefault(),OE(e))}))})(e),(e=>{hN(e)})(e));const r=j_(e);Nx(e,r),(e=>{e.on("NodeChange",O(Bx,e))})(e),(e=>{const t=e.dom,n=ji(e),o=hl(e),r=(s,a)=>{if((e=>{if(fC(e)){const t=e.keyCode;return!gC(e)&&(em.metaKeyPressed(e)||e.altKey||t>=112&&t<=123||j(uC,t))}return!1})(s))return;const i=e.getBody(),l=!(e=>fC(e)&&!(gC(e)||"keyup"===e.type&&229===e.keyCode))(s)&&((e,t,n)=>{if(Yr(fn(t),!1)){const o=t.firstElementChild;return!o||!e.getStyle(t.firstElementChild,"padding-left")&&!e.getStyle(t.firstElementChild,"padding-right")&&n===o.nodeName.toLowerCase()}return!1})(t,i,n);(""!==t.getAttrib(i,mC)!==l||a)&&(t.setAttrib(i,mC,l?o:null),t.setAttrib(i,"aria-placeholder",l?o:null),((e,t)=>{e.dispatch("PlaceholderToggle",{state:t})})(e,l),e.on(l?"keydown":"keyup",r),e.off(l?"keyup":"keydown",r))};o&&e.on("init",(t=>{r(t,!0),e.on("change SetContent ExecCommand",r),e.on("paste",(t=>gf.setEditorTimeout(e,(()=>r(t)))))}))})(e),kE(e);const s=(e=>{const t=e;return(e=>we(e.plugins,"rtc").bind((e=>M.from(e.setup))))(e).fold((()=>(t.rtcInstance=iy(e),M.none())),(e=>(t.rtcInstance=(()=>{const e=N(null),t=N("");return{init:{bindEvents:S},undoManager:{beforeChange:S,add:e,undo:e,redo:e,clear:S,reset:S,hasUndo:P,hasRedo:P,transact:e,ignore:S,extra:S},formatter:{match:P,matchAll:N([]),matchNode:N(void 0),canApply:P,closest:t,apply:S,remove:S,toggle:S,formatChanged:N({unbind:S})},editor:{getContent:t,setContent:N({content:"",html:""}),insertContent:N(""),addVisual:S},selection:{getContent:t},autocompleter:{addDecoration:S,removeDecoration:S},raw:{getModel:N(M.none())}}})(),M.some((()=>e().then((e=>(t.rtcInstance=(e=>{const t=e=>f(e)?e:{},{init:n,undoManager:o,formatter:r,editor:s,selection:a,autocompleter:i,raw:l}=e;return{init:{bindEvents:n.bindEvents},undoManager:{beforeChange:o.beforeChange,add:o.add,undo:o.undo,redo:o.redo,clear:o.clear,reset:o.reset,hasUndo:o.hasUndo,hasRedo:o.hasRedo,transact:(e,t,n)=>o.transact(n),ignore:(e,t)=>o.ignore(t),extra:(e,t,n,r)=>o.extra(n,r)},formatter:{match:(e,n,o,s)=>r.match(e,t(n),s),matchAll:r.matchAll,matchNode:r.matchNode,canApply:e=>r.canApply(e),closest:e=>r.closest(e),apply:(e,n,o)=>r.apply(e,t(n)),remove:(e,n,o,s)=>r.remove(e,t(n)),toggle:(e,n,o)=>r.toggle(e,t(n)),formatChanged:(e,t,n,o,s)=>r.formatChanged(t,n,o,s)},editor:{getContent:e=>s.getContent(e),setContent:(e,t)=>({content:s.setContent(e,t),html:""}),insertContent:(e,t)=>(s.insertContent(e),""),addVisual:s.addVisual},selection:{getContent:(e,t)=>a.getContent(t)},autocompleter:{addDecoration:i.addDecoration,removeDecoration:i.removeDecoration},raw:{getModel:()=>M.some(l.getRawModel())}}})(e),e.rtc.isRemote))))))))})(e);(e=>{const t=e.getDoc(),n=e.getBody();(e=>{e.dispatch("PreInit")})(e),Gl(e)||(t.body.spellcheck=!1,vN.setAttrib(n,"spellcheck","false")),e.quirks=bN(e),(e=>{e.dispatch("PostRender")})(e);const o=ml(e);void 0!==o&&(n.dir=o);const r=Yl(e);r&&e.on("BeforeSetContent",(e=>{Bt.each(r,(t=>{e.content=e.content.replace(t,(e=>"\x3c!--mce:protected "+escape(e)+"--\x3e"))}))})),e.on("SetContent",(()=>{e.addVisual(e.getBody())})),e.on("compositionstart compositionend",(t=>{e.composing="compositionstart"===t.type}))})(e),s.fold((()=>{SN(e).then((()=>_N(e)))}),(t=>{e.setProgressState(!0),SN(e).then((()=>{t().then((t=>{e.setProgressState(!1),_N(e),uy(e)}),(t=>{e.notificationManager.open({type:"error",text:String(t)}),_N(e),uy(e)}))}))}))},NN=(e,t)=>{if(e.inline||(e.getElement().style.visibility=e.orgVisibility),t||e.inline)EN(e);else{const t=e.iframeElement,o=(n=fn(t),ao(n,"load",qy,(()=>{o.unbind(),e.contentDocument=t.contentDocument,EN(e)})));t.srcdoc=e.iframeHTML}var n},RN=Hs.DOM,AN=Hs.DOM,ON=e=>({editorContainer:e,iframeContainer:e,api:{}}),TN=e=>{const t=e.getElement();return e.orgDisplay=t.style.display,m(yl(e))?(e=>e.theme.renderUI())(e):w(yl(e))?(e=>{const t=e.getElement(),n=yl(e)(e,t);return n.editorContainer.nodeType&&(n.editorContainer.id=n.editorContainer.id||e.id+"_parent"),n.iframeContainer&&n.iframeContainer.nodeType&&(n.iframeContainer.id=n.iframeContainer.id||e.id+"_iframecontainer"),n.height=n.iframeHeight?n.iframeHeight:t.offsetHeight,n})(e):(e=>{const t=e.getElement();return e.inline?ON(null):(e=>{const t=AN.create("div");return AN.insertAfter(t,e),ON(t)})(t)})(e)},BN=e=>{e.dispatch("ScriptsLoaded"),(e=>{const t=Bt.trim(Qi(e)),n=e.ui.registry.getAll().icons,o={...Ny.get("default").icons,...Ny.get(t).icons};fe(o,((t,o)=>{xe(n,o)||e.ui.registry.addIcon(o,t)}))})(e),(e=>{const t=yl(e);if(m(t)){const n=Iy.get(t);e.theme=n(e,Iy.urls[t])||{},w(e.theme.init)&&e.theme.init(e,Iy.urls[t]||e.documentBaseUrl.replace(/\/$/,""))}else e.theme={}})(e),(e=>{const t=wl(e),n=Ry.get(t);e.model=n(e,Ry.urls[t])})(e),(e=>{const t=[];$(Il(e),(n=>{((e,t,n)=>{const o=My.get(n),r=My.urls[n]||e.documentBaseUrl.replace(/\/$/,"");if(n=Bt.trim(n),o&&-1===Bt.inArray(t,n)){if(e.plugins[n])return;try{const s=o(e,r)||{};e.plugins[n]=s,w(s.init)&&(s.init(e,r),t.push(n))}catch(t){((e,t,n)=>{const o=Xs.translate(["Failed to initialize plugin: {0}",t]);Gu(e,"PluginLoadError",{message:o}),Hy(o,n),zy(e,o)})(e,n,t)}}})(e,t,(e=>e.replace(/^\-/,""))(n))}))})(e);const t=TN(e);((e,t)=>{const n={show:M.from(t.show).getOr(S),hide:M.from(t.hide).getOr(S),isEnabled:M.from(t.isEnabled).getOr(L),setEnabled:n=>{e.mode.isReadOnly()||M.from(t.setEnabled).each((e=>e(n)))}};e.ui={...e.ui,...n}})(e,M.from(t.api).getOr({}));const n={editorContainer:t.editorContainer,iframeContainer:t.iframeContainer};return e.editorContainer=n.editorContainer?n.editorContainer:null,(e=>{e.contentCSS=e.contentCSS.concat((e=>$y(e,dl(e)))(e),(e=>$y(e,ul(e)))(e))})(e),e.inline?NN(e):((e,t)=>{((e,t)=>{const n=e.translate("Rich Text Area"),o=Gt(fn(e.getElement()),"tabindex").bind(Ge),r=((e,t,n,o)=>{const r=un("iframe");return o.each((e=>qt(r,"tabindex",e))),Wt(r,n),Wt(r,{id:e+"_ifr",frameBorder:"0",allowTransparency:"true",title:t}),on(r,"tox-edit-area__iframe"),r})(e.id,n,Pi(e),o).dom;r.onload=()=>{r.onload=null,e.dispatch("load")},e.contentAreaContainer=t.iframeContainer,e.iframeElement=r,e.iframeHTML=(e=>{let t=Li(e)+"<html><head>";Mi(e)!==e.documentBaseUrl&&(t+='<base href="'+e.documentBaseURI.getURI()+'" />'),t+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';const n=Ii(e),o=Fi(e),r=e.translate(Hl(e));return Ui(e)&&(t+='<meta http-equiv="Content-Security-Policy" content="'+Ui(e)+'" />'),t+=`</head><body id="${n}" class="mce-content-body ${o}" data-id="${e.id}" aria-label="${r}"><br></body></html>`,t})(e),RN.add(t.iframeContainer,r)})(e,t),t.editorContainer&&(RN.get(t.editorContainer).style.display=e.orgDisplay,e.hidden=RN.isHidden(t.editorContainer)),e.getElement().style.display="none",RN.setAttrib(e.id,"aria-hidden","true"),NN(e)})(e,n)},DN=Hs.DOM,PN=e=>"-"===e.charAt(0),LN=(e,t,n)=>M.from(t).filter((e=>We(e)&&!Ny.has(e))).map((t=>({url:`${e.editorManager.baseURL}/icons/${t}/icons${n}.js`,name:M.some(t)}))),MN=(e,t)=>{const n=qs.ScriptLoader,o=()=>{!e.removed&&(e=>{const t=yl(e);return!m(t)||C(Iy.get(t))})(e)&&(e=>{const t=wl(e);return C(Ry.get(t))})(e)&&BN(e)};((e,t)=>{const n=yl(e);if(m(n)&&!PN(n)&&!xe(Iy.urls,n)){const o=Cl(e),r=o?e.documentBaseURI.toAbsolute(o):`themes/${n}/theme${t}.js`;Iy.load(n,r).catch((()=>{((e,t,n)=>{jy(e,"ThemeLoadError",Vy("theme",t,n))})(e,r,n)}))}})(e,t),((e,t)=>{const n=wl(e);if("plugin"!==n&&!xe(Ry.urls,n)){const o=xl(e),r=m(o)?e.documentBaseURI.toAbsolute(o):`models/${n}/model${t}.js`;Ry.load(n,r).catch((()=>{((e,t,n)=>{jy(e,"ModelLoadError",Vy("model",t,n))})(e,r,n)}))}})(e,t),((e,t)=>{const n=sl(t),o=al(t);if(!1===Xs.hasCode(n)&&"en"!==n){const r=We(o)?o:`${t.editorManager.baseURL}/langs/${n}.js`;e.add(r).catch((()=>{((e,t,n)=>{jy(e,"LanguageLoadError",Vy("language",t,n))})(t,r,n)}))}})(n,e),((e,t,n)=>{const o=LN(t,"default",n),r=(e=>M.from(Ji(e)).filter(We).map((e=>({url:e,name:M.none()}))))(t).orThunk((()=>LN(t,Qi(t),"")));$((e=>{const t=[],n=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(n);return t})([o,r]),(n=>{e.add(n.url).catch((()=>{((e,t,n)=>{jy(e,"IconsLoadError",Vy("icons",t,n))})(t,n.url,n.name.getOrUndefined())}))}))})(n,e,t),((e,t)=>{const n=(t,n)=>{My.load(t,n).catch((()=>{((e,t,n)=>{jy(e,"PluginLoadError",Vy("plugin",t,n))})(e,n,t)}))};fe(Fl(e),((t,o)=>{n(o,t),e.options.set("plugins",Il(e).concat(o))})),$(Il(e),(e=>{!(e=Bt.trim(e))||My.urls[e]||PN(e)||n(e,`plugins/${e}/plugin${t}.js`)}))})(e,t),n.loadQueue().then(o,o)},IN=Ct().deviceType,FN=IN.isPhone(),UN=IN.isTablet(),zN=e=>{if(y(e))return[];{const t=p(e)?e:e.split(/[ ,]/),n=H(t,He);return K(n,We)}},jN=(e,t)=>{const n=((t,n)=>{const o={},r={};return be(t,((t,n)=>j(e,n)),he(o),he(r)),{t:o,f:r}})(t);return o=n.t,r=n.f,{sections:N(o),options:N(r)};var o,r},VN=(e,t)=>xe(e.sections(),t),HN=(e,t)=>({table_grid:!1,object_resizing:!1,resize:!1,toolbar_mode:we(e,"toolbar_mode").getOr("scrolling"),toolbar_sticky:!1,...t?{menubar:!1}:{}}),$N=(e,t)=>{var n;const o=null!==(n=t.external_plugins)&&void 0!==n?n:{};return e&&e.external_plugins?Bt.extend({},e.external_plugins,o):o},qN=(e,t,n,o,r)=>{var s;const a=e?{mobile:HN(null!==(s=r.mobile)&&void 0!==s?s:{},t)}:{},i=jN(["mobile"],Kk(a,r)),l=Bt.extend(n,o,i.options(),((e,t)=>e&&VN(t,"mobile"))(e,i)?((e,t,n={})=>{const o=e.sections(),r=we(o,t).getOr({});return Bt.extend({},n,r)})(i,"mobile"):{},{external_plugins:$N(o,i.options())});return((e,t,n,o)=>{const r=zN(n.forced_plugins),s=zN(o.plugins),a=((e,t)=>VN(e,t)?e.sections()[t]:{})(t,"mobile"),i=((e,t,n,o)=>e&&VN(t,"mobile")?o:n)(e,t,s,a.plugins?zN(a.plugins):s),l=((e,t)=>[].concat(zN(e)).concat(zN(t)))(r,i);return Bt.extend(o,{forced_plugins:r,plugins:l})})(e,i,o,l)},WN=e=>{(e=>{const t=t=>()=>{$("left,center,right,justify".split(","),(n=>{t!==n&&e.formatter.remove("align"+n)})),"none"!==t&&((t,n)=>{e.formatter.toggle(t,void 0),e.nodeChanged()})("align"+t)};e.editorCommands.addCommands({JustifyLeft:t("left"),JustifyCenter:t("center"),JustifyRight:t("right"),JustifyFull:t("justify"),JustifyNone:t("none")})})(e),(e=>{const t=t=>()=>{const n=e.selection,o=n.isCollapsed()?[e.dom.getParent(n.getNode(),e.dom.isBlock)]:n.getSelectedBlocks();return V(o,(n=>C(e.formatter.matchNode(n,t))))};e.editorCommands.addCommands({JustifyLeft:t("alignleft"),JustifyCenter:t("aligncenter"),JustifyRight:t("alignright"),JustifyFull:t("alignjustify")},"state")})(e)},KN=(e,t)=>{const n=e.selection,o=e.dom;return/^ | $/.test(t)?((e,t,n)=>{const o=fn(e.getRoot());return n=Mg(o,Ya.fromRangeStart(t))?n.replace(/^ /,"&nbsp;"):n.replace(/^&nbsp;/," "),Ig(o,Ya.fromRangeEnd(t))?n.replace(/(&nbsp;| )(<br( \/)>)?$/,"&nbsp;"):n.replace(/&nbsp;(<br( \/)?>)?$/," ")})(o,n.getRng(),t):t},GN=(e,t)=>{const{content:n,details:o}=(e=>{if("string"!=typeof e){const t=Bt.extend({paste:e.paste,data:{paste:e.paste}},e);return{content:e.content,details:t}}return{content:e,details:{}}})(t);Dv(e,{content:KN(e,n),format:"html",set:!1,selection:!0,paste:o.paste}).each((t=>{const n=((e,t,n)=>dy(e).editor.insertContent(t,n))(e,t.content,o);Pv(e,n,t),e.addVisual()}))},YN={"font-size":"size","font-family":"face"},XN=e=>(t,n)=>M.from(n).map(fn).filter(Ut).bind((n=>((e,t,n)=>ih(fn(n),(t=>(t=>Kn(t,e).orThunk((()=>"font"===Mt(t)?we(YN,e).bind((e=>Gt(t,e))):M.none())))(t)),(e=>vn(fn(t),e))))(e,t,n.dom).or(((e,t)=>M.from(Hs.DOM.getStyle(t,e,!0)))(e,n.dom)))).getOr(""),QN=XN("font-size"),JN=_((e=>e.replace(/[\'\"\\]/g,"").replace(/,\s+/g,",")),XN("font-family")),ZN=e=>xc(e.getBody()).map((e=>{const t=e.container();return Ro(t)?t.parentNode:t})),eR=(e,t)=>((e,t)=>(e=>M.from(e.selection.getRng()).bind((t=>{const n=e.getBody();return t.startContainer===n&&0===t.startOffset?M.none():M.from(e.selection.getStart(!0))})))(e).orThunk(O(ZN,e)).map(fn).filter(Ut).bind(t))(e,E(M.some,t)),tR=(e,t)=>{if(/^[0-9.]+$/.test(t)){const n=parseInt(t,10);if(n>=1&&n<=7){const o=(e=>Bt.explode(e.options.get("font_size_style_values")))(e),r=(e=>Bt.explode(e.options.get("font_size_classes")))(e);return r?r[n-1]||t:o[n-1]||t}return t}return t},nR=e=>{const t=e.split(/\s*,\s*/);return H(t,(e=>-1===e.indexOf(" ")||ze(e,'"')||ze(e,"'")?e:`'${e}'`)).join(",")},oR=e=>{WN(e),(e=>{e.editorCommands.addCommands({"Cut,Copy,Paste":t=>{const n=e.getDoc();let o;try{n.execCommand(t)}catch(e){o=!0}if("paste"!==t||n.queryCommandEnabled(t)||(o=!0),o||!n.queryCommandSupported(t)){let t=e.translate("Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.");(Nt.os.isMacOS()||Nt.os.isiOS())&&(t=t.replace(/Ctrl\+/g,"\u2318+")),e.notificationManager.open({text:t,type:"error"})}}})})(e),(e=>{e.editorCommands.addCommands({mceAddUndoLevel:()=>{e.undoManager.add()},mceEndUndoLevel:()=>{e.undoManager.add()},Undo:()=>{e.undoManager.undo()},Redo:()=>{e.undoManager.redo()}})})(e),(e=>{e.editorCommands.addCommands({mceSelectNodeDepth:(t,n,o)=>{let r=0;e.dom.getParent(e.selection.getNode(),(t=>{if(1===t.nodeType&&r++===o)return e.selection.select(t),!1}),e.getBody())},mceSelectNode:(t,n,o)=>{e.selection.select(o)},selectAll:()=>{const t=e.dom.getParent(e.selection.getStart(),Mo);if(t){const n=e.dom.createRng();n.selectNodeContents(t),e.selection.setRng(n)}}})})(e),(e=>{e.editorCommands.addCommands({mceCleanup:()=>{const t=e.selection.getBookmark();e.setContent(e.getContent()),e.selection.moveToBookmark(t)},insertImage:(t,n,o)=>{GN(e,e.dom.createHTML("img",{src:o}))},insertHorizontalRule:()=>{e.execCommand("mceInsertContent",!1,"<hr>")},insertText:(t,n,o)=>{GN(e,e.dom.encode(o))},insertHTML:(t,n,o)=>{GN(e,o)},mceInsertContent:(t,n,o)=>{GN(e,o)},mceSetContent:(t,n,o)=>{e.setContent(o)},mceReplaceContent:(t,n,o)=>{e.execCommand("mceInsertContent",!1,o.replace(/\{\$selection\}/g,e.selection.getContent({format:"text"})))},mceNewDocument:()=>{e.setContent("")}})})(e),(e=>{const t=(t,n,o)=>{const r=m(o)?{href:o}:o,s=e.dom.getParent(e.selection.getNode(),"a");f(r)&&m(r.href)&&(r.href=r.href.replace(/ /g,"%20"),s&&r.href||e.formatter.remove("link"),r.href&&e.formatter.apply("link",r,s))};e.editorCommands.addCommands({unlink:()=>{if(e.selection.isCollapsed()){const t=e.dom.getParent(e.selection.getStart(),"a");t&&e.dom.remove(t,!0)}else e.formatter.remove("link")},mceInsertLink:t,createLink:t})})(e),(e=>{e.editorCommands.addCommands({Indent:()=>{(e=>{kx(e,"indent")})(e)},Outdent:()=>{Sx(e)}}),e.editorCommands.addCommands({Outdent:()=>Cx(e)},"state")})(e),(e=>{e.editorCommands.addCommands({insertParagraph:()=>{A_(d_,e)},mceInsertNewLine:(t,n,o)=>{O_(e,o)},InsertLineBreak:(t,n,o)=>{A_(b_,e)}})})(e),(e=>{(e=>{e.editorCommands.addCommands({"InsertUnorderedList,InsertOrderedList":t=>{e.getDoc().execCommand(t);const n=e.dom.getParent(e.selection.getNode(),"ol,ul");if(n){const t=n.parentNode;if(/^(H[1-6]|P|ADDRESS|PRE)$/.test(t.nodeName)){const o=e.selection.getBookmark();e.dom.split(t,n),e.selection.moveToBookmark(o)}}}})})(e),(e=>{e.editorCommands.addCommands({"InsertUnorderedList,InsertOrderedList":t=>{const n=e.dom.getParent(e.selection.getNode(),"ul,ol");return n&&("insertunorderedlist"===t&&"UL"===n.tagName||"insertorderedlist"===t&&"OL"===n.tagName)}},"state")})(e)})(e),(e=>{(e=>{const t=(t,n)=>{e.formatter.toggle(t,n),e.nodeChanged()};e.editorCommands.addCommands({"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":e=>{t(e)},"ForeColor,HiliteColor":(e,n,o)=>{t(e,{value:o})},BackColor:(e,n,o)=>{t("hilitecolor",{value:o})},FontName:(t,n,o)=>{((e,t)=>{const n=tR(e,t);e.formatter.toggle("fontname",{value:nR(n)}),e.nodeChanged()})(e,o)},FontSize:(t,n,o)=>{((e,t)=>{e.formatter.toggle("fontsize",{value:tR(e,t)}),e.nodeChanged()})(e,o)},LineHeight:(t,n,o)=>{((e,t)=>{e.formatter.toggle("lineheight",{value:String(t)}),e.nodeChanged()})(e,o)},Lang:(e,n,o)=>{t(e,{value:o.code,customValue:o.customCode})},RemoveFormat:t=>{e.formatter.remove(t)},mceBlockQuote:()=>{t("blockquote")},FormatBlock:(e,n,o)=>{t(m(o)?o:"p")},mceToggleFormat:(e,n,o)=>{t(o)}})})(e),(e=>{const t=t=>e.formatter.match(t);e.editorCommands.addCommands({"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":e=>t(e),mceBlockQuote:()=>t("blockquote")},"state"),e.editorCommands.addQueryValueHandler("FontName",(()=>(e=>eR(e,(t=>JN(e.getBody(),t.dom))).getOr(""))(e))),e.editorCommands.addQueryValueHandler("FontSize",(()=>(e=>eR(e,(t=>QN(e.getBody(),t.dom))).getOr(""))(e))),e.editorCommands.addQueryValueHandler("LineHeight",(()=>(e=>eR(e,(t=>{const n=fn(e.getBody()),o=ih(t,(e=>Kn(e,"line-height")),O(vn,n));return o.getOrThunk((()=>{const e=parseFloat(qn(t,"line-height")),n=parseFloat(qn(t,"font-size"));return String(e/n)}))})).getOr(""))(e)))})(e)})(e),(e=>{e.editorCommands.addCommands({mceRemoveNode:(t,n,o)=>{const r=null!=o?o:e.selection.getNode();if(r!==e.getBody()){const t=e.selection.getBookmark();e.dom.remove(r,!0),e.selection.moveToBookmark(t)}},mcePrint:()=>{e.getWin().print()},mceFocus:(t,n,o)=>{((e,t)=>{e.removed||(t?kf(e):(e=>{const t=e.selection,n=e.getBody();let o=t.getRng();e.quirks.refreshContentEditable(),void 0!==e.bookmark&&!1===xf(e)&&mf(e).each((t=>{e.selection.setRng(t),o=t}));const r=((e,t)=>e.dom.getParent(t,(t=>"true"===e.dom.getContentEditable(t))))(e,t.getNode());if(e.dom.isChildOf(r,n))return wf(r),Cf(e,o),void kf(e);e.inline||(Nt.browser.isOpera()||wf(n),e.getWin().focus()),(Nt.browser.isFirefox()||e.inline)&&(wf(n),Cf(e,o)),kf(e)})(e))})(e,o)},mceToggleVisualAid:()=>{e.hasVisual=!e.hasVisual,e.addVisual()}})})(e)};class rR{constructor(e){this.commands={state:{},exec:{},value:{}},this.editor=e}execCommand(e,t,n,o){const r=this.editor,s=e.toLowerCase(),a=null==o?void 0:o.skip_focus;if(r.removed)return!1;if("mcefocus"!==s&&(/^(mceAddUndoLevel|mceEndUndoLevel)$/i.test(s)||a?(e=>{mf(e).each((t=>e.selection.setRng(t)))})(r):r.focus()),r.dispatch("BeforeExecCommand",{command:e,ui:t,value:n}).isDefaultPrevented())return!1;const i=this.commands.exec[s];return!!w(i)&&(i(s,t,n),r.dispatch("ExecCommand",{command:e,ui:t,value:n}),!0)}queryCommandState(e){if(this.editor.quirks.isHidden()||this.editor.removed)return!1;const t=e.toLowerCase(),n=this.commands.state[t];return!!w(n)&&n(t)}queryCommandValue(e){if(this.editor.quirks.isHidden()||this.editor.removed)return"";const t=e.toLowerCase(),n=this.commands.value[t];return w(n)?n(t):""}addCommands(e,t="exec"){const n=this.commands;fe(e,((e,o)=>{$(o.toLowerCase().split(","),(o=>{n[t][o]=e}))}))}addCommand(e,t,n){const o=e.toLowerCase();this.commands.exec[o]=(e,o,r)=>t.call(null!=n?n:this.editor,o,r)}queryCommandSupported(e){const t=e.toLowerCase();return!!this.commands.exec[t]}addQueryStateHandler(e,t,n){this.commands.state[e.toLowerCase()]=()=>t.call(null!=n?n:this.editor)}addQueryValueHandler(e,t,n){this.commands.value[e.toLowerCase()]=()=>t.call(null!=n?n:this.editor)}}const sR="data-mce-contenteditable",aR=(e,t,n)=>{try{e.getDoc().execCommand(t,!1,String(n))}catch(e){}},iR=(e,t)=>{e.dom.contentEditable=t?"true":"false"},lR=(e,t)=>{const n=fn(e.getBody());((e,t,n)=>{an(e,t)&&!1===n?sn(e,t):n&&on(e,t)})(n,"mce-content-readonly",t),t?(e.selection.controlSelection.hideResizeRect(),e._selectionOverrides.hideFakeCaret(),(e=>{M.from(e.selection.getNode()).each((e=>{e.removeAttribute("data-mce-selected")}))})(e),e.readonly=!0,iR(n,!1),$(na(n,'*[contenteditable="true"]'),(e=>{qt(e,sR,"true"),iR(e,!1)}))):(e.readonly=!1,iR(n,!0),$(na(n,'*[data-mce-contenteditable="true"]'),(e=>{Xt(e,sR),iR(e,!0)})),aR(e,"StyleWithCSS",!1),aR(e,"enableInlineTableEditing",!1),aR(e,"enableObjectResizing",!1),(e=>xf(e)||(e=>{const t=Mn(fn(e.getElement()));return of(t).filter((t=>!(e=>{const t=e.classList;return void 0!==t&&(t.contains("tox-edit-area")||t.contains("tox-edit-area__iframe")||t.contains("mce-content-body"))})(t.dom)&&bf(e,t.dom))).isSome()})(e))(e)&&e.focus(),(e=>{e.selection.setRng(e.selection.getRng())})(e),e.nodeChanged())},dR=e=>e.readonly,cR=e=>{e.parser.addAttributeFilter("contenteditable",(t=>{dR(e)&&$(t,(e=>{e.attr(sR,e.attr("contenteditable")),e.attr("contenteditable","false")}))})),e.serializer.addAttributeFilter(sR,(t=>{dR(e)&&$(t,(e=>{e.attr("contenteditable",e.attr(sR))}))})),e.serializer.addTempAttr(sR)},uR=["copy"],mR=Bt.makeMap("focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange mouseout mouseenter mouseleave wheel keydown keypress keyup input beforeinput contextmenu dragstart dragend dragover draggesture dragdrop drop drag submit compositionstart compositionend compositionupdate touchstart touchmove touchend touchcancel"," ");class fR{constructor(e){this.bindings={},this.settings=e||{},this.scope=this.settings.scope||this,this.toggleEvent=this.settings.toggleEvent||P}static isNative(e){return!!mR[e.toLowerCase()]}fire(e,t){return this.dispatch(e,t)}dispatch(e,t){const n=e.toLowerCase(),o=Rs(n,null!=t?t:{},this.scope);this.settings.beforeFire&&this.settings.beforeFire(o);const r=this.bindings[n];if(r)for(let e=0,t=r.length;e<t;e++){const t=r[e];if(!t.removed){if(t.once&&this.off(n,t.func),o.isImmediatePropagationStopped())return o;if(!1===t.func.call(this.scope,o))return o.preventDefault(),o}}return o}on(e,t,n,o){if(!1===t&&(t=P),t){const r={func:t,removed:!1};o&&Bt.extend(r,o);const s=e.toLowerCase().split(" ");let a=s.length;for(;a--;){const e=s[a];let t=this.bindings[e];t||(t=[],this.toggleEvent(e,!0)),t=n?[r,...t]:[...t,r],this.bindings[e]=t}}return this}off(e,t){if(e){const n=e.toLowerCase().split(" ");let o=n.length;for(;o--;){const r=n[o];let s=this.bindings[r];if(!r)return fe(this.bindings,((e,t)=>{this.toggleEvent(t,!1),delete this.bindings[t]})),this;if(s){if(t){const e=W(s,(e=>e.func===t));s=e.fail,this.bindings[r]=s,$(e.pass,(e=>{e.removed=!0}))}else s.length=0;s.length||(this.toggleEvent(e,!1),delete this.bindings[r])}}}else fe(this.bindings,((e,t)=>{this.toggleEvent(t,!1)})),this.bindings={};return this}once(e,t,n){return this.on(e,t,n,{once:!0})}has(e){return e=e.toLowerCase(),!(!this.bindings[e]||0===this.bindings[e].length)}}const gR=e=>(e._eventDispatcher||(e._eventDispatcher=new fR({scope:e,toggleEvent:(t,n)=>{fR.isNative(t)&&e.toggleNativeEvent&&e.toggleNativeEvent(t,n)}})),e._eventDispatcher),pR={fire(e,t,n){return this.dispatch(e,t,n)},dispatch(e,t,n){const o=this;if(o.removed&&"remove"!==e&&"detach"!==e)return Rs(e.toLowerCase(),null!=t?t:{},o);const r=gR(o).dispatch(e,t);if(!1!==n&&o.parent){let t=o.parent();for(;t&&!r.isPropagationStopped();)t.dispatch(e,r,!1),t=t.parent()}return r},on(e,t,n){return gR(this).on(e,t,n)},off(e,t){return gR(this).off(e,t)},once(e,t){return gR(this).once(e,t)},hasEventListeners(e){return gR(this).has(e)}},hR=Hs.DOM;let bR;const vR=(e,t)=>{if("selectionchange"===t)return e.getDoc();if(!e.inline&&/^mouse|touch|click|contextmenu|drop|dragover|dragend/.test(t))return e.getDoc().documentElement;const n=bl(e);return n?(e.eventRoot||(e.eventRoot=hR.select(n)[0]),e.eventRoot):e.getBody()},yR=(e,t,n)=>{(e=>!e.hidden&&!dR(e))(e)?e.dispatch(t,n):dR(e)&&((e,t)=>{if((e=>"click"===e.type)(t)&&!em.metaKeyPressed(t)){const n=fn(t.target);((e,t)=>Go(t,"a",(t=>vn(t,fn(e.getBody())))).bind((e=>Gt(e,"href"))))(e,n).each((n=>{if(t.preventDefault(),/^#/.test(n)){const t=e.dom.select(`${n},[name="${o=n,ze(o,"#")?((e,t)=>e.substring(t))(o,"#".length):o}"]`);t.length&&e.selection.scrollIntoView(t[0],!0)}else window.open(n,"_blank","rel=noopener noreferrer,menubar=yes,toolbar=yes,location=yes,status=yes,resizable=yes,scrollbars=yes");var o}))}else(e=>j(uR,e.type))(t)&&e.dispatch(t.type,t)})(e,n)},CR=(e,t)=>{let n;if(e.delegates||(e.delegates={}),e.delegates[t]||e.removed)return;const o=vR(e,t);if(bl(e)){if(bR||(bR={},e.editorManager.on("removeEditor",(()=>{e.editorManager.activeEditor||bR&&(fe(bR,((t,n)=>{e.dom.unbind(vR(e,n))})),bR=null)}))),bR[t])return;n=n=>{const o=n.target,r=e.editorManager.get();let s=r.length;for(;s--;){const e=r[s].getBody();(e===o||hR.isChildOf(o,e))&&yR(r[s],t,n)}},bR[t]=n,hR.bind(o,t,n)}else n=n=>{yR(e,t,n)},hR.bind(o,t,n),e.delegates[t]=n},wR={...pR,bindPendingEventDelegates(){const e=this;Bt.each(e._pendingNativeEvents,(t=>{CR(e,t)}))},toggleNativeEvent(e,t){const n=this;"focus"!==e&&"blur"!==e&&(n.removed||(t?n.initialized?CR(n,e):n._pendingNativeEvents?n._pendingNativeEvents.push(e):n._pendingNativeEvents=[e]:n.initialized&&(n.dom.unbind(vR(n,e),e,n.delegates[e]),delete n.delegates[e])))},unbindAllNativeEvents(){const e=this,t=e.getBody(),n=e.dom;e.delegates&&(fe(e.delegates,((t,n)=>{e.dom.unbind(vR(e,n),n,t)})),delete e.delegates),!e.inline&&t&&n&&(t.onload=null,n.unbind(e.getWin()),n.unbind(e.getDoc())),n&&(n.unbind(t),n.unbind(e.getContainer()))}},xR=e=>m(e)?{value:e.split(/[ ,]/),valid:!0}:k(e,m)?{value:e,valid:!0}:{valid:!1,message:"The value must be a string[] or a comma/space separated string."},kR=(e,t)=>e+(Ke(t.message)?"":`. ${t.message}`),SR=e=>e.valid,_R=(e,t,n="")=>{const o=t(e);return b(o)?o?{value:e,valid:!0}:{valid:!1,message:n}:o},ER=["design","readonly"],NR=(e,t,n,o)=>{const r=n[t.get()],s=n[o];try{s.activate()}catch(e){return void console.error(`problem while activating editor mode ${o}:`,e)}r.deactivate(),r.editorReadOnly!==s.editorReadOnly&&lR(e,s.editorReadOnly),t.set(o),((e,t)=>{e.dispatch("SwitchMode",{mode:t})})(e,o)},RR=Bt.each,AR=Bt.explode,OR={f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123},TR=Bt.makeMap("alt,ctrl,shift,meta,access"),BR=e=>{let t;const n={},o=Nt.os.isMacOS()||Nt.os.isiOS();RR(AR(e.toLowerCase(),"+"),(e=>{e in TR?n[e]=!0:/^[0-9]{2,}$/.test(e)?n.keyCode=parseInt(e,10):(n.charCode=e.charCodeAt(0),n.keyCode=OR[e]||e.toUpperCase().charCodeAt(0))}));const r=[n.keyCode];for(t in TR)n[t]?r.push(t):n[t]=!1;return n.id=r.join(","),n.access&&(n.alt=!0,o?n.ctrl=!0:n.shift=!0),n.meta&&(o?n.meta=!0:(n.ctrl=!0,n.meta=!1)),n};class DR{constructor(e){this.shortcuts={},this.pendingPatterns=[],this.editor=e;const t=this;e.on("keyup keypress keydown",(e=>{!t.hasModifier(e)&&!t.isFunctionKey(e)||e.isDefaultPrevented()||(RR(t.shortcuts,(n=>{if(t.matchShortcut(e,n))return t.pendingPatterns=n.subpatterns.slice(0),"keydown"===e.type&&t.executeShortcutAction(n),!0})),t.matchShortcut(e,t.pendingPatterns[0])&&(1===t.pendingPatterns.length&&"keydown"===e.type&&t.executeShortcutAction(t.pendingPatterns[0]),t.pendingPatterns.shift()))}))}add(e,t,n,o){const r=this,s=r.normalizeCommandFunc(n);return RR(AR(Bt.trim(e)),(e=>{const n=r.createShortcut(e,t,s,o);r.shortcuts[n.id]=n})),!0}remove(e){const t=this.createShortcut(e);return!!this.shortcuts[t.id]&&(delete this.shortcuts[t.id],!0)}normalizeCommandFunc(e){const t=this,n=e;return"string"==typeof n?()=>{t.editor.execCommand(n,!1,null)}:Bt.isArray(n)?()=>{t.editor.execCommand(n[0],n[1],n[2])}:n}createShortcut(e,t,n,o){const r=Bt.map(AR(e,">"),BR);return r[r.length-1]=Bt.extend(r[r.length-1],{func:n,scope:o||this.editor}),Bt.extend(r[0],{desc:this.editor.translate(t),subpatterns:r.slice(1)})}hasModifier(e){return e.altKey||e.ctrlKey||e.metaKey}isFunctionKey(e){return"keydown"===e.type&&e.keyCode>=112&&e.keyCode<=123}matchShortcut(e,t){return!!t&&t.ctrl===e.ctrlKey&&t.meta===e.metaKey&&t.alt===e.altKey&&t.shift===e.shiftKey&&!!(e.keyCode===t.keyCode||e.charCode&&e.charCode===t.charCode)&&(e.preventDefault(),!0)}executeShortcutAction(e){return e.func?e.func.call(e.scope):null}}const PR=()=>{const e=(()=>{const e={},t={},n={},o={},r={},s={},a={},i=(e,t)=>(n,o)=>e[n.toLowerCase()]={...o,type:t};return{addButton:i(e,"button"),addGroupToolbarButton:i(e,"grouptoolbarbutton"),addToggleButton:i(e,"togglebutton"),addMenuButton:i(e,"menubutton"),addSplitButton:i(e,"splitbutton"),addMenuItem:i(t,"menuitem"),addNestedMenuItem:i(t,"nestedmenuitem"),addToggleMenuItem:i(t,"togglemenuitem"),addAutocompleter:i(n,"autocompleter"),addContextMenu:i(r,"contextmenu"),addContextToolbar:i(s,"contexttoolbar"),addContextForm:i(s,"contextform"),addSidebar:i(a,"sidebar"),addIcon:(e,t)=>o[e.toLowerCase()]=t,getAll:()=>({buttons:e,menuItems:t,icons:o,popups:n,contextMenus:r,contextToolbars:s,sidebars:a})}})();return{addAutocompleter:e.addAutocompleter,addButton:e.addButton,addContextForm:e.addContextForm,addContextMenu:e.addContextMenu,addContextToolbar:e.addContextToolbar,addIcon:e.addIcon,addMenuButton:e.addMenuButton,addMenuItem:e.addMenuItem,addNestedMenuItem:e.addNestedMenuItem,addSidebar:e.addSidebar,addSplitButton:e.addSplitButton,addToggleButton:e.addToggleButton,addGroupToolbarButton:e.addGroupToolbarButton,addToggleMenuItem:e.addToggleMenuItem,getAll:e.getAll}},LR=Hs.DOM,MR=Bt.extend,IR=Bt.each;class FR{constructor(e,t,n){this.plugins={},this.contentCSS=[],this.contentStyles=[],this.loadedCSS={},this.isNotDirty=!1,this.editorManager=n,this.documentBaseUrl=n.documentBaseURL,MR(this,wR);const o=this;this.id=e,this.hidden=!1;const r=((e,t)=>qN(FN||UN,FN,t,e,t))(n.defaultOptions,t);this.options=((e,t)=>{const n={},o={},r=(e,t,n)=>{const r=_R(t,n);return SR(r)?(o[e]=r.value,!0):(console.warn(kR(`Invalid value passed for the ${e} option`,r)),!1)},s=e=>xe(n,e);return{register:(e,s)=>{const a=(e=>m(e.processor))(s)?(e=>{const t=(()=>{switch(e){case"array":return p;case"boolean":return b;case"function":return w;case"number":return x;case"object":return f;case"string":return m;case"string[]":return xR;case"object[]":return e=>k(e,f);case"regexp":return e=>u(e,RegExp)}})();return n=>_R(n,t,`The value must be a ${e}.`)})(s.processor):s.processor,i=((e,t,n)=>{if(!v(t)){const o=_R(t,n);if(SR(o))return o.value;console.error(kR(`Invalid default value passed for the "${e}" option`,o))}})(e,s.default,a);n[e]={...s,default:i,processor:a},we(o,e).orThunk((()=>we(t,e))).each((t=>r(e,t,a)))},isRegistered:s,get:e=>we(o,e).orThunk((()=>we(n,e).map((e=>e.default)))).getOrUndefined(),set:(e,t)=>{if(s(e)){const o=n[e];return o.immutable?(console.error(`"${e}" is an immutable option and cannot be updated`),!1):r(e,t,o.processor)}return console.warn(`"${e}" is not a registered option. Ensure the option has been registered before setting a value.`),!1},unset:e=>{const t=s(e);return t&&delete o[e],t},isSet:e=>xe(o,e)}})(0,r),(e=>{const t=e.options.register;t("id",{processor:"string",default:e.id}),t("selector",{processor:"string"}),t("target",{processor:"object"}),t("suffix",{processor:"string"}),t("cache_suffix",{processor:"string"}),t("base_url",{processor:"string"}),t("referrer_policy",{processor:"string",default:""}),t("language_load",{processor:"boolean"}),t("inline",{processor:"boolean",default:!1}),t("iframe_attrs",{processor:"object",default:{}}),t("doctype",{processor:"string",default:"<!DOCTYPE html>"}),t("document_base_url",{processor:"string",default:e.documentBaseUrl}),t("body_id",{processor:Di(e,"tinymce"),default:"tinymce"}),t("body_class",{processor:Di(e),default:""}),t("content_security_policy",{processor:"string",default:""}),t("br_in_pre",{processor:"boolean",default:!0}),t("forced_root_block",{processor:e=>{const t=m(e)&&We(e);return t?{value:e,valid:t}:{valid:!1,message:"Must be a non-empty string."}},default:"p"}),t("forced_root_block_attrs",{processor:"object",default:{}}),t("newline_behavior",{processor:e=>{const t=j(["block","linebreak","invert","default"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be one of: block, linebreak, invert or default."}},default:"default"}),t("br_newline_selector",{processor:"string",default:".mce-toc h2,figcaption,caption"}),t("no_newline_selector",{processor:"string",default:""}),t("keep_styles",{processor:"boolean",default:!0}),t("end_container_on_empty_block",{processor:e=>b(e)||m(e)?{valid:!0,value:e}:{valid:!1,message:"Must be boolean or a string"},default:"blockquote"}),t("font_size_style_values",{processor:"string",default:"xx-small,x-small,small,medium,large,x-large,xx-large"}),t("font_size_legacy_values",{processor:"string",default:"xx-small,small,medium,large,x-large,xx-large,300%"}),t("font_size_classes",{processor:"string",default:""}),t("automatic_uploads",{processor:"boolean",default:!0}),t("images_reuse_filename",{processor:"boolean",default:!1}),t("images_replace_blob_uris",{processor:"boolean",default:!0}),t("icons",{processor:"string",default:""}),t("icons_url",{processor:"string",default:""}),t("images_upload_url",{processor:"string",default:""}),t("images_upload_base_path",{processor:"string",default:""}),t("images_upload_base_path",{processor:"string",default:""}),t("images_upload_credentials",{processor:"boolean",default:!1}),t("images_upload_handler",{processor:"function"}),t("language",{processor:"string",default:"en"}),t("language_url",{processor:"string",default:""}),t("entity_encoding",{processor:"string",default:"named"}),t("indent",{processor:"boolean",default:!0}),t("indent_before",{processor:"string",default:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist"}),t("indent_after",{processor:"string",default:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist"}),t("indent_use_margin",{processor:"boolean",default:!1}),t("indentation",{processor:"string",default:"40px"}),t("content_css",{processor:e=>{const t=!1===e||m(e)||k(e,m);return t?m(e)?{value:H(e.split(","),He),valid:t}:p(e)?{value:e,valid:t}:!1===e?{value:[],valid:t}:{value:e,valid:t}:{valid:!1,message:"Must be false, a string or an array of strings."}},default:Rl(e)?[]:["default"]}),t("content_style",{processor:"string"}),t("content_css_cors",{processor:"boolean",default:!1}),t("font_css",{processor:e=>{const t=m(e)||k(e,m);return t?{value:p(e)?e:H(e.split(","),He),valid:t}:{valid:!1,message:"Must be a string or an array of strings."}},default:[]}),t("inline_boundaries",{processor:"boolean",default:!0}),t("inline_boundaries_selector",{processor:"string",default:"a[href],code,span.mce-annotation"}),t("object_resizing",{processor:e=>{const t=b(e)||m(e);return t?!1===e||Ni.isiPhone()||Ni.isiPad()?{value:"",valid:t}:{value:!0===e?"table,img,figure.image,div,video,iframe":e,valid:t}:{valid:!1,message:"Must be boolean or a string"}},default:!Ri}),t("resize_img_proportional",{processor:"boolean",default:!0}),t("event_root",{processor:"object"}),t("service_message",{processor:"string"}),t("theme",{processor:e=>!1===e||m(e)||w(e),default:"silver"}),t("theme_url",{processor:"string"}),t("formats",{processor:"object"}),t("format_empty_lines",{processor:"boolean",default:!1}),t("preview_styles",{processor:e=>{const t=!1===e||m(e);return t?{value:!1===e?"":e,valid:t}:{valid:!1,message:"Must be false or a string"}},default:"font-family font-size font-weight font-style text-decoration text-transform color background-color border border-radius outline text-shadow"}),t("custom_ui_selector",{processor:"string",default:""}),t("hidden_input",{processor:"boolean",default:!0}),t("submit_patch",{processor:"boolean",default:!0}),t("encoding",{processor:"string"}),t("add_form_submit_trigger",{processor:"boolean",default:!0}),t("add_unload_trigger",{processor:"boolean",default:!0}),t("custom_undo_redo_levels",{processor:"number",default:0}),t("disable_nodechange",{processor:"boolean",default:!1}),t("readonly",{processor:"boolean",default:!1}),t("plugins",{processor:"string[]",default:[]}),t("external_plugins",{processor:"object"}),t("forced_plugins",{processor:"string[]"}),t("model",{processor:"string",default:e.hasPlugin("rtc")?"plugin":"dom"}),t("model_url",{processor:"string"}),t("block_unsupported_drop",{processor:"boolean",default:!0}),t("visual",{processor:"boolean",default:!0}),t("visual_table_class",{processor:"string",default:"mce-item-table"}),t("visual_anchor_class",{processor:"string",default:"mce-item-anchor"}),t("iframe_aria_text",{processor:"string",default:"Rich Text Area. Press ALT-0 for help."}),t("setup",{processor:"function"}),t("init_instance_callback",{processor:"function"}),t("url_converter",{processor:"function",default:e.convertURL}),t("url_converter_scope",{processor:"object",default:e}),t("urlconverter_callback",{processor:"function"}),t("allow_conditional_comments",{processor:"boolean",default:!1}),t("allow_html_data_urls",{processor:"boolean",default:!1}),t("allow_svg_data_urls",{processor:"boolean"}),t("allow_html_in_named_anchor",{processor:"boolean",default:!1}),t("allow_script_urls",{processor:"boolean",default:!1}),t("allow_unsafe_link_target",{processor:"boolean",default:!1}),t("convert_fonts_to_spans",{processor:"boolean",default:!0,deprecated:!0}),t("fix_list_elements",{processor:"boolean",default:!1}),t("preserve_cdata",{processor:"boolean",default:!1}),t("remove_trailing_brs",{processor:"boolean"}),t("inline_styles",{processor:"boolean",default:!0,deprecated:!0}),t("element_format",{processor:"string",default:"html"}),t("entities",{processor:"string"}),t("schema",{processor:"string",default:"html5"}),t("convert_urls",{processor:"boolean",default:!0}),t("relative_urls",{processor:"boolean",default:!0}),t("remove_script_host",{processor:"boolean",default:!0}),t("custom_elements",{processor:"string"}),t("extended_valid_elements",{processor:"string"}),t("invalid_elements",{processor:"string"}),t("invalid_styles",{processor:Bi}),t("valid_children",{processor:"string"}),t("valid_classes",{processor:Bi}),t("valid_elements",{processor:"string"}),t("valid_styles",{processor:Bi}),t("verify_html",{processor:"boolean",default:!0}),t("auto_focus",{processor:e=>m(e)||!0===e}),t("browser_spellcheck",{processor:"boolean",default:!1}),t("protect",{processor:"array"}),t("images_file_types",{processor:"string",default:"jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp"}),t("deprecation_warnings",{processor:"boolean",default:!0}),t("a11y_advanced_options",{processor:"boolean",default:!1}),t("api_key",{processor:"string"}),t("paste_block_drop",{processor:"boolean",default:!1}),t("paste_data_images",{processor:"boolean",default:!0}),t("paste_preprocess",{processor:"function"}),t("paste_postprocess",{processor:"function"}),t("paste_webkit_styles",{processor:"string",default:"none"}),t("paste_remove_styles_if_webkit",{processor:"boolean",default:!0}),t("paste_merge_formats",{processor:"boolean",default:!0}),t("smart_paste",{processor:"boolean",default:!0}),t("paste_as_text",{processor:"boolean",default:!1}),t("paste_tab_spaces",{processor:"number",default:4}),t("text_patterns",{processor:e=>k(e,f)||!1===e?{value:Ei(!1===e?[]:e),valid:!0}:{valid:!1,message:"Must be an array of objects or false."},default:[{start:"*",end:"*",format:"italic"},{start:"**",end:"**",format:"bold"},{start:"#",format:"h1"},{start:"##",format:"h2"},{start:"###",format:"h3"},{start:"####",format:"h4"},{start:"#####",format:"h5"},{start:"######",format:"h6"},{start:"1. ",cmd:"InsertOrderedList"},{start:"* ",cmd:"InsertUnorderedList"},{start:"- ",cmd:"InsertUnorderedList"}]}),t("noneditable_class",{processor:"string",default:"mceNonEditable"}),t("editable_class",{processor:"string",default:"mceEditable"}),t("noneditable_regexp",{processor:e=>k(e,Oi)?{value:e,valid:!0}:Oi(e)?{value:[e],valid:!0}:{valid:!1,message:"Must be a RegExp or an array of RegExp."},default:[]}),t("table_tab_navigation",{processor:"boolean",default:!0}),e.on("ScriptsLoaded",(()=>{t("directionality",{processor:"string",default:Xs.isRtl()?"rtl":void 0}),t("placeholder",{processor:"string",default:Ai.getAttrib(e.getElement(),"placeholder")})}))})(o);const s=this.options.get;s("deprecation_warnings")&&((e,t)=>{((e,t)=>{const n=ky(e),o=Sy(t),r=o.length>0,s=n.length>0,a="mobile"===t.theme;if(r||s||a){const e="\n- ",t=a?`\n\nThemes:${e}mobile`:"",i=r?`\n\nPlugins:${e}${o.join(e)}`:"",l=s?`\n\nOptions:${e}${n.join(e)}`:"";console.warn("The following deprecated features are currently enabled and have been removed in TinyMCE 6.0. These features will no longer work and should be removed from the TinyMCE configuration. See https://www.tiny.cloud/docs/tinymce/6/migration-from-5x/ for more information."+t+i+l)}})(e,t)})(t,r);const a=s("suffix");a&&(n.suffix=a),this.suffix=n.suffix;const i=s("base_url");i&&n._setBaseUrl(i),this.baseUri=n.baseURI;const l=rl(o);l&&(qs.ScriptLoader._setReferrerPolicy(l),Hs.DOM.styleSheetLoader._setReferrerPolicy(l)),Qs.languageLoad=s("language_load"),Qs.baseURL=n.baseURL,this.setDirty(!1),this.documentBaseURI=new wv(Mi(o),{base_uri:this.baseUri}),this.baseURI=this.baseUri,this.inline=Rl(o),this.shortcuts=new DR(this),this.editorCommands=new rR(this),oR(this);const d=s("cache_suffix");d&&(Nt.cacheSuffix=d.replace(/^[\?\&]+/,"")),this.ui={registry:PR(),styleSheetLoader:void 0,show:S,hide:S,setEnabled:S,isEnabled:L},this.mode=(e=>{const t=Ws("design"),n=Ws({design:{activate:S,deactivate:S,editorReadOnly:!1},readonly:{activate:S,deactivate:S,editorReadOnly:!0}});return(e=>{e.serializer?cR(e):e.on("PreInit",(()=>{cR(e)}))})(e),(e=>{e.on("ShowCaret",(t=>{dR(e)&&t.preventDefault()})),e.on("ObjectSelected",(t=>{dR(e)&&t.preventDefault()}))})(e),{isReadOnly:()=>dR(e),set:o=>((e,t,n,o)=>{if(o!==n.get()){if(!xe(t,o))throw new Error(`Editor mode '${o}' is invalid`);e.initialized?NR(e,n,t,o):e.on("init",(()=>NR(e,n,t,o)))}})(e,n.get(),t,o),get:()=>t.get(),register:(e,t)=>{n.set(((e,t,n)=>{if(j(ER,t))throw new Error(`Cannot override default mode ${t}`);return{...e,[t]:{...n,deactivate:()=>{try{n.deactivate()}catch(e){console.error(`problem while deactivating editor mode ${t}:`,e)}}}}})(n.get(),e,t))}}})(o),n.dispatch("SetupEditor",{editor:this});const c=$l(o);w(c)&&c.call(o,o)}render(){(e=>{const t=e.id;Xs.setCode(sl(e));const n=()=>{DN.unbind(window,"ready",n),e.render()};if(!Ps.Event.domLoaded)return void DN.bind(window,"ready",n);if(!e.getElement())return;const o=fn(e.getElement()),r=Qt(o);e.on("remove",(()=>{q(o.dom.attributes,(e=>Xt(o,e.name))),Wt(o,r)})),e.ui.styleSheetLoader=((e,t)=>Xo.forElement(e,{contentCssCors:Ml(t),referrerPolicy:rl(t)}))(o,e),Rl(e)?e.inline=!0:(e.orgVisibility=e.getElement().style.visibility,e.getElement().style.visibility="hidden");const s=e.getElement().form||DN.getParent(t,"form");s&&(e.formElement=s,Al(e)&&!No(e.getElement())&&(DN.insertAfter(DN.create("input",{type:"hidden",name:t}),t),e.hasHiddenInput=!0),e.formEventDelegate=t=>{e.dispatch(t.type,t)},DN.bind(s,"submit reset",e.formEventDelegate),e.on("reset",(()=>{e.resetContent()})),!Ol(e)||s.submit.nodeType||s.submit.length||s._mceOldSubmit||(s._mceOldSubmit=s.submit,s.submit=()=>(e.editorManager.triggerSave(),e.setDirty(!1),s._mceOldSubmit(s)))),e.windowManager=Fy(e),e.notificationManager=Ly(e),(e=>"xml"===e.options.get("encoding"))(e)&&e.on("GetContent",(e=>{e.save&&(e.content=DN.encode(e.content))})),Tl(e)&&e.on("submit",(()=>{e.initialized&&e.save()})),Bl(e)&&(e._beforeUnload=()=>{!e.initialized||e.destroyed||e.isHidden()||e.save({format:"raw",no_events:!0,set_dirty:!1})},e.editorManager.on("BeforeUnload",e._beforeUnload)),e.editorManager.add(e),MN(e,e.suffix)})(this)}focus(e){this.execCommand("mceFocus",!1,e)}hasFocus(){return xf(this)}translate(e){return Xs.translate(e)}getParam(e,t,n){const o=this.options;return o.isRegistered(e)||(C(n)?o.register(e,{processor:n,default:t}):o.register(e,{processor:L,default:t})),o.isSet(e)||v(t)?o.get(e):t}hasPlugin(e,t){return!(!j(Il(this),e)||t&&void 0===My.get(e))}nodeChanged(e){this._nodeChangeDispatcher.nodeChanged(e)}addCommand(e,t,n){this.editorCommands.addCommand(e,t,n)}addQueryStateHandler(e,t,n){this.editorCommands.addQueryStateHandler(e,t,n)}addQueryValueHandler(e,t,n){this.editorCommands.addQueryValueHandler(e,t,n)}addShortcut(e,t,n,o){this.shortcuts.add(e,t,n,o)}execCommand(e,t,n,o){return this.editorCommands.execCommand(e,t,n,o)}queryCommandState(e){return this.editorCommands.queryCommandState(e)}queryCommandValue(e){return this.editorCommands.queryCommandValue(e)}queryCommandSupported(e){return this.editorCommands.queryCommandSupported(e)}show(){const e=this;e.hidden&&(e.hidden=!1,e.inline?e.getBody().contentEditable="true":(LR.show(e.getContainer()),LR.hide(e.id)),e.load(),e.dispatch("show"))}hide(){const e=this;e.hidden||(e.save(),e.inline?(e.getBody().contentEditable="false",e===e.editorManager.focusedEditor&&(e.editorManager.focusedEditor=null)):(LR.hide(e.getContainer()),LR.setStyle(e.id,"display",e.orgDisplay)),e.hidden=!0,e.dispatch("hide"))}isHidden(){return this.hidden}setProgressState(e,t){this.dispatch("ProgressState",{state:e,time:t})}load(e){const t=this;let n,o=t.getElement();if(t.removed)return"";if(o){(e=e||{}).load=!0;const r=No(o)?o.value:o.innerHTML;return n=t.setContent(r,e),e.element=o,e.no_events||t.dispatch("LoadContent",e),e.element=o=null,n}}save(e){const t=this;let n,o,r=t.getElement();if(r&&t.initialized&&!t.removed)return(e=e||{}).save=!0,e.element=r,n=e.content=t.getContent(e),e.no_events||t.dispatch("SaveContent",e),"raw"===e.format&&t.dispatch("RawSaveContent",e),n=e.content,No(r)?r.value=n:(!e.is_removing&&t.inline||(r.innerHTML=n),(o=LR.getParent(t.id,"form"))&&IR(o.elements,(e=>{if(e.name===t.id)return e.value=n,!1}))),e.element=r=null,!1!==e.set_dirty&&t.setDirty(!1),n}setContent(e,t){return Cy(this,e,t)}getContent(e){return((e,t={})=>{const n=((e,t)=>({...e,format:t,get:!0,getInner:!0}))(t,t.format?t.format:"html");return Tv(e,n).fold(R,(t=>{const n=((e,t)=>dy(e).editor.getContent(t))(e,t);return Bv(e,n,t)}))})(this,e)}insertContent(e,t){t&&(e=MR({content:e},t)),this.execCommand("mceInsertContent",!1,e)}resetContent(e){void 0===e?Cy(this,this.startContent,{format:"raw"}):Cy(this,e),this.undoManager.reset(),this.setDirty(!1),this.nodeChanged()}isDirty(){return!this.isNotDirty}setDirty(e){const t=!this.isNotDirty;this.isNotDirty=!e,e&&e!==t&&this.dispatch("dirty")}getContainer(){const e=this;return e.container||(e.container=LR.get(e.editorContainer||e.id+"_parent")),e.container}getContentAreaContainer(){return this.contentAreaContainer}getElement(){return this.targetElm||(this.targetElm=LR.get(this.id)),this.targetElm}getWin(){const e=this;let t;return e.contentWindow||(t=e.iframeElement,t&&(e.contentWindow=t.contentWindow)),e.contentWindow}getDoc(){const e=this;let t;return e.contentDocument||(t=e.getWin(),t&&(e.contentDocument=t.document)),e.contentDocument}getBody(){const e=this.getDoc();return this.bodyElement||(e?e.body:null)}convertURL(e,t,n){const o=this,r=o.options.get,s=Wl(o);return w(s)?s.call(o,e,n,!0,t):!r("convert_urls")||n&&"LINK"===n.nodeName||0===e.indexOf("file:")||0===e.length?e:r("relative_urls")?o.documentBaseURI.toRelative(e):e=o.documentBaseURI.toAbsolute(e,r("remove_script_host"))}addVisual(e){((e,t)=>{((e,t)=>{cy(e).editor.addVisual(t)})(e,t)})(this,e)}remove(){(e=>{if(!e.removed){const{_selectionOverrides:t,editorUpload:n}=e,o=e.getBody(),r=e.getElement();o&&e.save({is_removing:!0}),e.removed=!0,e.unbindAllNativeEvents(),e.hasHiddenInput&&r&&_y.remove(r.nextSibling),(e=>{e.dispatch("remove")})(e),e.editorManager.remove(e),!e.inline&&o&&(e=>{_y.setStyle(e.id,"display",e.orgDisplay)})(e),(e=>{e.dispatch("detach")})(e),_y.remove(e.getContainer()),Ey(t),Ey(n),e.destroy()}})(this)}destroy(e){((e,t)=>{const{selection:n,dom:o}=e;e.destroyed||(t||e.removed?(t||(e.editorManager.off("beforeunload",e._beforeUnload),e.theme&&e.theme.destroy&&e.theme.destroy(),Ey(n),Ey(o)),(e=>{const t=e.formElement;t&&(t._mceOldSubmit&&(t.submit=t._mceOldSubmit,t._mceOldSubmit=null),_y.unbind(t,"submit reset",e.formEventDelegate))})(e),(e=>{e.contentAreaContainer=e.formElement=e.container=e.editorContainer=null,e.bodyElement=e.contentDocument=e.contentWindow=null,e.iframeElement=e.targetElm=null,e.selection&&(e.selection=e.selection.win=e.selection.dom=e.selection.dom.doc=null)})(e),e.destroyed=!0):e.remove())})(this,e)}uploadImages(){return this.editorUpload.uploadImages()}_scanForImages(){return this.editorUpload.scanForImages()}}const UR=Hs.DOM,zR=Bt.each;let jR,VR=!1,HR=[];const $R=e=>{const t=e.type;zR(GR.get(),(n=>{switch(t){case"scroll":n.dispatch("ScrollWindow",e);break;case"resize":n.dispatch("ResizeWindow",e)}}))},qR=e=>{if(e!==VR){const t=Hs.DOM;e?(t.bind(window,"resize",$R),t.bind(window,"scroll",$R)):(t.unbind(window,"resize",$R),t.unbind(window,"scroll",$R)),VR=e}},WR=e=>{const t=HR;return HR=K(HR,(t=>e!==t)),GR.activeEditor===e&&(GR.activeEditor=HR.length>0?HR[0]:null),GR.focusedEditor===e&&(GR.focusedEditor=null),t.length!==HR.length},KR="CSS1Compat"!==document.compatMode,GR={...pR,baseURI:null,baseURL:null,defaultOptions:{},documentBaseURL:null,suffix:null,majorVersion:"6",minorVersion:"1.0",releaseDate:"2022-06-29",i18n:Xs,activeEditor:null,focusedEditor:null,setup(){const e=this;let t,n,o="";n=wv.getDocumentBaseUrl(document.location),/^[^:]+:\/\/\/?[^\/]+\//.test(n)&&(n=n.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(n)||(n+="/"));const r=window.tinymce||window.tinyMCEPreInit;if(r)t=r.base||r.baseURL,o=r.suffix;else{const e=document.getElementsByTagName("script");for(let n=0;n<e.length;n++){const r=e[n].src||"";if(""===r)continue;const s=r.substring(r.lastIndexOf("/"));if(/tinymce(\.full|\.jquery|)(\.min|\.dev|)\.js/.test(r)){-1!==s.indexOf(".min")&&(o=".min"),t=r.substring(0,r.lastIndexOf("/"));break}}if(!t&&document.currentScript){const e=document.currentScript.src;-1!==e.indexOf(".min")&&(o=".min"),t=e.substring(0,e.lastIndexOf("/"))}}var s;e.baseURL=new wv(n).toAbsolute(t),e.documentBaseURL=n,e.baseURI=new wv(e.baseURL),e.suffix=o,(s=e).on("AddEditor",O(vf,s)),s.on("RemoveEditor",O(yf,s))},overrideDefaults(e){const t=e.base_url;t&&this._setBaseUrl(t);const n=e.suffix;e.suffix&&(this.suffix=n),this.defaultOptions=e;const o=e.plugin_base_urls;void 0!==o&&fe(o,((e,t)=>{Qs.PluginManager.urls[t]=e}))},init(e){const t=this;let n;const o=Bt.makeMap("area base basefont br col frame hr img input isindex link meta param embed source wbr track colgroup option table tbody tfoot thead tr th td script noscript style textarea video audio iframe object menu"," ");let r=e=>{n=e};const s=()=>{let n=0;const a=[];let i;UR.unbind(window,"ready",s),(n=>{const o=e.onpageload;o&&o.apply(t,[])})(),i=((e,t)=>{const n=[],o=w(t)?e=>V(n,(n=>t(n,e))):e=>j(n,e);for(let t=0,r=e.length;t<r;t++){const r=e[t];o(r)||n.push(r)}return n})((e=>Nt.browser.isIE()||Nt.browser.isEdge()?(Hy("TinyMCE does not support the browser you are using. For a list of supported browsers please see: https://www.tiny.cloud/docs/tinymce/6/support/#supportedwebbrowsers"),[]):KR?(Hy("Failed to initialize the editor as the document is not in standards mode. TinyMCE requires standards mode."),[]):m(e.selector)?UR.select(e.selector):C(e.target)?[e.target]:[])(e)),Bt.each(i,(e=>{var n;(n=t.get(e.id))&&n.initialized&&!(n.getContainer()||n.getBody()).parentNode&&(WR(n),n.unbindAllNativeEvents(),n.destroy(!0),n.removed=!0,n=null)})),i=Bt.grep(i,(e=>!t.get(e.id))),0===i.length?r([]):zR(i,(s=>{((e,t)=>e.inline&&t.tagName.toLowerCase()in o)(e,s)?Hy("Could not initialize inline editor on invalid inline target element",s):((e,o,s)=>{const l=new FR(e,o,t);a.push(l),l.on("init",(()=>{++n===i.length&&r(a)})),l.targetElm=l.targetElm||s,l.render()})((e=>{let t=e.id;return t||(t=we(e,"name").filter((e=>!UR.get(e))).getOrThunk(UR.uniqueId),e.setAttribute("id",t)),t})(s),e,s)}))};return UR.bind(window,"ready",s),new Promise((e=>{n?e(n):r=t=>{e(t)}}))},get(e){return 0===arguments.length?HR.slice(0):m(e)?Q(HR,(t=>t.id===e)).getOr(null):x(e)&&HR[e]?HR[e]:null},add(e){const t=this,n=t.get(e.id);return n===e||(null===n&&HR.push(e),qR(!0),t.activeEditor=e,t.dispatch("AddEditor",{editor:e}),jR||(jR=e=>{const n=t.dispatch("BeforeUnload");if(n.returnValue)return e.preventDefault(),e.returnValue=n.returnValue,n.returnValue},window.addEventListener("beforeunload",jR))),e},createEditor(e,t){return this.add(new FR(e,t,this))},remove(e){const t=this;let n,o;if(e){if(!m(e))return o=e,h(t.get(o.id))?null:(WR(o)&&t.dispatch("RemoveEditor",{editor:o}),0===HR.length&&window.removeEventListener("beforeunload",jR),o.remove(),qR(HR.length>0),o);zR(UR.select(e),(e=>{o=t.get(e.id),o&&t.remove(o)}))}else for(n=HR.length-1;n>=0;n--)t.remove(HR[n])},execCommand(e,t,n){var o;const r=this,s=f(n)?null!==(o=n.id)&&void 0!==o?o:n.index:n;switch(e){case"mceAddEditor":if(!r.get(s)){const e=n.options;new FR(s,e,r).render()}return!0;case"mceRemoveEditor":{const e=r.get(s);return e&&e.remove(),!0}case"mceToggleEditor":{const e=r.get(s);return e?(e.isHidden()?e.show():e.hide(),!0):(r.execCommand("mceAddEditor",!1,n),!0)}}return!!r.activeEditor&&r.activeEditor.execCommand(e,t,n)},triggerSave:()=>{zR(HR,(e=>{e.save()}))},addI18n:(e,t)=>{Xs.add(e,t)},translate:e=>Xs.translate(e),setActive(e){const t=this.activeEditor;this.activeEditor!==e&&(t&&t.dispatch("deactivate",{relatedTarget:e}),e.dispatch("activate",{relatedTarget:t})),this.activeEditor=e},_setBaseUrl(e){this.baseURL=new wv(this.documentBaseURL).toAbsolute(e.replace(/\/+$/,"")),this.baseURI=new wv(this.baseURL)}};GR.setup();const YR=(()=>{const e=Js();return{FakeClipboardItem:e=>({items:e,types:ue(e),getType:t=>we(e,t).getOrUndefined()}),write:t=>{e.set(t)},read:()=>e.get().getOrUndefined(),clear:e.clear}})(),XR=Math.min,QR=Math.max,JR=Math.round,ZR=(e,t,n)=>{let o=t.x,r=t.y;const s=e.w,a=e.h,i=t.w,l=t.h,d=(n||"").split("");return"b"===d[0]&&(r+=l),"r"===d[1]&&(o+=i),"c"===d[0]&&(r+=JR(l/2)),"c"===d[1]&&(o+=JR(i/2)),"b"===d[3]&&(r-=a),"r"===d[4]&&(o-=s),"c"===d[3]&&(r-=JR(a/2)),"c"===d[4]&&(o-=JR(s/2)),eA(o,r,s,a)},eA=(e,t,n,o)=>({x:e,y:t,w:n,h:o}),tA={inflate:(e,t,n)=>eA(e.x-t,e.y-n,e.w+2*t,e.h+2*n),relativePosition:ZR,findBestRelativePosition:(e,t,n,o)=>{let r,s;for(s=0;s<o.length;s++)if(r=ZR(e,t,o[s]),r.x>=n.x&&r.x+r.w<=n.w+n.x&&r.y>=n.y&&r.y+r.h<=n.h+n.y)return o[s];return null},intersect:(e,t)=>{const n=QR(e.x,t.x),o=QR(e.y,t.y),r=XR(e.x+e.w,t.x+t.w),s=XR(e.y+e.h,t.y+t.h);return r-n<0||s-o<0?null:eA(n,o,r-n,s-o)},clamp:(e,t,n)=>{let o=e.x,r=e.y,s=e.x+e.w,a=e.y+e.h;const i=t.x+t.w,l=t.y+t.h,d=QR(0,t.x-o),c=QR(0,t.y-r),u=QR(0,s-i),m=QR(0,a-l);return o+=d,r+=c,n&&(s+=d,a+=c,o-=u,r-=m),s-=u,a-=m,eA(o,r,s-o,a-r)},create:eA,fromClientRect:e=>eA(e.left,e.top,e.width,e.height)},nA=(()=>{const e={},t={};return{load:(n,o)=>{const r=`Script at URL "${o}" failed to load`,s=`Script at URL "${o}" did not call \`tinymce.Resource.add('${n}', data)\` within 1 second`;if(void 0!==e[n])return e[n];{const a=new Promise(((e,a)=>{const i=((e,t,n=1e3)=>{let o=!1,r=null;const s=e=>(...t)=>{o||(o=!0,null!==r&&(clearTimeout(r),r=null),e.apply(null,t))},a=s(e),i=s(t);return{start:(...e)=>{o||null!==r||(r=setTimeout((()=>i.apply(null,e)),n))},resolve:a,reject:i}})(e,a);t[n]=i.resolve,qs.ScriptLoader.loadScript(o).then((()=>i.start(s)),(()=>i.reject(r)))}));return e[n]=a,a}},add:(n,o)=>{void 0!==t[n]&&(t[n](o),delete t[n]),e[n]=Promise.resolve(o)},unload:t=>{delete e[t]}}})();let oA;try{const e="__storage_test__";oA=window.localStorage,oA.setItem(e,e),oA.removeItem(e)}catch(e){oA=(()=>{let e={},t=[];const n={getItem:t=>e[t]||null,setItem:(n,o)=>{t.push(n),e[n]=String(o)},key:e=>t[e],removeItem:n=>{t=t.filter((e=>e===n)),delete e[n]},clear:()=>{t=[],e={}},length:0};return Object.defineProperty(n,"length",{get:()=>t.length,configurable:!1,enumerable:!1}),n})()}const rA={geom:{Rect:tA},util:{Delay:gf,Tools:Bt,VK:em,URI:wv,EventDispatcher:fR,Observable:pR,I18n:Xs,LocalStorage:oA,ImageUploader:e=>{const t=Ky(),n=Qy(e,t);return{upload:(t,o=!0)=>n.upload(t,o?Xy(e):void 0)}}},dom:{EventUtils:Ps,TreeWalker:Qo,TextSeeker:Ca,DOMUtils:Hs,ScriptLoader:qs,RangeUtils:Pm,Serializer:yy,StyleSheetLoader:Yo,ControlSelection:sm,BookmarkManager:Wu,Selection:hy,Event:Ps.Event},html:{Styles:_s,Entities:ms,Node:Ff,Schema:Ss,DomParser:Av,Writer:Wf,Serializer:Kf},Env:Nt,AddOnManager:Qs,Annotator:qu,Formatter:lC,UndoManager:cC,EditorCommands:rR,WindowManager:Fy,NotificationManager:Ly,EditorObservable:wR,Shortcuts:DR,Editor:FR,FocusManager:ff,EditorManager:GR,DOM:Hs.DOM,ScriptLoader:qs.ScriptLoader,PluginManager:My,ThemeManager:Iy,ModelManager:Ry,IconManager:Ny,Resource:nA,FakeClipboard:YR,trim:Bt.trim,isArray:Bt.isArray,is:Bt.is,toArray:Bt.toArray,makeMap:Bt.makeMap,each:Bt.each,map:Bt.map,grep:Bt.grep,inArray:Bt.inArray,extend:Bt.extend,walk:Bt.walk,resolve:Bt.resolve,explode:Bt.explode,_addCacheSuffix:Bt._addCacheSuffix},sA=Bt.extend(GR,rA);(e=>{window.tinymce=e,window.tinyMCE=e})(sA),(e=>{if("object"==typeof module)try{module.exports=e}catch(e){}})(sA)}();
4
+ !function(){"use strict";var e=function(e){if(null===e)return"null";if(void 0===e)return"undefined";var t=typeof e;return"object"===t&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"===t&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":t},t=function(e){return{eq:e}},n=t((function(e,t){return e===t})),o=function(e){return t((function(t,n){if(t.length!==n.length)return!1;for(var o=t.length,r=0;r<o;r++)if(!e.eq(t[r],n[r]))return!1;return!0}))},r=function(e){return t((function(r,s){var a=Object.keys(r),i=Object.keys(s);if(!function(e,n){return function(e,n){return t((function(t,o){return e.eq(n(t),n(o))}))}(o(e),(function(e){return function(e,t){return Array.prototype.slice.call(e).sort(t)}(e,n)}))}(n).eq(a,i))return!1;for(var l=a.length,d=0;d<l;d++){var c=a[d];if(!e.eq(r[c],s[c]))return!1}return!0}))},s=t((function(t,n){if(t===n)return!0;var a=e(t);return a===e(n)&&(function(e){return-1!==["undefined","boolean","number","string","function","xml","null"].indexOf(e)}(a)?t===n:"array"===a?o(s).eq(t,n):"object"===a&&r(s).eq(t,n))}));const a=Object.getPrototypeOf,i=(e,t,n)=>{var o;return!!n(e,t.prototype)||(null===(o=e.constructor)||void 0===o?void 0:o.name)===t.name},l=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&i(e,String,((e,t)=>t.isPrototypeOf(e)))?"string":t})(t)===e,d=e=>t=>typeof t===e,c=e=>t=>e===t,u=(e,t)=>f(e)&&i(e,t,((e,t)=>a(e)===t)),m=l("string"),f=l("object"),g=e=>u(e,Object),p=l("array"),h=c(null),b=d("boolean"),v=c(void 0),y=e=>null==e,C=e=>!y(e),w=d("function"),E=d("number"),x=(e,t)=>{if(p(e)){for(let n=0,o=e.length;n<o;++n)if(!t(e[n]))return!1;return!0}return!1},_=()=>{},k=(e,t)=>(...n)=>e(t.apply(null,n)),S=(e,t)=>n=>e(t(n)),N=e=>()=>e,R=e=>e,A=(e,t)=>e===t;function T(e,...t){return(...n)=>{const o=t.concat(n);return e.apply(null,o)}}const O=e=>t=>!e(t),B=e=>()=>{throw new Error(e)},P=e=>e(),D=e=>{e()},L=N(!1),M=N(!0);class I{constructor(e,t){this.tag=e,this.value=t}static some(e){return new I(!0,e)}static none(){return I.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?I.some(e(this.value)):I.none()}bind(e){return this.tag?e(this.value):I.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:I.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return C(e)?I.some(e):I.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}I.singletonNone=new I(!1);const F=Array.prototype.slice,U=Array.prototype.indexOf,z=Array.prototype.push,j=(e,t)=>U.call(e,t),H=(e,t)=>j(e,t)>-1,$=(e,t)=>{for(let n=0,o=e.length;n<o;n++)if(t(e[n],n))return!0;return!1},V=(e,t)=>{const n=e.length,o=new Array(n);for(let r=0;r<n;r++){const n=e[r];o[r]=t(n,r)}return o},q=(e,t)=>{for(let n=0,o=e.length;n<o;n++)t(e[n],n)},W=(e,t)=>{for(let n=e.length-1;n>=0;n--)t(e[n],n)},K=(e,t)=>{const n=[],o=[];for(let r=0,s=e.length;r<s;r++){const s=e[r];(t(s,r)?n:o).push(s)}return{pass:n,fail:o}},Y=(e,t)=>{const n=[];for(let o=0,r=e.length;o<r;o++){const r=e[o];t(r,o)&&n.push(r)}return n},G=(e,t,n)=>(W(e,((e,o)=>{n=t(n,e,o)})),n),X=(e,t,n)=>(q(e,((e,o)=>{n=t(n,e,o)})),n),Z=(e,t,n)=>{for(let o=0,r=e.length;o<r;o++){const r=e[o];if(t(r,o))return I.some(r);if(n(r,o))break}return I.none()},Q=(e,t)=>Z(e,t,L),J=(e,t)=>{for(let n=0,o=e.length;n<o;n++)if(t(e[n],n))return I.some(n);return I.none()},ee=e=>{const t=[];for(let n=0,o=e.length;n<o;++n){if(!p(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);z.apply(t,e[n])}return t},te=(e,t)=>ee(V(e,t)),ne=(e,t)=>{for(let n=0,o=e.length;n<o;++n)if(!0!==t(e[n],n))return!1;return!0},oe=e=>{const t=F.call(e,0);return t.reverse(),t},re=(e,t)=>Y(e,(e=>!H(t,e))),se=(e,t)=>{const n={};for(let o=0,r=e.length;o<r;o++){const r=e[o];n[String(r)]=t(r,o)}return n},ae=(e,t)=>{const n=F.call(e,0);return n.sort(t),n},ie=(e,t)=>t>=0&&t<e.length?I.some(e[t]):I.none(),le=e=>ie(e,0),de=e=>ie(e,e.length-1),ce=w(Array.from)?Array.from:e=>F.call(e),ue=(e,t)=>{for(let n=0;n<e.length;n++){const o=t(e[n],n);if(o.isSome())return o}return I.none()},me=(e,t)=>{const n=[],o=w(t)?e=>$(n,(n=>t(n,e))):e=>H(n,e);for(let t=0,r=e.length;t<r;t++){const r=e[t];o(r)||n.push(r)}return n},fe=Object.keys,ge=Object.hasOwnProperty,pe=(e,t)=>{const n=fe(e);for(let o=0,r=n.length;o<r;o++){const r=n[o];t(e[r],r)}},he=(e,t)=>be(e,((e,n)=>({k:n,v:t(e,n)}))),be=(e,t)=>{const n={};return pe(e,((e,o)=>{const r=t(e,o);n[r.k]=r.v})),n},ve=e=>(t,n)=>{e[n]=t},ye=(e,t,n,o)=>{pe(e,((e,r)=>{(t(e,r)?n:o)(e,r)}))},Ce=(e,t)=>{const n={};return ye(e,t,ve(n),_),n},we=(e,t)=>{const n=[];return pe(e,((e,o)=>{n.push(t(e,o))})),n},Ee=e=>we(e,R),xe=(e,t)=>_e(e,t)?I.from(e[t]):I.none(),_e=(e,t)=>ge.call(e,t),ke=(e,t)=>_e(e,t)&&void 0!==e[t]&&null!==e[t],Se=e=>{const t={};return q(e,(e=>{t[e]={}})),fe(t)},Ne=e=>void 0!==e.length,Re=Array.isArray,Ae=(e,t,n)=>{if(!e)return!1;if(n=n||e,Ne(e)){for(let o=0,r=e.length;o<r;o++)if(!1===t.call(n,e[o],o,e))return!1}else for(const o in e)if(_e(e,o)&&!1===t.call(n,e[o],o,e))return!1;return!0},Te=(e,t)=>{const n=[];return Ae(e,((o,r)=>{n.push(t(o,r,e))})),n},Oe=(e,t)=>{const n=[];return Ae(e,((o,r)=>{t&&!t(o,r,e)||n.push(o)})),n},Be=(e,t,n,o)=>{let r=v(n)?e[0]:n;for(let n=0;n<e.length;n++)r=t.call(o,r,e[n],n);return r},Pe=(e,t,n)=>{for(let o=0,r=e.length;o<r;o++)if(t.call(n,e[o],o,e))return o;return-1},De=e=>e[e.length-1],Le=e=>{let t,n=!1;return(...o)=>(n||(n=!0,t=e.apply(null,o)),t)},Me=()=>Ie(0,0),Ie=(e,t)=>({major:e,minor:t}),Fe={nu:Ie,detect:(e,t)=>{const n=String(t).toLowerCase();return 0===e.length?Me():((e,t)=>{const n=((e,t)=>{for(let n=0;n<e.length;n++){const o=e[n];if(o.test(t))return o}})(e,t);if(!n)return{major:0,minor:0};const o=e=>Number(t.replace(n,"$"+e));return Ie(o(1),o(2))})(e,n)},unknown:Me},Ue=(e,t)=>{const n=String(t).toLowerCase();return Q(e,(e=>e.search(n)))},ze=(e,t,n)=>""===t||e.length>=t.length&&e.substr(n,n+t.length)===t,je=(e,t)=>$e(e,t)?((e,t)=>e.substring(t))(e,t.length):e,He=(e,t,n=0,o)=>{const r=e.indexOf(t,n);return-1!==r&&(!!v(o)||r+t.length<=o)},$e=(e,t)=>ze(e,t,0),Ve=(e,t)=>ze(e,t,e.length-t.length),qe=e=>t=>t.replace(e,""),We=qe(/^\s+|\s+$/g),Ke=qe(/^\s+/g),Ye=qe(/\s+$/g),Ge=e=>e.length>0,Xe=e=>!Ge(e),Ze=(e,t=10)=>{const n=parseInt(e,t);return isNaN(n)?I.none():I.some(n)},Qe=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Je=e=>t=>He(t,e),et=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>He(e,"edge/")&&He(e,"chrome")&&He(e,"safari")&&He(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Qe],search:e=>He(e,"chrome")&&!He(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>He(e,"msie")||He(e,"trident")},{name:"Opera",versionRegexes:[Qe,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Je("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Je("firefox")},{name:"Safari",versionRegexes:[Qe,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(He(e,"safari")||He(e,"mobile/"))&&He(e,"applewebkit")}],tt=[{name:"Windows",search:Je("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>He(e,"iphone")||He(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Je("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:Je("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Je("linux"),versionRegexes:[]},{name:"Solaris",search:Je("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Je("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:Je("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],nt={browsers:N(et),oses:N(tt)},ot="Edge",rt="Chromium",st="Opera",at="Firefox",it="Safari",lt=e=>{const t=e.current,n=e.version,o=e=>()=>t===e;return{current:t,version:n,isEdge:o(ot),isChromium:o(rt),isIE:o("IE"),isOpera:o(st),isFirefox:o(at),isSafari:o(it)}},dt=()=>lt({current:void 0,version:Fe.unknown()}),ct=lt,ut=(N(ot),N(rt),N("IE"),N(st),N(at),N(it),"Windows"),mt="Android",ft="Linux",gt="macOS",pt="Solaris",ht="FreeBSD",bt="ChromeOS",vt=e=>{const t=e.current,n=e.version,o=e=>()=>t===e;return{current:t,version:n,isWindows:o(ut),isiOS:o("iOS"),isAndroid:o(mt),isMacOS:o(gt),isLinux:o(ft),isSolaris:o(pt),isFreeBSD:o(ht),isChromeOS:o(bt)}},yt=()=>vt({current:void 0,version:Fe.unknown()}),Ct=vt,wt=(N(ut),N("iOS"),N(mt),N(ft),N(gt),N(pt),N(ht),N(bt),e=>window.matchMedia(e).matches);let Et=Le((()=>((e,t,n)=>{const o=nt.browsers(),r=nt.oses(),s=t.bind((e=>((e,t)=>ue(t.brands,(t=>{const n=t.brand.toLowerCase();return Q(e,(e=>{var t;return n===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())})).map((e=>({current:e.name,version:Fe.nu(parseInt(t.version,10),0)})))})))(o,e))).orThunk((()=>((e,t)=>Ue(e,t).map((e=>{const n=Fe.detect(e.versionRegexes,t);return{current:e.name,version:n}})))(o,e))).fold(dt,ct),a=((e,t)=>Ue(e,t).map((e=>{const n=Fe.detect(e.versionRegexes,t);return{current:e.name,version:n}})))(r,e).fold(yt,Ct),i=((e,t,n,o)=>{const r=e.isiOS()&&!0===/ipad/i.test(n),s=e.isiOS()&&!r,a=e.isiOS()||e.isAndroid(),i=a||o("(pointer:coarse)"),l=r||!s&&a&&o("(min-device-width:768px)"),d=s||a&&!l,c=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(n),u=!d&&!l&&!c;return{isiPad:N(r),isiPhone:N(s),isTablet:N(l),isPhone:N(d),isTouch:N(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:N(c),isDesktop:N(u)}})(a,s,e,n);return{browser:s,os:a,deviceType:i}})(window.navigator.userAgent,I.from(window.navigator.userAgentData),wt)));const xt=()=>Et(),_t=window.navigator.userAgent,kt=xt(),St=kt.browser,Nt=kt.os,Rt=kt.deviceType,At=-1!==_t.indexOf("Windows Phone"),Tt={transparentSrc:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",documentMode:St.isIE()?document.documentMode||7:10,cacheSuffix:null,container:null,canHaveCSP:!St.isIE(),windowsPhone:At,browser:{current:St.current,version:St.version,isChromium:St.isChromium,isEdge:St.isEdge,isFirefox:St.isFirefox,isIE:St.isIE,isOpera:St.isOpera,isSafari:St.isSafari},os:{current:Nt.current,version:Nt.version,isAndroid:Nt.isAndroid,isChromeOS:Nt.isChromeOS,isFreeBSD:Nt.isFreeBSD,isiOS:Nt.isiOS,isLinux:Nt.isLinux,isMacOS:Nt.isMacOS,isSolaris:Nt.isSolaris,isWindows:Nt.isWindows},deviceType:{isDesktop:Rt.isDesktop,isiPad:Rt.isiPad,isiPhone:Rt.isiPhone,isPhone:Rt.isPhone,isTablet:Rt.isTablet,isTouch:Rt.isTouch,isWebView:Rt.isWebView}},Ot=/^\s*|\s*$/g,Bt=e=>y(e)?"":(""+e).replace(Ot,""),Pt=function(e,t,n,o){o=o||this,e&&(n&&(e=e[n]),Ae(e,((e,r)=>!1!==t.call(o,e,r,n)&&(Pt(e,t,n,o),!0))))},Dt={trim:Bt,isArray:Re,is:(e,t)=>t?!("array"!==t||!Re(e))||typeof e===t:void 0!==e,toArray:e=>{if(Re(e))return e;{const t=[];for(let n=0,o=e.length;n<o;n++)t[n]=e[n];return t}},makeMap:(e,t,n={})=>{const o=m(e)?e.split(t||","):e||[];let r=o.length;for(;r--;)n[o[r]]={};return n},each:Ae,map:Te,grep:Oe,inArray:(e,t)=>{if(e)for(let n=0,o=e.length;n<o;n++)if(e[n]===t)return n;return-1},hasOwn:_e,extend:(e,...t)=>{for(let n=0;n<t.length;n++){const o=t[n];for(const t in o)if(_e(o,t)){const n=o[t];void 0!==n&&(e[t]=n)}}return e},walk:Pt,resolve:(e,t=window)=>{const n=e.split(".");for(let e=0,o=n.length;e<o&&(t=t[n[e]]);e++);return t},explode:(e,t)=>p(e)?e:""===e?[]:Te(e.split(t||","),Bt),_addCacheSuffix:e=>{const t=Tt.cacheSuffix;return t&&(e+=(-1===e.indexOf("?")?"?":"&")+t),e}},Lt=(e,t,n=A)=>e.exists((e=>n(e,t))),Mt=(e,t,n=A)=>It(e,t,n).getOr(e.isNone()&&t.isNone()),It=(e,t,n)=>e.isSome()&&t.isSome()?I.some(n(e.getOrDie(),t.getOrDie())):I.none(),Ft=(e,t)=>e?I.some(t):I.none(),Ut="undefined"!=typeof window?window:Function("return this;")(),zt=(e,t)=>((e,t)=>{let n=null!=t?t:Ut;for(let t=0;t<e.length&&null!=n;++t)n=n[e[t]];return n})(e.split("."),t),jt=Object.getPrototypeOf,Ht=e=>{const t=zt("ownerDocument.defaultView",e);return f(e)&&((e=>((e,t)=>{const n=((e,t)=>zt(e,t))(e,t);if(null==n)throw new Error(e+" not available on this browser");return n})("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(jt(e).constructor.name))},$t=e=>e.dom.nodeName.toLowerCase(),Vt=e=>e.dom.nodeType,qt=e=>t=>Vt(t)===e,Wt=e=>Kt(e)&&Ht(e.dom),Kt=qt(1),Yt=qt(3),Gt=qt(9),Xt=qt(11),Zt=e=>t=>Kt(t)&&$t(t)===e,Qt=(e,t,n)=>{if(!(m(n)||b(n)||E(n)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",n,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,n+"")},Jt=(e,t,n)=>{Qt(e.dom,t,n)},en=(e,t)=>{const n=e.dom;pe(t,((e,t)=>{Qt(n,t,e)}))},tn=(e,t)=>{const n=e.dom.getAttribute(t);return null===n?void 0:n},nn=(e,t)=>I.from(tn(e,t)),on=(e,t)=>{const n=e.dom;return!(!n||!n.hasAttribute)&&n.hasAttribute(t)},rn=(e,t)=>{e.dom.removeAttribute(t)},sn=e=>X(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}),an=(e,t)=>{const n=tn(e,t);return void 0===n||""===n?[]:n.split(" ")},ln=e=>void 0!==e.dom.classList,dn=e=>an(e,"class"),cn=(e,t)=>((e,t,n)=>{const o=an(e,t).concat([n]);return Jt(e,t,o.join(" ")),!0})(e,"class",t),un=(e,t)=>((e,t,n)=>{const o=Y(an(e,t),(e=>e!==n));return o.length>0?Jt(e,t,o.join(" ")):rn(e,t),!1})(e,"class",t),mn=(e,t)=>{ln(e)?e.dom.classList.add(t):cn(e,t)},fn=e=>{0===(ln(e)?e.dom.classList:dn(e)).length&&rn(e,"class")},gn=(e,t)=>{ln(e)?e.dom.classList.remove(t):un(e,t),fn(e)},pn=(e,t)=>ln(e)&&e.dom.classList.contains(t),hn=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},bn=(e,t)=>{const n=(t||document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||n.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return hn(n.childNodes[0])},vn=(e,t)=>{const n=(t||document).createElement(e);return hn(n)},yn=(e,t)=>{const n=(t||document).createTextNode(e);return hn(n)},Cn=hn,wn=(e,t,n)=>I.from(e.dom.elementFromPoint(t,n)).map(hn),En=(e,t)=>{const n=[],o=e=>(n.push(e),t(e));let r=t(e);do{r=r.bind(o)}while(r.isSome());return n},xn=(e,t)=>{const n=e.dom;if(1!==n.nodeType)return!1;{const e=n;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},_n=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,kn=(e,t)=>e.dom===t.dom,Sn=(e,t)=>{const n=e.dom,o=t.dom;return n!==o&&n.contains(o)},Nn=e=>Cn(e.dom.ownerDocument),Rn=e=>Gt(e)?e:Nn(e),An=e=>Cn(Rn(e).dom.defaultView),Tn=e=>I.from(e.dom.parentNode).map(Cn),On=e=>I.from(e.dom.parentElement).map(Cn),Bn=(e,t)=>{const n=w(t)?t:L;let o=e.dom;const r=[];for(;null!==o.parentNode&&void 0!==o.parentNode;){const e=o.parentNode,t=Cn(e);if(r.push(t),!0===n(t))break;o=e}return r},Pn=e=>I.from(e.dom.previousSibling).map(Cn),Dn=e=>I.from(e.dom.nextSibling).map(Cn),Ln=e=>oe(En(e,Pn)),Mn=e=>En(e,Dn),In=e=>V(e.dom.childNodes,Cn),Fn=(e,t)=>{const n=e.dom.childNodes;return I.from(n[t]).map(Cn)},Un=e=>Fn(e,0),zn=e=>Fn(e,e.dom.childNodes.length-1),jn=e=>e.dom.childNodes.length,Hn=e=>Xt(e)&&C(e.dom.host),$n=e=>Cn(e.dom.getRootNode()),Vn=e=>Hn(e)?e:(e=>{const t=e.dom.head;if(null==t)throw new Error("Head is not available yet");return Cn(t)})(Rn(e)),qn=e=>Cn(e.dom.host),Wn=e=>{if(C(e.target)){const t=Cn(e.target);if(Kt(t)&&Kn(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return le(t)}}return I.from(e.target)},Kn=e=>C(e.dom.shadowRoot),Yn=e=>{const t=Yt(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const n=t.ownerDocument;return(e=>{const t=$n(e);return Hn(t)?I.some(t):I.none()})(Cn(t)).fold((()=>n.body.contains(t)),S(Yn,qn))};var Gn=(e,t,n,o,r)=>e(n,o)?I.some(n):w(r)&&r(n)?I.none():t(n,o,r);const Xn=(e,t,n)=>{let o=e.dom;const r=w(n)?n:L;for(;o.parentNode;){o=o.parentNode;const e=Cn(o);if(t(e))return I.some(e);if(r(e))break}return I.none()},Zn=(e,t,n)=>Gn(((e,t)=>t(e)),Xn,e,t,n),Qn=(e,t)=>{const n=e=>{for(let o=0;o<e.childNodes.length;o++){const r=Cn(e.childNodes[o]);if(t(r))return I.some(r);const s=n(e.childNodes[o]);if(s.isSome())return s}return I.none()};return n(e.dom)},Jn=(e,t,n)=>Xn(e,(e=>xn(e,t)),n),eo=(e,t)=>((e,t)=>{const n=void 0===t?document:t.dom;return _n(n)?I.none():I.from(n.querySelector(e)).map(Cn)})(t,e),to=(e,t,n)=>Gn(((e,t)=>xn(e,t)),Jn,e,t,n),no=(e,t=!1)=>{return Yn(e)?e.dom.isContentEditable:(n=e,to(n,"[contenteditable]")).fold(N(t),(e=>"true"===oo(e)));var n},oo=e=>e.dom.contentEditable,ro=(e,t)=>{e.dom.contentEditable=t?"true":"false"},so=e=>void 0!==e.style&&w(e.style.getPropertyValue),ao=(e,t,n)=>{if(!m(n))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",n,":: Element ",e),new Error("CSS value must be a string: "+n);so(e)&&e.style.setProperty(t,n)},io=(e,t,n)=>{const o=e.dom;ao(o,t,n)},lo=(e,t)=>{const n=e.dom;pe(t,((e,t)=>{ao(n,t,e)}))},co=(e,t)=>{const n=e.dom,o=window.getComputedStyle(n).getPropertyValue(t);return""!==o||Yn(e)?o:uo(n,t)},uo=(e,t)=>so(e)?e.style.getPropertyValue(t):"",mo=(e,t)=>{const n=e.dom,o=uo(n,t);return I.from(o).filter((e=>e.length>0))},fo=e=>{const t={},n=e.dom;if(so(n))for(let e=0;e<n.style.length;e++){const o=n.style.item(e);t[o]=n.style[o]}return t},go=(e,t)=>{((e,t)=>{so(e)&&e.style.removeProperty(t)})(e.dom,t),Lt(nn(e,"style").map(We),"")&&rn(e,"style")},po=(e,t)=>{Tn(e).each((n=>{n.dom.insertBefore(t.dom,e.dom)}))},ho=(e,t)=>{Dn(e).fold((()=>{Tn(e).each((e=>{vo(e,t)}))}),(e=>{po(e,t)}))},bo=(e,t)=>{Un(e).fold((()=>{vo(e,t)}),(n=>{e.dom.insertBefore(t.dom,n.dom)}))},vo=(e,t)=>{e.dom.appendChild(t.dom)},yo=(e,t)=>{po(e,t),vo(t,e)},Co=(e,t)=>{q(t,(t=>{vo(e,t)}))},wo=e=>{e.dom.textContent="",q(In(e),(e=>{Eo(e)}))},Eo=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},xo=e=>{const t=In(e);var n,o;t.length>0&&(n=e,q(o=t,((e,t)=>{const r=0===t?n:o[t-1];ho(r,e)}))),Eo(e)},_o=e=>V(e,Cn),ko=e=>e.dom.innerHTML,So=(e,t)=>{const n=Nn(e).dom,o=Cn(n.createDocumentFragment()),r=((e,t)=>{const n=(t||document).createElement("div");return n.innerHTML=e,In(Cn(n))})(t,n);Co(o,r),wo(e),vo(e,o)},No=(e,t,n,o)=>((e,t,n,o,r)=>{const s=((e,t)=>n=>{e(n)&&t((e=>{const t=Cn(Wn(e).getOr(e.target)),n=()=>e.stopPropagation(),o=()=>e.preventDefault(),r=k(o,n);return((e,t,n,o,r,s,a)=>({target:e,x:t,y:n,stop:o,prevent:r,kill:s,raw:a}))(t,e.clientX,e.clientY,n,o,r,e)})(n))})(n,o);return e.dom.addEventListener(t,s,false),{unbind:T(Ro,e,t,s,false)}})(e,t,n,o),Ro=(e,t,n,o)=>{e.dom.removeEventListener(t,n,o)},Ao=(e,t)=>({left:e,top:t,translate:(n,o)=>Ao(e+n,t+o)}),To=Ao,Oo=(e,t)=>void 0!==e?e:void 0!==t?t:0,Bo=e=>{const t=e.dom,n=t.ownerDocument.body;return n===t?To(n.offsetLeft,n.offsetTop):Yn(e)?(e=>{const t=e.getBoundingClientRect();return To(t.left,t.top)})(t):To(0,0)},Po=e=>{const t=void 0!==e?e.dom:document,n=t.body.scrollLeft||t.documentElement.scrollLeft,o=t.body.scrollTop||t.documentElement.scrollTop;return To(n,o)},Do=(e,t,n)=>{const o=(void 0!==n?n.dom:document).defaultView;o&&o.scrollTo(e,t)},Lo=(e,t)=>{xt().browser.isSafari()&&w(e.dom.scrollIntoViewIfNeeded)?e.dom.scrollIntoViewIfNeeded(!1):e.dom.scrollIntoView(t)},Mo=(e,t,n,o)=>({x:e,y:t,width:n,height:o,right:e+n,bottom:t+o}),Io=e=>{const t=void 0===e?window:e,n=t.document,o=Po(Cn(n));return(e=>{const t=void 0===e?window:e;return xt().browser.isFirefox()?I.none():I.from(t.visualViewport)})(t).fold((()=>{const e=t.document.documentElement,n=e.clientWidth,r=e.clientHeight;return Mo(o.left,o.top,n,r)}),(e=>Mo(Math.max(e.pageLeft,o.left),Math.max(e.pageTop,o.top),e.width,e.height)))},Fo=(e,t)=>{let n=[];return q(In(e),(e=>{t(e)&&(n=n.concat([e])),n=n.concat(Fo(e,t))})),n},Uo=(e,t)=>((e,t)=>{const n=void 0===t?document:t.dom;return _n(n)?[]:V(n.querySelectorAll(e),Cn)})(t,e),zo=(e,t,n)=>Xn(e,t,n).isSome(),jo=(e,t)=>((e,t)=>{const n=e.dom;return n.parentNode?((e,t)=>Q(e.dom.childNodes,(e=>t(Cn(e)))).map(Cn))(Cn(n.parentNode),(n=>!kn(e,n)&&t(n))):I.none()})(e,t).isSome(),Ho=(e,t)=>Qn(e,t).isSome();class $o{constructor(e,t){this.node=e,this.rootNode=t,this.current=this.current.bind(this),this.next=this.next.bind(this),this.prev=this.prev.bind(this),this.prev2=this.prev2.bind(this)}current(){return this.node}next(e){return this.node=this.findSibling(this.node,"firstChild","nextSibling",e),this.node}prev(e){return this.node=this.findSibling(this.node,"lastChild","previousSibling",e),this.node}prev2(e){return this.node=this.findPreviousNode(this.node,e),this.node}findSibling(e,t,n,o){if(e){if(!o&&e[t])return e[t];if(e!==this.rootNode){let t=e[n];if(t)return t;for(let o=e.parentNode;o&&o!==this.rootNode;o=o.parentNode)if(t=o[n],t)return t}}}findPreviousNode(e,t){if(e){const n=e.previousSibling;if(this.rootNode&&n===this.rootNode)return;if(n){if(!t)for(let e=n.lastChild;e;e=e.lastChild)if(!e.lastChild)return e;return n}const o=e.parentNode;if(o&&o!==this.rootNode)return o}}}const Vo="\ufeff",qo="\xa0",Wo=e=>e===Vo,Ko=/^[ \t\r\n]*$/,Yo=e=>Ko.test(e),Go=e=>"\n"===e||"\r"===e,Xo=(e,t=4,n=!0,o=!0)=>{const r=((e,t)=>t<=0?"":new Array(t+1).join(" "))(0,t),s=e.replace(/\t/g,r),a=X(s,((e,t)=>(e=>-1!==" \f\t\v".indexOf(e))(t)||t===qo?e.pcIsSpace||""===e.str&&n||e.str.length===s.length-1&&o||((e,t)=>t<e.length&&t>=0&&Go(e[t]))(s,e.str.length+1)?{pcIsSpace:!1,str:e.str+qo}:{pcIsSpace:!0,str:e.str+" "}:{pcIsSpace:Go(t),str:e.str+t}),{pcIsSpace:!1,str:""});return a.str},Zo=e=>t=>!!t&&t.nodeType===e,Qo=e=>!!e&&!Object.getPrototypeOf(e),Jo=Zo(1),er=e=>Jo(e)&&Wt(Cn(e)),tr=e=>{const t=e.toLowerCase();return e=>C(e)&&e.nodeName.toLowerCase()===t},nr=e=>{const t=e.map((e=>e.toLowerCase()));return e=>{if(e&&e.nodeName){const n=e.nodeName.toLowerCase();return H(t,n)}return!1}},or=(e,t)=>{const n=t.toLowerCase().split(" ");return t=>{if(Jo(t)){const o=t.ownerDocument.defaultView;if(o)for(let r=0;r<n.length;r++){const s=o.getComputedStyle(t,null);if((s?s.getPropertyValue(e):null)===n[r])return!0}}return!1}},rr=e=>Jo(e)&&e.hasAttribute("data-mce-bogus"),sr=e=>Jo(e)&&"TABLE"===e.tagName,ar=e=>t=>{if(er(t)){if(t.contentEditable===e)return!0;if(t.getAttribute("data-mce-contenteditable")===e)return!0}return!1},ir=nr(["textarea","input"]),lr=Zo(3),dr=Zo(4),cr=Zo(7),ur=Zo(8),mr=Zo(9),fr=Zo(11),gr=tr("br"),pr=tr("img"),hr=ar("true"),br=ar("false"),vr=nr(["td","th"]),yr=nr(["td","th","caption"]),Cr=nr(["video","audio","object","embed"]),wr=tr("li"),Er=tr("details"),xr=tr("summary"),_r={skipBogus:!0,includeZwsp:!1,checkRootAsContent:!1},kr=("data-mce-bookmark",e=>Jo(e)&&e.hasAttribute("data-mce-bookmark"));const Sr=(e,t,n,o)=>lr(e)&&!((e,t,n)=>Yo(e.data)&&!((e,t,n)=>{const o=Cn(t),r=Cn(e),s=n.getWhitespaceElements();return zo(r,(e=>_e(s,$t(e))),T(kn,o))})(e,t,n))(e,t,n)&&(!o.includeZwsp||!(e=>{for(const t of e)if(!Wo(t))return!1;return!0})(e.data)),Nr=(e,t,n,o)=>w(o.isContent)&&o.isContent(t)||((e,t)=>Jo(e)&&_e(t.getNonEmptyElements(),e.nodeName))(t,e)||kr(t)||(e=>Jo(e)&&"A"===e.nodeName&&!e.hasAttribute("href")&&(e.hasAttribute("name")||e.hasAttribute("id")))(t)||Sr(t,n,e,o)||br(t)||hr(t)&&(e=>On(Cn(e)).exists((e=>!no(e))))(t),Rr=(e,t,n)=>{const o={..._r,...n};if(o.checkRootAsContent&&Nr(e,t,t,o))return!1;let r=t.firstChild,s=0;if(!r)return!0;const a=new $o(r,t);do{if(o.skipBogus&&Jo(r)){const e=r.getAttribute("data-mce-bogus");if(e){r=a.next("all"===e);continue}}if(ur(r))r=a.next(!0);else if(gr(r))s++,r=a.next();else{if(Nr(e,r,t,o))return!1;r=a.next()}}while(r);return s<=1},Ar=(e,t,n)=>Rr(e,t.dom,{checkRootAsContent:!0,...n}),Tr=(e,t,n)=>Nr(e,t,t,{includeZwsp:_r.includeZwsp,...n}),Or=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},Br=e=>{const t=Or(I.none()),n=()=>t.get().each((e=>clearInterval(e)));return{clear:()=>{n(),t.set(I.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:o=>{n(),t.set(I.some(setInterval(o,e)))}}},Pr=()=>{const e=(e=>{const t=Or(I.none()),n=()=>t.get().each(e);return{clear:()=>{n(),t.set(I.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{n(),t.set(I.some(e))}}})(_);return{...e,on:t=>e.get().each(t)}},Dr=e=>{const t=e.toLowerCase();return"svg"===t?"svg":"math"===t?"math":"html"},Lr=e=>"html"!==Dr(e),Mr=e=>Lr(e.nodeName),Ir=e=>Dr(e.nodeName),Fr=["svg","math"],Ur="data-mce-block",zr=e=>V((e=>Y(fe(e),(e=>!/[A-Z]/.test(e))))(e),(e=>{const t=CSS.escape(e);return`${t}:`+V(Fr,(e=>`not(${e} ${t})`)).join(":")})).join(","),jr=(e,t)=>C(t.querySelector(e))?(t.setAttribute(Ur,"true"),"inline-boundary"===t.getAttribute("data-mce-selected")&&t.removeAttribute("data-mce-selected"),!0):(t.removeAttribute(Ur),!1),Hr=(e,t)=>{const n=zr(e.getTransparentElements()),o=zr(e.getBlockElements());return Y(t.querySelectorAll(n),(e=>jr(o,e)))},$r=(e,t,n)=>{var o;const r=n?"lastChild":"firstChild";for(let n=t[r];n;n=n[r])if(Rr(e,n,{checkRootAsContent:!0}))return void(null===(o=n.parentNode)||void 0===o||o.removeChild(n))},Vr=(e,t,n)=>{const o=e.getBlockElements(),r=Cn(t),s=e=>$t(e)in o,a=e=>kn(e,r);q(_o(n),(t=>{Xn(t,s,a).each((n=>{const o=((t,o)=>Y(In(t),(t=>s(t)&&!e.isValidChild($t(n),$t(t)))))(t);if(o.length>0){const t=On(n);q(o,(t=>{Xn(t,s,a).each((n=>{((e,t,n)=>{const o=document.createRange(),r=t.parentNode;if(r){o.setStartBefore(t),o.setEndBefore(n);const s=o.extractContents();$r(e,s,!0),o.setStartAfter(n),o.setEndAfter(t);const a=o.extractContents();$r(e,a,!1),Rr(e,s,{checkRootAsContent:!0})||r.insertBefore(s,t),Rr(e,n,{checkRootAsContent:!0})||r.insertBefore(n,t),Rr(e,a,{checkRootAsContent:!0})||r.insertBefore(a,t),r.removeChild(t)}})(e,n.dom,t.dom)}))})),t.each((t=>Hr(e,t.dom)))}}))}))},qr=(e,t)=>{const n=Hr(e,t);Vr(e,t,n),((e,t,n)=>{q([...n,...Xr(e,t)?[t]:[]],(t=>q(Uo(Cn(t),t.nodeName.toLowerCase()),(t=>{Zr(e,t.dom)&&xo(t)}))))})(e,t,n)},Wr=(e,t)=>{if(Gr(e,t)){const n=zr(e.getBlockElements());jr(n,t)}},Kr=e=>e.hasAttribute(Ur),Yr=(e,t)=>_e(e.getTransparentElements(),t),Gr=(e,t)=>Jo(t)&&Yr(e,t.nodeName),Xr=(e,t)=>Gr(e,t)&&Kr(t),Zr=(e,t)=>Gr(e,t)&&!Kr(t),Qr=(e,t)=>1===t.type&&Yr(e,t.name)&&m(t.attr(Ur)),Jr=xt().browser,es=e=>Q(e,Kt),ts=(e,t)=>e.children&&H(e.children,t),ns=(e,t={})=>{let n=0;const o={},r=Cn(e),s=Rn(r),a=e=>{vo(Vn(r),e)},i=e=>{const t=Vn(r);eo(t,"#"+e).each(Eo)},l=e=>xe(o,e).getOrThunk((()=>({id:"mce-u"+n++,passed:[],failed:[],count:0}))),d=e=>new Promise(((n,r)=>{let i;const d=Dt._addCacheSuffix(e),c=l(d);o[d]=c,c.count++;const u=(e,t)=>{q(e,D),c.status=t,c.passed=[],c.failed=[],i&&(i.onload=null,i.onerror=null,i=null)},m=()=>u(c.passed,2),f=()=>u(c.failed,3);if(n&&c.passed.push(n),r&&c.failed.push(r),1===c.status)return;if(2===c.status)return void m();if(3===c.status)return void f();c.status=1;const g=vn("link",s.dom);en(g,{rel:"stylesheet",type:"text/css",id:c.id}),t.contentCssCors&&Jt(g,"crossOrigin","anonymous"),t.referrerPolicy&&Jt(g,"referrerpolicy",t.referrerPolicy),i=g.dom,i.onload=m,i.onerror=f,a(g),Jt(g,"href",d)})),c=e=>{const t=Dt._addCacheSuffix(e);xe(o,t).each((e=>{0==--e.count&&(delete o[t],i(e.id))}))};return{load:d,loadRawCss:(e,t)=>{const n=l(e);o[e]=n,n.count++;const r=vn("style",s.dom);en(r,{rel:"stylesheet",type:"text/css",id:n.id,"data-mce-key":e}),r.dom.innerHTML=t,a(r)},loadAll:e=>Promise.allSettled(V(e,(e=>d(e).then(N(e))))).then((e=>{const t=K(e,(e=>"fulfilled"===e.status));return t.fail.length>0?Promise.reject(V(t.fail,(e=>e.reason))):V(t.pass,(e=>e.value))})),unload:c,unloadRawCss:e=>{xe(o,e).each((t=>{0==--t.count&&(delete o[e],i(t.id))}))},unloadAll:e=>{q(e,(e=>{c(e)}))},_setReferrerPolicy:e=>{t.referrerPolicy=e},_setContentCssCors:e=>{t.contentCssCors=e}}},os=(()=>{const e=new WeakMap;return{forElement:(t,n)=>{const o=$n(t).dom;return I.from(e.get(o)).getOrThunk((()=>{const t=ns(o,n);return e.set(o,t),t}))}}})(),rs=(e,t)=>C(e)&&(Tr(t,e)||t.isInline(e.nodeName.toLowerCase())),ss=e=>(e=>"span"===e.nodeName.toLowerCase())(e)&&"bookmark"===e.getAttribute("data-mce-type"),as=(e,t,n,o)=>{var r;const s=o||t;if(Jo(t)&&ss(t))return t;const a=t.childNodes;for(let t=a.length-1;t>=0;t--)as(e,a[t],n,s);if(Jo(t)){const e=t.childNodes;1===e.length&&ss(e[0])&&(null===(r=t.parentNode)||void 0===r||r.insertBefore(e[0],t))}return(e=>fr(e)||mr(e))(t)||Tr(n,t)||(e=>!!Jo(e)&&e.childNodes.length>0)(t)||((e,t,n)=>lr(e)&&e.data.length>0&&((e,t,n)=>{const o=new $o(e,t).prev(!1),r=new $o(e,t).next(!1),s=v(o)||rs(o,n),a=v(r)||rs(r,n);return s&&a})(e,t,n))(t,s,n)||e.remove(t),t},is=Dt.makeMap,ls=/[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,ds=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,cs=/[<>&\"\']/g,us=/&#([a-z0-9]+);?|&([a-z0-9]+);/gi,ms={128:"\u20ac",130:"\u201a",131:"\u0192",132:"\u201e",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02c6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017d",145:"\u2018",146:"\u2019",147:"\u201c",148:"\u201d",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02dc",153:"\u2122",154:"\u0161",155:"\u203a",156:"\u0153",158:"\u017e",159:"\u0178"},fs={'"':"&quot;","'":"&#39;","<":"&lt;",">":"&gt;","&":"&amp;","`":"&#96;"},gs={"&lt;":"<","&gt;":">","&amp;":"&","&quot;":'"',"&apos;":"'"},ps=(e,t)=>{const n={};if(e){const o=e.split(",");t=t||10;for(let e=0;e<o.length;e+=2){const r=String.fromCharCode(parseInt(o[e],t));if(!fs[r]){const t="&"+o[e+1]+";";n[r]=t,n[t]=r}}return n}},hs=ps("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32),bs=(e,t)=>e.replace(t?ls:ds,(e=>fs[e]||e)),vs=(e,t)=>e.replace(t?ls:ds,(e=>e.length>1?"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";":fs[e]||"&#"+e.charCodeAt(0)+";")),ys=(e,t,n)=>{const o=n||hs;return e.replace(t?ls:ds,(e=>fs[e]||o[e]||e))},Cs={encodeRaw:bs,encodeAllRaw:e=>(""+e).replace(cs,(e=>fs[e]||e)),encodeNumeric:vs,encodeNamed:ys,getEncodeFunc:(e,t)=>{const n=ps(t)||hs,o=is(e.replace(/\+/g,","));return o.named&&o.numeric?(e,t)=>e.replace(t?ls:ds,(e=>void 0!==fs[e]?fs[e]:void 0!==n[e]?n[e]:e.length>1?"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";":"&#"+e.charCodeAt(0)+";")):o.named?t?(e,t)=>ys(e,t,n):ys:o.numeric?vs:bs},decode:e=>e.replace(us,((e,t)=>t?(t="x"===t.charAt(0).toLowerCase()?parseInt(t.substr(1),16):parseInt(t,10))>65535?(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t))):ms[t]||String.fromCharCode(t):gs[e]||hs[e]||(e=>{const t=vn("div").dom;return t.innerHTML=e,t.textContent||t.innerText||e})(e)))},ws=(e,t)=>(e=Dt.trim(e))?e.split(t||" "):[],Es=e=>new RegExp("^"+e.replace(/([?+*])/g,".$1")+"$"),xs=e=>Object.freeze(["id","accesskey","class","dir","lang","style","tabindex","title","role",..."html4"!==e?["contenteditable","contextmenu","draggable","dropzone","hidden","spellcheck","translate","itemprop","itemscope","itemtype"]:[],..."html5-strict"!==e?["xml:lang"]:[]]),_s=e=>{let t,n;t="address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul",n="a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd label map noscript object q s samp script select small span strong sub sup textarea u var #text #comment","html4"!==e&&(t+=" article aside details dialog figure main header footer hgroup section nav a ins del canvas map",n+=" audio canvas command data datalist mark meter output picture progress time wbr video ruby bdi keygen svg"),"html5-strict"!==e&&(n=[n,"acronym applet basefont big font strike tt"].join(" "),t=[t,"center dir isindex noframes"].join(" "));const o=[t,n].join(" ");return{blockContent:t,phrasingContent:n,flowContent:o}},ks=e=>{const{blockContent:t,phrasingContent:n,flowContent:o}=_s(e),r=e=>Object.freeze(e.split(" "));return Object.freeze({blockContent:r(t),phrasingContent:r(n),flowContent:r(o)})},Ss={html4:Le((()=>ks("html4"))),html5:Le((()=>ks("html5"))),"html5-strict":Le((()=>ks("html5-strict")))},Ns=(e,t)=>{const{blockContent:n,phrasingContent:o,flowContent:r}=Ss[e]();return"blocks"===t?I.some(n):"phrasing"===t?I.some(o):"flow"===t?I.some(r):I.none()},Rs=e=>I.from(/^(@?)([A-Za-z0-9_\-.\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]+)$/.exec(e)).map((e=>({preset:"@"===e[1],name:e[2]}))),As={},Ts=Dt.makeMap,Os=Dt.each,Bs=Dt.extend,Ps=Dt.explode,Ds=(e,t={})=>{const n=Ts(e," ",Ts(e.toUpperCase()," "));return Bs(n,t)},Ls=e=>Ds("td th li dt dd figcaption caption details summary",e.getTextBlockElements()),Ms=(e,t)=>{if(e){const n={};return m(e)&&(e={"*":e}),Os(e,((e,o)=>{n[o]=n[o.toUpperCase()]="map"===t?Ts(e,/[, ]/):Ps(e,/[, ]/)})),n}},Is=(e={})=>{var t;const n={},o={};let r=[];const s={},a={},i=(t,n,o)=>{const r=e[t];if(r)return Ts(r,/[, ]/,Ts(r.toUpperCase(),/[, ]/));{let e=As[t];return e||(e=Ds(n,o),As[t]=e),e}},l=null!==(t=e.schema)&&void 0!==t?t:"html5",d=(e=>{const t=xs(e),{phrasingContent:n,flowContent:o}=_s(e),r={},s=(e,t,n)=>{r[e]={attributes:se(t,N({})),attributesOrder:t,children:se(n,N({}))}},a=(e,n="",o="")=>{const r=ws(o),a=ws(e);let i=a.length;const l=[...t,...ws(n)];for(;i--;)s(a[i],l.slice(),r)},i=(e,t)=>{const n=ws(e),o=ws(t);let s=n.length;for(;s--;){const e=r[n[s]];for(let t=0,n=o.length;t<n;t++)e.attributes[o[t]]={},e.attributesOrder.push(o[t])}};return"html5-strict"!==e&&(q(ws("acronym applet basefont big font strike tt"),(e=>{a(e,"",n)})),q(ws("center dir isindex noframes"),(e=>{a(e,"",o)}))),a("html","manifest","head body"),a("head","","base command link meta noscript script style title"),a("title hr noscript br"),a("base","href target"),a("link","href rel media hreflang type sizes hreflang"),a("meta","name http-equiv content charset"),a("style","media type scoped"),a("script","src async defer type charset"),a("body","onafterprint onbeforeprint onbeforeunload onblur onerror onfocus onhashchange onload onmessage onoffline ononline onpagehide onpageshow onpopstate onresize onscroll onstorage onunload",o),a("dd div","",o),a("address dt caption","","html4"===e?n:o),a("h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn","",n),a("blockquote","cite",o),a("ol","reversed start type","li"),a("ul","","li"),a("li","value",o),a("dl","","dt dd"),a("a","href target rel media hreflang type","html4"===e?n:o),a("q","cite",n),a("ins del","cite datetime",o),a("img","src sizes srcset alt usemap ismap width height"),a("iframe","src name width height",o),a("embed","src type width height"),a("object","data type typemustmatch name usemap form width height",[o,"param"].join(" ")),a("param","name value"),a("map","name",[o,"area"].join(" ")),a("area","alt coords shape href target rel media hreflang type"),a("table","border","caption colgroup thead tfoot tbody tr"+("html4"===e?" col":"")),a("colgroup","span","col"),a("col","span"),a("tbody thead tfoot","","tr"),a("tr","","td th"),a("td","colspan rowspan headers",o),a("th","colspan rowspan headers scope abbr",o),a("form","accept-charset action autocomplete enctype method name novalidate target",o),a("fieldset","disabled form name",[o,"legend"].join(" ")),a("label","form for",n),a("input","accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate formtarget height list max maxlength min multiple name pattern readonly required size src step type value width"),a("button","disabled form formaction formenctype formmethod formnovalidate formtarget name type value","html4"===e?o:n),a("select","disabled form multiple name required size","option optgroup"),a("optgroup","disabled label","option"),a("option","disabled label selected value"),a("textarea","cols dirname disabled form maxlength name readonly required rows wrap"),a("menu","type label",[o,"li"].join(" ")),a("noscript","",o),"html4"!==e&&(a("wbr"),a("ruby","",[n,"rt rp"].join(" ")),a("figcaption","",o),a("mark rt rp bdi","",n),a("summary","",[n,"h1 h2 h3 h4 h5 h6"].join(" ")),a("canvas","width height",o),a("data","value",n),a("video","src crossorigin poster preload autoplay mediagroup loop muted controls width height buffered",[o,"track source"].join(" ")),a("audio","src crossorigin preload autoplay mediagroup loop muted controls buffered volume",[o,"track source"].join(" ")),a("picture","","img source"),a("source","src srcset type media sizes"),a("track","kind src srclang label default"),a("datalist","",[n,"option"].join(" ")),a("article section nav aside main header footer","",o),a("hgroup","","h1 h2 h3 h4 h5 h6"),a("figure","",[o,"figcaption"].join(" ")),a("time","datetime",n),a("dialog","open",o),a("command","type label icon disabled checked radiogroup command"),a("output","for form name",n),a("progress","value max",n),a("meter","value min max low high optimum",n),a("details","open",[o,"summary"].join(" ")),a("keygen","autofocus challenge disabled form keytype name"),s("svg","id tabindex lang xml:space class style x y width height viewBox preserveAspectRatio zoomAndPan transform".split(" "),[])),"html5-strict"!==e&&(i("script","language xml:space"),i("style","xml:space"),i("object","declare classid code codebase codetype archive standby align border hspace vspace"),i("embed","align name hspace vspace"),i("param","valuetype type"),i("a","charset name rev shape coords"),i("br","clear"),i("applet","codebase archive code object alt name width height align hspace vspace"),i("img","name longdesc align border hspace vspace"),i("iframe","longdesc frameborder marginwidth marginheight scrolling align"),i("font basefont","size color face"),i("input","usemap align"),i("select"),i("textarea"),i("h1 h2 h3 h4 h5 h6 div p legend caption","align"),i("ul","type compact"),i("li","type"),i("ol dl menu dir","compact"),i("pre","width xml:space"),i("hr","align noshade size width"),i("isindex","prompt"),i("table","summary width frame rules cellspacing cellpadding align bgcolor"),i("col","width align char charoff valign"),i("colgroup","width align char charoff valign"),i("thead","align char charoff valign"),i("tr","align char charoff valign bgcolor"),i("th","axis align char charoff valign nowrap bgcolor width height"),i("form","accept"),i("td","abbr axis scope align char charoff valign nowrap bgcolor width height"),i("tfoot","align char charoff valign"),i("tbody","align char charoff valign"),i("area","nohref"),i("body","background bgcolor text link vlink alink")),"html4"!==e&&(i("input button select textarea","autofocus"),i("input textarea","placeholder"),i("a","download"),i("link script img","crossorigin"),i("img","loading"),i("iframe","sandbox seamless allow allowfullscreen loading referrerpolicy")),"html4"!==e&&q([r.video,r.audio],(e=>{delete e.children.audio,delete e.children.video})),q(ws("a form meter progress dfn"),(e=>{r[e]&&delete r[e].children[e]})),delete r.caption.children.table,delete r.script,r})(l);!1===e.verify_html&&(e.valid_elements="*[*]");const c=Ms(e.valid_styles),u=Ms(e.invalid_styles,"map"),g=Ms(e.valid_classes,"map"),h=i("whitespace_elements","pre script noscript style textarea video audio iframe object code"),v=i("self_closing_elements","colgroup dd dt li option p td tfoot th thead tr"),y=i("void_elements","area base basefont br col frame hr img input isindex link meta param embed source wbr track"),C=i("boolean_attributes","checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls allowfullscreen"),w="td th iframe video audio object script code",E=i("non_empty_elements",w+" pre svg textarea summary",y),x=i("move_caret_before_on_enter_elements",w+" table",y),_="h1 h2 h3 h4 h5 h6",k=i("text_block_elements",_+" p div address pre form blockquote center dir fieldset header footer article section hgroup aside main nav figure"),S=i("block_elements","hr table tbody thead tfoot th tr td li ol ul caption dl dt dd noscript menu isindex option datalist select optgroup figcaption details summary html body multicol listing",k),R=i("text_inline_elements","span strong b em i font s strike u var cite dfn code mark q sup sub samp"),A=i("transparent_elements","a ins del canvas map"),T=i("wrap_block_elements","pre "+_);Os("script noscript iframe noframes noembed title style textarea xmp plaintext".split(" "),(e=>{a[e]=new RegExp("</"+e+"[^>]*>","gi")}));const O=e=>{const t=I.from(n["@"]),o=/[*?+]/;q(((e,t)=>{const n=/^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)])?$/;return te(ws(t,","),(t=>{const o=n.exec(t);if(o){const t=o[1],n=o[2],r=o[3],s=o[4],a=o[5],i={attributes:{},attributesOrder:[]};if(e.each((e=>((e,t)=>{pe(e.attributes,((e,n)=>{t.attributes[n]=e})),t.attributesOrder.push(...e.attributesOrder)})(e,i))),"#"===t?i.paddEmpty=!0:"-"===t&&(i.removeEmpty=!0),"!"===s&&(i.removeEmptyAttrs=!0),a&&((e,t)=>{const n=/^([!\-])?(\w+[\\:]:\w+|[^=~<]+)?(?:([=~<])(.*))?$/,o=/[*?+]/,{attributes:r,attributesOrder:s}=t;q(ws(e,"|"),(e=>{const a=n.exec(e);if(a){const e={},n=a[1],i=a[2].replace(/[\\:]:/g,":"),l=a[3],d=a[4];if("!"===n&&(t.attributesRequired=t.attributesRequired||[],t.attributesRequired.push(i),e.required=!0),"-"===n)return delete r[i],void s.splice(Dt.inArray(s,i),1);if(l&&("="===l?(t.attributesDefault=t.attributesDefault||[],t.attributesDefault.push({name:i,value:d}),e.defaultValue=d):"~"===l?(t.attributesForced=t.attributesForced||[],t.attributesForced.push({name:i,value:d}),e.forcedValue=d):"<"===l&&(e.validValues=Dt.makeMap(d,"?"))),o.test(i)){const n=e;t.attributePatterns=t.attributePatterns||[],n.pattern=Es(i),t.attributePatterns.push(n)}else r[i]||s.push(i),r[i]=e}}))})(a,i),r&&(i.outputName=n),"@"===n){if(!e.isNone())return[];e=I.some(i)}return[r?{name:n,element:i,aliasName:r}:{name:n,element:i}]}return[]}))})(t,null!=e?e:""),(({name:e,element:t,aliasName:s})=>{if(s&&(n[s]=t),o.test(e)){const n=t;n.pattern=Es(e),r.push(n)}else n[e]=t}))},B=e=>{r=[],q(fe(n),(e=>{delete n[e]})),O(e)},P=(e,t)=>{var r,a;delete As.text_block_elements,delete As.block_elements;const i=!!t.extends&&!oe(t.extends),d=t.extends;if(o[e]=d?o[d]:{},s[e]=null!=d?d:e,E[e.toUpperCase()]={},E[e]={},i||(S[e.toUpperCase()]={},S[e]={}),d&&!n[e]&&n[d]){const t=(e=>{const t=e=>p(e)?V(e,t):(e=>f(e)&&e.source&&"[object RegExp]"===Object.prototype.toString.call(e))(e)?new RegExp(e.source,e.flags):f(e)?he(e,t):e;return t(e)})(n[d]);delete t.removeEmptyAttrs,delete t.removeEmpty,n[e]=t}else n[e]={attributesOrder:[],attributes:{}};if(p(t.attributes)){const o=e=>{s.attributesOrder.push(e),s.attributes[e]={}},s=null!==(r=n[e])&&void 0!==r?r:{};delete s.attributesDefault,delete s.attributesForced,delete s.attributePatterns,delete s.attributesRequired,s.attributesOrder=[],s.attributes={},q(t.attributes,(e=>{const t=xs(l);Rs(e).each((({preset:e,name:n})=>{e?"global"===n&&q(t,o):o(n)}))})),n[e]=s}if(b(t.padEmpty)){const o=null!==(a=n[e])&&void 0!==a?a:{};o.paddEmpty=t.padEmpty,n[e]=o}if(p(t.children)){const n={},r=e=>{n[e]={}},s=e=>{Ns(l,e).each((e=>{q(e,r)}))};q(t.children,(e=>{Rs(e).each((({preset:e,name:t})=>{e?s(t):r(t)}))})),o[e]=n}d&&pe(o,((t,n)=>{t[d]&&(o[n]=t=Bs({},o[n]),t[e]=t[d])}))},D=e=>{f(e)?pe(e,((e,t)=>P(t,e))):m(e)&&(e=>{q((e=>{const t=/^(~)?(.+)$/;return te(ws(e,","),(e=>{const n=t.exec(e);return n?[{cloneName:"~"===n[1]?"span":"div",name:n[2]}]:[]}))})(null!=e?e:""),(({name:e,cloneName:t})=>{P(e,{extends:t})}))})(e)},L=e=>{q((e=>{const t=/^([+\-]?)([A-Za-z0-9_\-.\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]+)\[([^\]]+)]$/;return te(ws(e,","),(e=>{const n=t.exec(e);if(n){const e=n[1],t=e?(e=>"-"===e?"remove":"add")(e):"replace";return[{operation:t,name:n[2],validChildren:te(ws(n[3],"|"),(e=>Rs(e).toArray()))}]}return[]}))})(null!=e?e:""),(({operation:e,name:t,validChildren:n})=>{const r="replace"===e?{"#comment":{}}:o[t],s=t=>{"remove"===e?delete r[t]:r[t]={}};q(n,(({preset:e,name:t})=>{e?(e=>{Ns(l,e).each((e=>{q(e,s)}))})(t):s(t)})),o[t]=r}))},M=e=>{const t=n[e];if(t)return t;let o=r.length;for(;o--;){const t=r[o];if(t.pattern.test(e))return t}},F=N(c),U=N(u),z=N(g),j=N(C),H=N(S),$=N(k),W=N(R),K=N(Object.seal(y)),Y=N(v),G=N(E),X=N(x),Z=N(h),Q=N(A),J=N(T),ee=N(Object.seal(a)),ne=(e,t)=>{const n=M(e);if(n){if(!t)return!0;{if(n.attributes[t])return!0;const e=n.attributePatterns;if(e){let n=e.length;for(;n--;)if(e[n].pattern.test(t))return!0}}}return!1},oe=e=>_e(H(),e),re=e=>!$e(e,"#")&&ne(e)&&!oe(e),ae=N(s);return e.valid_elements?(B(e.valid_elements),Os(d,((e,t)=>{o[t]=e.children}))):(Os(d,((e,t)=>{n[t]={attributes:e.attributes,attributesOrder:e.attributesOrder},o[t]=e.children})),Os(ws("strong/b em/i"),(e=>{const t=ws(e,"/");n[t[1]].outputName=t[0]})),Os(R,((t,o)=>{n[o]&&(e.padd_empty_block_inline_children&&(n[o].paddInEmptyBlock=!0),n[o].removeEmpty=!0)})),Os(ws("ol ul blockquote a table tbody"),(e=>{n[e]&&(n[e].removeEmpty=!0)})),Os(ws("p h1 h2 h3 h4 h5 h6 th td pre div address caption li summary"),(e=>{n[e]&&(n[e].paddEmpty=!0)})),Os(ws("span"),(e=>{n[e].removeEmptyAttrs=!0}))),delete n.svg,D(e.custom_elements),L(e.valid_children),O(e.extended_valid_elements),L("+ol[ul|ol],+ul[ul|ol]"),Os({dd:"dl",dt:"dl",li:"ul ol",td:"tr",th:"tr",tr:"tbody thead tfoot",tbody:"table",thead:"table",tfoot:"table",legend:"fieldset",area:"map",param:"video audio object"},((e,t)=>{n[t]&&(n[t].parentsRequired=ws(e))})),e.invalid_elements&&Os(Ps(e.invalid_elements),(e=>{n[e]&&delete n[e]})),M("span")||O("span[!data-mce-type|*]"),{type:l,children:o,elements:n,getValidStyles:F,getValidClasses:z,getBlockElements:H,getInvalidStyles:U,getVoidElements:K,getTextBlockElements:$,getTextInlineElements:W,getBoolAttrs:j,getElementRule:M,getSelfClosingElements:Y,getNonEmptyElements:G,getMoveCaretBeforeOnEnterElements:X,getWhitespaceElements:Z,getTransparentElements:Q,getSpecialElements:ee,isValidChild:(e,t)=>{const n=o[e.toLowerCase()];return!(!n||!n[t.toLowerCase()])},isValid:ne,isBlock:oe,isInline:re,isWrapper:e=>_e(J(),e)||re(e),getCustomElements:ae,addValidElements:O,setValidElements:B,addCustomElements:D,addValidChildren:L}},Fs=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},Us=e=>(e=>{return{value:(t=e,je(t,"#").toUpperCase())};var t})(Fs(e.red)+Fs(e.green)+Fs(e.blue)),zs=/^\s*rgb\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*\)\s*$/i,js=/^\s*rgba\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*((?:\d?\.\d+|\d+)%?)\s*\)\s*$/i,Hs=(e,t,n,o)=>((e,t,n,o)=>({red:e,green:t,blue:n,alpha:o}))(parseInt(e,10),parseInt(t,10),parseInt(n,10),parseFloat(o)),$s=e=>{const t=zs.exec(e);if(null!==t)return I.some(Hs(t[1],t[2],t[3],"1"));const n=js.exec(e);return null!==n?I.some(Hs(n[1],n[2],n[3],n[4])):I.none()},Vs=e=>`rgba(${e.red},${e.green},${e.blue},${e.alpha})`,qs=e=>$s(e).map(Us).map((e=>"#"+e.value)).getOr(e),Ws=(e={},t)=>{const n=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,o=/\s*([^:]+):\s*([^;]+);?/g,r=/\s+$/,s={};let a,i;const l=Vo;t&&(a=t.getValidStyles(),i=t.getInvalidStyles());const d="\\\" \\' \\; \\: ; : \ufeff".split(" ");for(let e=0;e<d.length;e++)s[d[e]]=l+e,s[l+e]=d[e];const c={parse:t=>{const a={};let i=!1;const d=e.url_converter,u=e.url_converter_scope||c,m=(e,t,n)=>{const o=a[e+"-top"+t];if(!o)return;const r=a[e+"-right"+t];if(!r)return;const s=a[e+"-bottom"+t];if(!s)return;const i=a[e+"-left"+t];if(!i)return;const l=[o,r,s,i];let d=l.length-1;for(;d--&&l[d]===l[d+1];);d>-1&&n||(a[e+t]=-1===d?l[0]:l.join(" "),delete a[e+"-top"+t],delete a[e+"-right"+t],delete a[e+"-bottom"+t],delete a[e+"-left"+t])},f=e=>{const t=a[e];if(!t)return;const n=t.indexOf(",")>-1?[t]:t.split(" ");let o=n.length;for(;o--;)if(n[o]!==n[0])return!1;return a[e]=n[0],!0},g=e=>(i=!0,s[e]),p=(e,t)=>(i&&(e=e.replace(/\uFEFF[0-9]/g,(e=>s[e]))),t||(e=e.replace(/\\([\'\";:])/g,"$1")),e),h=e=>String.fromCharCode(parseInt(e.slice(1),16)),b=e=>e.replace(/\\[0-9a-f]+/gi,h),v=(t,n,o,r,s,a)=>{if(s=s||a)return"'"+(s=p(s)).replace(/\'/g,"\\'")+"'";if(n=p(n||o||r||""),!e.allow_script_urls){const t=n.replace(/[\s\r\n]+/g,"");if(/(java|vb)script:/i.test(t))return"";if(!e.allow_svg_data_urls&&/^data:image\/svg/i.test(t))return""}return d&&(n=d.call(u,n,"style")),"url('"+n.replace(/\'/g,"\\'")+"')"};if(t){let s;for(t=(t=t.replace(/[\u0000-\u001F]/g,"")).replace(/\\[\"\';:\uFEFF]/g,g).replace(/\"[^\"]+\"|\'[^\']+\'/g,(e=>e.replace(/[;:]/g,g)));s=o.exec(t);){o.lastIndex=s.index+s[0].length;let t=s[1].replace(r,"").toLowerCase(),d=s[2].replace(r,"");if(t&&d){if(t=b(t),d=b(d),-1!==t.indexOf(l)||-1!==t.indexOf('"'))continue;if(!e.allow_script_urls&&("behavior"===t||/expression\s*\(|\/\*|\*\//.test(d)))continue;"font-weight"===t&&"700"===d?d="bold":"color"!==t&&"background-color"!==t||(d=d.toLowerCase()),"rgb"==(E=d,zs.test(E)?"rgb":js.test(E)?"rgba":"other")&&$s(d).each((e=>{d=qs(Vs(e)).toLowerCase()})),d=d.replace(n,v),a[t]=i?p(d,!0):d}}m("border","",!0),m("border","-width"),m("border","-color"),m("border","-style"),m("padding",""),m("margin",""),"border",C="border-style",w="border-color",f(y="border-width")&&f(C)&&f(w)&&(a.border=a[y]+" "+a[C]+" "+a[w],delete a[y],delete a[C],delete a[w]),"medium none"===a.border&&delete a.border,"none"===a["border-image"]&&delete a["border-image"]}var y,C,w,E;return a},serialize:(e,t)=>{let n="";const o=(t,o)=>{const r=o[t];if(r)for(let t=0,o=r.length;t<o;t++){const o=r[t],s=e[o];s&&(n+=(n.length>0?" ":"")+o+": "+s+";")}};return t&&a?(o("*",a),o(t,a)):pe(e,((e,o)=>{e&&((e,t)=>{if(!i||!t)return!0;let n=i["*"];return!(n&&n[e]||(n=i[t],n&&n[e]))})(o,t)&&(n+=(n.length>0?" ":"")+o+": "+e+";")})),n}};return c},Ks={keyLocation:!0,layerX:!0,layerY:!0,returnValue:!0,webkitMovementX:!0,webkitMovementY:!0,keyIdentifier:!0,mozPressure:!0},Ys=(e,t)=>{const n=null!=t?t:{};for(const t in e)_e(Ks,t)||(n[t]=e[t]);return C(e.composedPath)&&(n.composedPath=()=>e.composedPath()),C(e.getModifierState)&&(n.getModifierState=t=>e.getModifierState(t)),C(e.getTargetRanges)&&(n.getTargetRanges=()=>e.getTargetRanges()),n},Gs=(e,t,n,o)=>{var r;const s=Ys(t,o);return s.type=e,y(s.target)&&(s.target=null!==(r=s.srcElement)&&void 0!==r?r:n),(e=>y(e.preventDefault)||(e=>e instanceof Event||w(e.initEvent))(e))(t)&&(s.preventDefault=()=>{s.defaultPrevented=!0,s.isDefaultPrevented=M,w(t.preventDefault)&&t.preventDefault()},s.stopPropagation=()=>{s.cancelBubble=!0,s.isPropagationStopped=M,w(t.stopPropagation)&&t.stopPropagation()},s.stopImmediatePropagation=()=>{s.isImmediatePropagationStopped=M,s.stopPropagation()},(e=>e.isDefaultPrevented===M||e.isDefaultPrevented===L)(s)||(s.isDefaultPrevented=!0===s.defaultPrevented?M:L,s.isPropagationStopped=!0===s.cancelBubble?M:L,s.isImmediatePropagationStopped=L)),s},Xs=/^(?:mouse|contextmenu)|click/,Zs=(e,t,n,o)=>{e.addEventListener(t,n,o||!1)},Qs=(e,t,n,o)=>{e.removeEventListener(t,n,o||!1)},Js=(e,t)=>{const n=Gs(e.type,e,document,t);if((e=>C(e)&&Xs.test(e.type))(e)&&v(e.pageX)&&!v(e.clientX)){const t=n.target.ownerDocument||document,o=t.documentElement,r=t.body,s=n;s.pageX=e.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),s.pageY=e.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)}return n},ea=(e,t,n)=>{const o=e.document,r={type:"ready"};if(n.domLoaded)return void t(r);const s=()=>{Qs(e,"DOMContentLoaded",s),Qs(e,"load",s),n.domLoaded||(n.domLoaded=!0,t(r)),e=null};"complete"===o.readyState||"interactive"===o.readyState&&o.body?s():Zs(e,"DOMContentLoaded",s),n.domLoaded||Zs(e,"load",s)};class ta{constructor(){this.domLoaded=!1,this.events={},this.count=1,this.expando="mce-data-"+(+new Date).toString(32),this.hasFocusIn="onfocusin"in document.documentElement,this.count=1}bind(e,t,n,o){const r=this;let s;const a=window,i=e=>{r.executeHandlers(Js(e||a.event),l)};if(!e||lr(e)||ur(e))return n;let l;e[r.expando]?l=e[r.expando]:(l=r.count++,e[r.expando]=l,r.events[l]={}),o=o||e;const d=t.split(" ");let c=d.length;for(;c--;){let t=d[c],u=i,m=!1,f=!1;"DOMContentLoaded"===t&&(t="ready"),r.domLoaded&&"ready"===t&&"complete"===e.readyState?n.call(o,Js({type:t})):(r.hasFocusIn||"focusin"!==t&&"focusout"!==t||(m=!0,f="focusin"===t?"focus":"blur",u=e=>{const t=Js(e||a.event);t.type="focus"===t.type?"focusin":"focusout",r.executeHandlers(t,l)}),s=r.events[l][t],s?"ready"===t&&r.domLoaded?n(Js({type:t})):s.push({func:n,scope:o}):(r.events[l][t]=s=[{func:n,scope:o}],s.fakeName=f,s.capture=m,s.nativeHandler=u,"ready"===t?ea(e,u,r):Zs(e,f||t,u,m)))}return e=s=null,n}unbind(e,t,n){if(!e||lr(e)||ur(e))return this;const o=e[this.expando];if(o){let r=this.events[o];if(t){const o=t.split(" ");let s=o.length;for(;s--;){const t=o[s],a=r[t];if(a){if(n){let e=a.length;for(;e--;)if(a[e].func===n){const n=a.nativeHandler,o=a.fakeName,s=a.capture,i=a.slice(0,e).concat(a.slice(e+1));i.nativeHandler=n,i.fakeName=o,i.capture=s,r[t]=i}}n&&0!==a.length||(delete r[t],Qs(e,a.fakeName||t,a.nativeHandler,a.capture))}}}else pe(r,((t,n)=>{Qs(e,t.fakeName||n,t.nativeHandler,t.capture)})),r={};for(const e in r)if(_e(r,e))return this;delete this.events[o];try{delete e[this.expando]}catch(t){e[this.expando]=null}}return this}fire(e,t,n){return this.dispatch(e,t,n)}dispatch(e,t,n){if(!e||lr(e)||ur(e))return this;const o=Js({type:t,target:e},n);do{const t=e[this.expando];t&&this.executeHandlers(o,t),e=e.parentNode||e.ownerDocument||e.defaultView||e.parentWindow}while(e&&!o.isPropagationStopped());return this}clean(e){if(!e||lr(e)||ur(e))return this;if(e[this.expando]&&this.unbind(e),e.getElementsByTagName||(e=e.document),e&&e.getElementsByTagName){this.unbind(e);const t=e.getElementsByTagName("*");let n=t.length;for(;n--;)(e=t[n])[this.expando]&&this.unbind(e)}return this}destroy(){this.events={}}cancel(e){return e&&(e.preventDefault(),e.stopImmediatePropagation()),!1}executeHandlers(e,t){const n=this.events[t],o=n&&n[e.type];if(o)for(let t=0,n=o.length;t<n;t++){const n=o[t];if(n&&!1===n.func.call(n.scope,e)&&e.preventDefault(),e.isImmediatePropagationStopped())return}}}ta.Event=new ta;const na=Dt.each,oa=Dt.grep,ra="data-mce-style",sa=Dt.makeMap("fill-opacity font-weight line-height opacity orphans widows z-index zoom"," "),aa=(e,t,n)=>{y(n)||""===n?rn(e,t):Jt(e,t,n)},ia=e=>e.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase())),la=(e,t)=>{let n=0;if(e)for(let o=e.nodeType,r=e.previousSibling;r;r=r.previousSibling){const e=r.nodeType;(!t||!lr(r)||e!==o&&r.data.length)&&(n++,o=e)}return n},da=(e,t)=>{const n=tn(t,"style"),o=e.serialize(e.parse(n),$t(t));aa(t,ra,o)},ca=(e,t,n)=>{const o=ia(t);y(n)||""===n?go(e,o):io(e,o,((e,t)=>E(e)?_e(sa,t)?e+"":e+"px":e)(n,o))},ua=(e,t={})=>{const n={},o=window,r={};let s=0;const a=os.forElement(Cn(e),{contentCssCors:t.contentCssCors,referrerPolicy:t.referrerPolicy}),i=[],l=t.schema?t.schema:Is({}),d=Ws({url_converter:t.url_converter,url_converter_scope:t.url_converter_scope},t.schema),c=t.ownEvents?new ta:ta.Event,u=l.getBlockElements(),f=t=>t&&e&&m(t)?e.getElementById(t):t,h=e=>{const t=f(e);return C(t)?Cn(t):null},b=(e,t,n="")=>{let o;const r=h(e);if(C(r)&&Kt(r)){const e=G[t];o=e&&e.get?e.get(r.dom,t):tn(r,t)}return C(o)?o:n},v=e=>{const t=f(e);return y(t)?[]:t.attributes},E=(e,n,o)=>{B(e,(e=>{if(Jo(e)){const r=Cn(e),s=""===o?null:o,a=tn(r,n),i=G[n];i&&i.set?i.set(r.dom,s,n):aa(r,n,s),a!==s&&t.onSetAttrib&&t.onSetAttrib({attrElm:r.dom,attrName:n,attrValue:s})}}))},x=()=>t.root_element||e.body,k=(t,n)=>((e,t,n)=>{let o=0,r=0;const s=e.ownerDocument;if(n=n||e,t){if(n===e&&t.getBoundingClientRect&&"static"===co(Cn(e),"position")){const n=t.getBoundingClientRect();return o=n.left+(s.documentElement.scrollLeft||e.scrollLeft)-s.documentElement.clientLeft,r=n.top+(s.documentElement.scrollTop||e.scrollTop)-s.documentElement.clientTop,{x:o,y:r}}let a=t;for(;a&&a!==n&&a.nodeType&&!ts(a,n);){const e=a;o+=e.offsetLeft||0,r+=e.offsetTop||0,a=e.offsetParent}for(a=t.parentNode;a&&a!==n&&a.nodeType&&!ts(a,n);)o-=a.scrollLeft||0,r-=a.scrollTop||0,a=a.parentNode;r+=(e=>Jr.isFirefox()&&"table"===$t(e)?es(In(e)).filter((e=>"caption"===$t(e))).bind((e=>es(Mn(e)).map((t=>{const n=t.dom.offsetTop,o=e.dom.offsetTop,r=e.dom.offsetHeight;return n<=o?-r:0})))).getOr(0):0)(Cn(t))}return{x:o,y:r}})(e.body,f(t),n),S=(e,t,n)=>{const o=f(e);var r;if(!y(o)&&(er(o)||Jo(r=o)&&"http://www.w3.org/2000/svg"===r.namespaceURI))return n?co(Cn(o),ia(t)):("float"===(t=t.replace(/-(\D)/g,((e,t)=>t.toUpperCase())))&&(t="cssFloat"),o.style?o.style[t]:void 0)},R=e=>{const t=f(e);if(!t)return{w:0,h:0};let n=S(t,"width"),o=S(t,"height");return n&&-1!==n.indexOf("px")||(n="0"),o&&-1!==o.indexOf("px")||(o="0"),{w:parseInt(n,10)||t.offsetWidth||t.clientWidth,h:parseInt(o,10)||t.offsetHeight||t.clientHeight}},A=(e,t)=>{if(!e)return!1;const n=p(e)?e:[e];return $(n,(e=>xn(Cn(e),t)))},T=(e,t,n,o)=>{const r=[];let s=f(e);o=void 0===o;const a=n||("BODY"!==x().nodeName?x().parentNode:null);if(m(t))if("*"===t)t=Jo;else{const e=t;t=t=>A(t,e)}for(;s&&!(s===a||y(s.nodeType)||mr(s)||fr(s));){if(!t||t(s)){if(!o)return[s];r.push(s)}s=s.parentNode}return o?r:null},O=(e,t,n)=>{let o=t;if(e){m(t)&&(o=e=>A(e,t));for(let t=e[n];t;t=t[n])if(w(o)&&o(t))return t}return null},B=function(e,t,n){const o=null!=n?n:this;if(p(e)){const n=[];return na(e,((e,r)=>{const s=f(e);s&&n.push(t.call(o,s,r))})),n}{const n=f(e);return!!n&&t.call(o,n)}},P=(e,t)=>{B(e,(e=>{pe(t,((t,n)=>{E(e,n,t)}))}))},D=(e,t)=>{B(e,(e=>{const n=Cn(e);So(n,t)}))},L=(t,n,o,r,s)=>B(t,(t=>{const a=m(n)?e.createElement(n):n;return C(o)&&P(a,o),r&&(!m(r)&&r.nodeType?a.appendChild(r):m(r)&&D(a,r)),s?a:t.appendChild(a)})),M=(t,n,o)=>L(e.createElement(t),t,n,o,!0),I=Cs.encodeAllRaw,F=(e,t)=>B(e,(e=>{const n=Cn(e);return t&&q(In(n),(e=>{Yt(e)&&0===e.dom.length?Eo(e):po(n,e)})),Eo(n),n.dom})),U=(e,t,n)=>{B(e,(e=>{if(Jo(e)){const o=Cn(e),r=t.split(" ");q(r,(e=>{C(n)?(n?mn:gn)(o,e):((e,t)=>{const n=ln(e)?e.dom.classList.toggle(t):((e,t)=>H(dn(e),t)?un(e,t):cn(e,t))(e,t);fn(e)})(o,e)}))}}))},z=(e,t,n)=>B(t,(o=>{var r;const s=p(t)?e.cloneNode(!0):e;return n&&na(oa(o.childNodes),(e=>{s.appendChild(e)})),null===(r=o.parentNode)||void 0===r||r.replaceChild(s,o),o})),j=()=>e.createRange(),V=(n,r,s,a)=>{if(p(n)){let e=n.length;const t=[];for(;e--;)t[e]=V(n[e],r,s,a);return t}return!t.collect||n!==e&&n!==o||i.push([n,r,s,a]),c.bind(n,r,s,a||Y)},W=(t,n,r)=>{if(p(t)){let e=t.length;const o=[];for(;e--;)o[e]=W(t[e],n,r);return o}if(i.length>0&&(t===e||t===o)){let e=i.length;for(;e--;){const[o,s,a]=i[e];t!==o||n&&n!==s||r&&r!==a||c.unbind(o,s,a)}}return c.unbind(t,n,r)},K=e=>{if(e&&er(e)){const t=e.getAttribute("data-mce-contenteditable");return t&&"inherit"!==t?t:"inherit"!==e.contentEditable?e.contentEditable:null}return null},Y={doc:e,settings:t,win:o,files:r,stdMode:!0,boxModel:!0,styleSheetLoader:a,boundEvents:i,styles:d,schema:l,events:c,isBlock:e=>m(e)?_e(u,e):Jo(e)&&(_e(u,e.nodeName)||Xr(l,e)),root:null,clone:(e,t)=>e.cloneNode(t),getRoot:x,getViewPort:e=>{const t=Io(e);return{x:t.x,y:t.y,w:t.width,h:t.height}},getRect:e=>{const t=f(e),n=k(t),o=R(t);return{x:n.x,y:n.y,w:o.w,h:o.h}},getSize:R,getParent:(e,t,n)=>{const o=T(e,t,n,!1);return o&&o.length>0?o[0]:null},getParents:T,get:f,getNext:(e,t)=>O(e,t,"nextSibling"),getPrev:(e,t)=>O(e,t,"previousSibling"),select:(n,o)=>{var r,s;const a=null!==(s=null!==(r=f(o))&&void 0!==r?r:t.root_element)&&void 0!==s?s:e;return w(a.querySelectorAll)?ce(a.querySelectorAll(n)):[]},is:A,add:L,create:M,createHTML:(e,t,n="")=>{let o="<"+e;for(const e in t)ke(t,e)&&(o+=" "+e+'="'+I(t[e])+'"');return Xe(n)&&_e(l.getVoidElements(),e)?o+" />":o+">"+n+"</"+e+">"},createFragment:t=>{const n=e.createElement("div"),o=e.createDocumentFragment();let r;for(o.appendChild(n),t&&(n.innerHTML=t);r=n.firstChild;)o.appendChild(r);return o.removeChild(n),o},remove:F,setStyle:(e,n,o)=>{B(e,(e=>{const r=Cn(e);ca(r,n,o),t.update_styles&&da(d,r)}))},getStyle:S,setStyles:(e,n)=>{B(e,(e=>{const o=Cn(e);pe(n,((e,t)=>{ca(o,t,e)})),t.update_styles&&da(d,o)}))},removeAllAttribs:e=>B(e,(e=>{const t=e.attributes;for(let n=t.length-1;n>=0;n--)e.removeAttributeNode(t.item(n))})),setAttrib:E,setAttribs:P,getAttrib:b,getPos:k,parseStyle:e=>d.parse(e),serializeStyle:(e,t)=>d.serialize(e,t),addStyle:t=>{if(Y!==ua.DOM&&e===document){if(n[t])return;n[t]=!0}let o=e.getElementById("mceDefaultStyles");if(!o){o=e.createElement("style"),o.id="mceDefaultStyles",o.type="text/css";const t=e.head;t.firstChild?t.insertBefore(o,t.firstChild):t.appendChild(o)}o.styleSheet?o.styleSheet.cssText+=t:o.appendChild(e.createTextNode(t))},loadCSS:e=>{e||(e=""),q(e.split(","),(e=>{r[e]=!0,a.load(e).catch(_)}))},addClass:(e,t)=>{U(e,t,!0)},removeClass:(e,t)=>{U(e,t,!1)},hasClass:(e,t)=>{const n=h(e),o=t.split(" ");return C(n)&&ne(o,(e=>pn(n,e)))},toggleClass:U,show:e=>{B(e,(e=>go(Cn(e),"display")))},hide:e=>{B(e,(e=>io(Cn(e),"display","none")))},isHidden:e=>{const t=h(e);return C(t)&&Lt(mo(t,"display"),"none")},uniqueId:e=>(e||"mce_")+s++,setHTML:D,getOuterHTML:e=>{const t=h(e);return C(t)?Jo(t.dom)?t.dom.outerHTML:(e=>{const t=vn("div"),n=Cn(e.dom.cloneNode(!0));return vo(t,n),ko(t)})(t):""},setOuterHTML:(e,t)=>{B(e,(e=>{Jo(e)&&(e.outerHTML=t)}))},decode:Cs.decode,encode:I,insertAfter:(e,t)=>{const n=f(t);return B(e,(e=>{const t=null==n?void 0:n.parentNode,o=null==n?void 0:n.nextSibling;return t&&(o?t.insertBefore(e,o):t.appendChild(e)),e}))},replace:z,rename:(e,t)=>{if(e.nodeName!==t.toUpperCase()){const n=M(t);return na(v(e),(t=>{E(n,t.nodeName,b(e,t.nodeName))})),z(n,e,!0),n}return e},findCommonAncestor:(e,t)=>{let n=e;for(;n;){let e=t;for(;e&&n!==e;)e=e.parentNode;if(n===e)break;n=n.parentNode}return!n&&e.ownerDocument?e.ownerDocument.documentElement:n},run:B,getAttribs:v,isEmpty:(e,t,n)=>{if(g(t)){const o=e=>{const n=e.nodeName.toLowerCase();return Boolean(t[n])};return Rr(l,e,{...n,isContent:o})}return Rr(l,e,n)},createRng:j,nodeIndex:la,split:(e,t,n)=>{let o,r,s=j();if(e&&t&&e.parentNode&&t.parentNode){const a=e.parentNode;return s.setStart(a,la(e)),s.setEnd(t.parentNode,la(t)),o=s.extractContents(),s=j(),s.setStart(t.parentNode,la(t)+1),s.setEnd(a,la(e)+1),r=s.extractContents(),a.insertBefore(as(Y,o,l),e),n?a.insertBefore(n,e):a.insertBefore(t,e),a.insertBefore(as(Y,r,l),e),F(e),n||t}},bind:V,unbind:W,fire:(e,t,n)=>c.dispatch(e,t,n),dispatch:(e,t,n)=>c.dispatch(e,t,n),getContentEditable:K,getContentEditableParent:e=>{const t=x();let n=null;for(let o=e;o&&o!==t&&(n=K(o),null===n);o=o.parentNode);return n},isEditable:e=>{if(C(e)){const t=Jo(e)?e:e.parentElement;return C(t)&&er(t)&&no(Cn(t))}return!1},destroy:()=>{if(i.length>0){let e=i.length;for(;e--;){const[t,n,o]=i[e];c.unbind(t,n,o)}}pe(r,((e,t)=>{a.unload(t),delete r[t]}))},isChildOf:(e,t)=>e===t||t.contains(e),dumpRng:e=>"startContainer: "+e.startContainer.nodeName+", startOffset: "+e.startOffset+", endContainer: "+e.endContainer.nodeName+", endOffset: "+e.endOffset},G=((e,t,n)=>{const o=t.keep_values,r={set:(e,o,r)=>{const s=Cn(e);w(t.url_converter)&&C(o)&&(o=t.url_converter.call(t.url_converter_scope||n(),String(o),r,e)),aa(s,"data-mce-"+r,o),aa(s,r,o)},get:(e,t)=>{const n=Cn(e);return tn(n,"data-mce-"+t)||tn(n,t)}},s={style:{set:(t,n)=>{const r=Cn(t);o&&aa(r,ra,n),rn(r,"style"),m(n)&&lo(r,e.parse(n))},get:t=>{const n=Cn(t),o=tn(n,ra)||tn(n,"style");return e.serialize(e.parse(o),$t(n))}}};return o&&(s.href=s.src=r),s})(d,t,N(Y));return Y};ua.DOM=ua(document),ua.nodeIndex=la;const ma=ua.DOM;class fa{constructor(e={}){this.states={},this.queue=[],this.scriptLoadedCallbacks={},this.queueLoadedCallbacks=[],this.loading=!1,this.settings=e}_setReferrerPolicy(e){this.settings.referrerPolicy=e}loadScript(e){return new Promise(((t,n)=>{const o=ma;let r;const s=()=>{o.remove(a),r&&(r.onerror=r.onload=r=null)},a=o.uniqueId();r=document.createElement("script"),r.id=a,r.type="text/javascript",r.src=Dt._addCacheSuffix(e),this.settings.referrerPolicy&&o.setAttrib(r,"referrerpolicy",this.settings.referrerPolicy),r.onload=()=>{s(),t()},r.onerror=()=>{s(),n("Failed to load script: "+e)},(document.getElementsByTagName("head")[0]||document.body).appendChild(r)}))}isDone(e){return 2===this.states[e]}markDone(e){this.states[e]=2}add(e){const t=this;return t.queue.push(e),void 0===t.states[e]&&(t.states[e]=0),new Promise(((n,o)=>{t.scriptLoadedCallbacks[e]||(t.scriptLoadedCallbacks[e]=[]),t.scriptLoadedCallbacks[e].push({resolve:n,reject:o})}))}load(e){return this.add(e)}remove(e){delete this.states[e],delete this.scriptLoadedCallbacks[e]}loadQueue(){const e=this.queue;return this.queue=[],this.loadScripts(e)}loadScripts(e){const t=this,n=(e,n)=>{xe(t.scriptLoadedCallbacks,n).each((t=>{q(t,(t=>t[e](n)))})),delete t.scriptLoadedCallbacks[n]},o=e=>{const t=Y(e,(e=>"rejected"===e.status));return t.length>0?Promise.reject(te(t,(({reason:e})=>p(e)?e:[e]))):Promise.resolve()},r=e=>Promise.allSettled(V(e,(e=>2===t.states[e]?(n("resolve",e),Promise.resolve()):3===t.states[e]?(n("reject",e),Promise.reject(e)):(t.states[e]=1,t.loadScript(e).then((()=>{t.states[e]=2,n("resolve",e);const s=t.queue;return s.length>0?(t.queue=[],r(s).then(o)):Promise.resolve()}),(()=>(t.states[e]=3,n("reject",e),Promise.reject(e)))))))),s=e=>(t.loading=!0,r(e).then((e=>{t.loading=!1;const n=t.queueLoadedCallbacks.shift();return I.from(n).each(D),o(e)}))),a=Se(e);return t.loading?new Promise(((e,n)=>{t.queueLoadedCallbacks.push((()=>{s(a).then(e,n)}))})):s(a)}}fa.ScriptLoader=new fa;const ga={},pa=Or("en"),ha=()=>xe(ga,pa.get()),ba={getData:()=>he(ga,(e=>({...e}))),setCode:e=>{e&&pa.set(e)},getCode:()=>pa.get(),add:(e,t)=>{let n=ga[e];n||(ga[e]=n={});const o=V(fe(t),(e=>e.toLowerCase()));pe(t,((e,r)=>{const s=r.toLowerCase();s!==r&&((e,t)=>{const n=e.indexOf(t);return-1!==n&&e.indexOf(t,n+1)>n})(o,s)?(_e(t,s)||(n[s]=e),n[r]=e):n[s]=e}))},translate:e=>{const t=ha().getOr({}),n=e=>w(e)?Object.prototype.toString.call(e):o(e)?"":""+e,o=e=>""===e||null==e,r=e=>{const o=n(e);return _e(t,o)?n(t[o]):xe(t,o.toLowerCase()).map(n).getOr(o)},s=e=>e.replace(/{context:\w+}$/,"");if(o(e))return"";if(f(a=e)&&_e(a,"raw"))return n(e.raw);var a;if((e=>p(e)&&e.length>1)(e)){const t=e.slice(1);return s(r(e[0]).replace(/\{([0-9]+)\}/g,((e,o)=>_e(t,o)?n(t[o]):e)))}return s(r(e))},isRtl:()=>ha().bind((e=>xe(e,"_dir"))).exists((e=>"rtl"===e)),hasCode:e=>_e(ga,e)},va=()=>{const e=[],t={},n={},o=[],r=(e,t)=>{const n=Y(o,(n=>n.name===e&&n.state===t));q(n,(e=>e.resolve()))},s=e=>_e(t,e),a=(e,n)=>{const o=ba.getCode();!o||n&&-1===(","+(n||"")+",").indexOf(","+o+",")||fa.ScriptLoader.add(t[e]+"/langs/"+o+".js")},i=(e,t="added")=>"added"===t&&(e=>_e(n,e))(e)||"loaded"===t&&s(e)?Promise.resolve():new Promise((n=>{o.push({name:e,state:t,resolve:n})}));return{items:e,urls:t,lookup:n,get:e=>{if(n[e])return n[e].instance},requireLangPack:(e,t)=>{!1!==va.languageLoad&&(s(e)?a(e,t):i(e,"loaded").then((()=>a(e,t))))},add:(t,o)=>(e.push(o),n[t]={instance:o},r(t,"added"),o),remove:e=>{delete t[e],delete n[e]},createUrl:(e,t)=>m(t)?m(e)?{prefix:"",resource:t,suffix:""}:{prefix:e.prefix,resource:t,suffix:e.suffix}:t,load:(e,o)=>{if(t[e])return Promise.resolve();let s=m(o)?o:o.prefix+o.resource+o.suffix;0!==s.indexOf("/")&&-1===s.indexOf("://")&&(s=va.baseURL+"/"+s),t[e]=s.substring(0,s.lastIndexOf("/"));const a=()=>(r(e,"loaded"),Promise.resolve());return n[e]?a():fa.ScriptLoader.add(s).then(a)},waitFor:i}};va.languageLoad=!0,va.baseURL="",va.PluginManager=va(),va.ThemeManager=va(),va.ModelManager=va();const ya=(e,t)=>{let n=null;return{cancel:()=>{h(n)||(clearTimeout(n),n=null)},throttle:(...o)=>{h(n)&&(n=setTimeout((()=>{n=null,e.apply(null,o)}),t))}}},Ca=(e,t)=>{let n=null;const o=()=>{h(n)||(clearTimeout(n),n=null)};return{cancel:o,throttle:(...r)=>{o(),n=setTimeout((()=>{n=null,e.apply(null,r)}),t)}}},wa=N("mce-annotation"),Ea=N("data-mce-annotation"),xa=N("data-mce-annotation-uid"),_a=N("data-mce-annotation-active"),ka=N("data-mce-annotation-classes"),Sa=N("data-mce-annotation-attrs"),Na=e=>t=>kn(t,e),Ra=(e,t)=>{const n=e.selection.getRng(),o=Cn(n.startContainer),r=Cn(e.getBody()),s=t.fold((()=>"."+wa()),(e=>`[${Ea()}="${e}"]`)),a=Fn(o,n.startOffset).getOr(o);return to(a,s,Na(r)).bind((t=>nn(t,`${xa()}`).bind((n=>nn(t,`${Ea()}`).map((t=>{const o=Ta(e,n);return{uid:n,name:t,elements:o}}))))))},Aa=(e,t)=>on(e,"data-mce-bogus")||((e,t,n)=>Jn(e,'[data-mce-bogus="all"]',n).isSome())(e,0,Na(t)),Ta=(e,t)=>{const n=Cn(e.getBody()),o=Uo(n,`[${xa()}="${t}"]`);return Y(o,(e=>!Aa(e,n)))},Oa=(e,t)=>{const n=Cn(e.getBody()),o=Uo(n,`[${Ea()}="${t}"]`),r={};return q(o,(e=>{if(!Aa(e,n)){const t=tn(e,xa()),n=xe(r,t).getOr([]);r[t]=n.concat([e])}})),r},Ba=()=>window.crypto.getRandomValues(new Uint32Array(1))[0]/4294967295;let Pa=0;const Da=e=>{const t=(new Date).getTime(),n=Math.floor(1e9*Ba());return Pa++,e+"_"+n+Pa+String(t)},La=(e,t)=>Cn(e.dom.cloneNode(t)),Ma=e=>La(e,!1),Ia=e=>La(e,!0),Fa=(e,t,n=L)=>{const o=new $o(e,t),r=e=>{let t;do{t=o[e]()}while(t&&!lr(t)&&!n(t));return I.from(t).filter(lr)};return{current:()=>I.from(o.current()).filter(lr),next:()=>r("next"),prev:()=>r("prev"),prev2:()=>r("prev2")}},Ua=(e,t)=>{const n=t||(t=>e.isBlock(t)||gr(t)||br(t)),o=(e,t,n,r)=>{if(lr(e)){const n=r(e,t,e.data);if(-1!==n)return I.some({container:e,offset:n})}return n().bind((e=>o(e.container,e.offset,n,r)))};return{backwards:(t,r,s,a)=>{const i=Fa(t,null!=a?a:e.getRoot(),n);return o(t,r,(()=>i.prev().map((e=>({container:e,offset:e.length})))),s).getOrNull()},forwards:(t,r,s,a)=>{const i=Fa(t,null!=a?a:e.getRoot(),n);return o(t,r,(()=>i.next().map((e=>({container:e,offset:0})))),s).getOrNull()}}},za=((e,t)=>{const n=t=>e(t)?I.from(t.dom.nodeValue):I.none();return{get:t=>{if(!e(t))throw new Error("Can only get text value of a text node");return n(t).getOr("")},getOption:n,set:(t,n)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=n}}})(Yt),ja=e=>za.get(e),Ha=(e,t)=>za.set(e,t),$a=e=>{let t;return n=>(t=t||se(e,M),_e(t,$t(n)))},Va=e=>Kt(e)&&"br"===$t(e),qa=$a(["h1","h2","h3","h4","h5","h6","p","div","address","pre","form","blockquote","center","dir","fieldset","header","footer","article","section","hgroup","aside","nav","figure"]),Wa=$a(["ul","ol","dl"]),Ka=$a(["li","dd","dt"]),Ya=$a(["thead","tbody","tfoot"]),Ga=$a(["td","th"]),Xa=$a(["pre","script","textarea","style"]),Za=()=>{const e=vn("br");return Jt(e,"data-mce-bogus","1"),e},Qa=e=>{wo(e),vo(e,Za())},Ja=Vo,ei=Wo,ti=e=>e.replace(/\uFEFF/g,""),ni=Jo,oi=lr,ri=e=>(oi(e)&&(e=e.parentNode),ni(e)&&e.hasAttribute("data-mce-caret")),si=e=>oi(e)&&ei(e.data),ai=e=>ri(e)||si(e),ii=e=>e.firstChild!==e.lastChild||!gr(e.firstChild),li=e=>{const t=e.container();return!!lr(t)&&(t.data.charAt(e.offset())===Ja||e.isAtStart()&&si(t.previousSibling))},di=e=>{const t=e.container();return!!lr(t)&&(t.data.charAt(e.offset()-1)===Ja||e.isAtEnd()&&si(t.nextSibling))},ci=e=>oi(e)&&e.data[0]===Ja,ui=e=>oi(e)&&e.data[e.data.length-1]===Ja,mi=e=>e&&e.hasAttribute("data-mce-caret")?((e=>{var t;const n=e.getElementsByTagName("br"),o=n[n.length-1];rr(o)&&(null===(t=o.parentNode)||void 0===t||t.removeChild(o))})(e),e.removeAttribute("data-mce-caret"),e.removeAttribute("data-mce-bogus"),e.removeAttribute("style"),e.removeAttribute("data-mce-style"),e.removeAttribute("_moz_abspos"),e):null,fi=e=>ri(e.startContainer),gi=Math.round,pi=e=>e?{left:gi(e.left),top:gi(e.top),bottom:gi(e.bottom),right:gi(e.right),width:gi(e.width),height:gi(e.height)}:{left:0,top:0,bottom:0,right:0,width:0,height:0},hi=(e,t)=>(e=pi(e),t||(e.left=e.left+e.width),e.right=e.left,e.width=0,e),bi=(e,t,n)=>e>=0&&e<=Math.min(t.height,n.height)/2,vi=(e,t)=>{const n=Math.min(t.height/2,e.height/2);return e.bottom-n<t.top||!(e.top>t.bottom)&&bi(t.top-e.bottom,e,t)},yi=(e,t)=>e.top>t.bottom||!(e.bottom<t.top)&&bi(t.bottom-e.top,e,t),Ci=(e,t,n)=>{const o=Math.max(Math.min(t,e.left+e.width),e.left),r=Math.max(Math.min(n,e.top+e.height),e.top);return Math.sqrt((t-o)*(t-o)+(n-r)*(n-r))},wi=e=>{const t=e.startContainer,n=e.startOffset;return t===e.endContainer&&t.hasChildNodes()&&e.endOffset===n+1?t.childNodes[n]:null},Ei=(e,t)=>{if(Jo(e)&&e.hasChildNodes()){const n=e.childNodes,o=((e,t,n)=>Math.min(Math.max(e,0),n))(t,0,n.length-1);return n[o]}return e},xi=new RegExp("[\u0300-\u036f\u0483-\u0487\u0488-\u0489\u0591-\u05bd\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05c7\u0610-\u061a\u064b-\u065f\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7-\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08e3-\u0902\u093a\u093c\u0941-\u0948\u094d\u0951-\u0957\u0962-\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2-\u09e3\u0a01-\u0a02\u0a3c\u0a41-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a51\u0a70-\u0a71\u0a75\u0a81-\u0a82\u0abc\u0ac1-\u0ac5\u0ac7-\u0ac8\u0acd\u0ae2-\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62-\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c00\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56\u0c62-\u0c63\u0c81\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc-\u0ccd\u0cd5-\u0cd6\u0ce2-\u0ce3\u0d01\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62-\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb-\u0ebc\u0ec8-\u0ecd\u0f18-\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86-\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039-\u103a\u103d-\u103e\u1058-\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085-\u1086\u108d\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17b4-\u17b5\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927-\u1928\u1932\u1939-\u193b\u1a17-\u1a18\u1a1b\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1ab0-\u1abd\u1abe\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80-\u1b81\u1ba2-\u1ba5\u1ba8-\u1ba9\u1bab-\u1bad\u1be6\u1be8-\u1be9\u1bed\u1bef-\u1bf1\u1c2c-\u1c33\u1c36-\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1cf4\u1cf8-\u1cf9\u1dc0-\u1df5\u1dfc-\u1dff\u200c-\u200d\u20d0-\u20dc\u20dd-\u20e0\u20e1\u20e2-\u20e4\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302d\u302e-\u302f\u3099-\u309a\ua66f\ua670-\ua672\ua674-\ua67d\ua69e-\ua69f\ua6f0-\ua6f1\ua802\ua806\ua80b\ua825-\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\ua9e5\uaa29-\uaa2e\uaa31-\uaa32\uaa35-\uaa36\uaa43\uaa4c\uaa7c\uaab0\uaab2-\uaab4\uaab7-\uaab8\uaabe-\uaabf\uaac1\uaaec-\uaaed\uaaf6\uabe5\uabe8\uabed\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\uff9e-\uff9f]"),_i=e=>m(e)&&e.charCodeAt(0)>=768&&xi.test(e),ki=hr,Si=br,Ni=gr,Ri=lr,Ai=nr(["script","style","textarea"]),Ti=nr(["img","input","textarea","hr","iframe","video","audio","object","embed"]),Oi=nr(["table"]),Bi=ai,Pi=e=>!Bi(e)&&(Ri(e)?!Ai(e.parentNode):Ti(e)||Ni(e)||Oi(e)||Di(e)),Di=e=>!(e=>Jo(e)&&"true"===e.getAttribute("unselectable"))(e)&&Si(e),Li=(e,t)=>Pi(e)&&((e,t)=>{for(let n=e.parentNode;n&&n!==t;n=n.parentNode){if(Di(n))return!1;if(ki(n))return!0}return!0})(e,t),Mi=Jo,Ii=Pi,Fi=or("display","block table"),Ui=or("float","left right"),zi=((...e)=>t=>{for(let n=0;n<e.length;n++)if(!e[n](t))return!1;return!0})(Mi,Ii,O(Ui)),ji=O(or("white-space","pre pre-line pre-wrap")),Hi=lr,$i=gr,Vi=ua.nodeIndex,qi=(e,t)=>t<0&&Jo(e)&&e.hasChildNodes()?void 0:Ei(e,t),Wi=e=>e?e.createRange():ua.DOM.createRng(),Ki=e=>m(e)&&/[\r\n\t ]/.test(e),Yi=e=>!!e.setStart&&!!e.setEnd,Gi=e=>{const t=e.startContainer,n=e.startOffset;if(Ki(e.toString())&&ji(t.parentNode)&&lr(t)){const e=t.data;if(Ki(e[n-1])||Ki(e[n+1]))return!0}return!1},Xi=e=>0===e.left&&0===e.right&&0===e.top&&0===e.bottom,Zi=e=>{var t;let n;const o=e.getClientRects();return n=o.length>0?pi(o[0]):pi(e.getBoundingClientRect()),!Yi(e)&&$i(e)&&Xi(n)?(e=>{const t=e.ownerDocument,n=Wi(t),o=t.createTextNode(qo),r=e.parentNode;r.insertBefore(o,e),n.setStart(o,0),n.setEnd(o,1);const s=pi(n.getBoundingClientRect());return r.removeChild(o),s})(e):Xi(n)&&Yi(e)&&null!==(t=(e=>{const t=e.startContainer,n=e.endContainer,o=e.startOffset,r=e.endOffset;if(t===n&&lr(n)&&0===o&&1===r){const t=e.cloneRange();return t.setEndAfter(n),Zi(t)}return null})(e))&&void 0!==t?t:n},Qi=(e,t)=>{const n=hi(e,t);return n.width=1,n.right=n.left+1,n},Ji=(e,t,n)=>{const o=()=>(n||(n=(e=>{const t=[],n=e=>{var n,o;0!==e.height&&(t.length>0&&(n=e,o=t[t.length-1],n.left===o.left&&n.top===o.top&&n.bottom===o.bottom&&n.right===o.right)||t.push(e))},o=(e,t)=>{const o=Wi(e.ownerDocument);if(t<e.data.length){if(_i(e.data[t]))return;if(_i(e.data[t-1])&&(o.setStart(e,t),o.setEnd(e,t+1),!Gi(o)))return void n(Qi(Zi(o),!1))}t>0&&(o.setStart(e,t-1),o.setEnd(e,t),Gi(o)||n(Qi(Zi(o),!1))),t<e.data.length&&(o.setStart(e,t),o.setEnd(e,t+1),Gi(o)||n(Qi(Zi(o),!0)))},r=e.container(),s=e.offset();if(Hi(r))return o(r,s),t;if(Mi(r))if(e.isAtEnd()){const e=qi(r,s);Hi(e)&&o(e,e.data.length),zi(e)&&!$i(e)&&n(Qi(Zi(e),!1))}else{const a=qi(r,s);if(Hi(a)&&o(a,0),zi(a)&&e.isAtEnd())return n(Qi(Zi(a),!1)),t;const i=qi(e.container(),e.offset()-1);zi(i)&&!$i(i)&&(Fi(i)||Fi(a)||!zi(a))&&n(Qi(Zi(i),!1)),zi(a)&&n(Qi(Zi(a),!0))}return t})(Ji(e,t))),n);return{container:N(e),offset:N(t),toRange:()=>{const n=Wi(e.ownerDocument);return n.setStart(e,t),n.setEnd(e,t),n},getClientRects:o,isVisible:()=>o().length>0,isAtStart:()=>(Hi(e),0===t),isAtEnd:()=>Hi(e)?t>=e.data.length:t>=e.childNodes.length,isEqual:n=>n&&e===n.container()&&t===n.offset(),getNode:n=>qi(e,n?t-1:t)}};Ji.fromRangeStart=e=>Ji(e.startContainer,e.startOffset),Ji.fromRangeEnd=e=>Ji(e.endContainer,e.endOffset),Ji.after=e=>Ji(e.parentNode,Vi(e)+1),Ji.before=e=>Ji(e.parentNode,Vi(e)),Ji.isAbove=(e,t)=>It(le(t.getClientRects()),de(e.getClientRects()),vi).getOr(!1),Ji.isBelow=(e,t)=>It(de(t.getClientRects()),le(e.getClientRects()),yi).getOr(!1),Ji.isAtStart=e=>!!e&&e.isAtStart(),Ji.isAtEnd=e=>!!e&&e.isAtEnd(),Ji.isTextPosition=e=>!!e&&lr(e.container()),Ji.isElementPosition=e=>!Ji.isTextPosition(e);const el=(e,t)=>{lr(t)&&0===t.data.length&&e.remove(t)},tl=(e,t,n)=>{fr(n)?((e,t,n)=>{const o=I.from(n.firstChild),r=I.from(n.lastChild);t.insertNode(n),o.each((t=>el(e,t.previousSibling))),r.each((t=>el(e,t.nextSibling)))})(e,t,n):((e,t,n)=>{t.insertNode(n),el(e,n.previousSibling),el(e,n.nextSibling)})(e,t,n)},nl=lr,ol=rr,rl=ua.nodeIndex,sl=e=>{const t=e.parentNode;return ol(t)?sl(t):t},al=e=>e?Be(e.childNodes,((e,t)=>(ol(t)&&"BR"!==t.nodeName?e=e.concat(al(t)):e.push(t),e)),[]):[],il=e=>t=>e===t,ll=e=>(nl(e)?"text()":e.nodeName.toLowerCase())+"["+(e=>{let t,n;t=al(sl(e)),n=Pe(t,il(e),e),t=t.slice(0,n+1);const o=Be(t,((e,n,o)=>(nl(n)&&nl(t[o-1])&&e++,e)),0);return t=Oe(t,nr([e.nodeName])),n=Pe(t,il(e),e),n-o})(e)+"]",dl=(e,t)=>{let n,o=[],r=t.container(),s=t.offset();if(nl(r))n=((e,t)=>{let n=e;for(;(n=n.previousSibling)&&nl(n);)t+=n.data.length;return t})(r,s);else{const e=r.childNodes;s>=e.length?(n="after",s=e.length-1):n="before",r=e[s]}o.push(ll(r));let a=((e,t,n)=>{const o=[];for(let n=t.parentNode;n&&n!==e;n=n.parentNode)o.push(n);return o})(e,r);return a=Oe(a,O(rr)),o=o.concat(Te(a,(e=>ll(e)))),o.reverse().join("/")+","+n},cl=(e,t)=>{if(!t)return null;const n=t.split(","),o=n[0].split("/"),r=n.length>1?n[1]:"before",s=Be(o,((e,t)=>{const n=/([\w\-\(\)]+)\[([0-9]+)\]/.exec(t);return n?("text()"===n[1]&&(n[1]="#text"),((e,t,n)=>{let o=al(e);return o=Oe(o,((e,t)=>!nl(e)||!nl(o[t-1]))),o=Oe(o,nr([t])),o[n]})(e,n[1],parseInt(n[2],10))):null}),e);if(!s)return null;if(!nl(s)&&s.parentNode){let e;return e="after"===r?rl(s)+1:rl(s),Ji(s.parentNode,e)}return((e,t)=>{let n=e,o=0;for(;nl(n);){const r=n.data.length;if(t>=o&&t<=o+r){e=n,t-=o;break}if(!nl(n.nextSibling)){e=n,t=r;break}o+=r,n=n.nextSibling}return nl(e)&&t>e.data.length&&(t=e.data.length),Ji(e,t)})(s,parseInt(r,10))},ul=br,ml=(e,t,n,o,r)=>{const s=r?o.startContainer:o.endContainer;let a=r?o.startOffset:o.endOffset;const i=[],l=e.getRoot();if(lr(s))i.push(n?((e,t,n)=>{let o=e(t.data.slice(0,n)).length;for(let n=t.previousSibling;n&&lr(n);n=n.previousSibling)o+=e(n.data).length;return o})(t,s,a):a);else{let t=0;const o=s.childNodes;a>=o.length&&o.length&&(t=1,a=Math.max(0,o.length-1)),i.push(e.nodeIndex(o[a],n)+t)}for(let t=s;t&&t!==l;t=t.parentNode)i.push(e.nodeIndex(t,n));return i},fl=(e,t,n)=>{let o=0;return Dt.each(e.select(t),(e=>"all"===e.getAttribute("data-mce-bogus")?void 0:e!==n&&void o++)),o},gl=(e,t)=>{let n=t?e.startContainer:e.endContainer,o=t?e.startOffset:e.endOffset;if(Jo(n)&&"TR"===n.nodeName){const r=n.childNodes;n=r[Math.min(t?o:o-1,r.length-1)],n&&(o=t?0:n.childNodes.length,t?e.setStart(n,o):e.setEnd(n,o))}},pl=e=>(gl(e,!0),gl(e,!1),e),hl=(e,t)=>{if(Jo(e)&&(e=Ei(e,t),ul(e)))return e;if(ai(e)){lr(e)&&ri(e)&&(e=e.parentNode);let t=e.previousSibling;if(ul(t))return t;if(t=e.nextSibling,ul(t))return t}},bl=(e,t,n)=>{const o=n.getNode(),r=n.getRng();if("IMG"===o.nodeName||ul(o)){const e=o.nodeName;return{name:e,index:fl(n.dom,e,o)}}const s=(e=>hl(e.startContainer,e.startOffset)||hl(e.endContainer,e.endOffset))(r);if(s){const e=s.tagName;return{name:e,index:fl(n.dom,e,s)}}return((e,t,n,o)=>{const r=t.dom,s=ml(r,e,n,o,!0),a=t.isForward(),i=fi(o)?{isFakeCaret:!0}:{};return t.isCollapsed()?{start:s,forward:a,...i}:{start:s,end:ml(r,e,n,o,!1),forward:a,...i}})(e,n,t,r)},vl=(e,t,n)=>{const o={"data-mce-type":"bookmark",id:t,style:"overflow:hidden;line-height:0px"};return n?e.create("span",o,"&#xFEFF;"):e.create("span",o)},yl=(e,t)=>{const n=e.dom;let o=e.getRng();const r=n.uniqueId(),s=e.isCollapsed(),a=e.getNode(),i=a.nodeName,l=e.isForward();if("IMG"===i)return{name:i,index:fl(n,i,a)};const d=pl(o.cloneRange());if(!s){d.collapse(!1);const e=vl(n,r+"_end",t);tl(n,d,e)}o=pl(o),o.collapse(!0);const c=vl(n,r+"_start",t);return tl(n,o,c),e.moveToBookmark({id:r,keep:!0,forward:l}),{id:r,forward:l}},Cl=T(bl,R,!0),wl=e=>{const t=t=>t(e),n=N(e),o=()=>r,r={tag:!0,inner:e,fold:(t,n)=>n(e),isValue:M,isError:L,map:t=>xl.value(t(e)),mapError:o,bind:t,exists:t,forall:t,getOr:n,or:o,getOrThunk:n,orThunk:o,getOrDie:n,each:t=>{t(e)},toOptional:()=>I.some(e)};return r},El=e=>{const t=()=>n,n={tag:!1,inner:e,fold:(t,n)=>t(e),isValue:L,isError:M,map:t,mapError:t=>xl.error(t(e)),bind:t,exists:L,forall:M,getOr:R,or:R,getOrThunk:P,orThunk:P,getOrDie:B(String(e)),each:_,toOptional:I.none};return n},xl={value:wl,error:El,fromOption:(e,t)=>e.fold((()=>El(t)),wl)},_l=e=>{if(!p(e))throw new Error("cases must be an array");if(0===e.length)throw new Error("there must be at least one case");const t=[],n={};return q(e,((o,r)=>{const s=fe(o);if(1!==s.length)throw new Error("one and only one name per case");const a=s[0],i=o[a];if(void 0!==n[a])throw new Error("duplicate key detected:"+a);if("cata"===a)throw new Error("cannot have a case named cata (sorry)");if(!p(i))throw new Error("case arguments must be an array");t.push(a),n[a]=(...n)=>{const o=n.length;if(o!==i.length)throw new Error("Wrong number of arguments to case "+a+". Expected "+i.length+" ("+i+"), got "+o);return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);return t[r].apply(null,n)},match:e=>{const o=fe(e);if(t.length!==o.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+o.join(","));if(!ne(t,(e=>H(o,e))))throw new Error("Not all branches were specified when using match. Specified: "+o.join(", ")+"\nRequired: "+t.join(", "));return e[a].apply(null,n)},log:e=>{console.log(e,{constructors:t,constructor:a,params:n})}}}})),n};_l([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const kl=e=>"inline-command"===e.type||"inline-format"===e.type,Sl=e=>"block-command"===e.type||"block-format"===e.type,Nl=e=>{var t;const n=t=>xl.error({message:t,pattern:e}),o=(t,o,r)=>{if(void 0!==e.format){let r;if(p(e.format)){if(!ne(e.format,m))return n(t+" pattern has non-string items in the `format` array");r=e.format}else{if(!m(e.format))return n(t+" pattern has non-string `format` parameter");r=[e.format]}return xl.value(o(r))}return void 0!==e.cmd?m(e.cmd)?xl.value(r(e.cmd,e.value)):n(t+" pattern has non-string `cmd` parameter"):n(t+" pattern is missing both `format` and `cmd` parameters")};if(!f(e))return n("Raw pattern is not an object");if(!m(e.start))return n("Raw pattern is missing `start` parameter");if(void 0!==e.end){if(!m(e.end))return n("Inline pattern has non-string `end` parameter");if(0===e.start.length&&0===e.end.length)return n("Inline pattern has empty `start` and `end` parameters");let t=e.start,r=e.end;return 0===r.length&&(r=t,t=""),o("Inline",(e=>({type:"inline-format",start:t,end:r,format:e})),((e,n)=>({type:"inline-command",start:t,end:r,cmd:e,value:n})))}if(void 0!==e.replacement)return m(e.replacement)?0===e.start.length?n("Replacement pattern has empty `start` parameter"):xl.value({type:"inline-command",start:"",end:e.start,cmd:"mceInsertContent",value:e.replacement}):n("Replacement pattern has non-string `replacement` parameter");{const r=null!==(t=e.trigger)&&void 0!==t?t:"space";return 0===e.start.length?n("Block pattern has empty `start` parameter"):o("Block",(t=>({type:"block-format",start:e.start,format:t[0],trigger:r})),((t,n)=>({type:"block-command",start:e.start,cmd:t,value:n,trigger:r})))}},Rl=e=>Y(e,Sl),Al=e=>Y(e,kl),Tl=(e,t)=>({...e,blockPatterns:Y(e.blockPatterns,(e=>((e,t)=>("block-command"===e.type||"block-format"===e.type)&&e.trigger===t)(e,t)))}),Ol=e=>{const t=(e=>{const t=[],n=[];return q(e,(e=>{e.fold((e=>{t.push(e)}),(e=>{n.push(e)}))})),{errors:t,values:n}})(V(e,Nl));return q(t.errors,(e=>console.error(e.message,e.pattern))),t.values},Bl=(e,t,n)=>{e.dispatch(t,n)},Pl=(e,t,n,o)=>{e.dispatch("FormatApply",{format:t,node:n,vars:o})},Dl=(e,t,n,o)=>{e.dispatch("FormatRemove",{format:t,node:n,vars:o})},Ll=(e,t)=>e.dispatch("SetContent",t),Ml=(e,t)=>e.dispatch("GetContent",t),Il=(e,t)=>{e.dispatch("AutocompleterUpdateActiveRange",t)},Fl=(e,t)=>e.dispatch("PastePlainTextToggle",{state:t}),Ul=xt().deviceType,zl=Ul.isTouch(),jl=ua.DOM,Hl=e=>u(e,RegExp),$l=e=>t=>t.options.get(e),Vl=e=>m(e)||f(e),ql=(e,t="")=>n=>{const o=m(n);if(o){if(-1!==n.indexOf("=")){const r=(e=>{const t=e.indexOf("=")>0?e.split(/[;,](?![^=;,]*(?:[;,]|$))/):e.split(",");return X(t,((e,t)=>{const n=t.split("="),o=n[0],r=n.length>1?n[1]:o;return e[We(o)]=We(r),e}),{})})(n);return{value:xe(r,e.id).getOr(t),valid:o}}return{value:n,valid:o}}return{valid:!1,message:"Must be a string."}},Wl=$l("iframe_attrs"),Kl=$l("doctype"),Yl=$l("document_base_url"),Gl=$l("body_id"),Xl=$l("body_class"),Zl=$l("content_security_policy"),Ql=$l("br_in_pre"),Jl=$l("forced_root_block"),ed=$l("forced_root_block_attrs"),td=$l("newline_behavior"),nd=$l("br_newline_selector"),od=$l("no_newline_selector"),rd=$l("keep_styles"),sd=$l("end_container_on_empty_block"),ad=$l("automatic_uploads"),id=$l("images_reuse_filename"),ld=$l("images_replace_blob_uris"),dd=$l("icons"),cd=$l("icons_url"),ud=$l("images_upload_url"),md=$l("images_upload_base_path"),fd=$l("images_upload_credentials"),gd=$l("images_upload_handler"),pd=$l("content_css_cors"),hd=$l("referrer_policy"),bd=$l("language"),vd=$l("language_url"),yd=$l("indent_use_margin"),Cd=$l("indentation"),wd=$l("content_css"),Ed=$l("content_style"),xd=$l("font_css"),_d=$l("directionality"),kd=$l("inline_boundaries_selector"),Sd=$l("object_resizing"),Nd=$l("resize_img_proportional"),Rd=$l("placeholder"),Ad=$l("event_root"),Td=$l("service_message"),Od=$l("theme"),Bd=$l("theme_url"),Pd=$l("model"),Dd=$l("model_url"),Ld=$l("inline_boundaries"),Md=$l("formats"),Id=$l("preview_styles"),Fd=$l("format_empty_lines"),Ud=$l("format_noneditable_selector"),zd=$l("custom_ui_selector"),jd=$l("inline"),Hd=$l("hidden_input"),$d=$l("submit_patch"),Vd=$l("add_form_submit_trigger"),qd=$l("add_unload_trigger"),Wd=$l("custom_undo_redo_levels"),Kd=$l("disable_nodechange"),Yd=$l("readonly"),Gd=$l("editable_root"),Xd=$l("content_css_cors"),Zd=$l("plugins"),Qd=$l("external_plugins"),Jd=$l("block_unsupported_drop"),ec=$l("visual"),tc=$l("visual_table_class"),nc=$l("visual_anchor_class"),oc=$l("iframe_aria_text"),rc=$l("setup"),sc=$l("init_instance_callback"),ac=$l("urlconverter_callback"),ic=$l("auto_focus"),lc=$l("browser_spellcheck"),dc=$l("protect"),cc=$l("paste_block_drop"),uc=$l("paste_data_images"),mc=$l("paste_preprocess"),fc=$l("paste_postprocess"),gc=$l("newdocument_content"),pc=$l("paste_webkit_styles"),hc=$l("paste_remove_styles_if_webkit"),bc=$l("paste_merge_formats"),vc=$l("smart_paste"),yc=$l("paste_as_text"),Cc=$l("paste_tab_spaces"),wc=$l("allow_html_data_urls"),Ec=$l("text_patterns"),xc=$l("text_patterns_lookup"),_c=$l("noneditable_class"),kc=$l("editable_class"),Sc=$l("noneditable_regexp"),Nc=$l("preserve_cdata"),Rc=$l("highlight_on_focus"),Ac=$l("xss_sanitization"),Tc=$l("init_content_sync"),Oc=e=>Dt.explode(e.options.get("images_file_types")),Bc=$l("table_tab_navigation"),Pc=$l("details_initial_state"),Dc=$l("details_serialized_state"),Lc=$l("sandbox_iframes"),Mc=e=>e.options.get("sandbox_iframes_exclusions"),Ic=$l("convert_unsafe_embeds"),Fc=$l("license_key"),Uc=$l("api_key"),zc=$l("disabled"),jc=Jo,Hc=lr,$c=e=>{const t=e.parentNode;t&&t.removeChild(e)},Vc=e=>{const t=ti(e);return{count:e.length-t.length,text:t}},qc=e=>{let t;for(;-1!==(t=e.data.lastIndexOf(Ja));)e.deleteData(t,1)},Wc=(e,t)=>(Yc(e),t),Kc=(e,t)=>Ji.isTextPosition(t)?((e,t)=>Hc(e)&&t.container()===e?((e,t)=>{const n=Vc(e.data.substr(0,t.offset())),o=Vc(e.data.substr(t.offset()));return(n.text+o.text).length>0?(qc(e),Ji(e,t.offset()-n.count)):t})(e,t):Wc(e,t))(e,t):((e,t)=>t.container()===e.parentNode?((e,t)=>{const n=t.container(),o=((e,t)=>{const n=j(e,t);return-1===n?I.none():I.some(n)})(ce(n.childNodes),e).map((e=>e<t.offset()?Ji(n,t.offset()-1):t)).getOr(t);return Yc(e),o})(e,t):Wc(e,t))(e,t),Yc=e=>{jc(e)&&ai(e)&&(ii(e)?e.removeAttribute("data-mce-caret"):$c(e)),Hc(e)&&(qc(e),0===e.data.length&&$c(e))},Gc=br,Xc=Cr,Zc=vr,Qc=(e,t,n)=>{const o=hi(t.getBoundingClientRect(),n);let r,s;if("BODY"===e.tagName){const t=e.ownerDocument.documentElement;r=e.scrollLeft||t.scrollLeft,s=e.scrollTop||t.scrollTop}else{const t=e.getBoundingClientRect();r=e.scrollLeft-t.left,s=e.scrollTop-t.top}o.left+=r,o.right+=r,o.top+=s,o.bottom+=s,o.width=1;let a=t.offsetWidth-t.clientWidth;return a>0&&(n&&(a*=-1),o.left+=a,o.right+=a),o},Jc=(e,t,n,o)=>{const r=Pr();let s,a;const i=Jl(e),l=e.dom,d=()=>{(e=>{var t,n;const o=Uo(Cn(e),"*[contentEditable=false],video,audio,embed,object");for(let e=0;e<o.length;e++){const r=o[e].dom;let s=r.previousSibling;if(ui(s)){const e=s.data;1===e.length?null===(t=s.parentNode)||void 0===t||t.removeChild(s):s.deleteData(e.length-1,1)}s=r.nextSibling,ci(s)&&(1===s.data.length?null===(n=s.parentNode)||void 0===n||n.removeChild(s):s.deleteData(0,1))}})(t),a&&(Yc(a),a=null),r.on((e=>{l.remove(e.caret),r.clear()})),s&&(clearInterval(s),s=void 0)};return{show:(e,c)=>{let u;if(d(),Zc(c))return null;if(!n(c))return a=((e,t)=>{var n;const o=(null!==(n=e.ownerDocument)&&void 0!==n?n:document).createTextNode(Ja),r=e.parentNode;if(t){const t=e.previousSibling;if(oi(t)){if(ai(t))return t;if(ui(t))return t.splitText(t.data.length-1)}null==r||r.insertBefore(o,e)}else{const t=e.nextSibling;if(oi(t)){if(ai(t))return t;if(ci(t))return t.splitText(1),t}e.nextSibling?null==r||r.insertBefore(o,e.nextSibling):null==r||r.appendChild(o)}return o})(c,e),u=c.ownerDocument.createRange(),tu(a.nextSibling)?(u.setStart(a,0),u.setEnd(a,0)):(u.setStart(a,1),u.setEnd(a,1)),u;{const n=((e,t,n)=>{var o;const r=(null!==(o=t.ownerDocument)&&void 0!==o?o:document).createElement(e);r.setAttribute("data-mce-caret",n?"before":"after"),r.setAttribute("data-mce-bogus","all"),r.appendChild(Za().dom);const s=t.parentNode;return n?null==s||s.insertBefore(r,t):t.nextSibling?null==s||s.insertBefore(r,t.nextSibling):null==s||s.appendChild(r),r})(i,c,e),d=Qc(t,c,e);l.setStyle(n,"top",d.top),l.setStyle(n,"caret-color","transparent"),a=n;const m=l.create("div",{class:"mce-visual-caret","data-mce-bogus":"all"});l.setStyles(m,{...d}),l.add(t,m),r.set({caret:m,element:c,before:e}),e&&l.addClass(m,"mce-visual-caret-before"),s=setInterval((()=>{r.on((e=>{o()?l.toggleClass(e.caret,"mce-visual-caret-hidden"):l.addClass(e.caret,"mce-visual-caret-hidden")}))}),500),u=c.ownerDocument.createRange(),u.setStart(n,0),u.setEnd(n,0)}return u},hide:d,getCss:()=>".mce-visual-caret {position: absolute;background-color: black;background-color: currentcolor;}.mce-visual-caret-hidden {display: none;}*[data-mce-caret] {position: absolute;left: -1000px;right: auto;top: 0;margin: 0;padding: 0;}",reposition:()=>{r.on((e=>{const n=Qc(t,e.element,e.before);l.setStyles(e.caret,{...n})}))},destroy:()=>clearInterval(s)}},eu=()=>Tt.browser.isFirefox(),tu=e=>Gc(e)||Xc(e),nu=e=>(tu(e)||sr(e)&&eu())&&On(Cn(e)).exists(no),ou=hr,ru=br,su=Cr,au=or("display","block table table-cell table-row table-caption list-item"),iu=ai,lu=ri,du=Jo,cu=lr,uu=Pi,mu=e=>e>0,fu=e=>e<0,gu=(e,t)=>{let n;for(;n=e(t);)if(!lu(n))return n;return null},pu=(e,t,n,o,r)=>{const s=new $o(e,o),a=ru(e)||lu(e);let i;if(fu(t)){if(a&&(i=gu(s.prev.bind(s),!0),n(i)))return i;for(;i=gu(s.prev.bind(s),r);)if(n(i))return i}if(mu(t)){if(a&&(i=gu(s.next.bind(s),!0),n(i)))return i;for(;i=gu(s.next.bind(s),r);)if(n(i))return i}return null},hu=(e,t)=>{for(;e&&e!==t;){if(au(e))return e;e=e.parentNode}return null},bu=(e,t,n)=>hu(e.container(),n)===hu(t.container(),n),vu=(e,t)=>{if(!t)return I.none();const n=t.container(),o=t.offset();return du(n)?I.from(n.childNodes[o+e]):I.none()},yu=(e,t)=>{var n;const o=(null!==(n=t.ownerDocument)&&void 0!==n?n:document).createRange();return e?(o.setStartBefore(t),o.setEndBefore(t)):(o.setStartAfter(t),o.setEndAfter(t)),o},Cu=(e,t,n)=>hu(t,e)===hu(n,e),wu=(e,t,n)=>{const o=e?"previousSibling":"nextSibling";let r=n;for(;r&&r!==t;){let e=r[o];if(e&&iu(e)&&(e=e[o]),ru(e)||su(e)){if(Cu(t,e,r))return e;break}if(uu(e))break;r=r.parentNode}return null},Eu=T(yu,!0),xu=T(yu,!1),_u=(e,t,n)=>{let o;const r=T(wu,!0,t),s=T(wu,!1,t),a=n.startContainer,i=n.startOffset;if(ri(a)){const e=cu(a)?a.parentNode:a,t=e.getAttribute("data-mce-caret");if("before"===t&&(o=e.nextSibling,nu(o)))return Eu(o);if("after"===t&&(o=e.previousSibling,nu(o)))return xu(o)}if(!n.collapsed)return n;if(lr(a)){if(iu(a)){if(1===e){if(o=s(a),o)return Eu(o);if(o=r(a),o)return xu(o)}if(-1===e){if(o=r(a),o)return xu(o);if(o=s(a),o)return Eu(o)}return n}if(ui(a)&&i>=a.data.length-1)return 1===e&&(o=s(a),o)?Eu(o):n;if(ci(a)&&i<=1)return-1===e&&(o=r(a),o)?xu(o):n;if(i===a.data.length)return o=s(a),o?Eu(o):n;if(0===i)return o=r(a),o?xu(o):n}return n},ku=(e,t)=>vu(e?0:-1,t).filter(ru),Su=(e,t,n)=>{const o=_u(e,t,n);return-1===e?Ji.fromRangeStart(o):Ji.fromRangeEnd(o)},Nu=e=>I.from(e.getNode()).map(Cn),Ru=(e,t)=>{let n=t;for(;n=e(n);)if(n.isVisible())return n;return n},Au=(e,t)=>{const n=bu(e,t);return!(n||!gr(e.getNode()))||n};var Tu;!function(e){e[e.Backwards=-1]="Backwards",e[e.Forwards=1]="Forwards"}(Tu||(Tu={}));const Ou=br,Bu=lr,Pu=Jo,Du=gr,Lu=Pi,Mu=e=>Ti(e)||(e=>!!Di(e)&&!X(ce(e.getElementsByTagName("*")),((e,t)=>e||ki(t)),!1))(e),Iu=Li,Fu=(e,t)=>e.hasChildNodes()&&t<e.childNodes.length?e.childNodes[t]:null,Uu=(e,t)=>{if(mu(e)){if(Lu(t.previousSibling)&&!Bu(t.previousSibling))return Ji.before(t);if(Bu(t))return Ji(t,0)}if(fu(e)){if(Lu(t.nextSibling)&&!Bu(t.nextSibling))return Ji.after(t);if(Bu(t))return Ji(t,t.data.length)}return fu(e)?Du(t)?Ji.before(t):Ji.after(t):Ji.before(t)},zu=(e,t,n)=>{let o,r,s,a;if(!Pu(n)||!t)return null;if(t.isEqual(Ji.after(n))&&n.lastChild){if(a=Ji.after(n.lastChild),fu(e)&&Lu(n.lastChild)&&Pu(n.lastChild))return Du(n.lastChild)?Ji.before(n.lastChild):a}else a=t;const i=a.container();let l=a.offset();if(Bu(i)){if(fu(e)&&l>0)return Ji(i,--l);if(mu(e)&&l<i.length)return Ji(i,++l);o=i}else{if(fu(e)&&l>0&&(r=Fu(i,l-1),Lu(r)))return!Mu(r)&&(s=pu(r,e,Iu,r),s)?Bu(s)?Ji(s,s.data.length):Ji.after(s):Bu(r)?Ji(r,r.data.length):Ji.before(r);if(mu(e)&&l<i.childNodes.length&&(r=Fu(i,l),Lu(r)))return Du(r)?((e,t)=>{const n=t.nextSibling;return n&&Lu(n)?Bu(n)?Ji(n,0):Ji.before(n):zu(Tu.Forwards,Ji.after(t),e)})(n,r):!Mu(r)&&(s=pu(r,e,Iu,r),s)?Bu(s)?Ji(s,0):Ji.before(s):Bu(r)?Ji(r,0):Ji.after(r);o=r||a.getNode()}if(o&&(mu(e)&&a.isAtEnd()||fu(e)&&a.isAtStart())&&(o=pu(o,e,M,n,!0),Iu(o,n)))return Uu(e,o);r=o?pu(o,e,Iu,n):o;const d=De(Y(((e,t)=>{const n=[];let o=e;for(;o&&o!==t;)n.push(o),o=o.parentNode;return n})(i,n),Ou));return!d||r&&d.contains(r)?r?Uu(e,r):null:(a=mu(e)?Ji.after(d):Ji.before(d),a)},ju=e=>({next:t=>zu(Tu.Forwards,t,e),prev:t=>zu(Tu.Backwards,t,e)}),Hu=e=>Ji.isTextPosition(e)?0===e.offset():Pi(e.getNode()),$u=e=>{if(Ji.isTextPosition(e)){const t=e.container();return e.offset()===t.data.length}return Pi(e.getNode(!0))},Vu=(e,t)=>!Ji.isTextPosition(e)&&!Ji.isTextPosition(t)&&e.getNode()===t.getNode(!0),qu=(e,t,n)=>{const o=ju(t);return I.from(e?o.next(n):o.prev(n))},Wu=(e,t,n)=>qu(e,t,n).bind((o=>bu(n,o,t)&&((e,t,n)=>{return e?!Vu(t,n)&&(o=t,!(!Ji.isTextPosition(o)&&gr(o.getNode())))&&$u(t)&&Hu(n):!Vu(n,t)&&Hu(t)&&$u(n);var o})(e,n,o)?qu(e,t,o):I.some(o))),Ku=(e,t,n,o)=>Wu(e,t,n).bind((n=>o(n)?Ku(e,t,n,o):I.some(n))),Yu=(e,t)=>{const n=e?t.firstChild:t.lastChild;return lr(n)?I.some(Ji(n,e?0:n.data.length)):n?Pi(n)?I.some(e?Ji.before(n):gr(o=n)?Ji.before(o):Ji.after(o)):((e,t,n)=>{const o=e?Ji.before(n):Ji.after(n);return qu(e,t,o)})(e,t,n):I.none();var o},Gu=T(qu,!0),Xu=T(qu,!1),Zu=T(Yu,!0),Qu=T(Yu,!1),Ju="_mce_caret",em=e=>Jo(e)&&e.id===Ju,tm=(e,t)=>{let n=t;for(;n&&n!==e;){if(em(n))return n;n=n.parentNode}return null},nm=e=>_e(e,"name"),om=e=>Dt.isArray(e.start),rm=e=>!(!nm(e)&&b(e.forward))||e.forward,sm=(e,t)=>(Jo(t)&&e.isBlock(t)&&!t.innerHTML&&(t.innerHTML='<br data-mce-bogus="1" />'),t),am=(e,t)=>Qu(e).fold(L,(e=>(t.setStart(e.container(),e.offset()),t.setEnd(e.container(),e.offset()),!0))),im=(e,t,n)=>!(!(e=>!e.hasChildNodes())(t)||!tm(e,t)||(((e,t)=>{var n;const o=(null!==(n=e.ownerDocument)&&void 0!==n?n:document).createTextNode(Ja);e.appendChild(o),t.setStart(o,0),t.setEnd(o,0)})(t,n),0)),lm=(e,t,n,o)=>{const r=n[t?"start":"end"],s=e.getRoot();if(r){let e=s,n=r[0];for(let t=r.length-1;e&&t>=1;t--){const n=e.childNodes;if(im(s,e,o))return!0;if(r[t]>n.length-1)return!!im(s,e,o)||am(e,o);e=n[r[t]]}lr(e)&&(n=Math.min(r[0],e.data.length)),Jo(e)&&(n=Math.min(r[0],e.childNodes.length)),t?o.setStart(e,n):o.setEnd(e,n)}return!0},dm=e=>lr(e)&&e.data.length>0,cm=(e,t,n)=>{const o=e.get(n.id+"_"+t),r=null==o?void 0:o.parentNode,s=n.keep;if(o&&r){let a,i;if("start"===t?s?o.hasChildNodes()?(a=o.firstChild,i=1):dm(o.nextSibling)?(a=o.nextSibling,i=0):dm(o.previousSibling)?(a=o.previousSibling,i=o.previousSibling.data.length):(a=r,i=e.nodeIndex(o)+1):(a=r,i=e.nodeIndex(o)):s?o.hasChildNodes()?(a=o.firstChild,i=1):dm(o.previousSibling)?(a=o.previousSibling,i=o.previousSibling.data.length):(a=r,i=e.nodeIndex(o)):(a=r,i=e.nodeIndex(o)),!s){const r=o.previousSibling,s=o.nextSibling;let l;for(Dt.each(Dt.grep(o.childNodes),(e=>{lr(e)&&(e.data=e.data.replace(/\uFEFF/g,""))}));l=e.get(n.id+"_"+t);)e.remove(l,!0);if(lr(s)&&lr(r)&&!Tt.browser.isOpera()){const t=r.data.length;r.appendData(s.data),e.remove(s),a=r,i=t}}return I.some(Ji(a,i))}return I.none()},um=(e,t,n)=>((e,t,n=!1)=>2===t?bl(ti,n,e):3===t?(e=>{const t=e.getRng();return{start:dl(e.dom.getRoot(),Ji.fromRangeStart(t)),end:dl(e.dom.getRoot(),Ji.fromRangeEnd(t)),forward:e.isForward()}})(e):t?(e=>({rng:e.getRng(),forward:e.isForward()}))(e):yl(e,!1))(e,t,n),mm=(e,t)=>{((e,t)=>{const n=e.dom;if(t){if(om(t))return((e,t)=>{const n=e.createRng();return lm(e,!0,t,n)&&lm(e,!1,t,n)?I.some({range:n,forward:rm(t)}):I.none()})(n,t);if((e=>m(e.start))(t))return((e,t)=>{const n=I.from(cl(e.getRoot(),t.start)),o=I.from(cl(e.getRoot(),t.end));return It(n,o,((n,o)=>{const r=e.createRng();return r.setStart(n.container(),n.offset()),r.setEnd(o.container(),o.offset()),{range:r,forward:rm(t)}}))})(n,t);if((e=>_e(e,"id"))(t))return((e,t)=>{const n=cm(e,"start",t),o=cm(e,"end",t);return It(n,o.or(n),((n,o)=>{const r=e.createRng();return r.setStart(sm(e,n.container()),n.offset()),r.setEnd(sm(e,o.container()),o.offset()),{range:r,forward:rm(t)}}))})(n,t);if(nm(t))return((e,t)=>I.from(e.select(t.name)[t.index]).map((t=>{const n=e.createRng();return n.selectNode(t),{range:n,forward:!0}})))(n,t);if((e=>_e(e,"rng"))(t))return I.some({range:t.rng,forward:rm(t)})}return I.none()})(e,t).each((({range:t,forward:n})=>{e.setRng(t,n)}))},fm=e=>Jo(e)&&"SPAN"===e.tagName&&"bookmark"===e.getAttribute("data-mce-type"),gm=(pm=qo,e=>pm===e);var pm;const hm=e=>""!==e&&-1!==" \f\n\r\t\v".indexOf(e),bm=e=>!hm(e)&&!gm(e)&&!Wo(e),vm=e=>{const t=[];if(e)for(let n=0;n<e.rangeCount;n++)t.push(e.getRangeAt(n));return t},ym=(e,t)=>{const n=Uo(t,"td[data-mce-selected],th[data-mce-selected]");return n.length>0?n:(e=>Y((e=>te(e,(e=>{const t=wi(e);return t?[Cn(t)]:[]})))(e),Ga))(e)},Cm=e=>ym(vm(e.selection.getSel()),Cn(e.getBody())),wm=(e,t)=>Jn(e,"table",t),Em=e=>Un(e).fold(N([e]),(t=>[e].concat(Em(t)))),xm=e=>zn(e).fold(N([e]),(t=>"br"===$t(t)?Pn(t).map((t=>[e].concat(xm(t)))).getOr([]):[e].concat(xm(t)))),_m=(e,t)=>It((e=>{const t=e.startContainer,n=e.startOffset;return lr(t)?0===n?I.some(Cn(t)):I.none():I.from(t.childNodes[n]).map(Cn)})(t),(e=>{const t=e.endContainer,n=e.endOffset;return lr(t)?n===t.data.length?I.some(Cn(t)):I.none():I.from(t.childNodes[n-1]).map(Cn)})(t),((t,n)=>{const o=Q(Em(e),T(kn,t)),r=Q(xm(e),T(kn,n));return o.isSome()&&r.isSome()})).getOr(!1),km=(e,t,n,o)=>{const r=n,s=new $o(n,r),a=Ce(e.schema.getMoveCaretBeforeOnEnterElements(),((e,t)=>!H(["td","th","table"],t.toLowerCase())));let i=n;do{if(lr(i)&&0!==Dt.trim(i.data).length)return void(o?t.setStart(i,0):t.setEnd(i,i.data.length));if(a[i.nodeName])return void(o?t.setStartBefore(i):"BR"===i.nodeName?t.setEndBefore(i):t.setEndAfter(i))}while(i=o?s.next():s.prev());"BODY"===r.nodeName&&(o?t.setStart(r,0):t.setEnd(r,r.childNodes.length))},Sm=e=>{const t=e.selection.getSel();return C(t)&&t.rangeCount>0},Nm=(e,t)=>{const n=Cm(e);n.length>0?q(n,(n=>{const o=n.dom,r=e.dom.createRng();r.setStartBefore(o),r.setEndAfter(o),t(r,!0)})):t(e.selection.getRng(),!1)},Rm=(e,t,n)=>{const o=yl(e,t);n(o),e.moveToBookmark(o)},Am=e=>E(null==e?void 0:e.nodeType),Tm=e=>Jo(e)&&!fm(e)&&!em(e)&&!rr(e),Om=(e,t,n)=>{const{selection:o,dom:r}=e,s=o.getNode(),a=br(s);Rm(o,!0,(()=>{t()})),a&&br(s)&&r.isChildOf(s,e.getBody())?e.selection.select(s):n(o.getStart())&&Bm(r,o)},Bm=(e,t)=>{var n,o;const r=t.getRng(),{startContainer:s,startOffset:a}=r;if(!((e,t)=>{if(Tm(t)&&!/^(TD|TH)$/.test(t.nodeName)){const n=e.getAttrib(t,"data-mce-selected"),o=parseInt(n,10);return!isNaN(o)&&o>0}return!1})(e,t.getNode())&&Jo(s)){const i=s.childNodes,l=e.getRoot();let d;if(a<i.length){const t=i[a];d=new $o(t,null!==(n=e.getParent(t,e.isBlock))&&void 0!==n?n:l)}else{const t=i[i.length-1];d=new $o(t,null!==(o=e.getParent(t,e.isBlock))&&void 0!==o?o:l),d.next(!0)}for(let n=d.current();n;n=d.next()){if("false"===e.getContentEditable(n))return;if(lr(n)&&!Mm(n))return r.setStart(n,0),void t.setRng(r)}}},Pm=(e,t,n)=>{if(e){const o=t?"nextSibling":"previousSibling";for(e=n?e:e[o];e;e=e[o])if(Jo(e)||!Mm(e))return e}},Dm=(e,t)=>!!e.getTextBlockElements()[t.nodeName.toLowerCase()]||Xr(e,t),Lm=(e,t,n)=>e.schema.isValidChild(t,n),Mm=(e,t=!1)=>{if(C(e)&&lr(e)){const n=t?e.data.replace(/ /g,"\xa0"):e.data;return Yo(n)}return!1},Im=(e,t)=>{const n=e.dom;return Tm(t)&&"false"===n.getContentEditable(t)&&((e,t)=>{const n="[data-mce-cef-wrappable]",o=Ud(e),r=Xe(o)?n:`${n},${o}`;return xn(Cn(t),r)})(e,t)&&0===n.select('[contenteditable="true"]',t).length},Fm=(e,t)=>w(e)?e(t):(C(t)&&(e=e.replace(/%(\w+)/g,((e,n)=>t[n]||e))),e),Um=(e,t)=>(t=t||"",e=""+((e=e||"").nodeName||e),t=""+(t.nodeName||t),e.toLowerCase()===t.toLowerCase()),zm=(e,t)=>{if(y(e))return null;{let n=String(e);return"color"!==t&&"backgroundColor"!==t||(n=qs(n)),"fontWeight"===t&&700===e&&(n="bold"),"fontFamily"===t&&(n=n.replace(/[\'\"]/g,"").replace(/,\s+/g,",")),n}},jm=(e,t,n)=>{const o=e.getStyle(t,n);return zm(o,n)},Hm=(e,t)=>{let n;return e.getParent(t,(t=>!!Jo(t)&&(n=e.getStyle(t,"text-decoration"),!!n&&"none"!==n))),n},$m=(e,t,n)=>e.getParents(t,n,e.getRoot()),Vm=(e,t,n)=>{const o=e.formatter.get(t);return C(o)&&$(o,n)},qm=e=>ke(e,"block"),Wm=e=>ke(e,"selector"),Km=e=>ke(e,"inline"),Ym=e=>Wm(e)&&!1!==e.expand&&!Km(e),Gm=e=>(e=>{const t=[];let n=e;for(;n;){if(lr(n)&&n.data!==Ja||n.childNodes.length>1)return[];Jo(n)&&t.push(n),n=n.firstChild}return t})(e).length>0,Xm=e=>em(e.dom)&&Gm(e.dom),Zm=fm,Qm=$m,Jm=Mm,ef=Dm,tf=(e,t)=>{let n=t;for(;n;){if(Jo(n)&&e.getContentEditable(n))return"false"===e.getContentEditable(n)?n:t;n=n.parentNode}return t},nf=(e,t,n,o)=>{const r=t.data;if(e){for(let e=n;e>0;e--)if(o(r.charAt(e-1)))return e}else for(let e=n;e<r.length;e++)if(o(r.charAt(e)))return e;return-1},of=(e,t,n)=>nf(e,t,n,(e=>gm(e)||hm(e))),rf=(e,t,n)=>nf(e,t,n,bm),sf=(e,t,n,o,r,s)=>{let a;const i=e.getParent(n,e.isBlock)||t,l=(t,n,o)=>{const s=Ua(e),l=r?s.backwards:s.forwards;return I.from(l(t,n,((e,t)=>Zm(e.parentNode)?-1:(a=e,o(r,e,t))),i))};return l(n,o,of).bind((e=>s?l(e.container,e.offset+(r?-1:0),rf):I.some(e))).orThunk((()=>a?I.some({container:a,offset:r?0:a.length}):I.none()))},af=(e,t,n,o,r)=>{const s=o[r];lr(o)&&Xe(o.data)&&s&&(o=s);const a=Qm(e,o);for(let o=0;o<a.length;o++)for(let r=0;r<t.length;r++){const s=t[r];if((!C(s.collapsed)||s.collapsed===n.collapsed)&&Wm(s)&&e.is(a[o],s.selector))return a[o]}return o},lf=(e,t,n,o)=>{var r;let s=n;const a=e.getRoot(),i=t[0];if(qm(i)&&(s=i.wrapper?null:e.getParent(n,i.block,a)),!s){const t=null!==(r=e.getParent(n,"LI,TD,TH,SUMMARY"))&&void 0!==r?r:a;s=e.getParent(lr(n)?n.parentNode:n,(t=>t!==a&&ef(e.schema,t)),t)}if(s&&qm(i)&&i.wrapper&&(s=Qm(e,s,"ul,ol").reverse()[0]||s),!s)for(s=n;s&&s[o]&&!e.isBlock(s[o])&&(s=s[o],!Um(s,"br")););return s||n},df=(e,t,n,o)=>{const r=n.parentNode;return!C(n[o])&&(!(r!==t&&!y(r)&&!e.isBlock(r))||df(e,t,r,o))},cf=(e,t,n,o,r)=>{let s=n;const a=r?"previousSibling":"nextSibling",i=e.getRoot();if(lr(n)&&!Jm(n)&&(r?o>0:o<n.data.length))return n;for(;s;){if(!t[0].block_expand&&e.isBlock(s))return s;for(let t=s[a];t;t=t[a]){const n=lr(t)&&!df(e,i,t,a);if(!Zm(t)&&(!gr(l=t)||!l.getAttribute("data-mce-bogus")||l.nextSibling)&&!Jm(t,n))return s}if(s===i||s.parentNode===i){n=s;break}s=s.parentNode}var l;return n},uf=e=>Zm(e.parentNode)||Zm(e),mf=(e,t,n,o=!1)=>{let{startContainer:r,startOffset:s,endContainer:a,endOffset:i}=t;const l=n[0];return Jo(r)&&r.hasChildNodes()&&(r=Ei(r,s),lr(r)&&(s=0)),Jo(a)&&a.hasChildNodes()&&(a=Ei(a,t.collapsed?i:i-1),lr(a)&&(i=a.data.length)),r=tf(e,r),a=tf(e,a),uf(r)&&(r=Zm(r)?r:r.parentNode,r=t.collapsed?r.previousSibling||r:r.nextSibling||r,lr(r)&&(s=t.collapsed?r.length:0)),uf(a)&&(a=Zm(a)?a:a.parentNode,a=t.collapsed?a.nextSibling||a:a.previousSibling||a,lr(a)&&(i=t.collapsed?0:a.length)),t.collapsed&&(sf(e,e.getRoot(),r,s,!0,o).each((({container:e,offset:t})=>{r=e,s=t})),sf(e,e.getRoot(),a,i,!1,o).each((({container:e,offset:t})=>{a=e,i=t}))),(Km(l)||l.block_expand)&&(Km(l)&&lr(r)&&0!==s||(r=cf(e,n,r,s,!0)),Km(l)&&lr(a)&&i!==a.data.length||(a=cf(e,n,a,i,!1))),Ym(l)&&(r=af(e,n,t,r,"previousSibling"),a=af(e,n,t,a,"nextSibling")),(qm(l)||Wm(l))&&(r=lf(e,n,r,"previousSibling"),a=lf(e,n,a,"nextSibling"),qm(l)&&(e.isBlock(r)||(r=cf(e,n,r,s,!0),lr(r)&&(s=0)),e.isBlock(a)||(a=cf(e,n,a,i,!1),lr(a)&&(i=a.data.length)))),Jo(r)&&r.parentNode&&(s=e.nodeIndex(r),r=r.parentNode),Jo(a)&&a.parentNode&&(i=e.nodeIndex(a)+1,a=a.parentNode),{startContainer:r,startOffset:s,endContainer:a,endOffset:i}},ff=(e,t,n)=>{var o;const r=t.startOffset,s=Ei(t.startContainer,r),a=t.endOffset,i=Ei(t.endContainer,a-1),l=e=>{const t=e[0];lr(t)&&t===s&&r>=t.data.length&&e.splice(0,1);const n=e[e.length-1];return 0===a&&e.length>0&&n===i&&lr(n)&&e.splice(e.length-1,1),e},d=(e,t,n)=>{const o=[];for(;e&&e!==n;e=e[t])o.push(e);return o},c=(t,n)=>e.getParent(t,(e=>e.parentNode===n),n),u=(e,t,o)=>{const r=o?"nextSibling":"previousSibling";for(let s=e,a=s.parentNode;s&&s!==t;s=a){a=s.parentNode;const t=d(s===e?s:s[r],r);t.length&&(o||t.reverse(),n(l(t)))}};if(s===i)return n(l([s]));const m=null!==(o=e.findCommonAncestor(s,i))&&void 0!==o?o:e.getRoot();if(e.isChildOf(s,i))return u(s,m,!0);if(e.isChildOf(i,s))return u(i,m);const f=c(s,m)||s,g=c(i,m)||i;u(s,f,!0);const p=d(f===s?f:f.nextSibling,"nextSibling",g===i?g.nextSibling:g);p.length&&n(l(p)),u(i,g)},gf=['pre[class*=language-][contenteditable="false"]',"figure.image","div[data-ephox-embed-iri]","div.tiny-pageembed","div.mce-toc","div[data-mce-toc]"],pf=(e,t,n,o,r,s)=>{const{uid:a=t,...i}=n;mn(e,wa()),Jt(e,`${xa()}`,a),Jt(e,`${Ea()}`,o);const{attributes:l={},classes:d=[]}=r(a,i);if(en(e,l),((e,t)=>{q(t,(t=>{mn(e,t)}))})(e,d),s){d.length>0&&Jt(e,`${ka()}`,d.join(","));const t=fe(l);t.length>0&&Jt(e,`${Sa()}`,t.join(","))}},hf=(e,t,n,o,r)=>{const s=vn("span",e);return pf(s,t,n,o,r,!1),s},bf=(e,t,n,o,r,s)=>{const a=[],i=hf(e.getDoc(),n,s,o,r),l=Pr(),d=()=>{l.clear()},c=e=>{q(e,u)},u=t=>{switch(((e,t,n,o)=>Tn(t).fold((()=>"skipping"),(r=>"br"===o||(e=>Yt(e)&&ja(e)===Ja)(t)?"valid":(e=>Kt(e)&&pn(e,wa()))(t)?"existing":em(t.dom)?"caret":$(gf,(e=>xn(t,e)))?"valid-block":Lm(e,n,o)&&Lm(e,$t(r),n)?"valid":"invalid-child")))(e,t,"span",$t(t))){case"invalid-child":{d();const e=In(t);c(e),d();break}case"valid-block":d(),pf(t,n,s,o,r,!0);break;case"valid":{const e=l.get().getOrThunk((()=>{const e=Ma(i);return a.push(e),l.set(e),e}));yo(t,e);break}}};return ff(e.dom,t,(e=>{d(),(e=>{const t=V(e,Cn);c(t)})(e)})),a},vf=e=>{const t=(()=>{const e={};return{register:(t,n)=>{e[t]={name:t,settings:n}},lookup:t=>xe(e,t).map((e=>e.settings)),getNames:()=>fe(e)}})();((e,t)=>{const n=Ea(),o=e=>I.from(e.attr(n)).bind(t.lookup),r=e=>{var t,n;e.attr(xa(),null),e.attr(Ea(),null),e.attr(_a(),null);const o=I.from(e.attr(Sa())).map((e=>e.split(","))).getOr([]),r=I.from(e.attr(ka())).map((e=>e.split(","))).getOr([]);q(o,(t=>e.attr(t,null)));const s=null!==(n=null===(t=e.attr("class"))||void 0===t?void 0:t.split(" "))&&void 0!==n?n:[],a=re(s,[wa()].concat(r));e.attr("class",a.length>0?a.join(" "):null),e.attr(ka(),null),e.attr(Sa(),null)};e.serializer.addTempAttr(_a()),e.serializer.addAttributeFilter(n,(e=>{for(const t of e)o(t).each((e=>{!1===e.persistent&&("span"===t.name?t.unwrap():r(t))}))}))})(e,t);const n=((e,t)=>{const n=Or({}),o=()=>({listeners:[],previous:Pr()}),r=(e,t)=>{s(e,(e=>(t(e),e)))},s=(e,t)=>{const r=n.get(),s=t(xe(r,e).getOrThunk(o));r[e]=s,n.set(r)},a=(t,n)=>{q(Ta(e,t),(e=>{n?Jt(e,_a(),"true"):rn(e,_a())}))},i=Ca((()=>{const n=ae(t.getNames());q(n,(t=>{s(t,(n=>{const o=n.previous.get();return Ra(e,I.some(t)).fold((()=>{o.each((e=>{(e=>{r(e,(t=>{q(t.listeners,(t=>t(!1,e)))}))})(t),n.previous.clear(),a(e,!1)}))}),(({uid:e,name:t,elements:s})=>{Lt(o,e)||(o.each((e=>a(e,!1))),((e,t,n)=>{r(e,(o=>{q(o.listeners,(o=>o(!0,e,{uid:t,nodes:V(n,(e=>e.dom))})))}))})(t,e,s),n.previous.set(e),a(e,!0))})),{previous:n.previous,listeners:n.listeners}}))}))}),30);return e.on("remove",(()=>{i.cancel()})),e.on("NodeChange",(()=>{i.throttle()})),{addListener:(e,t)=>{s(e,(e=>({previous:e.previous,listeners:e.listeners.concat([t])})))}}})(e,t),o=Zt("span"),r=e=>{q(e,(e=>{o(e)?xo(e):(e=>{gn(e,wa()),rn(e,`${xa()}`),rn(e,`${Ea()}`),rn(e,`${_a()}`);const t=nn(e,`${Sa()}`).map((e=>e.split(","))).getOr([]),n=nn(e,`${ka()}`).map((e=>e.split(","))).getOr([]);var o;q(t,(t=>rn(e,t))),o=e,q(n,(e=>{gn(o,e)})),rn(e,`${ka()}`),rn(e,`${Sa()}`)})(e)}))};return{register:(e,n)=>{t.register(e,n)},annotate:(n,o)=>{t.lookup(n).each((t=>{((e,t,n,o)=>{e.undoManager.transact((()=>{const r=e.selection,s=r.getRng(),a=Cm(e).length>0,i=Da("mce-annotation");if(s.collapsed&&!a&&((e,t)=>{const n=mf(e.dom,t,[{inline:"span"}]);t.setStart(n.startContainer,n.startOffset),t.setEnd(n.endContainer,n.endOffset),e.selection.setRng(t)})(e,s),r.getRng().collapsed&&!a){const s=hf(e.getDoc(),i,o,t,n.decorate);So(s,qo),r.getRng().insertNode(s.dom),r.select(s.dom)}else Rm(r,!1,(()=>{Nm(e,(r=>{bf(e,r,i,t,n.decorate,o)}))}))}))})(e,n,t,o)}))},annotationChanged:(e,t)=>{n.addListener(e,t)},remove:t=>{Ra(e,I.some(t)).each((({elements:t})=>{const n=e.selection.getBookmark();r(t),e.selection.moveToBookmark(n)}))},removeAll:t=>{const n=e.selection.getBookmark();pe(Oa(e,t),((e,t)=>{r(e)})),e.selection.moveToBookmark(n)},getAll:t=>{const n=Oa(e,t);return he(n,(e=>V(e,(e=>e.dom))))}}},yf=e=>({getBookmark:T(um,e),moveToBookmark:T(mm,e)});yf.isBookmarkNode=fm;const Cf=(e,t,n)=>!n.collapsed&&$(n.getClientRects(),(n=>((e,t,n)=>t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom)(n,e,t))),wf=()=>Cn(document),Ef=(e,t=!1)=>e.dom.focus({preventScroll:t}),xf=e=>{const t=$n(e).dom;return e.dom===t.activeElement},_f=(e=wf())=>I.from(e.dom.activeElement).map(Cn),kf=(e,t,n,o)=>({start:e,soffset:t,finish:n,foffset:o}),Sf=_l([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),Nf={before:Sf.before,on:Sf.on,after:Sf.after,cata:(e,t,n,o)=>e.fold(t,n,o),getStart:e=>e.fold(R,R,R)},Rf=_l([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Af={domRange:Rf.domRange,relative:Rf.relative,exact:Rf.exact,exactFromRange:e=>Rf.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>Cn(e.startContainer),relative:(e,t)=>Nf.getStart(e),exact:(e,t,n,o)=>e}))(e);return An(t)},range:kf},Tf=(e,t)=>{const n=Yt(t)?ja(t).length:In(t).length+1;return e>n?n:e<0?0:e},Of=e=>Af.range(e.start,Tf(e.soffset,e.start),e.finish,Tf(e.foffset,e.finish)),Bf=(e,t)=>!Qo(t.dom)&&(Sn(e,t)||kn(e,t)),Pf=e=>t=>Bf(e,t.start)&&Bf(e,t.finish),Df=e=>Af.range(Cn(e.startContainer),e.startOffset,Cn(e.endContainer),e.endOffset),Lf=e=>{const t=document.createRange();try{return t.setStart(e.start.dom,e.soffset),t.setEnd(e.finish.dom,e.foffset),I.some(t)}catch(e){return I.none()}},Mf=e=>{const t=(e=>e.inline||Tt.browser.isFirefox())(e)?(n=Cn(e.getBody()),(e=>{const t=e.getSelection();return(t&&0!==t.rangeCount?I.from(t.getRangeAt(0)):I.none()).map(Df)})(An(n).dom).filter(Pf(n))):I.none();var n;e.bookmark=t.isSome()?t:e.bookmark},If=e=>(e.bookmark?e.bookmark:I.none()).bind((t=>{return n=Cn(e.getBody()),o=t,I.from(o).filter(Pf(n)).map(Of);var n,o})).bind(Lf),Ff={isEditorUIElement:e=>{const t=e.className.toString();return-1!==t.indexOf("tox-")||-1!==t.indexOf("mce-")}},Uf={setEditorTimeout:(e,t,n)=>((e,t)=>(E(t)||(t=0),setTimeout(e,t)))((()=>{e.removed||t()}),n),setEditorInterval:(e,t,n)=>{const o=((e,t)=>(E(t)||(t=0),setInterval(e,t)))((()=>{e.removed?clearInterval(o):t()}),n);return o}};let zf;const jf=ua.DOM,Hf=e=>{const t=e.classList;return void 0!==t&&(t.contains("tox-edit-area")||t.contains("tox-edit-area__iframe")||t.contains("mce-content-body"))},$f=(e,t)=>{const n=zd(e),o=jf.getParent(t,(t=>(e=>Jo(e)&&Ff.isEditorUIElement(e))(t)||!!n&&e.dom.is(t,n)));return null!==o},Vf=e=>{try{const t=$n(Cn(e.getElement()));return _f(t).fold((()=>document.body),(e=>e.dom))}catch(e){return document.body}},qf=(e,t)=>{const n=t.editor;(e=>{const t=ya((()=>{Mf(e)}),0);e.on("init",(()=>{e.inline&&((e,t)=>{const n=()=>{t.throttle()};ua.DOM.bind(document,"mouseup",n),e.on("remove",(()=>{ua.DOM.unbind(document,"mouseup",n)}))})(e,t),((e,t)=>{((e,t)=>{e.on("mouseup touchend",(e=>{t.throttle()}))})(e,t),e.on("keyup NodeChange AfterSetSelectionRange",(t=>{(e=>"nodechange"===e.type&&e.selectionChange)(t)||Mf(e)}))})(e,t)})),e.on("remove",(()=>{t.cancel()}))})(n);const o=(e,t)=>{Rc(e)&&!0!==e.inline&&t(Cn(e.getContainer()),"tox-edit-focus")};n.on("focusin",(()=>{const t=e.focusedEditor;Hf(Vf(n))&&o(n,mn),t!==n&&(t&&t.dispatch("blur",{focusedEditor:n}),e.setActive(n),e.focusedEditor=n,n.dispatch("focus",{blurredEditor:t}),n.focus(!0))})),n.on("focusout",(()=>{Uf.setEditorTimeout(n,(()=>{const t=e.focusedEditor;Hf(Vf(n))&&t===n||o(n,gn),$f(n,Vf(n))||t!==n||(n.dispatch("blur",{focusedEditor:null}),e.focusedEditor=null)}))})),zf||(zf=t=>{const n=e.activeEditor;n&&Wn(t).each((t=>{const o=t;o.ownerDocument===document&&(o===document.body||$f(n,o)||e.focusedEditor!==n||(n.dispatch("blur",{focusedEditor:null}),e.focusedEditor=null))}))},jf.bind(document,"focusin",zf))},Wf=(e,t)=>{e.focusedEditor===t.editor&&(e.focusedEditor=null),!e.activeEditor&&zf&&(jf.unbind(document,"focusin",zf),zf=null)},Kf=(e,t)=>{((e,t)=>(e=>e.collapsed?I.from(Ei(e.startContainer,e.startOffset)).map(Cn):I.none())(t).bind((t=>Ya(t)?I.some(t):Sn(e,t)?I.none():I.some(e))))(Cn(e.getBody()),t).bind((e=>Zu(e.dom))).fold((()=>{e.selection.normalize()}),(t=>e.selection.setRng(t.toRange())))},Yf=e=>{if(e.setActive)try{e.setActive()}catch(t){e.focus()}else e.focus()},Gf=e=>e.inline?(e=>{const t=e.getBody();return t&&(n=Cn(t),xf(n)||(o=n,_f($n(o)).filter((e=>o.dom.contains(e.dom)))).isSome());var n,o})(e):(e=>C(e.iframeElement)&&xf(Cn(e.iframeElement)))(e),Xf=e=>Gf(e)||(e=>{const t=$n(Cn(e.getElement()));return _f(t).filter((t=>!Hf(t.dom)&&$f(e,t.dom))).isSome()})(e),Zf=e=>e.editorManager.setActive(e),Qf={BACKSPACE:8,DELETE:46,DOWN:40,ENTER:13,ESC:27,LEFT:37,RIGHT:39,SPACEBAR:32,TAB:9,UP:38,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,modifierPressed:e=>e.shiftKey||e.ctrlKey||e.altKey||Qf.metaKeyPressed(e),metaKeyPressed:e=>Tt.os.isMacOS()||Tt.os.isiOS()?e.metaKey:e.ctrlKey&&!e.altKey},Jf="data-mce-selected",eg=Math.abs,tg=Math.round,ng={nw:[0,0,-1,-1],ne:[1,0,1,-1],se:[1,1,1,1],sw:[0,1,-1,1]},og=(e,t)=>{const n=t.dom,o=t.getDoc(),r=document,s=t.getBody();let a,i,l,d,c,u,m,f,g,p,h,b,v,y,w;const E=e=>C(e)&&(pr(e)||n.is(e,"figure.image")),x=e=>Cr(e)||n.hasClass(e,"mce-preview-object"),_=e=>{const n=e.target;((e,t)=>{if((e=>"longpress"===e.type||0===e.type.indexOf("touch"))(e)){const n=e.touches[0];return E(e.target)&&!Cf(n.clientX,n.clientY,t)}return E(e.target)&&!Cf(e.clientX,e.clientY,t)})(e,t.selection.getRng())&&!e.isDefaultPrevented()&&t.selection.select(n)},k=e=>n.hasClass(e,"mce-preview-object")&&C(e.firstElementChild)?[e,e.firstElementChild]:n.is(e,"figure.image")?[e.querySelector("img")]:[e],S=e=>{const o=Sd(t);return!(!o||t.mode.isReadOnly())&&"false"!==e.getAttribute("data-mce-resize")&&e!==t.getBody()&&(n.hasClass(e,"mce-preview-object")&&C(e.firstElementChild)?xn(Cn(e.firstElementChild),o):xn(Cn(e),o))},N=(e,o,r)=>{if(C(r)){const s=k(e);q(s,(e=>{e.style[o]||!t.schema.isValid(e.nodeName.toLowerCase(),o)?n.setStyle(e,o,r):n.setAttrib(e,o,""+r)}))}},R=(e,t,n)=>{N(e,"width",t),N(e,"height",n)},A=e=>{let o,r,c,C,_;o=e.screenX-u,r=e.screenY-m,b=o*d[2]+f,v=r*d[3]+g,b=b<5?5:b,v=v<5?5:v,c=(E(a)||x(a))&&!1!==Nd(t)?!Qf.modifierPressed(e):Qf.modifierPressed(e),c&&(eg(o)>eg(r)?(v=tg(b*p),b=tg(v/p)):(b=tg(v/p),v=tg(b*p))),R(i,b,v),C=d.startPos.x+o,_=d.startPos.y+r,C=C>0?C:0,_=_>0?_:0,n.setStyles(l,{left:C,top:_,display:"block"}),l.innerHTML=b+" &times; "+v,d[2]<0&&i.clientWidth<=b&&n.setStyle(i,"left",void 0+(f-b)),d[3]<0&&i.clientHeight<=v&&n.setStyle(i,"top",void 0+(g-v)),o=s.scrollWidth-y,r=s.scrollHeight-w,o+r!==0&&n.setStyles(l,{left:C-o,top:_-r}),h||(((e,t,n,o,r)=>{e.dispatch("ObjectResizeStart",{target:t,width:n,height:o,origin:r})})(t,a,f,g,"corner-"+d.name),h=!0)},T=()=>{const e=h;h=!1,e&&(N(a,"width",b),N(a,"height",v)),n.unbind(o,"mousemove",A),n.unbind(o,"mouseup",T),r!==o&&(n.unbind(r,"mousemove",A),n.unbind(r,"mouseup",T)),n.remove(i),n.remove(l),n.remove(c),O(a),e&&(((e,t,n,o,r)=>{e.dispatch("ObjectResized",{target:t,width:n,height:o,origin:r})})(t,a,b,v,"corner-"+d.name),n.setAttrib(a,"style",n.getAttrib(a,"style"))),t.nodeChanged()},O=e=>{M();const h=n.getPos(e,s),C=h.x,E=h.y,_=e.getBoundingClientRect(),N=_.width||_.right-_.left,O=_.height||_.bottom-_.top;a!==e&&(P(),a=e,b=v=0);const B=t.dispatch("ObjectSelected",{target:e});S(e)&&!B.isDefaultPrevented()?pe(ng,((e,t)=>{let h=n.get("mceResizeHandle"+t);h&&n.remove(h),h=n.add(s,"div",{id:"mceResizeHandle"+t,"data-mce-bogus":"all",class:"mce-resizehandle",unselectable:!0,style:"cursor:"+t+"-resize; margin:0; padding:0"}),n.bind(h,"mousedown",(h=>{h.stopImmediatePropagation(),h.preventDefault(),(h=>{const b=k(a)[0];u=h.screenX,m=h.screenY,f=b.clientWidth,g=b.clientHeight,p=g/f,d=e,d.name=t,d.startPos={x:N*e[0]+C,y:O*e[1]+E},y=s.scrollWidth,w=s.scrollHeight,c=n.add(s,"div",{class:"mce-resize-backdrop","data-mce-bogus":"all"}),n.setStyles(c,{position:"fixed",left:"0",top:"0",width:"100%",height:"100%"}),i=((e,t)=>{if(x(t))return e.create("img",{src:Tt.transparentSrc});if(sr(t)){const n=$e(d.name,"n")?le:de,o=t.cloneNode(!0);return n(e.select("tr",o)).each((t=>{const n=e.select("td,th",t);e.setStyle(t,"height",null),q(n,(t=>e.setStyle(t,"height",null)))})),o}return t.cloneNode(!0)})(n,a),n.addClass(i,"mce-clonedresizable"),n.setAttrib(i,"data-mce-bogus","all"),i.contentEditable="false",n.setStyles(i,{left:C,top:E,margin:0}),R(i,N,O),i.removeAttribute(Jf),s.appendChild(i),n.bind(o,"mousemove",A),n.bind(o,"mouseup",T),r!==o&&(n.bind(r,"mousemove",A),n.bind(r,"mouseup",T)),l=n.add(s,"div",{class:"mce-resize-helper","data-mce-bogus":"all"},f+" &times; "+g)})(h)})),e.elm=h,n.setStyles(h,{left:N*e[0]+C-h.offsetWidth/2,top:O*e[1]+E-h.offsetHeight/2})})):P(!1)},B=ya(O,0),P=(e=!0)=>{B.cancel(),M(),a&&e&&a.removeAttribute(Jf),pe(ng,((e,t)=>{const o=n.get("mceResizeHandle"+t);o&&(n.unbind(o),n.remove(o))}))},D=(e,t)=>n.isChildOf(e,t),L=o=>{if(h||t.removed||t.composing)return;const r="mousedown"===o.type?o.target:e.getNode(),a=to(Cn(r),"table,img,figure.image,hr,video,span.mce-preview-object,details").map((e=>e.dom)).filter((e=>n.isEditable(e.parentElement)||"IMG"===e.nodeName&&n.isEditable(e))).getOrUndefined(),i=C(a)?n.getAttrib(a,Jf,"1"):"1";if(q(n.select(`img[${Jf}],hr[${Jf}]`),(e=>{e.removeAttribute(Jf)})),C(a)&&D(a,s)&&Xf(t)){I();const t=e.getStart(!0);if(D(t,a)&&D(e.getEnd(!0),a))return n.setAttrib(a,Jf,i),void B.throttle(a)}P()},M=()=>{pe(ng,(e=>{e.elm&&(n.unbind(e.elm),delete e.elm)}))},I=()=>{try{t.getDoc().execCommand("enableObjectResizing",!1,"false")}catch(e){}};return t.on("init",(()=>{I(),t.on("NodeChange ResizeEditor ResizeWindow ResizeContent drop",L),t.on("keyup compositionend",(e=>{a&&"TABLE"===a.nodeName&&L(e)})),t.on("hide blur",P),t.on("contextmenu longpress",_,!0)})),t.on("remove",M),{isResizable:S,showResizeRect:O,hideResizeRect:P,updateResizeRect:L,destroy:()=>{B.cancel(),a=i=c=null}}},rg=(e,t,n)=>{const o=e.document.createRange();var r;return r=o,t.fold((e=>{r.setStartBefore(e.dom)}),((e,t)=>{r.setStart(e.dom,t)}),(e=>{r.setStartAfter(e.dom)})),((e,t)=>{t.fold((t=>{e.setEndBefore(t.dom)}),((t,n)=>{e.setEnd(t.dom,n)}),(t=>{e.setEndAfter(t.dom)}))})(o,n),o},sg=(e,t,n,o,r)=>{const s=e.document.createRange();return s.setStart(t.dom,n),s.setEnd(o.dom,r),s},ag=_l([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),ig=(e,t,n)=>t(Cn(n.startContainer),n.startOffset,Cn(n.endContainer),n.endOffset);ag.ltr,ag.rtl;const lg=(e,t)=>{const n=$t(e);return"input"===n?Nf.after(e):H(["br","img"],n)?0===t?Nf.before(e):Nf.after(e):Nf.on(e,t)},dg=(e,t)=>{const n=e.fold(Nf.before,lg,Nf.after),o=t.fold(Nf.before,lg,Nf.after);return Af.relative(n,o)},cg=(e,t,n,o)=>{const r=lg(e,t),s=lg(n,o);return Af.relative(r,s)},ug=(e,t)=>{const n=(t||document).createDocumentFragment();return q(e,(e=>{n.appendChild(e.dom)})),Cn(n)},mg=e=>{const t=Af.getWin(e).dom,n=(e,n,o,r)=>sg(t,e,n,o,r),o=(e=>e.match({domRange:e=>{const t=Cn(e.startContainer),n=Cn(e.endContainer);return cg(t,e.startOffset,n,e.endOffset)},relative:dg,exact:cg}))(e);return((e,t)=>{const n=((e,t)=>t.match({domRange:e=>({ltr:N(e),rtl:I.none}),relative:(t,n)=>({ltr:Le((()=>rg(e,t,n))),rtl:Le((()=>I.some(rg(e,n,t))))}),exact:(t,n,o,r)=>({ltr:Le((()=>sg(e,t,n,o,r))),rtl:Le((()=>I.some(sg(e,o,r,t,n))))})}))(e,t);return((e,t)=>{const n=t.ltr();return n.collapsed?t.rtl().filter((e=>!1===e.collapsed)).map((e=>ag.rtl(Cn(e.endContainer),e.endOffset,Cn(e.startContainer),e.startOffset))).getOrThunk((()=>ig(0,ag.ltr,n))):ig(0,ag.ltr,n)})(0,n)})(t,o).match({ltr:n,rtl:n})},fg=(e,t,n)=>((e,t,n)=>((e,t,n)=>e.caretPositionFromPoint?((e,t,n)=>{var o;return I.from(null===(o=e.caretPositionFromPoint)||void 0===o?void 0:o.call(e,t,n)).bind((t=>{if(null===t.offsetNode)return I.none();const n=e.createRange();return n.setStart(t.offsetNode,t.offset),n.collapse(),I.some(n)}))})(e,t,n):e.caretRangeFromPoint?((e,t,n)=>{var o;return I.from(null===(o=e.caretRangeFromPoint)||void 0===o?void 0:o.call(e,t,n))})(e,t,n):I.none())(e.document,t,n).map((e=>kf(Cn(e.startContainer),e.startOffset,Cn(e.endContainer),e.endOffset))))(e,t,n),gg=(e,t,n)=>{const o=An(Cn(n));return fg(o.dom,e,t).map((e=>{const t=n.createRange();return t.setStart(e.start.dom,e.soffset),t.setEnd(e.finish.dom,e.foffset),t})).getOrUndefined()},pg=(e,t)=>C(e)&&C(t)&&e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset,hg=(e,t,n)=>null!==((e,t,n)=>{let o=e;for(;o&&o!==t;){if(n(o))return o;o=o.parentNode}return null})(e,t,n),bg=(e,t,n)=>hg(e,t,(e=>e.nodeName===n)),vg=(e,t)=>ai(e)&&!hg(e,t,em),yg=(e,t,n)=>{const o=t.parentNode;if(o){const r=new $o(t,e.getParent(o,e.isBlock)||e.getRoot());let s;for(;s=r[n?"prev":"next"]();)if(gr(s))return!0}return!1},Cg=(e,t,n,o,r)=>{const s=e.getRoot(),a=e.schema.getNonEmptyElements(),i=r.parentNode;let l,d;if(!i)return I.none();const c=e.getParent(i,e.isBlock)||s;if(o&&gr(r)&&t&&e.isEmpty(c))return I.some(Ji(i,e.nodeIndex(r)));const u=new $o(r,c);for(;d=u[o?"prev":"next"]();){if("false"===e.getContentEditableParent(d)||vg(d,s))return I.none();if(lr(d)&&d.data.length>0)return bg(d,s,"A")?I.none():I.some(Ji(d,o?d.data.length:0));if(e.isBlock(d)||a[d.nodeName.toLowerCase()])return I.none();l=d}return ur(l)?I.none():n&&l?I.some(Ji(l,0)):I.none()},wg=(e,t,n,o)=>{const r=e.getRoot();let s,a=!1,i=n?o.startContainer:o.endContainer,l=n?o.startOffset:o.endOffset;const d=Jo(i)&&l===i.childNodes.length,c=e.schema.getNonEmptyElements();let u=n;if(ai(i))return I.none();if(Jo(i)&&l>i.childNodes.length-1&&(u=!1),mr(i)&&(i=r,l=0),i===r){if(u&&(s=i.childNodes[l>0?l-1:0],s)){if(ai(s))return I.none();if(c[s.nodeName]||sr(s))return I.none()}if(i.hasChildNodes()){if(l=Math.min(!u&&l>0?l-1:l,i.childNodes.length-1),i=i.childNodes[l],l=lr(i)&&d?i.data.length:0,!t&&i===r.lastChild&&sr(i))return I.none();if(((e,t)=>{let n=t;for(;n&&n!==e;){if(br(n))return!0;n=n.parentNode}return!1})(r,i)||ai(i))return I.none();if(Er(i))return I.none();if(i.hasChildNodes()&&!sr(i)){s=i;const t=new $o(i,r);do{if(br(s)||ai(s)){a=!1;break}if(lr(s)&&s.data.length>0){l=u?0:s.data.length,i=s,a=!0;break}if(c[s.nodeName.toLowerCase()]&&!yr(s)){l=e.nodeIndex(s),i=s.parentNode,u||l++,a=!0;break}}while(s=u?t.next():t.prev())}}}return t&&(lr(i)&&0===l&&Cg(e,d,t,!0,i).each((e=>{i=e.container(),l=e.offset(),a=!0})),Jo(i)&&(s=i.childNodes[l],s||(s=i.childNodes[l-1]),!s||!gr(s)||((e,t)=>{var n;return"A"===(null===(n=e.previousSibling)||void 0===n?void 0:n.nodeName)})(s)||yg(e,s,!1)||yg(e,s,!0)||Cg(e,d,t,!0,s).each((e=>{i=e.container(),l=e.offset(),a=!0})))),u&&!t&&lr(i)&&l===i.data.length&&Cg(e,d,t,!1,i).each((e=>{i=e.container(),l=e.offset(),a=!0})),a&&i?I.some(Ji(i,l)):I.none()},Eg=(e,t)=>{const n=t.collapsed,o=t.cloneRange(),r=Ji.fromRangeStart(t);return wg(e,n,!0,o).each((e=>{n&&Ji.isAbove(r,e)||o.setStart(e.container(),e.offset())})),n||wg(e,n,!1,o).each((e=>{o.setEnd(e.container(),e.offset())})),n&&o.collapse(!0),pg(t,o)?I.none():I.some(o)},xg=(e,t)=>e.splitText(t),_g=e=>{let t=e.startContainer,n=e.startOffset,o=e.endContainer,r=e.endOffset;if(t===o&&lr(t)){if(n>0&&n<t.data.length)if(o=xg(t,n),t=o.previousSibling,r>n){r-=n;const e=xg(o,r).previousSibling;t=o=e,r=e.data.length,n=0}else r=0}else if(lr(t)&&n>0&&n<t.data.length&&(t=xg(t,n),n=0),lr(o)&&r>0&&r<o.data.length){const e=xg(o,r).previousSibling;o=e,r=e.data.length}return{startContainer:t,startOffset:n,endContainer:o,endOffset:r}},kg=e=>({walk:(t,n)=>ff(e,t,n),split:_g,expand:(t,n={type:"word"})=>{if("word"===n.type){const n=mf(e,t,[{inline:"span"}]),o=e.createRng();return o.setStart(n.startContainer,n.startOffset),o.setEnd(n.endContainer,n.endOffset),o}return t},normalize:t=>Eg(e,t).fold(L,(e=>(t.setStart(e.startContainer,e.startOffset),t.setEnd(e.endContainer,e.endOffset),!0)))});kg.compareRanges=pg,kg.getCaretRangeFromPoint=gg,kg.getSelectedNode=wi,kg.getNode=Ei;const Sg=((e,t)=>{const n=t=>{const n=(e=>{const t=e.dom;return Yn(e)?t.getBoundingClientRect().height:t.offsetHeight})(t);if(n<=0||null===n){const n=co(t,e);return parseFloat(n)||0}return n},o=(e,t)=>X(t,((t,n)=>{const o=co(e,n),r=void 0===o?0:parseInt(o,10);return isNaN(r)?t:t+r}),0);return{set:(t,n)=>{if(!E(n)&&!n.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+n);const o=t.dom;so(o)&&(o.style[e]=n+"px")},get:n,getOuter:n,aggregate:o,max:(e,t,n)=>{const r=o(e,n);return t>r?t-r:0}}})("height"),Ng=(e,t)=>e.view(t).fold(N([]),(t=>{const n=e.owner(t),o=Ng(e,n);return[t].concat(o)}));var Rg=Object.freeze({__proto__:null,view:e=>{var t;return(e.dom===document?I.none():I.from(null===(t=e.dom.defaultView)||void 0===t?void 0:t.frameElement)).map(Cn)},owner:e=>Rn(e)});const Ag=e=>"textarea"===$t(e),Tg=(e,t)=>{const n=(e=>{const t=e.dom.ownerDocument,n=t.body,o=t.defaultView,r=t.documentElement;if(n===e.dom)return To(n.offsetLeft,n.offsetTop);const s=Oo(null==o?void 0:o.pageYOffset,r.scrollTop),a=Oo(null==o?void 0:o.pageXOffset,r.scrollLeft),i=Oo(r.clientTop,n.clientTop),l=Oo(r.clientLeft,n.clientLeft);return Bo(e).translate(a-l,s-i)})(e),o=(e=>Sg.get(e))(e);return{element:e,bottom:n.top+o,height:o,pos:n,cleanup:t}},Og=(e,t,n,o)=>{Lg(e,((r,s)=>Pg(e,t,n,o)),n)},Bg=(e,t,n,o,r)=>{const s={elm:o.element.dom,alignToTop:r};((e,t)=>e.dispatch("ScrollIntoView",t).isDefaultPrevented())(e,s)||(n(e,t,Po(t).top,o,r),((e,t)=>{e.dispatch("AfterScrollIntoView",t)})(e,s))},Pg=(e,t,n,o)=>{const r=Cn(e.getBody()),s=Cn(e.getDoc());r.dom.offsetWidth;const a=((e,t)=>{const n=((e,t)=>{const n=In(e);if(0===n.length||Ag(e))return{element:e,offset:t};if(t<n.length&&!Ag(n[t]))return{element:n[t],offset:0};{const o=n[n.length-1];return Ag(o)?{element:e,offset:t}:"img"===$t(o)?{element:o,offset:1}:Yt(o)?{element:o,offset:ja(o).length}:{element:o,offset:In(o).length}}})(e,t),o=bn('<span data-mce-bogus="all" style="display: inline-block;">\ufeff</span>');return po(n.element,o),Tg(o,(()=>Eo(o)))})(Cn(n.startContainer),n.startOffset);Bg(e,s,t,a,o),a.cleanup()},Dg=(e,t,n,o)=>{const r=Cn(e.getDoc());Bg(e,r,n,(e=>Tg(Cn(e),_))(t),o)},Lg=(e,t,n)=>{const o=n.startContainer,r=n.startOffset,s=n.endContainer,a=n.endOffset;t(Cn(o),Cn(s));const i=e.dom.createRng();i.setStart(o,r),i.setEnd(s,a),e.selection.setRng(n)},Mg=(e,t,n,o,r)=>{const s=t.pos;if(o)Do(s.left,s.top,r);else{const o=s.top-n+t.height;Do(-e.getBody().getBoundingClientRect().left,o,r)}},Ig=(e,t,n,o,r,s)=>{const a=o+n,i=r.pos.top,l=r.bottom,d=l-i>=o;i<n?Mg(e,r,o,!1!==s,t):i>a?Mg(e,r,o,d?!1!==s:!0===s,t):l>a&&!d&&Mg(e,r,o,!0===s,t)},Fg=(e,t,n,o,r)=>{const s=An(t).dom.innerHeight;Ig(e,t,n,s,o,r)},Ug=(e,t,n,o,r)=>{const s=An(t).dom.innerHeight;Ig(e,t,n,s,o,r);const a=(e=>{const t=wf(),n=Po(t),o=((e,t)=>{const n=t.owner(e);return Ng(t,n)})(e,Rg),r=Bo(e),s=G(o,((e,t)=>{const n=Bo(t);return{left:e.left+n.left,top:e.top+n.top}}),{left:0,top:0});return To(s.left+r.left+n.left,s.top+r.top+n.top)})(o.element),i=Io(window);a.top<i.y?Lo(o.element,!1!==r):a.top>i.bottom&&Lo(o.element,!0===r)},zg=(e,t,n)=>Og(e,Fg,t,n),jg=(e,t,n)=>Dg(e,t,Fg,n),Hg=(e,t,n)=>Og(e,Ug,t,n),$g=(e,t,n)=>Dg(e,t,Ug,n),Vg=(e,t,n)=>{(e.inline?zg:Hg)(e,t,n)},qg=(e,t)=>t.collapsed?e.isEditable(t.startContainer):e.isEditable(t.startContainer)&&e.isEditable(t.endContainer),Wg=(e,t,n,o,r)=>{const s=n?t.startContainer:t.endContainer,a=n?t.startOffset:t.endOffset;return I.from(s).map(Cn).map((e=>o&&t.collapsed?e:Fn(e,r(e,a)).getOr(e))).bind((e=>Kt(e)?I.some(e):Tn(e).filter(Kt))).map((e=>e.dom)).getOr(e)},Kg=(e,t,n=!1)=>Wg(e,t,!0,n,((e,t)=>Math.min(jn(e),t))),Yg=(e,t,n=!1)=>Wg(e,t,!1,n,((e,t)=>t>0?t-1:t)),Gg=(e,t)=>{const n=e;for(;e&&lr(e)&&0===e.length;)e=t?e.nextSibling:e.previousSibling;return e||n},Xg=(e,t)=>V(t,(t=>{const n=e.dispatch("GetSelectionRange",{range:t});return n.range!==t?n.range:t})),Zg={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11},Qg=(e,t,n)=>{const o=n?"lastChild":"firstChild",r=n?"prev":"next";if(e[o])return e[o];if(e!==t){let n=e[r];if(n)return n;for(let o=e.parent;o&&o!==t;o=o.parent)if(n=o[r],n)return n}},Jg=e=>{var t;const n=null!==(t=e.value)&&void 0!==t?t:"";if(!Yo(n))return!1;const o=e.parent;return!o||"span"===o.name&&!o.attr("style")||!/^[ ]+$/.test(n)},ep=e=>{const t="a"===e.name&&!e.attr("href")&&e.attr("id");return e.attr("name")||e.attr("id")&&!e.firstChild||e.attr("data-mce-bookmark")||t};class tp{static create(e,t){const n=new tp(e,Zg[e]||1);return t&&pe(t,((e,t)=>{n.attr(t,e)})),n}constructor(e,t){this.name=e,this.type=t,1===t&&(this.attributes=[],this.attributes.map={})}replace(e){const t=this;return e.parent&&e.remove(),t.insert(e,t),t.remove(),t}attr(e,t){const n=this;if(!m(e))return C(e)&&pe(e,((e,t)=>{n.attr(t,e)})),n;const o=n.attributes;if(o){if(void 0!==t){if(null===t){if(e in o.map){delete o.map[e];let t=o.length;for(;t--;)if(o[t].name===e)return o.splice(t,1),n}return n}if(e in o.map){let n=o.length;for(;n--;)if(o[n].name===e){o[n].value=t;break}}else o.push({name:e,value:t});return o.map[e]=t,n}return o.map[e]}}clone(){const e=this,t=new tp(e.name,e.type),n=e.attributes;if(n){const e=[];e.map={};for(let t=0,o=n.length;t<o;t++){const o=n[t];"id"!==o.name&&(e[e.length]={name:o.name,value:o.value},e.map[o.name]=o.value)}t.attributes=e}return t.value=e.value,t}wrap(e){const t=this;return t.parent&&(t.parent.insert(e,t),e.append(t)),t}unwrap(){const e=this;for(let t=e.firstChild;t;){const n=t.next;e.insert(t,e,!0),t=n}e.remove()}remove(){const e=this,t=e.parent,n=e.next,o=e.prev;return t&&(t.firstChild===e?(t.firstChild=n,n&&(n.prev=null)):o&&(o.next=n),t.lastChild===e?(t.lastChild=o,o&&(o.next=null)):n&&(n.prev=o),e.parent=e.next=e.prev=null),e}append(e){const t=this;e.parent&&e.remove();const n=t.lastChild;return n?(n.next=e,e.prev=n,t.lastChild=e):t.lastChild=t.firstChild=e,e.parent=t,e}insert(e,t,n){e.parent&&e.remove();const o=t.parent||this;return n?(t===o.firstChild?o.firstChild=e:t.prev&&(t.prev.next=e),e.prev=t.prev,e.next=t,t.prev=e):(t===o.lastChild?o.lastChild=e:t.next&&(t.next.prev=e),e.next=t.next,e.prev=t,t.next=e),e.parent=o,e}getAll(e){const t=this,n=[];for(let o=t.firstChild;o;o=Qg(o,t))o.name===e&&n.push(o);return n}children(){const e=[];for(let t=this.firstChild;t;t=t.next)e.push(t);return e}empty(){const e=this;if(e.firstChild){const t=[];for(let n=e.firstChild;n;n=Qg(n,e))t.push(n);let n=t.length;for(;n--;){const e=t[n];e.parent=e.firstChild=e.lastChild=e.next=e.prev=null}}return e.firstChild=e.lastChild=null,e}isEmpty(e,t={},n){var o;const r=this;let s=r.firstChild;if(ep(r))return!1;if(s)do{if(1===s.type){if(s.attr("data-mce-bogus"))continue;if(e[s.name])return!1;if(ep(s))return!1}if(8===s.type)return!1;if(3===s.type&&!Jg(s))return!1;if(3===s.type&&s.parent&&t[s.parent.name]&&Yo(null!==(o=s.value)&&void 0!==o?o:""))return!1;if(n&&n(s))return!1}while(s=Qg(s,r));return!0}walk(e){return Qg(this,null,e)}}const np=Dt.makeMap("NOSCRIPT STYLE SCRIPT XMP IFRAME NOEMBED NOFRAMES PLAINTEXT"," "),op=e=>m(e.nodeValue)&&e.nodeValue.includes(Ja),rp=e=>(0===e.length?"":`${V(e,(e=>`[${e}]`)).join(",")},`)+'[data-mce-bogus="all"]',sp=e=>document.createTreeWalker(e,NodeFilter.SHOW_COMMENT,(e=>op(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP)),ap=e=>document.createTreeWalker(e,NodeFilter.SHOW_TEXT,(e=>{if(op(e)){const t=e.parentNode;return t&&_e(np,t.nodeName)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}return NodeFilter.FILTER_SKIP})),ip=e=>null!==sp(e).nextNode(),lp=e=>null!==ap(e).nextNode(),dp=(e,t)=>null!==t.querySelector(rp(e)),cp=(e,t)=>{q(((e,t)=>t.querySelectorAll(rp(e)))(e,t),(t=>{const n=Cn(t);"all"===tn(n,"data-mce-bogus")?Eo(n):q(e,(e=>{on(n,e)&&rn(n,e)}))}))},up=e=>{let t=e.nextNode();for(;null!==t;)t.nodeValue=null,t=e.nextNode()},mp=k(up,sp),fp=k(up,ap),gp=(e,t)=>{const n=[{condition:T(dp,t),action:T(cp,t)},{condition:ip,action:mp},{condition:lp,action:fp}];let o=e,r=!1;return q(n,(({condition:t,action:n})=>{t(o)&&(r||(o=e.cloneNode(!0),r=!0),n(o))})),o},pp=e=>{const t=Uo(e,"[data-mce-bogus]");q(t,(e=>{"all"===tn(e,"data-mce-bogus")?Eo(e):Va(e)?(po(e,yn(Vo)),Eo(e)):xo(e)}))},hp=e=>{const t=Uo(e,"input");q(t,(e=>{rn(e,"name")}))},bp=(e,t,n)=>{let o;return o="raw"===t.format?Dt.trim(ti(gp(n,e.serializer.getTempAttrs()).innerHTML)):"text"===t.format?((e,t)=>{const n=e.getDoc(),o=$n(Cn(e.getBody())),r=vn("div",n);Jt(r,"data-mce-bogus","all"),lo(r,{position:"fixed",left:"-9999999px",top:"0"}),So(r,t.innerHTML),pp(r),hp(r);const s=(e=>Hn(e)?e:Cn(Rn(e).dom.body))(o);vo(s,r);const a=ti(r.dom.innerText);return Eo(r),a})(e,n):"tree"===t.format?e.serializer.serialize(n,t):((e,t)=>{const n=Jl(e),o=new RegExp(`^(<${n}[^>]*>(&nbsp;|&#160;|\\s|\xa0|<br \\/>|)<\\/${n}>[\r\n]*|<br \\/>[\r\n]*)$`);return t.replace(o,"")})(e,e.serializer.serialize(n,t)),"text"!==t.format&&!Xa(Cn(n))&&m(o)?Dt.trim(o):o},vp=Dt.makeMap,yp=e=>{const t=[],n=(e=e||{}).indent,o=vp(e.indent_before||""),r=vp(e.indent_after||""),s=Cs.getEncodeFunc(e.entity_encoding||"raw",e.entities),a="xhtml"!==e.element_format;return{start:(e,i,l)=>{if(n&&o[e]&&t.length>0){const e=t[t.length-1];e.length>0&&"\n"!==e&&t.push("\n")}if(t.push("<",e),i)for(let e=0,n=i.length;e<n;e++){const n=i[e];t.push(" ",n.name,'="',s(n.value,!0),'"')}if(t[t.length]=!l||a?">":" />",l&&n&&r[e]&&t.length>0){const e=t[t.length-1];e.length>0&&"\n"!==e&&t.push("\n")}},end:e=>{let o;t.push("</",e,">"),n&&r[e]&&t.length>0&&(o=t[t.length-1],o.length>0&&"\n"!==o&&t.push("\n"))},text:(e,n)=>{e.length>0&&(t[t.length]=n?e:s(e))},cdata:e=>{t.push("<![CDATA[",e,"]]>")},comment:e=>{t.push("\x3c!--",e,"--\x3e")},pi:(e,o)=>{o?t.push("<?",e," ",s(o),"?>"):t.push("<?",e,"?>"),n&&t.push("\n")},doctype:e=>{t.push("<!DOCTYPE",e,">",n?"\n":"")},reset:()=>{t.length=0},getContent:()=>t.join("").replace(/\n$/,"")}},Cp=(e={},t=Is())=>{const n=yp(e);return e.validate=!("validate"in e)||e.validate,{serialize:o=>{const r=e.validate,s={3:e=>{var t;n.text(null!==(t=e.value)&&void 0!==t?t:"",e.raw)},8:e=>{var t;n.comment(null!==(t=e.value)&&void 0!==t?t:"")},7:e=>{n.pi(e.name,e.value)},10:e=>{var t;n.doctype(null!==(t=e.value)&&void 0!==t?t:"")},4:e=>{var t;n.cdata(null!==(t=e.value)&&void 0!==t?t:"")},11:e=>{let t=e;if(t=t.firstChild)do{a(t)}while(t=t.next)}};n.reset();const a=e=>{var o;const i=s[e.type];if(i)i(e);else{const s=e.name,i=s in t.getVoidElements();let l=e.attributes;if(r&&l&&l.length>1){const n=[];n.map={};const o=t.getElementRule(e.name);if(o){for(let e=0,t=o.attributesOrder.length;e<t;e++){const t=o.attributesOrder[e];if(t in l.map){const e=l.map[t];n.map[t]=e,n.push({name:t,value:e})}}for(let e=0,t=l.length;e<t;e++){const t=l[e].name;if(!(t in n.map)){const e=l.map[t];n.map[t]=e,n.push({name:t,value:e})}}l=n}}if(n.start(s,l,i),Lr(s))m(e.value)&&n.text(e.value,!0),n.end(s);else if(!i){let t=e.firstChild;if(t){"pre"!==s&&"textarea"!==s||3!==t.type||"\n"!==(null===(o=t.value)||void 0===o?void 0:o[0])||n.text("\n",!0);do{a(t)}while(t=t.next)}n.end(s)}}};return 1!==o.type||e.inner?3===o.type?s[3](o):s[11](o):a(o),n.getContent()}}},wp=new Set;q(["margin","margin-left","margin-right","margin-top","margin-bottom","padding","padding-left","padding-right","padding-top","padding-bottom","border","border-width","border-style","border-color","background","background-attachment","background-clip","background-image","background-origin","background-position","background-repeat","background-size","float","position","left","right","top","bottom","z-index","display","transform","width","max-width","min-width","height","max-height","min-height","overflow","overflow-x","overflow-y","text-overflow","vertical-align","transition","transition-delay","transition-duration","transition-property","transition-timing-function"],(e=>{wp.add(e)}));const Ep=new Set;q(["background-color"],(e=>{Ep.add(e)}));const xp=["font","text-decoration","text-emphasis"],_p=(e,t)=>fe(((e,t)=>e.parseStyle(e.getAttrib(t,"style")))(e,t)),kp=(e,t)=>$(_p(e,t),(e=>(e=>wp.has(e))(e))),Sp=(e,t,n)=>I.from(n.container()).filter(lr).exists((o=>{const r=e?0:-1;return t(o.data.charAt(n.offset()+r))})),Np=T(Sp,!0,hm),Rp=T(Sp,!1,hm),Ap=e=>{const t=e.container();return lr(t)&&(0===t.data.length||ei(t.data)&&yf.isBookmarkNode(t.parentNode))},Tp=(e,t)=>n=>vu(e?0:-1,n).filter(t).isSome(),Op=e=>pr(e)&&"block"===co(Cn(e),"display"),Bp=e=>br(e)&&!(e=>Jo(e)&&"all"===e.getAttribute("data-mce-bogus"))(e),Pp=Tp(!0,Op),Dp=Tp(!1,Op),Lp=Tp(!0,Cr),Mp=Tp(!1,Cr),Ip=Tp(!0,sr),Fp=Tp(!1,sr),Up=Tp(!0,Bp),zp=Tp(!1,Bp),jp=(e,t)=>((e,t,n)=>Sn(t,e)?Bn(e,(e=>n(e)||kn(e,t))).slice(0,-1):[])(e,t,L),Hp=(e,t)=>[e].concat(jp(e,t)),$p=(e,t,n)=>Ku(e,t,n,Ap),Vp=(e,t,n)=>Q(Hp(Cn(t.container()),e),(e=>t=>e.isBlock($t(t)))(n)),qp=(e,t,n,o)=>$p(e,t.dom,n).forall((e=>Vp(t,n,o).fold((()=>!bu(e,n,t.dom)),(o=>!bu(e,n,t.dom)&&Sn(o,Cn(e.container())))))),Wp=(e,t,n,o)=>Vp(t,n,o).fold((()=>$p(e,t.dom,n).forall((e=>!bu(e,n,t.dom)))),(t=>$p(e,t.dom,n).isNone())),Kp=T(Wp,!1),Yp=T(Wp,!0),Gp=T(qp,!1),Xp=T(qp,!0),Zp=e=>Nu(e).exists(Va),Qp=(e,t,n,o)=>{const r=Y(Hp(Cn(n.container()),t),(e=>o.isBlock($t(e)))),s=le(r).getOr(t);return qu(e,s.dom,n).filter(Zp)},Jp=(e,t,n)=>Nu(t).exists(Va)||Qp(!0,e,t,n).isSome(),eh=(e,t,n)=>(e=>I.from(e.getNode(!0)).map(Cn))(t).exists(Va)||Qp(!1,e,t,n).isSome(),th=T(Qp,!1),nh=T(Qp,!0),oh=e=>Ji.isTextPosition(e)&&!e.isAtStart()&&!e.isAtEnd(),rh=(e,t,n)=>{const o=Y(Hp(Cn(t.container()),e),(e=>n.isBlock($t(e))));return le(o).getOr(e)},sh=(e,t,n)=>oh(t)?Rp(t):Rp(t)||Xu(rh(e,t,n).dom,t).exists(Rp),ah=(e,t,n)=>oh(t)?Np(t):Np(t)||Gu(rh(e,t,n).dom,t).exists(Np),ih=e=>Nu(e).bind((e=>Zn(e,Kt))).exists((e=>(e=>H(["pre","pre-wrap"],e))(co(e,"white-space")))),lh=(e,t)=>n=>{return o=new $o(n,e)[t](),C(o)&&br(o)&&au(o);var o},dh=(e,t,n)=>!ih(t)&&(((e,t,n)=>((e,t)=>Xu(e.dom,t).isNone())(e,t)||((e,t)=>Gu(e.dom,t).isNone())(e,t)||Kp(e,t,n)||Yp(e,t,n)||eh(e,t,n)||Jp(e,t,n))(e,t,n)||sh(e,t,n)||ah(e,t,n)),ch=(e,t,n)=>!ih(t)&&(Kp(e,t,n)||Gp(e,t,n)||eh(e,t,n)||sh(e,t,n)||((e,t)=>{const n=Xu(e.dom,t).getOr(t),o=lh(e.dom,"prev");return t.isAtStart()&&(o(t.container())||o(n.container()))})(e,t)),uh=(e,t,n)=>!ih(t)&&(Yp(e,t,n)||Xp(e,t,n)||Jp(e,t,n)||ah(e,t,n)||((e,t)=>{const n=Gu(e.dom,t).getOr(t),o=lh(e.dom,"next");return t.isAtEnd()&&(o(t.container())||o(n.container()))})(e,t)),mh=(e,t,n)=>ch(e,t,n)||uh(e,(e=>{const t=e.container(),n=e.offset();return lr(t)&&n<t.data.length?Ji(t,n+1):e})(t),n),fh=(e,t)=>gm(e.charAt(t)),gh=(e,t)=>hm(e.charAt(t)),ph=(e,t,n,o)=>{const r=t.data,s=Ji(t,0);return n||!fh(r,0)||mh(e,s,o)?!!(n&&gh(r,0)&&ch(e,s,o))&&(t.data=qo+r.slice(1),!0):(t.data=" "+r.slice(1),!0)},hh=(e,t,n,o)=>{const r=t.data,s=Ji(t,r.length-1);return n||!fh(r,r.length-1)||mh(e,s,o)?!!(n&&gh(r,r.length-1)&&uh(e,s,o))&&(t.data=r.slice(0,-1)+qo,!0):(t.data=r.slice(0,-1)+" ",!0)},bh=(e,t,n)=>{const o=t.container();if(!lr(o))return I.none();if((e=>{const t=e.container();return lr(t)&&He(t.data,qo)})(t)){const r=ph(e,o,!1,n)||(e=>{const t=e.data,n=(e=>{const t=e.split("");return V(t,((e,n)=>gm(e)&&n>0&&n<t.length-1&&bm(t[n-1])&&bm(t[n+1])?" ":e)).join("")})(t);return n!==t&&(e.data=n,!0)})(o)||hh(e,o,!1,n);return Ft(r,t)}if(mh(e,t,n)){const r=ph(e,o,!0,n)||hh(e,o,!0,n);return Ft(r,t)}return I.none()},vh=(e,t,n,o)=>{if(0===n)return;const r=Cn(e),s=Xn(r,(e=>o.isBlock($t(e)))).getOr(r),a=e.data.slice(t,t+n),i=t+n>=e.data.length&&uh(s,Ji(e,e.data.length),o),l=0===t&&ch(s,Ji(e,0),o);e.replaceData(t,n,Xo(a,4,l,i))},yh=(e,t,n)=>{const o=e.data.slice(t),r=o.length-Ke(o).length;vh(e,t,r,n)},Ch=(e,t,n)=>{const o=e.data.slice(0,t),r=o.length-Ye(o).length;vh(e,t-r,r,n)},wh=(e,t,n,o,r=!0)=>{const s=Ye(e.data).length,a=r?e:t,i=r?t:e;return r?a.appendData(i.data):a.insertData(0,i.data),Eo(Cn(i)),o&&yh(a,s,n),a},Eh=(e,t)=>((e,t)=>{const n=e.container(),o=e.offset();return!Ji.isTextPosition(e)&&n===t.parentNode&&o>Ji.before(t).offset()})(t,e)?Ji(t.container(),t.offset()-1):t,xh=e=>{return Pi(e.previousSibling)?I.some((t=e.previousSibling,lr(t)?Ji(t,t.data.length):Ji.after(t))):e.previousSibling?Qu(e.previousSibling):I.none();var t},_h=e=>{return Pi(e.nextSibling)?I.some((t=e.nextSibling,lr(t)?Ji(t,0):Ji.before(t))):e.nextSibling?Zu(e.nextSibling):I.none();var t},kh=(e,t,n)=>((e,t,n)=>e?((e,t)=>_h(t).orThunk((()=>xh(t))).orThunk((()=>((e,t)=>Gu(e,Ji.after(t)).orThunk((()=>Xu(e,Ji.before(t)))))(e,t))))(t,n):((e,t)=>xh(t).orThunk((()=>_h(t))).orThunk((()=>((e,t)=>I.from(t.previousSibling?t.previousSibling:t.parentNode).bind((t=>Xu(e,Ji.before(t)))).orThunk((()=>Gu(e,Ji.after(t)))))(e,t))))(t,n))(e,t,n).map(T(Eh,n)),Sh=(e,t,n)=>{n.fold((()=>{e.focus()}),(n=>{e.selection.setRng(n.toRange(),t)}))},Nh=(e,t)=>t&&_e(e.schema.getBlockElements(),$t(t)),Rh=(e,t,n,o=!0,r=!1)=>{const s=kh(t,e.getBody(),n.dom),a=Xn(n,T(Nh,e),(i=e.getBody(),e=>e.dom===i));var i;const l=((e,t,n,o)=>{const r=Pn(e).filter(Yt),s=Dn(e).filter(Yt);return Eo(e),(a=r,i=s,l=t,d=(e,t,r)=>{const s=e.dom,a=t.dom,i=s.data.length;return wh(s,a,n,o),r.container()===a?Ji(s,i):r},a.isSome()&&i.isSome()&&l.isSome()?I.some(d(a.getOrDie(),i.getOrDie(),l.getOrDie())):I.none()).orThunk((()=>(o&&(r.each((e=>Ch(e.dom,e.dom.length,n))),s.each((e=>yh(e.dom,0,n)))),t)));var a,i,l,d})(n,s,e.schema,((e,t)=>_e(e.schema.getTextInlineElements(),$t(t)))(e,n));e.dom.isEmpty(e.getBody())?(e.setContent(""),e.selection.setCursorLocation()):a.bind((t=>((e,t,n)=>{if(Ar(e,t)){const e=bn('<br data-mce-bogus="1">');return n?q(In(t),(e=>{Xm(e)||Eo(e)})):wo(t),vo(t,e),I.some(Ji.before(e.dom))}return I.none()})(e.schema,t,r))).fold((()=>{o&&Sh(e,t,l)}),(n=>{o&&Sh(e,t,I.some(n))}))},Ah=/[\u0591-\u07FF\uFB1D-\uFDFF\uFE70-\uFEFC]/,Th=(e,t)=>xn(Cn(t),kd(e))&&!Xr(e.schema,t)&&e.dom.isEditable(t),Oh=e=>{var t;return"rtl"===ua.DOM.getStyle(e,"direction",!0)||(e=>Ah.test(e))(null!==(t=e.textContent)&&void 0!==t?t:"")},Bh=(e,t,n)=>{const o=((e,t,n)=>Y(ua.DOM.getParents(n.container(),"*",t),e))(e,t,n);return I.from(o[o.length-1])},Ph=(e,t)=>{const n=t.container(),o=t.offset();return e?si(n)?lr(n.nextSibling)?Ji(n.nextSibling,0):Ji.after(n):li(t)?Ji(n,o+1):t:si(n)?lr(n.previousSibling)?Ji(n.previousSibling,n.previousSibling.data.length):Ji.before(n):di(t)?Ji(n,o-1):t},Dh=T(Ph,!0),Lh=T(Ph,!1),Mh=(e,t)=>{const n=e=>e.stopImmediatePropagation();e.on("beforeinput input",n,!0),e.getDoc().execCommand(t),e.off("beforeinput input",n)},Ih=e=>Mh(e,"Delete"),Fh=e=>Mh(e,"ForwardDelete"),Uh=e=>qa(e)||Ka(e),zh=(e,t)=>Sn(e,t)?Zn(t,Uh,(e=>t=>Lt(Tn(t),e,kn))(e)):I.none(),jh=(e,t=!0)=>{e.dom.isEmpty(e.getBody())&&e.setContent("",{no_selection:!t})},Hh=(e,t,n)=>It(Zu(n),Qu(n),((o,r)=>{const s=Ph(!0,o),a=Ph(!1,r),i=Ph(!1,t);return e?Gu(n,i).exists((e=>e.isEqual(a)&&t.isEqual(s))):Xu(n,i).exists((e=>e.isEqual(s)&&t.isEqual(a)))})).getOr(!0),$h=e=>{var t;return(8===Vt(t=e)||"#comment"===$t(t)?Pn(e):zn(e)).bind($h).orThunk((()=>I.some(e)))},Vh=(e,t,n,o=!0)=>{var r;t.deleteContents();const s=$h(n).getOr(n),a=Cn(null!==(r=e.dom.getParent(s.dom,e.dom.isBlock))&&void 0!==r?r:n.dom);if(a.dom===e.getBody()?jh(e,o):Ar(e.schema,a,{checkRootAsContent:!1})&&(Qa(a),o&&e.selection.setCursorLocation(a.dom,0)),!kn(n,a)){const t=Lt(Tn(a),n)?[]:Tn(i=a).map(In).map((e=>Y(e,(e=>!kn(i,e))))).getOr([]);q(t.concat(In(n)),(t=>{kn(t,a)||Sn(t,a)||!Ar(e.schema,t)||Eo(t)}))}var i},qh=e=>Uo(e,"td,th"),Wh=(e,t)=>wm(Cn(e),t),Kh=(e,t)=>({start:e,end:t}),Yh=_l([{singleCellTable:["rng","cell"]},{fullTable:["table"]},{partialTable:["cells","outsideDetails"]},{multiTable:["startTableCells","endTableCells","betweenRng"]}]),Gh=(e,t)=>to(Cn(e),"td,th",t),Xh=e=>!kn(e.start,e.end),Zh=(e,t)=>wm(e.start,t).bind((n=>wm(e.end,t).bind((e=>Ft(kn(n,e),n))))),Qh=e=>t=>Zh(t,e).map((e=>((e,t,n)=>({rng:e,table:t,cells:n}))(t,e,qh(e)))),Jh=(e,t,n,o)=>{if(n.collapsed||!e.forall(Xh))return I.none();if(t.isSameTable){const t=e.bind(Qh(o));return I.some({start:t,end:t})}{const e=Gh(n.startContainer,o),t=Gh(n.endContainer,o),r=e.bind((e=>t=>wm(t,e).bind((e=>de(qh(e)).map((e=>Kh(t,e))))))(o)).bind(Qh(o)),s=t.bind((e=>t=>wm(t,e).bind((e=>le(qh(e)).map((e=>Kh(e,t))))))(o)).bind(Qh(o));return I.some({start:r,end:s})}},eb=(e,t)=>J(e,(e=>kn(e,t))),tb=e=>It(eb(e.cells,e.rng.start),eb(e.cells,e.rng.end),((t,n)=>e.cells.slice(t,n+1))),nb=(e,t)=>{const{startTable:n,endTable:o}=t,r=e.cloneRange();return n.each((e=>r.setStartAfter(e.dom))),o.each((e=>r.setEndBefore(e.dom))),r},ob=(e,t)=>{const n=(e=>t=>kn(e,t))(e),o=((e,t)=>{const n=Gh(e.startContainer,t),o=Gh(e.endContainer,t);return It(n,o,Kh)})(t,n),r=((e,t)=>{const n=Wh(e.startContainer,t),o=Wh(e.endContainer,t),r=n.isSome(),s=o.isSome(),a=It(n,o,kn).getOr(!1);return(e=>It(e.startTable,e.endTable,((t,n)=>{const o=Ho(t,(e=>kn(e,n))),r=Ho(n,(e=>kn(e,t)));return o||r?{...e,startTable:o?I.none():e.startTable,endTable:r?I.none():e.endTable,isSameTable:!1,isMultiTable:!1}:e})).getOr(e))({startTable:n,endTable:o,isStartInTable:r,isEndInTable:s,isSameTable:a,isMultiTable:!a&&r&&s})})(t,n);return((e,t,n)=>e.exists((e=>((e,t)=>!Xh(e)&&Zh(e,t).exists((e=>{const t=e.dom.rows;return 1===t.length&&1===t[0].cells.length})))(e,n)&&_m(e.start,t))))(o,t,n)?o.map((e=>Yh.singleCellTable(t,e.start))):r.isMultiTable?((e,t,n,o)=>Jh(e,t,n,o).bind((({start:e,end:o})=>{const r=e.bind(tb).getOr([]),s=o.bind(tb).getOr([]);if(r.length>0&&s.length>0){const e=nb(n,t);return I.some(Yh.multiTable(r,s,e))}return I.none()})))(o,r,t,n):((e,t,n,o)=>Jh(e,t,n,o).bind((({start:e,end:t})=>e.or(t))).bind((e=>{const{isSameTable:o}=t,r=tb(e).getOr([]);if(o&&e.cells.length===r.length)return I.some(Yh.fullTable(e.table));if(r.length>0){if(o)return I.some(Yh.partialTable(r,I.none()));{const e=nb(n,t);return I.some(Yh.partialTable(r,I.some({...t,rng:e})))}}return I.none()})))(o,r,t,n)},rb=e=>q(e,(e=>{rn(e,"contenteditable"),Qa(e)})),sb=(e,t,n,o)=>{const r=n.cloneRange();o?(r.setStart(n.startContainer,n.startOffset),r.setEndAfter(t.dom.lastChild)):(r.setStartBefore(t.dom.firstChild),r.setEnd(n.endContainer,n.endOffset)),db(e,r,t,!1).each((e=>e()))},ab=e=>{const t=Cm(e),n=Cn(e.selection.getNode());vr(n.dom)&&Ar(e.schema,n)?e.selection.setCursorLocation(n.dom,0):e.selection.collapse(!0),t.length>1&&$(t,(e=>kn(e,n)))&&Jt(n,"data-mce-selected","1")},ib=(e,t,n)=>I.some((()=>{const o=e.selection.getRng(),r=n.bind((({rng:n,isStartInTable:r})=>{const s=((e,t)=>I.from(e.dom.getParent(t,e.dom.isBlock)).map(Cn))(e,r?n.endContainer:n.startContainer);n.deleteContents(),((e,t,n)=>{n.each((n=>{t?Eo(n):(Qa(n),e.selection.setCursorLocation(n.dom,0))}))})(e,r,s.filter(T(Ar,e.schema)));const a=r?t[0]:t[t.length-1];return sb(e,a,o,r),Ar(e.schema,a)?I.none():I.some(r?t.slice(1):t.slice(0,-1))})).getOr(t);rb(r),ab(e)})),lb=(e,t,n,o)=>I.some((()=>{const r=e.selection.getRng(),s=t[0],a=n[n.length-1];sb(e,s,r,!0),sb(e,a,r,!1);const i=Ar(e.schema,s)?t:t.slice(1),l=Ar(e.schema,a)?n:n.slice(0,-1);rb(i.concat(l)),o.deleteContents(),ab(e)})),db=(e,t,n,o=!0)=>I.some((()=>{Vh(e,t,n,o)})),cb=(e,t)=>I.some((()=>Rh(e,!1,t))),ub=(e,t)=>Q(Hp(t,e),Ga),mb=(e,t)=>Q(Hp(t,e),Zt("caption")),fb=(e,t)=>I.some((()=>{Qa(t),e.selection.setCursorLocation(t.dom,0)})),gb=(e,t)=>e?Ip(t):Fp(t),pb=(e,t,n)=>{const o=Cn(e.getBody());return mb(o,n).fold((()=>((e,t,n,o)=>{const r=Ji.fromRangeStart(e.selection.getRng());return ub(n,o).bind((o=>Ar(e.schema,o,{checkRootAsContent:!1})?fb(e,o):((e,t,n,o,r)=>Wu(n,e.getBody(),r).bind((e=>ub(t,Cn(e.getNode())).bind((e=>kn(e,o)?I.none():I.some(_))))))(e,n,t,o,r)))})(e,t,o,n).orThunk((()=>Ft(((e,t)=>{const n=Ji.fromRangeStart(e.selection.getRng());return gb(t,n)||qu(t,e.getBody(),n).exists((e=>gb(t,e)))})(e,t),_)))),(n=>((e,t,n,o)=>{const r=Ji.fromRangeStart(e.selection.getRng());return Ar(e.schema,o)?fb(e,o):((e,t,n,o,r)=>Wu(n,e.getBody(),r).fold((()=>I.some(_)),(s=>((e,t,n,o)=>Zu(e.dom).bind((r=>Qu(e.dom).map((e=>t?n.isEqual(r)&&o.isEqual(e):n.isEqual(e)&&o.isEqual(r))))).getOr(!0))(o,n,r,s)?((e,t)=>fb(e,t))(e,o):((e,t,n)=>mb(e,Cn(n.getNode())).fold((()=>I.some(_)),(e=>Ft(!kn(e,t),_))))(t,o,s))))(e,n,t,o,r)})(e,t,o,n)))},hb=(e,t)=>{const n=Cn(e.selection.getStart(!0)),o=Cm(e);return e.selection.isCollapsed()&&0===o.length?pb(e,t,n):((e,t,n)=>{const o=Cn(e.getBody()),r=e.selection.getRng();return 0!==n.length?ib(e,n,I.none()):((e,t,n,o)=>mb(t,o).fold((()=>((e,t,n)=>ob(t,n).bind((t=>t.fold(T(db,e),T(cb,e),T(ib,e),T(lb,e)))))(e,t,n)),(t=>((e,t)=>fb(e,t))(e,t))))(e,o,r,t)})(e,n,o)},bb=(e,t)=>{let n=t;for(;n&&n!==e;){if(hr(n)||br(n))return n;n=n.parentNode}return null},vb=["data-ephox-","data-mce-","data-alloy-","data-snooker-","_"],yb=Dt.each,Cb=e=>{const t=e.dom,n=new Set(e.serializer.getTempAttrs()),o=e=>$(vb,(t=>$e(e,t)))||n.has(e);return{compare:(e,n)=>{if(e.nodeName!==n.nodeName||e.nodeType!==n.nodeType)return!1;const r=e=>{const n={};return yb(t.getAttribs(e),(r=>{const s=r.nodeName.toLowerCase();"style"===s||o(s)||(n[s]=t.getAttrib(e,s))})),n},s=(e,t)=>{for(const n in e)if(_e(e,n)){const o=t[n];if(v(o))return!1;if(e[n]!==o)return!1;delete t[n]}for(const e in t)if(_e(t,e))return!1;return!0};if(Jo(e)&&Jo(n)){if(!s(r(e),r(n)))return!1;if(!s(t.parseStyle(t.getAttrib(e,"style")),t.parseStyle(t.getAttrib(n,"style"))))return!1}return!fm(e)&&!fm(n)},isAttributeInternal:o}},wb=e=>["h1","h2","h3","h4","h5","h6"].includes(e.name),Eb=(e,t,n,o)=>{const r=n.name;for(let t=0,s=e.length;t<s;t++){const s=e[t];if(s.name===r){const e=o.nodes[r];e?e.nodes.push(n):o.nodes[r]={filter:s,nodes:[n]}}}if(n.attributes)for(let e=0,r=t.length;e<r;e++){const r=t[e],s=r.name;if(s in n.attributes.map){const e=o.attributes[s];e?e.nodes.push(n):o.attributes[s]={filter:r,nodes:[n]}}}},xb=(e,t)=>{const n=(e,n)=>{pe(e,(e=>{const o=ce(e.nodes);q(e.filter.callbacks,(r=>{for(let t=o.length-1;t>=0;t--){const r=o[t];(n?void 0!==r.attr(e.filter.name):r.name===e.filter.name)&&!y(r.parent)||o.splice(t,1)}o.length>0&&r(o,e.filter.name,t)}))}))};n(e.nodes,!1),n(e.attributes,!0)},_b=(e,t,n,o={})=>{const r=((e,t,n)=>{const o={nodes:{},attributes:{}};return n.firstChild&&((n,r)=>{let s=n;for(;s=s.walk();)Eb(e,t,s,o)})(n),o})(e,t,n);xb(r,o)},kb=(e,t,n,o)=>{if((e.pad_empty_with_br||t.insert)&&n(o)){const e=new tp("br",1);t.insert&&e.attr("data-mce-bogus","1"),o.empty().append(e)}else o.empty().append(new tp("#text",3)).value=qo},Sb=(e,t)=>{const n=null==e?void 0:e.firstChild;return C(n)&&n===e.lastChild&&n.name===t},Nb=(e,t,n,o)=>o.isEmpty(t,n,(t=>((e,t)=>{const n=e.getElementRule(t.name);return!0===(null==n?void 0:n.paddEmpty)})(e,t))),Rb=e=>{let t;for(let n=e;n;n=n.parent){const e=n.attr("contenteditable");if("false"===e)break;"true"===e&&(t=n)}return I.from(t)},Ab=(e,t,n=e.parent)=>{if(t.getSpecialElements()[e.name])e.empty().remove();else{const o=e.children();for(const e of o)n&&!t.isValidChild(n.name,e.name)&&Ab(e,t,n);e.unwrap()}},Tb=(e,t,n,o=_)=>{const r=t.getTextBlockElements(),s=t.getNonEmptyElements(),a=t.getWhitespaceElements(),i=Dt.makeMap("tr,td,th,tbody,thead,tfoot,table,summary"),l=new Set,d=e=>e!==n&&!i[e.name];for(let n=0;n<e.length;n++){const i=e[n];let c,u,m;if(!i.parent||l.has(i))continue;if(r[i.name]&&"li"===i.parent.name){let e=i.next;for(;e&&r[e.name];)e.name="li",l.add(e),i.parent.insert(e,i.parent),e=e.next;i.unwrap();continue}const f=[i];for(c=i.parent;c&&!t.isValidChild(c.name,i.name)&&d(c);c=c.parent)f.push(c);if(c&&f.length>1)if(Ob(t,i,c))Ab(i,t);else{f.reverse(),u=f[0].clone(),o(u);let e=u;for(let n=0;n<f.length-1;n++){t.isValidChild(e.name,f[n].name)&&n>0?(m=f[n].clone(),o(m),e.append(m)):m=e;for(let e=f[n].firstChild;e&&e!==f[n+1];){const t=e.next;m.append(e),e=t}e=m}Nb(t,s,a,u)?c.insert(i,f[0],!0):(c.insert(u,f[0],!0),c.insert(i,u)),c=f[0],(Nb(t,s,a,c)||Sb(c,"br"))&&c.empty().remove()}else if(i.parent){if("li"===i.name){let e=i.prev;if(e&&("ul"===e.name||"ol"===e.name)){e.append(i);continue}if(e=i.next,e&&("ul"===e.name||"ol"===e.name)&&e.firstChild){e.insert(i,e.firstChild,!0);continue}const t=new tp("ul",1);o(t),i.wrap(t);continue}if(t.isValidChild(i.parent.name,"div")&&t.isValidChild("div",i.name)){const e=new tp("div",1);o(e),i.wrap(e)}else Ab(i,t)}}},Ob=(e,t,n=t.parent)=>!(!n||(!e.children[t.name]||e.isValidChild(n.name,t.name))&&("a"!==t.name||!((e,t)=>{let n=e;for(;n;){if("a"===n.name)return!0;n=n.parent}return!1})(n))&&(!(e=>"summary"===e.name)(n)||!wb(t)||(null==n?void 0:n.firstChild)===t&&(null==n?void 0:n.lastChild)===t)),Bb=e=>e.collapsed?e:(e=>{const t=Ji.fromRangeStart(e),n=Ji.fromRangeEnd(e),o=e.commonAncestorContainer;return qu(!1,o,n).map((r=>!bu(t,n,o)&&bu(t,r,o)?((e,t,n,o)=>{const r=document.createRange();return r.setStart(e,t),r.setEnd(n,o),r})(t.container(),t.offset(),r.container(),r.offset()):e)).getOr(e)})(e),Pb=(e,t)=>{let n=t.firstChild,o=t.lastChild;return n&&"meta"===n.name&&(n=n.next),o&&"mce_marker"===o.attr("id")&&(o=o.prev),((e,t)=>{const n=e.getNonEmptyElements();return C(t)&&(t.isEmpty(n)||((e,t)=>e.getBlockElements()[t.name]&&(e=>C(e.firstChild)&&e.firstChild===e.lastChild)(t)&&(e=>"br"===e.name||e.value===qo)(t.firstChild))(e,t))})(e,o)&&(o=null==o?void 0:o.prev),!(!n||n!==o||"ul"!==n.name&&"ol"!==n.name)},Db=e=>{return e.length>0&&(!(n=e[e.length-1]).firstChild||C(null==(t=n)?void 0:t.firstChild)&&t.firstChild===t.lastChild&&(e=>e.data===qo||gr(e))(t.firstChild))?e.slice(0,-1):e;var t,n},Lb=(e,t)=>{const n=e.getParent(t,e.isBlock);return n&&"LI"===n.nodeName?n:null},Mb=(e,t)=>{const n=Ji.after(e),o=ju(t).prev(n);return o?o.toRange():null},Ib=(e,t,n,o)=>{const r=((e,t,n)=>{const o=t.serialize(n);return(e=>{var t,n;const o=e.firstChild,r=e.lastChild;return o&&"META"===o.nodeName&&(null===(t=o.parentNode)||void 0===t||t.removeChild(o)),r&&"mce_marker"===r.id&&(null===(n=r.parentNode)||void 0===n||n.removeChild(r)),e})(e.createFragment(o))})(t,e,o),s=Lb(t,n.startContainer),a=Db((i=r.firstChild,Y(null!==(l=null==i?void 0:i.childNodes)&&void 0!==l?l:[],(e=>"LI"===e.nodeName))));var i,l;const d=t.getRoot(),c=e=>{const o=Ji.fromRangeStart(n),r=ju(t.getRoot()),a=1===e?r.prev(o):r.next(o),i=null==a?void 0:a.getNode();return!i||Lb(t,i)!==s};return s?c(1)?((e,t,n)=>{const o=e.parentNode;return o&&Dt.each(t,(t=>{o.insertBefore(t,e)})),((e,t)=>{const n=Ji.before(e),o=ju(t).next(n);return o?o.toRange():null})(e,n)})(s,a,d):c(2)?((e,t,n,o)=>(o.insertAfter(t.reverse(),e),Mb(t[0],n)))(s,a,d,t):((e,t,n,o)=>{const r=((e,t)=>{const n=t.cloneRange(),o=t.cloneRange();return n.setStartBefore(e),o.setEndAfter(e),[n.cloneContents(),o.cloneContents()]})(e,o),s=e.parentNode;return s&&(s.insertBefore(r[0],e),Dt.each(t,(t=>{s.insertBefore(t,e)})),s.insertBefore(r[1],e),s.removeChild(e)),Mb(t[t.length-1],n)})(s,a,d,n):null},Fb=["pre"],Ub=vr,zb=(e,t,n)=>{var o,r;const s=e.selection,a=e.dom,i=e.parser,l=n.merge,d=Cp({validate:!0},e.schema),c='<span id="mce_marker" data-mce-type="bookmark">&#xFEFF;</span>';n.preserve_zwsp||(t=ti(t)),-1===t.indexOf("{$caret}")&&(t+="{$caret}"),t=t.replace(/\{\$caret\}/,c);let u=s.getRng();const m=u.startContainer,f=e.getBody();m===f&&s.isCollapsed()&&a.isBlock(f.firstChild)&&((e,t)=>C(t)&&!e.schema.getVoidElements()[t.nodeName])(e,f.firstChild)&&a.isEmpty(f.firstChild)&&(u=a.createRng(),u.setStart(f.firstChild,0),u.setEnd(f.firstChild,0),s.setRng(u)),s.isCollapsed()||(e=>{const t=e.dom,n=Bb(e.selection.getRng());e.selection.setRng(n);const o=t.getParent(n.startContainer,Ub);((e,t,n)=>!!C(n)&&n===e.getParent(t.endContainer,Ub)&&_m(Cn(n),t))(t,n,o)?db(e,n,Cn(o)):n.startContainer===n.endContainer&&n.endOffset-n.startOffset==1&&lr(n.startContainer.childNodes[n.startOffset])?n.deleteContents():e.getDoc().execCommand("Delete",!1)})(e);const g=s.getNode(),p={context:g.nodeName.toLowerCase(),data:n.data,insert:!0},h=i.parse(t,p);if(!0===n.paste&&Pb(e.schema,h)&&((e,t)=>!!Lb(e,t))(a,g))return u=Ib(d,a,s.getRng(),h),u&&s.setRng(u),t;!0===n.paste&&((e,t,n,o)=>{var r;const s=t.firstChild,a=t.lastChild,i=s===("bookmark"===a.attr("data-mce-type")?a.prev:a),l=H(Fb,s.name);if(i&&l){const t="false"!==s.attr("contenteditable"),a=(null===(r=e.getParent(n,e.isBlock))||void 0===r?void 0:r.nodeName.toLowerCase())===s.name,i=I.from(bb(o,n)).forall(hr);return t&&a&&i}return!1})(a,h,g,e.getBody())&&(null===(o=h.firstChild)||void 0===o||o.unwrap()),(e=>{let t=e;for(;t=t.walk();)1===t.type&&t.attr("data-mce-fragment","1")})(h);let b=h.lastChild;if(b&&"mce_marker"===b.attr("id")){const t=b;for(b=b.prev;b&&"table"!==b.name;b=b.walk(!0))if(3===b.type||!a.isBlock(b.name)){b.parent&&e.schema.isValidChild(b.parent.name,"span")&&b.parent.insert(t,b,"br"===b.name);break}}if(e._selectionOverrides.showBlockCaretContainer(g),p.invalid||((e,t,n)=>{var o;return $(n.children(),wb)&&"SUMMARY"===(null===(o=e.getParent(t,e.isBlock))||void 0===o?void 0:o.nodeName)})(a,g,h)){e.selection.setContent(c);let n,o=s.getNode();const l=e.getBody();for(mr(o)?o=n=l:n=o;n&&n!==l;)o=n,n=n.parentNode;t=o===l?l.innerHTML:a.getOuterHTML(o);const u=i.parse(t),m=(e=>{for(let t=e;t;t=t.walk())if("mce_marker"===t.attr("id"))return I.some(t);return I.none()})(u),f=m.bind(Rb).getOr(u);m.each((e=>e.replace(h)));const g=h.children(),p=null!==(r=h.parent)&&void 0!==r?r:u;h.unwrap();const b=Y(g,(t=>Ob(e.schema,t,p)));Tb(b,e.schema,f),_b(i.getNodeFilters(),i.getAttributeFilters(),u),t=d.serialize(u),o===l?a.setHTML(l,t):a.setOuterHTML(o,t)}else t=d.serialize(h),((e,t,n)=>{var o;if("all"===n.getAttribute("data-mce-bogus"))null===(o=n.parentNode)||void 0===o||o.insertBefore(e.dom.createFragment(t),n);else{const o=n.firstChild,r=n.lastChild;!o||o===r&&"BR"===o.nodeName?e.dom.setHTML(n,t):e.selection.setContent(t,{no_events:!0})}})(e,t,g);var v;return((e,t)=>{const n=e.schema.getTextInlineElements(),o=e.dom;if(t){const t=e.getBody(),r=Cb(e),s="*[data-mce-fragment]",a=o.select(s);Dt.each(a,(e=>{const a=e=>C(n[e.nodeName.toLowerCase()]),i=e=>1===e.childNodes.length;if(!kp(o,l=e)&&!((e,t)=>kp(e,t)&&$(_p(e,t),(e=>(e=>Ep.has(e))(e))))(o,l)&&a(e)&&i(e)){const n=_p(o,e),l=(e,t)=>ne(e,(e=>H(t,e))),d=t=>i(e)&&o.is(t,s)&&a(t)&&(t.nodeName===e.nodeName&&l(n,_p(o,t))||d(t.children[0])),c=n=>C(n)&&n!==t&&(r.compare(e,n)||c(n.parentElement)),u=n=>C(n)&&n!==t&&o.is(n,s)&&(((e,t,n)=>{const o=_p(e,t),r=_p(e,n),s=o=>{var r,s;const a=null!==(r=e.getStyle(t,o))&&void 0!==r?r:"",i=null!==(s=e.getStyle(n,o))&&void 0!==s?s:"";return Ge(a)&&Ge(i)&&a!==i};return $(o,(e=>{const t=t=>$(t,(t=>t===e));if(!t(r)&&t(xp)){const e=Y(r,(e=>$(xp,(t=>$e(e,t)))));return $(e,s)}return s(e)}))})(o,e,n)||u(n.parentElement));(d(e.children[0])||c(e.parentElement)&&!u(e.parentElement))&&o.remove(e,!0)}var l}))}})(e,l),((e,t)=>{var n,o,r;let s;const a=e.dom,i=e.selection;if(!t)return;i.scrollIntoView(t);const l=bb(e.getBody(),t);if(l&&"false"===a.getContentEditable(l))return a.remove(t),void i.select(l);let d=a.createRng();const c=t.previousSibling;if(lr(c)){d.setStart(c,null!==(o=null===(n=c.nodeValue)||void 0===n?void 0:n.length)&&void 0!==o?o:0);const e=t.nextSibling;lr(e)&&(c.appendData(e.data),null===(r=e.parentNode)||void 0===r||r.removeChild(e))}else d.setStartBefore(t),d.setEndBefore(t);const u=a.getParent(t,a.isBlock);if(a.remove(t),u&&a.isEmpty(u)){const t=Ub(u);wo(Cn(u)),d.setStart(u,0),d.setEnd(u,0),t||(e=>!!e.getAttribute("data-mce-fragment"))(u)||!(s=(t=>{let n=Ji.fromRangeStart(t);return n=ju(e.getBody()).next(n),null==n?void 0:n.toRange()})(d))?a.add(u,a.create("br",t?{}:{"data-mce-bogus":"1"})):(d=s,a.remove(u))}i.setRng(d)})(e,a.get("mce_marker")),v=e.getBody(),Dt.each(v.getElementsByTagName("*"),(e=>{e.removeAttribute("data-mce-fragment")})),((e,t,n)=>{I.from(e.getParent(t,"td,th")).map(Cn).each((e=>((e,t)=>{zn(e).each((n=>{Pn(n).each((o=>{t.isBlock($t(e))&&Va(n)&&t.isBlock($t(o))&&Eo(n)}))}))})(e,n)))})(a,s.getStart(),e.schema),((e,t,n)=>{const o=Bn(Cn(n),(e=>kn(e,Cn(t))));ie(o,o.length-2).filter(Kt).fold((()=>qr(e,t)),(t=>qr(e,t.dom)))})(e.schema,e.getBody(),s.getStart()),t},jb=e=>e instanceof tp,Hb=(e,t,n)=>{e.dom.setHTML(e.getBody(),t),!0!==n&&(e=>{Gf(e)&&Zu(e.getBody()).each((t=>{const n=t.getNode(),o=sr(n)?Zu(n).getOr(t):t;e.selection.setRng(o.toRange())}))})(e)},$b=e=>w(e)?e:L,Vb=(e,t,n)=>{const o=t(e),r=$b(n);return o.orThunk((()=>r(e)?I.none():((e,t,n)=>{let o=e.dom;const r=$b(n);for(;o.parentNode;){o=o.parentNode;const e=Cn(o),n=t(e);if(n.isSome())return n;if(r(e))break}return I.none()})(e,t,r)))},qb=Um,Wb=(e,t,n)=>{const o=e.formatter.get(n);if(o)for(let n=0;n<o.length;n++){const r=o[n];if(Wm(r)&&!1===r.inherit&&e.dom.is(t,r.selector))return!0}return!1},Kb=(e,t,n,o,r)=>{const s=e.dom.getRoot();if(t===s)return!1;const a=e.dom.getParent(t,(t=>!!Wb(e,t,n)||t.parentNode===s||!!Xb(e,t,n,o,!0)));return!!Xb(e,a,n,o,r)},Yb=(e,t,n)=>!(!Km(n)||!qb(t,n.inline))||!(!qm(n)||!qb(t,n.block))||!!Wm(n)&&Jo(t)&&e.is(t,n.selector),Gb=(e,t,n,o,r,s)=>{const a=n[o],i="attributes"===o;if(w(n.onmatch))return n.onmatch(t,n,o);if(a)if(Ne(a)){for(let n=0;n<a.length;n++)if(i?e.getAttrib(t,a[n]):jm(e,t,a[n]))return!0}else for(const o in a)if(_e(a,o)){const l=i?e.getAttrib(t,o):jm(e,t,o),d=Fm(a[o],s),c=y(l)||Xe(l);if(c&&y(d))continue;if(r&&c&&!n.exact)return!1;if((!r||n.exact)&&!qb(l,zm(d,o)))return!1}return!0},Xb=(e,t,n,o,r)=>{const s=e.formatter.get(n),a=e.dom;if(s&&Jo(t))for(let n=0;n<s.length;n++){const i=s[n];if(Yb(e.dom,t,i)&&Gb(a,t,i,"attributes",r,o)&&Gb(a,t,i,"styles",r,o)){const n=i.classes;if(n)for(let r=0;r<n.length;r++)if(!e.dom.hasClass(t,Fm(n[r],o)))return;return i}}},Zb=(e,t,n,o,r)=>{if(o)return Kb(e,o,t,n,r);if(o=e.selection.getNode(),Kb(e,o,t,n,r))return!0;const s=e.selection.getStart();return!(s===o||!Kb(e,s,t,n,r))},Qb=Ja,Jb=e=>{if(e){const t=new $o(e,e);for(let e=t.current();e;e=t.next())if(lr(e))return e}return null},ev=e=>{const t=vn("span");return en(t,{id:Ju,"data-mce-bogus":"1","data-mce-type":"format-caret"}),e&&vo(t,yn(Qb)),t},tv=(e,t,n)=>{const o=e.dom,r=e.selection;if(Gm(t))Rh(e,!1,Cn(t),n,!0);else{const e=r.getRng(),n=o.getParent(t,o.isBlock),s=e.startContainer,a=e.startOffset,i=e.endContainer,l=e.endOffset,d=(e=>{const t=Jb(e);return t&&t.data.charAt(0)===Qb&&t.deleteData(0,1),t})(t);o.remove(t,!0),s===d&&a>0&&e.setStart(d,a-1),i===d&&l>0&&e.setEnd(d,l-1),n&&o.isEmpty(n)&&Qa(Cn(n)),r.setRng(e)}},nv=(e,t,n)=>{const o=e.dom,r=e.selection;if(t)tv(e,t,n);else if(!(t=tm(e.getBody(),r.getStart())))for(;t=o.get(Ju);)tv(e,t,n)},ov=(e,t)=>(e.appendChild(t),t),rv=(e,t)=>{var n;const o=G(e,((e,t)=>ov(e,t.cloneNode(!1))),t),r=null!==(n=o.ownerDocument)&&void 0!==n?n:document;return ov(o,r.createTextNode(Qb))},sv=e=>Ha(e,ja(e).replace(new RegExp(`${qo}$`)," ")),av=(e,t)=>{const n=()=>{null===t||e.dom.isEmpty(t)||Pn(Cn(t)).each((e=>{Yt(e)?sv(e):Qn(e,(e=>Yt(e))).each((e=>{Yt(e)&&sv(e)}))}))};e.once("input",(t=>{t.data&&!hm(t.data)&&(t.isComposing?e.once("compositionend",(()=>{n()})):n())}))},iv=(e,t,n,o)=>{const a=e.dom,i=e.selection;let l=!1;const d=e.formatter.get(t);if(!d)return;const c=i.getRng(),u=c.startContainer,m=c.startOffset;let f=u;lr(u)&&(m!==u.data.length&&(l=!0),f=f.parentNode);const g=[];let h;for(;f;){if(Xb(e,f,t,n,o)){h=f;break}f.nextSibling&&(l=!0),g.push(f),f=f.parentNode}if(h)if(l){const r=i.getBookmark();c.collapse(!0);let s=mf(a,c,d,!0);s=_g(s),e.formatter.remove(t,n,s,o),i.moveToBookmark(r)}else{const l=tm(e.getBody(),h),d=C(l)?a.getParents(h.parentNode,M,l):[],c=ev(!1).dom;((e,t,n)=>{var o,r;const s=e.dom,a=s.getParent(n,T(Dm,e.schema));a&&s.isEmpty(a)?null===(o=n.parentNode)||void 0===o||o.replaceChild(t,n):((e=>{const t=Uo(e,"br"),n=Y((e=>{const t=[];let n=e.dom;for(;n;)t.push(Cn(n)),n=n.lastChild;return t})(e).slice(-1),Va);t.length===n.length&&q(n,Eo)})(Cn(n)),s.isEmpty(n)?null===(r=n.parentNode)||void 0===r||r.replaceChild(t,n):s.insertAfter(t,n))})(e,c,null!=l?l:h);const u=((e,t,n,o,a,i)=>{const l=e.formatter,d=e.dom,c=Y(fe(l.get()),(e=>e!==o&&!He(e,"removeformat"))),u=((e,t,n)=>X(n,((n,o)=>{const r=((e,t)=>Vm(e,t,(e=>{const t=e=>w(e)||e.length>1&&"%"===e.charAt(0);return $(["styles","attributes"],(n=>xe(e,n).exists((e=>{const n=p(e)?e:Ee(e);return $(n,t)}))))})))(e,o);return e.formatter.matchNode(t,o,{},r)?n.concat([o]):n}),[]))(e,n,c);if(Y(u,(t=>!((e,t,n)=>{const o=["inline","block","selector","attributes","styles","classes"],a=e=>Ce(e,((e,t)=>$(o,(e=>e===t))));return Vm(e,t,(t=>{const o=a(t);return Vm(e,n,(e=>{const t=a(e);return((e,t,n=s)=>r(n).eq(e,t))(o,t)}))}))})(e,t,o))).length>0){const e=n.cloneNode(!1);return d.add(t,e),l.remove(o,a,e,i),d.remove(e),I.some(e)}return I.none()})(e,c,h,t,n,o),m=rv([...g,...u.toArray(),...d],c);l&&tv(e,l,C(l)),i.setCursorLocation(m,1),av(e,c),a.isEmpty(h)&&a.remove(h)}},lv=e=>{const t=ev(!1),n=rv(e,t.dom);return{caretContainer:t,caretPosition:Ji(n,0)}},dv=(e,t)=>{const{caretContainer:n,caretPosition:o}=lv(t);return po(Cn(e),n),Eo(Cn(e)),o},cv=(e,t)=>{if(em(t.dom))return!1;const n=e.schema.getTextInlineElements();return _e(n,$t(t))&&!em(t.dom)&&!rr(t.dom)},uv={},mv=nr(["pre"]);((e,t)=>{uv[e]||(uv[e]=[]),uv[e].push((e=>{if(!e.selection.getRng().collapsed){const t=e.selection.getSelectedBlocks(),n=Y(Y(t,mv),(e=>t=>{const n=t.previousSibling;return mv(n)&&H(e,n)})(t));q(n,(e=>{((e,t)=>{const n=Cn(t),o=Rn(n).dom;Eo(n),Co(Cn(e),[vn("br",o),vn("br",o),...In(n)])})(e.previousSibling,e)}))}}))})("pre");const fv=["fontWeight","fontStyle","color","fontSize","fontFamily"],gv=(e,t)=>{const n=e.get(t);return p(n)?Q(n,(e=>Km(e)&&"span"===e.inline&&(e=>f(e.styles)&&$(fe(e.styles),(e=>H(fv,e))))(e))):I.none()},pv=(e,t)=>Xu(t,Ji.fromRangeStart(e)).isNone(),hv=(e,t)=>!1===Gu(t,Ji.fromRangeEnd(e)).exists((e=>!gr(e.getNode())||Gu(t,e).isSome())),bv=e=>t=>wr(t)&&e.isEditable(t),vv=e=>Y(e.getSelectedBlocks(),bv(e.dom)),yv=Dt.each,Cv=e=>Jo(e)&&!fm(e)&&!em(e)&&!rr(e),wv=(e,t)=>{for(let n=e;n;n=n[t]){if(lr(n)&&Ge(n.data))return e;if(Jo(n)&&!fm(n))return n}return e},Ev=(e,t,n)=>{const o=Cb(e),r=er(t)&&e.dom.isEditable(t),s=er(n)&&e.dom.isEditable(n);if(r&&s){const r=wv(t,"previousSibling"),s=wv(n,"nextSibling");if(o.compare(r,s)){for(let e=r.nextSibling;e&&e!==s;){const t=e;e=e.nextSibling,r.appendChild(t)}return e.dom.remove(s),Dt.each(Dt.grep(s.childNodes),(e=>{r.appendChild(e)})),r}}return n},xv=(e,t,n,o)=>{var r;if(o&&!1!==t.merge_siblings){const t=null!==(r=Ev(e,Pm(o),o))&&void 0!==r?r:o;Ev(e,t,Pm(t,!0))}},_v=(e,t,n)=>{yv(e.childNodes,(e=>{Cv(e)&&(t(e)&&n(e),e.hasChildNodes()&&_v(e,t,n))}))},kv=(e,t)=>n=>!(!n||!jm(e,n,t)),Sv=(e,t,n)=>o=>{e.setStyle(o,t,n),""===o.getAttribute("style")&&o.removeAttribute("style"),((e,t)=>{"SPAN"===t.nodeName&&0===e.getAttribs(t).length&&e.remove(t,!0)})(e,o)},Nv=_l([{keep:[]},{rename:["name"]},{removed:[]}]),Rv=/^(src|href|style)$/,Av=Dt.each,Tv=Um,Ov=(e,t,n)=>e.isChildOf(t,n)&&t!==n&&!e.isBlock(n),Bv=(e,t,n)=>{let o=t[n?"startContainer":"endContainer"],r=t[n?"startOffset":"endOffset"];if(Jo(o)){const e=o.childNodes.length-1;!n&&r&&r--,o=o.childNodes[r>e?e:r]}return lr(o)&&n&&r>=o.data.length&&(o=new $o(o,e.getBody()).next()||o),lr(o)&&!n&&0===r&&(o=new $o(o,e.getBody()).prev()||o),o},Pv=(e,t)=>{const n=t?"firstChild":"lastChild",o=e[n];return(e=>/^(TR|TH|TD)$/.test(e.nodeName))(e)&&o?"TR"===e.nodeName&&o[n]||o:e},Dv=(e,t,n,o)=>{var r;const s=e.create(n,o);return null===(r=t.parentNode)||void 0===r||r.insertBefore(s,t),s.appendChild(t),s},Lv=(e,t,n,o,r)=>{const s=Cn(t),a=Cn(e.create(o,r)),i=n?Mn(s):Ln(s);return Co(a,i),n?(po(s,a),bo(a,s)):(ho(s,a),vo(a,s)),a.dom},Mv=(e,t,n)=>{const o=t.parentNode;let r;const s=e.dom,a=Jl(e);qm(n)&&o===s.getRoot()&&(n.list_block&&Tv(t,n.list_block)||q(ce(t.childNodes),(t=>{Lm(e,a,t.nodeName.toLowerCase())?r?r.appendChild(t):(r=Dv(s,t,a),s.setAttribs(r,ed(e))):r=null}))),(e=>Wm(e)&&Km(e)&&Lt(xe(e,"mixed"),!0))(n)&&!Tv(n.inline,t)||s.remove(t,!0)},Iv=(e,t,n)=>E(e)?{name:t,value:null}:{name:e,value:Fm(t,n)},Fv=(e,t)=>{""===e.getAttrib(t,"style")&&(t.removeAttribute("style"),t.removeAttribute("data-mce-style"))},Uv=(e,t,n,o,r)=>{let s=!1;Av(n.styles,((a,i)=>{const{name:l,value:d}=Iv(i,a,o),c=zm(d,l);(n.remove_similar||h(d)||!Jo(r)||Tv(jm(e,r,l),c))&&e.setStyle(t,l,""),s=!0})),s&&Fv(e,t)},zv=(e,t,n,o,r)=>{const s=e.dom,a=Cb(e),i=e.schema;if(Km(t)&&Yr(i,t.inline)&&Xr(i,o)&&o.parentElement===e.getBody())return Mv(e,o,t),Nv.removed();if(!t.ceFalseOverride&&o&&"false"===s.getContentEditableParent(o))return Nv.keep();if(o&&!Yb(s,o,t)&&!((e,t)=>t.links&&"A"===e.nodeName)(o,t))return Nv.keep();const l=o,d=t.preserve_attributes;if(Km(t)&&"all"===t.remove&&p(d)){const e=Y(s.getAttribs(l),(e=>H(d,e.name.toLowerCase())));if(s.removeAllAttribs(l),q(e,(e=>s.setAttrib(l,e.name,e.value))),e.length>0)return Nv.rename("span")}if("all"!==t.remove){Uv(s,l,t,n,r),Av(t.attributes,((e,o)=>{const{name:a,value:i}=Iv(o,e,n);if(t.remove_similar||h(i)||!Jo(r)||Tv(s.getAttrib(r,a),i)){if("class"===a){const e=s.getAttrib(l,a);if(e){let t="";if(q(e.split(/\s+/),(e=>{/mce\-\w+/.test(e)&&(t+=(t?" ":"")+e)})),t)return void s.setAttrib(l,a,t)}}if(Rv.test(a)&&l.removeAttribute("data-mce-"+a),"style"===a&&nr(["li"])(l)&&"none"===s.getStyle(l,"list-style-type"))return l.removeAttribute(a),void s.setStyle(l,"list-style-type","none");"class"===a&&l.removeAttribute("className"),l.removeAttribute(a)}})),Av(t.classes,(e=>{e=Fm(e,n),Jo(r)&&!s.hasClass(r,e)||s.removeClass(l,e)}));const e=s.getAttribs(l);for(let t=0;t<e.length;t++){const n=e[t].nodeName;if(!a.isAttributeInternal(n))return Nv.keep()}}return"none"!==t.remove?(Mv(e,l,t),Nv.removed()):Nv.keep()},jv=(e,t,n,o)=>zv(e,t,n,o,o).fold(N(o),(t=>(e.dom.createFragment().appendChild(o),e.dom.rename(o,t))),N(null)),Hv=(e,t,n,o,r)=>{(o||e.selection.isEditable())&&((e,t,n,o,r)=>{const s=e.formatter.get(t),a=s[0],i=e.dom,l=e.selection,d=o=>{const i=((e,t,n,o,r)=>{let s;return t.parentNode&&q($m(e.dom,t.parentNode).reverse(),(t=>{if(!s&&Jo(t)&&"_start"!==t.id&&"_end"!==t.id){const a=Xb(e,t,n,o,r);a&&!1!==a.split&&(s=t)}})),s})(e,o,t,n,r);return((e,t,n,o,r,s,a,i)=>{var l,d;let c,u;const m=e.dom;if(n){const s=n.parentNode;for(let n=o.parentNode;n&&n!==s;n=n.parentNode){let o=m.clone(n,!1);for(let n=0;n<t.length&&(o=jv(e,t[n],i,o),null!==o);n++);o&&(c&&o.appendChild(c),u||(u=o),c=o)}a.mixed&&m.isBlock(n)||(o=null!==(l=m.split(n,o))&&void 0!==l?l:o),c&&u&&(null===(d=r.parentNode)||void 0===d||d.insertBefore(c,r),u.appendChild(r),Km(a)&&xv(e,a,0,c))}return o})(e,s,i,o,o,0,a,n)},c=t=>$(s,(o=>$v(e,o,n,t,t))),u=t=>{const n=ce(t.childNodes),o=c(t)||$(s,(e=>Yb(i,t,e))),r=t.parentNode;if(!o&&C(r)&&Ym(a)&&c(r),a.deep&&n.length)for(let e=0;e<n.length;e++)u(n[e]);q(["underline","line-through","overline"],(n=>{Jo(t)&&e.dom.getStyle(t,"text-decoration")===n&&t.parentNode&&Hm(i,t.parentNode)===n&&$v(e,{deep:!1,exact:!0,inline:"span",styles:{textDecoration:n}},void 0,t)}))},m=e=>{const t=i.get(e?"_start":"_end");if(t){let n=t[e?"firstChild":"lastChild"];return(e=>fm(e)&&Jo(e)&&("_start"===e.id||"_end"===e.id))(n)&&(n=n[e?"firstChild":"lastChild"]),lr(n)&&0===n.data.length&&(n=e?t.previousSibling||t.nextSibling:t.nextSibling||t.previousSibling),i.remove(t,!0),n}return null},f=t=>{let n,o,r=mf(i,t,s,t.collapsed);if(a.split){if(r=_g(r),n=Bv(e,r,!0),o=Bv(e,r),n!==o){if(n=Pv(n,!0),o=Pv(o,!1),Ov(i,n,o)){const e=I.from(n.firstChild).getOr(n);return d(Lv(i,e,!0,"span",{id:"_start","data-mce-type":"bookmark"})),void m(!0)}if(Ov(i,o,n)){const e=I.from(o.lastChild).getOr(o);return d(Lv(i,e,!1,"span",{id:"_end","data-mce-type":"bookmark"})),void m(!1)}n=Dv(i,n,"span",{id:"_start","data-mce-type":"bookmark"}),o=Dv(i,o,"span",{id:"_end","data-mce-type":"bookmark"});const e=i.createRng();e.setStartAfter(n),e.setEndBefore(o),ff(i,e,(e=>{q(e,(e=>{fm(e)||fm(e.parentNode)||d(e)}))})),d(n),d(o),n=m(!0),o=m()}else n=o=d(n);r.startContainer=n.parentNode?n.parentNode:n,r.startOffset=i.nodeIndex(n),r.endContainer=o.parentNode?o.parentNode:o,r.endOffset=i.nodeIndex(o)+1}ff(i,r,(e=>{q(e,u)}))};if(o){if(Am(o)){const e=i.createRng();e.setStartBefore(o),e.setEndAfter(o),f(e)}else f(o);Dl(e,t,o,n)}else l.isCollapsed()&&Km(a)&&!Cm(e).length?iv(e,t,n,r):(Om(e,(()=>Nm(e,f)),(o=>Km(a)&&Zb(e,t,n,o))),e.nodeChanged()),((e,t,n)=>{"removeformat"===t?q(vv(e.selection),(t=>{q(fv,(n=>e.dom.setStyle(t,n,""))),Fv(e.dom,t)})):gv(e.formatter,t).each((t=>{q(vv(e.selection),(o=>Uv(e.dom,o,t,n,null)))}))})(e,t,n),Dl(e,t,o,n)})(e,t,n,o,r)},$v=(e,t,n,o,r)=>zv(e,t,n,o,r).fold(L,(t=>(e.dom.rename(o,t),!0)),M),Vv=Dt.each,qv=Dt.each,Wv=(e,t,n,o)=>{if(qv(n.styles,((n,r)=>{e.setStyle(t,r,Fm(n,o))})),n.styles){const n=e.getAttrib(t,"style");n&&e.setAttrib(t,"data-mce-style",n)}},Kv=(e,t,n,o)=>{const r=e.formatter.get(t),s=r[0],a=!o&&e.selection.isCollapsed(),i=e.dom,l=e.selection,d=(e,t=s)=>{w(t.onformat)&&t.onformat(e,t,n,o),Wv(i,e,t,n),qv(t.attributes,((t,o)=>{i.setAttrib(e,o,Fm(t,n))})),qv(t.classes,(t=>{const o=Fm(t,n);i.hasClass(e,o)||i.addClass(e,o)}))},c=(e,t)=>{let n=!1;return qv(e,(e=>!(!Wm(e)||("false"!==i.getContentEditable(t)||e.ceFalseOverride)&&(!C(e.collapsed)||e.collapsed===a)&&i.is(t,e.selector)&&!em(t)&&(d(t,e),n=!0,1)))),n},u=e=>{if(m(e)){const t=i.create(e);return d(t),t}return null},f=(o,a,i)=>{const l=[];let m=!0;const f=s.inline||s.block,g=u(f);ff(o,a,(a=>{let u;const p=a=>{let h=!1,b=m,v=!1;const y=a.parentNode,w=y.nodeName.toLowerCase(),E=o.getContentEditable(a);C(E)&&(b=m,m="true"===E,h=!0,v=Im(e,a));const x=m&&!h;if(gr(a)&&!((e,t,n,o)=>{if(Fd(e)&&Km(t)&&n.parentNode){const t=Ls(e.schema),r=jo(Cn(n),(e=>em(e.dom)));return ke(t,o)&&Rr(e.schema,n.parentNode,{skipBogus:!1,includeZwsp:!0})&&!r}return!1})(e,s,a,w))return u=null,void(qm(s)&&o.remove(a));if((o=>(e=>qm(e)&&!0===e.wrapper)(s)&&Xb(e,o,t,n))(a))u=null;else{if(((t,n,o)=>{const r=(e=>qm(e)&&!0!==e.wrapper)(s)&&Dm(e.schema,t)&&Lm(e,n,f);return o&&r})(a,w,x)){const e=o.rename(a,f);return d(e),l.push(e),void(u=null)}if(Wm(s)){let e=c(r,a);if(!e&&C(y)&&Ym(s)&&(e=c(r,y)),!Km(s)||e)return void(u=null)}C(g)&&((t,n,r,a)=>{const l=t.nodeName.toLowerCase(),d=Lm(e,f,l)&&Lm(e,n,f),c=!i&&lr(t)&&ei(t.data),u=em(t),m=!Km(s)||!o.isBlock(t);return(r||a)&&d&&!c&&!u&&m})(a,w,x,v)?(u||(u=o.clone(g,!1),y.insertBefore(u,a),l.push(u)),v&&h&&(m=b),u.appendChild(a)):(u=null,q(ce(a.childNodes),p),h&&(m=b),u=null)}};q(a,p)})),!0===s.links&&q(l,(e=>{const t=e=>{"A"===e.nodeName&&d(e,s),q(ce(e.childNodes),t)};t(e)})),q(l,(a=>{const i=(e=>{let t=0;return q(e.childNodes,(e=>{(e=>C(e)&&lr(e)&&0===e.length)(e)||fm(e)||t++})),t})(a);!(l.length>1)&&o.isBlock(a)||0!==i?(Km(s)||qm(s)&&s.wrapper)&&(s.exact||1!==i||(a=(e=>{const t=Q(e.childNodes,Tm).filter((e=>"false"!==o.getContentEditable(e)&&Yb(o,e,s)));return t.map((t=>{const n=o.clone(t,!1);return d(n),o.replace(n,e,!0),o.remove(t,!0),n})).getOr(e)})(a)),((e,t,n,o)=>{Vv(t,(t=>{Km(t)&&Vv(e.dom.select(t.inline,o),(o=>{Cv(o)&&$v(e,t,n,o,t.exact?o:null)})),((e,t,n)=>{if(t.clear_child_styles){const o=t.links?"*:not(a)":"*";yv(e.select(o,n),(n=>{Cv(n)&&e.isEditable(n)&&yv(t.styles,((t,o)=>{e.setStyle(n,o,"")}))}))}})(e.dom,t,o)}))})(e,r,n,a),((e,t,n,o,r)=>{const s=r.parentNode;Xb(e,s,n,o)&&$v(e,t,o,r)||t.merge_with_parents&&s&&e.dom.getParent(s,(s=>!!Xb(e,s,n,o)&&($v(e,t,o,r),!0)))})(e,s,t,n,a),((e,t,n,o)=>{if(t.styles&&t.styles.backgroundColor){const r=kv(e,"fontSize");_v(o,(t=>r(t)&&e.isEditable(t)),Sv(e,"backgroundColor",Fm(t.styles.backgroundColor,n)))}})(o,s,n,a),((e,t,n,o)=>{const r=t=>{if(er(t)&&Jo(t.parentNode)&&e.isEditable(t)){const n=Hm(e,t.parentNode);e.getStyle(t,"color")&&n?e.setStyle(t,"text-decoration",n):e.getStyle(t,"text-decoration")===n&&e.setStyle(t,"text-decoration",null)}};t.styles&&(t.styles.color||t.styles.textDecoration)&&(Dt.walk(o,r,"childNodes"),r(o))})(o,s,0,a),((e,t,n,o)=>{if(Km(t)&&("sub"===t.inline||"sup"===t.inline)){const n=kv(e,"fontSize");_v(o,(t=>n(t)&&e.isEditable(t)),Sv(e,"fontSize",""));const r=Y(e.select("sup"===t.inline?"sub":"sup",o),e.isEditable);e.remove(r,!0)}})(o,s,0,a),xv(e,s,0,a)):o.remove(a,!0)}))},g=Am(o)?o:l.getNode();if("false"===i.getContentEditable(g)&&!Im(e,g))return c(r,o=g),void Pl(e,t,o,n);if(s){if(o)if(Am(o)){if(!c(r,o)){const e=i.createRng();e.setStartBefore(o),e.setEndAfter(o),f(i,mf(i,e,r),!0)}}else f(i,o,!0);else a&&Km(s)&&!Cm(e).length?((e,t,n)=>{let o;const r=e.selection,s=e.formatter.get(t);if(!s)return;const a=r.getRng();let i=a.startOffset;const l=a.startContainer.nodeValue;o=tm(e.getBody(),r.getStart());const d=/[^\s\u00a0\u00ad\u200b\ufeff]/;if(l&&i>0&&i<l.length&&d.test(l.charAt(i))&&d.test(l.charAt(i-1))){const o=r.getBookmark();a.collapse(!0);let i=mf(e.dom,a,s);i=_g(i),e.formatter.apply(t,n,i),r.moveToBookmark(o)}else{let s=o?Jb(o):null;o&&(null==s?void 0:s.data)===Qb||(c=e.getDoc(),u=ev(!0).dom,o=c.importNode(u,!0),s=o.firstChild,a.insertNode(o),i=1,av(e,o)),e.formatter.apply(t,n,o),r.setCursorLocation(s,i)}var c,u})(e,t,n):(l.setRng(Bb(l.getRng())),Om(e,(()=>{Nm(e,((e,t)=>{const n=t?e:mf(i,e,r);f(i,n,!1)}))}),M),e.nodeChanged()),gv(e.formatter,t).each((t=>{q((e=>Y((e=>{const t=e.getSelectedBlocks(),n=e.getRng();if(e.isCollapsed())return[];if(1===t.length)return pv(n,t[0])&&hv(n,t[0])?t:[];{const e=le(t).filter((e=>pv(n,e))).toArray(),o=de(t).filter((e=>hv(n,e))).toArray(),r=t.slice(1,-1);return e.concat(r).concat(o)}})(e),bv(e.dom)))(e.selection),(e=>Wv(i,e,t,n)))}));((e,t)=>{_e(uv,e)&&q(uv[e],(e=>{e(t)}))})(t,e)}Pl(e,t,o,n)},Yv=(e,t,n,o)=>{(o||e.selection.isEditable())&&Kv(e,t,n,o)},Gv=e=>_e(e,"vars"),Xv=e=>e.selection.getStart(),Zv=(e,t,n,o,r)=>Z(t,(t=>{const s=e.formatter.matchNode(t,n,null!=r?r:{},o);return!v(s)}),(t=>!!Wb(e,t,n)||!o&&C(e.formatter.matchNode(t,n,r,!0)))),Qv=(e,t)=>{const n=null!=t?t:Xv(e);return Y($m(e.dom,n),(e=>Jo(e)&&!rr(e)))},Jv=(e,t,n)=>{const o=Qv(e,t);pe(n,((n,r)=>{const s=n=>{const s=Zv(e,o,r,n.similar,Gv(n)?n.vars:void 0),a=s.isSome();if(n.state.get()!==a){n.state.set(a);const e=s.getOr(t);Gv(n)?n.callback(a,{node:e,format:r,parents:o}):q(n.callbacks,(t=>t(a,{node:e,format:r,parents:o})))}};q([n.withSimilar,n.withoutSimilar],s),q(n.withVars,s)}))},ey=Dt.explode,ty=()=>{const e={};return{addFilter:(t,n)=>{q(ey(t),(t=>{_e(e,t)||(e[t]={name:t,callbacks:[]}),e[t].callbacks.push(n)}))},getFilters:()=>Ee(e),removeFilter:(t,n)=>{q(ey(t),(t=>{if(_e(e,t))if(C(n)){const o=e[t],r=Y(o.callbacks,(e=>e!==n));r.length>0?o.callbacks=r:delete e[t]}else delete e[t]}))}}},ny=(e,t,n)=>{var o;const r=Ws();t.convert_fonts_to_spans&&((e,t,n)=>{e.addNodeFilter("font",(e=>{q(e,(e=>{const o=t.parse(e.attr("style")),r=e.attr("color"),s=e.attr("face"),a=e.attr("size");r&&(o.color=r),s&&(o["font-family"]=s),a&&Ze(a).each((e=>{o["font-size"]=n[e-1]})),e.name="span",e.attr("style",t.serialize(o)),((e,t)=>{q(["color","face","size"],(t=>{e.attr(t,null)}))})(e)}))}))})(e,r,Dt.explode(null!==(o=t.font_size_legacy_values)&&void 0!==o?o:"")),((e,t,n)=>{e.addNodeFilter("strike",(e=>{const o="html4"!==t.type;q(e,(e=>{if(o)e.name="s";else{const t=n.parse(e.attr("style"));t["text-decoration"]="line-through",e.name="span",e.attr("style",n.serialize(t))}}))}))})(e,n,r)},oy=e=>{const[t,...n]=e.split(","),o=n.join(","),r=/data:([^/]+\/[^;]+)(;.+)?/.exec(t);if(r){const e=";base64"===r[2],t=(e=>{try{return decodeURIComponent(e)}catch(t){return e}})(o),n=e?(e=>{const t=/([a-z0-9+\/=\s]+)/i.exec(e);return t?t[1]:""})(t):t;return I.some({type:r[1],data:n,base64Encoded:e})}return I.none()},ry=(e,t,n=!0)=>{let o=t;if(n)try{o=atob(t)}catch(e){return I.none()}const r=new Uint8Array(o.length);for(let e=0;e<r.length;e++)r[e]=o.charCodeAt(e);return I.some(new Blob([r],{type:e}))},sy=e=>new Promise(((t,n)=>{const o=new FileReader;o.onloadend=()=>{t(o.result)},o.onerror=()=>{var e;n(null===(e=o.error)||void 0===e?void 0:e.message)},o.readAsDataURL(e)}));let ay=0;const iy=(e,t,n)=>oy(e).bind((({data:e,type:o,base64Encoded:r})=>{if(t&&!r)return I.none();{const t=r?e:btoa(e);return n(t,o)}})),ly=(e,t,n)=>{const o=e.create("blobid"+ay++,t,n);return e.add(o),o},dy=(e,t,n=!1)=>iy(t,n,((t,n)=>I.from(e.getByData(t,n)).orThunk((()=>ry(n,t).map((n=>ly(e,n,t))))))),cy=/^(?:(?:(?:[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?|www\.|[-;:&=+$,.\w]+@)([A-Za-z\d-]+(?:\.[A-Za-z\d-]+)*))(?::\d+)?(?:\/(?:[-.~*+=!;:'%@$(),\/\w]*[-~*+=%@$()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+)?)?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+)?)?)$/,uy=e=>I.from(e.match(cy)).bind((e=>ie(e,1))).map((e=>$e(e,"www.")?e.substring(4):e)),my=(e,t)=>{I.from(e.attr("src")).bind(uy).forall((e=>!H(t,e)))&&e.attr("sandbox","")},fy=(e,t)=>$e(e,`${t}/`),{entries:gy,setPrototypeOf:py,isFrozen:hy,getPrototypeOf:by,getOwnPropertyDescriptor:vy}=Object;let{freeze:yy,seal:Cy,create:wy}=Object,{apply:Ey,construct:xy}="undefined"!=typeof Reflect&&Reflect;// eslint-disable-line import/no-mutable-exports
5
+ yy||(yy=function(e){return e}),Cy||(Cy=function(e){return e}),Ey||(Ey=function(e,t,n){return e.apply(t,n)}),xy||(xy=function(e,t){return new e(...t)});const _y=Iy(Array.prototype.forEach),ky=Iy(Array.prototype.pop),Sy=Iy(Array.prototype.push),Ny=Iy(String.prototype.toLowerCase),Ry=Iy(String.prototype.toString),Ay=Iy(String.prototype.match),Ty=Iy(String.prototype.replace),Oy=Iy(String.prototype.indexOf),By=Iy(String.prototype.trim),Py=Iy(Object.prototype.hasOwnProperty),Dy=Iy(RegExp.prototype.test),Ly=(My=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return xy(My,t)});
6
+ /**
7
+ * Creates a new function that constructs an instance of the given constructor function with the provided arguments.
8
+ *
9
+ * @param {Function} func - The constructor function to be wrapped and called.
10
+ * @returns {Function} A new function that constructs an instance of the given constructor function with the provided arguments.
11
+ */
12
+ var My;
13
+ /**
14
+ * Add properties to a lookup table
15
+ *
16
+ * @param {Object} set - The set to which elements will be added.
17
+ * @param {Array} array - The array containing elements to be added to the set.
18
+ * @param {Function} transformCaseFunc - An optional function to transform the case of each element before adding to the set.
19
+ * @returns {Object} The modified set with added elements.
20
+ */
21
+ /**
22
+ * Creates a new function that calls the given function with a specified thisArg and arguments.
23
+ *
24
+ * @param {Function} func - The function to be wrapped and called.
25
+ * @returns {Function} A new function that calls the given function with a specified thisArg and arguments.
26
+ */
27
+ function Iy(e){return function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return Ey(e,t,o)}}function Fy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ny;py&&
28
+ // Make 'in' and truthy checks like Boolean(set.constructor)
29
+ // independent of any properties defined on Object.prototype.
30
+ // Prevent prototype setters from intercepting set as a this value.
31
+ py(e,null);let o=t.length;for(;o--;){let r=t[o];if("string"==typeof r){const e=n(r);e!==r&&(
32
+ // Config presets (e.g. tags.js, attrs.js) are immutable.
33
+ hy(t)||(t[o]=e),r=e)}e[r]=!0}return e}
34
+ /**
35
+ * Clean up an array to harden against CSPP
36
+ *
37
+ * @param {Array} array - The array to be cleaned.
38
+ * @returns {Array} The cleaned version of the array
39
+ */function Uy(e){for(let t=0;t<e.length;t++)Py(e,t)||(e[t]=null);return e}
40
+ /**
41
+ * Shallow clone an object
42
+ *
43
+ * @param {Object} object - The object to be cloned.
44
+ * @returns {Object} A new object that copies the original.
45
+ */function zy(e){const t=wy(null);for(const[n,o]of gy(e))Py(e,n)&&(Array.isArray(o)?t[n]=Uy(o):o&&"object"==typeof o&&o.constructor===Object?t[n]=zy(o):t[n]=o);return t}
46
+ /**
47
+ * This method automatically checks if the prop is function or getter and behaves accordingly.
48
+ *
49
+ * @param {Object} object - The object to look up the getter function in its prototype chain.
50
+ * @param {String} prop - The property name for which to find the getter function.
51
+ * @returns {Function} The getter function found in the prototype chain or a fallback function.
52
+ */function jy(e,t){for(;null!==e;){const n=vy(e,t);if(n){if(n.get)return Iy(n.get);if("function"==typeof n.value)return Iy(n.value)}e=by(e)}return function(){return null}}const Hy=yy(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),$y=yy(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Vy=yy(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),qy=yy(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Wy=yy(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Ky=yy(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Yy=yy(["#text"]),Gy=yy(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Xy=yy(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Zy=yy(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Qy=yy(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Jy=Cy(/\{\{[\w\W]*|[\w\W]*\}\}/gm),eC=Cy(/<%[\w\W]*|[\w\W]*%>/gm),tC=Cy(/\${[\w\W]*}/gm),nC=Cy(/^data-[\-\w.\u00B7-\uFFFF]/),oC=Cy(/^aria-[\-\w]+$/),rC=Cy(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),sC=Cy(/^(?:\w+script|data):/i),aC=Cy(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),iC=Cy(/^html$/i),lC=Cy(/^[a-z][.\w]*(-[.\w]+)+$/i);
53
+ // SVG
54
+ var dC=Object.freeze({__proto__:null,MUSTACHE_EXPR:Jy,ERB_EXPR:eC,TMPLIT_EXPR:tC,DATA_ATTR:nC,ARIA_ATTR:oC,IS_ALLOWED_URI:rC,IS_SCRIPT_OR_DATA:sC,ATTR_WHITESPACE:aC,DOCTYPE_NAME:iC,CUSTOM_ELEMENT:lC});
55
+ // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
56
+ const cC=function(){return"undefined"==typeof window?null:window};var uC=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:cC();const n=t=>e(t)
57
+ /**
58
+ * Version label, exposed for easier checks
59
+ * if DOMPurify is up to date or not
60
+ */;if(n.version="3.1.7",
61
+ /**
62
+ * Array of elements that DOMPurify removed during sanitation.
63
+ * Empty if nothing was removed.
64
+ */
65
+ n.removed=[],!t||!t.document||9!==t.document.nodeType)
66
+ // Not running in a browser, provide a factory function
67
+ // so that you can pass your own Window
68
+ return n.isSupported=!1,n;let{document:o}=t;const r=o,s=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:i,Node:l,Element:d,NodeFilter:c,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:m,DOMParser:f,trustedTypes:g}=t,p=d.prototype,h=jy(p,"cloneNode"),b=jy(p,"remove"),v=jy(p,"nextSibling"),y=jy(p,"childNodes"),C=jy(p,"parentNode");
69
+ // As per issue #47, the web-components registry is inherited by a
70
+ // new document created via createHTMLDocument. As per the spec
71
+ // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
72
+ // a new empty registry is used when creating a template contents owner
73
+ // document, so we use that as our parent document to ensure nothing
74
+ // is inherited.
75
+ if("function"==typeof i){const e=o.createElement("template");e.content&&e.content.ownerDocument&&(o=e.content.ownerDocument)}let w,E="";const{implementation:x,createNodeIterator:_,createDocumentFragment:k,getElementsByTagName:S}=o,{importNode:N}=r;let R={};
76
+ /**
77
+ * Expose whether this browser supports running the full DOMPurify.
78
+ */n.isSupported="function"==typeof gy&&"function"==typeof C&&x&&void 0!==x.createHTMLDocument;const{MUSTACHE_EXPR:A,ERB_EXPR:T,TMPLIT_EXPR:O,DATA_ATTR:B,ARIA_ATTR:P,IS_SCRIPT_OR_DATA:D,ATTR_WHITESPACE:L,CUSTOM_ELEMENT:M}=dC;let{IS_ALLOWED_URI:I}=dC,F=null;
79
+ /**
80
+ * We consider the elements and attributes below to be safe. Ideally
81
+ * don't add any new ones but feel free to remove unwanted ones.
82
+ */
83
+ /* allowed element names */const U=Fy({},[...Hy,...$y,...Vy,...Wy,...Yy]);
84
+ /* Allowed attribute names */let z=null;const j=Fy({},[...Gy,...Xy,...Zy,...Qy]);
85
+ /*
86
+ * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.
87
+ * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
88
+ * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
89
+ * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
90
+ */let H=Object.seal(wy(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),$=null,V=null,q=!0,W=!0,K=!1,Y=!0,G=!1,X=!0,Z=!1,Q=!1,J=!1,ee=!1,te=!1,ne=!1,oe=!0,re=!1,se=!0,ae=!1,ie={},le=null;
91
+ /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */const de=Fy({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);
92
+ /* Tags that are safe for data: URIs */let ce=null;const ue=Fy({},["audio","video","img","source","image","track"]);
93
+ /* Attributes safe for values like "javascript:" */let me=null;const fe=Fy({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ge="http://www.w3.org/1998/Math/MathML",pe="http://www.w3.org/2000/svg",he="http://www.w3.org/1999/xhtml";
94
+ /* Document namespace */
95
+ let be=he,ve=!1,ye=null;const Ce=Fy({},[ge,pe,he],Ry);
96
+ /* Parsing of strict XHTML documents */let we=null;const Ee=["application/xhtml+xml","text/html"];let xe=null,_e=null;
97
+ /* Keep a reference to config to pass to hooks */
98
+ /* Ideally, do not touch anything below this line */
99
+ /* ______________________________________________ */
100
+ const ke=o.createElement("form"),Se=function(e){return e instanceof RegExp||e instanceof Function},Ne=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!_e||_e!==e){if(
101
+ /* Shield configuration object from tampering */
102
+ e&&"object"==typeof e||(e={})
103
+ /* Shield configuration object from prototype pollution */,e=zy(e),we=
104
+ // eslint-disable-next-line unicorn/prefer-includes
105
+ -1===Ee.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,
106
+ // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
107
+ xe="application/xhtml+xml"===we?Ry:Ny,
108
+ /* Set configuration parameters */
109
+ F=Py(e,"ALLOWED_TAGS")?Fy({},e.ALLOWED_TAGS,xe):U,z=Py(e,"ALLOWED_ATTR")?Fy({},e.ALLOWED_ATTR,xe):j,ye=Py(e,"ALLOWED_NAMESPACES")?Fy({},e.ALLOWED_NAMESPACES,Ry):Ce,me=Py(e,"ADD_URI_SAFE_ATTR")?Fy(zy(fe),
110
+ // eslint-disable-line indent
111
+ e.ADD_URI_SAFE_ATTR,
112
+ // eslint-disable-line indent
113
+ xe):fe,ce=Py(e,"ADD_DATA_URI_TAGS")?Fy(zy(ue),
114
+ // eslint-disable-line indent
115
+ e.ADD_DATA_URI_TAGS,
116
+ // eslint-disable-line indent
117
+ xe):ue,le=Py(e,"FORBID_CONTENTS")?Fy({},e.FORBID_CONTENTS,xe):de,$=Py(e,"FORBID_TAGS")?Fy({},e.FORBID_TAGS,xe):{},V=Py(e,"FORBID_ATTR")?Fy({},e.FORBID_ATTR,xe):{},ie=!!Py(e,"USE_PROFILES")&&e.USE_PROFILES,q=!1!==e.ALLOW_ARIA_ATTR,// Default true
118
+ W=!1!==e.ALLOW_DATA_ATTR,// Default true
119
+ K=e.ALLOW_UNKNOWN_PROTOCOLS||!1,// Default false
120
+ Y=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,// Default true
121
+ G=e.SAFE_FOR_TEMPLATES||!1,// Default false
122
+ X=!1!==e.SAFE_FOR_XML,// Default true
123
+ Z=e.WHOLE_DOCUMENT||!1,// Default false
124
+ ee=e.RETURN_DOM||!1,// Default false
125
+ te=e.RETURN_DOM_FRAGMENT||!1,// Default false
126
+ ne=e.RETURN_TRUSTED_TYPE||!1,// Default false
127
+ J=e.FORCE_BODY||!1,// Default false
128
+ oe=!1!==e.SANITIZE_DOM,// Default true
129
+ re=e.SANITIZE_NAMED_PROPS||!1,// Default false
130
+ se=!1!==e.KEEP_CONTENT,// Default true
131
+ ae=e.IN_PLACE||!1,// Default false
132
+ I=e.ALLOWED_URI_REGEXP||rC,be=e.NAMESPACE||he,H=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(H.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),G&&(W=!1),te&&(ee=!0)
133
+ /* Parse profile info */,ie&&(F=Fy({},Yy),z=[],!0===ie.html&&(Fy(F,Hy),Fy(z,Gy)),!0===ie.svg&&(Fy(F,$y),Fy(z,Xy),Fy(z,Qy)),!0===ie.svgFilters&&(Fy(F,Vy),Fy(z,Xy),Fy(z,Qy)),!0===ie.mathMl&&(Fy(F,Wy),Fy(z,Zy),Fy(z,Qy)))
134
+ /* Merge configuration parameters */,e.ADD_TAGS&&(F===U&&(F=zy(F)),Fy(F,e.ADD_TAGS,xe)),e.ADD_ATTR&&(z===j&&(z=zy(z)),Fy(z,e.ADD_ATTR,xe)),e.ADD_URI_SAFE_ATTR&&Fy(me,e.ADD_URI_SAFE_ATTR,xe),e.FORBID_CONTENTS&&(le===de&&(le=zy(le)),Fy(le,e.FORBID_CONTENTS,xe))
135
+ /* Add #text in case KEEP_CONTENT is set to true */,se&&(F["#text"]=!0)
136
+ /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */,Z&&Fy(F,["html","head","body"])
137
+ /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */,F.table&&(Fy(F,["tbody"]),delete $.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw Ly('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw Ly('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
138
+ // Overwrite existing TrustedTypes policy.
139
+ w=e.TRUSTED_TYPES_POLICY,
140
+ // Sign local variables required by `sanitize`.
141
+ E=w.createHTML("")}else
142
+ // Uninitialized policy, attempt to initialize the internal dompurify policy.
143
+ void 0===w&&(w=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;
144
+ // Allow the callers to control the unique policy name
145
+ // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
146
+ // Policy creation with duplicate names throws in Trusted Types.
147
+ let n=null;const o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(n=t.getAttribute(o));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){
148
+ // Policy creation failed (most likely another DOMPurify script has
149
+ // already run). Skip creating the policy, as this will only cause errors
150
+ // if TT are enforced.
151
+ return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(g,s)),
152
+ // If creating the internal policy succeeded sign internal variables.
153
+ null!==w&&"string"==typeof E&&(E=w.createHTML(""));
154
+ // Prevent further manipulation of configuration.
155
+ // Not available in IE8, Safari 5, etc.
156
+ yy&&yy(e),_e=e}},Re=Fy({},["mi","mo","mn","ms","mtext"]),Ae=Fy({},["annotation-xml"]),Te=Fy({},["title","style","font","a","script"]),Oe=Fy({},[...$y,...Vy,...qy]),Be=Fy({},[...Wy,...Ky]),Pe=function(e){Sy(n.removed,{element:e});try{
157
+ // eslint-disable-next-line unicorn/prefer-dom-node-remove
158
+ C(e).removeChild(e)}catch(t){b(e)}},De=function(e,t){try{Sy(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Sy(n.removed,{attribute:null,from:t})}
159
+ // We void attribute values for unremovable "is"" attributes
160
+ if(t.removeAttribute(e),"is"===e&&!z[e])if(ee||te)try{Pe(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Le=function(e){
161
+ /* Create a HTML document */
162
+ let t=null,n=null;if(J)e="<remove></remove>"+e;else{
163
+ /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
164
+ const t=Ay(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===we&&be===he&&(
165
+ // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
166
+ e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=w?w.createHTML(e):e;
167
+ /*
168
+ * Use the DOMParser API by default, fallback later if needs be
169
+ * DOMParser not work for svg when has multiple root element.
170
+ */if(be===he)try{t=(new f).parseFromString(r,we)}catch(e){}
171
+ /* Use createHTMLDocument in case DOMParser is not available */if(!t||!t.documentElement){t=x.createDocument(be,"template",null);try{t.documentElement.innerHTML=ve?E:r}catch(e){
172
+ // Syntax error if dirtyPayload is invalid xml
173
+ }}const s=t.body||t.documentElement;
174
+ /* Work on whole document or just its body */
175
+ return e&&n&&s.insertBefore(o.createTextNode(n),s.childNodes[0]||null),be===he?S.call(t,Z?"html":"body")[0]:Z?t.documentElement:s},Me=function(e){return _.call(e.ownerDocument||e,e,
176
+ // eslint-disable-next-line no-bitwise
177
+ c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ie=function(e){return e instanceof m&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Fe=function(e){return"function"==typeof l&&e instanceof l},Ue=function(e,t,o){R[e]&&_y(R[e],(e=>{e.call(n,t,o,_e)}))},ze=function(e){let t=null;
178
+ /* Execute a hook if present */
179
+ /* Check if element is clobbered or can clobber */
180
+ if(Ue("beforeSanitizeElements",e,null),Ie(e))return Pe(e),!0;
181
+ /* Now let's check the element's type and name */const o=xe(e.nodeName);
182
+ /* Execute a hook if present */
183
+ /* Detect mXSS attempts abusing namespace confusion */
184
+ if(Ue("uponSanitizeElement",e,{tagName:o,allowedTags:F}),e.hasChildNodes()&&!Fe(e.firstElementChild)&&Dy(/<[/\w]/g,e.innerHTML)&&Dy(/<[/\w]/g,e.textContent))return Pe(e),!0;
185
+ /* Remove any occurrence of processing instructions */if(7===e.nodeType)return Pe(e),!0;
186
+ /* Remove any kind of possibly harmful comments */if(X&&8===e.nodeType&&Dy(/<[/\w]/g,e.data))return Pe(e),!0;
187
+ /* Remove element if anything forbids its presence */if(!F[o]||$[o]){
188
+ /* Check if we have a custom element to handle */
189
+ if(!$[o]&&He(o)){if(H.tagNameCheck instanceof RegExp&&Dy(H.tagNameCheck,o))return!1;if(H.tagNameCheck instanceof Function&&H.tagNameCheck(o))return!1}
190
+ /* Keep content except for bad-listed elements */if(se&&!le[o]){const t=C(e)||e.parentNode,n=y(e)||e.childNodes;if(n&&t)for(let o=n.length-1;o>=0;--o){const r=h(n[o],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,v(e))}}return Pe(e),!0}
191
+ /* Check whether element has a valid namespace */return e instanceof d&&!function(e){let t=C(e);
192
+ // In JSDOM, if we're inside shadow DOM, then parentNode
193
+ // can be null. We just simulate parent in this case.
194
+ t&&t.tagName||(t={namespaceURI:be,tagName:"template"});const n=Ny(e.tagName),o=Ny(t.tagName);return!!ye[e.namespaceURI]&&(e.namespaceURI===pe?
195
+ // The only way to switch from HTML namespace to SVG
196
+ // is via <svg>. If it happens via any other tag, then
197
+ // it should be killed.
198
+ t.namespaceURI===he?"svg"===n:
199
+ // The only way to switch from MathML to SVG is via`
200
+ // svg if parent is either <annotation-xml> or MathML
201
+ // text integration points.
202
+ t.namespaceURI===ge?"svg"===n&&("annotation-xml"===o||Re[o]):Boolean(Oe[n]):e.namespaceURI===ge?
203
+ // The only way to switch from HTML namespace to MathML
204
+ // is via <math>. If it happens via any other tag, then
205
+ // it should be killed.
206
+ t.namespaceURI===he?"math"===n:
207
+ // The only way to switch from SVG to MathML is via
208
+ // <math> and HTML integration points
209
+ t.namespaceURI===pe?"math"===n&&Ae[o]:Boolean(Be[n]):e.namespaceURI===he?
210
+ // The only way to switch from SVG to HTML is via
211
+ // HTML integration points, and from MathML to HTML
212
+ // is via MathML text integration points
213
+ !(t.namespaceURI===pe&&!Ae[o])&&!(t.namespaceURI===ge&&!Re[o])&&!Be[n]&&(Te[n]||!Oe[n]):!("application/xhtml+xml"!==we||!ye[e.namespaceURI]))}(e)?(Pe(e),!0):
214
+ /* Make sure that older browsers don't get fallback-tag mXSS */
215
+ "noscript"!==o&&"noembed"!==o&&"noframes"!==o||!Dy(/<\/no(script|embed|frames)/i,e.innerHTML)?(
216
+ /* Sanitize element content to be template-safe */
217
+ G&&3===e.nodeType&&(
218
+ /* Get the element's text content */
219
+ t=e.textContent,_y([A,T,O],(e=>{t=Ty(t,e," ")})),e.textContent!==t&&(Sy(n.removed,{element:e.cloneNode()}),e.textContent=t))
220
+ /* Execute a hook if present */,Ue("afterSanitizeElements",e,null),!1):(Pe(e),!0)},je=function(e,t,n){
221
+ /* Make sure attribute cannot clobber */
222
+ if(oe&&("id"===t||"name"===t)&&(n in o||n in ke))return!1;
223
+ /* Allow valid data-* attributes: At least one character after "-"
224
+ (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
225
+ XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
226
+ We don't need to check the value; it's always URI safe. */if(W&&!V[t]&&Dy(B,t));else if(q&&Dy(P,t));else if(!z[t]||V[t]){if(
227
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
228
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
229
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
230
+ !(He(e)&&(H.tagNameCheck instanceof RegExp&&Dy(H.tagNameCheck,e)||H.tagNameCheck instanceof Function&&H.tagNameCheck(e))&&(H.attributeNameCheck instanceof RegExp&&Dy(H.attributeNameCheck,t)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(t))||
231
+ // Alternative, second condition checks if it's an `is`-attribute, AND
232
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
233
+ "is"===t&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&Dy(H.tagNameCheck,n)||H.tagNameCheck instanceof Function&&H.tagNameCheck(n))))return!1;
234
+ /* Check value is safe. First, is attr inert? If so, is safe */}else if(me[t]);else if(Dy(I,Ty(n,L,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Oy(n,"data:")||!ce[e])if(K&&!Dy(D,Ty(n,L,"")));else if(n)return!1;return!0},He=function(e){return"annotation-xml"!==e&&Ay(e,M)},$e=function(e){
235
+ /* Execute a hook if present */
236
+ Ue("beforeSanitizeAttributes",e,null);const{attributes:t}=e;
237
+ /* Check if we have attributes; if not we might have a text node */if(!t)return;const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:z};let r=t.length;
238
+ /* Go backwards over all attributes; safely remove bad ones */for(;r--;){const s=t[r],{name:a,namespaceURI:i,value:l}=s,d=xe(a);let c="value"===a?l:By(l);const u=c;
239
+ /* Execute a hook if present */
240
+ /* Did the hooks approve of the attribute? */
241
+ if(o.attrName=d,o.attrValue=c,o.keepAttr=!0,o.forceKeepAttr=void 0,// Allows developers to see this is a property they can set
242
+ Ue("uponSanitizeAttribute",e,o),c=o.attrValue,o.forceKeepAttr)continue;
243
+ /* Remove attribute */
244
+ /* Did the hooks approve of the attribute? */if(!o.keepAttr){De(a,e);continue}
245
+ /* Work around a security issue in jQuery 3.0 */if(!Y&&Dy(/\/>/i,c)){De(a,e);continue}
246
+ /* Sanitize attribute content to be template-safe */G&&_y([A,T,O],(e=>{c=Ty(c,e," ")}))
247
+ /* Is `value` valid for this attribute? */;const m=xe(e.nodeName);if(je(m,d,c))
248
+ /* Work around a security issue with comments inside attributes */
249
+ if(
250
+ /* Full DOM Clobbering protection via namespace isolation,
251
+ * Prefix id and name attributes with `user-content-`
252
+ */
253
+ !re||"id"!==d&&"name"!==d||(
254
+ // Remove the attribute with this value
255
+ De(a,e),
256
+ // Prefix the value and later re-create the attribute with the sanitized value
257
+ c="user-content-"+c),X&&Dy(/((--!?|])>)|<\/(style|title)/i,c))De(a,e);else{
258
+ /* Handle attributes that require Trusted Types */
259
+ if(w&&"object"==typeof g&&"function"==typeof g.getAttributeType)if(i);else switch(g.getAttributeType(m,d)){case"TrustedHTML":c=w.createHTML(c);break;case"TrustedScriptURL":c=w.createScriptURL(c)}
260
+ /* Handle invalid data-* attribute set by try-catching it */if(c!==u)try{i?e.setAttributeNS(i,a,c):
261
+ /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
262
+ e.setAttribute(a,c),Ie(e)?Pe(e):ky(n.removed)}catch(e){}}else De(a,e)}
263
+ /* Execute a hook if present */Ue("afterSanitizeAttributes",e,null)},Ve=function e(t){let n=null;const o=Me(t);
264
+ /* Execute a hook if present */for(Ue("beforeSanitizeShadowDOM",t,null);n=o.nextNode();)
265
+ /* Execute a hook if present */
266
+ Ue("uponSanitizeShadowNode",n,null),
267
+ /* Sanitize tags and elements */
268
+ ze(n)||(
269
+ /* Deep shadow DOM detected */
270
+ n.content instanceof a&&e(n.content)
271
+ /* Check attributes, sanitize if necessary */,$e(n));
272
+ /* Execute a hook if present */Ue("afterSanitizeShadowDOM",t,null)};
273
+ /**
274
+ * Sanitize
275
+ * Public method providing core sanitation functionality
276
+ *
277
+ * @param {String|Node} dirty string or DOM node
278
+ * @param {Object} cfg object
279
+ */
280
+ // eslint-disable-next-line complexity
281
+ return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=null,s=null,i=null,d=null;
282
+ /* Stringify, in case dirty is an object */
283
+ if(
284
+ /* Make sure we have a string to sanitize.
285
+ DO NOT return early, as this will return the wrong type if
286
+ the user has requested a DOM object rather than a string */
287
+ ve=!e,ve&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Fe(e)){if("function"!=typeof e.toString)throw Ly("toString is not a function");if("string"!=typeof(e=e.toString()))throw Ly("dirty is not a string, aborting")}
288
+ /* Return dirty HTML if DOMPurify cannot run */if(!n.isSupported)return e;
289
+ /* Assign config vars */if(Q||Ne(t)
290
+ /* Clean up removed elements */,n.removed=[],
291
+ /* Check if dirty is correctly typed for IN_PLACE */
292
+ "string"==typeof e&&(ae=!1),ae){
293
+ /* Do some early pre-sanitization to avoid unsafe root nodes */
294
+ if(e.nodeName){const t=xe(e.nodeName);if(!F[t]||$[t])throw Ly("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)
295
+ /* If dirty is a DOM element, append to an empty document to avoid
296
+ elements being stripped by the parser */
297
+ o=Le("\x3c!----\x3e"),s=o.ownerDocument.importNode(e,!0),1===s.nodeType&&"BODY"===s.nodeName||"HTML"===s.nodeName?
298
+ /* Node is already a body, use as is */
299
+ o=s:
300
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
301
+ o.appendChild(s);else{
302
+ /* Exit directly if we have nothing to do */
303
+ if(!ee&&!G&&!Z&&
304
+ // eslint-disable-next-line unicorn/prefer-includes
305
+ -1===e.indexOf("<"))return w&&ne?w.createHTML(e):e;
306
+ /* Initialize the document to work on */
307
+ /* Check we have a DOM node from the data */
308
+ if(o=Le(e),!o)return ee?null:ne?E:""}
309
+ /* Remove first element node (ours) if FORCE_BODY is set */o&&J&&Pe(o.firstChild)
310
+ /* Get node iterator */;const c=Me(ae?e:o);
311
+ /* Now start iterating over the created document */for(;i=c.nextNode();)
312
+ /* Sanitize tags and elements */
313
+ ze(i)||(
314
+ /* Shadow DOM detected, sanitize it */
315
+ i.content instanceof a&&Ve(i.content)
316
+ /* Check attributes, sanitize if necessary */,$e(i));
317
+ /* If we sanitized `dirty` in-place, return it. */if(ae)return e;
318
+ /* Return sanitized string or DOM */if(ee){if(te)for(d=k.call(o.ownerDocument);o.firstChild;)
319
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
320
+ d.appendChild(o.firstChild);else d=o;return(z.shadowroot||z.shadowrootmode)&&(
321
+ /*
322
+ AdoptNode() is not used because internal state is not reset
323
+ (e.g. the past names map of a HTMLFormElement), this is safe
324
+ in theory but we would rather not risk another attack vector.
325
+ The state that is cloned by importNode() is explicitly defined
326
+ by the specs.
327
+ */
328
+ d=N.call(r,d,!0)),d}let u=Z?o.outerHTML:o.innerHTML;
329
+ /* Serialize doctype if allowed */return Z&&F["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&Dy(iC,o.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+o.ownerDocument.doctype.name+">\n"+u)
330
+ /* Sanitize final string template-safe */,G&&_y([A,T,O],(e=>{u=Ty(u,e," ")})),w&&ne?w.createHTML(u):u},
331
+ /**
332
+ * Public method to set the configuration once
333
+ * setConfig
334
+ *
335
+ * @param {Object} cfg configuration object
336
+ */
337
+ n.setConfig=function(){Ne(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Q=!0},
338
+ /**
339
+ * Public method to remove the configuration
340
+ * clearConfig
341
+ *
342
+ */
343
+ n.clearConfig=function(){_e=null,Q=!1},
344
+ /**
345
+ * Public method to check if an attribute value is valid.
346
+ * Uses last set config, if any. Otherwise, uses config defaults.
347
+ * isValidAttribute
348
+ *
349
+ * @param {String} tag Tag name of containing element.
350
+ * @param {String} attr Attribute name.
351
+ * @param {String} value Attribute value.
352
+ * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
353
+ */
354
+ n.isValidAttribute=function(e,t,n){
355
+ /* Initialize shared config vars if necessary. */
356
+ _e||Ne({});const o=xe(e),r=xe(t);return je(o,r,n)},
357
+ /**
358
+ * AddHook
359
+ * Public method to add DOMPurify hooks
360
+ *
361
+ * @param {String} entryPoint entry point for the hook to add
362
+ * @param {Function} hookFunction function to execute
363
+ */
364
+ n.addHook=function(e,t){"function"==typeof t&&(R[e]=R[e]||[],Sy(R[e],t))},
365
+ /**
366
+ * RemoveHook
367
+ * Public method to remove a DOMPurify hook at a given entryPoint
368
+ * (pops it from the stack of hooks if more are present)
369
+ *
370
+ * @param {String} entryPoint entry point for the hook to remove
371
+ * @return {Function} removed(popped) hook
372
+ */
373
+ n.removeHook=function(e){if(R[e])return ky(R[e])},
374
+ /**
375
+ * RemoveHooks
376
+ * Public method to remove all DOMPurify hooks at a given entryPoint
377
+ *
378
+ * @param {String} entryPoint entry point for the hooks to remove
379
+ */
380
+ n.removeHooks=function(e){R[e]&&(R[e]=[])},
381
+ /**
382
+ * RemoveAllHooks
383
+ * Public method to remove all DOMPurify hooks
384
+ */
385
+ n.removeAllHooks=function(){R={}},n}();const mC=Dt.each,fC=Dt.trim,gC=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],pC={ftp:21,http:80,https:443,mailto:25},hC=["img","video"],bC=(e,t,n)=>{const o=(e=>{try{return decodeURIComponent(e)}catch(t){return unescape(e)}})(t).replace(/\s/g,"");return!e.allow_script_urls&&(!!/((java|vb)script|mhtml):/i.test(o)||!e.allow_html_data_urls&&(/^data:image\//i.test(o)?((e,t)=>C(e)?!e:!C(t)||!H(hC,t))(e.allow_svg_data_urls,n)&&/^data:image\/svg\+xml/i.test(o):/^data:/i.test(o)))};class vC{static parseDataUri(e){let t;const n=decodeURIComponent(e).split(","),o=/data:([^;]+)/.exec(n[0]);return o&&(t=o[1]),{type:t,data:n[1]}}static isDomSafe(e,t,n={}){if(n.allow_script_urls)return!0;{const o=Cs.decode(e).replace(/[\s\u0000-\u001F]+/g,"");return!bC(n,o,t)}}static getDocumentBaseUrl(e){var t;let n;return n=0!==e.protocol.indexOf("http")&&"file:"!==e.protocol?null!==(t=e.href)&&void 0!==t?t:"":e.protocol+"//"+e.host+e.pathname,/^[^:]+:\/\/\/?[^\/]+\//.test(n)&&(n=n.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(n)||(n+="/")),n}constructor(e,t={}){this.path="",this.directory="",e=fC(e),this.settings=t;const n=t.base_uri,o=this;if(/^([\w\-]+):([^\/]{2})/i.test(e)||/^\s*#/.test(e))return void(o.source=e);const r=0===e.indexOf("//");if(0!==e.indexOf("/")||r||(e=(n&&n.protocol||"http")+"://mce_host"+e),!/^[\w\-]*:?\/\//.test(e)){const t=n?n.path:new vC(document.location.href).directory;if(""===(null==n?void 0:n.protocol))e="//mce_host"+o.toAbsPath(t,e);else{const r=/([^#?]*)([#?]?.*)/.exec(e);r&&(e=(n&&n.protocol||"http")+"://mce_host"+o.toAbsPath(t,r[1])+r[2])}}e=e.replace(/@@/g,"(mce_at)");const s=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?(\[[a-zA-Z0-9:.%]+\]|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);s&&mC(gC,((e,t)=>{let n=s[t];n&&(n=n.replace(/\(mce_at\)/g,"@@")),o[e]=n})),n&&(o.protocol||(o.protocol=n.protocol),o.userInfo||(o.userInfo=n.userInfo),o.port||"mce_host"!==o.host||(o.port=n.port),o.host&&"mce_host"!==o.host||(o.host=n.host),o.source=""),r&&(o.protocol="")}setPath(e){const t=/^(.*?)\/?(\w+)?$/.exec(e);t&&(this.path=t[0],this.directory=t[1],this.file=t[2]),this.source="",this.getURI()}toRelative(e){if("./"===e)return e;const t=new vC(e,{base_uri:this});if("mce_host"!==t.host&&this.host!==t.host&&t.host||this.port!==t.port||this.protocol!==t.protocol&&""!==t.protocol)return t.getURI();const n=this.getURI(),o=t.getURI();if(n===o||"/"===n.charAt(n.length-1)&&n.substr(0,n.length-1)===o)return n;let r=this.toRelPath(this.path,t.path);return t.query&&(r+="?"+t.query),t.anchor&&(r+="#"+t.anchor),r}toAbsolute(e,t){const n=new vC(e,{base_uri:this});return n.getURI(t&&this.isSameOrigin(n))}isSameOrigin(e){if(this.host==e.host&&this.protocol==e.protocol){if(this.port==e.port)return!0;const t=this.protocol?pC[this.protocol]:null;if(t&&(this.port||t)==(e.port||t))return!0}return!1}toRelPath(e,t){let n,o,r=0,s="";const a=e.substring(0,e.lastIndexOf("/")).split("/"),i=t.split("/");if(a.length>=i.length)for(n=0,o=a.length;n<o;n++)if(n>=i.length||a[n]!==i[n]){r=n+1;break}if(a.length<i.length)for(n=0,o=i.length;n<o;n++)if(n>=a.length||a[n]!==i[n]){r=n+1;break}if(1===r)return t;for(n=0,o=a.length-(r-1);n<o;n++)s+="../";for(n=r-1,o=i.length;n<o;n++)s+=n!==r-1?"/"+i[n]:i[n];return s}toAbsPath(e,t){let n=0;const o=/\/$/.test(t)?"/":"",r=e.split("/"),s=t.split("/"),a=[];mC(r,(e=>{e&&a.push(e)}));const i=[];for(let e=s.length-1;e>=0;e--)0!==s[e].length&&"."!==s[e]&&(".."!==s[e]?n>0?n--:i.push(s[e]):n++);const l=a.length-n;let d;return d=l<=0?oe(i).join("/"):a.slice(0,l).join("/")+"/"+oe(i).join("/"),0!==d.indexOf("/")&&(d="/"+d),o&&d.lastIndexOf("/")!==d.length-1&&(d+=o),d}getURI(e=!1){let t;return this.source&&!e||(t="",e||(this.protocol?t+=this.protocol+"://":t+="//",this.userInfo&&(t+=this.userInfo+"@"),this.host&&(t+=this.host),this.port&&(t+=":"+this.port)),this.path&&(t+=this.path),this.query&&(t+="?"+this.query),this.anchor&&(t+="#"+this.anchor),this.source=t),this.source}}const yC=Dt.makeMap("src,href,data,background,action,formaction,poster,xlink:href"),CC="data-mce-type";let wC=0;const EC=(e,t,n,o,r)=>{var s,a,i,l;const d=t.validate,c=n.getSpecialElements();8===e.nodeType&&!t.allow_conditional_comments&&/^\[if/i.test(null!==(s=e.nodeValue)&&void 0!==s?s:"")&&(e.nodeValue=" "+e.nodeValue);const u=null!==(a=null==r?void 0:r.tagName)&&void 0!==a?a:e.nodeName.toLowerCase();if("html"!==o&&n.isValid(o))return void(C(r)&&(r.allowedTags[u]=!0));if(1!==e.nodeType||"body"===u)return;const f=Cn(e),g=on(f,CC),p=tn(f,"data-mce-bogus");if(!g&&m(p))return void("all"===p?Eo(f):xo(f));const h=n.getElementRule(u);if(!d||h){if(C(r)&&(r.allowedTags[u]=!0),d&&h&&!g){if(q(null!==(i=h.attributesForced)&&void 0!==i?i:[],(e=>{Jt(f,e.name,"{$uid}"===e.value?"mce_"+wC++:e.value)})),q(null!==(l=h.attributesDefault)&&void 0!==l?l:[],(e=>{on(f,e.name)||Jt(f,e.name,"{$uid}"===e.value?"mce_"+wC++:e.value)})),h.attributesRequired&&!$(h.attributesRequired,(e=>on(f,e))))return void xo(f);if(h.removeEmptyAttrs&&(e=>{const t=e.dom.attributes;return null==t||0===t.length})(f))return void xo(f);h.outputName&&h.outputName!==u&&((e,t)=>{const n=((e,t)=>{const n=vn(t),o=sn(e);return en(n,o),n})(e,t);ho(e,n);const o=In(e);Co(n,o),Eo(e)})(f,h.outputName)}}else _e(c,u)?Eo(f):xo(f)},xC=(e,t,n,o,r,s)=>"html"!==n&&!Lr(o)||!(r in yC&&bC(e,s,o))&&(!e.validate||t.isValid(o,r)||$e(r,"data-")||$e(r,"aria-")),_C=(e,t)=>e.hasAttribute(CC)&&("id"===t||"class"===t||"style"===t),kC=(e,t)=>e in t.getBoolAttrs(),SC=(e,t,n,o)=>{const{attributes:r}=e;for(let s=r.length-1;s>=0;s--){const a=r[s],i=a.name,l=a.value;xC(t,n,o,e.tagName.toLowerCase(),i,l)||_C(e,i)?kC(i,n)&&e.setAttribute(i,i):e.removeAttribute(i)}},NC=(e,t,n)=>{const o=uC();return o.addHook("uponSanitizeElement",((o,r)=>{EC(o,e,t,n.track(o),r)})),o.addHook("uponSanitizeAttribute",((o,r)=>{((e,t,n,o,r)=>{const s=e.tagName.toLowerCase(),{attrName:a,attrValue:i}=r;r.keepAttr=xC(t,n,o,s,a,i),r.keepAttr?(r.allowedAttributes[a]=!0,kC(a,n)&&(r.attrValue=a),t.allow_svg_data_urls&&$e(i,"data:image/svg+xml")&&(r.forceKeepAttr=!0)):_C(e,a)&&(r.forceKeepAttr=!0)})(o,e,t,n.current(),r)})),o},RC=e=>t=>{const n=Ir(t);if("svg"===n)(e=>{const t=["type","href","role","arcrole","title","show","actuate","label","from","to"].map((e=>`xlink:${e}`)),n={IN_PLACE:!0,USE_PROFILES:{html:!0,svg:!0,svgFilters:!0},ALLOWED_ATTR:t};uC().sanitize(e,n)})(t);else{if("math"!==n)throw new Error("Not a namespace element");((e,t)=>{const n=uC();n.addHook("uponSanitizeElement",((e,n)=>{var o;const r=null!==(o=n.tagName)&&void 0!==o?o:e.nodeName.toLowerCase(),s=t.allow_mathml_annotation_encodings;if("annotation"===r&&p(s)&&s.length>0){const t=e.getAttribute("encoding");m(t)&&H(s,t)&&(n.allowedTags[r]=!0)}})),n.sanitize(e,{IN_PLACE:!0,USE_PROFILES:{mathMl:!0}})})(t,e)}},AC=Dt.makeMap,TC=Dt.extend,OC=(e,t,n,o)=>{const r=e.name,s=r in n&&"title"!==r&&"textarea"!==r&&"noscript"!==r,a=t.childNodes;for(let t=0,r=a.length;t<r;t++){const r=a[t],i=new tp(r.nodeName.toLowerCase(),r.nodeType);if(Jo(r)){const e=r.attributes;for(let t=0,n=e.length;t<n;t++){const n=e[t];i.attr(n.name,n.value)}Lr(i.name)&&(o(r),i.value=r.innerHTML)}else lr(r)?(i.value=r.data,s&&(i.raw=!0)):(ur(r)||dr(r)||cr(r))&&(i.value=r.data);Lr(i.name)||OC(i,r,n,o),e.append(i)}},BC=(e={},t=Is())=>{const n=ty(),o=ty(),r={validate:!0,root_name:"body",sanitize:!0,...e},s=new DOMParser,a=((e,t)=>{const n=(()=>{const e=Pr(),t=()=>e.get().map(Ir).getOr("html");return{track:n=>(Mr(n)?e.set(n):e.get().exists((e=>!e.contains(n)))&&e.clear(),t()),current:t,reset:()=>{e.clear()}}})();if(e.sanitize){const o=NC(e,t,n),r=(t,r)=>{o.sanitize(t,((e,t)=>{const n={IN_PLACE:!0,ALLOW_UNKNOWN_PROTOCOLS:!0,ALLOWED_TAGS:["#comment","#cdata-section","body"],ALLOWED_ATTR:[],SAFE_FOR_XML:!1};return n.PARSER_MEDIA_TYPE=t,e.allow_script_urls?n.ALLOWED_URI_REGEXP=/.*/:e.allow_html_data_urls&&(n.ALLOWED_URI_REGEXP=/^(?!(\w+script|mhtml):)/i),n})(e,r)),o.removed=[],n.reset()};return{sanitizeHtmlElement:r,sanitizeNamespaceElement:RC(e)}}return{sanitizeHtmlElement:(o,r)=>{const s=document.createNodeIterator(o,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_TEXT);let a;for(;a=s.nextNode();){const o=n.track(a);EC(a,e,t,o),Jo(a)&&SC(a,e,t,o)}n.reset()},sanitizeNamespaceElement:_}})(r,t),i=n.addFilter,l=n.getFilters,d=n.removeFilter,c=o.addFilter,u=o.getFilters,f=o.removeFilter,g=(e,n)=>{const o=m(n.attr(CC)),r=1===n.type&&!_e(e,n.name)&&!Qr(t,n)&&!Lr(n.name);return 3===n.type||r&&!o},p={schema:t,addAttributeFilter:c,getAttributeFilters:u,removeAttributeFilter:f,addNodeFilter:i,getNodeFilters:l,removeNodeFilter:d,parse:(e,n={})=>{var o;const i=r.validate,d=null!==(o=n.context)&&void 0!==o?o:r.root_name,c=((e,n,o="html")=>{const r="xhtml"===o?"application/xhtml+xml":"text/html",i=_e(t.getSpecialElements(),n.toLowerCase()),l=i?`<${n}>${e}</${n}>`:e,d=s.parseFromString("xhtml"===o?`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>${l}</body></html>`:/^[\s]*<head/i.test(e)||/^[\s]*<html/i.test(e)||/^[\s]*<!DOCTYPE/i.test(e)?`<html>${l}</html>`:`<body>${l}</body>`,r).body;return a.sanitizeHtmlElement(d,r),i?d.firstChild:d})(e,d,n.format);qr(t,c);const m=new tp(d,11);OC(m,c,t.getSpecialElements(),a.sanitizeNamespaceElement),c.innerHTML="";const[f,p]=((e,t,n,o)=>{const r=n.validate,s=t.getNonEmptyElements(),a=t.getWhitespaceElements(),i=TC(AC("script,style,head,html,body,title,meta,param"),t.getBlockElements()),l=Ls(t),d=/[ \t\r\n]+/g,c=/^[ \t\r\n]+/,u=/[ \t\r\n]+$/,m=e=>{let t=e.parent;for(;C(t);){if(t.name in a)return!0;t=t.parent}return!1},f=n=>n.name in i||Qr(t,n)||Lr(n.name)&&n.parent===e,g=(t,n)=>{const r=n?t.prev:t.next;return!C(r)&&!y(t.parent)&&f(t.parent)&&(t.parent!==e||!0===o.isRootContent)};return[e=>{var t;if(3===e.type&&!m(e)){let n=null!==(t=e.value)&&void 0!==t?t:"";n=n.replace(d," "),(((e,t)=>C(e)&&(t(e)||"br"===e.name))(e.prev,f)||g(e,!0))&&(n=n.replace(c,"")),0===n.length||" "===n&&e.prev&&8===e.prev.type&&e.next&&8===e.next.type?e.remove():e.value=n}},e=>{var i;if(1===e.type){const i=t.getElementRule(e.name);if(r&&i){const r=Nb(t,s,a,e);i.paddInEmptyBlock&&r&&(e=>{let n=e;for(;C(n);){if(n.name in l)return Nb(t,s,a,n);n=n.parent}return!1})(e)?kb(n,o,f,e):i.removeEmpty&&r?f(e)?e.remove():e.unwrap():i.paddEmpty&&(r||(e=>{var t;return Sb(e,"#text")&&(null===(t=null==e?void 0:e.firstChild)||void 0===t?void 0:t.value)===qo})(e))&&kb(n,o,f,e)}}else if(3===e.type&&!m(e)){let t=null!==(i=e.value)&&void 0!==i?i:"";(e.next&&f(e.next)||g(e,!1))&&(t=t.replace(u,"")),0===t.length?e.remove():e.value=t}}]})(m,t,r,n),h=[],b=i?e=>((e,n)=>{Ob(t,e)&&n.push(e)})(e,h):_,v={nodes:{},attributes:{}},w=e=>Eb(l(),u(),e,v);if(((e,t,n)=>{const o=[];for(let n=e,r=n;n;r=n,n=n.walk()){const s=n;q(t,(e=>e(s))),y(s.parent)&&s!==e?n=r:o.push(s)}for(let e=o.length-1;e>=0;e--){const t=o[e];q(n,(e=>e(t)))}})(m,[f,w],[p,b]),h.reverse(),i&&h.length>0)if(n.context){const{pass:e,fail:o}=K(h,(e=>e.parent===m));Tb(o,t,m,w),n.invalid=e.length>0}else Tb(h,t,m,w);const E=((e,t)=>{var n;const o=null!==(n=t.forced_root_block)&&void 0!==n?n:e.forced_root_block;return!1===o?"":!0===o?"p":o})(r,n);return E&&("body"===m.name||n.isRootContent)&&((e,n)=>{const o=TC(AC("script,style,head,html,body,title,meta,param"),t.getBlockElements()),s=/^[ \t\r\n]+/,a=/[ \t\r\n]+$/;let i=e.firstChild,l=null;const d=e=>{var t,n;e&&(i=e.firstChild,i&&3===i.type&&(i.value=null===(t=i.value)||void 0===t?void 0:t.replace(s,"")),i=e.lastChild,i&&3===i.type&&(i.value=null===(n=i.value)||void 0===n?void 0:n.replace(a,"")))};if(t.isValidChild(e.name,n.toLowerCase())){for(;i;){const t=i.next;g(o,i)?(l||(l=new tp(n,1),l.attr(r.forced_root_block_attrs),e.insert(l,i)),l.append(i)):(d(l),l=null),i=t}d(l)}})(m,E),n.invalid||xb(v,n),m}};return((e,t)=>{var n,o;const r=e.schema;e.addAttributeFilter("href",(e=>{let n=e.length;const o=e=>{const t=e?Dt.trim(e):"";return/\b(noopener)\b/g.test(t)?t:(e=>e.split(" ").filter((e=>e.length>0)).concat(["noopener"]).sort().join(" "))(t)};if(!t.allow_unsafe_link_target)for(;n--;){const t=e[n];"a"===t.name&&"_blank"===t.attr("target")&&t.attr("rel",o(t.attr("rel")))}})),t.allow_html_in_named_anchor||e.addAttributeFilter("id,name",(e=>{let t,n,o,r,s=e.length;for(;s--;)if(r=e[s],"a"===r.name&&r.firstChild&&!r.attr("href"))for(o=r.parent,t=r.lastChild;t&&o;)n=t.prev,o.insert(t,r),t=n})),t.fix_list_elements&&e.addNodeFilter("ul,ol",(e=>{let t,n,o=e.length;for(;o--;)if(t=e[o],n=t.parent,n&&("ul"===n.name||"ol"===n.name))if(t.prev&&"li"===t.prev.name)t.prev.append(t);else{const e=new tp("li",1);e.attr("style","list-style-type: none"),t.wrap(e)}}));const s=r.getValidClasses();t.validate&&s&&e.addAttributeFilter("class",(e=>{var t;let n=e.length;for(;n--;){const o=e[n],r=null!==(t=o.attr("class"))&&void 0!==t?t:"",a=Dt.explode(r," ");let i="";for(let e=0;e<a.length;e++){const t=a[e];let n=!1,r=s["*"];r&&r[t]&&(n=!0),r=s[o.name],!n&&r&&r[t]&&(n=!0),n&&(i&&(i+=" "),i+=t)}i.length||(i=null),o.attr("class",i)}})),((e,t)=>{const{blob_cache:n}=t;if(n){const t=e=>{const t=e.attr("src");(e=>e.attr("src")===Tt.transparentSrc||C(e.attr("data-mce-placeholder")))(e)||(e=>C(e.attr("data-mce-bogus")))(e)||y(t)||dy(n,t,!0).each((t=>{e.attr("src",t.blobUri())}))};e.addAttributeFilter("src",(e=>q(e,t)))}})(e,t);const a=null!==(n=t.sandbox_iframes)&&void 0!==n&&n,i=me(null!==(o=t.sandbox_iframes_exclusions)&&void 0!==o?o:[]);t.convert_unsafe_embeds&&e.addNodeFilter("object,embed",(e=>q(e,(e=>{e.replace((({type:e,src:t,width:n,height:o}={},r,s)=>{const a=(e=>v(e)?"iframe":fy(e,"image")?"img":fy(e,"video")?"video":fy(e,"audio")?"audio":"iframe")(e),i=new tp(a,1);return i.attr("audio"===a?{src:t}:{src:t,width:n,height:o}),"audio"!==a&&"video"!==a||i.attr("controls",""),"iframe"===a&&r&&my(i,s),i})({type:e.attr("type"),src:"object"===e.name?e.attr("data"):e.attr("src"),width:e.attr("width"),height:e.attr("height")},a,i))})))),a&&e.addNodeFilter("iframe",(e=>q(e,(e=>my(e,i)))))})(p,r),((e,t,n)=>{t.inline_styles&&ny(e,t,n)})(p,r,t),p},PC=(e,t,n)=>{const o=(e=>jb(e)?Cp({validate:!1}).serialize(e):e)(e),r=t(o);if(r.isDefaultPrevented())return r;if(jb(e)){if(r.content!==o){const t=BC({validate:!1,forced_root_block:!1,...n}).parse(r.content,{context:e.name});return{...r,content:t}}return{...r,content:e}}return r},DC=e=>({sanitize:Ac(e),sandbox_iframes:Lc(e),sandbox_iframes_exclusions:Mc(e)}),LC=(e,t)=>{if(t.no_events)return xl.value(t);{const n=((e,t)=>e.dispatch("BeforeGetContent",t))(e,t);return n.isDefaultPrevented()?xl.error(Ml(e,{content:"",...n}).content):xl.value(n)}},MC=(e,t,n)=>{if(n.no_events)return t;{const o=PC(t,(t=>Ml(e,{...n,content:t})),DC(e));return o.content}},IC=(e,t)=>{if(t.no_events)return xl.value(t);{const n=PC(t.content,(n=>((e,t)=>e.dispatch("BeforeSetContent",t))(e,{...t,content:n})),DC(e));return n.isDefaultPrevented()?(Ll(e,n),xl.error(void 0)):xl.value(n)}},FC=(e,t,n)=>{n.no_events||Ll(e,{...n,content:t})},UC=(e,t,n)=>({element:e,width:t,rows:n}),zC=(e,t)=>({element:e,cells:t}),jC=(e,t)=>({x:e,y:t}),HC=(e,t)=>nn(e,t).bind(Ze).getOr(1),$C=(e,t,n)=>{const o=e.rows;return!!(o[n]?o[n].cells:[])[t]},VC=e=>X(e,((e,t)=>t.cells.length>e?t.cells.length:e),0),qC=(e,t)=>{const n=e.rows;for(let e=0;e<n.length;e++){const o=n[e].cells;for(let n=0;n<o.length;n++)if(kn(o[n],t))return I.some(jC(n,e))}return I.none()},WC=(e,t,n,o,r)=>{const s=[],a=e.rows;for(let e=n;e<=r;e++){const n=a[e].cells,r=t<o?n.slice(t,o+1):n.slice(o,t+1);s.push(zC(a[e].element,r))}return s},KC=e=>((e,t)=>{const n=Ma(e.element),o=vn("tbody");return Co(o,t),vo(n,o),n})(e,(e=>V(e.rows,(e=>{const t=V(e.cells,(e=>{const t=Ia(e);return rn(t,"colspan"),rn(t,"rowspan"),t})),n=Ma(e.element);return Co(n,t),n})))(e)),YC=(e,t,n)=>{const o=Cn(t.commonAncestorContainer),r=Hp(o,e),s=Y(r,(e=>n.isWrapper($t(e)))),a=((e,t)=>Q(e,(e=>"li"===$t(e)&&_m(e,t))).fold(N([]),(t=>(e=>Q(e,(e=>"ul"===$t(e)||"ol"===$t(e))))(e).map((e=>{const t=vn($t(e)),n=Ce(fo(e),((e,t)=>$e(t,"list-style")));return lo(t,n),[vn("li"),t]})).getOr([]))))(r,t),i=s.concat(a.length?a:(e=>Ka(e)?Tn(e).filter(Wa).fold(N([]),(t=>[e,t])):Wa(e)?[e]:[])(o));return V(i,Ma)},GC=()=>ug([]),XC=(e,t)=>((e,t)=>Jn(t,"table",T(kn,e)))(e,t[0]).bind((e=>{const n=t[0],o=t[t.length-1],r=(e=>{const t=UC(Ma(e),0,[]);return q(Uo(e,"tr"),((e,n)=>{q(Uo(e,"td,th"),((o,r)=>{((e,t,n,o,r)=>{const s=HC(r,"rowspan"),a=HC(r,"colspan"),i=e.rows;for(let e=n;e<n+s;e++){i[e]||(i[e]=zC(Ia(o),[]));for(let o=t;o<t+a;o++)i[e].cells[o]=e===n&&o===t?r:Ma(r)}})(t,((e,t,n)=>{for(;$C(e,t,n);)t++;return t})(t,r,n),n,e,o)}))})),UC(t.element,VC(t.rows),t.rows)})(e);return((e,t,n)=>qC(e,t).bind((t=>qC(e,n).map((n=>((e,t,n)=>{const o=t.x,r=t.y,s=n.x,a=n.y,i=r<a?WC(e,o,r,s,a):WC(e,o,a,s,r);return UC(e.element,VC(i),i)})(e,t,n))))))(r,n,o).map((e=>ug([KC(e)])))})).getOrThunk(GC),ZC=(e,t,n)=>{const o=ym(t,e);return o.length>0?XC(e,o):((e,t,n)=>t.length>0&&t[0].collapsed?GC():((e,t,n)=>((e,t)=>{const n=X(t,((e,t)=>(vo(t,e),t)),e);return t.length>0?ug([n]):n})(Cn(t.cloneContents()),YC(e,t,n)))(e,t[0],n))(e,t,n)},QC=(e,t)=>t>=0&&t<e.length&&hm(e.charAt(t)),JC=e=>ti(e.innerText),ew=e=>Jo(e)?e.outerHTML:lr(e)?Cs.encodeRaw(e.data,!1):ur(e)?"\x3c!--"+e.data+"--\x3e":"",tw=(e,t)=>(((e,t)=>{let n=0;q(e,(e=>{0===e[0]?n++:1===e[0]?(((e,t,n)=>{const o=(e=>{let t;const n=document.createElement("div"),o=document.createDocumentFragment();for(e&&(n.innerHTML=e);t=n.firstChild;)o.appendChild(t);return o})(t);if(e.hasChildNodes()&&n<e.childNodes.length){const t=e.childNodes[n];e.insertBefore(o,t)}else e.appendChild(o)})(t,e[1],n),n++):2===e[0]&&((e,t)=>{if(e.hasChildNodes()&&t<e.childNodes.length){const n=e.childNodes[t];e.removeChild(n)}})(t,n)}))})(((e,t)=>{const n=e.length+t.length+2,o=new Array(n),r=new Array(n),s=(n,o,r,a,l)=>{const d=i(n,o,r,a);if(null===d||d.start===o&&d.diag===o-a||d.end===n&&d.diag===n-r){let s=n,i=r;for(;s<o||i<a;)s<o&&i<a&&e[s]===t[i]?(l.push([0,e[s]]),++s,++i):o-n>a-r?(l.push([2,e[s]]),++s):(l.push([1,t[i]]),++i)}else{s(n,d.start,r,d.start-d.diag,l);for(let t=d.start;t<d.end;++t)l.push([0,e[t]]);s(d.end,o,d.end-d.diag,a,l)}},a=(n,o,r,s)=>{let a=n;for(;a-o<s&&a<r&&e[a]===t[a-o];)++a;return((e,t,n)=>({start:e,end:t,diag:n}))(n,a,o)},i=(n,s,i,l)=>{const d=s-n,c=l-i;if(0===d||0===c)return null;const u=d-c,m=c+d,f=(m%2==0?m:m+1)/2;let g,p,h,b,v;for(o[1+f]=n,r[1+f]=s+1,g=0;g<=f;++g){for(p=-g;p<=g;p+=2){for(h=p+f,p===-g||p!==g&&o[h-1]<o[h+1]?o[h]=o[h+1]:o[h]=o[h-1]+1,b=o[h],v=b-n+i-p;b<s&&v<l&&e[b]===t[v];)o[h]=++b,++v;if(u%2!=0&&u-g<=p&&p<=u+g&&r[h-u]<=o[h])return a(r[h-u],p+n-i,s,l)}for(p=u-g;p<=u+g;p+=2){for(h=p+f-u,p===u-g||p!==u+g&&r[h+1]<=r[h-1]?r[h]=r[h+1]-1:r[h]=r[h-1],b=r[h]-1,v=b-n+i-p;b>=n&&v>=i&&e[b]===t[v];)r[h]=b--,v--;if(u%2==0&&-g<=p&&p<=g&&r[h]<=o[h+u])return a(r[h],p+n-i,s,l)}}return null},l=[];return s(0,e.length,0,t.length,l),l})(V(ce(t.childNodes),ew),e),t),t),nw=Le((()=>document.implementation.createHTMLDocument("undo"))),ow=e=>{const t=e.serializer.getTempAttrs(),n=gp(e.getBody(),t);return(e=>null!==e.querySelector("iframe"))(n)?{type:"fragmented",fragments:Y(V(ce(n.childNodes),k(ti,ew)),(e=>e.length>0)),content:"",bookmark:null,beforeBookmark:null}:{type:"complete",fragments:null,content:ti(n.innerHTML),bookmark:null,beforeBookmark:null}},rw=(e,t,n)=>{const o=n?t.beforeBookmark:t.bookmark;"fragmented"===t.type?tw(t.fragments,e.getBody()):e.setContent(t.content,{format:"raw",no_selection:!C(o)||!om(o)||!o.isFakeCaret}),o&&(e.selection.moveToBookmark(o),e.selection.scrollIntoView())},sw=e=>"fragmented"===e.type?e.fragments.join(""):e.content,aw=e=>{const t=vn("body",nw());return So(t,sw(e)),q(Uo(t,"*[data-mce-bogus]"),xo),ko(t)},iw=(e,t)=>!(!e||!t)&&(!!((e,t)=>sw(e)===sw(t))(e,t)||((e,t)=>aw(e)===aw(t))(e,t)),lw=e=>0===e.get(),dw=(e,t,n)=>{lw(n)&&(e.typing=t)},cw=(e,t)=>{e.typing&&(dw(e,!1,t),e.add())},uw=e=>({init:{bindEvents:_},undoManager:{beforeChange:(t,n)=>((e,t,n)=>{lw(t)&&n.set(Cl(e.selection))})(e,t,n),add:(t,n,o,r,s,a)=>((e,t,n,o,r,s,a)=>{const i=ow(e),l=Dt.extend(s||{},i);if(!lw(o)||e.removed)return null;const d=t.data[n.get()];if(e.dispatch("BeforeAddUndo",{level:l,lastLevel:d,originalEvent:a}).isDefaultPrevented())return null;if(d&&iw(d,l))return null;t.data[n.get()]&&r.get().each((e=>{t.data[n.get()].beforeBookmark=e}));const c=Wd(e);if(c&&t.data.length>c){for(let e=0;e<t.data.length-1;e++)t.data[e]=t.data[e+1];t.data.length--,n.set(t.data.length)}l.bookmark=Cl(e.selection),n.get()<t.data.length-1&&(t.data.length=n.get()+1),t.data.push(l),n.set(t.data.length-1);const u={level:l,lastLevel:d,originalEvent:a};return n.get()>0?(e.setDirty(!0),e.dispatch("AddUndo",u),e.dispatch("change",u)):e.dispatch("AddUndo",u),l})(e,t,n,o,r,s,a),undo:(t,n,o)=>((e,t,n,o)=>{let r;return t.typing&&(t.add(),t.typing=!1,dw(t,!1,n)),o.get()>0&&(o.set(o.get()-1),r=t.data[o.get()],rw(e,r,!0),e.setDirty(!0),e.dispatch("Undo",{level:r})),r})(e,t,n,o),redo:(t,n)=>((e,t,n)=>{let o;return t.get()<n.length-1&&(t.set(t.get()+1),o=n[t.get()],rw(e,o,!1),e.setDirty(!0),e.dispatch("Redo",{level:o})),o})(e,t,n),clear:(t,n)=>((e,t,n)=>{t.data=[],n.set(0),t.typing=!1,e.dispatch("ClearUndos")})(e,t,n),reset:e=>(e=>{e.clear(),e.add()})(e),hasUndo:(t,n)=>((e,t,n)=>n.get()>0||t.typing&&t.data[0]&&!iw(ow(e),t.data[0]))(e,t,n),hasRedo:(e,t)=>((e,t)=>t.get()<e.data.length-1&&!e.typing)(e,t),transact:(e,t,n)=>((e,t,n)=>(cw(e,t),e.beforeChange(),e.ignore(n),e.add()))(e,t,n),ignore:(e,t)=>((e,t)=>{try{e.set(e.get()+1),t()}finally{e.set(e.get()-1)}})(e,t),extra:(t,n,o,r)=>((e,t,n,o,r)=>{if(t.transact(o)){const o=t.data[n.get()].bookmark,s=t.data[n.get()-1];rw(e,s,!0),t.transact(r)&&(t.data[n.get()-1].beforeBookmark=o)}})(e,t,n,o,r)},formatter:{match:(t,n,o,r)=>Zb(e,t,n,o,r),matchAll:(t,n)=>((e,t,n)=>{const o=[],r={},s=e.selection.getStart();return e.dom.getParent(s,(s=>{for(let a=0;a<t.length;a++){const i=t[a];!r[i]&&Xb(e,s,i,n)&&(r[i]=!0,o.push(i))}}),e.dom.getRoot()),o})(e,t,n),matchNode:(t,n,o,r)=>Xb(e,t,n,o,r),canApply:t=>((e,t)=>{const n=e.formatter.get(t),o=e.dom;if(n&&e.selection.isEditable()){const t=e.selection.getStart(),r=$m(o,t);for(let e=n.length-1;e>=0;e--){const t=n[e];if(!Wm(t))return!0;for(let e=r.length-1;e>=0;e--)if(o.is(r[e],t.selector))return!0}}return!1})(e,t),closest:t=>((e,t)=>{const n=t=>kn(t,Cn(e.getBody()));return I.from(e.selection.getStart(!0)).bind((o=>Vb(Cn(o),(n=>ue(t,(t=>((t,n)=>Xb(e,t.dom,n)?I.some(n):I.none())(n,t)))),n))).getOrNull()})(e,t),apply:(t,n,o)=>Yv(e,t,n,o),remove:(t,n,o,r)=>Hv(e,t,n,o,r),toggle:(t,n,o)=>((e,t,n,o)=>{const r=e.formatter.get(t);r&&(!Zb(e,t,n,o)||"toggle"in r[0]&&!r[0].toggle?Yv(e,t,n,o):Hv(e,t,n,o))})(e,t,n,o),formatChanged:(t,n,o,r,s)=>((e,t,n,o,r,s)=>(((e,t,n,o,r,s)=>{const a=t.get();q(n.split(","),(t=>{const n=xe(a,t).getOrThunk((()=>{const e={withSimilar:{state:Or(!1),similar:!0,callbacks:[]},withoutSimilar:{state:Or(!1),similar:!1,callbacks:[]},withVars:[]};return a[t]=e,e})),i=()=>{const n=Qv(e);return Zv(e,n,t,r,s).isSome()};if(v(s)){const e=r?n.withSimilar:n.withoutSimilar;e.callbacks.push(o),1===e.callbacks.length&&e.state.set(i())}else n.withVars.push({state:Or(i()),similar:r,vars:s,callback:o})})),t.set(a)})(e,t,n,o,r,s),{unbind:()=>((e,t,n)=>{const o=e.get();q(t.split(","),(e=>xe(o,e).each((t=>{o[e]={withSimilar:{...t.withSimilar,callbacks:Y(t.withSimilar.callbacks,(e=>e!==n))},withoutSimilar:{...t.withoutSimilar,callbacks:Y(t.withoutSimilar.callbacks,(e=>e!==n))},withVars:Y(t.withVars,(e=>e.callback!==n))}})))),e.set(o)})(t,n,o)}))(e,t,n,o,r,s)},editor:{getContent:t=>((e,t)=>I.from(e.getBody()).fold(N("tree"===t.format?new tp("body",11):""),(n=>bp(e,t,n))))(e,t),setContent:(t,n)=>((e,t,n)=>I.from(e.getBody()).map((o=>jb(t)?((e,t,n,o)=>{_b(e.parser.getNodeFilters(),e.parser.getAttributeFilters(),n);const r=Cp({validate:!1},e.schema).serialize(n),s=ti(Xa(Cn(t))?r:Dt.trim(r));return Hb(e,s,o.no_selection),{content:n,html:s}})(e,o,t,n):((e,t,n,o)=>{if(0===(n=ti(n)).length||/^\s+$/.test(n)){const r='<br data-mce-bogus="1">';"TABLE"===t.nodeName?n="<tr><td>"+r+"</td></tr>":/^(UL|OL)$/.test(t.nodeName)&&(n="<li>"+r+"</li>");const s=Jl(e);return e.schema.isValidChild(t.nodeName.toLowerCase(),s.toLowerCase())?(n=r,n=e.dom.createHTML(s,ed(e),n)):n||(n=r),Hb(e,n,o.no_selection),{content:n,html:n}}{"raw"!==o.format&&(n=Cp({validate:!1},e.schema).serialize(e.parser.parse(n,{isRootContent:!0,insert:!0})));const r=Xa(Cn(t))?n:Dt.trim(n);return Hb(e,r,o.no_selection),{content:r,html:r}}})(e,o,t,n))).getOr({content:t,html:jb(n.content)?"":n.content}))(e,t,n),insertContent:(t,n)=>zb(e,t,n),addVisual:t=>((e,t)=>{const n=e.dom,o=C(t)?t:e.getBody();q(n.select("table,a",o),(t=>{switch(t.nodeName){case"TABLE":const o=tc(e),r=n.getAttrib(t,"border");r&&"0"!==r||!e.hasVisual?n.removeClass(t,o):n.addClass(t,o);break;case"A":if(!n.getAttrib(t,"href")){const o=n.getAttrib(t,"name")||t.id,r=nc(e);o&&e.hasVisual?n.addClass(t,r):n.removeClass(t,r)}}})),e.dispatch("VisualAid",{element:t,hasVisual:e.hasVisual})})(e,t)},selection:{getContent:(t,n)=>((e,t,n={})=>{const o=((e,t)=>({...e,format:t,get:!0,selection:!0,getInner:!0}))(n,t);return LC(e,o).fold(R,(t=>{const n=((e,t)=>{if("text"===t.format)return(e=>I.from(e.selection.getRng()).map((t=>{var n;const o=I.from(e.dom.getParent(t.commonAncestorContainer,e.dom.isBlock)),r=e.getBody(),s=(e=>e.map((e=>e.nodeName)).getOr("div").toLowerCase())(o),a=Cn(t.cloneContents());pp(a),hp(a);const i=e.dom.add(r,s,{"data-mce-bogus":"all",style:"overflow: hidden; opacity: 0;"},a.dom),l=JC(i),d=ti(null!==(n=i.textContent)&&void 0!==n?n:"");if(e.dom.remove(i),QC(d,0)||QC(d,d.length-1)){const e=o.getOr(r),t=JC(e),n=t.indexOf(l);return-1===n?l:(QC(t,n-1)?" ":"")+l+(QC(t,n+l.length)?" ":"")}return l})).getOr(""))(e);{const n=((e,t)=>{const n=e.selection.getRng(),o=e.dom.create("body"),r=e.selection.getSel(),s=Xg(e,vm(r)),a=t.contextual?ZC(Cn(e.getBody()),s,e.schema).dom:n.cloneContents();return a&&o.appendChild(a),e.selection.serializer.serialize(o,t)})(e,t);return"tree"===t.format?n:e.selection.isCollapsed()?"":n}})(e,t);return MC(e,n,t)}))})(e,t,n)},autocompleter:{addDecoration:_,removeDecoration:_},raw:{getModel:()=>I.none()}}),mw=e=>_e(e.plugins,"rtc"),fw=e=>e.rtcInstance?e.rtcInstance:uw(e),gw=e=>{const t=e.rtcInstance;if(t)return t;throw new Error("Failed to get RTC instance not yet initialized.")},pw=e=>gw(e).init.bindEvents(),hw=e=>0===e.dom.length?(Eo(e),I.none()):I.some(e),bw=(e,t,n,o,r)=>{e.bind((e=>((o?Ch:yh)(e.dom,o?e.dom.length:0,r),t.filter(Yt).map((t=>((e,t,n,o,r)=>{const s=e.dom,a=t.dom,i=o?s.length:a.length;o?(wh(s,a,r,!1,!o),n.setStart(a,i)):(wh(a,s,r,!1,!o),n.setEnd(a,i))})(e,t,n,o,r)))))).orThunk((()=>{const e=((e,t)=>e.filter((e=>yf.isBookmarkNode(e.dom))).bind(t?Dn:Pn))(t,o).or(t).filter(Yt);return e.map((e=>((e,t,n)=>{Tn(e).each((o=>{const r=e.dom;t&&ch(o,Ji(r,0),n)?yh(r,0,n):!t&&uh(o,Ji(r,r.length),n)&&Ch(r,r.length,n)}))})(e,o,r)))}))},vw=(e,t,n)=>{if(_e(e,t)){const o=Y(e[t],(e=>e!==n));0===o.length?delete e[t]:e[t]=o}};const yw=e=>!(!e||!e.ownerDocument)&&Sn(Cn(e.ownerDocument),Cn(e)),Cw=(e,t,n,o)=>{let r,s;const{selectorChangedWithUnbind:a}=((e,t)=>{let n,o;const r=(t,n)=>Q(n,(n=>e.is(n,t))),s=t=>e.getParents(t,void 0,e.getRoot());return{selectorChangedWithUnbind:(e,a)=>(n||(n={},o={},t.on("NodeChange",(e=>{const t=e.element,a=s(t),i={};pe(n,((e,t)=>{r(t,a).each((n=>{o[t]||(q(e,(e=>{e(!0,{node:n,selector:t,parents:a})})),o[t]=e),i[t]=e}))})),pe(o,((e,n)=>{i[n]||(delete o[n],q(e,(e=>{e(!1,{node:t,selector:n,parents:a})})))}))}))),n[e]||(n[e]=[]),n[e].push(a),r(e,s(t.selection.getStart())).each((()=>{o[e]=n[e]})),{unbind:()=>{vw(n,e,a),vw(o,e,a)}})}})(e,o),i=(e,t)=>((e,t,n={})=>{const o=((e,t)=>({format:"html",...e,set:!0,selection:!0,content:t}))(n,t);IC(e,o).each((t=>{const n=((e,t)=>{if("raw"!==t.format){const n=e.selection.getRng(),o=e.dom.getParent(n.commonAncestorContainer,e.dom.isBlock),r=o?{context:o.nodeName.toLowerCase()}:{},s=e.parser.parse(t.content,{forced_root_block:!1,...r,...t});return Cp({validate:!1},e.schema).serialize(s)}return t.content})(e,t),o=e.selection.getRng();((e,t,n)=>{const o=I.from(t.firstChild).map(Cn),r=I.from(t.lastChild).map(Cn);e.deleteContents(),e.insertNode(t);const s=o.bind(Pn).filter(Yt).bind(hw),a=r.bind(Dn).filter(Yt).bind(hw);bw(s,o,e,!0,n),bw(a,r,e,!1,n),e.collapse(!1)})(o,o.createContextualFragment(n),e.schema),e.selection.setRng(o),Vg(e,o),FC(e,n,t)}))})(o,e,t),l=e=>{const t=c();t.collapse(!!e),u(t)},d=()=>t.getSelection?t.getSelection():t.document.selection,c=()=>{let n;const a=(e,t,n)=>{try{return t.compareBoundaryPoints(e,n)}catch(e){return-1}},i=t.document;if(C(o.bookmark)&&!Gf(o)){const e=If(o);if(e.isSome())return e.map((e=>Xg(o,[e])[0])).getOr(i.createRange())}try{const e=d();e&&!Qo(e.anchorNode)&&(n=e.rangeCount>0?e.getRangeAt(0):i.createRange(),n=Xg(o,[n])[0])}catch(e){}if(n||(n=i.createRange()),mr(n.startContainer)&&n.collapsed){const t=e.getRoot();n.setStart(t,0),n.setEnd(t,0)}return r&&s&&(0===a(n.START_TO_START,n,r)&&0===a(n.END_TO_END,n,r)?n=s:(r=null,s=null)),n},u=(e,t)=>{if(!(e=>!!e&&yw(e.startContainer)&&yw(e.endContainer))(e))return;const n=d();if(e=o.dispatch("SetSelectionRange",{range:e,forward:t}).range,n){s=e;try{n.removeAllRanges(),n.addRange(e)}catch(e){}!1===t&&n.extend&&(n.collapse(e.endContainer,e.endOffset),n.extend(e.startContainer,e.startOffset)),r=n.rangeCount>0?n.getRangeAt(0):null}if(!e.collapsed&&e.startContainer===e.endContainer&&(null==n?void 0:n.setBaseAndExtent)&&e.endOffset-e.startOffset<2&&e.startContainer.hasChildNodes()){const t=e.startContainer.childNodes[e.startOffset];t&&"IMG"===t.nodeName&&(n.setBaseAndExtent(e.startContainer,e.startOffset,e.endContainer,e.endOffset),n.anchorNode===e.startContainer&&n.focusNode===e.endContainer||n.setBaseAndExtent(t,0,t,1))}o.dispatch("AfterSetSelectionRange",{range:e,forward:t})},m=()=>{const t=d(),n=null==t?void 0:t.anchorNode,o=null==t?void 0:t.focusNode;if(!t||!n||!o||Qo(n)||Qo(o))return!0;const r=e.createRng(),s=e.createRng();try{r.setStart(n,t.anchorOffset),r.collapse(!0),s.setStart(o,t.focusOffset),s.collapse(!0)}catch(e){return!0}return r.compareBoundaryPoints(r.START_TO_START,s)<=0},f={dom:e,win:t,serializer:n,editor:o,expand:(t={type:"word"})=>u(kg(e).expand(c(),t)),collapse:l,setCursorLocation:(t,n)=>{const r=e.createRng();C(t)&&C(n)?(r.setStart(t,n),r.setEnd(t,n),u(r),l(!1)):(km(e,r,o.getBody(),!0),u(r))},getContent:e=>((e,t={})=>((e,t,n)=>gw(e).selection.getContent(t,n))(e,t.format?t.format:"html",t))(o,e),setContent:i,getBookmark:(e,t)=>g.getBookmark(e,t),moveToBookmark:e=>g.moveToBookmark(e),select:(t,n)=>(((e,t,n)=>I.from(t).bind((t=>I.from(t.parentNode).map((o=>{const r=e.nodeIndex(t),s=e.createRng();return s.setStart(o,r),s.setEnd(o,r+1),n&&(km(e,s,t,!0),km(e,s,t,!1)),s})))))(e,t,n).each(u),t),isCollapsed:()=>{const e=c(),t=d();return!(!e||e.item)&&(e.compareEndPoints?0===e.compareEndPoints("StartToEnd",e):!t||e.collapsed)},isEditable:()=>{if(o.mode.isReadOnly())return!1;const t=c(),n=o.getBody().querySelectorAll('[data-mce-selected="1"]');return n.length>0?ne(n,(t=>e.isEditable(t.parentElement))):qg(e,t)},isForward:m,setNode:t=>(i(e.getOuterHTML(t)),t),getNode:()=>((e,t)=>{if(!t)return e;let n=t.startContainer,o=t.endContainer;const r=t.startOffset,s=t.endOffset;let a=t.commonAncestorContainer;t.collapsed||(n===o&&s-r<2&&n.hasChildNodes()&&(a=n.childNodes[r]),lr(n)&&lr(o)&&(n=n.length===r?Gg(n.nextSibling,!0):n.parentNode,o=0===s?Gg(o.previousSibling,!1):o.parentNode,n&&n===o&&(a=n)));const i=lr(a)?a.parentNode:a;return er(i)?i:e})(o.getBody(),c()),getSel:d,setRng:u,getRng:c,getStart:e=>Kg(o.getBody(),c(),e),getEnd:e=>Yg(o.getBody(),c(),e),getSelectedBlocks:(t,n)=>((e,t,n,o)=>{const r=[],s=e.getRoot(),a=e.getParent(n||Kg(s,t,t.collapsed),e.isBlock),i=e.getParent(o||Yg(s,t,t.collapsed),e.isBlock);if(a&&a!==s&&r.push(a),a&&i&&a!==i){let t;const n=new $o(a,s);for(;(t=n.next())&&t!==i;)e.isBlock(t)&&r.push(t)}return i&&a!==i&&i!==s&&r.push(i),r})(e,c(),t,n),normalize:()=>{const t=c(),n=d();if(!(vm(n).length>1)&&Sm(o)){const n=Eg(e,t);return n.each((e=>{u(e,m())})),n.getOr(t)}return t},selectorChanged:(e,t)=>(a(e,t),f),selectorChangedWithUnbind:a,getScrollContainer:()=>{let t,n=e.getRoot();for(;n&&"BODY"!==n.nodeName;){if(n.scrollHeight>n.clientHeight){t=n;break}n=n.parentNode}return t},scrollIntoView:(e,t)=>{C(e)?((e,t,n)=>{(e.inline?jg:$g)(e,t,n)})(o,e,t):Vg(o,c(),t)},placeCaretAt:(e,t)=>u(gg(e,t,o.getDoc())),getBoundingClientRect:()=>{const e=c();return e.collapsed?Ji.fromRangeStart(e).getClientRects()[0]:e.getBoundingClientRect()},destroy:()=>{t=r=s=null,p.destroy()}},g=yf(f),p=og(f,o);return f.bookmarkManager=g,f.controlSelection=p,f},ww=(e,t,n)=>{-1===Dt.inArray(t,n)&&(e.addAttributeFilter(n,((e,t)=>{let n=e.length;for(;n--;)e[n].attr(t,null)})),t.push(n))},Ew=(e,t)=>{const n=["data-mce-selected"],o={entity_encoding:"named",remove_trailing_brs:!0,pad_empty_with_br:!1,...e},r=t&&t.dom?t.dom:ua.DOM,s=t&&t.schema?t.schema:Is(o),a=BC(o,s);return((e,t,n)=>{e.addAttributeFilter("data-mce-tabindex",((e,t)=>{let n=e.length;for(;n--;){const o=e[n];o.attr("tabindex",o.attr("data-mce-tabindex")),o.attr(t,null)}})),e.addAttributeFilter("src,href,style",((e,o)=>{const r="data-mce-"+o,s=t.url_converter,a=t.url_converter_scope;let i=e.length;for(;i--;){const t=e[i];let l=t.attr(r);void 0!==l?(t.attr(o,l.length>0?l:null),t.attr(r,null)):(l=t.attr(o),"style"===o?l=n.serializeStyle(n.parseStyle(l),t.name):s&&(l=s.call(a,l,o,t.name)),t.attr(o,l.length>0?l:null))}})),e.addAttributeFilter("class",(e=>{let t=e.length;for(;t--;){const n=e[t];let o=n.attr("class");o&&(o=o.replace(/(?:^|\s)mce-item-\w+(?!\S)/g,""),n.attr("class",o.length>0?o:null))}})),e.addAttributeFilter("data-mce-type",((e,t,n)=>{let o=e.length;for(;o--;){const t=e[o];if("bookmark"===t.attr("data-mce-type")&&!n.cleanup){const e=I.from(t.firstChild).exists((e=>{var t;return!ei(null!==(t=e.value)&&void 0!==t?t:"")}));e?t.unwrap():t.remove()}}})),e.addNodeFilter("script,style",((e,n)=>{var o;const r=e=>e.replace(/(<!--\[CDATA\[|\]\]-->)/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*((<!--)?(\s*\/\/)?\s*<!\[CDATA\[|(<!--\s*)?\/\*\s*<!\[CDATA\[\s*\*\/|(\/\/)?\s*<!--|\/\*\s*<!--\s*\*\/)\s*[\r\n]*/gi,"").replace(/\s*(\/\*\s*\]\]>\s*\*\/(-->)?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"");let s=e.length;for(;s--;){const a=e[s],i=a.firstChild,l=null!==(o=null==i?void 0:i.value)&&void 0!==o?o:"";if("script"===n){const e=a.attr("type");e&&a.attr("type","mce-no/type"===e?null:e.replace(/^mce\-/,"")),"xhtml"===t.element_format&&i&&l.length>0&&(i.value="// <![CDATA[\n"+r(l)+"\n// ]]>")}else"xhtml"===t.element_format&&i&&l.length>0&&(i.value="\x3c!--\n"+r(l)+"\n--\x3e")}})),e.addNodeFilter("#comment",(e=>{let o=e.length;for(;o--;){const r=e[o],s=r.value;t.preserve_cdata&&0===(null==s?void 0:s.indexOf("[CDATA["))?(r.name="#cdata",r.type=4,r.value=n.decode(s.replace(/^\[CDATA\[|\]\]$/g,""))):0===(null==s?void 0:s.indexOf("mce:protected "))&&(r.name="#text",r.type=3,r.raw=!0,r.value=unescape(s).substr(14))}})),e.addNodeFilter("xml:namespace,input",((e,t)=>{let n=e.length;for(;n--;){const o=e[n];7===o.type?o.remove():1===o.type&&("input"!==t||o.attr("type")||o.attr("type","text"))}})),e.addAttributeFilter("data-mce-type",(t=>{q(t,(t=>{"format-caret"===t.attr("data-mce-type")&&(t.isEmpty(e.schema.getNonEmptyElements())?t.remove():t.unwrap())}))})),e.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style,data-mce-selected,data-mce-expando,data-mce-block,data-mce-type,data-mce-resize,data-mce-placeholder",((e,t)=>{let n=e.length;for(;n--;)e[n].attr(t,null)})),t.remove_trailing_brs&&((e,t,n)=>{t.addNodeFilter("br",((t,o,r)=>{const s=Dt.extend({},n.getBlockElements()),a=n.getNonEmptyElements(),i=n.getWhitespaceElements();s.body=1;const l=e=>e.name in s||Qr(n,e);for(let o=0,d=t.length;o<d;o++){let d=t[o],c=d.parent;if(c&&l(c)&&d===c.lastChild){let t=d.prev;for(;t;){const e=t.name;if("span"!==e||"bookmark"!==t.attr("data-mce-type")){"br"===e&&(d=null);break}t=t.prev}if(d&&(d.remove(),Nb(n,a,i,c))){const t=n.getElementRule(c.name);t&&(t.removeEmpty?c.remove():t.paddEmpty&&kb(e,r,l,c))}}else{let e=d;for(;c&&c.firstChild===e&&c.lastChild===e&&(e=c,!s[c.name]);)c=c.parent;if(e===c){const e=new tp("#text",3);e.value=qo,d.replace(e)}}}}))})(t,e,e.schema)})(a,o,r),{schema:s,addNodeFilter:a.addNodeFilter,addAttributeFilter:a.addAttributeFilter,serialize:(e,n={})=>{const i={format:"html",...n},l=((e,t,n)=>((e,t)=>C(e)&&e.hasEventListeners("PreProcess")&&!t.no_events)(e,n)?((e,t,n)=>{let o;const r=e.dom;let s=t.cloneNode(!0);const a=document.implementation;if(a.createHTMLDocument){const e=a.createHTMLDocument("");Dt.each("BODY"===s.nodeName?s.childNodes:[s],(t=>{e.body.appendChild(e.importNode(t,!0))})),s="BODY"!==s.nodeName?e.body.firstChild:e.body,o=r.doc,r.doc=e}return((e,t)=>{e.dispatch("PreProcess",t)})(e,{...n,node:s}),o&&(r.doc=o),s})(e,t,n):t)(t,e,i),d=((e,t,n)=>{const o=ti(n.getInner?t.innerHTML:e.getOuterHTML(t));return n.selection||Xa(Cn(t))?o:Dt.trim(o)})(r,l,i),c=((e,t,n)=>{const o=n.selection?{forced_root_block:!1,...n}:n,r=e.parse(t,o);return(e=>{const t=e=>"br"===(null==e?void 0:e.name),n=e.lastChild;if(t(n)){const e=n.prev;t(e)&&(n.remove(),e.remove())}})(r),r})(a,d,i);return"tree"===i.format?c:((e,t,n,o,r)=>{const s=((e,t,n)=>Cp(e,t).serialize(n))(t,n,o);return((e,t,n)=>{if(!t.no_events&&e){const o=((e,t)=>e.dispatch("PostProcess",t))(e,{...t,content:n});return o.content}return n})(e,r,s)})(t,o,s,c,i)},addRules:s.addValidElements,setRules:s.setValidElements,addTempAttr:T(ww,a,n),getTempAttrs:N(n),getNodeFilters:a.getNodeFilters,getAttributeFilters:a.getAttributeFilters,removeNodeFilter:a.removeNodeFilter,removeAttributeFilter:a.removeAttributeFilter}},xw=(e,t)=>{const n=Ew(e,t);return{schema:n.schema,addNodeFilter:n.addNodeFilter,addAttributeFilter:n.addAttributeFilter,serialize:n.serialize,addRules:n.addRules,setRules:n.setRules,addTempAttr:n.addTempAttr,getTempAttrs:n.getTempAttrs,getNodeFilters:n.getNodeFilters,getAttributeFilters:n.getAttributeFilters,removeNodeFilter:n.removeNodeFilter,removeAttributeFilter:n.removeAttributeFilter}},_w=(e,t,n={})=>{const o=((e,t)=>({format:"html",...e,set:!0,content:t}))(n,t);return IC(e,o).map((t=>{const n=((e,t,n)=>fw(e).editor.setContent(t,n))(e,t.content,t);return FC(e,n.html,t),n.content})).getOr(t)},kw="autoresize_on_init,content_editable_state,padd_empty_with_br,block_elements,boolean_attributes,editor_deselector,editor_selector,elements,file_browser_callback_types,filepicker_validator_handler,force_hex_style_colors,force_p_newlines,gecko_spellcheck,images_dataimg_filter,media_scripts,mode,move_caret_before_on_enter_elements,non_empty_elements,self_closing_elements,short_ended_elements,special,spellchecker_select_languages,spellchecker_whitelist,tab_focus,tabfocus_elements,table_responsive_width,text_block_elements,text_inline_elements,toolbar_drawer,types,validate,whitespace_elements,paste_enable_default_filters,paste_filter_drop,paste_word_valid_elements,paste_retain_style_properties,paste_convert_word_fake_lists,template_cdate_classes,template_mdate_classes,template_selected_content_classes,template_preview_replace_values,template_replace_values,templates,template_cdate_format,template_mdate_format".split(","),Sw=[],Nw="bbcode,colorpicker,contextmenu,fullpage,legacyoutput,spellchecker,template,textcolor,rtc".split(","),Rw=[],Aw=(e,t)=>{const n=Y(t,(t=>_e(e,t)));return ae(n)},Tw=e=>{const t=Aw(e,kw),n=e.forced_root_block;return!1!==n&&""!==n||t.push("forced_root_block (false only)"),ae(t)},Ow=e=>Aw(e,Sw),Bw=(e,t)=>{const n=Dt.makeMap(e.plugins," "),o=Y(t,(e=>_e(n,e)));return ae(o)},Pw=e=>Bw(e,Nw),Dw=e=>Bw(e,Rw.map((e=>e.name))),Lw=e=>Q(Rw,(t=>t.name===e)).fold((()=>e),(t=>t.replacedWith?`${e}, replaced by ${t.replacedWith}`:e)),Mw=ua.DOM,Iw=e=>I.from(e).each((e=>e.destroy())),Fw=(()=>{const e={};return{add:(t,n)=>{e[t]=n},get:t=>e[t]?e[t]:{icons:{}},has:t=>_e(e,t)}})(),Uw=va.ModelManager,zw=(e,t)=>t.dom[e],jw=(e,t)=>parseInt(co(t,e),10),Hw=T(zw,"clientWidth"),$w=T(zw,"clientHeight"),Vw=T(jw,"margin-top"),qw=T(jw,"margin-left"),Ww=e=>{const t=[],n=()=>{const t=e.theme;return t&&t.getNotificationManagerImpl?t.getNotificationManagerImpl():(()=>{const e=()=>{throw new Error("Theme did not provide a NotificationManager implementation.")};return{open:e,close:e,getArgs:e}})()},o=()=>I.from(t[0]),r=()=>{o().each((e=>{e.reposition()}))},s=e=>{J(t,(t=>t===e)).each((e=>{t.splice(e,1)}))},a=(o,a=!0)=>e.removed||!(e=>{return(t=e.inline?e.getBody():e.getContentAreaContainer(),I.from(t).map(Cn)).map(Yn).getOr(!1);var t})(e)?{}:(a&&e.dispatch("BeforeOpenNotification",{notification:o}),Q(t,(e=>{return t=n().getArgs(e),r=o,!(t.type!==r.type||t.text!==r.text||t.progressBar||t.timeout||r.progressBar||r.timeout);var t,r})).getOrThunk((()=>{e.editorManager.setActive(e);const a=n().open(o,(()=>{s(a)}),(()=>Xf(e)));return(e=>{t.push(e)})(a),r(),e.dispatch("OpenNotification",{notification:{...a}}),a}))),i=N(t);return(e=>{e.on("SkinLoaded",(()=>{const t=Td(e);t&&a({text:t,type:"warning",timeout:0},!1),r()})),e.on("show ResizeEditor ResizeWindow NodeChange ToggleView FullscreenStateChanged",(()=>{requestAnimationFrame(r)})),e.on("remove",(()=>{q(t.slice(),(e=>{n().close(e)}))})),e.on("keydown",(e=>{var t;const n="f12"===(null===(t=e.key)||void 0===t?void 0:t.toLowerCase())||123===e.keyCode;e.altKey&&n&&(e.preventDefault(),o().map((e=>Cn(e.getEl()))).each((e=>Ef(e))))}))})(e),{open:a,close:()=>{o().each((e=>{n().close(e),s(e),r()}))},getNotifications:i}},Kw=va.PluginManager,Yw=va.ThemeManager,Gw=e=>{let t=[];const n=()=>{const t=e.theme;return t&&t.getWindowManagerImpl?t.getWindowManagerImpl():(()=>{const e=()=>{throw new Error("Theme did not provide a WindowManager implementation.")};return{open:e,openUrl:e,alert:e,confirm:e,close:e}})()},o=(e,t)=>(...n)=>t?t.apply(e,n):void 0,r=n=>{(t=>{e.dispatch("CloseWindow",{dialog:t})})(n),t=Y(t,(e=>e!==n)),0===t.length&&e.focus()},s=n=>{e.editorManager.setActive(e),Mf(e),e.ui.show();const o=n();return(n=>{t.push(n),(t=>{e.dispatch("OpenWindow",{dialog:t})})(n)})(o),o};return e.on("remove",(()=>{q(t,(e=>{n().close(e)}))})),{open:(e,t)=>s((()=>n().open(e,t,r))),openUrl:e=>s((()=>n().openUrl(e,r))),alert:(e,t,r)=>{const s=n();s.alert(e,o(r||s,t))},confirm:(e,t,r)=>{const s=n();s.confirm(e,o(r||s,t))},close:()=>{I.from(t[t.length-1]).each((e=>{n().close(e),r(e)}))}}},Xw=(e,t)=>{e.notificationManager.open({type:"error",text:t})},Zw=(e,t)=>{e._skinLoaded?Xw(e,t):e.on("SkinLoaded",(()=>{Xw(e,t)}))},Qw=(e,t,n)=>{Bl(e,t,{message:n}),console.error(n)},Jw=(e,t,n)=>n?`Failed to load ${e}: ${n} from url ${t}`:`Failed to load ${e} url: ${t}`,eE=(e,...t)=>{const n=window.console;n&&(n.error?n.error(e,...t):n.log(e,...t))},tE=(e,t,n)=>{try{e.getDoc().execCommand(t,!1,String(n))}catch(e){}},nE=(e,t,n)=>{pn(e,t)&&!n?gn(e,t):n&&mn(e,t)},oE=e=>{const t=Cn(e.getBody());nE(t,"mce-content-readonly",!0),e.selection.controlSelection.hideResizeRect(),e._selectionOverrides.hideFakeCaret(),(e=>{I.from(e.selection.getNode()).each((e=>{e.removeAttribute("data-mce-selected")}))})(e)},rE=e=>{const t=Cn(e.getBody());nE(t,"mce-content-readonly",!1),e.hasEditableRoot()&&ro(t,!0),((e,t)=>{tE(e,"StyleWithCSS",t),tE(e,"enableInlineTableEditing",t),tE(e,"enableObjectResizing",t)})(e,!1),Xf(e)&&e.focus(),(e=>{e.selection.setRng(e.selection.getRng())})(e),e.nodeChanged()},sE=e=>zc(e),aE="data-mce-contenteditable",iE=(e,t)=>{const n=Cn(e.getBody());t?(oE(e),ro(n,!1),q(Uo(n,'*[contenteditable="true"]'),(e=>{Jt(e,aE,"true"),ro(e,!1)}))):(q(Uo(n,`*[${aE}="true"]`),(e=>{rn(e,aE),ro(e,!0)})),rE(e))},lE=e=>{e.parser.addAttributeFilter("contenteditable",(t=>{sE(e)&&q(t,(e=>{e.attr(aE,e.attr("contenteditable")),e.attr("contenteditable","false")}))})),e.serializer.addAttributeFilter(aE,(t=>{sE(e)&&q(t,(e=>{e.attr("contenteditable",e.attr(aE))}))})),e.serializer.addTempAttr(aE)},dE=["copy"],cE=e=>"content/"+e+"/content.css",uE=(e,t)=>{const n=e.editorManager.baseURL+"/skins/content",o=`content${e.editorManager.suffix}.css`;return V(t,(t=>(e=>tinymce.Resource.has(cE(e)))(t)?t:(e=>/^[a-z0-9\-]+$/i.test(e))(t)&&!e.inline?`${n}/${t}/${o}`:e.documentBaseURI.toAbsolute(t)))},mE=(e,t)=>{const n={};return{findAll:(o,r=M)=>{const s=Y((e=>e?ce(e.getElementsByTagName("img")):[])(o),(t=>{const n=t.src;return!t.hasAttribute("data-mce-bogus")&&!t.hasAttribute("data-mce-placeholder")&&!(!n||n===Tt.transparentSrc)&&($e(n,"blob:")?!e.isUploaded(n)&&r(t):!!$e(n,"data:")&&r(t))})),a=V(s,(e=>{const o=e.src;if(_e(n,o))return n[o].then((t=>m(t)?t:{image:e,blobInfo:t.blobInfo}));{const r=((e,t)=>{const n=()=>Promise.reject("Invalid data URI");if($e(t,"blob:")){const s=e.getByUri(t);return C(s)?Promise.resolve(s):(o=t,$e(o,"blob:")?(e=>fetch(e).then((e=>e.ok?e.blob():Promise.reject())).catch((()=>Promise.reject({message:`Cannot convert ${e} to Blob. Resource might not exist or is inaccessible.`,uriType:"blob"}))))(o):$e(o,"data:")?(r=o,new Promise(((e,t)=>{oy(r).bind((({type:e,data:t,base64Encoded:n})=>ry(e,t,n))).fold((()=>t("Invalid data URI")),e)}))):Promise.reject("Unknown URI format")).then((t=>sy(t).then((o=>iy(o,!1,(n=>I.some(ly(e,t,n)))).getOrThunk(n)))))}var o,r;return $e(t,"data:")?dy(e,t).fold(n,(e=>Promise.resolve(e))):Promise.reject("Unknown image data format")})(t,o).then((t=>(delete n[o],{image:e,blobInfo:t}))).catch((e=>(delete n[o],e)));return n[o]=r,r}}));return Promise.all(a)}}},fE=()=>{let e={};const t=(e,t)=>({status:e,resultUri:t}),n=t=>t in e;return{hasBlobUri:n,getResultUri:t=>{const n=e[t];return n?n.resultUri:null},isPending:t=>!!n(t)&&1===e[t].status,isUploaded:t=>!!n(t)&&2===e[t].status,markPending:n=>{e[n]=t(1,null)},markUploaded:(n,o)=>{e[n]=t(2,o)},removeFailed:t=>{delete e[t]},destroy:()=>{e={}}}};let gE=0;const pE=(e,t)=>{const n={},o=(e,n)=>new Promise(((o,r)=>{const s=new XMLHttpRequest;s.open("POST",t.url),s.withCredentials=t.credentials,s.upload.onprogress=e=>{n(e.loaded/e.total*100)},s.onerror=()=>{r("Image upload failed due to a XHR Transport error. Code: "+s.status)},s.onload=()=>{if(s.status<200||s.status>=300)return void r("HTTP Error: "+s.status);const e=JSON.parse(s.responseText);var n,a;e&&m(e.location)?o((n=t.basePath,a=e.location,n?n.replace(/\/$/,"")+"/"+a.replace(/^\//,""):a)):r("Invalid JSON: "+s.responseText)};const a=new FormData;a.append("file",e.blob(),e.filename()),s.send(a)})),r=w(t.handler)?t.handler:o,s=(e,t)=>({url:t,blobInfo:e,status:!0}),a=(e,t)=>({url:"",blobInfo:e,status:!1,error:t}),i=(e,t)=>{Dt.each(n[e],(e=>{e(t)})),delete n[e]};return{upload:(l,d)=>t.url||r!==o?((t,o)=>(t=Dt.grep(t,(t=>!e.isUploaded(t.blobUri()))),Promise.all(Dt.map(t,(t=>e.isPending(t.blobUri())?(e=>{const t=e.blobUri();return new Promise((e=>{n[t]=n[t]||[],n[t].push(e)}))})(t):((t,n,o)=>(e.markPending(t.blobUri()),new Promise((r=>{let l,d;try{const c=()=>{l&&(l.close(),d=_)},u=n=>{c(),e.markUploaded(t.blobUri(),n),i(t.blobUri(),s(t,n)),r(s(t,n))},f=n=>{c(),e.removeFailed(t.blobUri()),i(t.blobUri(),a(t,n)),r(a(t,n))};d=e=>{e<0||e>100||I.from(l).orThunk((()=>I.from(o).map(P))).each((t=>{l=t,t.progressBar.value(e)}))},n(t,d).then(u,(e=>{f(m(e)?{message:e}:e)}))}catch(e){r(a(t,e))}}))))(t,r,o))))))(l,d):new Promise((e=>{e([])}))}},hE=e=>()=>e.notificationManager.open({text:e.translate("Image uploading..."),type:"info",timeout:-1,progressBar:!0}),bE=(e,t)=>pE(t,{url:ud(e),basePath:md(e),credentials:fd(e),handler:gd(e)}),vE=e=>{const t=(()=>{let e=[];const t=e=>{if(!e.blob||!e.base64)throw new Error("blob and base64 representations of the image are required for BlobInfo to be created");const t=e.id||"blobid"+gE+++(()=>{const e=()=>Math.round(4294967295*Ba()).toString(36);return"s"+(new Date).getTime().toString(36)+e()+e()+e()})(),n=e.name||t,o=e.blob;var r;return{id:N(t),name:N(n),filename:N(e.filename||n+"."+(r=o.type,{"image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/png":"png","image/apng":"apng","image/avif":"avif","image/svg+xml":"svg","image/webp":"webp","image/bmp":"bmp","image/tiff":"tiff"}[r.toLowerCase()]||"dat")),blob:N(o),base64:N(e.base64),blobUri:N(e.blobUri||URL.createObjectURL(o)),uri:N(e.uri)}},n=t=>Q(e,t).getOrUndefined(),o=e=>n((t=>t.id()===e));return{create:(e,n,o,r,s)=>{if(m(e))return t({id:e,name:r,filename:s,blob:n,base64:o});if(f(e))return t(e);throw new Error("Unknown input type")},add:t=>{o(t.id())||e.push(t)},get:o,getByUri:e=>n((t=>t.blobUri()===e)),getByData:(e,t)=>n((n=>n.base64()===e&&n.blob().type===t)),findFirst:n,removeByUri:t=>{e=Y(e,(e=>e.blobUri()!==t||(URL.revokeObjectURL(e.blobUri()),!1)))},destroy:()=>{q(e,(e=>{URL.revokeObjectURL(e.blobUri())})),e=[]}}})();let n,o;const r=fE(),s=[],a=t=>n=>e.selection?t(n):[],i=(e,t,n)=>{let o=0;do{o=e.indexOf(t,o),-1!==o&&(e=e.substring(0,o)+n+e.substr(o+t.length),o+=n.length-t.length+1)}while(-1!==o);return e},l=(e,t,n)=>{const o=`src="${n}"${n===Tt.transparentSrc?' data-mce-placeholder="1"':""}`;return e=i(e,`src="${t}"`,o),i(e,'data-mce-src="'+t+'"','data-mce-src="'+n+'"')},d=(t,n)=>{q(e.undoManager.data,(e=>{"fragmented"===e.type?e.fragments=V(e.fragments,(e=>l(e,t,n))):e.content=l(e.content,t,n)}))},c=()=>(n||(n=bE(e,r)),p().then(a((o=>{const r=V(o,(e=>e.blobInfo));return n.upload(r,hE(e)).then(a((n=>{const r=[];let s=!1;const a=V(n,((n,a)=>{const{blobInfo:i,image:l}=o[a];let c=!1;return n.status&&ld(e)?(n.url&&!He(l.src,n.url)&&(s=!0),t.removeByUri(l.src),mw(e)||((t,n)=>{const o=e.convertURL(n,"src");var r;d(t.src,n),en(Cn(t),{src:id(e)?(r=n,r+(-1===r.indexOf("?")?"?":"&")+(new Date).getTime()):n,"data-mce-src":o})})(l,n.url)):n.error&&(n.error.remove&&(d(l.src,Tt.transparentSrc),r.push(l),c=!0),((e,t)=>{Zw(e,ba.translate(["Failed to upload image: {0}",t]))})(e,n.error.message)),{element:l,status:n.status,uploadUri:n.url,blobInfo:i,removed:c}}));return r.length>0&&!mw(e)?e.undoManager.transact((()=>{q(_o(r),(n=>{const o=Tn(n);Eo(n),o.each((e=>t=>{((e,t)=>e.dom.isEmpty(t.dom)&&C(e.schema.getTextBlockElements()[$t(t)]))(e,t)&&vo(t,bn('<br data-mce-bogus="1" />'))})(e)),t.removeByUri(n.dom.src)}))})):s&&e.undoManager.dispatchChange(),a})))})))),u=()=>ad(e)?c():Promise.resolve([]),g=e=>ne(s,(t=>t(e))),p=()=>(o||(o=mE(r,t)),o.findAll(e.getBody(),g).then(a((t=>{const n=Y(t,(t=>m(t)?(Zw(e,t),!1):"blob"!==t.uriType));return mw(e)||q(n,(e=>{d(e.image.src,e.blobInfo.blobUri()),e.image.src=e.blobInfo.blobUri(),e.image.removeAttribute("data-mce-src")})),n})))),h=n=>n.replace(/src="(blob:[^"]+)"/g,((n,o)=>{const s=r.getResultUri(o);if(s)return'src="'+s+'"';let a=t.getByUri(o);return a||(a=X(e.editorManager.get(),((e,t)=>e||t.editorUpload&&t.editorUpload.blobCache.getByUri(o)),void 0)),a?'src="data:'+a.blob().type+";base64,"+a.base64()+'"':n}));return e.on("SetContent",(()=>{ad(e)?u():p()})),e.on("RawSaveContent",(e=>{e.content=h(e.content)})),e.on("GetContent",(e=>{e.source_view||"raw"===e.format||"tree"===e.format||(e.content=h(e.content))})),e.on("PostRender",(()=>{e.parser.addNodeFilter("img",(e=>{q(e,(e=>{const n=e.attr("src");if(!n||t.getByUri(n))return;const o=r.getResultUri(n);o&&e.attr("src",o)}))}))})),{blobCache:t,addFilter:e=>{s.push(e)},uploadImages:c,uploadImagesAuto:u,scanForImages:p,destroy:()=>{t.destroy(),r.destroy(),o=n=null}}},yE={remove_similar:!0,inherit:!1},CE={selector:"td,th",...yE},wE={tablecellbackgroundcolor:{styles:{backgroundColor:"%value"},...CE},tablecellverticalalign:{styles:{"vertical-align":"%value"},...CE},tablecellbordercolor:{styles:{borderColor:"%value"},...CE},tablecellclass:{classes:["%value"],...CE},tableclass:{selector:"table",classes:["%value"],...yE},tablecellborderstyle:{styles:{borderStyle:"%value"},...CE},tablecellborderwidth:{styles:{borderWidth:"%value"},...CE}},EE=N(wE),xE=Dt.each,_E=ua.DOM,kE=e=>C(e)&&f(e),SE=(e,t)=>{const n=t&&t.schema||Is({}),o=e=>{const t=m(e)?{name:e,classes:[],attrs:{}}:e,n=_E.create(t.name);return((e,t)=>{t.classes.length>0&&_E.addClass(e,t.classes.join(" ")),_E.setAttribs(e,t.attrs)})(n,t),n},r=(e,t,s)=>{let a;const i=t[0],l=kE(i)?i.name:void 0,d=((e,t)=>{const o=n.getElementRule(e.nodeName.toLowerCase()),r=null==o?void 0:o.parentsRequired;return!(!r||!r.length)&&(t&&H(r,t)?t:r[0])})(e,l);if(d)l===d?(a=i,t=t.slice(1)):a=d;else if(i)a=i,t=t.slice(1);else if(!s)return e;const c=a?o(a):_E.create("div");c.appendChild(e),s&&Dt.each(s,(t=>{const n=o(t);c.insertBefore(n,e)}));const u=kE(a)?a.siblings:void 0;return r(c,t,u)},s=_E.create("div");if(e.length>0){const t=e[0],n=o(t),a=kE(t)?t.siblings:void 0;s.appendChild(r(n,e.slice(1),a))}return s},NE=e=>{let t="div";const n={name:t,classes:[],attrs:{},selector:e=Dt.trim(e)};return"*"!==e&&(t=e.replace(/(?:([#\.]|::?)([\w\-]+)|(\[)([^\]]+)\]?)/g,((e,t,o,r,s)=>{switch(t){case"#":n.attrs.id=o;break;case".":n.classes.push(o);break;case":":-1!==Dt.inArray("checked disabled enabled read-only required".split(" "),o)&&(n.attrs[o]=o)}if("["===r){const e=s.match(/([\w\-]+)(?:\=\"([^\"]+))?/);e&&(n.attrs[e[1]]=e[2])}return""}))),n.name=t||"div",n},RE=(e,t)=>{let n="",o=Id(e);if(""===o)return"";const r=e=>m(e)?e.replace(/%(\w+)/g,""):"",s=(t,n)=>_E.getStyle(null!=n?n:e.getBody(),t,!0);if(m(t)){const n=e.formatter.get(t);if(!n)return"";t=n[0]}if("preview"in t){const e=t.preview;if(!1===e)return"";o=e||o}let a,i=t.block||t.inline||"span";const l=(d=t.selector,m(d)?(d=(d=d.split(/\s*,\s*/)[0]).replace(/\s*(~\+|~|\+|>)\s*/g,"$1"),Dt.map(d.split(/(?:>|\s+(?![^\[\]]+\]))/),(e=>{const t=Dt.map(e.split(/(?:~\+|~|\+)/),NE),n=t.pop();return t.length&&(n.siblings=t),n})).reverse()):[]);var d;l.length>0?(l[0].name||(l[0].name=i),i=t.selector,a=SE(l,e)):a=SE([i],e);const c=_E.select(i,a)[0]||a.firstChild;xE(t.styles,((e,t)=>{const n=r(e);n&&_E.setStyle(c,t,n)})),xE(t.attributes,((e,t)=>{const n=r(e);n&&_E.setAttrib(c,t,n)})),xE(t.classes,(e=>{const t=r(e);_E.hasClass(c,t)||_E.addClass(c,t)})),e.dispatch("PreviewFormats"),_E.setStyles(a,{position:"absolute",left:-65535}),e.getBody().appendChild(a);const u=s("fontSize"),f=/px$/.test(u)?parseInt(u,10):0;return xE(o.split(" "),(e=>{let t=s(e,c);if(!("background-color"===e&&/transparent|rgba\s*\([^)]+,\s*0\)/.test(t)&&(t=s(e),"#ffffff"===qs(t).toLowerCase())||"color"===e&&"#000000"===qs(t).toLowerCase())){if("font-size"===e&&/em|%$/.test(t)){if(0===f)return;t=parseFloat(t)/(/%$/.test(t)?100:1)*f+"px"}"border"===e&&t&&(n+="padding:0 2px;"),n+=e+":"+t+";"}})),e.dispatch("AfterPreviewFormats"),_E.remove(a),n},AE=e=>{const t=(e=>{const t={},n=(e,o)=>{e&&(m(e)?(p(o)||(o=[o]),q(o,(e=>{v(e.deep)&&(e.deep=!Wm(e)),v(e.split)&&(e.split=!Wm(e)||Km(e)),v(e.remove)&&Wm(e)&&!Km(e)&&(e.remove="none"),Wm(e)&&Km(e)&&(e.mixed=!0,e.block_expand=!0),m(e.classes)&&(e.classes=e.classes.split(/\s+/))})),t[e]=o):pe(e,((e,t)=>{n(t,e)})))};return n((e=>{const t=e.dom,n=e.schema.type,o={valigntop:[{selector:"td,th",styles:{verticalAlign:"top"}}],valignmiddle:[{selector:"td,th",styles:{verticalAlign:"middle"}}],valignbottom:[{selector:"td,th",styles:{verticalAlign:"bottom"}}],alignleft:[{selector:"figure.image",collapsed:!1,classes:"align-left",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"left"},inherit:!1,preview:!1},{selector:"img,audio,video",collapsed:!1,styles:{float:"left"},preview:"font-family font-size"},{selector:".mce-placeholder",styles:{float:"left"},ceFalseOverride:!0},{selector:"table",collapsed:!1,styles:{marginLeft:"0px",marginRight:"auto"},onformat:e=>{t.setStyle(e,"float",null)},preview:"font-family font-size"},{selector:".mce-preview-object,[data-ephox-embed-iri]",ceFalseOverride:!0,styles:{float:"left"}}],aligncenter:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"center"},inherit:!1,preview:"font-family font-size"},{selector:"figure.image",collapsed:!1,classes:"align-center",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"img,audio,video",collapsed:!1,styles:{display:"block",marginLeft:"auto",marginRight:"auto"},preview:!1},{selector:".mce-placeholder",styles:{display:"block",marginLeft:"auto",marginRight:"auto"},ceFalseOverride:!0},{selector:"table",collapsed:!1,styles:{marginLeft:"auto",marginRight:"auto"},preview:"font-family font-size"},{selector:".mce-preview-object",ceFalseOverride:!0,styles:{display:"table",marginLeft:"auto",marginRight:"auto"},preview:!1},{selector:"[data-ephox-embed-iri]",ceFalseOverride:!0,styles:{marginLeft:"auto",marginRight:"auto"},preview:!1}],alignright:[{selector:"figure.image",collapsed:!1,classes:"align-right",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"right"},inherit:!1,preview:"font-family font-size"},{selector:"img,audio,video",collapsed:!1,styles:{float:"right"},preview:"font-family font-size"},{selector:".mce-placeholder",styles:{float:"right"},ceFalseOverride:!0},{selector:"table",collapsed:!1,styles:{marginRight:"0px",marginLeft:"auto"},onformat:e=>{t.setStyle(e,"float",null)},preview:"font-family font-size"},{selector:".mce-preview-object,[data-ephox-embed-iri]",ceFalseOverride:!0,styles:{float:"right"},preview:!1}],alignjustify:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"justify"},inherit:!1,preview:"font-family font-size"}],bold:[{inline:"strong",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all",preserve_attributes:["class","style"]}],italic:[{inline:"em",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all",preserve_attributes:["class","style"]}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:!0},{inline:"u",remove:"all",preserve_attributes:["class","style"]}],strikethrough:(()=>{const e={inline:"span",styles:{textDecoration:"line-through"},exact:!0},t={inline:"strike",remove:"all",preserve_attributes:["class","style"]},o={inline:"s",remove:"all",preserve_attributes:["class","style"]};return"html4"!==n?[o,e,t]:[e,o,t]})(),forecolor:{inline:"span",styles:{color:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},fontname:{inline:"span",toggle:!1,styles:{fontFamily:"%value"},clear_child_styles:!0},fontsize:{inline:"span",toggle:!1,styles:{fontSize:"%value"},clear_child_styles:!0},lineheight:{selector:"h1,h2,h3,h4,h5,h6,p,li,td,th,div",styles:{lineHeight:"%value"}},fontsize_class:{inline:"span",attributes:{class:"%value"}},blockquote:{block:"blockquote",wrapper:!0,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},code:{inline:"code"},samp:{inline:"samp"},link:{inline:"a",selector:"a",remove:"all",split:!0,deep:!0,onmatch:(e,t,n)=>Jo(e)&&e.hasAttribute("href"),onformat:(e,n,o)=>{Dt.each(o,((n,o)=>{t.setAttrib(e,o,n)}))}},lang:{inline:"span",clear_child_styles:!0,remove_similar:!0,attributes:{lang:"%value","data-mce-lang":e=>{var t;return null!==(t=null==e?void 0:e.customValue)&&void 0!==t?t:null}}},removeformat:[{selector:"b,strong,em,i,font,u,strike,s,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins,small",remove:"all",split:!0,expand:!1,block_expand:!0,deep:!0},{selector:"span",attributes:["style","class"],remove:"empty",split:!0,expand:!1,deep:!0},{selector:"*",attributes:["style","class"],split:!1,expand:!1,deep:!0}]};return Dt.each("p h1 h2 h3 h4 h5 h6 div address pre dt dd".split(/\s/),(e=>{o[e]={block:e,remove:"all"}})),o})(e)),n(EE()),n(Md(e)),{get:e=>C(e)?t[e]:t,has:e=>_e(t,e),register:n,unregister:e=>(e&&t[e]&&delete t[e],t)}})(e),n=Or({});return(e=>{e.addShortcut("meta+b","","Bold"),e.addShortcut("meta+i","","Italic"),e.addShortcut("meta+u","","Underline");for(let t=1;t<=6;t++)e.addShortcut("access+"+t,"",["FormatBlock",!1,"h"+t]);e.addShortcut("access+7","",["FormatBlock",!1,"p"]),e.addShortcut("access+8","",["FormatBlock",!1,"div"]),e.addShortcut("access+9","",["FormatBlock",!1,"address"])})(e),(e=>{e.on("mouseup keydown",(t=>{var n;((e,t,n)=>{const o=e.selection,r=e.getBody();nv(e,null,n),8!==t&&46!==t||!o.isCollapsed()||o.getStart().innerHTML!==Qb||nv(e,tm(r,o.getStart()),!0),37!==t&&39!==t||nv(e,tm(r,o.getStart()),!0)})(e,t.keyCode,(n=e.selection.getRng().endContainer,lr(n)&&Ve(n.data,qo)))}))})(e),mw(e)||((e,t)=>{e.set({}),t.on("NodeChange",(n=>{Jv(t,n.element,e.get())})),t.on("FormatApply FormatRemove",(n=>{const o=I.from(n.node).map((e=>Am(e)?e:e.startContainer)).bind((e=>Jo(e)?I.some(e):I.from(e.parentElement))).getOrThunk((()=>Xv(t)));Jv(t,o,e.get())}))})(n,e),{get:t.get,has:t.has,register:t.register,unregister:t.unregister,apply:(t,n,o)=>{((e,t,n,o)=>{gw(e).formatter.apply(t,n,o)})(e,t,n,o)},remove:(t,n,o,r)=>{((e,t,n,o,r)=>{gw(e).formatter.remove(t,n,o,r)})(e,t,n,o,r)},toggle:(t,n,o)=>{((e,t,n,o)=>{gw(e).formatter.toggle(t,n,o)})(e,t,n,o)},match:(t,n,o,r)=>((e,t,n,o,r)=>gw(e).formatter.match(t,n,o,r))(e,t,n,o,r),closest:t=>((e,t)=>gw(e).formatter.closest(t))(e,t),matchAll:(t,n)=>((e,t,n)=>gw(e).formatter.matchAll(t,n))(e,t,n),matchNode:(t,n,o,r)=>((e,t,n,o,r)=>gw(e).formatter.matchNode(t,n,o,r))(e,t,n,o,r),canApply:t=>((e,t)=>gw(e).formatter.canApply(t))(e,t),formatChanged:(t,o,r,s)=>((e,t,n,o,r,s)=>gw(e).formatter.formatChanged(t,n,o,r,s))(e,n,t,o,r,s),getCssText:T(RE,e)}},TE=e=>{switch(e.toLowerCase()){case"undo":case"redo":case"mcefocus":return!0;default:return!1}},OE=e=>{const t=Pr(),n=Or(0),o=Or(0),r={data:[],typing:!1,beforeChange:()=>{((e,t,n)=>{gw(e).undoManager.beforeChange(t,n)})(e,n,t)},add:(s,a)=>((e,t,n,o,r,s,a)=>gw(e).undoManager.add(t,n,o,r,s,a))(e,r,o,n,t,s,a),dispatchChange:()=>{e.setDirty(!0);const t=ow(e);t.bookmark=Cl(e.selection),e.dispatch("change",{level:t,lastLevel:ie(r.data,o.get()).getOrUndefined()})},undo:()=>((e,t,n,o)=>gw(e).undoManager.undo(t,n,o))(e,r,n,o),redo:()=>((e,t,n)=>gw(e).undoManager.redo(t,n))(e,o,r.data),clear:()=>{((e,t,n)=>{gw(e).undoManager.clear(t,n)})(e,r,o)},reset:()=>{((e,t)=>{gw(e).undoManager.reset(t)})(e,r)},hasUndo:()=>((e,t,n)=>gw(e).undoManager.hasUndo(t,n))(e,r,o),hasRedo:()=>((e,t,n)=>gw(e).undoManager.hasRedo(t,n))(e,r,o),transact:t=>((e,t,n,o)=>gw(e).undoManager.transact(t,n,o))(e,r,n,t),ignore:t=>{((e,t,n)=>{gw(e).undoManager.ignore(t,n)})(e,n,t)},extra:(t,n)=>{((e,t,n,o,r)=>{gw(e).undoManager.extra(t,n,o,r)})(e,r,o,t,n)}};return mw(e)||((e,t,n)=>{const o=Or(!1),r=e=>{dw(t,!1,n),t.add({},e)};e.on("init",(()=>{t.add()})),e.on("BeforeExecCommand",(e=>{const o=e.command;TE(o)||(cw(t,n),t.beforeChange())})),e.on("ExecCommand",(e=>{const t=e.command;TE(t)||r(e)})),e.on("ObjectResizeStart cut",(()=>{t.beforeChange()})),e.on("SaveContent ObjectResized blur",r),e.on("dragend",r),e.on("keyup",(n=>{const s=n.keyCode;if(n.isDefaultPrevented())return;const a=Tt.os.isMacOS()&&"Meta"===n.key;(s>=33&&s<=36||s>=37&&s<=40||45===s||n.ctrlKey||a)&&(r(),e.nodeChanged()),46!==s&&8!==s||e.nodeChanged(),o.get()&&t.typing&&!iw(ow(e),t.data[0])&&(e.isDirty()||e.setDirty(!0),e.dispatch("TypingUndo"),o.set(!1),e.nodeChanged())})),e.on("keydown",(e=>{const s=e.keyCode;if(e.isDefaultPrevented())return;if(s>=33&&s<=36||s>=37&&s<=40||45===s)return void(t.typing&&r(e));const a=e.ctrlKey&&!e.altKey||e.metaKey;if((s<16||s>20)&&224!==s&&91!==s&&!t.typing&&!a)return t.beforeChange(),dw(t,!0,n),t.add({},e),void o.set(!0);(Tt.os.isMacOS()?e.metaKey:e.ctrlKey&&!e.altKey)&&t.beforeChange()})),e.on("mousedown",(e=>{t.typing&&r(e)})),e.on("input",(e=>{var t;e.inputType&&("insertReplacementText"===e.inputType||"insertText"===(t=e).inputType&&null===t.data||(e=>"insertFromPaste"===e.inputType||"insertFromDrop"===e.inputType)(e))&&r(e)})),e.on("AddUndo Undo Redo ClearUndos",(t=>{t.isDefaultPrevented()||e.nodeChanged()}))})(e,r,n),(e=>{e.addShortcut("meta+z","","Undo"),e.addShortcut("meta+y,meta+shift+z","","Redo")})(e),r},BE=[9,27,Qf.HOME,Qf.END,19,20,44,144,145,33,34,45,16,17,18,91,92,93,Qf.DOWN,Qf.UP,Qf.LEFT,Qf.RIGHT].concat(Tt.browser.isFirefox()?[224]:[]),PE="data-mce-placeholder",DE=e=>"keydown"===e.type||"keyup"===e.type,LE=e=>{const t=e.keyCode;return t===Qf.BACKSPACE||t===Qf.DELETE},ME=(e,t)=>({from:e,to:t}),IE=(e,t)=>{const n=Cn(e),o=Cn(t.container());return zh(n,o).map((e=>((e,t)=>({block:e,position:t}))(e,t)))},FE=(e,t)=>Zn(t,(e=>Ga(e)||hr(e.dom)),(t=>kn(t,e))).filter(Kt).getOr(e),UE=(e,t)=>{const n=((e,t)=>{const n=In(e);return J(n,(e=>t.isBlock($t(e)))).fold(N(n),(e=>n.slice(0,e)))})(e,t);return q(n,Eo),n},zE=(e,t,n)=>{const o=Hp(n,t);return Q(o.reverse(),(t=>Ar(e,t))).each(Eo)},jE=(e,t,n,o,r)=>{if(Ar(o,n))return Qa(n),Zu(n.dom);((e,t)=>0===Y(Ln(t),(t=>!Ar(e,t))).length)(o,r)&&Ar(o,t)&&po(r,vn("br"));const s=Xu(n.dom,Ji.before(r.dom));return q(UE(t,o),(e=>{po(r,e)})),zE(o,e,t),s},HE=(e,t,n,o)=>{if(Ar(o,n)){if(Ar(o,t)){const e=e=>{const t=(e,n)=>Un(e).fold((()=>n),(e=>((e,t)=>e.isInline($t(t)))(o,e)?t(e,n.concat(Ma(e))):n));return t(e,[])},r=G(e(n),((e,t)=>(yo(e,t),t)),Za());wo(t),vo(t,r)}return Eo(n),Zu(t.dom)}const r=Qu(n.dom);return q(UE(t,o),(e=>{vo(n,e)})),zE(o,e,t),r},$E=(e,t)=>{Yu(e,t.dom).bind((e=>I.from(e.getNode()))).map(Cn).filter(Va).each(Eo)},VE=(e,t,n,o)=>($E(!0,t),$E(!1,n),((e,t)=>Sn(t,e)?((e,t)=>{const n=Hp(t,e);return I.from(n[n.length-1])})(t,e):I.none())(t,n).fold(T(HE,e,t,n,o),T(jE,e,t,n,o))),qE=(e,t,n,o,r)=>t?VE(e,o,n,r):VE(e,n,o,r),WE=(e,t)=>{const n=Cn(e.getBody()),o=((e,t,n,o)=>o.collapsed?((e,t,n,o)=>{const r=IE(t,Ji.fromRangeStart(o)),s=r.bind((o=>qu(n,t,o.position).bind((o=>IE(t,o).map((o=>((e,t,n,o)=>gr(o.position.getNode())&&!Ar(e,o.block)?Yu(!1,o.block.dom).bind((e=>e.isEqual(o.position)?qu(n,t,e).bind((e=>IE(t,e))):I.some(o))).getOr(o):o)(e,t,n,o)))))));return It(r,s,ME).filter((e=>(e=>!kn(e.from.block,e.to.block))(e)&&((e,t)=>{const n=Cn(e);return kn(FE(n,t.from.block),FE(n,t.to.block))})(t,e)&&(e=>!1===br(e.from.block.dom)&&!1===br(e.to.block.dom))(e)&&(e=>{const t=e=>qa(e)||Kr(e.dom)||Ka(e);return t(e.from.block)&&t(e.to.block)})(e)&&(e=>!(Sn(e.to.block,e.from.block)||Sn(e.from.block,e.to.block)))(e)))})(e,t,n,o):I.none())(e.schema,n.dom,t,e.selection.getRng()).map((o=>()=>{qE(n,t,o.from.block,o.to.block,e.schema).each((t=>{e.selection.setRng(t.toRange())}))}));return o},KE=(e,t)=>{const n=Cn(t),o=T(kn,e);return Xn(n,Ga,o).isSome()},YE=e=>{const t=Cn(e.getBody());return((e,t)=>{const n=Xu(e.dom,Ji.fromRangeStart(t)).isNone(),o=Gu(e.dom,Ji.fromRangeEnd(t)).isNone();return!((e,t)=>KE(e,t.startContainer)||KE(e,t.endContainer))(e,t)&&n&&o})(t,e.selection.getRng())?(e=>I.some((()=>{e.setContent(""),e.selection.setCursorLocation()})))(e):((e,t,n)=>{const o=t.getRng();return It(zh(e,Cn(o.startContainer)),zh(e,Cn(o.endContainer)),((r,s)=>kn(r,s)?I.none():I.some((()=>{o.deleteContents(),qE(e,!0,r,s,n).each((e=>{t.setRng(e.toRange())}))})))).getOr(I.none())})(t,e.selection,e.schema)},GE=(e,t)=>e.selection.isCollapsed()?I.none():YE(e),XE=(e,t,n,o,r)=>I.from(t._selectionOverrides.showCaret(e,n,o,r)),ZE=(e,t)=>e.dispatch("BeforeObjectSelected",{target:t}).isDefaultPrevented()?I.none():I.some((e=>{const t=e.ownerDocument.createRange();return t.selectNode(e),t})(t)),QE=(e,t,n)=>t.collapsed?((e,t,n)=>{const o=_u(1,e.getBody(),t),r=Ji.fromRangeStart(o),s=r.getNode();if(tu(s))return XE(1,e,s,!r.isAtEnd(),!1);const a=r.getNode(!0);if(tu(a))return XE(1,e,a,!1,!1);const i=bb(e.dom.getRoot(),r.getNode());return tu(i)?XE(1,e,i,!1,n):I.none()})(e,t,n).getOr(t):t,JE=e=>Up(e)||Lp(e),ex=e=>zp(e)||Mp(e),tx=(e,t,n,o,r,s)=>{XE(o,e,s.getNode(!r),r,!0).each((n=>{if(t.collapsed){const e=t.cloneRange();r?e.setEnd(n.startContainer,n.startOffset):e.setStart(n.endContainer,n.endOffset),e.deleteContents()}else t.deleteContents();e.selection.setRng(n)})),((e,t)=>{lr(t)&&0===t.data.length&&e.remove(t)})(e.dom,n)},nx=(e,t)=>((e,t)=>{const n=e.selection.getRng();if(!lr(n.commonAncestorContainer))return I.none();const o=t?Tu.Forwards:Tu.Backwards,r=ju(e.getBody()),s=T(Ru,t?r.next:r.prev),a=t?JE:ex,i=Su(o,e.getBody(),n),l=s(i),d=l?Ph(t,l):l;if(!d||!Au(i,d))return I.none();if(a(d))return I.some((()=>tx(e,n,i.getNode(),o,t,d)));const c=s(d);return c&&a(c)&&Au(d,c)?I.some((()=>tx(e,n,i.getNode(),o,t,c))):I.none()})(e,t),ox=(e,t)=>{const n=e.getBody();return t?Zu(n).filter(Up):Qu(n).filter(zp)},rx=e=>{const t=e.selection.getRng();return!t.collapsed&&(ox(e,!0).exists((e=>e.isEqual(Ji.fromRangeStart(t))))||ox(e,!1).exists((e=>e.isEqual(Ji.fromRangeEnd(t)))))},sx=_l([{remove:["element"]},{moveToElement:["element"]},{moveToPosition:["position"]}]),ax=(e,t,n,o)=>qu(t,e,n).bind((r=>{return s=r.getNode(),C(s)&&(Ga(Cn(s))||Ka(Cn(s)))||((e,t,n,o,r)=>{const s=t=>r.isInline(t.nodeName.toLowerCase())&&!bu(n,o,e);return ku(!t,n).fold((()=>ku(t,o).fold(L,s)),s)})(e,t,n,r,o)?I.none():t&&br(r.getNode())||!t&&br(r.getNode(!0))?((e,t,n,o,r)=>{const s=r.getNode(!n);return zh(Cn(t),Cn(o.getNode())).map((t=>Ar(e,t)?sx.remove(t.dom):sx.moveToElement(s))).orThunk((()=>I.some(sx.moveToElement(s))))})(o,e,t,n,r):t&&zp(n)||!t&&Up(n)?I.some(sx.moveToPosition(r)):I.none();var s})),ix=(e,t)=>I.from(bb(e.getBody(),t)),lx=(e,t)=>{const n=e.selection.getNode();return ix(e,n).filter(br).fold((()=>((e,t,n,o)=>{const r=_u(t?1:-1,e,n),s=Ji.fromRangeStart(r),a=Cn(e);return!t&&zp(s)?I.some(sx.remove(s.getNode(!0))):t&&Up(s)?I.some(sx.remove(s.getNode())):!t&&Up(s)&&eh(a,s,o)?th(a,s,o).map((e=>sx.remove(e.getNode()))):t&&zp(s)&&Jp(a,s,o)?nh(a,s,o).map((e=>sx.remove(e.getNode()))):((e,t,n,o)=>((e,t)=>{const n=t.getNode(!e),o=e?"after":"before";return Jo(n)&&n.getAttribute("data-mce-caret")===o})(t,n)?((e,t)=>y(t)?I.none():e&&br(t.nextSibling)?I.some(sx.moveToElement(t.nextSibling)):!e&&br(t.previousSibling)?I.some(sx.moveToElement(t.previousSibling)):I.none())(t,n.getNode(!t)).orThunk((()=>ax(e,t,n,o))):ax(e,t,n,o).bind((t=>((e,t,n)=>n.fold((e=>I.some(sx.remove(e))),(e=>I.some(sx.moveToElement(e))),(n=>bu(t,n,e)?I.none():I.some(sx.moveToPosition(n)))))(e,n,t))))(e,t,s,o)})(e.getBody(),t,e.selection.getRng(),e.schema).map((n=>()=>n.fold(((e,t)=>n=>(e._selectionOverrides.hideFakeCaret(),Rh(e,t,Cn(n)),!0))(e,t),((e,t)=>n=>{const o=t?Ji.before(n):Ji.after(n);return e.selection.setRng(o.toRange()),!0})(e,t),(e=>t=>(e.selection.setRng(t.toRange()),!0))(e))))),(()=>I.some(_)))},dx=e=>{const t=e.dom,n=e.selection,o=bb(e.getBody(),n.getNode());if(hr(o)&&t.isBlock(o)&&t.isEmpty(o)){const e=t.create("br",{"data-mce-bogus":"1"});t.setHTML(o,""),o.appendChild(e),n.setRng(Ji.before(e).toRange())}return!0},cx=(e,t)=>e.selection.isCollapsed()?lx(e,t):((e,t)=>{const n=e.selection.getNode();return br(n)&&!vr(n)?ix(e,n.parentNode).filter(br).fold((()=>I.some((()=>{var n;n=Cn(e.getBody()),q(Uo(n,".mce-offscreen-selection"),Eo),Rh(e,t,Cn(e.selection.getNode())),jh(e)}))),(()=>I.some(_))):rx(e)?I.some((()=>{Vh(e,e.selection.getRng(),Cn(e.getBody()))})):I.none()})(e,t),ux=e=>e.hasOwnProperty("text"),mx=e=>e.hasOwnProperty("marker"),fx=(e,t)=>{const n=(e,n)=>{if(lr(e))return{text:e,offset:n};{const o=t(),r=e.childNodes;return n<r.length?(e.insertBefore(o,r[n]),{marker:o,before:!0}):(e.appendChild(o),{marker:o,before:!1})}},o=n(e.endContainer,e.endOffset);return{start:n(e.startContainer,e.startOffset),end:o}},gx=e=>{var t,n;const{start:o,end:r}=e,s=new window.Range;return ux(o)?s.setStart(o.text,o.offset):mx(o)&&(o.before?s.setStartBefore(o.marker):s.setStartAfter(o.marker),null===(t=o.marker.parentNode)||void 0===t||t.removeChild(o.marker)),ux(r)?s.setEnd(r.text,r.offset):mx(r)&&(r.before?s.setEndBefore(r.marker):s.setEndAfter(r.marker),null===(n=r.marker.parentNode)||void 0===n||n.removeChild(r.marker)),s},px=(e,t)=>{var n;const o=e.dom,r=o.getParent(e.selection.getStart(),o.isBlock),s=o.getParent(e.selection.getEnd(),o.isBlock),a=e.getBody();if("div"===(null===(n=null==r?void 0:r.nodeName)||void 0===n?void 0:n.toLowerCase())&&r&&s&&r===a.firstChild&&s===a.lastChild&&!o.isEmpty(a)){const n=r.cloneNode(!1),o=()=>{if(t?Fh(e):Ih(e),a.firstChild!==r){const t=fx(e.selection.getRng(),(()=>document.createElement("span")));Array.from(a.childNodes).forEach((e=>n.appendChild(e))),a.appendChild(n),e.selection.setRng(gx(t))}};return I.some(o)}return I.none()},hx=(e,t)=>e.selection.isCollapsed()?((e,t)=>{const n=Ji.fromRangeStart(e.selection.getRng());return qu(t,e.getBody(),n).filter((e=>t?Pp(e):Dp(e))).bind((e=>vu(t?0:-1,e))).map((t=>()=>e.selection.select(t)))})(e,t):I.none(),bx=lr,vx=e=>bx(e)&&e.data[0]===Ja,yx=e=>bx(e)&&e.data[e.data.length-1]===Ja,Cx=e=>{var t;return(null!==(t=e.ownerDocument)&&void 0!==t?t:document).createTextNode(Ja)},wx=(e,t)=>e?(e=>{var t;if(bx(e.previousSibling))return yx(e.previousSibling)||e.previousSibling.appendData(Ja),e.previousSibling;if(bx(e))return vx(e)||e.insertData(0,Ja),e;{const n=Cx(e);return null===(t=e.parentNode)||void 0===t||t.insertBefore(n,e),n}})(t):(e=>{var t,n;if(bx(e.nextSibling))return vx(e.nextSibling)||e.nextSibling.insertData(0,Ja),e.nextSibling;if(bx(e))return yx(e)||e.appendData(Ja),e;{const o=Cx(e);return e.nextSibling?null===(t=e.parentNode)||void 0===t||t.insertBefore(o,e.nextSibling):null===(n=e.parentNode)||void 0===n||n.appendChild(o),o}})(t),Ex=T(wx,!0),xx=T(wx,!1),_x=(e,t)=>lr(e.container())?wx(t,e.container()):wx(t,e.getNode()),kx=(e,t)=>{const n=t.get();return n&&e.container()===n&&si(n)},Sx=(e,t)=>t.fold((t=>{Yc(e.get());const n=Ex(t);return e.set(n),I.some(Ji(n,n.length-1))}),(t=>Zu(t).map((t=>{if(kx(t,e)){const t=e.get();return Ji(t,1)}{Yc(e.get());const n=_x(t,!0);return e.set(n),Ji(n,1)}}))),(t=>Qu(t).map((t=>{if(kx(t,e)){const t=e.get();return Ji(t,t.length-1)}{Yc(e.get());const n=_x(t,!1);return e.set(n),Ji(n,n.length-1)}}))),(t=>{Yc(e.get());const n=xx(t);return e.set(n),I.some(Ji(n,1))})),Nx=(e,t)=>{for(let n=0;n<e.length;n++){const o=e[n].apply(null,t);if(o.isSome())return o}return I.none()},Rx=_l([{before:["element"]},{start:["element"]},{end:["element"]},{after:["element"]}]),Ax=(e,t)=>hu(t,e)||e,Tx=(e,t,n)=>{const o=Dh(n),r=Ax(t,o.container());return Bh(e,r,o).fold((()=>Gu(r,o).bind(T(Bh,e,r)).map((e=>Rx.before(e)))),I.none)},Ox=(e,t)=>null===tm(e,t),Bx=(e,t,n)=>Bh(e,t,n).filter(T(Ox,t)),Px=(e,t,n)=>{const o=Lh(n);return Bx(e,t,o).bind((e=>Xu(e,o).isNone()?I.some(Rx.start(e)):I.none()))},Dx=(e,t,n)=>{const o=Dh(n);return Bx(e,t,o).bind((e=>Gu(e,o).isNone()?I.some(Rx.end(e)):I.none()))},Lx=(e,t,n)=>{const o=Lh(n),r=Ax(t,o.container());return Bh(e,r,o).fold((()=>Xu(r,o).bind(T(Bh,e,r)).map((e=>Rx.after(e)))),I.none)},Mx=e=>!Oh(Fx(e)),Ix=(e,t,n)=>Nx([Tx,Px,Dx,Lx],[e,t,n]).filter(Mx),Fx=e=>e.fold(R,R,R,R),Ux=e=>e.fold(N("before"),N("start"),N("end"),N("after")),zx=e=>e.fold(Rx.before,Rx.before,Rx.after,Rx.after),jx=e=>e.fold(Rx.start,Rx.start,Rx.end,Rx.end),Hx=(e,t,n,o,r,s)=>It(Bh(t,n,o),Bh(t,n,r),((t,o)=>t!==o&&((e,t,n)=>{const o=hu(t,e),r=hu(n,e);return C(o)&&o===r})(n,t,o)?Rx.after(e?t:o):s)).getOr(s),$x=(e,t)=>e.fold(M,(e=>{return o=t,!(Ux(n=e)===Ux(o)&&Fx(n)===Fx(o));var n,o})),Vx=(e,t)=>e?t.fold(k(I.some,Rx.start),I.none,k(I.some,Rx.after),I.none):t.fold(I.none,k(I.some,Rx.before),I.none,k(I.some,Rx.end)),qx=(e,t,n)=>{const o=e?1:-1;return t.setRng(Ji(n.container(),n.offset()+o).toRange()),t.getSel().modify("move",e?"forward":"backward","word"),!0};var Wx;!function(e){e[e.Br=0]="Br",e[e.Block=1]="Block",e[e.Wrap=2]="Wrap",e[e.Eol=3]="Eol"}(Wx||(Wx={}));const Kx=(e,t)=>e===Tu.Backwards?oe(t):t,Yx=(e,t,n)=>e===Tu.Forwards?t.next(n):t.prev(n),Gx=(e,t,n,o)=>gr(o.getNode(t===Tu.Forwards))?Wx.Br:!1===bu(n,o)?Wx.Block:Wx.Wrap,Xx=(e,t,n,o)=>{const r=ju(n);let s=o;const a=[];for(;s;){const n=Yx(t,r,s);if(!n)break;if(gr(n.getNode(!1)))return t===Tu.Forwards?{positions:Kx(t,a).concat([n]),breakType:Wx.Br,breakAt:I.some(n)}:{positions:Kx(t,a),breakType:Wx.Br,breakAt:I.some(n)};if(n.isVisible()){if(e(s,n)){const e=Gx(0,t,s,n);return{positions:Kx(t,a),breakType:e,breakAt:I.some(n)}}a.push(n),s=n}else s=n}return{positions:Kx(t,a),breakType:Wx.Eol,breakAt:I.none()}},Zx=(e,t,n,o)=>t(n,o).breakAt.map((o=>{const r=t(n,o).positions;return e===Tu.Backwards?r.concat(o):[o].concat(r)})).getOr([]),Qx=(e,t)=>X(e,((e,n)=>e.fold((()=>I.some(n)),(o=>It(le(o.getClientRects()),le(n.getClientRects()),((e,r)=>{const s=Math.abs(t-e.left);return Math.abs(t-r.left)<=s?n:o})).or(e)))),I.none()),Jx=(e,t)=>le(t.getClientRects()).bind((t=>Qx(e,t.left))),e_=T(Xx,Ji.isAbove,-1),t_=T(Xx,Ji.isBelow,1),n_=T(Zx,-1,e_),o_=T(Zx,1,t_),r_=(e,t)=>e_(e,t).breakAt.isNone(),s_=(e,t)=>t_(e,t).breakAt.isNone(),a_=(e,t)=>Jx(n_(e,t),t),i_=(e,t)=>Jx(o_(e,t),t),l_=br,d_=(e,t)=>Math.abs(e.left-t),c_=(e,t)=>Math.abs(e.right-t),u_=(e,t)=>Be(e,((e,n)=>{const o=Math.min(d_(e,t),c_(e,t)),r=Math.min(d_(n,t),c_(n,t));return r===o&&ke(n,"node")&&l_(n.node)||r<o?n:e})),m_=e=>{const t=t=>V(t,(t=>{const n=pi(t);return n.node=e,n}));if(Jo(e))return t(e.getClientRects());if(lr(e)){const n=e.ownerDocument.createRange();return n.setStart(e,0),n.setEnd(e,e.data.length),t(n.getClientRects())}return[]},f_=e=>te(e,m_);var g_;!function(e){e[e.Up=-1]="Up",e[e.Down=1]="Down"}(g_||(g_={}));const p_=(e,t,n,o,r,s)=>{let a=0;const i=[],l=o=>{let s=f_([o]);-1===e&&(s=s.reverse());for(let e=0;e<s.length;e++){const o=s[e];if(!n(o,d)){if(i.length>0&&t(o,De(i))&&a++,o.line=a,r(o))return!0;i.push(o)}}return!1},d=De(s.getClientRects());if(!d)return i;const c=s.getNode();return c&&(l(c),((e,t,n,o)=>{let r=o;for(;r=pu(r,e,Li,t);)if(n(r))return})(e,o,l,c)),i},h_=T(p_,g_.Up,vi,yi),b_=T(p_,g_.Down,yi,vi),v_=e=>De(e.getClientRects()),y_=e=>t=>((e,t)=>t.line>e)(e,t),C_=e=>t=>((e,t)=>t.line===e)(e,t),w_=(e,t)=>{e.selection.setRng(t),Vg(e,e.selection.getRng())},E_=(e,t,n)=>I.some(QE(e,t,n)),x_=(e,t,n,o,r,s)=>{const a=t===Tu.Forwards,i=ju(e.getBody()),l=T(Ru,a?i.next:i.prev),d=a?o:r;if(!n.collapsed){const o=wi(n);if(s(o))return XE(t,e,o,t===Tu.Backwards,!1);if(rx(e)){const e=n.cloneRange();return e.collapse(t===Tu.Backwards),I.from(e)}}const c=Su(t,e.getBody(),n);if(d(c))return ZE(e,c.getNode(!a));let u=l(c);const m=fi(n);if(!u)return m?I.some(n):I.none();if(u=Ph(a,u),d(u))return XE(t,e,u.getNode(!a),a,!1);const f=l(u);return f&&d(f)&&Au(u,f)?XE(t,e,f.getNode(!a),a,!1):m?E_(e,u.toRange(),!1):I.none()},__=(e,t,n,o,r,s)=>{const a=Su(t,e.getBody(),n),i=De(a.getClientRects()),l=t===g_.Down,d=e.getBody();if(!i)return I.none();if(rx(e)){const e=l?Ji.fromRangeEnd(n):Ji.fromRangeStart(n);return(l?i_:a_)(d,e).orThunk((()=>I.from(e))).map((e=>e.toRange()))}const c=(l?b_:h_)(d,y_(1),a),u=Y(c,C_(1)),m=i.left,f=u_(u,m);if(f&&s(f.node)){const n=Math.abs(m-f.left),o=Math.abs(m-f.right);return XE(t,e,f.node,n<o,!1)}let g;if(g=o(a)?a.getNode():r(a)?a.getNode(!0):wi(n),g){const n=((e,t,n,o)=>{const r=ju(t);let s,a,i,l;const d=[];let c=0;1===e?(s=r.next,a=yi,i=vi,l=Ji.after(o)):(s=r.prev,a=vi,i=yi,l=Ji.before(o));const u=v_(l);do{if(!l.isVisible())continue;const e=v_(l);if(i(e,u))continue;d.length>0&&a(e,De(d))&&c++;const t=pi(e);if(t.position=l,t.line=c,n(t))return d;d.push(t)}while(l=s(l));return d})(t,d,y_(1),g);let o=u_(Y(n,C_(1)),m);if(o)return E_(e,o.position.toRange(),!1);if(o=De(Y(n,C_(0))),o)return E_(e,o.position.toRange(),!1)}return 0===u.length?k_(e,l).filter(l?r:o).map((t=>QE(e,t.toRange(),!1))):I.none()},k_=(e,t)=>{const n=e.selection.getRng(),o=t?Ji.fromRangeEnd(n):Ji.fromRangeStart(n),r=(s=o.container(),a=e.getBody(),Xn(Cn(s),(e=>ou(e.dom)),(e=>e.dom===a)).map((e=>e.dom)).getOr(a));var s,a;if(t){const e=t_(r,o);return de(e.positions)}{const e=e_(r,o);return le(e.positions)}},S_=(e,t,n)=>k_(e,t).filter(n).exists((t=>(e.selection.setRng(t.toRange()),!0))),N_=(e,t)=>{const n=e.dom.createRng();n.setStart(t.container(),t.offset()),n.setEnd(t.container(),t.offset()),e.selection.setRng(n)},R_=(e,t)=>{e?t.setAttribute("data-mce-selected","inline-boundary"):t.removeAttribute("data-mce-selected")},A_=(e,t,n)=>Sx(t,n).map((t=>(N_(e,t),n))),T_=(e,t,n)=>{const o=e.getBody(),r=((e,t,n)=>{const o=Ji.fromRangeStart(e);if(e.collapsed)return o;{const r=Ji.fromRangeEnd(e);return n?Xu(t,r).getOr(r):Gu(t,o).getOr(o)}})(e.selection.getRng(),o,n);return((e,t,n,o)=>{const r=Ph(e,o),s=Ix(t,n,r);return Ix(t,n,r).bind(T(Vx,e)).orThunk((()=>((e,t,n,o,r)=>{const s=Ph(e,r);return qu(e,n,s).map(T(Ph,e)).fold((()=>o.map(zx)),(r=>Ix(t,n,r).map(T(Hx,e,t,n,s,r)).filter(T($x,o)))).filter(Mx)})(e,t,n,s,o)))})(n,T(Th,e),o,r).bind((n=>A_(e,t,n)))},O_=(e,t,n)=>!!Ld(e)&&T_(e,t,n).isSome(),B_=(e,t,n)=>!!Ld(t)&&((e,t)=>{const n=t.selection.getRng(),o=e?Ji.fromRangeEnd(n):Ji.fromRangeStart(n);return!!(e=>w(e.selection.getSel().modify))(t)&&(e&&li(o)?qx(!0,t.selection,o):!(e||!di(o))&&qx(!1,t.selection,o))})(e,t),P_=e=>{const t=Or(null),n=T(Th,e);return e.on("NodeChange",(o=>{Ld(e)&&(((e,t,n)=>{const o=V(Uo(Cn(t.getRoot()),'*[data-mce-selected="inline-boundary"]'),(e=>e.dom)),r=Y(o,e),s=Y(n,e);q(re(r,s),T(R_,!1)),q(re(s,r),T(R_,!0))})(n,e.dom,o.parents),((e,t)=>{const n=t.get();if(e.selection.isCollapsed()&&!e.composing&&n){const o=Ji.fromRangeStart(e.selection.getRng());Ji.isTextPosition(o)&&!(e=>li(e)||di(e))(o)&&(N_(e,Kc(n,o)),t.set(null))}})(e,t),((e,t,n,o)=>{if(t.selection.isCollapsed()){const r=Y(o,e);q(r,(o=>{const r=Ji.fromRangeStart(t.selection.getRng());Ix(e,t.getBody(),r).bind((e=>A_(t,n,e)))}))}})(n,e,t,o.parents))})),t},D_=T(B_,!0),L_=T(B_,!1),M_=(e,t,n)=>{if(Ld(e)){const o=k_(e,t).getOrThunk((()=>{const n=e.selection.getRng();return t?Ji.fromRangeEnd(n):Ji.fromRangeStart(n)}));return Ix(T(Th,e),e.getBody(),o).exists((t=>{const o=zx(t);return Sx(n,o).exists((t=>(N_(e,t),!0)))}))}return!1},I_=(e,t)=>n=>Sx(t,n).map((t=>()=>N_(e,t))),F_=(e,t,n,o)=>{const r=e.getBody(),s=T(Th,e);e.undoManager.ignore((()=>{e.selection.setRng(((e,t)=>{const n=document.createRange();return n.setStart(e.container(),e.offset()),n.setEnd(t.container(),t.offset()),n})(n,o)),Ih(e),Ix(s,r,Ji.fromRangeStart(e.selection.getRng())).map(jx).bind(I_(e,t)).each(D)})),e.nodeChanged()},U_=(e,t,n)=>{if(e.selection.isCollapsed()&&Ld(e)){const o=Ji.fromRangeStart(e.selection.getRng());return((e,t,n,o)=>{const r=((e,t)=>hu(t,e)||e)(e.getBody(),o.container()),s=T(Th,e),a=Ix(s,r,o);return a.bind((e=>n?e.fold(N(I.some(jx(e))),I.none,N(I.some(zx(e))),I.none):e.fold(I.none,N(I.some(zx(e))),I.none,N(I.some(jx(e)))))).map(I_(e,t)).getOrThunk((()=>{const i=Wu(n,r,o),l=i.bind((e=>Ix(s,r,e)));return It(a,l,(()=>Bh(s,r,o).bind((t=>(e=>It(Zu(e),Qu(e),((t,n)=>{const o=Ph(!0,t),r=Ph(!1,n);return Gu(e,o).forall((e=>e.isEqual(r)))})).getOr(!0))(t)?I.some((()=>{Rh(e,n,Cn(t))})):I.none())))).getOrThunk((()=>l.bind((()=>i.map((r=>()=>{n?F_(e,t,o,r):F_(e,t,r,o)}))))))}))})(e,t,n,o)}return I.none()},z_=(e,t)=>{const n=Cn(e.getBody()),o=Cn(e.selection.getStart()),r=Hp(o,n);return J(r,t).fold(N(r),(e=>r.slice(0,e)))},j_=e=>1===jn(e),H_=(e,t)=>{const n=T(cv,e);return te(t,(e=>n(e)?[e.dom]:[]))},$_=e=>{const t=(e=>z_(e,(t=>e.schema.isBlock($t(t)))))(e);return H_(e,t)},V_=(e,t)=>{const n=Y((e=>z_(e,(t=>e.schema.isBlock($t(t))||(e=>jn(e)>1)(t))))(e),j_);return de(n).bind((o=>{const r=Ji.fromRangeStart(e.selection.getRng());return Hh(t,r,o.dom)&&!Xm(o)?I.some((()=>((e,t,n,o)=>{const r=H_(t,o);if(0===r.length)Rh(t,e,n);else{const e=dv(n.dom,r);t.selection.setRng(e.toRange())}})(t,e,o,n))):I.none()}))},q_=(e,t)=>{const n=e.selection.getStart(),o=((e,t)=>{const n=t.parentElement;return gr(t)&&!h(n)&&e.dom.isEmpty(n)})(e,n)||Xm(Cn(n))?dv(n,t):((e,t)=>{const{caretContainer:n,caretPosition:o}=lv(t);return e.insertNode(n.dom),o})(e.selection.getRng(),t);e.selection.setRng(o.toRange())},W_=e=>lr(e.startContainer),K_=e=>{const t=e.selection.getRng();return(e=>0===e.startOffset&&W_(e))(t)&&((e,t)=>{const n=t.startContainer.parentElement;return!h(n)&&cv(e,Cn(n))})(e,t)&&(e=>(e=>(e=>{const t=e.startContainer.parentNode,n=e.endContainer.parentNode;return!h(t)&&!h(n)&&t.isEqualNode(n)})(e)&&(e=>{const t=e.endContainer;return e.endOffset===(lr(t)?t.length:t.childNodes.length)})(e))(e)||(e=>!e.endContainer.isEqualNode(e.commonAncestorContainer))(e))(t)},Y_=(e,t)=>e.selection.isCollapsed()?V_(e,t):(e=>{if(K_(e)){const t=$_(e);return I.some((()=>{Ih(e),((e,t)=>{const n=re(t,$_(e));n.length>0&&q_(e,n)})(e,t)}))}return I.none()})(e),G_=e=>((e=>{const t=e.selection.getRng();return t.collapsed&&(W_(t)||e.dom.isEmpty(t.startContainer))&&!(e=>{return t=Cn(e.selection.getStart()),n=e.schema,zo(t,(e=>em(e.dom)),(e=>n.isBlock($t(e))));var t,n})(e)})(e)&&q_(e,[]),!0),X_=(e,t,n)=>C(n)?I.some((()=>{e._selectionOverrides.hideFakeCaret(),Rh(e,t,Cn(n))})):I.none(),Z_=(e,t)=>e.selection.isCollapsed()?((e,t)=>{const n=t?Lp:Mp,o=t?Tu.Forwards:Tu.Backwards,r=Su(o,e.getBody(),e.selection.getRng());return n(r)?X_(e,t,r.getNode(!t)):I.from(Ph(t,r)).filter((e=>n(e)&&Au(r,e))).bind((n=>X_(e,t,n.getNode(!t))))})(e,t):((e,t)=>{const n=e.selection.getNode();return Cr(n)?X_(e,t,n):I.none()})(e,t),Q_=e=>Ze(null!=e?e:"").getOr(0),J_=(e,t)=>(e||"table"===$t(t)?"margin":"padding")+("rtl"===co(t,"direction")?"-right":"-left"),ek=e=>{const t=nk(e);return!e.mode.isReadOnly()&&(t.length>1||((e,t)=>ne(t,(t=>{const n=J_(yd(e),t),o=mo(t,n).map(Q_).getOr(0);return"false"!==e.dom.getContentEditable(t.dom)&&o>0})))(e,t))},tk=e=>Wa(e)||Ka(e),nk=e=>Y(_o(e.selection.getSelectedBlocks()),(e=>!tk(e)&&!(e=>Tn(e).exists(tk))(e)&&Zn(e,(e=>hr(e.dom)||br(e.dom))).exists((e=>hr(e.dom))))),ok=(e,t)=>{var n,o;if(e.mode.isReadOnly())return;const{dom:r}=e,s=Cd(e),a=null!==(o=null===(n=/[a-z%]+$/i.exec(s))||void 0===n?void 0:n[0])&&void 0!==o?o:"px",i=Q_(s),l=yd(e);q(nk(e),(e=>{((e,t,n,o,r,s)=>{const a=J_(n,Cn(s)),i=Q_(e.getStyle(s,a));if("outdent"===t){const t=Math.max(0,i-o);e.setStyle(s,a,t?t+r:"")}else{const t=i+o+r;e.setStyle(s,a,t)}})(r,t,l,i,a,e.dom)}))},rk=e=>ok(e,"outdent"),sk=e=>{if(e.selection.isCollapsed()&&ek(e)){const t=e.dom,n=e.selection.getRng(),o=Ji.fromRangeStart(n),r=t.getParent(n.startContainer,t.isBlock);if(null!==r&&Kp(Cn(r),o,e.schema))return I.some((()=>rk(e)))}return I.none()},ak=(e,t,n)=>ue([sk,cx,nx,(e,n)=>U_(e,t,n),WE,hb,hx,Z_,GE,Y_,px],(t=>t(e,n))).filter((t=>e.selection.isEditable())),ik=e=>void 0===e.touches||1!==e.touches.length?I.none():I.some(e.touches[0]),lk=(e,t)=>_e(e,t.nodeName),dk=(e,t)=>!!lr(t)||!!Jo(t)&&!(lk(e.getBlockElements(),t)||fm(t)||Xr(e,t)||Mr(t)),ck=(e,t)=>{if(lr(t)){if(0===t.data.length)return!0;if(/^\s+$/.test(t.data))return!t.nextSibling||lk(e,t.nextSibling)||Mr(t.nextSibling)}return!1},uk=e=>e.dom.create(Jl(e),ed(e)),mk=(e,t,n)=>{const o=Cn(uk(e)),r=Za();vo(o,r),n(t,o);const s=document.createRange();return s.setStartBefore(r.dom),s.setEndBefore(r.dom),s},fk=e=>t=>-1!==(" "+t.attr("class")+" ").indexOf(e),gk=(e,t,n)=>function(o){const r=arguments,s=r[r.length-2],a=s>0?t.charAt(s-1):"";if('"'===a)return o;if(">"===a){const e=t.lastIndexOf("<",s);if(-1!==e&&-1!==t.substring(e,s).indexOf('contenteditable="false"'))return o}return'<span class="'+n+'" data-mce-content="'+e.dom.encode(r[0])+'">'+e.dom.encode("string"==typeof r[1]?r[1]:r[0])+"</span>"},pk=(e,t)=>ne(e,(e=>{const n=t.match(e);return null!==n&&n[0].length===t.length})),hk=(e,t)=>{t.hasAttribute("data-mce-caret")&&(mi(t),e.selection.setRng(e.selection.getRng()),e.selection.scrollIntoView(t))},bk=(e,t)=>{const n=(e=>eo(Cn(e.getBody()),"*[data-mce-caret]").map((e=>e.dom)).getOrNull())(e);if(n)return"compositionstart"===t.type?(t.preventDefault(),t.stopPropagation(),void hk(e,n)):void(ii(n)&&(hk(e,n),e.undoManager.add()))},vk=br,yk=(e,t,n)=>{const o=ju(e.getBody()),r=T(Ru,1===t?o.next:o.prev);if(n.collapsed){const o=e.dom.getParent(n.startContainer,"PRE");if(!o)return;if(!r(Ji.fromRangeStart(n))){const n=Cn((e=>{const t=e.dom.create(Jl(e));return t.innerHTML='<br data-mce-bogus="1">',t})(e));1===t?ho(Cn(o),n):po(Cn(o),n),e.selection.select(n.dom,!0),e.selection.collapse()}}},Ck=(e,t)=>((e,t)=>{const n=t?Tu.Forwards:Tu.Backwards,o=e.selection.getRng();return((e,t,n)=>x_(t,e,n,Up,zp,vk))(n,e,o).orThunk((()=>(yk(e,n,o),I.none())))})(e,((e,t)=>{const n=t?e.getEnd(!0):e.getStart(!0);return Oh(n)?!t:t})(e.selection,t)).exists((t=>(w_(e,t),!0))),wk=(e,t)=>((e,t)=>{const n=t?1:-1,o=e.selection.getRng();return((e,t,n)=>__(t,e,n,(e=>Up(e)||Ip(e)),(e=>zp(e)||Fp(e)),vk))(n,e,o).orThunk((()=>(yk(e,n,o),I.none())))})(e,t).exists((t=>(w_(e,t),!0))),Ek=(e,t)=>S_(e,t,t?zp:Up),xk=(e,t)=>ox(e,!t).map((n=>{const o=n.toRange(),r=e.selection.getRng();return t?o.setStart(r.startContainer,r.startOffset):o.setEnd(r.endContainer,r.endOffset),o})).exists((t=>(w_(e,t),!0))),_k=e=>H(["figcaption"],$t(e)),kk=(e,t)=>!!e.selection.isCollapsed()&&((e,t)=>{const n=Cn(e.getBody()),o=Ji.fromRangeStart(e.selection.getRng());return((e,t,n)=>{const o=T(kn,t);return Zn(Cn(e.container()),(e=>n.isBlock($t(e))),o).filter(_k)})(o,n,e.schema).exists((()=>{if(((e,t,n)=>t?s_(e.dom,n):r_(e.dom,n))(n,t,o)){const o=mk(e,n,t?vo:bo);return e.selection.setRng(o),!0}return!1}))})(e,t),Sk=(e,t)=>((e,t)=>t?I.from(e.dom.getParent(e.selection.getNode(),"details")).map((t=>((e,t)=>{const n=e.selection.getRng(),o=Ji.fromRangeStart(n);return!(e.getBody().lastChild!==t||!s_(t,o)||(e.execCommand("InsertNewBlockAfter"),0))})(e,t))).getOr(!1):I.from(e.dom.getParent(e.selection.getNode(),"summary")).bind((t=>I.from(e.dom.getParent(t,"details")).map((n=>((e,t,n)=>{const o=e.selection.getRng(),r=Ji.fromRangeStart(o);return!(e.getBody().firstChild!==t||!r_(n,r)||(e.execCommand("InsertNewBlockBefore"),0))})(e,n,t))))).getOr(!1))(e,t),Nk={shiftKey:!1,altKey:!1,ctrlKey:!1,metaKey:!1,keyCode:0},Rk=(e,t)=>t.keyCode===e.keyCode&&t.shiftKey===e.shiftKey&&t.altKey===e.altKey&&t.ctrlKey===e.ctrlKey&&t.metaKey===e.metaKey,Ak=(e,...t)=>()=>e.apply(null,t),Tk=(e,t)=>Q(((e,t)=>te((e=>V(e,(e=>({...Nk,...e}))))(e),(e=>Rk(e,t)?[e]:[])))(e,t),(e=>e.action())),Ok=(e,t)=>ue(((e,t)=>te((e=>V(e,(e=>({...Nk,...e}))))(e),(e=>Rk(e,t)?[e]:[])))(e,t),(e=>e.action())),Bk=(e,t)=>{const n=t?Tu.Forwards:Tu.Backwards,o=e.selection.getRng();return x_(e,n,o,Lp,Mp,Cr).exists((t=>(w_(e,t),!0)))},Pk=(e,t)=>{const n=t?1:-1,o=e.selection.getRng();return __(e,n,o,Lp,Mp,Cr).exists((t=>(w_(e,t),!0)))},Dk=(e,t)=>S_(e,t,t?Mp:Lp),Lk=_l([{none:["current"]},{first:["current"]},{middle:["current","target"]},{last:["current"]}]),Mk={...Lk,none:e=>Lk.none(e)},Ik=(e,t,n)=>te(In(e),(e=>xn(e,t)?n(e)?[e]:[]:Ik(e,t,n))),Fk=(e,t)=>to(e,"table",t),Uk=(e,t,n,o,r=M)=>{const s=1===o;if(!s&&n<=0)return Mk.first(e[0]);if(s&&n>=e.length-1)return Mk.last(e[e.length-1]);{const s=n+o,a=e[s];return r(a)?Mk.middle(t,a):Uk(e,t,s,o,r)}},zk=(e,t)=>Fk(e,t).bind((t=>{const n=Ik(t,"th,td",M);return J(n,(t=>kn(e,t))).map((e=>({index:e,all:n})))})),jk=["img","br"],Hk=e=>{return(t=e,za.getOption(t)).filter((e=>0!==e.trim().length||e.indexOf(qo)>-1)).isSome()||H(jk,$t(e))||(e=>Wt(e)&&"false"===tn(e,"contenteditable"))(e);var t},$k=(e,t,n,o,r)=>{const s=Uo(Cn(n),"td,th,caption").map((e=>e.dom)),a=Y(((e,t)=>te(t,(t=>{const n=((e,t)=>({left:e.left-t,top:e.top-t,right:e.right+-2,bottom:e.bottom+-2,width:e.width+t,height:e.height+t}))(pi(t.getBoundingClientRect()),-1);return[{x:n.left,y:e(n),cell:t},{x:n.right,y:e(n),cell:t}]})))(e,s),(e=>t(e,r)));return((e,t,n)=>X(e,((e,o)=>e.fold((()=>I.some(o)),(e=>{const r=Math.sqrt(Math.abs(e.x-t)+Math.abs(e.y-n)),s=Math.sqrt(Math.abs(o.x-t)+Math.abs(o.y-n));return I.some(s<r?o:e)}))),I.none()))(a,o,r).map((e=>e.cell))},Vk=T($k,(e=>e.bottom),((e,t)=>e.y<t)),qk=T($k,(e=>e.top),((e,t)=>e.y>t)),Wk=(e,t,n)=>{const o=e(t,n);return(e=>e.breakType===Wx.Wrap&&0===e.positions.length)(o)||!gr(n.getNode())&&(e=>e.breakType===Wx.Br&&1===e.positions.length)(o)?!((e,t,n)=>n.breakAt.exists((n=>e(t,n).breakAt.isSome())))(e,t,o):o.breakAt.isNone()},Kk=T(Wk,e_),Yk=T(Wk,t_),Gk=(e,t,n,o)=>{const r=e.selection.getRng(),s=t?1:-1;return!(!eu()||!((e,t,n)=>{const o=Ji.fromRangeStart(t);return Yu(!e,n).exists((e=>e.isEqual(o)))})(t,r,n)||(XE(s,e,n,!t,!1).each((t=>{w_(e,t)})),0))},Xk=(e,t,n)=>{const o=((e,t)=>{const n=t.getNode(e);return sr(n)?I.some(n):I.none()})(!!t,n),r=!1===t;o.fold((()=>w_(e,n.toRange())),(o=>Yu(r,e.getBody()).filter((e=>e.isEqual(n))).fold((()=>w_(e,n.toRange())),(n=>((e,t,n)=>{t.undoManager.transact((()=>{const o=e?ho:po,r=mk(t,Cn(n),o);w_(t,r)}))})(t,e,o)))))},Zk=(e,t,n,o)=>{const r=e.selection.getRng(),s=Ji.fromRangeStart(r),a=e.getBody();if(!t&&Kk(o,s)){const o=((e,t,n)=>((e,t)=>le(t.getClientRects()).bind((t=>Vk(e,t.left,t.top))).bind((e=>{return Jx(Qu(n=e).map((e=>e_(n,e).positions.concat(e))).getOr([]),t);var n})))(t,n).orThunk((()=>le(n.getClientRects()).bind((n=>Qx(n_(e,Ji.before(t)),n.left))))).getOr(Ji.before(t)))(a,n,s);return Xk(e,t,o),!0}if(t&&Yk(o,s)){const o=((e,t,n)=>((e,t)=>de(t.getClientRects()).bind((t=>qk(e,t.left,t.top))).bind((e=>{return Jx(Zu(n=e).map((e=>[e].concat(t_(n,e).positions))).getOr([]),t);var n})))(t,n).orThunk((()=>le(n.getClientRects()).bind((n=>Qx(o_(e,Ji.after(t)),n.left))))).getOr(Ji.after(t)))(a,n,s);return Xk(e,t,o),!0}return!1},Qk=(e,t,n)=>I.from(e.dom.getParent(e.selection.getNode(),"td,th")).bind((o=>I.from(e.dom.getParent(o,"table")).map((r=>n(e,t,r,o))))).getOr(!1),Jk=(e,t)=>Qk(e,t,Gk),eS=(e,t)=>Qk(e,t,Zk),tS=(e,t,n)=>n.fold(I.none,I.none,((e,t)=>{return(n=t,Qn(n,Hk)).map((e=>(e=>{const t=Af.exact(e,0,e,0);return mg(t)})(e)));var n}),(n=>e.mode.isReadOnly()?I.none():(e.execCommand("mceTableInsertRowAfter"),nS(e,t,n)))),nS=(e,t,n)=>{return tS(e,t,(r=no,zk(o=n,void 0).fold((()=>Mk.none(o)),(e=>Uk(e.all,o,e.index,1,r)))));var o,r},oS=(e,t,n)=>{return tS(e,t,(r=no,zk(o=n,void 0).fold((()=>Mk.none()),(e=>Uk(e.all,o,e.index,-1,r)))));var o,r},rS=(e,t)=>{const n=["table","li","dl"],o=Cn(e.getBody()),r=e=>{const t=$t(e);return kn(e,o)||H(n,t)},s=e.selection.getRng();return((e,t)=>((e,t,n=L)=>n(t)?I.none():H(e,$t(t))?I.some(t):Jn(t,e.join(","),(e=>xn(e,"table")||n(e))))(["td","th"],e,t))(Cn(t?s.endContainer:s.startContainer),r).map((n=>(Fk(n,r).each((t=>{e.model.table.clearSelectedCells(t.dom)})),e.selection.collapse(!t),(t?nS:oS)(e,r,n).each((t=>{e.selection.setRng(t)})),!0))).getOr(!1)},sS=(e,t)=>({container:e,offset:t}),aS=ua.DOM,iS=e=>t=>e===t?-1:0,lS=(e,t,n)=>{if(lr(e)&&t>=0)return I.some(sS(e,t));{const o=Ua(aS);return I.from(o.backwards(e,t,iS(e),n)).map((e=>sS(e.container,e.container.data.length)))}},dS=(e,t,n)=>{if(!lr(e))return I.none();const o=e.data;if(t>=0&&t<=o.length)return I.some(sS(e,t));{const o=Ua(aS);return I.from(o.backwards(e,t,iS(e),n)).bind((e=>{const o=e.container.data;return dS(e.container,t+o.length,n)}))}},cS=(e,t,n)=>{if(!lr(e))return I.none();const o=e.data;if(t<=o.length)return I.some(sS(e,t));{const r=Ua(aS);return I.from(r.forwards(e,t,iS(e),n)).bind((e=>cS(e.container,t-o.length,n)))}},uS=(e,t,n,o,r)=>{const s=Ua(e,(e=>t=>e.isBlock(t)||H(["BR","IMG","HR","INPUT"],t.nodeName)||"false"===e.getContentEditable(t))(e));return I.from(s.backwards(t,n,o,r))},mS=e=>""!==e&&-1!==" \xa0\ufeff\f\n\r\t\v".indexOf(e),fS=(e,t)=>e.substring(t.length),gS=(e,t,n,o=!1)=>{if(!(r=t).collapsed||!lr(r.startContainer))return I.none();var r;const s={text:"",offset:0},a=e.getParent(t.startContainer,e.isBlock)||e.getRoot();return uS(e,t.startContainer,t.startOffset,((e,t,r)=>(s.text=r+s.text,s.offset+=t,((e,t,n,o=!1)=>{let r;const s=n.charAt(0);for(r=t-1;r>=0;r--){const a=e.charAt(r);if(!o&&mS(a))return I.none();if(s===a&&He(e,n,r,t))break}return I.some(r)})(s.text,s.offset,n,o).getOr(t))),a).bind((e=>{const o=t.cloneRange();if(o.setStart(e.container,e.offset),o.setEnd(t.endContainer,t.endOffset),o.collapsed)return I.none();const r=(e=>ti(e.toString().replace(/\u00A0/g," ")))(o);return 0!==r.lastIndexOf(n)?I.none():I.some({text:fS(r,n),range:o,trigger:n})}))},pS=e=>{if((e=>3===e.nodeType)(e))return sS(e,e.data.length);{const t=e.childNodes;return t.length>0?pS(t[t.length-1]):sS(e,t.length)}},hS=(e,t)=>{const n=e.childNodes;return n.length>0&&t<n.length?hS(n[t],0):n.length>0&&(e=>1===e.nodeType)(e)&&n.length===t?pS(n[n.length-1]):sS(e,t)},bS=(e,t,n,o={})=>{var r;const s=t(),a=null!==(r=e.selection.getRng().startContainer.nodeValue)&&void 0!==r?r:"",i=Y(s.lookupByTrigger(n.trigger),(t=>n.text.length>=t.minChars&&t.matches.getOrThunk((()=>(e=>t=>{const n=hS(t.startContainer,t.startOffset);return!((e,t)=>{var n;const o=null!==(n=e.getParent(t.container,e.isBlock))&&void 0!==n?n:e.getRoot();return uS(e,t.container,t.offset,((e,t)=>0===t?-1:t),o).filter((e=>{const t=e.container.data.charAt(e.offset-1);return!mS(t)})).isSome()})(e,n)})(e.dom)))(n.range,a,n.text)));if(0===i.length)return I.none();const l=Promise.all(V(i,(e=>e.fetch(n.text,e.maxResults,o).then((t=>({matchText:n.text,items:t,columns:e.columns,onAction:e.onAction,highlightOn:e.highlightOn}))))));return I.some({lookupData:l,context:n})};var vS;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(vS||(vS={}));const yS=(e,t,n)=>e.stype===vS.Error?t(e.serror):n(e.svalue),CS=e=>({stype:vS.Value,svalue:e}),wS=e=>({stype:vS.Error,serror:e}),ES=yS,xS=e=>f(e)&&fe(e).length>100?" removed due to size":JSON.stringify(e,null,2),_S=(e,t)=>wS([{path:e,getErrorInfo:t}]),kS=(e,t)=>({extract:(n,o)=>xe(o,e).fold((()=>((e,t)=>_S(e,(()=>'Choice schema did not contain choice key: "'+t+'"')))(n,e)),(e=>((e,t,n,o)=>xe(n,o).fold((()=>((e,t,n)=>_S(e,(()=>'The chosen schema: "'+n+'" did not exist in branches: '+xS(t))))(e,n,o)),(n=>n.extract(e.concat(["branch: "+o]),t))))(n,o,t,e))),toString:()=>"chooseOn("+e+"). Possible values: "+fe(t)}),SS=e=>(...t)=>{if(0===t.length)throw new Error("Can't merge zero objects");const n={};for(let o=0;o<t.length;o++){const r=t[o];for(const t in r)_e(r,t)&&(n[t]=e(n[t],r[t]))}return n},NS=SS(((e,t)=>g(e)&&g(t)?NS(e,t):t)),RS=SS(((e,t)=>t)),AS=e=>({tag:"defaultedThunk",process:N(e)}),TS=e=>{const t=(e=>{const t=[],n=[];return q(e,(e=>{yS(e,(e=>n.push(e)),(e=>t.push(e)))})),{values:t,errors:n}})(e);return t.errors.length>0?(n=t.errors,k(wS,ee)(n)):CS(t.values);var n},OS=(e,t,n)=>{switch(e.tag){case"field":return t(e.key,e.newKey,e.presence,e.prop);case"custom":return n(e.newKey,e.instantiator)}},BS=e=>({extract:(t,n)=>{return o=e(n),r=e=>((e,t)=>_S(e,N(t)))(t,e),o.stype===vS.Error?r(o.serror):o;var o,r},toString:N("val")}),PS=BS(CS),DS=(e,t,n,o)=>o(xe(e,t).getOrThunk((()=>n(e)))),LS=(e,t,n,o,r)=>{const s=e=>r.extract(t.concat([o]),e),a=e=>e.fold((()=>CS(I.none())),(e=>{const n=r.extract(t.concat([o]),e);return s=n,a=I.some,s.stype===vS.Value?{stype:vS.Value,svalue:a(s.svalue)}:s;var s,a}));switch(e.tag){case"required":return((e,t,n,o)=>xe(t,n).fold((()=>((e,t,n)=>_S(e,(()=>'Could not find valid *required* value for "'+t+'" in '+xS(n))))(e,n,t)),o))(t,n,o,s);case"defaultedThunk":return DS(n,o,e.process,s);case"option":return((e,t,n)=>n(xe(e,t)))(n,o,a);case"defaultedOptionThunk":return((e,t,n,o)=>o(xe(e,t).map((t=>!0===t?n(e):t))))(n,o,e.process,a);case"mergeWithThunk":return DS(n,o,N({}),(t=>{const o=NS(e.process(n),t);return s(o)}))}},MS=e=>({extract:(t,n)=>((e,t,n)=>{const o={},r=[];for(const s of n)OS(s,((n,s,a,i)=>{const l=LS(a,e,t,n,i);ES(l,(e=>{r.push(...e)}),(e=>{o[s]=e}))}),((e,n)=>{o[e]=n(t)}));return r.length>0?wS(r):CS(o)})(t,n,e),toString:()=>{const t=V(e,(e=>OS(e,((e,t,n,o)=>e+" -> "+o.toString()),((e,t)=>"state("+e+")"))));return"obj{\n"+t.join("\n")+"}"}}),IS=e=>({extract:(t,n)=>{const o=V(n,((n,o)=>e.extract(t.concat(["["+o+"]"]),n)));return TS(o)},toString:()=>"array("+e.toString()+")"}),FS=k(IS,MS),US=(e,t,n)=>{return o=((e,t,n)=>((e,t)=>e.stype===vS.Error?{stype:vS.Error,serror:t(e.serror)}:e)(t.extract([e],n),(e=>({input:n,errors:e}))))(e,t,n),yS(o,xl.error,xl.value);var o},zS=(e,t)=>kS(e,he(t,MS)),jS=N(PS),HS=(e,t)=>BS((n=>{const o=typeof n;return e(n)?CS(n):wS(`Expected type: ${t} but got: ${o}`)})),$S=HS(E,"number"),VS=HS(m,"string"),qS=HS(b,"boolean"),WS=HS(w,"function"),KS=(e,t,n,o)=>({tag:"field",key:e,newKey:t,presence:n,prop:o}),YS=(e,t)=>({tag:"custom",newKey:e,instantiator:t}),GS=e=>{return t=t=>H(e,t)?xl.value(t):xl.error(`Unsupported value: "${t}", choose one of "${e.join(", ")}".`),BS((e=>t(e).fold(wS,CS)));var t},XS=(e,t)=>KS(e,e,{tag:"required",process:{}},t),ZS=e=>XS(e,VS),QS=(e,t)=>KS(e,e,{tag:"required",process:{}},GS(t)),JS=e=>XS(e,WS),eN=(e,t)=>KS(e,e,{tag:"required",process:{}},IS(t)),tN=(e,t)=>KS(e,e,{tag:"option",process:{}},t),nN=e=>tN(e,VS),oN=(e,t,n)=>KS(e,e,AS(t),n),rN=(e,t)=>oN(e,t,$S),sN=(e,t)=>oN(e,t,VS),aN=(e,t,n)=>oN(e,t,GS(n)),iN=(e,t)=>oN(e,t,qS),lN=(e,t)=>oN(e,t,WS),dN=ZS("type"),cN=JS("fetch"),uN=JS("onAction"),mN=lN("onSetup",(()=>_)),fN=nN("text"),gN=nN("icon"),pN=nN("tooltip"),hN=nN("label"),bN=iN("active",!1),vN=iN("enabled",!0),yN=iN("primary",!1),CN=e=>sN("type",e),wN=MS([dN,ZS("trigger"),rN("minChars",1),(1,((e,t)=>KS(e,e,AS(1),jS()))("columns")),rN("maxResults",10),("matches",tN("matches",WS)),cN,uN,(EN=VS,oN("highlightOn",[],IS(EN)))]);var EN;const xN=[vN,pN,gN,fN,mN,sN("context","mode:design")],_N=[bN].concat(xN),kN=[lN("predicate",L),aN("scope","node",["node","editor"]),aN("position","selection",["node","selection","line"])],SN=xN.concat([CN("contextformbutton"),sN("align","end"),yN,uN,YS("original",R)]),NN=_N.concat([CN("contextformbutton"),sN("align","end"),yN,uN,YS("original",R)]),RN=xN.concat([CN("contextformbutton")]),AN=_N.concat([CN("contextformtogglebutton")]),TN=[hN,eN("commands",zS("type",{contextformbutton:SN,contextformtogglebutton:NN})),tN("launch",zS("type",{contextformbutton:RN,contextformtogglebutton:AN})),lN("onInput",_),lN("onSetup",_)];zS("type",{contextform:[...kN,...TN,QS("type",["contextform"]),lN("initValue",N("")),nN("placeholder")],contextsliderform:[...kN,...TN,QS("type",["contextsliderform"]),lN("initValue",N(0)),lN("min",N(0)),lN("max",N(100))],contextsizeinputform:[...kN,...TN,QS("type",["contextsizeinputform"]),lN("initValue",N({width:"",height:""}))]}),MS([CN("contexttoolbar"),XS("items",((e,t)=>{const n=R;return{extract:(t,o)=>{const r=[];for(const s of e){const e=s.extract(t,o);if(e.stype===vS.Value)return{stype:vS.Value,svalue:n(e.svalue)};r.push(e)}return TS(r)},toString:()=>"oneOf("+V(e,(e=>e.toString())).join(", ")+")"}})([VS,FS([nN("name"),nN("label"),eN("items",VS)])]))].concat(kN));const ON=e=>{const t=e.ui.registry.getAll().popups,n=he(t,(e=>{return(t=e,US("Autocompleter",wN,t)).fold((e=>{throw new Error("Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:N("... (only showing first ten failures)")}]):e;return V(t,(e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo()))})((t=e).errors).join("\n")+"\n\nInput object: "+xS(t.input));var t}),R);var t})),o=Se(we(n,(e=>e.trigger))),r=Ee(n);return{dataset:n,triggers:o,lookupByTrigger:e=>Y(r,(t=>t.trigger===e))}},BN=e=>{const t=Pr(),n=Or(!1),o=t.isSet,r=()=>{o()&&((e=>{e.dispatch("AutocompleterEnd")})(e),n.set(!1),t.clear())},s=Le((()=>ON(e))),a=a=>{(n=>t.get().map((t=>gS(e.dom,e.selection.getRng(),t.trigger,!0).bind((t=>bS(e,s,t,n))))).getOrThunk((()=>((e,t)=>{const n=t(),o=e.selection.getRng();return((e,t,n)=>ue(n.triggers,(n=>gS(e,t,n))))(e.dom,o,n).bind((n=>bS(e,t,n)))})(e,s))))(a).fold(r,(r=>{(e=>{o()||t.set({trigger:e.trigger,matchLength:e.text.length})})(r.context),r.lookupData.then((o=>{t.get().map((s=>{const a=r.context;s.trigger===a.trigger&&(t.set({...s,matchLength:a.text.length}),n.get()?(Il(e,{range:a.range}),((e,t)=>{e.dispatch("AutocompleterUpdate",t)})(e,{lookupData:o})):(n.set(!0),Il(e,{range:a.range}),((e,t)=>{e.dispatch("AutocompleterStart",t)})(e,{lookupData:o})))}))}))}))},i=()=>t.get().bind((({trigger:t})=>{const o=e.selection.getRng();return gS(e.dom,o,t,n.get()).filter((({range:e})=>((e,t)=>{const n=e.compareBoundaryPoints(window.Range.START_TO_START,t),o=e.compareBoundaryPoints(window.Range.END_TO_END,t);return n>=0&&o<=0})(o,e))).map((({range:e})=>e))}));e.addCommand("mceAutocompleterReload",((e,t)=>{const n=f(t)?t.fetchOptions:{};a(n)})),e.addCommand("mceAutocompleterClose",r),e.addCommand("mceAutocompleterRefreshActiveRange",(()=>{i().each((t=>{Il(e,{range:t})}))})),e.editorCommands.addQueryStateHandler("mceAutoCompleterInRange",(()=>i().isSome())),((e,t)=>{const n=Ca(t.load,50);e.on("input",(t=>{("insertCompositionText"!==t.inputType||e.composing)&&n.throttle()})),e.on("keydown",(e=>{const o=e.which;8===o?n.throttle():27===o?(n.cancel(),t.cancelIfNecessary()):38!==o&&40!==o||n.cancel()}),!0),e.on("remove",n.cancel)})(e,{cancelIfNecessary:r,load:a})},PN=xt().browser.isSafari(),DN=e=>Qa(Cn(e)),LN=(e,t)=>{var n;return 0===e.startOffset&&e.endOffset===(null===(n=t.textContent)||void 0===n?void 0:n.length)},MN=(e,t)=>I.from(e.getParent(t.container(),"details")),IN=(e,t)=>MN(e,t).isSome(),FN=(e,t)=>{const n=t.getNode();v(n)||e.selection.setCursorLocation(n,t.offset())},UN=(e,t,n)=>{const o=e.dom.getParent(t.container(),"details");if(o&&!o.open){const t=e.dom.select("summary",o)[0];t&&(n?Zu(t):Qu(t)).each((t=>FN(e,t)))}else FN(e,t)},zN=(e,t,n)=>{const{dom:o,selection:r}=e,s=e.getBody();if("character"===n){const n=Ji.fromRangeStart(r.getRng()),a=o.getParent(n.container(),o.isBlock),i=MN(o,n),l=a&&o.isEmpty(a),d=h(null==a?void 0:a.previousSibling),c=h(null==a?void 0:a.nextSibling);return!!(l&&(t?c:d)&&Wu(!t,s,n).exists((e=>IN(o,e)&&!Mt(i,MN(o,e)))))||Wu(t,s,n).fold(L,(n=>{const r=MN(o,n);if(IN(o,n)&&!Mt(i,r)){if(t||UN(e,n,!1),a&&l){if(t&&d)return!0;if(!t&&c)return!0;UN(e,n,t),e.dom.remove(a)}return!0}return!1}))}return!1},jN=(e,t,n,o)=>{const r=e.selection.getRng(),s=Ji.fromRangeStart(r),a=e.getBody();return"selection"===o?((e,t)=>{const n=t.startSummary.exists((t=>t.contains(e.startContainer))),o=t.startSummary.exists((t=>t.contains(e.endContainer))),r=t.startDetails.forall((e=>t.endDetails.forall((t=>e!==t))));return(n||o)&&!(n&&o)||r})(r,t):n?((e,t)=>t.startSummary.exists((t=>((e,t)=>Qu(t).exists((n=>gr(n.getNode())&&Xu(t,n).exists((t=>t.isEqual(e)))||n.isEqual(e))))(e,t))))(s,t)||((e,t,n)=>n.startDetails.exists((n=>Gu(e,t).forall((e=>!n.contains(e.container()))))))(a,s,t):((e,t)=>t.startSummary.exists((t=>((e,t)=>Zu(t).exists((t=>t.isEqual(e))))(e,t))))(s,t)||((e,t)=>t.startDetails.exists((n=>Xu(n,e).forall((n=>t.startSummary.exists((t=>!t.contains(e.container())&&t.contains(n.container()))))))))(s,t)},HN=(e,t,n)=>((e,t,n)=>((e,t)=>{const n=I.from(e.getParent(t.startContainer,"details")),o=I.from(e.getParent(t.endContainer,"details"));if(n.isSome()||o.isSome()){const t=n.bind((t=>I.from(e.select("summary",t)[0])));return I.some({startSummary:t,startDetails:n,endDetails:o})}return I.none()})(e.dom,e.selection.getRng()).fold((()=>zN(e,t,n)),(o=>jN(e,o,t,n)||zN(e,t,n))))(e,t,n)||PN&&((e,t,n)=>{const o=e.selection,r=o.getNode(),s=o.getRng(),a=Ji.fromRangeStart(s);return!!xr(r)&&("selection"===n&&LN(s,r)||Hh(t,a,r)?DN(r):e.undoManager.transact((()=>{const s=o.getSel();let{anchorNode:a,anchorOffset:i,focusNode:l,focusOffset:d}=null!=s?s:{};const c=()=>{C(a)&&C(i)&&C(l)&&C(d)&&(null==s||s.setBaseAndExtent(a,i,l,d))},u=(e,t)=>{q(e.childNodes,(e=>{Am(e)&&t.appendChild(e)}))},m=e.dom.create("span",{"data-mce-bogus":"1"});u(r,m),r.appendChild(m),c(),"word"!==n&&"line"!==n||null==s||s.modify("extend",t?"right":"left",n),!o.isCollapsed()&&LN(o.getRng(),m)?DN(r):(e.execCommand(t?"ForwardDelete":"Delete"),a=null==s?void 0:s.anchorNode,i=null==s?void 0:s.anchorOffset,l=null==s?void 0:s.focusNode,d=null==s?void 0:s.focusOffset,u(m,r),c()),e.dom.remove(m)})),!0)})(e,t,n)?I.some(_):I.none(),$N=e=>(t,n,o={})=>{const r=t.getBody(),s={bubbles:!0,composed:!0,data:null,isComposing:!1,detail:0,view:null,target:r,currentTarget:r,eventPhase:Event.AT_TARGET,originalTarget:r,explicitOriginalTarget:r,isTrusted:!1,srcElement:r,cancelable:!1,preventDefault:_,inputType:n},a=Ys(new InputEvent(e));return t.dispatch(e,{...a,...s,...o})},VN=$N("input"),qN=$N("beforeinput"),WN=xt(),KN=WN.os,YN=KN.isMacOS()||KN.isiOS(),GN=WN.browser.isFirefox(),XN=(e,t)=>{const n=e.dom,o=e.schema.getMoveCaretBeforeOnEnterElements();if(!t)return;if(/^(LI|DT|DD)$/.test(t.nodeName)){const e=(e=>{for(;e;){if(Jo(e)||lr(e)&&e.data&&/[\r\n\s]/.test(e.data))return e;e=e.nextSibling}return null})(t.firstChild);e&&/^(UL|OL|DL)$/.test(e.nodeName)&&t.insertBefore(n.doc.createTextNode(qo),t.firstChild)}const r=n.createRng();if(t.normalize(),t.hasChildNodes()){const e=new $o(t,t);let n,s=t;for(;n=e.current();){if(lr(n)){r.setStart(n,0),r.setEnd(n,0);break}if(o[n.nodeName.toLowerCase()]){r.setStartBefore(n),r.setEndBefore(n);break}s=n,n=e.next()}n||(r.setStart(s,0),r.setEnd(s,0))}else gr(t)?t.nextSibling&&n.isBlock(t.nextSibling)?(r.setStartBefore(t),r.setEndBefore(t)):(r.setStartAfter(t),r.setEndAfter(t)):(r.setStart(t,0),r.setEnd(t,0));e.selection.setRng(r),Vg(e,r)},ZN=(e,t)=>{const n=e.getRoot();let o,r=t;for(;r!==n&&r&&"false"!==e.getContentEditable(r);){if("true"===e.getContentEditable(r)){o=r;break}r=r.parentNode}return r!==n?o:n},QN=e=>I.from(e.dom.getParent(e.selection.getStart(!0),e.dom.isBlock)),JN=e=>{e.innerHTML='<br data-mce-bogus="1">'},eR=(e,t)=>{Jl(e).toLowerCase()===t.tagName.toLowerCase()&&((e,t,n)=>{const o=e.dom;I.from(n.style).map(o.parseStyle).each((e=>{const n={...fo(Cn(t)),...e};o.setStyles(t,n)}));const r=I.from(n.class).map((e=>e.split(/\s+/))),s=I.from(t.className).map((e=>Y(e.split(/\s+/),(e=>""!==e))));It(r,s,((e,n)=>{const r=Y(n,(t=>!H(e,t))),s=[...e,...r];o.setAttrib(t,"class",s.join(" "))}));const a=["style","class"],i=Ce(n,((e,t)=>!H(a,t)));o.setAttribs(t,i)})(e,t,ed(e))},tR=(e,t,n,o,r=!0,s,a)=>{const i=e.dom,l=e.schema,d=Jl(e),c=n?n.nodeName.toUpperCase():"";let u=t;const m=l.getTextInlineElements();let f;f=s||"TABLE"===c||"HR"===c?i.create(s||d,a||{}):n.cloneNode(!1);let g=f;if(r){do{if(m[u.nodeName]){if(em(u)||fm(u))continue;const e=u.cloneNode(!1);i.setAttrib(e,"id",""),f.hasChildNodes()?(e.appendChild(f.firstChild),f.appendChild(e)):(g=e,f.appendChild(e))}}while((u=u.parentNode)&&u!==o)}else i.setAttrib(f,"style",null),i.setAttrib(f,"class",null);return eR(e,f),JN(g),f},nR=(e,t)=>{const n=null==e?void 0:e.parentNode;return C(n)&&n.nodeName===t},oR=e=>C(e)&&/^(OL|UL|LI)$/.test(e.nodeName),rR=e=>C(e)&&/^(LI|DT|DD)$/.test(e.nodeName),sR=e=>{const t=e.parentNode;return rR(t)?t:e},aR=(e,t,n)=>{let o=e[n?"firstChild":"lastChild"];for(;o&&!Jo(o);)o=o[n?"nextSibling":"previousSibling"];return o===t},iR=e=>X(we(fo(Cn(e)),((e,t)=>`${t}: ${e};`)),((e,t)=>e+t),""),lR=(e,t)=>t&&"A"===t.nodeName&&e.isEmpty(t),dR=(e,t)=>e.nodeName===t||e.previousSibling&&e.previousSibling.nodeName===t,cR=(e,t)=>C(t)&&e.isBlock(t)&&!/^(TD|TH|CAPTION|FORM)$/.test(t.nodeName)&&!/^(fixed|absolute)/i.test(t.style.position)&&e.isEditable(t.parentNode)&&"false"!==e.getContentEditable(t),uR=(e,t,n)=>lr(t)?e?1===n&&t.data.charAt(n-1)===Ja?0:n:n===t.data.length-1&&t.data.charAt(n)===Ja?t.data.length:n:n,mR={insert:(e,t)=>{let n,o,r,s,a=!1;const i=e.dom,l=e.schema.getNonEmptyElements(),d=e.selection.getRng(),c=Jl(e),u=Cn(d.startContainer),f=Fn(u,d.startOffset),g=f.exists((e=>Wt(e)&&!no(e))),p=d.collapsed&&g,b=(t,o)=>tR(e,n,k,_,rd(e),t,o),v=e=>{const t=uR(e,n,o);if(lr(n)&&(e?t>0:t<n.data.length))return!1;if((n.parentNode===k||n===k)&&a&&!e)return!0;if(e&&Jo(n)&&n===k.firstChild)return!0;if(dR(n,"TABLE")||dR(n,"HR"))return((e,t)=>"BR"===e.nodeName||e.nextSibling&&"BR"===e.nextSibling.nodeName)(n)?!e:a&&!e||!a&&e;const r=new $o(n,k);let s;for(lr(n)&&(e&&0===t?r.prev():e||t!==n.data.length||r.next());s=r.current();){if(Jo(s)){if(!s.getAttribute("data-mce-bogus")){const e=s.nodeName.toLowerCase();if(l[e]&&"br"!==e)return!1}}else if(lr(s)&&!Yo(s.data))return!1;e?r.prev():r.next()}return!0},w=()=>{let t;return t=/^(H[1-6]|PRE|FIGURE)$/.test(r)&&"HGROUP"!==S?b(c):b(),((e,t)=>{const n=sd(e);return!y(t)&&(m(n)?H(Dt.explode(n),t.nodeName.toLowerCase()):n)})(e,s)&&cR(i,s)&&i.isEmpty(k,void 0,{includeZwsp:!0})?t=i.split(s,k):i.insertAfter(t,k),XN(e,t),t};Eg(i,d).each((e=>{d.setStart(e.startContainer,e.startOffset),d.setEnd(e.endContainer,e.endOffset)})),n=d.startContainer,o=d.startOffset;const E=!(!t||!t.shiftKey),x=!(!t||!t.ctrlKey);Jo(n)&&n.hasChildNodes()&&!p&&(a=o>n.childNodes.length-1,n=n.childNodes[Math.min(o,n.childNodes.length-1)]||n,o=a&&lr(n)?n.data.length:0);const _=ZN(i,n);if(!_||((e,t)=>{const n=e.dom.getParent(t,"ol,ul,dl");return null!==n&&"false"===e.dom.getContentEditableParent(n)})(e,n))return;E||(n=((e,t,n,o,r)=>{var s,a;const i=e.dom,l=null!==(s=ZN(i,o))&&void 0!==s?s:i.getRoot();let d=i.getParent(o,i.isBlock);if(!d||!cR(i,d)){if(d=d||l,!d.hasChildNodes()){const o=i.create(t);return eR(e,o),d.appendChild(o),n.setStart(o,0),n.setEnd(o,0),o}let s,c=o;for(;c&&c.parentNode!==d;)c=c.parentNode;for(;c&&!i.isBlock(c);)s=c,c=c.previousSibling;const u=null===(a=null==s?void 0:s.parentElement)||void 0===a?void 0:a.nodeName;if(s&&u&&e.schema.isValidChild(u,t.toLowerCase())){const a=s.parentNode,l=i.create(t);for(eR(e,l),a.insertBefore(l,s),c=s;c&&!i.isBlock(c);){const e=c.nextSibling;l.appendChild(c),c=e}n.setStart(o,r),n.setEnd(o,r)}}return o})(e,c,d,n,o));let k=i.getParent(n,i.isBlock)||i.getRoot();s=C(null==k?void 0:k.parentNode)?i.getParent(k.parentNode,i.isBlock):null,r=k?k.nodeName.toUpperCase():"";const S=s?s.nodeName.toUpperCase():"";if("LI"!==S||x||(k=s,s=s.parentNode,r=S),Jo(s)&&((e,t,n)=>!t&&n.nodeName.toLowerCase()===Jl(e)&&e.dom.isEmpty(n)&&((t,n,o)=>{let r=n;for(;r&&r!==t&&h(r.nextSibling);){const t=r.parentElement;if(!t||(s=t,!_e(e.schema.getTextBlockElements(),s.nodeName.toLowerCase())))return Er(t);r=t}var s;return!1})(e.getBody(),n))(e,E,k))return((e,t,n)=>{var o,r,s;const a=t(Jl(e)),i=((e,t)=>e.dom.getParent(t,Er))(e,n);i&&(e.dom.insertAfter(a,i),XN(e,a),(null!==(s=null===(r=null===(o=n.parentElement)||void 0===o?void 0:o.childNodes)||void 0===r?void 0:r.length)&&void 0!==s?s:0)>1&&e.dom.remove(n))})(e,b,k);if(/^(LI|DT|DD)$/.test(r)&&Jo(s)&&i.isEmpty(k))return void((e,t,n,o,r)=>{const s=e.dom,a=e.selection.getRng(),i=n.parentNode;if(n===e.getBody()||!i)return;var l;oR(l=n)&&oR(l.parentNode)&&(r="LI");const d=rR(o)?iR(o):void 0;let c=rR(o)&&d?t(r,{style:iR(o)}):t(r);if(aR(n,o,!0)&&aR(n,o,!1))if(nR(n,"LI")){const e=sR(n);s.insertAfter(c,e),(e=>{var t;return(null===(t=e.parentNode)||void 0===t?void 0:t.firstChild)===e})(n)?s.remove(e):s.remove(n)}else s.replace(c,n);else if(aR(n,o,!0))nR(n,"LI")?(s.insertAfter(c,sR(n)),c.appendChild(s.doc.createTextNode(" ")),c.appendChild(n)):i.insertBefore(c,n),s.remove(o);else if(aR(n,o,!1))s.insertAfter(c,sR(n)),s.remove(o);else{n=sR(n);const e=a.cloneRange();e.setStartAfter(o),e.setEndAfter(n);const t=e.extractContents();if("LI"===r&&((e,t)=>e.firstChild&&"LI"===e.firstChild.nodeName)(t)){const e=Y(V(c.children,Cn),O(Zt("br")));c=t.firstChild,s.insertAfter(t,n),q(e,(e=>bo(Cn(c),e))),d&&c.setAttribute("style",d)}else s.insertAfter(t,n),s.insertAfter(c,n);s.remove(o)}XN(e,c)})(e,b,s,k,c);if(!(p||k!==e.getBody()&&cR(i,k)))return;const N=k.parentNode;let R;if(p)R=b(c),f.fold((()=>{vo(u,Cn(R))}),(e=>{po(e,Cn(R))})),e.selection.setCursorLocation(R,0);else if(ri(k))R=mi(k),i.isEmpty(k)&&JN(k),eR(e,R),XN(e,R);else if(v(!1))R=w();else if(v(!0)&&N){const t=Ji.fromRangeStart(d),n=Fp(t),o=Cn(k),r=eh(o,t,e.schema)?th(o,t,e.schema).bind((e=>I.from(e.getNode()))):I.none();R=N.insertBefore(b(),k);const s=dR(k,"HR")||n?R:r.getOr(k);XN(e,s)}else{const t=(e=>{const t=e.cloneRange();return t.setStart(e.startContainer,uR(!0,e.startContainer,e.startOffset)),t.setEnd(e.endContainer,uR(!1,e.endContainer,e.endOffset)),t})(d).cloneRange();t.setEndAfter(k);const n=t.extractContents();(e=>{q(Fo(Cn(e),Yt),(e=>{const t=e.dom;t.nodeValue=ti(t.data)}))})(n),(e=>{let t=e;do{lr(t)&&(t.data=t.data.replace(/^[\r\n]+/,"")),t=t.firstChild}while(t)})(n),R=n.firstChild,i.insertAfter(n,k),((e,t,n)=>{var o;const r=[];if(!n)return;let s=n;for(;s=s.firstChild;){if(e.isBlock(s))return;Jo(s)&&!t[s.nodeName.toLowerCase()]&&r.push(s)}let a=r.length;for(;a--;)s=r[a],(!s.hasChildNodes()||s.firstChild===s.lastChild&&""===(null===(o=s.firstChild)||void 0===o?void 0:o.nodeValue)||lR(e,s))&&e.remove(s)})(i,l,R),((e,t)=>{t.normalize();const n=t.lastChild;(!n||Jo(n)&&/^(left|right)$/gi.test(e.getStyle(n,"float",!0)))&&e.add(t,"br")})(i,k),i.isEmpty(k)&&JN(k),R.normalize(),i.isEmpty(R)?(i.remove(R),w()):(eR(e,R),XN(e,R))}i.setAttrib(R,"id",""),e.dispatch("NewBlock",{newBlock:R})},fakeEventName:"insertParagraph"},fR=(e,t,n)=>{const o=e.dom.createRng();n?(o.setStartBefore(t),o.setEndBefore(t)):(o.setStartAfter(t),o.setEndAfter(t)),e.selection.setRng(o),Vg(e,o)},gR=(e,t)=>{const n=vn("br");po(Cn(t),n),e.undoManager.add()},pR=(e,t)=>{hR(e.getBody(),t)||ho(Cn(t),vn("br"));const n=vn("br");ho(Cn(t),n),fR(e,n.dom,!1),e.undoManager.add()},hR=(e,t)=>{return n=Ji.after(t),!!gr(n.getNode())||Gu(e,Ji.after(t)).map((e=>gr(e.getNode()))).getOr(!1);var n},bR=e=>e&&"A"===e.nodeName&&"href"in e,vR=e=>e.fold(L,bR,bR,L),yR=(e,t)=>{t.fold(_,T(gR,e),T(pR,e),_)},CR={insert:(e,t)=>{const n=(e=>{const t=T(Th,e),n=Ji.fromRangeStart(e.selection.getRng());return Ix(t,e.getBody(),n).filter(vR)})(e);n.isSome()?n.each(T(yR,e)):((e,t)=>{const n=e.selection,o=e.dom,r=n.getRng();let s,a=!1;Eg(o,r).each((e=>{r.setStart(e.startContainer,e.startOffset),r.setEnd(e.endContainer,e.endOffset)}));let i=r.startOffset,l=r.startContainer;if(Jo(l)&&l.hasChildNodes()){const e=i>l.childNodes.length-1;l=l.childNodes[Math.min(i,l.childNodes.length-1)]||l,i=e&&lr(l)?l.data.length:0}let d=o.getParent(l,o.isBlock);const c=d&&d.parentNode?o.getParent(d.parentNode,o.isBlock):null,u=c?c.nodeName.toUpperCase():"",m=!(!t||!t.ctrlKey);"LI"!==u||m||(d=c),lr(l)&&i>=l.data.length&&(((e,t,n)=>{const o=new $o(t,n);let r;const s=e.getNonEmptyElements();for(;r=o.next();)if(s[r.nodeName.toLowerCase()]||lr(r)&&r.length>0)return!0;return!1})(e.schema,l,d||o.getRoot())||(s=o.create("br"),r.insertNode(s),r.setStartAfter(s),r.setEndAfter(s),a=!0)),s=o.create("br"),tl(o,r,s),fR(e,s,a),e.undoManager.add()})(e,t)},fakeEventName:"insertLineBreak"},wR=(e,t)=>QN(e).filter((e=>t.length>0&&xn(Cn(e),t))).isSome(),ER=_l([{br:[]},{block:[]},{none:[]}]),xR=(e,t)=>(e=>wR(e,od(e)))(e),_R=e=>(t,n)=>(e=>QN(e).filter((e=>Ka(Cn(e)))).isSome())(t)===e,kR=(e,t)=>(n,o)=>{const r=(e=>QN(e).fold(N(""),(e=>e.nodeName.toUpperCase())))(n)===e.toUpperCase();return r===t},SR=e=>{const t=ZN(e.dom,e.selection.getStart());return y(t)},NR=e=>kR("pre",e),RR=e=>(t,n)=>Ql(t)===e,AR=(e,t)=>(e=>wR(e,nd(e)))(e),TR=(e,t)=>t,OR=e=>{const t=Jl(e),n=ZN(e.dom,e.selection.getStart());return C(n)&&e.schema.isValidChild(n.nodeName,t)},BR=e=>{const t=e.selection.getRng(),n=Cn(t.startContainer),o=Fn(n,t.startOffset).map((e=>Wt(e)&&!no(e)));return t.collapsed&&o.getOr(!0)},PR=(e,t)=>(n,o)=>X(e,((e,t)=>e&&t(n,o)),!0)?I.some(t):I.none(),DR=(e,t,n)=>{if(!t.mode.isReadOnly()){if(t.selection.isCollapsed()||(e=>{e.execCommand("delete")})(t),C(n)&&qN(t,e.fakeEventName).isDefaultPrevented())return;e.insert(t,n),C(n)&&VN(t,e.fakeEventName)}},LR=(e,t)=>{if(e.mode.isReadOnly())return;const n=()=>DR(CR,e,t),o=()=>DR(mR,e,t),r=((e,t)=>Nx([PR([xR],ER.none()),PR([NR(!0),SR],ER.none()),PR([kR("summary",!0)],ER.br()),PR([NR(!0),RR(!1),TR],ER.br()),PR([NR(!0),RR(!1)],ER.block()),PR([NR(!0),RR(!0),TR],ER.block()),PR([NR(!0),RR(!0)],ER.br()),PR([_R(!0),TR],ER.br()),PR([_R(!0)],ER.block()),PR([AR],ER.br()),PR([TR],ER.br()),PR([OR],ER.block()),PR([BR],ER.block())],[e,!(!t||!t.shiftKey)]).getOr(ER.none()))(e,t);switch(td(e)){case"linebreak":r.fold(n,n,_);break;case"block":r.fold(o,o,_);break;case"invert":r.fold(o,n,_);break;default:r.fold(n,o,_)}},MR=xt(),IR=MR.os.isiOS()&&MR.browser.isSafari(),FR=(e,t)=>{var n;t.isDefaultPrevented()||(t.preventDefault(),(n=e.undoManager).typing&&(n.typing=!1,n.add()),e.undoManager.transact((()=>{LR(e,t)})))},UR=xt(),zR=e=>e.stopImmediatePropagation(),jR=e=>e.keyCode===Qf.PAGE_UP||e.keyCode===Qf.PAGE_DOWN,HR=(e,t,n)=>{n&&!e.get()?t.on("NodeChange",zR,!0):!n&&e.get()&&t.off("NodeChange",zR),e.set(n)},$R=(e,t)=>{const n=t.container(),o=t.offset();return lr(n)?(n.insertData(o,e),I.some(Ji(n,o+e.length))):Nu(t).map((n=>{const o=yn(e);return t.isAtEnd()?ho(n,o):po(n,o),Ji(o.dom,e.length)}))},VR=T($R,qo),qR=T($R," "),WR=e=>t=>{e.selection.setRng(t.toRange()),e.nodeChanged()},KR=e=>{const t=Ji.fromRangeStart(e.selection.getRng()),n=Cn(e.getBody());if(e.selection.isCollapsed()){const o=T(Th,e),r=Ji.fromRangeStart(e.selection.getRng());return Ix(o,e.getBody(),r).bind((e=>t=>t.fold((t=>Xu(e.dom,Ji.before(t))),(e=>Zu(e)),(e=>Qu(e)),(t=>Gu(e.dom,Ji.after(t)))))(n)).map((o=>()=>((e,t,n)=>o=>dh(e,o,n)?VR(t):qR(t))(n,t,e.schema)(o).each(WR(e))))}return I.none()},YR=e=>{return Ft(Tt.browser.isFirefox()&&e.selection.isEditable()&&(t=e.dom,n=e.selection.getRng().startContainer,t.isEditable(t.getParent(n,"summary"))),(()=>{const t=Cn(e.getBody());e.selection.isCollapsed()||e.getDoc().execCommand("Delete"),((e,t,n)=>dh(e,t,n)?VR(t):qR(t))(t,Ji.fromRangeStart(e.selection.getRng()),e.schema).each(WR(e))}));var t,n},GR=e=>Bc(e)?[{keyCode:Qf.TAB,action:Ak(rS,e,!0)},{keyCode:Qf.TAB,shiftKey:!0,action:Ak(rS,e,!1)}]:[],XR=e=>{if(e.addShortcut("Meta+P","","mcePrint"),BN(e),mw(e))return Or(null);{const t=P_(e);return(e=>{e.on("beforeinput",(t=>{e.selection.isEditable()&&!$(t.getTargetRanges(),(t=>!qg(e.dom,t)))||t.preventDefault()}))})(e),(e=>{e.on("keyup compositionstart",T(bk,e))})(e),((e,t)=>{e.on("keydown",(n=>{n.isDefaultPrevented()||((e,t,n)=>{const o=Tt.os.isMacOS()||Tt.os.isiOS();Tk([{keyCode:Qf.RIGHT,action:Ak(Ck,e,!0)},{keyCode:Qf.LEFT,action:Ak(Ck,e,!1)},{keyCode:Qf.UP,action:Ak(wk,e,!1)},{keyCode:Qf.DOWN,action:Ak(wk,e,!0)},...o?[{keyCode:Qf.UP,action:Ak(xk,e,!1),metaKey:!0,shiftKey:!0},{keyCode:Qf.DOWN,action:Ak(xk,e,!0),metaKey:!0,shiftKey:!0}]:[],{keyCode:Qf.RIGHT,action:Ak(Jk,e,!0)},{keyCode:Qf.LEFT,action:Ak(Jk,e,!1)},{keyCode:Qf.UP,action:Ak(eS,e,!1)},{keyCode:Qf.DOWN,action:Ak(eS,e,!0)},{keyCode:Qf.UP,action:Ak(eS,e,!1)},{keyCode:Qf.UP,action:Ak(Sk,e,!1)},{keyCode:Qf.DOWN,action:Ak(Sk,e,!0)},{keyCode:Qf.RIGHT,action:Ak(Bk,e,!0)},{keyCode:Qf.LEFT,action:Ak(Bk,e,!1)},{keyCode:Qf.UP,action:Ak(Pk,e,!1)},{keyCode:Qf.DOWN,action:Ak(Pk,e,!0)},{keyCode:Qf.RIGHT,action:Ak(O_,e,t,!0)},{keyCode:Qf.LEFT,action:Ak(O_,e,t,!1)},{keyCode:Qf.RIGHT,ctrlKey:!o,altKey:o,action:Ak(D_,e,t)},{keyCode:Qf.LEFT,ctrlKey:!o,altKey:o,action:Ak(L_,e,t)},{keyCode:Qf.UP,action:Ak(kk,e,!1)},{keyCode:Qf.DOWN,action:Ak(kk,e,!0)}],n).each((e=>{n.preventDefault()}))})(e,t,n)}))})(e,t),((e,t)=>{let n=!1;e.on("keydown",(o=>{n=o.keyCode===Qf.BACKSPACE,o.isDefaultPrevented()||((e,t,n)=>{const o=n.keyCode===Qf.BACKSPACE?"deleteContentBackward":"deleteContentForward",r=e.selection.isCollapsed(),s=r?"character":"selection",a=e=>r?e?"word":"line":"selection";Ok([{keyCode:Qf.BACKSPACE,action:Ak(sk,e)},{keyCode:Qf.BACKSPACE,action:Ak(cx,e,!1)},{keyCode:Qf.DELETE,action:Ak(cx,e,!0)},{keyCode:Qf.BACKSPACE,action:Ak(nx,e,!1)},{keyCode:Qf.DELETE,action:Ak(nx,e,!0)},{keyCode:Qf.BACKSPACE,action:Ak(U_,e,t,!1)},{keyCode:Qf.DELETE,action:Ak(U_,e,t,!0)},{keyCode:Qf.BACKSPACE,action:Ak(hb,e,!1)},{keyCode:Qf.DELETE,action:Ak(hb,e,!0)},{keyCode:Qf.BACKSPACE,action:Ak(HN,e,!1,s)},{keyCode:Qf.DELETE,action:Ak(HN,e,!0,s)},...YN?[{keyCode:Qf.BACKSPACE,altKey:!0,action:Ak(HN,e,!1,a(!0))},{keyCode:Qf.DELETE,altKey:!0,action:Ak(HN,e,!0,a(!0))},{keyCode:Qf.BACKSPACE,metaKey:!0,action:Ak(HN,e,!1,a(!1))}]:[{keyCode:Qf.BACKSPACE,ctrlKey:!0,action:Ak(HN,e,!1,a(!0))},{keyCode:Qf.DELETE,ctrlKey:!0,action:Ak(HN,e,!0,a(!0))}],{keyCode:Qf.BACKSPACE,action:Ak(hx,e,!1)},{keyCode:Qf.DELETE,action:Ak(hx,e,!0)},{keyCode:Qf.BACKSPACE,action:Ak(Z_,e,!1)},{keyCode:Qf.DELETE,action:Ak(Z_,e,!0)},{keyCode:Qf.BACKSPACE,action:Ak(GE,e,!1)},{keyCode:Qf.DELETE,action:Ak(GE,e,!0)},{keyCode:Qf.BACKSPACE,action:Ak(WE,e,!1)},{keyCode:Qf.DELETE,action:Ak(WE,e,!0)},{keyCode:Qf.BACKSPACE,action:Ak(Y_,e,!1)},{keyCode:Qf.DELETE,action:Ak(Y_,e,!0)},{keyCode:Qf.BACKSPACE,action:Ak(px,e,!1)},{keyCode:Qf.DELETE,action:Ak(px,e,!0)}],n).filter((t=>e.selection.isEditable())).each((t=>{n.preventDefault(),qN(e,o).isDefaultPrevented()||(t(),VN(e,o))}))})(e,t,o)})),e.on("keyup",(t=>{t.isDefaultPrevented()||((e,t,n)=>{Tk([{keyCode:Qf.BACKSPACE,action:Ak(dx,e)},{keyCode:Qf.DELETE,action:Ak(dx,e)},...YN?[{keyCode:Qf.BACKSPACE,altKey:!0,action:Ak(G_,e)},{keyCode:Qf.DELETE,altKey:!0,action:Ak(G_,e)},...n?[{keyCode:GN?224:91,action:Ak(G_,e)}]:[]]:[{keyCode:Qf.BACKSPACE,ctrlKey:!0,action:Ak(G_,e)},{keyCode:Qf.DELETE,ctrlKey:!0,action:Ak(G_,e)}]],t)})(e,t,n),n=!1}))})(e,t),(e=>{let t=I.none();e.on("keydown",(n=>{n.keyCode===Qf.ENTER&&(IR&&(e=>{if(!e.collapsed)return!1;const t=e.startContainer;if(lr(t)){const n=/^[\uAC00-\uD7AF\u1100-\u11FF\u3130-\u318F\uA960-\uA97F\uD7B0-\uD7FF]$/,o=t.data.charAt(e.startOffset-1);return n.test(o)}return!1})(e.selection.getRng())?(e=>{t=I.some(e.selection.getBookmark()),e.undoManager.add()})(e):FR(e,n))})),e.on("keyup",(n=>{n.keyCode===Qf.ENTER&&t.each((()=>((e,n)=>{e.undoManager.undo(),t.fold(_,(t=>e.selection.moveToBookmark(t))),FR(e,n),t=I.none()})(e,n)))}))})(e),(e=>{e.on("keydown",(t=>{t.isDefaultPrevented()||((e,t)=>{Ok([{keyCode:Qf.SPACEBAR,action:Ak(KR,e)},{keyCode:Qf.SPACEBAR,action:Ak(YR,e)}],t).each((n=>{t.preventDefault(),qN(e,"insertText",{data:" "}).isDefaultPrevented()||(n(),VN(e,"insertText",{data:" "}))}))})(e,t)}))})(e),(e=>{e.on("input",(t=>{t.isComposing||(e=>{const t=Cn(e.getBody());e.selection.isCollapsed()&&bh(t,Ji.fromRangeStart(e.selection.getRng()),e.schema).each((t=>{e.selection.setRng(t.toRange())}))})(e)}))})(e),(e=>{e.on("keydown",(t=>{t.isDefaultPrevented()||((e,t)=>{Tk([...GR(e)],t).each((e=>{t.preventDefault()}))})(e,t)}))})(e),((e,t)=>{e.on("keydown",(n=>{n.isDefaultPrevented()||((e,t,n)=>{const o=Tt.os.isMacOS()||Tt.os.isiOS();Tk([{keyCode:Qf.END,action:Ak(Ek,e,!0)},{keyCode:Qf.HOME,action:Ak(Ek,e,!1)},...o?[]:[{keyCode:Qf.HOME,action:Ak(xk,e,!1),ctrlKey:!0,shiftKey:!0},{keyCode:Qf.END,action:Ak(xk,e,!0),ctrlKey:!0,shiftKey:!0}],{keyCode:Qf.END,action:Ak(Dk,e,!0)},{keyCode:Qf.HOME,action:Ak(Dk,e,!1)},{keyCode:Qf.END,action:Ak(M_,e,!0,t)},{keyCode:Qf.HOME,action:Ak(M_,e,!1,t)}],n).each((e=>{n.preventDefault()}))})(e,t,n)}))})(e,t),((e,t)=>{if(UR.os.isMacOS())return;const n=Or(!1);e.on("keydown",(t=>{jR(t)&&HR(n,e,!0)})),e.on("keyup",(o=>{o.isDefaultPrevented()||((e,t,n)=>{Tk([{keyCode:Qf.PAGE_UP,action:Ak(M_,e,!1,t)},{keyCode:Qf.PAGE_DOWN,action:Ak(M_,e,!0,t)}],n)})(e,t,o),jR(o)&&n.get()&&(HR(n,e,!1),e.nodeChanged())}))})(e,t),t}};class ZR{constructor(e){let t;this.lastPath=[],this.editor=e;const n=this;"onselectionchange"in e.getDoc()||e.on("NodeChange click mouseup keyup focus",(n=>{const o=e.selection.getRng(),r={startContainer:o.startContainer,startOffset:o.startOffset,endContainer:o.endContainer,endOffset:o.endOffset};"nodechange"!==n.type&&pg(r,t)||e.dispatch("SelectionChange"),t=r})),e.on("contextmenu",(()=>{Mf(e),e.dispatch("SelectionChange")})),e.on("SelectionChange",(()=>{const t=e.selection.getStart(!0);t&&Sm(e)&&!n.isSameElementPath(t)&&e.dom.isChildOf(t,e.getBody())&&e.nodeChanged({selectionChange:!0})})),e.on("mouseup",(t=>{!t.isDefaultPrevented()&&Sm(e)&&("IMG"===e.selection.getNode().nodeName?Uf.setEditorTimeout(e,(()=>{e.nodeChanged()})):e.nodeChanged())}))}nodeChanged(e={}){const t=this.editor,n=t.selection;let o;if(t.initialized&&n&&!Kd(t)&&!zc(t)){const r=t.getBody();o=n.getStart(!0)||r,o.ownerDocument===t.getDoc()&&t.dom.isChildOf(o,r)||(o=r);const s=[];t.dom.getParent(o,(e=>e===r||(s.push(e),!1))),t.dispatch("NodeChange",{...e,element:o,parents:s})}}isSameElementPath(e){let t;const n=this.editor,o=oe(n.dom.getParents(e,M,n.getBody()));if(o.length===this.lastPath.length){for(t=o.length;t>=0&&o[t]===this.lastPath[t];t--);if(-1===t)return this.lastPath=o,!0}return this.lastPath=o,!1}}const QR=Da("image"),JR=Da("event"),eA=e=>t=>{t[JR]=e},tA=eA(0),nA=eA(2),oA=eA(1),rA=(0,e=>{const t=e;return I.from(t[JR]).exists((e=>0===e))});const sA=Da("mode"),aA=e=>t=>{t[sA]=e},iA=(e,t)=>aA(t)(e),lA=aA(0),dA=aA(2),cA=aA(1),uA=e=>t=>{const n=t;return I.from(n[sA]).exists((t=>t===e))},mA=uA(0),fA=uA(1),gA=["none","copy","link","move"],pA=["none","copy","copyLink","copyMove","link","linkMove","move","all","uninitialized"],hA=()=>{const e=new window.DataTransfer;let t="move",n="all";const o={get dropEffect(){return t},set dropEffect(e){H(gA,e)&&(t=e)},get effectAllowed(){return n},set effectAllowed(e){rA(o)&&H(pA,e)&&(n=e)},get items(){return((e,t)=>({...t,get length(){return t.length},add:(n,o)=>{if(mA(e)){if(!m(n))return t.add(n);if(!v(o))return t.add(n,o)}return null},remove:n=>{mA(e)&&t.remove(n)},clear:()=>{mA(e)&&t.clear()}}))(o,e.items)},get files(){return fA(o)?Object.freeze({length:0,item:e=>null}):e.files},get types(){return e.types},setDragImage:(t,n,r)=>{var s;mA(o)&&(s={image:t,x:n,y:r},o[QR]=s,e.setDragImage(t,n,r))},getData:t=>fA(o)?"":e.getData(t),setData:(t,n)=>{mA(o)&&e.setData(t,n)},clearData:t=>{mA(o)&&e.clearData(t)}};return lA(o),o},bA=(e,t)=>e.setData("text/html",t),vA="x-tinymce/html",yA=N(vA),CA="\x3c!-- "+vA+" --\x3e",wA=e=>CA+e,EA=e=>-1!==e.indexOf(CA),xA="%MCEPASTEBIN%",_A=e=>e.dom.get("mcepastebin"),kA=e=>C(e)&&"mcepastebin"===e.id,SA=e=>e===xA,NA=(e,t)=>(Dt.each(t,(t=>{e=u(t,RegExp)?e.replace(t,""):e.replace(t[0],t[1])})),e),RA=e=>NA(e,[/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/gi,/<!--StartFragment-->|<!--EndFragment-->/g,[/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,(e,t,n)=>t||n?qo:" "],/<br class="Apple-interchange-newline">/g,/<br>$/i]),AA=(e,t)=>({content:e,cancelled:t}),TA=(e,t)=>(e.insertContent(t,{merge:bc(e),paste:!0}),!0),OA=e=>/^https?:\/\/[\w\-\/+=.,!;:&%@^~(){}?#]+$/i.test(e),BA=(e,t,n)=>!(e.selection.isCollapsed()||!OA(t))&&((e,t,n)=>(e.undoManager.extra((()=>{n(e,t)}),(()=>{e.execCommand("mceInsertLink",!1,t)})),!0))(e,t,n),PA=(e,t,n)=>!!((e,t)=>OA(t)&&$(Oc(e),(e=>Ve(t.toLowerCase(),`.${e.toLowerCase()}`))))(e,t)&&((e,t,n)=>(e.undoManager.extra((()=>{n(e,t)}),(()=>{e.insertContent('<img src="'+t+'">')})),!0))(e,t,n),DA=(e=>{let t=0;return()=>"mceclip"+t++})(),LA=e=>{const t=hA();return bA(t,e),dA(t),t},MA=(e,t,n,o,r)=>{const s=((e,t,n)=>((e,t,n)=>{const o=((e,t,n)=>e.dispatch("PastePreProcess",{content:t,internal:n}))(e,t,n),r=((e,t)=>{const n=BC({sanitize:Ac(e),sandbox_iframes:Lc(e),sandbox_iframes_exclusions:Mc(e),convert_unsafe_embeds:Ic(e)},e.schema);n.addNodeFilter("meta",(e=>{Dt.each(e,(e=>{e.remove()}))}));const o=n.parse(t,{forced_root_block:!1,isRootContent:!0});return Cp({validate:!0},e.schema).serialize(o)})(e,o.content);return e.hasEventListeners("PastePostProcess")&&!o.isDefaultPrevented()?((e,t,n)=>{const o=e.dom.create("div",{style:"display:none"},t),r=((e,t,n)=>e.dispatch("PastePostProcess",{node:t,internal:n}))(e,o,n);return AA(r.node.innerHTML,r.isDefaultPrevented())})(e,r,n):AA(r,o.isDefaultPrevented())})(e,t,n))(e,t,n);if(!s.cancelled){const t=s.content,n=()=>((e,t,n)=>{n||!vc(e)?TA(e,t):((e,t)=>{Dt.each([BA,PA,TA],(n=>!n(e,t,TA)))})(e,t)})(e,t,o);r?qN(e,"insertFromPaste",{dataTransfer:LA(t)}).isDefaultPrevented()||(n(),VN(e,"insertFromPaste")):n()}},IA=(e,t,n,o)=>{const r=n||EA(t);MA(e,(e=>e.replace(CA,""))(t),r,!1,o)},FA=(e,t,n)=>{const o=e.dom.encode(t).replace(/\r\n/g,"\n"),r=((e,t,n)=>{const o=e.split(/\n\n/),r=((e,t)=>{let n="<"+e;const o=we(t,((e,t)=>t+'="'+Cs.encodeAllRaw(e)+'"'));return o.length&&(n+=" "+o.join(" ")),n+">"})(t,n),s="</"+t+">",a=V(o,(e=>e.split(/\n/).join("<br />")));return 1===a.length?a[0]:V(a,(e=>r+e+s)).join("")})(Xo(o,Cc(e)),Jl(e),ed(e));MA(e,r,!1,!0,n)},UA=e=>{const t={};if(e&&e.types)for(let n=0;n<e.types.length;n++){const o=e.types[n];try{t[o]=e.getData(o)}catch(e){t[o]=""}}return t},zA=(e,t)=>t in e&&e[t].length>0,jA=e=>zA(e,"text/html")||zA(e,"text/plain"),HA=(e,t,n)=>{const o="paste"===t.type?t.clipboardData:t.dataTransfer;var r;if(uc(e)&&o){const s=((e,t)=>{const n=t.items?te(ce(t.items),(e=>"file"===e.kind?[e.getAsFile()]:[])):[],o=t.files?ce(t.files):[];return Y(n.length>0?n:o,(e=>{const t=Oc(e);return e=>$e(e.type,"image/")&&$(t,(t=>(e=>{const t=e.toLowerCase(),n={jpg:"jpeg",jpe:"jpeg",jfi:"jpeg",jif:"jpeg",jfif:"jpeg",pjpeg:"jpeg",pjp:"jpeg",svg:"svg+xml"};return Dt.hasOwn(n,t)?"image/"+n[t]:"image/"+t})(t)===e.type))})(e))})(e,o);if(s.length>0)return t.preventDefault(),(r=s,Promise.all(V(r,(e=>sy(e).then((t=>({file:e,uri:t}))))))).then((t=>{n&&e.selection.setRng(n),q(t,(t=>{((e,t)=>{oy(t.uri).each((({data:n,type:o,base64Encoded:r})=>{const s=r?n:btoa(n),a=t.file,i=e.editorUpload.blobCache,l=i.getByData(s,o),d=null!=l?l:((e,t,n,o)=>{const r=DA(),s=id(e)&&C(n.name),a=s?((e,t)=>{const n=t.match(/([\s\S]+?)(?:\.[a-z0-9.]+)$/i);return C(n)?e.dom.encode(n[1]):void 0})(e,n.name):r,i=s?n.name:void 0,l=t.create(r,n,o,a,i);return t.add(l),l})(e,i,a,s);IA(e,`<img src="${d.blobUri()}">`,!1,!0)}))})(e,t)}))})),!0}return!1},$A=(e,t,n,o,r)=>{let s=RA(n);const a=zA(t,yA())||EA(n),i=!a&&(e=>!/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(e))(s),l=OA(s);(SA(s)||!s.length||i&&!l)&&(o=!0),(o||l)&&(s=zA(t,"text/plain")&&i?t["text/plain"]:(e=>{const t=Is(),n=BC({},t);let o="";const r=t.getVoidElements(),s=Dt.makeMap("script noscript style textarea video audio iframe object"," "),a=t.getBlockElements(),i=e=>{const n=e.name,l=e;if("br"!==n){if("wbr"!==n)if(r[n]&&(o+=" "),s[n])o+=" ";else{if(3===e.type&&(o+=e.value),!(e.name in t.getVoidElements())){let t=e.firstChild;if(t)do{i(t)}while(t=t.next)}a[n]&&l.next&&(o+="\n","p"===n&&(o+="\n"))}}else o+="\n"};return e=NA(e,[/<!\[[^\]]+\]>/g]),i(n.parse(e)),o})(s)),SA(s)||(o?FA(e,s,r):IA(e,s,a,r))},VA=(e,t,n)=>{((e,t,n)=>{let o;e.on("keydown",(e=>{(e=>Qf.metaKeyPressed(e)&&86===e.keyCode||e.shiftKey&&45===e.keyCode)(e)&&!e.isDefaultPrevented()&&(o=e.shiftKey&&86===e.keyCode)})),e.on("paste",(r=>{if(r.isDefaultPrevented()||(e=>{var t,n;return Tt.os.isAndroid()&&0===(null===(n=null===(t=e.clipboardData)||void 0===t?void 0:t.items)||void 0===n?void 0:n.length)})(r))return;const s="text"===n.get()||o;o=!1;const a=UA(r.clipboardData);!jA(a)&&HA(e,r,t.getLastRng()||e.selection.getRng())||(zA(a,"text/html")?(r.preventDefault(),$A(e,a,a["text/html"],s,!0)):zA(a,"text/plain")&&zA(a,"text/uri-list")?(r.preventDefault(),$A(e,a,a["text/plain"],s,!0)):(t.create(),Uf.setEditorTimeout(e,(()=>{const n=t.getHtml();t.remove(),$A(e,a,n,s,!1)}),0)))}))})(e,t,n),(e=>{const t=e=>$e(e,"webkit-fake-url"),n=e=>$e(e,"data:");e.parser.addNodeFilter("img",((o,r,s)=>{if(!uc(e)&&(e=>{var t;return!0===(null===(t=e.data)||void 0===t?void 0:t.paste)})(s))for(const r of o){const o=r.attr("src");m(o)&&!r.attr("data-mce-object")&&o!==Tt.transparentSrc&&(t(o)||!wc(e)&&n(o))&&r.remove()}}))})(e)},qA=(e,t,n,o)=>{((e,t,n)=>{if(!e)return!1;try{return e.clearData(),e.setData("text/html",t),e.setData("text/plain",n),e.setData(yA(),t),!0}catch(e){return!1}})(e.clipboardData,t.html,t.text)?(e.preventDefault(),o()):n(t.html,o)},WA=e=>(t,n)=>{const{dom:o,selection:r}=e,s=o.create("div",{contenteditable:"false","data-mce-bogus":"all"}),a=o.create("div",{contenteditable:"true"},t);o.setStyles(s,{position:"fixed",top:"0",left:"-3000px",width:"1000px",overflow:"hidden"}),s.appendChild(a),o.add(e.getBody(),s);const i=r.getRng();a.focus();const l=o.createRng();l.selectNodeContents(a),r.setRng(l),Uf.setEditorTimeout(e,(()=>{r.setRng(i),o.remove(s),n()}),0)},KA=e=>({html:wA(e.selection.getContent({contextual:!0})),text:e.selection.getContent({format:"text"})}),YA=e=>!e.selection.isCollapsed()||(e=>!!e.dom.getParent(e.selection.getStart(),"td[data-mce-selected],th[data-mce-selected]",e.getBody()))(e),GA=(e,t)=>{var n,o;return kg.getCaretRangeFromPoint(null!==(n=t.clientX)&&void 0!==n?n:0,null!==(o=t.clientY)&&void 0!==o?o:0,e.getDoc())},XA=(e,t)=>{e.focus(),t&&e.selection.setRng(t)},ZA=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,QA=e=>Dt.trim(e).replace(ZA,qs).toLowerCase(),JA=(e,t,n)=>{const o=pc(e);if(n||"all"===o||!hc(e))return t;const r=o?o.split(/[, ]/):[];if(r&&"none"!==o){const n=e.dom,o=e.selection.getNode();t=t.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,((e,t,s,a)=>{const i=n.parseStyle(n.decode(s)),l={};for(let e=0;e<r.length;e++){const t=i[r[e]];let s=t,a=n.getStyle(o,r[e],!0);/color/.test(r[e])&&(s=QA(s),a=QA(a)),a!==s&&(l[r[e]]=t)}const d=n.serializeStyle(l,"span");return d?t+' style="'+d+'"'+a:t+a}))}else t=t.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,"$1$3");return t=t.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi,((e,t,n,o)=>t+' style="'+n+'"'+o)),t},eT=e=>{const t=Or(!1),n=Or(yc(e)?"text":"html"),o=(e=>{const t=Or(null);return{create:()=>((e,t)=>{const{dom:n,selection:o}=e,r=e.getBody();t.set(o.getRng());const s=n.add(e.getBody(),"div",{id:"mcepastebin",class:"mce-pastebin",contentEditable:!0,"data-mce-bogus":"all",style:"position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0"},xA);Tt.browser.isFirefox()&&n.setStyle(s,"left","rtl"===n.getStyle(r,"direction",!0)?65535:-65535),n.bind(s,"beforedeactivate focusin focusout",(e=>{e.stopPropagation()})),s.focus(),o.select(s,!0)})(e,t),remove:()=>((e,t)=>{const n=e.dom;if(_A(e)){let o;const r=t.get();for(;o=_A(e);)n.remove(o),n.unbind(o);r&&e.selection.setRng(r)}t.set(null)})(e,t),getEl:()=>_A(e),getHtml:()=>(e=>{const t=e.dom,n=(e,n)=>{e.appendChild(n),t.remove(n,!0)},[o,...r]=Y(e.getBody().childNodes,kA);q(r,(e=>{n(o,e)}));const s=t.select("div[id=mcepastebin]",o);for(let e=s.length-1;e>=0;e--){const r=t.create("div");o.insertBefore(r,s[e]),n(r,s[e])}return o?o.innerHTML:""})(e),getLastRng:t.get}})(e);(e=>{(Tt.browser.isChromium()||Tt.browser.isSafari())&&((e,t)=>{e.on("PastePreProcess",(n=>{n.content=t(e,n.content,n.internal)}))})(e,JA)})(e),((e,t)=>{e.addCommand("mceTogglePlainTextPaste",(()=>{((e,t)=>{"text"===t.get()?(t.set("html"),Fl(e,!1)):(t.set("text"),Fl(e,!0)),e.focus()})(e,t)})),e.addCommand("mceInsertClipboardContent",((t,n)=>{n.html&&IA(e,n.html,n.internal,!1),n.text&&FA(e,n.text,!1)}))})(e,n),(e=>{const t=t=>n=>{t(e,n)},n=mc(e);w(n)&&e.on("PastePreProcess",t(n));const o=fc(e);w(o)&&e.on("PastePostProcess",t(o))})(e),e.addQueryStateHandler("mceTogglePlainTextPaste",(()=>"text"===n.get())),e.on("PreInit",(()=>{(e=>{e.on("cut",(e=>t=>{!t.isDefaultPrevented()&&YA(e)&&e.selection.isEditable()&&qA(t,KA(e),WA(e),(()=>{if(Tt.browser.isChromium()||Tt.browser.isFirefox()){const t=e.selection.getRng();Uf.setEditorTimeout(e,(()=>{e.selection.setRng(t),e.execCommand("Delete")}),0)}else e.execCommand("Delete")}))})(e)),e.on("copy",(e=>t=>{!t.isDefaultPrevented()&&YA(e)&&qA(t,KA(e),WA(e),_)})(e))})(e),((e,t)=>{cc(e)&&e.on("dragend dragover draggesture dragdrop drop drag",(e=>{e.preventDefault(),e.stopPropagation()})),uc(e)||e.on("drop",(e=>{const t=e.dataTransfer;t&&(e=>$(e.files,(e=>/^image\//.test(e.type))))(t)&&e.preventDefault()})),e.on("drop",(n=>{if(n.isDefaultPrevented())return;const o=GA(e,n);if(y(o))return;const r=UA(n.dataTransfer),s=zA(r,yA());if((!jA(r)||(e=>{const t=e["text/plain"];return!!t&&0===t.indexOf("file://")})(r))&&HA(e,n,o))return;const a=r[yA()],i=a||r["text/html"]||r["text/plain"],l=((e,t,n,o)=>{const r=e.getParent(n,(e=>Xr(t,e)));if(!h(e.getParent(n,"summary")))return!0;if(r&&_e(o,"text/html")){const e=(new DOMParser).parseFromString(o["text/html"],"text/html").body;return!h(e.querySelector(r.nodeName.toLowerCase()))}return!1})(e.dom,e.schema,o.startContainer,r),d=t.get();d&&!l||i&&(n.preventDefault(),Uf.setEditorTimeout(e,(()=>{e.undoManager.transact((()=>{(a||d&&l)&&e.execCommand("Delete"),XA(e,o);const t=RA(i);r["text/html"]?IA(e,t,s,!0):FA(e,t,!0)}))})))})),e.on("dragstart",(e=>{t.set(!0)})),e.on("dragover dragend",(n=>{uc(e)&&!t.get()&&(n.preventDefault(),XA(e,GA(e,n))),"dragend"===n.type&&t.set(!1)})),(e=>{e.on("input",(t=>{const n=e=>h(e.querySelector("summary"));if("deleteByDrag"===t.inputType){const t=Y(e.dom.select("details"),n);q(t,(t=>{gr(t.firstChild)&&t.firstChild.remove();const n=e.dom.create("summary");n.appendChild(Za().dom),t.prepend(n)}))}}))})(e)})(e,t),VA(e,o,n)}))},tT=gr,nT=lr,oT=e=>br(e.dom),rT=e=>t=>kn(Cn(e),t),sT=(e,t)=>Zn(Cn(e),oT,rT(t)),aT=(e,t,n)=>{const o=new $o(e,t),r=n?o.next.bind(o):o.prev.bind(o);let s=e;for(let t=n?e:r();t&&!tT(t);t=r())Pi(t)&&(s=t);return s},iT=e=>{const t=((e,t,n)=>{const o=Ji.fromRangeStart(e).getNode(),r=((e,t,n)=>Zn(Cn(e),(e=>(e=>hr(e.dom))(e)||n.isBlock($t(e))),rT(t)).getOr(Cn(t)).dom)(o,t,n),s=aT(o,r,!1),a=aT(o,r,!0),i=document.createRange();return sT(s,r).fold((()=>{nT(s)?i.setStart(s,0):i.setStartBefore(s)}),(e=>i.setStartBefore(e.dom))),sT(a,r).fold((()=>{nT(a)?i.setEnd(a,a.data.length):i.setEndAfter(a)}),(e=>i.setEndAfter(e.dom))),i})(e.selection.getRng(),e.getBody(),e.schema);e.selection.setRng(Bb(t))};var lT;!function(e){e.Before="before",e.After="after"}(lT||(lT={}));const dT=(e,t)=>Math.abs(e.left-t),cT=(e,t)=>Math.abs(e.right-t),uT=(e,t)=>(e=>X(e,((e,t)=>e.fold((()=>I.some(t)),(e=>{const n=Math.min(t.left,e.left),o=Math.min(t.top,e.top),r=Math.max(t.right,e.right),s=Math.max(t.bottom,e.bottom);return I.some({top:o,right:r,bottom:s,left:n,width:r-n,height:s-o})}))),I.none()))(Y(e,(e=>{return(n=t)>=(o=e).top&&n<=o.bottom;var n,o}))).fold((()=>[[],e]),(t=>{const{pass:n,fail:o}=K(e,(e=>((e,t)=>{const n=((e,t)=>Math.max(0,Math.min(e.bottom,t.bottom)-Math.max(e.top,t.top)))(e,t)/Math.min(e.height,t.height);return((e,t)=>e.top<t.bottom&&e.bottom>t.top)(e,t)&&n>.5})(e,t)));return[n,o]})),mT=(e,t,n)=>t>e.left&&t<e.right?0:Math.min(Math.abs(e.left-t),Math.abs(e.right-t)),fT=(e,t,n,o)=>{const r=e=>Pi(e.node)?I.some(e):Jo(e.node)?fT(ce(e.node.childNodes),t,n,!1):I.none(),s=(e,s)=>{const a=ae(e,((e,o)=>s(e,t,n)-s(o,t,n)));return ue(a,r).map((e=>o&&!lr(e.node)&&a.length>1?((e,o,s)=>r(o).filter((o=>Math.abs(s(e,t,n)-s(o,t,n))<2&&lr(o.node))))(e,a[1],s).getOr(e):e))},[a,i]=uT(f_(e),n),{pass:l,fail:d}=K(i,(e=>e.top<n));return s(a,mT).orThunk((()=>s(d,Ci))).orThunk((()=>s(l,Ci)))},gT=(e,t,n)=>((e,t,n)=>{const o=Cn(e),r=Rn(o),s=wn(r,t,n).filter((e=>Sn(o,e))).getOr(o);return((e,t,n,o)=>{const r=(t,s)=>{const a=Y(t.dom.childNodes,O((e=>Jo(e)&&e.classList.contains("mce-drag-container"))));return s.fold((()=>fT(a,n,o,!0)),(e=>{const t=Y(a,(t=>t!==e.dom));return fT(t,n,o,!0)})).orThunk((()=>(kn(t,e)?I.none():On(t)).bind((e=>r(e,I.some(t))))))};return r(t,I.none())})(o,s,t,n)})(e,t,n).filter((e=>nu(e.node))).map((e=>((e,t)=>({node:e.node,position:dT(e,t)<cT(e,t)?lT.Before:lT.After}))(e,t))),pT=e=>{var t,n;const o=e.getBoundingClientRect(),r=e.ownerDocument,s=r.documentElement,a=r.defaultView;return{top:o.top+(null!==(t=null==a?void 0:a.scrollY)&&void 0!==t?t:0)-s.clientTop,left:o.left+(null!==(n=null==a?void 0:a.scrollX)&&void 0!==n?n:0)-s.clientLeft}},hT=e=>({target:e,srcElement:e}),bT=(e,t,n,o)=>{const r=((e,t)=>{const n=(e=>{const t=hA(),n=(e=>{const t=e;return I.from(t[sA])})(e);return dA(e),tA(t),t.dropEffect=e.dropEffect,t.effectAllowed=e.effectAllowed,(e=>{const t=e;return I.from(t[QR])})(e).each((e=>t.setDragImage(e.image,e.x,e.y))),q(e.types,(n=>{"Files"!==n&&t.setData(n,e.getData(n))})),q(e.files,(e=>t.items.add(e))),(e=>{const t=e;return I.from(t[JR])})(e).each((e=>{((e,t)=>{eA(t)(e)})(t,e)})),n.each((n=>{iA(e,n),iA(t,n)})),t})(e);return"dragstart"===t?(tA(n),lA(n)):"drop"===t?(nA(n),dA(n)):(oA(n),cA(n)),n})(n,e);return v(o)?((e,t,n)=>{const o=B("Function not supported on simulated event.");return{bubbles:!0,cancelBubble:!1,cancelable:!0,composed:!1,currentTarget:null,defaultPrevented:!1,eventPhase:0,isTrusted:!0,returnValue:!1,timeStamp:0,type:e,composedPath:o,initEvent:o,preventDefault:_,stopImmediatePropagation:_,stopPropagation:_,AT_TARGET:window.Event.AT_TARGET,BUBBLING_PHASE:window.Event.BUBBLING_PHASE,CAPTURING_PHASE:window.Event.CAPTURING_PHASE,NONE:window.Event.NONE,altKey:!1,button:0,buttons:0,clientX:0,clientY:0,ctrlKey:!1,metaKey:!1,movementX:0,movementY:0,offsetX:0,offsetY:0,pageX:0,pageY:0,relatedTarget:null,screenX:0,screenY:0,shiftKey:!1,x:0,y:0,detail:0,view:null,which:0,initUIEvent:o,initMouseEvent:o,getModifierState:o,dataTransfer:n,...hT(t)}})(e,t,r):((e,t,n,o)=>({...t,dataTransfer:o,type:e,...hT(n)}))(e,o,t,r)},vT=br,yT=((...e)=>t=>{for(let n=0;n<e.length;n++)if(e[n](t))return!0;return!1})(vT,hr),CT=(e,t,n,o)=>{const r=e.dom,s=t.cloneNode(!0);r.setStyles(s,{width:n,height:o}),r.setAttrib(s,"data-mce-selected",null);const a=r.create("div",{class:"mce-drag-container","data-mce-bogus":"all",unselectable:"on",contenteditable:"false"});return r.setStyles(a,{position:"absolute",opacity:.5,overflow:"hidden",border:0,padding:0,margin:0,width:n,height:o}),r.setStyles(s,{margin:0,boxSizing:"border-box"}),a.appendChild(s),a},wT=(e,t)=>n=>()=>{const o="left"===e?n.scrollX:n.scrollY;n.scroll({[e]:o+t,behavior:"smooth"})},ET=wT("left",-32),xT=wT("left",32),_T=wT("top",-32),kT=wT("top",32),ST=e=>{e&&e.parentNode&&e.parentNode.removeChild(e)},NT=(e,t,n,o,r)=>{"dragstart"===t&&bA(o,e.dom.getOuterHTML(n));const s=bT(t,n,o,r);return e.dispatch(t,s)},RT=(e,t)=>{const n=ya(((e,n)=>((e,t,n)=>{e._selectionOverrides.hideFakeCaret(),gT(e.getBody(),t,n).fold((()=>e.selection.placeCaretAt(t,n)),(o=>{const r=e._selectionOverrides.showCaret(1,o.node,o.position===lT.Before,!1);r?e.selection.setRng(r):e.selection.placeCaretAt(t,n)}))})(t,e,n)),0);t.on("remove",n.cancel);const o=e;return r=>e.on((e=>{const s=Math.max(Math.abs(r.screenX-e.screenX),Math.abs(r.screenY-e.screenY));if(!e.dragging&&s>10){const n=NT(t,"dragstart",e.element,e.dataTransfer,r);if(C(n.dataTransfer)&&(e.dataTransfer=n.dataTransfer),n.isDefaultPrevented())return;e.dragging=!0,t.focus()}if(e.dragging){const s=r.currentTarget===t.getDoc().documentElement,l=((e,t)=>({pageX:t.pageX-e.relX,pageY:t.pageY+5}))(e,((e,t)=>{return n=(e=>e.inline?pT(e.getBody()):{left:0,top:0})(e),o=(e=>{const t=e.getBody();return e.inline?{left:t.scrollLeft,top:t.scrollTop}:{left:0,top:0}})(e),r=((e,t)=>{if(t.target.ownerDocument!==e.getDoc()){const n=pT(e.getContentAreaContainer()),o=(e=>{const t=e.getBody(),n=e.getDoc().documentElement,o={left:t.scrollLeft,top:t.scrollTop},r={left:t.scrollLeft||n.scrollLeft,top:t.scrollTop||n.scrollTop};return e.inline?o:r})(e);return{left:t.pageX-n.left+o.left,top:t.pageY-n.top+o.top}}return{left:t.pageX,top:t.pageY}})(e,t),{pageX:r.left-n.left+o.left,pageY:r.top-n.top+o.top};var n,o,r})(t,r));a=e.ghost,i=t.getBody(),a.parentNode!==i&&i.appendChild(a),((e,t,n,o,r,s,a,i,l,d,c,u)=>{let m=0,f=0;e.style.left=t.pageX+"px",e.style.top=t.pageY+"px",t.pageX+n>r&&(m=t.pageX+n-r),t.pageY+o>s&&(f=t.pageY+o-s),e.style.width=n-m+"px",e.style.height=o-f+"px";const g=l.clientHeight,p=l.clientWidth,h=a+l.getBoundingClientRect().top,b=i+l.getBoundingClientRect().left;c.on((e=>{e.intervalId.clear(),e.dragging&&u&&(a+8>=g?e.intervalId.set(kT(d)):a-8<=0?e.intervalId.set(_T(d)):i+8>=p?e.intervalId.set(xT(d)):i-8<=0?e.intervalId.set(ET(d)):h+16>=window.innerHeight?e.intervalId.set(kT(window)):h-16<=0?e.intervalId.set(_T(window)):b+16>=window.innerWidth?e.intervalId.set(xT(window)):b-16<=0&&e.intervalId.set(ET(window)))}))})(e.ghost,l,e.width,e.height,e.maxX,e.maxY,r.clientY,r.clientX,t.getContentAreaContainer(),t.getWin(),o,s),n.throttle(r.clientX,r.clientY)}var a,i}))},AT=(e,t,n)=>{e.on((e=>{e.intervalId.clear(),e.dragging&&n.fold((()=>NT(t,"dragend",e.element,e.dataTransfer)),(n=>NT(t,"dragend",e.element,e.dataTransfer,n)))})),TT(e)},TT=e=>{e.on((e=>{e.intervalId.clear(),ST(e.ghost)})),e.clear()},OT=e=>{const t=Pr(),n=ua.DOM,o=document,r=((e,t)=>n=>{if((e=>0===e.button)(n)){const o=Q(t.dom.getParents(n.target),yT).getOr(null);if(C(o)&&((e,t,n)=>vT(n)&&n!==t&&e.isEditable(n.parentElement))(t.dom,t.getBody(),o)){const r=t.dom.getPos(o),s=t.getBody(),a=t.getDoc().documentElement;e.set({element:o,dataTransfer:hA(),dragging:!1,screenX:n.screenX,screenY:n.screenY,maxX:(t.inline?s.scrollWidth:a.offsetWidth)-2,maxY:(t.inline?s.scrollHeight:a.offsetHeight)-2,relX:n.pageX-r.x,relY:n.pageY-r.y,width:o.offsetWidth,height:o.offsetHeight,ghost:CT(t,o,o.offsetWidth,o.offsetHeight),intervalId:Br(100)})}}})(t,e),s=RT(t,e),a=((e,t)=>n=>{e.on((e=>{var o;if(e.intervalId.clear(),e.dragging){if(((e,t,n)=>!y(t)&&t!==n&&!e.dom.isChildOf(t,n)&&e.dom.isEditable(t))(t,(e=>{const t=e.getSel();if(C(t)){const e=t.getRangeAt(0).startContainer;return lr(e)?e.parentNode:e}return null})(t.selection),e.element)){const r=null!==(o=t.getDoc().elementFromPoint(n.clientX,n.clientY))&&void 0!==o?o:t.getBody();NT(t,"drop",r,e.dataTransfer,n).isDefaultPrevented()||t.undoManager.transact((()=>{((e,t)=>{const n=e.getParent(t.parentNode,e.isBlock);ST(t),n&&n!==e.getRoot()&&e.isEmpty(n)&&Qa(Cn(n))})(t.dom,e.element),(e=>{const t=e.getData("text/html");return""===t?I.none():I.some(t)})(e.dataTransfer).each((e=>t.insertContent(e))),t._selectionOverrides.hideFakeCaret()}))}NT(t,"dragend",t.getBody(),e.dataTransfer,n)}})),TT(e)})(t,e),i=((e,t)=>n=>AT(e,t,I.some(n)))(t,e);e.on("mousedown",r),e.on("mousemove",s),e.on("mouseup",a),n.bind(o,"mousemove",s),n.bind(o,"mouseup",i),e.on("remove",(()=>{n.unbind(o,"mousemove",s),n.unbind(o,"mouseup",i)})),e.on("keydown",(n=>{n.keyCode===Qf.ESC&&AT(t,e,I.none())}))},BT=br,PT=(e,t)=>bb(e.getBody(),t),DT=e=>{const t=e.selection,n=e.dom,o=e.getBody(),r=Jc(e,o,n.isBlock,(()=>Gf(e))),s="sel-"+n.uniqueId(),a="data-mce-selected";let i;const l=e=>e!==o&&(BT(e)||Cr(e))&&n.isChildOf(e,o)&&n.isEditable(e.parentNode),d=(n,o,s,a=!0)=>e.dispatch("ShowCaret",{target:o,direction:n,before:s}).isDefaultPrevented()?null:(a&&t.scrollIntoView(o,-1===n),r.show(s,o)),c=e=>ai(e)||ci(e)||ui(e),u=e=>c(e.startContainer)||c(e.endContainer),m=t=>{const o=e.schema.getVoidElements(),r=n.createRng(),s=t.startContainer,a=t.startOffset,i=t.endContainer,l=t.endOffset;return _e(o,s.nodeName.toLowerCase())?0===a?r.setStartBefore(s):r.setStartAfter(s):r.setStart(s,a),_e(o,i.nodeName.toLowerCase())?0===l?r.setEndBefore(i):r.setEndAfter(i):r.setEnd(i,l),r},f=(r,c)=>{if(!r)return null;if(r.collapsed){if(!u(r)){const e=c?1:-1,t=Su(e,o,r),s=t.getNode(!c);if(C(s)){if(nu(s))return d(e,s,!!c&&!t.isAtEnd(),!1);if(si(s)&&br(s.nextSibling)){const e=n.createRng();return e.setStart(s,0),e.setEnd(s,0),e}}const a=t.getNode(c);if(C(a)){if(nu(a))return d(e,a,!c&&!t.isAtEnd(),!1);if(si(a)&&br(a.previousSibling)){const e=n.createRng();return e.setStart(a,1),e.setEnd(a,1),e}}}return null}let m=r.startContainer,f=r.startOffset;const g=r.endOffset;if(lr(m)&&0===f&&BT(m.parentNode)&&(m=m.parentNode,f=n.nodeIndex(m),m=m.parentNode),!Jo(m))return null;if(g===f+1&&m===r.endContainer){const o=m.childNodes[f];if(l(o))return(o=>{const r=o.cloneNode(!0),l=e.dispatch("ObjectSelected",{target:o,targetClone:r});if(l.isDefaultPrevented())return null;const d=((o,r)=>{const a=Cn(e.getBody()),i=e.getDoc(),l=eo(a,"#"+s).getOrThunk((()=>{const e=bn('<div data-mce-bogus="all" class="mce-offscreen-selection"></div>',i);return Jt(e,"id",s),vo(a,e),e})),d=n.createRng();wo(l),Co(l,[yn(qo,i),Cn(r),yn(qo,i)]),d.setStart(l.dom.firstChild,1),d.setEnd(l.dom.lastChild,0),lo(l,{top:n.getPos(o,e.getBody()).y+"px"}),Ef(l);const c=t.getSel();return c&&(c.removeAllRanges(),c.addRange(d)),d})(o,l.targetClone),c=Cn(o);return q(Uo(Cn(e.getBody()),`*[${a}]`),(e=>{kn(c,e)||rn(e,a)})),n.getAttrib(o,a)||o.setAttribute(a,"1"),i=o,p(),d})(o)}return null},g=()=>{i&&i.removeAttribute(a),eo(Cn(e.getBody()),"#"+s).each(Eo),i=null},p=()=>{r.hide()};return mw(e)||(e.on("click",(t=>{n.isEditable(t.target)||(t.preventDefault(),e.focus())})),e.on("blur NewBlock",g),e.on("ResizeWindow FullscreenStateChanged",r.reposition),e.on("tap",(t=>{const n=t.target,o=PT(e,n);BT(o)?(t.preventDefault(),ZE(e,o).each(f)):l(n)&&ZE(e,n).each(f)}),!0),e.on("mousedown",(r=>{const s=r.target;if(s!==o&&"HTML"!==s.nodeName&&!n.isChildOf(s,o))return;if(!((e,t,n)=>{const o=Cn(e.getBody()),r=e.inline?o:Cn(Rn(o).dom.documentElement),s=((e,t,n,o)=>{const r=(e=>e.dom.getBoundingClientRect())(t);return{x:n-(e?r.left+t.dom.clientLeft+qw(t):0),y:o-(e?r.top+t.dom.clientTop+Vw(t):0)}})(e.inline,r,t,n);return((e,t,n)=>{const o=Hw(e),r=$w(e);return t>=0&&n>=0&&t<=o&&n<=r})(r,s.x,s.y)})(e,r.clientX,r.clientY))return;g(),p();const a=PT(e,s);BT(a)?(r.preventDefault(),ZE(e,a).each(f)):gT(o,r.clientX,r.clientY).each((n=>{var o;r.preventDefault(),(o=d(1,n.node,n.position===lT.Before,!1))&&t.setRng(o),er(a)?a.focus():e.getBody().focus()}))})),e.on("keypress",(e=>{Qf.modifierPressed(e)||BT(t.getNode())&&e.preventDefault()})),e.on("GetSelectionRange",(e=>{let t=e.range;if(i){if(!i.parentNode)return void(i=null);t=t.cloneRange(),t.selectNode(i),e.range=t}})),e.on("SetSelectionRange",(e=>{e.range=m(e.range);const t=f(e.range,e.forward);t&&(e.range=t)})),e.on("AfterSetSelectionRange",(e=>{const t=e.range,o=t.startContainer.parentElement;var r;u(t)||Jo(r=o)&&"mcepastebin"===r.id||p(),(e=>C(e)&&n.hasClass(e,"mce-offscreen-selection"))(o)||g()})),(e=>{OT(e),Jd(e)&&(e=>{const t=t=>{if(!t.isDefaultPrevented()){const n=t.dataTransfer;n&&(H(n.types,"Files")||n.files.length>0)&&(t.preventDefault(),"drop"===t.type&&Zw(e,"Dropped file type is not supported"))}},n=n=>{$f(e,n.target)&&t(n)},o=()=>{const o=ua.DOM,r=e.dom,s=document,a=e.inline?e.getBody():e.getDoc(),i=["drop","dragover"];q(i,(e=>{o.bind(s,e,n),r.bind(a,e,t)})),e.on("remove",(()=>{q(i,(e=>{o.unbind(s,e,n),r.unbind(a,e,t)}))}))};e.on("init",(()=>{Uf.setEditorTimeout(e,o,0)}))})(e)})(e),(e=>{const t=ya((()=>{if(!e.removed&&e.getBody().contains(document.activeElement)){const t=e.selection.getRng();if(t.collapsed){const n=QE(e,t,!1);e.selection.setRng(n)}}}),0);e.on("focus",(()=>{t.throttle()})),e.on("blur",(()=>{t.cancel()}))})(e),(e=>{e.on("init",(()=>{e.on("focusin",(t=>{const n=t.target;if(Cr(n)){const t=bb(e.getBody(),n),o=br(t)?t:n;e.selection.getNode()!==o&&ZE(e,o).each((t=>e.selection.setRng(t)))}}))}))})(e)),{showCaret:d,showBlockCaretContainer:e=>{e.hasAttribute("data-mce-caret")&&(mi(e),t.scrollIntoView(e))},hideFakeCaret:p,destroy:()=>{r.destroy(),i=null}}},LT=(e,t)=>{let n=t;for(let t=e.previousSibling;lr(t);t=t.previousSibling)n+=t.data.length;return n},MT=(e,t,n,o,r)=>{if(lr(n)&&(o<0||o>n.data.length))return[];const s=r&&lr(n)?[LT(n,o)]:[o];let a=n;for(;a!==t&&a.parentNode;)s.push(e.nodeIndex(a,r)),a=a.parentNode;return a===t?s.reverse():[]},IT=(e,t,n,o,r,s,a=!1)=>({start:MT(e,t,n,o,a),end:MT(e,t,r,s,a)}),FT=(e,t)=>{const n=t.slice(),o=n.pop();return E(o)?X(n,((e,t)=>e.bind((e=>I.from(e.childNodes[t])))),I.some(e)).bind((e=>lr(e)&&(o<0||o>e.data.length)?I.none():I.some({node:e,offset:o}))):I.none()},UT=(e,t)=>FT(e,t.start).bind((({node:n,offset:o})=>FT(e,t.end).map((({node:e,offset:t})=>{const r=document.createRange();return r.setStart(n,o),r.setEnd(e,t),r})))),zT=(e,t,n)=>{if(t&&e.isEmpty(t)&&!n(t)){const o=t.parentNode;e.remove(t,lr(t.firstChild)&&Yo(t.firstChild.data)),zT(e,o,n)}},jT=(e,t,n,o=!0)=>{const r=t.startContainer.parentNode,s=t.endContainer.parentNode;t.deleteContents(),o&&!n(t.startContainer)&&(lr(t.startContainer)&&0===t.startContainer.data.length&&e.remove(t.startContainer),lr(t.endContainer)&&0===t.endContainer.data.length&&e.remove(t.endContainer),zT(e,r,n),r!==s&&zT(e,s,n))},HT=(e,t)=>I.from(e.dom.getParent(t.startContainer,e.dom.isBlock)),$T=(e,t,n)=>{const o=e.dynamicPatternsLookup({text:n,block:t});return{...e,blockPatterns:Rl(o).concat(e.blockPatterns),inlinePatterns:Al(o).concat(e.inlinePatterns)}},VT=(e,t,n,o)=>{const r=e.createRng();return r.setStart(t,0),r.setEnd(n,o),r.toString()},qT=(e,t)=>e.create("span",{"data-mce-type":"bookmark",id:t}),WT=(e,t)=>{const n=e.createRng();return n.setStartAfter(t.start),n.setEndBefore(t.end),n},KT=(e,t,n)=>{const o=UT(e.getRoot(),n).getOrDie("Unable to resolve path range"),r=o.startContainer,s=o.endContainer,a=0===o.endOffset?s:s.splitText(o.endOffset),i=0===o.startOffset?r:r.splitText(o.startOffset),l=i.parentNode;return{prefix:t,end:a.parentNode.insertBefore(qT(e,t+"-end"),a),start:l.insertBefore(qT(e,t+"-start"),i)}},YT=(e,t,n)=>{zT(e,e.get(t.prefix+"-end"),n),zT(e,e.get(t.prefix+"-start"),n)},GT=e=>0===e.start.length,XT=(e,t,n,o)=>{const r=t.start;var s;return uS(e,o.container,o.offset,(s=r,(e,t)=>{const n=e.data.substring(0,t),o=n.lastIndexOf(s.charAt(s.length-1)),r=n.lastIndexOf(s);return-1!==r?r+s.length:-1!==o?o+1:-1}),n).bind((o=>{var s,a;const i=null!==(a=null===(s=n.textContent)||void 0===s?void 0:s.indexOf(r))&&void 0!==a?a:-1;if(-1!==i&&o.offset>=i+r.length){const t=e.createRng();return t.setStart(o.container,o.offset-r.length),t.setEnd(o.container,o.offset),I.some(t)}{const s=o.offset-r.length;return dS(o.container,s,n).map((t=>{const n=e.createRng();return n.setStart(t.container,t.offset),n.setEnd(o.container,o.offset),n})).filter((e=>e.toString()===r)).orThunk((()=>XT(e,t,n,sS(o.container,0))))}}))},ZT=(e,t,n,o)=>{const r=e.dom,s=r.getRoot(),a=n.pattern,i=n.position.container,l=n.position.offset;return dS(i,l-n.pattern.end.length,t).bind((d=>{const c=IT(r,s,d.container,d.offset,i,l,o);if(GT(a))return I.some({matches:[{pattern:a,startRng:c,endRng:c}],position:d});{const i=QT(e,n.remainingPatterns,d.container,d.offset,t,o),l=i.getOr({matches:[],position:d}),u=l.position,m=((e,t,n,o,r,s=!1)=>{if(0===t.start.length&&!s){const t=e.createRng();return t.setStart(n,o),t.setEnd(n,o),I.some(t)}return lS(n,o,r).bind((n=>XT(e,t,r,n).bind((e=>{var t;if(s){if(e.endContainer===n.container&&e.endOffset===n.offset)return I.none();if(0===n.offset&&(null===(t=e.endContainer.textContent)||void 0===t?void 0:t.length)===e.endOffset)return I.none()}return I.some(e)}))))})(r,a,u.container,u.offset,t,i.isNone());return m.map((e=>{const t=((e,t,n,o=!1)=>IT(e,t,n.startContainer,n.startOffset,n.endContainer,n.endOffset,o))(r,s,e,o);return{matches:l.matches.concat([{pattern:a,startRng:t,endRng:c}]),position:sS(e.startContainer,e.startOffset)}}))}}))},QT=(e,t,n,o,r,s)=>{const a=e.dom;return lS(n,o,a.getRoot()).bind((i=>{const l=VT(a,r,n,o);for(let a=0;a<t.length;a++){const d=t[a];if(!Ve(l,d.end))continue;const c=t.slice();c.splice(a,1);const u=ZT(e,r,{pattern:d,remainingPatterns:c,position:i},s);if(u.isNone()&&o>0)return QT(e,t,n,o-1,r,s);if(u.isSome())return u}return I.none()}))},JT=(e,t,n)=>{e.selection.setRng(n),"inline-format"===t.type?q(t.format,(t=>{e.formatter.apply(t)})):e.execCommand(t.cmd,!1,t.value)},eO=(e,t,n,o,r,s)=>{var a;return((e,t)=>{const n=ne(e,(e=>$(t,(t=>e.pattern.start===t.pattern.start&&e.pattern.end===t.pattern.end))));return e.length===t.length?n?e:t:e.length>t.length?e:t})(QT(e,r.inlinePatterns,n,o,t,s).fold((()=>[]),(e=>e.matches)),QT(e,(a=r.inlinePatterns,ae(a,((e,t)=>t.end.length-e.end.length))),n,o,t,s).fold((()=>[]),(e=>e.matches)))},tO=(e,t)=>{if(0===t.length)return;const n=e.dom,o=e.selection.getBookmark(),r=((e,t)=>{const n=Da("mce_textpattern"),o=G(t,((t,o)=>{const r=KT(e,n+`_end${t.length}`,o.endRng);return t.concat([{...o,endMarker:r}])}),[]);return G(o,((t,r)=>{const s=o.length-t.length-1,a=GT(r.pattern)?r.endMarker:KT(e,n+`_start${s}`,r.startRng);return t.concat([{...r,startMarker:a}])}),[])})(n,t);q(r,(t=>{const o=n.getParent(t.startMarker.start,n.isBlock),r=e=>e===o;GT(t.pattern)?((e,t,n,o)=>{const r=WT(e.dom,n);jT(e.dom,r,o),JT(e,t,r)})(e,t.pattern,t.endMarker,r):((e,t,n,o,r)=>{const s=e.dom,a=WT(s,o),i=WT(s,n);jT(s,i,r),jT(s,a,r);const l={prefix:n.prefix,start:n.end,end:o.start},d=WT(s,l);JT(e,t,d)})(e,t.pattern,t.startMarker,t.endMarker,r),YT(n,t.endMarker,r),YT(n,t.startMarker,r)})),e.selection.moveToBookmark(o)},nO=(e,t,n)=>((e,t,n)=>{if(lr(e)&&0>=e.length)return I.some(sS(e,0));{const t=Ua(aS);return I.from(t.forwards(e,0,iS(e),n)).map((e=>sS(e.container,0)))}})(t,0,t).map((o=>{const r=o.container;return cS(r,n.start.length,t).each((n=>{const o=e.createRng();o.setStart(r,0),o.setEnd(n.container,n.offset),jT(e,o,(e=>e===t))})),r})),oO=e=>(t,n)=>{const o=t.dom,r=n.pattern,s=UT(o.getRoot(),n.range).getOrDie("Unable to resolve path range");return HT(t,s).each((n=>{"block-format"===r.type?((e,t)=>{const n=t.get(e);return p(n)&&le(n).exists((e=>_e(e,"block")))})(r.format,t.formatter)&&t.undoManager.transact((()=>{e(t.dom,n,r),t.formatter.apply(r.format)})):"block-command"===r.type&&t.undoManager.transact((()=>{e(t.dom,n,r),t.execCommand(r.cmd,!1,r.value)}))})),!0},rO=e=>(t,n)=>{const o=(e=>ae(e,((e,t)=>t.start.length-e.start.length)))(t),r=n.replace(qo," ");return Q(o,(t=>e(t,n,r)))},sO=(e,t)=>(n,o,r,s,a)=>{var i;void 0===a&&(a=null!==(i=o.textContent)&&void 0!==i?i:"");const l=n.dom,d=Jl(n);return l.is(o,d)?e(r.blockPatterns,a).map((e=>t&&Dt.trim(a).length===e.start.length?[]:[{pattern:e,range:IT(l,l.getRoot(),o,0,o,0,s)}])).getOr([]):[]},aO=oO(((e,t,n)=>{nO(e,t,n).each((e=>{const t=Cn(e),n=ja(t);/^\s[^\s]/.test(n)&&Ha(t,n.slice(1))}))})),iO=rO(((e,t,n)=>0===t.indexOf(e.start)||0===n.indexOf(e.start))),lO=sO(iO,!0),dO=oO(nO),cO=rO(((e,t,n)=>t===e.start||n===e.start)),uO=sO(cO,!1),mO=(e,t,n)=>{for(let o=0;o<e.length;o++)if(n(e[o],t))return!0;return!1},fO=e=>{const t=[",",".",";",":","!","?"],n=[32],o=()=>{return t=Ec(e).filter((t=>"inline-command"!==t.type&&"block-command"!==t.type||e.queryCommandSupported(t.cmd))),n=xc(e),{inlinePatterns:Al(t),blockPatterns:Rl(t),dynamicPatternsLookup:n};var t,n},r=()=>(e=>e.options.isSet("text_patterns_lookup"))(e);e.on("keydown",(t=>{if(13===t.keyCode&&!Qf.modifierPressed(t)&&e.selection.isCollapsed()&&e.selection.isEditable()){const n=Tl(o(),"enter");(n.inlinePatterns.length>0||n.blockPatterns.length>0||r())&&((e,t)=>((e,t)=>{const n=e.selection.getRng();return HT(e,n).map((o=>{var r;const s=Math.max(0,n.startOffset),a=$T(t,o,null!==(r=o.textContent)&&void 0!==r?r:"");return{inlineMatches:eO(e,o,n.startContainer,s,a,!0),blockMatches:lO(e,o,a,!0)}})).filter((({inlineMatches:e,blockMatches:t})=>t.length>0||e.length>0))})(e,t).fold(L,(({inlineMatches:t,blockMatches:n})=>(e.undoManager.add(),e.undoManager.extra((()=>{e.execCommand("mceInsertNewLine")}),(()=>{(e=>{e.insertContent(Ja,{preserve_zwsp:!0})})(e),tO(e,t),((e,t)=>{if(0===t.length)return;const n=e.selection.getBookmark();q(t,(t=>aO(e,t))),e.selection.moveToBookmark(n)})(e,n);const o=e.selection.getRng(),r=lS(o.startContainer,o.startOffset,e.dom.getRoot());e.execCommand("mceInsertNewLine"),r.each((t=>{const n=t.container;n.data.charAt(t.offset-1)===Vo&&(n.deleteData(t.offset-1,1),zT(e.dom,n.parentNode,(t=>t===e.dom.getRoot())))}))})),!0))))(e,n)&&t.preventDefault()}}),!0),e.on("keydown",(t=>{if(32===t.keyCode&&e.selection.isCollapsed()&&e.selection.isEditable()){const n=Tl(o(),"space");(n.blockPatterns.length>0||r())&&((e,t)=>((e,t)=>{const n=e.selection.getRng();return HT(e,n).map((o=>{const r=Math.max(0,n.startOffset),s=VT(e.dom,o,n.startContainer,r),a=$T(t,o,s);return uO(e,o,a,!1,s)})).filter((e=>e.length>0))})(e,t).fold(L,(t=>(e.undoManager.transact((()=>{((e,t)=>{q(t,(t=>dO(e,t)))})(e,t)})),!0))))(e,n)&&t.preventDefault()}}),!0);const s=()=>{if(e.selection.isCollapsed()&&e.selection.isEditable()){const t=Tl(o(),"space");(t.inlinePatterns.length>0||r())&&((e,t)=>{const n=e.selection.getRng();HT(e,n).map((o=>{const r=Math.max(0,n.startOffset-1),s=VT(e.dom,o,n.startContainer,r),a=$T(t,o,s),i=eO(e,o,n.startContainer,r,a,!1);i.length>0&&e.undoManager.transact((()=>{tO(e,i)}))}))})(e,t)}};e.on("keyup",(e=>{mO(n,e,((e,t)=>e===t.keyCode&&!Qf.modifierPressed(t)))&&s()})),e.on("keypress",(n=>{mO(t,n,((e,t)=>e.charCodeAt(0)===t.charCode))&&Uf.setEditorTimeout(e,s)}))},gO=e=>{const t=Dt.each,n=Qf.BACKSPACE,o=Qf.DELETE,r=e.dom,s=e.selection,a=e.parser,i=Tt.browser,l=i.isFirefox(),d=i.isChromium()||i.isSafari(),c=Tt.deviceType.isiPhone()||Tt.deviceType.isiPad(),u=Tt.os.isMacOS()||Tt.os.isiOS(),m=(t,n)=>{try{e.getDoc().execCommand(t,!1,String(n))}catch(e){}},f=e=>e.isDefaultPrevented(),g=()=>{e.shortcuts.add("meta+a",null,"SelectAll")},p=()=>{e.inline||r.bind(e.getDoc(),"mousedown mouseup",(t=>{let n;if(t.target===e.getDoc().documentElement)if(n=s.getRng(),e.getBody().focus(),"mousedown"===t.type){if(ai(n.startContainer))return;s.placeCaretAt(t.clientX,t.clientY)}else s.setRng(n)}))},h=()=>{Range.prototype.getClientRects||e.on("mousedown",(t=>{if(!f(t)&&"HTML"===t.target.nodeName){const t=e.getBody();t.blur(),Uf.setEditorTimeout(e,(()=>{t.focus()}))}}))},b=()=>{const t=nc(e);e.on("click",(n=>{const o=n.target;/^(IMG|HR)$/.test(o.nodeName)&&r.isEditable(o)&&(n.preventDefault(),e.selection.select(o),e.nodeChanged()),"A"===o.nodeName&&r.hasClass(o,t)&&0===o.childNodes.length&&r.isEditable(o.parentNode)&&(n.preventDefault(),s.select(o))}))},v=()=>{e.on("keydown",(e=>{if(!f(e)&&e.keyCode===n&&s.isCollapsed()&&0===s.getRng().startOffset){const t=s.getNode().previousSibling;if(t&&t.nodeName&&"table"===t.nodeName.toLowerCase())return e.preventDefault(),!1}return!0}))},y=()=>{Yd(e)||e.on("BeforeExecCommand mousedown",(()=>{m("StyleWithCSS",!1),m("enableInlineTableEditing",!1),Sd(e)||m("enableObjectResizing",!1)}))},C=()=>{e.contentStyles.push("img:-moz-broken {-moz-force-broken-image-icon:1;min-width:24px;min-height:24px}")},w=()=>{e.inline||e.on("keydown",(()=>{document.activeElement===document.body&&e.getWin().focus()}))},E=()=>{e.inline||(e.contentStyles.push("body {min-height: 150px}"),e.on("click",(t=>{let n;"HTML"===t.target.nodeName&&(n=e.selection.getRng(),e.getBody().focus(),e.selection.setRng(n),e.selection.normalize(),e.nodeChanged())})))},x=()=>{u&&e.on("keydown",(t=>{!Qf.metaKeyPressed(t)||t.shiftKey||37!==t.keyCode&&39!==t.keyCode||(t.preventDefault(),e.selection.getSel().modify("move",37===t.keyCode?"backward":"forward","lineboundary"))}))},k=()=>{e.on("click",(e=>{let t=e.target;do{if("A"===t.tagName)return void e.preventDefault()}while(t=t.parentNode)})),e.contentStyles.push(".mce-content-body {-webkit-touch-callout: none}")},S=()=>{e.on("init",(()=>{e.dom.bind(e.getBody(),"submit",(e=>{e.preventDefault()}))}))},N=_;return mw(e)?(d&&(p(),b(),S(),g(),c&&(w(),E(),k())),l&&(h(),y(),C(),x())):(e.on("keydown",(t=>{if(f(t)||t.keyCode!==Qf.BACKSPACE)return;let n=s.getRng();const o=n.startContainer,a=n.startOffset,i=r.getRoot();let l=o;if(n.collapsed&&0===a){for(;l.parentNode&&l.parentNode.firstChild===l&&l.parentNode!==i;)l=l.parentNode;"BLOCKQUOTE"===l.nodeName&&(e.formatter.toggle("blockquote",void 0,l),n=r.createRng(),n.setStart(o,0),n.setEnd(o,0),s.setRng(n))}})),(()=>{const t=e=>{const t=r.create("body"),n=e.cloneContents();return t.appendChild(n),s.serializer.serialize(t,{format:"html"})};e.on("keydown",(s=>{const a=s.keyCode;if(!f(s)&&(a===o||a===n)&&e.selection.isEditable()){const n=e.selection.isCollapsed(),o=e.getBody();if(n&&!Rr(e.schema,o))return;if(!n&&!(n=>{const o=t(n),s=r.createRng();return s.selectNode(e.getBody()),o===t(s)})(e.selection.getRng()))return;s.preventDefault(),e.setContent(""),o.firstChild&&r.isBlock(o.firstChild)?e.selection.setCursorLocation(o.firstChild,0):e.selection.setCursorLocation(o,0),e.nodeChanged()}}))})(),Tt.windowsPhone||e.on("keyup focusin mouseup",(t=>{Qf.modifierPressed(t)||(e=>{const t=e.getBody(),n=e.selection.getRng();return n.startContainer===n.endContainer&&n.startContainer===t&&0===n.startOffset&&n.endOffset===t.childNodes.length})(e)||s.normalize()}),!0),d&&(p(),b(),e.on("init",(()=>{m("DefaultParagraphSeparator",Jl(e))})),S(),v(),a.addNodeFilter("br",(e=>{let t=e.length;for(;t--;)"Apple-interchange-newline"===e[t].attr("class")&&e[t].remove()})),c?(w(),E(),k()):g()),l&&(e.on("keydown",(t=>{if(!f(t)&&t.keyCode===n){if(!e.getBody().getElementsByTagName("hr").length)return;if(s.isCollapsed()&&0===s.getRng().startOffset){const e=s.getNode(),n=e.previousSibling;if("HR"===e.nodeName)return r.remove(e),void t.preventDefault();n&&n.nodeName&&"hr"===n.nodeName.toLowerCase()&&(r.remove(n),t.preventDefault())}}})),h(),(()=>{const n=()=>{const n=r.getAttribs(s.getStart().cloneNode(!1));return()=>{const o=s.getStart();o!==e.getBody()&&(r.setAttrib(o,"style",null),t(n,(e=>{o.setAttributeNode(e.cloneNode(!0))})))}},o=()=>!s.isCollapsed()&&r.getParent(s.getStart(),r.isBlock)!==r.getParent(s.getEnd(),r.isBlock);e.on("keypress",(t=>{let r;return!(!(f(t)||8!==t.keyCode&&46!==t.keyCode)&&o()&&(r=n(),e.getDoc().execCommand("delete",!1),r(),t.preventDefault(),1))})),r.bind(e.getDoc(),"cut",(t=>{if(!f(t)&&o()){const t=n();Uf.setEditorTimeout(e,(()=>{t()}))}}))})(),y(),e.on("SetContent ExecCommand",(e=>{"setcontent"!==e.type&&"mceInsertLink"!==e.command||t(r.select("a:not([data-mce-block])"),(e=>{var t;let n=e.parentNode;const o=r.getRoot();if((null==n?void 0:n.lastChild)===e){for(;n&&!r.isBlock(n);){if((null===(t=n.parentNode)||void 0===t?void 0:t.lastChild)!==n||n===o)return;n=n.parentNode}r.add(n,"br",{"data-mce-bogus":1})}}))})),C(),x(),v())),{refreshContentEditable:N,isHidden:()=>{if(!l||e.removed)return!1;const t=e.selection.getSel();return!t||!t.rangeCount||0===t.rangeCount}}},pO=ua.DOM,hO=e=>e.inline?e.getElement().nodeName.toLowerCase():void 0,bO=e=>Ce(e,(e=>!1===v(e))),vO=e=>{const t=e.options.get,n=e.editorUpload.blobCache;return bO({allow_conditional_comments:t("allow_conditional_comments"),allow_html_data_urls:t("allow_html_data_urls"),allow_svg_data_urls:t("allow_svg_data_urls"),allow_html_in_named_anchor:t("allow_html_in_named_anchor"),allow_script_urls:t("allow_script_urls"),allow_mathml_annotation_encodings:t("allow_mathml_annotation_encodings"),allow_unsafe_link_target:t("allow_unsafe_link_target"),convert_unsafe_embeds:t("convert_unsafe_embeds"),convert_fonts_to_spans:t("convert_fonts_to_spans"),fix_list_elements:t("fix_list_elements"),font_size_legacy_values:t("font_size_legacy_values"),forced_root_block:t("forced_root_block"),forced_root_block_attrs:t("forced_root_block_attrs"),preserve_cdata:t("preserve_cdata"),inline_styles:t("inline_styles"),root_name:hO(e),sandbox_iframes:t("sandbox_iframes"),sandbox_iframes_exclusions:Mc(e),sanitize:t("xss_sanitization"),validate:!0,blob_cache:n,document:e.getDoc()})},yO=e=>{const t=e.options.get;return bO({custom_elements:t("custom_elements"),extended_valid_elements:t("extended_valid_elements"),invalid_elements:t("invalid_elements"),invalid_styles:t("invalid_styles"),schema:t("schema"),valid_children:t("valid_children"),valid_classes:t("valid_classes"),valid_elements:t("valid_elements"),valid_styles:t("valid_styles"),verify_html:t("verify_html"),padd_empty_block_inline_children:t("format_empty_lines")})},CO=e=>e.inline?e.ui.styleSheetLoader:e.dom.styleSheetLoader,wO=e=>{const t=CO(e),n=xd(e),o=e.contentCSS,r=()=>{t.unloadAll(o),e.inline||e.ui.styleSheetLoader.unloadAll(n)},s=()=>{e.removed?r():e.on("remove",r)};if(e.contentStyles.length>0){let t="";Dt.each(e.contentStyles,(e=>{t+=e+"\r\n"})),e.dom.addStyle(t)}const a=Promise.all(((e,t,n)=>{const{pass:o,fail:r}=K(t,(e=>tinymce.Resource.has(cE(e)))),s=o.map((t=>{const n=tinymce.Resource.get(cE(t));return m(n)?Promise.resolve(CO(e).loadRawCss(t,n)):Promise.resolve()})),a=[...s,CO(e).loadAll(r)];return e.inline?a:a.concat([e.ui.styleSheetLoader.loadAll(n)])})(e,o,n)).then(s).catch(s),i=Ed(e);return i&&((e,t)=>{const n=Cn(e.getBody()),o=Vn($n(n)),r=vn("style");Jt(r,"type","text/css"),vo(r,yn(t)),vo(o,r),e.on("remove",(()=>{Eo(r)}))})(e,i),a},EO=e=>{!0!==e.removed&&((e=>{mw(e)||e.load({initial:!0,format:"html"}),e.startContent=e.getContent({format:"raw"})})(e),(e=>{e.bindPendingEventDelegates(),e.initialized=!0,(e=>{e.dispatch("Init")})(e),e.focus(!0),(e=>{const t=e.dom.getRoot();e.inline||Sm(e)&&e.selection.getStart(!0)!==t||Zu(t).each((t=>{const n=t.getNode(),o=sr(n)?Zu(n).getOr(t):t;e.selection.setRng(o.toRange())}))})(e),e.nodeChanged({initial:!0});const t=sc(e);w(t)&&t.call(e,e),(e=>{const t=ic(e);t&&Uf.setEditorTimeout(e,(()=>{let n;n=!0===t?e:e.editorManager.get(t),n&&!n.destroyed&&(n.focus(),n.selection.scrollIntoView())}),100)})(e),sE(e)&&iE(e,!0)})(e))},xO=e=>{const t=e.getElement();let n=e.getDoc();e.inline&&(pO.addClass(t,"mce-content-body"),e.contentDocument=n=document,e.contentWindow=window,e.bodyElement=t,e.contentAreaContainer=t);const o=e.getBody();o.disabled=!0,e.readonly=Yd(e),e._editableRoot=Gd(e),!zc(e)&&e.hasEditableRoot()&&(e.inline&&"static"===pO.getStyle(o,"position",!0)&&(o.style.position="relative"),o.contentEditable="true"),o.disabled=!1,e.editorUpload=vE(e),e.schema=Is(yO(e)),e.dom=ua(n,{keep_values:!0,url_converter:e.convertURL,url_converter_scope:e,update_styles:!0,root_element:e.inline?e.getBody():null,collect:e.inline,schema:e.schema,contentCssCors:pd(e),referrerPolicy:hd(e),onSetAttrib:t=>{e.dispatch("SetAttrib",t)}}),e.parser=(e=>{const t=BC(vO(e),e.schema);return t.addAttributeFilter("src,href,style,tabindex",((t,n)=>{const o=e.dom,r="data-mce-"+n;let s=t.length;for(;s--;){const a=t[s];let i=a.attr(n);if(i&&!a.attr(r)){if(0===i.indexOf("data:")||0===i.indexOf("blob:"))continue;"style"===n?(i=o.serializeStyle(o.parseStyle(i),a.name),i.length||(i=null),a.attr(r,i),a.attr(n,i)):"tabindex"===n?(a.attr(r,i),a.attr(n,null)):a.attr(r,e.convertURL(i,n,a.name))}}})),t.addNodeFilter("script",(e=>{let t=e.length;for(;t--;){const n=e[t],o=n.attr("type")||"no/type";0!==o.indexOf("mce-")&&n.attr("type","mce-"+o)}})),Nc(e)&&t.addNodeFilter("#cdata",(t=>{var n;let o=t.length;for(;o--;){const r=t[o];r.type=8,r.name="#comment",r.value="[CDATA["+e.dom.encode(null!==(n=r.value)&&void 0!==n?n:"")+"]]"}})),t.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",(t=>{let n=t.length;const o=e.schema.getNonEmptyElements();for(;n--;){const e=t[n];e.isEmpty(o)&&0===e.getAll("br").length&&e.append(new tp("br",1))}})),t})(e),e.serializer=xw((e=>{const t=e.options.get;return{...vO(e),...yO(e),...bO({remove_trailing_brs:t("remove_trailing_brs"),pad_empty_with_br:t("pad_empty_with_br"),url_converter:t("url_converter"),url_converter_scope:t("url_converter_scope"),element_format:t("element_format"),entities:t("entities"),entity_encoding:t("entity_encoding"),indent:t("indent"),indent_after:t("indent_after"),indent_before:t("indent_before")})}})(e),e),e.selection=Cw(e.dom,e.getWin(),e.serializer,e),e.annotator=vf(e),e.formatter=AE(e),e.undoManager=OE(e),e._nodeChangeDispatcher=new ZR(e),e._selectionOverrides=DT(e),(e=>{const t=Pr(),n=Or(!1),o=Ca((t=>{e.dispatch("longpress",{...t,type:"longpress"}),n.set(!0)}),400);e.on("touchstart",(e=>{ik(e).each((r=>{o.cancel();const s={x:r.clientX,y:r.clientY,target:e.target};o.throttle(e),n.set(!1),t.set(s)}))}),!0),e.on("touchmove",(r=>{o.cancel(),ik(r).each((o=>{t.on((r=>{((e,t)=>{const n=Math.abs(e.clientX-t.x),o=Math.abs(e.clientY-t.y);return n>5||o>5})(o,r)&&(t.clear(),n.set(!1),e.dispatch("longpresscancel"))}))}))}),!0),e.on("touchend touchcancel",(r=>{o.cancel(),"touchcancel"!==r.type&&t.get().filter((e=>e.target.isEqualNode(r.target))).each((()=>{n.get()?r.preventDefault():e.dispatch("tap",{...r,type:"tap"})}))}),!0)})(e),(e=>{(e=>{e.on("click",(t=>{e.dom.getParent(t.target,"details")&&t.preventDefault()}))})(e),(e=>{e.parser.addNodeFilter("details",(t=>{const n=Pc(e);q(t,(e=>{"expanded"===n?e.attr("open","open"):"collapsed"===n&&e.attr("open",null)}))})),e.serializer.addNodeFilter("details",(t=>{const n=Dc(e);q(t,(e=>{"expanded"===n?e.attr("open","open"):"collapsed"===n&&e.attr("open",null)}))}))})(e)})(e),(e=>{const t="contenteditable",n=" "+Dt.trim(kc(e))+" ",o=" "+Dt.trim(_c(e))+" ",r=fk(n),s=fk(o),a=Sc(e);a.length>0&&e.on("BeforeSetContent",(t=>{((e,t,n)=>{let o=t.length,r=n.content;if("raw"!==n.format){for(;o--;)r=r.replace(t[o],gk(e,r,_c(e)));n.content=r}})(e,a,t)})),e.parser.addAttributeFilter("class",(e=>{let n=e.length;for(;n--;){const o=e[n];r(o)?o.attr(t,"true"):s(o)&&o.attr(t,"false")}})),e.serializer.addAttributeFilter(t,(e=>{let n=e.length;for(;n--;){const o=e[n];if(!r(o)&&!s(o))continue;const i=o.attr("data-mce-content");a.length>0&&i?pk(a,i)?(o.name="#text",o.type=3,o.raw=!0,o.value=i):o.remove():o.attr(t,null)}}))})(e),mw(e)||((e=>{e.on("mousedown",(t=>{t.detail>=3&&(t.preventDefault(),iT(e))}))})(e),(e=>{fO(e)})(e));const r=XR(e);((e,t)=>{e.addCommand("delete",(()=>{((e,t)=>{ak(e,t,!1).fold((()=>{e.selection.isEditable()&&(Ih(e),jh(e))}),D)})(e,t)})),e.addCommand("forwardDelete",(()=>{((e,t)=>{ak(e,t,!0).fold((()=>{e.selection.isEditable()&&Fh(e)}),D)})(e,t)}))})(e,r),(e=>{e.on("NodeChange",(()=>(e=>{const t=e.dom,n=e.selection,o=e.schema,r=o.getBlockElements(),s=n.getStart(),a=e.getBody();let i,l,d=null;const c=Jl(e);if(!s||!Jo(s))return;const u=a.nodeName.toLowerCase();if(!o.isValidChild(u,c.toLowerCase())||((e,t,n)=>$(jp(Cn(n),Cn(t)),(t=>lk(e,t.dom))))(r,a,s))return;if(a.firstChild===a.lastChild&&gr(a.firstChild))return i=uk(e),i.appendChild(Za().dom),a.replaceChild(i,a.firstChild),e.selection.setCursorLocation(i,0),void e.nodeChanged();let m=a.firstChild;for(;m;)if(Jo(m)&&Wr(o,m),dk(o,m)){if(ck(r,m)){l=m,m=m.nextSibling,t.remove(l);continue}if(!i){if(!d&&e.hasFocus()&&(d=fx(e.selection.getRng(),(()=>document.createElement("span")))),!m.parentNode){m=null;break}i=uk(e),a.insertBefore(i,m)}l=m,m=m.nextSibling,i.appendChild(l)}else i=null,m=m.nextSibling;d&&(e.selection.setRng(gx(d)),e.nodeChanged())})(e)))})(e),(e=>{var t;const n=e.dom,o=Jl(e),r=null!==(t=Rd(e))&&void 0!==t?t:"",s=(t,a)=>{if((e=>{if(DE(e)){const t=e.keyCode;return!LE(e)&&(Qf.metaKeyPressed(e)||e.altKey||t>=112&&t<=123||H(BE,t))}return!1})(t))return;const i=e.getBody(),l=!(e=>DE(e)&&!(LE(e)||"keyup"===e.type&&229===e.keyCode))(t)&&((e,t,n)=>{if(e.isEmpty(t,void 0,{skipBogus:!1,includeZwsp:!0})){const o=t.firstElementChild;return!o||!e.getStyle(t.firstElementChild,"padding-left")&&!e.getStyle(t.firstElementChild,"padding-right")&&n===o.nodeName.toLowerCase()}return!1})(n,i,o);(""!==n.getAttrib(i,PE)!==l||a)&&(n.setAttrib(i,PE,l?r:null),((e,t)=>{e.dispatch("PlaceholderToggle",{state:t})})(e,l),e.on(l?"keydown":"keyup",s),e.off(l?"keyup":"keydown",s))};Ge(r)&&e.on("init",(t=>{s(t,!0),e.on("change SetContent ExecCommand",s),e.on("paste",(t=>Uf.setEditorTimeout(e,(()=>s(t)))))}))})(e),eT(e);const s=(e=>{const t=e;return(e=>xe(e.plugins,"rtc").bind((e=>I.from(e.setup))))(e).fold((()=>(t.rtcInstance=uw(e),I.none())),(e=>(t.rtcInstance=(()=>{const e=N(null),t=N("");return{init:{bindEvents:_},undoManager:{beforeChange:_,add:e,undo:e,redo:e,clear:_,reset:_,hasUndo:L,hasRedo:L,transact:e,ignore:_,extra:_},formatter:{match:L,matchAll:N([]),matchNode:N(void 0),canApply:L,closest:t,apply:_,remove:_,toggle:_,formatChanged:N({unbind:_})},editor:{getContent:t,setContent:N({content:"",html:""}),insertContent:N(""),addVisual:_},selection:{getContent:t},autocompleter:{addDecoration:_,removeDecoration:_},raw:{getModel:N(I.none())}}})(),I.some((()=>e().then((e=>(t.rtcInstance=(e=>{const t=e=>f(e)?e:{},{init:n,undoManager:o,formatter:r,editor:s,selection:a,autocompleter:i,raw:l}=e;return{init:{bindEvents:n.bindEvents},undoManager:{beforeChange:o.beforeChange,add:o.add,undo:o.undo,redo:o.redo,clear:o.clear,reset:o.reset,hasUndo:o.hasUndo,hasRedo:o.hasRedo,transact:(e,t,n)=>o.transact(n),ignore:(e,t)=>o.ignore(t),extra:(e,t,n,r)=>o.extra(n,r)},formatter:{match:(e,n,o,s)=>r.match(e,t(n),s),matchAll:r.matchAll,matchNode:r.matchNode,canApply:e=>r.canApply(e),closest:e=>r.closest(e),apply:(e,n,o)=>r.apply(e,t(n)),remove:(e,n,o,s)=>r.remove(e,t(n)),toggle:(e,n,o)=>r.toggle(e,t(n)),formatChanged:(e,t,n,o,s)=>r.formatChanged(t,n,o,s)},editor:{getContent:e=>s.getContent(e),setContent:(e,t)=>({content:s.setContent(e,t),html:""}),insertContent:(e,t)=>(s.insertContent(e),""),addVisual:s.addVisual},selection:{getContent:(e,t)=>a.getContent(t)},autocompleter:{addDecoration:i.addDecoration,removeDecoration:i.removeDecoration},raw:{getModel:()=>I.some(l.getRawModel())}}})(e),e.rtc.isRemote))))))))})(e);(e=>{const t=e.getDoc(),n=e.getBody();(e=>{e.dispatch("PreInit")})(e),lc(e)||(t.body.spellcheck=!1,pO.setAttrib(n,"spellcheck","false")),e.quirks=gO(e),(e=>{e.dispatch("PostRender")})(e);const o=_d(e);void 0!==o&&(n.dir=o);const r=dc(e);r&&e.on("BeforeSetContent",(e=>{Dt.each(r,(t=>{e.content=e.content.replace(t,(e=>"\x3c!--mce:protected "+escape(e)+"--\x3e"))}))})),e.on("SetContent",(()=>{e.addVisual(e.getBody())})),e.on("compositionstart compositionend",(t=>{e.composing="compositionstart"===t.type}))})(e),(e=>{const t=Fc(e);m(Uc(e))||!v(t)&&"INVALID"!==(e=>(e=>"gpl"===e.toLowerCase())(e)||(e=>e.length>=64&&e.length<=255)(e)?"VALID":"INVALID")(t)||console.warn("TinyMCE is running in evaluation mode. Provide a valid license key or add license_key: 'gpl' to the init config to agree to the open source license terms. Read more at https://www.tiny.cloud/license-key/")})(e),s.fold((()=>{const t=(e=>{let t=!1;const n=setTimeout((()=>{t||e.setProgressState(!0)}),500);return()=>{clearTimeout(n),t=!0,e.setProgressState(!1)}})(e);wO(e).then((()=>{EO(e),t()}))}),(t=>{e.setProgressState(!0),wO(e).then((()=>{t().then((t=>{e.setProgressState(!1),EO(e),pw(e)}),(t=>{e.notificationManager.open({type:"error",text:String(t)}),EO(e),pw(e)}))}))}))},_O=M,kO=ua.DOM,SO=ua.DOM,NO=(e,t)=>({editorContainer:e,iframeContainer:t,api:{}}),RO=e=>{const t=e.getElement();return e.inline?NO(null):(e=>{const t=SO.create("div");return SO.insertAfter(t,e),NO(t,t)})(t)},AO=async e=>{e.dispatch("ScriptsLoaded"),(e=>{const t=Dt.trim(dd(e)),n=e.ui.registry.getAll().icons,o={...Fw.get("default").icons,...Fw.get(t).icons};pe(o,((t,o)=>{_e(n,o)||e.ui.registry.addIcon(o,t)}))})(e),(e=>{const t=Od(e);if(m(t)){const n=Yw.get(t);e.theme=n(e,Yw.urls[t])||{},w(e.theme.init)&&e.theme.init(e,Yw.urls[t]||e.documentBaseUrl.replace(/\/$/,""))}else e.theme={}})(e),(e=>{const t=Pd(e),n=Uw.get(t);e.model=n(e,Uw.urls[t])})(e),(e=>{const t=[];q(Zd(e),(n=>{((e,t,n)=>{const o=Kw.get(n),r=Kw.urls[n]||e.documentBaseUrl.replace(/\/$/,"");if(n=Dt.trim(n),o&&-1===Dt.inArray(t,n)){if(e.plugins[n])return;try{const s=o(e,r)||{};e.plugins[n]=s,w(s.init)&&(s.init(e,r),t.push(n))}catch(t){((e,t,n)=>{const o=ba.translate(["Failed to initialize plugin: {0}",t]);Bl(e,"PluginLoadError",{message:o}),eE(o,n),Zw(e,o)})(e,n,t)}}})(e,t,(e=>e.replace(/^\-/,""))(n))}))})(e);const t=await(e=>{const t=e.getElement();return e.orgDisplay=t.style.display,m(Od(e))?(e=>{const t=e.theme.renderUI;return t?t():RO(e)})(e):w(Od(e))?(e=>{const t=e.getElement(),n=Od(e)(e,t);return n.editorContainer.nodeType&&(n.editorContainer.id=n.editorContainer.id||e.id+"_parent"),n.iframeContainer&&n.iframeContainer.nodeType&&(n.iframeContainer.id=n.iframeContainer.id||e.id+"_iframecontainer"),n.height=n.iframeHeight?n.iframeHeight:t.offsetHeight,n})(e):RO(e)})(e);((e,t)=>{const n={show:I.from(t.show).getOr(_),hide:I.from(t.hide).getOr(_),isEnabled:I.from(t.isEnabled).getOr(M),setEnabled:n=>{n&&("readonly"===e.mode.get()||sE(e))||I.from(t.setEnabled).each((e=>e(n)))}};e.ui={...e.ui,...n}})(e,I.from(t.api).getOr({})),e.editorContainer=t.editorContainer,(e=>{e.contentCSS=e.contentCSS.concat((e=>uE(e,wd(e)))(e),(e=>uE(e,xd(e)))(e))})(e),e.inline?xO(e):((e,t)=>{((e,t)=>{const n=Tt.browser.isFirefox()?oc(e):"Rich Text Area",o=e.translate(n),r=nn(Cn(e.getElement()),"tabindex").bind(Ze),s=((e,t,n,o)=>{const r=vn("iframe");return o.each((e=>Jt(r,"tabindex",e))),en(r,n),en(r,{id:e+"_ifr",frameBorder:"0",allowTransparency:"true",title:t}),mn(r,"tox-edit-area__iframe"),r})(e.id,o,Wl(e),r).dom;s.onload=()=>{s.onload=null,e.dispatch("load")},e.contentAreaContainer=t.iframeContainer,e.iframeElement=s,e.iframeHTML=(e=>{let t=Kl(e)+"<html><head>";Yl(e)!==e.documentBaseUrl&&(t+='<base href="'+e.documentBaseURI.getURI()+'" />'),t+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';const n=Gl(e),o=Xl(e),r=e.translate(oc(e));return Zl(e)&&(t+='<meta http-equiv="Content-Security-Policy" content="'+Zl(e)+'" />'),t+=`</head><body id="${n}" class="mce-content-body ${o}" data-id="${e.id}" aria-label="${r}"><br></body></html>`,t})(e),kO.add(t.iframeContainer,s)})(e,t),t.editorContainer&&(t.editorContainer.style.display=e.orgDisplay,e.hidden=kO.isHidden(t.editorContainer)),e.getElement().style.display="none",kO.setAttrib(e.id,"aria-hidden","true"),e.getElement().style.visibility=e.orgVisibility,(e=>{const t=e.iframeElement,n=()=>{e.contentDocument=t.contentDocument,xO(e)};if(Tc(e)||Tt.browser.isFirefox()){const t=e.getDoc();t.open(),t.write(e.iframeHTML),t.close(),n()}else{const r=(o=Cn(t),No(o,"load",_O,(()=>{r.unbind(),n()})));t.srcdoc=e.iframeHTML}var o})(e)})(e,{editorContainer:t.editorContainer,iframeContainer:t.iframeContainer})},TO=ua.DOM,OO=e=>"-"===e.charAt(0),BO=(e,t,n)=>I.from(t).filter((e=>Ge(e)&&!Fw.has(e))).map((t=>({url:`${e.editorManager.baseURL}/icons/${t}/icons${n}.js`,name:I.some(t)}))),PO=(e,t)=>{const n=fa.ScriptLoader,o=()=>{!e.removed&&(e=>{const t=Od(e);return!m(t)||C(Yw.get(t))})(e)&&(e=>{const t=Pd(e);return C(Uw.get(t))})(e)&&AO(e)};((e,t)=>{const n=Od(e);if(m(n)&&!OO(n)&&!_e(Yw.urls,n)){const o=Bd(e),r=o?e.documentBaseURI.toAbsolute(o):`themes/${n}/theme${t}.js`;Yw.load(n,r).catch((()=>{((e,t,n)=>{Qw(e,"ThemeLoadError",Jw("theme",t,n))})(e,r,n)}))}})(e,t),((e,t)=>{const n=Pd(e);if("plugin"!==n&&!_e(Uw.urls,n)){const o=Dd(e),r=m(o)?e.documentBaseURI.toAbsolute(o):`models/${n}/model${t}.js`;Uw.load(n,r).catch((()=>{((e,t,n)=>{Qw(e,"ModelLoadError",Jw("model",t,n))})(e,r,n)}))}})(e,t),((e,t)=>{const n=bd(t),o=vd(t);if(!ba.hasCode(n)&&"en"!==n){const r=Ge(o)?o:`${t.editorManager.baseURL}/langs/${n}.js`;e.add(r).catch((()=>{((e,t,n)=>{Qw(e,"LanguageLoadError",Jw("language",t,n))})(t,r,n)}))}})(n,e),((e,t,n)=>{const o=BO(t,"default",n),r=(e=>I.from(cd(e)).filter(Ge).map((e=>({url:e,name:I.none()}))))(t).orThunk((()=>BO(t,dd(t),"")));q((e=>{const t=[],n=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(n);return t})([o,r]),(n=>{e.add(n.url).catch((()=>{((e,t,n)=>{Qw(e,"IconsLoadError",Jw("icons",t,n))})(t,n.url,n.name.getOrUndefined())}))}))})(n,e,t),((e,t)=>{const n=(t,n)=>{Kw.load(t,n).catch((()=>{((e,t,n)=>{Qw(e,"PluginLoadError",Jw("plugin",t,n))})(e,n,t)}))};pe(Qd(e),((t,o)=>{n(o,t),e.options.set("plugins",Zd(e).concat(o))})),q(Zd(e),(e=>{!(e=Dt.trim(e))||Kw.urls[e]||OO(e)||n(e,`plugins/${e}/plugin${t}.js`)}))})(e,t),n.loadQueue().then(o,o)},DO=xt().deviceType,LO=DO.isPhone(),MO=DO.isTablet(),IO=e=>{if(y(e))return[];{const t=p(e)?e:e.split(/[ ,]/),n=V(t,We);return Y(n,Ge)}},FO=(e,t)=>{const n=((t,n)=>{const o={},r={};return ye(t,((t,n)=>H(e,n)),ve(o),ve(r)),{t:o,f:r}})(t);return o=n.t,r=n.f,{sections:N(o),options:N(r)};var o,r},UO=(e,t)=>_e(e.sections(),t),zO=(e,t)=>({table_grid:!1,object_resizing:!1,resize:!1,toolbar_mode:xe(e,"toolbar_mode").getOr("scrolling"),toolbar_sticky:!1,...t?{menubar:!1}:{}}),jO=(e,t)=>{var n;const o=null!==(n=t.external_plugins)&&void 0!==n?n:{};return e&&e.external_plugins?Dt.extend({},e.external_plugins,o):o},HO=(e,t,n,o,r)=>{var s;const a=e?{mobile:zO(null!==(s=r.mobile)&&void 0!==s?s:{},t)}:{},i=FO(["mobile"],NS(a,r)),l=Dt.extend(n,o,i.options(),((e,t)=>e&&UO(t,"mobile"))(e,i)?((e,t,n={})=>{const o=e.sections(),r=xe(o,t).getOr({});return Dt.extend({},n,r)})(i,"mobile"):{},{external_plugins:jO(o,i.options())});return((e,t,n,o)=>{const r=IO(n.forced_plugins),s=IO(o.plugins),a=((e,t)=>UO(e,t)?e.sections()[t]:{})(t,"mobile"),i=((e,t,n,o)=>e&&UO(t,"mobile")?o:n)(e,t,s,a.plugins?IO(a.plugins):s),l=((e,t)=>[...IO(e),...IO(t)])(r,i);return Dt.extend(o,{forced_plugins:r,plugins:l})})(e,i,o,l)},$O=e=>{(e=>{const t=t=>()=>{q("left,center,right,justify".split(","),(n=>{t!==n&&e.formatter.remove("align"+n)})),"none"!==t&&((t,n)=>{e.formatter.toggle(t,void 0),e.nodeChanged()})("align"+t)};e.editorCommands.addCommands({JustifyLeft:t("left"),JustifyCenter:t("center"),JustifyRight:t("right"),JustifyFull:t("justify"),JustifyNone:t("none")})})(e),(e=>{const t=t=>()=>{const n=e.selection,o=n.isCollapsed()?[e.dom.getParent(n.getNode(),e.dom.isBlock)]:n.getSelectedBlocks();return $(o,(n=>C(e.formatter.matchNode(n,t))))};e.editorCommands.addCommands({JustifyLeft:t("alignleft"),JustifyCenter:t("aligncenter"),JustifyRight:t("alignright"),JustifyFull:t("alignjustify")},"state")})(e)},VO=(e,t)=>{const n=e.selection,o=e.dom;return/^ | $/.test(t)?((e,t,n,o)=>{const r=Cn(e.getRoot());return n=ch(r,Ji.fromRangeStart(t),o)?n.replace(/^ /,"&nbsp;"):n.replace(/^&nbsp;/," "),uh(r,Ji.fromRangeEnd(t),o)?n.replace(/(&nbsp;| )(<br( \/)>)?$/,"&nbsp;"):n.replace(/&nbsp;(<br( \/)?>)?$/," ")})(o,n.getRng(),t,e.schema):t},qO=(e,t)=>{if(e.selection.isEditable()){const{content:n,details:o}=(e=>{if("string"!=typeof e){const t=Dt.extend({paste:e.paste,data:{paste:e.paste}},e);return{content:e.content,details:t}}return{content:e,details:{}}})(t);IC(e,{...o,content:VO(e,n),format:"html",set:!1,selection:!0}).each((t=>{const n=((e,t,n)=>fw(e).editor.insertContent(t,n))(e,t.content,o);FC(e,n,t),e.addVisual()}))}},WO={"font-size":"size","font-family":"face"},KO=Zt("font"),YO=e=>(t,n)=>I.from(n).map(Cn).filter(Kt).bind((n=>((e,t,n)=>Vb(Cn(n),(t=>(t=>mo(t,e).orThunk((()=>KO(t)?xe(WO,e).bind((e=>nn(t,e))):I.none())))(t)),(e=>kn(Cn(t),e))))(e,t,n.dom).or(((e,t)=>I.from(ua.DOM.getStyle(t,e,!0)))(e,n.dom)))).getOr(""),GO=YO("font-size"),XO=k((e=>e.replace(/[\'\"\\]/g,"").replace(/,\s+/g,",")),YO("font-family")),ZO=e=>Zu(e.getBody()).bind((e=>{const t=e.container();return I.from(lr(t)?t.parentNode:t)})),QO=(e,t)=>((e,t)=>(e=>I.from(e.selection.getRng()).bind((t=>{const n=e.getBody();return t.startContainer===n&&0===t.startOffset?I.none():I.from(e.selection.getStart(!0))})))(e).orThunk(T(ZO,e)).map(Cn).filter(Kt).bind(t))(e,S(I.some,t)),JO=(e,t)=>{if(/^[0-9.]+$/.test(t)){const n=parseInt(t,10);if(n>=1&&n<=7){const o=(e=>Dt.explode(e.options.get("font_size_style_values")))(e),r=(e=>Dt.explode(e.options.get("font_size_classes")))(e);return r.length>0?r[n-1]||t:o[n-1]||t}return t}return t},eB=e=>{const t=e.split(/\s*,\s*/);return V(t,(e=>-1===e.indexOf(" ")||$e(e,'"')||$e(e,"'")?e:`'${e}'`)).join(",")},tB=(e,t)=>{if(e.mode.isReadOnly())return;const n=e.dom,o=e.selection.getRng(),r=t?e.selection.getStart():e.selection.getEnd(),s=t?o.startContainer:o.endContainer,a=ZN(n,s);if(!a||!a.isContentEditable)return;const i=t?po:ho,l=Jl(e);((e,t,n,o)=>{const r=e.dom,s=e=>r.isBlock(e)&&e.parentElement===n,a=s(t)?t:r.getParent(o,s,n);return I.from(a).map(Cn)})(e,r,a,s).each((t=>{const n=tR(e,s,t.dom,a,!1,l);i(t,Cn(n)),e.selection.setCursorLocation(n,0),e.dispatch("NewBlock",{newBlock:n}),VN(e,"insertParagraph")}))},nB=e=>{$O(e),(e=>{e.editorCommands.addCommands({"Cut,Copy,Paste":t=>{const n=e.getDoc();let o;try{n.execCommand(t)}catch(e){o=!0}if("paste"!==t||n.queryCommandEnabled(t)||(o=!0),o||!n.queryCommandSupported(t)){let t=e.translate("Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.");(Tt.os.isMacOS()||Tt.os.isiOS())&&(t=t.replace(/Ctrl\+/g,"\u2318+")),e.notificationManager.open({text:t,type:"error"})}}})})(e),(e=>{e.editorCommands.addCommands({mceAddUndoLevel:()=>{e.undoManager.add()},mceEndUndoLevel:()=>{e.undoManager.add()},Undo:()=>{e.undoManager.undo()},Redo:()=>{e.undoManager.redo()}})})(e),(e=>{e.editorCommands.addCommands({mceSelectNodeDepth:(t,n,o)=>{let r=0;e.dom.getParent(e.selection.getNode(),(t=>!Jo(t)||r++!==o||(e.selection.select(t),!1)),e.getBody())},mceSelectNode:(t,n,o)=>{e.selection.select(o)},selectAll:()=>{const t=e.dom.getParent(e.selection.getStart(),hr);if(t){const n=e.dom.createRng();n.selectNodeContents(t),e.selection.setRng(n)}}})})(e),(e=>{e.editorCommands.addCommands({mceCleanup:()=>{const t=e.selection.getBookmark();e.setContent(e.getContent()),e.selection.moveToBookmark(t)},insertImage:(t,n,o)=>{qO(e,e.dom.createHTML("img",{src:o}))},insertHorizontalRule:()=>{e.execCommand("mceInsertContent",!1,"<hr>")},insertText:(t,n,o)=>{qO(e,e.dom.encode(o))},insertHTML:(t,n,o)=>{qO(e,o)},mceInsertContent:(t,n,o)=>{qO(e,o)},mceSetContent:(t,n,o)=>{e.setContent(o)},mceReplaceContent:(t,n,o)=>{e.execCommand("mceInsertContent",!1,o.replace(/\{\$selection\}/g,e.selection.getContent({format:"text"})))},mceNewDocument:()=>{e.setContent(gc(e))}})})(e),(e=>{const t=(t,n,o)=>{if(e.mode.isReadOnly())return;const r=m(o)?{href:o}:o,s=e.dom.getParent(e.selection.getNode(),"a");f(r)&&m(r.href)&&(r.href=r.href.replace(/ /g,"%20"),s&&r.href||e.formatter.remove("link"),r.href&&e.formatter.apply("link",r,s))};e.editorCommands.addCommands({unlink:()=>{if(e.selection.isEditable()){if(e.selection.isCollapsed()){const t=e.dom.getParent(e.selection.getStart(),"a");return void(t&&e.dom.remove(t,!0))}e.formatter.remove("link")}},mceInsertLink:t,createLink:t})})(e),(e=>{e.editorCommands.addCommands({Indent:()=>{(e=>{ok(e,"indent")})(e)},Outdent:()=>{rk(e)}}),e.editorCommands.addCommands({Outdent:()=>ek(e)},"state")})(e),(e=>{e.editorCommands.addCommands({InsertNewBlockBefore:()=>{(e=>{tB(e,!0)})(e)},InsertNewBlockAfter:()=>{(e=>{tB(e,!1)})(e)}})})(e),(e=>{e.editorCommands.addCommands({insertParagraph:()=>{DR(mR,e)},mceInsertNewLine:(t,n,o)=>{LR(e,o)},InsertLineBreak:(t,n,o)=>{DR(CR,e)}})})(e),(e=>{(e=>{const t=(t,n)=>{e.formatter.toggle(t,n),e.nodeChanged()};e.editorCommands.addCommands({"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":e=>{t(e)},"ForeColor,HiliteColor":(e,n,o)=>{t(e,{value:o})},BackColor:(e,n,o)=>{t("hilitecolor",{value:o})},FontName:(t,n,o)=>{((e,t)=>{const n=JO(e,t);e.formatter.toggle("fontname",{value:eB(n)}),e.nodeChanged()})(e,o)},FontSize:(t,n,o)=>{((e,t)=>{e.formatter.toggle("fontsize",{value:JO(e,t)}),e.nodeChanged()})(e,o)},LineHeight:(t,n,o)=>{((e,t)=>{e.formatter.toggle("lineheight",{value:String(t)}),e.nodeChanged()})(e,o)},Lang:(e,n,o)=>{var r;t(e,{value:o.code,customValue:null!==(r=o.customCode)&&void 0!==r?r:null})},RemoveFormat:t=>{e.formatter.remove(t)},mceBlockQuote:()=>{t("blockquote")},FormatBlock:(e,n,o)=>{t(m(o)?o:"p")},mceToggleFormat:(e,n,o)=>{t(o)}})})(e),(e=>{const t=t=>e.formatter.match(t);e.editorCommands.addCommands({"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":e=>t(e),mceBlockQuote:()=>t("blockquote")},"state"),e.editorCommands.addQueryValueHandler("FontName",(()=>(e=>QO(e,(t=>XO(e.getBody(),t.dom))).getOr(""))(e))),e.editorCommands.addQueryValueHandler("FontSize",(()=>(e=>QO(e,(t=>GO(e.getBody(),t.dom))).getOr(""))(e))),e.editorCommands.addQueryValueHandler("LineHeight",(()=>(e=>QO(e,(t=>{const n=Cn(e.getBody()),o=Vb(t,(e=>mo(e,"line-height")),T(kn,n));return o.getOrThunk((()=>{const e=parseFloat(co(t,"line-height")),n=parseFloat(co(t,"font-size"));return String(e/n)}))})).getOr(""))(e)))})(e)})(e),(e=>{e.editorCommands.addCommands({mceRemoveNode:(t,n,o)=>{const r=null!=o?o:e.selection.getNode();if(r!==e.getBody()){const t=e.selection.getBookmark();e.dom.remove(r,!0),e.selection.moveToBookmark(t)}},mcePrint:()=>{e.getWin().print()},mceFocus:(t,n,o)=>{((e,t)=>{e.removed||(t?Zf(e):(e=>{const t=e.selection,n=e.getBody();let o=t.getRng();e.quirks.refreshContentEditable();const r=e=>{If(e).each((t=>{e.selection.setRng(t),o=t}))};!Gf(e)&&e.hasEditableRoot()&&r(e);const s=((e,t)=>e.dom.getParent(t,(t=>"true"===e.dom.getContentEditable(t))))(e,t.getNode());if(s&&e.dom.isChildOf(s,n))return((e,t)=>null!==e.dom.getParent(t,(t=>"false"===e.dom.getContentEditable(t))))(e,s)||Yf(n),Yf(s),e.hasEditableRoot()||r(e),Kf(e,o),void Zf(e);e.inline||(Tt.browser.isOpera()||Yf(n),e.getWin().focus()),(Tt.browser.isFirefox()||e.inline)&&(Yf(n),Kf(e,o)),Zf(e)})(e))})(e,!0===o)},mceToggleVisualAid:()=>{e.hasVisual=!e.hasVisual,e.addVisual()}})})(e)},oB=["toggleview"],rB=e=>H(oB,e.toLowerCase());class sB{constructor(e){this.commands={state:{},exec:{},value:{}},this.editor=e}execCommand(e,t=!1,n,o){const r=this.editor,s=e.toLowerCase(),a=null==o?void 0:o.skip_focus;if(r.removed)return!1;if("mcefocus"!==s&&(/^(mceAddUndoLevel|mceEndUndoLevel)$/i.test(s)||a?(e=>{If(e).each((t=>e.selection.setRng(t)))})(r):r.focus()),r.dispatch("BeforeExecCommand",{command:e,ui:t,value:n}).isDefaultPrevented())return!1;const i=this.commands.exec[s];return!!w(i)&&(i(s,t,n),r.dispatch("ExecCommand",{command:e,ui:t,value:n}),!0)}queryCommandState(e){if(!rB(e)&&this.editor.quirks.isHidden()||this.editor.removed)return!1;const t=e.toLowerCase(),n=this.commands.state[t];return!!w(n)&&n(t)}queryCommandValue(e){if(!rB(e)&&this.editor.quirks.isHidden()||this.editor.removed)return"";const t=e.toLowerCase(),n=this.commands.value[t];return w(n)?n(t):""}addCommands(e,t="exec"){const n=this.commands;pe(e,((e,o)=>{q(o.toLowerCase().split(","),(o=>{n[t][o]=e}))}))}addCommand(e,t,n){const o=e.toLowerCase();this.commands.exec[o]=(e,o,r)=>t.call(null!=n?n:this.editor,o,r)}queryCommandSupported(e){const t=e.toLowerCase();return!!this.commands.exec[t]}addQueryStateHandler(e,t,n){this.commands.state[e.toLowerCase()]=()=>t.call(null!=n?n:this.editor)}addQueryValueHandler(e,t,n){this.commands.value[e.toLowerCase()]=()=>t.call(null!=n?n:this.editor)}}const aB=Dt.makeMap("focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange mouseout mouseenter mouseleave wheel keydown keypress keyup input beforeinput contextmenu dragstart dragend dragover draggesture dragdrop drop drag submit compositionstart compositionend compositionupdate touchstart touchmove touchend touchcancel"," ");class iB{static isNative(e){return!!aB[e.toLowerCase()]}constructor(e){this.bindings={},this.settings=e||{},this.scope=this.settings.scope||this,this.toggleEvent=this.settings.toggleEvent||L}fire(e,t){return this.dispatch(e,t)}dispatch(e,t){const n=e.toLowerCase(),o=Gs(n,null!=t?t:{},this.scope);this.settings.beforeFire&&this.settings.beforeFire(o);const r=this.bindings[n];if(r)for(let e=0,t=r.length;e<t;e++){const t=r[e];if(!t.removed){if(t.once&&this.off(n,t.func),o.isImmediatePropagationStopped())return o;if(!1===t.func.call(this.scope,o))return o.preventDefault(),o}}return o}on(e,t,n,o){if(!1===t&&(t=L),t){const r={func:t,removed:!1};o&&Dt.extend(r,o);const s=e.toLowerCase().split(" ");let a=s.length;for(;a--;){const e=s[a];let t=this.bindings[e];t||(t=[],this.toggleEvent(e,!0)),t=n?[r,...t]:[...t,r],this.bindings[e]=t}}return this}off(e,t){if(e){const n=e.toLowerCase().split(" ");let o=n.length;for(;o--;){const r=n[o];let s=this.bindings[r];if(!r)return pe(this.bindings,((e,t)=>{this.toggleEvent(t,!1),delete this.bindings[t]})),this;if(s){if(t){const e=K(s,(e=>e.func===t));s=e.fail,this.bindings[r]=s,q(e.pass,(e=>{e.removed=!0}))}else s.length=0;s.length||(this.toggleEvent(e,!1),delete this.bindings[r])}}}else pe(this.bindings,((e,t)=>{this.toggleEvent(t,!1)})),this.bindings={};return this}once(e,t,n){return this.on(e,t,n,{once:!0})}has(e){e=e.toLowerCase();const t=this.bindings[e];return!(!t||0===t.length)}}const lB=e=>(e._eventDispatcher||(e._eventDispatcher=new iB({scope:e,toggleEvent:(t,n)=>{iB.isNative(t)&&e.toggleNativeEvent&&e.toggleNativeEvent(t,n)}})),e._eventDispatcher),dB={fire(e,t,n){return this.dispatch(e,t,n)},dispatch(e,t,n){const o=this;if(o.removed&&"remove"!==e&&"detach"!==e)return Gs(e.toLowerCase(),null!=t?t:{},o);const r=lB(o).dispatch(e,t);if(!1!==n&&o.parent){let t=o.parent();for(;t&&!r.isPropagationStopped();)t.dispatch(e,r,!1),t=t.parent?t.parent():void 0}return r},on(e,t,n){return lB(this).on(e,t,n)},off(e,t){return lB(this).off(e,t)},once(e,t){return lB(this).once(e,t)},hasEventListeners(e){return lB(this).has(e)}},cB=ua.DOM;let uB;const mB=(e,t)=>{if("selectionchange"===t)return e.getDoc();if(!e.inline&&/^(?:mouse|touch|click|contextmenu|drop|dragover|dragend)/.test(t))return e.getDoc().documentElement;const n=Ad(e);return n?(e.eventRoot||(e.eventRoot=cB.select(n)[0]),e.eventRoot):e.getBody()},fB=(e,t,n)=>{(e=>!e.hidden&&!sE(e))(e)?e.dispatch(t,n):sE(e)&&((e,t)=>{if((e=>"click"===e.type)(t)&&!Qf.metaKeyPressed(t)){const n=Cn(t.target);((e,t)=>to(t,"a",(t=>kn(t,Cn(e.getBody())))).bind((e=>nn(e,"href"))))(e,n).each((n=>{if(t.preventDefault(),/^#/.test(n)){const t=e.dom.select(`${n},[name="${je(n,"#")}"]`);t.length&&e.selection.scrollIntoView(t[0],!0)}else window.open(n,"_blank","rel=noopener noreferrer,menubar=yes,toolbar=yes,location=yes,status=yes,resizable=yes,scrollbars=yes")}))}else(e=>H(dE,e.type))(t)&&e.dispatch(t.type,t)})(e,n)},gB=(e,t)=>{if(e.delegates||(e.delegates={}),e.delegates[t]||e.removed)return;const n=mB(e,t);if(Ad(e)){if(uB||(uB={},e.editorManager.on("removeEditor",(()=>{e.editorManager.activeEditor||uB&&(pe(uB,((t,n)=>{e.dom.unbind(mB(e,n))})),uB=null)}))),uB[t])return;const o=n=>{const o=n.target,r=e.editorManager.get();let s=r.length;for(;s--;){const e=r[s].getBody();(e===o||cB.isChildOf(o,e))&&fB(r[s],t,n)}};uB[t]=o,cB.bind(n,t,o)}else{const o=n=>{fB(e,t,n)};cB.bind(n,t,o),e.delegates[t]=o}},pB={...dB,bindPendingEventDelegates(){const e=this;Dt.each(e._pendingNativeEvents,(t=>{gB(e,t)}))},toggleNativeEvent(e,t){const n=this;"focus"!==e&&"blur"!==e&&(n.removed||(t?n.initialized?gB(n,e):n._pendingNativeEvents?n._pendingNativeEvents.push(e):n._pendingNativeEvents=[e]:n.initialized&&n.delegates&&(n.dom.unbind(mB(n,e),e,n.delegates[e]),delete n.delegates[e])))},unbindAllNativeEvents(){const e=this,t=e.getBody(),n=e.dom;e.delegates&&(pe(e.delegates,((t,n)=>{e.dom.unbind(mB(e,n),n,t)})),delete e.delegates),!e.inline&&t&&n&&(t.onload=null,n.unbind(e.getWin()),n.unbind(e.getDoc())),n&&(n.unbind(t),n.unbind(e.getContainer()))}},hB=e=>m(e)?{value:e.split(/[ ,]/),valid:!0}:x(e,m)?{value:e,valid:!0}:{valid:!1,message:"The value must be a string[] or a comma/space separated string."},bB=(e,t)=>e+(Xe(t.message)?"":`. ${t.message}`),vB=e=>e.valid,yB=(e,t,n="")=>{const o=t(e);return b(o)?o?{value:e,valid:!0}:{valid:!1,message:n}:o},CB=e=>e.readonly,wB=["design","readonly"],EB=(e,t,n,o)=>{const r=n[t.get()],s=n[o];try{s.activate()}catch(e){return void console.error(`problem while activating editor mode ${o}:`,e)}r.deactivate(),r.editorReadOnly!==s.editorReadOnly&&((e,t)=>{const n=Cn(e.getBody());t?(e.readonly=!0,e.hasEditableRoot()&&(n.dom.contentEditable="true"),oE(e)):(e.readonly=!1,rE(e))})(e,s.editorReadOnly),t.set(o),((e,t)=>{e.dispatch("SwitchMode",{mode:t})})(e,o)},xB=e=>{const t=Or("design"),n=Or({design:{activate:_,deactivate:_,editorReadOnly:!1},readonly:{activate:_,deactivate:_,editorReadOnly:!0}});return(e=>{e.on("beforeinput paste cut dragend dragover draggesture dragdrop drop drag",(t=>{CB(e)&&t.preventDefault()})),e.on("BeforeExecCommand",(t=>{"Undo"!==t.command&&"Redo"!==t.command||!CB(e)||t.preventDefault()})),e.on("input",(t=>{if(!t.isComposing&&CB(e)){const t=e.undoManager.add();C(t)&&e.undoManager.undo()}})),e.on("compositionend",(()=>{if(CB(e)){const t=e.undoManager.add();C(t)&&e.undoManager.undo()}}))})(e),(e=>{(e=>{e.serializer?lE(e):e.on("PreInit",(()=>{lE(e)}))})(e),(e=>{e.on("ShowCaret ObjectSelected",(t=>{sE(e)&&t.preventDefault()})),e.on("DisabledStateChange",(t=>{t.isDefaultPrevented()||iE(e,t.state)}))})(e)})(e),{isReadOnly:()=>CB(e),set:o=>((e,t,n,o)=>{if(!(o===n.get()||e.initialized&&sE(e))){if(!_e(t,o))throw new Error(`Editor mode '${o}' is invalid`);e.initialized?EB(e,n,t,o):e.on("init",(()=>EB(e,n,t,o)))}})(e,n.get(),t,o),get:()=>t.get(),register:(e,t)=>{n.set(((e,t,n)=>{if(H(wB,t))throw new Error(`Cannot override default mode ${t}`);return{...e,[t]:{...n,deactivate:()=>{try{n.deactivate()}catch(e){console.error(`problem while deactivating editor mode ${t}:`,e)}}}}})(n.get(),e,t))}}},_B=Dt.each,kB=Dt.explode,SB={f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123},NB=Dt.makeMap("alt,ctrl,shift,meta,access"),RB=e=>{const t={},n=Tt.os.isMacOS()||Tt.os.isiOS();_B(kB(e.toLowerCase(),"+"),(e=>{(e=>e in NB)(e)?t[e]=!0:/^[0-9]{2,}$/.test(e)?t.keyCode=parseInt(e,10):(t.charCode=e.charCodeAt(0),t.keyCode=SB[e]||e.toUpperCase().charCodeAt(0))}));const o=[t.keyCode];let r;for(r in NB)t[r]?o.push(r):t[r]=!1;return t.id=o.join(","),t.access&&(t.alt=!0,n?t.ctrl=!0:t.shift=!0),t.meta&&(n?t.meta=!0:(t.ctrl=!0,t.meta=!1)),t};class AB{constructor(e){this.shortcuts={},this.pendingPatterns=[],this.editor=e;const t=this;e.on("keyup keypress keydown",(e=>{!t.hasModifier(e)&&!t.isFunctionKey(e)||e.isDefaultPrevented()||(_B(t.shortcuts,(n=>{t.matchShortcut(e,n)&&(t.pendingPatterns=n.subpatterns.slice(0),"keydown"===e.type&&t.executeShortcutAction(n))})),t.matchShortcut(e,t.pendingPatterns[0])&&(1===t.pendingPatterns.length&&"keydown"===e.type&&t.executeShortcutAction(t.pendingPatterns[0]),t.pendingPatterns.shift()))}))}add(e,t,n,o){const r=this,s=r.normalizeCommandFunc(n);return _B(kB(Dt.trim(e)),(e=>{const n=r.createShortcut(e,t,s,o);r.shortcuts[n.id]=n})),!0}remove(e){const t=this.createShortcut(e);return!!this.shortcuts[t.id]&&(delete this.shortcuts[t.id],!0)}normalizeCommandFunc(e){const t=this,n=e;return"string"==typeof n?()=>{t.editor.execCommand(n,!1,null)}:Dt.isArray(n)?()=>{t.editor.execCommand(n[0],n[1],n[2])}:n}createShortcut(e,t,n,o){const r=Dt.map(kB(e,">"),RB);return r[r.length-1]=Dt.extend(r[r.length-1],{func:n,scope:o||this.editor}),Dt.extend(r[0],{desc:this.editor.translate(t),subpatterns:r.slice(1)})}hasModifier(e){return e.altKey||e.ctrlKey||e.metaKey}isFunctionKey(e){return"keydown"===e.type&&e.keyCode>=112&&e.keyCode<=123}matchShortcut(e,t){return!!t&&t.ctrl===e.ctrlKey&&t.meta===e.metaKey&&t.alt===e.altKey&&t.shift===e.shiftKey&&!!(e.keyCode===t.keyCode||e.charCode&&e.charCode===t.charCode)&&(e.preventDefault(),!0)}executeShortcutAction(e){return e.func?e.func.call(e.scope):null}}const TB=()=>{const e=(()=>{const e={},t={},n={},o={},r={},s={},a={},i={},l={},d=(e,t)=>(n,o)=>{e[n.toLowerCase()]={...o,type:t}};return{addButton:d(e,"button"),addGroupToolbarButton:d(e,"grouptoolbarbutton"),addToggleButton:d(e,"togglebutton"),addMenuButton:d(e,"menubutton"),addSplitButton:d(e,"splitbutton"),addMenuItem:d(t,"menuitem"),addNestedMenuItem:d(t,"nestedmenuitem"),addToggleMenuItem:d(t,"togglemenuitem"),addAutocompleter:d(n,"autocompleter"),addContextMenu:d(r,"contextmenu"),addContextToolbar:d(s,"contexttoolbar"),addContextForm:(c=s,(e,t)=>{c[e.toLowerCase()]={type:"contextform",...t}}),addSidebar:d(i,"sidebar"),addView:d(l,"views"),addIcon:(e,t)=>o[e.toLowerCase()]=t,addContext:(e,t)=>a[e.toLowerCase()]=t,getAll:()=>({buttons:e,menuItems:t,icons:o,popups:n,contextMenus:r,contextToolbars:s,sidebars:i,views:l,contexts:a})};var c})();return{addAutocompleter:e.addAutocompleter,addButton:e.addButton,addContextForm:e.addContextForm,addContextMenu:e.addContextMenu,addContextToolbar:e.addContextToolbar,addIcon:e.addIcon,addMenuButton:e.addMenuButton,addMenuItem:e.addMenuItem,addNestedMenuItem:e.addNestedMenuItem,addSidebar:e.addSidebar,addSplitButton:e.addSplitButton,addToggleButton:e.addToggleButton,addGroupToolbarButton:e.addGroupToolbarButton,addToggleMenuItem:e.addToggleMenuItem,addView:e.addView,addContext:e.addContext,getAll:e.getAll}},OB=ua.DOM,BB=Dt.extend,PB=Dt.each;class DB{constructor(e,t,n){this.plugins={},this.contentCSS=[],this.contentStyles=[],this.loadedCSS={},this.isNotDirty=!1,this.composing=!1,this.destroyed=!1,this.hasHiddenInput=!1,this.iframeElement=null,this.initialized=!1,this.readonly=!1,this.removed=!1,this.startContent="",this._pendingNativeEvents=[],this._skinLoaded=!1,this._editableRoot=!0,this.editorManager=n,this.documentBaseUrl=n.documentBaseURL,BB(this,pB);const o=this;this.id=e,this.hidden=!1;const r=((e,t)=>{const n=RS(t);return HO(LO||MO,LO,n,e,n)})(n.defaultOptions,t);this.options=((e,t,n=t)=>{const o={},r={},s=(e,t,n)=>{const o=yB(t,n);return vB(o)?(r[e]=o.value,!0):(console.warn(bB(`Invalid value passed for the ${e} option`,o)),!1)},a=e=>_e(o,e);return{register:(e,n)=>{const a=(e=>m(e.processor))(n)?(e=>{const t=(()=>{switch(e){case"array":return p;case"boolean":return b;case"function":return w;case"number":return E;case"object":return f;case"string":return m;case"string[]":return hB;case"object[]":return e=>x(e,f);case"regexp":return e=>u(e,RegExp);default:return M}})();return n=>yB(n,t,`The value must be a ${e}.`)})(n.processor):n.processor,i=((e,t,n)=>{if(!v(t)){const o=yB(t,n);if(vB(o))return o.value;console.error(bB(`Invalid default value passed for the "${e}" option`,o))}})(e,n.default,a);o[e]={...n,default:i,processor:a},xe(r,e).orThunk((()=>xe(t,e))).each((t=>s(e,t,a)))},isRegistered:a,get:e=>xe(r,e).orThunk((()=>xe(o,e).map((e=>e.default)))).getOrUndefined(),set:(e,t)=>{if(a(e)){const n=o[e];return n.immutable?(console.error(`"${e}" is an immutable option and cannot be updated`),!1):s(e,t,n.processor)}return console.warn(`"${e}" is not a registered option. Ensure the option has been registered before setting a value.`),!1},unset:e=>{const t=a(e);return t&&delete r[e],t},isSet:e=>_e(r,e),debug:()=>{try{console.log(JSON.parse(JSON.stringify(n,((e,t)=>b(t)||E(t)||m(t)||h(t)||p(t)||g(t)?t:Object.prototype.toString.call(t)))))}catch(e){console.error(e)}}}})(0,r,t),(e=>{const t=e.options.register;t("id",{processor:"string",default:e.id}),t("selector",{processor:"string"}),t("target",{processor:"object"}),t("suffix",{processor:"string"}),t("cache_suffix",{processor:"string"}),t("base_url",{processor:"string"}),t("referrer_policy",{processor:"string",default:""}),t("language_load",{processor:"boolean",default:!0}),t("inline",{processor:"boolean",default:!1}),t("iframe_attrs",{processor:"object",default:{}}),t("doctype",{processor:"string",default:"<!DOCTYPE html>"}),t("document_base_url",{processor:"string",default:e.documentBaseUrl}),t("body_id",{processor:ql(e,"tinymce"),default:"tinymce"}),t("body_class",{processor:ql(e),default:""}),t("content_security_policy",{processor:"string",default:""}),t("br_in_pre",{processor:"boolean",default:!0}),t("forced_root_block",{processor:e=>{const t=m(e)&&Ge(e);return t?{value:e,valid:t}:{valid:!1,message:"Must be a non-empty string."}},default:"p"}),t("forced_root_block_attrs",{processor:"object",default:{}}),t("newline_behavior",{processor:e=>{const t=H(["block","linebreak","invert","default"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be one of: block, linebreak, invert or default."}},default:"default"}),t("br_newline_selector",{processor:"string",default:".mce-toc h2,figcaption,caption"}),t("no_newline_selector",{processor:"string",default:""}),t("keep_styles",{processor:"boolean",default:!0}),t("end_container_on_empty_block",{processor:e=>b(e)||m(e)?{valid:!0,value:e}:{valid:!1,message:"Must be boolean or a string"},default:"blockquote"}),t("font_size_style_values",{processor:"string",default:"xx-small,x-small,small,medium,large,x-large,xx-large"}),t("font_size_legacy_values",{processor:"string",default:"xx-small,small,medium,large,x-large,xx-large,300%"}),t("font_size_classes",{processor:"string",default:""}),t("automatic_uploads",{processor:"boolean",default:!0}),t("images_reuse_filename",{processor:"boolean",default:!1}),t("images_replace_blob_uris",{processor:"boolean",default:!0}),t("icons",{processor:"string",default:""}),t("icons_url",{processor:"string",default:""}),t("images_upload_url",{processor:"string",default:""}),t("images_upload_base_path",{processor:"string",default:""}),t("images_upload_credentials",{processor:"boolean",default:!1}),t("images_upload_handler",{processor:"function"}),t("language",{processor:"string",default:"en"}),t("language_url",{processor:"string",default:""}),t("entity_encoding",{processor:"string",default:"named"}),t("indent",{processor:"boolean",default:!0}),t("indent_before",{processor:"string",default:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,details,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist"}),t("indent_after",{processor:"string",default:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,details,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist"}),t("indent_use_margin",{processor:"boolean",default:!1}),t("indentation",{processor:"string",default:"40px"}),t("content_css",{processor:e=>{const t=!1===e||m(e)||x(e,m);return t?m(e)?{value:V(e.split(","),We),valid:t}:p(e)?{value:e,valid:t}:!1===e?{value:[],valid:t}:{value:e,valid:t}:{valid:!1,message:"Must be false, a string or an array of strings."}},default:jd(e)?[]:["default"]}),t("content_style",{processor:"string"}),t("content_css_cors",{processor:"boolean",default:!1}),t("font_css",{processor:e=>{const t=m(e)||x(e,m);return t?{value:p(e)?e:V(e.split(","),We),valid:t}:{valid:!1,message:"Must be a string or an array of strings."}},default:[]}),t("inline_boundaries",{processor:"boolean",default:!0}),t("inline_boundaries_selector",{processor:"string",default:"a[href],code,span.mce-annotation"}),t("object_resizing",{processor:e=>{const t=b(e)||m(e);return t?!1===e||Ul.isiPhone()||Ul.isiPad()?{value:"",valid:t}:{value:!0===e?"table,img,figure.image,div,video,iframe":e,valid:t}:{valid:!1,message:"Must be boolean or a string"}},default:!zl}),t("resize_img_proportional",{processor:"boolean",default:!0}),t("event_root",{processor:"string"}),t("service_message",{processor:"string"}),t("theme",{processor:e=>!1===e||m(e)||w(e),default:"silver"}),t("theme_url",{processor:"string"}),t("formats",{processor:"object"}),t("format_empty_lines",{processor:"boolean",default:!1}),t("format_noneditable_selector",{processor:"string",default:""}),t("preview_styles",{processor:e=>{const t=!1===e||m(e);return t?{value:!1===e?"":e,valid:t}:{valid:!1,message:"Must be false or a string"}},default:"font-family font-size font-weight font-style text-decoration text-transform color background-color border border-radius outline text-shadow"}),t("custom_ui_selector",{processor:"string",default:""}),t("hidden_input",{processor:"boolean",default:!0}),t("submit_patch",{processor:"boolean",default:!0}),t("encoding",{processor:"string"}),t("add_form_submit_trigger",{processor:"boolean",default:!0}),t("add_unload_trigger",{processor:"boolean",default:!0}),t("custom_undo_redo_levels",{processor:"number",default:0}),t("disable_nodechange",{processor:"boolean",default:!1}),t("disabled",{processor:t=>b(t)?(e.initialized&&zc(e)!==t&&Promise.resolve().then((()=>{((e,t)=>{e.dispatch("DisabledStateChange",{state:t})})(e,t)})),{valid:!0,value:t}):{valid:!1,message:"The value must be a boolean."},default:!1}),t("readonly",{processor:"boolean",default:!1}),t("editable_root",{processor:"boolean",default:!0}),t("plugins",{processor:"string[]",default:[]}),t("external_plugins",{processor:"object"}),t("forced_plugins",{processor:"string[]"}),t("model",{processor:"string",default:e.hasPlugin("rtc")?"plugin":"dom"}),t("model_url",{processor:"string"}),t("block_unsupported_drop",{processor:"boolean",default:!0}),t("visual",{processor:"boolean",default:!0}),t("visual_table_class",{processor:"string",default:"mce-item-table"}),t("visual_anchor_class",{processor:"string",default:"mce-item-anchor"}),t("iframe_aria_text",{processor:"string",default:"Rich Text Area. Press ALT-0 for help."}),t("setup",{processor:"function"}),t("init_instance_callback",{processor:"function"}),t("url_converter",{processor:"function",default:e.convertURL}),t("url_converter_scope",{processor:"object",default:e}),t("urlconverter_callback",{processor:"function"}),t("allow_conditional_comments",{processor:"boolean",default:!1}),t("allow_html_data_urls",{processor:"boolean",default:!1}),t("allow_svg_data_urls",{processor:"boolean"}),t("allow_html_in_named_anchor",{processor:"boolean",default:!1}),t("allow_script_urls",{processor:"boolean",default:!1}),t("allow_unsafe_link_target",{processor:"boolean",default:!1}),t("allow_mathml_annotation_encodings",{processor:e=>{const t=x(e,m);return t?{value:e,valid:t}:{valid:!1,message:"Must be an array of strings."}},default:[]}),t("convert_fonts_to_spans",{processor:"boolean",default:!0,deprecated:!0}),t("fix_list_elements",{processor:"boolean",default:!1}),t("preserve_cdata",{processor:"boolean",default:!1}),t("remove_trailing_brs",{processor:"boolean",default:!0}),t("pad_empty_with_br",{processor:"boolean",default:!1}),t("inline_styles",{processor:"boolean",default:!0,deprecated:!0}),t("element_format",{processor:"string",default:"html"}),t("entities",{processor:"string"}),t("schema",{processor:"string",default:"html5"}),t("convert_urls",{processor:"boolean",default:!0}),t("relative_urls",{processor:"boolean",default:!0}),t("remove_script_host",{processor:"boolean",default:!0}),t("custom_elements",{processor:Vl}),t("extended_valid_elements",{processor:"string"}),t("invalid_elements",{processor:"string"}),t("invalid_styles",{processor:Vl}),t("valid_children",{processor:"string"}),t("valid_classes",{processor:Vl}),t("valid_elements",{processor:"string"}),t("valid_styles",{processor:Vl}),t("verify_html",{processor:"boolean",default:!0}),t("auto_focus",{processor:e=>m(e)||!0===e}),t("browser_spellcheck",{processor:"boolean",default:!1}),t("protect",{processor:"array"}),t("images_file_types",{processor:"string",default:"jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp"}),t("deprecation_warnings",{processor:"boolean",default:!0}),t("a11y_advanced_options",{processor:"boolean",default:!1}),t("api_key",{processor:"string"}),t("license_key",{processor:"string"}),t("paste_block_drop",{processor:"boolean",default:!1}),t("paste_data_images",{processor:"boolean",default:!0}),t("paste_preprocess",{processor:"function"}),t("paste_postprocess",{processor:"function"}),t("paste_webkit_styles",{processor:"string",default:"none"}),t("paste_remove_styles_if_webkit",{processor:"boolean",default:!0}),t("paste_merge_formats",{processor:"boolean",default:!0}),t("smart_paste",{processor:"boolean",default:!0}),t("paste_as_text",{processor:"boolean",default:!1}),t("paste_tab_spaces",{processor:"number",default:4}),t("text_patterns",{processor:e=>x(e,f)||!1===e?{value:Ol(!1===e?[]:e),valid:!0}:{valid:!1,message:"Must be an array of objects or false."},default:[{start:"*",end:"*",format:"italic"},{start:"**",end:"**",format:"bold"},{start:"#",format:"h1",trigger:"space"},{start:"##",format:"h2",trigger:"space"},{start:"###",format:"h3",trigger:"space"},{start:"####",format:"h4",trigger:"space"},{start:"#####",format:"h5",trigger:"space"},{start:"######",format:"h6",trigger:"space"},{start:"1.",cmd:"InsertOrderedList",trigger:"space"},{start:"*",cmd:"InsertUnorderedList",trigger:"space"},{start:"-",cmd:"InsertUnorderedList",trigger:"space"},{start:">",cmd:"mceBlockQuote",trigger:"space"},{start:"---",cmd:"InsertHorizontalRule",trigger:"space"}]}),t("text_patterns_lookup",{processor:e=>{return w(e)?{value:(t=e,e=>{const n=t(e);return Ol(n)}),valid:!0}:{valid:!1,message:"Must be a single function"};var t},default:e=>[]}),t("noneditable_class",{processor:"string",default:"mceNonEditable"}),t("editable_class",{processor:"string",default:"mceEditable"}),t("noneditable_regexp",{processor:e=>x(e,Hl)?{value:e,valid:!0}:Hl(e)?{value:[e],valid:!0}:{valid:!1,message:"Must be a RegExp or an array of RegExp."},default:[]}),t("table_tab_navigation",{processor:"boolean",default:!0}),t("highlight_on_focus",{processor:"boolean",default:!0}),t("xss_sanitization",{processor:"boolean",default:!0}),t("details_initial_state",{processor:e=>{const t=H(["inherited","collapsed","expanded"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be one of: inherited, collapsed, or expanded."}},default:"inherited"}),t("details_serialized_state",{processor:e=>{const t=H(["inherited","collapsed","expanded"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be one of: inherited, collapsed, or expanded."}},default:"inherited"}),t("init_content_sync",{processor:"boolean",default:!1}),t("newdocument_content",{processor:"string",default:""}),t("sandbox_iframes",{processor:"boolean",default:!0}),t("sandbox_iframes_exclusions",{processor:"string[]",default:["youtube.com","youtu.be","vimeo.com","player.vimeo.com","dailymotion.com","embed.music.apple.com","open.spotify.com","giphy.com","dai.ly","codepen.io"]}),t("convert_unsafe_embeds",{processor:"boolean",default:!0}),e.on("ScriptsLoaded",(()=>{t("directionality",{processor:"string",default:ba.isRtl()?"rtl":void 0}),t("placeholder",{processor:"string",default:jl.getAttrib(e.getElement(),"placeholder")})}))})(o);const s=this.options.get;s("deprecation_warnings")&&((e,t)=>{((e,t)=>{const n=Tw(e),o=Pw(t),r=o.length>0,s=n.length>0,a="mobile"===t.theme;if(r||s||a){const e="\n- ",t=a?`\n\nThemes:${e}mobile`:"",i=r?`\n\nPlugins:${e}${o.join(e)}`:"",l=s?`\n\nOptions:${e}${n.join(e)}`:"";console.warn("The following deprecated features are currently enabled and have been removed in TinyMCE 7.0. These features will no longer work and should be removed from the TinyMCE configuration. See https://www.tiny.cloud/docs/tinymce/7/migration-from-6x/ for more information."+t+i+l)}})(e,t),((e,t)=>{const n=Ow(e),o=Dw(t),r=o.length>0,s=n.length>0;if(r||s){const e="\n- ",t=r?`\n\nPlugins:${e}${o.map(Lw).join(e)}`:"",a=s?`\n\nOptions:${e}${n.join(e)}`:"";console.warn("The following deprecated features are currently enabled but will be removed soon."+t+a)}})(e,t)})(t,r);const a=s("suffix");a&&(n.suffix=a),this.suffix=n.suffix;const i=s("base_url");i&&n._setBaseUrl(i),this.baseUri=n.baseURI;const l=hd(o);l&&(fa.ScriptLoader._setReferrerPolicy(l),ua.DOM.styleSheetLoader._setReferrerPolicy(l));const d=Xd(o);C(d)&&ua.DOM.styleSheetLoader._setContentCssCors(d),va.languageLoad=s("language_load"),va.baseURL=n.baseURL,this.setDirty(!1),this.documentBaseURI=new vC(Yl(o),{base_uri:this.baseUri}),this.baseURI=this.baseUri,this.inline=jd(o),this.hasVisual=ec(o),this.shortcuts=new AB(this),this.editorCommands=new sB(this),nB(this);const c=s("cache_suffix");c&&(Tt.cacheSuffix=c.replace(/^[\?\&]+/,"")),this.ui={registry:TB(),styleSheetLoader:void 0,show:_,hide:_,setEnabled:_,isEnabled:M},this.mode=xB(o),n.dispatch("SetupEditor",{editor:this});const y=rc(o);w(y)&&y.call(o,o)}render(){(e=>{const t=e.id;ba.setCode(bd(e));const n=()=>{TO.unbind(window,"ready",n),e.render()};if(!ta.Event.domLoaded)return void TO.bind(window,"ready",n);if(!e.getElement())return;const o=Cn(e.getElement()),r=sn(o);e.on("remove",(()=>{W(o.dom.attributes,(e=>rn(o,e.name))),en(o,r)})),e.ui.styleSheetLoader=((e,t)=>os.forElement(e,{contentCssCors:Xd(t),referrerPolicy:hd(t)}))(o,e),jd(e)?e.inline=!0:(e.orgVisibility=e.getElement().style.visibility,e.getElement().style.visibility="hidden");const s=e.getElement().form||TO.getParent(t,"form");s&&(e.formElement=s,Hd(e)&&!ir(e.getElement())&&(TO.insertAfter(TO.create("input",{type:"hidden",name:t}),t),e.hasHiddenInput=!0),e.formEventDelegate=t=>{e.dispatch(t.type,t)},TO.bind(s,"submit reset",e.formEventDelegate),e.on("reset",(()=>{e.resetContent()})),!$d(e)||s.submit.nodeType||s.submit.length||s._mceOldSubmit||(s._mceOldSubmit=s.submit,s.submit=()=>(e.editorManager.triggerSave(),e.setDirty(!1),s._mceOldSubmit(s)))),e.windowManager=Gw(e),e.notificationManager=Ww(e),(e=>"xml"===e.options.get("encoding"))(e)&&e.on("GetContent",(e=>{e.save&&(e.content=TO.encode(e.content))})),Vd(e)&&e.on("submit",(()=>{e.initialized&&e.save()})),qd(e)&&(e._beforeUnload=()=>{!e.initialized||e.destroyed||e.isHidden()||e.save({format:"raw",no_events:!0,set_dirty:!1})},e.editorManager.on("BeforeUnload",e._beforeUnload)),e.editorManager.add(e),PO(e,e.suffix)})(this)}focus(e){this.execCommand("mceFocus",!1,e)}hasFocus(){return Gf(this)}translate(e){return ba.translate(e)}getParam(e,t,n){const o=this.options;return o.isRegistered(e)||(C(n)?o.register(e,{processor:n,default:t}):o.register(e,{processor:M,default:t})),o.isSet(e)||v(t)?o.get(e):t}hasPlugin(e,t){return!(!H(Zd(this),e)||t&&void 0===Kw.get(e))}nodeChanged(e){this._nodeChangeDispatcher.nodeChanged(e)}addCommand(e,t,n){this.editorCommands.addCommand(e,t,n)}addQueryStateHandler(e,t,n){this.editorCommands.addQueryStateHandler(e,t,n)}addQueryValueHandler(e,t,n){this.editorCommands.addQueryValueHandler(e,t,n)}addShortcut(e,t,n,o){this.shortcuts.add(e,t,n,o)}execCommand(e,t,n,o){return this.editorCommands.execCommand(e,t,n,o)}queryCommandState(e){return this.editorCommands.queryCommandState(e)}queryCommandValue(e){return this.editorCommands.queryCommandValue(e)}queryCommandSupported(e){return this.editorCommands.queryCommandSupported(e)}show(){const e=this;e.hidden&&(e.hidden=!1,e.inline?e.getBody().contentEditable="true":(OB.show(e.getContainer()),OB.hide(e.id)),e.load(),e.dispatch("show"))}hide(){const e=this;e.hidden||(e.save(),e.inline?(e.getBody().contentEditable="false",e===e.editorManager.focusedEditor&&(e.editorManager.focusedEditor=null)):(OB.hide(e.getContainer()),OB.setStyle(e.id,"display",e.orgDisplay)),e.hidden=!0,e.dispatch("hide"))}isHidden(){return this.hidden}setProgressState(e,t){this.dispatch("ProgressState",{state:e,time:t})}load(e={}){const t=this,n=t.getElement();if(t.removed)return"";if(n){const o={...e,load:!0},r=ir(n)?n.value:n.innerHTML,s=t.setContent(r,o);return o.no_events||t.dispatch("LoadContent",{...o,element:n}),s}return""}save(e={}){const t=this;let n=t.getElement();if(!n||!t.initialized||t.removed)return"";const o={...e,save:!0,element:n};let r=t.getContent(o);const s={...o,content:r};if(s.no_events||t.dispatch("SaveContent",s),"raw"===s.format&&t.dispatch("RawSaveContent",s),r=s.content,ir(n))n.value=r;else{!e.is_removing&&t.inline||(n.innerHTML=r);const o=OB.getParent(t.id,"form");o&&PB(o.elements,(e=>e.name!==t.id||(e.value=r,!1)))}return s.element=o.element=n=null,!1!==s.set_dirty&&t.setDirty(!1),r}setContent(e,t){return _w(this,e,t)}getContent(e){return((e,t={})=>{const n=((e,t)=>({...e,format:t,get:!0,getInner:!0}))(t,t.format?t.format:"html");return LC(e,n).fold(R,(t=>{const n=((e,t)=>fw(e).editor.getContent(t))(e,t);return MC(e,n,t)}))})(this,e)}insertContent(e,t){t&&(e=BB({content:e},t)),this.execCommand("mceInsertContent",!1,e)}resetContent(e){void 0===e?_w(this,this.startContent,{format:"raw"}):_w(this,e),this.undoManager.reset(),this.setDirty(!1),this.nodeChanged()}isDirty(){return!this.isNotDirty}setDirty(e){const t=!this.isNotDirty;this.isNotDirty=!e,e&&e!==t&&this.dispatch("dirty")}getContainer(){const e=this;return e.container||(e.container=e.editorContainer||OB.get(e.id+"_parent")),e.container}getContentAreaContainer(){return this.contentAreaContainer}getElement(){return this.targetElm||(this.targetElm=OB.get(this.id)),this.targetElm}getWin(){const e=this;if(!e.contentWindow){const t=e.iframeElement;t&&(e.contentWindow=t.contentWindow)}return e.contentWindow}getDoc(){const e=this;if(!e.contentDocument){const t=e.getWin();t&&(e.contentDocument=t.document)}return e.contentDocument}getBody(){var e,t;const n=this.getDoc();return null!==(t=null!==(e=this.bodyElement)&&void 0!==e?e:null==n?void 0:n.body)&&void 0!==t?t:null}convertURL(e,t,n){const o=this,r=o.options.get,s=ac(o);if(w(s))return s.call(o,e,n,!0,t);if(!r("convert_urls")||"link"===n||f(n)&&"LINK"===n.nodeName||0===e.indexOf("file:")||0===e.length)return e;const a=new vC(e);return"http"!==a.protocol&&"https"!==a.protocol&&""!==a.protocol?e:r("relative_urls")?o.documentBaseURI.toRelative(e):e=o.documentBaseURI.toAbsolute(e,r("remove_script_host"))}addVisual(e){((e,t)=>{((e,t)=>{gw(e).editor.addVisual(t)})(e,t)})(this,e)}setEditableRoot(e){((e,t)=>{e._editableRoot!==t&&(e._editableRoot=t,sE(e)||(e.getBody().contentEditable=String(e.hasEditableRoot()),e.nodeChanged()),((e,t)=>{e.dispatch("EditableRootStateChange",{state:t})})(e,t))})(this,e)}hasEditableRoot(){return this._editableRoot}remove(){(e=>{if(!e.removed){const{_selectionOverrides:t,editorUpload:n}=e,o=e.getBody(),r=e.getElement();o&&e.save({is_removing:!0}),e.removed=!0,e.unbindAllNativeEvents(),e.hasHiddenInput&&C(null==r?void 0:r.nextSibling)&&Mw.remove(r.nextSibling),(e=>{e.dispatch("remove")})(e),e.editorManager.remove(e),!e.inline&&o&&(e=>{Mw.setStyle(e.id,"display",e.orgDisplay)})(e),(e=>{e.dispatch("detach")})(e),Mw.remove(e.getContainer()),Iw(t),Iw(n),e.destroy()}})(this)}destroy(e){((e,t)=>{const{selection:n,dom:o}=e;e.destroyed||(t||e.removed?(t||(e.editorManager.off("beforeunload",e._beforeUnload),e.theme&&e.theme.destroy&&e.theme.destroy(),Iw(n),Iw(o)),(e=>{const t=e.formElement;t&&(t._mceOldSubmit&&(t.submit=t._mceOldSubmit,delete t._mceOldSubmit),Mw.unbind(t,"submit reset",e.formEventDelegate))})(e),(e=>{const t=e;t.contentAreaContainer=t.formElement=t.container=t.editorContainer=null,t.bodyElement=t.contentDocument=t.contentWindow=null,t.iframeElement=t.targetElm=null;const n=e.selection;if(n){const e=n.dom;t.selection=n.win=n.dom=e.doc=null}})(e),e.destroyed=!0):e.remove())})(this,e)}uploadImages(){return this.editorUpload.uploadImages()}_scanForImages(){return this.editorUpload.scanForImages()}}const LB=ua.DOM,MB=Dt.each;let IB,FB=!1,UB=[];const zB=e=>{const t=e.type;MB(VB.get(),(n=>{switch(t){case"scroll":n.dispatch("ScrollWindow",e);break;case"resize":n.dispatch("ResizeWindow",e)}}))},jB=e=>{if(e!==FB){const t=ua.DOM;e?(t.bind(window,"resize",zB),t.bind(window,"scroll",zB)):(t.unbind(window,"resize",zB),t.unbind(window,"scroll",zB)),FB=e}},HB=e=>{const t=UB;return UB=Y(UB,(t=>e!==t)),VB.activeEditor===e&&(VB.activeEditor=UB.length>0?UB[0]:null),VB.focusedEditor===e&&(VB.focusedEditor=null),t.length!==UB.length},$B="CSS1Compat"!==document.compatMode,VB={...dB,baseURI:null,baseURL:null,defaultOptions:{},documentBaseURL:null,suffix:null,majorVersion:"7",minorVersion:"6.0",releaseDate:"2024-12-11",i18n:ba,activeEditor:null,focusedEditor:null,setup(){const e=this;let t="",n="",o=vC.getDocumentBaseUrl(document.location);/^[^:]+:\/\/\/?[^\/]+\//.test(o)&&(o=o.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(o)||(o+="/"));const r=window.tinymce||window.tinyMCEPreInit;if(r)t=r.base||r.baseURL,n=r.suffix;else{const e=document.getElementsByTagName("script");for(let o=0;o<e.length;o++){const r=e[o].src||"";if(""===r)continue;const s=r.substring(r.lastIndexOf("/"));if(/tinymce(\.full|\.jquery|)(\.min|\.dev|)\.js/.test(r)){-1!==s.indexOf(".min")&&(n=".min"),t=r.substring(0,r.lastIndexOf("/"));break}}if(!t&&document.currentScript){const e=document.currentScript.src;-1!==e.indexOf(".min")&&(n=".min"),t=e.substring(0,e.lastIndexOf("/"))}}var s;e.baseURL=new vC(o).toAbsolute(t),e.documentBaseURL=o,e.baseURI=new vC(e.baseURL),e.suffix=n,(s=e).on("AddEditor",T(qf,s)),s.on("RemoveEditor",T(Wf,s))},overrideDefaults(e){const t=e.base_url;t&&this._setBaseUrl(t);const n=e.suffix;n&&(this.suffix=n),this.defaultOptions=e;const o=e.plugin_base_urls;void 0!==o&&pe(o,((e,t)=>{va.PluginManager.urls[t]=e}))},init(e){const t=this;let n;const o=Dt.makeMap("area base basefont br col frame hr img input isindex link meta param embed source wbr track colgroup option table tbody tfoot thead tr th td script noscript style textarea video audio iframe object menu"," ");let r=e=>{n=e};const s=()=>{let n=0;const a=[];let i;LB.unbind(window,"ready",s),(n=>{const o=e.onpageload;o&&o.apply(t,[])})(),i=me((e=>Tt.browser.isIE()||Tt.browser.isEdge()?(eE("TinyMCE does not support the browser you are using. For a list of supported browsers please see: https://www.tiny.cloud/docs/tinymce/7/support/#supportedwebbrowsers"),[]):$B?(eE("Failed to initialize the editor as the document is not in standards mode. TinyMCE requires standards mode."),[]):m(e.selector)?LB.select(e.selector):C(e.target)?[e.target]:[])(e)),Dt.each(i,(e=>{var n;(n=t.get(e.id))&&n.initialized&&!(n.getContainer()||n.getBody()).parentNode&&(HB(n),n.unbindAllNativeEvents(),n.destroy(!0),n.removed=!0)})),i=Dt.grep(i,(e=>!t.get(e.id))),0===i.length?r([]):MB(i,(s=>{((e,t)=>e.inline&&t.tagName.toLowerCase()in o)(e,s)?eE("Could not initialize inline editor on invalid inline target element",s):((e,o,s)=>{const l=new DB(e,o,t);a.push(l),l.on("init",(()=>{++n===i.length&&r(a)})),l.targetElm=l.targetElm||s,l.render()})((e=>{let t=e.id;return t||(t=xe(e,"name").filter((e=>!LB.get(e))).getOrThunk(LB.uniqueId),e.setAttribute("id",t)),t})(s),e,s)}))};return LB.bind(window,"ready",s),new Promise((e=>{n?e(n):r=t=>{e(t)}}))},get(e){return 0===arguments.length?UB.slice(0):m(e)?Q(UB,(t=>t.id===e)).getOr(null):E(e)&&UB[e]?UB[e]:null},add(e){const t=this,n=t.get(e.id);return n===e||(null===n&&UB.push(e),jB(!0),t.activeEditor=e,t.dispatch("AddEditor",{editor:e}),IB||(IB=e=>{const n=t.dispatch("BeforeUnload");if(n.returnValue)return e.preventDefault(),e.returnValue=n.returnValue,n.returnValue},window.addEventListener("beforeunload",IB))),e},createEditor(e,t){return this.add(new DB(e,t,this))},remove(e){const t=this;let n;if(e){if(!m(e))return n=e,h(t.get(n.id))?null:(HB(n)&&t.dispatch("RemoveEditor",{editor:n}),0===UB.length&&window.removeEventListener("beforeunload",IB),n.remove(),jB(UB.length>0),n);MB(LB.select(e),(e=>{n=t.get(e.id),n&&t.remove(n)}))}else for(let e=UB.length-1;e>=0;e--)t.remove(UB[e])},execCommand(e,t,n){var o;const r=this,s=f(n)?null!==(o=n.id)&&void 0!==o?o:n.index:n;switch(e){case"mceAddEditor":if(!r.get(s)){const e=n.options;new DB(s,e,r).render()}return!0;case"mceRemoveEditor":{const e=r.get(s);return e&&e.remove(),!0}case"mceToggleEditor":{const e=r.get(s);return e?(e.isHidden()?e.show():e.hide(),!0):(r.execCommand("mceAddEditor",!1,n),!0)}}return!!r.activeEditor&&r.activeEditor.execCommand(e,t,n)},triggerSave:()=>{MB(UB,(e=>{e.save()}))},addI18n:(e,t)=>{ba.add(e,t)},translate:e=>ba.translate(e),setActive(e){const t=this.activeEditor;this.activeEditor!==e&&(t&&t.dispatch("deactivate",{relatedTarget:e}),e.dispatch("activate",{relatedTarget:t})),this.activeEditor=e},_setBaseUrl(e){this.baseURL=new vC(this.documentBaseURL).toAbsolute(e.replace(/\/+$/,"")),this.baseURI=new vC(this.baseURL)}};VB.setup();const qB=(()=>{const e=Pr();return{FakeClipboardItem:e=>({items:e,types:fe(e),getType:t=>xe(e,t).getOrUndefined()}),write:t=>{e.set(t)},read:()=>e.get().getOrUndefined(),clear:e.clear}})(),WB=Math.min,KB=Math.max,YB=Math.round,GB=(e,t,n)=>{let o=t.x,r=t.y;const s=e.w,a=e.h,i=t.w,l=t.h,d=(n||"").split("");return"b"===d[0]&&(r+=l),"r"===d[1]&&(o+=i),"c"===d[0]&&(r+=YB(l/2)),"c"===d[1]&&(o+=YB(i/2)),"b"===d[3]&&(r-=a),"r"===d[4]&&(o-=s),"c"===d[3]&&(r-=YB(a/2)),"c"===d[4]&&(o-=YB(s/2)),XB(o,r,s,a)},XB=(e,t,n,o)=>({x:e,y:t,w:n,h:o}),ZB={inflate:(e,t,n)=>XB(e.x-t,e.y-n,e.w+2*t,e.h+2*n),relativePosition:GB,findBestRelativePosition:(e,t,n,o)=>{for(let r=0;r<o.length;r++){const s=GB(e,t,o[r]);if(s.x>=n.x&&s.x+s.w<=n.w+n.x&&s.y>=n.y&&s.y+s.h<=n.h+n.y)return o[r]}return null},intersect:(e,t)=>{const n=KB(e.x,t.x),o=KB(e.y,t.y),r=WB(e.x+e.w,t.x+t.w),s=WB(e.y+e.h,t.y+t.h);return r-n<0||s-o<0?null:XB(n,o,r-n,s-o)},clamp:(e,t,n)=>{let o=e.x,r=e.y,s=e.x+e.w,a=e.y+e.h;const i=t.x+t.w,l=t.y+t.h,d=KB(0,t.x-o),c=KB(0,t.y-r),u=KB(0,s-i),m=KB(0,a-l);return o+=d,r+=c,n&&(s+=d,a+=c,o-=u,r-=m),s-=u,a-=m,XB(o,r,s-o,a-r)},create:XB,fromClientRect:e=>XB(e.left,e.top,e.width,e.height)},QB=(()=>{const e={},t={},n={};return{load:(n,o)=>{const r=`Script at URL "${o}" failed to load`,s=`Script at URL "${o}" did not call \`tinymce.Resource.add('${n}', data)\` within 1 second`;if(void 0!==e[n])return e[n];{const a=new Promise(((e,a)=>{const i=((e,t,n=1e3)=>{let o=!1,r=null;const s=e=>(...t)=>{o||(o=!0,null!==r&&(clearTimeout(r),r=null),e.apply(null,t))},a=s(e),i=s(t);return{start:(...e)=>{o||null!==r||(r=setTimeout((()=>i.apply(null,e)),n))},resolve:a,reject:i}})(e,a);t[n]=i.resolve,fa.ScriptLoader.loadScript(o).then((()=>i.start(s)),(()=>i.reject(r)))}));return e[n]=a,a}},add:(o,r)=>{void 0!==t[o]&&(t[o](r),delete t[o]),e[o]=Promise.resolve(r),n[o]=r},has:e=>e in n,get:e=>n[e],unload:t=>{delete e[t],delete n[t]}}})();let JB;try{const e="__storage_test__";JB=window.localStorage,JB.setItem(e,e),JB.removeItem(e)}catch(e){JB=(()=>{let e={},t=[];const n={getItem:t=>e[t]||null,setItem:(n,o)=>{t.push(n),e[n]=String(o)},key:e=>t[e],removeItem:n=>{t=t.filter((e=>e===n)),delete e[n]},clear:()=>{t=[],e={}},length:0};return Object.defineProperty(n,"length",{get:()=>t.length,configurable:!1,enumerable:!1}),n})()}const eP={geom:{Rect:ZB},util:{Delay:Uf,Tools:Dt,VK:Qf,URI:vC,EventDispatcher:iB,Observable:dB,I18n:ba,LocalStorage:JB,ImageUploader:e=>{const t=fE(),n=bE(e,t);return{upload:(t,o=!0)=>n.upload(t,o?hE(e):void 0)}}},dom:{EventUtils:ta,TreeWalker:$o,TextSeeker:Ua,DOMUtils:ua,ScriptLoader:fa,RangeUtils:kg,Serializer:xw,StyleSheetLoader:ns,ControlSelection:og,BookmarkManager:yf,Selection:Cw,Event:ta.Event},html:{Styles:Ws,Entities:Cs,Node:tp,Schema:Is,DomParser:BC,Writer:yp,Serializer:Cp},Env:Tt,AddOnManager:va,Annotator:vf,Formatter:AE,UndoManager:OE,EditorCommands:sB,WindowManager:Gw,NotificationManager:Ww,EditorObservable:pB,Shortcuts:AB,Editor:DB,FocusManager:Ff,EditorManager:VB,DOM:ua.DOM,ScriptLoader:fa.ScriptLoader,PluginManager:Kw,ThemeManager:Yw,ModelManager:Uw,IconManager:Fw,Resource:QB,FakeClipboard:qB,trim:Dt.trim,isArray:Dt.isArray,is:Dt.is,toArray:Dt.toArray,makeMap:Dt.makeMap,each:Dt.each,map:Dt.map,grep:Dt.grep,inArray:Dt.inArray,extend:Dt.extend,walk:Dt.walk,resolve:Dt.resolve,explode:Dt.explode,_addCacheSuffix:Dt._addCacheSuffix},tP=Dt.extend(VB,eP);(e=>{window.tinymce=e,window.tinyMCE=e})(tP),(e=>{if("object"==typeof module)try{module.exports=e}catch(e){}})(tP)}();