// alignment.js
!function(t){t.Redactor.prototype.alignment=function(){return{langs:{en:{align:"Align","align-left":"Align Left","align-center":"Align Center","align-right":"Align Right"}},init:function(){var t=this,e={};e.left={title:t.lang.get("align-left"),func:t.alignment.setLeft},e.center={title:t.lang.get("align-center"),func:t.alignment.setCenter},e.right={title:t.lang.get("align-right"),func:t.alignment.setRight};var n=this.button.add("alignment",this.lang.get("align"));this.button.addDropdown(n,e)},removeAlign:function(){this.block.removeClass("text-center"),this.block.removeClass("text-right")},setLeft:function(){this.buffer.set(),this.alignment.removeAlign()},setCenter:function(){this.buffer.set(),this.alignment.removeAlign(),this.block.addClass("text-center")},setRight:function(){this.buffer.set(),this.alignment.removeAlign(),this.block.addClass("text-right")}}}}(jQuery);
// source.js
-!function(t){t.Redactor.prototype.source=function(){return{init:function(){var e=this.button.addFirst("html","HTML");this.button.addCallback(e,this.source.toggle);var s={width:"100%",margin:"0",background:"#111","box-sizing":"border-box",color:"rgba(255, 255, 255, .8)","font-size":"14px",outline:"none",padding:"16px","line-height":"22px","font-family":'Menlo, Monaco, Consolas, "Courier New", monospace'};this.source.$textarea=t("<textarea />"),this.source.$textarea.css(s).hide(),"textarea"===this.opts.type?this.core.box().append(this.source.$textarea):this.core.box().after(this.source.$textarea),this.core.element().on("destroy.callback.redactor",t.proxy(function(){this.source.$textarea.remove()},this))},toggle:function(){return this.source.$textarea.hasClass("open")?this.source.hide():this.source.show()},setCaretOnShow:function(){this.source.offset=this.offset.get();t(window).scrollTop(),this.core.editor().innerWidth(),this.core.editor().innerHeight();this.source.start=0,this.source.end=0;var e=t("<div/>").append(t.parseHTML(this.core.editor().html(),document,!0)),s=e.find("span.redactor-selection-marker");if(s.length>0){var r=e.html().replace(/&/g,"&");1===s.length?(this.source.start=this.utils.strpos(r,e.find("#selection-marker-1").prop("outerHTML")),this.source.end=this.source.start):2===s.length&&(this.source.start=this.utils.strpos(r,e.find("#selection-marker-1").prop("outerHTML")),this.source.end=this.utils.strpos(r,e.find("#selection-marker-2").prop("outerHTML"))-e.find("#selection-marker-1").prop("outerHTML").toString().length)}},setCaretOnHide:function(t){if(this.source.start=this.source.$textarea.get(0).selectionStart,this.source.end=this.source.$textarea.get(0).selectionEnd,this.source.start>this.source.end&&this.source.end>0){var e=this.source.end,s=this.source.start;this.source.start=e,this.source.end=s}if(this.source.start=this.source.enlargeOffset(t,this.source.start),this.source.end=this.source.enlargeOffset(t,this.source.end),t=t.substr(0,this.source.start)+this.marker.html(1)+t.substr(this.source.start),this.source.end>this.source.start){var r=this.marker.html(1).toString().length;t=t.substr(0,this.source.end+r)+this.marker.html(2)+t.substr(this.source.end+r)}return t},hide:function(){this.source.$textarea.removeClass("open").hide(),this.source.$textarea.off(".redactor-source");var t=this.source.$textarea.val();t=this.paragraphize.load(t),t=this.source.setCaretOnHide(t),this.code.start(t),this.button.enableAll(),this.core.editor().show().focus(),this.selection.restore(),this.code.sync()},show:function(){this.selection.save(),this.source.setCaretOnShow();var e=this.core.editor().innerHeight(),s=this.code.get();console.debug(e),s=s.replace(/\n\n\n/g,"\n"),s=s.replace(/\n\n/g,"\n"),this.core.editor().hide(),this.button.disableAll("html"),this.source.$textarea.val(s).height(e).addClass("open").show(),this.source.$textarea.on("keyup.redactor-source",t.proxy(function(){"textarea"===this.opts.type&&this.core.textarea().val(this.source.$textarea.val())},this)),this.marker.remove(),t(window).scrollTop(scroll),this.source.$textarea[0].setSelectionRange&&this.source.$textarea[0].setSelectionRange(this.source.start,this.source.end),this.source.$textarea[0].scrollTop=0,setTimeout(t.proxy(function(){this.source.$textarea.focus()},this),0)},enlargeOffset:function(t,e){var s=t.length,r=0;if(">"===t[e])r++;else for(var o=e;s>=o&&(r++,">"!==t[o]);o++)if("<"===t[o]||o===s){r=0;break}return e+r}}}}(jQuery);
+!function(t){t.Redactor.prototype.source=function(){return{init:function(){var e=this.button.addFirst("html","HTML");this.button.addCallback(e,this.source.toggle);var s={width:"100%",margin:"0",background:"#111","box-sizing":"border-box",color:"rgba(255, 255, 255, .8)","font-size":"14px",outline:"none",padding:"16px","line-height":"22px","font-family":'Menlo, Monaco, Consolas, "Courier New", monospace'};this.source.$textarea=t("<textarea />"),this.source.$textarea.css(s).hide(),"textarea"===this.opts.type?this.core.box().append(this.source.$textarea):this.core.box().after(this.source.$textarea),this.core.element().on("destroy.callback.redactor",t.proxy(function(){this.source.$textarea.remove()},this))},toggle:function(){return this.source.$textarea.hasClass("open")?this.source.hide():this.source.show()},setCaretOnShow:function(){this.source.offset=this.offset.get();t(window).scrollTop(),this.core.editor().innerWidth(),this.core.editor().innerHeight();this.source.start=0,this.source.end=0;var e=t("<div/>").append(t.parseHTML(this.core.editor().html(),document,!0)),s=e.find("span.redactor-selection-marker");if(s.length>0){var r=e.html().replace(/&/g,"&");1===s.length?(this.source.start=this.utils.strpos(r,e.find("#selection-marker-1").prop("outerHTML")),this.source.end=this.source.start):2===s.length&&(this.source.start=this.utils.strpos(r,e.find("#selection-marker-1").prop("outerHTML")),this.source.end=this.utils.strpos(r,e.find("#selection-marker-2").prop("outerHTML"))-e.find("#selection-marker-1").prop("outerHTML").toString().length)}},setCaretOnHide:function(t){if(this.source.start=this.source.$textarea.get(0).selectionStart,this.source.end=this.source.$textarea.get(0).selectionEnd,this.source.start>this.source.end&&this.source.end>0){var e=this.source.end,s=this.source.start;this.source.start=e,this.source.end=s}if(this.source.start=this.source.enlargeOffset(t,this.source.start),this.source.end=this.source.enlargeOffset(t,this.source.end),t=t.substr(0,this.source.start)+this.marker.html(1)+t.substr(this.source.start),this.source.end>this.source.start){var r=this.marker.html(1).toString().length;t=t.substr(0,this.source.end+r)+this.marker.html(2)+t.substr(this.source.end+r)}return t},hide:function(){this.source.$textarea.removeClass("open").hide(),this.source.$textarea.off(".redactor-source");var t=this.source.$textarea.val();t=this.paragraphize.load(t),t=this.source.setCaretOnHide(t),this.code.start(t),this.button.enableAll(),this.core.editor().show().focus(),this.selection.restore(),this.code.sync()},show:function(){this.selection.save(),this.source.setCaretOnShow();var e=this.core.editor().innerHeight(),s=this.code.get();s=s.replace(/\n\n\n/g,"\n"),s=s.replace(/\n\n/g,"\n"),this.core.editor().hide(),this.button.disableAll("html"),this.source.$textarea.val(s).height(e).addClass("open").show(),this.source.$textarea.on("keyup.redactor-source",t.proxy(function(){"textarea"===this.opts.type&&this.core.textarea().val(this.source.$textarea.val())},this)),this.marker.remove(),t(window).scrollTop(scroll),this.source.$textarea[0].setSelectionRange&&this.source.$textarea[0].setSelectionRange(this.source.start,this.source.end),this.source.$textarea[0].scrollTop=0,setTimeout(t.proxy(function(){this.source.$textarea.focus()},this),0)},enlargeOffset:function(t,e){var s=t.length,r=0;if(">"===t[e])r++;else for(var o=e;s>=o&&(r++,">"!==t[o]);o++)if("<"===t[o]||o===s){r=0;break}return e+r}}}}(jQuery);
// table.js
!function(e){e.Redactor.prototype.table=function(){return{langs:{en:{table:"Table","insert-table":"Insert table","insert-row-above":"Insert row above","insert-row-below":"Insert row below","insert-column-left":"Insert column left","insert-column-right":"Insert column right","add-head":"Add head","delete-head":"Delete head","delete-column":"Delete column","delete-row":"Delete row","delete-table":"Delete table"}},init:function(){var e={};e.insert_table={title:this.lang.get("insert-table"),func:this.table.insert,observe:{element:"table",in:{attr:{class:"redactor-dropdown-link-inactive","aria-disabled":!0}}}},e.insert_row_above={title:this.lang.get("insert-row-above"),func:this.table.addRowAbove,observe:{element:"table",out:{attr:{class:"redactor-dropdown-link-inactive","aria-disabled":!0}}}},e.insert_row_below={title:this.lang.get("insert-row-below"),func:this.table.addRowBelow,observe:{element:"table",out:{attr:{class:"redactor-dropdown-link-inactive","aria-disabled":!0}}}},e.insert_column_left={title:this.lang.get("insert-column-left"),func:this.table.addColumnLeft,observe:{element:"table",out:{attr:{class:"redactor-dropdown-link-inactive","aria-disabled":!0}}}},e.insert_column_right={title:this.lang.get("insert-column-right"),func:this.table.addColumnRight,observe:{element:"table",out:{attr:{class:"redactor-dropdown-link-inactive","aria-disabled":!0}}}},e.add_head={title:this.lang.get("add-head"),func:this.table.addHead,observe:{element:"table",out:{attr:{class:"redactor-dropdown-link-inactive","aria-disabled":!0}}}},e.delete_head={title:this.lang.get("delete-head"),func:this.table.deleteHead,observe:{element:"table",out:{attr:{class:"redactor-dropdown-link-inactive","aria-disabled":!0}}}},e.delete_column={title:this.lang.get("delete-column"),func:this.table.deleteColumn,observe:{element:"table",out:{attr:{class:"redactor-dropdown-link-inactive","aria-disabled":!0}}}},e.delete_row={title:this.lang.get("delete-row"),func:this.table.deleteRow,observe:{element:"table",out:{attr:{class:"redactor-dropdown-link-inactive","aria-disabled":!0}}}},e.delete_table={title:this.lang.get("delete-table"),func:this.table.deleteTable,observe:{element:"table",out:{attr:{class:"redactor-dropdown-link-inactive","aria-disabled":!0}}}};var t=this.button.addBefore("link","table",this.lang.get("table"));this.button.addDropdown(t,e)},insert:function(){if(!this.table.getTable()){this.placeholder.hide();for(var t=2,a=3,i=e("<div>"),r=e("<table />"),l=0;t>l;l++){for(var n=e("<tr>"),s=0;a>s;s++){var o=e("<td>"+this.opts.invisibleSpace+"</td>");0===l&&0===s&&o.append(this.marker.get()),e(n).append(o)}r.append(n)}i.append(r);var d=i.html();this.buffer.set();var h=this.selection.current();0!==e(h).closest("li",this.core.editor().get(0)).length?e(h).closest("ul, ol").first().after(d):(this.air.collapsed(),this.insert.html(d)),this.selection.restore(),this.core.callback("insertedTable",r)}},getTable:function(){var t=e(this.selection.current()).closest("table");return this.utils.isRedactorParent(t)?0===t.length?!1:t:!1},restoreAfterDelete:function(e){this.selection.restore(),e.find("span.redactor-selection-marker").remove()},deleteTable:function(){var e=this.table.getTable();if(e){this.buffer.set();var t=e.next();this.opts.linebreaks||0===t.length?this.caret.after(e):this.caret.start(t),e.remove()}},deleteRow:function(){var t=this.table.getTable();if(t){var a=e(this.selection.current());this.buffer.set();var i=a.closest("tr"),r=i.prev().length?i.prev():i.next();if(r.length){var l=r.children("td, th").first();l.length&&l.prepend(this.marker.get())}i.remove(),this.table.restoreAfterDelete(t)}},deleteColumn:function(){var t=this.table.getTable();if(t){this.buffer.set();var a=e(this.selection.current()),i=a.closest("td, th"),r=i[0].cellIndex;t.find("tr").each(e.proxy(function(t,a){var i=e(a),l=0>r-1?r+1:r-1;0===t&&i.find("td, th").eq(l).prepend(this.marker.get()),i.find("td, th").eq(r).remove()},this)),this.table.restoreAfterDelete(t)}},addHead:function(){var t=this.table.getTable();if(t){if(this.buffer.set(),0!==t.find("thead").length)return void this.table.deleteHead();var a=t.find("tr").first().clone();a.find("td").replaceWith(e.proxy(function(){return e("<th>").html(this.opts.invisibleSpace)},this)),$thead=e("<thead></thead>").append(a),t.prepend($thead)}},deleteHead:function(){var e=this.table.getTable();if(e){var t=e.find("thead");0!==t.length&&(this.buffer.set(),t.remove())}},addRowAbove:function(){this.table.addRow("before")},addRowBelow:function(){this.table.addRow("after")},addColumnLeft:function(){this.table.addColumn("before")},addColumnRight:function(){this.table.addColumn("after")},addRow:function(t){var a=this.table.getTable();if(a){this.buffer.set();var i=e(this.selection.current()),r=i.closest("tr"),l=r.clone();l.find("th").replaceWith(function(){var t=e("<td>");return t[0].attributes=this.attributes,t.append(e(this).contents())}),l.find("td").html(this.opts.invisibleSpace),"after"===t?r.after(l):r.before(l)}},addColumn:function(t){var a=this.table.getTable();if(a){var i=0,r=e(this.selection.current());this.buffer.set();var l=r.closest("tr"),n=r.closest("td, th");l.find("td, th").each(e.proxy(function(t,a){e(a)[0]===n[0]&&(i=t)},this)),a.find("tr").each(e.proxy(function(a,r){var l=e(r).find("td, th").eq(i),n=l.clone();n.html(this.opts.invisibleSpace),"after"===t?l.after(n):l.before(n)},this))}}}}}(jQuery);
// WoltLabAlignment.js