"),i.append(h)),a("#redactor_link_resource").bind("input",function(b){c.link.url="[[~"+a(this).val()+"]]"}).bind("typeahead:selected",function(a,b,d){c.link.$inputUrl.val("[[~"+b.id+"]]"),c.link.$inputText.val()||c.link.$inputText.val(b.pagetitle),c.link.$inputUrl.removeClass("redactor-input-error").trigger("keyup")}),a("#redactor_link_mailto").bind("input",function(d){c.link.url="mailto:"+a(this).val(),b()}),a("#redactor_link_mailto_subject, #redactor_link_mailto_body, #redactor_link_mailto_cc, #redactor_link_mailto_bcc").bind("input",function(d){c.link.url="mailto:"+a("#redactor_link_mailto").val(),b()}),i.children(".redactor_tab").each(function(b,c){a(this).attr("id","redactor_tab"+(b+1).toString())}),a("#redactor-link-blank").parent().attr("id","redactor-link-open-in-new-tab"),i.append(a('
').append([a("#redactor-link-url-text").prev("label").detach(),a("#redactor-link-url-text").detach(),a("#redactor-link-open-in-new-tab").detach()])),a(".typeahead").each(function(){a(this).typeahead({name:"resources-oss",prefetch:{url:c.opts.assetsUrl+"connector.php?action=resources/prefetch",ttl:c.opts.prefetch_ttl?c.opts.prefetch_ttl:864e5},remote:{url:c.opts.assetsUrl+"connector.php?action=resources/search&query=%TERM%",wildcard:"%TERM%"},template:['
#{{id}}
','
{{& pagetitle}}
','
{{& introtext}}
'].join(""),valueKey:"id",limit:15,engine:Hogan})}),assignTabListeners(this,d),d.find("a:not(.email)").on("click",function(b){a("#redactor-link-open-in-new-tab").show()}),d.find("a.email").on("click",function(b){a("#redactor-link-open-in-new-tab").hide()}),c.opts.advAttrib&&(this.selection.get(),this.link.getData(),c.modmore.inputListeners(),c.$element.on("insertedLinkCallback",function(a){c.selection.get(),c.link.getData(),c.modmore.insertLink(c.link.$node)}),c.$element.on("modalOpenedCallback",function(a){c.link.buttonInsert.on("click",function(a){c.modmore.insertLink(c.link.$node)})}))}}}}(jQuery),function(a){"use strict";function b(a,c){return new b.prototype.init(a,c)}Function.prototype.bind||(Function.prototype.bind=function(a){var b=this;return function(){return b.apply(a)}});var c=0;a.fn.redactor=function(c){var d=[],e=Array.prototype.slice.call(arguments,1);return"string"==typeof c?this.each(function(){var b,f=a.data(this,"redactor");if("-1"!=c.search(/\./)?(b=c.split("."),"undefined"!=typeof f[b[0]]&&(b=f[b[0]][b[1]])):b=f[c],"undefined"!=typeof f&&a.isFunction(b)){var g=b.apply(f,e);void 0!==g&&g!==f&&d.push(g)}else a.error('No such method "'+c+'" for Redactor')}):this.each(function(){a.data(this,"redactor",{}),a.data(this,"redactor",b(this,c))}),0===d.length?this:1===d.length?d[0]:d},a.Redactor=b,a.Redactor.VERSION="10.2.3",a.Redactor.modules=["alignment","autosave","block","buffer","build","button","caret","clean","code","core","dropdown","file","focus","image","indent","inline","insert","keydown","keyup","lang","line","link","linkify","list","modal","observe","paragraphize","paste","placeholder","progress","selection","shortcuts","tabifier","tidy","toolbar","upload","utils"],a.Redactor.opts={lang:"en",direction:"ltr",plugins:!1,focus:!1,focusEnd:!1,placeholder:!1,visual:!0,tabindex:!1,minHeight:!1,maxHeight:!1,linebreaks:!1,replaceDivs:!0,paragraphize:!0,cleanStyleOnEnter:!1,enterKey:!0,cleanOnPaste:!0,cleanSpaces:!0,pastePlainText:!1,autosave:!1,autosaveName:!1,autosaveInterval:60,autosaveOnChange:!1,autosaveFields:!1,linkTooltip:!0,linkProtocol:"http",linkNofollow:!1,linkSize:50,imageEditable:!0,imageLink:!0,imagePosition:!0,imageFloatMargin:"10px",imageResizable:!0,imageUpload:null,imageUploadParam:"file",uploadImageField:!1,dragImageUpload:!0,fileUpload:null,fileUploadParam:"file",dragFileUpload:!0,s3:!1,convertLinks:!0,convertUrlLinks:!0,convertImageLinks:!0,convertVideoLinks:!0,preSpaces:4,tabAsSpaces:!1,tabKey:!0,scrollTarget:!1,toolbar:!0,toolbarFixed:!0,toolbarFixedTarget:document,toolbarFixedTopOffset:0,toolbarExternal:!1,toolbarOverflow:!1,source:!0,buttons:["html","formatting","bold","italic","deleted","unorderedlist","orderedlist","outdent","indent","image","file","link","alignment","horizontalrule"],buttonsHide:[],buttonsHideOnMobile:[],formatting:["p","blockquote","pre","h1","h2","h3","h4","h5","h6"],formattingAdd:!1,tabifier:!0,deniedTags:["script","style"],allowedTags:!1,paragraphizeBlocks:["table","div","pre","form","ul","ol","h1","h2","h3","h4","h5","h6","dl","blockquote","figcaption","address","section","header","footer","aside","article","object","style","script","iframe","select","input","textarea","button","option","map","area","math","hr","fieldset","legend","hgroup","nav","figure","details","menu","summary","p"],removeComments:!1,replaceTags:[["strike","del"],["b","strong"]],replaceStyles:[["font-weight:\\s?bold","strong"],["font-style:\\s?italic","em"],["text-decoration:\\s?underline","u"],["text-decoration:\\s?line-through","del"]],removeDataAttr:!1,removeAttr:!1,allowedAttr:!1,removeWithoutAttr:["span"],removeEmpty:["p"],activeButtons:["deleted","italic","bold","underline","unorderedlist","orderedlist","alignleft","aligncenter","alignright","justify"],activeButtonsStates:{b:"bold",strong:"bold",i:"italic",em:"italic",del:"deleted",strike:"deleted",ul:"unorderedlist",ol:"orderedlist",u:"underline"},shortcuts:{"ctrl+shift+m, meta+shift+m":{func:"inline.removeFormat"},"ctrl+b, meta+b":{func:"inline.format",params:["bold"]},"ctrl+i, meta+i":{func:"inline.format",params:["italic"]},"ctrl+h, meta+h":{func:"inline.format",params:["superscript"]},"ctrl+l, meta+l":{func:"inline.format",params:["subscript"]},"ctrl+k, meta+k":{func:"link.show"},"ctrl+shift+7":{func:"list.toggle",params:["orderedlist"]},"ctrl+shift+8":{func:"list.toggle",params:["unorderedlist"]}},shortcutsAdd:!1,buffer:[],rebuffer:[],emptyHtml:"
",invisibleSpace:"",imageTypes:["image/png","image/jpeg","image/gif"],indentValue:20,verifiedTags:["a","img","b","strong","sub","sup","i","em","u","small","strike","del","cite","ul","ol","li"],inlineTags:["strong","b","u","em","i","code","del","ins","samp","kbd","sup","sub","mark","var","cite","small"],alignmentTags:["P","H1","H2","H3","H4","H5","H6","DL","DT","DD","DIV","TD","BLOCKQUOTE","OUTPUT","FIGCAPTION","ADDRESS","SECTION","HEADER","FOOTER","ASIDE","ARTICLE"],blockLevelElements:["PRE","UL","OL","LI"],highContrast:!1,observe:{dropdowns:[]},langs:{en:{html:"HTML",video:"Insert Video",image:"Insert Image",table:"Table",link:"Link",link_insert:"Insert link",link_edit:"Edit link",unlink:"Unlink",formatting:"Formatting",paragraph:"Normal text",quote:"Quote",code:"Code",header1:"Header 1",header2:"Header 2",header3:"Header 3",header4:"Header 4",header5:"Header 5",bold:"Bold",italic:"Italic",fontcolor:"Font Color",backcolor:"Back Color",unorderedlist:"Unordered List",orderedlist:"Ordered List",outdent:"Outdent",indent:"Indent",cancel:"Cancel",insert:"Insert",save:"Save",_delete:"Delete",insert_table:"Insert Table",insert_row_above:"Add Row Above",insert_row_below:"Add Row Below",insert_column_left:"Add Column Left",insert_column_right:"Add Column Right",delete_column:"Delete Column",delete_row:"Delete Row",delete_table:"Delete Table",rows:"Rows",columns:"Columns",add_head:"Add Head",delete_head:"Delete Head",title:"Title",image_position:"Position",none:"None",left:"Left",right:"Right",center:"Center",image_web_link:"Image Web Link",text:"Text",mailto:"Email",web:"URL",video_html_code:"Video Embed Code or Youtube/Vimeo Link",file:"Insert File",upload:"Upload",download:"Download",choose:"Choose",or_choose:"Or choose",drop_file_here:"Drop file here",align_left:"Align text to the left",align_center:"Center text",align_right:"Align text to the right",align_justify:"Justify text",horizontalrule:"Insert Horizontal Rule",deleted:"Deleted",anchor:"Anchor",link_new_tab:"Open link in new tab",underline:"Underline",alignment:"Alignment",filename:"Name (optional)",edit:"Edit",upload_label:"Drop file here or "}},linkify:{regexps:{youtube:/https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com\S*[^\w\-\s])([\w\-]{11})(?=[^\w\-]|$)(?![?=&+%\w.\-]*(?:['"][^<>]*>|<\/a>))[?=&+%\w.-]*/gi,vimeo:/https?:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/,image:/((https?|www)[^\s]+\.)(jpe?g|png|gif)(\?[^\s-]+)?/gi,url:/(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/gi}},codemirror:!1},b.fn=a.Redactor.prototype={keyCode:{BACKSPACE:8,DELETE:46,UP:38,DOWN:40,ENTER:13,SPACE:32,ESC:27,TAB:9,CTRL:17,META:91,SHIFT:16,ALT:18,RIGHT:39,LEFT:37,LEFT_WIN:91},init:function(b,d){if(this.$element=a(b),this.uuid=c++,this.rtePaste=!1,this.$pasteBox=!1,this.loadOptions(d),this.loadModules(),this.formatting={},a.merge(this.opts.blockLevelElements,this.opts.alignmentTags),this.reIsBlock=new RegExp("^("+this.opts.blockLevelElements.join("|")+")$","i"),this.tidy.setupAllowed(),this.opts.deniedTags!==!1)for(var e=["html","head","link","body","meta","applet"],f=0;f
c;c++)this.bindModuleMethods(a.Redactor.modules[c])},bindModuleMethods:function(a){if("undefined"!=typeof this[a]){this[a]=this[a]();for(var b=this.getModuleMethods(this[a]),c=b.length,d=0;c>d;d++)this[a][b[d]]=this[a][b[d]].bind(this)}},alignment:function(){return{left:function(){this.alignment.set("")},right:function(){this.alignment.set("right")},center:function(){this.alignment.set("center")},justify:function(){this.alignment.set("justify")},set:function(a){this.utils.browser("msie")||this.$editor.focus(),this.buffer.set(),this.selection.save(),this.alignment.blocks=this.selection.getBlocks(),this.alignment.type=a,this.alignment.isLinebreaksOrNoBlocks()?this.alignment.setText():this.alignment.setBlocks(),this.selection.restore(),this.code.sync()},setText:function(){var b=this.selection.wrap("div");a(b).attr("data-tagblock","redactor").css("text-align",this.alignment.type)},setBlocks:function(){a.each(this.alignment.blocks,a.proxy(function(a,b){var c=this.utils.getAlignmentElement(b);c&&(this.alignment.isNeedReplaceElement(c)?this.alignment.replaceElement(c):this.alignment.alignElement(c))},this))},isLinebreaksOrNoBlocks:function(){return this.opts.linebreaks&&this.alignment.blocks[0]===!1},isNeedReplaceElement:function(a){return""===this.alignment.type&&"undefined"!=typeof a.data("tagblock")},replaceElement:function(a){a.replaceWith(a.html())},alignElement:function(a){a.css("text-align",this.alignment.type),this.utils.removeEmptyAttr(a,"style")}}},autosave:function(){return{html:!1,enable:function(){this.opts.autosave&&(this.autosave.name=this.opts.autosaveName?this.opts.autosaveName:this.$textarea.attr("name"),this.opts.autosaveOnChange||(this.autosaveInterval=setInterval(this.autosave.load,1e3*this.opts.autosaveInterval)))},onChange:function(){this.opts.autosaveOnChange&&this.autosave.load()},load:function(){if(this.opts.autosave&&(this.autosave.source=this.code.get(),this.autosave.html!==this.autosave.source)){var b={};b.name=this.autosave.name,b[this.autosave.name]=this.autosave.source,b=this.autosave.getHiddenFields(b);var c=a.ajax({url:this.opts.autosave,type:"post",data:b});c.done(this.autosave.success)}},getHiddenFields:function(b){return this.opts.autosaveFields===!1||"object"!=typeof this.opts.autosaveFields?b:(a.each(this.opts.autosaveFields,a.proxy(function(c,d){null!==d&&0===d.toString().indexOf("#")&&(d=a(d).val()),b[c]=d},this)),b)},success:function(b){var c;try{c=a.parseJSON(b)}catch(d){c=b}var e="undefined"==typeof c.error?"autosave":"autosaveError";this.core.setCallback(e,this.autosave.name,c),this.autosave.html=this.autosave.source},disable:function(){clearInterval(this.autosaveInterval)}}},block:function(){return{formatting:function(a){this.block.clearStyle=!1;var b,c;"undefined"!=typeof this.formatting[a].data?b="data":"undefined"!=typeof this.formatting[a].attr?b="attr":"undefined"!=typeof this.formatting[a]["class"]&&(b="class"),"undefined"!=typeof this.formatting[a].clear&&(this.block.clearStyle=!0),b&&(c=this.formatting[a][b]),this.block.format(this.formatting[a].tag,b,c)},format:function(b,c,d){"quote"==b&&(b="blockquote");var e=["p","pre","blockquote","h1","h2","h3","h4","h5","h6"];if(-1!=a.inArray(b,e)){this.block.isRemoveInline="pre"==b||-1!=b.search(/h[1-6]/i),this.utils.browser("msie")||this.$editor.focus();var f=a.trim(this.$editor.html());if(this.block.isEmpty=this.utils.isEmpty(f),this.utils.browser("mozilla")&&!this.focus.isFocused()&&this.block.isEmpty){var g;this.opts.linebreaks||(g=this.$editor.children().first(),this.caret.setEnd(g))}this.block.blocks=this.selection.getBlocks(),this.block.blocksSize=this.block.blocks.length,this.block.type=c,this.block.value=d,this.buffer.set(),this.selection.save(),this.block.set(b),this.selection.restore(),this.code.sync(),this.observe.load()}},set:function(a){this.selection.get(),this.block.containerTag=this.range.commonAncestorContainer.tagName,this.range.collapsed?this.block.setCollapsed(a):this.block.setMultiple(a)},setCollapsed:function(b){if(this.opts.linebreaks&&this.block.isEmpty&&"p"!=b){var c=document.createElement(b);return this.$editor.html(c),void this.caret.setEnd(c)}var d=this.block.blocks[0];if(d!==!1){if("LI"==d.tagName){if("blockquote"!=b)return;return void this.block.formatListToBlockquote()}var e="TD"==this.block.containerTag||"TH"==this.block.containerTag;if(e&&!this.opts.linebreaks)document.execCommand("formatblock",!1,"<"+b+">"),d=this.selection.getBlock(),this.block.toggle(a(d));else if(d.tagName.toLowerCase()!=b)if(this.opts.linebreaks&&"p"==b)a(d).append("
"),this.utils.replaceWithContents(d);else{var f=this.utils.replaceToTag(d,b);this.block.toggle(f),"p"!=b&&"blockquote"!=b&&f.find("img").remove(),this.block.isRemoveInline&&this.utils.removeInlineTags(f),("p"==b||this.block.headTag)&&f.find("p").contents().unwrap(),this.block.formatTableWrapping(f)}else if("blockquote"==b&&d.tagName.toLowerCase()==b)if(this.opts.linebreaks)a(d).append("
"),this.utils.replaceWithContents(d);else{var g=this.utils.replaceToTag(d,"p");this.block.toggle(g)}else d.tagName.toLowerCase()==b&&this.block.toggle(a(d));"undefined"==typeof this.block.type&&"undefined"==typeof this.block.value&&a(d).removeAttr("class").removeAttr("style")}},setMultiple:function(b){var c=this.block.blocks[0],d="TD"==this.block.containerTag||"TH"==this.block.containerTag;if(c!==!1&&1===this.block.blocksSize)if(c.tagName.toLowerCase()==b&&"blockquote"==b)if(this.opts.linebreaks)a(c).append("
"),this.utils.replaceWithContents(c);else{var e=this.utils.replaceToTag(c,"p");this.block.toggle(e)}else if("LI"==c.tagName){if("blockquote"!=b)return;this.block.formatListToBlockquote()}else if("BLOCKQUOTE"==this.block.containerTag)this.block.formatBlockquote(b);else if(this.opts.linebreaks&&(d||this.range.commonAncestorContainer!=c))this.block.formatWrap(b);else if(this.opts.linebreaks&&"p"==b)a(c).prepend("
").append("
"),this.utils.replaceWithContents(c);else if("TD"===c.tagName)this.block.formatWrap(b);else{var f=this.utils.replaceToTag(c,b);this.block.toggle(f),this.block.isRemoveInline&&this.utils.removeInlineTags(f),("p"==b||this.block.headTag)&&f.find("p").contents().unwrap()}else if(this.opts.linebreaks||"p"!=b){if("blockquote"==b){for(var g=0,h=0;h").append("
"),d=this.utils.replaceWithContents(c)):d=this.utils.replaceToTag(c,"p"),d&&"undefined"==typeof this.block.type&&"undefined"==typeof this.block.value&&d.removeAttr("class").removeAttr("style")},this))}this.block.formatWrap(b)}else{var i=0,j=!1;"class"==this.block.type&&(j="toggle",i=a(this.block.blocks).filter("."+this.block.value).length,this.block.blocksSize==i?j="toggle":this.block.blocksSize>i?j="set":0===i&&(j="set"));var k=["ul","ol","li","td","th","dl","dt","dd"];a.each(this.block.blocks,a.proxy(function(c,d){if(-1==a.inArray(d.tagName.toLowerCase(),k)){var e=this.utils.replaceToTag(d,b);j?"toggle"==j?this.block.toggle(e):"remove"==j?this.block.remove(e):"set"==j&&this.block.setForce(e):this.block.toggle(e),"p"!=b&&"blockquote"!=b&&e.find("img").remove(),this.block.isRemoveInline&&this.utils.removeInlineTags(e),("p"==b||this.block.headTag)&&e.find("p").contents().unwrap(),"undefined"==typeof this.block.type&&"undefined"==typeof this.block.value&&e.removeAttr("class").removeAttr("style")}},this))}},setForce:function(a){return this.block.clearStyle&&a.removeAttr("class").removeAttr("style"),"class"==this.block.type?void a.addClass(this.block.value):"attr"==this.block.type||"data"==this.block.type?void a.attr(this.block.value.name,this.block.value.value):void 0},toggle:function(a){return this.block.clearStyle&&a.removeAttr("class").removeAttr("style"),"class"==this.block.type?void a.toggleClass(this.block.value):"attr"==this.block.type||"data"==this.block.type?void(a.attr(this.block.value.name)==this.block.value.value?a.removeAttr(this.block.value.name):a.attr(this.block.value.name,this.block.value.value)):void a.removeAttr("style class")},remove:function(a){a.removeClass(this.block.value)},formatListToBlockquote:function(){var b=a(this.block.blocks[0]).closest("ul, ol",this.$editor[0]);a(b).find("ul, ol").contents().unwrap(),a(b).find("li").append(a("
")).contents().unwrap();var c=this.utils.replaceToTag(b,"blockquote");this.block.toggle(c)},formatBlockquote:function(b){document.execCommand("outdent"),document.execCommand("formatblock",!1,b),this.clean.clearUnverified(),this.$editor.find("p:empty").remove();var c=this.selection.getBlock();"p"!=b&&a(c).find("img").remove(),this.opts.linebreaks||this.block.toggle(a(c)),this.$editor.find("ul, ol, tr, blockquote, p").each(a.proxy(this.utils.removeEmpty,this)),this.opts.linebreaks&&"p"==b&&this.utils.replaceWithContents(c)},formatWrap:function(b){if("UL"==this.block.containerTag||"OL"==this.block.containerTag){if("blockquote"!=b)return;this.block.formatListToBlockquote()}var c=this.selection.wrap(b);if(c!==!1){var d=a(c);this.block.formatTableWrapping(d);var e=d.find(this.opts.blockLevelElements.join(",")+", td, table, thead, tbody, tfoot, th, tr");if(e.contents().unwrap(),"p"!=b&&"blockquote"!=b&&d.find("img").remove(),a.each(this.block.blocks,a.proxy(this.utils.removeEmpty,this)),d.append(this.selection.getMarker(2)),this.opts.linebreaks||this.block.toggle(d),this.$editor.find("ul, ol, tr, blockquote, p").each(a.proxy(this.utils.removeEmpty,this)),d.find("blockquote:empty").remove(),this.block.isRemoveInline&&this.utils.removeInlineTags(d),this.opts.linebreaks&&"p"==b&&this.utils.replaceWithContents(d),this.opts.linebreaks){var f=d.next().next();0!=f.size()&&"BR"===f[0].tagName&&f.remove()}}},formatTableWrapping:function(a){0!==a.closest("table",this.$editor[0]).length&&(0===a.closest("tr",this.$editor[0]).length&&a.wrap(""),0===a.closest("td",this.$editor[0]).length&&0===a.closest("th").length&&a.wrap(""))},removeData:function(b,c){var d=this.selection.getBlocks();a(d).removeAttr("data-"+b),this.code.sync()},setData:function(b,c){var d=this.selection.getBlocks();a(d).attr("data-"+b,c),this.code.sync()},toggleData:function(b,c){var d=this.selection.getBlocks();a.each(d,function(){a(this).attr("data-"+b)?a(this).removeAttr("data-"+b):a(this).attr("data-"+b,c)})},removeAttr:function(b,c){var d=this.selection.getBlocks();a(d).removeAttr(b),this.code.sync()},setAttr:function(b,c){var d=this.selection.getBlocks();a(d).attr(b,c),this.code.sync()},toggleAttr:function(b,c){var d=this.selection.getBlocks();a.each(d,function(){a(this).attr(name)?a(this).removeAttr(name):a(this).attr(name,c)})},removeClass:function(b){var c=this.selection.getBlocks();a(c).removeClass(b),this.utils.removeEmptyAttr(c,"class"),this.code.sync()},setClass:function(b){var c=this.selection.getBlocks();a(c).addClass(b),this.code.sync()},toggleClass:function(b){var c=this.selection.getBlocks();a(c).toggleClass(b),this.code.sync()}}},buffer:function(){return{set:function(a){"undefined"==typeof a||"undo"==a?this.buffer.setUndo():this.buffer.setRedo()},setUndo:function(){this.selection.save(),this.opts.buffer.push(this.$editor.html()),this.selection.restore()},setRedo:function(){this.selection.save(),this.opts.rebuffer.push(this.$editor.html()),this.selection.restore()},getUndo:function(){this.$editor.html(this.opts.buffer.pop())},getRedo:function(){this.$editor.html(this.opts.rebuffer.pop())},add:function(){this.opts.buffer.push(this.$editor.html())},undo:function(){0!==this.opts.buffer.length&&(this.buffer.set("redo"),this.buffer.getUndo(),this.selection.restore(),setTimeout(a.proxy(this.observe.load,this),50))},redo:function(){0!==this.opts.rebuffer.length&&(this.buffer.set("undo"),this.buffer.getRedo(),this.selection.restore(),setTimeout(a.proxy(this.observe.load,this),50))}}},build:function(){return{run:function(){this.build.createContainerBox(),this.build.loadContent(),this.build.loadEditor(),this.build.enableEditor(),this.build.setCodeAndCall()},isTextarea:function(){return"TEXTAREA"===this.$element[0].tagName},createContainerBox:function(){this.$box=a('')},createTextarea:function(){this.$textarea=a("").attr("name",this.build.getTextareaName())},getTextareaName:function(){return"undefined"==typeof name?"content-"+this.uuid:this.$element.attr("id")},loadContent:function(){var b=this.build.isTextarea()?"val":"html";this.content=a.trim(this.$element[b]())},enableEditor:function(){this.$editor.attr({contenteditable:!0,dir:this.opts.direction})},loadEditor:function(){var a=this.build.isTextarea()?"fromTextarea":"fromElement";this.build[a]()},fromTextarea:function(){this.$editor=a(""),this.$textarea=this.$element,this.$box.insertAfter(this.$element).append(this.$editor).append(this.$element),this.$editor.addClass("redactor-editor"),this.$element.hide()},fromElement:function(){this.$editor=this.$element,this.build.createTextarea(),this.$box.insertAfter(this.$editor).append(this.$editor).append(this.$textarea),this.$editor.addClass("redactor-editor"),this.$textarea.hide()},setCodeAndCall:function(){this.code.set(this.content),this.build.setOptions(),this.build.callEditor(),this.opts.visual||setTimeout(a.proxy(this.code.showCode,this),200)},callEditor:function(){this.build.disableMozillaEditing(),this.build.disableIeLinks(),this.build.setEvents(),this.build.setHelpers(),this.opts.toolbar&&(this.opts.toolbar=this.toolbar.init(),this.toolbar.build()),this.modal.loadTemplates(),this.build.plugins(),setTimeout(a.proxy(this.observe.load,this),4),this.core.setCallback("init")},setOptions:function(){a(this.$textarea).attr("dir",this.opts.direction),this.opts.linebreaks&&this.$editor.addClass("redactor-linebreaks"),this.opts.tabindex&&this.$editor.attr("tabindex",this.opts.tabindex),this.opts.minHeight&&this.$editor.css("minHeight",this.opts.minHeight),this.opts.maxHeight&&this.$editor.css("maxHeight",this.opts.maxHeight)},setEventDropUpload:function(a){if(a.preventDefault(),this.opts.dragImageUpload&&this.opts.dragFileUpload){var b=a.dataTransfer.files;this.upload.directUpload(b[0],a)}},setEventDrop:function(a){this.code.sync(),setTimeout(this.clean.clearUnverified,1),this.core.setCallback("drop",a)},setEvents:function(){this.$editor.on("drop.redactor",a.proxy(function(a){return a=a.originalEvent||a,void 0!==window.FormData&&a.dataTransfer?0===a.dataTransfer.files.length?this.build.setEventDrop(a):(this.build.setEventDropUpload(a),setTimeout(this.clean.clearUnverified,1),void this.core.setCallback("drop",a)):!0},this)),this.$editor.on("click.redactor",a.proxy(function(a){var b=this.core.getEvent(),c="click"==b||"arrow"==b?!1:"click";this.core.addEvent(c),this.utils.disableSelectAll(),this.core.setCallback("click",a)},this)),this.$editor.on("paste.redactor",a.proxy(this.paste.init,this)),this.$editor.on("cut.redactor",a.proxy(this.code.sync,this)),this.$editor.on("keydown.redactor",a.proxy(this.keydown.init,this)),this.$editor.on("keyup.redactor",a.proxy(this.keyup.init,this)),a.isFunction(this.opts.codeKeydownCallback)&&this.$textarea.on("keydown.redactor-textarea",a.proxy(this.opts.codeKeydownCallback,this)),a.isFunction(this.opts.codeKeyupCallback)&&this.$textarea.on("keyup.redactor-textarea",a.proxy(this.opts.codeKeyupCallback,this)),this.$editor.on("focus.redactor",a.proxy(function(b){a.isFunction(this.opts.focusCallback)&&this.core.setCallback("focus",b),this.selection.getCurrent()===!1&&(this.selection.get(),this.range.setStart(this.$editor[0],0),this.range.setEnd(this.$editor[0],0),this.selection.addRange())},this)),a(document).on("mousedown.redactor-blur."+this.uuid,a.proxy(function(b){this.start||this.rtePaste||0===a(b.target).closest(".redactor-editor, .redactor-toolbar, .redactor-dropdown").size()&&(this.utils.disableSelectAll(),a.isFunction(this.opts.blurCallback)&&this.core.setCallback("blur",b))},this))},setHelpers:function(){this.linkify.isEnabled()&&this.linkify.format(),this.placeholder.enable(),this.opts.focus&&setTimeout(this.focus.setStart,100),this.opts.focusEnd&&setTimeout(this.focus.setEnd,100)},plugins:function(){this.opts.plugins&&a.each(this.opts.plugins,a.proxy(function(c,d){var e="undefined"!=typeof RedactorPlugins&&"undefined"!=typeof RedactorPlugins[d]?RedactorPlugins:b.fn;if(a.isFunction(e[d])){this[d]=e[d]();for(var f=this.getModuleMethods(this[d]),g=f.length,h=0;g>h;h++)this[d][f[h]]=this[d][f[h]].bind(this);a.isFunction(this[d].init)&&this[d].init()}},this))},disableMozillaEditing:function(){if(this.utils.browser("mozilla"))try{document.execCommand("enableObjectResizing",!1,!1),document.execCommand("enableInlineTableEditing",!1,!1)}catch(a){}},disableIeLinks:function(){this.utils.browser("msie")&&document.execCommand("AutoUrlDetect",!1,!1)}}},button:function(){return{build:function(b,c){var d=a('').attr({role:"button","aria-label":c.title,tabindex:"-1"});if((c.func||c.command||c.dropdown)&&this.button.setEvent(d,b,c),c.dropdown){d.addClass("redactor-toolbar-link-dropdown").attr("aria-haspopup",!0);var e=a('');d.data("dropdown",e),this.dropdown.build(b,e,c.dropdown)}return this.utils.isDesktop()&&this.button.createTooltip(d,b,c.title),d},setEvent:function(b,c,d){b.on("touchstart click",a.proxy(function(a){if(b.hasClass("redactor-button-disabled"))return!1;var e="func",f=d.func;d.command?(e="command",f=d.command):d.dropdown&&(e="dropdown",f=!1),this.button.onClick(a,c,e,f)},this))},createTooltip:function(b,c,d){var e=a(" ").addClass("redactor-toolbar-tooltip redactor-toolbar-tooltip-"+this.uuid+" redactor-toolbar-tooltip-"+c).hide().html(d);e.appendTo("body"),b.on("mouseover",function(){if(!a(this).hasClass("redactor-button-disabled")){var c=b.offset();e.show(),e.css({top:c.top+b.innerHeight()+"px",left:c.left+b.innerWidth()/2-e.innerWidth()/2+"px"})}}),b.on("mouseout",function(){e.hide()})},onClick:function(b,c,d,e){this.button.caretOffset=this.caret.getOffset(),b.preventDefault(),a(document).find(".redactor-toolbar-tooltip").hide(),this.utils.browser("msie")&&(b.returnValue=!1),"command"==d?this.inline.format(e):"dropdown"==d?this.dropdown.show(b,c):this.button.onClickCallback(b,e,c)},onClickCallback:function(b,c,d){var e;if(a.isFunction(c))c.call(this,d);else if("-1"!=c.search(/\./)){if(e=c.split("."),"undefined"==typeof this[e[0]])return;this[e[0]][e[1]](d)}else this[c](d);this.observe.buttons(b,d)},get:function(a){return this.$toolbar.find("a.re-"+a)},setActive:function(a){this.button.get(a).addClass("redactor-act")},setInactive:function(a){this.button.get(a).removeClass("redactor-act")},setInactiveAll:function(a){"undefined"==typeof a?this.$toolbar.find("a.re-icon").removeClass("redactor-act"):this.$toolbar.find("a.re-icon").not(".re-"+a).removeClass("redactor-act")},setActiveInVisual:function(){this.$toolbar.find("a.re-icon").not("a.re-html, a.re-fullscreen").removeClass("redactor-button-disabled")},setInactiveInCode:function(){this.$toolbar.find("a.re-icon").not("a.re-html, a.re-fullscreen").addClass("redactor-button-disabled")},changeIcon:function(a,b){this.button.get(a).addClass("re-"+b)},removeIcon:function(a,b){this.button.get(a).removeClass("re-"+b)},setAwesome:function(a,b){var c=this.button.get(a);c.removeClass("redactor-btn-image").addClass("fa-redactor-btn"),c.html('')},addCallback:function(b,c){if("buffer"!=b){var d="dropdown"==c?"dropdown":"func",e=b.attr("rel");b.on("touchstart click",a.proxy(function(a){return b.hasClass("redactor-button-disabled")?!1:void this.button.onClick(a,e,d,c)},this))}},addDropdown:function(b,c){b.addClass("redactor-toolbar-link-dropdown").attr("aria-haspopup",!0);var d=b.attr("rel");this.button.addCallback(b,"dropdown");var e=a('');return b.data("dropdown",e),c&&this.dropdown.build(d,e,c),e},add:function(b,c){if(this.opts.toolbar){if(this.button.isMobileUndoRedo(b))return"buffer";var d=this.button.build(b,{title:c});return d.addClass("redactor-btn-image"),this.$toolbar.append(a(" ").append(d)),d}},addFirst:function(b,c){if(this.opts.toolbar){if(this.button.isMobileUndoRedo(b))return"buffer";var d=this.button.build(b,{title:c});return d.addClass("redactor-btn-image"),this.$toolbar.prepend(a("").append(d)),d}},addAfter:function(b,c,d){if(this.opts.toolbar){if(this.button.isMobileUndoRedo(c))return"buffer";var e=this.button.build(c,{title:d});e.addClass("redactor-btn-image");var f=this.button.get(b);return 0!==f.length?f.parent().after(a("").append(e)):this.$toolbar.append(a("").append(e)),e}},addBefore:function(b,c,d){if(this.opts.toolbar){if(this.button.isMobileUndoRedo(c))return"buffer";var e=this.button.build(c,{title:d});e.addClass("redactor-btn-image");var f=this.button.get(b);return 0!==f.length?f.parent().before(a("").append(e)):this.$toolbar.append(a("").append(e)),e}},remove:function(a){this.button.get(a).remove()},isMobileUndoRedo:function(a){return("undo"==a||"redo"==a)&&!this.utils.isDesktop()}}},caret:function(){return{setStart:function(b){if(this.utils.isBlock(b))this.caret.set(b,0,b,0);else{var c=this.utils.createSpaceElement();a(b).prepend(c),this.caret.setEnd(c)}},setEnd:function(a){return a=a[0]||a,1==a.lastChild.nodeType?this.caret.setAfter(a.lastChild):void this.caret.set(a,1,a,1)},set:function(b,c,d,e){if(b=b[0]||b,d=d[0]||d,this.utils.isBlockTag(b.tagName)&&""===b.innerHTML&&(b.innerHTML=this.opts.invisibleSpace),"BR"==b.tagName&&this.opts.linebreaks===!1){
var f=a(this.opts.emptyHtml)[0];a(b).replaceWith(f),b=f,d=b}this.selection.get();try{this.range.setStart(b,c),this.range.setEnd(d,e)}catch(g){}this.selection.addRange()},setAfter:function(b){try{var c=a(b)[0].tagName;if("BR"==c||this.utils.isBlock(b))"BR"!=c&&this.utils.browser("msie")?this.caret.setStart(a(b).next()):this.caret.setAfterOrBefore(b,"after");else{var d=this.utils.createSpaceElement();a(b).after(d),this.caret.setEnd(d)}}catch(e){var d=this.utils.createSpaceElement();a(b).after(d),this.caret.setEnd(d)}},setBefore:function(b){this.utils.isBlock(b)?this.caret.setEnd(a(b).prev()):this.caret.setAfterOrBefore(b,"before")},setAfterOrBefore:function(a,b){if(this.utils.browser("msie")||this.$editor.focus(),a=a[0]||a,this.selection.get(),"after"==b)try{this.range.setStartAfter(a),this.range.setEndAfter(a)}catch(c){}else try{this.range.setStartBefore(a),this.range.setEndBefore(a)}catch(c){}this.range.collapse(!1),this.selection.addRange()},getOffsetOfElement:function(b){b=b[0]||b,this.selection.get();var c=this.range.cloneRange();return c.selectNodeContents(b),c.setEnd(this.range.endContainer,this.range.endOffset),a.trim(c.toString()).length},getOffset:function(){var a=0,b=window.getSelection();if(b.rangeCount>0){var c=window.getSelection().getRangeAt(0),d=c.cloneRange();d.selectNodeContents(this.$editor[0]),d.setEnd(c.endContainer,c.endOffset),a=d.toString().length}return a},setOffset:function(a,b){"undefined"==typeof b&&(b=a),this.focus.isFocused()||this.focus.setStart();for(var c,d=(this.selection.get(),0),e=document.createTreeWalker(this.$editor[0],NodeFilter.SHOW_TEXT,null,null);c==e.nextNode();)if(d+=c.nodeValue.length,d>a&&(this.range.setStart(c,c.nodeValue.length+a-d),a=1/0),d>=b){this.range.setEnd(c,c.nodeValue.length+b-d);break}this.range.collapse(!1),this.selection.addRange()},setToPoint:function(a,b){this.caret.setOffset(a,b)},getCoords:function(){return this.caret.getOffset()}}},clean:function(){return{onSet:function(b){b=this.clean.savePreCode(b),b=b.replace(/"),b=this.clean.restoreFormTags(b);var c={"™":"™","©":"©","…":"…","—":"—","‐":"‐"};a.each(c,function(a,c){b=b.replace(new RegExp(a,"g"),c)}),this.utils.browser("mozilla")&&(b=b.replace(/ $/gi,"")),b=b.replace(new RegExp("
","gi"),""),b=b.replace(new RegExp(" ","gi"),""),b=b.replace(/<(.*?)rel="\s*?"(.*?[^>]?)>/gi,'<$1$2">'),b=b.replace(/<(.*?)style="\s*?"(.*?[^>]?)>/gi,'<$1$2">'),b=b.replace(/="">/gi,">"),b=b.replace(/""">/gi,'">'),b=b.replace(/"">/gi,'">'),b=b.replace(/ ])>/gi," "),b=b.replace(/<(.*?) data-verified="redactor"(.*?[^>])>/gi,"<$1$2>");var d=a(" ").html(a.parseHTML(b,document,!0));return d.find("span").removeAttr("rel"),d.find("pre .redactor-invisible-space").each(function(){a(this).contents().unwrap()}),b=d.html(),b=b.replace(/ ])rel="(.*?[^>])"(.*?[^>])>/gi," "),b=b.replace(/ (.*?)<\/span>/gi,"$1"),b=b.replace(/ data-save-url="(.*?[^>])"/gi,""),b=b.replace(/])>([\w\W]*?)<\/span>/gi,"$3"),b=b.replace(/])>(.*?)<\/span>/gi,""),b=b.replace(/])>(.*?)<\/span>/gi,""),b=b.replace(//gi,""),b=b.replace(/<\/font>/gi,""),b=this.tidy.load(b),this.opts.linkNofollow&&(b=b.replace(/])>/gi,""),b=b.replace(/])>/gi,'')),b=b.replace(/\sdata-redactor-(tag|class|style)="(.*?[^>])"/gi,""),b=b.replace(new RegExp('<(.*?) data-verified="redactor"(.*?[^>])>',"gi"),"<$1$2>"),b=b.replace(new RegExp('<(.*?) data-verified="redactor">',"gi"),"<$1>"),b=b.replace(/&/g,"&")},onPaste:function(b,c){if(b=a.trim(b),b=b.replace(/\$/g,"$"),b=b.replace(//gi,""),b=b.replace(/ <\/span>/gi," "),b=b.replace(/]*>\t<\/span>/gi," "),b=b.replace(/]*>(\s| )<\/span>/gi," "),this.opts.pastePlainText)return this.clean.getPlainText(b);if(!this.utils.isSelectAll()&&"undefined"==typeof c){if(this.utils.isCurrentOrParent(["FIGCAPTION","A"]))return this.clean.getPlainText(b,!1);if(this.utils.isCurrentOrParent("PRE"))return b=b.replace(/”/g,'"'),b=b.replace(/“/g,'"'),b=b.replace(/‘/g,"'"),b=b.replace(/’/g,"'"),this.clean.getPreCode(b);if(this.utils.isCurrentOrParent(["BLOCKQUOTE","H1","H2","H3","H4","H5","H6"])){if(b=this.clean.getOnlyImages(b),!this.utils.browser("msie")){var d=this.selection.getBlock();d&&"P"==d.tagName&&(b=b.replace(//gi,""))}return b}if(this.utils.isCurrentOrParent(["TD"]))return b=this.clean.onPasteTidy(b,"td"),this.opts.linebreaks&&(b=this.clean.replaceParagraphsToBr(b)),b=this.clean.replaceDivsToBr(b);if(this.utils.isCurrentOrParent(["LI"]))return this.clean.onPasteTidy(b,"li")}return b=this.clean.isSingleLine(b,c),this.clean.singleLine||(this.opts.linebreaks&&(b=this.clean.replaceParagraphsToBr(b)),this.opts.replaceDivs&&(b=this.clean.replaceDivs(b)),b=this.clean.saveFormTags(b)),b=this.clean.onPasteWord(b),b=this.clean.onPasteExtra(b),b=this.clean.onPasteTidy(b,"all"),!this.clean.singleLine&&this.opts.paragraphize&&(b=this.paragraphize.load(b)),b=this.clean.removeDirtyStyles(b),b=this.clean.onPasteRemoveSpans(b),b=this.clean.onPasteRemoveEmpty(b),b=this.clean.convertInline(b)},onPasteWord:function(b){if(b=b.replace(//gi,""),b=b.replace(/ |