require(["jquery"],function(b){var a=function(d){var c=this;c.selectWidget=b(d);c.triggerSelectionChange=function(){c.selectWidget.trigger("xwiki:select:updated",{elements:c.selectWidget[0]})};c.onOptionClicked=function(){var f=b(this);var e=f.find("input");if(e.prop("checked")){return}e.prop("checked",true);c.selectWidget.find(".xwiki-select-option-selected").removeClass("xwiki-select-option-selected");f.addClass("xwiki-select-option-selected");c.triggerSelectionChange()};c.onFilterChange=function(){var f=b(this);var h=f.val().split(" ");var r=0;var q=c.selectWidget.find(".xwiki-select-category");for(var o=0;o<q.length;++o){var e=b(q[o]);var w=e.find(".xwiki-select-option");var s=0;for(var n=0;n<w.length;++n){var p=b(w[n]);var u=p.find("label").text().toLowerCase();var m=p.find(".xHint").text().toLowerCase();var v=u+" "+m;var g=true;for(var l=0;l<h.length;++l){var t=h[l].toLowerCase();if(v.indexOf(t)==-1){g=false;break}}if(g){p.show();s++}else{p.hide()}}e.find(".xwiki-select-category-count").text(s);if(s==0){e.hide()}else{e.show();r++}}if(r==0){if(c.selectWidget.find(".xwiki-select-no-results").length==0){c.selectWidget.find(".xwiki-select-options").append('<p class="xwiki-select-no-results">\u041D\u0435\u0442 \u043F\u043E\u0434\u0445\u043E\u0434\u044F\u0449\u0435\u0433\u043E \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u0430...</p>')}}else{c.selectWidget.find(".xwiki-select-no-results").remove()}};c.init=function(){c.selectWidget.find(".xwiki-select-option").click(c.onOptionClicked);c.selectWidget.find("input.xwiki-select-filter").change(c.onFilterChange).keyup(c.onFilterChange)};c.clearSelection=function(){c.selectWidget.find(".xwiki-select-option-selected").removeClass("xwiki-select-option-selected");c.selectWidget.find('input[type="radio"]:checked').prop("checked",false);c.triggerSelectionChange()};c.getValue=function(){return c.selectWidget.find('input[type="radio"]:checked').val()};c.init()};b.fn.xwikiSelectWidget=function(d){if(!d||d=="init"){for(var c=0;c<this.length;++c){var e=this[c];if(b(e).data("xwikiSelectWidget")){continue}b(e).data("xwikiSelectWidget",new a(e))}}else{if(d=="clearSelection"){for(var c=0;c<this.length;++c){b(this[c]).data("xwikiSelectWidget").clearSelection()}}else{if(d=="getValue"){return b(this[0]).data("xwikiSelectWidget").getValue()}}}return this};b(document).ready(function(){b(".xwiki-select").xwikiSelectWidget()})});