"use strict";function_typeof(a){"@babel/helpers - typeof";return_typeof="function"==typeofSymbol&&"symbol"==typeofSymbol.iterator?function(a){returntypeofa}:function(a){returna&&"function"==typeofSymbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeofa},_typeof(a)}function_slicedToArray(a,b){return_arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function_nonIterableRest(){thrownewTypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function_unsupportedIterableToArray(a,b){if(a){if("string"==typeofa)return_arrayLikeToArray(a,b);varc=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void0}}function_arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(varc=0,d=Array(b);c<b;c++)d[c]=a[c];returnd}function_iterableToArrayLimit(a,b){varc=null==a?null:"undefined"!=typeofSymbol&&a[Symbol.iterator]||a["@@iterator"];if(null!=c){vard,e,f=[],g=!0,h=!1;try{for(c=c.call(a);!(g=(d=c.next()).done)&&(f.push(d.value),!(b&&f.length===b));g=!0);}catch(a){h=!0,e=a}finally{try{g||null==c["return"]||c["return"]()}finally{if(h)throwe}}returnf}}function_arrayWithHoles(a){if(Array.isArray(a))returna}/*global jQuery, define, module, require*//*!
varc=function(a,b){varc=null;"function"==typeofEvent?c=newEvent(b,{bubbles:!0}):(c=document.createEvent("Event"),c.initEvent(b,!0,!0)),a.dispatchEvent(c)};// missing forEach on NodeList for IE11
window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach);// This is the easiest way to have default options.
vard={placeholder:"Select Here",// Dont change it here.
csvDispCount:3,// display no. of items in multiselect. 0 to display all.
captionFormat:"{0} Selected",// format of caption text. you can set your locale.
captionFormatAllSelected:"{0} all selected!",// format of caption text when all elements are selected. set null to use captionFormat. It will not work if there are disabled elements in select.
floatWidth:400,// Screen width of device at which the list is rendered in floating popup fashion.
forceCustomRendering:!1,// force the custom modal on all devices below floatWidth resolution.
Pstate:[],lastUnselected:null,selectedCount:0,createElems:functioncreateElems(){varb=this,c=b.E.find("option:checked");//break for mobile rendring.. if forceCustomRendering is false
b.E.attr("name")&&b.select.addClass("sumo_".concat(b.E.attr("name").replace(/\[\]/,""))),b.E.addClass("SumoUnder").attr("tabindex","-1"),b.optDiv=a("<div class=\"optWrapper ".concat(f.up?"up":"","\">")),b.floatingList(),b.ul=a("<ul class=\"options\">"),b.optDiv.append(b.ul),f.clearAll&&b.is_multi&&b.ClearAll(),f.selectAll&&b.is_multi&&!f.max&&b.SelAll(),f.search&&b.Search(),b.ul.append(b.prepItems(b.E.children())),b.is_multi&&b.multiSelelect(),b.select.append(b.optDiv),b._handleMax(),b.basicEvents(),b.selAllState());// if there is a name attr in select add a class to container div
},prepItems:functionprepItems(b,c){vard=[],e=this;returna(b).each(function(b,f){// parsing options to li
varg=a(f);d.push(g.is("optgroup")?a("<li class=\"group ".concat(f.disabled?"disabled":"","\"><label></label><ul></ul></li>")).find("label").text(g.attr("label")).end().find("ul").append(e.prepItems(g.children(),f.disabled)).end():e.createLi(g,c))}),d},//## Creates a LI element from a given option and binds events to it
//## returns the jquery instance of li (not inserted in dom)
createLi:functioncreateLi(b,c){vard=this;b.attr("value")||b.attr("value",b.val());vare=a("<li class=\"opt\"><label>".concat(b.html(),"</label></li>"));returne.data("opt",b),b.data("li",e),d.is_multi&&e.prepend("<span><i></i></span>"),(b[0].disabled||c)&&e.addClass("disabled"),d.onOptClick(e),b[0].selected&&(e.addClass("selected"),d.selectedCount++),b.attr("class")&&e.addClass(b.attr("class")),b.attr("title")&&e.attr("title",b.attr("title")),f.renderLi(e,b)},//## Returns the selected items as string in a Multiselect.
getSelStr:functiongetSelStr(){// get the pre selected items.
varb=[];returnthis.E.find("option:checked").each(function(){b.push(a(this).val())}),b.join(f.csvSepChar)},//## THOSE OK/CANCEL BUTTONS ON MULTIPLE SELECT.
multiSelelect:functionmultiSelelect(){varb=this;b.optDiv.addClass("multiple"),b.okbtn=a("<p tabindex=\"0\" class=\"btnOk\"></p>").on("click",function(){b._okbtn(),b.hideOpts()});varc=_slicedToArray(f.locale,1);b.okbtn[0].innerText=c[0],b.cancelBtn=a("<p tabindex=\"0\" class=\"btnCancel\"></p>").on("click",function(){b._cnbtn(),b.hideOpts()});vard=_slicedToArray(f.locale,2);b.cancelBtn[0].innerText=d[1];vare=b.okbtn.add(b.cancelBtn);b.optDiv.append(a("<div class=\"MultiControls\">").append(e)),e.on("keydown.sumo",function(c){vard=a(this);switch(c.which){case32:// space
case13:d.trigger("click");break;case9://tab
if(d.hasClass("btnOk"))return;break;case27:returnb._cnbtn(),voidb.hideOpts();default:}c.stopPropagation(),c.preventDefault()})},_okbtn:function_okbtn(){vara=this,b=0;f.triggerChangeCombined&&(a.E.find("option:checked").length===a.Pstate.length?a.E.find("option").each(function(c,d){d.selected&&0>a.Pstate.indexOf(c)&&(b=1)}):b=1,b&&(a.callChange(),a.setText()))},_cnbtn:function_cnbtn(){vara=this;//remove all selections
a.E.find("option:checked").each(function(){this.selected=!1}),a.optDiv.find("li.selected").removeClass("selected");//restore selections from saved state.
for(varb=0;b<a.Pstate.length;b++)a.E.find("option")[a.Pstate[b]].selected=!0,a.ul.find("li.opt").eq(a.Pstate[b]).addClass("selected");a.setText(),a.selAllState()},_handleMax:function_handleMax(){f.max&&(this.selectedCount>=+f.max?this.optDiv.find("li.opt").not(".hidden").each(function(b,c){a(c).hasClass("selected")||a(c).addClass("temporary-disabled disabled")}):this.optDiv.find("li.opt").not(".hidden").each(function(b,c){a(c).hasClass("temporary-disabled")&&a(c).removeClass("temporary-disabled disabled")}))},ClearAll:functionClearAll(){varb=this;if(b.is_multi){b.selAll=a("<p class=\"reset-all\"><span><i></i></span><label></label></p>");varc=_slicedToArray(f.locale,4);b.selAll.find("label")[0].innerText=c[3],b.optDiv.addClass("resetAll"),b.selAll.on("click",function(){b.selAll.removeClass("selected"),b.toggSelAll(!1,1),f.closeAfterClearAll&&b.hideOpts()}),b.optDiv.prepend(b.selAll)}},SelAll:functionSelAll(){varb=this;if(b.is_multi){b.selAll=a("<p class=\"select-all\"><span><i></i></span><label></label></p>");varc=_slicedToArray(f.locale,3);b.selAll.find("label")[0].innerText=c[2],b.optDiv.addClass("selall"),b.selAll.on("click",function(){b.selAll.toggleClass("selected"),b.toggSelAll(b.selAll.hasClass("selected"),1),b.selAllState()}),b.optDiv.prepend(b.selAll)}},// search module (can be removed if not required.)
Search:functionSearch(){varc=this,d=c.CaptionCont.addClass("search"),e=a("<p class=\"no-match\">"),g=b.searchFn&&"function"==typeofb.searchFn?b.searchFn:f.searchFn;c.ftxt=a("<input type=\"search\" class=\"search-txt\" value=\"\" autocomplete=\"off\">").on("click",function(a){a.stopPropagation()}),c.ftxt[0].placeholder=f.searchText,d.append(c.ftxt),c.optDiv.children("ul").after(e),c.ftxt.on("input.sumo",function(){varb=c.optDiv.find("ul.options li.opt").each(function(b,d){vare=a(d),f=e.data("opt"),h=f[0];h.hidden=g(e.text(),c.ftxt.val(),e),e.toggleClass("hidden",h.hidden)}).not(".hidden");// Hide opt-groups with no options matched
c.optDiv[0].querySelectorAll("li.group").forEach(function(a){a.querySelector("li:not(.hidden)")?a.classList.remove("hidden"):a.classList.add("hidden")}),e.html(f.noMatch.replace(/\{0\}/g,"<em></em>")).toggle(!b.length),e.find("em").text(c.ftxt.val()),c.selAllState()})},selAllState:functionselAllState(){varb=this;if(f.selectAll&&b.is_multi){varc=0,d=0;b.optDiv.find("li.opt:not(.disabled):not(.hidden)").each(function(b,f){a(f).hasClass("selected")&&c++,d++}),c==d?b.selAll.removeClass("partial").addClass("selected"):0===c?b.selAll.removeClass("selected partial"):(f.selectAllPartialCheck&&b.selAll.addClass("partial"),b.selAll.removeClass("selected"))}},showOpts:functionshowOpts(){varb=this;if(!b.E.attr("disabled")){b.E.trigger("sumo:opening",b),b.is_opened=!0,b.select.addClass("open").attr("aria-expanded","true");// Scroll first selected option into view
varc=b.optDiv.find("li.opt.selected").first();if(c.length?b.optDiv.find(".options").scrollTop(c.position().top):b.optDiv.find(".options").scrollTop(0),b.E.trigger("sumo:opened",b),b.ftxt?b.ftxt.focus():b.select.focus(),a(document).on("click.sumo",function(a){if(!b.select.is(a.target)// if the target of the click isn't the container...
&&0===b.select.has(a.target).length){// ... nor a descendant of the container
if(!b.is_opened)return;b.hideOpts(),f.okCancelInMulti&&(f.isClickAwayOk?b._okbtn():b._cnbtn())}}),b.is_floating){vard=b.optDiv.children("ul").outerHeight()+2;// +2 is clear fix
b.is_multi&&(d+=+b.optDiv.css("padding-bottom")),b.optDiv.css("height",d),a("body").addClass("sumoStopScroll")}b.setPstate()}// if select is disabled then retrun
},//maintain state when ok/cancel buttons are available storing the indexes.
setPstate:functionsetPstate(){vara=this;a.is_multi&&(a.is_floating||f.okCancelInMulti)&&(a.Pstate=[],a.E.find("option").each(function(b,c){c.selected&&a.Pstate.push(b)}))},callChange:functioncallChange(){this.E.get().forEach(function(a){c(a,"change"),c(a,"click")})},hideOpts:functionhideOpts(){varb=this;b.is_opened&&(b.E.trigger("sumo:closing",b),b.is_opened=!1,b.select.removeClass("open").attr("aria-expanded","false").find("ul li.sel").removeClass("sel"),b.E.trigger("sumo:closed",b),a(document).off("click.sumo"),a("body").removeClass("sumoStopScroll"),f.search&&(b.ftxt.val(""),b.ftxt.trigger("input.sumo")))},setOnOpen:functionsetOnOpen(){vara=this,b=a.optDiv.find("li.opt:not(.hidden)").eq(f.search?0:a.E[0].selectedIndex);b.hasClass("disabled")&&(b=b.next(":not(disabled)"),!b.length)||(a.optDiv.find("li.sel").removeClass("sel"),b.addClass("sel"),a.showOpts())},nav:functionnav(a){varb=this,d=null,e=b.ul.find("li.opt.sel:not(.hidden)"),f=b.ul.find("li.opt:not(.disabled):not(.hidden)"),g=f.index(e);if(b.is_opened&&e.length){if(a&&0<g)d=f.eq(g-1);elseif(!a&&g<f.length-1&&-1<g)d=f.eq(g+1);elsereturn;// if no items before or after
e.removeClass("sel"),e=d.addClass("sel");// setting sel item to visible view.
varh=b.ul,i=h.scrollTop(),j=e.position().top+i;j>=i+h.height()-e.outerHeight()&&h.scrollTop(j-h.height()+e.outerHeight()),j<i&&h.scrollTop(j)}elseb.setOnOpen()},basicEvents:functionbasicEvents(){varb=this;b.CaptionCont.on("click",function(a){b.E.trigger("click"),b.is_opened?b.hideOpts():b.showOpts(),a.stopPropagation()}),b.select.on("keydown.sumo",function(a){switch(a.which){case38:b.nav(!0);break;case40:b.nav(!1);break;case65:// shortcut ctrl + a to select all and ctrl + shift + a to unselect all.
if(b.is_multi&&!f.max&&a.ctrlKey){b.toggSelAll(!a.shiftKey,1);break}elsereturn;case32:// space
if(f.search&&b.ftxt.is(a.target))return;break;case13:b.is_opened&&b.optDiv.find("ul li.sel").trigger("click"),f.search?b.select.focus():b.setOnOpen();break;case9:returnvoid(f.okCancelInMulti||b.hideOpts());case27:returnf.okCancelInMulti&&b._cnbtn(),b.hideOpts(),void(f.search&&b.select.focus());default:return;// die this handler for other keys
}a.preventDefault()}),a(window).on("resize.sumo",function(){b.floatingList()})},onOptClick:functiononOptClick(b){varc=this;b.on("click",function(){varb=a(this);b.hasClass("disabled")||(c.is_multi?(b.toggleClass("selected"),b.data("opt")[0].selected=b.hasClass("selected"),!1===b.data("opt")[0].selected?(c.lastUnselected=b.data("opt")[0].textContent,c.selectedCount--):c.selectedCount++,f.max&&c._handleMax(),c.selAllState()):(b.parent().find("li.selected").removeClass("selected"),b.toggleClass("selected"),b.data("opt")[0].selected=!0,c.selectedCount=1),!(c.is_multi&&f.triggerChangeCombined&&(c.is_floating||f.okCancelInMulti))&&(c.setText(),c.callChange()),!c.is_multi&&c.hideOpts())})},// fixed some variables that were not explicitly typed (michc)
b=e.length,a.placeholder=f.csvDispCount&&e.length>f.csvDispCount?e.length===a.E.find("option").length&&f.captionFormatAllSelected?f.captionFormatAllSelected.replace(/\{0\}/g,e.length):f.captionFormat.replace(/\{0\}/g,e.length):e.toArray().map(function(a){returna.innerText}).join(", ")}else{varg=a.E.find(":checked").not(":disabled");a.placeholder=g.text(),b=g.length}varc=!1;a.placeholder||(c=!0,a.placeholder=a.E.attr("placeholder"),!a.placeholder&&(//if placeholder is there then set it
a.placeholder=a.E.find("option:disabled:checked").text())),a.select.attr("selected-count",b),a.select.attr("is-selected",b?"true":"false"),a.placeholder=a.placeholder?"".concat(f.prefix," ").concat(a.placeholder):f.placeholder,a.caption.text(a.placeholder),f.showTitle&&a.CaptionCont.attr("title",a.placeholder);//set the hidden field if post as csv is true.
vard=a.select.find("input.HEMANT123");returnd.length&&d.val(a.getSelStr()),c?a.caption.addClass("placeholder"):a.caption.removeClass("placeholder"),a.placeholder},isMobile:functionisMobile(){// Adapted from http://www.detectmobilebrowsers.com
// Checks for iOs, Android, Blackberry, Opera Mini, and Windows mobile devices
for(vara=navigator.userAgent||navigator.vendor||window.opera,b=0;b<f.nativeOnDevice.length;b++)if(0<a.toString().toLowerCase().indexOf(f.nativeOnDevice[b].toLowerCase()))returnf.nativeOnDevice[b];return!1},setNativeMobile:functionsetNativeMobile(){vara=this;a.E.addClass("SelectClass"),a.mob=!0,a.E.change(function(){a.setText()})},floatingList:functionfloatingList(){varb=this;//called on init and also on resize.
//O.is_floating = true if window width is < specified float width
b.is_floating=a(window).width()<=f.floatWidth,b.optDiv.toggleClass("isFloating",b.is_floating),b.is_floating||b.optDiv.css("height",""),b.optDiv.toggleClass("okCancelInMulti",f.okCancelInMulti&&!b.is_floating)},//HELPERS FOR OUTSIDERS
// validates range of given item operations
vRange:functionvRange(a){varb=this,c=b.E.find("option");if(c.length<=a||0>a)thrownewError("index out of bounds");returnb},//toggles selection on c as boolean.
toggSel:functiontoggSel(b,c){vard=this,e=null;"number"==typeofc?(d.vRange(c),e=d.E.find("option")[c]):e=d.E.find("option[value=\"".concat(c,"\"]"))[0]||0,!e||e.disabled||e.selected!==b&&(f.max&&!e.selected&&d.selectedCount<f.max||e.selected||!f.max&&!e.selected)&&(e.selected=b,!d.mob&&a(e).data("li").toggleClass("selected",b),d.callChange(),d.setPstate(),d.setText(),d.selAllState())},//toggles disabled on c as boolean.
toggDis:functiontoggDis(a,b){varc=this.vRange(b);c.E.find("option")[b].disabled=a,a&&(c.E.find("option")[b].selected=!1),c.mob||c.optDiv.find("ul.options li.opt").eq(b).toggleClass("disabled",a).removeClass("selected"),c.setText()},// toggle disable/enable on complete select control
toggSumo:functiontoggSumo(a){varb=this;returnb.enabled=a,b.select.toggleClass("disabled",a),a?(b.E.attr("disabled","disabled"),b.select.removeAttr("tabindex")):(b.E.removeAttr("disabled"),b.select.attr("tabindex","0")),b},// toggles all option on c as boolean.
// set direct=false/0 bypasses okCancelInMulti behaviour.
toggSelAll:functiontoggSelAll(b,c){vard=this,e=a.extend(!0,{},a._data(d.E.get(0),"events"));d.E.off(),d.is_multi?b?d.E.find("option").toArray().filter(function(a){return!a.selected&&!a.disabled&&"none"!==a.style.display}).forEach(function(b){a(b).data("li").hasClass("hidden")||(b.selected=!0,a(b).data("li").toggleClass("selected",!0))}):d.E.find("option").toArray().filter(function(a){returna.selected&&!a.disabled&&"none"!==a.style.display}).forEach(function(b){a(b).data("li").hasClass("hidden")||(b.selected=!1,a(b).data("li").toggleClass("selected",!1))}):b?console.warn("You called `SelectAll` on a non-multiple select"):d.E[0].selectedIndex=-1,a.each(e,function(b,c){a.each(c,function(a,b){d.E.on(b.type,b.handler)})}),(!d.is_multi||f.okCancelInMulti)&&d.is_multi||(d.callChange(),d.setText()),c||(!d.mob&&d.selAll&&d.selAll.removeClass("partial").toggleClass("selected",!!b),d.setText(),d.setPstate())},/*outsideaccessibilityoptions
add:functionadd(b,c,d,f){if("undefined"==typeofb)thrownewError("No value to add");varg=this,h=g.E.find("option"),i=c,j=d;"number"==typeofc?(j=c,i=b):"undefined"==typeofc&&(i=b);vark=a("<option></option>").val(b).html(i);if(f&&"object"===_typeof(f)&&a.each(f,function(a,b){k.attr(a,b)}),h.length<j)thrownewError("index out of bounds");return"undefined"==typeofj||h.length===j?(g.E.append(k),!g.mob&&g.ul.append(g.createLi(k))):(h.eq(j).before(k),!g.mob&&g.ul.find("li.opt").eq(j).before(g.createLi(k))),e},//## removes an item at a given index.
remove:functionremove(a){varb=this.vRange(a);b.E.find("option").eq(a).remove(),b.mob||b.optDiv.find("ul.options li.opt").eq(a).remove(),b.setText()},// removes all but the selected one
removeAll:functionremoveAll(){for(vara=this,b=a.E.find("option"),c=b.length-1;0<=c;c--)!0!==b[c].selected&&a.remove(c)},find:functionfind(a){varb=this,c=b.E.find("option");for(vardinc)if(c[d].value===a)return+d;return-1},//## Select an item at a given index.
selectItem:functionselectItem(a){this.toggSel(!0,a)},//## UnSelect an iten at a given index.
unSelectItem:functionunSelectItem(a){this.toggSel(!1,a)},//## Select all items of the select.
selectAll:functionselectAll(){this.toggSelAll(!0)},//## UnSelect all items of the select.
unSelectAll:functionunSelectAll(){this.toggSelAll(!1)},//## Disable an iten at a given index.
disableItem:functiondisableItem(a){this.toggDis(!0,a)},//## Removes disabled an iten at a given index.
enableItem:functionenableItem(a){this.toggDis(!1,a)},//## New simple methods as getter and setter are not working fine in ie8-
//## variable to check state of control if enabled or disabled.
enabled:!0,//## Enables the control
enable:functionenable(){returnthis.toggSumo(!1)},//## Disables the control