!function(e){"use strict";e.fn.extend({customSelect:function(t){if(void 0===document.body.style.maxHeight)return this;var s={customClass:"customSelect",mapClass:!0,mapStyle:!0},t=e.extend(s,t),o=t.customClass,n=function(t,s){var o=t.find(":selected"),n=s.children(":first"),c=o.html()||" ";n.html(c),o.attr("disabled")?s.addClass(a("DisabledOption")):s.removeClass(a("DisabledOption")),setTimeout(function(){s.removeClass(a("Open")),e(document).off("mouseup.customSelect")},60)},a=function(e){return o+e};return this.each(function(){var s=e(this),c=e("").addClass(a("Inner")),u=e("");s.after(u.append(c)),u.addClass(o),t.mapClass&&u.addClass(s.attr("class")),t.mapStyle&&u.attr("style",s.attr("style")),s.addClass("hasCustomSelect").on("render.customSelect",function(){n(s,u),s.css("width","");parseInt(s.outerWidth(),10),parseInt(u.outerWidth(),10),parseInt(u.width(),10);u.css({});var e=u.outerHeight();s.attr("disabled")?u.addClass(a("Disabled")):u.removeClass(a("Disabled")),c.css({width:"100%",display:"block"}),s.css({"-webkit-appearance":"menulist-button",width:"100%",position:"absolute",opacity:0,height:e,fontSize:u.css("font-size")})}).on("change.customSelect",function(){u.addClass(a("Changed")),n(s,u)}).on("keyup.customSelect",function(e){u.hasClass(a("Open"))?13!=e.which&&27!=e.which||n(s,u):(s.trigger("blur.customSelect"),s.trigger("focus.customSelect"))}).on("mousedown.customSelect",function(){u.removeClass(a("Changed"))}).on("mouseup.customSelect",function(t){u.hasClass(a("Open"))||(e("."+a("Open")).not(u).length>0&&"undefined"!=typeof InstallTrigger?s.trigger("focus.customSelect"):(u.addClass(a("Open")),t.stopPropagation(),e(document).one("mouseup.customSelect",function(t){t.target!=s.get(0)&&e.inArray(t.target,s.find("*").get())<0?s.trigger("blur.customSelect"):n(s,u)})))}).on("focus.customSelect",function(){u.removeClass(a("Changed")).addClass(a("Focus"))}).on("blur.customSelect",function(){u.removeClass(a("Focus")+" "+a("Open"))}).on("mouseenter.customSelect",function(){u.addClass(a("Hover"))}).on("mouseleave.customSelect",function(){u.removeClass(a("Hover"))}).trigger("render.customSelect")})}})}(jQuery);