!function(e,t){void 0===e&&void 0!==window&&(e=window),"function"==typeof define&&define.amd?define(["jquery"],function(e){return t(e)}):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(e.jQuery)}(this,function(e){!function(e){"use strict";var t=["sanitize","whiteList","sanitizeFn"],i=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],s={"*":["class","dir","id","lang","role","tabindex","style",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},n=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:\/?#]*(?:[\/?#]|$))/gi,o=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+\/]+=*$/i;function l(t,s){var l=t.nodeName.toLowerCase();if(-1!==e.inArray(l,s))return-1===e.inArray(l,i)||Boolean(t.nodeValue.match(n)||t.nodeValue.match(o));for(var r=e(s).filter(function(e,t){return t instanceof RegExp}),a=0,c=r.length;a1?arguments[1]:void 0,l=o?Number(o):0;l!=l&&(l=0);var r=Math.min(Math.max(l,0),i);if(n+r>i)return!1;for(var a=-1;++a]+>/g,"")),s&&(a=S(a)),a=a.toUpperCase(),o="contains"===i?a.indexOf(t)>=0:a.startsWith(t)))break}return o}function x(e){return parseInt(e,10)||0}e.fn.triggerNative=function(e){var t,i=this[0];i.dispatchEvent?(b?t=new Event(e,{bubbles:!0}):(t=document.createEvent("Event")).initEvent(e,!0,!1),i.dispatchEvent(t)):i.fireEvent?((t=document.createEventObject()).eventType=e,i.fireEvent("on"+e,t)):this.trigger(e)};var I={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},k=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,$=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]","g");function y(e){return I[e]}function S(e){return(e=e.toString())&&e.replace(k,y).replace($,"")}var E,C,O,z,L,T=(E={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},C=function(e){return E[e]},O="(?:"+Object.keys(E).join("|")+")",z=RegExp(O),L=RegExp(O,"g"),function(e){return e=null==e?"":""+e,z.test(e)?e.replace(L,C):e}),A={32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"},N=27,D=13,H=32,B=9,P=38,W=40,M={success:!1,major:"3"};try{M.full=(e.fn.dropdown.Constructor.VERSION||"").split(" ")[0].split("."),M.major=M.full[0],M.success=!0}catch(e){}var R=0,U=".bs.select",j={DISABLED:"disabled",DIVIDER:"divider",SHOW:"open",DROPUP:"dropup",MENU:"dropdown-menu",MENURIGHT:"dropdown-menu-right",MENULEFT:"dropdown-menu-left",BUTTONCLASS:"btn-default",POPOVERHEADER:"popover-title",ICONBASE:"glyphicon",TICKICON:"glyphicon-ok"},V={MENU:"."+j.MENU},F={span:document.createElement("span"),i:document.createElement("i"),subtext:document.createElement("small"),a:document.createElement("a"),li:document.createElement("li"),whitespace:document.createTextNode(" "),fragment:document.createDocumentFragment()};F.a.setAttribute("role","option"),F.subtext.className="text-muted",F.text=F.span.cloneNode(!1),F.text.className="text",F.checkMark=F.span.cloneNode(!1);var _=new RegExp(P+"|"+W),q=new RegExp("^"+B+"$|"+N),G={li:function(e,t,i){var s=F.li.cloneNode(!1);return e&&(1===e.nodeType||11===e.nodeType?s.appendChild(e):s.innerHTML=e),void 0!==t&&""!==t&&(s.className=t),null!=i&&s.classList.add("optgroup-"+i),s},a:function(e,t,i){var s=F.a.cloneNode(!0);return e&&(11===e.nodeType?s.appendChild(e):s.insertAdjacentHTML("beforeend",e)),void 0!==t&&""!==t&&(s.className=t),"4"===M.major&&s.classList.add("dropdown-item"),i&&s.setAttribute("style",i),s},text:function(e,t){var i,s,n=F.text.cloneNode(!1);if(e.content)n.innerHTML=e.content;else{if(n.textContent=e.text,e.icon){var o=F.whitespace.cloneNode(!1);(s=(!0===t?F.i:F.span).cloneNode(!1)).className=e.iconBase+" "+e.icon,F.fragment.appendChild(s),F.fragment.appendChild(o)}e.subtext&&((i=F.subtext.cloneNode(!1)).textContent=e.subtext,n.appendChild(i))}if(!0===t)for(;n.childNodes.length>0;)F.fragment.appendChild(n.childNodes[0]);else F.fragment.appendChild(n);return F.fragment},label:function(e){var t,i,s=F.text.cloneNode(!1);if(s.innerHTML=e.label,e.icon){var n=F.whitespace.cloneNode(!1);(i=F.span.cloneNode(!1)).className=e.iconBase+" "+e.icon,F.fragment.appendChild(i),F.fragment.appendChild(n)}return e.subtext&&((t=F.subtext.cloneNode(!1)).textContent=e.subtext,s.appendChild(t)),F.fragment.appendChild(s),F.fragment}},K=function(t,i){var s=this;v.useDefault||(e.valHooks.select.set=v._set,v.useDefault=!0),this.$element=e(t),this.$newElement=null,this.$button=null,this.$menu=null,this.options=i,this.selectpicker={main:{},current:{},search:{},view:{},keydown:{keyHistory:"",resetKeyHistory:{start:function(){return setTimeout(function(){s.selectpicker.keydown.keyHistory=""},800)}}}},null===this.options.title&&(this.options.title=this.$element.attr("title"));var n=this.options.windowPadding;"number"==typeof n&&(this.options.windowPadding=[n,n,n,n]),this.val=K.prototype.val,this.render=K.prototype.render,this.refresh=K.prototype.refresh,this.setStyle=K.prototype.setStyle,this.selectAll=K.prototype.selectAll,this.deselectAll=K.prototype.deselectAll,this.destroy=K.prototype.destroy,this.remove=K.prototype.remove,this.show=K.prototype.show,this.hide=K.prototype.hide,this.init()};function Y(i){var s,n=arguments,o=i;if([].shift.apply(n),!M.success){try{M.full=(e.fn.dropdown.Constructor.VERSION||"").split(" ")[0].split(".")}catch(e){K.BootstrapVersion?M.full=K.BootstrapVersion.split(" ")[0].split("."):(M.full=[M.major,"0","0"],console.warn("There was an issue retrieving Bootstrap's version. Ensure Bootstrap is being loaded before bootstrap-select and there is no namespace collision. If loading Bootstrap asynchronously, the version may need to be manually specified via $.fn.selectpicker.Constructor.BootstrapVersion.",e))}M.major=M.full[0],M.success=!0}if("4"===M.major){var l=[];K.DEFAULTS.style===j.BUTTONCLASS&&l.push({name:"style",className:"BUTTONCLASS"}),K.DEFAULTS.iconBase===j.ICONBASE&&l.push({name:"iconBase",className:"ICONBASE"}),K.DEFAULTS.tickIcon===j.TICKICON&&l.push({name:"tickIcon",className:"TICKICON"}),j.DIVIDER="dropdown-divider",j.SHOW="show",j.BUTTONCLASS="btn-light",j.POPOVERHEADER="popover-header",j.ICONBASE="",j.TICKICON="bs-ok-default";for(var r=0;r'},maxOptions:!1,mobile:!1,selectOnTab:!1,dropdownAlignRight:!1,windowPadding:0,virtualScroll:600,display:!1,sanitize:!0,sanitizeFn:null,whiteList:s},K.prototype={constructor:K,init:function(){var e=this,t=this.$element.attr("id");this.selectId=R++,this.$element[0].classList.add("bs-select-hidden"),this.multiple=this.$element.prop("multiple"),this.autofocus=this.$element.prop("autofocus"),this.options.showTick=this.$element[0].classList.contains("show-tick"),this.$newElement=this.createDropdown(),this.$element.after(this.$newElement).prependTo(this.$newElement),this.$button=this.$newElement.children("button"),this.$menu=this.$newElement.children(V.MENU),this.$menuInner=this.$menu.children(".inner"),this.$searchbox=this.$menu.find("input"),this.$element[0].classList.remove("bs-select-hidden"),!0===this.options.dropdownAlignRight&&this.$menu[0].classList.add(j.MENURIGHT),void 0!==t&&this.$button.attr("data-id",t),this.checkDisabled(),this.clickListener(),this.options.liveSearch&&this.liveSearchListener(),this.setStyle(),this.render(),this.setWidth(),this.options.container?this.selectPosition():this.$element.on("hide.bs.select",function(){if(e.isVirtual()){var t=e.$menuInner[0],i=t.firstChild.cloneNode(!1);t.replaceChild(i,t.firstChild),t.scrollTop=0}}),this.$menu.data("this",this),this.$newElement.data("this",this),this.options.mobile&&this.mobile(),this.$newElement.on({"hide.bs.dropdown":function(t){e.$menuInner.attr("aria-expanded",!1),e.$element.trigger("hide.bs.select",t)},"hidden.bs.dropdown":function(t){e.$element.trigger("hidden.bs.select",t)},"show.bs.dropdown":function(t){e.$menuInner.attr("aria-expanded",!0),e.$element.trigger("show.bs.select",t)},"shown.bs.dropdown":function(t){e.$element.trigger("shown.bs.select",t)}}),e.$element[0].hasAttribute("required")&&this.$element.on("invalid.bs.select",function(){e.$button[0].classList.add("bs-invalid"),e.$element.on("shown.bs.select.invalid",function(){e.$element.val(e.$element.val()).off("shown.bs.select.invalid")}).on("rendered.bs.select",function(){this.validity.valid&&e.$button[0].classList.remove("bs-invalid"),e.$element.off("rendered.bs.select")}),e.$button.on("blur.bs.select",function(){e.$element.trigger("focus").trigger("blur"),e.$button.off("blur.bs.select")})}),setTimeout(function(){e.createLi(),e.$element.trigger("loaded.bs.select")})},createDropdown:function(){var t=this.multiple||this.options.showTick?" show-tick":"",i="",s=this.autofocus?" autofocus":"";M.major<4&&this.$element.parent().hasClass("input-group")&&(i=" input-group-btn");var n,o="",l="",r="",a="";return this.options.header&&(o='
'+this.options.header+"
"),this.options.liveSearch&&(l=''),this.multiple&&this.options.actionsBox&&(r='
"),this.multiple&&this.options.doneButton&&(a='
"),n='",e(n)},setPositionData:function(){this.selectpicker.view.canHighlight=[];for(var e=0;e=this.options.virtualScroll||!0===this.options.virtualScroll},createView:function(t,i){i=i||0;var s=this;this.selectpicker.current=t?this.selectpicker.search:this.selectpicker.main;var n,o,l=[];function a(e,i){var a,c,d,h,p,u,f,m,v,g,b=s.selectpicker.current.elements.length,w=[],x=!0,I=s.isVirtual();s.selectpicker.view.scrollTop=e,!0===I&&s.sizeInfo.hasScrollBar&&s.$menu[0].offsetWidth>s.sizeInfo.totalMenuWidth&&(s.sizeInfo.menuWidth=s.$menu[0].offsetWidth,s.sizeInfo.totalMenuWidth=s.sizeInfo.menuWidth+s.sizeInfo.scrollBarWidth,s.$menu.css("min-width",s.sizeInfo.menuWidth)),a=Math.ceil(s.sizeInfo.menuInnerHeight/s.sizeInfo.liHeight*1.5),c=Math.round(b/a)||1;for(var k=0;kb-1?0:s.selectpicker.current.data[b-1].position-s.selectpicker.current.data[s.selectpicker.view.position1-1].position,E.firstChild.style.marginTop=y+"px",E.firstChild.style.marginBottom=S+"px"),E.firstChild.appendChild(C)}if(s.prevActiveIndex=s.activeIndex,s.options.liveSearch){if(t&&i){var H,B=0;s.selectpicker.view.canHighlight[B]||(B=1+s.selectpicker.view.canHighlight.slice(1).indexOf(!0)),H=s.selectpicker.view.visibleElements[B],s.selectpicker.view.currentActive&&(s.selectpicker.view.currentActive.classList.remove("active"),s.selectpicker.view.currentActive.firstChild&&s.selectpicker.view.currentActive.firstChild.classList.remove("active")),H&&(H.classList.add("active"),H.firstChild&&H.firstChild.classList.add("active")),s.activeIndex=(s.selectpicker.current.data[B]||{}).index}}else s.$menuInner.trigger("focus")}this.setPositionData(),a(i,!0),this.$menuInner.off("scroll.createView").on("scroll.createView",function(e,t){s.noScroll||a(this.scrollTop,t),s.noScroll=!1}),e(window).off("resize.bs.select."+this.selectId+".createView").on("resize.bs.select."+this.selectId+".createView",function(){s.$newElement.hasClass(j.SHOW)&&a(s.$menuInner[0].scrollTop)})},setPlaceholder:function(){var t=!1;if(this.options.title&&!this.multiple){this.selectpicker.view.titleOption||(this.selectpicker.view.titleOption=document.createElement("option")),t=!0;var i=this.$element[0],s=!1,n=!this.selectpicker.view.titleOption.parentNode;if(n)this.selectpicker.view.titleOption.className="bs-title-option",this.selectpicker.view.titleOption.value="",s=void 0===e(i.options[i.selectedIndex]).attr("selected")&&void 0===this.$element.data("selected");(n||0!==this.selectpicker.view.titleOption.index)&&i.insertBefore(this.selectpicker.view.titleOption,i.firstChild),s&&(i.selectedIndex=0)}return t},createLi:function(){var e=this,t=this.options.iconBase,i=':not([hidden]):not([data-hidden="true"])',s=[],n=[],o=0,l=0,r=this.setPlaceholder()?1:0;this.options.hideDisabled&&(i+=":not(:disabled)"),!e.options.showTick&&!e.multiple||F.checkMark.parentNode||(F.checkMark.className=t+" "+e.options.tickIcon+" check-mark",F.a.appendChild(F.checkMark));var a=this.$element[0].querySelectorAll("select > *"+i);function c(e){var t=n[n.length-1];t&&"divider"===t.type&&(t.optID||e.optID)||((e=e||{}).type="divider",s.push(G.li(!1,j.DIVIDER,e.optID?e.optID+"div":void 0)),n.push(e))}function d(i,l){if((l=l||{}).divider="true"===i.getAttribute("data-divider"),l.divider)c({optID:l.optID});else{var r=n.length,a=i.style.cssText,d=a?T(a):"",h=(i.className||"")+(l.optgroupClass||"");l.optID&&(h="opt "+h),l.text=i.textContent,l.content=i.getAttribute("data-content"),l.tokens=i.getAttribute("data-tokens"),l.subtext=i.getAttribute("data-subtext"),l.icon=i.getAttribute("data-icon"),l.iconBase=t;var p=G.text(l);s.push(G.li(G.a(p,h,d),"",l.optID)),i.liIndex=r,l.display=l.content||l.text,l.type="option",l.index=r,l.option=i,l.disabled=l.disabled||i.disabled,n.push(l);var u=0;l.display&&(u+=l.display.length),l.subtext&&(u+=l.subtext.length),l.icon&&(u+=1),u>o&&(o=u,e.selectpicker.view.widestOption=s[s.length-1])}}function h(e,o){var r=o[e],a=o[e-1],h=o[e+1],p=r.querySelectorAll("option"+i);if(p.length){var u,f,m={label:T(r.label),subtext:r.getAttribute("data-subtext"),icon:r.getAttribute("data-icon"),iconBase:t},v=" "+(r.className||"");l++,a&&c({optID:l});var g=G.label(m);s.push(G.li(g,"dropdown-header"+v,l)),n.push({display:m.label,subtext:m.subtext,type:"optgroup-label",optID:l});for(var b=0,w=p.length;b li")},render:function(){this.setPlaceholder();var e,t,i=this.$element[0].selectedOptions,s=i.length,n=this.$button[0],o=n.querySelector(".filter-option-inner-inner"),l=document.createTextNode(this.options.multipleSeparator),a=F.fragment.cloneNode(!1),c=!1;if(this.togglePlaceholder(),this.tabIndex(),"static"===this.options.selectedTextFormat)a=G.text({text:this.options.title},!0);else if((e=this.multiple&&-1!==this.options.selectedTextFormat.indexOf("count")&&s>1)&&(e=(t=this.options.selectedTextFormat.split(">")).length>1&&s>t[1]||1===t.length&&s>=2),!1===e){for(var d=0;d0&&a.appendChild(l.cloneNode(!1)),h.title?p.text=h.title:u.content&&this.options.showContent?(p.content=u.content.toString(),c=!0):(this.options.showIcon&&(p.icon=u.icon,p.iconBase=this.options.iconBase),this.options.showSubtext&&!this.multiple&&u.subtext&&(p.subtext=" "+u.subtext),p.text=h.textContent.trim()),a.appendChild(G.text(p,!0))}s>49&&a.appendChild(document.createTextNode("..."))}else{var f=':not([hidden]):not([data-hidden="true"]):not([data-divider="true"])';this.options.hideDisabled&&(f+=":not(:disabled)");var m=this.$element[0].querySelectorAll("select > option"+f+", optgroup"+f+" option"+f).length,v="function"==typeof this.options.countSelectedText?this.options.countSelectedText(s,m):this.options.countSelectedText;a=G.text({text:v.replace("{0}",s.toString()).replace("{1}",m.toString())},!0)}if(null==this.options.title&&(this.options.title=this.$element.attr("title")),a.childNodes.length||(a=G.text({text:void 0!==this.options.title?this.options.title:this.options.noneSelectedText},!0)),n.title=a.textContent.replace(/<[^>]*>?/g,"").trim(),this.options.sanitize&&c&&r([a],this.options.whiteList,this.options.sanitizeFn),o.innerHTML="",o.appendChild(a),M.major<4&&this.$newElement[0].classList.contains("bs3-has-addon")){var g=n.querySelector(".filter-expand"),b=o.cloneNode(!0);b.className="filter-expand",g?n.replaceChild(b,g):n.appendChild(b)}this.$element.trigger("rendered.bs.select")},setStyle:function(e,t){var i,s=this.$button[0],n=this.$newElement[0],o=this.options.style.trim();this.$element.attr("class")&&this.$newElement.addClass(this.$element.attr("class").replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi,"")),M.major<4&&(n.classList.add("bs3"),n.parentNode.classList.contains("input-group")&&(n.previousElementSibling||n.nextElementSibling)&&(n.previousElementSibling||n.nextElementSibling).classList.contains("input-group-addon")&&n.classList.add("bs3-has-addon")),i=e?e.trim():o,"add"==t?i&&s.classList.add.apply(s.classList,i.split(" ")):"remove"==t?i&&s.classList.remove.apply(s.classList,i.split(" ")):(o&&s.classList.remove.apply(s.classList,o.split(" ")),i&&s.classList.add.apply(s.classList,i.split(" ")))},liHeight:function(t){if(t||!1!==this.options.size&&!this.sizeInfo){this.sizeInfo||(this.sizeInfo={});var i=document.createElement("div"),s=document.createElement("div"),n=document.createElement("div"),o=document.createElement("ul"),l=document.createElement("li"),r=document.createElement("li"),a=document.createElement("li"),c=document.createElement("a"),d=document.createElement("span"),h=this.options.header&&this.$menu.find("."+j.POPOVERHEADER).length>0?this.$menu.find("."+j.POPOVERHEADER)[0].cloneNode(!0):null,p=this.options.liveSearch?document.createElement("div"):null,u=this.options.actionsBox&&this.multiple&&this.$menu.find(".bs-actionsbox").length>0?this.$menu.find(".bs-actionsbox")[0].cloneNode(!0):null,f=this.options.doneButton&&this.multiple&&this.$menu.find(".bs-donebutton").length>0?this.$menu.find(".bs-donebutton")[0].cloneNode(!0):null,m=this.$element.find("option")[0];if(this.sizeInfo.selectWidth=this.$newElement[0].offsetWidth,d.className="text",c.className="dropdown-item "+(m?m.className:""),i.className=this.$menu[0].parentNode.className+" "+j.SHOW,i.style.width=this.sizeInfo.selectWidth+"px","auto"===this.options.width&&(s.style.minWidth=0),s.className=j.MENU+" "+j.SHOW,n.className="inner "+j.SHOW,o.className=j.MENU+" inner "+("4"===M.major?j.SHOW:""),l.className=j.DIVIDER,r.className="dropdown-header",d.appendChild(document.createTextNode("​")),c.appendChild(d),a.appendChild(c),r.appendChild(d.cloneNode(!0)),this.selectpicker.view.widestOption&&o.appendChild(this.selectpicker.view.widestOption.cloneNode(!0)),o.appendChild(a),o.appendChild(l),o.appendChild(r),h&&s.appendChild(h),p){var v=document.createElement("input");p.className="bs-searchbox",v.className="form-control",p.appendChild(v),s.appendChild(p)}u&&s.appendChild(u),n.appendChild(o),s.appendChild(n),f&&s.appendChild(f),i.appendChild(s),document.body.appendChild(i);var g,b=a.offsetHeight,w=r?r.offsetHeight:0,I=h?h.offsetHeight:0,k=p?p.offsetHeight:0,$=u?u.offsetHeight:0,y=f?f.offsetHeight:0,S=e(l).outerHeight(!0),E=!!window.getComputedStyle&&window.getComputedStyle(s),C=s.offsetWidth,O=E?null:e(s),z={vert:x(E?E.paddingTop:O.css("paddingTop"))+x(E?E.paddingBottom:O.css("paddingBottom"))+x(E?E.borderTopWidth:O.css("borderTopWidth"))+x(E?E.borderBottomWidth:O.css("borderBottomWidth")),horiz:x(E?E.paddingLeft:O.css("paddingLeft"))+x(E?E.paddingRight:O.css("paddingRight"))+x(E?E.borderLeftWidth:O.css("borderLeftWidth"))+x(E?E.borderRightWidth:O.css("borderRightWidth"))},L={vert:z.vert+x(E?E.marginTop:O.css("marginTop"))+x(E?E.marginBottom:O.css("marginBottom"))+2,horiz:z.horiz+x(E?E.marginLeft:O.css("marginLeft"))+x(E?E.marginRight:O.css("marginRight"))+2};n.style.overflowY="scroll",g=s.offsetWidth-C,document.body.removeChild(i),this.sizeInfo.liHeight=b,this.sizeInfo.dropdownHeaderHeight=w,this.sizeInfo.headerHeight=I,this.sizeInfo.searchHeight=k,this.sizeInfo.actionsHeight=$,this.sizeInfo.doneButtonHeight=y,this.sizeInfo.dividerHeight=S,this.sizeInfo.menuPadding=z,this.sizeInfo.menuExtras=L,this.sizeInfo.menuWidth=C,this.sizeInfo.totalMenuWidth=this.sizeInfo.menuWidth,this.sizeInfo.scrollBarWidth=g,this.sizeInfo.selectHeight=this.$newElement[0].offsetHeight,this.setPositionData()}},getSelectPosition:function(){var t,i=e(window),s=this.$newElement.offset(),n=e(this.options.container);this.options.container&&n.length&&!n.is("body")?((t=n.offset()).top+=parseInt(n.css("borderTopWidth")),t.left+=parseInt(n.css("borderLeftWidth"))):t={top:0,left:0};var o=this.options.windowPadding;this.sizeInfo.selectOffsetTop=s.top-t.top-i.scrollTop(),this.sizeInfo.selectOffsetBot=i.height()-this.sizeInfo.selectOffsetTop-this.sizeInfo.selectHeight-t.top-o[2],this.sizeInfo.selectOffsetLeft=s.left-t.left-i.scrollLeft(),this.sizeInfo.selectOffsetRight=i.width()-this.sizeInfo.selectOffsetLeft-this.sizeInfo.selectWidth-t.left-o[1],this.sizeInfo.selectOffsetTop-=o[0],this.sizeInfo.selectOffsetLeft-=o[3]},setMenuSize:function(e){this.getSelectPosition();var t,i,s,n,o,l,r,a=this.sizeInfo.selectWidth,c=this.sizeInfo.liHeight,d=this.sizeInfo.headerHeight,h=this.sizeInfo.searchHeight,p=this.sizeInfo.actionsHeight,u=this.sizeInfo.doneButtonHeight,f=this.sizeInfo.dividerHeight,m=this.sizeInfo.menuPadding,v=0;if(this.options.dropupAuto&&(r=c*this.selectpicker.current.elements.length+m.vert,this.$newElement.toggleClass(j.DROPUP,this.sizeInfo.selectOffsetTop-this.sizeInfo.selectOffsetBot>this.sizeInfo.menuExtras.vert&&r+this.sizeInfo.menuExtras.vert+50>this.sizeInfo.selectOffsetBot)),"auto"===this.options.size)n=this.selectpicker.current.elements.length>3?3*this.sizeInfo.liHeight+this.sizeInfo.menuExtras.vert-2:0,i=this.sizeInfo.selectOffsetBot-this.sizeInfo.menuExtras.vert,s=n+d+h+p+u,l=Math.max(n-m.vert,0),this.$newElement.hasClass(j.DROPUP)&&(i=this.sizeInfo.selectOffsetTop-this.sizeInfo.menuExtras.vert),o=i,t=i-d-h-p-u-m.vert;else if(this.options.size&&"auto"!=this.options.size&&this.selectpicker.current.elements.length>this.options.size){for(var g=0;gthis.sizeInfo.selectOffsetRight&&this.sizeInfo.selectOffsetRightthis.sizeInfo.menuInnerHeight&&(this.sizeInfo.hasScrollBar=!0,this.sizeInfo.totalMenuWidth=this.sizeInfo.menuWidth+this.sizeInfo.scrollBarWidth,this.$menu.css("min-width",this.sizeInfo.totalMenuWidth)),this.dropdown&&this.dropdown._popper&&this.dropdown._popper.update()},setSize:function(t){if(this.liHeight(t),this.options.header&&this.$menu.css("padding-top",0),!1!==this.options.size){var i,s=this,n=e(window),o=0;if(this.setMenuSize(),this.options.liveSearch&&this.$searchbox.off("input.setMenuSize propertychange.setMenuSize").on("input.setMenuSize propertychange.setMenuSize",function(){return s.setMenuSize()}),"auto"===this.options.size?n.off("resize.bs.select."+this.selectId+".setMenuSize scroll"+U+"."+this.selectId+".setMenuSize").on("resize.bs.select."+this.selectId+".setMenuSize scroll"+U+"."+this.selectId+".setMenuSize",function(){return s.setMenuSize()}):this.options.size&&"auto"!=this.options.size&&this.selectpicker.current.elements.length>this.options.size&&n.off("resize.bs.select."+this.selectId+".setMenuSize scroll"+U+"."+this.selectId+".setMenuSize"),t)o=this.$menuInner[0].scrollTop;else if(!s.multiple){var l=s.$element[0];"number"==typeof(i=(l.options[l.selectedIndex]||{}).liIndex)&&!1!==s.options.size&&(o=(o=s.sizeInfo.liHeight*i)-s.sizeInfo.menuInnerHeight/2+s.sizeInfo.liHeight/2)}s.createView(!1,o)}},setWidth:function(){var e=this;"auto"===this.options.width?requestAnimationFrame(function(){e.$menu.css("min-width","0"),e.$element.on("loaded.bs.select",function(){e.liHeight(),e.setMenuSize();var t=e.$newElement.clone().appendTo("body"),i=t.css("width","auto").children("button").outerWidth();t.remove(),e.sizeInfo.selectWidth=Math.max(e.sizeInfo.totalMenuWidth,i),e.$newElement.css("width",e.sizeInfo.selectWidth+"px")})}):"fit"===this.options.width?(this.$menu.css("min-width",""),this.$newElement.css("width","").addClass("fit-width")):this.options.width?(this.$menu.css("min-width",""),this.$newElement.css("width",this.options.width)):(this.$menu.css("min-width",""),this.$newElement.css("width","")),this.$newElement.hasClass("fit-width")&&"fit"!==this.options.width&&this.$newElement[0].classList.remove("fit-width")},selectPosition:function(){this.$bsContainer=e('
');var t,i,s,n=this,o=e(this.options.container),l=function(l){var r={},a=n.options.display||!!e.fn.dropdown.Constructor.Default&&e.fn.dropdown.Constructor.Default.display;n.$bsContainer.addClass(l.attr("class").replace(/form-control|fit-width/gi,"")).toggleClass(j.DROPUP,l.hasClass(j.DROPUP)),t=l.offset(),o.is("body")?i={top:0,left:0}:((i=o.offset()).top+=parseInt(o.css("borderTopWidth"))-o.scrollTop(),i.left+=parseInt(o.css("borderLeftWidth"))-o.scrollLeft()),s=l.hasClass(j.DROPUP)?0:l[0].offsetHeight,(M.major<4||"static"===a)&&(r.top=t.top-i.top+s,r.left=t.left-i.left),r.width=l[0].offsetWidth,n.$bsContainer.css(r)};this.$button.on("click.bs.dropdown.data-api",function(){n.isDisabled()||(l(n.$newElement),n.$bsContainer.appendTo(n.options.container).toggleClass(j.SHOW,!n.$button.hasClass(j.SHOW)).append(n.$menu))}),e(window).off("resize.bs.select."+this.selectId+" scroll"+U+"."+this.selectId).on("resize.bs.select."+this.selectId+" scroll"+U+"."+this.selectId,function(){n.$newElement.hasClass(j.SHOW)&&l(n.$newElement)}),this.$element.on("hide.bs.select",function(){n.$menu.data("height",n.$menu.height()),n.$bsContainer.detach()})},setOptionStatus:function(){if(this.noScroll=!1,this.selectpicker.view.visibleElements&&this.selectpicker.view.visibleElements.length)for(var e=0;e3&&!t.dropdown&&(t.dropdown=t.$button.data("bs.dropdown"),t.dropdown._menu=t.$menu[0])}),this.$button.on("click.bs.dropdown.data-api",function(){t.$newElement.hasClass(j.SHOW)||t.setSize()}),this.$element.on("shown.bs.select",function(){t.$menuInner[0].scrollTop!==t.selectpicker.view.scrollTop&&(t.$menuInner[0].scrollTop=t.selectpicker.view.scrollTop),M.major>3?requestAnimationFrame(n):s()}),this.$menuInner.on("click","li a",function(i,s){var n=e(this),o=t.isVirtual()?t.selectpicker.view.position0:0,l=t.selectpicker.current.data[n.parent().index()+o],r=l.index,a=m(t.$element[0]),c=t.$element.prop("selectedIndex"),d=!0;if(t.multiple&&1!==t.options.maxOptions&&i.stopPropagation(),i.preventDefault(),!t.isDisabled()&&!n.parent().hasClass(j.DISABLED)){var h=t.$element.find("option"),p=l.option,u=e(p),f=p.selected,v=u.parent("optgroup"),b=v.find("option"),w=t.options.maxOptions,x=v.data("maxOptions")||!1;if(r===t.activeIndex&&(s=!0),s||(t.prevActiveIndex=t.activeIndex,t.activeIndex=void 0),t.multiple){if(p.selected=!f,t.setSelected(r,!f),n.trigger("blur"),!1!==w||!1!==x){var I=w
');S[2]&&(E=E.replace("{var}",S[2][w>1?0:1]),C=C.replace("{var}",S[2][x>1?0:1])),u.prop("selected",!1),t.$menu.append(O),w&&I&&(O.append(e("
"+E+"
")),d=!1,t.$element.trigger("maxReached.bs.select")),x&&k&&(O.append(e("
"+C+"
")),d=!1,t.$element.trigger("maxReachedGrp.bs.select")),setTimeout(function(){t.setSelected(r,!1)},10),O.delay(750).fadeOut(300,function(){e(this).remove()})}}}else h.prop("selected",!1),p.selected=!0,t.setSelected(r,!0);!t.multiple||t.multiple&&1===t.options.maxOptions?t.$button.trigger("focus"):t.options.liveSearch&&t.$searchbox.trigger("focus"),d&&(a!=m(t.$element[0])&&t.multiple||c!=t.$element.prop("selectedIndex")&&!t.multiple)&&(g=[p.index,u.prop("selected"),a],t.$element.triggerNative("change"))}}),this.$menu.on("click","li."+j.DISABLED+" a, ."+j.POPOVERHEADER+", ."+j.POPOVERHEADER+" :not(.close)",function(i){i.currentTarget==this&&(i.preventDefault(),i.stopPropagation(),t.options.liveSearch&&!e(i.target).hasClass("close")?t.$searchbox.trigger("focus"):t.$button.trigger("focus"))}),this.$menuInner.on("click",".divider, .dropdown-header",function(e){e.preventDefault(),e.stopPropagation(),t.options.liveSearch?t.$searchbox.trigger("focus"):t.$button.trigger("focus")}),this.$menu.on("click","."+j.POPOVERHEADER+" .close",function(){t.$button.trigger("click")}),this.$searchbox.on("click",function(e){e.stopPropagation()}),this.$menu.on("click",".actions-btn",function(i){t.options.liveSearch?t.$searchbox.trigger("focus"):t.$button.trigger("focus"),i.preventDefault(),i.stopPropagation(),e(this).hasClass("bs-select-all")?t.selectAll():t.deselectAll()}),this.$element.on("change.bs.select",function(){t.render(),t.$element.trigger("changed.bs.select",g),g=null}).on("focus.bs.select",function(){t.options.mobile||t.$button.trigger("focus")})},liveSearchListener:function(){var e=this,t=document.createElement("li");this.$button.on("click.bs.dropdown.data-api",function(){e.$searchbox.val()&&e.$searchbox.val("")}),this.$searchbox.on("click.bs.dropdown.data-api focus.bs.dropdown.data-api touchend.bs.dropdown.data-api",function(e){e.stopPropagation()}),this.$searchbox.on("input propertychange",function(){var i=e.$searchbox.val();if(e.selectpicker.search.elements=[],e.selectpicker.search.data=[],i){var s=[],n=i.toUpperCase(),o={},l=[],r=e._searchStyle(),a=e.options.liveSearchNormalize;a&&(n=S(n)),e._$lisSelected=e.$menuInner.find(".selected");for(var c=0;c0&&(o[d.headerIndex-1]=!0,l.push(d.headerIndex-1)),o[d.headerIndex]=!0,l.push(d.headerIndex),o[d.lastIndex+1]=!0),o[c]&&"optgroup-label"!==d.type&&l.push(c)}c=0;for(var h=l.length;c=48&&t.which<=57||t.which>=96&&t.which<=105||t.which>=65&&t.which<=90)&&(c.$button.trigger("click.bs.dropdown.data-api"),c.options.liveSearch))c.$searchbox.trigger("focus");else{if(t.which===N&&s&&(t.preventDefault(),c.$button.trigger("click.bs.dropdown.data-api").trigger("focus")),u){if(!d.length)return;void 0===(i=!0===m?d.index(d.filter(".active")):c.activeIndex)&&(i=-1),-1!==i&&((n=c.selectpicker.current.elements[i+v]).classList.remove("active"),n.firstChild&&n.firstChild.classList.remove("active")),t.which===P?(-1!==i&&i--,i+v<0&&(i+=d.length),c.selectpicker.view.canHighlight[i+v]||-1===(i=c.selectpicker.view.canHighlight.slice(0,i+v).lastIndexOf(!0)-v)&&(i=d.length-1)):(t.which===W||p)&&(++i+v>=c.selectpicker.view.canHighlight.length&&(i=0),c.selectpicker.view.canHighlight[i+v]||(i=i+1+c.selectpicker.view.canHighlight.slice(i+v+1).indexOf(!0))),t.preventDefault();var g=v+i;t.which===P?0===v&&i===d.length-1?(c.$menuInner[0].scrollTop=c.$menuInner[0].scrollHeight,g=c.selectpicker.current.elements.length-1):h=(l=(o=c.selectpicker.current.data[g]).position-o.height)f),(n=c.selectpicker.current.elements[g])&&(n.classList.add("active"),n.firstChild&&n.firstChild.classList.add("active")),c.activeIndex=c.selectpicker.current.data[g].index,c.selectpicker.view.currentActive=n,h&&(c.$menuInner[0].scrollTop=l),c.options.liveSearch?c.$searchbox.trigger("focus"):r.trigger("focus")}else if(!r.is("input")&&!q.test(t.which)||t.which===H&&c.selectpicker.keydown.keyHistory){var b,x,I=[];t.preventDefault(),c.selectpicker.keydown.keyHistory+=A[t.which],c.selectpicker.keydown.resetKeyHistory.cancel&&clearTimeout(c.selectpicker.keydown.resetKeyHistory.cancel),c.selectpicker.keydown.resetKeyHistory.cancel=c.selectpicker.keydown.resetKeyHistory.start(),x=c.selectpicker.keydown.keyHistory,/^(.)\1+$/.test(x)&&(x=x.charAt(0));for(var k=0;k0?(l=o.position-o.height,h=!0):(l=o.position-c.sizeInfo.menuInnerHeight,h=o.position>f+c.sizeInfo.menuInnerHeight),(n=c.selectpicker.main.elements[b]).classList.add("active"),n.firstChild&&n.firstChild.classList.add("active"),c.activeIndex=I[y],n.firstChild.focus(),h&&(c.$menuInner[0].scrollTop=l),r.trigger("focus")}}s&&(t.which===H&&!c.selectpicker.keydown.keyHistory||t.which===D||t.which===B&&c.options.selectOnTab)&&(t.which!==H&&t.preventDefault(),c.options.liveSearch&&t.which===H||(c.$menuInner.find(".active a").trigger("click",!0),r.trigger("focus"),c.options.liveSearch||(t.preventDefault(),e(document).data("spaceSelect",!0))))}},mobile:function(){this.$element[0].classList.add("mobile-device")},refresh:function(){var t=e.extend({},this.options,this.$element.data());this.options=t,this.checkDisabled(),this.setStyle(),this.render(),this.createLi(),this.setWidth(),this.setSize(!0),this.$element.trigger("refreshed.bs.select")},hide:function(){this.$newElement.hide()},show:function(){this.$newElement.show()},remove:function(){this.$newElement.remove(),this.$element.remove()},destroy:function(){this.$newElement.before(this.$element).remove(),this.$bsContainer?this.$bsContainer.remove():this.$menu.remove(),this.$element.off(U).removeData("selectpicker").removeClass("bs-select-hidden selectpicker"),e(window).off(".bs.select."+this.selectId)}};var Z=e.fn.selectpicker;e.fn.selectpicker=Y,e.fn.selectpicker.Constructor=K,e.fn.selectpicker.noConflict=function(){return e.fn.selectpicker=Z,this},e(document).off("keydown.bs.dropdown.data-api").on("keydown.bs.select",'.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input',K.prototype.keydown).on("focusin.modal",'.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input',function(e){e.stopPropagation()}),e(window).on("load.bs.select.data-api",function(){e(".selectpicker").each(function(){var t=e(this);Y.call(t,t.data())})})}(e)});