if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(t){"use strict";var e=t.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(t){"use strict";function e(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in e)if(void 0!==t.style[i])return{end:e[i]};return!1}t.fn.emulateTransitionEnd=function(e){var i=!1,o=this;t(this).one("bsTransitionEnd",function(){i=!0});var n=function(){i||t(o).trigger(t.support.transition.end)};return setTimeout(n,e),this},t(function(){t.support.transition=e(),t.support.transition&&(t.event.special.bsTransitionEnd={bindType:t.support.transition.end,delegateType:t.support.transition.end,handle:function(e){return t(e.target).is(this)?e.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var i=t(this),n=i.data("bs.alert");n||i.data("bs.alert",n=new o(this)),"string"==typeof e&&n[e].call(i)})}var i='[data-dismiss="alert"]',o=function(e){t(e).on("click",i,this.close)};o.VERSION="3.3.5",o.TRANSITION_DURATION=150,o.prototype.close=function(e){function i(){a.detach().trigger("closed.bs.alert").remove()}var n=t(this),s=n.attr("data-target");s||(s=n.attr("href"),s=s&&s.replace(/.*(?=#[^\s]*$)/,""));var a=t(s);e&&e.preventDefault(),a.length||(a=n.closest(".alert")),a.trigger(e=t.Event("close.bs.alert")),e.isDefaultPrevented()||(a.removeClass("in"),t.support.transition&&a.hasClass("fade")?a.one("bsTransitionEnd",i).emulateTransitionEnd(o.TRANSITION_DURATION):i())};var n=t.fn.alert;t.fn.alert=e,t.fn.alert.Constructor=o,t.fn.alert.noConflict=function(){return t.fn.alert=n,this},t(document).on("click.bs.alert.data-api",i,o.prototype.close)}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var o=t(this),n=o.data("bs.button"),s="object"==typeof e&&e;n||o.data("bs.button",n=new i(this,s)),"toggle"==e?n.toggle():e&&n.setState(e)})}var i=function(e,o){this.$element=t(e),this.options=t.extend({},i.DEFAULTS,o),this.isLoading=!1};i.VERSION="3.3.5",i.DEFAULTS={loadingText:"loading..."},i.prototype.setState=function(e){var i="disabled",o=this.$element,n=o.is("input")?"val":"html",s=o.data();e+="Text",null==s.resetText&&o.data("resetText",o[n]()),setTimeout(t.proxy(function(){o[n](null==s[e]?this.options[e]:s[e]),"loadingText"==e?(this.isLoading=!0,o.addClass(i).attr(i,i)):this.isLoading&&(this.isLoading=!1,o.removeClass(i).removeAttr(i))},this),0)},i.prototype.toggle=function(){var t=!0,e=this.$element.closest('[data-toggle="buttons"]');if(e.length){var i=this.$element.find("input");"radio"==i.prop("type")?(i.prop("checked")&&(t=!1),e.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==i.prop("type")&&(i.prop("checked")!==this.$element.hasClass("active")&&(t=!1),this.$element.toggleClass("active")),i.prop("checked",this.$element.hasClass("active")),t&&i.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var o=t.fn.button;t.fn.button=e,t.fn.button.Constructor=i,t.fn.button.noConflict=function(){return t.fn.button=o,this},t(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(i){var o=t(i.target);o.hasClass("btn")||(o=o.closest(".btn")),e.call(o,"toggle"),t(i.target).is('input[type="radio"]')||t(i.target).is('input[type="checkbox"]')||i.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(e){t(e.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(e.type))})}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var o=t(this),n=o.data("bs.carousel"),s=t.extend({},i.DEFAULTS,o.data(),"object"==typeof e&&e),a="string"==typeof e?e:s.slide;n||o.data("bs.carousel",n=new i(this,s)),"number"==typeof e?n.to(e):a?n[a]():s.interval&&n.pause().cycle()})}var i=function(e,i){this.$element=t(e),this.$indicators=this.$element.find(".carousel-indicators"),this.options=i,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",t.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",t.proxy(this.pause,this)).on("mouseleave.bs.carousel",t.proxy(this.cycle,this))};i.VERSION="3.3.5",i.TRANSITION_DURATION=600,i.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},i.prototype.keydown=function(t){if(!/input|textarea/i.test(t.target.tagName)){switch(t.which){case 37:this.prev();break;case 39:this.next();break;default:return}t.preventDefault()}},i.prototype.cycle=function(e){return e||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(t.proxy(this.next,this),this.options.interval)),this},i.prototype.getItemIndex=function(t){return this.$items=t.parent().children(".item"),this.$items.index(t||this.$active)},i.prototype.getItemForDirection=function(t,e){var i=this.getItemIndex(e),o="prev"==t&&0===i||"next"==t&&i==this.$items.length-1;if(o&&!this.options.wrap)return e;var n="prev"==t?-1:1,s=(i+n)%this.$items.length;return this.$items.eq(s)},i.prototype.to=function(t){var e=this,i=this.getItemIndex(this.$active=this.$element.find(".item.active"));return t>this.$items.length-1||0>t?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){e.to(t)}):i==t?this.pause().cycle():this.slide(t>i?"next":"prev",this.$items.eq(t))},i.prototype.pause=function(e){return e||(this.paused=!0),this.$element.find(".next, .prev").length&&t.support.transition&&(this.$element.trigger(t.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},i.prototype.next=function(){return this.sliding?void 0:this.slide("next")},i.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},i.prototype.slide=function(e,o){var n=this.$element.find(".item.active"),s=o||this.getItemForDirection(e,n),a=this.interval,r="next"==e?"left":"right",l=this;if(s.hasClass("active"))return this.sliding=!1;var h=s[0],d=t.Event("slide.bs.carousel",{relatedTarget:h,direction:r});if(this.$element.trigger(d),!d.isDefaultPrevented()){if(this.sliding=!0,a&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var p=t(this.$indicators.children()[this.getItemIndex(s)]);p&&p.addClass("active")}var c=t.Event("slid.bs.carousel",{relatedTarget:h,direction:r});return t.support.transition&&this.$element.hasClass("slide")?(s.addClass(e),s[0].offsetWidth,n.addClass(r),s.addClass(r),n.one("bsTransitionEnd",function(){s.removeClass([e,r].join(" ")).addClass("active"),n.removeClass(["active",r].join(" ")),l.sliding=!1,setTimeout(function(){l.$element.trigger(c)},0)}).emulateTransitionEnd(i.TRANSITION_DURATION)):(n.removeClass("active"),s.addClass("active"),this.sliding=!1,this.$element.trigger(c)),a&&this.cycle(),this}};var o=t.fn.carousel;t.fn.carousel=e,t.fn.carousel.Constructor=i,t.fn.carousel.noConflict=function(){return t.fn.carousel=o,this};var n=function(i){var o,n=t(this),s=t(n.attr("data-target")||(o=n.attr("href"))&&o.replace(/.*(?=#[^\s]+$)/,""));if(s.hasClass("carousel")){var a=t.extend({},s.data(),n.data()),r=n.attr("data-slide-to");r&&(a.interval=!1),e.call(s,a),r&&s.data("bs.carousel").to(r),i.preventDefault()}};t(document).on("click.bs.carousel.data-api","[data-slide]",n).on("click.bs.carousel.data-api","[data-slide-to]",n),t(window).on("load",function(){t('[data-ride="carousel"]').each(function(){var i=t(this);e.call(i,i.data())})})}(jQuery),+function(t){"use strict";function e(e){var i,o=e.attr("data-target")||(i=e.attr("href"))&&i.replace(/.*(?=#[^\s]+$)/,"");return t(o)}function i(e){return this.each(function(){var i=t(this),n=i.data("bs.collapse"),s=t.extend({},o.DEFAULTS,i.data(),"object"==typeof e&&e);!n&&s.toggle&&/show|hide/.test(e)&&(s.toggle=!1),n||i.data("bs.collapse",n=new o(this,s)),"string"==typeof e&&n[e]()})}var o=function(e,i){this.$element=t(e),this.options=t.extend({},o.DEFAULTS,i),this.$trigger=t('[data-toggle="collapse"][href="#'+e.id+'"],[data-toggle="collapse"][data-target="#'+e.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};o.VERSION="3.3.5",o.TRANSITION_DURATION=350,o.DEFAULTS={toggle:!0},o.prototype.dimension=function(){var t=this.$element.hasClass("width");return t?"width":"height"},o.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var e,n=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(n&&n.length&&(e=n.data("bs.collapse"),e&&e.transitioning))){var s=t.Event("show.bs.collapse");if(this.$element.trigger(s),!s.isDefaultPrevented()){n&&n.length&&(i.call(n,"hide"),e||n.data("bs.collapse",null));var a=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[a](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var r=function(){this.$element.removeClass("collapsing").addClass("collapse in")[a](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!t.support.transition)return r.call(this);var l=t.camelCase(["scroll",a].join("-"));this.$element.one("bsTransitionEnd",t.proxy(r,this)).emulateTransitionEnd(o.TRANSITION_DURATION)[a](this.$element[0][l])}}}},o.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var e=t.Event("hide.bs.collapse");if(this.$element.trigger(e),!e.isDefaultPrevented()){var i=this.dimension();this.$element[i](this.$element[i]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var n=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return t.support.transition?void this.$element[i](0).one("bsTransitionEnd",t.proxy(n,this)).emulateTransitionEnd(o.TRANSITION_DURATION):n.call(this)}}},o.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},o.prototype.getParent=function(){return t(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(t.proxy(function(i,o){var n=t(o);this.addAriaAndCollapsedClass(e(n),n)},this)).end()},o.prototype.addAriaAndCollapsedClass=function(t,e){var i=t.hasClass("in");t.attr("aria-expanded",i),e.toggleClass("collapsed",!i).attr("aria-expanded",i)};var n=t.fn.collapse;t.fn.collapse=i,t.fn.collapse.Constructor=o,t.fn.collapse.noConflict=function(){return t.fn.collapse=n,this},t(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(o){var n=t(this);n.attr("data-target")||o.preventDefault();var s=e(n),a=s.data("bs.collapse"),r=a?"toggle":n.data();i.call(s,r)})}(jQuery),+function(t){"use strict";function e(e){var i=e.attr("data-target");i||(i=e.attr("href"),i=i&&/#[A-Za-z]/.test(i)&&i.replace(/.*(?=#[^\s]*$)/,""));var o=i&&t(i);return o&&o.length?o:e.parent()}function i(i){i&&3===i.which||(t(n).remove(),t(s).each(function(){var o=t(this),n=e(o),s={relatedTarget:this};n.hasClass("open")&&(i&&"click"==i.type&&/input|textarea/i.test(i.target.tagName)&&t.contains(n[0],i.target)||(n.trigger(i=t.Event("hide.bs.dropdown",s)),i.isDefaultPrevented()||(o.attr("aria-expanded","false"),n.removeClass("open").trigger("hidden.bs.dropdown",s))))}))}function o(e){return this.each(function(){var i=t(this),o=i.data("bs.dropdown");o||i.data("bs.dropdown",o=new a(this)),"string"==typeof e&&o[e].call(i)})}var n=".dropdown-backdrop",s='[data-toggle="dropdown"]',a=function(e){t(e).on("click.bs.dropdown",this.toggle)};a.VERSION="3.3.5",a.prototype.toggle=function(o){var n=t(this);if(!n.is(".disabled, :disabled")){var s=e(n),a=s.hasClass("open");if(i(),!a){"ontouchstart"in document.documentElement&&!s.closest(".navbar-nav").length&&t(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(t(this)).on("click",i);var r={relatedTarget:this};if(s.trigger(o=t.Event("show.bs.dropdown",r)),o.isDefaultPrevented())return;n.trigger("focus").attr("aria-expanded","true"),s.toggleClass("open").trigger("shown.bs.dropdown",r)}return!1}},a.prototype.keydown=function(i){if(/(38|40|27|32)/.test(i.which)&&!/input|textarea/i.test(i.target.tagName)){var o=t(this);if(i.preventDefault(),i.stopPropagation(),!o.is(".disabled, :disabled")){var n=e(o),a=n.hasClass("open");if(!a&&27!=i.which||a&&27==i.which)return 27==i.which&&n.find(s).trigger("focus"),o.trigger("click");var r=" li:not(.disabled):visible a",l=n.find(".dropdown-menu"+r);if(l.length){var h=l.index(i.target);38==i.which&&h>0&&h--,40==i.which&&hdocument.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&t?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!t?this.scrollbarWidth:""})},i.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},i.prototype.checkScrollbar=function(){var t=window.innerWidth;if(!t){var e=document.documentElement.getBoundingClientRect();t=e.right-Math.abs(e.left)}this.bodyIsOverflowing=document.body.clientWidth
',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},i.prototype.init=function(e,i,o){if(this.enabled=!0,this.type=e,this.$element=t(i),this.options=this.getOptions(o),this.$viewport=this.options.viewport&&t(t.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var n=this.options.trigger.split(" "),s=n.length;s--;){var a=n[s];if("click"==a)this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this));else if("manual"!=a){var r="hover"==a?"mouseenter":"focusin",l="hover"==a?"mouseleave":"focusout";this.$element.on(r+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(l+"."+this.type,this.options.selector,t.proxy(this.leave,this))}}this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},i.prototype.getDefaults=function(){return i.DEFAULTS},i.prototype.getOptions=function(e){return e=t.extend({},this.getDefaults(),this.$element.data(),e),e.delay&&"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),e},i.prototype.getDelegateOptions=function(){var e={},i=this.getDefaults();return this._options&&t.each(this._options,function(t,o){i[t]!=o&&(e[t]=o)}),e},i.prototype.enter=function(e){var i=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);return i||(i=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,i)),e instanceof t.Event&&(i.inState["focusin"==e.type?"focus":"hover"]=!0),i.tip().hasClass("in")||"in"==i.hoverState?void(i.hoverState="in"):(clearTimeout(i.timeout),i.hoverState="in",i.options.delay&&i.options.delay.show?void(i.timeout=setTimeout(function(){"in"==i.hoverState&&i.show()},i.options.delay.show)):i.show())},i.prototype.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},i.prototype.leave=function(e){var i=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);return i||(i=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,i)),e instanceof t.Event&&(i.inState["focusout"==e.type?"focus":"hover"]=!1),i.isInStateTrue()?void 0:(clearTimeout(i.timeout),i.hoverState="out",i.options.delay&&i.options.delay.hide?void(i.timeout=setTimeout(function(){"out"==i.hoverState&&i.hide()},i.options.delay.hide)):i.hide())},i.prototype.show=function(){var e=t.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(e);var o=t.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(e.isDefaultPrevented()||!o)return;var n=this,s=this.tip(),a=this.getUID(this.type);this.setContent(),s.attr("id",a),this.$element.attr("aria-describedby",a),this.options.animation&&s.addClass("fade");var r="function"==typeof this.options.placement?this.options.placement.call(this,s[0],this.$element[0]):this.options.placement,l=/\s?auto?\s?/i,h=l.test(r);h&&(r=r.replace(l,"")||"top"),s.detach().css({top:0,left:0,display:"block"}).addClass(r).data("bs."+this.type,this),this.options.container?s.appendTo(this.options.container):s.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var d=this.getPosition(),p=s[0].offsetWidth,c=s[0].offsetHeight;if(h){var f=r,u=this.getPosition(this.$viewport);r="bottom"==r&&d.bottom+c>u.bottom?"top":"top"==r&&d.top-cu.width?"left":"left"==r&&d.left-pa.top+a.height&&(n.top=a.top+a.height-l)}else{var h=e.left-s,d=e.left+s+i;ha.right&&(n.left=a.left+a.width-d)}return n},i.prototype.getTitle=function(){var t,e=this.$element,i=this.options;return t=e.attr("data-original-title")||("function"==typeof i.title?i.title.call(e[0]):i.title)},i.prototype.getUID=function(t){do t+=~~(1e6*Math.random());while(document.getElementById(t));return t},i.prototype.tip=function(){if(!this.$tip&&(this.$tip=t(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},i.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},i.prototype.enable=function(){this.enabled=!0},i.prototype.disable=function(){this.enabled=!1},i.prototype.toggleEnabled=function(){this.enabled=!this.enabled},i.prototype.toggle=function(e){var i=this;e&&(i=t(e.currentTarget).data("bs."+this.type),i||(i=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,i))),e?(i.inState.click=!i.inState.click,i.isInStateTrue()?i.enter(i):i.leave(i)):i.tip().hasClass("in")?i.leave(i):i.enter(i)},i.prototype.destroy=function(){var t=this;clearTimeout(this.timeout),this.hide(function(){t.$element.off("."+t.type).removeData("bs."+t.type),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null})};var o=t.fn.tooltip;t.fn.tooltip=e,t.fn.tooltip.Constructor=i,t.fn.tooltip.noConflict=function(){return t.fn.tooltip=o,this}}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var o=t(this),n=o.data("bs.popover"),s="object"==typeof e&&e;(n||!/destroy|hide/.test(e))&&(n||o.data("bs.popover",n=new i(this,s)),"string"==typeof e&&n[e]())})}var i=function(t,e){this.init("popover",t,e)};if(!t.fn.tooltip)throw new Error("Popover requires tooltip.js");i.VERSION="3.3.5",i.DEFAULTS=t.extend({},t.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:''}),i.prototype=t.extend({},t.fn.tooltip.Constructor.prototype),i.prototype.constructor=i,i.prototype.getDefaults=function(){return i.DEFAULTS},i.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),i=this.getContent();t.find(".popover-title")[this.options.html?"html":"text"](e),t.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof i?"html":"append":"text"](i),t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},i.prototype.hasContent=function(){return this.getTitle()||this.getContent()},i.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},i.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var o=t.fn.popover;t.fn.popover=e,t.fn.popover.Constructor=i,t.fn.popover.noConflict=function(){return t.fn.popover=o,this}}(jQuery),+function(t){"use strict";function e(i,o){this.$body=t(document.body),this.$scrollElement=t(t(i).is(document.body)?window:i),this.options=t.extend({},e.DEFAULTS,o),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",t.proxy(this.process,this)),this.refresh(),this.process()}function i(i){return this.each(function(){var o=t(this),n=o.data("bs.scrollspy"),s="object"==typeof i&&i;n||o.data("bs.scrollspy",n=new e(this,s)),"string"==typeof i&&n[i]()})}e.VERSION="3.3.5",e.DEFAULTS={offset:10},e.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},e.prototype.refresh=function(){var e=this,i="offset",o=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),t.isWindow(this.$scrollElement[0])||(i="position",o=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var e=t(this),n=e.data("target")||e.attr("href"),s=/^#./.test(n)&&t(n);return s&&s.length&&s.is(":visible")&&[[s[i]().top+o,n]]||null}).sort(function(t,e){return t[0]-e[0]}).each(function(){e.offsets.push(this[0]),e.targets.push(this[1])})},e.prototype.process=function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,i=this.getScrollHeight(),o=this.options.offset+i-this.$scrollElement.height(),n=this.offsets,s=this.targets,a=this.activeTarget;if(this.scrollHeight!=i&&this.refresh(),e>=o)return a!=(t=s[s.length-1])&&this.activate(t);if(a&&e=n[t]&&(void 0===n[t+1]||e .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),e.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),r?(e[0].offsetWidth,e.addClass("in")):e.removeClass("fade"),e.parent(".dropdown-menu").length&&e.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),n&&n()}var a=o.find("> .active"),r=n&&t.support.transition&&(a.length&&a.hasClass("fade")||!!o.find("> .fade").length);a.length&&r?a.one("bsTransitionEnd",s).emulateTransitionEnd(i.TRANSITION_DURATION):s(),a.removeClass("in")};var o=t.fn.tab;t.fn.tab=e,t.fn.tab.Constructor=i,t.fn.tab.noConflict=function(){return t.fn.tab=o,this};var n=function(i){i.preventDefault(),e.call(t(this),"show")};t(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',n).on("click.bs.tab.data-api",'[data-toggle="pill"]',n)}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var o=t(this),n=o.data("bs.affix"),s="object"==typeof e&&e;n||o.data("bs.affix",n=new i(this,s)),"string"==typeof e&&n[e]()})}var i=function(e,o){this.options=t.extend({},i.DEFAULTS,o),this.$target=t(this.options.target).on("scroll.bs.affix.data-api",t.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",t.proxy(this.checkPositionWithEventLoop,this)),this.$element=t(e),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};i.VERSION="3.3.5",i.RESET="affix affix-top affix-bottom",i.DEFAULTS={offset:0,target:window},i.prototype.getState=function(t,e,i,o){var n=this.$target.scrollTop(),s=this.$element.offset(),a=this.$target.height();if(null!=i&&"top"==this.affixed)return i>n?"top":!1;if("bottom"==this.affixed)return null!=i?n+this.unpin<=s.top?!1:"bottom":t-o>=n+a?!1:"bottom";var r=null==this.affixed,l=r?n:s.top,h=r?a:e;return null!=i&&i>=n?"top":null!=o&&l+h>=t-o?"bottom":!1},i.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(i.RESET).addClass("affix");var t=this.$target.scrollTop(),e=this.$element.offset();return this.pinnedOffset=e.top-t},i.prototype.checkPositionWithEventLoop=function(){setTimeout(t.proxy(this.checkPosition,this),1)},i.prototype.checkPosition=function(){if(this.$element.is(":visible")){var e=this.$element.height(),o=this.options.offset,n=o.top,s=o.bottom,a=Math.max(t(document).height(),t(document.body).height());"object"!=typeof o&&(s=n=o),"function"==typeof n&&(n=o.top(this.$element)),"function"==typeof s&&(s=o.bottom(this.$element));var r=this.getState(a,e,n,s);if(this.affixed!=r){null!=this.unpin&&this.$element.css("top","");var l="affix"+(r?"-"+r:""),h=t.Event(l+".bs.affix");if(this.$element.trigger(h),h.isDefaultPrevented())return;this.affixed=r,this.unpin="bottom"==r?this.getPinnedOffset():null,this.$element.removeClass(i.RESET).addClass(l).trigger(l.replace("affix","affixed")+".bs.affix")}"bottom"==r&&this.$element.offset({top:a-e-s})}};var o=t.fn.affix;t.fn.affix=e,t.fn.affix.Constructor=i,t.fn.affix.noConflict=function(){return t.fn.affix=o,this},t(window).on("load",function(){t('[data-spy="affix"]').each(function(){var i=t(this),o=i.data();o.offset=o.offset||{},null!=o.offsetBottom&&(o.offset.bottom=o.offsetBottom),null!=o.offsetTop&&(o.offset.top=o.offsetTop),e.call(i,o)})})}(jQuery); window.CodeMirror=function(){"use strict";function t(r,n){if(!(this instanceof t))return new t(r,n);this.options=n=n||{};for(var i in ai)!n.hasOwnProperty(i)&&ai.hasOwnProperty(i)&&(n[i]=ai[i]);h(n);var o="string"==typeof n.value?0:n.value.first,l=this.display=e(r,o);l.wrapper.CodeMirror=this,u(this),n.autofocus&&!Vn&&pt(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,draggingText:!1,highlight:new jr},s(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");var a=n.value;"string"==typeof a&&(a=new Ci(n.value,n.mode)),lt(this,dr)(this,a),An&&setTimeout(nn(dt,this,!0),20),mt(this);var c;try{c=document.activeElement==l.input}catch(f){}c||n.autofocus&&!Vn?setTimeout(nn(Et,this),20):zt(this),lt(this,function(){for(var t in si)si.propertyIsEnumerable(t)&&si[t](this,n[t],ui);for(var e=0;ee.maxLineLength&&(e.maxLineLength=n,e.maxLine=t)})}function h(t){var e=Jr(t.gutters,"CodeMirror-linenumbers");-1==e&&t.lineNumbers?t.gutters=t.gutters.concat(["CodeMirror-linenumbers"]):e>-1&&!t.lineNumbers&&(t.gutters=t.gutters.slice(0),t.gutters.splice(e,1))}function d(t){var e=t.display,r=t.doc.height,n=r+F(e);e.sizer.style.minHeight=e.heightForcer.style.top=n+"px",e.gutters.style.height=Math.max(n,e.scroller.clientHeight-Mi)+"px";var i=Math.max(n,e.scroller.scrollHeight),o=e.scroller.scrollWidth>e.scroller.clientWidth+1,l=i>e.scroller.clientHeight+1;l?(e.scrollbarV.style.display="block",e.scrollbarV.style.bottom=o?dn(e.measure)+"px":"0",e.scrollbarV.firstChild.style.height=i-e.scroller.clientHeight+e.scrollbarV.clientHeight+"px"):(e.scrollbarV.style.display="",e.scrollbarV.firstChild.style.height="0"),o?(e.scrollbarH.style.display="block",e.scrollbarH.style.right=l?dn(e.measure)+"px":"0",e.scrollbarH.firstChild.style.width=e.scroller.scrollWidth-e.scroller.clientWidth+e.scrollbarH.clientWidth+"px"):(e.scrollbarH.style.display="",e.scrollbarH.firstChild.style.width="0"),o&&l?(e.scrollbarFiller.style.display="block",e.scrollbarFiller.style.height=e.scrollbarFiller.style.width=dn(e.measure)+"px"):e.scrollbarFiller.style.display="",o&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(e.gutterFiller.style.display="block",e.gutterFiller.style.height=dn(e.measure)+"px",e.gutterFiller.style.width=e.gutters.offsetWidth+"px"):e.gutterFiller.style.display="",Pn&&0===dn(e.measure)&&(e.scrollbarV.style.minWidth=e.scrollbarH.style.minHeight=Rn?"18px":"12px",e.scrollbarV.style.pointerEvents=e.scrollbarH.style.pointerEvents="none")}function p(t,e,r){var n=t.scroller.scrollTop,i=t.wrapper.clientHeight;"number"==typeof r?n=r:r&&(n=r.top,i=r.bottom-r.top),n=Math.floor(n-I(t));var o=Math.ceil(n+i);return{from:br(e,n),to:br(e,o)}}function g(t){var e=t.display;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var r=y(e)-e.scroller.scrollLeft+t.doc.scrollLeft,n=e.gutters.offsetWidth,i=r+"px",o=e.lineDiv.firstChild;o;o=o.nextSibling)if(o.alignable)for(var l=0,s=o.alignable;l=t.display.showingFrom&&s.to<=t.display.showingTo)break}return i&&(Kr(t,"update",t),(t.display.showingFrom!=o||t.display.showingTo!=l)&&Kr(t,"viewportChange",t,t.display.showingFrom,t.display.showingTo)),i}function x(t,e,r,n){var i=t.display,o=t.doc;if(!i.wrapper.clientWidth)return i.showingFrom=i.showingTo=o.first,void(i.viewOffset=0);if(!(!n&&0==e.length&&r.from>i.showingFrom&&r.tof&&i.showingTo-f<20&&(f=Math.min(u,i.showingTo)),Qn)for(c=yr(Ge(o,pr(o,c)));u>f&&Ve(o,pr(o,f));)++f;var h=[{from:Math.max(i.showingFrom,o.first),to:Math.min(i.showingTo,u)}];if(h=h[0].from>=h[0].to?[]:L(h,e),Qn)for(var a=0;ap.from)){h.splice(a--,1);break}p.to=g}for(var v=0,a=0;af&&(p.to=f),p.from>=p.to?h.splice(a--,1):v+=p.to-p.from}if(!n&&v==f-c&&c==i.showingFrom&&f==i.showingTo)return void w(t);h.sort(function(t,e){return t.from-e.from});try{var y=document.activeElement}catch(b){}.7*(f-c)>v&&(i.lineDiv.style.display="none"),S(t,c,f,h,s),i.lineDiv.style.display="",y&&document.activeElement!=y&&y.offsetHeight&&y.focus();var x=c!=i.showingFrom||f!=i.showingTo||i.lastSizeC!=i.wrapper.clientHeight;return x&&(i.lastSizeC=i.wrapper.clientHeight,W(t,400)),i.showingFrom=c,i.showingTo=f,C(t),w(t),!0}}function C(t){for(var e,r=t.display,n=r.lineDiv.offsetTop,i=r.lineDiv.firstChild;i;i=i.nextSibling)if(i.lineObj){if(Nn){var o=i.offsetTop+i.offsetHeight;e=o-n,n=o}else{var l=fn(i);e=l.bottom-l.top}var s=i.lineObj.height-e;if(2>e&&(e=rt(r)),s>.001||-.001>s){vr(i.lineObj,e);var a=i.lineObj.widgets;if(a)for(var u=0;ur;++r){for(var i=e[r],o=[],l=i.diff||0,s=0,a=t.length;a>s;++s){var u=t[s];i.to<=u.from&&i.diff?o.push({from:u.from+l,to:u.to+l}):i.to<=u.from||i.from>=u.to?o.push(u):(i.from>u.from&&o.push({from:u.from,to:i.from}),i.toh){for(;c.lineObj!=e;)c=o(c);a&&h>=i&&c.lineNumber&&cn(c.lineNumber,v(t.options,h)),c=c.nextSibling}else{if(e.widgets)for(var m,y=0,b=c;b&&20>y;++y,b=b.nextSibling)if(b.lineObj==e&&/div/i.test(b.nodeName)){m=b;break}var x=M(t,e,h,l,m);if(x!=m)u.insertBefore(x,c);else{for(;c!=m;)c=o(c);c=c.nextSibling}x.lineObj=e}++h});c;)c=o(c)}function M(t,e,r,n,i){var o,l=rr(t,e),s=l.pre,a=e.gutterMarkers,u=t.display,c=l.bgClass?l.bgClass+" "+(e.bgClass||""):e.bgClass;if(!(t.options.lineNumbers||a||c||e.wrapClass||e.widgets))return s;if(i){i.alignable=null;for(var f,h=!0,d=0,p=null,g=i.firstChild;g;g=f)if(f=g.nextSibling,/\bCodeMirror-linewidget\b/.test(g.className)){for(var m=0;me&&(e=0),l.appendChild(sn("div",null,"CodeMirror-selected","position: absolute; left: "+t+"px; top: "+e+"px; width: "+(null==r?s-t:r)+"px; height: "+(n-e)+"px"))}function r(r,n,o){function l(e,n){return q(t,Yt(r,e),"div",f,n)}var u,c,f=pr(i,r),h=f.text.length;return gn(Cr(f),n||0,null==o?h:o,function(t,r,i){var f,d,p,g=l(t,"left");if(t==r)f=g,d=p=g.left;else{if(f=l(r-1,"right"),"rtl"==i){var m=g;g=f,f=m}d=g.left,p=f.right}null==n&&0==t&&(d=a),f.top-g.top>3&&(e(d,g.top,null,g.bottom),d=a,g.bottomc.bottom||f.bottom==c.bottom&&f.right>c.right)&&(c=f),a+1>d&&(d=a),e(d,f.top,p-d,f.bottom)}),{start:u,end:c}}var n=t.display,i=t.doc,o=t.doc.sel,l=document.createDocumentFragment(),s=n.lineSpace.offsetWidth,a=P(t.display);if(o.from.line==o.to.line)r(o.from.line,o.from.ch,o.to.ch);else{var u=pr(i,o.from.line),c=pr(i,o.to.line),f=Ge(i,u)==Ge(i,c),h=r(o.from.line,o.from.ch,f?u.text.length:null).end,d=r(o.to.line,f?0:null,o.to.ch).start;f&&(h.top0&&(e.blinker=setInterval(function(){e.cursor.style.visibility=e.otherCursor.style.visibility=(r=!r)?"":"hidden"},t.options.cursorBlinkRate))}}function W(t,e){t.doc.mode.startState&&t.doc.frontier=t.display.showingTo)){var r,n=+new Date+t.options.workTime,i=be(e.mode,z(t,e.frontier)),o=[];e.iter(e.frontier,Math.min(e.first+e.size,t.display.showingTo+500),function(l){if(e.frontier>=t.display.showingFrom){var s=l.styles;l.styles=Qe(t,l,i,!0);for(var a=!s||s.length!=l.styles.length,u=0;!a&&un?(W(t,t.options.workDelay),!0):void 0}),o.length&<(t,function(){for(var t=0;tl;--s){if(s<=o.first)return o.first;var a=pr(o,s-1);if(a.stateAfter&&(!r||s<=o.frontier))return s;var u=$r(a.text,null,t.options.tabSize);(null==i||n>u)&&(i=s-1,n=u)}return i}function z(t,e,r){var n=t.doc,i=t.display;if(!n.mode.startState)return!0;var o=E(t,e,r),l=o>n.first&&pr(n,o-1).stateAfter;return l=l?be(n.mode,l):xe(n.mode),n.iter(o,e,function(r){tr(t,r.text,l);var s=o==e-1||o%5==0||o>=i.showingFrom&&oo&&0==s&&(o=1)}return i=s>r?"left":r>s?"right":i,"left"==i&&a.leftSide?a=a.leftSide:"right"==i&&a.rightSide&&(a=a.rightSide),{left:r>s?a.right:a.left,right:s>r?a.left:a.right,top:a.top,bottom:a.bottom}}function B(t,e){for(var r=t.display.measureLineCache,n=0;nv&&(r=v),0>e&&(e=0);for(var n=g.length-2;n>=0;n-=2){var i=g[n],o=g[n+1];if(!(i>r||e>o)&&(e>=i&&o>=r||i>=e&&r>=o||Math.min(r,o)-Math.max(e,i)>=r-e>>1)){g[n]=Math.min(e,i),g[n+1]=Math.max(r,o);break}}return 0>n&&(n=g.length,g.push(e,r)),{left:t.left-p.left,right:t.right-p.left,top:n,bottom:null}}function n(t){t.bottom=g[t.top+1],t.top=g[t.top]}if(!t.options.lineWrapping&&e.text.length>=t.options.crudeMeasuringFrom)return U(t,e);var i=t.display,o=rn(e.text.length),l=rr(t,e,o,!0).pre;if(An&&!Nn&&!t.options.lineWrapping&&l.childNodes.length>100){for(var s=document.createDocumentFragment(),a=10,u=l.childNodes.length,c=0,f=Math.ceil(u/a);f>c;++c){for(var h=sn("div",null,null,"display: inline-block"),d=0;a>d&&u;++d)h.appendChild(l.firstChild),--u;s.appendChild(h)}l.appendChild(s)}un(i.measure,l);var p=fn(i.lineDiv),g=[],m=rn(e.text.length),v=l.offsetHeight;Hn&&i.measure.first!=l&&un(i.measure,l);for(var y,c=0;c1&&(x=m[c]=r(C[0]),x.rightSide=r(C[C.length-1]))}x||(x=m[c]=r(fn(b))),y.measureRight&&(x.right=fn(y.measureRight).left),y.leftSide&&(x.leftSide=r(fn(y.leftSide)))}an(t.display.measure);for(var y,c=0;c=t.options.crudeMeasuringFrom)return R(t,e,e.text.length,o&&o.measure,"right").right;var l=rr(t,e,null,!0).pre,s=l.appendChild(pn(t.display.measure));return un(t.display.measure,l),fn(s).right-fn(t.display.lineDiv).left}function _(t){t.display.measureLineCache.length=t.display.measureLineCachePos=0,t.display.cachedCharWidth=t.display.cachedTextHeight=null,t.options.lineWrapping||(t.display.maxLineChanged=!0),t.display.lineNumChars=null}function Y(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function j(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function $(t,e,r,n){if(e.widgets)for(var i=0;ir.from?o(t-1):o(t,n)}n=n||pr(t.doc,e.line),i||(i=V(t,n));var s=Cr(n),a=e.ch;if(!s)return o(a);var u=Ln(s,a),c=l(a,u);return null!=Pi&&(c.other=l(a,Pi)),c}function J(t,e,r,n){var i=new Yt(t,e);return i.xRel=n,r&&(i.outside=!0),i}function tt(t,e,r){var n=t.doc;if(r+=t.display.viewOffset,0>r)return J(n.first,0,!0,-1);var i=br(n,r),o=n.first+n.size-1;if(i>o)return J(n.first+n.size-1,pr(n,o).text.length,!0,1);for(0>e&&(e=0);;){var l=pr(n,i),s=et(t,l,i,e,r),a=Be(l),u=a&&a.find();if(!a||!(s.ch>u.from.ch||s.ch==u.from.ch&&s.xRel>0))return s;i=u.to.line}}function et(t,e,r,n,i){function o(n){var i=Q(t,Yt(r,n),"line",e,u);return s=!0,l>i.bottom?i.left-a:lm)return J(r,d,v,1);for(;;){if(c?d==h||d==Sn(e,h,1):1>=d-h){for(var y=p>n||m-n>=n-p?h:d,b=n-(y==h?p:m);Hi.test(e.text.charAt(y));)++y;var x=J(r,y,y==h?g:v,0>b?-1:b?1:0);return x}var C=Math.ceil(f/2),w=h+C;if(c){w=h;for(var L=0;C>L;++L)w=Sn(e,w,1)}var k=o(w);k>n?(d=w,m=k,(v=s)&&(m+=1e3),f=C):(h=w,p=k,g=s,f-=C)}}function rt(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==_n){_n=sn("pre");for(var e=0;49>e;++e)_n.appendChild(document.createTextNode("x")),_n.appendChild(sn("br"));_n.appendChild(document.createTextNode("x"))}un(t.measure,_n);var r=_n.offsetHeight/50;return r>3&&(t.cachedTextHeight=r),an(t.measure),r||1}function nt(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=sn("span","x"),r=sn("pre",[e]);un(t.measure,r);var n=e.offsetWidth;return n>2&&(t.cachedCharWidth=n),n||10}function it(t){t.curOp={changes:[],forceUpdate:!1,updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,cursorActivity:!1,updateMaxLine:!1,updateScrollPos:!1,id:++Jn},Si++||(ki=[])}function ot(t){var e=t.curOp,r=t.doc,n=t.display;if(t.curOp=null,e.updateMaxLine&&f(t),n.maxLineChanged&&!t.options.lineWrapping&&n.maxLine){var i=X(t,n.maxLine);n.sizer.style.minWidth=Math.max(0,i+3+Mi)+"px",n.maxLineChanged=!1;var o=Math.max(0,n.sizer.offsetLeft+n.sizer.offsetWidth-n.scroller.clientWidth);os&&r.charCodeAt(s)==o.charCodeAt(s);)++s;var u=i.from,c=i.to;s1e3||o.indexOf("\n")>-1?e.value=t.display.prevInput="":t.display.prevInput=o,l&&ot(t),t.state.pasteIncoming=!1,!0}function dt(t,e){var r,n,i=t.doc;if(jt(i.sel.from,i.sel.to))e&&(t.display.prevInput=t.display.input.value="",An&&!Hn&&(t.display.inputHasSelection=null));else{t.display.prevInput="",r=Ii&&(i.sel.to.line-i.sel.from.line>100||(n=t.getSelection()).length>1e3);var o=r?"-":n||t.getSelection();t.display.input.value=o,t.state.focused&&Qr(t.display.input),An&&!Hn&&(t.display.inputHasSelection=o)}t.display.inaccurateSelection=r}function pt(t){"nocursor"==t.options.readOnly||Vn&&document.activeElement==t.display.input||t.display.input.focus()}function gt(t){return t.options.readOnly||t.doc.cantEdit}function mt(t){function e(){t.state.focused&&setTimeout(nn(pt,t),0)}function r(){null==s&&(s=setTimeout(function(){s=null,l.cachedCharWidth=l.cachedTextHeight=Wi=null,_(t),at(t,nn(ut,t))},100))}function n(){for(var t=l.wrapper.parentNode;t&&t!=document.body;t=t.parentNode);t?setTimeout(n,5e3):Gr(window,"resize",r)}function i(e){Ur(t,e)||t.options.onDragEvent&&t.options.onDragEvent(t,Or(e))||Fr(e)}function o(){l.inaccurateSelection&&(l.prevInput="",l.inaccurateSelection=!1,l.input.value=t.getSelection(),Qr(l.input))}var l=t.display;Br(l.scroller,"mousedown",lt(t,bt)),An?Br(l.scroller,"dblclick",lt(t,function(e){if(!Ur(t,e)){var r=yt(t,e);if(r&&!wt(t,e)&&!vt(t.display,e)){Er(e);var n=me(pr(t.doc,r.line).text,r);ee(t.doc,n.from,n.to)}}})):Br(l.scroller,"dblclick",function(e){Ur(t,e)||Er(e)}),Br(l.lineSpace,"selectstart",function(t){vt(l,t)||Er(t)}),Zn||Br(l.scroller,"contextmenu",function(e){It(t,e)}),Br(l.scroller,"scroll",function(){l.scroller.clientHeight&&(St(t,l.scroller.scrollTop),Mt(t,l.scroller.scrollLeft,!0),Vr(t,"scroll",t))}),Br(l.scrollbarV,"scroll",function(){l.scroller.clientHeight&&St(t,l.scrollbarV.scrollTop)}),Br(l.scrollbarH,"scroll",function(){l.scroller.clientHeight&&Mt(t,l.scrollbarH.scrollLeft)}),Br(l.scroller,"mousewheel",function(e){Tt(t,e)}),Br(l.scroller,"DOMMouseScroll",function(e){Tt(t,e)}),Br(l.scrollbarH,"mousedown",e),Br(l.scrollbarV,"mousedown",e),Br(l.wrapper,"scroll",function(){l.wrapper.scrollTop=l.wrapper.scrollLeft=0});var s;Br(window,"resize",r),setTimeout(n,5e3),Br(l.input,"keyup",lt(t,function(e){Ur(t,e)||t.options.onKeyEvent&&t.options.onKeyEvent(t,Or(e))||16==e.keyCode&&(t.doc.sel.shift=!1)})),Br(l.input,"input",function(){An&&!Hn&&t.display.inputHasSelection&&(t.display.inputHasSelection=null),ft(t)}),Br(l.input,"keydown",lt(t,Wt)),Br(l.input,"keypress",lt(t,Ot)),Br(l.input,"focus",nn(Et,t)),Br(l.input,"blur",nn(zt,t)),t.options.dragDrop&&(Br(l.scroller,"dragstart",function(e){kt(t,e)}),Br(l.scroller,"dragenter",i),Br(l.scroller,"dragover",i),Br(l.scroller,"drop",lt(t,Lt))),Br(l.scroller,"paste",function(e){vt(l,e)||(pt(t),ft(t))}),Br(l.input,"paste",function(){if(Wn&&!t.state.fakedLastChar&&!(new Date-t.state.lastMiddleDown<200)){var e=l.input.selectionStart,r=l.input.selectionEnd;l.input.value+="$",l.input.selectionStart=e,l.input.selectionEnd=r,t.state.fakedLastChar=!0}t.state.pasteIncoming=!0,ft(t)}),Br(l.input,"cut",o),Br(l.input,"copy",o),Fn&&Br(l.sizer,"mouseup",function(){document.activeElement==l.input&&l.input.blur(),pt(t)})}function vt(t,e){for(var r=Pr(e);r!=t.wrapper;r=r.parentNode)if(!r||r.ignoreEvents||r.parentNode==t.sizer&&r!=t.mover)return!0}function yt(t,e,r){var n=t.display;if(!r){var i=Pr(e);if(i==n.scrollbarH||i==n.scrollbarH.firstChild||i==n.scrollbarV||i==n.scrollbarV.firstChild||i==n.scrollbarFiller||i==n.gutterFiller)return null}var o,l,s=fn(n.lineSpace);try{o=e.clientX,l=e.clientY}catch(e){return null}return tt(t,o-s.left,l-s.top)}function bt(t){function e(t){if(!jt(v,t)){ if(v=t,"single"==c)return void ee(i.doc,Qt(l,a),t);if(g=Qt(l,g),m=Qt(l,m),"double"==c){var e=me(pr(l,t.line).text,t);$t(t,g)?ee(i.doc,e.from,m):ee(i.doc,g,e.to)}else"triple"==c&&($t(t,g)?ee(i.doc,m,Qt(l,Yt(t.line,0))):ee(i.doc,g,Qt(l,Yt(t.line+1,0))))}}function r(t){var n=++b,s=yt(i,t,!0);if(s)if(jt(s,h)){var a=t.clientYy.bottom?20:0;a&&setTimeout(lt(i,function(){b==n&&(o.scroller.scrollTop+=a,r(t))}),50)}else{i.state.focused||Et(i),h=s,e(s);var u=p(o,l);(s.line>=u.to||s.lineu-400&&jt(jn.pos,a))c="triple",Er(t),setTimeout(nn(pt,i),20),ve(i,a.line);else if(Yn&&Yn.time>u-400&&jt(Yn.pos,a)){c="double",jn={time:u,pos:a},Er(t);var f=me(pr(l,a.line).text,a);ee(i.doc,f.from,f.to)}else Yn={time:u,pos:a};var h=a;if(i.options.dragDrop&&Di&&!gt(i)&&!jt(s.from,s.to)&&!$t(a,s.from)&&!$t(s.to,a)&&"single"==c){var d=lt(i,function(e){Wn&&(o.scroller.draggable=!1),i.state.draggingText=!1,Gr(document,"mouseup",d),Gr(o.scroller,"drop",d),Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)<10&&(Er(e),ee(i.doc,a),pt(i))});return Wn&&(o.scroller.draggable=!0),i.state.draggingText=d,o.scroller.dragDrop&&o.scroller.dragDrop(),Br(document,"mouseup",d),void Br(o.scroller,"drop",d)}Er(t),"single"==c&&ee(i.doc,Qt(l,a));var g=s.from,m=s.to,v=a,y=fn(o.wrapper),b=0,x=lt(i,function(t){An||Rr(t)?r(t):n(t)}),C=lt(i,n);Br(document,"mousemove",x),Br(document,"mouseup",C)}}}function xt(t,e,r,n,i){try{var o=e.clientX,l=e.clientY}catch(e){return!1}if(o>=Math.floor(fn(t.display.gutters).right))return!1;n&&Er(e);var s=t.display,a=fn(s.lineDiv);if(l>a.bottom||!_r(t,r))return Ir(e);l-=a.top-s.viewOffset;for(var u=0;u=o){var f=br(t.doc,l),h=t.options.gutters[u];return i(t,r,t,f,h,e),Ir(e)}}}function Ct(t,e){return _r(t,"gutterContextMenu")?xt(t,e,"gutterContextMenu",!1,Vr):!1}function wt(t,e){return xt(t,e,"gutterClick",!0,Kr)}function Lt(t){var e=this;if(!(Ur(e,t)||vt(e.display,t)||e.options.onDragEvent&&e.options.onDragEvent(e,Or(t)))){Er(t),An&&(ti=+new Date);var r=yt(e,t,!0),n=t.dataTransfer.files;if(r&&!gt(e))if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),l=0,s=function(t,n){var s=new FileReader;s.onload=function(){o[n]=s.result,++l==i&&(r=Qt(e.doc,r),Bt(e.doc,{from:r,to:r,text:Ei(o.join("\n")),origin:"paste"},"around"))},s.readAsText(t)},a=0;i>a;++a)s(n[a],a);else{if(e.state.draggingText&&!$t(r,e.doc.sel.from)&&!$t(e.doc.sel.to,r))return e.state.draggingText(t),void setTimeout(nn(pt,e),20);try{var o=t.dataTransfer.getData("Text");if(o){var u=e.doc.sel.from,c=e.doc.sel.to;ne(e.doc,r,r),e.state.draggingText&&_t(e.doc,"",u,c,"paste"),e.replaceSelection(o,null,"paste"),pt(e)}}catch(t){}}}}function kt(t,e){if(An&&(!t.state.draggingText||+new Date-ti<100))return void Fr(e);if(!Ur(t,e)&&!vt(t.display,e)){var r=t.getSelection();if(e.dataTransfer.setData("Text",r),e.dataTransfer.setDragImage&&!In){var n=sn("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",zn&&(n.width=n.height=1,t.display.wrapper.appendChild(n),n._top=n.offsetTop),e.dataTransfer.setDragImage(n,0,0),zn&&n.parentNode.removeChild(n)}}}function St(t,e){Math.abs(t.doc.scrollTop-e)<2||(t.doc.scrollTop=e,Tn||b(t,[],e),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e),t.display.scrollbarV.scrollTop!=e&&(t.display.scrollbarV.scrollTop=e),Tn&&b(t,[]),W(t,100))}function Mt(t,e,r){(r?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)||(e=Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth),t.doc.scrollLeft=e,g(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbarH.scrollLeft!=e&&(t.display.scrollbarH.scrollLeft=e))}function Tt(t,e){var r=e.wheelDeltaX,n=e.wheelDeltaY;null==r&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(r=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta);var i=t.display,o=i.scroller;if(r&&o.scrollWidth>o.clientWidth||n&&o.scrollHeight>o.clientHeight){if(n&&Kn&&Wn)for(var l=e.target;l!=o;l=l.parentNode)if(l.lineObj){t.display.currentWheelTarget=l;break}if(r&&!Tn&&!zn&&null!=ri)return n&&St(t,Math.max(0,Math.min(o.scrollTop+n*ri,o.scrollHeight-o.clientHeight))),Mt(t,Math.max(0,Math.min(o.scrollLeft+r*ri,o.scrollWidth-o.clientWidth))),Er(e),void(i.wheelStartX=null);if(n&&null!=ri){var s=n*ri,a=t.doc.scrollTop,u=a+i.wrapper.clientHeight;0>s?a=Math.max(0,a+s-50):u=Math.min(t.doc.height,u+s+50),b(t,[],{top:a,bottom:u})}20>ei&&(null==i.wheelStartX?(i.wheelStartX=o.scrollLeft,i.wheelStartY=o.scrollTop,i.wheelDX=r,i.wheelDY=n,setTimeout(function(){if(null!=i.wheelStartX){var t=o.scrollLeft-i.wheelStartX,e=o.scrollTop-i.wheelStartY,r=e&&i.wheelDY&&e/i.wheelDY||t&&i.wheelDX&&t/i.wheelDX;i.wheelStartX=i.wheelStartY=null,r&&(ri=(ri*ei+r)/(ei+1),++ei)}},200)):(i.wheelDX+=r,i.wheelDY+=n))}}function At(t,e,r){if("string"==typeof e&&(e=gi[e],!e))return!1;t.display.pollingFast&&ht(t)&&(t.display.pollingFast=!1);var n=t.doc,i=n.sel.shift,o=!1;try{gt(t)&&(t.state.suppressEdits=!0),r&&(n.sel.shift=!1),o=e(t)!=Ti}finally{n.sel.shift=i,t.state.suppressEdits=!1}return o}function Nt(t){var e=t.state.keyMaps.slice(0);return t.options.extraKeys&&e.push(t.options.extraKeys),e.push(t.options.keyMap),e}function Ht(t,e){var r=Ce(t.options.keyMap),n=r.auto;clearTimeout(ni),n&&!Le(e)&&(ni=setTimeout(function(){Ce(t.options.keyMap)==r&&(t.options.keyMap=n.call?n.call(null,t):n,l(t))},50));var i=ke(e,!0),o=!1;if(!i)return!1;var s=Nt(t);return o=e.shiftKey?we("Shift-"+i,s,function(e){return At(t,e,!0)})||we(i,s,function(e){return("string"==typeof e?/^go[A-Z]/.test(e):e.motion)?At(t,e):void 0}):we(i,s,function(e){return At(t,e)}),o&&(Er(e),D(t),Hn&&(e.oldKeyCode=e.keyCode,e.keyCode=0),Kr(t,"keyHandled",t,i,e)),o}function Dt(t,e,r){var n=we("'"+r+"'",Nt(t),function(e){return At(t,e,!0)});return n&&(Er(e),D(t),Kr(t,"keyHandled",t,"'"+r+"'",e)),n}function Wt(t){var e=this;if(e.state.focused||Et(e),!(Ur(e,t)||e.options.onKeyEvent&&e.options.onKeyEvent(e,Or(t)))){An&&27==t.keyCode&&(t.returnValue=!1);var r=t.keyCode;e.doc.sel.shift=16==r||t.shiftKey;var n=Ht(e,t);zn&&(oi=n?r:null,!n&&88==r&&!Ii&&(Kn?t.metaKey:t.ctrlKey)&&e.replaceSelection(""))}}function Ot(t){var e=this;if(!(Ur(e,t)||e.options.onKeyEvent&&e.options.onKeyEvent(e,Or(t)))){var r=t.keyCode,n=t.charCode;if(zn&&r==oi)return oi=null,void Er(t);if(!(zn&&(!t.which||t.which<10)||Fn)||!Ht(e,t)){var i=String.fromCharCode(null==n?r:n);this.options.electricChars&&this.doc.mode.electricChars&&this.options.smartIndent&&!gt(this)&&this.doc.mode.electricChars.indexOf(i)>-1&&setTimeout(lt(e,function(){he(e,e.doc.sel.to.line,"smart")}),75),Dt(e,t,i)||(An&&!Hn&&(e.display.inputHasSelection=null),ft(e))}}}function Et(t){"nocursor"!=t.options.readOnly&&(t.state.focused||(Vr(t,"focus",t),t.state.focused=!0,-1==t.display.wrapper.className.search(/\bCodeMirror-focused\b/)&&(t.display.wrapper.className+=" CodeMirror-focused"),t.curOp||(dt(t,!0),Wn&&setTimeout(nn(dt,t,!0),0))),ct(t),D(t))}function zt(t){t.state.focused&&(Vr(t,"blur",t),t.state.focused=!1,t.display.wrapper.className=t.display.wrapper.className.replace(" CodeMirror-focused","")),clearInterval(t.display.blinker),setTimeout(function(){t.state.focused||(t.doc.sel.shift=!1)},150)}function It(t,e){function r(){if(null!=i.input.selectionStart){var t=i.input.value="​"+(jt(o.from,o.to)?"":i.input.value);i.prevInput="​",i.input.selectionStart=1,i.input.selectionEnd=t.length}}function n(){if(i.inputDiv.style.position="relative",i.input.style.cssText=u,Hn&&(i.scrollbarV.scrollTop=i.scroller.scrollTop=s),ct(t),null!=i.input.selectionStart){(!An||Hn)&&r(),clearTimeout(ii);var e=0,n=function(){" "==i.prevInput&&0==i.input.selectionStart?lt(t,gi.selectAll)(t):e++<10?ii=setTimeout(n,500):dt(t)};ii=setTimeout(n,200)}}if(!Ur(t,e,"contextmenu")){var i=t.display,o=t.doc.sel;if(!vt(i,e)&&!Ct(t,e)){var l=yt(t,e),s=i.scroller.scrollTop;if(l&&!zn){var a=t.options.resetSelectionOnContextMenu;a&&(jt(o.from,o.to)||$t(l,o.from)||!$t(l,o.to))&<(t,ne)(t.doc,l,l);var u=i.input.style.cssText;if(i.inputDiv.style.position="absolute",i.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: white; outline: none;border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);",pt(t),dt(t,!0),jt(o.from,o.to)&&(i.input.value=i.prevInput=" "),An&&!Hn&&r(),Zn){Fr(e);var c=function(){Gr(window,"mouseup",c),setTimeout(n,20)};Br(window,"mouseup",c)}else setTimeout(n,50)}}}}function Ft(t,e,r){if(!$t(e.from,r))return Qt(t,r);var n=e.text.length-1-(e.to.line-e.from.line);if(r.line>e.to.line+n){var i=r.line-n,o=t.first+t.size-1;return i>o?Yt(o,pr(t,o).text.length):Jt(r,pr(t,i).text.length)}if(r.line==e.to.line+n)return Jt(r,qr(e.text).length+(1==e.text.length?e.from.ch:0)+pr(t,e.to.line).text.length-e.to.ch);var l=r.line-e.from.line;return Jt(r,e.text[l].length+(l?0:e.from.ch))}function Pt(t,e,r){if(r&&"object"==typeof r)return{anchor:Ft(t,e,r.anchor),head:Ft(t,e,r.head)};if("start"==r)return{anchor:e.from,head:e.from};var n=li(e);if("around"==r)return{anchor:e.from,head:n};if("end"==r)return{anchor:n,head:n};var i=function(t){if($t(t,e.from))return t;if(!$t(e.to,t))return n;var r=t.line+e.text.length-(e.to.line-e.from.line)-1,i=t.ch;return t.line==e.to.line&&(i+=n.ch-e.to.ch),Yt(r,i)};return{anchor:i(t.sel.anchor),head:i(t.sel.head)}}function Rt(t,e,r){var n={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){this.canceled=!0}};return r&&(n.update=function(e,r,n,i){e&&(this.from=Qt(t,e)),r&&(this.to=Qt(t,r)),n&&(this.text=n),void 0!==i&&(this.origin=i)}),Vr(t,"beforeChange",t,n),t.cm&&Vr(t.cm,"beforeChange",t.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Bt(t,e,r,n){if(t.cm){if(!t.cm.curOp)return lt(t.cm,Bt)(t,e,r,n);if(t.cm.state.suppressEdits)return}if(!(_r(t,"beforeChange")||t.cm&&_r(t.cm,"beforeChange"))||(e=Rt(t,e,!0))){var i=qn&&!n&&Fe(t,e.from,e.to);if(i){for(var o=i.length-1;o>=1;--o)Gt(t,{from:i[o].from,to:i[o].to,text:[""]});i.length&&Gt(t,{from:i[0].from,to:i[0].to,text:e.text},r)}else Gt(t,e,r)}}function Gt(t,e,r){if(1!=e.text.length||""!=e.text[0]||!jt(e.from,e.to)){var n=Pt(t,e,r);Sr(t,e,n,t.cm?t.cm.curOp.id:NaN),Ut(t,e,n,ze(t,e));var i=[];hr(t,function(t,r){r||-1!=Jr(i,t.history)||(Dr(t.history,e),i.push(t.history)),Ut(t,e,null,ze(t,e))})}}function Vt(t,e){if(!t.cm||!t.cm.state.suppressEdits){var r=t.history,n=("undo"==e?r.done:r.undone).pop();if(n){var i={changes:[],anchorBefore:n.anchorAfter,headBefore:n.headAfter,anchorAfter:n.anchorBefore,headAfter:n.headBefore,generation:r.generation};("undo"==e?r.undone:r.done).push(i),r.generation=n.generation||++r.maxGeneration;for(var o=_r(t,"beforeChange")||t.cm&&_r(t.cm,"beforeChange"),l=n.changes.length-1;l>=0;--l){var s=n.changes[l];if(s.origin=e,o&&!Rt(t,s,!1))return void(("undo"==e?r.done:r.undone).length=0);i.changes.push(kr(t,s));var a=l?Pt(t,s,null):{anchor:n.anchorBefore,head:n.headBefore};Ut(t,s,a,Ie(t,s));var u=[];hr(t,function(t,e){e||-1!=Jr(u,t.history)||(Dr(t.history,s),u.push(t.history)),Ut(t,s,null,Ie(t,s))})}}}}function Kt(t,e){function r(t){return Yt(t.line+e,t.ch)}t.first+=e,t.cm&&ut(t.cm,t.first,t.first,e),t.sel.head=r(t.sel.head),t.sel.anchor=r(t.sel.anchor),t.sel.from=r(t.sel.from),t.sel.to=r(t.sel.to)}function Ut(t,e,r,n){if(t.cm&&!t.cm.curOp)return lt(t.cm,Ut)(t,e,r,n);if(e.to.linet.lastLine())){if(e.from.lineo&&(e={from:e.from,to:Yt(o,pr(t,o).text.length),text:[e.text[0]],origin:e.origin}),e.removed=gr(t,e.from,e.to),r||(r=Pt(t,e,null)),t.cm?Xt(t.cm,e,n,r):ur(t,e,n,r)}}function Xt(t,e,r,n){var o=t.doc,l=t.display,s=e.from,a=e.to,u=!1,f=s.line;t.options.lineWrapping||(f=yr(Ge(o,pr(o,s.line))),o.iter(f,a.line+1,function(t){return t==l.maxLine?(u=!0,!0):void 0})),$t(o.sel.head,e.from)||$t(e.to,o.sel.head)||(t.curOp.cursorActivity=!0),ur(o,e,r,n,i(t)),t.options.lineWrapping||(o.iter(f,s.line+e.text.length,function(t){var e=c(o,t);e>l.maxLineLength&&(l.maxLine=t,l.maxLineLength=e,l.maxLineChanged=!0,u=!1)}),u&&(t.curOp.updateMaxLine=!0)),o.frontier=Math.min(o.frontier,s.line),W(t,400);var h=e.text.length-(a.line-s.line)-1;if(ut(t,s.line,a.line+1,h),_r(t,"change")){var d={from:s,to:a,text:e.text,removed:e.removed,origin:e.origin};if(t.curOp.textChanged){for(var p=t.curOp.textChanged;p.next;p=p.next);p.next=d}else t.curOp.textChanged=d}}function _t(t,e,r,n,i){if(n||(n=r),$t(n,r)){var o=n;n=r,r=o}"string"==typeof e&&(e=Ei(e)),Bt(t,{from:r,to:n,text:e,origin:i},null)}function Yt(t,e){return this instanceof Yt?(this.line=t,void(this.ch=e)):new Yt(t,e)}function jt(t,e){return t.line==e.line&&t.ch==e.ch}function $t(t,e){return t.liner?Yt(r,pr(t,r).text.length):Jt(e,pr(t,e.line).text.length)}function Jt(t,e){var r=t.ch;return null==r||r>e?Yt(t.line,e):0>r?Yt(t.line,0):t}function te(t,e){return e>=t.first&&e=o.ch:u.to>o.ch))){if(n&&(Vr(c,"beforeCursorEnter"),c.explicitlyCleared)){if(s.markedSpans){--a;continue}break}if(!c.atomic)continue;var f=c.find()[0>l?"from":"to"];if(jt(f,o)&&(f.ch+=l,f.ch<0?f=f.line>t.first?Qt(t,Yt(f.line-1)):null:f.ch>s.text.length&&(f=f.line(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!Bn){var o="none"==r.cursor.style.display;o&&(r.cursor.style.display="",r.cursor.style.left=e.left+"px",r.cursor.style.top=e.top-r.viewOffset+"px"),r.cursor.scrollIntoView(i),o&&(r.cursor.style.display="none")}}}function se(t,e,r,n){for(null==n&&(n=0);;){var i=!1,o=Q(t,e),l=r&&r!=e?Q(t,r):o,s=ue(t,Math.min(o.left,l.left),Math.min(o.top,l.top)-n,Math.max(o.left,l.left),Math.max(o.bottom,l.bottom)+n),a=t.doc.scrollTop,u=t.doc.scrollLeft;if(null!=s.scrollTop&&(St(t,s.scrollTop),Math.abs(t.doc.scrollTop-a)>1&&(i=!0)),null!=s.scrollLeft&&(Mt(t,s.scrollLeft),Math.abs(t.doc.scrollLeft-u)>1&&(i=!0)),!i)return o}}function ae(t,e,r,n,i){var o=ue(t,e,r,n,i);null!=o.scrollTop&&St(t,o.scrollTop),null!=o.scrollLeft&&Mt(t,o.scrollLeft)}function ue(t,e,r,n,i){var o=t.display,l=rt(t.display);0>r&&(r=0);var s=o.scroller.clientHeight-Mi,a=o.scroller.scrollTop,u={},c=t.doc.height+F(o),f=l>r,h=i>c-l;if(a>r)u.scrollTop=f?0:r;else if(i>a+s){var d=Math.min(r,(h?c:i)-s);d!=a&&(u.scrollTop=d)}var p=o.scroller.clientWidth-Mi,g=o.scroller.scrollLeft;e+=o.gutters.offsetWidth,n+=o.gutters.offsetWidth;var m=o.gutters.offsetWidth,v=m+10>e;return g+m>e||v?(v&&(e=0),u.scrollLeft=Math.max(0,e-10-m)):n>p+g-3&&(u.scrollLeft=n+10-p),u}function ce(t,e,r){t.curOp.updateScrollPos={scrollLeft:null==e?t.doc.scrollLeft:e,scrollTop:null==r?t.doc.scrollTop:r}}function fe(t,e,r){var n=t.curOp.updateScrollPos||(t.curOp.updateScrollPos={scrollLeft:t.doc.scrollLeft,scrollTop:t.doc.scrollTop}),i=t.display.scroller;n.scrollTop=Math.max(0,Math.min(i.scrollHeight-i.clientHeight,n.scrollTop+r)),n.scrollLeft=Math.max(0,Math.min(i.scrollWidth-i.clientWidth,n.scrollLeft+e))}function he(t,e,r,n){var i=t.doc;if(null==r&&(r="add"),"smart"==r)if(t.doc.mode.indent)var o=z(t,e);else r="prev";var l,s=t.options.tabSize,a=pr(i,e),u=$r(a.text,null,s),c=a.text.match(/^\s*/)[0];if("smart"==r&&(l=t.doc.mode.indent(o,a.text.slice(c.length),a.text),l==Ti)){if(!n)return;r="prev"}"prev"==r?l=e>i.first?$r(pr(i,e-1).text,null,s):0:"add"==r?l=u+t.options.indentUnit:"subtract"==r?l=u-t.options.indentUnit:"number"==typeof r&&(l=u+r),l=Math.max(0,l);var f="",h=0;if(t.options.indentWithTabs)for(var d=Math.floor(l/s);d;--d)h+=s,f+=" ";l>h&&(f+=Zr(l-h)),f!=c?_t(t.doc,f,Yt(e,0),Yt(e,c.length),"+input"):i.sel.head.line==e&&i.sel.head.ch=t.first+t.size?f=!1:(s=e,c=pr(t,e))}function l(t){var e=(i?Sn:Mn)(c,a,r,!0);if(null==e){if(t||!o())return f=!1;a=i?(0>r?bn:yn)(c):0>r?c.text.length:0}else a=e;return!0}var s=e.line,a=e.ch,u=r,c=pr(t,s),f=!0;if("char"==n)l();else if("column"==n)l(!0);else if("word"==n||"group"==n)for(var h=null,d="group"==n,p=!0;!(0>r)||l(!p);p=!1){var g=c.text.charAt(a)||"\n",m=on(g)?"w":d?/\s/.test(g)?null:"p":null;if(h&&h!=m){0>r&&(r=1,l());break}if(m&&(h=m),r>0&&!l(!p))break}var v=oe(t,Yt(s,a),u,!0);return f||(v.hitSide=!0),v}function ge(t,e,r,n){var i,o=t.doc,l=e.left;if("page"==n){var s=Math.min(t.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=e.top+r*(s-(0>r?1.5:.5)*rt(t.display))}else"line"==n&&(i=r>0?e.bottom+3:e.top-3);for(;;){var a=tt(t,l,i);if(!a.outside)break;if(0>r?0>=i:i>=o.height){a.hitSide=!0;break}i+=5*r}return a}function me(t,e){var r=e.ch,n=e.ch;if(t){(e.xRel<0||n==t.length)&&r?--r:++n;for(var i=t.charAt(r),o=on(i)?on:/\s/.test(i)?function(t){return/\s/.test(t)}:function(t){return!/\s/.test(t)&&!on(t)};r>0&&o(t.charAt(r-1));)--r;for(;nl;++l){var a=n(o[l]);if(a)return a}return!1}for(var i=0;i=e:o.to>e);(n||(n=[])).push({from:o.from,to:a?null:o.to,marker:l})}}return n}function Ee(t,e,r){if(t)for(var n,i=0;i=e:o.to>e);if(s||"bookmark"==l.type&&o.from==e&&(!r||o.marker.insertLeft)){var a=null==o.from||(l.inclusiveLeft?o.from<=e:o.from0&&s)for(var f=0;ff;++f)p.push(g);p.push(a)}return p}function Ie(t,e){var r=Tr(t,e),n=ze(t,e);if(!r)return n;if(!n)return r;for(var i=0;ie)&&(!r||r.widtht.options.maxHighlightLength?(l=!1,o&&tr(t,e,n,c.pos),c.pos=e.length,s=null):s=r.token(c,n),l&&u==s||(aa;){var n=i[s];n>t&&i.splice(s,1,t,i[s+1],n),s+=2,a=Math.min(t,n)}if(e)if(l.opaque)i.splice(r,s-r,t,e),s=r+2;else for(;s>r;r+=2){var o=i[r+1];i[r+1]=o?o+" "+e:e}})}return i}function Je(t,e){return e.styles&&e.styles[0]==t.state.modeGen||(e.styles=Qe(t,e,e.stateAfter=z(t,yr(e)))),e.styles}function tr(t,e,r,n){var i=t.doc.mode,o=new Se(e,t.options.tabSize);for(o.start=o.pos=n||0,""==e&&i.blankLine&&i.blankLine(r);!o.eol()&&o.pos<=t.options.maxHighlightLength;)i.token(o,r),o.start=o.pos}function er(t,e){if(!t)return null;for(;;){var r=t.match(/(?:^|\s)line-(background-)?(\S+)/);if(!r)break;t=t.slice(0,r.index)+t.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==e[n]?e[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(e[n])||(e[n]+=" "+r[2])}return bi[t]||(bi[t]="cm-"+t.replace(/ +/g," cm-"))}function rr(t,e,r,n){for(var i,o=e,l=!0;i=Re(o);)o=pr(t.doc,i.find().from.line);var s={pre:sn("pre"),col:0,pos:0,measure:null,measuredSomething:!1,cm:t,copyWidgets:n};do{o.text&&(l=!1),s.measure=o==e&&r,s.pos=0,s.addToken=s.measure?or:ir,(An||Wn)&&t.getOption("lineWrapping")&&(s.addToken=lr(s.addToken));var a=ar(o,s,Je(t,o));r&&o==e&&!s.measuredSomething&&(r[0]=s.pre.appendChild(pn(t.display.measure)),s.measuredSomething=!0),a&&(o=pr(t.doc,a.to.line))}while(a);!r||s.measuredSomething||r[0]||(r[0]=s.pre.appendChild(l?sn("span"," "):pn(t.display.measure))),s.pre.firstChild||Ve(t.doc,e)||s.pre.appendChild(document.createTextNode(" "));var u;if(r&&(An||Dn)&&(u=Cr(o))){var c=u.length-1;u[c].from==u[c].to&&--c;var f=u[c],h=u[c-1];if(f.from+1==f.to&&h&&f.level="�"&&"�">s&&ld)?(null!=b.to&&m>b.to&&(m=b.to,a=""),x.className&&(s+=" "+x.className),x.startStyle&&b.from==d&&(u+=" "+x.startStyle),x.endStyle&&b.to==m&&(a+=" "+x.endStyle),x.title&&!c&&(c=x.title), x.collapsed&&(!f||f.marker.sized&&m>b.from&&(m=b.from),"bookmark"==x.type&&b.from==d&&x.replacedWith&&v.push(x)}if(f&&(f.from||0)==d&&(sr(e,(null==f.to?h:f.to)-d,f.marker,null==f.from),null==f.to))return f.marker.find();if(!f&&v.length)for(var y=0;y=h)break;for(var C=Math.min(h,m);;){if(g){var w=d+g.length;if(!f){var L=w>C?g.slice(0,C-d):g;e.addToken(e,L,l?l+s:s,u,d+L.length==m?a:"",c)}if(w>=C){g=g.slice(C-d),d=C;break}d=w,u=""}g=i.slice(o,o=r[p++]),l=er(r[p++],e)}}else for(var p=1;pm;++m)g.push(new yi(u[m],o(m),i));g.push(new yi(h+c.text.slice(a.ch),d,i)),l(c,c.text.slice(0,s.ch)+u[0],o(0)),t.insert(s.line+1,g)}else if(1==u.length)l(c,c.text.slice(0,s.ch)+u[0]+f.text.slice(a.ch),o(0)),t.remove(s.line+1,p);else{l(c,c.text.slice(0,s.ch)+u[0],o(0)),l(f,h+f.text.slice(a.ch),d);for(var m=1,v=u.length-1,g=[];v>m;++m)g.push(new yi(u[m],o(m),i));p>1&&t.remove(s.line+1,p-1),t.insert(s.line+1,g)}else{for(var m=0,v=u.length-1,g=[];v>m;++m)g.push(new yi(u[m],o(m),i));l(f,f.text,d),p&&t.remove(s.line,p),g.length&&t.insert(s.line,g)}Kr(t,"change",t,e),ne(t,n.anchor,n.head,null,!0)}function cr(t){this.lines=t,this.parent=null;for(var e=0,r=t.length,n=0;r>e;++e)t[e].parent=this,n+=t[e].height;this.height=n}function fr(t){this.children=t;for(var e=0,r=0,n=0,i=t.length;i>n;++n){var o=t[n];e+=o.chunkSize(),r+=o.height,o.parent=this}this.size=e,this.height=r,this.parent=null}function hr(t,e,r){function n(t,i,o){if(t.linked)for(var l=0;le){t=n;break}e-=i}return t.lines[e]}function gr(t,e,r){var n=[],i=e.line;return t.iter(e.line,r.line+1,function(t){var o=t.text;i==r.line&&(o=o.slice(0,r.ch)),i==e.line&&(o=o.slice(e.ch)),n.push(o),++i}),n}function mr(t,e,r){var n=[];return t.iter(e,r,function(t){n.push(t.text)}),n}function vr(t,e){for(var r=e-t.height,n=t;n;n=n.parent)n.height+=r}function yr(t){if(null==t.parent)return null;for(var e=t.parent,r=Jr(e.lines,t),n=e.parent;n;e=n,n=n.parent)for(var i=0;n.children[i]!=e;++i)r+=n.children[i].chunkSize();return r+e.first}function br(t,e){var r=t.first;t:do{for(var n=0,i=t.children.length;i>n;++n){var o=t.children[n],l=o.height;if(l>e){t=o;continue t}e-=l,r+=o.chunkSize()}return r}while(!t.lines);for(var n=0,i=t.lines.length;i>n;++n){var s=t.lines[n],a=s.height;if(a>e)break;e-=a}return r+n}function xr(t,e){e=Ge(t.doc,e);for(var r=0,n=e.parent,i=0;io-t.cm.options.historyEventDelay||"*"==e.origin.charAt(0)))){var s=qr(l.changes);jt(e.from,e.to)&&jt(e.from,s.to)?s.to=li(e):l.changes.push(kr(t,e)),l.anchorAfter=r.anchor,l.headAfter=r.head}else for(l={changes:[kr(t,e)],generation:i.generation,anchorBefore:t.sel.anchor,headBefore:t.sel.head,anchorAfter:r.anchor,headAfter:r.head},i.done.push(l),i.generation=++i.maxGeneration;i.done.length>i.undoDepth;)i.done.shift();i.lastTime=o,i.lastOp=n,i.lastOrigin=e.origin}function Mr(t){if(!t)return null;for(var e,r=0;r-1&&(qr(l)[c]=u[c],delete u[c])}}return n}function Nr(t,e,r,n){r0}function Yr(t){t.prototype.on=function(t,e){Br(this,t,e)},t.prototype.off=function(t,e){Gr(this,t,e)}}function jr(){this.id=null}function $r(t,e,r,n,i){null==e&&(e=t.search(/[^\s\u00a0]/),-1==e&&(e=t.length));for(var o=n||0,l=i||0;e>o;++o)" "==t.charAt(o)?l+=r-l%r:++l;return l}function Zr(t){for(;Ai.length<=t;)Ai.push(qr(Ai)+" ");return Ai[t]}function qr(t){return t[t.length-1]}function Qr(t){if(Gn)t.selectionStart=0,t.selectionEnd=t.value.length;else try{t.select()}catch(e){}}function Jr(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;n>r;++r)if(t[r]==e)return r;return-1}function tn(t,e){function r(){}r.prototype=t;var n=new r;return e&&en(e,n),n}function en(t,e){e||(e={});for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function rn(t){for(var e=[],r=0;t>r;++r)e.push(void 0);return e}function nn(t){var e=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,e)}}function on(t){return/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||Ni.test(t))}function ln(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}function sn(t,e,r,n){var i=document.createElement(t);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof e)cn(i,e);else if(e)for(var o=0;o0;--e)t.removeChild(t.firstChild);return t}function un(t,e){return an(t).appendChild(e)}function cn(t,e){Hn?(t.innerHTML="",t.appendChild(document.createTextNode(e))):t.textContent=e}function fn(t){return t.getBoundingClientRect()}function hn(){return!1}function dn(t){if(null!=Wi)return Wi;var e=sn("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return un(t,e),e.offsetWidth&&(Wi=e.offsetHeight-e.clientHeight),Wi||0}function pn(t){if(null==Oi){var e=sn("span","​");un(t,sn("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(Oi=e.offsetWidth<=1&&e.offsetHeight>2&&!Nn)}return Oi?sn("span","​"):sn("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function gn(t,e,r,n){if(!t)return n(e,r,"ltr");for(var i=!1,o=0;oe||e==r&&l.to==e)&&(n(Math.max(l.from,e),Math.min(l.to,r),1==l.level?"rtl":"ltr"),i=!0)}i||n(e,r,"ltr")}function mn(t){return t.level%2?t.to:t.from}function vn(t){return t.level%2?t.from:t.to}function yn(t){var e=Cr(t);return e?mn(e[0]):0}function bn(t){var e=Cr(t);return e?vn(qr(e)):t.text.length}function xn(t,e){var r=pr(t.doc,e),n=Ge(t.doc,r);n!=r&&(e=yr(n));var i=Cr(n),o=i?i[0].level%2?bn(n):yn(n):0;return Yt(e,o)}function Cn(t,e){for(var r,n;r=Be(n=pr(t.doc,e));)e=r.find().to.line;var i=Cr(n),o=i?i[0].level%2?yn(n):bn(n):n.text.length;return Yt(e,o)}function wn(t,e,r){var n=t[0].level;return e==n?!0:r==n?!1:r>e}function Ln(t,e){for(var r,n=0;ne)return Pi=null,n;if(i.from==e||i.to==e){if(null!=r)return wn(t,i.level,t[r].level)?(Pi=r,n):(Pi=n,r);r=n}}return Pi=null,r}function kn(t,e,r,n){if(!n)return e+r;do e+=r;while(e>0&&Hi.test(t.text.charAt(e)));return e}function Sn(t,e,r,n){var i=Cr(t);if(!i)return Mn(t,e,r,n);for(var o=Ln(i,e),l=i[o],s=kn(t,e,l.level%2?-r:r,n);;){if(s>l.from&&s0==l.level%2?l.to:l.from);if(l=i[o+=r],!l)return null;s=r>0==l.level%2?kn(t,l.to,-1,n):kn(t,l.from,1,n)}}function Mn(t,e,r,n){var i=e+r;if(n)for(;i>0&&Hi.test(t.text.charAt(i));)i+=r;return 0>i||i>t.text.length?null:i}var Tn=/gecko\/\d/i.test(navigator.userAgent),An=/MSIE \d/.test(navigator.userAgent),Nn=An&&(null==document.documentMode||document.documentMode<8),Hn=An&&(null==document.documentMode||document.documentMode<9),Dn=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent),Wn=/WebKit\//.test(navigator.userAgent),On=Wn&&/Qt\/\d+\.\d+/.test(navigator.userAgent),En=/Chrome\//.test(navigator.userAgent),zn=/Opera\//.test(navigator.userAgent),In=/Apple Computer/.test(navigator.vendor),Fn=/KHTML\//.test(navigator.userAgent),Pn=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),Rn=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),Bn=/PhantomJS/.test(navigator.userAgent),Gn=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),Vn=Gn||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),Kn=Gn||/Mac/.test(navigator.platform),Un=/win/i.test(navigator.platform),Xn=zn&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Xn&&(Xn=Number(Xn[1])),Xn&&Xn>=15&&(zn=!1,Wn=!0);var _n,Yn,jn,$n=Kn&&(On||zn&&(null==Xn||12.11>Xn)),Zn=Tn||An&&!Hn,qn=!1,Qn=!1,Jn=0,ti=0,ei=0,ri=null;An?ri=-.53:Tn?ri=15:En?ri=-.7:In&&(ri=-1/3);var ni,ii,oi=null,li=t.changeEnd=function(t){return t.text?Yt(t.from.line+t.text.length-1,qr(t.text).length+(1==t.text.length?t.from.ch:0)):t.to};t.Pos=Yt,t.prototype={constructor:t,focus:function(){window.focus(),pt(this),ft(this)},setOption:function(t,e){var r=this.options,n=r[t];(r[t]!=e||"mode"==t)&&(r[t]=e,si.hasOwnProperty(t)&<(this,si[t])(this,e,n))},getOption:function(t){return this.options[t]},getDoc:function(){return this.doc},addKeyMap:function(t,e){this.state.keyMaps[e?"push":"unshift"](t)},removeKeyMap:function(t){for(var e=this.state.keyMaps,r=0;r=n;++n)he(this,n,t)}),getTokenAt:function(t,e){var r=this.doc;t=Qt(r,t);for(var n=z(this,t.line,e),i=this.doc.mode,o=pr(r,t.line),l=new Se(o.text,this.options.tabSize);l.pos>1;if((o?e[2*o-1]:0)>=i)n=o;else{if(!(e[2*o+1]n&&(t=n,r=!0);var i=pr(this.doc,t);return $(this,pr(this.doc,t),{top:0,left:0},e||"page").top+(r?i.height:0)},defaultTextHeight:function(){return rt(this.display)},defaultCharWidth:function(){return nt(this.display)},setGutterMarker:lt(null,function(t,e,r){return de(this,t,function(t){var n=t.gutterMarkers||(t.gutterMarkers={});return n[e]=r,!r&&ln(n)&&(t.gutterMarkers=null),!0})}),clearGutter:lt(null,function(t){var e=this,r=e.doc,n=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[t]&&(r.gutterMarkers[t]=null,ut(e,n,n+1),ln(r.gutterMarkers)&&(r.gutterMarkers=null)),++n})}),addLineClass:lt(null,function(t,e,r){return de(this,t,function(t){var n="text"==e?"textClass":"background"==e?"bgClass":"wrapClass";if(t[n]){if(new RegExp("(?:^|\\s)"+r+"(?:$|\\s)").test(t[n]))return!1;t[n]+=" "+r}else t[n]=r;return!0})}),removeLineClass:lt(null,function(t,e,r){return de(this,t,function(t){var n="text"==e?"textClass":"background"==e?"bgClass":"wrapClass",i=t[n];if(!i)return!1;if(null==r)t[n]=null;else{var o=i.match(new RegExp("(?:^|\\s+)"+r+"(?:$|\\s+)"));if(!o)return!1;var l=o.index+o[0].length;t[n]=i.slice(0,o.index)+(o.index&&l!=i.length?" ":"")+i.slice(l)||null}return!0})}),addLineWidget:lt(null,function(t,e,r){return je(this,t,e,r)}),removeLineWidget:function(t){t.clear()},lineInfo:function(t){if("number"==typeof t){if(!te(this.doc,t))return null;var e=t;if(t=pr(this.doc,t),!t)return null}else{var e=yr(t);if(null==e)return null}return{line:e,handle:t,text:t.text,gutterMarkers:t.gutterMarkers,textClass:t.textClass,bgClass:t.bgClass,wrapClass:t.wrapClass,widgets:t.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(t,e,r,n,i){var o=this.display;t=Q(this,Qt(this.doc,t));var l=t.bottom,s=t.left;if(e.style.position="absolute",o.sizer.appendChild(e),"over"==n)l=t.top;else if("above"==n||"near"==n){var a=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||t.bottom+e.offsetHeight>a)&&t.top>e.offsetHeight?l=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=a&&(l=t.bottom),s+e.offsetWidth>u&&(s=u-e.offsetWidth)}e.style.top=l+"px",e.style.left=e.style.right="","right"==i?(s=o.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-e.offsetWidth)/2),e.style.left=s+"px"),r&&ae(this,s,l,s+e.offsetWidth,l+e.offsetHeight)},triggerOnKeyDown:lt(null,Wt),execCommand:function(t){return gi[t](this)},findPosH:function(t,e,r,n){var i=1;0>e&&(i=-1,e=-e);for(var o=0,l=Qt(this.doc,t);e>o&&(l=pe(this.doc,l,i,r,n),!l.hitSide);++o);return l},moveH:lt(null,function(t,e){var r,n=this.doc.sel;r=n.shift||n.extend||jt(n.from,n.to)?pe(this.doc,n.head,t,e,this.options.rtlMoveVisually):0>t?n.from:n.to,ee(this.doc,r,r,t)}),deleteH:lt(null,function(t,e){var r=this.doc.sel;jt(r.from,r.to)?_t(this.doc,"",r.from,pe(this.doc,r.head,t,e,!1),"+delete"):_t(this.doc,"",r.from,r.to,"+delete"),this.curOp.userSelChange=!0}),findPosV:function(t,e,r,n){var i=1,o=n;0>e&&(i=-1,e=-e);for(var l=0,s=Qt(this.doc,t);e>l;++l){var a=Q(this,s,"div");if(null==o?o=a.left:a.left=o,s=ge(this,a,i,r),s.hitSide)break}return s},moveV:lt(null,function(t,e){var r=this.doc.sel,n=Q(this,r.head,"div");null!=r.goalColumn&&(n.left=r.goalColumn);var i=ge(this,n,t,e);"page"==e&&fe(this,0,q(this,i,"div").top-n.top),ee(this.doc,i,i,t),r.goalColumn=n.left}),toggleOverwrite:function(t){(null==t||t!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?this.display.cursor.className+=" CodeMirror-overwrite":this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite",""))},hasFocus:function(){return this.state.focused},scrollTo:lt(null,function(t,e){ce(this,t,e)}),getScrollInfo:function(){var t=this.display.scroller,e=Mi;return{left:t.scrollLeft,top:t.scrollTop,height:t.scrollHeight-e,width:t.scrollWidth-e,clientHeight:t.clientHeight-e,clientWidth:t.clientWidth-e}},scrollIntoView:lt(null,function(t,e){null==t?t={from:this.doc.sel.head,to:null}:"number"==typeof t?t={from:Yt(t,0),to:null}:null==t.from&&(t={from:t,to:null}),t.to||(t.to=t.from),e||(e=0);var r=t;null!=t.from.line&&(this.curOp.scrollToPos={from:t.from,to:t.to,margin:e},r={from:Q(this,t.from),to:Q(this,t.to)});var n=ue(this,Math.min(r.from.left,r.to.left),Math.min(r.from.top,r.to.top)-e,Math.max(r.from.right,r.to.right),Math.max(r.from.bottom,r.to.bottom)+e);ce(this,n.scrollLeft,n.scrollTop)}),setSize:lt(null,function(t,e){function r(t){return"number"==typeof t||/^\d+$/.test(String(t))?t+"px":t}null!=t&&(this.display.wrapper.style.width=r(t)),null!=e&&(this.display.wrapper.style.height=r(e)),this.options.lineWrapping&&(this.display.measureLineCache.length=this.display.measureLineCachePos=0),this.curOp.forceUpdate=!0}),operation:function(t){return at(this,t)},refresh:lt(null,function(){var t=null==this.display.cachedTextHeight;_(this),ce(this,this.doc.scrollLeft,this.doc.scrollTop),ut(this),t&&o(this)}),swapDoc:lt(null,function(t){var e=this.doc;return e.cm=null,dr(this,t),_(this),dt(this,!0),ce(this,t.scrollLeft,t.scrollTop),Kr(this,"swapDoc",this,e),e}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Yr(t);var si=t.optionHandlers={},ai=t.defaults={},ui=t.Init={toString:function(){return"CodeMirror.Init"}};ye("value","",function(t,e){t.setValue(e)},!0),ye("mode",null,function(t,e){t.doc.modeOption=e,r(t)},!0),ye("indentUnit",2,r,!0),ye("indentWithTabs",!1),ye("smartIndent",!0),ye("tabSize",4,function(t){r(t),_(t),ut(t)},!0),ye("specialChars",/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g,function(t,e){t.options.specialChars=new RegExp(e.source+(e.test(" ")?"":"| "),"g"),t.refresh()},!0),ye("specialCharPlaceholder",nr,function(t){t.refresh()},!0),ye("electricChars",!0),ye("rtlMoveVisually",!Un),ye("wholeLineUpdateBefore",!0),ye("theme","default",function(t){s(t),a(t)},!0),ye("keyMap","default",l),ye("extraKeys",null),ye("onKeyEvent",null),ye("onDragEvent",null),ye("lineWrapping",!1,n,!0),ye("gutters",[],function(t){h(t.options),a(t)},!0),ye("fixedGutter",!0,function(t,e){t.display.gutters.style.left=e?y(t.display)+"px":"0",t.refresh()},!0),ye("coverGutterNextToScrollbar",!1,d,!0),ye("lineNumbers",!1,function(t){h(t.options),a(t)},!0),ye("firstLineNumber",1,a,!0),ye("lineNumberFormatter",function(t){return t},a,!0),ye("showCursorWhenSelecting",!1,A,!0),ye("resetSelectionOnContextMenu",!0),ye("readOnly",!1,function(t,e){"nocursor"==e?(zt(t),t.display.input.blur(),t.display.disabled=!0):(t.display.disabled=!1,e||dt(t,!0))}),ye("dragDrop",!0),ye("cursorBlinkRate",530),ye("cursorScrollMargin",0),ye("cursorHeight",1),ye("workTime",100),ye("workDelay",100),ye("flattenSpans",!0),ye("pollInterval",100),ye("undoDepth",40,function(t,e){t.doc.history.undoDepth=e}),ye("historyEventDelay",500),ye("viewportMargin",10,function(t){t.refresh()},!0),ye("maxHighlightLength",1e4,function(t){r(t),t.refresh()},!0),ye("crudeMeasuringFrom",1e4),ye("moveInputWithCursor",!0,function(t,e){e||(t.display.inputDiv.style.top=t.display.inputDiv.style.left=0)}),ye("tabindex",null,function(t,e){t.display.input.tabIndex=e||""}),ye("autofocus",null);var ci=t.modes={},fi=t.mimeModes={};t.defineMode=function(e,r){if(t.defaults.mode||"null"==e||(t.defaults.mode=e),arguments.length>2){r.dependencies=[];for(var n=2;n0&&e.ch=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pose},eatSpace:function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},skipToEnd:function(){this.pos=this.string.length},skipTo:function(t){var e=this.string.indexOf(t,this.pos);return e>-1?(this.pos=e,!0):void 0},backUp:function(t){this.pos-=t},column:function(){return this.lastColumnPos0?null:(n&&e!==!1&&(this.pos+=n[0].length),n)}var i=function(t){return r?t.toLowerCase():t},o=this.string.substr(this.pos,t.length);return i(o)==i(t)?(e!==!1&&(this.pos+=t.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)}},t.StringStream=Se,t.TextMarker=Me,Yr(Me),Me.prototype.clear=function(){if(!this.explicitlyCleared){var t=this.doc.cm,e=t&&!t.curOp;if(e&&it(t),_r(this,"clear")){var r=this.find();r&&Kr(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;ot.display.maxLineLength&&(t.display.maxLine=a,t.display.maxLineLength=u,t.display.maxLineChanged=!0)}null!=n&&t&&ut(t,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&ie(t)),e&&ot(t)}},Me.prototype.find=function(){for(var t,e,r=0;r=e.display.showingFrom&&t.liner;++r){var i=this.lines[r];this.height-=i.height,Ze(i),Kr(i,"delete")}this.lines.splice(t,e)},collapse:function(t){t.splice.apply(t,[t.length,0].concat(this.lines))},insertInner:function(t,e,r){this.height+=r,this.lines=this.lines.slice(0,t).concat(e).concat(this.lines.slice(t));for(var n=0,i=e.length;i>n;++n)e[n].parent=this},iterN:function(t,e,r){for(var n=t+e;n>t;++t)if(r(this.lines[t]))return!0}},fr.prototype={chunkSize:function(){return this.size},removeInner:function(t,e){this.size-=e;for(var r=0;rt){var o=Math.min(e,i-t),l=n.height;if(n.removeInner(t,o),this.height-=l-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(e-=o))break;t=0}else t-=i}if(this.size-e<25){var s=[];this.collapse(s),this.children=[new cr(s)],this.children[0].parent=this}},collapse:function(t){for(var e=0,r=this.children.length;r>e;++e)this.children[e].collapse(t)},insertInner:function(t,e,r){this.size+=e.length,this.height+=r;for(var n=0,i=this.children.length;i>n;++n){var o=this.children[n],l=o.chunkSize();if(l>=t){if(o.insertInner(t,e,r),o.lines&&o.lines.length>50){for(;o.lines.length>50;){var s=o.lines.splice(o.lines.length-25,25),a=new cr(s);o.height-=a.height,this.children.splice(n+1,0,a),a.parent=this}this.maybeSpill()}break}t-=l}},maybeSpill:function(){if(!(this.children.length<=10)){var t=this;do{var e=t.children.splice(t.children.length-5,5),r=new fr(e);if(t.parent){t.size-=r.size,t.height-=r.height;var n=Jr(t.parent.children,t);t.parent.children.splice(n+1,0,r)}else{var i=new fr(t.children);i.parent=t,t.children=[i,r],t=i}r.parent=t.parent}while(t.children.length>10);t.parent.maybeSpill()}},iterN:function(t,e,r){for(var n=0,i=this.children.length;i>n;++n){var o=this.children[n],l=o.chunkSize();if(l>t){var s=Math.min(e,l-t);if(o.iterN(t,s,r))return!0;if(0==(e-=s))break;t=0}else t-=l}}};var xi=0,Ci=t.Doc=function(t,e,r){if(!(this instanceof Ci))return new Ci(t,e,r);null==r&&(r=0),fr.call(this,[new cr([new yi("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.history=wr(),this.cleanGeneration=1,this.frontier=r;var n=Yt(r,0);this.sel={from:n,to:n,head:n,anchor:n,shift:!1,extend:!1,goalColumn:null},this.id=++xi,this.modeOption=e,"string"==typeof t&&(t=Ei(t)),ur(this,{from:n,to:n,text:t},null,{head:n,anchor:n})};Ci.prototype=tn(fr.prototype,{constructor:Ci,iter:function(t,e,r){r?this.iterN(t-this.first,e-t,r):this.iterN(this.first,this.first+this.size,t)},insert:function(t,e){for(var r=0,n=0,i=e.length;i>n;++n)r+=e[n].height;this.insertInner(t-this.first,e,r)},remove:function(t,e){this.removeInner(t-this.first,e)},getValue:function(t){var e=mr(this,this.first,this.first+this.size);return t===!1?e:e.join(t||"\n")},setValue:function(t){var e=Yt(this.first,0),r=this.first+this.size-1;Bt(this,{from:e,to:Yt(r,pr(this,r).text.length),text:Ei(t),origin:"setValue"},{head:e,anchor:e},!0)},replaceRange:function(t,e,r,n){e=Qt(this,e),r=r?Qt(this,r):e,_t(this,t,e,r,n)},getRange:function(t,e,r){var n=gr(this,Qt(this,t),Qt(this,e));return r===!1?n:n.join(r||"\n")},getLine:function(t){var e=this.getLineHandle(t);return e&&e.text},setLine:function(t,e){te(this,t)&&_t(this,e,Yt(t,0),Qt(this,Yt(t)))},removeLine:function(t){t?_t(this,"",Qt(this,Yt(t-1)),Qt(this,Yt(t))):_t(this,"",Yt(0,0),Qt(this,Yt(1,0)))},getLineHandle:function(t){return te(this,t)?pr(this,t):void 0},getLineNumber:function(t){return yr(t)},getLineHandleVisualStart:function(t){return"number"==typeof t&&(t=pr(this,t)),Ge(this,t)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(t){return Qt(this,t)},getCursor:function(t){var e,r=this.sel;return e=null==t||"head"==t?r.head:"anchor"==t?r.anchor:"end"==t||t===!1?r.to:r.from,Zt(e)},somethingSelected:function(){return!jt(this.sel.head,this.sel.anchor)},setCursor:st(function(t,e,r){var n=Qt(this,"number"==typeof t?Yt(t,e||0):t);r?ee(this,n):ne(this,n,n)}),setSelection:st(function(t,e,r){ne(this,Qt(this,t),Qt(this,e||t),r)}),extendSelection:st(function(t,e,r){ee(this,Qt(this,t),e&&Qt(this,e),r)}),getSelection:function(t){return this.getRange(this.sel.from,this.sel.to,t)},replaceSelection:function(t,e,r){Bt(this,{from:this.sel.from,to:this.sel.to,text:Ei(t),origin:r},e||"around")},undo:st(function(){Vt(this,"undo")}),redo:st(function(){Vt(this,"redo")}),setExtending:function(t){this.sel.extend=t},historySize:function(){var t=this.history;return{undo:t.done.length,redo:t.undone.length}},clearHistory:function(){this.history=wr(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration()},changeGeneration:function(){return this.history.lastOp=this.history.lastOrigin=null,this.history.generation},isClean:function(t){return this.history.generation==(t||this.cleanGeneration)},getHistory:function(){return{done:Ar(this.history.done),undone:Ar(this.history.undone)}},setHistory:function(t){var e=this.history=wr(this.history.maxGeneration);e.done=t.done.slice(0),e.undone=t.undone.slice(0)},markText:function(t,e,r){return Te(this,Qt(this,t),Qt(this,e),r,"range")},setBookmark:function(t,e){var r={replacedWith:e&&(null==e.nodeType?e.widget:e),insertLeft:e&&e.insertLeft};return t=Qt(this,t),Te(this,t,t,r,"bookmark")},findMarksAt:function(t){t=Qt(this,t);var e=[],r=pr(this,t.line).markedSpans;if(r)for(var n=0;n=t.ch)&&e.push(i.marker.parent||i.marker)}return e},getAllMarks:function(){var t=[];return this.iter(function(e){var r=e.markedSpans;if(r)for(var n=0;nt?(e=t,!0):(t-=i,void++r)}),Qt(this,Yt(r,e))},indexFromPos:function(t){t=Qt(this,t);var e=t.ch;return t.linee&&(e=t.from),null!=t.to&&t.to=8208&&8212>=r}:Wn&&(hn=function(t,e){if(e>1&&45==t.charCodeAt(e-1)){if(/\w/.test(t.charAt(e-2))&&/[^\-?\.]/.test(t.charAt(e)))return!0;if(e>2&&/[\d\.,]/.test(t.charAt(e-2))&&/[\d\.,]/.test(t.charAt(e)))return!1}return/[~!#%&*)=+}\]\\|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|…[\w~`@#$%\^&*(_=+{[><]/.test(t.slice(e-1,e+1))});var Wi,Oi,Ei=3!="\n\nb".split(/\n/).length?function(t){for(var e=0,r=[],n=t.length;n>=e;){var i=t.indexOf("\n",e);-1==i&&(i=t.length);var o=t.slice(e,"\r"==t.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(r.push(o.slice(0,l)),e+=l+1):(r.push(o),e=i+1)}return r}:function(t){return t.split(/\r\n?|\n/)};t.splitLines=Ei;var zi=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(e){return!1}}:function(t){try{var e=t.ownerDocument.selection.createRange()}catch(r){}return e&&e.parentElement()==t?0!=e.compareEndPoints("StartToEnd",e):!1},Ii=function(){var t=sn("div");return"oncopy"in t?!0:(t.setAttribute("oncopy","return;"),"function"==typeof t.oncopy)}(),Fi={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};t.keyNames=Fi,function(){for(var t=0;10>t;t++)Fi[t+48]=String(t);for(var t=65;90>=t;t++)Fi[t]=String.fromCharCode(t);for(var t=1;12>=t;t++)Fi[t+111]=Fi[t+63235]="F"+t}();var Pi,Ri=function(){function t(t){return 255>=t?e.charAt(t):t>=1424&&1524>=t?"R":t>=1536&&1791>=t?r.charAt(t-1536):t>=1792&&2220>=t?"r":"L"}var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",r="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,l=/[Lb1n]/,s=/[1n]/,a="L";return function(e){if(!n.test(e))return!1;for(var r,u=e.length,c=[],f=0;u>f;++f)c.push(r=t(e.charCodeAt(f)));for(var f=0,h=a;u>f;++f){var r=c[f];"m"==r?c[f]=h:h=r}for(var f=0,d=a;u>f;++f){var r=c[f];"1"==r&&"r"==d?c[f]="n":o.test(r)&&(d=r,"r"==r&&(c[f]="R"))}for(var f=1,h=c[0];u-1>f;++f){var r=c[f];"+"==r&&"1"==h&&"1"==c[f+1]?c[f]="1":","!=r||h!=c[f+1]||"1"!=h&&"n"!=h||(c[f]=h),h=r}for(var f=0;u>f;++f){var r=c[f];if(","==r)c[f]="N";else if("%"==r){for(var p=f+1;u>p&&"%"==c[p];++p);for(var g=f&&"!"==c[f-1]||u-1>p&&"1"==c[p]?"1":"N",m=f;p>m;++m)c[m]=g;f=p-1}}for(var f=0,d=a;u>f;++f){var r=c[f];"L"==d&&"1"==r?c[f]="L":o.test(r)&&(d=r)}for(var f=0;u>f;++f)if(i.test(c[f])){for(var p=f+1;u>p&&i.test(c[p]);++p);for(var v="L"==(f?c[f-1]:a),y="L"==(u-1>p?c[p]:a),g=v||y?"L":"R",m=f;p>m;++m)c[m]=g;f=p-1}for(var b,x=[],f=0;u>f;)if(l.test(c[f])){var C=f;for(++f;u>f&&l.test(c[f]);++f);x.push({from:C,to:f,level:0})}else{var w=f,L=x.length;for(++f;u>f&&"L"!=c[f];++f);for(var m=w;f>m;)if(s.test(c[m])){m>w&&x.splice(L,0,{from:w,to:m,level:1});var k=m;for(++m;f>m&&s.test(c[m]);++m);x.splice(L,0,{from:k,to:m,level:2}),w=m}else++m;f>w&&x.splice(L,0,{from:w,to:f,level:1})}return 1==x[0].level&&(b=e.match(/^\s+/))&&(x[0].from=b[0].length,x.unshift({from:0,to:b[0].length,level:0})),1==qr(x).level&&(b=e.match(/\s+$/))&&(qr(x).to-=b[0].length,x.push({from:u-b[0].length,to:u,level:0})),x[0].level!=qr(x).level&&x.push({from:u,to:u,level:x[0].level}),x}}();return t.version="3.20.0",t}(); CodeMirror.defineMode("xml",function(t,e){function r(t,e){function r(r){return e.tokenize=r,r(t,e)}var o=t.next();if("<"==o){if(t.eat("!"))return t.eat("[")?t.match("CDATA[")?r(a("atom","]]>")):null:t.match("--")?r(a("comment","-->")):t.match("DOCTYPE",!0,!0)?(t.eatWhile(/[\w\._\-]/),r(i(1))):null;if(t.eat("?"))return t.eatWhile(/[\w\._\-]/),e.tokenize=a("meta","?>"),"meta";var l=t.eat("/");b="";for(var u;u=t.eat(/[^\s\u00a0=<>\"\'\/?]/);)b+=u;return b?(C=l?"closeTag":"openTag",e.tokenize=n,"tag"):"tag error"}if("&"==o){var f;return f=t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";"),f?"atom":"error"}return t.eatWhile(/[^&<]/),null}function n(t,e){var n=t.next();if(">"==n||"/"==n&&t.eat(">"))return e.tokenize=r,C=">"==n?"endTag":"selfcloseTag","tag";if("="==n)return C="equals",null;if("<"==n){e.tokenize=r;var a=e.tokenize(t,e);return a?a+" error":"error"}return/[\'\"]/.test(n)?(e.tokenize=o(n),e.stringStartCol=t.column(),e.tokenize(t,e)):(t.eatWhile(/[^\s\u00a0=<>\"\']/),"word")}function o(t){var e=function(e,r){for(;!e.eol();)if(e.next()==t){r.tokenize=n;break}return"string"};return e.isInAttribute=!0,e}function a(t,e){return function(n,o){for(;!n.eol();){if(n.match(e)){o.tokenize=r;break}n.next()}return t}}function i(t){return function(e,n){for(var o;null!=(o=e.next());){if("<"==o)return n.tokenize=i(t+1),n.tokenize(e,n);if(">"==o){if(1==t){n.tokenize=r;break}return n.tokenize=i(t-1),n.tokenize(e,n)}}return"meta"}}function l(){for(var t=arguments.length-1;t>=0;t--)w.cc.push(arguments[t])}function u(){return l.apply(null,arguments),!0}function f(t,e){var r=N.doNotIndent.hasOwnProperty(t)||w.context&&w.context.noIndent;w.context={prev:w.context,tagName:t,indent:w.indented,startOfLine:e,noIndent:r}}function d(){w.context&&(w.context=w.context.prev)}function c(t){if("openTag"==t)return w.tagName=b,w.tagStart=T.column(),u(p,s(w.startOfLine));if("closeTag"==t){var e=!1;return w.context?w.context.tagName!=b&&(N.implicitlyClosed.hasOwnProperty(w.context.tagName.toLowerCase())&&d(),e=!w.context||w.context.tagName!=b):e=!0,e&&(v="error"),u(m(e))}return u()}function s(t){return function(e){var r=w.tagName;return w.tagName=w.tagStart=null,"selfcloseTag"==e||"endTag"==e&&N.autoSelfClosers.hasOwnProperty(r.toLowerCase())?(g(r.toLowerCase()),u()):"endTag"==e?(g(r.toLowerCase()),f(r,t),u()):u()}}function m(t){return function(e){return t&&(v="error"),"endTag"==e?(d(),u()):(v="error",u(arguments.callee))}}function g(t){for(var e;;){if(!w.context)return;if(e=w.context.tagName.toLowerCase(),!N.contextGrabbers.hasOwnProperty(e)||!N.contextGrabbers[e].hasOwnProperty(t))return;d()}}function p(t){return"word"==t?(v="attribute",u(h,p)):"endTag"==t||"selfcloseTag"==t?l():(v="error",u(p))}function h(t){if("equals"==t)return u(x,p);if(N.allowMissing){if("word"==t)return v="attribute",u(h,p)}else v="error";return"endTag"==t||"selfcloseTag"==t?l():u()}function x(t){return"string"==t?u(k):"word"==t&&N.allowUnquoted?(v="string",u()):(v="error","endTag"==t||"selfCloseTag"==t?l():u())}function k(t){return"string"==t?u(k):l()}var b,C,w,T,v,z=t.indentUnit,M=e.multilineTagIndentFactor||1,y=e.multilineTagIndentPastTag||!0,N=e.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1},I=e.alignCDATA;return{startState:function(){return{tokenize:r,cc:[],indented:0,startOfLine:!0,tagName:null,tagStart:null,context:null}},token:function(t,e){if(!e.tagName&&t.sol()&&(e.startOfLine=!0,e.indented=t.indentation()),t.eatSpace())return null;v=C=b=null;var r=e.tokenize(t,e);if(e.type=C,(r||C)&&"comment"!=r)for(w=e,T=t;;){var n=e.cc.pop()||c;if(n(C||r))break}return e.startOfLine=!1,v&&(r="error"==v?r+" error":v),r},indent:function(t,e,o){var a=t.context;if(t.tokenize.isInAttribute)return t.stringStartCol+1;if(t.tokenize!=n&&t.tokenize!=r||a&&a.noIndent)return o?o.match(/^(\s*)/)[0].length:0;if(t.tagName)return y?t.tagStart+t.tagName.length+2:t.tagStart+z*M;if(I&&/",configuration:e.htmlMode?"html":"xml",helperType:e.htmlMode?"html":"xml"}}),CodeMirror.defineMIME("text/xml","xml"),CodeMirror.defineMIME("application/xml","xml"),CodeMirror.mimeModes.hasOwnProperty("text/html")||CodeMirror.defineMIME("text/html",{name:"xml",htmlMode:!0}); !function(){function e(e){for(var n=[/for\s*?\((.*?)\)/,/\"(.*?)(\"|$)/,/\'(.*?)(\'|$)/,/\/\*(.*?)(\*\/|$)/,/\/\/.*/],r=[],t=0;t"==a.charAt(d.pos-1)&&(m=d.pos),c.push({from:r,to:m,mode:s}),r=m,s=l}if(d.pos>=t)break;d.start=d.pos}return t>r&&c.push({from:r,to:t,mode:s}),c}CodeMirror.extendMode("css",{commentStart:"/*",commentEnd:"*/",wordWrapChars:[";","\\{","\\}"],autoFormatLineBreaks:function(e){return e.replace(new RegExp("(;|\\{|\\})([^\r\n])","g"),"$1\n$2")}}),CodeMirror.extendMode("javascript",{commentStart:"/*",commentEnd:"*/",wordWrapChars:[";","\\{","\\}"],autoFormatLineBreaks:function(n){var r=0,t=this.jsonMode?function(e){return e.replace(/([,{])/g,"$1\n").replace(/}/g,"\n}")}:function(e){return e.replace(/(;|\{|\})([^\r\n;])/g,"$1\n$2")},o=e(n),a="";if(null!=o){for(var i=0;ir&&(a+=t(n.substring(r,o[i].start)),r=o[i].start),o[i].start<=r&&o[i].end>=r&&(a+=n.substring(r,o[i].end),r=o[i].end);r",wordWrapChars:[">"],autoFormatLineBreaks:function(e){for(var n=e.split("\n"),r=new RegExp("(^\\s*?<|^[^<]*?)(.+)(>\\s*?$|[^>]*?$)"),t=new RegExp("<","g"),o=new RegExp("(>)([^\r\n])","g"),a=0;a3&&(n[a]=i[1]+i[2].replace(t,"\n$&").replace(o,"$1\n$2")+i[3])}return n.join("\n")}}),CodeMirror.defineExtension("commentRange",function(e,r,t){var o=n(this,r),a=this;this.operation(function(){if(e)a.replaceRange(o.commentEnd,t),a.replaceRange(o.commentStart,r),r.line==t.line&&r.ch==t.ch&&a.setCursor(r.line,r.ch+o.commentStart.length);else{var n=a.getRange(r,t),i=n.indexOf(o.commentStart),s=n.lastIndexOf(o.commentEnd);i>-1&&s>-1&&s>i&&(n=n.substr(0,i)+n.substring(i+o.commentStart.length,s)+n.substr(s+o.commentEnd.length)),a.replaceRange(n,r,t)}})}),CodeMirror.defineExtension("autoIndentRange",function(e,n){var r=this;this.operation(function(){for(var t=e.line;t<=n.line;t++)r.indentLine(t,"smart")})}),CodeMirror.defineExtension("autoFormatRange",function(e,n){var t=this;t.operation(function(){for(var o=e.line,a=n.line;a>=o;++o){for(var i={line:o,ch:o==e.line?e.ch:0},s={line:o,ch:o==a?n.ch:null},c=r(t,o,i.ch,s.ch),d="",l=t.getRange(i,s),m=0;m1?l.slice(c[m].from,c[m].to):l;d&&(d+="\n"),d+=c[m].mode.autoFormatLineBreaks?c[m].mode.autoFormatLineBreaks(u):l}if(d!=l){for(var f=0,g=d.indexOf("\n");-1!=g;g=d.indexOf("\n",g+1),++f);t.replaceRange(d,i,s),o+=f,a+=f}}for(var o=e.line+1;a>=o;++o)t.indentLine(o,"smart");t.setSelection(e,t.getCursor(!1))})})}(); /** * Super simple wysiwyg editor v0.7.1 * http://summernote.org/ * * summernote.js * Copyright 2013-2015 Alan Hong. and other contributors * summernote may be freely distributed under the MIT license./ * * * MODIFIED: Adding support for CodeMirror callbacks. * If we've got any callbacks for code mirror, register them. * Line 4670 * * Date: 2015-12-31T12:09Z */ !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=e(require("jquery")):e(window.jQuery)}(function(e){"use strict";var t,n=function(){var t=function(e){return function(t){return e===t}},n=function(e,t){return e===t},o=function(e){return function(t,n){return t[e]===n[e]}},i=function(){return!0},r=function(){return!1},a=function(e){return function(){return!e.apply(e,arguments)}},s=function(e,t){return function(n){return e(n)&&t(n)}},l=function(e){return e},c=0,d=function(e){var t=++c+"";return e?e+t:t},u=function(t){var n=e(document);return{top:t.top+n.scrollTop(),left:t.left+n.scrollLeft(),width:t.right-t.left,height:t.bottom-t.top}},f=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t},h=function(e,t){return t=t||"",t+e.split(".").map(function(e){return e.substring(0,1).toUpperCase()+e.substring(1)}).join("")};return{eq:t,eq2:n,peq2:o,ok:i,fail:r,self:l,not:a,and:s,uniqueId:d,rect2bnd:u,invertObject:f,namespaceToCamel:h}}(),o=function(){var t=function(e){return e[0]},o=function(e){return e[e.length-1]},i=function(e){return e.slice(0,e.length-1)},r=function(e){return e.slice(1)},a=function(e,t){for(var n=0,o=e.length;o>n;n++){var i=e[n];if(t(i))return i}},s=function(e,t){for(var n=0,o=e.length;o>n;n++)if(!t(e[n]))return!1;return!0},l=function(t,n){return e.inArray(n,t)},c=function(e,t){return-1!==l(e,t)},d=function(e,t){return t=t||n.self,e.reduce(function(e,n){return e+t(n)},0)},u=function(e){for(var t=[],n=-1,o=e.length;++nn;n++)e[n]&&t.push(e[n]);return t},p=function(e){for(var t=[],n=0,o=e.length;o>n;n++)c(t,e[n])||t.push(e[n]);return t},g=function(e,t){var n=l(e,t);return-1===n?null:e[n+1]},v=function(e,t){var n=l(e,t);return-1===n?null:e[n-1]};return{head:t,last:o,initial:i,tail:r,prev:v,next:g,find:a,contains:c,all:s,sum:d,from:u,isEmpty:f,clusterBy:h,compact:m,unique:p}}(),i="function"==typeof define&&define.amd,r=function(t){var n="Comic Sans MS"===t?"Courier New":"Comic Sans MS",o=e("
").css({position:"absolute",left:"-9999px",top:"-9999px",fontSize:"200px"}).text("mmmmmmmmmwwwwwww").appendTo(document.body),i=o.css("fontFamily",n).width(),r=o.css("fontFamily",t+","+n).width();return o.remove(),i!==r},a=navigator.userAgent,s=/MSIE|Trident/i.test(a);if(s){var l=/MSIE (\d+[.]\d+)/.exec(a);l&&(t=parseFloat(l[1])),l=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(a),l&&(t=parseFloat(l[1]))}var c={isMac:navigator.appVersion.indexOf("Mac")>-1,isMSIE:s,isFF:/firefox/i.test(a),isWebkit:/webkit/i.test(a),isSafari:/safari/i.test(a),browserVersion:t,jqueryVersion:parseFloat(e.fn.jquery),isSupportAmd:i,hasCodeMirror:i?require.specified("codemirror"):!!window.CodeMirror,isFontInstalled:r,isW3CRangeSupport:!!document.createRange},d=String.fromCharCode(160),u="\ufeff",f=function(){var t=function(t){return t&&e(t).hasClass("note-editable")},i=function(t){return t&&e(t).hasClass("note-control-sizing")},r=function(e){return e=e.toUpperCase(),function(t){return t&&t.nodeName.toUpperCase()===e}},a=function(e){return e&&3===e.nodeType},s=function(e){return e&&1===e.nodeType},l=function(e){return e&&/^BR|^IMG|^HR|^IFRAME|^BUTTON/.test(e.nodeName.toUpperCase())},h=function(e){return t(e)?!1:e&&/^DIV|^P|^LI|^H[1-7]/.test(e.nodeName.toUpperCase())},m=function(e){return e&&/^H[1-7]/.test(e.nodeName.toUpperCase())},p=r("PRE"),g=r("LI"),v=function(e){return h(e)&&!g(e)},b=r("TABLE"),k=function(e){return!(T(e)||y(e)||C(e)||h(e)||b(e)||N(e))},y=function(e){return e&&/^UL|^OL/.test(e.nodeName.toUpperCase())},C=r("HR"),w=function(e){return e&&/^TD|^TH/.test(e.nodeName.toUpperCase())},N=r("BLOCKQUOTE"),T=function(e){return w(e)||N(e)||t(e)},I=r("A"),E=function(e){return k(e)&&!!D(e,h)},S=function(e){return k(e)&&!D(e,h)},H=r("BODY"),x=function(e,t){return e.nextSibling===t||e.previousSibling===t},P=function(e,t){t=t||n.ok;var o=[];return e.previousSibling&&t(e.previousSibling)&&o.push(e.previousSibling),o.push(e),e.nextSibling&&t(e.nextSibling)&&o.push(e.nextSibling),o},R=c.isMSIE&&c.browserVersion<11?" ":"
",L=function(e){return a(e)?e.nodeValue.length:e.childNodes.length},F=function(e){var t=L(e);return 0===t?!0:a(e)||1!==t||e.innerHTML!==R?o.all(e.childNodes,a)&&""===e.innerHTML?!0:!1:!0},A=function(e){l(e)||L(e)||(e.innerHTML=R)},D=function(e,n){for(;e;){if(n(e))return e;if(t(e))break;e=e.parentNode}return null},M=function(e,n){for(e=e.parentNode;e&&1===L(e);){if(n(e))return e;if(t(e))break;e=e.parentNode}return null},z=function(e,o){o=o||n.fail;var i=[];return D(e,function(e){return t(e)||i.push(e),o(e)}),i},B=function(e,t){var n=z(e);return o.last(n.filter(t))},U=function(t,n){for(var o=z(t),i=n;i;i=i.parentNode)if(e.inArray(i,o)>-1)return i;return null},$=function(e,t){t=t||n.fail;for(var o=[];e&&!t(e);)o.push(e),e=e.previousSibling;return o},O=function(e,t){t=t||n.fail;for(var o=[];e&&!t(e);)o.push(e),e=e.nextSibling;return o},j=function(e,t){var o=[];return t=t||n.ok,function i(n){e!==n&&t(n)&&o.push(n);for(var r=0,a=n.childNodes.length;a>r;r++)i(n.childNodes[r])}(e),o},K=function(t,n){var o=t.parentNode,i=e("<"+n+">")[0];return o.insertBefore(i,t),i.appendChild(t),i},V=function(e,t){var n=t.nextSibling,o=t.parentNode;return n?o.insertBefore(e,n):o.appendChild(e),e},W=function(t,n){return e.each(n,function(e,n){t.appendChild(n)}),t},q=function(e){return 0===e.offset},_=function(e){return e.offset===L(e.node)},G=function(e){return q(e)||_(e)},Y=function(e,t){for(;e&&e!==t;){if(0!==X(e))return!1;e=e.parentNode}return!0},Z=function(e,t){for(;e&&e!==t;){if(X(e)!==L(e.parentNode)-1)return!1;e=e.parentNode}return!0},J=function(e,t){return q(e)&&Y(e.node,t)},Q=function(e,t){return _(e)&&Z(e.node,t)},X=function(e){for(var t=0;e=e.previousSibling;)t+=1;return t},ee=function(e){return!!(e&&e.childNodes&&e.childNodes.length)},te=function(e,n){var o,i;if(0===e.offset){if(t(e.node))return null;o=e.node.parentNode,i=X(e.node)}else ee(e.node)?(o=e.node.childNodes[e.offset-1],i=L(o)):(o=e.node,i=n?0:e.offset-1);return{node:o,offset:i}},ne=function(e,n){var o,i;if(L(e.node)===e.offset){if(t(e.node))return null;o=e.node.parentNode,i=X(e.node)+1}else ee(e.node)?(o=e.node.childNodes[e.offset],i=0):(o=e.node,i=n?L(e.node):e.offset+1);return{node:o,offset:i}},oe=function(e,t){return e.node===t.node&&e.offset===t.offset},ie=function(e){if(a(e.node)||!ee(e.node)||F(e.node))return!0;var t=e.node.childNodes[e.offset-1],n=e.node.childNodes[e.offset];return t&&!l(t)||n&&!l(n)?!1:!0},re=function(e,t){for(;e;){if(t(e))return e;e=te(e)}return null},ae=function(e,t){for(;e;){if(t(e))return e;e=ne(e)}return null},se=function(e){if(!a(e.node))return!1;var t=e.node.nodeValue.charAt(e.offset-1);return t&&" "!==t&&t!==d},le=function(e,t,n,o){for(var i=e;i&&(n(i),!oe(i,t));){var r=o&&e.node!==i.node&&t.node!==i.node;i=ne(i,r)}},ce=function(e,t){var o=z(t,n.eq(e));return o.map(X).reverse()},de=function(e,t){for(var n=e,o=0,i=t.length;i>o;o++)n=n.childNodes.length<=t[o]?n.childNodes[n.childNodes.length-1]:n.childNodes[t[o]];return n},ue=function(e,t){var n=t&&t.isSkipPaddingBlankHTML,o=t&&t.isNotSplitEdgePoint;if(G(e)&&(a(e.node)||o)){if(q(e))return e.node;if(_(e))return e.node.nextSibling}if(a(e.node))return e.node.splitText(e.offset);var i=e.node.childNodes[e.offset],r=V(e.node.cloneNode(!1),e.node);return W(r,O(i)),n||(A(e.node),A(r)),r},fe=function(e,t,o){var i=z(t.node,n.eq(e));return i.length?1===i.length?ue(t,o):i.reduce(function(e,n){return e===t.node&&(e=ue(t,o)),ue({node:n,offset:e?f.position(e):L(n)},o)}):null},he=function(e,t){var n,i,r=t?h:T,a=z(e.node,r),s=o.last(a)||e.node;r(s)?(n=a[a.length-2],i=s):(n=s,i=n.parentNode);var l=n&&fe(n,e,{isSkipPaddingBlankHTML:t,isNotSplitEdgePoint:t});return l||i!==e.node||(l=e.node.childNodes[e.offset]),{rightNode:l,container:i}},me=function(e){return document.createElement(e)},pe=function(e){return document.createTextNode(e)},ge=function(e,t){if(e&&e.parentNode){if(e.removeNode)return e.removeNode(t);var n=e.parentNode;if(!t){var o,i,r=[];for(o=0,i=e.childNodes.length;i>o;o++)r.push(e.childNodes[o]);for(o=0,i=r.length;i>o;o++)n.insertBefore(r[o],e)}n.removeChild(e)}},ve=function(e,n){for(;e&&!t(e)&&n(e);){var o=e.parentNode;ge(e),e=o}},be=function(e,t){if(e.nodeName.toUpperCase()===t.toUpperCase())return e;var n=me(t);return e.style.cssText&&(n.style.cssText=e.style.cssText),W(n,o.from(e.childNodes)),V(n,e),ge(e),n},ke=r("TEXTAREA"),ye=function(e,t){var n=ke(e[0])?e.val():e.html();return t?n.replace(/[\n\r]/g,""):n},Ce=function(t,n){var o=ye(t);if(n){var i=/<(\/?)(\b(?!!)[^>\s]*)(.*?)(\s*\/?>)/g;o=o.replace(i,function(e,t,n){n=n.toUpperCase();var o=/^DIV|^TD|^TH|^P|^LI|^H[1-7]/.test(n)&&!!t,i=/^BLOCKQUOTE|^TABLE|^TBODY|^TR|^HR|^UL|^OL/.test(n);return e+(o||i?"\n":"")}),o=e.trim(o)}return o},we=function(t){var n=e(t),o=n.offset(),i=n.outerHeight(!0);return{left:o.left,top:o.top+i}},Ne=function(e,t){Object.keys(t).forEach(function(n){e.on(n,t[n])})},Te=function(e,t){Object.keys(t).forEach(function(n){e.off(n,t[n])})};return{NBSP_CHAR:d,ZERO_WIDTH_NBSP_CHAR:u,blank:R,emptyPara:"

"+R+"

",makePredByNodeName:r,isEditable:t,isControlSizing:i,isText:a,isElement:s,isVoid:l,isPara:h,isPurePara:v,isHeading:m,isInline:k,isBlock:n.not(k),isBodyInline:S,isBody:H,isParaInline:E,isPre:p,isList:y,isTable:b,isCell:w,isBlockquote:N,isBodyContainer:T,isAnchor:I,isDiv:r("DIV"),isLi:g,isBR:r("BR"),isSpan:r("SPAN"),isB:r("B"),isU:r("U"),isS:r("S"),isI:r("I"),isImg:r("IMG"),isTextarea:ke,isEmpty:F,isEmptyAnchor:n.and(I,F),isClosestSibling:x,withClosestSiblings:P,nodeLength:L,isLeftEdgePoint:q,isRightEdgePoint:_,isEdgePoint:G,isLeftEdgeOf:Y,isRightEdgeOf:Z,isLeftEdgePointOf:J,isRightEdgePointOf:Q,prevPoint:te,nextPoint:ne,isSamePoint:oe,isVisiblePoint:ie,prevPointUntil:re,nextPointUntil:ae,isCharPoint:se,walkPoint:le,ancestor:D,singleChildAncestor:M,listAncestor:z,lastAncestor:B,listNext:O,listPrev:$,listDescendant:j,commonAncestor:U,wrap:K,insertAfter:V,appendChildNodes:W,position:X,hasChildren:ee,makeOffsetPath:ce,fromOffsetPath:de,splitTree:fe,splitPoint:he,create:me,createText:pe,remove:ge,removeWhile:ve,replace:be,html:Ce,value:ye,posFromPlaceholder:we,attachEvents:Ne,detachEvents:Te}}(),h=function(t,i){var r=this,a=e.summernote.ui;return this.memos={},this.modules={},this.layoutInfo={},this.options=i,this.initialize=function(){return this.layoutInfo=a.createLayout(t,i),this._initialize(),t.hide(),this},this.destroy=function(){this._destroy(),t.removeData("summernote"),a.removeLayout(t,this.layoutInfo)},this.reset=function(){this.code(f.emptyPara),this._destroy(),this._initialize()},this._initialize=function(){var t=e.extend({},this.options.buttons);Object.keys(t).forEach(function(e){r.memo("button."+e,t[e])});var n=e.extend({},this.options.modules,e.summernote.plugins||{});Object.keys(n).forEach(function(e){r.module(e,n[e],!0)}),Object.keys(this.modules).forEach(function(e){r.initializeModule(e)})},this._destroy=function(){Object.keys(this.modules).reverse().forEach(function(e){r.removeModule(e)}),Object.keys(this.memos).forEach(function(e){r.removeMemo(e)})},this.code=function(e){var n=this.invoke("codeview.isActivated");return void 0===e?(this.invoke("codeview.sync"),n?this.layoutInfo.codable.val():this.layoutInfo.editable.html()):(n?this.layoutInfo.codable.val(e):this.layoutInfo.editable.html(e),t.val(e),this.triggerEvent("change",e),void 0)},this.isDisabled=function(){return"false"===this.layoutInfo.editable.attr("contenteditable")},this.enable=function(){this.layoutInfo.editable.attr("contenteditable",!0),this.invoke("toolbar.activate",!0)},this.disable=function(){this.invoke("codeview.isActivated")&&this.invoke("codeview.deactivate"),this.layoutInfo.editable.attr("contenteditable",!1),this.invoke("toolbar.deactivate",!0)},this.triggerEvent=function(){var e=o.head(arguments),i=o.tail(o.from(arguments)),r=this.options.callbacks[n.namespaceToCamel(e,"on")];r&&r.apply(t[0],i),t.trigger("summernote."+e,i)},this.initializeModule=function(e){var o=this.modules[e];o.shouldInitialize=o.shouldInitialize||n.ok,o.shouldInitialize()&&(o.initialize&&o.initialize(),o.events&&f.attachEvents(t,o.events))},this.module=function(e,t,n){return 1===arguments.length?this.modules[e]:(this.modules[e]=new t(this),void(n||this.initializeModule(e)))},this.removeModule=function(e){var n=this.modules[e];n.shouldInitialize()&&(n.events&&f.detachEvents(t,n.events),n.destroy&&n.destroy()),delete this.modules[e]},this.memo=function(e,t){return 1===arguments.length?this.memos[e]:void(this.memos[e]=t)},this.removeMemo=function(e){this.memos[e]&&this.memos[e].destroy&&this.memos[e].destroy(),delete this.memos[e]},this.createInvokeHandler=function(t,n){return function(o){o.preventDefault(),r.invoke(t,n||e(o.target).data("value")||e(o.currentTarget).data("value"))}},this.invoke=function(){var e=o.head(arguments),t=o.tail(o.from(arguments)),n=e.split("."),i=n.length>1,r=i&&o.head(n),a=i?o.last(n):o.head(n),s=this.modules[r||"editor"];return!r&&this[a]?this[a].apply(this,t):s&&s[a]&&s.shouldInitialize()?s[a].apply(s,t):void 0},this.initialize()};e.summernote=e.summernote||{lang:{}},e.fn.extend({summernote:function(){var t=e.type(o.head(arguments)),n="string"===t,i="object"===t,r=i?o.head(arguments):{};r=e.extend({},e.summernote.options,r),r.langInfo=e.extend(!0,{},e.summernote.lang["en-US"],e.summernote.lang[r.lang]),this.each(function(t,n){var o=e(n);if(!o.data("summernote")){var i=new h(o,r);o.data("summernote",i),o.data("summernote").triggerEvent("init",i.layoutInfo)}});var a=this.first();if(a.length){var s=a.data("summernote");if(n)return s.invoke.apply(s,o.from(arguments));r.focus&&s.invoke("editor.focus")}return this}});var m=function(t,n,o,i){this.render=function(r){var a=e(t);if(o&&o.contents&&a.html(o.contents),o&&o.className&&a.addClass(o.className),o&&o.data&&e.each(o.data,function(e,t){a.attr("data-"+e,t)}),o&&o.click&&a.on("click",o.click),n){var s=a.find(".note-children-container");n.forEach(function(e){e.render(s.length?s:a)})}return i&&i(a,o),o&&o.callback&&o.callback(a),r&&r.append(a),a}},p={create:function(t,n){return function(){var o=e.isArray(arguments[0])?arguments[0]:[],i="object"==typeof arguments[1]?arguments[1]:arguments[0];return i&&i.children&&(o=i.children),new m(t,o,i,n)}}},g=p.create('
'),v=p.create('
'),b=p.create('
'),k=p.create('