!function(l){"use strict";vart,n,e,r,a,o=function(t){varn=t,e=function(){returnn};return{get:e,set:function(t){n=t},clone:function(){returno(e())}}},i=tinymce.util.Tools.resolve("tinymce.PluginManager"),f=function(){},u=function(t){returnfunction(){returnt}},s=u(!1),c=u(!0),d=function(){returng},g=(t=function(t){returnt.isNone()},r={fold:function(t,n){returnt()},is:s,isSome:s,isNone:c,getOr:e=function(t){returnt},getOrThunk:n=function(t){returnt()},getOrDie:function(t){thrownewError(t||"error: getOrDie called on none.")},getOrNull:u(null),getOrUndefined:u(undefined),or:e,orThunk:n,map:d,each:f,bind:d,exists:s,forall:c,filter:d,equals:t,equals_:t,toArray:function(){return[]},toString:u("none()")},Object.freeze&&Object.freeze(r),r),m=function(e){vart=u(e),n=function(){returna},r=function(t){returnt(e)},a={fold:function(t,n){returnn(e)},is:function(t){returne===t},isSome:c,isNone:s,getOr:t,getOrThunk:t,getOrDie:t,getOrNull:t,getOrUndefined:t,or:n,orThunk:n,map:function(t){returnm(t(e))},each:function(t){t(e)},bind:r,exists:r,forall:r,filter:function(t){returnt(e)?a:g},toArray:function(){return[e]},toString:function(){return"some("+e+")"},equals:function(t){returnt.is(e)},equals_:function(t,n){returnt.fold(s,function(t){returnn(e,t)})}};returna},h={some:m,none:d,from:function(t){returnnull===t||t===undefined?g:m(t)}},p=(a="function",function(t){returnfunction(t){if(null===t)return"null";varn=typeoft;return"object"===n&&(Array.prototype.isPrototypeOf(t)||t.constructor&&"Array"===t.constructor.name)?"array":"object"===n&&(String.prototype.isPrototypeOf(t)||t.constructor&&"String"===t.constructor.name)?"string":n}(t)===a}),v=Array.prototype.slice,y=function(t,n){for(vare=[],r=0,a=t.length;r<a;r++){varo=t[r];n(o,r)&&e.push(o)}returne},O=(p(Array.from)&&Array.from,Object.hasOwnProperty),P=function(t,n){returnO.call(t,n)},x=function(t){returnP(t,"start")&&P(t,"end")},T=function(t){return!P(t,"end")&&!P(t,"replacement")},b=function(t){returnP(t,"replacement")},k=function(t){returnn=t,e=function(t,n){returnt.start.length===n.start.length?0:t.start.length>n.start.length?-1:1},(r=v.call(n,0)).sort(e),r;varn,e,r},C=function(t){return{inlinePatterns:k(y(t,x)),blockPatterns:k(y(t,T)),replacementPatterns:y(t,b)}},D=function(n){return{setPatterns:function(t){n.set(C(t))},getPatterns:function(){returnfunction(){for(vart=0,n=0,e=arguments.length;n<e;n++)t+=arguments[n].length;varr=Array(t),a=0;for(n=0;n<e;n++)for(varo=arguments[n],i=0,f=o.length;i<f;i++,a++)r[a]=o[i];returnr}(n.get().inlinePatterns,n.get().blockPatterns,n.get().replacementPatterns)}}},S=[{start:"*",end:"*",format:"italic"},{start:"**",end:"**",format:"bold"},{start:"***",end:"***",format:["bold","italic"]},{start:"#",format:"h1"},{start:"##",format:"h2"},{start:"###",format:"h3"},{start:"####",format:"h4"},{start:"#####",format:"h5"},{start:"######",format:"h6"},{start:"1. ",cmd:"InsertOrderedList"},{start:"* ",cmd:"InsertUnorderedList"},{start:"- ",cmd:"InsertUnorderedList"}],A=function(t){varn,e,r=(n=t,e="textpattern_patterns",P(n,e)?h.from(n[e]):h.none()).getOr(S);returnC(r)},N=tinymce.util.Tools.resolve("tinymce.util.Delay"),R=tinymce.util.Tools.resolve("tinymce.util.VK"),w=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),I=tinymce.util.Tools.resolve("tinymce.util.Tools"),j=function(t,n){for(vare=0;e<t.length;e++){varr=t[e];if(0===n.indexOf(r.start)&&(!r.end||n.lastIndexOf(r.end)===n.length-r.end.length))returnr}},E=function(t,n,e){if(!1!==n.collapsed){varr=n.startContainer,a=r.data,o=!0===e?1:0;if(3===r.nodeType){vari=function(t,n,e,r){vara,o,i,f,u,s;for(o=0;o<t.length;o++)if((a=t[o]).end!==undefined&&(f=a,u=e,s=r,n.substr(u-f.end.length-s,f.end.length)===f.end)&&0<e-r-(i=a).end.length-i.start.length)returna}(t,a,n.startOffset,o);if(i!==undefined){varf=a.lastIndexOf(i.end,n.startOffset-o),u=a.lastIndexOf(i.start,f-i.end.length);if(f=a.indexOf(i.end,u+i.start.length),-1!==u){vars=l.document.createRange();s.setStart(r,u),s.setEnd(r,f+i.end.length);varc=j(t,s.toString());if(!(i===undefined||c!==i||r.data.length<=i.