$.Redactor.prototype.WoltLabAttachment=function(){"use strict";return{init:function(){require(["EventHandler"],function(t){t.add("com.woltlab.wcf.redactor2","insertAttachment_"+this.$element[0].id,this.WoltLabAttachment._insert.bind(this)),t.add("com.woltlab.wcf.redactor2","deleteAttachment_"+this.$element[0].id,this.WoltLabAttachment._delete.bind(this))}.bind(this))},_insert:function(t){var e=t.attachmentId;this.buffer.set(),t.url?this.insert.html('<img src="'+t.url+'" class="woltlabAttachment" data-attachment-id="'+e+'">'):this.insert.text("[attach="+e+"][/attach]")},_delete:function(t){var e=t.attachmentId,a=this.core.editor()[0];elBySelAll('.woltlabAttachment[data-attachment-id="'+e+'"]',a,function(t){elRemove(t)});var n="[attach="+e+"][/attach]";if(a.textContent.indexOf(n)!==!1){for(var i,c=document.createTreeWalker(a,NodeFilter.SHOW_TEXT,null,!1),r=[];i=c.nextNode();)-1!==i.textContent.indexOf(n)&&r.push(i);for(var l=0,o=r.length;o>l;l++)r[l].textContent=r[l].textContent.replace(new RegExp("\\[attach="+e+"\\]\\[\\/attach\\]","g"),"")}}}};
// WoltLabButton.js
$.Redactor.prototype.WoltLabButton=function(){"use strict";return{init:function(){var t,o,s,e;for(s=0,e=this.opts.woltlab.customButtons.length;e>s;s++)o=this.opts.woltlab.customButtons[s],t=this.button.add(o,""),this.button.addCallback(t,this.WoltLabButton._handleCustomButton);var n;for(s=0,e=this.opts.buttons.length;e>s;s++)if(o=this.opts.buttons[s],"wcfSeparator"!==o){if(!this.opts.woltlab.buttons.hasOwnProperty(o))throw new Error("Missing button definition for '"+o+"'.");if(n=this.opts.woltlab.buttons[o],"subscript"===o||"superscript"===o?(t=this.button.addAfter(this.opts.buttons[s-1],o,""),this.button.setEvent(t,o,{func:"inline.format"})):t=this.button.get(o),this.button.setIcon(t,'<span class="icon icon16 '+n.icon+'"></span>'),!t[0])throw new Error("Missing button element for '"+o+"'.");elAttr(t[0],"title",n.title),t[0].classList.add("jsTooltip")}for(var i,r={},l=[],a=this.core.toolbar()[0];a.childElementCount;)i=a.removeChild(a.children[0]),o=elAttr(i.children[0],"rel"),r[o]=i,l.push(o);var h=!1;for(s=0,e=this.opts.buttons.length;e>s;s++)o=this.opts.buttons[s],"wcfSeparator"!==o?(i=r[o],a.appendChild(i),l.splice(l.indexOf(o),1),h&&(i.classList.add("redactor-toolbar-separator"),h=!1)):h=!0;l.forEach(function(t){a.appendChild(r[t])}),WCF.DOMNodeInsertedHandler.execute()},_handleCustomButton:function(t){var o={cancel:!1};if(WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","bbcode_"+t+"_"+this.$element[0].id,o),o.cancel!==!0){this.buffer.set();var s="["+t+"]"+this.selection.html()+(this.selection.is()?"":this.marker.html())+"[/"+t+"]";this.insert.html(s),this.selection.restore()}}}};
+// WoltLabCode.js
+$.Redactor.prototype.WoltLabCode=function(){"use strict";return{init:function(){this.opts.activeButtonsStates.pre="code",require(["EventHandler"],function(t){t.add("com.woltlab.wcf.redactor2","bbcode_code_"+this.$element[0].id,function(t){t.cancel=!0,this.button.toggle({},"pre","func","block.format");var e=this.selection.block();e&&"PRE"===e.nodeName&&(""===e.textContent&&(e.textContent=""),""===elData(e,"display-value")&&elData(e,"display-value","TODO: source code"))}.bind(this))}.bind(this))}}};
// WoltLabColor.js
$.Redactor.prototype.WoltLabColor=function(){"use strict";return{init:function(){for(var o,t=["000000","800000","8B4513","2F4F4F","008080","000080","4B0082","696969","B22222","A52A2A","DAA520","006400","40E0D0","0000CD","800080","808080","FF0000","FF8C00","FFD700","008000","00FFFF","0000FF","EE82EE","A9A9A9","FFA07A","FFA500","FFFF00","00FF00","AFEEEE","ADD8E6","DDA0DD","D3D3D3","FFF0F5","FAEBD7","FFFFE0","F0FFF0","F0FFFF","F0F8FF","E6E6FA","FFFFFF"],F=this.WoltLabColor.setColor.bind(this),r={removeColor:{title:"remove color",func:this.WoltLabColor.removeColor.bind(this)}},e=0,l=t.length;l>e;e++)o=t[e],r["color_"+o]={title:"#"+o,func:F};var i=this.button.add("woltlabColor","");this.button.addDropdown(i,r),i.data("dropdown").find("a").each(function(o,t){t.className.match(/redactor-dropdown-color_([A-F0-9]{6})/)&&(t.parentNode.classList.add("woltlab-color-"+RegExp.$1),t.parentNode.classList.add("woltlab-color-selection"))})},setColor:function(o){o=o.replace(/^color_/,""),require(["WoltLab/WCF/Ui/Redactor/Format"],function(t){this.selection.save(),t.format(this.$editor[0],"woltlab-color","woltlab-color-"+o),this.selection.restore()}.bind(this))},removeColor:function(){require(["WoltLab/WCF/Ui/Redactor/Format"],function(o){this.selection.save(),o.removeFormat(this.$editor[0],"woltlab-color"),this.selection.restore()}.bind(this))}}};
// WoltLabDropdown.js