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