require(["jquery"],function(e){function l(){h=e(window);f={};m={};k={};e.each([f,m,k],function(a,b){b.add=function(c){c=c.split(" ");for(var d=0,g=c.length;d<g;d++)b[c[d]]=b.ddd(c[d])}});f.ddd=function(a){return"ddd-"+a};f.add("truncated keep");m.ddd=function(a){return"ddd-"+a};k.ddd=function(a){return a+".ddd"};k.add("resize");l=function(){}}if(!(e.dotdotdot&&"3.2.2"<e.dotdotdot.version)){e.dotdotdot=function(a,b){this.$dot=a;this.api="getInstance truncate restore destroy watch unwatch".split(" ");
this.opts=b;(a=this.$dot.data("dotdotdot"))&&a.destroy();this.init();this.truncate();this.opts.watch&&this.watch();return this};e.dotdotdot.version="3.2.2";e.dotdotdot.uniqueId=0;e.dotdotdot.defaults={ellipsis:"\u2026 ",callback:function(a){},truncate:"word",tolerance:0,keep:null,watch:"window",height:null};e.dotdotdot.prototype={init:function(){this.watchInterval=this.watchTimeout=null;this.uniqueId=e.dotdotdot.uniqueId++;this.originalStyle=this.$dot.attr("style")||"";this.originalContent=this._getOriginalContent();
"break-word"!==this.$dot.css("word-wrap")&&this.$dot.css("word-wrap","break-word");"nowrap"===this.$dot.css("white-space")&&this.$dot.css("white-space","normal");null===this.opts.height&&(this.opts.height=this._getMaxHeight());"string"==typeof this.opts.ellipsis&&(this.opts.ellipsis=document.createTextNode(this.opts.ellipsis))},getInstance:function(){return this},truncate:function(){this.$inner=this.$dot.wrapInner("\x3cdiv /\x3e").children().css({display:"block",height:"auto",width:"auto",border:"none",
padding:0,margin:0});this.$inner.empty().append(this.originalContent.clone(!0));this.maxHeight=this._getMaxHeight();var a=!1;this._fits()||(a=!0,this._truncateToNode(this.$inner[0]));this.$dot[a?"addClass":"removeClass"](f.truncated);this.$inner.replaceWith(this.$inner.contents());this.$inner=null;this.opts.callback.call(this.$dot[0],a);return a},restore:function(){this.unwatch();this.$dot.empty().append(this.originalContent).attr("style",this.originalStyle).removeClass(f.truncated)},destroy:function(){this.restore();
this.$dot.data("dotdotdot",null)},watch:function(){var a=this;this.unwatch();var b={};if("window"==this.opts.watch)h.on(k.resize+a.uniqueId,function(c){a.watchTimeout&&clearTimeout(a.watchTimeout);a.watchTimeout=setTimeout(function(){b=a._watchSizes(b,h,"width","height")},100)});else this.watchInterval=setInterval(function(){b=a._watchSizes(b,a.$dot,"innerWidth","innerHeight")},500)},unwatch:function(){h.off(k.resize+this.uniqueId);this.watchInterval&&clearInterval(this.watchInterval);this.watchTimeout&&
clearTimeout(this.watchTimeout)},_api:function(){var a=this,b={};e.each(this.api,function(c){var d=this;b[d]=function(){var g=a[d].apply(a,arguments);return"undefined"==typeof g?b:g}});return b},_truncateToNode:function(a){var b=[],c=[];e(a).contents().each(function(){var n=e(this);if(!n.hasClass(f.keep)){var p=document.createComment("");n.replaceWith(p);c.push(this);b.push(p)}});if(c.length){for(a=0;a<c.length;a++){e(b[a]).replaceWith(c[a]);e(c[a]).append(this.opts.ellipsis);var d=this._fits();e(this.opts.ellipsis,
c[a]).remove();if(!d){if("node"==this.opts.truncate&&1<a){e(c[a-2]).remove();return}break}}for(d=a;d<b.length;d++)e(b[d]).remove();d=c[Math.max(0,Math.min(a,c.length-1))];if(1==d.nodeType){var g=e("\x3c"+d.nodeName+" /\x3e");g.append(this.opts.ellipsis);e(d).replaceWith(g);this._fits()?g.replaceWith(d):(g.remove(),d=c[Math.max(0,a-1)])}1==d.nodeType?this._truncateToNode(d):this._truncateToWord(d)}},_truncateToWord:function(a){var b=this.__getTextContent(a),c=-1!==b.indexOf(" ")?" ":"\u3000";b=b.split(c);
for(var d,g=b.length;0<=g;g--)if(d=b.slice(0,g).join(c),this.__setTextContent(a,this._addEllipsis(d)),this._fits()){"letter"==this.opts.truncate&&(this.__setTextContent(a,b.slice(0,g+1).join(c)),this._truncateToLetter(a));break}},_truncateToLetter:function(a){for(var b=this.__getTextContent(a).split(""),c,d=b.length;0<=d&&(c=b.slice(0,d).join(""),!c.length||(this.__setTextContent(a,this._addEllipsis(c)),!this._fits()));d--);},_fits:function(){return this.$inner.innerHeight()<=this.maxHeight+this.opts.tolerance},
_addEllipsis:function(a){for(var b=" \u3000,;.!?".split("");-1<e.inArray(a.slice(-1),b);)a=a.slice(0,-1);return a+=this.__getTextContent(this.opts.ellipsis)},_getOriginalContent:function(){var a=this;this.$dot.find("script, style").addClass(f.keep);this.opts.keep&&this.$dot.find(this.opts.keep).addClass(f.keep);this.$dot.find("*").not("."+f.keep).add(this.$dot).contents().each(function(){var b=e(this);if(3==this.nodeType){var c=b.prev().is("a")||b.prev().is("span")||b.next().is("a")||b.next().is("span");
""!=e.trim(a.__getTextContent(this))||c||(b.parent().is("table, thead, tbody, tfoot, tr, dl, ul, ol, video")?b.remove():b.prev().is("div, p, table, td, td, dt, dd, li")?b.remove():b.next().is("div, p, table, td, td, dt, dd, li")?b.remove():b.prev().length?b.next().length||b.remove():b.remove())}else 8==this.nodeType&&b.remove()});return this.$dot.contents()},_getMaxHeight:function(){if("number"==typeof this.opts.height)return this.opts.height;for(var a=["maxHeight","height"],b=0,c=0;c<a.length;c++)if(b=
window.getComputedStyle(this.$dot[0])[a[c]],"px"==b.slice(-2)){b=parseFloat(b);break}a=[];switch(this.$dot.css("boxSizing")){case "border-box":a.push("borderTopWidth"),a.push("borderBottomWidth");case "padding-box":a.push("paddingTop"),a.push("paddingBottom")}for(c=0;c<a.length;c++){var d=window.getComputedStyle(this.$dot[0])[a[c]];"px"==d.slice(-2)&&(b-=parseFloat(d))}return Math.max(b,0)},_watchSizes:function(a,b,c,d){return this.$dot.is(":visible")?(b={width:b[c](),height:b[d]()},a.width==b.width&&
a.height==b.height||this.truncate(),b):a},__getTextContent:function(a){for(var b=["nodeValue","textContent","innerText"],c=0;c<b.length;c++)if("string"==typeof a[b[c]])return a[b[c]];return""},__setTextContent:function(a,b){for(var c=["nodeValue","textContent","innerText"],d=0;d<c.length;d++)a[c[d]]=b}};e.fn.dotdotdot=function(a){l();a=e.extend(!0,{},e.dotdotdot.defaults,a);return this.each(function(){e(this).data("dotdotdot",(new e.dotdotdot(e(this),a))._api())})};var f,m,k,h}});
require(["jquery","xwiki-events-bridge"],function(e){var l=function(f,m,k){var h;return function(){var a=this,b=arguments,c=k&&!h;clearTimeout(h);h=setTimeout(function(){h=null;k||f.apply(a,b)},m);c&&f.apply(a,b)}}(function(){e(".ellipsis").each(function(f){e(this).dotdotdot({ellipsis:"\u2026 ",watch:!1,height:null})});e(".ellipsis3").each(function(f){e(this).dotdotdot({ellipsis:"\u2026 ",watch:!1,height:null})})},200);e(window).resize(function(){l()});e(document).on("xwiki:dom:updated hls:new:content-macro:updated",
function(){l()});XWiki.domIsLoaded&&l()||e(document).on("xwiki:dom:loaded",l())});