text: /*! OOjs UI v0.19.5 | http://oojs.mit-license.org */
  !function(a){"use strict";a.ui={},a.ui.bind=$.proxy,a.ui.Keys={UNDEFINED:0,BACKSPACE:8,DELETE:46,LEFT:37,RIGHT:39,UP:38,DOWN:40,ENTER:13,END:35,HOME:36,TAB:9,PAGEUP:33,PAGEDOWN:34,ESCAPE:27,SHIFT:16,SPACE:32},a.ui.MouseButtons={LEFT:1,MIDDLE:2,RIGHT:3},a.ui.elementId=0,a.ui.generateElementId=function(){return a.ui.elementId++,"oojsui-"+a.ui.elementId},a.ui.isFocusableElement=function(a){var b,c=a[0];return!c.disabled&&(!(!$.expr.filters.visible(c)||a.parents().addBack().filter(function(){return"hidden"===$.css(this,"visibility")}).length)&&("true"===c.contentEditable||(a.prop("tabIndex")>=0||(b=c.nodeName.toLowerCase(),["input","select","textarea","button","object"].indexOf(b)!==-1||("a"===b||"area"===b)&&void 0!==a.attr("href")))))},a.ui.findFocusable=function(b,c){var d=$([]),e=b.find("input, select, textarea, button, object, a, area, [contenteditable], [tabindex]");return c&&(e=Array.prototype.reverse.call(e)),e.each(function(){var b=$(this);if(a.ui.isFocusableElement(b))return d=b,!1}),d},a.ui.getUserLanguages=function(){return["en"]},a.ui.getLocalValue=function(b,c,d){var e,f,g;if(b[c])return b[c];for(g=a.ui.getUserLanguages(),e=0,f=g.length;e<f;e++)if(c=g[e],b[c])return b[c];if(b[d])return b[d];for(c in b)return b[c]},a.ui.contains=function(a,b,c){var d;for(Array.isArray(a)||(a=[a]),d=a.length-1;d>=0;d--)if(c&&b===a[d]||$.contains(a[d],b))return!0;return!1},a.ui.debounce=function(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,c||a.apply(e,f)};c&&!d&&a.apply(e,f),d&&!b||(clearTimeout(d),d=setTimeout(g,b))}},a.ui.warnDeprecation=function(b){void 0!==a.getProp(window,"console","warn")&&console.warn(b)},a.ui.throttle=function(b,c){var d,e,f,g=0,h=function(){f=null,g=a.ui.now(),b.apply(d,e)};return function(){var b=c-(a.ui.now()-g);d=this,e=arguments,b<=0?(clearTimeout(f),h()):f||(f=setTimeout(h,b))}},a.ui.now=Date.now||function(){return(new Date).getTime()},a.ui.infuse=function(b){return a.ui.Element.static.infuse(b)},function(){var b={"ooui-outline-control-move-down":"Move item down","ooui-outline-control-move-up":"Move item up","ooui-outline-control-remove":"Remove item","ooui-toolbar-more":"More","ooui-toolgroup-expand":"More","ooui-toolgroup-collapse":"Fewer","ooui-dialog-message-accept":"OK","ooui-dialog-message-reject":"Cancel","ooui-dialog-process-error":"Something went wrong","ooui-dialog-process-dismiss":"Dismiss","ooui-dialog-process-retry":"Try again","ooui-dialog-process-continue":"Continue","ooui-selectfile-button-select":"Select a file","ooui-selectfile-not-supported":"File selection is not supported","ooui-selectfile-placeholder":"No file is selected","ooui-selectfile-dragdrop-placeholder":"Drop file here"};a.ui.msg=function(a){var c=b[a],d=Array.prototype.slice.call(arguments,1);return c="string"==typeof c?c.replace(/\$(\d+)/g,function(a,b){var c=parseInt(b,10);return void 0!==d[c-1]?d[c-1]:"$"+b}):"["+a+"]"}}(),a.ui.deferMsg=function(){var b=arguments;return function(){return a.ui.msg.apply(a.ui,b)}},a.ui.resolveMsg=function(a){return $.isFunction(a)?a():a},a.ui.isSafeUrl=function(a){function b(a,b){return a.substr(0,b.length)===b}var c,d;if(d=["bitcoin","ftp","ftps","geo","git","gopher","http","https","irc","ircs","magnet","mailto","mms","news","nntp","redis","sftp","sip","sips","sms","ssh","svn","tel","telnet","urn","worldwind","xmpp"],""===a)return!0;for(c=0;c<d.length;c++)if(b(a,d[c]+":"))return!0;return!(!b(a,"/")&&!b(a,"./"))||!(!b(a,"?")&&!b(a,"#"))},a.ui.isMobile=function(){return!1},a.ui.mixin={},a.ui.Element=function(b){b=b||{},this.$=$,this.visible=!0,this.data=b.data,this.$element=b.$element||$(document.createElement(this.getTagName())),this.elementGroup=null,Array.isArray(b.classes)&&this.$element.addClass(b.classes.join(" ")),b.id&&this.$element.attr("id",b.id),b.text&&this.$element.text(b.text),b.content&&this.$element.append(b.content.map(function(b){return"string"==typeof b?document.createTextNode(b):b instanceof a.ui.HtmlSnippet?b.toString():b instanceof a.ui.Element?b.$element:b})),b.$content&&this.$element.append(b.$content)},a.initClass(a.ui.Element),a.ui.Element.static.tagName="div",a.ui.Element.static.infuse=function(b){var c=a.ui.Element.static.unsafeInfuse(b,!1);return c},a.ui.Element.static.unsafeInfuse=function(b,c){var d,e,f,g,h,i,j,k,l,m;if("string"==typeof b?(d=b,e=$(document.getElementById(d))):(e=$(b),d=e.attr("id")),!e.length)throw new Error("Widget not found: "+d);if(e[0].oouiInfused&&(e=e[0].oouiInfused),f=e.data("ooui-infused")){if(f===!0)throw new Error("Circular dependency! "+d);return c&&(l=f.constructor.static.gatherPreInfuseState(e,f),c.done(f.restorePreInfuseState.bind(f,l)),m=e.data("ooui-infused-children"),m&&m.length&&m.forEach(function(a){var b=a.constructor.static.gatherPreInfuseState(e,a);c.done(a.restorePreInfuseState.bind(a,b))})),f}if(f=e.attr("data-ooui"),!f)throw new Error("No infusion data found: "+d);try{f=$.parseJSON(f)}catch(a){f=null}if(!f||!f._)throw new Error("No valid infusion data found: "+d);if("Tag"===f._)return new a.ui.Element({$element:e});if(h=f._.split("."),g=a.getProp.apply(a,[window].concat(h)),void 0===g&&(g=a.getProp.apply(a,[a.ui].concat(h)),void 0===g))throw new Error("Unknown widget type: id: "+d+", class: "+f._);for(i=g.parent;void 0!==i&&i!==a.ui.Element;)i=i.parent;if(i!==a.ui.Element)throw new Error("Unknown widget type: id: "+d+", class: "+f._);return c===!1&&(k=$.Deferred(),c=k.promise()),e.data("ooui-infused",!0),f.id=d,m=[],f=a.copy(f,null,function(b){var d;if(a.isPlainObject(b)){if(b.tag)return d=a.ui.Element.static.unsafeInfuse(b.tag,c),m.push(d),m.push.apply(m,d.$element.data("ooui-infused-children")||[]),d.$element.removeData("ooui-infused-children"),d;if(void 0!==b.html)return new a.ui.HtmlSnippet(b.html)}}),f=g.static.reusePreInfuseDOM(e[0],f),l=g.static.gatherPreInfuseState(e[0],f),j=new g(f),k&&(e[0]!==j.$element[0]&&(e.replaceWith(j.$element),e[0].oouiInfused=j.$element),k.resolve()),j.$element.data("ooui-infused",j),j.$element.data("ooui-infused-children",m),j.$element.attr("data-ooui",""),c.done(j.restorePreInfuseState.bind(j,l)),j},a.ui.Element.static.reusePreInfuseDOM=function(a,b){return b},a.ui.Element.static.gatherPreInfuseState=function(){return{}},a.ui.Element.static.getJQuery=function(a,b){function c(a){return $(a,c.context)}return c.context=this.getDocument(a),b&&(c.$iframe=b),c},a.ui.Element.static.getDocument=function(a){return a[0]&&a[0].ownerDocument||a.context||a.ownerDocument||a.document||9===a.nodeType&&a||null},a.ui.Element.static.getWindow=function(a){var b=this.getDocument(a);return b.defaultView},a.ui.Element.static.getDir=function(a){var b,c;return a instanceof jQuery&&(a=a[0]),b=9===a.nodeType,c=void 0!==a.document,(b||c)&&(c&&(a=a.document),a=a.body),$(a).css("direction")},a.ui.Element.static.getFrameOffset=function(a,b,c){var d,e,f,g,h;if(b||(b=window),c||(c={top:0,left:0}),a.parent===a)return c;for(f=a.parent.document.getElementsByTagName("iframe"),d=0,e=f.length;d<e;d++)if(f[d].contentWindow===a){g=f[d];break}return g&&(h=g.getBoundingClientRect(),c.left+=h.left,c.top+=h.top,a!==b&&this.getFrameOffset(a.parent,c)),c},a.ui.Element.static.getRelativePosition=function(a,b){for(var c,d,e=a.offset(),f=b.offset(),g=this.getDocument(a),h=this.getDocument(b);g!==h;){if(c=g.defaultView.frameElement,!c)throw new Error("$element frame is not contained in $anchor frame");d=$(c).offset(),e.left+=d.left,e.top+=d.top,g=c.ownerDocument}return e.left-=f.left,e.top-=f.top,e},a.ui.Element.static.getBorders=function(a){var b=a.ownerDocument,c=b.defaultView,d=c.getComputedStyle(a,null),e=$(a),f=parseFloat(d?d.borderTopWidth:e.css("borderTopWidth"))||0,g=parseFloat(d?d.borderLeftWidth:e.css("borderLeftWidth"))||0,h=parseFloat(d?d.borderBottomWidth:e.css("borderBottomWidth"))||0,i=parseFloat(d?d.borderRightWidth:e.css("borderRightWidth"))||0;return{top:f,left:g,bottom:h,right:i}},a.ui.Element.static.getDimensions=function(a){var b,c,d=a.ownerDocument||a.document,e=d.defaultView;return e===a||a===d.documentElement?(c=$(e),{borders:{top:0,left:0,bottom:0,right:0},scroll:{top:c.scrollTop(),left:c.scrollLeft()},scrollbar:{right:0,bottom:0},rect:{top:0,left:0,bottom:c.innerHeight(),right:c.innerWidth()}}):(b=$(a),{borders:this.getBorders(a),scroll:{top:b.scrollTop(),left:b.scrollLeft()},scrollbar:{right:b.innerWidth()-a.clientWidth,bottom:b.innerHeight()-a.clientHeight},rect:a.getBoundingClientRect()})},a.ui.Element.static.getScrollLeft=function(){function a(){var a=$('<div dir="rtl" style="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll">A</div>'),c=a[0];a.appendTo("body"),c.scrollLeft>0?b="default":(c.scrollLeft=1,b=0===c.scrollLeft?"negative":"reverse"),a.remove()}var b=null;return function(c){var d=c.window===c||c===c.ownerDocument.body||c===c.ownerDocument.documentElement,e=d?$(window).scrollLeft():c.scrollLeft,f=d?"ltr":$(c).css("direction");return"rtl"===f&&(null===b&&a(),"reverse"===b?e=-e:"default"===b&&(e=e-c.scrollWidth+c.clientWidth)),e}}(),a.ui.Element.static.getRootScrollableElement=function(b){var c,d;return void 0===a.ui.scrollableElement&&(d=b.ownerDocument.body,c=d.scrollTop,d.scrollTop=1,1===d.scrollTop?(d.scrollTop=c,a.ui.scrollableElement="body"):a.ui.scrollableElement="documentElement"),b.ownerDocument[a.ui.scrollableElement]},a.ui.Element.static.getClosestScrollableContainer=function(a,b){var c,d,e=["overflow-x","overflow-y"],f=$(a).parent();for("x"!==b&&"y"!==b||(e=["overflow-"+b]);f.length;){if(f[0]===this.getRootScrollableElement(a))return f[0];for(c=e.length;c--;)if(d=f.css(e[c]),"auto"===d||"scroll"===d)return f[0];f=f.parent()}return this.getDocument(a).body},a.ui.Element.static.scrollIntoView=function(b,c){var d,e,f,g,h,i,j,k,l=$.Deferred();return c=c||{},e={},f="function"==typeof c.complete&&c.complete,f&&a.ui.warnDeprecation("Element#scrollIntoView: The `complete` callback config option is deprecated. Use the return promise instead."),g=this.getClosestScrollableContainer(b,c.direction),h=$(g),i=this.getDimensions(b),j=this.getDimensions(g),k=$(this.getWindow(b)),d=h.is("html, body")?{top:i.rect.top,bottom:k.innerHeight()-i.rect.bottom,left:i.rect.left,right:k.innerWidth()-i.rect.right}:{top:i.rect.top-(j.rect.top+j.borders.top),bottom:j.rect.bottom-j.borders.bottom-j.scrollbar.bottom-i.rect.bottom,left:i.rect.left-(j.rect.left+j.borders.left),right:j.rect.right-j.borders.right-j.scrollbar.right-i.rect.right},c.direction&&"y"!==c.direction||(d.top<0?e.scrollTop=j.scroll.top+d.top:d.top>0&&d.bottom<0&&(e.scrollTop=j.scroll.top+Math.min(d.top,-d.bottom))),c.direction&&"x"!==c.direction||(d.left<0?e.scrollLeft=j.scroll.left+d.left:d.left>0&&d.right<0&&(e.scrollLeft=j.scroll.left+Math.min(d.left,-d.right))),$.isEmptyObject(e)?(f&&f(),l.resolve()):(h.stop(!0).animate(e,void 0===c.duration?"fast":c.duration),h.queue(function(a){f&&f(),l.resolve(),a()})),l.promise()},a.ui.Element.static.reconsiderScrollbars=function(a){var b,c,d,e,f=[];for(d=a.scrollLeft,e=a.scrollTop;a.firstChild;)f.push(a.firstChild),a.removeChild(a.firstChild);for(void a.offsetHeight,b=0,c=f.length;b<c;b++)a.appendChild(f[b]);a.scrollLeft=d,a.scrollTop=e},a.ui.Element.prototype.toggle=function(a){return a=void 0===a?!this.visible:!!a,a!==this.isVisible()&&(this.visible=a,this.$element.toggleClass("oo-ui-element-hidden",!this.visible),this.emit("toggle",a)),this},a.ui.Element.prototype.isVisible=function(){return this.visible},a.ui.Element.prototype.getData=function(){return this.data},a.ui.Element.prototype.setData=function(a){return this.data=a,this},a.ui.Element.prototype.supports=function(a){var b,c,d=0;for(a=Array.isArray(a)?a:[a],b=0,c=a.length;b<c;b++)$.isFunction(this[a[b]])&&d++;return a.length===d},a.ui.Element.prototype.updateThemeClasses=function(){a.ui.theme.queueUpdateElementClasses(this)},a.ui.Element.prototype.getTagName=function(){return this.constructor.static.tagName},a.ui.Element.prototype.isElementAttached=function(){return $.contains(this.getElementDocument(),this.$element[0])},a.ui.Element.prototype.getElementDocument=function(){return a.ui.Element.static.getDocument(this.$element)},a.ui.Element.prototype.getElementWindow=function(){return a.ui.Element.static.getWindow(this.$element)},a.ui.Element.prototype.getClosestScrollableElementContainer=function(){return a.ui.Element.static.getClosestScrollableContainer(this.$element[0])},a.ui.Element.prototype.getElementGroup=function(){return this.elementGroup},a.ui.Element.prototype.setElementGroup=function(a){return this.elementGroup=a,this},a.ui.Element.prototype.scrollElementIntoView=function(b){return!this.isElementAttached()||!this.isVisible()||this.getElementGroup()&&!this.getElementGroup().isVisible()?$.Deferred().resolve():a.ui.Element.static.scrollIntoView(this.$element[0],b)},a.ui.Element.prototype.restorePreInfuseState=function(){},a.ui.HtmlSnippet=function(a){this.content=a},a.initClass(a.ui.HtmlSnippet),a.ui.HtmlSnippet.prototype.toString=function(){return this.content},a.ui.Layout=function(b){b=b||{},a.ui.Layout.parent.call(this,b),a.EventEmitter.call(this),this.$element.addClass("oo-ui-layout")},a.inheritClass(a.ui.Layout,a.ui.Element),a.mixinClass(a.ui.Layout,a.EventEmitter),a.ui.Widget=function(b){b=$.extend({disabled:!1},b),a.ui.Widget.parent.call(this,b),a.EventEmitter.call(this),this.disabled=null,this.wasDisabled=null,this.$element.addClass("oo-ui-widget"),this.setDisabled(!!b.disabled)},a.inheritClass(a.ui.Widget,a.ui.Element),a.mixinClass(a.ui.Widget,a.EventEmitter),a.ui.Widget.static.supportsSimpleLabel=!1,a.ui.Widget.prototype.isDisabled=function(){return this.disabled},a.ui.Widget.prototype.setDisabled=function(a){var b;return this.disabled=!!a,b=this.isDisabled(),b!==this.wasDisabled&&(this.$element.toggleClass("oo-ui-widget-disabled",b),this.$element.toggleClass("oo-ui-widget-enabled",!b),this.$element.attr("aria-disabled",b.toString()),this.emit("disable",b),this.updateThemeClasses()),this.wasDisabled=b,this},a.ui.Widget.prototype.updateDisabled=function(){return this.setDisabled(this.disabled),this},a.ui.Theme=function(){this.elementClassesQueue=[],this.debouncedUpdateQueuedElementClasses=a.ui.debounce(this.updateQueuedElementClasses)},a.initClass(a.ui.Theme),a.ui.Theme.prototype.getElementClasses=function(){return{on:[],off:[]}},a.ui.Theme.prototype.updateElementClasses=function(a){var b=$([]),c=this.getElementClasses(a);a.$icon&&(b=b.add(a.$icon)),a.$indicator&&(b=b.add(a.$indicator)),b.removeClass(c.off.join(" ")).addClass(c.on.join(" "))},a.ui.Theme.prototype.updateQueuedElementClasses=function(){var a;for(a=0;a<this.elementClassesQueue.length;a++)this.updateElementClasses(this.elementClassesQueue[a]);this.elementClassesQueue=[]},a.ui.Theme.prototype.queueUpdateElementClasses=function(a){this.elementClassesQueue.lastIndexOf(a)===-1&&(this.elementClassesQueue.push(a),this.debouncedUpdateQueuedElementClasses())},a.ui.Theme.prototype.getDialogTransitionDuration=function(){return 0},a.ui.mixin.TabIndexedElement=function(a){a=$.extend({tabIndex:0},a),this.$tabIndexed=null,this.tabIndex=null,this.connect(this,{disable:"onTabIndexedElementDisable"}),this.setTabIndex(a.tabIndex),this.setTabIndexedElement(a.$tabIndexed||this.$element)},a.initClass(a.ui.mixin.TabIndexedElement),a.ui.mixin.TabIndexedElement.prototype.setTabIndexedElement=function(a){var b=this.tabIndex;return this.setTabIndex(null),this.$tabIndexed=a,this.tabIndex=b,this.updateTabIndex()},a.ui.mixin.TabIndexedElement.prototype.setTabIndex=function(a){return a="number"==typeof a?a:null,this.tabIndex!==a&&(this.tabIndex=a,this.updateTabIndex()),this},a.ui.mixin.TabIndexedElement.prototype.updateTabIndex=function(){return this.$tabIndexed&&(null!==this.tabIndex?this.$tabIndexed.attr({tabindex:this.isDisabled()?-1:this.tabIndex,"aria-disabled":this.isDisabled().toString()}):this.$tabIndexed.removeAttr("tabindex aria-disabled")),this},a.ui.mixin.TabIndexedElement.prototype.onTabIndexedElementDisable=function(){this.updateTabIndex()},a.ui.mixin.TabIndexedElement.prototype.getTabIndex=function(){return this.tabIndex},a.ui.mixin.ButtonElement=function(a){a=a||{},this.$button=null,this.framed=null,this.active=void 0!==a.active&&a.active,this.onMouseUpHandler=this.onMouseUp.bind(this),this.onMouseDownHandler=this.onMouseDown.bind(this),this.onKeyDownHandler=this.onKeyDown.bind(this),this.onKeyUpHandler=this.onKeyUp.bind(this),this.onClickHandler=this.onClick.bind(this),this.onKeyPressHandler=this.onKeyPress.bind(this),this.$element.addClass("oo-ui-buttonElement"),this.toggleFramed(void 0===a.framed||a.framed),this.setButtonElement(a.$button||$("<a>"))},a.initClass(a.ui.mixin.ButtonElement),a.ui.mixin.ButtonElement.static.cancelButtonMouseDownEvents=!0,a.ui.mixin.ButtonElement.prototype.setButtonElement=function(a){this.$button&&this.$button.removeClass("oo-ui-buttonElement-button").removeAttr("role accesskey").off({mousedown:this.onMouseDownHandler,keydown:this.onKeyDownHandler,click:this.onClickHandler,keypress:this.onKeyPressHandler}),this.$button=a.addClass("oo-ui-buttonElement-button").on({mousedown:this.onMouseDownHandler,keydown:this.onKeyDownHandler,click:this.onClickHandler,keypress:this.onKeyPressHandler}),"A"===this.$button.prop("tagName").toUpperCase()&&this.$button.attr("role","button")},a.ui.mixin.ButtonElement.prototype.onMouseDown=function(b){if(!this.isDisabled()&&b.which===a.ui.MouseButtons.LEFT)return this.$element.addClass("oo-ui-buttonElement-pressed"),this.getElementDocument().addEventListener("mouseup",this.onMouseUpHandler,!0),!this.constructor.static.cancelButtonMouseDownEvents&&void 0},a.ui.mixin.ButtonElement.prototype.onMouseUp=function(b){this.isDisabled()||b.which!==a.ui.MouseButtons.LEFT||(this.$element.removeClass("oo-ui-buttonElement-pressed"),this.getElementDocument().removeEventListener("mouseup",this.onMouseUpHandler,!0))},a.ui.mixin.ButtonElement.prototype.onClick=function(b){if(!this.isDisabled()&&b.which===a.ui.MouseButtons.LEFT&&this.emit("click"))return!1},a.ui.mixin.ButtonElement.prototype.onKeyDown=function(b){this.isDisabled()||b.which!==a.ui.Keys.SPACE&&b.which!==a.ui.Keys.ENTER||(this.$element.addClass("oo-ui-buttonElement-pressed"),this.getElementDocument().addEventListener("keyup",this.onKeyUpHandler,!0))},a.ui.mixin.ButtonElement.prototype.onKeyUp=function(b){this.isDisabled()||b.which!==a.ui.Keys.SPACE&&b.which!==a.ui.Keys.ENTER||(this.$element.removeClass("oo-ui-buttonElement-pressed"),this.getElementDocument().removeEventListener("keyup",this.onKeyUpHandler,!0))},a.ui.mixin.ButtonElement.prototype.onKeyPress=function(b){if(!this.isDisabled()&&(b.which===a.ui.Keys.SPACE||b.which===a.ui.Keys.ENTER)&&this.emit("click"))return!1},a.ui.mixin.ButtonElement.prototype.isFramed=function(){return this.framed},a.ui.mixin.ButtonElement.prototype.toggleFramed=function(a){return a=void 0===a?!this.framed:!!a,a!==this.framed&&(this.framed=a,this.$element.toggleClass("oo-ui-buttonElement-frameless",!a).toggleClass("oo-ui-buttonElement-framed",a),this.updateThemeClasses()),this},a.ui.mixin.ButtonElement.prototype.setActive=function(a){return this.active=!!a,this.$element.toggleClass("oo-ui-buttonElement-active",this.active),this.updateThemeClasses(),this},a.ui.mixin.ButtonElement.prototype.isActive=function(){return this.active},a.ui.mixin.GroupElement=function(a){a=a||{},this.$group=null,this.items=[],this.aggregateItemEvents={},this.setGroupElement(a.$group||$("<div>"))},a.ui.mixin.GroupElement.prototype.setGroupElement=function(a){var b,c;for(this.$group=a,b=0,c=this.items.length;b<c;b++)this.$group.append(this.items[b].$element)},a.ui.mixin.GroupElement.prototype.isEmpty=function(){return!this.items.length},a.ui.mixin.GroupElement.prototype.getItems=function(){return this.items.slice(0)},a.ui.mixin.GroupElement.prototype.getItemFromData=function(b){var c,d,e,f=a.getHash(b);for(c=0,d=this.items.length;c<d;c++)if(e=this.items[c],f===a.getHash(e.getData()))return e;return null},a.ui.mixin.GroupElement.prototype.getItemsFromData=function(b){var c,d,e,f=a.getHash(b),g=[];for(c=0,d=this.items.length;c<d;c++)e=this.items[c],f===a.getHash(e.getData())&&g.push(e);return g},a.ui.mixin.GroupElement.prototype.aggregate=function(a){var b,c,d,e,f,g,h;for(g in a){if(h=a[g],Object.prototype.hasOwnProperty.call(this.aggregateItemEvents,g)){if(h)throw new Error("Duplicate item event aggregation for "+g);for(b=0,c=this.items.length;b<c;b++)d=this.items[b],d.connect&&d.disconnect&&(f={},f[g]=["emit",this.aggregateItemEvents[g],d],d.disconnect(this,f));delete this.aggregateItemEvents[g]}if(h)for(this.aggregateItemEvents[g]=h,b=0,c=this.items.length;b<c;b++)d=this.items[b],d.connect&&d.disconnect&&(e={},e[g]=["emit",h,d],d.connect(this,e))}},a.ui.mixin.GroupElement.prototype.addItems=function(a,b){var c,d,e,f,g,h,i=[];for(c=0,d=a.length;c<d;c++){if(e=a[c],h=this.items.indexOf(e),h>=0&&(this.removeItems([e]),h<b&&b--),e.connect&&e.disconnect&&!$.isEmptyObject(this.aggregateItemEvents)){g={};for(f in this.aggregateItemEvents)g[f]=["emit",this.aggregateItemEvents[f],e];e.connect(this,g)}e.setElementGroup(this),i.push(e.$element.get(0))}return void 0===b||b<0||b>=this.items.length?(this.$group.append(i),this.items.push.apply(this.items,a)):0===b?(this.$group.prepend(i),this.items.unshift.apply(this.items,a)):(this.items[b].$element.before(i),this.items.splice.apply(this.items,[b,0].concat(a))),this.emit("change",this.getItems()),this},a.ui.mixin.GroupElement.prototype.removeItems=function(a){var b,c,d,e,f,g;for(b=0,c=a.length;b<c;b++)if(d=a[b],e=this.items.indexOf(d),e!==-1){if(d.connect&&d.disconnect&&!$.isEmptyObject(this.aggregateItemEvents)){f={};for(g in this.aggregateItemEvents)f[g]=["emit",this.aggregateItemEvents[g],d];d.disconnect(this,f)}d.setElementGroup(null),this.items.splice(e,1),d.$element.detach()}return this.emit("change",this.getItems()),this},a.ui.mixin.GroupElement.prototype.clearItems=function(){var a,b,c,d,e;for(a=0,b=this.items.length;a<b;a++)c=this.items[a],c.connect&&c.disconnect&&!$.isEmptyObject(this.aggregateItemEvents)&&(d={},Object.prototype.hasOwnProperty.call(this.aggregateItemEvents,e)&&(d[e]=["emit",this.aggregateItemEvents[e],c]),c.disconnect(this,d)),c.setElementGroup(null),c.$element.detach();return this.emit("change",this.getItems()),this.items=[],this},a.ui.mixin.IconElement=function(a){a=a||{},this.$icon=null,this.icon=null,this.iconTitle=null,this.setIcon(a.icon||this.constructor.static.icon),this.setIconTitle(a.iconTitle||this.constructor.static.iconTitle),this.setIconElement(a.$icon||$("<span>"))},a.initClass(a.ui.mixin.IconElement),a.ui.mixin.IconElement.static.icon=null,a.ui.mixin.IconElement.static.iconTitle=null,a.ui.mixin.IconElement.prototype.setIconElement=function(a){this.$icon&&this.$icon.removeClass("oo-ui-iconElement-icon oo-ui-icon-"+this.icon).removeAttr("title"),this.$icon=a.addClass("oo-ui-iconElement-icon").toggleClass("oo-ui-icon-"+this.icon,!!this.icon),null!==this.iconTitle&&this.$icon.attr("title",this.iconTitle),this.updateThemeClasses()},a.ui.mixin.IconElement.prototype.setIcon=function(b){return b=a.isPlainObject(b)?a.ui.getLocalValue(b,null,"default"):b,b="string"==typeof b&&b.trim().length?b.trim():null,this.icon!==b&&(this.$icon&&(null!==this.icon&&this.$icon.removeClass("oo-ui-icon-"+this.icon),null!==b&&this.$icon.addClass("oo-ui-icon-"+b)),this.icon=b),this.$element.toggleClass("oo-ui-iconElement",!!this.icon),this.updateThemeClasses(),this},a.ui.mixin.IconElement.prototype.setIconTitle=function(b){return b="function"==typeof b||"string"==typeof b&&b.length?a.ui.resolveMsg(b):null,this.iconTitle!==b&&(this.iconTitle=b,this.$icon&&(null!==this.iconTitle?this.$icon.attr("title",b):this.$icon.removeAttr("title"))),this},a.ui.mixin.IconElement.prototype.getIcon=function(){return this.icon},a.ui.mixin.IconElement.prototype.getIconTitle=function(){return this.iconTitle},a.ui.mixin.IndicatorElement=function(a){a=a||{},this.$indicator=null,this.indicator=null,this.indicatorTitle=null,this.setIndicator(a.indicator||this.constructor.static.indicator),this.setIndicatorTitle(a.indicatorTitle||this.constructor.static.indicatorTitle),this.setIndicatorElement(a.$indicator||$("<span>"))},a.initClass(a.ui.mixin.IndicatorElement),a.ui.mixin.IndicatorElement.static.indicator=null,a.ui.mixin.IndicatorElement.static.indicatorTitle=null,a.ui.mixin.IndicatorElement.prototype.setIndicatorElement=function(a){this.$indicator&&this.$indicator.removeClass("oo-ui-indicatorElement-indicator oo-ui-indicator-"+this.indicator).removeAttr("title"),this.$indicator=a.addClass("oo-ui-indicatorElement-indicator").toggleClass("oo-ui-indicator-"+this.indicator,!!this.indicator),null!==this.indicatorTitle&&this.$indicator.attr("title",this.indicatorTitle),this.updateThemeClasses()},a.ui.mixin.IndicatorElement.prototype.setIndicator=function(a){return a="string"==typeof a&&a.length?a.trim():null,this.indicator!==a&&(this.$indicator&&(null!==this.indicator&&this.$indicator.removeClass("oo-ui-indicator-"+this.indicator),null!==a&&this.$indicator.addClass("oo-ui-indicator-"+a)),this.indicator=a),this.$element.toggleClass("oo-ui-indicatorElement",!!this.indicator),this.updateThemeClasses(),this},a.ui.mixin.IndicatorElement.prototype.setIndicatorTitle=function(b){return b="function"==typeof b||"string"==typeof b&&b.length?a.ui.resolveMsg(b):null,this.indicatorTitle!==b&&(this.indicatorTitle=b,this.$indicator&&(null!==this.indicatorTitle?this.$indicator.attr("title",b):this.$indicator.removeAttr("title"))),this},a.ui.mixin.IndicatorElement.prototype.getIndicator=function(){return this.indicator},a.ui.mixin.IndicatorElement.prototype.getIndicatorTitle=function(){return this.indicatorTitle},a.ui.mixin.LabelElement=function(a){a=a||{},this.$label=null,this.label=null,this.setLabel(a.label||this.constructor.static.label),this.setLabelElement(a.$label||$("<span>"))},a.initClass(a.ui.mixin.LabelElement),a.ui.mixin.LabelElement.static.label=null,a.ui.mixin.LabelElement.static.highlightQuery=function(a,b){var c=$("<span>"),d=a.toLowerCase().indexOf(b.toLowerCase());return b.length&&d!==-1?(c.append(document.createTextNode(a.slice(0,d)),$("<span>").addClass("oo-ui-labelElement-label-highlight").text(a.slice(d,d+b.length)),document.createTextNode(a.slice(d+b.length))),c.contents()):c.text(a)},a.ui.mixin.LabelElement.prototype.setLabelElement=function(a){this.$label&&this.$label.removeClass("oo-ui-labelElement-label").empty(),this.$label=a.addClass("oo-ui-labelElement-label"),this.setLabelContent(this.label)},a.ui.mixin.LabelElement.prototype.setLabel=function(b){return b="function"==typeof b?a.ui.resolveMsg(b):b,b=("string"==typeof b||b instanceof jQuery)&&b.length||b instanceof a.ui.HtmlSnippet&&b.toString().length?b:null,this.label!==b&&(this.$label&&this.setLabelContent(b),this.label=b,this.emit("labelChange")),this.$element.toggleClass("oo-ui-labelElement",!!this.label),this},a.ui.mixin.LabelElement.prototype.setHighlightedQuery=function(a,b){return this.setLabel(this.constructor.static.highlightQuery(a,b))},a.ui.mixin.LabelElement.prototype.getLabel=function(){return this.label},a.ui.mixin.LabelElement.prototype.setLabelContent=function(b){"string"==typeof b?b.match(/^\s*$/)?this.$label.html("&nbsp;"):this.$label.text(b):b instanceof a.ui.HtmlSnippet?this.$label.html(b.toString()):b instanceof jQuery?this.$label.empty().append(b):this.$label.empty()},a.ui.mixin.FlaggedElement=function(a){a=a||{},this.flags={},this.$flagged=null,this.setFlags(a.flags),this.setFlaggedElement(a.$flagged||this.$element)},a.ui.mixin.FlaggedElement.prototype.setFlaggedElement=function(a){var b=Object.keys(this.flags).map(function(a){return"oo-ui-flaggedElement-"+a}).join(" ");this.$flagged&&this.$flagged.removeClass(b),this.$flagged=a.addClass(b)},a.ui.mixin.FlaggedElement.prototype.hasFlag=function(a){return this.flags&&a in this.flags},a.ui.mixin.FlaggedElement.prototype.getFlags=function(){return Object.keys(this.flags||{})},a.ui.mixin.FlaggedElement.prototype.clearFlags=function(){var a,b,c={},d=[],e="oo-ui-flaggedElement-";for(a in this.flags)b=e+a,c[a]=!1,delete this.flags[a],d.push(b);return this.$flagged&&this.$flagged.removeClass(d.join(" ")),this.updateThemeClasses(),this.emit("flag",c),this},a.ui.mixin.FlaggedElement.prototype.setFlags=function(b){var c,d,e,f,g={},h=[],i=[],j="oo-ui-flaggedElement-";if("string"==typeof b)f=j+b,this.flags[b]||(this.flags[b]=!0,h.push(f));else if(Array.isArray(b))for(c=0,d=b.length;c<d;c++)e=b[c],f=j+e,this.flags[e]||(g[e]=!0,this.flags[e]=!0,h.push(f));else if(a.isPlainObject(b))for(e in b)f=j+e,b[e]?this.flags[e]||(g[e]=!0,this.flags[e]=!0,h.push(f)):this.flags[e]&&(g[e]=!1,delete this.flags[e],i.push(f));return this.$flagged&&this.$flagged.addClass(h.join(" ")).removeClass(i.join(" ")),this.updateThemeClasses(),this.emit("flag",g),this},a.ui.mixin.TitledElement=function(a){a=a||{},this.$titled=null,this.title=null,this.setTitle(void 0!==a.title?a.title:this.constructor.static.title),this.setTitledElement(a.$titled||this.$element)},a.initClass(a.ui.mixin.TitledElement),a.ui.mixin.TitledElement.static.title=null,a.ui.mixin.TitledElement.prototype.setTitledElement=function(a){this.$titled&&this.$titled.removeAttr("title"),this.$titled=a,this.title&&this.$titled.attr("title",this.title)},a.ui.mixin.TitledElement.prototype.setTitle=function(b){return b="function"==typeof b?a.ui.resolveMsg(b):b,b="string"==typeof b&&b.length?b:null,this.title!==b&&(this.$titled&&(null!==b?this.$titled.attr("title",b):this.$titled.removeAttr("title")),this.title=b),this},a.ui.mixin.TitledElement.prototype.getTitle=function(){return this.title},a.ui.mixin.AccessKeyedElement=function(a){a=a||{},this.$accessKeyed=null,this.accessKey=null,this.setAccessKey(a.accessKey||null),this.setAccessKeyedElement(a.$accessKeyed||this.$element)},a.initClass(a.ui.mixin.AccessKeyedElement),a.ui.mixin.AccessKeyedElement.static.accessKey=null,a.ui.mixin.AccessKeyedElement.prototype.setAccessKeyedElement=function(a){this.$accessKeyed&&this.$accessKeyed.removeAttr("accesskey"),this.$accessKeyed=a,this.accessKey&&this.$accessKeyed.attr("accesskey",this.accessKey)},a.ui.mixin.AccessKeyedElement.prototype.setAccessKey=function(b){return b="string"==typeof b?a.ui.resolveMsg(b):null,this.accessKey!==b&&(this.$accessKeyed&&(null!==b?this.$accessKeyed.attr("accesskey",b):this.$accessKeyed.removeAttr("accesskey")),this.accessKey=b),this},a.ui.mixin.AccessKeyedElement.prototype.getAccessKey=function(){return this.accessKey},a.ui.ButtonWidget=function(b){b=b||{},a.ui.ButtonWidget.parent.call(this,b),a.ui.mixin.ButtonElement.call(this,b),a.ui.mixin.IconElement.call(this,b),a.ui.mixin.IndicatorElement.call(this,b),a.ui.mixin.LabelElement.call(this,b),a.ui.mixin.TitledElement.call(this,$.extend({},b,{$titled:this.$button})),a.ui.mixin.FlaggedElement.call(this,b),a.ui.mixin.TabIndexedElement.call(this,$.extend({},b,{$tabIndexed:this.$button})),a.ui.mixin.AccessKeyedElement.call(this,$.extend({},b,{$accessKeyed:this.$button})),this.href=null,this.target=null,this.noFollow=!1,this.connect(this,{disable:"onDisable"}),this.$button.append(this.$icon,this.$label,this.$indicator),this.$element.addClass("oo-ui-buttonWidget").append(this.$button),this.setActive(b.active),this.setHref(b.href),this.setTarget(b.target),this.setNoFollow(b.noFollow)},a.inheritClass(a.ui.ButtonWidget,a.ui.Widget),a.mixinClass(a.ui.ButtonWidget,a.ui.mixin.ButtonElement),a.mixinClass(a.ui.ButtonWidget,a.ui.mixin.IconElement),a.mixinClass(a.ui.ButtonWidget,a.ui.mixin.IndicatorElement),a.mixinClass(a.ui.ButtonWidget,a.ui.mixin.LabelElement),a.mixinClass(a.ui.ButtonWidget,a.ui.mixin.TitledElement),a.mixinClass(a.ui.ButtonWidget,a.ui.mixin.FlaggedElement),a.mixinClass(a.ui.ButtonWidget,a.ui.mixin.TabIndexedElement),a.mixinClass(a.ui.ButtonWidget,a.ui.mixin.AccessKeyedElement),a.ui.ButtonWidget.static.cancelButtonMouseDownEvents=!1,a.ui.ButtonWidget.prototype.getHref=function(){return this.href},a.ui.ButtonWidget.prototype.getTarget=function(){return this.target},a.ui.ButtonWidget.prototype.getNoFollow=function(){
  return this.noFollow},a.ui.ButtonWidget.prototype.setHref=function(b){return b="string"==typeof b?b:null,null===b||a.ui.isSafeUrl(b)||(b="./"+b),b!==this.href&&(this.href=b,this.updateHref()),this},a.ui.ButtonWidget.prototype.updateHref=function(){return null===this.href||this.isDisabled()?this.$button.removeAttr("href"):this.$button.attr("href",this.href),this},a.ui.ButtonWidget.prototype.onDisable=function(){this.updateHref()},a.ui.ButtonWidget.prototype.setTarget=function(a){return a="string"==typeof a?a:null,a!==this.target&&(this.target=a,null!==a?this.$button.attr("target",a):this.$button.removeAttr("target")),this},a.ui.ButtonWidget.prototype.setNoFollow=function(a){return a="boolean"!=typeof a||a,a!==this.noFollow&&(this.noFollow=a,a?this.$button.attr("rel","nofollow"):this.$button.removeAttr("rel")),this},a.ui.ButtonGroupWidget=function(b){b=b||{},a.ui.ButtonGroupWidget.parent.call(this,b),a.ui.mixin.GroupElement.call(this,$.extend({},b,{$group:this.$element})),this.$element.addClass("oo-ui-buttonGroupWidget"),Array.isArray(b.items)&&this.addItems(b.items)},a.inheritClass(a.ui.ButtonGroupWidget,a.ui.Widget),a.mixinClass(a.ui.ButtonGroupWidget,a.ui.mixin.GroupElement),a.ui.IconWidget=function(b){b=b||{},a.ui.IconWidget.parent.call(this,b),a.ui.mixin.IconElement.call(this,$.extend({},b,{$icon:this.$element})),a.ui.mixin.TitledElement.call(this,$.extend({},b,{$titled:this.$element})),a.ui.mixin.FlaggedElement.call(this,$.extend({},b,{$flagged:this.$element})),this.$element.addClass("oo-ui-iconWidget")},a.inheritClass(a.ui.IconWidget,a.ui.Widget),a.mixinClass(a.ui.IconWidget,a.ui.mixin.IconElement),a.mixinClass(a.ui.IconWidget,a.ui.mixin.TitledElement),a.mixinClass(a.ui.IconWidget,a.ui.mixin.FlaggedElement),a.ui.IconWidget.static.tagName="span",a.ui.IndicatorWidget=function(b){b=b||{},a.ui.IndicatorWidget.parent.call(this,b),a.ui.mixin.IndicatorElement.call(this,$.extend({},b,{$indicator:this.$element})),a.ui.mixin.TitledElement.call(this,$.extend({},b,{$titled:this.$element})),this.$element.addClass("oo-ui-indicatorWidget")},a.inheritClass(a.ui.IndicatorWidget,a.ui.Widget),a.mixinClass(a.ui.IndicatorWidget,a.ui.mixin.IndicatorElement),a.mixinClass(a.ui.IndicatorWidget,a.ui.mixin.TitledElement),a.ui.IndicatorWidget.static.tagName="span",a.ui.LabelWidget=function(b){b=b||{},a.ui.LabelWidget.parent.call(this,b),a.ui.mixin.LabelElement.call(this,$.extend({},b,{$label:this.$element})),a.ui.mixin.TitledElement.call(this,b),this.input=b.input,this.input instanceof a.ui.InputWidget&&(this.input.getInputId()?this.$element.attr("for",this.input.getInputId()):this.$label.on("click",function(){return this.fieldWidget.focus(),!1}.bind(this))),this.$element.addClass("oo-ui-labelWidget")},a.inheritClass(a.ui.LabelWidget,a.ui.Widget),a.mixinClass(a.ui.LabelWidget,a.ui.mixin.LabelElement),a.mixinClass(a.ui.LabelWidget,a.ui.mixin.TitledElement),a.ui.LabelWidget.static.tagName="label",a.ui.mixin.PendingElement=function(a){a=a||{},this.pending=0,this.$pending=null,this.setPendingElement(a.$pending||this.$element)},a.initClass(a.ui.mixin.PendingElement),a.ui.mixin.PendingElement.prototype.setPendingElement=function(a){this.$pending&&this.$pending.removeClass("oo-ui-pendingElement-pending"),this.$pending=a,this.pending>0&&this.$pending.addClass("oo-ui-pendingElement-pending")},a.ui.mixin.PendingElement.prototype.isPending=function(){return!!this.pending},a.ui.mixin.PendingElement.prototype.pushPending=function(){return 0===this.pending&&(this.$pending.addClass("oo-ui-pendingElement-pending"),this.updateThemeClasses()),this.pending++,this},a.ui.mixin.PendingElement.prototype.popPending=function(){return 1===this.pending&&(this.$pending.removeClass("oo-ui-pendingElement-pending"),this.updateThemeClasses()),this.pending=Math.max(0,this.pending-1),this},a.ui.mixin.FloatableElement=function(a){a=a||{},this.$floatable=null,this.$floatableContainer=null,this.$floatableWindow=null,this.$floatableClosestScrollable=null,this.onFloatableScrollHandler=this.position.bind(this),this.onFloatableWindowResizeHandler=this.position.bind(this),this.setFloatableContainer(a.$floatableContainer),this.setFloatableElement(a.$floatable||this.$element),this.setVerticalPosition(a.verticalPosition||"below"),this.setHorizontalPosition(a.horizontalPosition||"start"),this.hideWhenOutOfView=void 0===a.hideWhenOutOfView||!!a.hideWhenOutOfView},a.ui.mixin.FloatableElement.prototype.setFloatableElement=function(a){this.$floatable&&(this.$floatable.removeClass("oo-ui-floatableElement-floatable"),this.$floatable.css({left:"",top:""})),this.$floatable=a.addClass("oo-ui-floatableElement-floatable"),this.position()},a.ui.mixin.FloatableElement.prototype.setFloatableContainer=function(a){this.$floatableContainer=a,this.$floatable&&this.position()};a.ui.mixin.FloatableElement.prototype.setVerticalPosition=function(a){if(["below","above","top","bottom","center"].indexOf(a)===-1)throw new Error("Invalid value for vertical position: "+a);this.verticalPosition!==a&&(this.verticalPosition=a,this.$floatable&&this.position())};a.ui.mixin.FloatableElement.prototype.setHorizontalPosition=function(a){if(["before","after","start","end","center"].indexOf(a)===-1)throw new Error("Invalid value for horizontal position: "+a);this.horizontalPosition!==a&&(this.horizontalPosition=a,this.$floatable&&this.position())},a.ui.mixin.FloatableElement.prototype.togglePositioning=function(b){var c;return this.$floatable&&this.$floatableContainer?(b=void 0===b?!this.positioning:!!b,!b||this.warnedUnattached||this.isElementAttached()||(a.ui.warnDeprecation("FloatableElement#togglePositioning: Before calling this method, the element must be attached to the DOM."),this.warnedUnattached=!0),this.positioning!==b&&(this.positioning=b,this.needsCustomPosition="below"!==this.verticalPostion||"start"!==this.horizontalPosition||!a.ui.contains(this.$floatableContainer[0],this.$floatable[0]),c=a.ui.Element.static.getClosestScrollableContainer(this.$floatableContainer[0]),$(c).is("html, body")&&(c=a.ui.Element.static.getWindow(c)),b?(this.$floatableWindow=$(this.getElementWindow()),this.$floatableWindow.on("resize",this.onFloatableWindowResizeHandler),this.$floatableClosestScrollable=$(c),this.$floatableClosestScrollable.on("scroll",this.onFloatableScrollHandler),this.position()):(this.$floatableWindow&&(this.$floatableWindow.off("resize",this.onFloatableWindowResizeHandler),this.$floatableWindow=null),this.$floatableClosestScrollable&&(this.$floatableClosestScrollable.off("scroll",this.onFloatableScrollHandler),this.$floatableClosestScrollable=null),this.$floatable.css({left:"",right:"",top:""}))),this):this},a.ui.mixin.FloatableElement.prototype.isElementInViewport=function(a,b){var c,d,e,f,g,h,i,j,k=a.css("direction");return c=a[0].getBoundingClientRect(),d=b[0]===window?{top:0,left:0,right:document.documentElement.clientWidth,bottom:document.documentElement.clientHeight}:b[0].getBoundingClientRect(),e=c.top>=d.top&&c.top<=d.bottom,f=c.bottom>=d.top&&c.bottom<=d.bottom,g=c.left>=d.left&&c.left<=d.right,h=c.right>=d.left&&c.right<=d.right,"rtl"===k?(i=h,j=g):(i=g,j=h),!("below"===this.verticalPosition&&!f)&&(!("above"===this.verticalPosition&&!e)&&(!("before"===this.horizontalPosition&&!i)&&(!("after"===this.horizontalPosition&&!j)&&(c.top<=d.bottom&&c.bottom>=d.top&&c.left<=d.right&&c.right>=d.left))))},a.ui.mixin.FloatableElement.prototype.position=function(){return this.positioning?this.hideWhenOutOfView&&!this.isElementInViewport(this.$floatableContainer,this.$floatableClosestScrollable)?(this.$floatable.addClass("oo-ui-element-hidden"),this):(this.$floatable.removeClass("oo-ui-element-hidden"),this.needsCustomPosition?(this.$floatable.css(this.computePosition()),this.clip&&this.clip(),this):this):this},a.ui.mixin.FloatableElement.prototype.computePosition=function(){var b,c,d,e,f,g,h,i,j={top:"",left:"",bottom:"",right:""},k=this.$floatableContainer.css("direction"),l=this.$floatable.offsetParent();return l.is("html")&&(l=$(l[0].ownerDocument.body)),b=l.is("body"),c="scroll"===l.css("overflow-x")||"auto"===l.css("overflow-x"),d="scroll"===l.css("overflow-y")||"auto"===l.css("overflow-y"),g=l.innerWidth()-l.prop("clientWidth"),f=l.innerHeight()-l.prop("clientHeight"),h=d&&!b?l.scrollTop():0,i=c&&!b?a.ui.Element.static.getScrollLeft(l[0]):0,e=b?this.$floatableContainer.offset():a.ui.Element.static.getRelativePosition(this.$floatableContainer,l),e.bottom=e.top+this.$floatableContainer.outerHeight(),e.right=e.left+this.$floatableContainer.outerWidth(),e.start="rtl"===k?e.right:e.left,e.end="rtl"===k?e.left:e.right,"below"===this.verticalPosition?j.top=e.bottom:"above"===this.verticalPosition?j.bottom=l.outerHeight()-e.top:"top"===this.verticalPosition?j.top=e.top:"bottom"===this.verticalPosition?j.bottom=l.outerHeight()-e.bottom:"center"===this.verticalPosition&&(j.top=e.top+(this.$floatableContainer.height()-this.$floatable.height())/2),"before"===this.horizontalPosition?j.end=e.start:"after"===this.horizontalPosition?j.start=e.end:"start"===this.horizontalPosition?j.start=e.start:"end"===this.horizontalPosition?j.end=e.end:"center"===this.horizontalPosition&&(j.left=e.left+(this.$floatableContainer.width()-this.$floatable.width())/2),void 0!==j.start&&("rtl"===k?j.right=(b?$(l[0].ownerDocument.documentElement):l).outerWidth()-j.start:j.left=j.start,delete j.start),void 0!==j.end&&("rtl"===k?j.left=j.end:j.right=(b?$(l[0].ownerDocument.documentElement):l).outerWidth()-j.end,delete j.end),""!==j.top&&(j.top+=h),""!==j.bottom&&(j.bottom-=h),""!==j.left&&(j.left+=i),""!==j.right&&(j.right-=i),""!==j.bottom&&(j.bottom-=f),"rtl"===k?""!==j.left&&(j.left-=g):""!==j.right&&(j.right-=g),j},a.ui.mixin.ClippableElement=function(a){a=a||{},this.$clippable=null,this.$clippableContainer=null,this.clipping=!1,this.clippedHorizontally=!1,this.clippedVertically=!1,this.$clippableScrollableContainer=null,this.$clippableScroller=null,this.$clippableWindow=null,this.idealWidth=null,this.idealHeight=null,this.onClippableScrollHandler=this.clip.bind(this),this.onClippableWindowResizeHandler=this.clip.bind(this),a.$clippableContainer&&this.setClippableContainer(a.$clippableContainer),this.setClippableElement(a.$clippable||this.$element)},a.ui.mixin.ClippableElement.prototype.setClippableElement=function(b){this.$clippable&&(this.$clippable.removeClass("oo-ui-clippableElement-clippable"),this.$clippable.css({width:"",height:"",overflowX:"",overflowY:""}),a.ui.Element.static.reconsiderScrollbars(this.$clippable[0])),this.$clippable=b.addClass("oo-ui-clippableElement-clippable"),this.clip()},a.ui.mixin.ClippableElement.prototype.setClippableContainer=function(a){this.$clippableContainer=a,this.$clippable&&this.clip()},a.ui.mixin.ClippableElement.prototype.toggleClipping=function(b){return b=void 0===b?!this.clipping:!!b,!b||this.warnedUnattached||this.isElementAttached()||(a.ui.warnDeprecation("ClippableElement#toggleClipping: Before calling this method, the element must be attached to the DOM."),this.warnedUnattached=!0),this.clipping!==b&&(this.clipping=b,b?(this.$clippableScrollableContainer=$(this.getClosestScrollableElementContainer()),this.$clippableScroller=this.$clippableScrollableContainer.is("html, body")?$(a.ui.Element.static.getWindow(this.$clippableScrollableContainer)):this.$clippableScrollableContainer,this.$clippableScroller.on("scroll",this.onClippableScrollHandler),this.$clippableWindow=$(this.getElementWindow()).on("resize",this.onClippableWindowResizeHandler),this.clip()):(this.$clippable.css({width:"",height:"",maxWidth:"",maxHeight:"",overflowX:"",overflowY:""}),a.ui.Element.static.reconsiderScrollbars(this.$clippable[0]),this.$clippableScrollableContainer=null,this.$clippableScroller.off("scroll",this.onClippableScrollHandler),this.$clippableScroller=null,this.$clippableWindow.off("resize",this.onClippableWindowResizeHandler),this.$clippableWindow=null)),this},a.ui.mixin.ClippableElement.prototype.isClipping=function(){return this.clipping},a.ui.mixin.ClippableElement.prototype.isClipped=function(){return this.clippedHorizontally||this.clippedVertically},a.ui.mixin.ClippableElement.prototype.isClippedHorizontally=function(){return this.clippedHorizontally},a.ui.mixin.ClippableElement.prototype.isClippedVertically=function(){return this.clippedVertically},a.ui.mixin.ClippableElement.prototype.setIdealSize=function(a,b){this.idealWidth=a,this.idealHeight=b,this.clipping||this.$clippable.css({width:a,height:b})},a.ui.mixin.ClippableElement.prototype.clip=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v=7;return this.clipping?(b=this.$clippableContainer||this.$clippable,c=b.outerHeight()-this.$clippable.outerHeight(),d=b.outerWidth()-this.$clippable.outerWidth(),e=b.offset(),this.$clippableScrollableContainer.is("html, body")?(f=this.$clippableWindow,g={top:0,left:0}):(f=this.$clippableScrollableContainer,g=f.offset()),h=f.innerHeight()-v,i=f.innerWidth()-v,j=b.outerWidth()+v,k=this.$clippableScroller[0]===this.$clippableWindow[0],l=k?this.$clippableScroller.scrollTop():0,m=k?this.$clippableScroller.scrollLeft():0,n=e.left<0?j+e.left:g.left+m+i-e.left,o=g.top+l+h-e.top,n=Math.min(n,document.documentElement.clientWidth),o=Math.min(o,document.documentElement.clientHeight),p=Math.ceil(n-d),q=Math.ceil(o-c),r=this.$clippable.prop("scrollWidth"),s=this.$clippable.prop("scrollHeight"),t=p<r,u=q<s,t?(this.$clippable.css("overflowX","scroll"),void this.$clippable[0].offsetHeight,this.$clippable.css({width:Math.max(0,p),maxWidth:""})):this.$clippable.css({overflowX:"",width:this.idealWidth?this.idealWidth-d:"",maxWidth:Math.max(0,p)}),u?(this.$clippable.css("overflowY","scroll"),void this.$clippable[0].offsetHeight,this.$clippable.css({height:Math.max(0,q),maxHeight:""})):this.$clippable.css({overflowY:"",height:this.idealHeight?this.idealHeight-c:"",maxHeight:Math.max(0,q)}),(this.clippedHorizontally&&!t||this.clippedVertically&&!u)&&a.ui.Element.static.reconsiderScrollbars(this.$clippable[0]),this.clippedHorizontally=t,this.clippedVertically=u,this):this},a.ui.PopupWidget=function(b){b=b||{},a.ui.PopupWidget.parent.call(this,b),this.$body=$("<div>"),this.$popup=$("<div>"),a.ui.mixin.LabelElement.call(this,b),a.ui.mixin.ClippableElement.call(this,$.extend({},b,{$clippable:this.$body,$clippableContainer:this.$popup})),a.ui.mixin.FloatableElement.call(this,b),this.$anchor=$("<div>"),this.$container=b.$container,this.containerPadding=void 0!==b.containerPadding?b.containerPadding:10,this.autoClose=!!b.autoClose,this.$autoCloseIgnore=b.$autoCloseIgnore,this.transitionTimeout=null,this.anchored=!1,this.width=void 0!==b.width?b.width:320,this.height=void 0!==b.height?b.height:null,this.onMouseDownHandler=this.onMouseDown.bind(this),this.onDocumentKeyDownHandler=this.onDocumentKeyDown.bind(this),this.toggleAnchor(void 0===b.anchor||b.anchor),this.setAlignment(b.align||"center"),this.setPosition(b.position||"below"),this.$body.addClass("oo-ui-popupWidget-body"),this.$anchor.addClass("oo-ui-popupWidget-anchor"),this.$popup.addClass("oo-ui-popupWidget-popup").append(this.$body),this.$element.addClass("oo-ui-popupWidget").append(this.$popup,this.$anchor),b.$content instanceof jQuery&&this.$body.append(b.$content),b.padded&&this.$body.addClass("oo-ui-popupWidget-body-padded"),b.head&&(this.closeButton=new a.ui.ButtonWidget({framed:!1,icon:"close"}),this.closeButton.connect(this,{click:"onCloseButtonClick"}),this.$head=$("<div>").addClass("oo-ui-popupWidget-head").append(this.$label,this.closeButton.$element),this.$popup.prepend(this.$head)),b.$footer&&(this.$footer=$("<div>").addClass("oo-ui-popupWidget-footer").append(b.$footer),this.$popup.append(this.$footer)),this.visible=!1,this.$element.addClass("oo-ui-element-hidden")},a.inheritClass(a.ui.PopupWidget,a.ui.Widget),a.mixinClass(a.ui.PopupWidget,a.ui.mixin.LabelElement),a.mixinClass(a.ui.PopupWidget,a.ui.mixin.ClippableElement),a.mixinClass(a.ui.PopupWidget,a.ui.mixin.FloatableElement),a.ui.PopupWidget.prototype.onMouseDown=function(b){this.isVisible()&&!a.ui.contains(this.$element.add(this.$autoCloseIgnore).get(),b.target,!0)&&this.toggle(!1)},a.ui.PopupWidget.prototype.bindMouseDownListener=function(){this.getElementWindow().addEventListener("mousedown",this.onMouseDownHandler,!0)},a.ui.PopupWidget.prototype.onCloseButtonClick=function(){this.isVisible()&&this.toggle(!1)},a.ui.PopupWidget.prototype.unbindMouseDownListener=function(){this.getElementWindow().removeEventListener("mousedown",this.onMouseDownHandler,!0)},a.ui.PopupWidget.prototype.onDocumentKeyDown=function(b){b.which===a.ui.Keys.ESCAPE&&this.isVisible()&&(this.toggle(!1),b.preventDefault(),b.stopPropagation())},a.ui.PopupWidget.prototype.bindKeyDownListener=function(){this.getElementWindow().addEventListener("keydown",this.onDocumentKeyDownHandler,!0)},a.ui.PopupWidget.prototype.unbindKeyDownListener=function(){this.getElementWindow().removeEventListener("keydown",this.onDocumentKeyDownHandler,!0)},a.ui.PopupWidget.prototype.toggleAnchor=function(a){a=void 0===a?!this.anchored:!!a,this.anchored!==a&&(a?this.$element.addClass("oo-ui-popupWidget-anchored"):this.$element.removeClass("oo-ui-popupWidget-anchored"),this.anchored=a)},a.ui.PopupWidget.prototype.setAnchorEdge=function(a){if(["top","bottom","start","end"].indexOf(a)===-1)throw new Error("Invalid value for edge: "+a);null!==this.anchorEdge&&this.$element.removeClass("oo-ui-popupWidget-anchored-"+this.anchorEdge),this.anchorEdge=a,this.$element.addClass("oo-ui-popupWidget-anchored-"+a)},a.ui.PopupWidget.prototype.hasAnchor=function(){return this.anchored},a.ui.PopupWidget.prototype.toggle=function(b){var c;return b=void 0===b?!this.isVisible():!!b,c=b!==this.isVisible(),!b||this.warnedUnattached||this.isElementAttached()||(a.ui.warnDeprecation("PopupWidget#toggle: Before calling this method, the popup must be attached to the DOM."),this.warnedUnattached=!0),b&&!this.$floatableContainer&&this.isElementAttached()&&this.setFloatableContainer(this.$element.parent()),a.ui.PopupWidget.parent.prototype.toggle.call(this,b),c&&(this.togglePositioning(b&&!!this.$floatableContainer),b?(this.autoClose&&(this.bindMouseDownListener(),this.bindKeyDownListener()),this.updateDimensions(),this.toggleClipping(!0)):(this.toggleClipping(!1),this.autoClose&&(this.unbindMouseDownListener(),this.unbindKeyDownListener()))),this},a.ui.PopupWidget.prototype.setSize=function(a,b,c){this.width=a,this.height=void 0!==b?b:null,this.isVisible()&&this.updateDimensions(c)},a.ui.PopupWidget.prototype.updateDimensions=function(a){var b=this;clearTimeout(this.transitionTimeout),a&&this.$element.addClass("oo-ui-popupWidget-transitioning"),this.position(),a?this.transitionTimeout=setTimeout(function(){b.$element.removeClass("oo-ui-popupWidget-transitioning")},200):this.$element.removeClass("oo-ui-popupWidget-transitioning")},a.ui.PopupWidget.prototype.computePosition=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u={},v={left:"",right:"",top:"",bottom:""},w={ltr:{"force-left":"backwards","force-right":"forwards"},rtl:{"force-left":"forwards","force-right":"backwards"}},x={above:"bottom",below:"top",before:"end",after:"start"},y={forwards:"start",center:"center",backwards:"before"},z={forwards:"top",center:"center",backwards:"bottom"};return this.$container||(this.$container=$(this.getClosestScrollableElementContainer())),b=this.$container.css("direction"),this.$popup.css({width:this.width,height:null!==this.height?this.height:"auto"}),c=w[b][this.align]||this.align,d="before"===this.popupPosition||"after"===this.popupPosition,e=d?"top":"rtl"===b?"right":"left",f=d?"bottom":"rtl"===b?"left":"right",g=d?"top":"left",h=d?"bottom":"right",i=d?"Height":"Width",j=d?this.height||this.$popup.height():this.width,this.setAnchorEdge(x[this.popupPosition]),this.horizontalPosition=d?this.popupPosition:y[c],this.verticalPosition=d?z[c]:this.popupPosition,o=a.ui.mixin.FloatableElement.prototype.computePosition.call(this),p=d?""!==o.top?"top":"bottom":""!==o.left?"left":"right",r=this.$floatableContainer.offset(),r[h]=r[g]+this.$floatableContainer["outer"+i](),s=this.$element.offsetParent().offset(),p===g?(u[g]=s[g]+o[g],u[h]=u[g]+j):(u[h]=s[g]+this.$element.offsetParent()["inner"+i]()-o[h],u[g]=u[h]-j),l=d?(r[e]+r[f])/2:r[e],m=(e===h?-1:1)*(l-u[e]),k=this.$anchor[0]["scroll"+i],n=parseFloat(this.$anchor.css("margin-"+e)),q=m+n<2*k?(p===e?-1:1)*(2*k-(m+n)):m+n>j-2*k?(p===f?-1:1)*(m+n-(j-2*k)):0,t=this.$container.offset(),t[h]=t[g]+this.$container["inner"+i](),u[g]+=(p===g?1:-1)*q,u[h]+=(p===g?1:-1)*q,t[g]+this.containerPadding>u[g]?q+=(p===g?1:-1)*(t[g]+this.containerPadding-u[g]):t[h]-this.containerPadding<u[h]&&(q+=(p===h?1:-1)*(u[h]-(t[h]-this.containerPadding))),m+=(p===e?-1:1)*q,v[e]=m,this.$anchor.css(v),o[p]+=q,o},a.ui.PopupWidget.prototype.setAlignment=function(b){"left"!==b&&"right"!==b||(a.ui.warnDeprecation("PopupWidget#setAlignment parameter value `"+b+"` is deprecated. Use `force-right` or `force-left` instead."),b={left:"force-right",right:"force-left"}[b]),["force-left","force-right","backwards","forwards","center"].indexOf(b)>-1?this.align=b:this.align="center",this.position()},a.ui.PopupWidget.prototype.getAlignment=function(){return this.align},a.ui.PopupWidget.prototype.setPosition=function(a){["above","below","before","after"].indexOf(a)===-1&&(a="below"),this.popupPosition=a,this.position()},a.ui.PopupWidget.prototype.getPosition=function(){return this.popupPosition},a.ui.mixin.PopupElement=function(b){b=b||{},this.popup=new a.ui.PopupWidget($.extend({autoClose:!0,$floatableContainer:this.$element},b.popup,{$autoCloseIgnore:this.$element.add(b.popup&&b.popup.$autoCloseIgnore)}))},a.ui.mixin.PopupElement.prototype.getPopup=function(){return this.popup},a.ui.PopupButtonWidget=function(b){a.ui.PopupButtonWidget.parent.call(this,b),a.ui.mixin.PopupElement.call(this,b),this.$overlay=b.$overlay||this.$element,this.connect(this,{click:"onAction"}),this.$element.addClass("oo-ui-popupButtonWidget").attr("aria-haspopup","true"),this.popup.$element.addClass("oo-ui-popupButtonWidget-popup").toggleClass("oo-ui-popupButtonWidget-framed-popup",this.isFramed()).toggleClass("oo-ui-popupButtonWidget-frameless-popup",!this.isFramed()),this.$overlay.append(this.popup.$element)},a.inheritClass(a.ui.PopupButtonWidget,a.ui.ButtonWidget),a.mixinClass(a.ui.PopupButtonWidget,a.ui.mixin.PopupElement),a.ui.PopupButtonWidget.prototype.onAction=function(){this.popup.toggle()},a.ui.mixin.GroupWidget=function(b){a.ui.mixin.GroupElement.call(this,b)},a.mixinClass(a.ui.mixin.GroupWidget,a.ui.mixin.GroupElement),a.ui.mixin.GroupWidget.prototype.setDisabled=function(b){var c,d;if(a.ui.Widget.prototype.setDisabled.call(this,b),this.items)for(c=0,d=this.items.length;c<d;c++)this.items[c].updateDisabled();return this},a.ui.mixin.ItemWidget=function(){},a.ui.mixin.ItemWidget.prototype.isDisabled=function(){return this.disabled||this.elementGroup instanceof a.ui.Widget&&this.elementGroup.isDisabled()},a.ui.mixin.ItemWidget.prototype.setElementGroup=function(b){return a.ui.Element.prototype.setElementGroup.call(this,b),this.updateDisabled(),this},a.ui.OptionWidget=function(b){b=b||{},a.ui.OptionWidget.parent.call(this,b),a.ui.mixin.ItemWidget.call(this),a.ui.mixin.LabelElement.call(this,b),a.ui.mixin.FlaggedElement.call(this,b),a.ui.mixin.AccessKeyedElement.call(this,b),this.selected=!1,this.highlighted=!1,this.pressed=!1,this.$element.data("oo-ui-optionWidget",this).attr("tabindex","-1").attr("role","option").attr("aria-selected","false").addClass("oo-ui-optionWidget").append(this.$label)},a.inheritClass(a.ui.OptionWidget,a.ui.Widget),a.mixinClass(a.ui.OptionWidget,a.ui.mixin.ItemWidget),a.mixinClass(a.ui.OptionWidget,a.ui.mixin.LabelElement),a.mixinClass(a.ui.OptionWidget,a.ui.mixin.FlaggedElement),a.mixinClass(a.ui.OptionWidget,a.ui.mixin.AccessKeyedElement),a.ui.OptionWidget.static.selectable=!0,a.ui.OptionWidget.static.highlightable=!0,a.ui.OptionWidget.static.pressable=!0,a.ui.OptionWidget.static.scrollIntoViewOnSelect=!1,a.ui.OptionWidget.prototype.isSelectable=function(){return this.constructor.static.selectable&&!this.isDisabled()&&this.isVisible()},a.ui.OptionWidget.prototype.isHighlightable=function(){return this.constructor.static.highlightable&&!this.isDisabled()&&this.isVisible()},a.ui.OptionWidget.prototype.isPressable=function(){return this.constructor.static.pressable&&!this.isDisabled()&&this.isVisible()},a.ui.OptionWidget.prototype.isSelected=function(){return this.selected},a.ui.OptionWidget.prototype.isHighlighted=function(){return this.highlighted},a.ui.OptionWidget.prototype.isPressed=function(){return this.pressed},a.ui.OptionWidget.prototype.setSelected=function(a){return this.constructor.static.selectable&&(this.selected=!!a,this.$element.toggleClass("oo-ui-optionWidget-selected",a).attr("aria-selected",a.toString()),a&&this.constructor.static.scrollIntoViewOnSelect&&this.scrollElementIntoView(),this.updateThemeClasses()),this},a.ui.OptionWidget.prototype.setHighlighted=function(a){return this.constructor.static.highlightable&&(this.highlighted=!!a,this.$element.toggleClass("oo-ui-optionWidget-highlighted",a),this.updateThemeClasses()),this},a.ui.OptionWidget.prototype.setPressed=function(a){return this.constructor.static.pressable&&(this.pressed=!!a,this.$element.toggleClass("oo-ui-optionWidget-pressed",a),this.updateThemeClasses()),this},a.ui.OptionWidget.prototype.getMatchText=function(){var a=this.getLabel();return"string"==typeof a?a:this.$label.text()},a.ui.SelectWidget=function(b){b=b||{},a.ui.SelectWidget.parent.call(this,b),a.ui.mixin.GroupWidget.call(this,$.extend({},b,{$group:this.$element})),this.pressed=!1,this.selecting=null,this.onMouseUpHandler=this.onMouseUp.bind(this),this.onMouseMoveHandler=this.onMouseMove.bind(this),this.onKeyDownHandler=this.onKeyDown.bind(this),this.onKeyPressHandler=this.onKeyPress.bind(this),this.keyPressBuffer="",this.keyPressBufferTimer=null,this.blockMouseOverEvents=0,this.connect(this,{toggle:"onToggle"}),this.$element.on({focusin:this.onFocus.bind(this),mousedown:this.onMouseDown.bind(this),mouseover:this.onMouseOver.bind(this),mouseleave:this.onMouseLeave.bind(this)}),this.$element.addClass("oo-ui-selectWidget oo-ui-selectWidget-depressed").attr("role","listbox"),Array.isArray(b.items)&&this.addItems(b.items)},a.inheritClass(a.ui.SelectWidget,a.ui.Widget),a.mixinClass(a.ui.SelectWidget,a.ui.mixin.GroupWidget),a.ui.SelectWidget.prototype.onFocus=function(a){var b;a.target===this.$element[0]?this.getSelectedItem()||(b=this.getFirstSelectableItem()):b=this.getTargetItem(a),b&&(b.constructor.static.highlightable?this.highlightItem(b):this.selectItem(b)),a.target!==this.$element[0]&&this.$element.focus()},a.ui.SelectWidget.prototype.onMouseDown=function(b){var c;return this.isDisabled()||b.which!==a.ui.MouseButtons.LEFT||(this.togglePressed(!0),c=this.getTargetItem(b),c&&c.isSelectable()&&(this.pressItem(c),this.selecting=c,this.getElementDocument().addEventListener("mouseup",this.onMouseUpHandler,!0),this.getElementDocument().addEventListener("mousemove",this.onMouseMoveHandler,!0))),!1},a.ui.SelectWidget.prototype.onMouseUp=function(b){var c;return this.togglePressed(!1),this.selecting||(c=this.getTargetItem(b),c&&c.isSelectable()&&(this.selecting=c)),!this.isDisabled()&&b.which===a.ui.MouseButtons.LEFT&&this.selecting&&(this.pressItem(null),this.chooseItem(this.selecting),this.selecting=null),this.getElementDocument().removeEventListener("mouseup",this.onMouseUpHandler,!0),this.getElementDocument().removeEventListener("mousemove",this.onMouseMoveHandler,!0),!1},a.ui.SelectWidget.prototype.onMouseMove=function(a){var b;!this.isDisabled()&&this.pressed&&(b=this.getTargetItem(a),b&&b!==this.selecting&&b.isSelectable()&&(this.pressItem(b),this.selecting=b))},a.ui.SelectWidget.prototype.onMouseOver=function(a){var b;if(!this.blockMouseOverEvents)return this.isDisabled()||(b=this.getTargetItem(a),this.highlightItem(b&&b.isHighlightable()?b:null)),!1},a.ui.SelectWidget.prototype.onMouseLeave=function(){return this.isDisabled()||this.highlightItem(null),!1},a.ui.SelectWidget.prototype.onKeyDown=function(b){var c,d=!1,e=this.getHighlightedItem()||this.getSelectedItem();if(!this.isDisabled()&&this.isVisible()){switch(b.keyCode){case a.ui.Keys.ENTER:e&&e.constructor.static.highlightable&&(this.chooseItem(e),d=!0);break;case a.ui.Keys.UP:case a.ui.Keys.LEFT:this.clearKeyPressBuffer(),c=this.getRelativeSelectableItem(e,-1),d=!0;break;case a.ui.Keys.DOWN:case a.ui.Keys.RIGHT:this.clearKeyPressBuffer(),c=this.getRelativeSelectableItem(e,1),d=!0;break;case a.ui.Keys.ESCAPE:case a.ui.Keys.TAB:e&&e.constructor.static.highlightable&&e.setHighlighted(!1),this.unbindKeyDownListener(),this.unbindKeyPressListener(),d=!1}c&&(c.constructor.static.highlightable?this.highlightItem(c):this.chooseItem(c),this.scrollItemIntoView(c)),d&&(b.preventDefault(),b.stopPropagation())}},a.ui.SelectWidget.prototype.bindKeyDownListener=function(){this.getElementWindow().addEventListener("keydown",this.onKeyDownHandler,!0)},a.ui.SelectWidget.prototype.unbindKeyDownListener=function(){this.getElementWindow().removeEventListener("keydown",this.onKeyDownHandler,!0)},a.ui.SelectWidget.prototype.scrollItemIntoView=function(a){var b=this;this.blockMouseOverEvents++,a.scrollElementIntoView().done(function(){setTimeout(function(){b.blockMouseOverEvents--},200)})},a.ui.SelectWidget.prototype.clearKeyPressBuffer=function(){this.keyPressBufferTimer&&(clearTimeout(this.keyPressBufferTimer),this.keyPressBufferTimer=null),this.keyPressBuffer=""},a.ui.SelectWidget.prototype.onKeyPress=function(b){var c,d,e;if(b.charCode)c=String.fromCodePoint?String.fromCodePoint(b.charCode):String.fromCharCode(b.charCode),this.keyPressBufferTimer&&clearTimeout(this.keyPressBufferTimer),this.keyPressBufferTimer=setTimeout(this.clearKeyPressBuffer.bind(this),1500),e=this.getHighlightedItem()||this.getSelectedItem(),this.keyPressBuffer===c?e&&(e=this.getRelativeSelectableItem(e,1)):this.keyPressBuffer+=c,d=this.getItemMatcher(this.keyPressBuffer,!1),e&&d(e)||(e=this.getRelativeSelectableItem(e,1,d)),e&&(this.isVisible()&&e.constructor.static.highlightable?this.highlightItem(e):this.chooseItem(e),this.scrollItemIntoView(e)),b.preventDefault(),b.stopPropagation();else if(b.keyCode===a.ui.Keys.BACKSPACE&&""!==this.keyPressBuffer)return this.keyPressBuffer=this.keyPressBuffer.substr(0,this.keyPressBuffer.length-1),!1},a.ui.SelectWidget.prototype.getItemMatcher=function(a,b){var c;return a.normalize&&(a=a.normalize()),a=b?a.trim():a.replace(/^\s+/,""),c="^\\s*"+a.replace(/([\\{}()|.?*+\-\^$\[\]])/g,"\\$1").replace(/\s+/g,"\\s+"),b&&(c+="\\s*$"),c=new RegExp(c,"i"),function(a){var b=a.getMatchText();return b.normalize&&(b=b.normalize()),c.test(b)}},a.ui.SelectWidget.prototype.bindKeyPressListener=function(){this.getElementWindow().addEventListener("keypress",this.onKeyPressHandler,!0)},a.ui.SelectWidget.prototype.unbindKeyPressListener=function(){this.getElementWindow().removeEventListener("keypress",this.onKeyPressHandler,!0),this.clearKeyPressBuffer()},a.ui.SelectWidget.prototype.onToggle=function(a){a||this.clearKeyPressBuffer()},a.ui.SelectWidget.prototype.getTargetItem=function(a){return $(a.target).closest(".oo-ui-optionWidget").data("oo-ui-optionWidget")||null},a.ui.SelectWidget.prototype.getSelectedItem=function(){var a,b;for(a=0,b=this.items.length;a<b;a++)if(this.items[a].isSelected())return this.items[a];return null},a.ui.SelectWidget.prototype.getHighlightedItem=function(){var a,b;for(a=0,b=this.items.length;a<b;a++)if(this.items[a].isHighlighted())return this.items[a];return null},a.ui.SelectWidget.prototype.togglePressed=function(a){void 0===a&&(a=!this.pressed),a!==this.pressed&&(this.$element.toggleClass("oo-ui-selectWidget-pressed",a).toggleClass("oo-ui-selectWidget-depressed",!a),this.pressed=a)},a.ui.SelectWidget.prototype.highlightItem=function(a){var b,c,d,e=!1;for(b=0,c=this.items.length;b<c;b++)d=this.items[b]===a,this.items[b].isHighlighted()!==d&&(this.items[b].setHighlighted(d),
  e=!0);return e&&this.emit("highlight",a),this},a.ui.SelectWidget.prototype.getItemFromLabel=function(b,c){var d,e,f,g=this.items.length,h=this.getItemMatcher(b,!0);for(d=0;d<g;d++)if(e=this.items[d],e instanceof a.ui.OptionWidget&&e.isSelectable()&&h(e))return e;if(c){for(f=null,h=this.getItemMatcher(b,!1),d=0;d<g;d++)if(e=this.items[d],e instanceof a.ui.OptionWidget&&e.isSelectable()&&h(e)){if(f)return null;f=e}if(f)return f}return null},a.ui.SelectWidget.prototype.selectItemByLabel=function(a,b){var c=this.getItemFromLabel(a,!!b);return void 0!==a&&c?this.selectItem(c):this.selectItem()},a.ui.SelectWidget.prototype.selectItemByData=function(a){var b=this.getItemFromData(a);return void 0!==a&&b?this.selectItem(b):this.selectItem()},a.ui.SelectWidget.prototype.selectItem=function(a){var b,c,d,e=!1;for(b=0,c=this.items.length;b<c;b++)d=this.items[b]===a,this.items[b].isSelected()!==d&&(this.items[b].setSelected(d),e=!0);return e&&this.emit("select",a),this},a.ui.SelectWidget.prototype.pressItem=function(a){var b,c,d,e=!1;for(b=0,c=this.items.length;b<c;b++)d=this.items[b]===a,this.items[b].isPressed()!==d&&(this.items[b].setPressed(d),e=!0);return e&&this.emit("press",a),this},a.ui.SelectWidget.prototype.chooseItem=function(a){return a&&(this.selectItem(a),this.emit("choose",a)),this},a.ui.SelectWidget.prototype.getRelativeSelectableItem=function(b,c,d){var e,f,g,h=c>0?1:-1,i=this.items.length;for(b instanceof a.ui.OptionWidget?(e=this.items.indexOf(b),f=(e+h+i)%i):f=c>0?0:i-1,g=0;g<i;g++){if(b=this.items[f],b instanceof a.ui.OptionWidget&&b.isSelectable()&&(!d||d(b)))return b;f=(f+h+i)%i}return null},a.ui.SelectWidget.prototype.getFirstSelectableItem=function(){return this.getRelativeSelectableItem(null,1)},a.ui.SelectWidget.prototype.addItems=function(b,c){return a.ui.mixin.GroupWidget.prototype.addItems.call(this,b,c),this.emit("add",b,void 0===c?this.items.length-b.length-1:c),this},a.ui.SelectWidget.prototype.removeItems=function(b){var c,d,e;for(c=0,d=b.length;c<d;c++)e=b[c],e.isSelected()&&this.selectItem(null);return a.ui.mixin.GroupWidget.prototype.removeItems.call(this,b),this.emit("remove",b),this},a.ui.SelectWidget.prototype.clearItems=function(){var b=this.items.slice();return a.ui.mixin.GroupWidget.prototype.clearItems.call(this),this.selectItem(null),this.emit("remove",b),this},a.ui.DecoratedOptionWidget=function(b){a.ui.DecoratedOptionWidget.parent.call(this,b),a.ui.mixin.IconElement.call(this,b),a.ui.mixin.IndicatorElement.call(this,b),this.$element.addClass("oo-ui-decoratedOptionWidget").prepend(this.$icon).append(this.$indicator)},a.inheritClass(a.ui.DecoratedOptionWidget,a.ui.OptionWidget),a.mixinClass(a.ui.DecoratedOptionWidget,a.ui.mixin.IconElement),a.mixinClass(a.ui.DecoratedOptionWidget,a.ui.mixin.IndicatorElement),a.ui.MenuOptionWidget=function(b){b=$.extend({icon:"check"},b),a.ui.MenuOptionWidget.parent.call(this,b),this.$element.attr("role","menuitem").addClass("oo-ui-menuOptionWidget")},a.inheritClass(a.ui.MenuOptionWidget,a.ui.DecoratedOptionWidget),a.ui.MenuOptionWidget.static.scrollIntoViewOnSelect=!0,a.ui.MenuSectionOptionWidget=function(b){a.ui.MenuSectionOptionWidget.parent.call(this,b),this.$element.addClass("oo-ui-menuSectionOptionWidget")},a.inheritClass(a.ui.MenuSectionOptionWidget,a.ui.DecoratedOptionWidget),a.ui.MenuSectionOptionWidget.static.selectable=!1,a.ui.MenuSectionOptionWidget.static.highlightable=!1,a.ui.MenuSelectWidget=function(b){b=b||{},a.ui.MenuSelectWidget.parent.call(this,b),a.ui.mixin.ClippableElement.call(this,$.extend({},b,{$clippable:this.$group})),this.autoHide=void 0===b.autoHide||!!b.autoHide,this.hideOnChoose=void 0===b.hideOnChoose||!!b.hideOnChoose,this.filterFromInput=!!b.filterFromInput,this.$input=b.$input?b.$input:b.input?b.input.$input:null,this.$widget=b.widget?b.widget.$element:null,this.onDocumentMouseDownHandler=this.onDocumentMouseDown.bind(this),this.onInputEditHandler=a.ui.debounce(this.updateItemVisibility.bind(this),100),this.$element.addClass("oo-ui-menuSelectWidget").attr("role","menu"),this.visible=!1,this.$element.addClass("oo-ui-element-hidden")},a.inheritClass(a.ui.MenuSelectWidget,a.ui.SelectWidget),a.mixinClass(a.ui.MenuSelectWidget,a.ui.mixin.ClippableElement),a.ui.MenuSelectWidget.prototype.onDocumentMouseDown=function(b){a.ui.contains(this.$element[0],b.target,!0)||this.$widget&&a.ui.contains(this.$widget[0],b.target,!0)||this.toggle(!1)},a.ui.MenuSelectWidget.prototype.onKeyDown=function(b){var c=this.getHighlightedItem()||this.getSelectedItem();if(!this.isDisabled()&&this.isVisible())switch(b.keyCode){case a.ui.Keys.LEFT:case a.ui.Keys.RIGHT:this.$input||a.ui.MenuSelectWidget.parent.prototype.onKeyDown.call(this,b);break;case a.ui.Keys.ESCAPE:case a.ui.Keys.TAB:c&&c.setHighlighted(!1),this.toggle(!1),b.keyCode===a.ui.Keys.ESCAPE&&(b.preventDefault(),b.stopPropagation());break;default:return void a.ui.MenuSelectWidget.parent.prototype.onKeyDown.call(this,b)}},a.ui.MenuSelectWidget.prototype.updateItemVisibility=function(){var b,c,d,e,f,g=!1,h=this.items.length,i=!this.isVisible(),j=i?null:this.getItemMatcher(this.$input.val());for(b=0;b<h;b++)c=this.items[b],c instanceof a.ui.MenuSectionOptionWidget?(e&&e.toggle(i||!f),e=c,f=!0):c instanceof a.ui.OptionWidget&&(d=i||j(c),g=g||d,f=f&&!d,c.toggle(d));e&&e.toggle(i||!f),this.$element.toggleClass("oo-ui-menuSelectWidget-invisible",!g),this.clip()},a.ui.MenuSelectWidget.prototype.bindKeyDownListener=function(){this.$input?this.$input.on("keydown",this.onKeyDownHandler):a.ui.MenuSelectWidget.parent.prototype.bindKeyDownListener.call(this)},a.ui.MenuSelectWidget.prototype.unbindKeyDownListener=function(){this.$input?this.$input.off("keydown",this.onKeyDownHandler):a.ui.MenuSelectWidget.parent.prototype.unbindKeyDownListener.call(this)},a.ui.MenuSelectWidget.prototype.bindKeyPressListener=function(){this.$input?this.filterFromInput&&this.$input.on("keydown mouseup cut paste change input select",this.onInputEditHandler):a.ui.MenuSelectWidget.parent.prototype.bindKeyPressListener.call(this)},a.ui.MenuSelectWidget.prototype.unbindKeyPressListener=function(){this.$input?this.filterFromInput&&(this.$input.off("keydown mouseup cut paste change input select",this.onInputEditHandler),this.updateItemVisibility()):a.ui.MenuSelectWidget.parent.prototype.unbindKeyPressListener.call(this)},a.ui.MenuSelectWidget.prototype.chooseItem=function(b){return a.ui.MenuSelectWidget.parent.prototype.chooseItem.call(this,b),this.hideOnChoose&&this.toggle(!1),this},a.ui.MenuSelectWidget.prototype.addItems=function(b,c){return a.ui.MenuSelectWidget.parent.prototype.addItems.call(this,b,c),this.clip(),this},a.ui.MenuSelectWidget.prototype.removeItems=function(b){return a.ui.MenuSelectWidget.parent.prototype.removeItems.call(this,b),this.clip(),this},a.ui.MenuSelectWidget.prototype.clearItems=function(){return a.ui.MenuSelectWidget.parent.prototype.clearItems.call(this),this.clip(),this},a.ui.MenuSelectWidget.prototype.toggle=function(b){var c;return b=(void 0===b?!this.visible:!!b)&&!!this.items.length,c=b!==this.isVisible(),!b||this.warnedUnattached||this.isElementAttached()||(a.ui.warnDeprecation("MenuSelectWidget#toggle: Before calling this method, the menu must be attached to the DOM."),this.warnedUnattached=!0),a.ui.MenuSelectWidget.parent.prototype.toggle.call(this,b),c&&(b?(this.bindKeyDownListener(),this.bindKeyPressListener(),this.toggleClipping(!0),this.getSelectedItem()&&this.getSelectedItem().scrollElementIntoView({duration:0}),this.autoHide&&this.getElementDocument().addEventListener("mousedown",this.onDocumentMouseDownHandler,!0)):(this.unbindKeyDownListener(),this.unbindKeyPressListener(),this.getElementDocument().removeEventListener("mousedown",this.onDocumentMouseDownHandler,!0),this.toggleClipping(!1))),this},a.ui.DropdownWidget=function(b){b=$.extend({indicator:"down"},b),a.ui.DropdownWidget.parent.call(this,b),this.$handle=this.$("<span>"),this.$overlay=b.$overlay||this.$element,a.ui.mixin.IconElement.call(this,b),a.ui.mixin.IndicatorElement.call(this,b),a.ui.mixin.LabelElement.call(this,b),a.ui.mixin.TitledElement.call(this,$.extend({},b,{$titled:this.$label})),a.ui.mixin.TabIndexedElement.call(this,$.extend({},b,{$tabIndexed:this.$handle})),this.menu=new a.ui.FloatingMenuSelectWidget($.extend({widget:this,$container:this.$element},b.menu)),this.$handle.on({click:this.onClick.bind(this),keydown:this.onKeyDown.bind(this),keypress:this.menu.onKeyPressHandler,blur:this.menu.clearKeyPressBuffer.bind(this.menu)}),this.menu.connect(this,{select:"onMenuSelect",toggle:"onMenuToggle"}),this.$handle.addClass("oo-ui-dropdownWidget-handle").append(this.$icon,this.$label,this.$indicator),this.$element.addClass("oo-ui-dropdownWidget").append(this.$handle),this.$overlay.append(this.menu.$element)},a.inheritClass(a.ui.DropdownWidget,a.ui.Widget),a.mixinClass(a.ui.DropdownWidget,a.ui.mixin.IconElement),a.mixinClass(a.ui.DropdownWidget,a.ui.mixin.IndicatorElement),a.mixinClass(a.ui.DropdownWidget,a.ui.mixin.LabelElement),a.mixinClass(a.ui.DropdownWidget,a.ui.mixin.TitledElement),a.mixinClass(a.ui.DropdownWidget,a.ui.mixin.TabIndexedElement),a.ui.DropdownWidget.prototype.getMenu=function(){return this.menu},a.ui.DropdownWidget.prototype.onMenuSelect=function(a){var b;return a?(b=a.getLabel(),b instanceof jQuery&&(b=b.clone()),void this.setLabel(b)):void this.setLabel(null)},a.ui.DropdownWidget.prototype.onMenuToggle=function(a){this.$element.toggleClass("oo-ui-dropdownWidget-open",a)},a.ui.DropdownWidget.prototype.onClick=function(b){return this.isDisabled()||b.which!==a.ui.MouseButtons.LEFT||this.menu.toggle(),!1},a.ui.DropdownWidget.prototype.onKeyDown=function(b){if(!(this.isDisabled()||b.which!==a.ui.Keys.ENTER&&(this.menu.isVisible()||b.which!==a.ui.Keys.SPACE&&b.which!==a.ui.Keys.UP&&b.which!==a.ui.Keys.DOWN)))return this.menu.toggle(),!1},a.ui.RadioOptionWidget=function(b){b=b||{},this.radio=new a.ui.RadioInputWidget({value:b.data,tabIndex:-1}),a.ui.RadioOptionWidget.parent.call(this,b),this.radio.$input.attr("role","presentation"),this.$element.addClass("oo-ui-radioOptionWidget").attr("role","radio").attr("aria-checked","false").removeAttr("aria-selected").prepend(this.radio.$element)},a.inheritClass(a.ui.RadioOptionWidget,a.ui.OptionWidget),a.ui.RadioOptionWidget.static.highlightable=!1,a.ui.RadioOptionWidget.static.scrollIntoViewOnSelect=!0,a.ui.RadioOptionWidget.static.pressable=!1,a.ui.RadioOptionWidget.static.tagName="label",a.ui.RadioOptionWidget.prototype.setSelected=function(b){return a.ui.RadioOptionWidget.parent.prototype.setSelected.call(this,b),this.radio.setSelected(b),this.$element.attr("aria-checked",b.toString()).removeAttr("aria-selected"),this},a.ui.RadioOptionWidget.prototype.setDisabled=function(b){return a.ui.RadioOptionWidget.parent.prototype.setDisabled.call(this,b),this.radio.setDisabled(this.isDisabled()),this},a.ui.RadioSelectWidget=function(b){a.ui.RadioSelectWidget.parent.call(this,b),a.ui.mixin.TabIndexedElement.call(this,b),this.$element.on({focus:this.bindKeyDownListener.bind(this),blur:this.unbindKeyDownListener.bind(this)}),this.$element.addClass("oo-ui-radioSelectWidget").attr("role","radiogroup")},a.inheritClass(a.ui.RadioSelectWidget,a.ui.SelectWidget),a.mixinClass(a.ui.RadioSelectWidget,a.ui.mixin.TabIndexedElement),a.ui.MultioptionWidget=function(b){b=b||{},a.ui.MultioptionWidget.parent.call(this,b),a.ui.mixin.ItemWidget.call(this),a.ui.mixin.LabelElement.call(this,b),this.selected=null,this.$element.addClass("oo-ui-multioptionWidget").append(this.$label),this.setSelected(b.selected)},a.inheritClass(a.ui.MultioptionWidget,a.ui.Widget),a.mixinClass(a.ui.MultioptionWidget,a.ui.mixin.ItemWidget),a.mixinClass(a.ui.MultioptionWidget,a.ui.mixin.LabelElement),a.ui.MultioptionWidget.prototype.isSelected=function(){return this.selected},a.ui.MultioptionWidget.prototype.setSelected=function(a){return a=!!a,this.selected!==a&&(this.selected=a,this.emit("change",a),this.$element.toggleClass("oo-ui-multioptionWidget-selected",a)),this},a.ui.MultiselectWidget=function(b){a.ui.MultiselectWidget.parent.call(this,b),b=b||{},a.ui.mixin.GroupWidget.call(this,b),this.aggregate({change:"select"}),this.connect(this,{select:["emit","change"]}),b.items&&this.addItems(b.items),this.$group.addClass("oo-ui-multiselectWidget-group"),this.$element.addClass("oo-ui-multiselectWidget").append(this.$group)},a.inheritClass(a.ui.MultiselectWidget,a.ui.Widget),a.mixinClass(a.ui.MultiselectWidget,a.ui.mixin.GroupWidget),a.ui.MultiselectWidget.prototype.getSelectedItems=function(){return this.items.filter(function(a){return a.isSelected()})},a.ui.MultiselectWidget.prototype.getSelectedItemsData=function(){return this.getSelectedItems().map(function(a){return a.data})},a.ui.MultiselectWidget.prototype.selectItems=function(a){return this.items.forEach(function(b){var c=a.indexOf(b)!==-1;b.setSelected(c)}),this},a.ui.MultiselectWidget.prototype.selectItemsByData=function(a){var b,c=this;return b=a.map(function(a){return c.getItemFromData(a)}),this.selectItems(b),this},a.ui.CheckboxMultioptionWidget=function(b){b=b||{},this.checkbox=new a.ui.CheckboxInputWidget,a.ui.CheckboxMultioptionWidget.parent.call(this,b),this.checkbox.on("change",this.onCheckboxChange.bind(this)),this.$element.on("keydown",this.onKeyDown.bind(this)),this.$element.addClass("oo-ui-checkboxMultioptionWidget").prepend(this.checkbox.$element)},a.inheritClass(a.ui.CheckboxMultioptionWidget,a.ui.MultioptionWidget),a.ui.CheckboxMultioptionWidget.static.tagName="label",a.ui.CheckboxMultioptionWidget.prototype.onCheckboxChange=function(){this.setSelected(this.checkbox.isSelected())},a.ui.CheckboxMultioptionWidget.prototype.setSelected=function(b){return a.ui.CheckboxMultioptionWidget.parent.prototype.setSelected.call(this,b),this.checkbox.setSelected(b),this},a.ui.CheckboxMultioptionWidget.prototype.setDisabled=function(b){return a.ui.CheckboxMultioptionWidget.parent.prototype.setDisabled.call(this,b),this.checkbox.setDisabled(this.isDisabled()),this},a.ui.CheckboxMultioptionWidget.prototype.focus=function(){this.checkbox.focus()},a.ui.CheckboxMultioptionWidget.prototype.onKeyDown=function(b){var c,d=this.getElementGroup();b.keyCode===a.ui.Keys.LEFT||b.keyCode===a.ui.Keys.UP?c=d.getRelativeFocusableItem(this,-1):b.keyCode!==a.ui.Keys.RIGHT&&b.keyCode!==a.ui.Keys.DOWN||(c=d.getRelativeFocusableItem(this,1)),c&&(b.preventDefault(),c.focus())},a.ui.CheckboxMultiselectWidget=function(b){a.ui.CheckboxMultiselectWidget.parent.call(this,b),this.$lastClicked=null,this.$group.on("click",this.onClick.bind(this)),this.$element.addClass("oo-ui-checkboxMultiselectWidget")},a.inheritClass(a.ui.CheckboxMultiselectWidget,a.ui.MultiselectWidget),a.ui.CheckboxMultiselectWidget.prototype.getRelativeFocusableItem=function(a,b){var c,d,e,f=b>0?1:-1,g=this.items.length;for(a?(c=this.items.indexOf(a),d=(c+f+g)%g):d=b>0?0:g-1,e=0;e<g;e++){if(a=this.items[d],a&&!a.isDisabled())return a;d=(d+f+g)%g}return null},a.ui.CheckboxMultiselectWidget.prototype.onClick=function(a){var b,c,d,e,f,g,h,i=this.$lastClicked,j=$(a.target).closest(".oo-ui-checkboxMultioptionWidget").not(".oo-ui-widget-disabled");if(i&&j.length&&a.shiftKey&&(b=this.$group.find(".oo-ui-checkboxMultioptionWidget"),c=b.index(i),d=b.index(j),d!==c)){for(h=this.items,g=h[d].isSelected(),f=d>c?1:-1,e=c;e!==d;e+=f)h[e].isDisabled()||h[e].setSelected(!g);a.preventDefault(),setTimeout(function(){h[d].isDisabled()||h[d].setSelected(!g)})}j.length&&(this.$lastClicked=j)},a.ui.FloatingMenuSelectWidget=function(b,c){a.isPlainObject(b)&&void 0===c&&(c=b,b=c.inputWidget),c=c||{},a.ui.FloatingMenuSelectWidget.parent.call(this,c),this.inputWidget=b,this.$container=c.$container||this.inputWidget.$element,a.ui.mixin.FloatableElement.call(this,$.extend({},c,{$floatableContainer:this.$container})),this.$element.addClass("oo-ui-floatingMenuSelectWidget"),this.$element.addClass("oo-ui-textInputMenuSelectWidget")},a.inheritClass(a.ui.FloatingMenuSelectWidget,a.ui.MenuSelectWidget),a.mixinClass(a.ui.FloatingMenuSelectWidget,a.ui.mixin.FloatableElement),a.ui.FloatingMenuSelectWidget.prototype.toggle=function(b){var c;return b=void 0===b?!this.isVisible():!!b,c=b!==this.isVisible(),c&&b&&this.setIdealSize(this.$container.width()),a.ui.FloatingMenuSelectWidget.parent.prototype.toggle.call(this,b),c&&this.togglePositioning(this.isVisible()),this},a.ui.TextInputMenuSelectWidget=function(){a.ui.warnDeprecation("TextInputMenuSelectWidget is deprecated. Use the FloatingMenuSelectWidget instead."),a.ui.TextInputMenuSelectWidget.parent.apply(this,arguments)},a.inheritClass(a.ui.TextInputMenuSelectWidget,a.ui.FloatingMenuSelectWidget),a.ui.ProgressBarWidget=function(b){b=b||{},a.ui.ProgressBarWidget.parent.call(this,b),this.$bar=$("<div>"),this.progress=null,this.setProgress(void 0!==b.progress&&b.progress),this.$bar.addClass("oo-ui-progressBarWidget-bar"),this.$element.attr({role:"progressbar","aria-valuemin":0,"aria-valuemax":100}).addClass("oo-ui-progressBarWidget").append(this.$bar)},a.inheritClass(a.ui.ProgressBarWidget,a.ui.Widget),a.ui.ProgressBarWidget.static.tagName="div",a.ui.ProgressBarWidget.prototype.getProgress=function(){return this.progress},a.ui.ProgressBarWidget.prototype.setProgress=function(a){this.progress=a,a!==!1?(this.$bar.css("width",this.progress+"%"),this.$element.attr("aria-valuenow",this.progress)):(this.$bar.css("width",""),this.$element.removeAttr("aria-valuenow")),this.$element.toggleClass("oo-ui-progressBarWidget-indeterminate",a===!1)},a.ui.InputWidget=function(b){b=b||{},a.ui.InputWidget.parent.call(this,b),this.$input=b.$input||this.getInputElement(b),this.value="",this.inputFilter=b.inputFilter,a.ui.mixin.FlaggedElement.call(this,b),a.ui.mixin.TabIndexedElement.call(this,$.extend({},b,{$tabIndexed:this.$input})),a.ui.mixin.TitledElement.call(this,$.extend({},b,{$titled:this.$input})),a.ui.mixin.AccessKeyedElement.call(this,$.extend({},b,{$accessKeyed:this.$input})),this.$input.on("keydown mouseup cut paste change input select",this.onEdit.bind(this)),this.$input.addClass("oo-ui-inputWidget-input").attr("name",b.name).prop("disabled",this.isDisabled()),this.$element.addClass("oo-ui-inputWidget").append(this.$input),this.setValue(b.value),b.dir&&this.setDir(b.dir)},a.inheritClass(a.ui.InputWidget,a.ui.Widget),a.mixinClass(a.ui.InputWidget,a.ui.mixin.FlaggedElement),a.mixinClass(a.ui.InputWidget,a.ui.mixin.TabIndexedElement),a.mixinClass(a.ui.InputWidget,a.ui.mixin.TitledElement),a.mixinClass(a.ui.InputWidget,a.ui.mixin.AccessKeyedElement),a.ui.InputWidget.static.supportsSimpleLabel=!0,a.ui.InputWidget.static.reusePreInfuseDOM=function(b,c){return c=a.ui.InputWidget.parent.static.reusePreInfuseDOM(b,c),c.$input=$(b).find(".oo-ui-inputWidget-input"),c},a.ui.InputWidget.static.gatherPreInfuseState=function(b,c){var d=a.ui.InputWidget.parent.static.gatherPreInfuseState(b,c);return c.$input&&c.$input.length&&(d.value=c.$input.val(),d.focus=c.$input.is(":focus")),d},a.ui.InputWidget.prototype.getInputElement=function(){return $("<input>")};a.ui.InputWidget.prototype.getInputId=function(){var b=this.$input.attr("id");return void 0===b&&(b=a.ui.generateElementId(),this.$input.attr("id",b)),b};a.ui.InputWidget.prototype.onEdit=function(){var a=this;this.isDisabled()||setTimeout(function(){a.setValue(a.$input.val())})},a.ui.InputWidget.prototype.getValue=function(){var a=this.$input.val();return this.value!==a&&this.setValue(a),this.value},a.ui.InputWidget.prototype.setDir=function(a){return this.$input.prop("dir",a),this},a.ui.InputWidget.prototype.setValue=function(a){return a=this.cleanUpValue(a),this.$input.val()!==a&&this.$input.val(a),this.value!==a&&(this.value=a,this.emit("change",this.value)),this},a.ui.InputWidget.prototype.cleanUpValue=function(a){return void 0===a||null===a?"":this.inputFilter?this.inputFilter(String(a)):String(a)},a.ui.InputWidget.prototype.simulateLabelClick=function(){a.ui.warnDeprecation("InputWidget: simulateLabelClick() is deprecated."),this.isDisabled()||(this.$input.is(":checkbox, :radio")&&this.$input.click(),this.$input.is(":input")&&this.$input[0].focus())},a.ui.InputWidget.prototype.setDisabled=function(b){return a.ui.InputWidget.parent.prototype.setDisabled.call(this,b),this.$input&&this.$input.prop("disabled",this.isDisabled()),this},a.ui.InputWidget.prototype.focus=function(){return this.$input[0].focus(),this},a.ui.InputWidget.prototype.blur=function(){return this.$input[0].blur(),this},a.ui.InputWidget.prototype.restorePreInfuseState=function(b){a.ui.InputWidget.parent.prototype.restorePreInfuseState.call(this,b),void 0!==b.value&&b.value!==this.getValue()&&this.setValue(b.value),b.focus&&this.focus()},a.ui.ButtonInputWidget=function(b){b=$.extend({type:"button",useInputTag:!1},b),b.$input&&b.$input.empty(),this.useInputTag=b.useInputTag,a.ui.ButtonInputWidget.parent.call(this,b),a.ui.mixin.ButtonElement.call(this,$.extend({},b,{$button:this.$input})),a.ui.mixin.IconElement.call(this,b),a.ui.mixin.IndicatorElement.call(this,b),a.ui.mixin.LabelElement.call(this,b),a.ui.mixin.TitledElement.call(this,$.extend({},b,{$titled:this.$input})),b.useInputTag||this.$input.append(this.$icon,this.$label,this.$indicator),this.$element.addClass("oo-ui-buttonInputWidget")},a.inheritClass(a.ui.ButtonInputWidget,a.ui.InputWidget),a.mixinClass(a.ui.ButtonInputWidget,a.ui.mixin.ButtonElement),a.mixinClass(a.ui.ButtonInputWidget,a.ui.mixin.IconElement),a.mixinClass(a.ui.ButtonInputWidget,a.ui.mixin.IndicatorElement),a.mixinClass(a.ui.ButtonInputWidget,a.ui.mixin.LabelElement),a.mixinClass(a.ui.ButtonInputWidget,a.ui.mixin.TitledElement),a.ui.ButtonInputWidget.static.supportsSimpleLabel=!1,a.ui.ButtonInputWidget.prototype.getInputElement=function(a){var b;return b=["button","submit","reset"].indexOf(a.type)!==-1?a.type:"button",$("<"+(a.useInputTag?"input":"button")+' type="'+b+'">')},a.ui.ButtonInputWidget.prototype.setLabel=function(b){return"function"==typeof b&&(b=a.ui.resolveMsg(b)),this.useInputTag&&("string"!=typeof b&&(b=""),this.$input.val(b)),a.ui.mixin.LabelElement.prototype.setLabel.call(this,b)},a.ui.ButtonInputWidget.prototype.setValue=function(b){return this.useInputTag||a.ui.ButtonInputWidget.parent.prototype.setValue.call(this,b),this},a.ui.CheckboxInputWidget=function(b){b=b||{},a.ui.CheckboxInputWidget.parent.call(this,b),this.$element.addClass("oo-ui-checkboxInputWidget").append($("<span>")),this.setSelected(void 0!==b.selected&&b.selected)},a.inheritClass(a.ui.CheckboxInputWidget,a.ui.InputWidget),a.ui.CheckboxInputWidget.static.gatherPreInfuseState=function(b,c){var d=a.ui.CheckboxInputWidget.parent.static.gatherPreInfuseState(b,c);return d.checked=c.$input.prop("checked"),d},a.ui.CheckboxInputWidget.prototype.getInputElement=function(){return $("<input>").attr("type","checkbox")},a.ui.CheckboxInputWidget.prototype.onEdit=function(){var a=this;this.isDisabled()||setTimeout(function(){a.setSelected(a.$input.prop("checked"))})},a.ui.CheckboxInputWidget.prototype.setSelected=function(a){return a=!!a,this.selected!==a&&(this.selected=a,this.$input.prop("checked",this.selected),this.emit("change",this.selected)),this},a.ui.CheckboxInputWidget.prototype.isSelected=function(){var a=this.$input.prop("checked");return this.selected!==a&&this.setSelected(a),this.selected},a.ui.CheckboxInputWidget.prototype.restorePreInfuseState=function(b){a.ui.CheckboxInputWidget.parent.prototype.restorePreInfuseState.call(this,b),void 0!==b.checked&&b.checked!==this.isSelected()&&this.setSelected(b.checked)},a.ui.DropdownInputWidget=function(b){b=b||{},b.$input&&b.$input.addClass("oo-ui-element-hidden"),this.dropdownWidget=new a.ui.DropdownWidget(b.dropdown),a.ui.DropdownInputWidget.parent.call(this,b),a.ui.mixin.TitledElement.call(this,b),this.dropdownWidget.getMenu().connect(this,{select:"onMenuSelect"}),this.setOptions(b.options||[]),this.$element.addClass("oo-ui-dropdownInputWidget").append(this.dropdownWidget.$element)},a.inheritClass(a.ui.DropdownInputWidget,a.ui.InputWidget),a.mixinClass(a.ui.DropdownInputWidget,a.ui.mixin.TitledElement),a.ui.DropdownInputWidget.prototype.getInputElement=function(){return $("<input>").attr("type","hidden")},a.ui.DropdownInputWidget.prototype.onMenuSelect=function(a){this.setValue(a.getData())},a.ui.DropdownInputWidget.prototype.setValue=function(b){return b=this.cleanUpValue(b),this.dropdownWidget.getMenu().selectItemByData(b),a.ui.DropdownInputWidget.parent.prototype.setValue.call(this,b),this},a.ui.DropdownInputWidget.prototype.setDisabled=function(b){return this.dropdownWidget.setDisabled(b),a.ui.DropdownInputWidget.parent.prototype.setDisabled.call(this,b),this},a.ui.DropdownInputWidget.prototype.setOptions=function(b){var c=this.getValue(),d=this;return this.dropdownWidget.getMenu().clearItems().addItems(b.map(function(b){var c=d.cleanUpValue(b.data);return new a.ui.MenuOptionWidget({data:c,label:void 0!==b.label?b.label:c})})),this.dropdownWidget.getMenu().getItemFromData(c)?this.setValue(c):b.length&&this.setValue(b[0].data),this},a.ui.DropdownInputWidget.prototype.focus=function(){return this.dropdownWidget.getMenu().toggle(!0),this},a.ui.DropdownInputWidget.prototype.blur=function(){return this.dropdownWidget.getMenu().toggle(!1),this},a.ui.RadioInputWidget=function(b){b=b||{},a.ui.RadioInputWidget.parent.call(this,b),this.$element.addClass("oo-ui-radioInputWidget").append($("<span>")),this.setSelected(void 0!==b.selected&&b.selected)},a.inheritClass(a.ui.RadioInputWidget,a.ui.InputWidget),a.ui.RadioInputWidget.static.gatherPreInfuseState=function(b,c){var d=a.ui.RadioInputWidget.parent.static.gatherPreInfuseState(b,c);return d.checked=c.$input.prop("checked"),d},a.ui.RadioInputWidget.prototype.getInputElement=function(){return $("<input>").attr("type","radio")},a.ui.RadioInputWidget.prototype.onEdit=function(){},a.ui.RadioInputWidget.prototype.setSelected=function(a){return this.$input.prop("checked",a),this},a.ui.RadioInputWidget.prototype.isSelected=function(){return this.$input.prop("checked")},a.ui.RadioInputWidget.prototype.restorePreInfuseState=function(b){a.ui.RadioInputWidget.parent.prototype.restorePreInfuseState.call(this,b),void 0!==b.checked&&b.checked!==this.isSelected()&&this.setSelected(b.checked)},a.ui.RadioSelectInputWidget=function(b){b=b||{},this.radioSelectWidget=new a.ui.RadioSelectWidget,a.ui.RadioSelectInputWidget.parent.call(this,b),this.radioSelectWidget.connect(this,{select:"onMenuSelect"}),this.setOptions(b.options||[]),this.$element.addClass("oo-ui-radioSelectInputWidget").append(this.radioSelectWidget.$element)},a.inheritClass(a.ui.RadioSelectInputWidget,a.ui.InputWidget),a.ui.RadioSelectInputWidget.static.supportsSimpleLabel=!1,a.ui.RadioSelectInputWidget.static.gatherPreInfuseState=function(b,c){var d=a.ui.RadioSelectInputWidget.parent.static.gatherPreInfuseState(b,c);return d.value=$(b).find(".oo-ui-radioInputWidget .oo-ui-inputWidget-input:checked").val(),d},a.ui.RadioSelectInputWidget.static.reusePreInfuseDOM=function(b,c){return c=a.ui.RadioSelectInputWidget.parent.static.reusePreInfuseDOM(b,c),delete c.$input,c},a.ui.RadioSelectInputWidget.prototype.getInputElement=function(){return $("<input>").attr("type","hidden")},a.ui.RadioSelectInputWidget.prototype.onMenuSelect=function(a){this.setValue(a.getData())},a.ui.RadioSelectInputWidget.prototype.setValue=function(b){return b=this.cleanUpValue(b),this.radioSelectWidget.selectItemByData(b),a.ui.RadioSelectInputWidget.parent.prototype.setValue.call(this,b),this},a.ui.RadioSelectInputWidget.prototype.setDisabled=function(b){return this.radioSelectWidget.setDisabled(b),a.ui.RadioSelectInputWidget.parent.prototype.setDisabled.call(this,b),this},a.ui.RadioSelectInputWidget.prototype.setOptions=function(b){var c=this.getValue(),d=this;return this.radioSelectWidget.clearItems().addItems(b.map(function(b){var c=d.cleanUpValue(b.data);return new a.ui.RadioOptionWidget({data:c,label:void 0!==b.label?b.label:c})})),this.radioSelectWidget.getItemFromData(c)?this.setValue(c):b.length&&this.setValue(b[0].data),this},a.ui.CheckboxMultiselectInputWidget=function(b){b=b||{},this.checkboxMultiselectWidget=new a.ui.CheckboxMultiselectWidget,a.ui.CheckboxMultiselectInputWidget.parent.call(this,b),this.inputName=b.name,this.$element.addClass("oo-ui-checkboxMultiselectInputWidget").append(this.checkboxMultiselectWidget.$element),this.$input.detach(),this.setOptions(b.options||[]),this.setValue(b.value)},a.inheritClass(a.ui.CheckboxMultiselectInputWidget,a.ui.InputWidget),a.ui.CheckboxMultiselectInputWidget.static.supportsSimpleLabel=!1,a.ui.CheckboxMultiselectInputWidget.static.gatherPreInfuseState=function(b,c){var d=a.ui.CheckboxMultiselectInputWidget.parent.static.gatherPreInfuseState(b,c);return d.value=$(b).find(".oo-ui-checkboxInputWidget .oo-ui-inputWidget-input:checked").toArray().map(function(a){return a.value}),d},a.ui.CheckboxMultiselectInputWidget.static.reusePreInfuseDOM=function(b,c){return c=a.ui.CheckboxMultiselectInputWidget.parent.static.reusePreInfuseDOM(b,c),delete c.$input,c},a.ui.CheckboxMultiselectInputWidget.prototype.getInputElement=function(){return $("<div>")},a.ui.CheckboxMultiselectInputWidget.prototype.getValue=function(){var a=this.$element.find(".oo-ui-checkboxInputWidget .oo-ui-inputWidget-input:checked").toArray().map(function(a){return a.value});return this.value!==a&&this.setValue(a),this.value},a.ui.CheckboxMultiselectInputWidget.prototype.setValue=function(b){return b=this.cleanUpValue(b),this.checkboxMultiselectWidget.selectItemsByData(b),a.ui.CheckboxMultiselectInputWidget.parent.prototype.setValue.call(this,b),this},a.ui.CheckboxMultiselectInputWidget.prototype.cleanUpValue=function(b){var c,d,e=[];if(!Array.isArray(b))return e;for(c=0;c<b.length;c++)d=a.ui.CheckboxMultiselectInputWidget.parent.prototype.cleanUpValue.call(this,b[c]),this.checkboxMultiselectWidget.getItemFromData(d)&&e.push(d);return e},a.ui.CheckboxMultiselectInputWidget.prototype.setDisabled=function(b){return this.checkboxMultiselectWidget.setDisabled(b),a.ui.CheckboxMultiselectInputWidget.parent.prototype.setDisabled.call(this,b),this},a.ui.CheckboxMultiselectInputWidget.prototype.setOptions=function(b){var c=this;return this.checkboxMultiselectWidget.clearItems().addItems(b.map(function(b){var d,e,f;return d=a.ui.CheckboxMultiselectInputWidget.parent.prototype.cleanUpValue.call(c,b.data),f=void 0!==b.disabled&&b.disabled,e=new a.ui.CheckboxMultioptionWidget({data:d,label:void 0!==b.label?b.label:d,disabled:f}),e.checkbox.$input.attr("name",c.inputName),e.checkbox.setValue(d),e})),this.setValue(this.getValue()),this},a.ui.TextInputWidget=function(b){b=$.extend({type:"text",labelPosition:"after"},b),"search"===b.type&&(a.ui.warnDeprecation("TextInputWidget: config.type='search' is deprecated. Use the SearchInputWidget instead. See T148471 for details."),void 0===b.icon&&(b.icon="search")),a.ui.TextInputWidget.parent.call(this,b),a.ui.mixin.IconElement.call(this,b),a.ui.mixin.IndicatorElement.call(this,b),a.ui.mixin.PendingElement.call(this,$.extend({},b,{$pending:this.$input})),a.ui.mixin.LabelElement.call(this,b),this.type=this.getSaneType(b),this.readOnly=!1,this.required=!1,this.multiline=!!b.multiline,this.autosize=!!b.autosize,this.minRows=void 0!==b.rows?b.rows:"",this.maxRows=b.maxRows||Math.max(2*(this.minRows||0),10),this.validate=null,this.styleHeight=null,this.scrollWidth=null,this.autosize&&(this.$clone=this.$input.clone().insertAfter(this.$input).attr("aria-hidden","true").addClass("oo-ui-element-hidden")),this.setValidation(b.validate),this.setLabelPosition(b.labelPosition),this.$input.on({keypress:this.onKeyPress.bind(this),blur:this.onBlur.bind(this),focus:this.onFocus.bind(this)}),this.$icon.on("mousedown",this.onIconMouseDown.bind(this)),this.$indicator.on("mousedown",this.onIndicatorMouseDown.bind(this)),this.on("labelChange",this.updatePosition.bind(this)),this.connect(this,{change:"onChange",disable:"onDisable"}),this.on("change",a.ui.debounce(this.onDebouncedChange.bind(this),250)),this.$element.addClass("oo-ui-textInputWidget oo-ui-textInputWidget-type-"+this.type).append(this.$icon,this.$indicator),
  this.setReadOnly(!!b.readOnly),this.setRequired(!!b.required),this.updateSearchIndicator(),void 0!==b.placeholder&&this.$input.attr("placeholder",b.placeholder),void 0!==b.maxLength&&this.$input.attr("maxlength",b.maxLength),b.autofocus&&this.$input.attr("autofocus","autofocus"),b.autocomplete===!1&&(this.$input.attr("autocomplete","off"),$(window).on({beforeunload:function(){this.$input.removeAttr("autocomplete")}.bind(this),pageshow:function(){this.$input.attr("autocomplete","off")}.bind(this)})),this.multiline&&b.rows&&this.$input.attr("rows",b.rows),(this.label||b.autosize)&&(this.isWaitingToBeAttached=!0,this.installParentChangeDetector())},a.inheritClass(a.ui.TextInputWidget,a.ui.InputWidget),a.mixinClass(a.ui.TextInputWidget,a.ui.mixin.IconElement),a.mixinClass(a.ui.TextInputWidget,a.ui.mixin.IndicatorElement),a.mixinClass(a.ui.TextInputWidget,a.ui.mixin.PendingElement),a.mixinClass(a.ui.TextInputWidget,a.ui.mixin.LabelElement),a.ui.TextInputWidget.static.validationPatterns={"non-empty":/.+/,integer:/^\d+$/},a.ui.TextInputWidget.static.gatherPreInfuseState=function(b,c){var d=a.ui.TextInputWidget.parent.static.gatherPreInfuseState(b,c);return c.multiline&&(d.scrollTop=c.$input.scrollTop()),d},a.ui.TextInputWidget.prototype.onIconMouseDown=function(b){if(b.which===a.ui.MouseButtons.LEFT)return this.$input[0].focus(),!1},a.ui.TextInputWidget.prototype.onIndicatorMouseDown=function(b){if(b.which===a.ui.MouseButtons.LEFT)return"search"===this.type&&this.setValue(""),this.$input[0].focus(),!1},a.ui.TextInputWidget.prototype.onKeyPress=function(b){b.which!==a.ui.Keys.ENTER||this.multiline||this.emit("enter",b)},a.ui.TextInputWidget.prototype.onBlur=function(){this.setValidityFlag()},a.ui.TextInputWidget.prototype.onFocus=function(){this.isWaitingToBeAttached&&this.onElementAttach(),this.setValidityFlag(!0)},a.ui.TextInputWidget.prototype.onElementAttach=function(){this.isWaitingToBeAttached=!1,this.valCache=null,this.adjustSize(),this.positionLabel()},a.ui.TextInputWidget.prototype.onChange=function(){this.updateSearchIndicator(),this.adjustSize()},a.ui.TextInputWidget.prototype.onDebouncedChange=function(){this.setValidityFlag()},a.ui.TextInputWidget.prototype.onDisable=function(){this.updateSearchIndicator()},a.ui.TextInputWidget.prototype.isReadOnly=function(){return this.readOnly},a.ui.TextInputWidget.prototype.setReadOnly=function(a){return this.readOnly=!!a,this.$input.prop("readOnly",this.readOnly),this.updateSearchIndicator(),this},a.ui.TextInputWidget.prototype.isRequired=function(){return this.required},a.ui.TextInputWidget.prototype.setRequired=function(a){return this.required=!!a,this.required?(this.$input.attr("required","required").attr("aria-required","true"),null===this.getIndicator()&&this.setIndicator("required")):(this.$input.removeAttr("required").removeAttr("aria-required"),"required"===this.getIndicator()&&this.setIndicator(null)),this.updateSearchIndicator(),this},a.ui.TextInputWidget.prototype.installParentChangeDetector=function(){var a,b,c,d,e=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,f=this;if(e){if(this.isElementAttached())return;for(c=this.$element[0];c.parentNode;)c=c.parentNode;a=new e(function(a){var d,e,f;for(d=0;d<a.length;d++)for(f=a[d].removedNodes,e=0;e<f.length;e++)if(f[e]===c)return void setTimeout(b,0)}),b=function(){f.isElementAttached()&&f.onElementAttach(),a.disconnect(),f.installParentChangeDetector()},d=$("<div>").append(c)[0],a.observe(d,{childList:!0})}else this.$element.on("DOMNodeInsertedIntoDocument",this.onElementAttach.bind(this))},a.ui.TextInputWidget.prototype.adjustSize=function(){var a,b,c,d,e,f,g,h,i;return this.isWaitingToBeAttached?this:(this.multiline&&this.$input.val()!==this.valCache&&(this.autosize&&(this.$clone.val(this.$input.val()).attr("rows",this.minRows).css("height",0),this.$clone.removeClass("oo-ui-element-hidden"),this.valCache=this.$input.val(),a=this.$clone[0].scrollHeight,this.$clone.css("height",""),b=this.$clone.innerHeight(),c=this.$clone.outerHeight(),this.$clone.attr("rows",this.maxRows).css("height","auto").val(""),d=this.$clone.innerHeight(),e=d-this.$clone[0].scrollHeight,f=Math.min(d,a+e),this.$clone.addClass("oo-ui-element-hidden"),g=f>b?f+(c-b):"",g!==this.styleHeight&&(this.$input.css("height",g),this.styleHeight=g,this.emit("resize"))),h=this.$input[0].offsetWidth-this.$input[0].clientWidth,h!==this.scrollWidth&&(i="rtl"===this.$element.css("direction")?"left":"right",this.$label.css({right:"",left:""}),this.$indicator.css({right:"",left:""}),h&&(this.$indicator.css(i,h),"after"===this.labelPosition&&this.$label.css(i,h)),this.scrollWidth=h,this.positionLabel())),this)},a.ui.TextInputWidget.prototype.getInputElement=function(a){return a.multiline?$("<textarea>"):"number"===this.getSaneType(a)?$("<input>").attr("step","any").attr("type","number"):$("<input>").attr("type",this.getSaneType(a))},a.ui.TextInputWidget.prototype.getSaneType=function(a){var b=["text","password","search","email","url","date","month","number"];return b.indexOf(a.type)!==-1?a.type:"text"},a.ui.TextInputWidget.prototype.isMultiline=function(){return!!this.multiline},a.ui.TextInputWidget.prototype.isAutosizing=function(){return!!this.autosize},a.ui.TextInputWidget.prototype.selectRange=function(a,b){var c,d,e,f=this.$input[0];b=b||a,c=b<a,d=c?b:a,e=c?a:b,this.focus();try{f.setSelectionRange(d,e,c?"backward":"forward")}catch(a){if(this.getElementDocument().body.contains(f))throw a}return this},a.ui.TextInputWidget.prototype.getRange=function(){var a=this.$input[0],b=a.selectionStart,c=a.selectionEnd,d="backward"===a.selectionDirection;return{from:d?c:b,to:d?b:c}},a.ui.TextInputWidget.prototype.getInputLength=function(){return this.$input[0].value.length},a.ui.TextInputWidget.prototype.select=function(){return this.selectRange(0,this.getInputLength())},a.ui.TextInputWidget.prototype.moveCursorToStart=function(){return this.selectRange(0)},a.ui.TextInputWidget.prototype.moveCursorToEnd=function(){return this.selectRange(this.getInputLength())},a.ui.TextInputWidget.prototype.insertContent=function(a){var b,c,d=this.getRange(),e=this.getValue();return b=Math.min(d.from,d.to),c=Math.max(d.from,d.to),this.setValue(e.slice(0,b)+a+e.slice(c)),this.selectRange(b+a.length),this},a.ui.TextInputWidget.prototype.encapsulateContent=function(a,b){var c,d,e=this.getRange(),f=a.length;return c=Math.min(e.from,e.to),d=Math.max(e.from,e.to),this.selectRange(c).insertContent(a),this.selectRange(f+d).insertContent(b),this.selectRange(f+c,f+d),this},a.ui.TextInputWidget.prototype.setValidation=function(a){a instanceof RegExp||a instanceof Function?this.validate=a:this.validate=this.constructor.static.validationPatterns[a]||/.*/},a.ui.TextInputWidget.prototype.setValidityFlag=function(a){var b=this,c=function(a){a?b.$input.removeAttr("aria-invalid"):b.$input.attr("aria-invalid","true"),b.setFlags({invalid:!a})};void 0!==a?c(a):this.getValidity().then(function(){c(!0)},function(){c(!1)})},a.ui.TextInputWidget.prototype.getValidity=function(){function a(a){return a?$.Deferred().resolve().promise():$.Deferred().reject().promise()}var b;return void 0!==this.$input[0].checkValidity&&this.$input[0].checkValidity()===!1?a(!1):this.validate instanceof Function?(b=this.validate(this.getValue()),b&&$.isFunction(b.promise)?b.promise().then(function(b){return a(b)}):a(b)):a(this.getValue().match(this.validate))},a.ui.TextInputWidget.prototype.setLabelPosition=function(a){return this.labelPosition=a,this.label&&this.updatePosition(),this},a.ui.TextInputWidget.prototype.updatePosition=function(){var a="after"===this.labelPosition;return this.$element.toggleClass("oo-ui-textInputWidget-labelPosition-after",!!this.label&&a).toggleClass("oo-ui-textInputWidget-labelPosition-before",!!this.label&&!a),this.valCache=null,this.scrollWidth=null,this.adjustSize(),this.positionLabel(),this},a.ui.TextInputWidget.prototype.updateSearchIndicator=function(){"search"===this.type&&(""===this.getValue()||this.isDisabled()||this.isReadOnly()?this.setIndicator(null):this.setIndicator("clear"))},a.ui.TextInputWidget.prototype.positionLabel=function(){var a,b,c;return this.isWaitingToBeAttached?this:(this.$input.css({"padding-right":"","padding-left":""}),this.label?(this.$element.append(this.$label),a="after"===this.labelPosition,b="rtl"===this.$element.css("direction"),c=a===b?"padding-left":"padding-right",this.$input.css(c,this.$label.outerWidth(!0)+(a?this.scrollWidth:0)),this):void this.$label.detach())},a.ui.TextInputWidget.prototype.restorePreInfuseState=function(b){a.ui.TextInputWidget.parent.prototype.restorePreInfuseState.call(this,b),void 0!==b.scrollTop&&this.$input.scrollTop(b.scrollTop)},a.ui.SearchInputWidget=function(b){b=$.extend({icon:"search"},b),b.type="text",a.ui.SearchInputWidget.parent.call(this,b),this.$element.addClass("oo-ui-textInputWidget-type-search"),this.updateSearchIndicator(),this.connect(this,{disable:"onDisable"})},a.inheritClass(a.ui.SearchInputWidget,a.ui.TextInputWidget),a.ui.SearchInputWidget.prototype.getInputElement=function(){return $("<input>").attr("type","search")},a.ui.SearchInputWidget.prototype.onIndicatorMouseDown=function(b){if(b.which===a.ui.MouseButtons.LEFT)return this.setValue(""),this.$input[0].focus(),!1},a.ui.SearchInputWidget.prototype.updateSearchIndicator=function(){""===this.getValue()||this.isDisabled()||this.isReadOnly()?this.setIndicator(null):this.setIndicator("clear")},a.ui.SearchInputWidget.prototype.onChange=function(){a.ui.SearchInputWidget.parent.prototype.onChange.call(this),this.updateSearchIndicator()},a.ui.SearchInputWidget.prototype.onDisable=function(){this.updateSearchIndicator()},a.ui.SearchInputWidget.prototype.setReadOnly=function(b){return a.ui.SearchInputWidget.parent.prototype.setReadOnly.call(this,b),this.updateSearchIndicator(),this},a.ui.ComboBoxInputWidget=function(b){b=$.extend({autocomplete:!1},b),b.multiline=!1,a.ui.ComboBoxInputWidget.parent.call(this,b),this.$overlay=b.$overlay||this.$element,this.dropdownButton=new a.ui.ButtonWidget({classes:["oo-ui-comboBoxInputWidget-dropdownButton"],indicator:"down",disabled:this.disabled}),this.menu=new a.ui.FloatingMenuSelectWidget($.extend({widget:this,input:this,$container:this.$element,disabled:this.isDisabled()},b.menu)),this.connect(this,{change:"onInputChange",enter:"onInputEnter"}),this.dropdownButton.connect(this,{click:"onDropdownButtonClick"}),this.menu.connect(this,{choose:"onMenuChoose",add:"onMenuItemsChange",remove:"onMenuItemsChange"}),this.$input.attr({role:"combobox","aria-autocomplete":"list"}),void 0!==b.options&&this.setOptions(b.options),this.$field=$("<div>").addClass("oo-ui-comboBoxInputWidget-field").append(this.$input,this.dropdownButton.$element),this.$element.addClass("oo-ui-comboBoxInputWidget").append(this.$field),this.$overlay.append(this.menu.$element),this.onMenuItemsChange()},a.inheritClass(a.ui.ComboBoxInputWidget,a.ui.TextInputWidget),a.ui.ComboBoxInputWidget.prototype.getMenu=function(){return this.menu},a.ui.ComboBoxInputWidget.prototype.getInput=function(){return this},a.ui.ComboBoxInputWidget.prototype.onInputChange=function(a){var b=this.menu.getItemFromData(a);this.menu.selectItem(b),this.menu.getHighlightedItem()&&this.menu.highlightItem(b),this.isDisabled()||this.menu.toggle(!0)},a.ui.ComboBoxInputWidget.prototype.onInputEnter=function(){this.isDisabled()||this.menu.toggle(!1)},a.ui.ComboBoxInputWidget.prototype.onDropdownButtonClick=function(){this.menu.toggle(),this.$input[0].focus()},a.ui.ComboBoxInputWidget.prototype.onMenuChoose=function(a){this.setValue(a.getData())},a.ui.ComboBoxInputWidget.prototype.onMenuItemsChange=function(){var a=this.menu.getItemFromData(this.getValue());this.menu.selectItem(a),this.menu.getHighlightedItem()&&this.menu.highlightItem(a),this.$element.toggleClass("oo-ui-comboBoxInputWidget-empty",this.menu.isEmpty())},a.ui.ComboBoxInputWidget.prototype.setDisabled=function(b){return a.ui.ComboBoxInputWidget.parent.prototype.setDisabled.call(this,b),this.dropdownButton&&this.dropdownButton.setDisabled(this.isDisabled()),this.menu&&this.menu.setDisabled(this.isDisabled()),this},a.ui.ComboBoxInputWidget.prototype.setOptions=function(b){return this.getMenu().clearItems().addItems(b.map(function(b){return new a.ui.MenuOptionWidget({data:b.data,label:void 0!==b.label?b.label:b.data})})),this},a.ui.FieldLayout=function(b,c){if(a.isPlainObject(b)&&void 0===c&&(c=b,b=c.fieldWidget),void 0===b)throw new Error("Widget not found");c=$.extend({align:"left"},c),a.ui.FieldLayout.parent.call(this,c),a.ui.mixin.LabelElement.call(this,$.extend({},c,{$label:$("<label>")})),a.ui.mixin.TitledElement.call(this,$.extend({},c,{$titled:this.$label})),this.fieldWidget=b,this.errors=[],this.notices=[],this.$field=$("<div>"),this.$messages=$("<ul>"),this.$header=$("<div>"),this.$body=$("<div>"),this.align=null,c.help?(this.popupButtonWidget=new a.ui.PopupButtonWidget({$overlay:c.$overlay,popup:{padded:!0},classes:["oo-ui-fieldLayout-help"],framed:!1,icon:"info"}),c.help instanceof a.ui.HtmlSnippet?this.popupButtonWidget.getPopup().$body.html(c.help.toString()):this.popupButtonWidget.getPopup().$body.text(c.help),this.$help=this.popupButtonWidget.$element):this.$help=$([]),this.fieldWidget.connect(this,{disable:"onFieldDisable"}),b.constructor.static.supportsSimpleLabel&&(this.fieldWidget.getInputId()?this.$label.attr("for",this.fieldWidget.getInputId()):this.$label.on("click",function(){return this.fieldWidget.focus(),!1}.bind(this))),this.$element.addClass("oo-ui-fieldLayout").toggleClass("oo-ui-fieldLayout-disabled",this.fieldWidget.isDisabled()).append(this.$body),this.$body.addClass("oo-ui-fieldLayout-body"),this.$header.addClass("oo-ui-fieldLayout-header"),this.$messages.addClass("oo-ui-fieldLayout-messages"),this.$field.addClass("oo-ui-fieldLayout-field").append(this.fieldWidget.$element),this.setErrors(c.errors||[]),this.setNotices(c.notices||[]),this.setAlignment(c.align)},a.inheritClass(a.ui.FieldLayout,a.ui.Layout),a.mixinClass(a.ui.FieldLayout,a.ui.mixin.LabelElement),a.mixinClass(a.ui.FieldLayout,a.ui.mixin.TitledElement),a.ui.FieldLayout.prototype.onFieldDisable=function(a){this.$element.toggleClass("oo-ui-fieldLayout-disabled",a)},a.ui.FieldLayout.prototype.getField=function(){return this.fieldWidget},a.ui.FieldLayout.prototype.makeMessage=function(b,c){var d,e,f;return d=$("<li>"),e="error"===b?new a.ui.IconWidget({icon:"alert",flags:["warning"]}).$element:"notice"===b?new a.ui.IconWidget({icon:"info"}).$element:"",f=new a.ui.LabelWidget({label:c}),d.append(e,f.$element).addClass("oo-ui-fieldLayout-messages-"+b),d},a.ui.FieldLayout.prototype.setAlignment=function(a){return a!==this.align&&(["left","right","top","inline"].indexOf(a)===-1&&(a="left"),"top"===a?(this.$header.append(this.$label,this.$help),this.$body.append(this.$header,this.$field)):"inline"===a?(this.$header.append(this.$label,this.$help),this.$body.append(this.$field,this.$header)):(this.$header.append(this.$label),this.$body.append(this.$header,this.$help,this.$field)),this.align&&this.$element.removeClass("oo-ui-fieldLayout-align-"+this.align),this.$element.addClass("oo-ui-fieldLayout-align-"+a),this.align=a),this},a.ui.FieldLayout.prototype.setErrors=function(a){return this.errors=a.slice(),this.updateMessages(),this},a.ui.FieldLayout.prototype.setNotices=function(a){return this.notices=a.slice(),this.updateMessages(),this},a.ui.FieldLayout.prototype.updateMessages=function(){var a;if(this.$messages.empty(),!this.errors.length&&!this.notices.length)return void this.$messages.remove();for(this.$body.after(this.$messages),a=0;a<this.notices.length;a++)this.$messages.append(this.makeMessage("notice",this.notices[a]));for(a=0;a<this.errors.length;a++)this.$messages.append(this.makeMessage("error",this.errors[a]))},a.ui.ActionFieldLayout=function(b,c,d){a.isPlainObject(b)&&void 0===d&&(d=b,b=d.fieldWidget,c=d.buttonWidget),a.ui.ActionFieldLayout.parent.call(this,b,d),this.buttonWidget=c,this.$button=$("<div>"),this.$input=$("<div>"),this.$element.addClass("oo-ui-actionFieldLayout"),this.$button.addClass("oo-ui-actionFieldLayout-button").append(this.buttonWidget.$element),this.$input.addClass("oo-ui-actionFieldLayout-input").append(this.fieldWidget.$element),this.$field.append(this.$input,this.$button)},a.inheritClass(a.ui.ActionFieldLayout,a.ui.FieldLayout),a.ui.FieldsetLayout=function(b){b=b||{},a.ui.FieldsetLayout.parent.call(this,b),a.ui.mixin.IconElement.call(this,b),a.ui.mixin.LabelElement.call(this,$.extend({},b,{$label:$("<div>")})),a.ui.mixin.GroupElement.call(this,b),this.$header=$("<div>"),b.help?(this.popupButtonWidget=new a.ui.PopupButtonWidget({$overlay:b.$overlay,popup:{padded:!0},classes:["oo-ui-fieldsetLayout-help"],framed:!1,icon:"info"}),b.help instanceof a.ui.HtmlSnippet?this.popupButtonWidget.getPopup().$body.html(b.help.toString()):this.popupButtonWidget.getPopup().$body.text(b.help),this.$help=this.popupButtonWidget.$element):this.$help=$([]),this.$header.addClass("oo-ui-fieldsetLayout-header").append(this.$icon,this.$label,this.$help),this.$group.addClass("oo-ui-fieldsetLayout-group"),this.$element.addClass("oo-ui-fieldsetLayout").prepend(this.$header,this.$group),Array.isArray(b.items)&&this.addItems(b.items)},a.inheritClass(a.ui.FieldsetLayout,a.ui.Layout),a.mixinClass(a.ui.FieldsetLayout,a.ui.mixin.IconElement),a.mixinClass(a.ui.FieldsetLayout,a.ui.mixin.LabelElement),a.mixinClass(a.ui.FieldsetLayout,a.ui.mixin.GroupElement),a.ui.FieldsetLayout.static.tagName="fieldset",a.ui.FormLayout=function(b){var c;b=b||{},a.ui.FormLayout.parent.call(this,b),a.ui.mixin.GroupElement.call(this,$.extend({},b,{$group:this.$element})),this.$element.on("submit",this.onFormSubmit.bind(this)),c=b.action,void 0===c||a.ui.isSafeUrl(c)||(c="./"+c),this.$element.addClass("oo-ui-formLayout").attr({method:b.method,action:c,enctype:b.enctype}),Array.isArray(b.items)&&this.addItems(b.items)},a.inheritClass(a.ui.FormLayout,a.ui.Layout),a.mixinClass(a.ui.FormLayout,a.ui.mixin.GroupElement),a.ui.FormLayout.static.tagName="form",a.ui.FormLayout.prototype.onFormSubmit=function(){if(this.emit("submit"))return!1},a.ui.PanelLayout=function(b){b=$.extend({scrollable:!1,padded:!1,expanded:!0,framed:!1},b),a.ui.PanelLayout.parent.call(this,b),this.$element.addClass("oo-ui-panelLayout"),b.scrollable&&this.$element.addClass("oo-ui-panelLayout-scrollable"),b.padded&&this.$element.addClass("oo-ui-panelLayout-padded"),b.expanded&&this.$element.addClass("oo-ui-panelLayout-expanded"),b.framed&&this.$element.addClass("oo-ui-panelLayout-framed")},a.inheritClass(a.ui.PanelLayout,a.ui.Layout),a.ui.PanelLayout.prototype.focus=function(){a.ui.findFocusable(this.$element).focus()},a.ui.HorizontalLayout=function(b){b=b||{},a.ui.HorizontalLayout.parent.call(this,b),a.ui.mixin.GroupElement.call(this,$.extend({},b,{$group:this.$element})),this.$element.addClass("oo-ui-horizontalLayout"),Array.isArray(b.items)&&this.addItems(b.items)},a.inheritClass(a.ui.HorizontalLayout,a.ui.Layout),a.mixinClass(a.ui.HorizontalLayout,a.ui.mixin.GroupElement)}(OO);
  //# sourceMappingURL=oojs-ui-core.min.js.map