require.config({paths:{selectize:"../../../webjars/selectize.js/0.12.5/js/standalone/selectize.min"},shim:{selectize:["jquery"]}});define("xwiki-selectize",["jquery","selectize","xwiki-events-bridge"],function(f,i){var k=['<div class="xwiki-selectize-option" data-value="">','<span class="xwiki-selectize-option-icon" />','<span class="xwiki-selectize-option-label" />',"</div>"].join("");var g=function(s){var n=f(k);var t=(s&&typeof s==="object")?s.value:s;n.attr("data-value",t);var r=s&&s.icon;if(typeof r==="object"){if(!r.iconSetType&&r.url){r.iconSetType="IMAGE"}else{if(!r.iconSetType&&r.cssClass){r.iconSetType="FONT"}}if(r.iconSetType==="IMAGE"){var u=f('<img class="xwiki-selectize-option-icon" alt="" />').attr("src",r.url);n.find(".xwiki-selectize-option-icon").replaceWith(u)}else{if(r.iconSetType==="FONT"){n.find(".xwiki-selectize-option-icon").addClass(r.cssClass)}else{n.find(".xwiki-selectize-option-icon").remove()}}}else{n.find(".xwiki-selectize-option-icon").remove()}var q=s&&s.url;if(typeof q==="string"){var p=f('<a class="xwiki-selectize-option-label" />').attr("href",q);n.find(".xwiki-selectize-option-label").replaceWith(p)}var o=(s&&typeof s==="object")?(s.label||s.value):s;n.find(".xwiki-selectize-option-label").text(o);return n};var b=function(o){var n=g(o);n.addClass("option");n.find(".xwiki-selectize-option-icon").wrap('<span class="xwiki-selectize-option-icon-wrapper"/>');var p=o&&o.hint;if(typeof p==="string"&&p!==""){n.append(f('<div class="xwiki-selectize-option-hint"/>').text(p))}return n};var d=function(o){var n=g(o);var p=o&&o.hint;if(typeof p==="string"&&p!==""){n.attr("title",p)}return n};var h={copyClassesToDropdown:false,dropdownParent:"body",highlight:false,labelField:"label",loadThrottle:500,onDropdownClose:function(n){n.removeClass("active")},onDropdownOpen:function(n){n.addClass("active")},persist:false,preload:"focus",render:{item:d,option:b,option_create:function(o,p){var q="Select {0} ...";var n=f('<div class="create option"/>').html(p(q).replace("{0}","<em/>"));n.find("em").text(o.input);return n}},searchField:["value","label","hint"],onType:function(n){var o=typeof this.settings.load==="function"&&!this.loadedSearches.hasOwnProperty(n);(this.$wrapper).toggleClass(this.settings.loadingClass,o)},onInitialize:function(){var n=this.$control;n.on("click","a.xwiki-selectize-option-label",function(o){o.preventDefault()})}};var c=function(){var n=this.selectize;var o=n.$wrapper;o.addClass(n.settings.loadingClass);n.loading++;n.items.reduce(function(p,q){return p.then(function(){return m(n,q)})},f.Deferred().resolve()).always(function(){n.loading=Math.max(n.loading-1,0);if(!n.loading){o.removeClass(n.settings.loadingClass)}})};var m=function(o,q){var n=f.Deferred();var p;if(typeof o.settings.loadSelected==="function"){p=o.settings.loadSelected}else{p=o.settings.load}if(q&&typeof p==="function"){p.call(o,q,function(r){f.isArray(r)&&r.forEach(function(s){var t=s[o.settings.valueField];if(o.options.hasOwnProperty(t)){o.updateOption(t,s)}else{o.addOption(s)}});n.resolve()})}else{n.resolve()}return n.promise()};var j=function(){var n=this.selectize.positionDropdown;this.selectize.positionDropdown=function(){if(this.settings.dropdownParent==="body"){n.call(this)}if(this.settings.dropdownWidth==="auto"){this["$dropdown"].css({width:"","min-width":this["$control"][0].getBoundingClientRect().width})}};a(this.selectize);if(this.selectize.settings.takeInputWidth){this.selectize["$control"].width(f(this).data("initialWidth"))}this.selectize["$control_input"].attr("title",f(this).attr("title"))};var a=function(n){var o=n.settings.dropdownAlignment;if(!o&&n.settings.dropdownParent!=="body"){o="left"}if(o){n["$dropdown"].addClass("selectize-dropdown-"+o)}};var e=function(n){var o={};if(n.closest(".xform").length===0){o.dropdownWidth="auto"}return o};i.prototype.get$=function(n){return this["$"+n]};var l=function(n,o){return f.extend({},h,e(n),o,n.data("xwiki-selectize"))};f.fn.xwikiSelectize=function(n){this.each(function(){f(this).data("initialWidth",f(this).width())});return this.not(".selectized, .selectize-control").on("initialize",j).on("change",function(o){var p=f(this).closest(".xwiki-livetable-display-header-filter").closest(".xwiki-livetable").attr("id");p&&f(document).trigger("xwiki:livetable:"+p+":filtersChanged")}).each(function(){var o=f(this).attr("id");f(this).removeAttr("id");f(this).selectize(l(f(this),n));if(o){this.selectize.get$("control_input").attr("id",o+"-selectized");f("label").filter(function(){return f(this).attr("for")===o}).attr("for",o+"-selectized");f(this).attr("id",o)}}).trigger("initialize").each(c)}});require(["jquery","xwiki-selectize","xwiki-events-bridge"],function(a){if(a.fn.xwikiSelectize.initialized){return}a.fn.xwikiSelectize.initialized=true;var b=function(d,e){var c=a((e&&e.elements)||document);c.find(".xwiki-selectize").xwikiSelectize()};a(document).on("xwiki:dom:updated",b);XWiki.domIsLoaded&&b()});