!function(){function e(e,r){var a=e.getCursor(),i=e.getTokenAt(a),l=CodeMirror.innerMode(e.getMode(),i.state),s=l.state;if("xml"!=l.mode.name)throw CodeMirror.Pass;var d=e.getOption("autoCloseTags"),c="html"==l.mode.configuration,f="object"==typeof d&&d.dontCloseTags||c&&o,g="object"==typeof d&&d.indentTags||c&&n;if(">"==r&&s.tagName){var h=s.tagName;i.end>a.ch&&(h=h.slice(0,h.length-i.end+a.ch));var u=h.toLowerCase();if("tag"==i.type&&"closeTag"==s.type||/\/\s*$/.test(i.string)||f&&t(f,u)>-1)throw CodeMirror.Pass;var m=g&&t(g,u)>-1;return e.replaceSelection(">"+(m?"\n\n":"")+"</"+h+">",m?{line:a.line+1,ch:0}:{line:a.line,ch:a.ch+1}),void(m&&(e.indentLine(a.line+1),e.indentLine(a.line+2)))}if("/"!=r||"tag"!=i.type||"<"!=i.string)throw CodeMirror.Pass;(h=s.context&&s.context.tagName)&&e.replaceSelection("/"+h+">","end")}function t(e,t){if(e.indexOf)return e.indexOf(t);for(var o=0,n=e.length;o<n;++o)if(e[o]==t)return o;return-1}CodeMirror.defineOption("autoCloseTags",!1,function(t,o,n){if(!o||n!=CodeMirror.Init&&n)!o&&n!=CodeMirror.Init&&n&&t.removeKeyMap("autoCloseTags");else{var r={name:"autoCloseTags"};("object"!=typeof o||o.whenClosing)&&(r["'/'"]=function(t){e(t,"/")}),("object"!=typeof o||o.whenOpening)&&(r["'>'"]=function(t){e(t,">")}),t.addKeyMap(r)}});var o=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],n=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"]}();