From ee9e28c1d9f190641d011d41be3b5c8bea602c03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Tue, 9 Jan 2024 19:53:22 -0500 Subject: [PATCH] update plugins, add fetching scripts :3 --- .gitignore | 2 + .vscode/settings.json | 3 + plugins/a11ychecker/plugin.min.js | 4 +- plugins/advcode/plugin.min.js | 4 +- plugins/advtemplate/plugin.min.js | 4 +- plugins/ai/plugin.min.js | 4 +- plugins/anchor/plugin.min.js | 2 +- plugins/autolink/plugin.min.js | 2 +- plugins/charmap/plugin.min.js | 2 +- plugins/codesample/plugin.min.js | 2 +- plugins/emoticons/plugin.min.js | 2 +- plugins/image/plugin.min.js | 4 +- plugins/link/plugin.min.js | 4 +- plugins/lists/plugin.min.js | 4 +- plugins/media/plugin.min.js | 4 +- plugins/mediaembed/plugin.min.js | 4 +- plugins/mentions/plugin.min.js | 4 +- plugins/pageembed/plugin.min.js | 4 +- plugins/powerpaste/plugin.min.js | 4 +- plugins/searchreplace/plugin.min.js | 4 +- plugins/table/plugin.min.js | 2 +- plugins/tinycomments/plugin.min.js | 4 +- plugins/tinymcespellchecker/plugin.min.js | 4 +- plugins/typography/plugin.min.js | 6 +- plugins/visualblocks/plugin.min.js | 2 +- plugins/wordcount/plugin.min.js | 2 +- scripts/fetchLatest.js | 28 + scripts/package.json | 15 + scripts/yarn.lock | 60 + tinymce.d.ts | 3251 +-------------------- tinymce.min.js | 41 +- 31 files changed, 226 insertions(+), 3256 deletions(-) create mode 100644 .gitignore create mode 100644 .vscode/settings.json create mode 100644 scripts/fetchLatest.js create mode 100644 scripts/package.json create mode 100644 scripts/yarn.lock diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5817028 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +scripts/node_modules/ +*.har diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..9092697 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "nuxt.isNuxtApp": false +} \ No newline at end of file diff --git a/plugins/a11ychecker/plugin.min.js b/plugins/a11ychecker/plugin.min.js index 38c0250..9a9290c 100644 --- a/plugins/a11ychecker/plugin.min.js +++ b/plugins/a11ychecker/plugin.min.js @@ -4,7 +4,7 @@ * Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc. * Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/ * - * Version: 3.2.1-70 + * Version: 3.3.1-77 */ -!function(){"use strict";const e=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(r=o=e,(a=String).prototype.isPrototypeOf(r)||(null===(n=o.constructor)||void 0===n?void 0:n.name)===a.name)?"string":t;var r,o,a,n})(t)===e,r=e=>t=>typeof t===e,o=t("string"),a=t("object"),n=t("array"),i=r("boolean"),s=(void 0,e=>undefined===e);const l=e=>!(e=>null==e)(e),c=r("function"),u=r("number"),d=()=>{},p=e=>()=>e,h=e=>e,m=(e,t)=>e===t,y=e=>e(),g=p(!1),v=p(!0);class w{constructor(e,t){this.tag=e,this.value=t}static some(e){return new w(!0,e)}static none(){return w.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?w.some(e(this.value)):w.none()}bind(e){return this.tag?e(this.value):w.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:w.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 l(e)?w.some(e):w.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()"}}w.singletonNone=new w(!1);const b=e=>parseInt(e,10),f=(e,t)=>{const r=e-t;return 0===r?0:r>0?1:-1},k=(e,t,r)=>({major:e,minor:t,patch:r}),x=e=>{const t=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(e);return t?k(b(t[1]),b(t[2]),b(t[3])):k(0,0,0)},A=Array.prototype.slice,C=Array.prototype.indexOf,T=Array.prototype.push,D=(e,t)=>((e,t)=>C.call(e,t))(e,t)>-1,I=(e,t)=>{for(let r=0,o=e.length;r{const r=e.length,o=new Array(r);for(let a=0;a{for(let r=0,o=e.length;r{const r=[];for(let o=0,a=e.length;o(N(e,((e,o)=>{r=t(r,e,o)})),r),O=(e,t,r)=>{for(let o=0,a=e.length;oO(e,t,g),R=(e,t)=>(e=>{const t=[];for(let r=0,o=e.length;r{const t=A.call(e,0);return t.reverse(),t},H=p("html4"),q=p("html5"),$=p("a"),G=p("aa"),P=p("aaa"),L=e=>t=>t.options.get(e),j=L("a11ychecker_css_url"),B=L("a11ychecker_level"),V=L("a11ychecker_html_version"),F=L("a11ychecker_issue_url_callback"),z=L("a11ychecker_filter_issue"),U=e=>{var t;return null!==(t=e.options.get("a11ychecker_allow_decorative_images"))&&void 0!==t?t:e.options.get("a11y_advanced_options")},K=tinymce.util.I18n,J={"a11y.d1.description":"This paragraph looks like a heading. If it is a heading, please select a heading level.","a11y.d1.repair.block.h1":"Heading 1","a11y.d1.repair.block.h2":"Heading 2","a11y.d1.repair.block.h3":"Heading 3","a11y.d1.repair.block.h4":"Heading 4","a11y.d1.repair.block.h5":"Heading 5","a11y.d1.repair.block.h6":"Heading 6","a11y.d1.repair.info":"Select a heading level:","a11y.d2.description":"Headings must be applied in sequential order. For example: Heading 1 should be followed by Heading 2, not Heading 3.","a11y.d3.description":"Adjacent links with the same URL should be merged into one link","a11y.d4.description":"The selected text appears to be a list. Lists should be formatted using a list tag.","a11y.d5a.description":"Large text must have a contrast ratio of at least 3:1","a11y.d5b.description":"Text must have a contrast ratio of at least 4.5:1","a11y.d5c.description":"Text must have a contrast ratio of at least 7:1","a11y.h93.description":"ID attribute must be unique","a11y.h93.repair.info":"Make ID unique","a11y.h93.repair.deduplicate.others":"Keep this ID and remove all others","a11y.h93.repair.deduplicate.this":"Remove this ID","a11y.h93.repair.deduplicate.all":"Remove all IDs","a11y.i1.description.decorativeAllowed":"Images must be marked as decorative or have an alternative text description","a11y.i1.description.decorativeNotAllowed":"Images must have an alternative text description. Decorative images are not allowed.","a11y.i1.repair.errors.duplicate":"Alternative text cannot be the same as the filename","a11y.i1.repair.errors.empty":"Alternative text cannot be empty","a11y.i1.repair.info.decorativeAllowed":"Or provide alternative text:","a11y.i1.repair.info.decorativeNotAllowed":"Provide alternative text:","a11y.i1.repair.checkboxlabel":"Make image decorative:","a11y.i1.repair.checkboxtext":"Image is decorative","a11y.i2.description":"Alternative text must not be the same as the image filename","a11y.i2.repair.info":"Provide alternative text:","a11y.i3.description":"Image alternative text should be less than 100 characters","a11y.i3.repair.error":"Alternative text is {0} characters","a11y.t1.description":"Tables must have captions","a11y.t1.repair.errors.duplicate":"Table caption cannot be the same as the table summary","a11y.t1.repair.errors.empty":"Caption cannot be empty","a11y.t1.repair.info":"Provide caption:","a11y.t2.description":"Complex tables should have summaries","a11y.t2.repair.errors.duplicate":"Table summary cannot be the same as the table caption","a11y.t2.repair.errors.empty":"Summary cannot be empty","a11y.t2.repair.info":"Provide table summary:","a11y.t3.description":"Table caption and summary cannot have the same value","a11y.t4a.description":"Table elements must contain TR and TD tags","a11y.t4b.description":"Tables must have at least one header cell","a11y.t4b.repair.info":"Choose table header:","a11y.t4c.description":"Table headers must be applied to a row or a column","a11y.t4c.repair.header.col":"Header column","a11y.t4c.repair.header.row":"Header row","a11y.t4c.repair.info":"Select header scope:","a11y.t4c.repair.scope.col":"Column","a11y.t4c.repair.scope.colgroup":"Column group","a11y.t4c.repair.scope.row":"Row","a11y.t4c.repair.scope.rowgroup":"Row group","a11y.widget.counter":"Issue {0} of {1}","a11y.widget.ignore":"Ignore","a11y.widget.issue.none":"No accessibility issues detected","a11y.widget.next":"Next issue","a11y.widget.previous":"Previous issue","a11y.widget.legacyrepair":"Repair issue","a11y.widget.repair":"Repair","a11y.widget.title":"Accessibility Checker","a11y.widget.help.title":"Click for more info","a11y.control.tooltip":"Accessibility checker","a11y.control.menutext":"Accessibility checker...",error:"Error",warning:"Warning",info:"Info",success:"Success"},Q=e=>J[e],X=e=>Array.isArray(e)?K.translate([Q(e[0]),...e.slice(1)]):K.translate(Q(e)),Y=Object.keys,Z=Object.hasOwnProperty,ee=(e,t)=>{const r=Y(e);for(let o=0,a=r.length;o(t,r)=>{e[r]=t},re=(e,t)=>Z.call(e,t),oe="undefined"!=typeof window?window:Function("return this;")(),ae=(e,t)=>((e,t)=>{let r=null!=t?t:oe;for(let t=0;t{const t=ae("ownerDocument.defaultView",e);return a(e)&&((e=>((e,t)=>{const r=((e,t)=>ae(e,t))(e,t);if(null==r)throw new Error(e+" not available on this browser");return r})("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(ne(e).constructor.name))},se=e=>t=>(e=>e.dom.nodeType)(t)===e,le=e=>ce(e)&&ie(e.dom),ce=se(1),ue=se(3),de=se(9),pe=se(11),he=e=>t=>ce(t)&&t.dom.nodeName.toLowerCase()===e,me=(e,t,r)=>{((e,t,r)=>{if(!(o(r)||i(r)||u(r)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",r,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,r+"")})(e.dom,t,r)},ye=(e,t)=>{const r=e.dom.getAttribute(t);return null===r?void 0:r},ge=(e,t)=>w.from(ye(e,t)),ve=(e,t)=>{e.dom.removeAttribute(t)},we=(e=>{const t="ephox-foam".replace(/\./g,"-");return{resolve:e=>t+"-"+e}})().resolve,be=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},fe=(e,t)=>{const r=(t||document).createElement(e);return be(r)},ke=be,xe=(e,t)=>{const r=e.dom;if(1!==r.nodeType)return!1;{const e=r;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")}},Ae=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,Ce=(e,t)=>e.dom===t.dom,Te=e=>ke(e.dom.ownerDocument),De=e=>w.from(e.dom.parentNode).map(ke),Ie=e=>w.from(e.dom.previousSibling).map(ke),_e=e=>W(((e,t)=>{const r=[],o=e=>(r.push(e),t(e));let a=t(e);do{a=a.bind(o)}while(a.isSome());return r})(e,Ie)),Ne=e=>_(e.dom.childNodes,ke),Se=c(Element.prototype.attachShadow)&&c(Node.prototype.getRootNode)?e=>ke(e.dom.getRootNode()):e=>de(e)?e:Te(e),Me=e=>ke(e.dom.host),Oe=e=>{const t=ue(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const r=t.ownerDocument;return(e=>{const t=Se(e);return pe(r=t)&&l(r.dom.host)?w.some(t):w.none();var r})(ke(t)).fold((()=>r.body.contains(t)),(o=Oe,a=Me,e=>o(a(e))));var o,a},Ee=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return ke(t)},Re=(e,t)=>((e,r)=>S(Ne(e),(e=>xe(e,t))))(e),We=(e,t)=>((e,t)=>{const r=void 0===t?document:t.dom;return Ae(r)?[]:_(r.querySelectorAll(e),ke)})(t,e),He=(e,t,r)=>{me(e,t,r)},qe=(e,t,r)=>{ve(e,t),ve(e,r)},$e=e=>{const t=e.editor;return{start:t=>{((e,t,r,o,a,n)=>{N(e,(e=>{const r=((e,t,r,o)=>{switch(e){case"info":return w.some(t);case"warning":return w.some(r);case"error":return w.some(o);default:return w.none()}})(e.severity,o,a,n).toArray().concat([t]);N(r,(t=>{me(e.element,t,1)}))})),w.from(e[0]).each((e=>{He(e.element,r,e.severity)}))})(t,e.violation,e.current,e.info,e.warn,e.error)},moveTo:(r,o)=>{((e,t,r,o)=>{const a=We(e,"["+t+"]");N(a,(e=>{ve(e,t)})),He(r,t,o)})(ke(t.getBody()),e.current,r,o)},stop:()=>{((e,t,r,o,a,n)=>{const i=We(e,"["+t+"]");N(i,(e=>{N([t,r,o,a,n],(t=>{ve(e,t)})),qe(e,t,r)}))})(ke(t.getBody()),e.violation,e.current,e.info,e.warn,e.error)},exclude:t=>{qe(t,e.violation,e.current)}}},Ge="data-"+we("a11y-current-violation"),Pe="data-"+we("a11y-violation"),Le="data-"+we("a11y-severity-info"),je="data-"+we("a11y-severity-warn"),Be="data-"+we("a11y-severity-error"),Ve="data-"+we("accessibility-ignore"),Fe=p(Ve),ze=(e,t,r)=>{let o=e.dom;const a=c(r)?r:g;for(;o.parentNode;){o=o.parentNode;const e=ke(o);if(t(e))return w.some(e);if(a(e))break}return w.none()},Ue=(e,t)=>E(e.dom.childNodes,(e=>t(ke(e)))).map(ke),Ke=(e,t,r)=>ze(e,(e=>xe(e,t)),r),Je=(e,t)=>Ue(e,(e=>xe(e,t))),Qe=(e,t)=>((e,t)=>{const r=void 0===t?document:t.dom;return Ae(r)?w.none():w.from(r.querySelector(e)).map(ke)})(t,e),Xe=(e,t,r)=>((e,t,r,o,a)=>((e,t)=>xe(e,t))(r,o)?w.some(r):c(a)&&a(r)?w.none():t(r,o,a))(0,Ke,e,t,r),Ye=(e,t=!1)=>{return Oe(e)?e.dom.isContentEditable:(r=e,Xe(r,"[contenteditable]")).fold(p(t),(e=>"true"===Ze(e)));var r},Ze=e=>e.dom.contentEditable,et=e=>{const t=(e=>ze(e,le).exists(Ye))(e);return t&&le(e)&&Ye(e)},tt=(e,t)=>S(e.querySelectorAll(t),(e=>et(ke(e)))),rt=(e,t,r)=>R(t,(t=>"I1"===t.id?t.check(e,r)?[{rule:t,element:e}]:[]:t.check(e)?[{rule:t,element:e}]:[])),ot=(e,t)=>{let r=[];const o=((e,t)=>{const r=[],o=[];for(let t=0,n=e.length;txe(t,e)))&&le(t)&&et(t)){const o=rt(t.dom,n,e.allowDecorativeImages);r=r.concat(o)}}const c=((e,t)=>R(t,(t=>_(t.check(e),(e=>({rule:t,element:e}))))))(t,i);return r=r.concat(c),r.sort(((e,t)=>((e,t)=>e===t?0:((e,t)=>((e,t,r)=>0!=(e.compareDocumentPosition(t)&r))(e,t,Node.DOCUMENT_POSITION_PRECEDING))(e,t)?1:-1)(e.element,t.element))),r},at=(e,t)=>Qe(e,t).isSome(),nt=p("error"),it=p("warning"),st=(e,t)=>{const r=e;return r.matches?r.matches(t):r.webkitMatchesSelector?r.webkitMatchesSelector(t):r.mozMatchesSelector?r.mozMatchesSelector(t):!!r.msMatchesSelector&&r.msMatchesSelector(t)},lt=e=>e.length>0,ct=((e,t)=>{const r=t=>e(t)?w.from(t.dom.nodeValue):w.none();return{get:t=>{if(!e(t))throw new Error("Can only get text value of a text node");return r(t).getOr("")},getOption:r,set:(t,r)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=r}}})(ue),ut=e=>ct.get(e),dt=e=>pt(e).isSome(),pt=e=>Ue(e,(e=>ue(e)&<(ut(e).trim()))),ht="strong,b",mt=(e,t)=>pt(e).fold((()=>((e,t)=>{for(let r=0,o=e.length;rmt(e,t)))),(e=>((e,t)=>Ke(e,ht,(e=>Ce(e,t))).isSome())(e,t))),yt={id:"D1",wcag:"1.3.1",severity:it(),desckey:"a11y.d1.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H42.html",walkable:!0,check:e=>{const t=ke(e);return!(!st(e,"p")||!at(t,ht))&&mt(t,t)},levels:[$(),G(),P()],htmlversions:[H(),q()]},gt={id:"D2",wcag:"1.3.1",severity:nt(),desckey:"a11y.d2.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G141.html",walkable:!1,check:e=>{const t=tt(e,"h1,h2,h3,h4,h5,h6");let r;const o=[];return N(t,(e=>{const t=parseInt(e.tagName.slice(1),10);r&&t-r>1&&o.push(e),r=t})),o},levels:[$(),G(),P()],htmlversions:[H(),q()]},vt={id:"D3",wcag:"2.4.4",severity:nt(),desckey:"a11y.d3.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H2.html",walkable:!1,check:e=>{const t=ke(e),r=We(t,"a + a"),o=S(r,(e=>{const t=W(_e(e));return O(t,he("a"),(e=>{return!(ue(t=e)&&(r=ut(t).replace(/[\u200B-\u200D\uFEFF]/g,""),!lt(r)));var t,r})).exists((t=>t.dom.href===e.dom.href))&&et(e)}));return _(o,(e=>e.dom))},levels:[$(),G(),P()],htmlversions:[H(),q()]},wt=(e,t)=>{const r=e.nodeName,o=((e,t)=>{let r=e.nextSibling;for(;null!==r&&(t&&"#text"===r.nodeName||"BR"===r.nodeName);)r=r.nextSibling;return r})(e,t);return null!==o&&o.nodeName===r&&o},bt=(e,t,r)=>{const o=[];if(t(e)){o.push(e);let a=wt(e,r);for(;!1!==a&&t(a);)o.push(a),a=wt(a,r)}return o},ft=(e,t)=>{let r=-1;for(let o=0;o{const r=tt(e,"p,h1,h2,h3,h4,h5,h6"),o=[];let a=0;for(;a1){o.push(e);const t=n[n.length-1],i=ft(r,t);a=-1===i?a+1:i}else l(e.firstChild)?(bt(e.firstChild,t,!1).length>1&&o.push(e),a++):a++}return o},xt=e=>{var t;return l(null===(t=e.textContent)||void 0===t?void 0:t.match(/^\s{0,}([a-z1-9]|i+)\s{0,}[.)-]/gim))},At={id:"D4o",wcag:"1.3.1",severity:nt(),desckey:"a11y.d4.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H48.html",walkable:!1,check:e=>kt(e,xt),levels:[$(),G(),P()],htmlversions:[H(),q()]},Ct=e=>{var t;return l(null===(t=e.textContent)||void 0===t?void 0:t.match(/^\s{0,}(\*|-)\s{0,}/gim))},Tt={id:"D4u",wcag:"1.3.1",severity:nt(),desckey:"a11y.d4.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H48.html",walkable:!1,check:e=>kt(e,Ct),levels:[$(),G(),P()],htmlversions:[H(),q()]},Dt=(e,t)=>{const r=e.dom,o=window.getComputedStyle(r).getPropertyValue(t);return""!==o||Oe(e)?o:It(r,t)},It=(e,t)=>(e=>void 0!==e.style&&c(e.style.getPropertyValue))(e)?e.style.getPropertyValue(t):"",_t=(e,t,r,o)=>({red:e,green:t,blue:r,alpha:o}),Nt=e=>{const t=e=>e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=e.red/255,o=e.green/255,a=e.blue/255;return.2126*t(r)+.7152*t(o)+.0722*t(a)},St=(e,t)=>{const r=e.alpha+t.alpha*(1-e.alpha),o=(e.red*e.alpha+t.red*t.alpha*(1-e.alpha))/r,a=(e.green*e.alpha+t.green*t.alpha*(1-e.alpha))/r,n=(e.blue*e.alpha+t.blue*t.alpha*(1-e.alpha))/r;return _t(Math.ceil(o),Math.ceil(a),Math.ceil(n),r)},Mt=e=>{const t=(e,t,r,o)=>{const a=parseInt(e,10),n=parseInt(t,10),i=parseInt(r,10),s=parseFloat(o);return w.some(_t(a,n,i,s))};if("transparent"===e)return t("0","0","0","0");const r=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)/.exec(e);if(null!==r)return t(r[1],r[2],r[3],"1");const o=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d?(?:\.\d+)?)\)/.exec(e);return null!==o?t(o[1],o[2],o[3],o[4]):w.none()},Ot=(e,t)=>{const r=parseFloat(Dt(e,"opacity"));return r<1?_t(t.red,t.green,t.blue,t.alpha*r):t},Et=(e,t)=>Rt(e).filter((e=>e{const t=(e=>{const t=Te(e),r=Ee(t),o=[e].concat(((e,t)=>{const r=c(t)?t:g;let o=e.dom;const a=[];for(;null!==o.parentNode&&void 0!==o.parentNode;){const e=o.parentNode,t=ke(e);if(a.push(t),!0===r(t))break;o=e}return a})(e,(e=>Ce(e,r)))),a=M(o,((e,t)=>{if(1===e.alpha)return e;const r=Dt(t,"background-color");return Mt(r).bind((r=>{const o=Ot(t,r);return o.alpha>0?w.some(St(e,o)):w.none()})).getOr(e)}),_t(0,0,0,0));return a.alpha<1?St(a,_t(255,255,255,1)):a})(e);return((e,t)=>{const r=Dt(e,"color");return Mt(r).bind((r=>{const o=Ot(e,r),a=o.alpha<1?St(o,t):o;return w.some(a)}))})(e,t).map((e=>{const r=Nt(t);return((e,t)=>(Math.max(e,t)+.05)/(Math.min(e,t)+.05))(Nt(e),r)}))},Wt={id:"D5c",wcag:"1.4.3",severity:nt(),desckey:"a11y.d5c.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G17.html",walkable:!0,check:e=>{const t=ke(e);return dt(t)&&Et(t,7)},levels:[P()],htmlversions:[H(),q()]},Ht=e=>{const t=Dt(e,"font-size"),r=new RegExp(".*px").test(t),o=/(\d*\.?\d*)(.*)/.exec(t);return r&&null!==o?w.some(Number(o[1])):w.none()},qt=e=>{const t=(e=>{const t=Dt(e,"font-weight");return!("bold"!==t&&"bolder"!==t)||!!/^[0-9]*$/.test(r=t)&&parseInt(r,10)>=700;var r})(e),r=Te(e),o=Ee(r),a=Ht(o);return Ht(e).fold(g,(e=>a.fold((()=>e>=24||t&&e>=19),(r=>e>=1.5*r||t&&e>=1.2*r))))},$t={id:"D5a",wcag:"1.4.3",severity:nt(),desckey:"a11y.d5a.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G145.html",walkable:!0,check:e=>{const t=ke(e);return dt(t)&&qt(t)&&Et(t,3)},levels:[G()],htmlversions:[H(),q()]},Gt={id:"D5b",wcag:"1.4.3",severity:nt(),desckey:"a11y.d5b.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G18.html",walkable:!0,check:e=>{const t=ke(e);return dt(t)&&!qt(t)&&Et(t,4.5)},levels:[G()],htmlversions:[H(),q()]},Pt={id:"H93",wcag:"4.1.1",severity:nt(),desckey:"a11y.h93.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H93.html",walkable:!1,check:e=>{const t=ke(e),r=We(t,"*[id]"),o=M(r,((e,t)=>{const r=ye(t,"id");if(void 0!==r&&et(t)){if(re(e.problems,r))return e;if(re(e.ids,r)){const t=e.ids[r];return{...e,problems:{...e.problems,[r]:t}}}return{...e,ids:{...e.ids,[r]:t.dom}}}return e}),{ids:{},problems:{}});return((e,t)=>{const r=[];return ee(e,((e,o)=>{r.push(t(e,o))})),r})(o.problems,h)},levels:[$(),G(),P()],htmlversions:[H(),q()]},Lt=he("img"),jt={id:"I1",wcag:"1.1.1",severity:nt(),desckey:"a11y.i1.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G95.html",walkable:!0,check:(e,t)=>{const r=ke(e);if(!Lt(r))return!1;const o=ge(r,"alt"),a=o.isSome(),n=o.exists((e=>""===e.trim())),i=((e,t,r=m)=>e.exists((e=>r(e,t))))(ge(r,"role"),"presentation");return!a||(t?a&&n&&!i||a&&!n&&i:n||i)},levels:[$(),G(),P()],htmlversions:[H(),q()]},Bt={id:"I2",wcag:"1.1.1",severity:nt(),desckey:"a11y.i2.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G95.html",walkable:!0,check:e=>(e=>st(e,"img[alt][src]"))(e)&&e.src.split("/").pop()===e.alt.split("/").pop(),levels:[$(),G(),P()],htmlversions:[H(),q()]},Vt={id:"I3",wcag:"N/A",severity:it(),desckey:"a11y.i3.description",url:"",walkable:!0,check:e=>{const t=ke(e);return!!Lt(t)&&ge(t,"alt").exists((e=>e.length>100))},levels:[$(),G(),P()],htmlversions:[H(),q()]},Ft={id:"T1",wcag:"1.3.1",severity:nt(),desckey:"a11y.t1.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H39.html",walkable:!0,check:e=>{if(st(e,"table")){const t=e.querySelector("caption");return!t||st(t,":empty")}return!1},levels:[$(),G(),P()],htmlversions:[H(),q()]},zt={id:"T2",wcag:"1.3.1",severity:it(),desckey:"a11y.t2.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H73.html",walkable:!0,check:e=>st(e,"table")&&l(e.querySelector("[rowspan]")||e.querySelector("[colspan]"))&&!e.hasAttribute("summary"),levels:[$(),G(),P()],htmlversions:[H()]},Ut={id:"T3",wcag:"1.3.1",severity:nt(),desckey:"a11y.t3.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H73.html",walkable:!0,check:e=>{if(st(e,"table")&&e.hasAttribute("summary")){const t=e.querySelectorAll("caption");return t.length>0&&e.getAttribute("summary")===t[0].innerHTML}return!1},levels:[$(),G(),P()],htmlversions:[H(),q()]},Kt={id:"T4b",wcag:"1.3.1",severity:nt(),desckey:"a11y.t4b.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H51.html",walkable:!0,check:e=>"table"===e.nodeName.toLowerCase()&&0===e.querySelectorAll("th").length,levels:[$(),G(),P()],htmlversions:[H(),q()]},Jt={id:"T4c",wcag:"1.3.1",severity:nt(),desckey:"a11y.t4c.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H63.html",walkable:!0,check:e=>{return!("th"!==e.nodeName.toLowerCase()||(t=e).hasAttribute("scope")&&/row|col|rowgroup|colgroup/i.test(t.getAttribute("scope")));var t},levels:[$(),G(),P()],htmlversions:[H(),q()]},Qt=(e,t)=>0===e.querySelectorAll(t).length,Xt={id:"T4a",wcag:"1.3.1",severity:nt(),desckey:"a11y.t4a.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H51.html",walkable:!0,check:e=>{return"table"===e.nodeName.toLowerCase()&&(Qt(t=e,"tr")||Qt(t,"td"));var t},levels:[$(),G(),P()],htmlversions:[H(),q()]},Yt=e=>({id:e.id.toUpperCase(),severity:e.severity,url:e.url,description:X(e.description),element:e.element.dom}),Zt=t=>{const r=(e=>{const t=(e=>{const t=e.options.get("a11ychecker_ignored_rules");return R(tinymce.explode(t),(e=>e.length>0?[e.toUpperCase()]:[]))})(e),r=B(e),o=V(e);return{rules:S([yt,gt,vt,At,Tt,$t,Gt,Wt,Pt,jt,Bt,Vt,Ft,zt,Ut,Jt,Xt,Kt],(e=>!D(t,e.id.toUpperCase())&&D(e.levels,r)&&D(e.htmlversions,o))),allowDecorativeImages:U(e),ignoreSelectors:["img[data-mce-placeholder]","[data-mce-bogus=all] *","[data-mce-bogus]","[data-mce-mergetag-affix]"]}})(t);(e=>{e.on("init",(()=>{N([Ve,Pe,Le,je,Be,Ge],(t=>{e.serializer.addTempAttr(t)}))}))})(t);const o=e(!1),a=(e=>$e({editor:e,violation:Pe,current:Ge,info:Le,warn:je,error:Be}))(t),n=Fe();let i=[],s=0;const l=()=>{const e=ot(r,t.getBody()),o=((e,t)=>_(t,(t=>{const r=t.rule;return{id:r.id.toUpperCase(),description:"I1"!==r.id?r.desckey:U(e)?`${r.desckey}.decorativeAllowed`:`${r.desckey}.decorativeNotAllowed`,element:ke(t.element),url:r.url,severity:r.severity}})))(t,e);return S(o,(e=>{const r=(a=e.element,ge(a,n).map((e=>e.split(" "))).getOr([])),o=z(t);var a;return!D(r,e.id)&&o(Yt(e))}))},c=e=>(s+=e,s=s<0?s+i.length:s%i.length,a.moveTo(i[s].element,i[s].severity),t.selection.scrollIntoView(i[s].element.dom),{summaryLabel:X(["a11y.widget.counter",s+1,i.length]),issue:i[s],index:s+1}),u=()=>i.length>0?w.some(c(0)):w.none(),d=()=>{o.set(!0),i=l(),s=0},p=()=>{a.stop(),o.set(!1),s=0,i=[]};return{scan:()=>(d(),a.start(i),u()),stepIssue:c,getIssues:()=>i.slice(0),getCurrent:u,getReport:()=>{const e=o.get();try{return e||d(),_(i,Yt)}finally{e||p()}},resolveCurrent:e=>(e&&((e,t,r)=>{const o=ge(e,t).map((e=>e.concat(" ",r))).getOr(r);me(e,t,o)})(i[s].element,n,i[s].id),i=l(),u()),clear:p,isAuditing:()=>o.get()}},er=(e,t)=>{const r=t.ui.registry.getAll().icons;return w.from(r[e]).orThunk((()=>w.from(r["temporary-placeholder"]))).getOr("!not found!")},tr={success:"checkmark",info:"info",warning:"notice",error:"warning"},rr=(e,t,r,o,a)=>{const n=X(r),i=X(t);return`
${er(tr[r],e)}

${n}

${i}

`+((e,t,r)=>{const o=`
${er(e,t)}
`;return"help"===e?o:`
${er(e,t)}
`})(o,e,a)+"
"},or=(e,t,r,o)=>({type:"listbox",label:t,name:e,items:_(r,(e=>({text:o(e.text),value:e.value})))}),ar=(e,t)=>({type:"input",name:e,label:t}),nr=(e,t,r)=>({type:"label",label:t,items:[{type:"checkbox",name:e,label:r}]}),ir=(e,t)=>({title:X("a11y.widget.title"),body:{type:"panel",items:[{type:"panel",classes:["tox-accessibility-issue","accessibility-issue--success"],items:[{type:"htmlpanel",html:rr(e,"a11y.widget.issue.none","success","checkmark"),presets:"presentation"}]}]},buttons:[{type:"submit",name:"ok",text:"OK",primary:!0}],onSubmit:e=>e.close(),onClose:t}),sr=(e,t,r)=>{e.redial(t),e.focus(r)};var lr;!function(e){e.Next="next",e.Prev="prev",e.Ignore="ignore",e.Ok="ok",e.Repair="repair"}(lr||(lr={}));const cr=({issue:e,summaryLabel:t},r,o,a,n,i)=>{const s=F(n),l=e=>cr(e,r,o,w.none(),n,i),c=a=>(s,{name:c})=>{if(c===lr.Next||c===lr.Prev){const e=r.stepIssue(c===lr.Next?1:-1);sr(s,l(e),c)}else c===lr.Ignore?r.resolveCurrent(!0).fold((()=>sr(s,ir(n,i),lr.Ok)),(e=>sr(s,l(e),lr.Ignore))):c===lr.Repair&&((a,s)=>{const c=s=>{sr(a,cr({issue:e,summaryLabel:t},r,o,w.some(s),n,i),lr.Repair)},u=()=>r.resolveCurrent(!1).fold((()=>r.scan().fold((()=>sr(a,ir(n,i),lr.Ok)),(e=>sr(a,l(e),lr.Ignore)))),(e=>sr(a,l(e),lr.Ignore)));s.each((t=>{t.repair(e.element,e.id,((e,t)=>{const r={},o={};return((e,t,r,o)=>{ee(e,((e,a)=>{(t(e,a)?r:o)(e,a)}))})(e,t,te(r),te(o)),{t:r,f:o}})(a.getData(),((t,r)=>{return o=r,""===(a=e.id)||o.length>=a.length&&o.substr(0,0+a.length)===a;var o,a})).t,(e=>e.fold(c,u)))}))})(s,a)},u=t=>r=>t.each((t=>{t.onChange.each((t=>t(r,r.getData(),e))),t.shouldDisableRepair.each((t=>{const o=t(r.getData(),e);r.setEnabled(lr.Repair,!o)}))})),d=(r,o,a)=>{const l="warning"===(d=e.severity)?"warn":d;var d;const p=o.map((()=>({type:"panel",classes:["accessibility-issue__repair"],items:o.map((e=>e.items)).getOr([])}))).toArray();return{title:X("a11y.widget.title"),body:{type:"panel",classes:["tox-accessibility-issue",`accessibility-issue--${l}`],items:[{type:"panel",classes:["accessibility-issue__header"],items:[{type:"htmlpanel",html:`

${t}

`,presets:"presentation"},{type:"button",name:lr.Prev,text:X("a11y.widget.previous"),icon:"action-prev",borderless:!0},{type:"button",name:lr.Next,text:X("a11y.widget.next"),icon:"action-next",borderless:!0}]},{type:"htmlpanel",html:rr(n,e.description,e.severity,"help",s(e.id)),presets:"presentation"},...p]},buttons:[{type:"custom",name:lr.Ignore,text:X("a11y.widget.ignore")},{type:"custom",name:lr.Repair,text:X("a11y.widget.repair"),enabled:!a,primary:!0}],initialData:{...o.map((e=>e.initialData)).getOr({})},onAction:c(r),onChange:u(r),onClose:i}};return o(e.id).fold((()=>d(w.none(),w.none(),!0)),(t=>{const r=((e,t,r)=>{const o=t.element;return r.fold((()=>e.ui.map((e=>e(t.id,o)))),(r=>e.ui.map((e=>{const a=e(t.id,o);return{items:a.items.concat([(n=r.errorMessage,{type:"htmlpanel",html:`
${n}
`})]),initialData:{...a.initialData,...r.repairErrorData}};var n}))))})(t,e,a),o=t.shouldDisableRepair.bind((t=>r.map((r=>t(r.initialData,e))))).getOr(!1);return d(w.some(t),r,o)}))},ur=(e,t)=>{De(e).each((r=>{r.dom.insertBefore(t.dom,e.dom)}))},dr=(e,t)=>{const r=(e=>w.from(e.dom.nextSibling).map(ke))(e);r.fold((()=>{De(e).each((e=>{pr(e,t)}))}),(e=>{ur(e,t)}))},pr=(e,t)=>{e.dom.appendChild(t.dom)},hr=(e,t)=>{N(t,(t=>{pr(e,t)}))},mr=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},yr=e=>{const t=Ne(e);var r,o;t.length>0&&(r=e,N(o=t,((e,t)=>{const a=0===t?r:o[t-1];dr(a,e)}))),mr(e)},gr=e=>e.dom.innerHTML,vr=e=>{const t=t=>t(e),r=p(e),o=()=>a,a={tag:!0,inner:e,fold:(t,r)=>r(e),isValue:v,isError:g,map:t=>br.value(t(e)),mapError:o,bind:t,exists:t,forall:t,getOr:r,or:o,getOrThunk:r,orThunk:o,getOrDie:r,each:t=>{t(e)},toOptional:()=>w.some(e)};return a},wr=e=>{const t=()=>r,r={tag:!1,inner:e,fold:(t,r)=>t(e),isValue:g,isError:v,map:t,mapError:t=>br.error(t(e)),bind:t,exists:g,forall:v,getOr:h,or:h,getOrThunk:y,orThunk:y,getOrDie:(o=String(e),()=>{throw new Error(o)}),each:d,toOptional:w.none};var o;return r},br={value:vr,error:wr,fromOption:(e,t)=>e.fold((()=>wr(t)),vr)},fr=e=>((e,t)=>ke(e.dom.cloneNode(!0)))(e),kr=(e,t,r)=>br.error({errorMessage:t(e),repairErrorData:r}),xr=(e,t,r,o,a,n)=>0===t.length?kr(o,n,{}):Ar(e,t,r,a,n),Ar=(e,t,r,o,a)=>t===r?kr(o,a,{}):br.value(e),Cr=e=>{const t=e.split("/");return w.from(t.pop())},Tr=(e,t,r,o,a,n)=>{const i=ge(e,"src").bind(Cr).getOr(""),s=r[`${t}_textinput`];return r[`${t}_checkbox`]?(e=>(me(e,"alt",""),me(e,"role","presentation"),br.value(e)))(e):xr(e,s,i,o,a,n).map((e=>(me(e,"alt",s),"presentation"===ye(e,"role")&&ve(e,"role"),e)))},Dr=e=>e.dom.textContent,Ir=(e,t,r,o,a,n)=>{const i=ye(e,"summary");return xr(e,r[t],i,o,a,n).map((o=>{const a=Je(e,"caption").fold((()=>fe("caption")),(e=>{var t;return(t=e).dom.textContent="",N(Ne(t),(e=>{mr(e)})),e}));return((e,t)=>{e.dom.textContent=t})(a,r[t]),((e,t)=>{(e=>((e,t)=>{const r=e.dom.childNodes;return w.from(r[0]).map(ke)})(e))(e).fold((()=>{pr(e,t)}),(r=>{e.dom.insertBefore(t.dom,r.dom)}))})(o,a),o}))},_r=e=>`${e}_checkbox`,Nr=e=>`${e}_textinput`,Sr=(e,t)=>{const r=t.id,o=!0===e[_r(r)],a=e[Nr(r)].length>0;return!o&&!a},Mr=(e,t,r)=>{const o=r.id,a=_r(o),n=Nr(o);!0===t[a]?(e.setEnabled(n,!1),e.setEnabled(lr.Repair,!0)):(e.setEnabled(n,!0),t[n].length>0?(e.setEnabled(lr.Repair,!0),e.setEnabled(a,!0)):(e.setEnabled(a,!0),e.setEnabled(lr.Repair,!1)))},Or=(e,t)=>{const r=ar(Nr(t),X((o="a11y.i1.repair.info",e?`${o}.decorativeAllowed`:`${o}.decorativeNotAllowed`)));var o;return e?[nr(_r(t),X("a11y.i1.repair.checkboxlabel"),X("a11y.i1.repair.checkboxtext")),r]:[r]},Er=(e,t,r)=>{const o=ye(e,"alt"),a=t?{[_r(r)]:!1}:{};return{[Nr(r)]:o||"",...a}},Rr=e=>{const t=U(e),r={H93:w.some({ui:w.some(((e,t)=>({items:[or(e,X("a11y.h93.repair.info"),[{text:"a11y.h93.repair.deduplicate.others",value:"others"},{text:"a11y.h93.repair.deduplicate.this",value:"this"},{text:"a11y.h93.repair.deduplicate.all",value:"all"}],X)],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r,o)=>{const a=r[t],n="all"===a||"this"===a;if("all"===a||"others"===a){const t=ye(e,"id"),r=o.getBody(),a=ke(r),n=We(a,`*[id="${t}"]`),i=S(n,(t=>!Ce(t,e)));N(i,(e=>{ve(e,"id")}))}return n&&ve(e,"id"),br.value(e)})(t,r,o,e))}))},shouldDisableRepair:w.none(),onChange:w.none()}),I1:w.some({ui:w.some(((e,r)=>({items:Or(t,e),initialData:Er(r,t,e)}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(Tr(t,r,o,"a11y.i1.repair.errors.empty","a11y.i1.repair.errors.duplicate",X))}))},shouldDisableRepair:t?w.some(Sr):w.none(),onChange:t?w.some(Mr):w.none()}),I2:w.some({ui:w.some(((e,r)=>({items:Or(t,e),initialData:Er(r,t,e)}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(Tr(t,r,o,"a11y.i1.repair.errors.empty","a11y.i1.repair.errors.duplicate",X))}))},shouldDisableRepair:t?w.some(Sr):w.none(),onChange:t?w.some(Mr):w.none()}),I3:w.some({ui:w.some(((e,t)=>({items:Or(!1,e),initialData:Er(t,!1,e)}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r,o,a)=>{const n=r[`${t}_textinput`];return((e,t,r,o,a,n=100)=>{const i=`${t}_textinput`;return r.length>n?kr([o,r.length],a,{[i]:r}):br.value(e)})(e,t,n,o,a,100).map((e=>(me(e,"alt",n),e)))})(t,r,o,"a11y.i3.repair.error",X))}))},shouldDisableRepair:w.none(),onChange:w.none()}),T1:w.some({ui:w.some(((e,t)=>({items:[ar(e,X("a11y.t1.repair.info"))],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(Ir(t,r,o,"a11y.t1.repair.errors.empty","a11y.t1.repair.errors.duplicate",X))}))},shouldDisableRepair:w.none(),onChange:w.none()}),T2:w.some({ui:w.some(((e,t)=>({items:[ar(e,X("a11y.t2.repair.info"))],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r,o,a,n)=>{const i=Qe(e,"caption").filter(le).map(Dr).getOr("");return xr(e,r[t],i,"a11y.t2.repair.errors.empty","a11y.t2.repair.errors.duplicate",n).map((o=>(me(e,"summary",r[t]),o)))})(t,r,o,0,0,X))}))},shouldDisableRepair:w.none(),onChange:w.none()}),T3:w.some({ui:w.some(((e,t)=>{const r=Je(t,"caption").fold(p(""),gr);return{items:[ar(e,X("a11y.t1.repair.info"))],initialData:{[e]:r}}})),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(Ir(t,r,o,"a11y.t1.repair.errors.empty","a11y.t1.repair.errors.duplicate",X))}))},shouldDisableRepair:w.none(),onChange:w.none()}),T4A:w.none(),T4B:w.some({ui:w.some(((e,t)=>({items:[or(e,X("a11y.t4b.repair.info"),[{text:"a11y.t4c.repair.header.row",value:"row"},{text:"a11y.t4c.repair.header.col",value:"col"}],X)],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r)=>{let o=[];if("row"===r[t]){const t=ke(e.dom.rows[0]);o=Re(t,"td")}else"col"===r[t]&&N(e.dom.rows,(e=>{Je(ke(e),"td").each((e=>{o.push(e)}))}));return N(o,(e=>{const t=fe("th");N(e.dom.attributes,(r=>{ge(e,r.name).each((e=>me(t,r.name,e)))})),t.dom.innerHTML=e.dom.innerHTML,dr(e,t),mr(e)})),br.value(e)})(t,r,o))}))},shouldDisableRepair:w.some(((e,t)=>!at(t.element,"td"))),onChange:w.none()}),T4C:w.some({ui:w.some(((e,t)=>({items:[or(e,X("a11y.t4c.repair.info"),[{text:"a11y.t4c.repair.scope.row",value:"row"},{text:"a11y.t4c.repair.scope.col",value:"col"},{text:"a11y.t4c.repair.scope.rowgroup",value:"rowgroup"},{text:"a11y.t4c.repair.scope.colgroup",value:"colgroup"}],X)],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r)=>(me(e,"scope",r[t]),br.value(e)))(t,r,o))}))},shouldDisableRepair:w.none(),onChange:w.none()}),D1:w.some({ui:w.some(((e,t)=>({items:[or(e,X("a11y.d1.repair.info"),[{text:"a11y.d1.repair.block.h1",value:"h1"},{text:"a11y.d1.repair.block.h2",value:"h2"},{text:"a11y.d1.repair.block.h3",value:"h3"},{text:"a11y.d1.repair.block.h4",value:"h4"},{text:"a11y.d1.repair.block.h5",value:"h5"},{text:"a11y.d1.repair.block.h6",value:"h6"}],X)],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r)=>{const o=Te(e),a=fe(r[t],o.dom),n=Ne(e),i=_(n,fr);hr(a,i);const s=We(a,"b,strong");return N(s,yr),ur(e,a),mr(e),br.value(a)})(t,r,o))}))},shouldDisableRepair:w.none(),onChange:w.none()}),D2:w.none(),D3:w.some({ui:w.none(),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a((e=>{const t=W(_e(e));return E(t,he("a")).fold((()=>br.error({errorMessage:"Failed to find previous link",repairErrorData:{}})),(r=>{for(const e of t){if(Ce(e,r))break;ue(e)&&mr(e)}const o=Ne(e);return hr(r,o),mr(e),br.value(r)}))})(t))}))},shouldDisableRepair:w.none(),onChange:w.none()})};return e=>r.hasOwnProperty(e)?r[e]:w.none()},Wr=(t,r)=>{const o=(()=>{const t=(t=>{const r=e(w.none()),o=()=>r.get().each(t);return{clear:()=>{o(),r.set(w.none())},isSet:()=>r.get().isSome(),get:()=>r.get(),set:e=>{o(),r.set(w.some(e))}}})(d);return{...t,on:e=>t.get().each(e)}})(),a=()=>{o.clear(),r.clear()},n=()=>{const e=((e,t,r,o,a)=>t.scan().fold((()=>e(ir(o,a))),(n=>e(cr(n,t,r,w.none(),o,a)))))((e=>t.windowManager.open(e,{inline:"toolbar",ariaAttrs:!0})),r,Rr(t),t,a);o.set(e)},i=e=>e.close();return t.ui.registry.addButton("a11ycheck",{tooltip:X("a11y.control.tooltip"),icon:"accessibility-check",onAction:n}),t.ui.registry.addMenuItem("a11ycheck",{icon:"accessibility-check",text:X("a11y.control.menutext"),onAction:n}),()=>o.get().fold(n,i)};tinymce.PluginManager.requireLangPack("a11ychecker","ar,bg_BG,ca,cs,da,de,el,es,eu,fa,fi,fr_FR,he_IL,hi,hr,hu_HU,id,it,ja,kk,ko_KR,ms,nb_NO,nl,pl,pt_PT,pt_BR,ro,ru,sk,sl_SI,sv_SE,th_TH,tr,uk,vi,zh_TW,zh_CN"),tinymce.PluginManager.add("a11ychecker",((e,t)=>{if(((e,t)=>!!e&&-1===((e,t)=>{const r=f(e.major,t.major);if(0!==r)return r;const o=f(e.minor,t.minor);if(0!==o)return o;const a=f(e.patch,t.patch);return 0!==a?a:0})((e=>x((e=>[e.majorVersion,e.minorVersion].join(".").split(".").slice(0,3).join("."))(e)))(e),x(t)))(tinymce,"6.3.0"))return console.error('The "a11ychecker" plugin requires at least version 6.3.0 of TinyMCE.'),{};((e,t)=>{const r=e.options.register;r("a11ychecker_css_url",{processor:"string",default:t+"/css/annotations.css"}),r("a11ychecker_allow_decorative_images",{processor:"boolean"});const a=[$(),G(),P()];r("a11ychecker_level",{processor:e=>o(e)&&D(a,e),default:G()});const n=[H(),q()];r("a11ychecker_html_version",{processor:e=>o(e)&&D(n,e),default:q()}),r("a11ychecker_issue_url_callback",{processor:"function",default:e=>`https://www.tiny.cloud/docs/tinymce/${tinymce.majorVersion}/a11ychecker/#${e}`}),r("a11ychecker_ignored_rules",{processor:"string",default:""}),r("a11ychecker_filter_issue",{processor:"function",default:v})})(e,t);const r=Zt(e),a=j(e),n=Wr(e,r);return e.on("init",(()=>{e.dom.loadCSS(a)})),{getReport:r.getReport,toggleaudit:n}}))}(); \ No newline at end of file +!function(){"use strict";const e=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(r=o=e,(a=String).prototype.isPrototypeOf(r)||(null===(n=o.constructor)||void 0===n?void 0:n.name)===a.name)?"string":t;var r,o,a,n})(t)===e,r=e=>t=>typeof t===e,o=t("string"),a=t("object"),n=t("array"),i=r("boolean"),s=(void 0,e=>undefined===e);const l=e=>!(e=>null==e)(e),c=r("function"),u=r("number"),d=()=>{},p=e=>()=>e,h=e=>e,m=(e,t)=>e===t,y=e=>e(),g=p(!1),v=p(!0);class w{constructor(e,t){this.tag=e,this.value=t}static some(e){return new w(!0,e)}static none(){return w.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?w.some(e(this.value)):w.none()}bind(e){return this.tag?e(this.value):w.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:w.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 l(e)?w.some(e):w.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()"}}w.singletonNone=new w(!1);const b=e=>parseInt(e,10),f=(e,t)=>{const r=e-t;return 0===r?0:r>0?1:-1},k=(e,t,r)=>({major:e,minor:t,patch:r}),x=e=>{const t=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(e);return t?k(b(t[1]),b(t[2]),b(t[3])):k(0,0,0)},A=Array.prototype.slice,C=Array.prototype.indexOf,T=Array.prototype.push,D=(e,t)=>((e,t)=>C.call(e,t))(e,t)>-1,I=(e,t)=>{for(let r=0,o=e.length;r{const r=e.length,o=new Array(r);for(let a=0;a{for(let r=0,o=e.length;r{const r=[];for(let o=0,a=e.length;o(S(e,((e,o)=>{r=t(r,e,o)})),r),O=(e,t,r)=>{for(let o=0,a=e.length;oO(e,t,g),R=(e,t)=>(e=>{const t=[];for(let r=0,o=e.length;r{const t=A.call(e,0);return t.reverse(),t},H=p("html4"),q=p("html5"),$=p("a"),G=p("aa"),P=p("aaa"),L=e=>t=>t.options.get(e),j=L("a11ychecker_css_url"),B=L("a11ychecker_level"),V=L("a11ychecker_html_version"),F=L("a11ychecker_issue_url_callback"),z=L("a11ychecker_filter_issue"),U=e=>{var t;return null!==(t=e.options.get("a11ychecker_allow_decorative_images"))&&void 0!==t?t:e.options.get("a11y_advanced_options")},K=tinymce.util.I18n,J={"a11y.d1.description":"This paragraph looks like a heading. If it is a heading, please select a heading level.","a11y.d1.repair.block.h1":"Heading 1","a11y.d1.repair.block.h2":"Heading 2","a11y.d1.repair.block.h3":"Heading 3","a11y.d1.repair.block.h4":"Heading 4","a11y.d1.repair.block.h5":"Heading 5","a11y.d1.repair.block.h6":"Heading 6","a11y.d1.repair.info":"Select a heading level:","a11y.d2.description":"Headings must be applied in sequential order. For example: Heading 1 should be followed by Heading 2, not Heading 3.","a11y.d3.description":"Adjacent links with the same URL should be merged into one link","a11y.d4.description":"The selected text appears to be a list. Lists should be formatted using a list tag.","a11y.d5a.description":"Large text must have a contrast ratio of at least 3:1","a11y.d5b.description":"Text must have a contrast ratio of at least 4.5:1","a11y.d5c.description":"Text must have a contrast ratio of at least 7:1","a11y.h93.description":"ID attribute must be unique","a11y.h93.repair.info":"Make ID unique","a11y.h93.repair.deduplicate.others":"Keep this ID and remove all others","a11y.h93.repair.deduplicate.this":"Remove this ID","a11y.h93.repair.deduplicate.all":"Remove all IDs","a11y.i1.description.decorativeAllowed":"Images must be marked as decorative or have an alternative text description","a11y.i1.description.decorativeNotAllowed":"Images must have an alternative text description. Decorative images are not allowed.","a11y.i1.repair.errors.duplicate":"Alternative text cannot be the same as the filename","a11y.i1.repair.errors.empty":"Alternative text cannot be empty","a11y.i1.repair.info.decorativeAllowed":"Or provide alternative text:","a11y.i1.repair.info.decorativeNotAllowed":"Provide alternative text:","a11y.i1.repair.checkboxlabel":"Make image decorative:","a11y.i1.repair.checkboxtext":"Image is decorative","a11y.i2.description":"Alternative text must not be the same as the image filename","a11y.i2.repair.info":"Provide alternative text:","a11y.i3.description":"Image alternative text should be less than 100 characters","a11y.i3.repair.error":"Alternative text is {0} characters","a11y.t1.description":"Tables must have captions","a11y.t1.repair.errors.duplicate":"Table caption cannot be the same as the table summary","a11y.t1.repair.errors.empty":"Caption cannot be empty","a11y.t1.repair.info":"Provide caption:","a11y.t2.description":"Complex tables should have summaries","a11y.t2.repair.errors.duplicate":"Table summary cannot be the same as the table caption","a11y.t2.repair.errors.empty":"Summary cannot be empty","a11y.t2.repair.info":"Provide table summary:","a11y.t3.description":"Table caption and summary cannot have the same value","a11y.t4a.description":"Table elements must contain TR and TD tags","a11y.t4b.description":"Tables must have at least one header cell","a11y.t4b.repair.info":"Choose table header:","a11y.t4c.description":"Table headers must be applied to a row or a column","a11y.t4c.repair.header.col":"Header column","a11y.t4c.repair.header.row":"Header row","a11y.t4c.repair.info":"Select header scope:","a11y.t4c.repair.scope.col":"Column","a11y.t4c.repair.scope.colgroup":"Column group","a11y.t4c.repair.scope.row":"Row","a11y.t4c.repair.scope.rowgroup":"Row group","a11y.widget.counter":"Issue {0} of {1}","a11y.widget.ignore":"Ignore","a11y.widget.issue.none":"No accessibility issues detected","a11y.widget.next":"Next issue","a11y.widget.previous":"Previous issue","a11y.widget.legacyrepair":"Repair issue","a11y.widget.repair":"Repair","a11y.widget.title":"Accessibility Checker","a11y.widget.help.title":"Click for more info","a11y.control.tooltip":"Accessibility checker","a11y.control.menutext":"Accessibility checker...",error:"Error",warning:"Warning",info:"Info",success:"Success"},Q=e=>J[e],X=e=>Array.isArray(e)?K.translate([Q(e[0]),...e.slice(1)]):K.translate(Q(e)),Y=Object.keys,Z=Object.hasOwnProperty,ee=(e,t)=>{const r=Y(e);for(let o=0,a=r.length;o(t,r)=>{e[r]=t},re=(e,t)=>Z.call(e,t),oe="undefined"!=typeof window?window:Function("return this;")(),ae=(e,t)=>((e,t)=>{let r=null!=t?t:oe;for(let t=0;t{const t=ae("ownerDocument.defaultView",e);return a(e)&&((e=>((e,t)=>{const r=((e,t)=>ae(e,t))(e,t);if(null==r)throw new Error(e+" not available on this browser");return r})("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(ne(e).constructor.name))},se=e=>t=>(e=>e.dom.nodeType)(t)===e,le=e=>ce(e)&&ie(e.dom),ce=se(1),ue=se(3),de=se(9),pe=se(11),he=e=>t=>ce(t)&&t.dom.nodeName.toLowerCase()===e,me=(e,t,r)=>{((e,t,r)=>{if(!(o(r)||i(r)||u(r)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",r,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,r+"")})(e.dom,t,r)},ye=(e,t)=>{const r=e.dom.getAttribute(t);return null===r?void 0:r},ge=(e,t)=>w.from(ye(e,t)),ve=(e,t)=>{e.dom.removeAttribute(t)},we=(e=>{const t="ephox-foam".replace(/\./g,"-");return{resolve:e=>t+"-"+e}})().resolve,be=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},fe=(e,t)=>{const r=(t||document).createElement(e);return be(r)},ke=be,xe=(e,t)=>{const r=e.dom;if(1!==r.nodeType)return!1;{const e=r;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")}},Ae=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,Ce=(e,t)=>e.dom===t.dom,Te=e=>ke(e.dom.ownerDocument),De=e=>w.from(e.dom.parentNode).map(ke),Ie=e=>w.from(e.dom.previousSibling).map(ke),_e=e=>W(((e,t)=>{const r=[],o=e=>(r.push(e),t(e));let a=t(e);do{a=a.bind(o)}while(a.isSome());return r})(e,Ie)),Se=e=>_(e.dom.childNodes,ke),Ne=c(Element.prototype.attachShadow)&&c(Node.prototype.getRootNode)?e=>ke(e.dom.getRootNode()):e=>de(e)?e:Te(e),Me=e=>ke(e.dom.host),Oe=e=>{const t=ue(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const r=t.ownerDocument;return(e=>{const t=Ne(e);return pe(r=t)&&l(r.dom.host)?w.some(t):w.none();var r})(ke(t)).fold((()=>r.body.contains(t)),(o=Oe,a=Me,e=>o(a(e))));var o,a},Ee=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return ke(t)},Re=(e,t)=>((e,r)=>N(Se(e),(e=>xe(e,t))))(e),We=(e,t)=>((e,t)=>{const r=void 0===t?document:t.dom;return Ae(r)?[]:_(r.querySelectorAll(e),ke)})(t,e),He=(e,t,r)=>{me(e,t,r)},qe=(e,t,r)=>{ve(e,t),ve(e,r)},$e=e=>{const t=e.editor;return{start:t=>{((e,t,r,o,a,n)=>{S(e,(e=>{const r=((e,t,r,o)=>{switch(e){case"info":return w.some(t);case"warning":return w.some(r);case"error":return w.some(o);default:return w.none()}})(e.severity,o,a,n).toArray().concat([t]);S(r,(t=>{me(e.element,t,1)}))})),w.from(e[0]).each((e=>{He(e.element,r,e.severity)}))})(t,e.violation,e.current,e.info,e.warn,e.error)},moveTo:(r,o)=>{((e,t,r,o)=>{const a=We(e,"["+t+"]");S(a,(e=>{ve(e,t)})),He(r,t,o)})(ke(t.getBody()),e.current,r,o)},stop:()=>{((e,t,r,o,a,n)=>{const i=We(e,"["+t+"]");S(i,(e=>{S([t,r,o,a,n],(t=>{ve(e,t)})),qe(e,t,r)}))})(ke(t.getBody()),e.violation,e.current,e.info,e.warn,e.error)},exclude:t=>{qe(t,e.violation,e.current)}}},Ge="data-"+we("a11y-current-violation"),Pe="data-"+we("a11y-violation"),Le="data-"+we("a11y-severity-info"),je="data-"+we("a11y-severity-warn"),Be="data-"+we("a11y-severity-error"),Ve="data-"+we("accessibility-ignore"),Fe=p(Ve),ze=(e,t,r)=>{let o=e.dom;const a=c(r)?r:g;for(;o.parentNode;){o=o.parentNode;const e=ke(o);if(t(e))return w.some(e);if(a(e))break}return w.none()},Ue=(e,t)=>E(e.dom.childNodes,(e=>t(ke(e)))).map(ke),Ke=(e,t,r)=>ze(e,(e=>xe(e,t)),r),Je=(e,t)=>Ue(e,(e=>xe(e,t))),Qe=(e,t)=>((e,t)=>{const r=void 0===t?document:t.dom;return Ae(r)?w.none():w.from(r.querySelector(e)).map(ke)})(t,e),Xe=(e,t,r)=>((e,t,r,o,a)=>((e,t)=>xe(e,t))(r,o)?w.some(r):c(a)&&a(r)?w.none():t(r,o,a))(0,Ke,e,t,r),Ye=(e,t=!1)=>{return Oe(e)?e.dom.isContentEditable:(r=e,Xe(r,"[contenteditable]")).fold(p(t),(e=>"true"===Ze(e)));var r},Ze=e=>e.dom.contentEditable,et=e=>{const t=(e=>ze(e,le).exists(Ye))(e);return t&&le(e)&&Ye(e)},tt=(e,t)=>N(e.querySelectorAll(t),(e=>et(ke(e)))),rt=(e,t,r)=>R(t,(t=>"I1"===t.id?t.check(e,r)?[{rule:t,element:e}]:[]:t.check(e)?[{rule:t,element:e}]:[])),ot=(e,t)=>{let r=[];const o=((e,t)=>{const r=[],o=[];for(let t=0,n=e.length;txe(t,e)))&&le(t)&&et(t)){const o=rt(t.dom,n,e.allowDecorativeImages);r=r.concat(o)}}const c=((e,t)=>R(t,(t=>_(t.check(e),(e=>({rule:t,element:e}))))))(t,i);return r=r.concat(c),r.sort(((e,t)=>((e,t)=>e===t?0:((e,t)=>((e,t,r)=>0!=(e.compareDocumentPosition(t)&r))(e,t,Node.DOCUMENT_POSITION_PRECEDING))(e,t)?1:-1)(e.element,t.element))),r},at=(e,t)=>Qe(e,t).isSome(),nt=p("error"),it=p("warning"),st=(e,t)=>{const r=e;return r.matches?r.matches(t):r.webkitMatchesSelector?r.webkitMatchesSelector(t):r.mozMatchesSelector?r.mozMatchesSelector(t):!!r.msMatchesSelector&&r.msMatchesSelector(t)},lt=e=>e.length>0,ct=((e,t)=>{const r=t=>e(t)?w.from(t.dom.nodeValue):w.none();return{get:t=>{if(!e(t))throw new Error("Can only get text value of a text node");return r(t).getOr("")},getOption:r,set:(t,r)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=r}}})(ue),ut=e=>ct.get(e),dt=e=>pt(e).isSome(),pt=e=>Ue(e,(e=>ue(e)&<(ut(e).trim()))),ht="strong,b",mt=(e,t)=>pt(e).fold((()=>((e,t)=>{for(let r=0,o=e.length;rmt(e,t)))),(e=>((e,t)=>Ke(e,ht,(e=>Ce(e,t))).isSome())(e,t))),yt={id:"D1",wcag:"1.3.1",severity:it(),desckey:"a11y.d1.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H42.html",walkable:!0,check:e=>{const t=ke(e);return!(!st(e,"p")||!at(t,ht))&&mt(t,t)},levels:[$(),G(),P()],htmlversions:[H(),q()]},gt={id:"D2",wcag:"1.3.1",severity:nt(),desckey:"a11y.d2.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G141.html",walkable:!1,check:e=>{const t=tt(e,"h1,h2,h3,h4,h5,h6");let r;const o=[];return S(t,(e=>{const t=parseInt(e.tagName.slice(1),10);r&&t-r>1&&o.push(e),r=t})),o},levels:[$(),G(),P()],htmlversions:[H(),q()]},vt={id:"D3",wcag:"2.4.4",severity:nt(),desckey:"a11y.d3.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H2.html",walkable:!1,check:e=>{const t=ke(e),r=We(t,"a + a"),o=N(r,(e=>{const t=W(_e(e));return O(t,he("a"),(e=>{return!(ue(t=e)&&(r=ut(t).replace(/[\u200B-\u200D\uFEFF]/g,""),!lt(r)));var t,r})).exists((t=>t.dom.href===e.dom.href))&&et(e)}));return _(o,(e=>e.dom))},levels:[$(),G(),P()],htmlversions:[H(),q()]},wt=(e,t)=>{const r=e.nodeName,o=((e,t)=>{let r=e.nextSibling;for(;null!==r&&(t&&"#text"===r.nodeName||"BR"===r.nodeName);)r=r.nextSibling;return r})(e,t);return null!==o&&o.nodeName===r&&o},bt=(e,t,r)=>{const o=[];if(t(e)){o.push(e);let a=wt(e,r);for(;!1!==a&&t(a);)o.push(a),a=wt(a,r)}return o},ft=(e,t)=>{let r=-1;for(let o=0;o{const r=tt(e,"p,h1,h2,h3,h4,h5,h6"),o=[];let a=0;for(;a1){o.push(e);const t=n[n.length-1],i=ft(r,t);a=-1===i?a+1:i}else l(e.firstChild)?(bt(e.firstChild,t,!1).length>1&&o.push(e),a++):a++}return o},xt=e=>{var t;return l(null===(t=e.textContent)||void 0===t?void 0:t.match(/^\s{0,}([a-z1-9]|i+)\s{0,}[.)-]/gim))},At={id:"D4o",wcag:"1.3.1",severity:nt(),desckey:"a11y.d4.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H48.html",walkable:!1,check:e=>kt(e,xt),levels:[$(),G(),P()],htmlversions:[H(),q()]},Ct=e=>{var t;return l(null===(t=e.textContent)||void 0===t?void 0:t.match(/^\s{0,}(\*|-)\s{0,}/gim))},Tt={id:"D4u",wcag:"1.3.1",severity:nt(),desckey:"a11y.d4.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H48.html",walkable:!1,check:e=>kt(e,Ct),levels:[$(),G(),P()],htmlversions:[H(),q()]},Dt=(e,t)=>{const r=e.dom,o=window.getComputedStyle(r).getPropertyValue(t);return""!==o||Oe(e)?o:It(r,t)},It=(e,t)=>(e=>void 0!==e.style&&c(e.style.getPropertyValue))(e)?e.style.getPropertyValue(t):"",_t=(e,t,r,o)=>({red:e,green:t,blue:r,alpha:o}),St=e=>{const t=e=>e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=e.red/255,o=e.green/255,a=e.blue/255;return.2126*t(r)+.7152*t(o)+.0722*t(a)},Nt=(e,t)=>{const r=e.alpha+t.alpha*(1-e.alpha),o=(e.red*e.alpha+t.red*t.alpha*(1-e.alpha))/r,a=(e.green*e.alpha+t.green*t.alpha*(1-e.alpha))/r,n=(e.blue*e.alpha+t.blue*t.alpha*(1-e.alpha))/r;return _t(Math.ceil(o),Math.ceil(a),Math.ceil(n),r)},Mt=e=>{const t=(e,t,r,o)=>{const a=parseInt(e,10),n=parseInt(t,10),i=parseInt(r,10),s=parseFloat(o);return w.some(_t(a,n,i,s))};if("transparent"===e)return t("0","0","0","0");const r=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)/.exec(e);if(null!==r)return t(r[1],r[2],r[3],"1");const o=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d?(?:\.\d+)?)\)/.exec(e);return null!==o?t(o[1],o[2],o[3],o[4]):w.none()},Ot=(e,t)=>{const r=parseFloat(Dt(e,"opacity"));return r<1?_t(t.red,t.green,t.blue,t.alpha*r):t},Et=(e,t)=>Rt(e).filter((e=>e{const t=(e=>{const t=Te(e),r=Ee(t),o=[e].concat(((e,t)=>{const r=c(t)?t:g;let o=e.dom;const a=[];for(;null!==o.parentNode&&void 0!==o.parentNode;){const e=o.parentNode,t=ke(e);if(a.push(t),!0===r(t))break;o=e}return a})(e,(e=>Ce(e,r)))),a=M(o,((e,t)=>{if(1===e.alpha)return e;const r=Dt(t,"background-color");return Mt(r).bind((r=>{const o=Ot(t,r);return o.alpha>0?w.some(Nt(e,o)):w.none()})).getOr(e)}),_t(0,0,0,0));return a.alpha<1?Nt(a,_t(255,255,255,1)):a})(e);return((e,t)=>{const r=Dt(e,"color");return Mt(r).bind((r=>{const o=Ot(e,r),a=o.alpha<1?Nt(o,t):o;return w.some(a)}))})(e,t).map((e=>{const r=St(t);return((e,t)=>(Math.max(e,t)+.05)/(Math.min(e,t)+.05))(St(e),r)}))},Wt={id:"D5c",wcag:"1.4.3",severity:nt(),desckey:"a11y.d5c.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G17.html",walkable:!0,check:e=>{const t=ke(e);return dt(t)&&Et(t,7)},levels:[P()],htmlversions:[H(),q()]},Ht=e=>{const t=Dt(e,"font-size"),r=new RegExp(".*px").test(t),o=/(\d*\.?\d*)(.*)/.exec(t);return r&&null!==o?w.some(Number(o[1])):w.none()},qt=e=>{const t=(e=>{const t=Dt(e,"font-weight");return!("bold"!==t&&"bolder"!==t)||!!/^[0-9]*$/.test(r=t)&&parseInt(r,10)>=700;var r})(e),r=Te(e),o=Ee(r),a=Ht(o);return Ht(e).fold(g,(e=>a.fold((()=>e>=24||t&&e>=19),(r=>e>=1.5*r||t&&e>=1.2*r))))},$t={id:"D5a",wcag:"1.4.3",severity:nt(),desckey:"a11y.d5a.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G145.html",walkable:!0,check:e=>{const t=ke(e);return dt(t)&&qt(t)&&Et(t,3)},levels:[G()],htmlversions:[H(),q()]},Gt={id:"D5b",wcag:"1.4.3",severity:nt(),desckey:"a11y.d5b.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G18.html",walkable:!0,check:e=>{const t=ke(e);return dt(t)&&!qt(t)&&Et(t,4.5)},levels:[G()],htmlversions:[H(),q()]},Pt={id:"H93",wcag:"4.1.1",severity:nt(),desckey:"a11y.h93.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H93.html",walkable:!1,check:e=>{const t=ke(e),r=We(t,"*[id]"),o=M(r,((e,t)=>{const r=ye(t,"id");if(void 0!==r&&et(t)){if(re(e.problems,r))return e;if(re(e.ids,r)){const t=e.ids[r];return{...e,problems:{...e.problems,[r]:t}}}return{...e,ids:{...e.ids,[r]:t.dom}}}return e}),{ids:{},problems:{}});return((e,t)=>{const r=[];return ee(e,((e,o)=>{r.push(t(e,o))})),r})(o.problems,h)},levels:[$(),G(),P()],htmlversions:[H(),q()]},Lt=he("img"),jt={id:"I1",wcag:"1.1.1",severity:nt(),desckey:"a11y.i1.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G95.html",walkable:!0,check:(e,t)=>{const r=ke(e);if(!Lt(r))return!1;const o=ge(r,"alt"),a=o.isSome(),n=o.exists((e=>""===e.trim())),i=((e,t,r=m)=>e.exists((e=>r(e,t))))(ge(r,"role"),"presentation");return!a||(t?a&&n&&!i||a&&!n&&i:n||i)},levels:[$(),G(),P()],htmlversions:[H(),q()]},Bt={id:"I2",wcag:"1.1.1",severity:nt(),desckey:"a11y.i2.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G95.html",walkable:!0,check:e=>(e=>st(e,"img[alt][src]"))(e)&&e.src.split("/").pop()===e.alt.split("/").pop(),levels:[$(),G(),P()],htmlversions:[H(),q()]},Vt={id:"I3",wcag:"N/A",severity:it(),desckey:"a11y.i3.description",url:"",walkable:!0,check:e=>{const t=ke(e);return!!Lt(t)&&ge(t,"alt").exists((e=>e.length>100))},levels:[$(),G(),P()],htmlversions:[H(),q()]},Ft={id:"T1",wcag:"1.3.1",severity:nt(),desckey:"a11y.t1.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H39.html",walkable:!0,check:e=>{if(st(e,"table")){const t=e.querySelector("caption");return!t||st(t,":empty")}return!1},levels:[$(),G(),P()],htmlversions:[H(),q()]},zt={id:"T2",wcag:"1.3.1",severity:it(),desckey:"a11y.t2.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H73.html",walkable:!0,check:e=>st(e,"table")&&l(e.querySelector("[rowspan]")||e.querySelector("[colspan]"))&&!e.hasAttribute("summary"),levels:[$(),G(),P()],htmlversions:[H()]},Ut={id:"T3",wcag:"1.3.1",severity:nt(),desckey:"a11y.t3.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H73.html",walkable:!0,check:e=>{if(st(e,"table")&&e.hasAttribute("summary")){const t=e.querySelectorAll("caption");return t.length>0&&e.getAttribute("summary")===t[0].innerHTML}return!1},levels:[$(),G(),P()],htmlversions:[H(),q()]},Kt={id:"T4b",wcag:"1.3.1",severity:nt(),desckey:"a11y.t4b.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H51.html",walkable:!0,check:e=>"table"===e.nodeName.toLowerCase()&&0===e.querySelectorAll("th").length,levels:[$(),G(),P()],htmlversions:[H(),q()]},Jt={id:"T4c",wcag:"1.3.1",severity:nt(),desckey:"a11y.t4c.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H63.html",walkable:!0,check:e=>{return!("th"!==e.nodeName.toLowerCase()||(t=e).hasAttribute("scope")&&/row|col|rowgroup|colgroup/i.test(t.getAttribute("scope")));var t},levels:[$(),G(),P()],htmlversions:[H(),q()]},Qt=(e,t)=>0===e.querySelectorAll(t).length,Xt={id:"T4a",wcag:"1.3.1",severity:nt(),desckey:"a11y.t4a.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H51.html",walkable:!0,check:e=>{return"table"===e.nodeName.toLowerCase()&&(Qt(t=e,"tr")||Qt(t,"td"));var t},levels:[$(),G(),P()],htmlversions:[H(),q()]},Yt=e=>({id:e.id.toUpperCase(),severity:e.severity,url:e.url,description:X(e.description),element:e.element.dom}),Zt=t=>{const r=(e=>{const t=(e=>{const t=e.options.get("a11ychecker_ignored_rules");return R(tinymce.explode(t),(e=>e.length>0?[e.toUpperCase()]:[]))})(e),r=B(e),o=V(e);return{rules:N([yt,gt,vt,At,Tt,$t,Gt,Wt,Pt,jt,Bt,Vt,Ft,zt,Ut,Jt,Xt,Kt],(e=>!D(t,e.id.toUpperCase())&&D(e.levels,r)&&D(e.htmlversions,o))),allowDecorativeImages:U(e),ignoreSelectors:["img[data-mce-placeholder]","[data-mce-bogus=all] *","[data-mce-bogus]","[data-mce-mergetag-affix]"]}})(t);(e=>{e.on("init",(()=>{S([Ve,Pe,Le,je,Be,Ge],(t=>{e.serializer.addTempAttr(t)}))}))})(t);const o=e(!1),a=(e=>$e({editor:e,violation:Pe,current:Ge,info:Le,warn:je,error:Be}))(t),n=Fe();let i=[],s=0;const l=()=>{const e=ot(r,t.getBody()),o=((e,t)=>_(t,(t=>{const r=t.rule;return{id:r.id.toUpperCase(),description:"I1"!==r.id?r.desckey:U(e)?`${r.desckey}.decorativeAllowed`:`${r.desckey}.decorativeNotAllowed`,element:ke(t.element),url:r.url,severity:r.severity}})))(t,e);return N(o,(e=>{const r=(a=e.element,ge(a,n).map((e=>e.split(" "))).getOr([])),o=z(t);var a;return!D(r,e.id)&&o(Yt(e))}))},c=e=>(s+=e,s=s<0?s+i.length:s%i.length,a.moveTo(i[s].element,i[s].severity),t.selection.scrollIntoView(i[s].element.dom),{summaryLabel:X(["a11y.widget.counter",s+1,i.length]),issue:i[s],index:s+1}),u=()=>i.length>0?w.some(c(0)):w.none(),d=()=>{o.set(!0),i=l(),s=0},p=()=>{a.stop(),o.set(!1),s=0,i=[]};return{scan:()=>(d(),a.start(i),u()),stepIssue:c,getIssues:()=>i.slice(0),getCurrent:u,getReport:()=>{const e=o.get();try{return e||d(),_(i,Yt)}finally{e||p()}},resolveCurrent:e=>(e&&((e,t,r)=>{const o=ge(e,t).map((e=>e.concat(" ",r))).getOr(r);me(e,t,o)})(i[s].element,n,i[s].id),i=l(),u()),clear:p,isAuditing:()=>o.get()}},er=(e,t)=>{const r=t.ui.registry.getAll().icons;return w.from(r[e]).orThunk((()=>w.from(r["temporary-placeholder"]))).getOr("!not found!")},tr={success:"checkmark",info:"info",warning:"notice",error:"warning"},rr=(e,t,r,o,a)=>{const n=X(r),i=X(t);return`
${er(tr[r],e)}

${n}

${i}

`+((e,t,r)=>{const o=`
${er(e,t)}
`;return"help"===e?o:`
${er(e,t)}
`})(o,e,a)+"
"},or=(e,t,r,o)=>({type:"listbox",label:t,name:e,items:_(r,(e=>({text:o(e.text),value:e.value})))}),ar=(e,t)=>({type:"input",name:e,label:t}),nr=(e,t,r)=>({type:"label",label:t,items:[{type:"checkbox",name:e,label:r}]}),ir=(e,t)=>({title:X("a11y.widget.title"),body:{type:"panel",items:[{type:"panel",classes:["tox-accessibility-issue","accessibility-issue--success"],items:[{type:"htmlpanel",html:rr(e,"a11y.widget.issue.none","success","checkmark"),presets:"presentation"}]}]},buttons:[{type:"submit",name:"ok",text:"OK",primary:!0}],onSubmit:e=>e.close(),onClose:t}),sr=(e,t,r)=>{e.redial(t),e.focus(r)};var lr;!function(e){e.Next="next",e.Prev="prev",e.Ignore="ignore",e.Ok="ok",e.Repair="repair"}(lr||(lr={}));const cr=({issue:e,summaryLabel:t},r,o,a,n,i)=>{const s=F(n),l=e=>cr(e,r,o,w.none(),n,i),c=a=>(s,{name:c})=>{if(c===lr.Next||c===lr.Prev){const e=r.stepIssue(c===lr.Next?1:-1);sr(s,l(e),c)}else c===lr.Ignore?r.resolveCurrent(!0).fold((()=>sr(s,ir(n,i),lr.Ok)),(e=>sr(s,l(e),lr.Ignore))):c===lr.Repair&&((a,s)=>{const c=s=>{sr(a,cr({issue:e,summaryLabel:t},r,o,w.some(s),n,i),lr.Repair)},u=()=>r.resolveCurrent(!1).fold((()=>r.scan().fold((()=>sr(a,ir(n,i),lr.Ok)),(e=>sr(a,l(e),lr.Ignore)))),(e=>sr(a,l(e),lr.Ignore)));s.each((t=>{t.repair(e.element,e.id,((e,t)=>{const r={},o={};return((e,t,r,o)=>{ee(e,((e,a)=>{(t(e,a)?r:o)(e,a)}))})(e,t,te(r),te(o)),{t:r,f:o}})(a.getData(),((t,r)=>{return o=r,""===(a=e.id)||o.length>=a.length&&o.substr(0,0+a.length)===a;var o,a})).t,(e=>e.fold(c,u)))}))})(s,a)},u=t=>r=>t.each((t=>{t.onChange.each((t=>t(r,r.getData(),e))),t.shouldDisableRepair.each((t=>{const o=t(r.getData(),e);r.setEnabled(lr.Repair,!o)}))})),d=(r,o,a)=>{const l="warning"===(d=e.severity)?"warn":d;var d;const p=o.map((()=>({type:"panel",classes:["accessibility-issue__repair"],items:o.map((e=>e.items)).getOr([])}))).toArray();return{title:X("a11y.widget.title"),body:{type:"panel",classes:["tox-accessibility-issue",`accessibility-issue--${l}`],items:[{type:"panel",classes:["accessibility-issue__header"],items:[{type:"htmlpanel",html:`

${t}

`,presets:"presentation"},{type:"button",name:lr.Prev,text:X("a11y.widget.previous"),icon:"action-prev",borderless:!0},{type:"button",name:lr.Next,text:X("a11y.widget.next"),icon:"action-next",borderless:!0}]},{type:"htmlpanel",html:rr(n,e.description,e.severity,"help",s(e.id)),presets:"presentation"},...p]},buttons:[{type:"custom",name:lr.Ignore,text:X("a11y.widget.ignore")},{type:"custom",name:lr.Repair,text:X("a11y.widget.repair"),enabled:!a,primary:!0}],initialData:{...o.map((e=>e.initialData)).getOr({})},onAction:c(r),onChange:u(r),onClose:i}};return o(e.id).fold((()=>d(w.none(),w.none(),!0)),(t=>{const r=((e,t,r)=>{const o=t.element;return r.fold((()=>e.ui.map((e=>e(t.id,o)))),(r=>e.ui.map((e=>{const a=e(t.id,o);return{items:a.items.concat([(n=r.errorMessage,{type:"htmlpanel",html:`
${n}
`})]),initialData:{...a.initialData,...r.repairErrorData}};var n}))))})(t,e,a),o=t.shouldDisableRepair.bind((t=>r.map((r=>t(r.initialData,e))))).getOr(!1);return d(w.some(t),r,o)}))},ur=(e,t)=>{De(e).each((r=>{r.dom.insertBefore(t.dom,e.dom)}))},dr=(e,t)=>{const r=(e=>w.from(e.dom.nextSibling).map(ke))(e);r.fold((()=>{De(e).each((e=>{pr(e,t)}))}),(e=>{ur(e,t)}))},pr=(e,t)=>{e.dom.appendChild(t.dom)},hr=(e,t)=>{S(t,(t=>{pr(e,t)}))},mr=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},yr=e=>{const t=Se(e);var r,o;t.length>0&&(r=e,S(o=t,((e,t)=>{const a=0===t?r:o[t-1];dr(a,e)}))),mr(e)},gr=e=>e.dom.innerHTML,vr=e=>{const t=t=>t(e),r=p(e),o=()=>a,a={tag:!0,inner:e,fold:(t,r)=>r(e),isValue:v,isError:g,map:t=>br.value(t(e)),mapError:o,bind:t,exists:t,forall:t,getOr:r,or:o,getOrThunk:r,orThunk:o,getOrDie:r,each:t=>{t(e)},toOptional:()=>w.some(e)};return a},wr=e=>{const t=()=>r,r={tag:!1,inner:e,fold:(t,r)=>t(e),isValue:g,isError:v,map:t,mapError:t=>br.error(t(e)),bind:t,exists:g,forall:v,getOr:h,or:h,getOrThunk:y,orThunk:y,getOrDie:(o=String(e),()=>{throw new Error(o)}),each:d,toOptional:w.none};var o;return r},br={value:vr,error:wr,fromOption:(e,t)=>e.fold((()=>wr(t)),vr)},fr=e=>((e,t)=>ke(e.dom.cloneNode(!0)))(e),kr=(e,t,r)=>br.error({errorMessage:t(e),repairErrorData:r}),xr=(e,t,r,o,a,n)=>0===t.length?kr(o,n,{}):Ar(e,t,r,a,n),Ar=(e,t,r,o,a)=>t===r?kr(o,a,{}):br.value(e),Cr=e=>{const t=e.split("/");return w.from(t.pop())},Tr=(e,t,r,o,a,n)=>{const i=ge(e,"src").bind(Cr).getOr(""),s=r[`${t}_textinput`];return r[`${t}_checkbox`]?(e=>(me(e,"alt",""),me(e,"role","presentation"),br.value(e)))(e):xr(e,s,i,o,a,n).map((e=>(me(e,"alt",s),"presentation"===ye(e,"role")&&ve(e,"role"),e)))},Dr=e=>e.dom.textContent,Ir=(e,t,r,o,a,n)=>{const i=ye(e,"summary");return xr(e,r[t],i,o,a,n).map((o=>{const a=Je(e,"caption").fold((()=>fe("caption")),(e=>{var t;return(t=e).dom.textContent="",S(Se(t),(e=>{mr(e)})),e}));return((e,t)=>{e.dom.textContent=t})(a,r[t]),((e,t)=>{(e=>((e,t)=>{const r=e.dom.childNodes;return w.from(r[0]).map(ke)})(e))(e).fold((()=>{pr(e,t)}),(r=>{e.dom.insertBefore(t.dom,r.dom)}))})(o,a),o}))},_r=e=>`${e}_checkbox`,Sr=e=>`${e}_textinput`,Nr=(e,t)=>{const r=t.id,o=!0===e[_r(r)],a=e[Sr(r)].length>0;return!o&&!a},Mr=(e,t,r)=>{const o=r.id,a=_r(o),n=Sr(o);!0===t[a]?(e.setEnabled(n,!1),e.setEnabled(lr.Repair,!0)):(e.setEnabled(n,!0),t[n].length>0?(e.setEnabled(lr.Repair,!0),e.setEnabled(a,!0)):(e.setEnabled(a,!0),e.setEnabled(lr.Repair,!1)))},Or=(e,t)=>{const r=ar(Sr(t),X((o="a11y.i1.repair.info",e?`${o}.decorativeAllowed`:`${o}.decorativeNotAllowed`)));var o;return e?[nr(_r(t),X("a11y.i1.repair.checkboxlabel"),X("a11y.i1.repair.checkboxtext")),r]:[r]},Er=(e,t,r)=>{const o=ye(e,"alt"),a=t?{[_r(r)]:!1}:{};return{[Sr(r)]:o||"",...a}},Rr=e=>{const t=U(e),r={H93:w.some({ui:w.some(((e,t)=>({items:[or(e,X("a11y.h93.repair.info"),[{text:"a11y.h93.repair.deduplicate.others",value:"others"},{text:"a11y.h93.repair.deduplicate.this",value:"this"},{text:"a11y.h93.repair.deduplicate.all",value:"all"}],X)],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r,o)=>{const a=r[t],n="all"===a||"this"===a;if("all"===a||"others"===a){const t=ye(e,"id"),r=o.getBody(),a=ke(r),n=We(a,`*[id="${t}"]`),i=N(n,(t=>!Ce(t,e)));S(i,(e=>{ve(e,"id")}))}return n&&ve(e,"id"),br.value(e)})(t,r,o,e))}))},shouldDisableRepair:w.none(),onChange:w.none()}),I1:w.some({ui:w.some(((e,r)=>({items:Or(t,e),initialData:Er(r,t,e)}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(Tr(t,r,o,"a11y.i1.repair.errors.empty","a11y.i1.repair.errors.duplicate",X))}))},shouldDisableRepair:t?w.some(Nr):w.none(),onChange:t?w.some(Mr):w.none()}),I2:w.some({ui:w.some(((e,r)=>({items:Or(t,e),initialData:Er(r,t,e)}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(Tr(t,r,o,"a11y.i1.repair.errors.empty","a11y.i1.repair.errors.duplicate",X))}))},shouldDisableRepair:t?w.some(Nr):w.none(),onChange:t?w.some(Mr):w.none()}),I3:w.some({ui:w.some(((e,t)=>({items:Or(!1,e),initialData:Er(t,!1,e)}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r,o,a)=>{const n=r[`${t}_textinput`];return((e,t,r,o,a,n=100)=>{const i=`${t}_textinput`;return r.length>n?kr([o,r.length],a,{[i]:r}):br.value(e)})(e,t,n,o,a,100).map((e=>(me(e,"alt",n),e)))})(t,r,o,"a11y.i3.repair.error",X))}))},shouldDisableRepair:w.none(),onChange:w.none()}),T1:w.some({ui:w.some(((e,t)=>({items:[ar(e,X("a11y.t1.repair.info"))],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(Ir(t,r,o,"a11y.t1.repair.errors.empty","a11y.t1.repair.errors.duplicate",X))}))},shouldDisableRepair:w.none(),onChange:w.none()}),T2:w.some({ui:w.some(((e,t)=>({items:[ar(e,X("a11y.t2.repair.info"))],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r,o,a,n)=>{const i=Qe(e,"caption").filter(le).map(Dr).getOr("");return xr(e,r[t],i,"a11y.t2.repair.errors.empty","a11y.t2.repair.errors.duplicate",n).map((o=>(me(e,"summary",r[t]),o)))})(t,r,o,0,0,X))}))},shouldDisableRepair:w.none(),onChange:w.none()}),T3:w.some({ui:w.some(((e,t)=>{const r=Je(t,"caption").fold(p(""),gr);return{items:[ar(e,X("a11y.t1.repair.info"))],initialData:{[e]:r}}})),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(Ir(t,r,o,"a11y.t1.repair.errors.empty","a11y.t1.repair.errors.duplicate",X))}))},shouldDisableRepair:w.none(),onChange:w.none()}),T4A:w.none(),T4B:w.some({ui:w.some(((e,t)=>({items:[or(e,X("a11y.t4b.repair.info"),[{text:"a11y.t4c.repair.header.row",value:"row"},{text:"a11y.t4c.repair.header.col",value:"col"}],X)],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r)=>{let o=[];if("row"===r[t]){const t=ke(e.dom.rows[0]);o=Re(t,"td")}else"col"===r[t]&&S(e.dom.rows,(e=>{Je(ke(e),"td").each((e=>{o.push(e)}))}));return S(o,(e=>{const t=fe("th");S(e.dom.attributes,(r=>{ge(e,r.name).each((e=>me(t,r.name,e)))})),t.dom.innerHTML=e.dom.innerHTML,dr(e,t),mr(e)})),br.value(e)})(t,r,o))}))},shouldDisableRepair:w.some(((e,t)=>!at(t.element,"td"))),onChange:w.none()}),T4C:w.some({ui:w.some(((e,t)=>({items:[or(e,X("a11y.t4c.repair.info"),[{text:"a11y.t4c.repair.scope.row",value:"row"},{text:"a11y.t4c.repair.scope.col",value:"col"},{text:"a11y.t4c.repair.scope.rowgroup",value:"rowgroup"},{text:"a11y.t4c.repair.scope.colgroup",value:"colgroup"}],X)],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r)=>(me(e,"scope",r[t]),br.value(e)))(t,r,o))}))},shouldDisableRepair:w.none(),onChange:w.none()}),D1:w.some({ui:w.some(((e,t)=>({items:[or(e,X("a11y.d1.repair.info"),[{text:"a11y.d1.repair.block.h1",value:"h1"},{text:"a11y.d1.repair.block.h2",value:"h2"},{text:"a11y.d1.repair.block.h3",value:"h3"},{text:"a11y.d1.repair.block.h4",value:"h4"},{text:"a11y.d1.repair.block.h5",value:"h5"},{text:"a11y.d1.repair.block.h6",value:"h6"}],X)],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r)=>{const o=Te(e),a=fe(r[t],o.dom),n=Se(e),i=_(n,fr);hr(a,i);const s=We(a,"b,strong");return S(s,yr),ur(e,a),mr(e),br.value(a)})(t,r,o))}))},shouldDisableRepair:w.none(),onChange:w.none()}),D2:w.none(),D3:w.some({ui:w.none(),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a((e=>{const t=W(_e(e));return E(t,he("a")).fold((()=>br.error({errorMessage:"Failed to find previous link",repairErrorData:{}})),(r=>{for(const e of t){if(Ce(e,r))break;ue(e)&&mr(e)}const o=Se(e);return hr(r,o),mr(e),br.value(r)}))})(t))}))},shouldDisableRepair:w.none(),onChange:w.none()})};return e=>r.hasOwnProperty(e)?r[e]:w.none()},Wr=(t,r)=>{const o=(()=>{const t=(t=>{const r=e(w.none()),o=()=>r.get().each(t);return{clear:()=>{o(),r.set(w.none())},isSet:()=>r.get().isSome(),get:()=>r.get(),set:e=>{o(),r.set(w.some(e))}}})(d);return{...t,on:e=>t.get().each(e)}})(),a=()=>{o.clear(),r.clear()},n=()=>{const e=((e,t,r,o,a)=>t.scan().fold((()=>e(ir(o,a))),(n=>e(cr(n,t,r,w.none(),o,a)))))((e=>t.windowManager.open(e,{inline:"toolbar",ariaAttrs:!0})),r,Rr(t),t,a);o.set(e)},i=e=>e.close();return t.ui.registry.addButton("a11ycheck",{tooltip:X("a11y.control.tooltip"),icon:"accessibility-check",onAction:n}),t.ui.registry.addMenuItem("a11ycheck",{icon:"accessibility-check",text:X("a11y.control.menutext"),onAction:n}),()=>o.get().fold(n,i)};tinymce.PluginManager.requireLangPack("a11ychecker","ar,bg_BG,ca,cs,da,de,el,es,eu,fa,fi,fr_FR,he_IL,hi,hr,hu_HU,id,it,ja,kk,ko_KR,ms,nb_NO,nl,pl,pt_PT,pt_BR,ro,ru,sk,sl_SI,sv_SE,th_TH,tr,uk,vi,zh_TW,zh_CN"),tinymce.PluginManager.add("a11ychecker",((e,t)=>{if(((e,t)=>!!e&&-1===((e,t)=>{const r=f(e.major,t.major);if(0!==r)return r;const o=f(e.minor,t.minor);if(0!==o)return o;const a=f(e.patch,t.patch);return 0!==a?a:0})((e=>x((e=>[e.majorVersion,e.minorVersion].join(".").split(".").slice(0,3).join("."))(e)))(e),x(t)))(tinymce,"6.8.0"))return console.error('The "a11ychecker" plugin requires at least version 6.8.0 of TinyMCE.'),{};((e,t)=>{const r=e.options.register;r("a11ychecker_css_url",{processor:"string",default:t+"/css/annotations.css"}),r("a11ychecker_allow_decorative_images",{processor:"boolean"});const a=[$(),G(),P()];r("a11ychecker_level",{processor:e=>o(e)&&D(a,e),default:G()});const n=[H(),q()];r("a11ychecker_html_version",{processor:e=>o(e)&&D(n,e),default:q()}),r("a11ychecker_issue_url_callback",{processor:"function",default:e=>`https://www.tiny.cloud/docs/tinymce/${tinymce.majorVersion}/a11ychecker/#${e}`}),r("a11ychecker_ignored_rules",{processor:"string",default:""}),r("a11ychecker_filter_issue",{processor:"function",default:v})})(e,t);const r=Zt(e),a=j(e),n=Wr(e,r);return e.on("init",(()=>{const t="a11ychecker/css/annotations.css";if(tinymce.Resource.has(t)){const r=tinymce.Resource.get(t);e.dom.styleSheetLoader.loadRawCss(t,r)}else e.dom.loadCSS(a)})),{getReport:r.getReport,toggleaudit:n}}))}(); \ No newline at end of file diff --git a/plugins/advcode/plugin.min.js b/plugins/advcode/plugin.min.js index 93eff2d..72d8be3 100644 --- a/plugins/advcode/plugin.min.js +++ b/plugins/advcode/plugin.min.js @@ -4,7 +4,7 @@ * Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc. * Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/ * - * Version: 3.3.1-98 + * Version: 3.4.0-107 */ -!function(){"use strict";const e=e=>parseInt(e,10),t=(e,t)=>{const o=e-t;return 0===o?0:o>0?1:-1},o=(e,t,o)=>({major:e,minor:t,patch:o}),n=t=>{const n=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(t);return n?o(e(n[1]),e(n[2]),e(n[3])):o(0,0,0)},r=e=>t=>typeof t===e,i=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),s=r("boolean"),c=e=>!(e=>null==e)(e),a=r("function"),d=r("number");class l{constructor(e,t){this.tag=e,this.value=t}static some(e){return new l(!0,e)}static none(){return l.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?l.some(e(this.value)):l.none()}bind(e){return this.tag?e(this.value):l.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:l.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return c(e)?l.some(e):l.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()"}}l.singletonNone=new l(!1);let u=0;const m=e=>{const t=(new Date).getTime(),o=Math.floor(1e9*Math.random());return u++,e+"_"+o+u+String(t)},g=e=>t=>t.options.get(e),p=g("codemirror_script"),h=g("codemirror_css"),v=g("codemirror_linewrapping"),f=g("codemirror_linenumbers"),y=g("codemirror_foldgutter"),b=g("codemirror_gutter"),w=g("codemirror_theme"),C=e=>"rtl"===e.getBody().dir?"rtl":"ltr",S=g("advcode_headless"),_=g("advcode_inline"),k=(e,t,o)=>({customEditorScriptUrl:t+"/customeditor.min.js",codeMirrorScriptUrl:p(e),codeMirrorCssUrl:h(e),lineWrapping:v(e),lineNumbers:f(e),foldGutter:y(e),theme:w(e),direction:C(e),gutter:b(e),editorId:e.id,advcodeInstanceId:m("advcode_instance"),currentAdvStatus:o}),x=()=>{},z=()=>!1,I=(e,t)=>{for(let o=0,n=e.length;oT.call(e,t);"undefined"!=typeof window?window:Function("return this;")();const E=e=>t=>(e=>e.dom.nodeType)(t)===e,M=E(1),N=E(3),O=E(9),D=E(11),L=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},P=(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 L(o.childNodes[0])},V=(e,t)=>{const o=(t||document).createElement(e);return L(o)},F=L,j=e=>O(e)?e:F(e.dom.ownerDocument),B=(e,t)=>{e.dom.appendChild(t.dom)},R=e=>D(e)&&c(e.dom.host),$=a(Element.prototype.attachShadow)&&a(Node.prototype.getRootNode)?e=>F(e.dom.getRootNode()):j,W=e=>F(e.dom.host),U=e=>{const t=N(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return(e=>{const t=$(e);return R(t)?l.some(t):l.none()})(F(t)).fold((()=>o.body.contains(t)),(n=U,r=W,e=>n(r(e))));var n,r},G=()=>H(F(document)),H=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return F(t)},q=(e,t,o)=>{let n=e.dom;const r=a(o)?o:z;for(;n.parentNode;){n=n.parentNode;const e=F(n);if(t(e))return l.some(e);if(r(e))break}return l.none()},K=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Q="\x3c!--mce_cursor--\x3e",J=(e,t)=>{const o=e.dom,n=e.selection,r=n.getBookmark(),i=(e=>A(e,"name"))(r)?o.select(r.name)[r.index]:o.select(`#${r.id}_start`)[0],s=l.from(i).map((t=>{const o=F(e.getBody());return((e,t)=>{const n=P(Q),r=F(e),i=((e,t,o)=>((e,t,o,n,r)=>n(o)?l.some(o):a(r)&&r(o)?l.none():t(o,n,r))(0,q,e,t,o))(r,(e=>((e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute("data-mce-bogus")})(e)),(e=>{return t=o,e.dom===t.dom;var t})).getOr(r);return((e,t)=>{const o=(e=>l.from(e.dom.parentNode).map(F))(e);o.each((o=>{o.dom.insertBefore(t.dom,e.dom)}))})(i,n),n})(t)})),c=t();return s.each(K),n.moveToBookmark(r),c},X=e=>{const t=(e=>{const t=e.split(/\r?\n/);return((e,t)=>{for(let o=0;o{const n=e.indexOf(Q);return(r=-1!==n,i=n,r?l.some(i):l.none()).map((n=>e===Q?0===o?{line:o,ch:0}:{line:o-1,ch:t[o-1].length}:{line:o,ch:n}));var r,i})).getOr({line:0,ch:0})})(J(e,(()=>e.getContent({source_view:!0}))));return{content:e.getContent({source_view:!0}),cursor:t}},Y=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},Z=()=>{const e=(e=>{const t=Y(l.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(l.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(l.some(e))}}})(x);return{...e,on:t=>e.get().each(t)}},ee=(e,t)=>{e.focus(),e.undoManager.transact((()=>{e.setContent(t)})),e.selection.setCursorLocation(),e.nodeChanged()},te=e=>{return(t=tinymce,"get",A(t,"get")?l.from(t.get):l.none()).bind((t=>l.from(t.call(tinymce,e))));var t},oe=(e,t)=>te(e).bind((e=>l.from(e.plugins.advcode))).map((e=>(e[t]||(e[t]=Z()),e[t]))),ne=(e,t)=>{te(e).bind((e=>l.from(e.plugins.advcode))).each((e=>{e[t]&&delete e[t]}))},re=(e,t)=>((e,t,o)=>{const n=((e,t)=>{const o=((e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o})(e,t);return void 0===o||""===o?[]:o.split(" ")})(e,t);return((e,t,o)=>{((e,t,o)=>{if(!(i(o)||s(o)||d(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+"")})(e.dom,t,o)})(e,t,n.concat([o]).join(" ")),!0})(e,"class",t),ie={unsupportedLength:["em","ex","cap","ch","ic","rem","lh","rlh","vw","vh","vi","vb","vmin","vmax","cm","mm","Q","in","pc","pt","px"],fixed:["px","pt"],relative:["%"],empty:[""]},se=(()=>{const e="[0-9]+",t="[eE][+-]?"+e,o=e=>`(?:${e})?`,n=["Infinity",e+"\\."+o(e)+o(t),"\\."+e+o(t),e+o(t)].join("|");return new RegExp(`^([+-]?(?:${n}))(.*)$`)})(),ce=(e,t,o,n="",r)=>{const i=(e=>{const t=te(e).map((e=>{const t=$(F(e.getElement()));return R(o=t)?o:F(j(o).dom.body);var o})).getOrThunk(G);if(M(t))return{element:t,destroy:x};{const e=V("div");return B(t,e),{element:e,destroy:()=>K(e)}}})(o.editorId),s=((e,t)=>{const o=(o,n)=>(n&&!n()||setTimeout((()=>{o.state.completionActive||o.showHint({completeSingle:!1,container:t})}),100),e.Pass);return{completeAfter:o,completeIfAfterLt:t=>o(t,(()=>{const o=t.getCursor();return"<"===t.getRange(e.Pos(o.line,o.ch-1),o)})),completeIfInTag:t=>o(t,(()=>{const o=t.getTokenAt(t.getCursor());return!!("string"!==o.type||/['"]/.test(o.string.charAt(o.string.length-1))&&1!==o.string.length)&&e.innerMode(t.getMode(),o.state).state.tagName}))}})(e,i.element.dom),c="dracula",d={lineWrapping:o.lineWrapping,lineNumbers:o.lineNumbers,foldGutter:o.foldGutter,theme:r.dark?c:o.theme,direction:o.direction,matchTags:{bothTags:!0},keyMap:"sublime",gutters:o.gutter?["CodeMirror-linenumbers","CodeMirror-foldgutter"]:[],extraKeys:{"Alt-F":"findPersistent","Ctrl-J":"toMatchingTag","Ctrl-B":"selectNextOccurrence","'<'":s.completeAfter,"'/'":s.completeIfAfterLt,"' '":s.completeIfInTag,"'='":s.completeIfInTag,"Ctrl-Q":e=>{e.foldCode(e.getCursor())}},mode:"text/html",value:n},u=e(t,d),m=e=>{27!==e.keyCode&&e.stopPropagation()};t.addEventListener("keyup",m),t.addEventListener("keydown",m),t.addEventListener("keypress",m),setTimeout((()=>{u.focus(),o.cursor&&u.doc.setCursor(o.cursor)}),0),setTimeout((()=>u.refresh()),200);const g=e=>{const t=u.getWrapperElement();e.fold((()=>{var e,o;t.classList.remove("inherit-font-size"),null===(o=null===(e=t.parentElement)||void 0===e?void 0:e.style)||void 0===o||o.removeProperty("font-size")}),(e=>{var o,n;t.classList.add("inherit-font-size"),null===(n=null===(o=t.parentElement)||void 0===o?void 0:o.style)||void 0===n||n.setProperty("font-size",e)})),u.refresh()},p={getValue:()=>u.doc.getValue(),setValue:e=>u.doc.setValue(e),setDarkMode:e=>{e?u.setOption("theme",c):u.setOption("theme",o.theme)},copyCode:()=>new Promise(((e,t)=>window.isSecureContext?e(navigator.clipboard.writeText(u.getValue())):t("context is not secure"))),setFontSize:g,changeFontSize:e=>{const t=u.getWrapperElement(),o=(d=F(t),m=".CodeMirror-scroll",((e,t)=>{const o=void 0===t?document:t.dom;return 1!==(n=o).nodeType&&9!==n.nodeType&&11!==n.nodeType||0===n.childElementCount?l.none():l.from(o.querySelector(e)).map(F);var n})(m,d)).map((e=>((e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||U(e)?n:((e,t)=>(e=>void 0!==e.style&&a(e.style.getPropertyValue))(e)?e.style.getPropertyValue(t):"")(o,t)})(e,"font-size"))).getOr("0px"),n=(s=o,c=["unsupportedLength"],l.from(se.exec(s)).bind((e=>{const t=Number(e[1]),o=e[2];return((e,t)=>I(t,(t=>I(ie[t],(t=>e===t)))))(o,c)?l.some({value:t,unit:o}):l.none()}))),r=n.map((e=>e.value)).getOr(0),i=n.map((e=>e.unit)).getOr("");var s,c,d,m;let p=l.none();return"increase"===e&&(p=l.some(`${r+1}${i}`)),"decrease"===e&&(p=l.some(`${r>5?r-1:r}${i}`)),g(p),p},destroy:()=>{t.removeEventListener("keyup",m),t.removeEventListener("keydown",m),t.removeEventListener("keypress",m),ne(o.editorId,o.advcodeInstanceId),i.destroy()}};return p},ae={},de=(e,t)=>{if(ae[t])return Promise.resolve();{const r=te(t),i=r.bind((e=>{var t;return l.from(null===(t=e.ui)||void 0===t?void 0:t.styleSheetLoader)})).getOr(tinymce.DOM.styleSheetLoader);return r.each((o=>{o.on("remove",(()=>{i.unload(e),delete ae[t]}))})),ae[t]=!0,o=e,(null!=(n=i)?n:tinymce.DOM.styleSheetLoader).load(o)}var o,n},le=e=>({name:"codeview",type:"customeditor",tag:"div",scriptId:"tinymce.plugins.advcode.customeditor",scriptUrl:e.customEditorScriptUrl,settings:e}),ue=(e,t)=>{const o={dark:!1,fullscreen:!1,fontSize:l.none()};e.addCommand("mceCodeEditor",(()=>{_(e)&&!e.inline?"code"===e.mode.get()?e.mode.set("design"):e.mode.set("code"):(()=>{const n=k(e,t,o);((e,t)=>{const o=X(e),n={...t,cursor:o.cursor},r=t.currentAdvStatus,i=oe(t.editorId,t.advcodeInstanceId),s=()=>{let e=[{type:"togglebutton",name:"dark_theme_toggle",text:"Dark/light mode",tooltip:"Dark/light mode",active:r.dark,align:"start"},{type:"custom",name:"increase_font_size",text:"Increase font size",icon:"text-size-increase",align:"start"},{type:"custom",name:"decrease_font_size",text:"Decrease font size",icon:"text-size-decrease",align:"start"},{type:"cancel",name:"cancel",text:"Cancel",align:"end"},{type:"submit",name:"save",text:"Save",primary:!0,align:"end"}];return window.isSecureContext?e=[{type:"custom",name:"copy_code",text:"Copy code",align:"start"}].concat(e):console.warn("Copy code is not allowed since window.isSecureContext is false"),e},c=o=>({title:"Source Code",size:"large",body:{type:"panel",items:[le(n)]},buttons:s(),initialData:{codeview:o},onSubmit:o=>{ee(e,o.getData().codeview),ne(t.editorId,t.advcodeInstanceId),o.close()},onClose:()=>{ne(t.editorId,t.advcodeInstanceId)},onAction:(e,t)=>{"copy_code"===t.name&&i.each((t=>t.get().each((t=>{(async()=>{const o=setTimeout((()=>{e.block("copying")}),150);await t.copyCode(),clearTimeout(o),e.unblock()})()})))),"increase_font_size"===t.name&&i.each((e=>e.get().each((e=>{r.fontSize=e.changeFontSize("increase")})))),"decrease_font_size"===t.name&&i.each((e=>e.get().each((e=>{r.fontSize=e.changeFontSize("decrease")})))),"dark_theme_toggle"===t.name&&i.each((t=>t.get().each((t=>{t.setDarkMode(!r.dark),r.dark=!r.dark,e.redial(c(e.getData().codeview))}))))}});e.windowManager.open(c(o.content))})(e,n)})()}))},me=e=>e.plugins.fullscreen&&e.plugins.fullscreen.isFullscreen(),ge=(e,t,o)=>{const n=Y({dark:!1,fullscreen:!1,fontSize:l.none()}),r=Y(me(e)),i=Z(),s=Y(l.none()),c={dark:!1,fullscreen:!1,fontSize:l.none()},a=()=>s.get().bind((t=>oe(e.id,t))),d=()=>{i.get().each((({destroy:t})=>{t(),n.get().fullscreen!==r.get()&&e.execCommand("mceFullScreen")})),i.clear()};e.ui.registry.addView("code",{buttons:1===o?[{type:"group",buttons:[...e.hasPlugin("fullscreen")?[{type:"togglebutton",icon:"fullscreen",tooltip:"Fullsceen",onAction:t=>{e.execCommand("mceFullScreen",void 0,void 0,{skip_focus:!0});const o=!t.isActive();n.set({...n.get(),fullscreen:o}),t.setActive(o)}}]:[],{type:"togglebutton",icon:"copy",text:"Copy code",onAction:e=>a().each((e=>e.get().each((e=>{(async()=>{await e.copyCode()})()}))))}]},{type:"group",buttons:[{type:"togglebutton",text:"Dark/light mode",tooltip:"Dark/light mode",onAction:e=>{a().each((t=>t.get().each((t=>{n.set({...n.get(),dark:!e.isActive()}),e.setActive(n.get().dark),t.setDarkMode(n.get().dark)}))))}},{type:"togglebutton",icon:"text-size-increase",tooltip:"Increase font size",onAction:e=>a().each((e=>e.get().each((e=>n.set({...n.get(),fontSize:e.changeFontSize("increase")})))))},{type:"togglebutton",icon:"text-size-decrease",tooltip:"Decrease font size",onAction:e=>a().each((e=>e.get().each((e=>n.set({...n.get(),fontSize:e.changeFontSize("decrease")})))))}]},{type:"group",buttons:[{type:"button",text:"Cancel",onAction:()=>{i.get().each((()=>{d(),e.mode.set("design")}))}},{type:"button",text:"Save code",buttonType:"primary",onAction:()=>{i.get().each((({syncWithEditor:t})=>{t(),d(),e.mode.set("design")}))}}]}]:[],onShow:a=>{const d=a.getContainer(),u=k(e,t,c);s.set(l.some(u.advcodeInstanceId)),r.set(me(e)),e.setProgressState(!0),n.get().fullscreen!==me(e)&&e.execCommand("mceFullScreen"),((e,t,o,n)=>{return Promise.all([de(t,o),("tinymce.plugins.advcode.CodeMirror",r=e,tinymce.Resource.load("tinymce.plugins.advcode.CodeMirror",r))]).then((([e,t])=>(e,o,r)=>ce(t(),e,o,r,n)));var r})(p(e),h(e),e.id,n.get()).then((t=>{e.setProgressState(!1),i.set(((e,t,o,n,r,i)=>{const s=X(o),c={...r,cursor:s.cursor},a=V("div");var d;d=a,((e,t)=>{for(let t=0,n=e.length;t{(e=>void 0!==e.dom.classList)(e)?e.dom.classList.add(t):re(e,t)})(d,o);var o})(0===t?["tox-inline-headless-codemirror","mce-codemirror"]:["tox-custom-editor","tox-inline-codemirror","mce-codemirror"]),B(F(e),a);const{getValue:l,destroy:u,copyCode:m,changeFontSize:g,setDarkMode:p,setFontSize:h}=n(a.dom,c,s.content,i);oe(r.editorId,r.advcodeInstanceId).each((e=>e.set({copyCode:m,changeFontSize:g,setDarkMode:p,setFontSize:h}))),h(i.fontSize);const v=()=>ee(o,l());return 0===t&&o.on("BeforeGetContent",v),{syncWithEditor:v,destroy:()=>{0===t&&(o.off("BeforeGetContent",v),v()),K(a),u()}}})(d,o,e,t,u,n.get()))}))},onHide:d})};tinymce.PluginManager.requireLangPack("advcode","ar,bg_BG,ca,cs,da,de,el,es,eu,fa,fi,fr_FR,he_IL,hi,hr,hu_HU,id,it,ja,kk,ko_KR,ms,nb_NO,nl,pl,pt_BR,pt_PT,ro,ru,sk,sl_SI,sv_SE,th_TH,tr,uk,vi,zh_CN,zh_TW"),tinymce.PluginManager.add("advcode",((e,o)=>{((e,o)=>!!e&&-1===((e,o)=>{const n=t(e.major,o.major);if(0!==n)return n;const r=t(e.minor,o.minor);if(0!==r)return r;const i=t(e.patch,o.patch);return 0!==i?i:0})((e=>n((e=>[e.majorVersion,e.minorVersion].join(".").split(".").slice(0,3).join("."))(e)))(e),n(o)))(tinymce,"6.3.0")?console.error("The advcode plugin requires at least version 6.3.0 of TinyMCE."):((e,t)=>{((e,t)=>{const o=e.options.register;o("codemirror_script",{processor:"string",default:t+"/codemirror.min.js"}),o("codemirror_css",{processor:"string",default:t+"/codemirror.min.css"}),o("codemirror_linewrapping",{processor:"boolean",default:!0}),o("codemirror_linenumbers",{processor:"boolean",default:!0}),o("codemirror_foldgutter",{processor:"boolean",default:!0}),o("codemirror_gutter",{processor:"boolean",default:!0}),o("codemirror_theme",{processor:"string",default:"default"}),o("advcode_headless",{processor:"boolean",default:!1}),o("advcode_inline",{processor:"boolean",default:!1})})(e,t),ue(e,t),(e=>{const t="sourcecode",o=()=>e.execCommand("mceCodeEditor");e.ui.registry.addButton("code",{icon:t,tooltip:"Source code",onAction:o}),e.ui.registry.addMenuItem("code",{icon:t,text:"Source code",onAction:o})})(e),((e,t)=>{ge(e,t,S(e)?0:1)})(e,t),(e=>{e.mode.register("code",{activate:()=>{"code"!==e.queryCommandValue("ToggleView")&&e.execCommand("ToggleView",!1,"code")},deactivate:()=>{"code"===e.queryCommandValue("ToggleView")&&e.execCommand("ToggleView",!1,"code")},editorReadOnly:!1})})(e)})(e,o)}))}(); \ No newline at end of file +!function(){"use strict";const e=e=>parseInt(e,10),t=(e,t)=>{const o=e-t;return 0===o?0:o>0?1:-1},o=(e,t,o)=>({major:e,minor:t,patch:o}),r=t=>{const r=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(t);return r?o(e(r[1]),e(r[2]),e(r[3])):o(0,0,0)},n=e=>t=>typeof t===e,s=e=>"string"===(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=r=e,(n=String).prototype.isPrototypeOf(o)||(null===(s=r.constructor)||void 0===s?void 0:s.name)===n.name)?"string":t;var o,r,n,s})(e),i=n("boolean"),c=e=>!(e=>null==e)(e),a=n("function"),d=n("number");class l{constructor(e,t){this.tag=e,this.value=t}static some(e){return new l(!0,e)}static none(){return l.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?l.some(e(this.value)):l.none()}bind(e){return this.tag?e(this.value):l.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:l.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return c(e)?l.some(e):l.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()"}}l.singletonNone=new l(!1);let u=0;const m=e=>{const t=(new Date).getTime(),o=Math.floor(1e9*Math.random());return u++,e+"_"+o+u+String(t)},g=e=>t=>t.options.get(e),p=g("codemirror_script"),h=g("codemirror_css"),v=g("codemirror_linewrapping"),f=g("codemirror_linenumbers"),y=g("codemirror_foldgutter"),b=g("codemirror_gutter"),w=g("codemirror_theme"),C=e=>"rtl"===e.getBody().dir?"rtl":"ltr",S=g("advcode_headless"),_=g("advcode_inline"),k=(e,t,o)=>({customEditorScriptUrl:t+"/customeditor.min.js",codeMirrorScriptUrl:p(e),codeMirrorCssUrl:h(e),lineWrapping:v(e),lineNumbers:f(e),foldGutter:y(e),theme:w(e),direction:C(e),gutter:b(e),editorId:e.id,advcodeInstanceId:m("advcode_instance"),currentAdvStatus:o}),x=()=>{},z=()=>!1,I=(e,t)=>{for(let o=0,r=e.length;oT.call(e,t);"undefined"!=typeof window?window:Function("return this;")();const E=e=>t=>(e=>e.dom.nodeType)(t)===e,M=E(1),N=E(3),O=E(9),D=E(11),L=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},P=(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 L(o.childNodes[0])},V=(e,t)=>{const o=(t||document).createElement(e);return L(o)},F=L,j=e=>O(e)?e:F(e.dom.ownerDocument),B=(e,t)=>{e.dom.appendChild(t.dom)},R=e=>D(e)&&c(e.dom.host),$=a(Element.prototype.attachShadow)&&a(Node.prototype.getRootNode)?e=>F(e.dom.getRootNode()):j,W=e=>F(e.dom.host),U=e=>{const t=N(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return(e=>{const t=$(e);return R(t)?l.some(t):l.none()})(F(t)).fold((()=>o.body.contains(t)),(r=U,n=W,e=>r(n(e))));var r,n},G=()=>H(F(document)),H=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return F(t)},q=(e,t,o)=>{let r=e.dom;const n=a(o)?o:z;for(;r.parentNode;){r=r.parentNode;const e=F(r);if(t(e))return l.some(e);if(n(e))break}return l.none()},K=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Q="\x3c!--mce_cursor--\x3e",J=(e,t)=>{const o=e.dom,r=e.selection,n=r.getBookmark(),s=(e=>A(e,"name"))(n)?o.select(n.name)[n.index]:o.select(`#${n.id}_start`)[0],i=l.from(s).map((t=>{const o=F(e.getBody());return((e,t)=>{const r=P(Q),n=F(e),s=((e,t,o)=>((e,t,o,r,n)=>r(o)?l.some(o):a(n)&&n(o)?l.none():t(o,r,n))(0,q,e,t,o))(n,(e=>((e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute("data-mce-bogus")})(e)),(e=>{return t=o,e.dom===t.dom;var t})).getOr(n);return((e,t)=>{const o=(e=>l.from(e.dom.parentNode).map(F))(e);o.each((o=>{o.dom.insertBefore(t.dom,e.dom)}))})(s,r),r})(t)})),c=t();return i.each(K),r.moveToBookmark(n),c},X=e=>{const t=(e=>{const t=e.split(/\r?\n/);return((e,t)=>{for(let o=0;o{const r=e.indexOf(Q);return(n=-1!==r,s=r,n?l.some(s):l.none()).map((r=>e===Q?0===o?{line:o,ch:0}:{line:o-1,ch:t[o-1].length}:{line:o,ch:r}));var n,s})).getOr({line:0,ch:0})})(J(e,(()=>e.getContent({source_view:!0}))));return{content:e.getContent({source_view:!0}),cursor:t}},Y=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},Z=()=>{const e=(e=>{const t=Y(l.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(l.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(l.some(e))}}})(x);return{...e,on:t=>e.get().each(t)}},ee=(e,t)=>{e.focus(),e.undoManager.transact((()=>{e.setContent(t)})),e.selection.setCursorLocation(),e.nodeChanged()},te=e=>{return(t=tinymce,"get",A(t,"get")?l.from(t.get):l.none()).bind((t=>l.from(t.call(tinymce,e))));var t},oe=(e,t)=>te(e).bind((e=>l.from(e.plugins.advcode))).map((e=>(e[t]||(e[t]=Z()),e[t]))),re=(e,t)=>{te(e).bind((e=>l.from(e.plugins.advcode))).each((e=>{e[t]&&delete e[t]}))},ne=(e,t)=>((e,t,o)=>{const r=((e,t)=>{const o=((e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o})(e,t);return void 0===o||""===o?[]:o.split(" ")})(e,t);return((e,t,o)=>{((e,t,o)=>{if(!(s(o)||i(o)||d(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+"")})(e.dom,t,o)})(e,t,r.concat([o]).join(" ")),!0})(e,"class",t),se={unsupportedLength:["em","ex","cap","ch","ic","rem","lh","rlh","vw","vh","vi","vb","vmin","vmax","cm","mm","Q","in","pc","pt","px"],fixed:["px","pt"],relative:["%"],empty:[""]},ie=(()=>{const e="[0-9]+",t="[eE][+-]?"+e,o=e=>`(?:${e})?`,r=["Infinity",e+"\\."+o(e)+o(t),"\\."+e+o(t),e+o(t)].join("|");return new RegExp(`^([+-]?(?:${r}))(.*)$`)})(),ce=(e,t,o,r="",n)=>{const s=(e=>{const t=te(e).map((e=>{const t=$(F(e.getElement()));return R(o=t)?o:F(j(o).dom.body);var o})).getOrThunk(G);if(M(t))return{element:t,destroy:x};{const e=V("div");return B(t,e),{element:e,destroy:()=>K(e)}}})(o.editorId),i=((e,t)=>{const o=(o,r)=>(r&&!r()||setTimeout((()=>{o.state.completionActive||o.showHint({completeSingle:!1,container:t})}),100),e.Pass);return{completeAfter:o,completeIfAfterLt:t=>o(t,(()=>{const o=t.getCursor();return"<"===t.getRange(e.Pos(o.line,o.ch-1),o)})),completeIfInTag:t=>o(t,(()=>{const o=t.getTokenAt(t.getCursor());return!!("string"!==o.type||/['"]/.test(o.string.charAt(o.string.length-1))&&1!==o.string.length)&&e.innerMode(t.getMode(),o.state).state.tagName}))}})(e,s.element.dom),c="dracula",d={lineWrapping:o.lineWrapping,lineNumbers:o.lineNumbers,foldGutter:o.foldGutter,theme:n.dark?c:o.theme,direction:o.direction,matchTags:{bothTags:!0},keyMap:"sublime",gutters:o.gutter?["CodeMirror-linenumbers","CodeMirror-foldgutter"]:[],extraKeys:{"Alt-F":"findPersistent","Ctrl-J":"toMatchingTag","Ctrl-B":"selectNextOccurrence","'<'":i.completeAfter,"'/'":i.completeIfAfterLt,"' '":i.completeIfInTag,"'='":i.completeIfInTag,"Ctrl-Q":e=>{e.foldCode(e.getCursor())}},mode:"text/html",value:r},u=e(t,d),m=e=>{27!==e.keyCode&&e.stopPropagation()};t.addEventListener("keyup",m),t.addEventListener("keydown",m),t.addEventListener("keypress",m),setTimeout((()=>{u.focus(),o.cursor&&u.doc.setCursor(o.cursor)}),0),setTimeout((()=>u.refresh()),200);const g=e=>{const t=u.getWrapperElement();e.fold((()=>{var e,o;t.classList.remove("inherit-font-size"),null===(o=null===(e=t.parentElement)||void 0===e?void 0:e.style)||void 0===o||o.removeProperty("font-size")}),(e=>{var o,r;t.classList.add("inherit-font-size"),null===(r=null===(o=t.parentElement)||void 0===o?void 0:o.style)||void 0===r||r.setProperty("font-size",e)})),u.refresh()},p={getValue:()=>u.doc.getValue(),setValue:e=>u.doc.setValue(e),setDarkMode:e=>{e?u.setOption("theme",c):u.setOption("theme",o.theme)},copyCode:()=>new Promise(((e,t)=>window.isSecureContext?e(navigator.clipboard.writeText(u.getValue())):t("context is not secure"))),setFontSize:g,changeFontSize:e=>{const t=u.getWrapperElement(),o=(d=F(t),m=".CodeMirror-scroll",((e,t)=>{const o=void 0===t?document:t.dom;return 1!==(r=o).nodeType&&9!==r.nodeType&&11!==r.nodeType||0===r.childElementCount?l.none():l.from(o.querySelector(e)).map(F);var r})(m,d)).map((e=>((e,t)=>{const o=e.dom,r=window.getComputedStyle(o).getPropertyValue(t);return""!==r||U(e)?r:((e,t)=>(e=>void 0!==e.style&&a(e.style.getPropertyValue))(e)?e.style.getPropertyValue(t):"")(o,t)})(e,"font-size"))).getOr("0px"),r=(i=o,c=["unsupportedLength"],l.from(ie.exec(i)).bind((e=>{const t=Number(e[1]),o=e[2];return((e,t)=>I(t,(t=>I(se[t],(t=>e===t)))))(o,c)?l.some({value:t,unit:o}):l.none()}))),n=r.map((e=>e.value)).getOr(0),s=r.map((e=>e.unit)).getOr("");var i,c,d,m;let p=l.none();return"increase"===e&&(p=l.some(`${n+1}${s}`)),"decrease"===e&&(p=l.some(`${n>5?n-1:n}${s}`)),g(p),p},destroy:()=>{t.removeEventListener("keyup",m),t.removeEventListener("keydown",m),t.removeEventListener("keypress",m),re(o.editorId,o.advcodeInstanceId),s.destroy()}};return p},ae={},de=(e,t)=>{if(ae[t])return Promise.resolve();{const o=te(t),r=o.bind((e=>{var t;return l.from(null===(t=e.ui)||void 0===t?void 0:t.styleSheetLoader)})).getOr(tinymce.DOM.styleSheetLoader);return o.each((o=>{o.on("remove",(()=>{r.unload(e),delete ae[t]}))})),ae[t]=!0,((e,t)=>{const o="advcode/css/codemirror.css",r=null!=t?t:tinymce.DOM.styleSheetLoader;if(tinymce.Resource.has(o)){const t=tinymce.Resource.get(o);return r.loadRawCss(e,t),Promise.resolve()}return r.load(e)})(e,r)}},le=e=>({name:"codeview",type:"customeditor",tag:"div",scriptId:"tinymce.plugins.advcode.customeditor",scriptUrl:e.customEditorScriptUrl,settings:e}),ue=(e,t)=>{const o={dark:!1,fullscreen:!1,fontSize:l.none()};e.addCommand("mceCodeEditor",(()=>{_(e)&&!e.inline?"code"===e.mode.get()?e.mode.set("design"):e.mode.set("code"):(()=>{const r=k(e,t,o);((e,t)=>{const o=X(e),r={...t,cursor:o.cursor},n=t.currentAdvStatus,s=oe(t.editorId,t.advcodeInstanceId),i=()=>{let e=[{type:"togglebutton",name:"dark_theme_toggle",text:"Dark/light mode",tooltip:"Dark/light mode",active:n.dark,align:"start"},{type:"custom",name:"increase_font_size",text:"Increase font size",icon:"text-size-increase",align:"start"},{type:"custom",name:"decrease_font_size",text:"Decrease font size",icon:"text-size-decrease",align:"start"},{type:"cancel",name:"cancel",text:"Cancel",align:"end"},{type:"submit",name:"save",text:"Save",primary:!0,align:"end"}];return window.isSecureContext?e=[{type:"custom",name:"copy_code",text:"Copy code",align:"start"}].concat(e):console.warn("Copy code is not allowed since window.isSecureContext is false"),e},c=o=>({title:"Source Code",size:"large",body:{type:"panel",items:[le(r)]},buttons:i(),initialData:{codeview:o},onSubmit:o=>{ee(e,o.getData().codeview),re(t.editorId,t.advcodeInstanceId),o.close()},onClose:()=>{re(t.editorId,t.advcodeInstanceId)},onAction:(e,t)=>{"copy_code"===t.name&&s.each((t=>t.get().each((t=>{(async()=>{const o=setTimeout((()=>{e.block("copying")}),150);await t.copyCode(),clearTimeout(o),e.unblock()})()})))),"increase_font_size"===t.name&&s.each((e=>e.get().each((e=>{n.fontSize=e.changeFontSize("increase")})))),"decrease_font_size"===t.name&&s.each((e=>e.get().each((e=>{n.fontSize=e.changeFontSize("decrease")})))),"dark_theme_toggle"===t.name&&s.each((t=>t.get().each((t=>{t.setDarkMode(!n.dark),n.dark=!n.dark,e.redial(c(e.getData().codeview))}))))}});e.windowManager.open(c(o.content))})(e,r)})()}))},me=e=>e.plugins.fullscreen&&e.plugins.fullscreen.isFullscreen(),ge=(e,t,o)=>{const r=Y({dark:!1,fullscreen:!1,fontSize:l.none()}),n=Y(me(e)),s=Z(),i=Y(l.none()),c={dark:!1,fullscreen:!1,fontSize:l.none()},a=()=>i.get().bind((t=>oe(e.id,t))),d=()=>{s.get().each((({destroy:t})=>{t(),r.get().fullscreen!==n.get()&&e.execCommand("mceFullScreen")})),s.clear()};e.ui.registry.addView("code",{buttons:1===o?[{type:"group",buttons:[...e.hasPlugin("fullscreen")?[{type:"togglebutton",icon:"fullscreen",tooltip:"Fullsceen",onAction:t=>{e.execCommand("mceFullScreen",void 0,void 0,{skip_focus:!0});const o=!t.isActive();r.set({...r.get(),fullscreen:o}),t.setActive(o)}}]:[],{type:"togglebutton",icon:"copy",text:"Copy code",onAction:e=>a().each((e=>e.get().each((e=>{(async()=>{await e.copyCode()})()}))))}]},{type:"group",buttons:[{type:"togglebutton",text:"Dark/light mode",tooltip:"Dark/light mode",onAction:e=>{a().each((t=>t.get().each((t=>{r.set({...r.get(),dark:!e.isActive()}),e.setActive(r.get().dark),t.setDarkMode(r.get().dark)}))))}},{type:"togglebutton",icon:"text-size-increase",tooltip:"Increase font size",onAction:e=>a().each((e=>e.get().each((e=>r.set({...r.get(),fontSize:e.changeFontSize("increase")})))))},{type:"togglebutton",icon:"text-size-decrease",tooltip:"Decrease font size",onAction:e=>a().each((e=>e.get().each((e=>r.set({...r.get(),fontSize:e.changeFontSize("decrease")})))))}]},{type:"group",buttons:[{type:"button",text:"Cancel",onAction:()=>{s.get().each((()=>{d(),e.mode.set("design")}))}},{type:"button",text:"Save code",buttonType:"primary",onAction:()=>{s.get().each((({syncWithEditor:t})=>{t(),d(),e.mode.set("design")}))}}]}]:[],onShow:a=>{const d=a.getContainer(),u=k(e,t,c);i.set(l.some(u.advcodeInstanceId)),n.set(me(e)),e.setProgressState(!0),r.get().fullscreen!==me(e)&&e.execCommand("mceFullScreen"),((e,t,o,r)=>{return Promise.all([de(t,o),("tinymce.plugins.advcode.CodeMirror",n=e,tinymce.Resource.load("tinymce.plugins.advcode.CodeMirror",n))]).then((([e,t])=>(e,o,n)=>ce(t(),e,o,n,r)));var n})(p(e),h(e),e.id,r.get()).then((t=>{e.setProgressState(!1),s.set(((e,t,o,r,n,s)=>{const i=X(o),c={...n,cursor:i.cursor},a=V("div");var d;d=a,((e,t)=>{for(let t=0,r=e.length;t{(e=>void 0!==e.dom.classList)(e)?e.dom.classList.add(t):ne(e,t)})(d,o);var o})(0===t?["tox-inline-headless-codemirror","mce-codemirror"]:["tox-custom-editor","tox-inline-codemirror","mce-codemirror"]),B(F(e),a);const{getValue:l,destroy:u,copyCode:m,changeFontSize:g,setDarkMode:p,setFontSize:h}=r(a.dom,c,i.content,s);oe(n.editorId,n.advcodeInstanceId).each((e=>e.set({copyCode:m,changeFontSize:g,setDarkMode:p,setFontSize:h}))),h(s.fontSize);const v=()=>ee(o,l());return 0===t&&o.on("BeforeGetContent",v),{syncWithEditor:v,destroy:()=>{0===t&&(o.off("BeforeGetContent",v),v()),K(a),u()}}})(d,o,e,t,u,r.get()))}))},onHide:d})};tinymce.PluginManager.requireLangPack("advcode","ar,bg_BG,ca,cs,da,de,el,es,eu,fa,fi,fr_FR,he_IL,hi,hr,hu_HU,id,it,ja,kk,ko_KR,ms,nb_NO,nl,pl,pt_BR,pt_PT,ro,ru,sk,sl_SI,sv_SE,th_TH,tr,uk,vi,zh_CN,zh_TW"),tinymce.PluginManager.add("advcode",((e,o)=>{((e,o)=>!!e&&-1===((e,o)=>{const r=t(e.major,o.major);if(0!==r)return r;const n=t(e.minor,o.minor);if(0!==n)return n;const s=t(e.patch,o.patch);return 0!==s?s:0})((e=>r((e=>[e.majorVersion,e.minorVersion].join(".").split(".").slice(0,3).join("."))(e)))(e),r(o)))(tinymce,"6.8.0")?console.error("The advcode plugin requires at least version 6.8.0 of TinyMCE."):((e,t)=>{((e,t)=>{const o=e.options.register;o("codemirror_script",{processor:"string",default:t+"/codemirror.min.js"}),o("codemirror_css",{processor:"string",default:t+"/codemirror.min.css"}),o("codemirror_linewrapping",{processor:"boolean",default:!0}),o("codemirror_linenumbers",{processor:"boolean",default:!0}),o("codemirror_foldgutter",{processor:"boolean",default:!0}),o("codemirror_gutter",{processor:"boolean",default:!0}),o("codemirror_theme",{processor:"string",default:"default"}),o("advcode_headless",{processor:"boolean",default:!1}),o("advcode_inline",{processor:"boolean",default:!1})})(e,t),ue(e,t),(e=>{const t="sourcecode",o=()=>e.execCommand("mceCodeEditor");e.ui.registry.addButton("code",{icon:t,tooltip:"Source code",onAction:o}),e.ui.registry.addMenuItem("code",{icon:t,text:"Source code",onAction:o})})(e),((e,t)=>{ge(e,t,S(e)?0:1)})(e,t),(e=>{e.mode.register("code",{activate:()=>{"code"!==e.queryCommandValue("ToggleView")&&e.execCommand("ToggleView",!1,"code")},deactivate:()=>{"code"===e.queryCommandValue("ToggleView")&&e.execCommand("ToggleView",!1,"code")},editorReadOnly:!1})})(e)})(e,o)}))}(); \ No newline at end of file diff --git a/plugins/advtemplate/plugin.min.js b/plugins/advtemplate/plugin.min.js index 2c68275..c844abc 100644 --- a/plugins/advtemplate/plugin.min.js +++ b/plugins/advtemplate/plugin.min.js @@ -4,7 +4,7 @@ * Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc. * Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/ * - * Version: 1.3.0-38 + * Version: 1.4.0-44 */ -!function(){"use strict";const e=e=>parseInt(e,10),t=(e,t)=>{const n=e-t;return 0===n?0:n>0?1:-1},n=(e,t,n)=>({major:e,minor:t,patch:n}),a=t=>{const a=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(t);return a?n(e(a[1]),e(a[2]),e(a[3])):n(0,0,0)},r=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(n=a=e,(r=String).prototype.isPrototypeOf(n)||(null===(o=a.constructor)||void 0===o?void 0:o.name)===r.name)?"string":t;var n,a,r,o})(t)===e,o=e=>t=>typeof t===e,i=r("string"),l=r("object"),s=r("array"),c=o("boolean"),m=(void 0,e=>undefined===e);const d=e=>null==e,p=e=>!d(e),u=o("function"),g=o("number"),y=()=>{},v=e=>()=>e,h=e=>e,f=e=>e(),_=v(!1),b=v(!0);class w{constructor(e,t){this.tag=e,this.value=t}static some(e){return new w(!0,e)}static none(){return w.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?w.some(e(this.value)):w.none()}bind(e){return this.tag?e(this.value):w.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:w.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 p(e)?w.some(e):w.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()"}}w.singletonNone=new w(!1);const x=Array.prototype.slice,C=Array.prototype.indexOf,S=Array.prototype.push,A=(e,t)=>((e,t)=>C.call(e,t))(e,t)>-1,T=(e,t)=>{const n=e.length,a=new Array(n);for(let r=0;r{for(let n=0,a=e.length;n(e=>{const t=[];for(let n=0,a=e.length;n{for(let n=0,a=e.length;n((e,t)=>0{const t=t=>t(e),n=v(e),a=()=>r,r={tag:!0,inner:e,fold:(t,n)=>n(e),isValue:b,isError:_,map:t=>j.value(t(e)),mapError:a,bind:t,exists:t,forall:t,getOr:n,or:a,getOrThunk:n,orThunk:a,getOrDie:n,each:t=>{t(e)},toOptional:()=>w.some(e)};return r},N=e=>{const t=()=>n,n={tag:!1,inner:e,fold:(t,n)=>t(e),isValue:_,isError:b,map:t,mapError:t=>j.error(t(e)),bind:t,exists:_,forall:b,getOr:h,or:h,getOrThunk:f,orThunk:f,getOrDie:(a=String(e),()=>{throw new Error(a)}),each:y,toOptional:w.none};var a;return n},j={value:I,error:N,fromOption:(e,t)=>e.fold((()=>N(t)),I)},k=Object.keys,$=Object.hasOwnProperty,R=(e,t)=>$.call(e,t),B=e=>i(e)&&e.length>0,L=e=>B(e),z=e=>R(e,"id")&&L(e.id),U=e=>R(e,"title")&&B(e.title),V=e=>R(e,"content")&&B(e.content),K=e=>l(e)&&z(e)&&U(e)&&R(e,"items")&&F(e.items),q=e=>l(e)&&z(e)&&U(e)&&(e=>!R(e,"items")||F(e.items))(e),F=e=>s(e)&&O(e,q),H=e=>R(e,"items")&&W(e.items),G=e=>l(e)&&U(e)&&((e=>V(e))(e)||H(e)),W=e=>s(e)&&O(e,G),Y=(e,t)=>n=>e(n)?j.value(n):j.error(t),J=Y((e=>l(e)&&(e=>{for(const t in e)if($.call(e,t))return!1;return!0})(e)),"response should contain empty object"),Q=Y((e=>l(e)&&z(e)),"response should contain id"),X=Y((e=>l(e)&&z(e)&&U(e)&&V(e)),"response contains invalid template data"),Z=e=>F(e)?(e=>{const t=e=>D(e,(e=>K(e)?[e.id,...t(e.items)]:[e.id])),n=t(e);return n.length===[...new Set(n)].length})(e)?j.value(e):j.error("response contains duplicated ids"):j.error("response contains invalid data"),ee=e=>t=>t.options.get(e),te=e=>{const t=(t,n)=>{var a,r;a=t,r=(e,t)=>(...a)=>((e,t,n)=>{return l(a=n)&&u(a.then)&&u(a.catch)?n.then((n=>t(n).fold((t=>Promise.reject(new P(`${e} ${t}`))),(e=>Promise.resolve(e))))):Promise.reject(new P(`${e} should return a Promise`));var a})(e,n,t(...a)),e.options.register(a,{processor:e=>u(e)?{valid:!0,value:r(a,e)}:{valid:!1,message:"Must be a function returning promise"},default:()=>Promise.reject(new P(`${a} option is not configured`))})};t("advtemplate_create_category",Q),t("advtemplate_rename_category",J),t("advtemplate_move_category_items",J),t("advtemplate_delete_category",J),t("advtemplate_create_template",Q),t("advtemplate_rename_template",J),t("advtemplate_update_template",J),t("advtemplate_move_template",J),t("advtemplate_get_template",X),t("advtemplate_delete_template",J),t("advtemplate_delete_all",J),t("advtemplate_list",Z),e.options.register("advtemplate_templates",{processor:W})},ne=ee("advtemplate_create_category"),ae=ee("advtemplate_rename_category"),re=ee("advtemplate_move_category_items"),oe=ee("advtemplate_delete_category"),ie=ee("advtemplate_create_template"),le=ee("advtemplate_rename_template"),se=ee("advtemplate_move_template"),ce=ee("advtemplate_get_template"),me=ee("advtemplate_delete_template"),de=ee("advtemplate_list"),pe=ee("advtemplate_templates"),ue=ee("content_style"),ge=ee("body_class"),ye=ee("content_css_cors"),ve=(e,t)=>e?w.some(t):w.none();let he=0;const fe=()=>{const e=(e=>{const t=(e=>{let t=e;return{get:()=>t,set:e=>{t=e}}})(w.none()),n=()=>t.get().each(e);return{clear:()=>{n(),t.set(w.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{n(),t.set(w.some(e))}}})(y);return{...e,on:t=>e.get().each(t)}},_e=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},be=(e,t)=>{const n=(t||document).createElement(e);return _e(n)},we=_e;"undefined"!=typeof window?window:Function("return this;")();const xe="{{mce-cursor}}",Ce=(e,t)=>{((e,t)=>ve(-1!==t.indexOf(xe),t).bind((t=>{const n=tinymce.html.DomParser(void 0,e.schema),a=fe();var r;n.addNodeFilter("#text",(r=a,e=>{((e,t)=>{for(let n=0;nw.from(e.value).map((t=>({node:e,textContent:t,index:t.indexOf(xe)}))).filter((({index:e})=>-1!==e)))).each((({node:e,textContent:t,index:n})=>{const a=tinymce.html.Node.create("span");if(n>0){const e=tinymce.html.Node.create("#text");e.value=t.substring(0,n),a.append(e)}const o=(e=>{const t=(new Date).getTime(),n=Math.floor(1e9*Math.random());return he++,"advtemplate-cursor-marker_"+n+he+String(t)})();r.set(o);const i=tinymce.html.Node.create("span",{"data-mce-id":o,"data-mce-cursor-marker":"true"}),l=tinymce.html.Node.create("#text");if(l.value="\ufeff",i.append(l),a.append(i),t.length>n+14){const e=tinymce.html.Node.create("#text");e.value=t.substring(n+14,t.length),a.append(e)}e.replace(a),a.unwrap()}))}));const o=n.parse(t,{insert:!0});return ve(a.isSet(),{content:tinymce.html.Serializer({validate:!0},e.schema).serialize(o),cursorMarkerId:a.get().getOrDie()})})))(e,t).fold((()=>e.insertContent(t)),(({cursorMarkerId:t,content:n})=>{e.undoManager.transact((()=>{e.insertContent(n),((e,t)=>{const n=we(e.getBody());var a,r;(a=n,r=`span[data-mce-id="${t}"]`,((e,t)=>{const n=void 0===t?document:t.dom;return 1!==(a=n).nodeType&&9!==a.nodeType&&11!==a.nodeType||0===a.childElementCount?w.none():w.from(n.querySelector(e)).map(we);var a})(r,a)).each((t=>{const n=e.dom.createRng();n.setStartAfter(t.dom),n.setEndAfter(t.dom),e.selection.setRng(n),e.selection.scrollIntoView(),(e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)})(t)}))})(e,t)}))}))},Se=(e,t)=>ce(e)(t).then((t=>{Ce(e,t.content)})),Ae={text:"Uncategorized",value:""},Te=(e,t)=>{const n=((e,n)=>{const a=[];for(let n=0,o=e.length;n({text:t,value:e})))]},Ee=(e,t)=>{return(n=t,a=t=>K(t)&&A(T(t.items,(({id:e})=>e)),e),((e,t,n)=>{for(let a=0,r=e.length;ae.id)).getOr(Ae.value);var n,a},De=e=>ve(e!==Ae.value,e).getOrUndefined(),Oe=(e,t,n)=>e.options.isSet(t)?[n]:[],Me=(e,t,n)=>{const a=e=>{const a=[...Oe(n,"advtemplate_rename_category",{type:"menuitem",text:"Rename...",onAction:t.renameCategory(e)}),...Oe(n,"advtemplate_move_category_items",{type:"menuitem",text:"Move all items...",enabled:e.items.length>0,onAction:t.moveCategoryItems(e.id)}),...Oe(n,"advtemplate_delete_category",{type:"separator"}),...Oe(n,"advtemplate_delete_category",{type:"menuitem",icon:"remove",text:"Delete all",onAction:t.deleteCategory(e.id)})];return a.length>0?{menu:{type:"menubutton",icon:"image-options",fetch:e=>e(a)}}:{}},r=e=>{const a=[...Oe(n,"advtemplate_rename_template",{type:"menuitem",text:"Rename...",onAction:t.renameTemplate(e)}),...Oe(n,"advtemplate_move_template",{type:"menuitem",text:"Move to...",onAction:t.moveTemplate(e.id)}),...Oe(n,"advtemplate_delete_template",{type:"separator"}),...Oe(n,"advtemplate_delete_template",{type:"menuitem",icon:"remove",text:"Delete",onAction:t.deleteTemplate(e.id)})];return a.length>0?{menu:{type:"menubutton",icon:"image-options",fetch:e=>e(a)}}:{}};return T(e,(e=>K(e)?(e=>({type:"directory",id:e.id,title:e.title,children:Me(e.items,t,n),...a(e)}))(e):(e=>({type:"leaf",id:e.id,title:e.title,...r(e)}))(e)))},Pe=e=>t=>{w.from(t.message).bind((e=>(console.error(e),ve(!(e=>e instanceof P)(t),e)))).or(w.some("Operation failed")).each(e.windowManager.alert)},Ie=(e,t)=>((e,t,n)=>{const a=((e,t)=>{const n=((e,t)=>{const n=e.dom.getAttribute(t);return null===n?void 0:n})(e,t);return void 0===n||""===n?[]:n.split(" ")})(e,t);return((e,t,n)=>{((e,t,n)=>{if(!(i(n)||c(n)||g(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)})(e,t,a.concat([n]).join(" ")),!0})(e,"class",t),Ne=(e=>{let t,n=!1;return(...a)=>(n||(n=!0,t=e.apply(null,a)),t)})((()=>{const e=tinymce.Env.os.isMacOS()||tinymce.Env.os.isiOS()?e=>e.metaKey:e=>e.ctrlKey&&!e.altKey;return`