!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(t){returnfunction(){returnt}},u=f(!1),s=f(!0),c=u,d=s,g=function(){returnm},m=(r={fold:function(t,n){returnt()},is:c,isSome:c,isNone:d,getOr:e=function(t){returnt},getOrThunk:n=function(t){returnt()},getOrDie:function(t){thrownewError(t||"error: getOrDie called on none.")},getOrNull:function(){returnnull},getOrUndefined:function(){returnundefined},or:e,orThunk:n,map:g,ap:g,each:function(){},bind:g,flatten:g,exists:c,forall:d,filter:g,equals:t=function(t){returnt.isNone()},equals_:t,toArray:function(){return[]},toString:f("none()")},Object.freeze&&Object.freeze(r),r),h=function(e){vart=function(){returne},n=function(){returna},r=function(t){returnt(e)},a={fold:function(t,n){returnn(e)},is:function(t){returne===t},isSome:d,isNone:c,getOr:t,getOrThunk:t,getOrDie:t,getOrNull:t,getOrUndefined:t,or:n,orThunk:n,map:function(t){returnh(t(e))},ap:function(t){returnt.fold(g,function(t){returnh(t(e))})},each:function(t){t(e)},bind:r,flatten:t,exists:r,forall:r,filter:function(t){returnt(e)?a:m},equals:function(t){returnt.is(e)},equals_:function(t,n){returnt.fold(c,function(t){returnn(e,t)})},toArray:function(){return[e]},toString:function(){return"some("+e+")"}};returna},p={some:h,none:g,from:function(t){returnnull===t||t===undefined?m:h(t)}},v=(a="function",function(t){returnfunction(t){if(null===t)return"null";varn=typeoft;return"object"===n&&Array.prototype.isPrototypeOf(t)?"array":"object"===n&&String.prototype.isPrototypeOf(t)?"string":n}(t)===a}),O=function(t,n){for(vare=[],r=0,a=t.length;r<a;r++){varo=t[r];n(o,r,t)&&e.push(o)}returne},y=Array.prototype.slice,P=(v(Array.from)&&Array.from,Object.hasOwnProperty),x=function(t,n){returnP.call(t,n)},T=function(t){returnx(t,"start")&&x(t,"end")},b=function(t){return!x(t,"end")&&!x(t,"replacement")},k=function(t){returnx(t,"replacement")},C=function(t){returnn=t,e=function(t,n){returnt.start.length===n.start.length?0:t.start.length>n.start.length?-1:1},(r=y.call(n,0)).sort(e),r;varn,e,r},D=function(t){return{inlinePatterns:C(O(t,T)),blockPatterns:C(O(t,b)),replacementPatterns:O(t,k)}},S=function(n){return{setPatterns:function(t){n.set(D(t))},getPatterns:function(){returnn.get().inlinePatterns.concat(n.get().blockPatterns,n.get().replacementPatterns)}}},A=[{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"}],N=function(t){varn,e,r=(n=t,e="textpattern_patterns",x(n,e)?p.from(n[e]):p.none()).getOr(A);returnD(r)},R=tinymce.util.Tools.resolve("tinymce.util.Delay"),w=tinymce.util.Tools.resolve("tinymce.util.VK"),I=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),j=tinymce.util.Tools.resolve("tinymce.util.Tools"),E=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}},q=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=E(t,s.toString());if(!(i===undefined||c!==i||r.data.length<=i.start.length+i.end.length))return{pattern:i,startOffset:u,endOffset:f}}}}}},L=function(t){returnt&&3===t.nodeType},M=function(t,n,e