!function(){"use strict";functiono(e){returnfunction(){returne}}functione(e){returne}functioni(e){returnn=typeof(t=e),"string"==(null===t?"null":"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);vart,n}vart,n=tinymce.util.Tools.resolve("tinymce.PluginManager"),u=function(e){returntypeofe===t};functions(e){returne.getParam("template_mdate_classes","mdate")}functionl(e){returne.getParam("template_replace_values")}functionm(e){returne.getParam("template_mdate_format",e.translate("%Y-%m-%d"))}functionf(e,t){if((e=""+e).length<t)for(varn=0;n<t-e.length;n++)e="0"+e;returne}functionp(e,t,n){void0===n&&(n=newDate);varr="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),a="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),o="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),c="January February March April May June July August September October November December".split(" ");return(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace("%D","%m/%d/%Y")).replace("%r","%I:%M:%S %p")).replace("%Y",""+n.getFullYear())).replace("%y",""+n.getYear())).replace("%m",f(n.getMonth()+1,2))).replace("%d",f(n.getDate(),2))).replace("%H",""+f(n.getHours(),2))).replace("%M",""+f(n.getMinutes(),2))).replace("%S",""+f(n.getSeconds(),2))).replace("%I",""+((n.getHours()+11)%12+1))).replace("%p",n.getHours()<12?"AM":"PM")).replace("%B",""+e.translate(c[n.getMonth()]))).replace("%b",""+e.translate(o[n.getMonth()]))).replace("%A",""+e.translate(a[n.getDay()]))).replace("%a",""+e.translate(r[n.getDay()]))).replace("%%","%")}functionx(n,e){returnO.each(e,function(e,t){u(e)&&(e=e(t)),n=n.replace(newRegExp("\\{\\$"+t+"\\}","g"),e)}),n}functiond(e,t){varr=e.dom,a=l(e);O.each(r.select("*",t),function(n){O.each(a,function(e,t){r.hasClass(n,t)&&u(e)&&e(n)})})}functiong(e,t){returnnewRegExp("\\b"+t+"\\b","g").test(e.className)}functiony(t,e,n){varr=t.dom,a=t.selection.getContent();n=x(n,l(t));varo=r.create("div",null,n),c=r.select(".mceTmpl",o);c&&0<c.length&&(o=r.create("div",null)).appendChild(c[0].cloneNode(!0)),O.each(r.select("*",o),function(e){g(e,t.getParam("template_cdate_classes","cdate").replace(/\s+/g,"|"))&&(e.innerHTML=p(t,t.getParam("template_cdate_format",t.translate("%Y-%m-%d")))),g(e,s(t).replace(/\s+/g,"|"))&&(e.innerHTML=p(t,m(t))),g(e,t.getParam("template_selected_content_classes","selcontent").replace(/\s+/g,"|"))&&(e.innerHTML=a)}),d(t,o),t.execCommand("mceInsertContent",!1,o.innerHTML),t.addVisual()}functionr(){returnb}varc=o(!(t="function")),v=o(!0),O=tinymce.util.Tools.resolve("tinymce.util.Tools"),h=tinymce.util.Tools.resolve("tinymce.util.XHR"),b={fold:function(e,t){returne()},isSome:c,isNone:v,getOr:e,getOrThunk:a,getOrDie:function(e){thrownewError(e||"error: getOrDie called on none.")},getOrNull:o(null),getOrUndefined:o(void0),or:e,orThunk:a,map:r,each:function(){},bind:r,exists:c,forall:v,filter:function(){returnb},toArray:function(){return[]},toString:o("none()")};functiona(e){returne()}functionT(M,t){functionl(e,t){returnfunction(e,t,n){for(varr=0,a=e.length;r<a;r++){varo=e[r];if(t(o,r))returnP.some(o);if(n(o,r))break}returnP.none()}(e,function(e){returne.text===t},c)}functioni(e){M.windowManager.alert("Could not load the specified template.",function(){returne.focus("template")})}functionu(e){returnnew_(function(t,n){e.value.url.fold(function(){returnt(e.value.content.getOr(""))},function(e){returnh.send({url:e,success:function(e){t(e)},error:function(e){n(e)}})})})}!function(){if(t&&0!==t.length)returnP.from(O.map(t,function(e,t){functionn(e){returnvoid0!==e.url}return{selected:0===t,text:e.title,value:{url:n(e)?P.from(e.url):P.none(),content:n(e)?P.none():P.from(e.content),description:e.description}}}));vare=M.translate("No templates defined.");returnM.notificationManager.open({text:e,type:"info"}),P.none()}().each(function(o){functionb(e,t){return{title:"Insert Template",size:"