tinymce-rails 6.1.2 → 6.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/source/tinymce/tinymce.js +2988 -2392
  3. data/lib/tinymce/rails/version.rb +2 -2
  4. data/vendor/assets/javascripts/tinymce/icons/default/icons.js +1 -1
  5. data/vendor/assets/javascripts/tinymce/models/dom/model.js +2 -2
  6. data/vendor/assets/javascripts/tinymce/plugins/advlist/plugin.js +2 -2
  7. data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.js +2 -2
  8. data/vendor/assets/javascripts/tinymce/plugins/autolink/plugin.js +2 -2
  9. data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.js +2 -2
  10. data/vendor/assets/javascripts/tinymce/plugins/autosave/plugin.js +2 -2
  11. data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.js +2 -2
  12. data/vendor/assets/javascripts/tinymce/plugins/code/plugin.js +1 -1
  13. data/vendor/assets/javascripts/tinymce/plugins/codesample/plugin.js +2 -2
  14. data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.js +1 -1
  15. data/vendor/assets/javascripts/tinymce/plugins/emoticons/plugin.js +2 -2
  16. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.js +2 -2
  17. data/vendor/assets/javascripts/tinymce/plugins/help/plugin.js +2 -2
  18. data/vendor/assets/javascripts/tinymce/plugins/image/plugin.js +2 -2
  19. data/vendor/assets/javascripts/tinymce/plugins/importcss/plugin.js +2 -2
  20. data/vendor/assets/javascripts/tinymce/plugins/insertdatetime/plugin.js +2 -2
  21. data/vendor/assets/javascripts/tinymce/plugins/link/plugin.js +2 -2
  22. data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +2 -2
  23. data/vendor/assets/javascripts/tinymce/plugins/media/plugin.js +2 -2
  24. data/vendor/assets/javascripts/tinymce/plugins/nonbreaking/plugin.js +1 -1
  25. data/vendor/assets/javascripts/tinymce/plugins/pagebreak/plugin.js +2 -2
  26. data/vendor/assets/javascripts/tinymce/plugins/preview/plugin.js +1 -1
  27. data/vendor/assets/javascripts/tinymce/plugins/quickbars/plugin.js +2 -2
  28. data/vendor/assets/javascripts/tinymce/plugins/save/plugin.js +1 -1
  29. data/vendor/assets/javascripts/tinymce/plugins/searchreplace/plugin.js +2 -2
  30. data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +2 -2
  31. data/vendor/assets/javascripts/tinymce/plugins/template/plugin.js +2 -2
  32. data/vendor/assets/javascripts/tinymce/plugins/visualblocks/plugin.js +1 -1
  33. data/vendor/assets/javascripts/tinymce/plugins/visualchars/plugin.js +2 -2
  34. data/vendor/assets/javascripts/tinymce/plugins/wordcount/plugin.js +2 -2
  35. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.css +1 -1
  36. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.css +1 -1
  37. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.min.css +1 -1
  38. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.min.css +1 -1
  39. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.css +1 -1
  40. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.min.css +1 -1
  41. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.css +1 -1
  42. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.inline.css +1 -1
  43. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -1
  44. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.min.css +1 -1
  45. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.css +1 -1
  46. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
  47. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.css +1 -1
  48. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.inline.css +1 -1
  49. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -1
  50. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.min.css +1 -1
  51. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.css +1 -1
  52. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.min.css +1 -1
  53. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.css +1 -1
  54. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.inline.css +1 -1
  55. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -1
  56. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -1
  57. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.css +1 -1
  58. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -1
  59. data/vendor/assets/javascripts/tinymce/themes/silver/theme.js +2 -2
  60. data/vendor/assets/javascripts/tinymce/tinymce.d.ts +345 -169
  61. data/vendor/assets/javascripts/tinymce/tinymce.js +2 -2
  62. metadata +2 -2
@@ -1,4 +1,4 @@
1
1
  /**
2
- * TinyMCE version 6.1.2 (2022-07-29)
2
+ * TinyMCE version 6.2.0 (2022-09-08)
3
3
  */
4
- !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(r=a=e,(o=String).prototype.isPrototypeOf(r)||(null===(s=a.constructor)||void 0===s?void 0:s.name)===o.name)?"string":t;var r,a,o,s})(t)===e,r=t("string"),a=t("object"),o=t("array"),s=e=>!(e=>null==e)(e);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 s(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 c=Array.prototype.push,n=(e,t)=>{for(let r=0,a=e.length;r<a;r++)t(e[r],r)},l=e=>{const t=[];for(let r=0,a=e.length;r<a;++r){if(!o(e[r]))throw new Error("Arr.flatten item "+r+" was not an array, input: "+e);c.apply(t,e[r])}return t},m=Object.keys,u=Object.hasOwnProperty,d=(e,t)=>h(e,t)?i.from(e[t]):i.none(),h=(e,t)=>u.call(e,t),p=e=>t=>t.options.get(e),g=p("audio_template_callback"),b=p("video_template_callback"),w=p("iframe_template_callback"),y=p("media_live_embeds"),f=p("media_filter_html"),v=p("media_url_resolver"),x=p("media_alt_source"),_=p("media_poster"),j=p("media_dimensions");var k=tinymce.util.Tools.resolve("tinymce.util.Tools"),O=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),A=tinymce.util.Tools.resolve("tinymce.html.DomParser");const S=O.DOM,D=e=>e.replace(/px$/,""),T=e=>{const t=e.attr("style"),r=t?S.parseStyle(t):{};return{type:"ephox-embed-iri",source:e.attr("data-ephox-embed-iri"),altsource:"",poster:"",width:d(r,"max-width").map(D).getOr(""),height:d(r,"max-height").map(D).getOr("")}},C=(e,t)=>{let r={};for(let a=A({validate:!1,forced_root_block:!1},t).parse(e);a;a=a.walk())if(1===a.type){const e=a.name;if(a.attr("data-ephox-embed-iri")){r=T(a);break}r.source||"param"!==e||(r.source=a.attr("movie")),"iframe"!==e&&"object"!==e&&"embed"!==e&&"video"!==e&&"audio"!==e||(r.type||(r.type=e),r=k.extend(a.attributes.map,r)),"script"===e&&(r={type:"script",source:a.attr("src")}),"source"===e&&(r.source?r.altsource||(r.altsource=a.attr("src")):r.source=a.attr("src")),"img"!==e||r.poster||(r.poster=a.attr("src"))}return r.source=r.source||r.src||r.data,r.altsource=r.altsource||"",r.poster=r.poster||"",r},$=e=>({mp3:"audio/mpeg",m4a:"audio/x-m4a",wav:"audio/wav",mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",swf:"application/x-shockwave-flash"}[e.toLowerCase().split(".").pop()]||"");var z=tinymce.util.Tools.resolve("tinymce.html.Node"),M=tinymce.util.Tools.resolve("tinymce.html.Serializer");const F=(e,t={})=>A({forced_root_block:!1,validate:!1,allow_conditional_comments:!0,...t},e),N=O.DOM,R=e=>/^[0-9.]+$/.test(e)?e+"px":e,U=(e,t)=>{const r=t.attr("style"),a=r?N.parseStyle(r):{};a["max-width"]=R(e.width),a["max-height"]=R(e.height),t.attr("style",N.serializeStyle(a))},P=["source","altsource"],E=(e,t,r,a)=>{let o=0,s=0;const i=F(a);i.addNodeFilter("source",(e=>o=e.length));const c=i.parse(e);for(let e=c;e;e=e.walk())if(1===e.type){const a=e.name;if(e.attr("data-ephox-embed-iri")){U(t,e);break}switch(a){case"video":case"object":case"embed":case"img":case"iframe":void 0!==t.height&&void 0!==t.width&&(e.attr("width",t.width),e.attr("height",t.height))}if(r)switch(a){case"video":e.attr("poster",t.poster),e.attr("src",null);for(let r=o;r<2;r++)if(t[P[r]]){const a=new z("source",1);a.attr("src",t[P[r]]),a.attr("type",t[P[r]+"mime"]||null),e.append(a)}break;case"iframe":e.attr("src",t.source);break;case"object":const r=e.getAll("img").length>0;if(t.poster&&!r){e.attr("src",t.poster);const r=new z("img",1);r.attr("src",t.poster),r.attr("width",t.width),r.attr("height",t.height),e.append(r)}break;case"source":if(s<2&&(e.attr("src",t[P[s]]),e.attr("type",t[P[s]+"mime"]||null),!t[P[s]])){e.remove();continue}s++;break;case"img":t.poster||e.remove()}}return M({},a).serialize(c)},L=[{regex:/youtu\.be\/([\w\-_\?&=.]+)/i,type:"iframe",w:560,h:314,url:"www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/youtube\.com(.+)v=([^&]+)(&([a-z0-9&=\-_]+))?/i,type:"iframe",w:560,h:314,url:"www.youtube.com/embed/$2?$4",allowFullscreen:!0},{regex:/youtube.com\/embed\/([a-z0-9\?&=\-_]+)/i,type:"iframe",w:560,h:314,url:"www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/vimeo\.com\/([0-9]+)/,type:"iframe",w:425,h:350,url:"player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc",allowFullscreen:!0},{regex:/vimeo\.com\/(.*)\/([0-9]+)/,type:"iframe",w:425,h:350,url:"player.vimeo.com/video/$2?title=0&amp;byline=0",allowFullscreen:!0},{regex:/maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/,type:"iframe",w:425,h:350,url:'maps.google.com/maps/ms?msid=$2&output=embed"',allowFullscreen:!1},{regex:/dailymotion\.com\/video\/([^_]+)/,type:"iframe",w:480,h:270,url:"www.dailymotion.com/embed/video/$1",allowFullscreen:!0},{regex:/dai\.ly\/([^_]+)/,type:"iframe",w:480,h:270,url:"www.dailymotion.com/embed/video/$1",allowFullscreen:!0}],I=(e,t)=>{const r=(e=>{const t=e.match(/^(https?:\/\/|www\.)(.+)$/i);return t&&t.length>1?"www."===t[1]?"https://":t[1]:"https://"})(t),a=e.regex.exec(t);let o=r+e.url;for(let e=0;e<a.length;e++)o=o.replace("$"+e,(()=>a[e]?a[e]:""));return o.replace(/\?$/,"")},B=(e,t)=>{const r=k.extend({},t);if(!r.source&&(k.extend(r,C(r.embed,e.schema)),!r.source))return"";r.altsource||(r.altsource=""),r.poster||(r.poster=""),r.source=e.convertURL(r.source,"source"),r.altsource=e.convertURL(r.altsource,"source"),r.sourcemime=$(r.source),r.altsourcemime=$(r.altsource),r.poster=e.convertURL(r.poster,"poster");const a=(e=>{const t=L.filter((t=>t.regex.test(e)));return t.length>0?k.extend({},t[0],{url:I(t[0],e)}):null})(r.source);if(a&&(r.source=a.url,r.type=a.type,r.allowfullscreen=a.allowFullscreen,r.width=r.width||String(a.w),r.height=r.height||String(a.h)),r.embed)return E(r.embed,r,!0,e.schema);{const t=g(e),a=b(e),o=w(e);return r.width=r.width||"300",r.height=r.height||"150",k.each(r,((t,a)=>{r[a]=e.dom.encode(""+t)})),"iframe"===r.type?((e,t)=>{if(t)return t(e);{const t=e.allowfullscreen?' allowFullscreen="1"':"";return'<iframe src="'+e.source+'" width="'+e.width+'" height="'+e.height+'"'+t+"></iframe>"}})(r,o):"application/x-shockwave-flash"===r.sourcemime?(e=>{let t='<object data="'+e.source+'" width="'+e.width+'" height="'+e.height+'" type="application/x-shockwave-flash">';return e.poster&&(t+='<img src="'+e.poster+'" width="'+e.width+'" height="'+e.height+'" />'),t+="</object>",t})(r):-1!==r.sourcemime.indexOf("audio")?((e,t)=>t?t(e):'<audio controls="controls" src="'+e.source+'">'+(e.altsource?'\n<source src="'+e.altsource+'"'+(e.altsourcemime?' type="'+e.altsourcemime+'"':"")+" />\n":"")+"</audio>")(r,t):"script"===r.type?(e=>'<script src="'+e.source+'"><\/script>')(r):((e,t)=>t?t(e):'<video width="'+e.width+'" height="'+e.height+'"'+(e.poster?' poster="'+e.poster+'"':"")+' controls="controls">\n<source src="'+e.source+'"'+(e.sourcemime?' type="'+e.sourcemime+'"':"")+" />\n"+(e.altsource?'<source src="'+e.altsource+'"'+(e.altsourcemime?' type="'+e.altsourcemime+'"':"")+" />\n":"")+"</video>")(r,a)}},G=e=>e.hasAttribute("data-mce-object")||e.hasAttribute("data-ephox-embed-iri"),W={},q=e=>t=>B(e,t),H=(e,t)=>{const r=v(e);return r?((e,t,r)=>new Promise(((a,o)=>{const s=r=>(r.html&&(W[e.source]=r),a({url:e.source,html:r.html?r.html:t(e)}));W[e.source]?s(W[e.source]):r({url:e.source},s,o)})))(t,q(e),r):((e,t)=>Promise.resolve({html:t(e),url:e.source}))(t,q(e))},J=(e,t)=>{const r={};return d(e,"dimensions").each((e=>{n(["width","height"],(a=>{d(t,a).orThunk((()=>d(e,a))).each((e=>r[a]=e))}))})),r},K=(e,t)=>{const r=t?((e,t)=>d(t,e).bind((e=>d(e,"meta"))))(t,e).getOr({}):{},o=((e,t,r)=>o=>{const s=()=>d(e,o),c=()=>d(t,o),n=e=>d(e,"value").bind((e=>e.length>0?i.some(e):i.none()));return{[o]:(o===r?s().bind((e=>a(e)?n(e).orThunk(c):c().orThunk((()=>i.from(e))))):c().orThunk((()=>s().bind((e=>a(e)?n(e):i.from(e)))))).getOr("")}})(e,r,t);return{...o("source"),...o("altsource"),...o("poster"),...o("embed"),...J(e,r)}},Q=e=>{const t={...e,source:{value:d(e,"source").getOr("")},altsource:{value:d(e,"altsource").getOr("")},poster:{value:d(e,"poster").getOr("")}};return n(["width","height"],(r=>{d(e,r).each((e=>{const a=t.dimensions||{};a[r]=e,t.dimensions=a}))})),t},V=e=>t=>{const r=t&&t.msg?"Media embed handler error: "+t.msg:"Media embed handler threw unknown error.";e.notificationManager.open({type:"error",text:r})},X=(e,t)=>a=>{if(r(a.url)&&a.url.trim().length>0){const r=a.html,o={...C(r,t.schema),source:a.url,embed:r};e.setData(Q(o))}},Y=(e,t)=>{const r=e.dom.select("*[data-mce-object]");e.insertContent(t),((e,t)=>{const r=e.dom.select("*[data-mce-object]");for(let e=0;e<t.length;e++)for(let a=r.length-1;a>=0;a--)t[e]===r[a]&&r.splice(a,1);e.selection.select(r[0])})(e,r),e.nodeChanged()},Z=e=>{const t=(e=>{const t=e.selection.getNode(),r=G(t)?e.serializer.serialize(t,{selection:!0}):"";return{embed:r,...C(r,e.schema)}})(e),r=(e=>{let t=e;return{get:()=>t,set:e=>{t=e}}})(t),a=Q(t),o=j(e)?[{type:"sizeinput",name:"dimensions",label:"Constrain proportions",constrain:!0}]:[],s={title:"General",name:"general",items:l([[{name:"source",type:"urlinput",filetype:"media",label:"Source"}],o])},i=[];x(e)&&i.push({name:"altsource",type:"urlinput",filetype:"media",label:"Alternative source URL"}),_(e)&&i.push({name:"poster",type:"urlinput",filetype:"image",label:"Media poster (Image URL)"});const c={title:"Advanced",name:"advanced",items:i},n=[s,{title:"Embed",items:[{type:"textarea",name:"embed",label:"Paste your embed code below:"}]}];i.length>0&&n.push(c);const m={type:"tabpanel",tabs:n},u=e.windowManager.open({title:"Insert/Edit Media",size:"normal",body:m,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],onSubmit:t=>{const a=K(t.getData());((e,t,r)=>{var a;t.embed=E(t.embed,t,!1,r.schema),t.embed&&(e.source===t.source||(a=t.source,h(W,a)))?Y(r,t.embed):H(r,t).then((e=>{Y(r,e.html)})).catch(V(r))})(r.get(),a,e),t.close()},onChange:(t,a)=>{switch(a.name){case"source":((t,r)=>{const a=K(r.getData(),"source");t.source!==a.source&&(X(u,e)({url:a.source,html:""}),H(e,a).then(X(u,e)).catch(V(e)))})(r.get(),t);break;case"embed":(t=>{const r=K(t.getData()),a=C(r.embed,e.schema);t.setData(Q(a))})(t);break;case"dimensions":case"altsource":case"poster":((t,r)=>{const a=K(t.getData(),r),o=B(e,a);t.setData(Q({...a,embed:o}))})(t,a.name)}r.set(K(t.getData()))},initialData:a})};var ee=tinymce.util.Tools.resolve("tinymce.Env");const te=e=>{const t=e.name;return"iframe"===t||"video"===t||"audio"===t},re=(e,t,r,a=null)=>{const o=e.attr(r);return s(o)?o:h(t,r)?null:a},ae=(e,t,r)=>{const a="img"===t.name||"video"===e.name,o=a?"300":null,s="audio"===e.name?"30":"150",i=a?s:null;t.attr({width:re(e,r,"width",o),height:re(e,r,"height",i)})},oe=(e,t)=>{const r=t.name,a=new z("img",1);return ie(e,t,a),ae(t,a,{}),a.attr({style:t.attr("style"),src:ee.transparentSrc,"data-mce-object":r,class:"mce-object mce-object-"+r}),a},se=(e,t)=>{const r=t.name,a=new z("span",1);a.attr({contentEditable:"false",style:t.attr("style"),"data-mce-object":r,class:"mce-preview-object mce-object-"+r}),ie(e,t,a);const o=e.dom.parseStyle(t.attr("style")),i=new z(r,1);if(ae(t,i,o),i.attr({src:t.attr("src"),style:t.attr("style"),class:t.attr("class")}),"iframe"===r)i.attr({allowfullscreen:t.attr("allowfullscreen"),frameborder:"0"});else{n(["controls","crossorigin","currentTime","loop","muted","poster","preload"],(e=>{i.attr(e,t.attr(e))}));const o=a.attr("data-mce-html");s(o)&&((e,t,r,a)=>{const o=F(e.schema).parse(a,{context:t});for(;o.firstChild;)r.append(o.firstChild)})(e,r,i,unescape(o))}const c=new z("span",1);return c.attr("class","mce-shim"),a.append(i),a.append(c),a},ie=(e,t,r)=>{const a=t.attributes;let o=a.length;for(;o--;){const t=a[o].name;let c=a[o].value;"width"===t||"height"===t||"style"===t||(i="data-mce-",(s=t).length>=i.length&&s.substr(0,0+i.length)===i)||("data"!==t&&"src"!==t||(c=e.convertURL(c,t)),r.attr("data-mce-p-"+t,c))}var s,i;const c=M({inner:!0},e.schema),l=new z("div",1);n(t.children(),(e=>l.append(e)));const m=c.serialize(l);m&&(r.attr("data-mce-html",escape(m)),r.empty())},ce=e=>{const t=e.attr("class");return t&&/\btiny-pageembed\b/.test(t)},ne=e=>{for(;e=e.parent;)if(e.attr("data-ephox-embed-iri")||ce(e))return!0;return!1},le=(e,t,r)=>{const a=f(e);return F(e.schema,{validate:a}).parse(r,{context:t})};e.add("media",(e=>((e=>{const t=e.options.register;t("audio_template_callback",{processor:"function"}),t("video_template_callback",{processor:"function"}),t("iframe_template_callback",{processor:"function"}),t("media_live_embeds",{processor:"boolean",default:!0}),t("media_filter_html",{processor:"boolean",default:!0}),t("media_url_resolver",{processor:"function"}),t("media_alt_source",{processor:"boolean",default:!0}),t("media_poster",{processor:"boolean",default:!0}),t("media_dimensions",{processor:"boolean",default:!0})})(e),(e=>{e.addCommand("mceMedia",(()=>{Z(e)}))})(e),(e=>{const t=()=>e.execCommand("mceMedia");e.ui.registry.addToggleButton("media",{tooltip:"Insert/edit media",icon:"embed",onAction:t,onSetup:t=>{const r=e.selection;return t.setActive(G(r.getNode())),r.selectorChangedWithUnbind("img[data-mce-object],span[data-mce-object],div[data-ephox-embed-iri]",t.setActive).unbind}}),e.ui.registry.addMenuItem("media",{icon:"embed",text:"Media...",onAction:t})})(e),(e=>{e.on("ResolveName",(e=>{let t;1===e.target.nodeType&&(t=e.target.getAttribute("data-mce-object"))&&(e.name=t)}))})(e),(e=>{e.on("PreInit",(()=>{const{schema:t,serializer:r,parser:a}=e,o=t.getBoolAttrs();n("webkitallowfullscreen mozallowfullscreen".split(" "),(e=>{o[e]={}})),((e,t)=>{const r=m(e);for(let a=0,o=r.length;a<o;a++){const o=r[a];t(e[o],o)}})({embed:["wmode"]},((e,r)=>{const a=t.getElementRule(r);n(e,(e=>{a.attributes[e]={},a.attributesOrder.push(e)}))})),a.addNodeFilter("iframe,video,audio,object,embed,script",(e=>t=>{let r,a=t.length;for(;a--;)r=t[a],r.parent&&(r.parent.attr("data-mce-object")||(te(r)&&y(e)?ne(r)||r.replace(se(e,r)):ne(r)||r.replace(oe(e,r))))})(e)),r.addAttributeFilter("data-mce-object",((t,r)=>{let a=t.length;for(;a--;){const o=t[a];if(!o.parent)continue;const s=o.attr(r),i=new z(s,1);if("audio"!==s&&"script"!==s){const e=o.attr("class");e&&-1!==e.indexOf("mce-preview-object")?i.attr({width:o.firstChild.attr("width"),height:o.firstChild.attr("height")}):i.attr({width:o.attr("width"),height:o.attr("height")})}i.attr({style:o.attr("style")});const c=o.attributes;let l=c.length;for(;l--;){const e=c[l].name;0===e.indexOf("data-mce-p-")&&i.attr(e.substr(11),c[l].value)}"script"===s&&i.attr("type","text/javascript");const m=o.attr("data-mce-html");if(m){const t=le(e,s,unescape(m));n(t.children(),(e=>i.append(e)))}o.replace(i)}}))})),e.on("SetContent",(()=>{const t=e.dom;n(t.select("span.mce-preview-object"),(e=>{0===t.select("span.mce-shim",e).length&&t.add(e,"span",{class:"mce-shim"})}))}))})(e),(e=>{e.on("click keyup touchend",(()=>{const t=e.selection.getNode();t&&e.dom.hasClass(t,"mce-preview-object")&&e.dom.getAttrib(t,"data-mce-selected")&&t.setAttribute("data-mce-selected","2")})),e.on("ObjectSelected",(e=>{"script"===e.target.getAttribute("data-mce-object")&&e.preventDefault()})),e.on("ObjectResized",(t=>{const r=t.target;if(r.getAttribute("data-mce-object")){let a=r.getAttribute("data-mce-html");a&&(a=unescape(a),r.setAttribute("data-mce-html",escape(E(a,{width:String(t.width),height:String(t.height)},!1,e.schema))))}}))})(e),(e=>({showDialog:()=>{Z(e)}}))(e))))}();
4
+ !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(r=a=e,(o=String).prototype.isPrototypeOf(r)||(null===(s=a.constructor)||void 0===s?void 0:s.name)===o.name)?"string":t;var r,a,o,s})(t)===e,r=t("string"),a=t("object"),o=t("array"),s=e=>!(e=>null==e)(e);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 s(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 n=Array.prototype.push,c=(e,t)=>{for(let r=0,a=e.length;r<a;r++)t(e[r],r)},l=e=>{const t=[];for(let r=0,a=e.length;r<a;++r){if(!o(e[r]))throw new Error("Arr.flatten item "+r+" was not an array, input: "+e);n.apply(t,e[r])}return t},m=Object.keys,u=Object.hasOwnProperty,d=(e,t)=>h(e,t)?i.from(e[t]):i.none(),h=(e,t)=>u.call(e,t),p=e=>t=>t.options.get(e),g=p("audio_template_callback"),b=p("video_template_callback"),w=p("iframe_template_callback"),v=p("media_live_embeds"),f=p("media_filter_html"),y=p("media_url_resolver"),x=p("media_alt_source"),_=p("media_poster"),j=p("media_dimensions");var k=tinymce.util.Tools.resolve("tinymce.util.Tools"),O=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),A=tinymce.util.Tools.resolve("tinymce.html.DomParser");const S=O.DOM,C=e=>e.replace(/px$/,""),D=e=>{const t=e.attr("style"),r=t?S.parseStyle(t):{};return{type:"ephox-embed-iri",source:e.attr("data-ephox-embed-iri"),altsource:"",poster:"",width:d(r,"max-width").map(C).getOr(""),height:d(r,"max-height").map(C).getOr("")}},T=(e,t)=>{let r={};for(let a=A({validate:!1,forced_root_block:!1},t).parse(e);a;a=a.walk())if(1===a.type){const e=a.name;if(a.attr("data-ephox-embed-iri")){r=D(a);break}r.source||"param"!==e||(r.source=a.attr("movie")),"iframe"!==e&&"object"!==e&&"embed"!==e&&"video"!==e&&"audio"!==e||(r.type||(r.type=e),r=k.extend(a.attributes.map,r)),"script"===e&&(r={type:"script",source:a.attr("src")}),"source"===e&&(r.source?r.altsource||(r.altsource=a.attr("src")):r.source=a.attr("src")),"img"!==e||r.poster||(r.poster=a.attr("src"))}return r.source=r.source||r.src||"",r.altsource=r.altsource||"",r.poster=r.poster||"",r},$=e=>{var t;const r=null!==(t=e.toLowerCase().split(".").pop())&&void 0!==t?t:"";return d({mp3:"audio/mpeg",m4a:"audio/x-m4a",wav:"audio/wav",mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",swf:"application/x-shockwave-flash"},r).getOr("")};var z=tinymce.util.Tools.resolve("tinymce.html.Node"),M=tinymce.util.Tools.resolve("tinymce.html.Serializer");const F=(e,t={})=>A({forced_root_block:!1,validate:!1,allow_conditional_comments:!0,...t},e),N=O.DOM,R=e=>/^[0-9.]+$/.test(e)?e+"px":e,U=(e,t)=>{const r=t.attr("style"),a=r?N.parseStyle(r):{};s(e.width)&&(a["max-width"]=R(e.width)),s(e.height)&&(a["max-height"]=R(e.height)),t.attr("style",N.serializeStyle(a))},P=["source","altsource"],E=(e,t,r,a)=>{let o=0,s=0;const i=F(a);i.addNodeFilter("source",(e=>o=e.length));const n=i.parse(e);for(let e=n;e;e=e.walk())if(1===e.type){const a=e.name;if(e.attr("data-ephox-embed-iri")){U(t,e);break}switch(a){case"video":case"object":case"embed":case"img":case"iframe":void 0!==t.height&&void 0!==t.width&&(e.attr("width",t.width),e.attr("height",t.height))}if(r)switch(a){case"video":e.attr("poster",t.poster),e.attr("src",null);for(let r=o;r<2;r++)if(t[P[r]]){const a=new z("source",1);a.attr("src",t[P[r]]),a.attr("type",t[P[r]+"mime"]||null),e.append(a)}break;case"iframe":e.attr("src",t.source);break;case"object":const r=e.getAll("img").length>0;if(t.poster&&!r){e.attr("src",t.poster);const r=new z("img",1);r.attr("src",t.poster),r.attr("width",t.width),r.attr("height",t.height),e.append(r)}break;case"source":if(s<2&&(e.attr("src",t[P[s]]),e.attr("type",t[P[s]+"mime"]||null),!t[P[s]])){e.remove();continue}s++;break;case"img":t.poster||e.remove()}}return M({},a).serialize(n)},L=[{regex:/youtu\.be\/([\w\-_\?&=.]+)/i,type:"iframe",w:560,h:314,url:"www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/youtube\.com(.+)v=([^&]+)(&([a-z0-9&=\-_]+))?/i,type:"iframe",w:560,h:314,url:"www.youtube.com/embed/$2?$4",allowFullscreen:!0},{regex:/youtube.com\/embed\/([a-z0-9\?&=\-_]+)/i,type:"iframe",w:560,h:314,url:"www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/vimeo\.com\/([0-9]+)/,type:"iframe",w:425,h:350,url:"player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc",allowFullscreen:!0},{regex:/vimeo\.com\/(.*)\/([0-9]+)/,type:"iframe",w:425,h:350,url:"player.vimeo.com/video/$2?title=0&amp;byline=0",allowFullscreen:!0},{regex:/maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/,type:"iframe",w:425,h:350,url:'maps.google.com/maps/ms?msid=$2&output=embed"',allowFullscreen:!1},{regex:/dailymotion\.com\/video\/([^_]+)/,type:"iframe",w:480,h:270,url:"www.dailymotion.com/embed/video/$1",allowFullscreen:!0},{regex:/dai\.ly\/([^_]+)/,type:"iframe",w:480,h:270,url:"www.dailymotion.com/embed/video/$1",allowFullscreen:!0}],I=(e,t)=>{const r=(e=>{const t=e.match(/^(https?:\/\/|www\.)(.+)$/i);return t&&t.length>1?"www."===t[1]?"https://":t[1]:"https://"})(t),a=e.regex.exec(t);let o=r+e.url;if(s(a))for(let e=0;e<a.length;e++)o=o.replace("$"+e,(()=>a[e]?a[e]:""));return o.replace(/\?$/,"")},B=(e,t)=>{var r;const a=k.extend({},t);if(!a.source&&(k.extend(a,T(null!==(r=a.embed)&&void 0!==r?r:"",e.schema)),!a.source))return"";a.altsource||(a.altsource=""),a.poster||(a.poster=""),a.source=e.convertURL(a.source,"source"),a.altsource=e.convertURL(a.altsource,"source"),a.sourcemime=$(a.source),a.altsourcemime=$(a.altsource),a.poster=e.convertURL(a.poster,"poster");const o=(e=>{const t=L.filter((t=>t.regex.test(e)));return t.length>0?k.extend({},t[0],{url:I(t[0],e)}):null})(a.source);if(o&&(a.source=o.url,a.type=o.type,a.allowfullscreen=o.allowFullscreen,a.width=a.width||String(o.w),a.height=a.height||String(o.h)),a.embed)return E(a.embed,a,!0,e.schema);{const t=g(e),r=b(e),o=w(e);return a.width=a.width||"300",a.height=a.height||"150",k.each(a,((t,r)=>{a[r]=e.dom.encode(""+t)})),"iframe"===a.type?((e,t)=>{if(t)return t(e);{const t=e.allowfullscreen?' allowFullscreen="1"':"";return'<iframe src="'+e.source+'" width="'+e.width+'" height="'+e.height+'"'+t+"></iframe>"}})(a,o):"application/x-shockwave-flash"===a.sourcemime?(e=>{let t='<object data="'+e.source+'" width="'+e.width+'" height="'+e.height+'" type="application/x-shockwave-flash">';return e.poster&&(t+='<img src="'+e.poster+'" width="'+e.width+'" height="'+e.height+'" />'),t+="</object>",t})(a):-1!==a.sourcemime.indexOf("audio")?((e,t)=>t?t(e):'<audio controls="controls" src="'+e.source+'">'+(e.altsource?'\n<source src="'+e.altsource+'"'+(e.altsourcemime?' type="'+e.altsourcemime+'"':"")+" />\n":"")+"</audio>")(a,t):"script"===a.type?(e=>'<script src="'+e.source+'"><\/script>')(a):((e,t)=>t?t(e):'<video width="'+e.width+'" height="'+e.height+'"'+(e.poster?' poster="'+e.poster+'"':"")+' controls="controls">\n<source src="'+e.source+'"'+(e.sourcemime?' type="'+e.sourcemime+'"':"")+" />\n"+(e.altsource?'<source src="'+e.altsource+'"'+(e.altsourcemime?' type="'+e.altsourcemime+'"':"")+" />\n":"")+"</video>")(a,r)}},G=e=>e.hasAttribute("data-mce-object")||e.hasAttribute("data-ephox-embed-iri"),W={},q=e=>t=>B(e,t),H=(e,t)=>{const r=y(e);return r?((e,t,r)=>new Promise(((a,o)=>{const s=r=>(r.html&&(W[e.source]=r),a({url:e.source,html:r.html?r.html:t(e)}));W[e.source]?s(W[e.source]):r({url:e.source},s,o)})))(t,q(e),r):((e,t)=>Promise.resolve({html:t(e),url:e.source}))(t,q(e))},J=(e,t)=>{const r={};return d(e,"dimensions").each((e=>{c(["width","height"],(a=>{d(t,a).orThunk((()=>d(e,a))).each((e=>r[a]=e))}))})),r},K=(e,t)=>{const r=t&&"dimensions"!==t?((e,t)=>d(t,e).bind((e=>d(e,"meta"))))(t,e).getOr({}):{},o=((e,t,r)=>o=>{const s=()=>d(e,o),n=()=>d(t,o),c=e=>d(e,"value").bind((e=>e.length>0?i.some(e):i.none()));return{[o]:(o===r?s().bind((e=>a(e)?c(e).orThunk(n):n().orThunk((()=>i.from(e))))):n().orThunk((()=>s().bind((e=>a(e)?c(e):i.from(e)))))).getOr("")}})(e,r,t);return{...o("source"),...o("altsource"),...o("poster"),...o("embed"),...J(e,r)}},Q=e=>{const t={...e,source:{value:d(e,"source").getOr("")},altsource:{value:d(e,"altsource").getOr("")},poster:{value:d(e,"poster").getOr("")}};return c(["width","height"],(r=>{d(e,r).each((e=>{const a=t.dimensions||{};a[r]=e,t.dimensions=a}))})),t},V=e=>t=>{const r=t&&t.msg?"Media embed handler error: "+t.msg:"Media embed handler threw unknown error.";e.notificationManager.open({type:"error",text:r})},X=(e,t)=>a=>{if(r(a.url)&&a.url.trim().length>0){const r=a.html,o={...T(r,t.schema),source:a.url,embed:r};e.setData(Q(o))}},Y=(e,t)=>{const r=e.dom.select("*[data-mce-object]");e.insertContent(t),((e,t)=>{const r=e.dom.select("*[data-mce-object]");for(let e=0;e<t.length;e++)for(let a=r.length-1;a>=0;a--)t[e]===r[a]&&r.splice(a,1);e.selection.select(r[0])})(e,r),e.nodeChanged()},Z=e=>{const t=(e=>{const t=e.selection.getNode(),r=G(t)?e.serializer.serialize(t,{selection:!0}):"";return{embed:r,...T(r,e.schema)}})(e),r=(e=>{let t=e;return{get:()=>t,set:e=>{t=e}}})(t),a=Q(t),o=j(e)?[{type:"sizeinput",name:"dimensions",label:"Constrain proportions",constrain:!0}]:[],s={title:"General",name:"general",items:l([[{name:"source",type:"urlinput",filetype:"media",label:"Source"}],o])},i=[];x(e)&&i.push({name:"altsource",type:"urlinput",filetype:"media",label:"Alternative source URL"}),_(e)&&i.push({name:"poster",type:"urlinput",filetype:"image",label:"Media poster (Image URL)"});const n={title:"Advanced",name:"advanced",items:i},c=[s,{title:"Embed",items:[{type:"textarea",name:"embed",label:"Paste your embed code below:"}]}];i.length>0&&c.push(n);const m={type:"tabpanel",tabs:c},u=e.windowManager.open({title:"Insert/Edit Media",size:"normal",body:m,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],onSubmit:t=>{const a=K(t.getData());((e,t,r)=>{var a,o;t.embed=E(null!==(a=t.embed)&&void 0!==a?a:"",t,!1,r.schema),t.embed&&(e.source===t.source||(o=t.source,h(W,o)))?Y(r,t.embed):H(r,t).then((e=>{Y(r,e.html)})).catch(V(r))})(r.get(),a,e),t.close()},onChange:(t,a)=>{switch(a.name){case"source":((t,r)=>{const a=K(r.getData(),"source");t.source!==a.source&&(X(u,e)({url:a.source,html:""}),H(e,a).then(X(u,e)).catch(V(e)))})(r.get(),t);break;case"embed":(t=>{var r;const a=K(t.getData()),o=T(null!==(r=a.embed)&&void 0!==r?r:"",e.schema);t.setData(Q(o))})(t);break;case"dimensions":case"altsource":case"poster":((t,r)=>{const a=K(t.getData(),r),o=B(e,a);t.setData(Q({...a,embed:o}))})(t,a.name)}r.set(K(t.getData()))},initialData:a})};var ee=tinymce.util.Tools.resolve("tinymce.Env");const te=e=>{const t=e.name;return"iframe"===t||"video"===t||"audio"===t},re=(e,t,r,a=null)=>{const o=e.attr(r);return s(o)?o:h(t,r)?null:a},ae=(e,t,r)=>{const a="img"===t.name||"video"===e.name,o=a?"300":null,s="audio"===e.name?"30":"150",i=a?s:null;t.attr({width:re(e,r,"width",o),height:re(e,r,"height",i)})},oe=(e,t)=>{const r=t.name,a=new z("img",1);return ie(e,t,a),ae(t,a,{}),a.attr({style:t.attr("style"),src:ee.transparentSrc,"data-mce-object":r,class:"mce-object mce-object-"+r}),a},se=(e,t)=>{var r;const a=t.name,o=new z("span",1);o.attr({contentEditable:"false",style:t.attr("style"),"data-mce-object":a,class:"mce-preview-object mce-object-"+a}),ie(e,t,o);const i=e.dom.parseStyle(null!==(r=t.attr("style"))&&void 0!==r?r:""),n=new z(a,1);if(ae(t,n,i),n.attr({src:t.attr("src"),style:t.attr("style"),class:t.attr("class")}),"iframe"===a)n.attr({allowfullscreen:t.attr("allowfullscreen"),frameborder:"0"});else{c(["controls","crossorigin","currentTime","loop","muted","poster","preload"],(e=>{n.attr(e,t.attr(e))}));const r=o.attr("data-mce-html");s(r)&&((e,t,r,a)=>{const o=F(e.schema).parse(a,{context:t});for(;o.firstChild;)r.append(o.firstChild)})(e,a,n,unescape(r))}const l=new z("span",1);return l.attr("class","mce-shim"),o.append(n),o.append(l),o},ie=(e,t,r)=>{var a;const o=null!==(a=t.attributes)&&void 0!==a?a:[];let s=o.length;for(;s--;){const t=o[s].name;let a=o[s].value;"width"===t||"height"===t||"style"===t||(n="data-mce-",(i=t).length>=n.length&&i.substr(0,0+n.length)===n)||("data"!==t&&"src"!==t||(a=e.convertURL(a,t)),r.attr("data-mce-p-"+t,a))}var i,n;const l=M({inner:!0},e.schema),m=new z("div",1);c(t.children(),(e=>m.append(e)));const u=l.serialize(m);u&&(r.attr("data-mce-html",escape(u)),r.empty())},ne=e=>{const t=e.attr("class");return r(t)&&/\btiny-pageembed\b/.test(t)},ce=e=>{let t=e;for(;t=t.parent;)if(t.attr("data-ephox-embed-iri")||ne(t))return!0;return!1},le=(e,t,r)=>{const a=f(e);return F(e.schema,{validate:a}).parse(r,{context:t})};e.add("media",(e=>((e=>{const t=e.options.register;t("audio_template_callback",{processor:"function"}),t("video_template_callback",{processor:"function"}),t("iframe_template_callback",{processor:"function"}),t("media_live_embeds",{processor:"boolean",default:!0}),t("media_filter_html",{processor:"boolean",default:!0}),t("media_url_resolver",{processor:"function"}),t("media_alt_source",{processor:"boolean",default:!0}),t("media_poster",{processor:"boolean",default:!0}),t("media_dimensions",{processor:"boolean",default:!0})})(e),(e=>{e.addCommand("mceMedia",(()=>{Z(e)}))})(e),(e=>{const t=()=>e.execCommand("mceMedia");e.ui.registry.addToggleButton("media",{tooltip:"Insert/edit media",icon:"embed",onAction:t,onSetup:t=>{const r=e.selection;return t.setActive(G(r.getNode())),r.selectorChangedWithUnbind("img[data-mce-object],span[data-mce-object],div[data-ephox-embed-iri]",t.setActive).unbind}}),e.ui.registry.addMenuItem("media",{icon:"embed",text:"Media...",onAction:t})})(e),(e=>{e.on("ResolveName",(e=>{let t;1===e.target.nodeType&&(t=e.target.getAttribute("data-mce-object"))&&(e.name=t)}))})(e),(e=>{e.on("PreInit",(()=>{const{schema:t,serializer:r,parser:a}=e,o=t.getBoolAttrs();c("webkitallowfullscreen mozallowfullscreen".split(" "),(e=>{o[e]={}})),((e,t)=>{const r=m(e);for(let a=0,o=r.length;a<o;a++){const o=r[a];t(e[o],o)}})({embed:["wmode"]},((e,r)=>{const a=t.getElementRule(r);a&&c(e,(e=>{a.attributes[e]={},a.attributesOrder.push(e)}))})),a.addNodeFilter("iframe,video,audio,object,embed,script",(e=>t=>{let r,a=t.length;for(;a--;)r=t[a],r.parent&&(r.parent.attr("data-mce-object")||(te(r)&&v(e)?ce(r)||r.replace(se(e,r)):ce(r)||r.replace(oe(e,r))))})(e)),r.addAttributeFilter("data-mce-object",((t,r)=>{var a;let o=t.length;for(;o--;){const s=t[o];if(!s.parent)continue;const i=s.attr(r),n=new z(i,1);if("audio"!==i&&"script"!==i){const e=s.attr("class");e&&-1!==e.indexOf("mce-preview-object")&&s.firstChild?n.attr({width:s.firstChild.attr("width"),height:s.firstChild.attr("height")}):n.attr({width:s.attr("width"),height:s.attr("height")})}n.attr({style:s.attr("style")});const l=null!==(a=s.attributes)&&void 0!==a?a:[];let m=l.length;for(;m--;){const e=l[m].name;0===e.indexOf("data-mce-p-")&&n.attr(e.substr(11),l[m].value)}"script"===i&&n.attr("type","text/javascript");const u=s.attr("data-mce-html");if(u){const t=le(e,i,unescape(u));c(t.children(),(e=>n.append(e)))}s.replace(n)}}))})),e.on("SetContent",(()=>{const t=e.dom;c(t.select("span.mce-preview-object"),(e=>{0===t.select("span.mce-shim",e).length&&t.add(e,"span",{class:"mce-shim"})}))}))})(e),(e=>{e.on("click keyup touchend",(()=>{const t=e.selection.getNode();t&&e.dom.hasClass(t,"mce-preview-object")&&e.dom.getAttrib(t,"data-mce-selected")&&t.setAttribute("data-mce-selected","2")})),e.on("ObjectSelected",(e=>{"script"===e.target.getAttribute("data-mce-object")&&e.preventDefault()})),e.on("ObjectResized",(t=>{const r=t.target;if(r.getAttribute("data-mce-object")){let a=r.getAttribute("data-mce-html");a&&(a=unescape(a),r.setAttribute("data-mce-html",escape(E(a,{width:String(t.width),height:String(t.height)},!1,e.schema))))}}))})(e),(e=>({showDialog:()=>{Z(e)}}))(e))))}();
@@ -1,4 +1,4 @@
1
1
  /**
2
- * TinyMCE version 6.1.2 (2022-07-29)
2
+ * TinyMCE version 6.2.0 (2022-09-08)
3
3
  */
4
4
  !function(){"use strict";var n=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=n=>e=>typeof e===n,a=e("boolean"),o=e("number"),t=n=>e=>e.options.get(n),i=t("nonbreaking_force_tab"),r=t("nonbreaking_wrap"),s=(n,e)=>{let a="";for(let o=0;o<e;o++)a+=n;return a},c=(n,e)=>{const a=r(n)||n.plugins.visualchars?`<span class="${(n=>!!n.plugins.visualchars&&n.plugins.visualchars.isEnabled())(n)?"mce-nbsp-wrap mce-nbsp":"mce-nbsp-wrap"}" contenteditable="false">${s("&nbsp;",e)}</span>`:s("&nbsp;",e);n.undoManager.transact((()=>n.insertContent(a)))};var l=tinymce.util.Tools.resolve("tinymce.util.VK");n.add("nonbreaking",(n=>{(n=>{const e=n.options.register;e("nonbreaking_force_tab",{processor:n=>a(n)?{value:n?3:0,valid:!0}:o(n)?{value:n,valid:!0}:{valid:!1,message:"Must be a boolean or number."},default:!1}),e("nonbreaking_wrap",{processor:"boolean",default:!0})})(n),(n=>{n.addCommand("mceNonBreaking",(()=>{c(n,1)}))})(n),(n=>{const e=()=>n.execCommand("mceNonBreaking");n.ui.registry.addButton("nonbreaking",{icon:"non-breaking",tooltip:"Nonbreaking space",onAction:e}),n.ui.registry.addMenuItem("nonbreaking",{icon:"non-breaking",text:"Nonbreaking space",onAction:e})})(n),(n=>{const e=i(n);e>0&&n.on("keydown",(a=>{if(a.keyCode===l.TAB&&!a.isDefaultPrevented()){if(a.shiftKey)return;a.preventDefault(),a.stopImmediatePropagation(),c(n,e)}}))})(n)}))}();
@@ -1,4 +1,4 @@
1
1
  /**
2
- * TinyMCE version 6.1.2 (2022-07-29)
2
+ * TinyMCE version 6.2.0 (2022-09-08)
3
3
  */
4
- !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=tinymce.util.Tools.resolve("tinymce.Env");const t=e=>a=>a.options.get(e),r=t("pagebreak_separator"),n=t("pagebreak_split_block"),o="mce-pagebreak",s=e=>{const t=`<img src="${a.transparentSrc}" class="mce-pagebreak" data-mce-resize="false" data-mce-placeholder />`;return e?`<p>${t}</p>`:t};e.add("pagebreak",(e=>{(e=>{const a=e.options.register;a("pagebreak_separator",{processor:"string",default:"\x3c!-- pagebreak --\x3e"}),a("pagebreak_split_block",{processor:"boolean",default:!1})})(e),(e=>{e.addCommand("mcePageBreak",(()=>{e.insertContent(s(n(e)))}))})(e),(e=>{const a=()=>e.execCommand("mcePageBreak");e.ui.registry.addButton("pagebreak",{icon:"page-break",tooltip:"Page break",onAction:a}),e.ui.registry.addMenuItem("pagebreak",{text:"Page break",icon:"page-break",onAction:a})})(e),(e=>{const a=r(e),t=()=>n(e),c=new RegExp(a.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,(e=>"\\"+e)),"gi");e.on("BeforeSetContent",(e=>{e.content=e.content.replace(c,s(t()))})),e.on("PreInit",(()=>{e.serializer.addNodeFilter("img",(r=>{let n,s,c=r.length;for(;c--;)if(n=r[c],s=n.attr("class"),s&&-1!==s.indexOf(o)){const r=n.parent;if(e.schema.getBlockElements()[r.name]&&t()){r.type=3,r.value=a,r.raw=!0,n.remove();continue}n.type=3,n.value=a,n.raw=!0}}))}))})(e),(e=>{e.on("ResolveName",(a=>{"IMG"===a.target.nodeName&&e.dom.hasClass(a.target,o)&&(a.name="pagebreak")}))})(e)}))}();
4
+ !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=tinymce.util.Tools.resolve("tinymce.Env");const t=e=>a=>a.options.get(e),r=t("pagebreak_separator"),n=t("pagebreak_split_block"),o="mce-pagebreak",s=e=>{const t=`<img src="${a.transparentSrc}" class="mce-pagebreak" data-mce-resize="false" data-mce-placeholder />`;return e?`<p>${t}</p>`:t};e.add("pagebreak",(e=>{(e=>{const a=e.options.register;a("pagebreak_separator",{processor:"string",default:"\x3c!-- pagebreak --\x3e"}),a("pagebreak_split_block",{processor:"boolean",default:!1})})(e),(e=>{e.addCommand("mcePageBreak",(()=>{e.insertContent(s(n(e)))}))})(e),(e=>{const a=()=>e.execCommand("mcePageBreak");e.ui.registry.addButton("pagebreak",{icon:"page-break",tooltip:"Page break",onAction:a}),e.ui.registry.addMenuItem("pagebreak",{text:"Page break",icon:"page-break",onAction:a})})(e),(e=>{const a=r(e),t=()=>n(e),c=new RegExp(a.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,(e=>"\\"+e)),"gi");e.on("BeforeSetContent",(e=>{e.content=e.content.replace(c,s(t()))})),e.on("PreInit",(()=>{e.serializer.addNodeFilter("img",(r=>{let n,s,c=r.length;for(;c--;)if(n=r[c],s=n.attr("class"),s&&-1!==s.indexOf(o)){const r=n.parent;if(r&&e.schema.getBlockElements()[r.name]&&t()){r.type=3,r.value=a,r.raw=!0,n.remove();continue}n.type=3,n.value=a,n.raw=!0}}))}))})(e),(e=>{e.on("ResolveName",(a=>{"IMG"===a.target.nodeName&&e.dom.hasClass(a.target,o)&&(a.name="pagebreak")}))})(e)}))}();
@@ -1,4 +1,4 @@
1
1
  /**
2
- * TinyMCE version 6.1.2 (2022-07-29)
2
+ * TinyMCE version 6.2.0 (2022-09-08)
3
3
  */
4
4
  !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.Env"),o=tinymce.util.Tools.resolve("tinymce.util.Tools");const n=e=>t=>t.options.get(e),i=n("content_style"),s=n("content_css_cors"),c=n("body_class"),r=n("body_id");e.add("preview",(e=>{(e=>{e.addCommand("mcePreview",(()=>{(e=>{const n=(e=>{var n;let l="";const a=e.dom.encode,d=null!==(n=i(e))&&void 0!==n?n:"";l+='<base href="'+a(e.documentBaseURI.getURI())+'">';const m=s(e)?' crossorigin="anonymous"':"";o.each(e.contentCSS,(t=>{l+='<link type="text/css" rel="stylesheet" href="'+a(e.documentBaseURI.toAbsolute(t))+'"'+m+">"})),d&&(l+='<style type="text/css">'+d+"</style>");const y=r(e),u=c(e),v='<script>document.addEventListener && document.addEventListener("click", function(e) {for (var elm = e.target; elm; elm = elm.parentNode) {if (elm.nodeName === "A" && !('+(t.os.isMacOS()||t.os.isiOS()?"e.metaKey":"e.ctrlKey && !e.altKey")+")) {e.preventDefault();}}}, false);<\/script> ",p=e.getBody().dir,w=p?' dir="'+a(p)+'"':"";return"<!DOCTYPE html><html><head>"+l+'</head><body id="'+a(y)+'" class="mce-content-body '+a(u)+'"'+w+">"+e.getContent()+v+"</body></html>"})(e);e.windowManager.open({title:"Preview",size:"large",body:{type:"panel",items:[{name:"preview",type:"iframe",sandboxed:!0,transparent:!1}]},buttons:[{type:"cancel",name:"close",text:"Close",primary:!0}],initialData:{preview:n}}).focus("close")})(e)}))})(e),(e=>{const t=()=>e.execCommand("mcePreview");e.ui.registry.addButton("preview",{icon:"preview",tooltip:"Preview",onAction:t}),e.ui.registry.addMenuItem("preview",{icon:"preview",text:"Preview",onAction:t})})(e)}))}();
@@ -1,4 +1,4 @@
1
1
  /**
2
- * TinyMCE version 6.1.2 (2022-07-29)
2
+ * TinyMCE version 6.2.0 (2022-09-08)
3
3
  */
4
- !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>typeof t===e,o=("string",e=>"string"===(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=n=e,(r=String).prototype.isPrototypeOf(o)||(null===(i=n.constructor)||void 0===i?void 0:i.name)===r.name)?"string":t;var o,n,r,i})(e));const n=t("boolean"),r=t("function"),i=e=>t=>t.options.get(e),s=i("quickbars_selection_toolbar"),a=i("quickbars_insert_toolbar"),l=i("quickbars_image_toolbar");let c=0;var u=tinymce.util.Tools.resolve("tinymce.Env"),d=tinymce.util.Tools.resolve("tinymce.util.Delay");const m=e=>{e.ui.registry.addButton("quickimage",{icon:"image",tooltip:"Insert image",onAction:()=>{(e=>new Promise((t=>{const o=document.createElement("input");o.type="file",o.accept="image/*",o.style.position="fixed",o.style.left="0",o.style.top="0",o.style.opacity="0.001",document.body.appendChild(o),o.addEventListener("change",(e=>{t(Array.prototype.slice.call(e.target.files))}));const n=r=>{const i=()=>{t([]),o.parentNode.removeChild(o)};u.os.isAndroid()&&"remove"!==r.type?d.setEditorTimeout(e,i,0):i(),e.off("focusin remove",n)};e.on("focusin remove",n),o.click()})))(e).then((t=>{if(t.length>0){const o=t[0];(e=>new Promise((t=>{const o=new FileReader;o.onloadend=()=>{t(o.result.split(",")[1])},o.readAsDataURL(e)})))(o).then((t=>{((e,t,o)=>{const n=e.editorUpload.blobCache,r=n.create((e=>{const t=(new Date).getTime(),o=Math.floor(1e9*Math.random());return c++,"mceu_"+o+c+String(t)})(),o,t);n.add(r),e.insertContent(e.dom.createHTML("img",{src:r.blobUri()}))})(e,t,o)}))}}))}}),e.ui.registry.addButton("quicktable",{icon:"table",tooltip:"Insert table",onAction:()=>{((e,t,o)=>{e.execCommand("mceInsertTable",!1,{rows:2,columns:2})})(e)}})},g=(!1,()=>false);class h{constructor(e,t){this.tag=e,this.value=t}static some(e){return new h(!0,e)}static none(){return h.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?h.some(e(this.value)):h.none()}bind(e){return this.tag?e(this.value):h.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:h.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 null==e?h.none():h.some(e)}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()"}}h.singletonNone=new h(!1);var b=(e,t,o,n,i)=>e(o,n)?h.some(o):r(i)&&i(o)?h.none():t(o,n,i);const p=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},f=p,v=(e,t)=>{const o=e.dom;if(1!==o.nodeType)return!1;{const e=o;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")}};"undefined"!=typeof window?window:Function("return this;")();const y=(e,t,o)=>{let n=e.dom;const i=r(o)?o:g;for(;n.parentNode;){n=n.parentNode;const e=f(n);if(t(e))return h.some(e);if(i(e))break}return h.none()},k=(e,t,o)=>y(e,(e=>v(e,t)),o),w=e=>{const t=a(e);t.length>0&&e.ui.registry.addContextToolbar("quickblock",{predicate:t=>{const o=f(t),n=e.schema.getTextBlockElements(),r=t=>t.dom===e.getBody();return((e,t,o)=>b(((e,t)=>v(e,t)),k,e,"table",o))(o,0,r).fold((()=>((t,o,r)=>b(((e,t)=>t(e)),y,t,(t=>t.dom.nodeName.toLowerCase()in n&&e.dom.isEmpty(t.dom)),r))(o,0,r).isSome()),g)},items:t,position:"line",scope:"editor"})};e.add("quickbars",(e=>{(e=>{const t=e.options.register,r=e=>t=>{const r=n(t)||o(t);return r?n(t)?{value:t?e:"",valid:r}:{value:t.trim(),valid:r}:{valid:!1,message:"Must be a boolean or string."}},i="bold italic | quicklink h2 h3 blockquote";t("quickbars_selection_toolbar",{processor:r(i),default:i});const s="quickimage quicktable";t("quickbars_insert_toolbar",{processor:r(s),default:s});const a="alignleft aligncenter alignright";t("quickbars_image_toolbar",{processor:r(a),default:a})})(e),m(e),w(e),(e=>{const t=e=>"IMG"===e.nodeName||"FIGURE"===e.nodeName&&/image/i.test(e.className),o=l(e);o.length>0&&e.ui.registry.addContextToolbar("imageselection",{predicate:t,items:o,position:"node"});const n=s(e);n.length>0&&e.ui.registry.addContextToolbar("textselection",{predicate:o=>!t(o)&&!e.selection.isCollapsed()&&(t=>"false"!==e.dom.getContentEditableParent(t))(o),items:n,position:"selection",scope:"editor"})})(e)}))}();
4
+ !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>typeof t===e,o=("string",e=>"string"===(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=n=e,(r=String).prototype.isPrototypeOf(o)||(null===(i=n.constructor)||void 0===i?void 0:i.name)===r.name)?"string":t;var o,n,r,i})(e));const n=t("boolean"),r=t("function"),i=e=>t=>t.options.get(e),s=i("quickbars_selection_toolbar"),a=i("quickbars_insert_toolbar"),l=i("quickbars_image_toolbar");let c=0;var u=tinymce.util.Tools.resolve("tinymce.Env"),d=tinymce.util.Tools.resolve("tinymce.util.Delay");const m=e=>{e.ui.registry.addButton("quickimage",{icon:"image",tooltip:"Insert image",onAction:()=>{(e=>new Promise((t=>{const o=document.createElement("input");o.type="file",o.accept="image/*",o.style.position="fixed",o.style.left="0",o.style.top="0",o.style.opacity="0.001",document.body.appendChild(o),o.addEventListener("change",(e=>{t(Array.prototype.slice.call(e.target.files))}));const n=r=>{const i=()=>{var e;t([]),null===(e=o.parentNode)||void 0===e||e.removeChild(o)};u.os.isAndroid()&&"remove"!==r.type?d.setEditorTimeout(e,i,0):i(),e.off("focusin remove",n)};e.on("focusin remove",n),o.click()})))(e).then((t=>{if(t.length>0){const o=t[0];(e=>new Promise((t=>{const o=new FileReader;o.onloadend=()=>{t(o.result.split(",")[1])},o.readAsDataURL(e)})))(o).then((t=>{((e,t,o)=>{const n=e.editorUpload.blobCache,r=n.create((e=>{const t=(new Date).getTime(),o=Math.floor(1e9*Math.random());return c++,"mceu_"+o+c+String(t)})(),o,t);n.add(r),e.insertContent(e.dom.createHTML("img",{src:r.blobUri()}))})(e,t,o)}))}}))}}),e.ui.registry.addButton("quicktable",{icon:"table",tooltip:"Insert table",onAction:()=>{((e,t,o)=>{e.execCommand("mceInsertTable",!1,{rows:2,columns:2})})(e)}})},g=(!1,()=>false);class h{constructor(e,t){this.tag=e,this.value=t}static some(e){return new h(!0,e)}static none(){return h.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?h.some(e(this.value)):h.none()}bind(e){return this.tag?e(this.value):h.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:h.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 null==e?h.none():h.some(e)}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()"}}h.singletonNone=new h(!1);var v=(e,t,o,n,i)=>e(o,n)?h.some(o):r(i)&&i(o)?h.none():t(o,n,i);const b=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},p=b,f=(e,t)=>{const o=e.dom;if(1!==o.nodeType)return!1;{const e=o;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")}};"undefined"!=typeof window?window:Function("return this;")();const y=(e,t,o)=>{let n=e.dom;const i=r(o)?o:g;for(;n.parentNode;){n=n.parentNode;const e=p(n);if(t(e))return h.some(e);if(i(e))break}return h.none()},k=(e,t,o)=>y(e,(e=>f(e,t)),o),w=e=>{const t=a(e);t.length>0&&e.ui.registry.addContextToolbar("quickblock",{predicate:t=>{const o=p(t),n=e.schema.getTextBlockElements(),r=t=>t.dom===e.getBody();return((e,t,o)=>v(((e,t)=>f(e,t)),k,e,"table",o))(o,0,r).fold((()=>((t,o,r)=>v(((e,t)=>t(e)),y,t,(t=>t.dom.nodeName.toLowerCase()in n&&e.dom.isEmpty(t.dom)),r))(o,0,r).isSome()),g)},items:t,position:"line",scope:"editor"})};e.add("quickbars",(e=>{(e=>{const t=e.options.register,r=e=>t=>{const r=n(t)||o(t);return r?n(t)?{value:t?e:"",valid:r}:{value:t.trim(),valid:r}:{valid:!1,message:"Must be a boolean or string."}},i="bold italic | quicklink h2 h3 blockquote";t("quickbars_selection_toolbar",{processor:r(i),default:i});const s="quickimage quicktable";t("quickbars_insert_toolbar",{processor:r(s),default:s});const a="alignleft aligncenter alignright";t("quickbars_image_toolbar",{processor:r(a),default:a})})(e),m(e),w(e),(e=>{const t=e=>"IMG"===e.nodeName||"FIGURE"===e.nodeName&&/image/i.test(e.className),o=l(e);o.length>0&&e.ui.registry.addContextToolbar("imageselection",{predicate:t,items:o,position:"node"});const n=s(e);n.length>0&&e.ui.registry.addContextToolbar("textselection",{predicate:o=>!t(o)&&!e.selection.isCollapsed()&&(t=>"false"!==e.dom.getContentEditableParent(t))(o),items:n,position:"selection",scope:"editor"})})(e)}))}();
@@ -1,4 +1,4 @@
1
1
  /**
2
- * TinyMCE version 6.1.2 (2022-07-29)
2
+ * TinyMCE version 6.2.0 (2022-09-08)
3
3
  */
4
4
  !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const n=("function",e=>"function"==typeof e);var o=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),t=tinymce.util.Tools.resolve("tinymce.util.Tools");const a=e=>n=>n.options.get(e),c=a("save_enablewhendirty"),i=a("save_onsavecallback"),s=a("save_oncancelcallback"),r=(e,n)=>{e.notificationManager.open({text:n,type:"error"})},l=e=>n=>{const o=()=>{n.setEnabled(!c(e)||e.isDirty())};return o(),e.on("NodeChange dirty",o),()=>e.off("NodeChange dirty",o)};e.add("save",(e=>{(e=>{const n=e.options.register;n("save_enablewhendirty",{processor:"boolean",default:!0}),n("save_onsavecallback",{processor:"function"}),n("save_oncancelcallback",{processor:"function"})})(e),(e=>{e.ui.registry.addButton("save",{icon:"save",tooltip:"Save",enabled:!1,onAction:()=>e.execCommand("mceSave"),onSetup:l(e)}),e.ui.registry.addButton("cancel",{icon:"cancel",tooltip:"Cancel",enabled:!1,onAction:()=>e.execCommand("mceCancel"),onSetup:l(e)}),e.addShortcut("Meta+S","","mceSave")})(e),(e=>{e.addCommand("mceSave",(()=>{(e=>{const t=o.DOM.getParent(e.id,"form");if(c(e)&&!e.isDirty())return;e.save();const a=i(e);if(n(a))return a.call(e,e),void e.nodeChanged();t?(e.setDirty(!1),t.onsubmit&&!t.onsubmit()||("function"==typeof t.submit?t.submit():r(e,"Error: Form submit field collision.")),e.nodeChanged()):r(e,"Error: No form element found.")})(e)})),e.addCommand("mceCancel",(()=>{(e=>{const o=t.trim(e.startContent),a=s(e);n(a)?a.call(e,e):e.resetContent(o)})(e)}))})(e)}))}();
@@ -1,4 +1,4 @@
1
1
  /**
2
- * TinyMCE version 6.1.2 (2022-07-29)
2
+ * TinyMCE version 6.2.0 (2022-09-08)
3
3
  */
4
- !function(){"use strict";const e=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}};var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const n=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(n=o=e,(r=String).prototype.isPrototypeOf(n)||(null===(s=o.constructor)||void 0===s?void 0:s.name)===r.name)?"string":t;var n,o,r,s})(t)===e,o=e=>t=>typeof t===e,r=n("string"),s=n("array"),a=o("boolean"),l=o("number"),i=()=>{},c=e=>()=>e,d=c(!0),u=c("[!-#%-*,-\\/:;?@\\[-\\]_{}\xa1\xab\xb7\xbb\xbf;\xb7\u055a-\u055f\u0589\u058a\u05be\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f3a-\u0f3d\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1361-\u1368\u1400\u166d\u166e\u169b\u169c\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cd3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205e\u207d\u207e\u208d\u208e\u3008\u3009\u2768-\u2775\u27c5\u27c6\u27e6-\u27ef\u2983-\u2998\u29d8-\u29db\u29fc\u29fd\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00-\u2e2e\u2e30\u2e31\u3001-\u3003\u3008-\u3011\u3014-\u301f\u3030\u303d\u30a0\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uabeb\ufd3e\ufd3f\ufe10-\ufe19\ufe30-\ufe52\ufe54-\ufe61\ufe63\ufe68\ufe6a\ufe6b\uff01-\uff03\uff05-\uff0a\uff0c-\uff0f\uff1a\uff1b\uff1f\uff20\uff3b-\uff3d\uff3f\uff5b\uff5d\uff5f-\uff65]");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 null==e?m.none():m.some(e)}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 h=u;var g=tinymce.util.Tools.resolve("tinymce.Env"),f=tinymce.util.Tools.resolve("tinymce.util.Tools");const p=Array.prototype.slice,x=Array.prototype.push,y=(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},w=(e,t)=>{for(let n=0,o=e.length;n<o;n++)t(e[n],n)},b=(e,t)=>{for(let n=e.length-1;n>=0;n--)t(e[n],n)},v=(e,t)=>(e=>{const t=[];for(let n=0,o=e.length;n<o;++n){if(!s(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);x.apply(t,e[n])}return t})(y(e,t)),C=Object.hasOwnProperty,E=(e,t)=>C.call(e,t);"undefined"!=typeof window?window:Function("return this;")();const O=(3,e=>3===(e=>e.dom.nodeType)(e));const N=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},k=N,T=(e,t)=>({element:e,offset:t}),A=(e,t)=>{((e,t)=>{const n=(e=>m.from(e.dom.parentNode).map(k))(e);n.each((n=>{n.dom.insertBefore(t.dom,e.dom)}))})(e,t),((e,t)=>{e.dom.appendChild(t.dom)})(t,e)},S=((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}}})(O),B=e=>S.get(e);var F=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker");const I=(e,t)=>e.isBlock(t)||E(e.schema.getVoidElements(),t.nodeName),M=(e,t)=>"false"===e.getContentEditable(t),R=(e,t)=>!e.isBlock(t)&&E(e.schema.getWhitespaceElements(),t.nodeName),P=(e,t)=>((e,t)=>{const n=(e=>y(e.dom.childNodes,k))(e);return n.length>0&&t<n.length?T(n[t],0):T(e,t)})(k(e),t),D=(e,t,n,o,r,s=!0)=>{let a=s?t(!1):n;for(;a;){const n=M(e,a);if(n||R(e,a)){if(n?o.cef(a):o.boundary(a))break;a=t(!0)}else{if(I(e,a)){if(o.boundary(a))break}else 3===a.nodeType&&o.text(a);if(a===r)break;a=t(!1)}}},W=(e,t,n,o,r)=>{if(((e,t)=>I(e,t)||M(e,t)||R(e,t)||((e,t)=>"true"===e.getContentEditable(t)&&"false"===e.getContentEditableParent(t.parentNode))(e,t))(e,n))return;const s=e.getParent(o,e.isBlock),a=new F(n,s),l=r?a.next.bind(a):a.prev.bind(a);D(e,l,n,{boundary:d,cef:d,text:e=>{r?t.fOffset+=e.length:t.sOffset+=e.length,t.elements.push(k(e))}})},V=(e,t,n,o,r,s=!0)=>{const a=new F(n,t),l=[];let i={sOffset:0,fOffset:0,elements:[]};W(e,i,n,t,!1);const c=()=>(i.elements.length>0&&(l.push(i),i={sOffset:0,fOffset:0,elements:[]}),!1);return D(e,a.next.bind(a),n,{boundary:c,cef:e=>(c(),r&&l.push(...r.cef(e)),!1),text:e=>{i.elements.push(k(e)),r&&r.text(e,i)}},o,s),o&&W(e,i,o,t,!0),c(),l},$=(e,t)=>{const n=P(t.startContainer,t.startOffset),o=n.element.dom,r=P(t.endContainer,t.endOffset),s=r.element.dom;return V(e,t.commonAncestorContainer,o,s,{text:(e,t)=>{e===s?t.fOffset+=e.length-r.offset:e===o&&(t.sOffset+=n.offset)},cef:t=>{return((e,t)=>{const n=p.call(e,0);return n.sort(((e,t)=>((e,t)=>((e,t,n)=>0!=(e.compareDocumentPosition(t)&n))(e,t,Node.DOCUMENT_POSITION_PRECEDING))(e.elements[0].dom,t.elements[0].dom)?1:-1)),n})(v((n=k(t),((e,t)=>{const n=void 0===t?document:t.dom;return 1!==(o=n).nodeType&&9!==o.nodeType&&11!==o.nodeType||0===o.childElementCount?[]:y(n.querySelectorAll(e),k);var o})("*[contenteditable=true]",n)),(t=>{const n=t.dom;return V(e,n,n)})));var n}},!1)},j=(e,t)=>t.collapsed?[]:$(e,t),_=(e,t)=>{const n=e.createRng();return n.selectNode(t),j(e,n)},z=(e,t)=>v(t,(t=>{const n=t.elements,o=y(n,B).join(""),r=((e,t,n=0,o=e.length)=>{const r=t.regex;r.lastIndex=n;const s=[];let a;for(;a=r.exec(e);){const e=a[t.matchIndex],n=a.index+a[0].indexOf(e),l=n+e.length;if(l>o)break;s.push({start:n,finish:l}),r.lastIndex=l}return s})(o,e,t.sOffset,o.length-t.fOffset);return((e,t)=>{const n=(o=e,r=(e,n)=>{const o=B(n),r=e.last,s=r+o.length,a=v(t,((e,t)=>e.start<s&&e.finish>r?[{element:n,start:Math.max(r,e.start)-r,finish:Math.min(s,e.finish)-r,matchId:t}]:[]));return{results:e.results.concat(a),last:s}},s={results:[],last:0},w(o,((e,t)=>{s=r(s,e)})),s).results;var o,r,s;return((e,t)=>{if(0===e.length)return[];{let n=t(e[0]);const o=[];let r=[];for(let s=0,a=e.length;s<a;s++){const a=e[s],l=t(a);l!==n&&(o.push(r),r=[]),n=l,r.push(a)}return 0!==r.length&&o.push(r),o}})(n,(e=>e.matchId))})(n,r)})),U=(e,t)=>{b(e,((e,n)=>{b(e,(e=>{const o=k(t.cloneNode(!1));((e,t,n)=>{((e,t,n)=>{if(!(r(n)||a(n)||l(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+"")})(e.dom,t,n)})(o,"data-mce-index",n);const s=e.element.dom;if(s.length===e.finish&&0===e.start)A(e.element,o);else{s.length!==e.finish&&s.splitText(e.finish);const t=s.splitText(e.start);A(k(t),o)}}))}))},q=e=>{const t=e.getAttribute("data-mce-index");return"number"==typeof t?""+t:t},G=(e,t,n,o)=>{const r=e.dom.create("span",{"data-mce-bogus":1});r.className="mce-match-marker";const s=e.getBody();return te(e,t,!1),o?((e,t,n,o)=>{const r=n.getBookmark(),s=e.select("td[data-mce-selected],th[data-mce-selected]"),a=s.length>0?((e,t)=>v(t,(t=>_(e,t))))(e,s):j(e,n.getRng()),l=z(t,a);return U(l,o),n.moveToBookmark(r),l.length})(e.dom,n,e.selection,r):((e,t,n,o)=>{const r=_(e,n),s=z(t,r);return U(s,o),s.length})(e.dom,n,s,r)},K=e=>{const t=e.parentNode;e.firstChild&&t.insertBefore(e.firstChild,e),e.parentNode.removeChild(e)},H=(e,t)=>{const n=[],o=f.toArray(e.getBody().getElementsByTagName("span"));if(o.length)for(let e=0;e<o.length;e++){const r=q(o[e]);null!==r&&r.length&&r===t.toString()&&n.push(o[e])}return n},J=(e,t,n)=>{const o=t.get();let r=o.index;const s=e.dom;(n=!1!==n)?r+1===o.count?r=0:r++:r-1==-1?r=o.count-1:r--,s.removeClass(H(e,o.index),"mce-match-marker-selected");const a=H(e,r);return a.length?(s.addClass(H(e,r),"mce-match-marker-selected"),e.selection.scrollIntoView(a[0]),r):-1},L=(e,t)=>{const n=t.parentNode;e.remove(t),e.isEmpty(n)&&e.remove(n)},Q=(e,t,n,o,r,s)=>{const a=e.selection,l=((e,t)=>{const n="("+e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&").replace(/\s/g,"[^\\S\\r\\n\\uFEFF]")+")";return t?`(?:^|\\s|${h()})`+n+`(?=$|\\s|${h()})`:n})(n,r),i=a.isForward(),c={regex:new RegExp(l,o?"g":"gi"),matchIndex:1},d=G(e,t,c,s);if(g.browser.isSafari()&&a.setRng(a.getRng(),i),d){const a=J(e,t,!0);t.set({index:a,count:d,text:n,matchCase:o,wholeWord:r,inSelection:s})}return d},X=(e,t)=>{const n=J(e,t,!0);t.set({...t.get(),index:n})},Y=(e,t)=>{const n=J(e,t,!1);t.set({...t.get(),index:n})},Z=e=>{const t=q(e);return null!==t&&t.length>0},ee=(e,t,n,o,r)=>{const s=t.get(),a=s.index;let l,i=a;o=!1!==o;const c=e.getBody(),d=f.grep(f.toArray(c.getElementsByTagName("span")),Z);for(let t=0;t<d.length;t++){const c=q(d[t]);let u=l=parseInt(c,10);if(r||u===s.index){for(n.length?(d[t].firstChild.nodeValue=n,K(d[t])):L(e.dom,d[t]);d[++t];){if(u=parseInt(q(d[t]),10),u!==l){t--;break}L(e.dom,d[t])}o&&i--}else l>a&&d[t].setAttribute("data-mce-index",String(l-1))}return t.set({...s,count:r?0:s.count-1,index:i}),o?X(e,t):Y(e,t),!r&&t.get().count>0},te=(e,t,n)=>{let o,r;const s=t.get(),a=f.toArray(e.getBody().getElementsByTagName("span"));for(let e=0;e<a.length;e++){const t=q(a[e]);null!==t&&t.length&&(t===s.index.toString()&&(o||(o=a[e].firstChild),r=a[e].firstChild),K(a[e]))}if(t.set({...s,index:-1,count:0,text:""}),o&&r){const t=e.dom.createRng();return t.setStart(o,0),t.setEnd(r,r.data.length),!1!==n&&e.selection.setRng(t),t}},ne=(t,n)=>{const o=(()=>{const t=(t=>{const n=e(m.none()),o=()=>n.get().each(t);return{clear:()=>{o(),n.set(m.none())},isSet:()=>n.get().isSome(),get:()=>n.get(),set:e=>{o(),n.set(m.some(e))}}})(i);return{...t,on:e=>t.get().each(e)}})();t.undoManager.add();const r=f.trim(t.selection.getContent({format:"text"})),s=e=>{e.setEnabled("next",((e,t)=>t.get().count>1)(0,n)),e.setEnabled("prev",((e,t)=>t.get().count>1)(0,n))},a=(e,t)=>{w(["replace","replaceall","prev","next"],(n=>e.setEnabled(n,!t)))},l=(e,t)=>{g.browser.isSafari()&&g.deviceType.isTouch()&&("find"===t||"replace"===t||"replaceall"===t)&&e.focus(t)},c=e=>{te(t,n,!1),a(e,!0),s(e)},d=e=>{const o=e.getData(),r=n.get();if(o.findtext.length){if(r.text===o.findtext&&r.matchCase===o.matchcase&&r.wholeWord===o.wholewords)X(t,n);else{const r=Q(t,n,o.findtext,o.matchcase,o.wholewords,o.inselection);r<=0&&(e=>{t.windowManager.alert("Could not find the specified string.",(()=>{e.focus("findtext")}))})(e),a(e,0===r)}s(e)}else c(e)},u=n.get(),h={title:"Find and Replace",size:"normal",body:{type:"panel",items:[{type:"bar",items:[{type:"input",name:"findtext",placeholder:"Find",maximized:!0,inputMode:"search"},{type:"button",name:"prev",text:"Previous",icon:"action-prev",enabled:!1,borderless:!0},{type:"button",name:"next",text:"Next",icon:"action-next",enabled:!1,borderless:!0}]},{type:"input",name:"replacetext",placeholder:"Replace with",inputMode:"search"}]},buttons:[{type:"menu",name:"options",icon:"preferences",tooltip:"Preferences",align:"start",items:[{type:"togglemenuitem",name:"matchcase",text:"Match case"},{type:"togglemenuitem",name:"wholewords",text:"Find whole words only"},{type:"togglemenuitem",name:"inselection",text:"Find in selection"}]},{type:"custom",name:"find",text:"Find",primary:!0},{type:"custom",name:"replace",text:"Replace",enabled:!1},{type:"custom",name:"replaceall",text:"Replace all",enabled:!1}],initialData:{findtext:r,replacetext:"",wholewords:u.wholeWord,matchcase:u.matchCase,inselection:u.inSelection},onChange:(e,t)=>{"findtext"===t.name&&n.get().count>0&&c(e)},onAction:(e,o)=>{const r=e.getData();switch(o.name){case"find":d(e);break;case"replace":ee(t,n,r.replacetext)?s(e):c(e);break;case"replaceall":ee(t,n,r.replacetext,!0,!0),c(e);break;case"prev":Y(t,n),s(e);break;case"next":X(t,n),s(e);break;case"matchcase":case"wholewords":case"inselection":(e=>{const t=e.getData(),o=n.get();n.set({...o,matchCase:t.matchcase,wholeWord:t.wholewords,inSelection:t.inselection})})(e),c(e)}l(e,o.name)},onSubmit:e=>{d(e),l(e,"find")},onClose:()=>{t.focus(),te(t,n),t.undoManager.add()}};o.set(t.windowManager.open(h,{inline:"toolbar"}))},oe=(e,t)=>()=>{ne(e,t)};t.add("searchreplace",(t=>{const n=e({index:-1,count:0,text:"",matchCase:!1,wholeWord:!1,inSelection:!1});return((e,t)=>{e.addCommand("SearchReplace",(()=>{ne(e,t)}))})(t,n),((e,t)=>{e.ui.registry.addMenuItem("searchreplace",{text:"Find and replace...",shortcut:"Meta+F",onAction:oe(e,t),icon:"search"}),e.ui.registry.addButton("searchreplace",{tooltip:"Find and replace",onAction:oe(e,t),icon:"search"}),e.shortcuts.add("Meta+F","",oe(e,t))})(t,n),((e,t)=>({done:n=>te(e,t,n),find:(n,o,r,s=!1)=>Q(e,t,n,o,r,s),next:()=>X(e,t),prev:()=>Y(e,t),replace:(n,o,r)=>ee(e,t,n,o,r)}))(t,n)}))}();
4
+ !function(){"use strict";const e=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}};var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const n=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(n=o=e,(r=String).prototype.isPrototypeOf(n)||(null===(s=o.constructor)||void 0===s?void 0:s.name)===r.name)?"string":t;var n,o,r,s})(t)===e,o=e=>t=>typeof t===e,r=n("string"),s=n("array"),a=o("boolean"),l=o("number"),i=()=>{},c=e=>()=>e,d=c(!0),u=c("[!-#%-*,-\\/:;?@\\[-\\]_{}\xa1\xab\xb7\xbb\xbf;\xb7\u055a-\u055f\u0589\u058a\u05be\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f3a-\u0f3d\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1361-\u1368\u1400\u166d\u166e\u169b\u169c\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cd3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205e\u207d\u207e\u208d\u208e\u3008\u3009\u2768-\u2775\u27c5\u27c6\u27e6-\u27ef\u2983-\u2998\u29d8-\u29db\u29fc\u29fd\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00-\u2e2e\u2e30\u2e31\u3001-\u3003\u3008-\u3011\u3014-\u301f\u3030\u303d\u30a0\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uabeb\ufd3e\ufd3f\ufe10-\ufe19\ufe30-\ufe52\ufe54-\ufe61\ufe63\ufe68\ufe6a\ufe6b\uff01-\uff03\uff05-\uff0a\uff0c-\uff0f\uff1a\uff1b\uff1f\uff20\uff3b-\uff3d\uff3f\uff5b\uff5d\uff5f-\uff65]");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 null==e?m.none():m.some(e)}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 h=u;var g=tinymce.util.Tools.resolve("tinymce.Env"),f=tinymce.util.Tools.resolve("tinymce.util.Tools");const p=Array.prototype.slice,x=Array.prototype.push,y=(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},w=(e,t)=>{for(let n=0,o=e.length;n<o;n++)t(e[n],n)},b=(e,t)=>{for(let n=e.length-1;n>=0;n--)t(e[n],n)},v=(e,t)=>(e=>{const t=[];for(let n=0,o=e.length;n<o;++n){if(!s(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);x.apply(t,e[n])}return t})(y(e,t)),C=Object.hasOwnProperty,E=(e,t)=>C.call(e,t);"undefined"!=typeof window?window:Function("return this;")();const O=(3,e=>3===(e=>e.dom.nodeType)(e));const N=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},T=N,k=(e,t)=>({element:e,offset:t}),A=(e,t)=>{((e,t)=>{const n=(e=>m.from(e.dom.parentNode).map(T))(e);n.each((n=>{n.dom.insertBefore(t.dom,e.dom)}))})(e,t),((e,t)=>{e.dom.appendChild(t.dom)})(t,e)},S=((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}}})(O),B=e=>S.get(e);var F=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker");const I=(e,t)=>e.isBlock(t)||E(e.schema.getVoidElements(),t.nodeName),M=(e,t)=>"false"===e.getContentEditable(t),R=(e,t)=>!e.isBlock(t)&&E(e.schema.getWhitespaceElements(),t.nodeName),P=(e,t)=>((e,t)=>{const n=(e=>y(e.dom.childNodes,T))(e);return n.length>0&&t<n.length?k(n[t],0):k(e,t)})(T(e),t),D=(e,t,n,o,r,s=!0)=>{let a=s?t(!1):n;for(;a;){const n=M(e,a);if(n||R(e,a)){if(n?o.cef(a):o.boundary(a))break;a=t(!0)}else{if(I(e,a)){if(o.boundary(a))break}else 3===a.nodeType&&o.text(a);if(a===r)break;a=t(!1)}}},W=(e,t,n,o,r)=>{var s;if(((e,t)=>I(e,t)||M(e,t)||R(e,t)||((e,t)=>"true"===e.getContentEditable(t)&&t.parentNode&&"false"===e.getContentEditableParent(t.parentNode))(e,t))(e,n))return;const a=null!==(s=e.getParent(o,e.isBlock))&&void 0!==s?s:e.getRoot(),l=new F(n,a),i=r?l.next.bind(l):l.prev.bind(l);D(e,i,n,{boundary:d,cef:d,text:e=>{r?t.fOffset+=e.length:t.sOffset+=e.length,t.elements.push(T(e))}})},$=(e,t,n,o,r,s=!0)=>{const a=new F(n,t),l=[];let i={sOffset:0,fOffset:0,elements:[]};W(e,i,n,t,!1);const c=()=>(i.elements.length>0&&(l.push(i),i={sOffset:0,fOffset:0,elements:[]}),!1);return D(e,a.next.bind(a),n,{boundary:c,cef:e=>(c(),r&&l.push(...r.cef(e)),!1),text:e=>{i.elements.push(T(e)),r&&r.text(e,i)}},o,s),o&&W(e,i,o,t,!0),c(),l},V=(e,t)=>{const n=P(t.startContainer,t.startOffset),o=n.element.dom,r=P(t.endContainer,t.endOffset),s=r.element.dom;return $(e,t.commonAncestorContainer,o,s,{text:(e,t)=>{e===s?t.fOffset+=e.length-r.offset:e===o&&(t.sOffset+=n.offset)},cef:t=>{return((e,t)=>{const n=p.call(e,0);return n.sort(((e,t)=>((e,t)=>((e,t,n)=>0!=(e.compareDocumentPosition(t)&n))(e,t,Node.DOCUMENT_POSITION_PRECEDING))(e.elements[0].dom,t.elements[0].dom)?1:-1)),n})(v((n=T(t),((e,t)=>{const n=void 0===t?document:t.dom;return 1!==(o=n).nodeType&&9!==o.nodeType&&11!==o.nodeType||0===o.childElementCount?[]:y(n.querySelectorAll(e),T);var o})("*[contenteditable=true]",n)),(t=>{const n=t.dom;return $(e,n,n)})));var n}},!1)},j=(e,t)=>t.collapsed?[]:V(e,t),_=(e,t)=>{const n=e.createRng();return n.selectNode(t),j(e,n)},z=(e,t)=>v(t,(t=>{const n=t.elements,o=y(n,B).join(""),r=((e,t,n=0,o=e.length)=>{const r=t.regex;r.lastIndex=n;const s=[];let a;for(;a=r.exec(e);){const e=a[t.matchIndex],n=a.index+a[0].indexOf(e),l=n+e.length;if(l>o)break;s.push({start:n,finish:l}),r.lastIndex=l}return s})(o,e,t.sOffset,o.length-t.fOffset);return((e,t)=>{const n=(o=e,r=(e,n)=>{const o=B(n),r=e.last,s=r+o.length,a=v(t,((e,t)=>e.start<s&&e.finish>r?[{element:n,start:Math.max(r,e.start)-r,finish:Math.min(s,e.finish)-r,matchId:t}]:[]));return{results:e.results.concat(a),last:s}},s={results:[],last:0},w(o,((e,t)=>{s=r(s,e)})),s).results;var o,r,s;return((e,t)=>{if(0===e.length)return[];{let n=t(e[0]);const o=[];let r=[];for(let s=0,a=e.length;s<a;s++){const a=e[s],l=t(a);l!==n&&(o.push(r),r=[]),n=l,r.push(a)}return 0!==r.length&&o.push(r),o}})(n,(e=>e.matchId))})(n,r)})),U=(e,t)=>{b(e,((e,n)=>{b(e,(e=>{const o=T(t.cloneNode(!1));((e,t,n)=>{((e,t,n)=>{if(!(r(n)||a(n)||l(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+"")})(e.dom,t,n)})(o,"data-mce-index",n);const s=e.element.dom;if(s.length===e.finish&&0===e.start)A(e.element,o);else{s.length!==e.finish&&s.splitText(e.finish);const t=s.splitText(e.start);A(T(t),o)}}))}))},q=e=>e.getAttribute("data-mce-index"),G=(e,t,n,o)=>{const r=e.dom.create("span",{"data-mce-bogus":1});r.className="mce-match-marker";const s=e.getBody();return te(e,t,!1),o?((e,t,n,o)=>{const r=n.getBookmark(),s=e.select("td[data-mce-selected],th[data-mce-selected]"),a=s.length>0?((e,t)=>v(t,(t=>_(e,t))))(e,s):j(e,n.getRng()),l=z(t,a);return U(l,o),n.moveToBookmark(r),l.length})(e.dom,n,e.selection,r):((e,t,n,o)=>{const r=_(e,n),s=z(t,r);return U(s,o),s.length})(e.dom,n,s,r)},K=e=>{var t;const n=e.parentNode;e.firstChild&&n.insertBefore(e.firstChild,e),null===(t=e.parentNode)||void 0===t||t.removeChild(e)},H=(e,t)=>{const n=[],o=f.toArray(e.getBody().getElementsByTagName("span"));if(o.length)for(let e=0;e<o.length;e++){const r=q(o[e]);null!==r&&r.length&&r===t.toString()&&n.push(o[e])}return n},J=(e,t,n)=>{const o=t.get();let r=o.index;const s=e.dom;n?r+1===o.count?r=0:r++:r-1==-1?r=o.count-1:r--,s.removeClass(H(e,o.index),"mce-match-marker-selected");const a=H(e,r);return a.length?(s.addClass(H(e,r),"mce-match-marker-selected"),e.selection.scrollIntoView(a[0]),r):-1},L=(e,t)=>{const n=t.parentNode;e.remove(t),n&&e.isEmpty(n)&&e.remove(n)},Q=(e,t,n,o,r,s)=>{const a=e.selection,l=((e,t)=>{const n="("+e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&").replace(/\s/g,"[^\\S\\r\\n\\uFEFF]")+")";return t?`(?:^|\\s|${h()})`+n+`(?=$|\\s|${h()})`:n})(n,r),i=a.isForward(),c={regex:new RegExp(l,o?"g":"gi"),matchIndex:1},d=G(e,t,c,s);if(g.browser.isSafari()&&a.setRng(a.getRng(),i),d){const a=J(e,t,!0);t.set({index:a,count:d,text:n,matchCase:o,wholeWord:r,inSelection:s})}return d},X=(e,t)=>{const n=J(e,t,!0);t.set({...t.get(),index:n})},Y=(e,t)=>{const n=J(e,t,!1);t.set({...t.get(),index:n})},Z=e=>{const t=q(e);return null!==t&&t.length>0},ee=(e,t,n,o,r)=>{const s=t.get(),a=s.index;let l,i=a;o=!1!==o;const c=e.getBody(),d=f.grep(f.toArray(c.getElementsByTagName("span")),Z);for(let t=0;t<d.length;t++){const c=q(d[t]);let u=l=parseInt(c,10);if(r||u===s.index){for(n.length?(d[t].innerText=n,K(d[t])):L(e.dom,d[t]);d[++t];){if(u=parseInt(q(d[t]),10),u!==l){t--;break}L(e.dom,d[t])}o&&i--}else l>a&&d[t].setAttribute("data-mce-index",String(l-1))}return t.set({...s,count:r?0:s.count-1,index:i}),o?X(e,t):Y(e,t),!r&&t.get().count>0},te=(e,t,n)=>{let o,r;const s=t.get(),a=f.toArray(e.getBody().getElementsByTagName("span"));for(let e=0;e<a.length;e++){const t=q(a[e]);null!==t&&t.length&&(t===s.index.toString()&&(o||(o=a[e].firstChild),r=a[e].firstChild),K(a[e]))}if(t.set({...s,index:-1,count:0,text:""}),o&&r){const t=e.dom.createRng();return t.setStart(o,0),t.setEnd(r,r.data.length),!1!==n&&e.selection.setRng(t),t}},ne=(t,n)=>{const o=(()=>{const t=(t=>{const n=e(m.none()),o=()=>n.get().each(t);return{clear:()=>{o(),n.set(m.none())},isSet:()=>n.get().isSome(),get:()=>n.get(),set:e=>{o(),n.set(m.some(e))}}})(i);return{...t,on:e=>t.get().each(e)}})();t.undoManager.add();const r=f.trim(t.selection.getContent({format:"text"})),s=e=>{e.setEnabled("next",((e,t)=>t.get().count>1)(0,n)),e.setEnabled("prev",((e,t)=>t.get().count>1)(0,n))},a=(e,t)=>{w(["replace","replaceall","prev","next"],(n=>e.setEnabled(n,!t)))},l=(e,t)=>{g.browser.isSafari()&&g.deviceType.isTouch()&&("find"===t||"replace"===t||"replaceall"===t)&&e.focus(t)},c=e=>{te(t,n,!1),a(e,!0),s(e)},d=e=>{const o=e.getData(),r=n.get();if(o.findtext.length){if(r.text===o.findtext&&r.matchCase===o.matchcase&&r.wholeWord===o.wholewords)X(t,n);else{const r=Q(t,n,o.findtext,o.matchcase,o.wholewords,o.inselection);r<=0&&(e=>{t.windowManager.alert("Could not find the specified string.",(()=>{e.focus("findtext")}))})(e),a(e,0===r)}s(e)}else c(e)},u=n.get(),h={title:"Find and Replace",size:"normal",body:{type:"panel",items:[{type:"bar",items:[{type:"input",name:"findtext",placeholder:"Find",maximized:!0,inputMode:"search"},{type:"button",name:"prev",text:"Previous",icon:"action-prev",enabled:!1,borderless:!0},{type:"button",name:"next",text:"Next",icon:"action-next",enabled:!1,borderless:!0}]},{type:"input",name:"replacetext",placeholder:"Replace with",inputMode:"search"}]},buttons:[{type:"menu",name:"options",icon:"preferences",tooltip:"Preferences",align:"start",items:[{type:"togglemenuitem",name:"matchcase",text:"Match case"},{type:"togglemenuitem",name:"wholewords",text:"Find whole words only"},{type:"togglemenuitem",name:"inselection",text:"Find in selection"}]},{type:"custom",name:"find",text:"Find",primary:!0},{type:"custom",name:"replace",text:"Replace",enabled:!1},{type:"custom",name:"replaceall",text:"Replace all",enabled:!1}],initialData:{findtext:r,replacetext:"",wholewords:u.wholeWord,matchcase:u.matchCase,inselection:u.inSelection},onChange:(e,t)=>{"findtext"===t.name&&n.get().count>0&&c(e)},onAction:(e,o)=>{const r=e.getData();switch(o.name){case"find":d(e);break;case"replace":ee(t,n,r.replacetext)?s(e):c(e);break;case"replaceall":ee(t,n,r.replacetext,!0,!0),c(e);break;case"prev":Y(t,n),s(e);break;case"next":X(t,n),s(e);break;case"matchcase":case"wholewords":case"inselection":(e=>{const t=e.getData(),o=n.get();n.set({...o,matchCase:t.matchcase,wholeWord:t.wholewords,inSelection:t.inselection})})(e),c(e)}l(e,o.name)},onSubmit:e=>{d(e),l(e,"find")},onClose:()=>{t.focus(),te(t,n),t.undoManager.add()}};o.set(t.windowManager.open(h,{inline:"toolbar"}))},oe=(e,t)=>()=>{ne(e,t)};t.add("searchreplace",(t=>{const n=e({index:-1,count:0,text:"",matchCase:!1,wholeWord:!1,inSelection:!1});return((e,t)=>{e.addCommand("SearchReplace",(()=>{ne(e,t)}))})(t,n),((e,t)=>{e.ui.registry.addMenuItem("searchreplace",{text:"Find and replace...",shortcut:"Meta+F",onAction:oe(e,t),icon:"search"}),e.ui.registry.addButton("searchreplace",{tooltip:"Find and replace",onAction:oe(e,t),icon:"search"}),e.shortcuts.add("Meta+F","",oe(e,t))})(t,n),((e,t)=>({done:n=>te(e,t,n),find:(n,o,r,s=!1)=>Q(e,t,n,o,r,s),next:()=>X(e,t),prev:()=>Y(e,t),replace:(n,o,r)=>ee(e,t,n,o,r)}))(t,n)}))}();
@@ -1,4 +1,4 @@
1
1
  /**
2
- * TinyMCE version 6.1.2 (2022-07-29)
2
+ * TinyMCE version 6.2.0 (2022-09-08)
3
3
  */
4
- !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=l=e,(n=String).prototype.isPrototypeOf(o)||(null===(r=l.constructor)||void 0===r?void 0:r.name)===n.name)?"string":t;var o,l,n,r})(t)===e,o=e=>t=>typeof t===e,l=t("string"),n=t("array"),r=o("boolean"),a=(void 0,e=>undefined===e);const s=e=>!(e=>null==e)(e),c=o("function"),i=o("number"),m=()=>{},d=e=>()=>e,u=e=>e,p=(e,t)=>e===t;function b(e,...t){return(...o)=>{const l=t.concat(o);return e.apply(null,l)}}const g=d(!1),h=d(!0);class f{constructor(e,t){this.tag=e,this.value=t}static some(e){return new f(!0,e)}static none(){return f.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?f.some(e(this.value)):f.none()}bind(e){return this.tag?e(this.value):f.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:f.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 s(e)?f.some(e):f.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()"}}f.singletonNone=new f(!1);const y=Object.keys,w=Object.hasOwnProperty,S=(e,t)=>{const o=y(e);for(let l=0,n=o.length;l<n;l++){const n=o[l];t(e[n],n)}},C=(e,t)=>{const o={};var l;return((e,t,o,l)=>{S(e,((e,n)=>{(t(e,n)?o:l)(e,n)}))})(e,t,(l=o,(e,t)=>{l[t]=e}),m),o},v=e=>y(e).length,T=(e,t)=>x(e,t)?f.from(e[t]):f.none(),x=(e,t)=>w.call(e,t),A=(e,t)=>x(e,t)&&void 0!==e[t]&&null!==e[t],R=Array.prototype.indexOf,_=Array.prototype.push,O=(e,t)=>((e,t)=>R.call(e,t))(e,t)>-1,D=(e,t)=>{for(let o=0,l=e.length;o<l;o++)if(t(e[o],o))return!0;return!1},I=(e,t)=>{const o=[];for(let l=0;l<e;l++)o.push(t(l));return o},M=(e,t)=>{const o=e.length,l=new Array(o);for(let n=0;n<o;n++){const o=e[n];l[n]=t(o,n)}return l},N=(e,t)=>{for(let o=0,l=e.length;o<l;o++)t(e[o],o)},P=(e,t)=>{const o=[];for(let l=0,n=e.length;l<n;l++){const n=e[l];t(n,l)&&o.push(n)}return o},k=(e,t,o)=>(N(e,((e,l)=>{o=t(o,e,l)})),o),B=(e,t)=>((e,t,o)=>{for(let l=0,n=e.length;l<n;l++){const n=e[l];if(t(n,l))return f.some(n);if(o(n,l))break}return f.none()})(e,t,g),E=(e,t)=>(e=>{const t=[];for(let o=0,l=e.length;o<l;++o){if(!n(e[o]))throw new Error("Arr.flatten item "+o+" was not an array, input: "+e);_.apply(t,e[o])}return t})(M(e,t)),F=(e,t)=>{for(let o=0,l=e.length;o<l;++o)if(!0!==t(e[o],o))return!1;return!0},q=(e,t)=>t>=0&&t<e.length?f.some(e[t]):f.none(),L=(e,t)=>{for(let o=0;o<e.length;o++){const l=t(e[o],o);if(l.isSome())return l}return f.none()},H=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},j={fromHtml:(e,t)=>{const o=(t||document).createElement("div");if(o.innerHTML=e,!o.hasChildNodes()||o.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return H(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return H(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return H(o)},fromDom:H,fromPoint:(e,t,o)=>f.from(e.dom.elementFromPoint(t,o)).map(H)};"undefined"!=typeof window?window:Function("return this;")();const V=e=>e.dom.nodeName.toLowerCase(),z=e=>e.dom.nodeType,W=e=>t=>z(t)===e,$=W(1),U=W(3),G=W(9),K=W(11),J=e=>t=>$(t)&&V(t)===e,Q=(e,t)=>{const o=e.dom;if(1!==o.nodeType)return!1;{const e=o;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")}},X=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,Y=(e,t)=>e.dom===t.dom,Z=Q,ee=e=>G(e)?e:j.fromDom(e.dom.ownerDocument),te=e=>f.from(e.dom.parentNode).map(j.fromDom),oe=e=>f.from(e.dom.nextSibling).map(j.fromDom),le=e=>M(e.dom.childNodes,j.fromDom),ne=c(Element.prototype.attachShadow)&&c(Node.prototype.getRootNode)?e=>j.fromDom(e.dom.getRootNode()):ee,re=e=>j.fromDom(e.dom.host),ae=e=>{const t=U(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return(e=>{const t=ne(e);return K(o=t)&&s(o.dom.host)?f.some(t):f.none();var o})(j.fromDom(t)).fold((()=>o.body.contains(t)),(l=ae,n=re,e=>l(n(e))));var l,n},se=(e,t)=>{let o=[];return N(le(e),(e=>{t(e)&&(o=o.concat([e])),o=o.concat(se(e,t))})),o},ce=(e,t)=>((e,o)=>P(le(e),(e=>Q(e,t))))(e),ie=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return X(o)?[]:M(o.querySelectorAll(e),j.fromDom)})(t,e),me=(e,t,o)=>{let l=e.dom;const n=c(o)?o:g;for(;l.parentNode;){l=l.parentNode;const e=j.fromDom(l);if(t(e))return f.some(e);if(n(e))break}return f.none()},de=(e,t,o)=>me(e,(e=>Q(e,t)),o),ue=(e,t)=>((e,o)=>B(e.dom.childNodes,(e=>{return o=j.fromDom(e),Q(o,t);var o})).map(j.fromDom))(e),pe=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return X(o)?f.none():f.from(o.querySelector(e)).map(j.fromDom)})(t,e),be=(e,t,o)=>((e,t,o,l,n)=>((e,t)=>Q(e,t))(o,l)?f.some(o):c(n)&&n(o)?f.none():t(o,l,n))(0,de,e,t,o),ge=(e,t,o)=>{if(!(l(o)||r(o)||i(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")},he=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},fe=(e,t)=>f.from(he(e,t)),ye=(e,t)=>{e.dom.removeAttribute(t)},we=(e,t,o=p)=>e.exists((e=>o(e,t))),Se=(e,t,o)=>e.isSome()&&t.isSome()?f.some(o(e.getOrDie(),t.getOrDie())):f.none(),Ce=(e,t)=>((e,t,o)=>""===t||e.length>=t.length&&e.substr(0,0+t.length)===t)(e,t),ve=(Te=/^\s+|\s+$/g,e=>e.replace(Te,""));var Te;const xe=e=>e.length>0,Ae=e=>void 0!==e.style&&c(e.style.getPropertyValue),Re=(e,t)=>{const o=e.dom,l=window.getComputedStyle(o).getPropertyValue(t);return""!==l||ae(e)?l:_e(o,t)},_e=(e,t)=>Ae(e)?e.style.getPropertyValue(t):"",Oe=(e,t)=>{const o=e.dom,l=_e(o,t);return f.from(l).filter((e=>e.length>0))},De=(e,t,o=0)=>fe(e,t).map((e=>parseInt(e,10))).getOr(o),Ie=(e,t)=>Me(e,t,h),Me=(e,t,o)=>E(le(e),(e=>Q(e,t)?o(e)?[e]:[]:Me(e,t,o))),Ne=["tfoot","thead","tbody","colgroup"],Pe=(e,t,o)=>({element:e,rowspan:t,colspan:o}),ke=(e,t,o)=>({element:e,cells:t,section:o}),Be=(e,t)=>be(e,"table",t),Ee=e=>Ie(e,"tr"),Fe=e=>Be(e).fold(d([]),(e=>ce(e,"colgroup"))),qe=e=>te(e).map((e=>{const t=V(e);return(e=>O(Ne,e))(t)?t:"tbody"})).getOr("tbody"),Le=e=>fe(e,"data-snooker-locked-cols").bind((e=>f.from(e.match(/\d+/g)))).map((e=>((e,t)=>{const o={};for(let l=0,n=e.length;l<n;l++){const n=e[l];o[String(n)]=t(n,l)}return o})(e,h))),He=(e,t)=>e+","+t,je=e=>{const t={},o=[];var l;const n=(l=e,q(l,0)).map((e=>e.element)).bind(Be).bind(Le).getOr({});let r=0,a=0,s=0;const{pass:c,fail:i}=((e,t)=>{const o=[],l=[];for(let t=0,r=e.length;t<r;t++){const r=e[t];(n=r,"colgroup"===n.section?o:l).push(r)}var n;return{pass:o,fail:l}})(e);N(i,(e=>{const l=[];N(e.cells,(e=>{let o=0;for(;void 0!==t[He(s,o)];)o++;const r=A(n,o.toString()),c=((e,t,o,l,n,r)=>({element:e,rowspan:t,colspan:o,row:l,column:n,isLocked:r}))(e.element,e.rowspan,e.colspan,s,o,r);for(let l=0;l<e.colspan;l++)for(let n=0;n<e.rowspan;n++){const e=o+l,r=He(s+n,e);t[r]=c,a=Math.max(a,e+1)}l.push(c)})),r++,o.push(ke(e.element,l,e.section)),s++}));const{columns:m,colgroups:d}=(e=>q(e,e.length-1))(c).map((e=>{const t=(e=>{const t={};let o=0;return N(e.cells,(e=>{const l=e.colspan;I(l,(n=>{const r=o+n;t[r]=((e,t,o)=>({element:e,colspan:t,column:o}))(e.element,l,r)})),o+=l})),t})(e),o=((e,t)=>({element:e,columns:t}))(e.element,((e,t)=>{const o=[];return S(e,((e,l)=>{o.push(t(e,l))})),o})(t,u));return{colgroups:[o],columns:t}})).getOrThunk((()=>({colgroups:[],columns:{}}))),p=((e,t)=>({rows:e,columns:t}))(r,a);return{grid:p,access:t,all:o,columns:m,colgroups:d}},Ve=e=>{const t=(e=>{const t=Ee(e);return((e,t)=>M(e,(e=>{if("colgroup"===V(e)){const t=M((e=>Q(e,"colgroup")?ce(e,"col"):E(Fe(e),(e=>ce(e,"col"))))(e),(e=>{const t=De(e,"span",1);return Pe(e,1,t)}));return ke(e,t,"colgroup")}{const o=M((e=>Ie(e,"th,td"))(e),(e=>{const t=De(e,"rowspan",1),o=De(e,"colspan",1);return Pe(e,t,o)}));return ke(e,o,t(e))}})))([...Fe(e),...t],qe)})(e);return je(t)},ze=(e,t,o)=>f.from(e.access[He(t,o)]),We=(e,t,o)=>{const l=((e,t)=>{const o=E(e.all,(e=>e.cells));return P(o,t)})(e,(e=>o(t,e.element)));return l.length>0?f.some(l[0]):f.none()},$e=(e,t)=>f.from(e.columns[t]);var Ue=tinymce.util.Tools.resolve("tinymce.util.Tools");const Ge=(e,t,o)=>((t,l)=>{for(let n=0;n<l.length;n++){const r=e.getStyle(l[n],o);if(void 0===t&&(t=r),t!==r)return""}return t})(void 0,e.select("td,th",t)),Ke=(e,t,o)=>{Ue.each("left center right".split(" "),(l=>{l!==o&&e.formatter.remove("align"+l,{},t)})),o&&e.formatter.apply("align"+o,{},t)},Je=(e,t,o)=>{e.dispatch("TableModified",{...o,table:t})},Qe=(e,t,o)=>((e,t)=>(e=>{const t=parseFloat(e);return isNaN(t)?f.none():f.some(t)})(e).getOr(t))(Re(e,t),o),Xe=e=>((e,t)=>{const o=e.dom,l=o.getBoundingClientRect().width||o.offsetWidth;return"border-box"===t?l:((e,t,o,l)=>t-Qe(e,"padding-left",0)-Qe(e,"padding-right",0)-Qe(e,"border-left-width",0)-Qe(e,"border-right-width",0))(e,l)})(e,"content-box");var Ye=tinymce.util.Tools.resolve("tinymce.Env");const Ze=I(5,(e=>{const t=`${e+1}px`;return{title:t,value:t}})),et=M(["Solid","Dotted","Dashed","Double","Groove","Ridge","Inset","Outset","None","Hidden"],(e=>({title:e,value:e.toLowerCase()}))),tt="100%",ot=e=>{var t;const o=e.dom,l=null!==(t=o.getParent(e.selection.getStart(),o.isBlock))&&void 0!==t?t:e.getBody();return Xe(j.fromDom(l))+"px"},lt=e=>t=>t.options.get(e),nt=lt("table_sizing_mode"),rt=lt("table_border_widths"),at=lt("table_border_styles"),st=lt("table_cell_advtab"),ct=lt("table_row_advtab"),it=lt("table_advtab"),mt=lt("table_appearance_options"),dt=lt("table_grid"),ut=lt("table_style_by_css"),pt=lt("table_cell_class_list"),bt=lt("table_row_class_list"),gt=lt("table_class_list"),ht=lt("table_toolbar"),ft=lt("table_background_color_map"),yt=lt("table_border_color_map"),wt=e=>"fixed"===nt(e),St=e=>"responsive"===nt(e),Ct=e=>{const t=e.options,o=t.get("table_default_styles");return t.isSet("table_default_styles")?o:((e,t)=>St(e)||!ut(e)?t:wt(e)?{...t,width:ot(e)}:{...t,width:tt})(e,o)},vt=e=>{const t=e.options,o=t.get("table_default_attributes");return t.isSet("table_default_attributes")?o:((e,t)=>St(e)||ut(e)?t:wt(e)?{...t,width:ot(e)}:{...t,width:tt})(e,o)},Tt=e=>t=>Y(t,(e=>j.fromDom(e.getBody()))(e)),xt=e=>/^\d+(\.\d+)?$/.test(e)?e+"px":e,At=e=>j.fromDom(e.selection.getStart()),Rt=(e,t)=>t.column>=e.startCol&&t.column+t.colspan-1<=e.finishCol&&t.row>=e.startRow&&t.row+t.rowspan-1<=e.finishRow,_t=(e,t,o)=>((e,t,o)=>{const l=We(e,t,Y),n=We(e,o,Y);return l.bind((e=>n.map((t=>{return o=e,l=t,{startRow:Math.min(o.row,l.row),startCol:Math.min(o.column,l.column),finishRow:Math.max(o.row+o.rowspan-1,l.row+l.rowspan-1),finishCol:Math.max(o.column+o.colspan-1,l.column+l.colspan-1)};var o,l}))))})(e,t,o).bind((t=>((e,t)=>{let o=!0;const l=b(Rt,t);for(let n=t.startRow;n<=t.finishRow;n++)for(let r=t.startCol;r<=t.finishCol;r++)o=o&&ze(e,n,r).exists(l);return o?f.some(t):f.none()})(e,t))),Ot=Ve,Dt=(e,t)=>{te(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},It=(e,t)=>{oe(e).fold((()=>{te(e).each((e=>{Mt(e,t)}))}),(e=>{Dt(e,t)}))},Mt=(e,t)=>{e.dom.appendChild(t.dom)},Nt=(e,t)=>{N(t,((o,l)=>{const n=0===l?e:t[l-1];It(n,o)}))},Pt=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},kt=((e,t)=>{const o=t=>e(t)?f.from(t.dom.nodeValue):f.none();return{get:t=>{if(!e(t))throw new Error("Can only get text value of a text node");return o(t).getOr("")},getOption:o,set:(t,o)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=o}}})(U);var Bt=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","li","table","thead","tbody","tfoot","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"];const Et=(e,t,o,l)=>{const n=t(e,o);return r=(o,l)=>{const n=t(e,l);return Ft(e,o,n)},a=n,((e,t)=>{for(let o=e.length-1;o>=0;o--)t(e[o],o)})(l,((e,t)=>{a=r(a,e)})),a;var r,a},Ft=(e,t,o)=>t.bind((t=>o.filter(b(e.eq,t)))),qt={up:d({selector:de,closest:be,predicate:me,all:(e,t)=>{const o=c(t)?t:g;let l=e.dom;const n=[];for(;null!==l.parentNode&&void 0!==l.parentNode;){const e=l.parentNode,t=j.fromDom(e);if(n.push(t),!0===o(t))break;l=e}return n}}),down:d({selector:ie,predicate:se}),styles:d({get:Re,getRaw:Oe,set:(e,t,o)=>{((e,t,o)=>{if(!l(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);Ae(e)&&e.style.setProperty(t,o)})(e.dom,t,o)},remove:(e,t)=>{((e,t)=>{Ae(e)&&e.style.removeProperty(t)})(e.dom,t),we(fe(e,"style").map(ve),"")&&ye(e,"style")}}),attrs:d({get:he,set:(e,t,o)=>{ge(e.dom,t,o)},remove:ye,copyTo:(e,t)=>{((e,t)=>{const o=e.dom;S(t,((e,t)=>{ge(o,t,e)}))})(t,k(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}))}}),insert:d({before:Dt,after:It,afterAll:Nt,append:Mt,appendAll:(e,t)=>{N(t,(t=>{Mt(e,t)}))},prepend:(e,t)=>{(e=>((e,t)=>{const o=e.dom.childNodes;return f.from(o[0]).map(j.fromDom)})(e))(e).fold((()=>{Mt(e,t)}),(o=>{e.dom.insertBefore(t.dom,o.dom)}))},wrap:(e,t)=>{Dt(e,t),Mt(t,e)}}),remove:d({unwrap:e=>{const t=le(e);t.length>0&&Nt(e,t),Pt(e)},remove:Pt}),create:d({nu:j.fromTag,clone:e=>j.fromDom(e.dom.cloneNode(!1)),text:j.fromText}),query:d({comparePosition:(e,t)=>e.dom.compareDocumentPosition(t.dom),prevSibling:e=>f.from(e.dom.previousSibling).map(j.fromDom),nextSibling:oe}),property:d({children:le,name:V,parent:te,document:e=>ee(e).dom,isText:U,isComment:e=>8===z(e)||"#comment"===V(e),isElement:$,isSpecial:e=>{const t=V(e);return O(["script","noscript","iframe","noframes","noembed","title","style","textarea","xmp"],t)},getLanguage:e=>$(e)?fe(e,"lang"):f.none(),getText:e=>kt.get(e),setText:(e,t)=>kt.set(e,t),isBoundary:e=>!!$(e)&&("body"===V(e)||O(Bt,V(e))),isEmptyTag:e=>!!$(e)&&O(["br","img","hr","input"],V(e)),isNonEditable:e=>$(e)&&"false"===he(e,"contenteditable")}),eq:Y,is:Z},Lt=e=>de(e,"table"),Ht=(e,t,o)=>pe(e,t).bind((t=>pe(e,o).bind((e=>{return(o=Lt,l=[t,e],((e,t,o)=>o.length>0?((e,t,o,l)=>l(e,t,o[0],o.slice(1)))(e,t,o,Et):f.none())(qt,((e,t)=>o(t)),l)).map((o=>({first:t,last:e,table:o})));var o,l})))),jt=e=>M(e,j.fromDom),Vt={selected:"data-mce-selected",selectedSelector:"td[data-mce-selected],th[data-mce-selected]",firstSelected:"data-mce-first-selected",firstSelectedSelector:"td[data-mce-first-selected],th[data-mce-first-selected]",lastSelected:"data-mce-last-selected",lastSelectedSelector:"td[data-mce-last-selected],th[data-mce-last-selected]"},zt=e=>(t,o)=>{const l=V(t),n="col"===l||"colgroup"===l?Be(r=t).bind((e=>((e,t)=>((e,t)=>{const o=ie(e,t);return o.length>0?f.some(o):f.none()})(e,t))(e,Vt.firstSelectedSelector))).fold(d(r),(e=>e[0])):t;var r;return be(n,e,o)},Wt=zt("th,td,caption"),$t=zt("th,td"),Ut=e=>jt(e.model.table.getSelectedCells()),Gt=(e,t)=>{const o=$t(e),l=o.bind((e=>Be(e))).map((e=>Ee(e)));return Se(o,l,((e,o)=>P(o,(o=>D(jt(o.dom.cells),(o=>"1"===he(o,t)||Y(o,e))))))).getOr([])},Kt=[{text:"None",value:""},{text:"Top",value:"top"},{text:"Middle",value:"middle"},{text:"Bottom",value:"bottom"}],Jt=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Qt=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Xt=e=>{return(t=e,"#",Ce(t,"#")?((e,t)=>e.substring(t))(t,"#".length):t).toUpperCase();var t},Yt=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},Zt=e=>({value:Yt(e.red)+Yt(e.green)+Yt(e.blue)}),eo=/^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i,to=/^\s*rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?(?:\.\d+)?)\s*\)\s*$/i,oo=(e,t,o,l)=>({red:e,green:t,blue:o,alpha:l}),lo=(e,t,o,l)=>{const n=parseInt(e,10),r=parseInt(t,10),a=parseInt(o,10),s=parseFloat(l);return oo(n,r,a,s)},no=e=>{if("transparent"===e)return f.some(oo(0,0,0,0));const t=eo.exec(e);if(null!==t)return f.some(lo(t[1],t[2],t[3],"1"));const o=to.exec(e);return null!==o?f.some(lo(o[1],o[2],o[3],o[4])):f.none()},ro=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},ao=(e,t,o)=>l=>{const n=(e=>{const t=ro(f.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(f.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(f.some(e))}}})((e=>e.unbind())),r=!xe(o),a=()=>{const a=Ut(e),s=l=>e.formatter.match(t,{value:o},l.dom,r);r?(l.setActive(!D(a,s)),n.set(e.formatter.formatChanged(t,(e=>l.setActive(!e)),!0))):(l.setActive(F(a,s)),n.set(e.formatter.formatChanged(t,l.setActive,!1,{value:o})))};return e.initialized?a():e.on("init",a),n.clear},so=e=>A(e,"menu"),co=e=>M(e,(e=>{const t=e.text||e.title;return so(e)?{text:t,items:co(e.menu)}:{text:t,value:e.value}})),io=(e,t,o,l)=>M(t,(t=>{const n=t.text||t.title;return so(t)?{type:"nestedmenuitem",text:n,getSubmenuItems:()=>io(e,t.menu,o,l)}:{text:n,type:"togglemenuitem",onAction:()=>l(t.value),onSetup:ao(e,o,t.value)}})),mo=(e,t)=>o=>{e.execCommand("mceTableApplyCellStyle",!1,{[t]:o})},uo=e=>E(e,(e=>so(e)?[{...e,menu:uo(e.menu)}]:xe(e.value)?[e]:[])),po=(e,t,o,l)=>n=>n(io(e,t,o,l)),bo=(e,t,o)=>{const l=M(t,(e=>{return{text:e.title,value:"#"+(o=e.value,(t=o,(e=>Jt.test(e)||Qt.test(e))(t)?f.some({value:Xt(t)}):f.none()).orThunk((()=>no(o).map(Zt))).getOrThunk((()=>{const e=document.createElement("canvas");e.height=1,e.width=1;const t=e.getContext("2d");t.clearRect(0,0,e.width,e.height),t.fillStyle="#FFFFFF",t.fillStyle=o,t.fillRect(0,0,1,1);const l=t.getImageData(0,0,1,1).data,n=l[0],r=l[1],a=l[2],s=l[3];return Zt(oo(n,r,a,s))}))).value,type:"choiceitem"};var t,o}));return[{type:"fancymenuitem",fancytype:"colorswatch",initData:{colors:l.length>0?l:void 0,allowCustomColors:!1},onAction:t=>{const l="remove"===t.value?"":t.value;e.execCommand("mceTableApplyCellStyle",!1,{[o]:l})}}]},go=e=>()=>{const t="header"===e.queryCommandValue("mceTableRowType")?"body":"header";e.execCommand("mceTableRowType",!1,{type:t})},ho=e=>()=>{const t="th"===e.queryCommandValue("mceTableColType")?"td":"th";e.execCommand("mceTableColType",!1,{type:t})},fo=[{name:"width",type:"input",label:"Width"},{name:"height",type:"input",label:"Height"},{name:"celltype",type:"listbox",label:"Cell type",items:[{text:"Cell",value:"td"},{text:"Header cell",value:"th"}]},{name:"scope",type:"listbox",label:"Scope",items:[{text:"None",value:""},{text:"Row",value:"row"},{text:"Column",value:"col"},{text:"Row group",value:"rowgroup"},{text:"Column group",value:"colgroup"}]},{name:"halign",type:"listbox",label:"Horizontal align",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{name:"valign",type:"listbox",label:"Vertical align",items:Kt}],yo=e=>fo.concat((e=>{const t=co(pt(e));return t.length>0?f.some({name:"class",type:"listbox",label:"Class",items:t}):f.none()})(e).toArray()),wo=(e,t)=>{const o=[{name:"borderstyle",type:"listbox",label:"Border style",items:[{text:"Select...",value:""}].concat(co(at(e)))},{name:"bordercolor",type:"colorinput",label:"Border color"},{name:"backgroundcolor",type:"colorinput",label:"Background color"}];return{title:"Advanced",name:"advanced",items:"cell"===t?[{name:"borderwidth",type:"input",label:"Border width"}].concat(o):o}},So=(e,t)=>{const o=e.dom;return{setAttrib:(e,l)=>{o.setAttrib(t,e,l)},setStyle:(e,l)=>{o.setStyle(t,e,l)},setFormat:(o,l)=>{""===l?e.formatter.remove(o,{value:null},t,!0):e.formatter.apply(o,{value:l},t)}}},Co=J("th"),vo=(e,t)=>e&&t?"sectionCells":e?"section":"cells",To=e=>{const t=M(e,(e=>(e=>{const t="thead"===e.section,o=we((e=>{const t=P(e,(e=>Co(e.element)));return 0===t.length?f.some("td"):t.length===e.length?f.some("th"):f.none()})(e.cells),"th");return"tfoot"===e.section?{type:"footer"}:t||o?{type:"header",subType:vo(t,o)}:{type:"body"}})(e).type)),o=O(t,"header"),l=O(t,"footer");if(o||l){const e=O(t,"body");return!o||e||l?o||e||!l?f.none():f.some("footer"):f.some("header")}return f.some("body")},xo=(e,t)=>L(e.all,(e=>B(e.cells,(e=>Y(t,e.element))))),Ao=(e,t,o)=>{const l=(e=>{const t=[],o=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(o);return t})(M(t.selection,(t=>{return(l=t,((e,t,o=g)=>o(t)?f.none():O(e,V(t))?f.some(t):de(t,e.join(","),(e=>Q(e,"table")||o(e))))(["td","th"],l,n)).bind((t=>xo(e,t))).filter(o);var l,n})));return n=l,l.length>0?f.some(n):f.none();var n},Ro=(e,t)=>Ao(e,t,h),_o=(e,t)=>F(t,(t=>((e,t)=>xo(e,t).exists((e=>!e.isLocked)))(e,t))),Oo=(e,t)=>((e,t)=>t.mergable)(0,t).filter((t=>_o(e,t.cells))),Do=(e,t)=>((e,t)=>t.unmergable)(0,t).filter((t=>_o(e,t))),Io=((e=>{if(!n(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=[],o={};N(e,((l,r)=>{const a=y(l);if(1!==a.length)throw new Error("one and only one name per case");const s=a[0],c=l[s];if(void 0!==o[s])throw new Error("duplicate key detected:"+s);if("cata"===s)throw new Error("cannot have a case named cata (sorry)");if(!n(c))throw new Error("case arguments must be an array");t.push(s),o[s]=(...o)=>{const l=o.length;if(l!==c.length)throw new Error("Wrong number of arguments to case "+s+". Expected "+c.length+" ("+c+"), got "+l);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,o)},match:e=>{const l=y(e);if(t.length!==l.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+l.join(","));if(!F(t,(e=>O(l,e))))throw new Error("Not all branches were specified when using match. Specified: "+l.join(", ")+"\nRequired: "+t.join(", "));return e[s].apply(null,o)},log:e=>{console.log(e,{constructors:t,constructor:s,params:o})}}}}))})([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}]),(e,t)=>{const o=Ve(e);return Ro(o,t).bind((e=>{const t=e[e.length-1],l=e[0].row,n=t.row+t.rowspan,r=o.all.slice(l,n);return To(r)})).getOr("")}),Mo=e=>{return Ce(e,"rgb")?no(t=e).map(Zt).map((e=>"#"+e.value)).getOr(t):e;var t},No=e=>{const t=j.fromDom(e);return{borderwidth:Oe(t,"border-width").getOr(""),borderstyle:Oe(t,"border-style").getOr(""),bordercolor:Oe(t,"border-color").map(Mo).getOr(""),backgroundcolor:Oe(t,"background-color").map(Mo).getOr("")}},Po=e=>{const t=e[0],o=e.slice(1);return N(o,(e=>{N(y(t),(o=>{S(e,((e,l)=>{const n=t[o];""!==n&&o===l&&n!==e&&(t[o]="")}))}))})),t},ko=(e,t,o,l)=>B(e,(e=>!a(o.formatter.matchNode(l,t+e)))).getOr(""),Bo=b(ko,["left","center","right"],"align"),Eo=b(ko,["top","middle","bottom"],"valign"),Fo=e=>Be(j.fromDom(e)).map((t=>{const o={selection:jt(e.cells)};return Io(t,o)})).getOr(""),qo=(e,t)=>{const o=Ve(e),l=(e=>E(e.all,(e=>e.cells)))(o),n=P(l,(e=>D(t,(t=>Y(e.element,t)))));return M(n,(e=>({element:e.element.dom,column:$e(o,e.column).map((e=>e.element.dom))})))},Lo=(e,t,o,l)=>{const n=l.getData();l.close(),e.undoManager.transact((()=>{((e,t,o,l)=>{const n=C(l,((e,t)=>o[t]!==e));v(n)>0&&t.length>=1&&Be(t[0]).each((o=>{const r=qo(o,t),a=v(C(n,((e,t)=>"scope"!==t&&"celltype"!==t)))>0,s=x(n,"celltype");(a||x(n,"scope"))&&((e,t,o,l)=>{const n=1===t.length;N(t,(t=>{const r=t.element,a=n?h:l,s=So(e,r);((e,t,o,l)=>{l("scope")&&e.setAttrib("scope",o.scope),l("class")&&e.setAttrib("class",o.class),l("height")&&e.setStyle("height",xt(o.height)),l("width")&&t.setStyle("width",xt(o.width))})(s,t.column.map((t=>So(e,t))).getOr(s),o,a),st(e)&&((e,t,o)=>{o("backgroundcolor")&&e.setFormat("tablecellbackgroundcolor",t.backgroundcolor),o("bordercolor")&&e.setFormat("tablecellbordercolor",t.bordercolor),o("borderstyle")&&e.setFormat("tablecellborderstyle",t.borderstyle),o("borderwidth")&&e.setFormat("tablecellborderwidth",xt(t.borderwidth))})(s,o,a),l("halign")&&Ke(e,r,o.halign),l("valign")&&((e,t,o)=>{Ue.each("top middle bottom".split(" "),(l=>{l!==o&&e.formatter.remove("valign"+l,{},t)})),o&&e.formatter.apply("valign"+o,{},t)})(e,r,o.valign)}))})(e,r,l,b(x,n)),s&&((e,t)=>{e.execCommand("mceTableCellType",!1,{type:t.celltype,no_events:!0})})(e,l),Je(e,o.dom,{structure:s,style:a})}))})(e,t,o,n),e.focus()}))},Ho=e=>{const t=Ut(e);if(0===t.length)return;const o=((e,t)=>{const o=Be(t[0]).map((o=>M(qo(o,t),(t=>((e,t,o,l)=>{const n=e.dom,r=(e,t)=>n.getStyle(e,t)||n.getAttrib(e,t);return{width:r(l.getOr(t),"width"),height:r(t,"height"),scope:n.getAttrib(t,"scope"),celltype:(a=t,a.nodeName.toLowerCase()),class:n.getAttrib(t,"class",""),halign:Bo(e,t),valign:Eo(e,t),...o?No(t):{}};var a})(e,t.element,st(e),t.column)))));return Po(o.getOrDie())})(e,t),l={type:"tabpanel",tabs:[{title:"General",name:"general",items:yo(e)},wo(e,"cell")]},n={type:"panel",items:[{type:"grid",columns:2,items:yo(e)}]};e.windowManager.open({title:"Cell Properties",size:"normal",body:st(e)?l:n,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:o,onSubmit:b(Lo,e,t,o)})},jo=[{type:"listbox",name:"type",label:"Row type",items:[{text:"Header",value:"header"},{text:"Body",value:"body"},{text:"Footer",value:"footer"}]},{type:"listbox",name:"align",label:"Alignment",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"Height",name:"height",type:"input"}],Vo=e=>jo.concat((e=>{const t=co(bt(e));return t.length>0?f.some({name:"class",type:"listbox",label:"Class",items:t}):f.none()})(e).toArray()),zo=(e,t,o,l)=>{const n=l.getData();l.close(),e.undoManager.transact((()=>{((e,t,o,l)=>{const n=C(l,((e,t)=>o[t]!==e));if(v(n)>0){const o=x(n,"type"),r=!o||v(n)>1;r&&((e,t,o,l)=>{const n=1===t.length?h:l;N(t,(t=>{const r=So(e,t);((e,t,o)=>{o("class")&&e.setAttrib("class",t.class),o("height")&&e.setStyle("height",xt(t.height))})(r,o,n),ct(e)&&((e,t,o)=>{o("backgroundcolor")&&e.setStyle("background-color",t.backgroundcolor),o("bordercolor")&&e.setStyle("border-color",t.bordercolor),o("borderstyle")&&e.setStyle("border-style",t.borderstyle)})(r,o,n),l("align")&&Ke(e,t,o.align)}))})(e,t,l,b(x,n)),o&&((e,t)=>{e.execCommand("mceTableRowType",!1,{type:t.type,no_events:!0})})(e,l),Be(j.fromDom(t[0])).each((t=>Je(e,t.dom,{structure:o,style:r})))}})(e,t,o,n),e.focus()}))},Wo=e=>{const t=Gt(At(e),Vt.selected);if(0===t.length)return;const o=M(t,(t=>((e,t,o)=>{const l=e.dom;return{height:l.getStyle(t,"height")||l.getAttrib(t,"height"),class:l.getAttrib(t,"class",""),type:Fo(t),align:Bo(e,t),...o?No(t):{}}})(e,t.dom,ct(e)))),l=Po(o),n={type:"tabpanel",tabs:[{title:"General",name:"general",items:Vo(e)},wo(e,"row")]},r={type:"panel",items:[{type:"grid",columns:2,items:Vo(e)}]};e.windowManager.open({title:"Row Properties",size:"normal",body:ct(e)?n:r,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:l,onSubmit:b(zo,e,M(t,(e=>e.dom)),l)})},$o=(e,t,o)=>{const l=o?[{type:"input",name:"cols",label:"Cols",inputMode:"numeric"},{type:"input",name:"rows",label:"Rows",inputMode:"numeric"}]:[],n=mt(e)?[{type:"input",name:"cellspacing",label:"Cell spacing",inputMode:"numeric"},{type:"input",name:"cellpadding",label:"Cell padding",inputMode:"numeric"},{type:"input",name:"border",label:"Border width"},{type:"label",label:"Caption",items:[{type:"checkbox",name:"caption",label:"Show caption"}]}]:[],r=t.length>0?[{type:"listbox",name:"class",label:"Class",items:t}]:[];return l.concat([{type:"input",name:"width",label:"Width"},{type:"input",name:"height",label:"Height"}]).concat(n).concat([{type:"listbox",name:"align",label:"Alignment",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]}]).concat(r)},Uo=(e,t,o,n)=>{if("TD"===t.tagName||"TH"===t.tagName)l(o)?e.setStyle(t,o,n):e.setStyles(t,o);else if(t.children)for(let l=0;l<t.children.length;l++)Uo(e,t.children[l],o,n)},Go=(e,t,o,l)=>{const n=e.dom,r=l.getData(),a=C(r,((e,t)=>o[t]!==e));l.close(),""===r.class&&delete r.class,e.undoManager.transact((()=>{if(!t){const o=parseInt(r.cols,10)||1,l=parseInt(r.rows,10)||1;e.execCommand("mceInsertTable",!1,{rows:l,columns:o}),t=$t(At(e),Tt(e)).bind((t=>Be(t,Tt(e)))).map((e=>e.dom)).getOrUndefined()}if(v(a)>0){((e,t,o)=>{const l=e.dom,n={},r={};if(n.class=o.class,r.height=xt(o.height),ut(e)?r.width=xt(o.width):l.getAttrib(t,"width")&&(n.width=(e=>e?e.replace(/px$/,""):"")(o.width)),ut(e)?(r["border-width"]=xt(o.border),r["border-spacing"]=xt(o.cellspacing)):(n.border=o.border,n.cellpadding=o.cellpadding,n.cellspacing=o.cellspacing),ut(e)&&t.children)for(let n=0;n<t.children.length;n++)Uo(l,t.children[n],{"border-width":xt(o.border),padding:xt(o.cellpadding)}),it(e)&&Uo(l,t.children[n],{"border-color":o.bordercolor});it(e)&&(r["background-color"]=o.backgroundcolor,r["border-color"]=o.bordercolor,r["border-style"]=o.borderstyle),n.style=l.serializeStyle({...Ct(e),...r}),l.setAttribs(t,{...vt(e),...n})})(e,t,r);const o=n.select("caption",t)[0];(o&&!r.caption||!o&&r.caption)&&e.execCommand("mceTableToggleCaption"),Ke(e,t,r.align)}if(e.focus(),e.addVisual(),v(a)>0){const o=x(a,"caption"),l=!o||v(a)>1;Je(e,t,{structure:o,style:l})}}))},Ko=(e,t)=>{const o=e.dom;let l,n=((e,t)=>{const o=Ct(e),l=vt(e),n=t?{borderstyle:T(o,"border-style").getOr(""),bordercolor:Mo(T(o,"border-color").getOr("")),backgroundcolor:Mo(T(o,"background-color").getOr(""))}:{};return{height:"",width:"100%",cellspacing:"",cellpadding:"",caption:!1,class:"",align:"",border:"",...o,...l,...n,...(()=>{const t=o["border-width"];return ut(e)&&t?{border:t}:T(l,"border").fold((()=>({})),(e=>({border:e})))})(),...{...T(o,"border-spacing").or(T(l,"cellspacing")).fold((()=>({})),(e=>({cellspacing:e}))),...T(o,"border-padding").or(T(l,"cellpadding")).fold((()=>({})),(e=>({cellpadding:e})))}}})(e,it(e));!1===t?(l=o.getParent(e.selection.getStart(),"table",e.getBody()),l?n=((e,t,o)=>{const l=e.dom,n=ut(e)?l.getStyle(t,"border-spacing")||l.getAttrib(t,"cellspacing"):l.getAttrib(t,"cellspacing")||l.getStyle(t,"border-spacing"),r=ut(e)?Ge(l,t,"padding")||l.getAttrib(t,"cellpadding"):l.getAttrib(t,"cellpadding")||Ge(l,t,"padding");return{width:l.getStyle(t,"width")||l.getAttrib(t,"width"),height:l.getStyle(t,"height")||l.getAttrib(t,"height"),cellspacing:n,cellpadding:r,border:((t,o)=>{const l=Oe(j.fromDom(o),"border-width");return ut(e)&&l.isSome()?l.getOr(""):t.getAttrib(o,"border")||Ge(e.dom,o,"border-width")||Ge(e.dom,o,"border")})(l,t),caption:!!l.select("caption",t)[0],class:l.getAttrib(t,"class",""),align:Bo(e,t),...o?No(t):{}}})(e,l,it(e)):it(e)&&(n.borderstyle="",n.bordercolor="",n.backgroundcolor="")):(n.cols="1",n.rows="1",it(e)&&(n.borderstyle="",n.bordercolor="",n.backgroundcolor=""));const r=co(gt(e));r.length>0&&n.class&&(n.class=n.class.replace(/\s*mce\-item\-table\s*/g,""));const a={type:"grid",columns:2,items:$o(e,r,t)},s=it(e)?{type:"tabpanel",tabs:[{title:"General",name:"general",items:[a]},wo(e,"table")]}:{type:"panel",items:[a]};e.windowManager.open({title:"Table Properties",size:"normal",body:s,onSubmit:b(Go,e,l,n),buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:n})},Jo=u,Qo=e=>{const t=(e,t)=>fe(e,t).exists((e=>parseInt(e,10)>1));return e.length>0&&F(e,(e=>t(e,"rowspan")||t(e,"colspan")))?f.some(e):f.none()},Xo=(e,t,o)=>{return t.length<=1?f.none():(l=e,n=o.firstSelectedSelector,r=o.lastSelectedSelector,Ht(l,n,r).bind((e=>{const t=e=>Y(l,e),o="thead,tfoot,tbody,table",n=de(e.first,o,t),r=de(e.last,o,t);return n.bind((t=>r.bind((o=>Y(t,o)?((e,t,o)=>{const l=Ot(e);return _t(l,t,o)})(e.table,e.first,e.last):f.none()))))}))).map((e=>({bounds:e,cells:t})));var l,n,r},Yo=e=>{const t=ro(f.none()),o=ro([]);let l=f.none();const n=J("caption"),r=e=>l.forall((t=>!t[e])),a=()=>Wt(At(e),Tt(e)).bind((t=>{return o=Se(Be(t),Wt((e=>j.fromDom(e.selection.getEnd()))(e),Tt(e)).bind(Be),((o,l)=>Y(o,l)?n(t)?f.some((e=>({element:e,mergable:f.none(),unmergable:f.none(),selection:[e]}))(t)):f.some(((e,t,o)=>({element:o,mergable:Xo(t,e,Vt),unmergable:Qo(e),selection:Jo(e)}))(Ut(e),o,t)):f.none())),o.bind(u);var o})),s=e=>Be(e.element).map((t=>{const o=Ve(t),l=Ro(o,e).getOr([]),n=k(l,((e,t)=>(t.isLocked&&(e.onAny=!0,0===t.column?e.onFirst=!0:t.column+t.colspan>=o.grid.columns&&(e.onLast=!0)),e)),{onAny:!1,onFirst:!1,onLast:!1});return{mergeable:Oo(o,e).isSome(),unmergeable:Do(o,e).isSome(),locked:n}})),c=()=>{t.set((e=>{let t,o=!1;return(...l)=>(o||(o=!0,t=e.apply(null,l)),t)})(a)()),l=t.get().bind(s),N(o.get(),(e=>e()))},i=e=>(e(),o.set(o.get().concat([e])),()=>{o.set(P(o.get(),(t=>t!==e)))}),m=(e,o)=>i((()=>t.get().fold((()=>{e.setEnabled(!1)}),(t=>{e.setEnabled(!o(t))})))),d=(e,o,l)=>i((()=>t.get().fold((()=>{e.setEnabled(!1),e.setActive(!1)}),(t=>{e.setEnabled(!o(t)),e.setActive(l(t))})))),p=e=>l.exists((t=>t.locked[e])),b=(t,o)=>l=>d(l,(e=>n(e.element)),(()=>e.queryCommandValue(t)===o)),h=b("mceTableRowType","header"),y=b("mceTableColType","th");return e.on("NodeChange ExecCommand TableSelectorChange",c),{onSetupTable:e=>m(e,(e=>!1)),onSetupCellOrRow:e=>m(e,(e=>n(e.element))),onSetupColumn:e=>t=>m(t,(t=>n(t.element)||p(e))),onSetupPasteable:e=>t=>m(t,(t=>n(t.element)||e().isNone())),onSetupPasteableColumn:(e,t)=>o=>m(o,(o=>n(o.element)||e().isNone()||p(t))),onSetupMergeable:e=>m(e,(e=>r("mergeable"))),onSetupUnmergeable:e=>m(e,(e=>r("unmergeable"))),resetTargets:c,onSetupTableWithCaption:t=>d(t,g,(t=>Be(t.element,Tt(e)).exists((e=>ue(e,"caption").isSome())))),onSetupTableRowHeaders:h,onSetupTableColumnHeaders:y,targets:t.get}};var Zo=tinymce.util.Tools.resolve("tinymce.FakeClipboard");const el=e=>{var t;const o=null!==(t=Zo.read())&&void 0!==t?t:[];return L(o,(t=>f.from(t.getType(e))))},tl=()=>el("x-tinymce/dom-table-rows"),ol=()=>el("x-tinymce/dom-table-columns");e.add("table",(e=>{const t=Yo(e);(e=>{const t=e.options.register;t("table_border_widths",{processor:"object[]",default:Ze}),t("table_border_styles",{processor:"object[]",default:et}),t("table_cell_advtab",{processor:"boolean",default:!0}),t("table_row_advtab",{processor:"boolean",default:!0}),t("table_advtab",{processor:"boolean",default:!0}),t("table_appearance_options",{processor:"boolean",default:!0}),t("table_grid",{processor:"boolean",default:!Ye.deviceType.isTouch()}),t("table_cell_class_list",{processor:"object[]",default:[]}),t("table_row_class_list",{processor:"object[]",default:[]}),t("table_class_list",{processor:"object[]",default:[]}),t("table_toolbar",{processor:"string",default:"tableprops tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol"}),t("table_background_color_map",{processor:"object[]",default:[]}),t("table_border_color_map",{processor:"object[]",default:[]})})(e),(e=>{S({mceTableProps:b(Ko,e,!1),mceTableRowProps:b(Wo,e),mceTableCellProps:b(Ho,e)},((t,o)=>e.addCommand(o,(()=>t())))),e.addCommand("mceInsertTableDialog",(t=>{Ko(e,!0)}))})(e),((e,t)=>{const o=t=>()=>e.execCommand(t),l=(t,l)=>!!e.queryCommandSupported(l.command)&&(e.ui.registry.addMenuItem(t,{...l,onAction:c(l.onAction)?l.onAction:o(l.command)}),!0),n=(t,l)=>{e.queryCommandSupported(l.command)&&e.ui.registry.addToggleMenuItem(t,{...l,onAction:c(l.onAction)?l.onAction:o(l.command)})},r=t=>{e.execCommand("mceInsertTable",!1,{rows:t.numRows,columns:t.numColumns})},a=[l("tableinsertrowbefore",{text:"Insert row before",icon:"table-insert-row-above",command:"mceTableInsertRowBefore",onSetup:t.onSetupCellOrRow}),l("tableinsertrowafter",{text:"Insert row after",icon:"table-insert-row-after",command:"mceTableInsertRowAfter",onSetup:t.onSetupCellOrRow}),l("tabledeleterow",{text:"Delete row",icon:"table-delete-row",command:"mceTableDeleteRow",onSetup:t.onSetupCellOrRow}),l("tablerowprops",{text:"Row properties",icon:"table-row-properties",command:"mceTableRowProps",onSetup:t.onSetupCellOrRow}),l("tablecutrow",{text:"Cut row",icon:"cut-row",command:"mceTableCutRow",onSetup:t.onSetupCellOrRow}),l("tablecopyrow",{text:"Copy row",icon:"duplicate-row",command:"mceTableCopyRow",onSetup:t.onSetupCellOrRow}),l("tablepasterowbefore",{text:"Paste row before",icon:"paste-row-before",command:"mceTablePasteRowBefore",onSetup:t.onSetupPasteable(tl)}),l("tablepasterowafter",{text:"Paste row after",icon:"paste-row-after",command:"mceTablePasteRowAfter",onSetup:t.onSetupPasteable(tl)})],s=[l("tableinsertcolumnbefore",{text:"Insert column before",icon:"table-insert-column-before",command:"mceTableInsertColBefore",onSetup:t.onSetupColumn("onFirst")}),l("tableinsertcolumnafter",{text:"Insert column after",icon:"table-insert-column-after",command:"mceTableInsertColAfter",onSetup:t.onSetupColumn("onLast")}),l("tabledeletecolumn",{text:"Delete column",icon:"table-delete-column",command:"mceTableDeleteCol",onSetup:t.onSetupColumn("onAny")}),l("tablecutcolumn",{text:"Cut column",icon:"cut-column",command:"mceTableCutCol",onSetup:t.onSetupColumn("onAny")}),l("tablecopycolumn",{text:"Copy column",icon:"duplicate-column",command:"mceTableCopyCol",onSetup:t.onSetupColumn("onAny")}),l("tablepastecolumnbefore",{text:"Paste column before",icon:"paste-column-before",command:"mceTablePasteColBefore",onSetup:t.onSetupPasteableColumn(ol,"onFirst")}),l("tablepastecolumnafter",{text:"Paste column after",icon:"paste-column-after",command:"mceTablePasteColAfter",onSetup:t.onSetupPasteableColumn(ol,"onLast")})],i=[l("tablecellprops",{text:"Cell properties",icon:"table-cell-properties",command:"mceTableCellProps",onSetup:t.onSetupCellOrRow}),l("tablemergecells",{text:"Merge cells",icon:"table-merge-cells",command:"mceTableMergeCells",onSetup:t.onSetupMergeable}),l("tablesplitcells",{text:"Split cell",icon:"table-split-cells",command:"mceTableSplitCells",onSetup:t.onSetupUnmergeable})];dt(e)?e.ui.registry.addNestedMenuItem("inserttable",{text:"Table",icon:"table",getSubmenuItems:()=>[{type:"fancymenuitem",fancytype:"inserttable",onAction:r}]}):e.ui.registry.addMenuItem("inserttable",{text:"Table",icon:"table",onAction:o("mceInsertTableDialog")}),e.ui.registry.addMenuItem("inserttabledialog",{text:"Insert table",icon:"table",onAction:o("mceInsertTableDialog")}),l("tableprops",{text:"Table properties",onSetup:t.onSetupTable,command:"mceTableProps"}),l("deletetable",{text:"Delete table",icon:"table-delete-table",onSetup:t.onSetupTable,command:"mceTableDelete"}),O(a,!0)&&e.ui.registry.addNestedMenuItem("row",{type:"nestedmenuitem",text:"Row",getSubmenuItems:d("tableinsertrowbefore tableinsertrowafter tabledeleterow tablerowprops | tablecutrow tablecopyrow tablepasterowbefore tablepasterowafter")}),O(s,!0)&&e.ui.registry.addNestedMenuItem("column",{type:"nestedmenuitem",text:"Column",getSubmenuItems:d("tableinsertcolumnbefore tableinsertcolumnafter tabledeletecolumn | tablecutcolumn tablecopycolumn tablepastecolumnbefore tablepastecolumnafter")}),O(i,!0)&&e.ui.registry.addNestedMenuItem("cell",{type:"nestedmenuitem",text:"Cell",getSubmenuItems:d("tablecellprops tablemergecells tablesplitcells")}),e.ui.registry.addContextMenu("table",{update:()=>(t.resetTargets(),t.targets().fold(d(""),(e=>"caption"===V(e.element)?"tableprops deletetable":"cell row column | advtablesort | tableprops deletetable")))});const m=uo(gt(e));0!==m.length&&e.queryCommandSupported("mceTableToggleClass")&&e.ui.registry.addNestedMenuItem("tableclass",{icon:"table-classes",text:"Table styles",getSubmenuItems:()=>io(e,m,"tableclass",(t=>e.execCommand("mceTableToggleClass",!1,t))),onSetup:t.onSetupTable});const u=uo(pt(e));0!==u.length&&e.queryCommandSupported("mceTableCellToggleClass")&&e.ui.registry.addNestedMenuItem("tablecellclass",{icon:"table-cell-classes",text:"Cell styles",getSubmenuItems:()=>io(e,u,"tablecellclass",(t=>e.execCommand("mceTableCellToggleClass",!1,t))),onSetup:t.onSetupCellOrRow}),e.queryCommandSupported("mceTableApplyCellStyle")&&(e.ui.registry.addNestedMenuItem("tablecellvalign",{icon:"vertical-align",text:"Vertical align",getSubmenuItems:()=>io(e,Kt,"tablecellverticalalign",mo(e,"vertical-align")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addNestedMenuItem("tablecellborderwidth",{icon:"border-width",text:"Border width",getSubmenuItems:()=>io(e,rt(e),"tablecellborderwidth",mo(e,"border-width")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addNestedMenuItem("tablecellborderstyle",{icon:"border-style",text:"Border style",getSubmenuItems:()=>io(e,at(e),"tablecellborderstyle",mo(e,"border-style")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addNestedMenuItem("tablecellbackgroundcolor",{icon:"cell-background-color",text:"Background color",getSubmenuItems:()=>bo(e,ft(e),"background-color"),onSetup:t.onSetupCellOrRow}),e.ui.registry.addNestedMenuItem("tablecellbordercolor",{icon:"cell-border-color",text:"Border color",getSubmenuItems:()=>bo(e,yt(e),"border-color"),onSetup:t.onSetupCellOrRow})),n("tablecaption",{icon:"table-caption",text:"Table caption",command:"mceTableToggleCaption",onSetup:t.onSetupTableWithCaption}),n("tablerowheader",{text:"Row header",icon:"table-top-header",command:"mceTableRowType",onAction:go(e),onSetup:t.onSetupTableRowHeaders}),n("tablecolheader",{text:"Column header",icon:"table-left-header",command:"mceTableColType",onAction:ho(e),onSetup:t.onSetupTableRowHeaders})})(e,t),((e,t)=>{e.ui.registry.addMenuButton("table",{tooltip:"Table",icon:"table",fetch:e=>e("inserttable | cell row column | advtablesort | tableprops deletetable")});const o=t=>()=>e.execCommand(t),l=(t,l)=>{e.queryCommandSupported(l.command)&&e.ui.registry.addButton(t,{...l,onAction:c(l.onAction)?l.onAction:o(l.command)})},n=(t,l)=>{e.queryCommandSupported(l.command)&&e.ui.registry.addToggleButton(t,{...l,onAction:c(l.onAction)?l.onAction:o(l.command)})};l("tableprops",{tooltip:"Table properties",command:"mceTableProps",icon:"table",onSetup:t.onSetupTable}),l("tabledelete",{tooltip:"Delete table",command:"mceTableDelete",icon:"table-delete-table",onSetup:t.onSetupTable}),l("tablecellprops",{tooltip:"Cell properties",command:"mceTableCellProps",icon:"table-cell-properties",onSetup:t.onSetupCellOrRow}),l("tablemergecells",{tooltip:"Merge cells",command:"mceTableMergeCells",icon:"table-merge-cells",onSetup:t.onSetupMergeable}),l("tablesplitcells",{tooltip:"Split cell",command:"mceTableSplitCells",icon:"table-split-cells",onSetup:t.onSetupUnmergeable}),l("tableinsertrowbefore",{tooltip:"Insert row before",command:"mceTableInsertRowBefore",icon:"table-insert-row-above",onSetup:t.onSetupCellOrRow}),l("tableinsertrowafter",{tooltip:"Insert row after",command:"mceTableInsertRowAfter",icon:"table-insert-row-after",onSetup:t.onSetupCellOrRow}),l("tabledeleterow",{tooltip:"Delete row",command:"mceTableDeleteRow",icon:"table-delete-row",onSetup:t.onSetupCellOrRow}),l("tablerowprops",{tooltip:"Row properties",command:"mceTableRowProps",icon:"table-row-properties",onSetup:t.onSetupCellOrRow}),l("tableinsertcolbefore",{tooltip:"Insert column before",command:"mceTableInsertColBefore",icon:"table-insert-column-before",onSetup:t.onSetupColumn("onFirst")}),l("tableinsertcolafter",{tooltip:"Insert column after",command:"mceTableInsertColAfter",icon:"table-insert-column-after",onSetup:t.onSetupColumn("onLast")}),l("tabledeletecol",{tooltip:"Delete column",command:"mceTableDeleteCol",icon:"table-delete-column",onSetup:t.onSetupColumn("onAny")}),l("tablecutrow",{tooltip:"Cut row",command:"mceTableCutRow",icon:"cut-row",onSetup:t.onSetupCellOrRow}),l("tablecopyrow",{tooltip:"Copy row",command:"mceTableCopyRow",icon:"duplicate-row",onSetup:t.onSetupCellOrRow}),l("tablepasterowbefore",{tooltip:"Paste row before",command:"mceTablePasteRowBefore",icon:"paste-row-before",onSetup:t.onSetupPasteable(tl)}),l("tablepasterowafter",{tooltip:"Paste row after",command:"mceTablePasteRowAfter",icon:"paste-row-after",onSetup:t.onSetupPasteable(tl)}),l("tablecutcol",{tooltip:"Cut column",command:"mceTableCutCol",icon:"cut-column",onSetup:t.onSetupColumn("onAny")}),l("tablecopycol",{tooltip:"Copy column",command:"mceTableCopyCol",icon:"duplicate-column",onSetup:t.onSetupColumn("onAny")}),l("tablepastecolbefore",{tooltip:"Paste column before",command:"mceTablePasteColBefore",icon:"paste-column-before",onSetup:t.onSetupPasteableColumn(ol,"onFirst")}),l("tablepastecolafter",{tooltip:"Paste column after",command:"mceTablePasteColAfter",icon:"paste-column-after",onSetup:t.onSetupPasteableColumn(ol,"onLast")}),l("tableinsertdialog",{tooltip:"Insert table",command:"mceInsertTableDialog",icon:"table"});const r=uo(gt(e));0!==r.length&&e.queryCommandSupported("mceTableToggleClass")&&e.ui.registry.addMenuButton("tableclass",{icon:"table-classes",tooltip:"Table styles",fetch:po(e,r,"tableclass",(t=>e.execCommand("mceTableToggleClass",!1,t))),onSetup:t.onSetupTable});const a=uo(pt(e));0!==a.length&&e.queryCommandSupported("mceTableCellToggleClass")&&e.ui.registry.addMenuButton("tablecellclass",{icon:"table-cell-classes",tooltip:"Cell styles",fetch:po(e,a,"tablecellclass",(t=>e.execCommand("mceTableCellToggleClass",!1,t))),onSetup:t.onSetupCellOrRow}),e.queryCommandSupported("mceTableApplyCellStyle")&&(e.ui.registry.addMenuButton("tablecellvalign",{icon:"vertical-align",tooltip:"Vertical align",fetch:po(e,Kt,"tablecellverticalalign",mo(e,"vertical-align")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addMenuButton("tablecellborderwidth",{icon:"border-width",tooltip:"Border width",fetch:po(e,rt(e),"tablecellborderwidth",mo(e,"border-width")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addMenuButton("tablecellborderstyle",{icon:"border-style",tooltip:"Border style",fetch:po(e,at(e),"tablecellborderstyle",mo(e,"border-style")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addMenuButton("tablecellbackgroundcolor",{icon:"cell-background-color",tooltip:"Background color",fetch:t=>t(bo(e,ft(e),"background-color")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addMenuButton("tablecellbordercolor",{icon:"cell-border-color",tooltip:"Border color",fetch:t=>t(bo(e,yt(e),"border-color")),onSetup:t.onSetupCellOrRow})),n("tablecaption",{tooltip:"Table caption",icon:"table-caption",command:"mceTableToggleCaption",onSetup:t.onSetupTableWithCaption}),n("tablerowheader",{tooltip:"Row header",icon:"table-top-header",command:"mceTableRowType",onAction:go(e),onSetup:t.onSetupTableRowHeaders}),n("tablecolheader",{tooltip:"Column header",icon:"table-left-header",command:"mceTableColType",onAction:ho(e),onSetup:t.onSetupTableColumnHeaders})})(e,t),(e=>{const t=ht(e);t.length>0&&e.ui.registry.addContextToolbar("table",{predicate:t=>e.dom.is(t,"table")&&e.getBody().contains(t),items:t,scope:"node",position:"node"})})(e)}))}();
4
+ !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=l=e,(n=String).prototype.isPrototypeOf(o)||(null===(r=l.constructor)||void 0===r?void 0:r.name)===n.name)?"string":t;var o,l,n,r})(t)===e,o=e=>t=>typeof t===e,l=t("string"),n=t("array"),r=o("boolean"),a=(void 0,e=>undefined===e);const s=e=>!(e=>null==e)(e),c=o("function"),i=o("number"),m=()=>{},d=e=>()=>e,u=e=>e,p=(e,t)=>e===t;function b(e,...t){return(...o)=>{const l=t.concat(o);return e.apply(null,l)}}const g=e=>{e()},h=d(!1),f=d(!0);class y{constructor(e,t){this.tag=e,this.value=t}static some(e){return new y(!0,e)}static none(){return y.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?y.some(e(this.value)):y.none()}bind(e){return this.tag?e(this.value):y.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:y.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 s(e)?y.some(e):y.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()"}}y.singletonNone=new y(!1);const w=Object.keys,S=Object.hasOwnProperty,C=(e,t)=>{const o=w(e);for(let l=0,n=o.length;l<n;l++){const n=o[l];t(e[n],n)}},v=(e,t)=>{const o={};var l;return((e,t,o,l)=>{C(e,((e,n)=>{(t(e,n)?o:l)(e,n)}))})(e,t,(l=o,(e,t)=>{l[t]=e}),m),o},T=e=>w(e).length,x=(e,t)=>A(e,t)?y.from(e[t]):y.none(),A=(e,t)=>S.call(e,t),R=(e,t)=>A(e,t)&&void 0!==e[t]&&null!==e[t],O=Array.prototype.indexOf,_=Array.prototype.push,D=(e,t)=>((e,t)=>O.call(e,t))(e,t)>-1,I=(e,t)=>{for(let o=0,l=e.length;o<l;o++)if(t(e[o],o))return!0;return!1},M=(e,t)=>{const o=[];for(let l=0;l<e;l++)o.push(t(l));return o},N=(e,t)=>{const o=e.length,l=new Array(o);for(let n=0;n<o;n++){const o=e[n];l[n]=t(o,n)}return l},P=(e,t)=>{for(let o=0,l=e.length;o<l;o++)t(e[o],o)},k=(e,t)=>{const o=[];for(let l=0,n=e.length;l<n;l++){const n=e[l];t(n,l)&&o.push(n)}return o},B=(e,t,o)=>(P(e,((e,l)=>{o=t(o,e,l)})),o),E=(e,t)=>((e,t,o)=>{for(let l=0,n=e.length;l<n;l++){const n=e[l];if(t(n,l))return y.some(n);if(o(n,l))break}return y.none()})(e,t,h),F=(e,t)=>(e=>{const t=[];for(let o=0,l=e.length;o<l;++o){if(!n(e[o]))throw new Error("Arr.flatten item "+o+" was not an array, input: "+e);_.apply(t,e[o])}return t})(N(e,t)),q=(e,t)=>{for(let o=0,l=e.length;o<l;++o)if(!0!==t(e[o],o))return!1;return!0},L=(e,t)=>t>=0&&t<e.length?y.some(e[t]):y.none(),H=(e,t)=>{for(let o=0;o<e.length;o++){const l=t(e[o],o);if(l.isSome())return l}return y.none()},j=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},V={fromHtml:(e,t)=>{const o=(t||document).createElement("div");if(o.innerHTML=e,!o.hasChildNodes()||o.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return j(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return j(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return j(o)},fromDom:j,fromPoint:(e,t,o)=>y.from(e.dom.elementFromPoint(t,o)).map(j)};"undefined"!=typeof window?window:Function("return this;")();const z=e=>e.dom.nodeName.toLowerCase(),W=e=>e.dom.nodeType,$=e=>t=>W(t)===e,U=$(1),G=$(3),K=$(9),J=$(11),Q=e=>t=>U(t)&&z(t)===e,X=(e,t)=>{const o=e.dom;if(1!==o.nodeType)return!1;{const e=o;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")}},Y=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,Z=(e,t)=>e.dom===t.dom,ee=X,te=e=>K(e)?e:V.fromDom(e.dom.ownerDocument),oe=e=>y.from(e.dom.parentNode).map(V.fromDom),le=e=>y.from(e.dom.nextSibling).map(V.fromDom),ne=e=>N(e.dom.childNodes,V.fromDom),re=c(Element.prototype.attachShadow)&&c(Node.prototype.getRootNode)?e=>V.fromDom(e.dom.getRootNode()):te,ae=e=>V.fromDom(e.dom.host),se=e=>{const t=G(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return(e=>{const t=re(e);return J(o=t)&&s(o.dom.host)?y.some(t):y.none();var o})(V.fromDom(t)).fold((()=>o.body.contains(t)),(l=se,n=ae,e=>l(n(e))));var l,n},ce=(e,t)=>{let o=[];return P(ne(e),(e=>{t(e)&&(o=o.concat([e])),o=o.concat(ce(e,t))})),o},ie=(e,t)=>((e,o)=>k(ne(e),(e=>X(e,t))))(e),me=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return Y(o)?[]:N(o.querySelectorAll(e),V.fromDom)})(t,e),de=(e,t,o)=>{let l=e.dom;const n=c(o)?o:h;for(;l.parentNode;){l=l.parentNode;const e=V.fromDom(l);if(t(e))return y.some(e);if(n(e))break}return y.none()},ue=(e,t,o)=>de(e,(e=>X(e,t)),o),pe=(e,t)=>((e,o)=>E(e.dom.childNodes,(e=>{return o=V.fromDom(e),X(o,t);var o})).map(V.fromDom))(e),be=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return Y(o)?y.none():y.from(o.querySelector(e)).map(V.fromDom)})(t,e),ge=(e,t,o)=>((e,t,o,l,n)=>((e,t)=>X(e,t))(o,l)?y.some(o):c(n)&&n(o)?y.none():t(o,l,n))(0,ue,e,t,o),he=(e,t,o)=>{if(!(l(o)||r(o)||i(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")},fe=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},ye=(e,t)=>y.from(fe(e,t)),we=(e,t)=>{e.dom.removeAttribute(t)},Se=(e,t,o=p)=>e.exists((e=>o(e,t))),Ce=(e,t,o)=>e.isSome()&&t.isSome()?y.some(o(e.getOrDie(),t.getOrDie())):y.none(),ve=(e,t)=>((e,t,o)=>""===t||e.length>=t.length&&e.substr(0,0+t.length)===t)(e,t),Te=(xe=/^\s+|\s+$/g,e=>e.replace(xe,""));var xe;const Ae=e=>e.length>0,Re=(e,t=10)=>{const o=parseInt(e,t);return isNaN(o)?y.none():y.some(o)},Oe=e=>void 0!==e.style&&c(e.style.getPropertyValue),_e=(e,t)=>{const o=e.dom,l=window.getComputedStyle(o).getPropertyValue(t);return""!==l||se(e)?l:De(o,t)},De=(e,t)=>Oe(e)?e.style.getPropertyValue(t):"",Ie=(e,t)=>{const o=e.dom,l=De(o,t);return y.from(l).filter((e=>e.length>0))},Me=(e,t,o=0)=>ye(e,t).map((e=>parseInt(e,10))).getOr(o),Ne=(e,t)=>Pe(e,t,f),Pe=(e,t,o)=>F(ne(e),(e=>X(e,t)?o(e)?[e]:[]:Pe(e,t,o))),ke=["tfoot","thead","tbody","colgroup"],Be=(e,t,o)=>({element:e,rowspan:t,colspan:o}),Ee=(e,t,o)=>({element:e,cells:t,section:o}),Fe=(e,t)=>ge(e,"table",t),qe=e=>Ne(e,"tr"),Le=e=>Fe(e).fold(d([]),(e=>ie(e,"colgroup"))),He=e=>oe(e).map((e=>{const t=z(e);return(e=>D(ke,e))(t)?t:"tbody"})).getOr("tbody"),je=e=>ye(e,"data-snooker-locked-cols").bind((e=>y.from(e.match(/\d+/g)))).map((e=>((e,t)=>{const o={};for(let l=0,n=e.length;l<n;l++){const n=e[l];o[String(n)]=t(n,l)}return o})(e,f))),Ve=(e,t)=>e+","+t,ze=e=>{const t={},o=[];var l;const n=(l=e,L(l,0)).map((e=>e.element)).bind(Fe).bind(je).getOr({});let r=0,a=0,s=0;const{pass:c,fail:i}=((e,t)=>{const o=[],l=[];for(let t=0,r=e.length;t<r;t++){const r=e[t];(n=r,"colgroup"===n.section?o:l).push(r)}var n;return{pass:o,fail:l}})(e);P(i,(e=>{const l=[];P(e.cells,(e=>{let o=0;for(;void 0!==t[Ve(s,o)];)o++;const r=R(n,o.toString()),c=((e,t,o,l,n,r)=>({element:e,rowspan:t,colspan:o,row:l,column:n,isLocked:r}))(e.element,e.rowspan,e.colspan,s,o,r);for(let l=0;l<e.colspan;l++)for(let n=0;n<e.rowspan;n++){const e=o+l,r=Ve(s+n,e);t[r]=c,a=Math.max(a,e+1)}l.push(c)})),r++,o.push(Ee(e.element,l,e.section)),s++}));const{columns:m,colgroups:d}=(e=>L(e,e.length-1))(c).map((e=>{const t=(e=>{const t={};let o=0;return P(e.cells,(e=>{const l=e.colspan;M(l,(n=>{const r=o+n;t[r]=((e,t,o)=>({element:e,colspan:t,column:o}))(e.element,l,r)})),o+=l})),t})(e),o=((e,t)=>({element:e,columns:t}))(e.element,((e,t)=>{const o=[];return C(e,((e,l)=>{o.push(t(e,l))})),o})(t,u));return{colgroups:[o],columns:t}})).getOrThunk((()=>({colgroups:[],columns:{}}))),p=((e,t)=>({rows:e,columns:t}))(r,a);return{grid:p,access:t,all:o,columns:m,colgroups:d}},We=e=>{const t=(e=>{const t=qe(e);return((e,t)=>N(e,(e=>{if("colgroup"===z(e)){const t=N((e=>X(e,"colgroup")?ie(e,"col"):F(Le(e),(e=>ie(e,"col"))))(e),(e=>{const t=Me(e,"span",1);return Be(e,1,t)}));return Ee(e,t,"colgroup")}{const o=N((e=>Ne(e,"th,td"))(e),(e=>{const t=Me(e,"rowspan",1),o=Me(e,"colspan",1);return Be(e,t,o)}));return Ee(e,o,t(e))}})))([...Le(e),...t],He)})(e);return ze(t)},$e=(e,t,o)=>y.from(e.access[Ve(t,o)]),Ue=(e,t,o)=>{const l=((e,t)=>{const o=F(e.all,(e=>e.cells));return k(o,t)})(e,(e=>o(t,e.element)));return l.length>0?y.some(l[0]):y.none()},Ge=(e,t)=>y.from(e.columns[t]);var Ke=tinymce.util.Tools.resolve("tinymce.util.Tools");const Je=(e,t,o)=>{const l=e.select("td,th",t);let n;for(let t=0;t<l.length;t++){const r=e.getStyle(l[t],o);if(a(n)&&(n=r),n!==r)return""}return n},Qe=(e,t,o)=>{Ke.each("left center right".split(" "),(l=>{l!==o&&e.formatter.remove("align"+l,{},t)})),o&&e.formatter.apply("align"+o,{},t)},Xe=(e,t,o)=>{e.dispatch("TableModified",{...o,table:t})},Ye=(e,t,o)=>((e,t)=>(e=>{const t=parseFloat(e);return isNaN(t)?y.none():y.some(t)})(e).getOr(t))(_e(e,t),o),Ze=e=>((e,t)=>{const o=e.dom,l=o.getBoundingClientRect().width||o.offsetWidth;return"border-box"===t?l:((e,t,o,l)=>t-Ye(e,"padding-left",0)-Ye(e,"padding-right",0)-Ye(e,"border-left-width",0)-Ye(e,"border-right-width",0))(e,l)})(e,"content-box");var et=tinymce.util.Tools.resolve("tinymce.Env");const tt=M(5,(e=>{const t=`${e+1}px`;return{title:t,value:t}})),ot=N(["Solid","Dotted","Dashed","Double","Groove","Ridge","Inset","Outset","None","Hidden"],(e=>({title:e,value:e.toLowerCase()}))),lt="100%",nt=e=>{var t;const o=e.dom,l=null!==(t=o.getParent(e.selection.getStart(),o.isBlock))&&void 0!==t?t:e.getBody();return Ze(V.fromDom(l))+"px"},rt=e=>t=>t.options.get(e),at=rt("table_sizing_mode"),st=rt("table_border_widths"),ct=rt("table_border_styles"),it=rt("table_cell_advtab"),mt=rt("table_row_advtab"),dt=rt("table_advtab"),ut=rt("table_appearance_options"),pt=rt("table_grid"),bt=rt("table_style_by_css"),gt=rt("table_cell_class_list"),ht=rt("table_row_class_list"),ft=rt("table_class_list"),yt=rt("table_toolbar"),wt=rt("table_background_color_map"),St=rt("table_border_color_map"),Ct=e=>"fixed"===at(e),vt=e=>"responsive"===at(e),Tt=e=>{const t=e.options,o=t.get("table_default_styles");return t.isSet("table_default_styles")?o:((e,t)=>vt(e)||!bt(e)?t:Ct(e)?{...t,width:nt(e)}:{...t,width:lt})(e,o)},xt=e=>{const t=e.options,o=t.get("table_default_attributes");return t.isSet("table_default_attributes")?o:((e,t)=>vt(e)||bt(e)?t:Ct(e)?{...t,width:nt(e)}:{...t,width:lt})(e,o)},At=e=>t=>Z(t,(e=>V.fromDom(e.getBody()))(e)),Rt=e=>/^\d+(\.\d+)?$/.test(e)?e+"px":e,Ot=e=>V.fromDom(e.selection.getStart()),_t=(e,t)=>t.column>=e.startCol&&t.column+t.colspan-1<=e.finishCol&&t.row>=e.startRow&&t.row+t.rowspan-1<=e.finishRow,Dt=(e,t,o)=>((e,t,o)=>{const l=Ue(e,t,Z),n=Ue(e,o,Z);return l.bind((e=>n.map((t=>{return o=e,l=t,{startRow:Math.min(o.row,l.row),startCol:Math.min(o.column,l.column),finishRow:Math.max(o.row+o.rowspan-1,l.row+l.rowspan-1),finishCol:Math.max(o.column+o.colspan-1,l.column+l.colspan-1)};var o,l}))))})(e,t,o).bind((t=>((e,t)=>{let o=!0;const l=b(_t,t);for(let n=t.startRow;n<=t.finishRow;n++)for(let r=t.startCol;r<=t.finishCol;r++)o=o&&$e(e,n,r).exists(l);return o?y.some(t):y.none()})(e,t))),It=We,Mt=(e,t)=>{oe(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},Nt=(e,t)=>{le(e).fold((()=>{oe(e).each((e=>{Pt(e,t)}))}),(e=>{Mt(e,t)}))},Pt=(e,t)=>{e.dom.appendChild(t.dom)},kt=(e,t)=>{P(t,((o,l)=>{const n=0===l?e:t[l-1];Nt(n,o)}))},Bt=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Et=((e,t)=>{const o=t=>e(t)?y.from(t.dom.nodeValue):y.none();return{get:t=>{if(!e(t))throw new Error("Can only get text value of a text node");return o(t).getOr("")},getOption:o,set:(t,o)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=o}}})(G);var Ft=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","li","table","thead","tbody","tfoot","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"];const qt=(e,t,o,l)=>{const n=t(e,o);return r=(o,l)=>{const n=t(e,l);return Lt(e,o,n)},a=n,((e,t)=>{for(let o=e.length-1;o>=0;o--)t(e[o],o)})(l,((e,t)=>{a=r(a,e)})),a;var r,a},Lt=(e,t,o)=>t.bind((t=>o.filter(b(e.eq,t)))),Ht={up:d({selector:ue,closest:ge,predicate:de,all:(e,t)=>{const o=c(t)?t:h;let l=e.dom;const n=[];for(;null!==l.parentNode&&void 0!==l.parentNode;){const e=l.parentNode,t=V.fromDom(e);if(n.push(t),!0===o(t))break;l=e}return n}}),down:d({selector:me,predicate:ce}),styles:d({get:_e,getRaw:Ie,set:(e,t,o)=>{((e,t,o)=>{if(!l(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);Oe(e)&&e.style.setProperty(t,o)})(e.dom,t,o)},remove:(e,t)=>{((e,t)=>{Oe(e)&&e.style.removeProperty(t)})(e.dom,t),Se(ye(e,"style").map(Te),"")&&we(e,"style")}}),attrs:d({get:fe,set:(e,t,o)=>{he(e.dom,t,o)},remove:we,copyTo:(e,t)=>{((e,t)=>{const o=e.dom;C(t,((e,t)=>{he(o,t,e)}))})(t,B(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}))}}),insert:d({before:Mt,after:Nt,afterAll:kt,append:Pt,appendAll:(e,t)=>{P(t,(t=>{Pt(e,t)}))},prepend:(e,t)=>{(e=>((e,t)=>{const o=e.dom.childNodes;return y.from(o[0]).map(V.fromDom)})(e))(e).fold((()=>{Pt(e,t)}),(o=>{e.dom.insertBefore(t.dom,o.dom)}))},wrap:(e,t)=>{Mt(e,t),Pt(t,e)}}),remove:d({unwrap:e=>{const t=ne(e);t.length>0&&kt(e,t),Bt(e)},remove:Bt}),create:d({nu:V.fromTag,clone:e=>V.fromDom(e.dom.cloneNode(!1)),text:V.fromText}),query:d({comparePosition:(e,t)=>e.dom.compareDocumentPosition(t.dom),prevSibling:e=>y.from(e.dom.previousSibling).map(V.fromDom),nextSibling:le}),property:d({children:ne,name:z,parent:oe,document:e=>te(e).dom,isText:G,isComment:e=>8===W(e)||"#comment"===z(e),isElement:U,isSpecial:e=>{const t=z(e);return D(["script","noscript","iframe","noframes","noembed","title","style","textarea","xmp"],t)},getLanguage:e=>U(e)?ye(e,"lang"):y.none(),getText:e=>Et.get(e),setText:(e,t)=>Et.set(e,t),isBoundary:e=>!!U(e)&&("body"===z(e)||D(Ft,z(e))),isEmptyTag:e=>!!U(e)&&D(["br","img","hr","input"],z(e)),isNonEditable:e=>U(e)&&"false"===fe(e,"contenteditable")}),eq:Z,is:ee},jt=e=>ue(e,"table"),Vt=(e,t,o)=>be(e,t).bind((t=>be(e,o).bind((e=>{return(o=jt,l=[t,e],((e,t,o)=>o.length>0?((e,t,o,l)=>l(e,t,o[0],o.slice(1)))(e,t,o,qt):y.none())(Ht,((e,t)=>o(t)),l)).map((o=>({first:t,last:e,table:o})));var o,l})))),zt=e=>N(e,V.fromDom),Wt={selected:"data-mce-selected",selectedSelector:"td[data-mce-selected],th[data-mce-selected]",firstSelected:"data-mce-first-selected",firstSelectedSelector:"td[data-mce-first-selected],th[data-mce-first-selected]",lastSelected:"data-mce-last-selected",lastSelectedSelector:"td[data-mce-last-selected],th[data-mce-last-selected]"},$t=e=>(t,o)=>{const l=z(t),n="col"===l||"colgroup"===l?Fe(r=t).bind((e=>((e,t)=>((e,t)=>{const o=me(e,t);return o.length>0?y.some(o):y.none()})(e,t))(e,Wt.firstSelectedSelector))).fold(d(r),(e=>e[0])):t;var r;return ge(n,e,o)},Ut=$t("th,td,caption"),Gt=$t("th,td"),Kt=e=>zt(e.model.table.getSelectedCells()),Jt=(e,t)=>{const o=Gt(e),l=o.bind((e=>Fe(e))).map((e=>qe(e)));return Ce(o,l,((e,o)=>k(o,(o=>I(zt(o.dom.cells),(o=>"1"===fe(o,t)||Z(o,e))))))).getOr([])},Qt=[{text:"None",value:""},{text:"Top",value:"top"},{text:"Middle",value:"middle"},{text:"Bottom",value:"bottom"}],Xt=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Yt=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Zt=e=>{return(t=e,"#",ve(t,"#")?((e,t)=>e.substring(t))(t,"#".length):t).toUpperCase();var t},eo=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},to=e=>({value:eo(e.red)+eo(e.green)+eo(e.blue)}),oo=/^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i,lo=/^\s*rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?(?:\.\d+)?)\s*\)\s*$/i,no=(e,t,o,l)=>({red:e,green:t,blue:o,alpha:l}),ro=(e,t,o,l)=>{const n=parseInt(e,10),r=parseInt(t,10),a=parseInt(o,10),s=parseFloat(l);return no(n,r,a,s)},ao=e=>{if("transparent"===e)return y.some(no(0,0,0,0));const t=oo.exec(e);if(null!==t)return y.some(ro(t[1],t[2],t[3],"1"));const o=lo.exec(e);return null!==o?y.some(ro(o[1],o[2],o[3],o[4])):y.none()},so=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},co=(e,t,o)=>l=>{const n=(e=>{const t=so(y.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(y.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(y.some(e))}}})((e=>e.unbind())),r=!Ae(o),a=()=>{const a=Kt(e),s=l=>e.formatter.match(t,{value:o},l.dom,r);r?(l.setActive(!I(a,s)),n.set(e.formatter.formatChanged(t,(e=>l.setActive(!e)),!0))):(l.setActive(q(a,s)),n.set(e.formatter.formatChanged(t,l.setActive,!1,{value:o})))};return e.initialized?a():e.on("init",a),n.clear},io=e=>R(e,"menu"),mo=e=>N(e,(e=>{const t=e.text||e.title||"";return io(e)?{text:t,items:mo(e.menu)}:{text:t,value:e.value}})),uo=(e,t,o,l)=>N(t,(t=>{const n=t.text||t.title;return io(t)?{type:"nestedmenuitem",text:n,getSubmenuItems:()=>uo(e,t.menu,o,l)}:{text:n,type:"togglemenuitem",onAction:()=>l(t.value),onSetup:co(e,o,t.value)}})),po=(e,t)=>o=>{e.execCommand("mceTableApplyCellStyle",!1,{[t]:o})},bo=e=>F(e,(e=>io(e)?[{...e,menu:bo(e.menu)}]:Ae(e.value)?[e]:[])),go=(e,t,o,l)=>n=>n(uo(e,t,o,l)),ho=(e,t,o)=>{const l=N(t,(e=>{return{text:e.title,value:"#"+(o=e.value,(t=o,(e=>Xt.test(e)||Yt.test(e))(t)?y.some({value:Zt(t)}):y.none()).orThunk((()=>ao(o).map(to))).getOrThunk((()=>{const e=document.createElement("canvas");e.height=1,e.width=1;const t=e.getContext("2d");t.clearRect(0,0,e.width,e.height),t.fillStyle="#FFFFFF",t.fillStyle=o,t.fillRect(0,0,1,1);const l=t.getImageData(0,0,1,1).data,n=l[0],r=l[1],a=l[2],s=l[3];return to(no(n,r,a,s))}))).value,type:"choiceitem"};var t,o}));return[{type:"fancymenuitem",fancytype:"colorswatch",initData:{colors:l.length>0?l:void 0,allowCustomColors:!1},onAction:t=>{const l="remove"===t.value?"":t.value;e.execCommand("mceTableApplyCellStyle",!1,{[o]:l})}}]},fo=e=>()=>{const t="header"===e.queryCommandValue("mceTableRowType")?"body":"header";e.execCommand("mceTableRowType",!1,{type:t})},yo=e=>()=>{const t="th"===e.queryCommandValue("mceTableColType")?"td":"th";e.execCommand("mceTableColType",!1,{type:t})},wo=[{name:"width",type:"input",label:"Width"},{name:"height",type:"input",label:"Height"},{name:"celltype",type:"listbox",label:"Cell type",items:[{text:"Cell",value:"td"},{text:"Header cell",value:"th"}]},{name:"scope",type:"listbox",label:"Scope",items:[{text:"None",value:""},{text:"Row",value:"row"},{text:"Column",value:"col"},{text:"Row group",value:"rowgroup"},{text:"Column group",value:"colgroup"}]},{name:"halign",type:"listbox",label:"Horizontal align",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{name:"valign",type:"listbox",label:"Vertical align",items:Qt}],So=e=>wo.concat((e=>{const t=mo(gt(e));return t.length>0?y.some({name:"class",type:"listbox",label:"Class",items:t}):y.none()})(e).toArray()),Co=(e,t)=>{const o=[{name:"borderstyle",type:"listbox",label:"Border style",items:[{text:"Select...",value:""}].concat(mo(ct(e)))},{name:"bordercolor",type:"colorinput",label:"Border color"},{name:"backgroundcolor",type:"colorinput",label:"Background color"}];return{title:"Advanced",name:"advanced",items:"cell"===t?[{name:"borderwidth",type:"input",label:"Border width"}].concat(o):o}},vo=(e,t)=>{const o=e.dom;return{setAttrib:(e,l)=>{o.setAttrib(t,e,l)},setStyle:(e,l)=>{o.setStyle(t,e,l)},setFormat:(o,l)=>{""===l?e.formatter.remove(o,{value:null},t,!0):e.formatter.apply(o,{value:l},t)}}},To=Q("th"),xo=(e,t)=>e&&t?"sectionCells":e?"section":"cells",Ao=e=>{const t=N(e,(e=>(e=>{const t="thead"===e.section,o=Se((e=>{const t=k(e,(e=>To(e.element)));return 0===t.length?y.some("td"):t.length===e.length?y.some("th"):y.none()})(e.cells),"th");return"tfoot"===e.section?{type:"footer"}:t||o?{type:"header",subType:xo(t,o)}:{type:"body"}})(e).type)),o=D(t,"header"),l=D(t,"footer");if(o||l){const e=D(t,"body");return!o||e||l?o||e||!l?y.none():y.some("footer"):y.some("header")}return y.some("body")},Ro=(e,t)=>H(e.all,(e=>E(e.cells,(e=>Z(t,e.element))))),Oo=(e,t,o)=>{const l=(e=>{const t=[],o=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(o);return t})(N(t.selection,(t=>{return(l=t,((e,t,o=h)=>o(t)?y.none():D(e,z(t))?y.some(t):ue(t,e.join(","),(e=>X(e,"table")||o(e))))(["td","th"],l,n)).bind((t=>Ro(e,t))).filter(o);var l,n})));return n=l,l.length>0?y.some(n):y.none();var n},_o=(e,t)=>Oo(e,t,f),Do=(e,t)=>q(t,(t=>((e,t)=>Ro(e,t).exists((e=>!e.isLocked)))(e,t))),Io=(e,t)=>((e,t)=>t.mergable)(0,t).filter((t=>Do(e,t.cells))),Mo=(e,t)=>((e,t)=>t.unmergable)(0,t).filter((t=>Do(e,t))),No=((e=>{if(!n(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=[],o={};P(e,((l,r)=>{const a=w(l);if(1!==a.length)throw new Error("one and only one name per case");const s=a[0],c=l[s];if(void 0!==o[s])throw new Error("duplicate key detected:"+s);if("cata"===s)throw new Error("cannot have a case named cata (sorry)");if(!n(c))throw new Error("case arguments must be an array");t.push(s),o[s]=(...o)=>{const l=o.length;if(l!==c.length)throw new Error("Wrong number of arguments to case "+s+". Expected "+c.length+" ("+c+"), got "+l);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,o)},match:e=>{const l=w(e);if(t.length!==l.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+l.join(","));if(!q(t,(e=>D(l,e))))throw new Error("Not all branches were specified when using match. Specified: "+l.join(", ")+"\nRequired: "+t.join(", "));return e[s].apply(null,o)},log:e=>{console.log(e,{constructors:t,constructor:s,params:o})}}}}))})([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}]),(e,t)=>{const o=We(e);return _o(o,t).bind((e=>{const t=e[e.length-1],l=e[0].row,n=t.row+t.rowspan,r=o.all.slice(l,n);return Ao(r)})).getOr("")}),Po=e=>{return ve(e,"rgb")?ao(t=e).map(to).map((e=>"#"+e.value)).getOr(t):e;var t},ko=e=>{const t=V.fromDom(e);return{borderwidth:Ie(t,"border-width").getOr(""),borderstyle:Ie(t,"border-style").getOr(""),bordercolor:Ie(t,"border-color").map(Po).getOr(""),backgroundcolor:Ie(t,"background-color").map(Po).getOr("")}},Bo=e=>{const t=e[0],o=e.slice(1);return P(o,(e=>{P(w(t),(o=>{C(e,((e,l)=>{const n=t[o];""!==n&&o===l&&n!==e&&(t[o]="")}))}))})),t},Eo=(e,t,o,l)=>E(e,(e=>!a(o.formatter.matchNode(l,t+e)))).getOr(""),Fo=b(Eo,["left","center","right"],"align"),qo=b(Eo,["top","middle","bottom"],"valign"),Lo=e=>Fe(V.fromDom(e)).map((t=>{const o={selection:zt(e.cells)};return No(t,o)})).getOr(""),Ho=(e,t)=>{const o=We(e),l=(e=>F(e.all,(e=>e.cells)))(o),n=k(l,(e=>I(t,(t=>Z(e.element,t)))));return N(n,(e=>({element:e.element.dom,column:Ge(o,e.column).map((e=>e.element.dom))})))},jo=(e,t,o,l)=>{const n=l.getData();l.close(),e.undoManager.transact((()=>{((e,t,o,l)=>{const n=v(l,((e,t)=>o[t]!==e));T(n)>0&&t.length>=1&&Fe(t[0]).each((o=>{const r=Ho(o,t),a=T(v(n,((e,t)=>"scope"!==t&&"celltype"!==t)))>0,s=A(n,"celltype");(a||A(n,"scope"))&&((e,t,o,l)=>{const n=1===t.length;P(t,(t=>{const r=t.element,a=n?f:l,s=vo(e,r);((e,t,o,l)=>{l("scope")&&e.setAttrib("scope",o.scope),l("class")&&e.setAttrib("class",o.class),l("height")&&e.setStyle("height",Rt(o.height)),l("width")&&t.setStyle("width",Rt(o.width))})(s,t.column.map((t=>vo(e,t))).getOr(s),o,a),it(e)&&((e,t,o)=>{o("backgroundcolor")&&e.setFormat("tablecellbackgroundcolor",t.backgroundcolor),o("bordercolor")&&e.setFormat("tablecellbordercolor",t.bordercolor),o("borderstyle")&&e.setFormat("tablecellborderstyle",t.borderstyle),o("borderwidth")&&e.setFormat("tablecellborderwidth",Rt(t.borderwidth))})(s,o,a),l("halign")&&Qe(e,r,o.halign),l("valign")&&((e,t,o)=>{Ke.each("top middle bottom".split(" "),(l=>{l!==o&&e.formatter.remove("valign"+l,{},t)})),o&&e.formatter.apply("valign"+o,{},t)})(e,r,o.valign)}))})(e,r,l,b(A,n)),s&&((e,t)=>{e.execCommand("mceTableCellType",!1,{type:t.celltype,no_events:!0})})(e,l),Xe(e,o.dom,{structure:s,style:a})}))})(e,t,o,n),e.focus()}))},Vo=e=>{const t=Kt(e);if(0===t.length)return;const o=((e,t)=>{const o=Fe(t[0]).map((o=>N(Ho(o,t),(t=>((e,t,o,l)=>{const n=e.dom,r=(e,t)=>n.getStyle(e,t)||n.getAttrib(e,t);return{width:r(l.getOr(t),"width"),height:r(t,"height"),scope:n.getAttrib(t,"scope"),celltype:(a=t,a.nodeName.toLowerCase()),class:n.getAttrib(t,"class",""),halign:Fo(e,t),valign:qo(e,t),...o?ko(t):{}};var a})(e,t.element,it(e),t.column)))));return Bo(o.getOrDie())})(e,t),l={type:"tabpanel",tabs:[{title:"General",name:"general",items:So(e)},Co(e,"cell")]},n={type:"panel",items:[{type:"grid",columns:2,items:So(e)}]};e.windowManager.open({title:"Cell Properties",size:"normal",body:it(e)?l:n,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:o,onSubmit:b(jo,e,t,o)})},zo=[{type:"listbox",name:"type",label:"Row type",items:[{text:"Header",value:"header"},{text:"Body",value:"body"},{text:"Footer",value:"footer"}]},{type:"listbox",name:"align",label:"Alignment",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"Height",name:"height",type:"input"}],Wo=e=>zo.concat((e=>{const t=mo(ht(e));return t.length>0?y.some({name:"class",type:"listbox",label:"Class",items:t}):y.none()})(e).toArray()),$o=(e,t,o,l)=>{const n=l.getData();l.close(),e.undoManager.transact((()=>{((e,t,o,l)=>{const n=v(l,((e,t)=>o[t]!==e));if(T(n)>0){const o=A(n,"type"),r=!o||T(n)>1;r&&((e,t,o,l)=>{const n=1===t.length?f:l;P(t,(t=>{const r=vo(e,t);((e,t,o)=>{o("class")&&e.setAttrib("class",t.class),o("height")&&e.setStyle("height",Rt(t.height))})(r,o,n),mt(e)&&((e,t,o)=>{o("backgroundcolor")&&e.setStyle("background-color",t.backgroundcolor),o("bordercolor")&&e.setStyle("border-color",t.bordercolor),o("borderstyle")&&e.setStyle("border-style",t.borderstyle)})(r,o,n),l("align")&&Qe(e,t,o.align)}))})(e,t,l,b(A,n)),o&&((e,t)=>{e.execCommand("mceTableRowType",!1,{type:t.type,no_events:!0})})(e,l),Fe(V.fromDom(t[0])).each((t=>Xe(e,t.dom,{structure:o,style:r})))}})(e,t,o,n),e.focus()}))},Uo=e=>{const t=Jt(Ot(e),Wt.selected);if(0===t.length)return;const o=N(t,(t=>((e,t,o)=>{const l=e.dom;return{height:l.getStyle(t,"height")||l.getAttrib(t,"height"),class:l.getAttrib(t,"class",""),type:Lo(t),align:Fo(e,t),...o?ko(t):{}}})(e,t.dom,mt(e)))),l=Bo(o),n={type:"tabpanel",tabs:[{title:"General",name:"general",items:Wo(e)},Co(e,"row")]},r={type:"panel",items:[{type:"grid",columns:2,items:Wo(e)}]};e.windowManager.open({title:"Row Properties",size:"normal",body:mt(e)?n:r,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:l,onSubmit:b($o,e,N(t,(e=>e.dom)),l)})},Go=(e,t,o)=>{const l=o?[{type:"input",name:"cols",label:"Cols",inputMode:"numeric"},{type:"input",name:"rows",label:"Rows",inputMode:"numeric"}]:[],n=ut(e)?[{type:"input",name:"cellspacing",label:"Cell spacing",inputMode:"numeric"},{type:"input",name:"cellpadding",label:"Cell padding",inputMode:"numeric"},{type:"input",name:"border",label:"Border width"},{type:"label",label:"Caption",items:[{type:"checkbox",name:"caption",label:"Show caption"}]}]:[],r=t.length>0?[{type:"listbox",name:"class",label:"Class",items:t}]:[];return l.concat([{type:"input",name:"width",label:"Width"},{type:"input",name:"height",label:"Height"}]).concat(n).concat([{type:"listbox",name:"align",label:"Alignment",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]}]).concat(r)},Ko=(e,t,o,n)=>{if("TD"===t.tagName||"TH"===t.tagName)l(o)&&s(n)?e.setStyle(t,o,n):e.setStyles(t,o);else if(t.children)for(let l=0;l<t.children.length;l++)Ko(e,t.children[l],o,n)},Jo=(e,t,o,l)=>{const n=e.dom,r=l.getData(),s=v(r,((e,t)=>o[t]!==e));l.close(),""===r.class&&delete r.class,e.undoManager.transact((()=>{if(!t){const o=Re(r.cols).getOr(1),l=Re(r.rows).getOr(1);e.execCommand("mceInsertTable",!1,{rows:l,columns:o}),t=Gt(Ot(e),At(e)).bind((t=>Fe(t,At(e)))).map((e=>e.dom)).getOrDie()}if(T(s)>0){((e,t,o)=>{const l=e.dom,n={},r={};if(a(o.class)||(n.class=o.class),r.height=Rt(o.height),bt(e)?r.width=Rt(o.width):l.getAttrib(t,"width")&&(n.width=(e=>e?e.replace(/px$/,""):"")(o.width)),bt(e)?(r["border-width"]=Rt(o.border),r["border-spacing"]=Rt(o.cellspacing)):(n.border=o.border,n.cellpadding=o.cellpadding,n.cellspacing=o.cellspacing),bt(e)&&t.children)for(let n=0;n<t.children.length;n++)Ko(l,t.children[n],{"border-width":Rt(o.border),padding:Rt(o.cellpadding)}),dt(e)&&Ko(l,t.children[n],{"border-color":o.bordercolor});if(dt(e)){const e=o;r["background-color"]=e.backgroundcolor,r["border-color"]=e.bordercolor,r["border-style"]=e.borderstyle}n.style=l.serializeStyle({...Tt(e),...r}),l.setAttribs(t,{...xt(e),...n})})(e,t,r);const o=n.select("caption",t)[0];(o&&!r.caption||!o&&r.caption)&&e.execCommand("mceTableToggleCaption"),Qe(e,t,r.align)}if(e.focus(),e.addVisual(),T(s)>0){const o=A(s,"caption"),l=!o||T(s)>1;Xe(e,t,{structure:o,style:l})}}))},Qo=(e,t)=>{const o=e.dom;let l,n=((e,t)=>{const o=Tt(e),l=xt(e),n=t?{borderstyle:x(o,"border-style").getOr(""),bordercolor:Po(x(o,"border-color").getOr("")),backgroundcolor:Po(x(o,"background-color").getOr(""))}:{};return{height:"",width:"100%",cellspacing:"",cellpadding:"",caption:!1,class:"",align:"",border:"",...o,...l,...n,...(()=>{const t=o["border-width"];return bt(e)&&t?{border:t}:x(l,"border").fold((()=>({})),(e=>({border:e})))})(),...{...x(o,"border-spacing").or(x(l,"cellspacing")).fold((()=>({})),(e=>({cellspacing:e}))),...x(o,"border-padding").or(x(l,"cellpadding")).fold((()=>({})),(e=>({cellpadding:e})))}}})(e,dt(e));t?(n.cols="1",n.rows="1",dt(e)&&(n.borderstyle="",n.bordercolor="",n.backgroundcolor="")):(l=o.getParent(e.selection.getStart(),"table",e.getBody()),l?n=((e,t,o)=>{const l=e.dom,n=bt(e)?l.getStyle(t,"border-spacing")||l.getAttrib(t,"cellspacing"):l.getAttrib(t,"cellspacing")||l.getStyle(t,"border-spacing"),r=bt(e)?Je(l,t,"padding")||l.getAttrib(t,"cellpadding"):l.getAttrib(t,"cellpadding")||Je(l,t,"padding");return{width:l.getStyle(t,"width")||l.getAttrib(t,"width"),height:l.getStyle(t,"height")||l.getAttrib(t,"height"),cellspacing:null!=n?n:"",cellpadding:null!=r?r:"",border:((t,o)=>{const l=Ie(V.fromDom(o),"border-width");return bt(e)&&l.isSome()?l.getOr(""):t.getAttrib(o,"border")||Je(e.dom,o,"border-width")||Je(e.dom,o,"border")||""})(l,t),caption:!!l.select("caption",t)[0],class:l.getAttrib(t,"class",""),align:Fo(e,t),...o?ko(t):{}}})(e,l,dt(e)):dt(e)&&(n.borderstyle="",n.bordercolor="",n.backgroundcolor=""));const r=mo(ft(e));r.length>0&&n.class&&(n.class=n.class.replace(/\s*mce\-item\-table\s*/g,""));const a={type:"grid",columns:2,items:Go(e,r,t)},s=dt(e)?{type:"tabpanel",tabs:[{title:"General",name:"general",items:[a]},Co(e,"table")]}:{type:"panel",items:[a]};e.windowManager.open({title:"Table Properties",size:"normal",body:s,onSubmit:b(Jo,e,l,n),buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:n})},Xo=u,Yo=e=>{const t=(e,t)=>ye(e,t).exists((e=>parseInt(e,10)>1));return e.length>0&&q(e,(e=>t(e,"rowspan")||t(e,"colspan")))?y.some(e):y.none()},Zo=(e,t,o)=>{return t.length<=1?y.none():(l=e,n=o.firstSelectedSelector,r=o.lastSelectedSelector,Vt(l,n,r).bind((e=>{const t=e=>Z(l,e),o="thead,tfoot,tbody,table",n=ue(e.first,o,t),r=ue(e.last,o,t);return n.bind((t=>r.bind((o=>Z(t,o)?((e,t,o)=>{const l=It(e);return Dt(l,t,o)})(e.table,e.first,e.last):y.none()))))}))).map((e=>({bounds:e,cells:t})));var l,n,r},el=e=>{const t=so(y.none()),o=so([]);let l=y.none();const n=Q("caption"),r=e=>l.forall((t=>!t[e])),a=()=>Ut(Ot(e),At(e)).bind((t=>{return o=Ce(Fe(t),Ut((e=>V.fromDom(e.selection.getEnd()))(e),At(e)).bind(Fe),((o,l)=>Z(o,l)?n(t)?y.some((e=>({element:e,mergable:y.none(),unmergable:y.none(),selection:[e]}))(t)):y.some(((e,t,o)=>({element:o,mergable:Zo(t,e,Wt),unmergable:Yo(e),selection:Xo(e)}))(Kt(e),o,t)):y.none())),o.bind(u);var o})),s=e=>Fe(e.element).map((t=>{const o=We(t),l=_o(o,e).getOr([]),n=B(l,((e,t)=>(t.isLocked&&(e.onAny=!0,0===t.column?e.onFirst=!0:t.column+t.colspan>=o.grid.columns&&(e.onLast=!0)),e)),{onAny:!1,onFirst:!1,onLast:!1});return{mergeable:Io(o,e).isSome(),unmergeable:Mo(o,e).isSome(),locked:n}})),c=()=>{t.set((e=>{let t,o=!1;return(...l)=>(o||(o=!0,t=e.apply(null,l)),t)})(a)()),l=t.get().bind(s),P(o.get(),g)},i=e=>(e(),o.set(o.get().concat([e])),()=>{o.set(k(o.get(),(t=>t!==e)))}),m=(e,o)=>i((()=>t.get().fold((()=>{e.setEnabled(!1)}),(t=>{e.setEnabled(!o(t))})))),d=(e,o,l)=>i((()=>t.get().fold((()=>{e.setEnabled(!1),e.setActive(!1)}),(t=>{e.setEnabled(!o(t)),e.setActive(l(t))})))),p=e=>l.exists((t=>t.locked[e])),b=(t,o)=>l=>d(l,(e=>n(e.element)),(()=>e.queryCommandValue(t)===o)),f=b("mceTableRowType","header"),w=b("mceTableColType","th");return e.on("NodeChange ExecCommand TableSelectorChange",c),{onSetupTable:e=>m(e,(e=>!1)),onSetupCellOrRow:e=>m(e,(e=>n(e.element))),onSetupColumn:e=>t=>m(t,(t=>n(t.element)||p(e))),onSetupPasteable:e=>t=>m(t,(t=>n(t.element)||e().isNone())),onSetupPasteableColumn:(e,t)=>o=>m(o,(o=>n(o.element)||e().isNone()||p(t))),onSetupMergeable:e=>m(e,(e=>r("mergeable"))),onSetupUnmergeable:e=>m(e,(e=>r("unmergeable"))),resetTargets:c,onSetupTableWithCaption:t=>d(t,h,(t=>Fe(t.element,At(e)).exists((e=>pe(e,"caption").isSome())))),onSetupTableRowHeaders:f,onSetupTableColumnHeaders:w,targets:t.get}};var tl=tinymce.util.Tools.resolve("tinymce.FakeClipboard");const ol=e=>{var t;const o=null!==(t=tl.read())&&void 0!==t?t:[];return H(o,(t=>y.from(t.getType(e))))},ll=()=>ol("x-tinymce/dom-table-rows"),nl=()=>ol("x-tinymce/dom-table-columns");e.add("table",(e=>{const t=el(e);(e=>{const t=e.options.register;t("table_border_widths",{processor:"object[]",default:tt}),t("table_border_styles",{processor:"object[]",default:ot}),t("table_cell_advtab",{processor:"boolean",default:!0}),t("table_row_advtab",{processor:"boolean",default:!0}),t("table_advtab",{processor:"boolean",default:!0}),t("table_appearance_options",{processor:"boolean",default:!0}),t("table_grid",{processor:"boolean",default:!et.deviceType.isTouch()}),t("table_cell_class_list",{processor:"object[]",default:[]}),t("table_row_class_list",{processor:"object[]",default:[]}),t("table_class_list",{processor:"object[]",default:[]}),t("table_toolbar",{processor:"string",default:"tableprops tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol"}),t("table_background_color_map",{processor:"object[]",default:[]}),t("table_border_color_map",{processor:"object[]",default:[]})})(e),(e=>{C({mceTableProps:b(Qo,e,!1),mceTableRowProps:b(Uo,e),mceTableCellProps:b(Vo,e)},((t,o)=>e.addCommand(o,(()=>t())))),e.addCommand("mceInsertTableDialog",(t=>{Qo(e,!0)}))})(e),((e,t)=>{const o=t=>()=>e.execCommand(t),l=(t,l)=>!!e.queryCommandSupported(l.command)&&(e.ui.registry.addMenuItem(t,{...l,onAction:c(l.onAction)?l.onAction:o(l.command)}),!0),n=(t,l)=>{e.queryCommandSupported(l.command)&&e.ui.registry.addToggleMenuItem(t,{...l,onAction:c(l.onAction)?l.onAction:o(l.command)})},r=t=>{e.execCommand("mceInsertTable",!1,{rows:t.numRows,columns:t.numColumns})},a=[l("tableinsertrowbefore",{text:"Insert row before",icon:"table-insert-row-above",command:"mceTableInsertRowBefore",onSetup:t.onSetupCellOrRow}),l("tableinsertrowafter",{text:"Insert row after",icon:"table-insert-row-after",command:"mceTableInsertRowAfter",onSetup:t.onSetupCellOrRow}),l("tabledeleterow",{text:"Delete row",icon:"table-delete-row",command:"mceTableDeleteRow",onSetup:t.onSetupCellOrRow}),l("tablerowprops",{text:"Row properties",icon:"table-row-properties",command:"mceTableRowProps",onSetup:t.onSetupCellOrRow}),l("tablecutrow",{text:"Cut row",icon:"cut-row",command:"mceTableCutRow",onSetup:t.onSetupCellOrRow}),l("tablecopyrow",{text:"Copy row",icon:"duplicate-row",command:"mceTableCopyRow",onSetup:t.onSetupCellOrRow}),l("tablepasterowbefore",{text:"Paste row before",icon:"paste-row-before",command:"mceTablePasteRowBefore",onSetup:t.onSetupPasteable(ll)}),l("tablepasterowafter",{text:"Paste row after",icon:"paste-row-after",command:"mceTablePasteRowAfter",onSetup:t.onSetupPasteable(ll)})],s=[l("tableinsertcolumnbefore",{text:"Insert column before",icon:"table-insert-column-before",command:"mceTableInsertColBefore",onSetup:t.onSetupColumn("onFirst")}),l("tableinsertcolumnafter",{text:"Insert column after",icon:"table-insert-column-after",command:"mceTableInsertColAfter",onSetup:t.onSetupColumn("onLast")}),l("tabledeletecolumn",{text:"Delete column",icon:"table-delete-column",command:"mceTableDeleteCol",onSetup:t.onSetupColumn("onAny")}),l("tablecutcolumn",{text:"Cut column",icon:"cut-column",command:"mceTableCutCol",onSetup:t.onSetupColumn("onAny")}),l("tablecopycolumn",{text:"Copy column",icon:"duplicate-column",command:"mceTableCopyCol",onSetup:t.onSetupColumn("onAny")}),l("tablepastecolumnbefore",{text:"Paste column before",icon:"paste-column-before",command:"mceTablePasteColBefore",onSetup:t.onSetupPasteableColumn(nl,"onFirst")}),l("tablepastecolumnafter",{text:"Paste column after",icon:"paste-column-after",command:"mceTablePasteColAfter",onSetup:t.onSetupPasteableColumn(nl,"onLast")})],i=[l("tablecellprops",{text:"Cell properties",icon:"table-cell-properties",command:"mceTableCellProps",onSetup:t.onSetupCellOrRow}),l("tablemergecells",{text:"Merge cells",icon:"table-merge-cells",command:"mceTableMergeCells",onSetup:t.onSetupMergeable}),l("tablesplitcells",{text:"Split cell",icon:"table-split-cells",command:"mceTableSplitCells",onSetup:t.onSetupUnmergeable})];pt(e)?e.ui.registry.addNestedMenuItem("inserttable",{text:"Table",icon:"table",getSubmenuItems:()=>[{type:"fancymenuitem",fancytype:"inserttable",onAction:r}]}):e.ui.registry.addMenuItem("inserttable",{text:"Table",icon:"table",onAction:o("mceInsertTableDialog")}),e.ui.registry.addMenuItem("inserttabledialog",{text:"Insert table",icon:"table",onAction:o("mceInsertTableDialog")}),l("tableprops",{text:"Table properties",onSetup:t.onSetupTable,command:"mceTableProps"}),l("deletetable",{text:"Delete table",icon:"table-delete-table",onSetup:t.onSetupTable,command:"mceTableDelete"}),D(a,!0)&&e.ui.registry.addNestedMenuItem("row",{type:"nestedmenuitem",text:"Row",getSubmenuItems:d("tableinsertrowbefore tableinsertrowafter tabledeleterow tablerowprops | tablecutrow tablecopyrow tablepasterowbefore tablepasterowafter")}),D(s,!0)&&e.ui.registry.addNestedMenuItem("column",{type:"nestedmenuitem",text:"Column",getSubmenuItems:d("tableinsertcolumnbefore tableinsertcolumnafter tabledeletecolumn | tablecutcolumn tablecopycolumn tablepastecolumnbefore tablepastecolumnafter")}),D(i,!0)&&e.ui.registry.addNestedMenuItem("cell",{type:"nestedmenuitem",text:"Cell",getSubmenuItems:d("tablecellprops tablemergecells tablesplitcells")}),e.ui.registry.addContextMenu("table",{update:()=>(t.resetTargets(),t.targets().fold(d(""),(e=>"caption"===z(e.element)?"tableprops deletetable":"cell row column | advtablesort | tableprops deletetable")))});const m=bo(ft(e));0!==m.length&&e.queryCommandSupported("mceTableToggleClass")&&e.ui.registry.addNestedMenuItem("tableclass",{icon:"table-classes",text:"Table styles",getSubmenuItems:()=>uo(e,m,"tableclass",(t=>e.execCommand("mceTableToggleClass",!1,t))),onSetup:t.onSetupTable});const u=bo(gt(e));0!==u.length&&e.queryCommandSupported("mceTableCellToggleClass")&&e.ui.registry.addNestedMenuItem("tablecellclass",{icon:"table-cell-classes",text:"Cell styles",getSubmenuItems:()=>uo(e,u,"tablecellclass",(t=>e.execCommand("mceTableCellToggleClass",!1,t))),onSetup:t.onSetupCellOrRow}),e.queryCommandSupported("mceTableApplyCellStyle")&&(e.ui.registry.addNestedMenuItem("tablecellvalign",{icon:"vertical-align",text:"Vertical align",getSubmenuItems:()=>uo(e,Qt,"tablecellverticalalign",po(e,"vertical-align")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addNestedMenuItem("tablecellborderwidth",{icon:"border-width",text:"Border width",getSubmenuItems:()=>uo(e,st(e),"tablecellborderwidth",po(e,"border-width")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addNestedMenuItem("tablecellborderstyle",{icon:"border-style",text:"Border style",getSubmenuItems:()=>uo(e,ct(e),"tablecellborderstyle",po(e,"border-style")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addNestedMenuItem("tablecellbackgroundcolor",{icon:"cell-background-color",text:"Background color",getSubmenuItems:()=>ho(e,wt(e),"background-color"),onSetup:t.onSetupCellOrRow}),e.ui.registry.addNestedMenuItem("tablecellbordercolor",{icon:"cell-border-color",text:"Border color",getSubmenuItems:()=>ho(e,St(e),"border-color"),onSetup:t.onSetupCellOrRow})),n("tablecaption",{icon:"table-caption",text:"Table caption",command:"mceTableToggleCaption",onSetup:t.onSetupTableWithCaption}),n("tablerowheader",{text:"Row header",icon:"table-top-header",command:"mceTableRowType",onAction:fo(e),onSetup:t.onSetupTableRowHeaders}),n("tablecolheader",{text:"Column header",icon:"table-left-header",command:"mceTableColType",onAction:yo(e),onSetup:t.onSetupTableRowHeaders})})(e,t),((e,t)=>{e.ui.registry.addMenuButton("table",{tooltip:"Table",icon:"table",fetch:e=>e("inserttable | cell row column | advtablesort | tableprops deletetable")});const o=t=>()=>e.execCommand(t),l=(t,l)=>{e.queryCommandSupported(l.command)&&e.ui.registry.addButton(t,{...l,onAction:c(l.onAction)?l.onAction:o(l.command)})},n=(t,l)=>{e.queryCommandSupported(l.command)&&e.ui.registry.addToggleButton(t,{...l,onAction:c(l.onAction)?l.onAction:o(l.command)})};l("tableprops",{tooltip:"Table properties",command:"mceTableProps",icon:"table",onSetup:t.onSetupTable}),l("tabledelete",{tooltip:"Delete table",command:"mceTableDelete",icon:"table-delete-table",onSetup:t.onSetupTable}),l("tablecellprops",{tooltip:"Cell properties",command:"mceTableCellProps",icon:"table-cell-properties",onSetup:t.onSetupCellOrRow}),l("tablemergecells",{tooltip:"Merge cells",command:"mceTableMergeCells",icon:"table-merge-cells",onSetup:t.onSetupMergeable}),l("tablesplitcells",{tooltip:"Split cell",command:"mceTableSplitCells",icon:"table-split-cells",onSetup:t.onSetupUnmergeable}),l("tableinsertrowbefore",{tooltip:"Insert row before",command:"mceTableInsertRowBefore",icon:"table-insert-row-above",onSetup:t.onSetupCellOrRow}),l("tableinsertrowafter",{tooltip:"Insert row after",command:"mceTableInsertRowAfter",icon:"table-insert-row-after",onSetup:t.onSetupCellOrRow}),l("tabledeleterow",{tooltip:"Delete row",command:"mceTableDeleteRow",icon:"table-delete-row",onSetup:t.onSetupCellOrRow}),l("tablerowprops",{tooltip:"Row properties",command:"mceTableRowProps",icon:"table-row-properties",onSetup:t.onSetupCellOrRow}),l("tableinsertcolbefore",{tooltip:"Insert column before",command:"mceTableInsertColBefore",icon:"table-insert-column-before",onSetup:t.onSetupColumn("onFirst")}),l("tableinsertcolafter",{tooltip:"Insert column after",command:"mceTableInsertColAfter",icon:"table-insert-column-after",onSetup:t.onSetupColumn("onLast")}),l("tabledeletecol",{tooltip:"Delete column",command:"mceTableDeleteCol",icon:"table-delete-column",onSetup:t.onSetupColumn("onAny")}),l("tablecutrow",{tooltip:"Cut row",command:"mceTableCutRow",icon:"cut-row",onSetup:t.onSetupCellOrRow}),l("tablecopyrow",{tooltip:"Copy row",command:"mceTableCopyRow",icon:"duplicate-row",onSetup:t.onSetupCellOrRow}),l("tablepasterowbefore",{tooltip:"Paste row before",command:"mceTablePasteRowBefore",icon:"paste-row-before",onSetup:t.onSetupPasteable(ll)}),l("tablepasterowafter",{tooltip:"Paste row after",command:"mceTablePasteRowAfter",icon:"paste-row-after",onSetup:t.onSetupPasteable(ll)}),l("tablecutcol",{tooltip:"Cut column",command:"mceTableCutCol",icon:"cut-column",onSetup:t.onSetupColumn("onAny")}),l("tablecopycol",{tooltip:"Copy column",command:"mceTableCopyCol",icon:"duplicate-column",onSetup:t.onSetupColumn("onAny")}),l("tablepastecolbefore",{tooltip:"Paste column before",command:"mceTablePasteColBefore",icon:"paste-column-before",onSetup:t.onSetupPasteableColumn(nl,"onFirst")}),l("tablepastecolafter",{tooltip:"Paste column after",command:"mceTablePasteColAfter",icon:"paste-column-after",onSetup:t.onSetupPasteableColumn(nl,"onLast")}),l("tableinsertdialog",{tooltip:"Insert table",command:"mceInsertTableDialog",icon:"table"});const r=bo(ft(e));0!==r.length&&e.queryCommandSupported("mceTableToggleClass")&&e.ui.registry.addMenuButton("tableclass",{icon:"table-classes",tooltip:"Table styles",fetch:go(e,r,"tableclass",(t=>e.execCommand("mceTableToggleClass",!1,t))),onSetup:t.onSetupTable});const a=bo(gt(e));0!==a.length&&e.queryCommandSupported("mceTableCellToggleClass")&&e.ui.registry.addMenuButton("tablecellclass",{icon:"table-cell-classes",tooltip:"Cell styles",fetch:go(e,a,"tablecellclass",(t=>e.execCommand("mceTableCellToggleClass",!1,t))),onSetup:t.onSetupCellOrRow}),e.queryCommandSupported("mceTableApplyCellStyle")&&(e.ui.registry.addMenuButton("tablecellvalign",{icon:"vertical-align",tooltip:"Vertical align",fetch:go(e,Qt,"tablecellverticalalign",po(e,"vertical-align")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addMenuButton("tablecellborderwidth",{icon:"border-width",tooltip:"Border width",fetch:go(e,st(e),"tablecellborderwidth",po(e,"border-width")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addMenuButton("tablecellborderstyle",{icon:"border-style",tooltip:"Border style",fetch:go(e,ct(e),"tablecellborderstyle",po(e,"border-style")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addMenuButton("tablecellbackgroundcolor",{icon:"cell-background-color",tooltip:"Background color",fetch:t=>t(ho(e,wt(e),"background-color")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addMenuButton("tablecellbordercolor",{icon:"cell-border-color",tooltip:"Border color",fetch:t=>t(ho(e,St(e),"border-color")),onSetup:t.onSetupCellOrRow})),n("tablecaption",{tooltip:"Table caption",icon:"table-caption",command:"mceTableToggleCaption",onSetup:t.onSetupTableWithCaption}),n("tablerowheader",{tooltip:"Row header",icon:"table-top-header",command:"mceTableRowType",onAction:fo(e),onSetup:t.onSetupTableRowHeaders}),n("tablecolheader",{tooltip:"Column header",icon:"table-left-header",command:"mceTableColType",onAction:yo(e),onSetup:t.onSetupTableColumnHeaders})})(e,t),(e=>{const t=yt(e);t.length>0&&e.ui.registry.addContextToolbar("table",{predicate:t=>e.dom.is(t,"table")&&e.getBody().contains(t),items:t,scope:"node",position:"node"})})(e)}))}();