/*! popupjs v1.0.0 | https://github.com/aui/popupjs */ !function(){function a(b){var d=c[b],e="exports";return"object"==typeof d?d:(d[e]||(d[e]={},d[e]=d.call(d[e],a,d[e],d)||d[e]),d[e])}function b(a,b){c[a]=b}var c={};b("jquery",function(){return jQuery}),b("popup",function(a){function b(){this.destroyed=!1,this.__popup=c("
").css({display:"none",position:"absolute",outline:0}).attr("tabindex","-1").html(this.innerHTML).appendTo("body"),this.__backdrop=this.__mask=c("
").css({opacity:.7,background:"#000"}),this.node=this.__popup[0],this.backdrop=this.__backdrop[0],d++}var c=a("jquery"),d=0,e=!("minWidth"in c("html")[0].style),f=!e;return c.extend(b.prototype,{node:null,backdrop:null,fixed:!1,destroyed:!0,open:!1,returnValue:"",autofocus:!0,align:"bottom left",innerHTML:"",className:"ui-popup",show:function(a){if(this.destroyed)return this;var d=this.__popup,g=this.__backdrop;if(this.__activeElement=this.__getActive(),this.open=!0,this.follow=a||this.follow,!this.__ready){if(d.addClass(this.className).attr("role",this.modal?"alertdialog":"dialog").css("position",this.fixed?"fixed":"absolute"),e||c(window).on("resize",c.proxy(this.reset,this)),this.modal){var h={position:"fixed",left:0,top:0,width:"100%",height:"100%",overflow:"hidden",userSelect:"none",zIndex:this.zIndex||b.zIndex};d.addClass(this.className+"-modal"),f||c.extend(h,{position:"absolute",width:c(window).width()+"px",height:c(document).height()+"px"}),g.css(h).attr({tabindex:"0"}).on("focus",c.proxy(this.focus,this)),this.__mask=g.clone(!0).attr("style","").insertAfter(d),g.addClass(this.className+"-backdrop").insertBefore(d),this.__ready=!0}d.html()||d.html(this.innerHTML)}return d.addClass(this.className+"-show").show(),g.show(),this.reset().focus(),this.__dispatchEvent("show"),this},showModal:function(){return this.modal=!0,this.show.apply(this,arguments)},close:function(a){return!this.destroyed&&this.open&&(void 0!==a&&(this.returnValue=a),this.__popup.hide().removeClass(this.className+"-show"),this.__backdrop.hide(),this.open=!1,this.blur(),this.__dispatchEvent("close")),this},remove:function(){if(this.destroyed)return this;this.__dispatchEvent("beforeremove"),b.current===this&&(b.current=null),this.__popup.remove(),this.__backdrop.remove(),this.__mask.remove(),e||c(window).off("resize",this.reset),this.__dispatchEvent("remove");for(var a in this)delete this[a];return this},reset:function(){var a=this.follow;return a?this.__follow(a):this.__center(),this.__dispatchEvent("reset"),this},focus:function(){var a=this.node,d=this.__popup,e=b.current,f=this.zIndex=b.zIndex++;if(e&&e!==this&&e.blur(!1),!c.contains(a,this.__getActive())){var g=d.find("[autofocus]")[0];!this._autofocus&&g?this._autofocus=!0:g=a,this.__focus(g)}return d.css("zIndex",f),b.current=this,d.addClass(this.className+"-focus"),this.__dispatchEvent("focus"),this},blur:function(){var a=this.__activeElement,b=arguments[0];return b!==!1&&this.__focus(a),this._autofocus=!1,this.__popup.removeClass(this.className+"-focus"),this.__dispatchEvent("blur"),this},addEventListener:function(a,b){return this.__getEventListener(a).push(b),this},removeEventListener:function(a,b){for(var c=this.__getEventListener(a),d=0;dH[E[b]][1]&&(b=B[a]=D[b]),F[a][b]',c("base")[0]?c("base").before(e):c("head").append(e))}var g=function(){};return g.prototype=d.prototype,b.prototype=new g,c.extend(b.prototype,{selectboxHtml:'
{{textContent}}
',dropdownHtml:'
{{options}}
',optgroupHtml:'
{{label}}
',optionHtml:'
{{textContent}}
',selectedClass:"ui-selectbox-selected",disabledClass:"ui-selectbox-disabled",focusClass:"ui-selectbox-focus",openClass:"ui-selectbox-open",isShowDropdown:!("createTouch"in document),selectedIndex:0,value:"",close:function(){this._popup&&(this._popup.close().remove(),this.change())},show:function(){var a=this,b=this.select,e=a._selectbox;if(!b[0].length)return!1;var f=20,g=b.outerHeight(),h=b.offset().top-c(document).scrollTop(),i=c(window).height()-h-g,j=Math.max(h,i)-f,k=this._popup=new d;k.node.innerHTML=this._dropdownHtml(),this._dropdown=c(k.node),c(k.backdrop).css("opacity",0).on(this._clickType,c.proxy(this.close,this));var l=a._dropdown.children(),m=!("minWidth"in l[0].style);l.css({minWidth:e.innerWidth(),maxHeight:j,overflowY:"auto",overflowX:"hidden"}),this._dropdown.on(this._clickType,"[data-option]",function(b){var d=c(this).data("option");a.selected(d),a.close(),b.preventDefault()}),k.onshow=function(){c(document).on("keydown",a._globalKeydown),e.addClass(a.openClass),a.selectedIndex=b[0].selectedIndex,a.selected(a.selectedIndex)},k.onremove=function(){c(document).off("keydown",a._globalKeydown),e.removeClass(a.openClass)},this._oldValue=this.select.val(),k.showModal(e[0]),m&&(l.css({width:Math.max(e.innerWidth(),l.outerWidth()),height:Math.min(j,l.outerHeight())}),k.reset())},selected:function(a){if(this._getOption(a).attr("disabled"))return!1;var b=this._dropdown,c=this._dropdown.find("[data-option="+a+"]"),d=this.select[0].options[a].value,e=this.select[0].selectedIndex,f=this.selectedClass;return b.find("[data-option="+e+"]").removeClass(f),c.addClass(f),c.focus(),this._value.html(this._getOption(a).html()),this.value=d,this.selectedIndex=a,this.select[0].selectedIndex=this.selectedIndex,this.select[0].value=this.value,!0},change:function(){this._oldValue!==this.value&&this.select.triggerHandler("change")},click:function(){this.select.focus(),this._popup&&this._popup.open?this.close():this.show()},focus:function(){this._selectbox.addClass(this.focusClass)},blur:function(){this._selectbox.removeClass(this.focusClass)},remove:function(){this.close(),this._selectbox.remove()},_clickType:"onmousedown"in document?"mousedown":"touchstart",_getOption:function(a){return a=void 0===a?this.select[0].selectedIndex:a,this.select.find("option").eq(a)},_tpl:function(a,b){return a.replace(/{{(.*?)}}/g,function(a,c){return b[c]})},_dropdownHtml:function(){var a="",b=this,d=this.select,e=d.data(),f=0,g=function(d){d.each(function(){var d=c(this),g="";g=this.selected?b.selectedClass:this.disabled?b.disabledClass:"",a+=b._tpl(b.optionHtml,c.extend({value:d.val(),textContent:d.html(),index:f,className:g},d.data(),e)),f++})};return d.find("optgroup").length?d.find("optgroup").each(function(d){a+=b._tpl(b.optgroupHtml,c.extend({index:d,label:this.label},c(this).data(),e)),g(c(this).find("option"))}):g(d.find("option")),this._tpl(this.dropdownHtml,{options:a})},_move:function(a){var b=0,c=this.select[0].length-1,d=this.select[0].selectedIndex+a;d>=b&&c>=d&&(this.selected(d)||this._move(a+a))},_globalKeydown:function(a){var b;switch(a.keyCode){case 8:b=!0;break;case 9:case 27:case 13:this.close(),b=!0;break;case 38:this._move(-1),b=!0;break;case 40:this._move(1),b=!0}b&&a.preventDefault()}}),function(a,d){"select"===a.type?new b(a,d):c(a).each(function(){new b(this,d)})}}),window.selectbox=a("selectbox")}();