!function(){"use strict";functionr(){}functioni(t){returnfunction(){returnt}}functiont(t){returnt}functionn(){returnc}varm,e=tinymce.util.Tools.resolve("tinymce.PluginManager"),l=i(!1),a=i(!(m=null)),c={fold:function(t,n){returnt()},isSome:l,isNone:a,getOr:t,getOrThunk:o,getOrDie:function(t){thrownewError(t||"error: getOrDie called on none.")},getOrNull:i(null),getOrUndefined:i(void0),or:t,orThunk:o,map:n,each:r,bind:n,exists:l,forall:a,filter:function(){returnc},toArray:function(){return[]},toString:i("none()")};functiono(t){returnt()}functiong(t){varn=t;return{get:function(){returnn},set:function(t){n=t}}}functiond(t,n){for(vare=k(t),o=0,r=e.length;o<r;o++){vari=e[o];n(t[i],i)}}functionh(t,n){returnj.call(t,n)}functions(){vart,n,e=(t=r,n=g(O.none()),{clear:function(){o(),n.set(O.none())},isSet:function(){returnn.get().isSome()},get:function(){returnn.get()},set:function(t){o(),n.set(O.some(t))}});functiono(){returnn.get().each(t)}returnC(C({},e),{on:function(t){returne.get().each(t)}})}functionf(t,n){return-1!==t.indexOf(n)}functionv(i,r,t){vara=s(),c=s(),f=i.getParam("emoticons_images_url","https://twemoji.maxcdn.com/v/13.0.1/72x72/","string");i.on("init",function(){_.load(t,r).then(function(t){varn,e,o,l,s,r=(n=i.getParam("emoticons_append",{},"object"),e=function(t){returnC({keywords:[],category:"user"},t)},A(n,function(t,n){return{k:n,v:e(t)}}));o=w(t,r),l={},s=[],d(o,function(t,n){vare,o,r,i,a,c={title:n,keywords:t.keywords,char:(i=(r=t).char).length>=(a="<img").length&&i.substr(0,0+a.length)===a?r.char.replace(/src="([^"]+)"/,function(t,n){return'src="'+f+n+'"'}):r.char,category:h(e=D,o=t.category)?e[o]:o},u=void0!==l[c.category]?l[c.category]:[];l[c.category]=u.concat([c]),s.push(c)}),a.set(l),c.set(s)},function(t){console.log("Failed to load emoticons: "+t),a.set({}),c.set([])})});functione(){returnc.get().getOr([])}functionu(){returna.isSet()&&c.isSet()}return{listCategories:function(){return[P].concat(k(a.get().getOr({})))},hasLoaded:u,waitForLoad:function(){returnu()?x.resolve(!0):newx(function(t,n){vare=15,o=T.setInterval(function(){u()?(T.clearInterval(o),t(!0)):--e<0&&(console.log("Could not load emojis from url: "+r),T.clearInterval(o),n(!1))},100)})},listAll:e,listCategory:function(n){returnn===P?e():a.get().bind(function(t){returnO.from(t[n])}).getOr([])}}}functiony(t,n,e){for(varo,r,i=[],a=n.toLowerCase(),c=e.fold(function(){returnl},function(n){returnfunction(t){returnn<=t}}),u=0;u<t.length&&(0!==n.length&&(o=t[u],r=a,!f(o.title.toLowerCase(),r)&&!function(t){for(varn=0,e=t.length;n<e;n++)if(f(t[n].toLowerCase(),r))return1}(o.keywords))||(i.push({value:t[u].char,text:t[u].title,icon:t[u].char}),!c(i.length)));u++);returni}functionp(o,i){vare,r,t={pattern:"",results:y(i.listAll(),"",O.some(300))},a=g(P),c=(e=function(t){varn,e=(n=t).getData(),o=a.get(),r=y(i.listCategory(o),e[S],o===P?O.some(300):O.none());n.setData({results:r})},r=null,{cancel:u,throttle:function(){for(vart=[],n=0;n<arguments.length;n++)t[n]=arguments[n];u(),r=setTimeout(function(){r=null,e.apply(null,t)},200)}});functionu(){m===r||(clearTimeout(r),r=null)}functionn(){return{title:"Emoticons",size:"normal",body:{type:"tabpanel",tabs:function(t){for(varn=t.length,e=newArray(n),o=0;o<n;o++){varr=t[o];e[o]={title:r,name:r,items:[l,s]}}returne}(i.listCategories())},initialData:t,onTabChange:function(t,n){a.set(n.newTabName),c.throttle(t)},onChange:c.throttle,onAction:function(t,n){vare;"results"===n.name&&(e=n.value,o.insertContent(e),t.close())},buttons:[{type:"cancel",text:"Close",primary:!0}]}}varl={label:"Search",type:"input",name:S},s={type:"collection",name:"results"},f=o.windowManager.open(n());f.focus(S),i.hasLoaded()||(f.block("Loading emoticons..."),i.waitForLoad().then(function(){f.redial(n()),c.throttle(f),f.focus(S),f.unblock()}).catch(function(t){f.redial({title:"Emoticons",body:{type:"panel",items:[{type:"alertbanner",level:"error",icon:"warning",text:"<p>Could not load emoticons</p>"}]},buttons:[{type:"cancel",text:"Close",primary:!0}],initialData:{patte