!function(i){"use strict";function e(i,e){var n,t;return function(){var o=this,l=+new Date,c=arguments;n&&l'}).join("");if(o===!0){if(0===c.length){if(i("."+t.o.prefix+"giphy-no-result",n).length>0)return;c=''}n.empty()}n.append(c),i("img",n).on("click",function(){t.restoreRange(),t.execCmd("insertImage",i(this).attr("src"),!1,!0),i("img",n).off(),t.closeModal()})}i.extend(!0,i.trumbowyg,{langs:{en:{giphy:"Insert GIF"},fr:{giphy:"Insérer un GIF"}}});var t='',o="tbwcancel",l={rating:"g",apiKey:null,throttleDelay:300,noResultGifUrl:"https://media.giphy.com/media/2Faz9FbRzmwxY0pZS/giphy.gif"};i.extend(!0,i.trumbowyg,{plugins:{giphy:{init:function(c){c.o.plugins.giphy=i.extend({},l,c.o.plugins.giphy||{}),c.addBtnDef("giphy",{fn:function(){if(null===c.o.plugins.giphy.apiKey)throw new Error("You must set a Giphy API Key");var l="https://api.giphy.com/v1/gifs/search?api_key="+c.o.plugins.giphy.apiKey+"&rating="+c.o.plugins.giphy.rating,a=l.replace("/search","/trending"),r={abort:function(){}},s=c.o.prefix,p='',g='',u='
Powered by'+t+"
",h=p+g+u+'
';c.openModal(null,h,!1).one(o,function(){try{r.abort()}catch(i){}c.closeModal()});var d=i("."+s+"giphy-search"),f=i("."+s+"giphy-close"),y=i("."+s+"giphy-modal"),v=function(){navigator.onLine||i("."+s+"giphy-offline",y).length||(y.empty(),y.append('

You are offline

'))};i.ajax({url:a,dataType:"json",success:function(i){n(i,y,c,!0)},error:v});var m=function(){var e=d.val();if(0!==e.length){try{r.abort()}catch(t){}r=i.ajax({url:l+"&q="+encodeURIComponent(e),dataType:"json",success:function(i){n(i,y,c,!0)},error:v})}},w=e(m,c.o.plugins.giphy.throttleDelay);d.on("input",w),d.focus(),f.one("click",function(){y.trigger(o)})}})}}}})}(jQuery);