if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(n){"use strict";function t(){var i=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},n;for(n in t)if(void 0!==i.style[n])return{end:t[n]};return!1}n.fn.emulateTransitionEnd=function(t){var i=!1,u=this,r;n(this).one("bsTransitionEnd",function(){i=!0});return r=function(){i||n(u).trigger(n.support.transition.end)},setTimeout(r,t),this};n(function(){n.support.transition=t();n.support.transition&&(n.event.special.bsTransitionEnd={bindType:n.support.transition.end,delegateType:n.support.transition.end,handle:function(t){if(n(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}})})}(jQuery);+function(n){"use strict";function u(i){return this.each(function(){var r=n(this),u=r.data("bs.alert");u||r.data("bs.alert",u=new t(this));"string"==typeof i&&u[i].call(r)})}var i='[data-dismiss="alert"]',t=function(t){n(t).on("click",i,this.close)},r;t.VERSION="3.2.0";t.prototype.close=function(t){function f(){i.detach().trigger("closed.bs.alert").remove()}var u=n(this),r=u.attr("data-target"),i;r||(r=u.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,""));i=n(r);t&&t.preventDefault();i.length||(i=u.hasClass("alert")?u:u.parent());i.trigger(t=n.Event("close.bs.alert"));t.isDefaultPrevented()||(i.removeClass("in"),n.support.transition&&i.hasClass("fade")?i.one("bsTransitionEnd",f).emulateTransitionEnd(150):f())};r=n.fn.alert;n.fn.alert=u;n.fn.alert.Constructor=t;n.fn.alert.noConflict=function(){return n.fn.alert=r,this};n(document).on("click.bs.alert.data-api",i,t.prototype.close)}(jQuery);+function(n){"use strict";function i(i){return this.each(function(){var u=n(this),r=u.data("bs.button"),f="object"==typeof i&&i;r||u.data("bs.button",r=new t(this,f));"toggle"==i?r.toggle():i&&r.setState(i)})}var t=function(i,r){this.$element=n(i);this.options=n.extend({},t.DEFAULTS,r);this.isLoading=!1},r;t.VERSION="3.2.0";t.DEFAULTS={loadingText:"loading..."};t.prototype.setState=function(t){var r="disabled",i=this.$element,f=i.is("input")?"val":"html",u=i.data();t+="Text";null==u.resetText&&i.data("resetText",i[f]());i[f](null==u[t]?this.options[t]:u[t]);setTimeout(n.proxy(function(){"loadingText"==t?(this.isLoading=!0,i.addClass(r).attr(r,r)):this.isLoading&&(this.isLoading=!1,i.removeClass(r).removeAttr(r))},this),0)};t.prototype.toggle=function(){var t=!0,i=this.$element.closest('[data-toggle="buttons"]'),n;i.length&&(n=this.$element.find("input"),"radio"==n.prop("type")&&(n.prop("checked")&&this.$element.hasClass("active")?t=!1:i.find(".active").removeClass("active")),t&&n.prop("checked",!this.$element.hasClass("active")).trigger("change"));t&&this.$element.toggleClass("active")};r=n.fn.button;n.fn.button=i;n.fn.button.Constructor=t;n.fn.button.noConflict=function(){return n.fn.button=r,this};n(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(t){var r=n(t.target);r.hasClass("btn")||(r=r.closest(".btn"));i.call(r,"toggle");t.preventDefault()})}(jQuery);+function(n){"use strict";function i(i){return this.each(function(){var u=n(this),r=u.data("bs.carousel"),f=n.extend({},t.DEFAULTS,u.data(),"object"==typeof i&&i),e="string"==typeof i?i:f.slide;r||u.data("bs.carousel",r=new t(this,f));"number"==typeof i?r.to(i):e?r[e]():f.interval&&r.pause().cycle()})}var t=function(t,i){this.$element=n(t).on("keydown.bs.carousel",n.proxy(this.keydown,this));this.$indicators=this.$element.find(".carousel-indicators");this.options=i;this.paused=this.sliding=this.interval=this.$active=this.$items=null;"hover"==this.options.pause&&this.$element.on("mouseenter.bs.carousel",n.proxy(this.pause,this)).on("mouseleave.bs.carousel",n.proxy(this.cycle,this))},r;t.VERSION="3.2.0";t.DEFAULTS={interval:5e3,pause:"hover",wrap:!0};t.prototype.keydown=function(n){switch(n.which){case 37:this.prev();break;case 39:this.next();break;default:return}n.preventDefault()};t.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(n.proxy(this.next,this),this.options.interval)),this};t.prototype.getItemIndex=function(n){return this.$items=n.parent().children(".item"),this.$items.index(n||this.$active)};t.prototype.to=function(t){var r=this,i=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(t>this.$items.length-1)&&!(0>t))return this.sliding?this.$element.one("slid.bs.carousel",function(){r.to(t)}):i==t?this.pause().cycle():this.slide(t>i?"next":"prev",n(this.$items[t]))};t.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&n.support.transition&&(this.$element.trigger(n.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this};t.prototype.next=function(){if(!this.sliding)return this.slide("next")};t.prototype.prev=function(){if(!this.sliding)return this.slide("prev")};t.prototype.slide=function(t,i){var u=this.$element.find(".item.active"),r=i||u[t](),c=this.interval,f="next"==t?"left":"right",a="next"==t?"first":"last",l=this,e,o,s,h;if(!r.length){if(!this.options.wrap)return;r=this.$element.find(".item")[a]()}return r.hasClass("active")?this.sliding=!1:(e=r[0],o=n.Event("slide.bs.carousel",{relatedTarget:e,direction:f}),(this.$element.trigger(o),!o.isDefaultPrevented())?((this.sliding=!0,c&&this.pause(),this.$indicators.length)&&(this.$indicators.find(".active").removeClass("active"),s=n(this.$indicators.children()[this.getItemIndex(r)]),s&&s.addClass("active")),h=n.Event("slid.bs.carousel",{relatedTarget:e,direction:f}),n.support.transition&&this.$element.hasClass("slide")?(r.addClass(t),r[0].offsetWidth,u.addClass(f),r.addClass(f),u.one("bsTransitionEnd",function(){r.removeClass([t,f].join(" ")).addClass("active");u.removeClass(["active",f].join(" "));l.sliding=!1;setTimeout(function(){l.$element.trigger(h)},0)}).emulateTransitionEnd(1e3*u.css("transition-duration").slice(0,-1))):(u.removeClass("active"),r.addClass("active"),this.sliding=!1,this.$element.trigger(h)),c&&this.cycle(),this):void 0)};r=n.fn.carousel;n.fn.carousel=i;n.fn.carousel.Constructor=t;n.fn.carousel.noConflict=function(){return n.fn.carousel=r,this};n(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(t){var o,r=n(this),u=n(r.attr("data-target")||(o=r.attr("href"))&&o.replace(/.*(?=#[^\s]+$)/,"")),e,f;u.hasClass("carousel")&&(e=n.extend({},u.data(),r.data()),f=r.attr("data-slide-to"),f&&(e.interval=!1),i.call(u,e),f&&u.data("bs.carousel").to(f),t.preventDefault())});n(window).on("load",function(){n('[data-ride="carousel"]').each(function(){var t=n(this);i.call(t,t.data())})})}(jQuery);+function(n){"use strict";function i(i){return this.each(function(){var u=n(this),r=u.data("bs.collapse"),f=n.extend({},t.DEFAULTS,u.data(),"object"==typeof i&&i);!r&&f.toggle&&"show"==i&&(i=!i);r||u.data("bs.collapse",r=new t(this,f));"string"==typeof i&&r[i]()})}var t=function(i,r){this.$element=n(i);this.options=n.extend({},t.DEFAULTS,r);this.transitioning=null;this.options.parent&&(this.$parent=n(this.options.parent));this.options.toggle&&this.toggle()},r;t.VERSION="3.2.0";t.DEFAULTS={toggle:!0};t.prototype.dimension=function(){var n=this.$element.hasClass("width");return n?"width":"height"};t.prototype.show=function(){var f,t,u,r,e,o;if(!this.transitioning&&!this.$element.hasClass("in")&&(f=n.Event("show.bs.collapse"),this.$element.trigger(f),!f.isDefaultPrevented())){if(t=this.$parent&&this.$parent.find("> .panel > .in"),t&&t.length){if(u=t.data("bs.collapse"),u&&u.transitioning)return;i.call(t,"hide");u||t.data("bs.collapse",null)}if(r=this.dimension(),this.$element.removeClass("collapse").addClass("collapsing")[r](0),this.transitioning=1,e=function(){this.$element.removeClass("collapsing").addClass("collapse in")[r]("");this.transitioning=0;this.$element.trigger("shown.bs.collapse")},!n.support.transition)return e.call(this);o=n.camelCase(["scroll",r].join("-"));this.$element.one("bsTransitionEnd",n.proxy(e,this)).emulateTransitionEnd(350)[r](this.$element[0][o])}};t.prototype.hide=function(){var i,t,r;if(!this.transitioning&&this.$element.hasClass("in")&&(i=n.Event("hide.bs.collapse"),this.$element.trigger(i),!i.isDefaultPrevented()))return t=this.dimension(),this.$element[t](this.$element[t]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1,r=function(){this.transitioning=0;this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")},n.support.transition?void this.$element[t](0).one("bsTransitionEnd",n.proxy(r,this)).emulateTransitionEnd(350):r.call(this)};t.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};r=n.fn.collapse;n.fn.collapse=i;n.fn.collapse.Constructor=t;n.fn.collapse.noConflict=function(){return n.fn.collapse=r,this};n(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(t){var o,r=n(this),h=r.attr("data-target")||t.preventDefault()||(o=r.attr("href"))&&o.replace(/.*(?=#[^\s]+$)/,""),u=n(h),f=u.data("bs.collapse"),c=f?"toggle":r.data(),e=r.attr("data-parent"),s=e&&n(e);f&&f.transitioning||(s&&s.find('[data-toggle="collapse"][data-parent="'+e+'"]').not(r).addClass("collapsed"),r[u.hasClass("in")?"addClass":"removeClass"]("collapsed"));i.call(u,c)})}(jQuery);+function(n){"use strict";function r(t){t&&3===t.which||(n(o).remove(),n(i).each(function(){var i=u(n(this)),r={relatedTarget:this};i.hasClass("open")&&(i.trigger(t=n.Event("hide.bs.dropdown",r)),t.isDefaultPrevented()||i.removeClass("open").trigger("hidden.bs.dropdown",r))}))}function u(t){var i=t.attr("data-target"),r;return i||(i=t.attr("href"),i=i&&/#[A-Za-z]/.test(i)&&i.replace(/.*(?=#[^\s]*$)/,"")),r=i&&n(i),r&&r.length?r:t.parent()}function e(i){return this.each(function(){var r=n(this),u=r.data("bs.dropdown");u||r.data("bs.dropdown",u=new t(this));"string"==typeof i&&u[i].call(r)})}var o=".dropdown-backdrop",i='[data-toggle="dropdown"]',t=function(t){n(t).on("click.bs.dropdown",this.toggle)},f;t.VERSION="3.2.0";t.prototype.toggle=function(t){var f=n(this),i,o,e;if(!f.is(".disabled, :disabled")){if(i=u(f),o=i.hasClass("open"),r(),!o){if("ontouchstart"in document.documentElement&&!i.closest(".navbar-nav").length&&n('<div class="dropdown-backdrop"/>').insertAfter(n(this)).on("click",r),e={relatedTarget:this},i.trigger(t=n.Event("show.bs.dropdown",e)),t.isDefaultPrevented())return;f.trigger("focus");i.toggleClass("open").trigger("shown.bs.dropdown",e)}return!1}};t.prototype.keydown=function(t){var e,o,s,h,f,r;if(/(38|40|27)/.test(t.keyCode)&&(e=n(this),t.preventDefault(),t.stopPropagation(),!e.is(".disabled, :disabled"))){if(o=u(e),s=o.hasClass("open"),!s||s&&27==t.keyCode)return 27==t.which&&o.find(i).trigger("focus"),e.trigger("click");h=" li:not(.divider):visible a";f=o.find('[role="menu"]'+h+', [role="listbox"]'+h);f.length&&(r=f.index(f.filter(":focus")),38==t.keyCode&&r>0&&r--,40==t.keyCode&&r<f.length-1&&r++,~r||(r=0),f.eq(r).trigger("focus"))}};f=n.fn.dropdown;n.fn.dropdown=e;n.fn.dropdown.Constructor=t;n.fn.dropdown.noConflict=function(){return n.fn.dropdown=f,this};n(document).on("click.bs.dropdown.data-api",r).on("click.bs.dropdown.data-api",".dropdown form",function(n){n.stopPropagation()}).on("click.bs.dropdown.data-api",i,t.prototype.toggle).on("keydown.bs.dropdown.data-api",i+', [role="menu"], [role="listbox"]',t.prototype.keydown)}(jQuery);+function(n){"use strict";function i(i,r){return this.each(function(){var f=n(this),u=f.data("bs.modal"),e=n.extend({},t.DEFAULTS,f.data(),"object"==typeof i&&i);u||f.data("bs.modal",u=new t(this,e));"string"==typeof i?u[i](r):e.show&&u.show(r)})}var t=function(t,i){this.options=i;this.$body=n(document.body);this.$element=n(t);this.$backdrop=this.isShown=null;this.scrollbarWidth=0;this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,n.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))},r;t.VERSION="3.2.0";t.DEFAULTS={backdrop:!0,keyboard:!0,show:!0};t.prototype.toggle=function(n){return this.isShown?this.hide():this.show(n)};t.prototype.show=function(t){var i=this,r=n.Event("show.bs.modal",{relatedTarget:t});this.$element.trigger(r);this.isShown||r.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.$body.addClass("modal-open"),this.setScrollbar(),this.escape(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',n.proxy(this.hide,this)),this.backdrop(function(){var u=n.support.transition&&i.$element.hasClass("fade"),r;i.$element.parent().length||i.$element.appendTo(i.$body);i.$element.show().scrollTop(0);u&&i.$element[0].offsetWidth;i.$element.addClass("in").attr("aria-hidden",!1);i.enforceFocus();r=n.Event("shown.bs.modal",{relatedTarget:t});u?i.$element.find(".modal-dialog").one("bsTransitionEnd",function(){i.$element.trigger("focus").trigger(r)}).emulateTransitionEnd(300):i.$element.trigger("focus").trigger(r)}))};t.prototype.hide=function(t){t&&t.preventDefault();t=n.Event("hide.bs.modal");this.$element.trigger(t);this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,this.$body.removeClass("modal-open"),this.resetScrollbar(),this.escape(),n(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),n.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",n.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())};t.prototype.enforceFocus=function(){n(document).off("focusin.bs.modal").on("focusin.bs.modal",n.proxy(function(n){this.$element[0]===n.target||this.$element.has(n.target).length||this.$element.trigger("focus")},this))};t.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",n.proxy(function(n){27==n.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")};t.prototype.hideModal=function(){var n=this;this.$element.hide();this.backdrop(function(){n.$element.trigger("hidden.bs.modal")})};t.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove();this.$backdrop=null};t.prototype.backdrop=function(t){var f=this,u=this.$element.hasClass("fade")?"fade":"",i,r;if(this.isShown&&this.options.backdrop){if(i=n.support.transition&&u,this.$backdrop=n('<div class="modal-backdrop '+u+'" />').appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",n.proxy(function(n){n.target===n.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),i&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!t)return;i?this.$backdrop.one("bsTransitionEnd",t).emulateTransitionEnd(150):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),r=function(){f.removeBackdrop();t&&t()},n.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",r).emulateTransitionEnd(150):r()):t&&t()};t.prototype.checkScrollbar=function(){document.body.clientWidth>=window.innerWidth||(this.scrollbarWidth=this.scrollbarWidth||this.measureScrollbar())};t.prototype.setScrollbar=function(){var n=parseInt(this.$body.css("padding-right")||0,10);this.scrollbarWidth&&this.$body.css("padding-right",n+this.scrollbarWidth)};t.prototype.resetScrollbar=function(){this.$body.css("padding-right","")};t.prototype.measureScrollbar=function(){var n=document.createElement("div"),t;return n.className="modal-scrollbar-measure",this.$body.append(n),t=n.offsetWidth-n.clientWidth,this.$body[0].removeChild(n),t};r=n.fn.modal;n.fn.modal=i;n.fn.modal.Constructor=t;n.fn.modal.noConflict=function(){return n.fn.modal=r,this};n(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(t){var r=n(this),f=r.attr("href"),u=n(r.attr("data-target")||f&&f.replace(/.*(?=#[^\s]+$)/,"")),e=u.data("bs.modal")?"toggle":n.extend({remote:!/#/.test(f)&&f},u.data(),r.data());r.is("a")&&t.preventDefault();u.one("show.bs.modal",function(n){n.isDefaultPrevented()||u.one("hidden.bs.modal",function(){r.is(":visible")&&r.trigger("focus")})});i.call(u,e,this)})}(jQuery);+function(n){"use strict";function r(i){return this.each(function(){var u=n(this),r=u.data("bs.tooltip"),f="object"==typeof i&&i;(r||"destroy"!=i)&&(r||u.data("bs.tooltip",r=new t(this,f)),"string"==typeof i&&r[i]())})}var t=function(n,t){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null;this.init("tooltip",n,t)},i;t.VERSION="3.2.0";t.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"><\/div><div class="tooltip-inner"><\/div><\/div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}};t.prototype.init=function(t,i,r){var f,e,u,o,s;for(this.enabled=!0,this.type=t,this.$element=n(i),this.options=this.getOptions(r),this.$viewport=this.options.viewport&&n(this.options.viewport.selector||this.options.viewport),f=this.options.trigger.split(" "),e=f.length;e--;)if(u=f[e],"click"==u)this.$element.on("click."+this.type,this.options.selector,n.proxy(this.toggle,this));else"manual"!=u&&(o="hover"==u?"mouseenter":"focusin",s="hover"==u?"mouseleave":"focusout",this.$element.on(o+"."+this.type,this.options.selector,n.proxy(this.enter,this)),this.$element.on(s+"."+this.type,this.options.selector,n.proxy(this.leave,this)));this.options.selector?this._options=n.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()};t.prototype.getDefaults=function(){return t.DEFAULTS};t.prototype.getOptions=function(t){return t=n.extend({},this.getDefaults(),this.$element.data(),t),t.delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t};t.prototype.getDelegateOptions=function(){var t={},i=this.getDefaults();return this._options&&n.each(this._options,function(n,r){i[n]!=r&&(t[n]=r)}),t};t.prototype.enter=function(t){var i=t instanceof this.constructor?t:n(t.currentTarget).data("bs."+this.type);return i||(i=new this.constructor(t.currentTarget,this.getDelegateOptions()),n(t.currentTarget).data("bs."+this.type,i)),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()};t.prototype.leave=function(t){var i=t instanceof this.constructor?t:n(t.currentTarget).data("bs."+this.type);return i||(i=new this.constructor(t.currentTarget,this.getDelegateOptions()),n(t.currentTarget).data("bs."+this.type,i)),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()};t.prototype.show=function(){var h=n.Event("show.bs."+this.type),c,y,s;if(this.hasContent()&&this.enabled){if(this.$element.trigger(h),c=n.contains(document.documentElement,this.$element[0]),h.isDefaultPrevented()||!c)return;var f=this,i=this.tip(),l=this.getUID(this.type);this.setContent();i.attr("id",l);this.$element.attr("aria-describedby",l);this.options.animation&&i.addClass("fade");var t="function"==typeof this.options.placement?this.options.placement.call(this,i[0],this.$element[0]):this.options.placement,a=/\s?auto?\s?/i,v=a.test(t);v&&(t=t.replace(a,"")||"top");i.detach().css({top:0,left:0,display:"block"}).addClass(t).data("bs."+this.type,this);this.options.container?i.appendTo(this.options.container):i.insertAfter(this.$element);var r=this.getPosition(),e=i[0].offsetWidth,o=i[0].offsetHeight;if(v){var p=t,w=this.$element.parent(),u=this.getPosition(w);t="bottom"==t&&r.top+r.height+o-u.scroll>u.height?"top":"top"==t&&r.top-u.scroll-o<0?"bottom":"right"==t&&r.right+e>u.width?"left":"left"==t&&r.left-e<u.left?"right":t;i.removeClass(p).addClass(t)}y=this.getCalculatedOffset(t,r,e,o);this.applyPlacement(y,t);s=function(){f.$element.trigger("shown.bs."+f.type);f.hoverState=null};n.support.transition&&this.$tip.hasClass("fade")?i.one("bsTransitionEnd",s).emulateTransitionEnd(150):s()}};t.prototype.applyPlacement=function(t,i){var r=this.tip(),c=r[0].offsetWidth,e=r[0].offsetHeight,o=parseInt(r.css("margin-top"),10),s=parseInt(r.css("margin-left"),10),h,f,u;isNaN(o)&&(o=0);isNaN(s)&&(s=0);t.top=t.top+o;t.left=t.left+s;n.offset.setOffset(r[0],n.extend({using:function(n){r.css({top:Math.round(n.top),left:Math.round(n.left)})}},t),0);r.addClass("in");h=r[0].offsetWidth;f=r[0].offsetHeight;"top"==i&&f!=e&&(t.top=t.top+e-f);u=this.getViewportAdjustedDelta(i,t,h,f);u.left?t.left+=u.left:t.top+=u.top;var l=u.left?2*u.left-c+h:2*u.top-e+f,a=u.left?"left":"top",v=u.left?"offsetWidth":"offsetHeight";r.offset(t);this.replaceArrow(l,r[0][v],a)};t.prototype.replaceArrow=function(n,t,i){this.arrow().css(i,n?50*(1-n/t)+"%":"")};t.prototype.setContent=function(){var n=this.tip(),t=this.getTitle();n.find(".tooltip-inner")[this.options.html?"html":"text"](t);n.removeClass("fade in top bottom left right")};t.prototype.hide=function(){function r(){"in"!=t.hoverState&&i.detach();t.$element.trigger("hidden.bs."+t.type)}var t=this,i=this.tip(),u=n.Event("hide.bs."+this.type);return this.$element.removeAttr("aria-describedby"),this.$element.trigger(u),u.isDefaultPrevented()?void 0:(i.removeClass("in"),n.support.transition&&this.$tip.hasClass("fade")?i.one("bsTransitionEnd",r).emulateTransitionEnd(150):r(),this.hoverState=null,this)};t.prototype.fixTitle=function(){var n=this.$element;(n.attr("title")||"string"!=typeof n.attr("data-original-title"))&&n.attr("data-original-title",n.attr("title")||"").attr("title","")};t.prototype.hasContent=function(){return this.getTitle()};t.prototype.getPosition=function(t){t=t||this.$element;var r=t[0],i="BODY"==r.tagName;return n.extend({},"function"==typeof r.getBoundingClientRect?r.getBoundingClientRect():null,{scroll:i?document.documentElement.scrollTop||document.body.scrollTop:t.scrollTop(),width:i?n(window).width():t.outerWidth(),height:i?n(window).height():t.outerHeight()},i?{top:0,left:0}:t.offset())};t.prototype.getCalculatedOffset=function(n,t,i,r){return"bottom"==n?{top:t.top+t.height,left:t.left+t.width/2-i/2}:"top"==n?{top:t.top-r,left:t.left+t.width/2-i/2}:"left"==n?{top:t.top+t.height/2-r/2,left:t.left-i}:{top:t.top+t.height/2-r/2,left:t.left+t.width}};t.prototype.getViewportAdjustedDelta=function(n,t,i,r){var f={top:0,left:0},e,u,o,s,h,c;return this.$viewport?(e=this.options.viewport&&this.options.viewport.padding||0,u=this.getPosition(this.$viewport),/right|left/.test(n)?(o=t.top-e-u.scroll,s=t.top+e-u.scroll+r,o<u.top?f.top=u.top-o:s>u.top+u.height&&(f.top=u.top+u.height-s)):(h=t.left-e,c=t.left+e+i,h<u.left?f.left=u.left-h:c>u.width&&(f.left=u.left+u.width-c)),f):f};t.prototype.getTitle=function(){var t=this.$element,n=this.options;return t.attr("data-original-title")||("function"==typeof n.title?n.title.call(t[0]):n.title)};t.prototype.getUID=function(n){do n+=~~(1e6*Math.random());while(document.getElementById(n));return n};t.prototype.tip=function(){return this.$tip=this.$tip||n(this.options.template)};t.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")};t.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)};t.prototype.enable=function(){this.enabled=!0};t.prototype.disable=function(){this.enabled=!1};t.prototype.toggleEnabled=function(){this.enabled=!this.enabled};t.prototype.toggle=function(t){var i=this;t&&(i=n(t.currentTarget).data("bs."+this.type),i||(i=new this.constructor(t.currentTarget,this.getDelegateOptions()),n(t.currentTarget).data("bs."+this.type,i)));i.tip().hasClass("in")?i.leave(i):i.enter(i)};t.prototype.destroy=function(){clearTimeout(this.timeout);this.hide().$element.off("."+this.type).removeData("bs."+this.type)};i=n.fn.tooltip;n.fn.tooltip=r;n.fn.tooltip.Constructor=t;n.fn.tooltip.noConflict=function(){return n.fn.tooltip=i,this}}(jQuery);+function(n){"use strict";function r(i){return this.each(function(){var u=n(this),r=u.data("bs.popover"),f="object"==typeof i&&i;(r||"destroy"!=i)&&(r||u.data("bs.popover",r=new t(this,f)),"string"==typeof i&&r[i]())})}var t=function(n,t){this.init("popover",n,t)},i;if(!n.fn.tooltip)throw new Error("Popover requires tooltip.js");t.VERSION="3.2.0";t.DEFAULTS=n.extend({},n.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"><\/div><h3 class="popover-title"><\/h3><div class="popover-content"><\/div><\/div>'});t.prototype=n.extend({},n.fn.tooltip.Constructor.prototype);t.prototype.constructor=t;t.prototype.getDefaults=function(){return t.DEFAULTS};t.prototype.setContent=function(){var n=this.tip(),i=this.getTitle(),t=this.getContent();n.find(".popover-title")[this.options.html?"html":"text"](i);n.find(".popover-content").empty()[this.options.html?"string"==typeof t?"html":"append":"text"](t);n.removeClass("fade top bottom left right in");n.find(".popover-title").html()||n.find(".popover-title").hide()};t.prototype.hasContent=function(){return this.getTitle()||this.getContent()};t.prototype.getContent=function(){var t=this.$element,n=this.options;return t.attr("data-content")||("function"==typeof n.content?n.content.call(t[0]):n.content)};t.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};t.prototype.tip=function(){return this.$tip||(this.$tip=n(this.options.template)),this.$tip};i=n.fn.popover;n.fn.popover=r;n.fn.popover.Constructor=t;n.fn.popover.noConflict=function(){return n.fn.popover=i,this}}(jQuery);+function(n){"use strict";function t(i,r){var u=n.proxy(this.process,this);this.$body=n("body");this.$scrollElement=n(n(i).is("body")?window:i);this.options=n.extend({},t.DEFAULTS,r);this.selector=(this.options.target||"")+" .nav li > a";this.offsets=[];this.targets=[];this.activeTarget=null;this.scrollHeight=0;this.$scrollElement.on("scroll.bs.scrollspy",u);this.refresh();this.process()}function i(i){return this.each(function(){var u=n(this),r=u.data("bs.scrollspy"),f="object"==typeof i&&i;r||u.data("bs.scrollspy",r=new t(this,f));"string"==typeof i&&r[i]()})}t.VERSION="3.2.0";t.DEFAULTS={offset:10};t.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)};t.prototype.refresh=function(){var i="offset",r=0,t;n.isWindow(this.$scrollElement[0])||(i="position",r=this.$scrollElement.scrollTop());this.offsets=[];this.targets=[];this.scrollHeight=this.getScrollHeight();t=this;this.$body.find(this.selector).map(function(){var f=n(this),u=f.data("target")||f.attr("href"),t=/^#./.test(u)&&n(u);return t&&t.length&&t.is(":visible")&&[[t[i]().top+r,u]]||null}).sort(function(n,t){return n[0]-t[0]}).each(function(){t.offsets.push(this[0]);t.targets.push(this[1])})};t.prototype.process=function(){var n,r=this.$scrollElement.scrollTop()+this.options.offset,f=this.getScrollHeight(),e=this.options.offset+f-this.$scrollElement.height(),t=this.offsets,i=this.targets,u=this.activeTarget;if(this.scrollHeight!=f&&this.refresh(),r>=e)return u!=(n=i[i.length-1])&&this.activate(n);if(u&&r<=t[0])return u!=(n=i[0])&&this.activate(n);for(n=t.length;n--;)u!=i[n]&&r>=t[n]&&(!t[n+1]||r<=t[n+1])&&this.activate(i[n])};t.prototype.activate=function(t){this.activeTarget=t;n(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var r=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',i=n(r).parents("li").addClass("active");i.parent(".dropdown-menu").length&&(i=i.closest("li.dropdown").addClass("active"));i.trigger("activate.bs.scrollspy")};var r=n.fn.scrollspy;n.fn.scrollspy=i;n.fn.scrollspy.Constructor=t;n.fn.scrollspy.noConflict=function(){return n.fn.scrollspy=r,this};n(window).on("load.bs.scrollspy.data-api",function(){n('[data-spy="scroll"]').each(function(){var t=n(this);i.call(t,t.data())})})}(jQuery);+function(n){"use strict";function i(i){return this.each(function(){var u=n(this),r=u.data("bs.tab");r||u.data("bs.tab",r=new t(this));"string"==typeof i&&r[i]()})}var t=function(t){this.element=n(t)},r;t.VERSION="3.2.0";t.prototype.show=function(){var t=this.element,e=t.closest("ul:not(.dropdown-menu)"),i=t.data("target"),r,u,f;(i||(i=t.attr("href"),i=i&&i.replace(/.*(?=#[^\s]*$)/,"")),t.parent("li").hasClass("active"))||(r=e.find(".active:last a")[0],u=n.Event("show.bs.tab",{relatedTarget:r}),(t.trigger(u),u.isDefaultPrevented())||(f=n(i),this.activate(t.closest("li"),e),this.activate(f,f.parent(),function(){t.trigger({type:"shown.bs.tab",relatedTarget:r})})))};t.prototype.activate=function(t,i,r){function f(){u.removeClass("active").find("> .dropdown-menu > .active").removeClass("active");t.addClass("active");e?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade");t.parent(".dropdown-menu")&&t.closest("li.dropdown").addClass("active");r&&r()}var u=i.find("> .active"),e=r&&n.support.transition&&u.hasClass("fade");e?u.one("bsTransitionEnd",f).emulateTransitionEnd(150):f();u.removeClass("in")};r=n.fn.tab;n.fn.tab=i;n.fn.tab.Constructor=t;n.fn.tab.noConflict=function(){return n.fn.tab=r,this};n(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(t){t.preventDefault();i.call(n(this),"show")})}(jQuery);+function(n){"use strict";function i(i){return this.each(function(){var u=n(this),r=u.data("bs.affix"),f="object"==typeof i&&i;r||u.data("bs.affix",r=new t(this,f));"string"==typeof i&&r[i]()})}var t=function(i,r){this.options=n.extend({},t.DEFAULTS,r);this.$target=n(this.options.target).on("scroll.bs.affix.data-api",n.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",n.proxy(this.checkPositionWithEventLoop,this));this.$element=n(i);this.affixed=this.unpin=this.pinnedOffset=null;this.checkPosition()},r;t.VERSION="3.2.0";t.RESET="affix affix-top affix-bottom";t.DEFAULTS={offset:0,target:window};t.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(t.RESET).addClass("affix");var n=this.$target.scrollTop(),i=this.$element.offset();return this.pinnedOffset=i.top-n};t.prototype.checkPositionWithEventLoop=function(){setTimeout(n.proxy(this.checkPosition,this),1)};t.prototype.checkPosition=function(){var i,e,o;if(this.$element.is(":visible")){var s=n(document).height(),h=this.$target.scrollTop(),c=this.$element.offset(),r=this.options.offset,f=r.top,u=r.bottom;"object"!=typeof r&&(u=f=r);"function"==typeof f&&(f=r.top(this.$element));"function"==typeof u&&(u=r.bottom(this.$element));i=null!=this.unpin&&h+this.unpin<=c.top?!1:null!=u&&c.top+this.$element.height()>=s-u?"bottom":null!=f&&f>=h?"top":!1;this.affixed!==i&&(null!=this.unpin&&this.$element.css("top",""),e="affix"+(i?"-"+i:""),o=n.Event(e+".bs.affix"),this.$element.trigger(o),o.isDefaultPrevented()||(this.affixed=i,this.unpin="bottom"==i?this.getPinnedOffset():null,this.$element.removeClass(t.RESET).addClass(e).trigger(n.Event(e.replace("affix","affixed"))),"bottom"==i&&this.$element.offset({top:s-this.$element.height()-u})))}};r=n.fn.affix;n.fn.affix=i;n.fn.affix.Constructor=t;n.fn.affix.noConflict=function(){return n.fn.affix=r,this};n(window).on("load",function(){n('[data-spy="affix"]').each(function(){var r=n(this),t=r.data();t.offset=t.offset||{};t.offsetBottom&&(t.offset.bottom=t.offsetBottom);t.offsetTop&&(t.offset.top=t.offsetTop);i.call(r,t)})})}(jQuery);!function(n){"use strict";function i(n,t){for(var i=0;i<n.length;++i)t(n[i],i)}function t(t,i){this.$select=n(t);this.options=this.mergeOptions(n.extend({},i,this.$select.data()));this.$select.attr("data-placeholder")&&(this.options.nonSelectedText=this.$select.data("placeholder"));this.originalOptions=this.$select.clone()[0].options;this.query="";this.searchTimeout=null;this.lastToggledInput=null;this.options.multiple=this.$select.attr("multiple")==="multiple";this.options.onChange=n.proxy(this.options.onChange,this);this.options.onSelectAll=n.proxy(this.options.onSelectAll,this);this.options.onDeselectAll=n.proxy(this.options.onDeselectAll,this);this.options.onDropdownShow=n.proxy(this.options.onDropdownShow,this);this.options.onDropdownHide=n.proxy(this.options.onDropdownHide,this);this.options.onDropdownShown=n.proxy(this.options.onDropdownShown,this);this.options.onDropdownHidden=n.proxy(this.options.onDropdownHidden,this);this.options.onInitialized=n.proxy(this.options.onInitialized,this);this.options.onFiltering=n.proxy(this.options.onFiltering,this);this.buildContainer();this.buildButton();this.buildDropdown();this.buildSelectAll();this.buildDropdownOptions();this.buildFilter();this.updateButtonText();this.updateSelectAll(!0);this.options.enableClickableOptGroups&&this.options.multiple&&this.updateOptGroups();this.options.wasDisabled=this.$select.prop("disabled");this.options.disableIfEmpty&&n("option",this.$select).length<=0&&this.disable();this.$select.wrap('<span class="multiselect-native-select" />').after(this.$container);this.options.onInitialized(this.$select,this.$container)}typeof ko!="undefined"&&ko.bindingHandlers&&!ko.bindingHandlers.multiselect&&(ko.bindingHandlers.multiselect={after:["options","value","selectedOptions","enable","disable"],init:function(t,i,r){var u=n(t),l=ko.toJS(i()),s,h,c,f,e,o;u.multiselect(l);r.has("options")&&(s=r.get("options"),ko.isObservable(s)&&ko.computed({read:function(){s();setTimeout(function(){var n=u.data("multiselect");n&&n.updateOriginalOptions();u.multiselect("rebuild")},1)},disposeWhenNodeIsRemoved:t}));r.has("value")&&(h=r.get("value"),ko.isObservable(h)&&ko.computed({read:function(){h();setTimeout(function(){u.multiselect("refresh")},1)},disposeWhenNodeIsRemoved:t}).extend({rateLimit:100,notifyWhenChangesStop:!0}));r.has("selectedOptions")&&(c=r.get("selectedOptions"),ko.isObservable(c)&&ko.computed({read:function(){c();setTimeout(function(){u.multiselect("refresh")},1)},disposeWhenNodeIsRemoved:t}).extend({rateLimit:100,notifyWhenChangesStop:!0}));f=function(n){setTimeout(function(){n?u.multiselect("enable"):u.multiselect("disable")})};r.has("enable")&&(e=r.get("enable"),ko.isObservable(e)?ko.computed({read:function(){f(e())},disposeWhenNodeIsRemoved:t}).extend({rateLimit:100,notifyWhenChangesStop:!0}):f(e));r.has("disable")&&(o=r.get("disable"),ko.isObservable(o)?ko.computed({read:function(){f(!o())},disposeWhenNodeIsRemoved:t}).extend({rateLimit:100,notifyWhenChangesStop:!0}):f(!o));ko.utils.domNodeDisposal.addDisposeCallback(t,function(){u.multiselect("destroy")})},update:function(t,i){var r=n(t),u=ko.toJS(i());r.multiselect("setOptions",u);r.multiselect("rebuild")}});t.prototype={defaults:{buttonText:function(t,i){if(this.disabledText.length>0&&(i.prop("disabled")||t.length==0&&this.disableIfEmpty))return this.disabledText;if(t.length===0)return this.nonSelectedText;if(this.allSelectedText&&t.length===n("option",n(i)).length&&n("option",n(i)).length!==1&&this.multiple)return this.selectAllNumber?this.allSelectedText+" ("+t.length+")":this.allSelectedText;if(t.length>this.numberDisplayed)return t.length+" "+this.nSelectedText;var r="",u=this.delimiterText;return t.each(function(){var t=n(this).attr("label")!==undefined?n(this).attr("label"):n(this).text();r+=t+u}),r.substr(0,r.length-this.delimiterText.length)},buttonTitle:function(t){if(t.length===0)return this.nonSelectedText;var i="",r=this.delimiterText;return t.each(function(){var t=n(this).attr("label")!==undefined?n(this).attr("label"):n(this).text();i+=t+r}),i.substr(0,i.length-this.delimiterText.length)},checkboxName:function(){return!1},optionLabel:function(t){return n(t).attr("label")||n(t).text()},optionClass:function(t){return n(t).attr("class")||""},onChange:function(){},onDropdownShow:function(){},onDropdownHide:function(){},onDropdownShown:function(){},onDropdownHidden:function(){},onSelectAll:function(){},onDeselectAll:function(){},onInitialized:function(){},onFiltering:function(){},enableHTML:!1,buttonClass:"btn btn-default",inheritClass:!1,buttonWidth:"auto",buttonContainer:'<div class="btn-group" />',dropRight:!1,dropUp:!1,selectedClass:"active",maxHeight:!1,includeSelectAllOption:!1,includeSelectAllIfMoreThan:0,selectAllText:" Select all",selectAllValue:"multiselect-all",selectAllName:!1,selectAllNumber:!0,selectAllJustVisible:!0,enableFiltering:!1,enableCaseInsensitiveFiltering:!1,enableFullValueFiltering:!1,enableClickableOptGroups:!1,enableCollapsibleOptGroups:!1,filterPlaceholder:"Search",filterBehavior:"text",includeFilterClearBtn:!0,preventInputChangeEvent:!1,nonSelectedText:"None selected",nSelectedText:"selected",allSelectedText:"All selected",numberDisplayed:3,disableIfEmpty:!1,disabledText:"",delimiterText:", ",templates:{button:'<button type="button" class="multiselect dropdown-toggle" data-toggle="dropdown"><span class="multiselect-selected-text"><\/span> <b class="caret"><\/b><\/button>',ul:'<ul class="multiselect-container dropdown-menu"><\/ul>',filter:'<li class="multiselect-item multiselect-filter"><div class="input-group"><span class="input-group-addon"><i class="glyphicon">&#128269;<\/i><\/span><input class="form-control multiselect-search" type="text"><\/div><\/li>',filterClearBtn:'<span class="input-group-btn"><button class="btn btn-default multiselect-clear-filter" type="button"><i class="glyphicon glyphicon-remove-circle"><\/i><\/button><\/span>',li:'<li><a tabindex="0"><label><\/label><\/a><\/li>',divider:'<li class="multiselect-item divider"><\/li>',liGroup:'<li class="multiselect-item multiselect-group"><label><\/label><\/li>'}},constructor:t,buildContainer:function(){this.$container=n(this.options.buttonContainer);this.$container.on("show.bs.dropdown",this.options.onDropdownShow);this.$container.on("hide.bs.dropdown",this.options.onDropdownHide);this.$container.on("shown.bs.dropdown",this.options.onDropdownShown);this.$container.on("hidden.bs.dropdown",this.options.onDropdownHidden)},buildButton:function(){this.$button=n(this.options.templates.button).addClass(this.options.buttonClass);this.$select.attr("class")&&this.options.inheritClass&&this.$button.addClass(this.$select.attr("class"));this.$select.prop("disabled")?this.disable():this.enable();this.options.buttonWidth&&this.options.buttonWidth!=="auto"&&(this.$button.css({width:"100%",overflow:"hidden","text-overflow":"ellipsis"}),this.$container.css({width:this.options.buttonWidth}));var t=this.$select.attr("tabindex");t&&this.$button.attr("tabindex",t);this.$container.prepend(this.$button)},buildDropdown:function(){if(this.$ul=n(this.options.templates.ul),this.options.dropRight&&this.$ul.addClass("pull-right"),this.options.maxHeight&&this.$ul.css({"max-height":this.options.maxHeight+"px","overflow-y":"auto","overflow-x":"hidden"}),this.options.dropUp){var t=Math.min(this.options.maxHeight,n('option[data-role!="divider"]',this.$select).length*26+n('option[data-role="divider"]',this.$select).length*19+(this.options.includeSelectAllOption?26:0)+(this.options.enableFiltering||this.options.enableCaseInsensitiveFiltering?44:0)),i=t+34;this.$ul.css({"max-height":t+"px","overflow-y":"auto","overflow-x":"hidden","margin-top":"-"+i+"px"})}this.$container.append(this.$ul)},buildDropdownOptions:function(){this.$select.children().each(n.proxy(function(t,i){var r=n(i),u=r.prop("tagName").toLowerCase();r.prop("value")!==this.options.selectAllValue&&(u==="optgroup"?this.createOptgroup(i):u==="option"&&(r.data("role")==="divider"?this.createDivider():this.createOptionValue(i)))},this));n("li:not(.multiselect-group) input",this.$ul).on("change",n.proxy(function(t){var i=n(t.target),u=i.prop("checked")||!1,o=i.val()===this.options.selectAllValue;this.options.selectedClass&&(u?i.closest("li").addClass(this.options.selectedClass):i.closest("li").removeClass(this.options.selectedClass));var s=i.val(),r=this.getOptionByValue(s),f=n("option",this.$select).not(r),e=n("input",this.$container).not(i);if(o)u?this.selectAll(this.options.selectAllJustVisible,!0):this.deselectAll(this.options.selectAllJustVisible,!0);else{u?(r.prop("selected",!0),this.options.multiple?r.prop("selected",!0):(this.options.selectedClass&&n(e).closest("li").removeClass(this.options.selectedClass),n(e).prop("checked",!1),f.prop("selected",!1),this.$button.click()),this.options.selectedClass==="active"&&f.closest("a").css("outline","")):r.prop("selected",!1);this.options.onChange(r,u);this.updateSelectAll();this.options.enableClickableOptGroups&&this.options.multiple&&this.updateOptGroups()}return this.$select.change(),this.updateButtonText(),this.options.preventInputChangeEvent?!1:void 0},this));n("li a",this.$ul).on("mousedown",function(n){if(n.shiftKey)return!1});n("li a",this.$ul).on("touchstart click",n.proxy(function(t){var i,e,u,r,s,f,o,h,c,l;if(t.stopPropagation(),i=n(t.target),t.shiftKey&&this.options.multiple){if(i.is("label")&&(t.preventDefault(),i=i.find("input"),i.prop("checked",!i.prop("checked"))),e=i.prop("checked")||!1,this.lastToggledInput!==null&&this.lastToggledInput!==i)for(u=i.closest("li").index(),r=this.lastToggledInput.closest("li").index(),u>r&&(s=r,r=u,u=s),++r,f=this.$ul.find("li").slice(u,r).find("input"),f.prop("checked",e),this.options.selectedClass&&f.closest("li").toggleClass(this.options.selectedClass,e),o=0,h=f.length;o<h;o++)c=n(f[o]),l=this.getOptionByValue(c.val()),l.prop("selected",e);i.trigger("change")}i.is("input")&&!i.closest("li").is(".multiselect-item")&&(this.lastToggledInput=i);i.blur()},this));this.$container.off("keydown.multiselect").on("keydown.multiselect",n.proxy(function(t){var r,i,f,u;if(!n('input[type="text"]',this.$container).is(":focus"))if(t.keyCode===9&&this.$container.hasClass("open"))this.$button.click();else{if(r=n(this.$container).find("li:not(.divider):not(.disabled) a").filter(":visible"),!r.length)return;i=r.index(r.filter(":focus"));t.keyCode===38&&i>0?i--:t.keyCode===40&&i<r.length-1?i++:~i||(i=0);f=r.eq(i);f.focus();(t.keyCode===32||t.keyCode===13)&&(u=f.find("input"),u.prop("checked",!u.prop("checked")),u.change());t.stopPropagation();t.preventDefault()}},this));if(this.options.enableClickableOptGroups&&this.options.multiple)n("li.multiselect-group input",this.$ul).on("change",n.proxy(function(t){t.stopPropagation();var f=n(t.target),i=f.prop("checked")||!1,r=n(t.target).closest("li"),e=r.nextUntil("li.multiselect-group").not(".multiselect-filter-hidden").not(".disabled"),o=e.find("input"),u=[];this.options.selectedClass&&(i?r.addClass(this.options.selectedClass):r.removeClass(this.options.selectedClass));n.each(o,n.proxy(function(t,r){var f=n(r).val(),e=this.getOptionByValue(f);i?(n(r).prop("checked",!0),n(r).closest("li").addClass(this.options.selectedClass),e.prop("selected",!0)):(n(r).prop("checked",!1),n(r).closest("li").removeClass(this.options.selectedClass),e.prop("selected",!1));u.push(this.getOptionByValue(f))},this));this.options.onChange(u,i);this.updateButtonText();this.updateSelectAll()},this));if(this.options.enableCollapsibleOptGroups&&this.options.multiple){n("li.multiselect-group .caret-container",this.$ul).on("click",n.proxy(function(t){var u=n(t.target).closest("li"),i=u.nextUntil("li.multiselect-group").not(".multiselect-filter-hidden"),r=!0;i.each(function(){r=r&&n(this).is(":visible")});r?i.hide().addClass("multiselect-collapsible-hidden"):i.show().removeClass("multiselect-collapsible-hidden")},this));n("li.multiselect-all",this.$ul).css("background","#f3f3f3").css("border-bottom","1px solid #eaeaea");n("li.multiselect-all > a > label.checkbox",this.$ul).css("padding","3px 20px 3px 35px");n("li.multiselect-group > a > input",this.$ul).css("margin","4px 0px 5px -20px")}},createOptionValue:function(t){var r=n(t),i,e,o;r.is(":selected")&&r.prop("selected",!0);var s=this.options.optionLabel(t),l=this.options.optionClass(t),h=r.val(),c=this.options.multiple?"checkbox":"radio",f=n(this.options.templates.li),u=n("label",f);u.addClass(c);f.addClass(l);this.options.enableHTML?u.html(" "+s):u.text(" "+s);i=n("<input/>").attr("type",c);e=this.options.checkboxName(r);e&&i.attr("name",e);u.prepend(i);o=r.prop("selected")||!1;i.val(h);h===this.options.selectAllValue&&(f.addClass("multiselect-item multiselect-all"),i.parent().parent().addClass("multiselect-all"));u.attr("title",r.attr("title"));this.$ul.append(f);r.is(":disabled")&&i.attr("disabled","disabled").prop("disabled",!0).closest("a").attr("tabindex","-1").closest("li").addClass("disabled");i.prop("checked",o);o&&this.options.selectedClass&&i.closest("li").addClass(this.options.selectedClass)},createDivider:function(){var t=n(this.options.templates.divider);this.$ul.append(t)},createOptgroup:function(t){var r=n(t).attr("label"),u=n(t).attr("value"),i=n('<li class="multiselect-item multiselect-group"><a href="javascript:void(0);"><label><b><\/b><\/label><\/a><\/li>'),f=this.options.optionClass(t);i.addClass(f);this.options.enableHTML?n("label b",i).html(" "+r):n("label b",i).text(" "+r);this.options.enableCollapsibleOptGroups&&this.options.multiple&&n("a",i).append('<span class="caret-container"><b class="caret"><\/b><\/span>');this.options.enableClickableOptGroups&&this.options.multiple&&n("a label",i).prepend('<input type="checkbox" value="'+u+'"/>');n(t).is(":disabled")&&i.addClass("disabled");this.$ul.append(i);n("option",t).each(n.proxy(function(n,t){this.createOptionValue(t)},this))},buildSelectAll:function(){var r,t,i;typeof this.options.selectAllValue=="number"&&(this.options.selectAllValue=this.options.selectAllValue.toString());r=this.hasSelectAll();!r&&this.options.includeSelectAllOption&&this.options.multiple&&n("option",this.$select).length>this.options.includeSelectAllIfMoreThan&&(this.options.includeSelectAllDivider&&this.$ul.prepend(n(this.options.templates.divider)),t=n(this.options.templates.li),n("label",t).addClass("checkbox"),this.options.enableHTML?n("label",t).html(" "+this.options.selectAllText):n("label",t).text(" "+this.options.selectAllText),this.options.selectAllName?n("label",t).prepend('<input type="checkbox" name="'+this.options.selectAllName+'" />'):n("label",t).prepend('<input type="checkbox" />'),i=n("input",t),i.val(this.options.selectAllValue),t.addClass("multiselect-item multiselect-all"),i.parent().parent().addClass("multiselect-all"),this.$ul.prepend(t),i.prop("checked",!1))},buildFilter:function(){var i,t;if((this.options.enableFiltering||this.options.enableCaseInsensitiveFiltering)&&(i=Math.max(this.options.enableFiltering,this.options.enableCaseInsensitiveFiltering),this.$select.find("option").length>=i)){if(this.$filter=n(this.options.templates.filter),n("input",this.$filter).attr("placeholder",this.options.filterPlaceholder),this.options.includeFilterClearBtn){t=n(this.options.templates.filterClearBtn);t.on("click",n.proxy(function(){clearTimeout(this.searchTimeout);this.$filter.find(".multiselect-search").val("");n("li",this.$ul).show().removeClass("multiselect-filter-hidden");this.updateSelectAll();this.options.enableClickableOptGroups&&this.options.multiple&&this.updateOptGroups()},this));this.$filter.find(".input-group").append(t)}this.$ul.prepend(this.$filter);this.$filter.val(this.query).on("click",function(n){n.stopPropagation()}).on("input keydown",n.proxy(function(t){t.which===13&&t.preventDefault();clearTimeout(this.searchTimeout);this.searchTimeout=this.asyncFunction(n.proxy(function(){if(this.query!==t.target.value){this.query=t.target.value;var i,r;n.each(n("li",this.$ul),n.proxy(function(t,u){var o=n("input",u).length>0?n("input",u).val():"",s=n("label",u).text(),e="",f,h;this.options.filterBehavior==="text"?e=s:this.options.filterBehavior==="value"?e=o:this.options.filterBehavior==="both"&&(e=s+"\n"+o);o!==this.options.selectAllValue&&s&&(f=!1,this.options.enableCaseInsensitiveFiltering&&(e=e.toLowerCase(),this.query=this.query.toLowerCase()),this.options.enableFullValueFiltering&&this.options.filterBehavior!=="both"?(h=e.trim().substring(0,this.query.length),this.query.indexOf(h)>-1&&(f=!0)):e.indexOf(this.query)>-1&&(f=!0),n(u).toggle(f).toggleClass("multiselect-filter-hidden",!f),n(u).hasClass("multiselect-group")?(i=u,r=f):(f&&n(i).show().removeClass("multiselect-filter-hidden"),!f&&r&&n(u).show().removeClass("multiselect-filter-hidden")))},this))}this.updateSelectAll();this.options.enableClickableOptGroups&&this.options.multiple&&this.updateOptGroups();this.options.onFiltering(t.target)},this),300,this)},this))}},destroy:function(){this.$container.remove();this.$select.show();this.$select.prop("disabled",this.options.wasDisabled);this.$select.data("multiselect",null)},refresh:function(){var t=n.map(n("li input",this.$ul),n);n("option",this.$select).each(n.proxy(function(i,r){for(var f=n(r),o=f.val(),u,e=t.length;0<e--;)if(o===(u=t[e]).val()){f.is(":selected")?(u.prop("checked",!0),this.options.selectedClass&&u.closest("li").addClass(this.options.selectedClass)):(u.prop("checked",!1),this.options.selectedClass&&u.closest("li").removeClass(this.options.selectedClass));f.is(":disabled")?u.attr("disabled","disabled").prop("disabled",!0).closest("li").addClass("disabled"):u.prop("disabled",!1).closest("li").removeClass("disabled");break}},this));this.updateButtonText();this.updateSelectAll();this.options.enableClickableOptGroups&&this.options.multiple&&this.updateOptGroups()},select:function(t,i){var u,r,f,e;for(n.isArray(t)||(t=[t]),u=0;u<t.length;u++)if((r=t[u],r!==null&&r!==undefined)&&(f=this.getOptionByValue(r),e=this.getInputByValue(r),f!==undefined&&e!==undefined)&&(this.options.multiple||this.deselectAll(!1),this.options.selectedClass&&e.closest("li").addClass(this.options.selectedClass),e.prop("checked",!0),f.prop("selected",!0),i))this.options.onChange(f,!0);this.updateButtonText();this.updateSelectAll();this.options.enableClickableOptGroups&&this.options.multiple&&this.updateOptGroups()},clearSelection:function(){this.deselectAll(!1);this.updateButtonText();this.updateSelectAll();this.options.enableClickableOptGroups&&this.options.multiple&&this.updateOptGroups()},deselect:function(t,i){var u,r,f,e;for(n.isArray(t)||(t=[t]),u=0;u<t.length;u++)if((r=t[u],r!==null&&r!==undefined)&&(f=this.getOptionByValue(r),e=this.getInputByValue(r),f!==undefined&&e!==undefined)&&(this.options.selectedClass&&e.closest("li").removeClass(this.options.selectedClass),e.prop("checked",!1),f.prop("selected",!1),i))this.options.onChange(f,!1);this.updateButtonText();this.updateSelectAll();this.options.enableClickableOptGroups&&this.options.multiple&&this.updateOptGroups()},selectAll:function(t,i){var t=typeof t=="undefined"?!0:t,r=n("li:not(.divider):not(.disabled):not(.multiselect-group)",this.$ul),u=n("li:not(.divider):not(.disabled):not(.multiselect-group):not(.multiselect-filter-hidden):not(.multiselect-collapisble-hidden)",this.$ul).filter(":visible");t?(n("input:enabled",u).prop("checked",!0),u.addClass(this.options.selectedClass),n("input:enabled",u).each(n.proxy(function(t,i){var r=n(i).val(),u=this.getOptionByValue(r);n(u).prop("selected",!0)},this))):(n("input:enabled",r).prop("checked",!0),r.addClass(this.options.selectedClass),n("input:enabled",r).each(n.proxy(function(t,i){var r=n(i).val(),u=this.getOptionByValue(r);n(u).prop("selected",!0)},this)));n('li input[value="'+this.options.selectAllValue+'"]',this.$ul).prop("checked",!0);this.options.enableClickableOptGroups&&this.options.multiple&&this.updateOptGroups();i&&this.options.onSelectAll()},deselectAll:function(t,i){var t=typeof t=="undefined"?!0:t,r=n("li:not(.divider):not(.disabled):not(.multiselect-group)",this.$ul),u=n("li:not(.divider):not(.disabled):not(.multiselect-group):not(.multiselect-filter-hidden):not(.multiselect-collapisble-hidden)",this.$ul).filter(":visible");t?(n('input[type="checkbox"]:enabled',u).prop("checked",!1),u.removeClass(this.options.selectedClass),n('input[type="checkbox"]:enabled',u).each(n.proxy(function(t,i){var r=n(i).val(),u=this.getOptionByValue(r);n(u).prop("selected",!1)},this))):(n('input[type="checkbox"]:enabled',r).prop("checked",!1),r.removeClass(this.options.selectedClass),n('input[type="checkbox"]:enabled',r).each(n.proxy(function(t,i){var r=n(i).val(),u=this.getOptionByValue(r);n(u).prop("selected",!1)},this)));n('li input[value="'+this.options.selectAllValue+'"]',this.$ul).prop("checked",!1);this.options.enableClickableOptGroups&&this.options.multiple&&this.updateOptGroups();i&&this.options.onDeselectAll()},rebuild:function(){this.$ul.html("");this.options.multiple=this.$select.attr("multiple")==="multiple";this.buildSelectAll();this.buildDropdownOptions();this.buildFilter();this.updateButtonText();this.updateSelectAll(!0);this.options.enableClickableOptGroups&&this.options.multiple&&this.updateOptGroups();this.options.disableIfEmpty&&n("option",this.$select).length<=0?this.disable():this.enable();this.options.dropRight&&this.$ul.addClass("pull-right")},dataprovider:function(t){var r=0,u=this.$select.empty();n.each(t,function(t,f){var e,o,s;if(n.isArray(f.children))r++,e=n("<optgroup/>").attr({label:f.label||"Group "+r,disabled:!!f.disabled}),i(f.children,function(t){var r={value:t.value,label:t.label||t.value,title:t.title,selected:!!t.selected,disabled:!!t.disabled},i;for(i in t.attributes)r["data-"+i]=t.attributes[i];e.append(n("<option/>").attr(r))});else{o={value:f.value,label:f.label||f.value,title:f.title,"class":f.class,selected:!!f.selected,disabled:!!f.disabled};for(s in f.attributes)o["data-"+s]=f.attributes[s];e=n("<option/>").attr(o);e.text(f.label||f.value)}u.append(e)});this.rebuild()},enable:function(){this.$select.prop("disabled",!1);this.$button.prop("disabled",!1).removeClass("disabled")},disable:function(){this.$select.prop("disabled",!0);this.$button.prop("disabled",!0).addClass("disabled")},setOptions:function(n){this.options=this.mergeOptions(n)},mergeOptions:function(t){return n.extend(!0,{},this.defaults,this.options,t)},hasSelectAll:function(){return n("li.multiselect-all",this.$ul).length>0},updateOptGroups:function(){var i=n("li.multiselect-group",this.$ul),t=this.options.selectedClass;i.each(function(){var r=n(this).nextUntil("li.multiselect-group").not(".multiselect-filter-hidden").not(".disabled"),i=!0;r.each(function(){var t=n("input",this);t.prop("checked")||(i=!1)});t&&(i?n(this).addClass(t):n(this).removeClass(t));n("input",this).prop("checked",i)})},updateSelectAll:function(){if(this.hasSelectAll()){var i=n("li:not(.multiselect-item):not(.multiselect-filter-hidden):not(.multiselect-group):not(.disabled) input:enabled",this.$ul),f=i.length,r=i.filter(":checked").length,t=n("li.multiselect-all",this.$ul),u=t.find("input");r>0&&r===f?(u.prop("checked",!0),t.addClass(this.options.selectedClass)):(u.prop("checked",!1),t.removeClass(this.options.selectedClass))}},updateButtonText:function(){var t=this.getSelected();this.options.enableHTML?n(".multiselect .multiselect-selected-text",this.$container).html(this.options.buttonText(t,this.$select)):n(".multiselect .multiselect-selected-text",this.$container).text(this.options.buttonText(t,this.$select));n(".multiselect",this.$container).attr("title",this.options.buttonTitle(t,this.$select))},getSelected:function(){return n("option",this.$select).filter(":selected")},getOptionByValue:function(t){for(var u=n("option",this.$select),f=t.toString(),r,i=0;i<u.length;i=i+1)if(r=u[i],r.value===f)return n(r)},getInputByValue:function(t){for(var u=n("li input:not(.multiselect-search)",this.$ul),f=t.toString(),r,i=0;i<u.length;i=i+1)if(r=u[i],r.value===f)return n(r)},updateOriginalOptions:function(){this.originalOptions=this.$select.clone()[0].options},asyncFunction:function(n,t,i){var r=Array.prototype.slice.call(arguments,3);return setTimeout(function(){n.apply(i||window,r)},t)},setAllSelectedText:function(n){this.options.allSelectedText=n;this.updateButtonText()}};n.fn.multiselect=function(i,r,u){return this.each(function(){var f=n(this).data("multiselect"),e=typeof i=="object"&&i;f||(f=new t(this,e),n(this).data("multiselect",f));typeof i=="string"&&(f[i](r,u),i==="destroy"&&n(this).data("multiselect",!1))})};n.fn.multiselect.Constructor=t;n(function(){n("select[data-role=multiselect]").multiselect()})}(window.jQuery)