"),this.initialized=!1,this.narrowThreshold=null,this.onWindowResizeHandler=this.onWindowResize.bind(this),this.$overlay=(!0===i.$overlay?h.ui.getDefaultOverlay():i.$overlay)||this.$element,this.$element.add(this.$bar).add(this.$group).add(this.$actions).on("mousedown keydown",this.onPointerDown.bind(this)),this.$group.addClass("oo-ui-toolbar-tools"),i.actions&&this.$bar.append(this.$actions.addClass("oo-ui-toolbar-actions")),this.$popups.addClass("oo-ui-toolbar-popups"),this.$bar.addClass("oo-ui-toolbar-bar").append(this.$group,'
'),this.$element.addClass("oo-ui-toolbar oo-ui-toolbar-position-"+this.position).append(this.$bar),this.$overlay.append(this.$popups)},h.inheritClass(h.ui.Toolbar,h.ui.Element),h.mixinClass(h.ui.Toolbar,h.EventEmitter),h.mixinClass(h.ui.Toolbar,h.ui.mixin.GroupElement),h.ui.Toolbar.prototype.getToolFactory=function(){return this.toolFactory},h.ui.Toolbar.prototype.getToolGroupFactory=function(){return this.toolGroupFactory},h.ui.Toolbar.prototype.onPointerDown=function(o){var t=$(o.target).closest(".oo-ui-widget"),i=this.$element.closest(".oo-ui-widget");if(!t.length||t[0]===i[0])return!1},h.ui.Toolbar.prototype.onWindowResize=function(){this.$element.add(this.$popups).toggleClass("oo-ui-toolbar-narrow",this.$bar[0].clientWidth<=this.getNarrowThreshold())},h.ui.Toolbar.prototype.getNarrowThreshold=function(){return null===this.narrowThreshold&&(this.narrowThreshold=this.$group[0].offsetWidth+this.$actions[0].offsetWidth),this.narrowThreshold},h.ui.Toolbar.prototype.initialize=function(){this.initialized||(this.initialized=!0,$(this.getElementWindow()).on("resize",this.onWindowResizeHandler),this.onWindowResize())},h.ui.Toolbar.prototype.setup=function(o){var t,i,e,s,l,u=[];for(this.reset(),t=0,i=o.length;t
"),this.$accel=$(""),this.$link=$(""),this.title=null,this.checkIcon=new h.ui.IconWidget({icon:"check",classes:["oo-ui-tool-checkIcon"]}),h.ui.mixin.IconElement.call(this,t),h.ui.mixin.FlaggedElement.call(this,t),h.ui.mixin.TabIndexedElement.call(this,$.extend({},t,{$tabIndexed:this.$link})),this.toolbar.connect(this,{updateState:"onUpdateState"}),this.$title.addClass("oo-ui-tool-title"),this.$accel.addClass("oo-ui-tool-accel").prop({dir:"ltr",lang:"en"}),this.$link.addClass("oo-ui-tool-link").append(this.checkIcon.$element,this.$icon,this.$title,this.$accel).attr("role","button"),this.$element.data("oo-ui-tool",this).addClass("oo-ui-tool").addClass("oo-ui-tool-name-"+this.constructor.static.name.replace(/^([^/]+)\/([^/]+).*$/,"$1-$2")).toggleClass("oo-ui-tool-with-label",this.constructor.static.displayBothIconAndLabel).append(this.$link),this.setTitle(t.title||this.constructor.static.title)},h.inheritClass(h.ui.Tool,h.ui.Widget),h.mixinClass(h.ui.Tool,h.ui.mixin.IconElement),h.mixinClass(h.ui.Tool,h.ui.mixin.FlaggedElement),h.mixinClass(h.ui.Tool,h.ui.mixin.TabIndexedElement),h.ui.Tool.static.tagName="span",h.ui.Tool.static.name="",h.ui.Tool.static.group="",h.ui.Tool.static.title="",h.ui.Tool.static.displayBothIconAndLabel=!1,h.ui.Tool.static.autoAddToCatchall=!0,h.ui.Tool.static.autoAddToGroup=!0,h.ui.Tool.static.isCompatibleWith=function(){return!1},h.ui.Tool.prototype.onUpdateState=null,h.ui.Tool.prototype.onSelect=null,h.ui.Tool.prototype.isActive=function(){return this.active},h.ui.Tool.prototype.setActive=function(o){this.active=!!o,this.$element.toggleClass("oo-ui-tool-active",this.active),this.updateThemeClasses()},h.ui.Tool.prototype.setTitle=function(o){return this.title=h.ui.resolveMsg(o),this.updateTitle(),this},h.ui.Tool.prototype.getTitle=function(){return this.title},h.ui.Tool.prototype.getName=function(){return this.constructor.static.name},h.ui.Tool.prototype.updateTitle=function(){var o=this.toolGroup.constructor.static.titleTooltips,t=this.toolGroup.constructor.static.accelTooltips,i=this.toolbar.getToolAccelerator(this.constructor.static.name),e=[];this.$title.text(this.title),this.$accel.text(i),o&&"string"==typeof this.title&&this.title.length&&e.push(this.title),t&&"string"==typeof i&&i.length&&e.push(i),e.length?this.$link.attr("title",e.join(" ")):this.$link.removeAttr("title")},h.ui.Tool.prototype.destroy=function(){this.toolbar.disconnect(this),this.$element.remove()},h.ui.ToolGroup=function(o,t){h.isPlainObject(o)&&void 0===t&&(o=(t=o).toolbar),t=t||{},h.ui.ToolGroup.parent.call(this,t),h.ui.mixin.GroupElement.call(this,t),this.toolbar=o,this.tools={},this.pressed=null,this.autoDisabled=!1,this.include=t.include||[],this.exclude=t.exclude||[],this.promote=t.promote||[],this.demote=t.demote||[],this.onDocumentMouseKeyUpHandler=this.onDocumentMouseKeyUp.bind(this),this.$group.on({mousedown:this.onMouseKeyDown.bind(this),mouseup:this.onMouseKeyUp.bind(this),keydown:this.onMouseKeyDown.bind(this),keyup:this.onMouseKeyUp.bind(this),focus:this.onMouseOverFocus.bind(this),blur:this.onMouseOutBlur.bind(this),mouseover:this.onMouseOverFocus.bind(this),mouseout:this.onMouseOutBlur.bind(this)}),this.toolbar.getToolFactory().connect(this,{register:"onToolFactoryRegister"}),this.aggregate({disable:"itemDisable"}),this.connect(this,{itemDisable:"updateDisabled",disable:"onDisable"}),this.$group.addClass("oo-ui-toolGroup-tools"),this.$element.addClass("oo-ui-toolGroup").append(this.$group),this.onDisable(this.isDisabled()),this.populate()},h.inheritClass(h.ui.ToolGroup,h.ui.Widget),h.mixinClass(h.ui.ToolGroup,h.ui.mixin.GroupElement),h.ui.ToolGroup.static.titleTooltips=!1,h.ui.ToolGroup.static.accelTooltips=!1,h.ui.ToolGroup.static.autoDisable=!0,h.ui.ToolGroup.static.name=null,h.ui.ToolGroup.prototype.isDisabled=function(){return this.autoDisabled||h.ui.ToolGroup.parent.prototype.isDisabled.apply(this,arguments)},h.ui.ToolGroup.prototype.updateDisabled=function(){var o,t=!0;if(this.constructor.static.autoDisable){for(o=this.items.length-1;0<=o;o--)if(!this.items[o].isDisabled()){t=!1;break}this.autoDisabled=t}h.ui.ToolGroup.parent.prototype.updateDisabled.apply(this,arguments)},h.ui.ToolGroup.prototype.onDisable=function(o){this.$group.toggleClass("oo-ui-toolGroup-disabled-tools",o),this.$group.toggleClass("oo-ui-toolGroup-enabled-tools",!o)},h.ui.ToolGroup.prototype.onMouseKeyDown=function(o){if(!this.isDisabled()&&(o.which===h.ui.MouseButtons.LEFT||o.which===h.ui.Keys.SPACE||o.which===h.ui.Keys.ENTER)&&(this.pressed=this.findTargetTool(o),this.pressed))return this.pressed.setActive(!0),this.getElementDocument().addEventListener("mouseup",this.onDocumentMouseKeyUpHandler,!0),this.getElementDocument().addEventListener("keyup",this.onDocumentMouseKeyUpHandler,!0),!1},h.ui.ToolGroup.prototype.onDocumentMouseKeyUp=function(o){this.getElementDocument().removeEventListener("mouseup",this.onDocumentMouseKeyUpHandler,!0),this.getElementDocument().removeEventListener("keyup",this.onDocumentMouseKeyUpHandler,!0),this.onMouseKeyUp(o)},h.ui.ToolGroup.prototype.onCapturedMouseKeyUp=function(){h.ui.warnDeprecation("onCapturedMouseKeyUp is deprecated, use onDocumentMouseKeyUp instead"),this.onDocumentMouseKeyUp.apply(this,arguments)},h.ui.ToolGroup.prototype.onMouseKeyUp=function(o){var t=this.findTargetTool(o);this.isDisabled()||!this.pressed||this.pressed!==t||o.which!==h.ui.MouseButtons.LEFT&&o.which!==h.ui.Keys.SPACE&&o.which!==h.ui.Keys.ENTER||(this.pressed.onSelect(),this.pressed=null,o.preventDefault(),o.stopPropagation()),this.pressed=null},h.ui.ToolGroup.prototype.onMouseOverFocus=function(o){var t=this.findTargetTool(o);this.pressed&&this.pressed===t&&this.pressed.setActive(!0)},h.ui.ToolGroup.prototype.onMouseOutBlur=function(o){var t=this.findTargetTool(o);this.pressed&&this.pressed===t&&this.pressed.setActive(!1)},h.ui.ToolGroup.prototype.findTargetTool=function(o){var t,i=$(o.target).closest(".oo-ui-tool-link");return i.length&&(t=i.parent().data("oo-ui-tool")),t&&!t.isDisabled()?t:null},h.ui.ToolGroup.prototype.onToolFactoryRegister=function(){this.populate()},h.ui.ToolGroup.prototype.getToolbar=function(){return this.toolbar},h.ui.ToolGroup.prototype.populate=function(){var o,t,i,e,s=this.toolbar.getToolFactory(),l={},u=[],n=[],p=this.toolbar.getToolFactory().getTools(this.include,this.exclude,this.promote,this.demote);for(o=0,t=p.length;o"),h.ui.mixin.IconElement.call(this,t),h.ui.mixin.IndicatorElement.call(this,t),h.ui.mixin.LabelElement.call(this,t),h.ui.mixin.TitledElement.call(this,t),h.ui.mixin.FlaggedElement.call(this,t),h.ui.mixin.ClippableElement.call(this,$.extend({},t,{$clippable:this.$group})),h.ui.mixin.FloatableElement.call(this,$.extend({},t,{$floatable:this.$group,$floatableContainer:this.$handle,hideWhenOutOfView:!1,verticalPosition:"bottom"===this.toolbar.position?"above":"below"})),h.ui.mixin.TabIndexedElement.call(this,$.extend({},t,{$tabIndexed:this.$handle})),this.$handle.on({keydown:this.onHandleMouseKeyDown.bind(this),keyup:this.onHandleMouseKeyUp.bind(this),mousedown:this.onHandleMouseKeyDown.bind(this),mouseup:this.onHandleMouseKeyUp.bind(this)}),this.$handle.addClass("oo-ui-popupToolGroup-handle").attr("role","button").append(this.$icon,this.$label,this.$indicator),void 0!==t.header&&this.$group.prepend($("").addClass("oo-ui-popupToolGroup-header").text(t.header)),this.$element.addClass("oo-ui-popupToolGroup").prepend(this.$handle),this.$group.addClass("oo-ui-popupToolGroup-tools"),this.toolbar.$popups.append(this.$group)},h.inheritClass(h.ui.PopupToolGroup,h.ui.ToolGroup),h.mixinClass(h.ui.PopupToolGroup,h.ui.mixin.IconElement),h.mixinClass(h.ui.PopupToolGroup,h.ui.mixin.IndicatorElement),h.mixinClass(h.ui.PopupToolGroup,h.ui.mixin.LabelElement),h.mixinClass(h.ui.PopupToolGroup,h.ui.mixin.TitledElement),h.mixinClass(h.ui.PopupToolGroup,h.ui.mixin.FlaggedElement),h.mixinClass(h.ui.PopupToolGroup,h.ui.mixin.ClippableElement),h.mixinClass(h.ui.PopupToolGroup,h.ui.mixin.FloatableElement),h.mixinClass(h.ui.PopupToolGroup,h.ui.mixin.TabIndexedElement),h.ui.PopupToolGroup.prototype.setDisabled=function(){h.ui.PopupToolGroup.parent.prototype.setDisabled.apply(this,arguments),this.isDisabled()&&this.isElementAttached()&&this.setActive(!1)},h.ui.PopupToolGroup.prototype.onPopupDocumentMouseKeyUp=function(o){var t=$(o.target);t.closest(".oo-ui-popupToolGroup")[0]!==this.$element[0]&&t.closest(".oo-ui-popupToolGroup-tools")[0]!==this.$group[0]&&this.setActive(!1)},h.ui.PopupToolGroup.prototype.onBlur=function(){h.ui.warnDeprecation("onBlur is deprecated, use onPopupDocumentMouseKeyUp instead"),this.onPopupDocumentMouseKeyUp.apply(this,arguments)},h.ui.PopupToolGroup.prototype.onMouseKeyUp=function(o){return this.isDisabled()||!this.pressed||this.pressed!==this.findTargetTool(o)||o.which!==h.ui.MouseButtons.LEFT&&o.which!==h.ui.Keys.SPACE&&o.which!==h.ui.Keys.ENTER||this.setActive(!1),h.ui.PopupToolGroup.parent.prototype.onMouseKeyUp.call(this,o)},h.ui.PopupToolGroup.prototype.onMouseKeyDown=function(o){var t,i,e;if(!this.isDisabled()&&o.which===h.ui.Keys.TAB){if(t=$(document.activeElement),i=h.ui.findFocusable(this.$group),t[0]===i[0]&&o.shiftKey)return this.$handle.trigger("focus"),!1;e=h.ui.findFocusable(this.$group,!0),t[0]!==e[0]||o.shiftKey||(this.$handle.trigger("focus"),this.setActive(!1))}return h.ui.PopupToolGroup.parent.prototype.onMouseKeyDown.call(this,o)},h.ui.PopupToolGroup.prototype.onHandleMouseKeyUp=function(o){if(!this.isDisabled()&&(o.which===h.ui.MouseButtons.LEFT||o.which===h.ui.Keys.SPACE||o.which===h.ui.Keys.ENTER))return!1},h.ui.PopupToolGroup.prototype.onHandleMouseKeyDown=function(o){var t;if(!this.isDisabled()){if(o.which===h.ui.Keys.TAB&&!o.shiftKey&&(t=h.ui.findFocusable(this.$group)).length)return t.trigger("focus"),!1;if(o.which===h.ui.MouseButtons.LEFT||o.which===h.ui.Keys.SPACE||o.which===h.ui.Keys.ENTER)return this.setActive(!this.active),!1}},h.ui.PopupToolGroup.prototype.isActive=function(){return this.active},h.ui.PopupToolGroup.prototype.setActive=function(o){var t,i;o=!!o,this.active!==o&&((this.active=o)?(this.getElementDocument().addEventListener("mouseup",this.onPopupDocumentMouseKeyUpHandler,!0),this.getElementDocument().addEventListener("keyup",this.onPopupDocumentMouseKeyUpHandler,!0),this.$clippable.css("left",""),this.$element.addClass("oo-ui-popupToolGroup-active"),this.$group.addClass("oo-ui-popupToolGroup-active-tools"),this.togglePositioning(!0),this.toggleClipping(!0),this.setHorizontalPosition("start"),(this.isClippedHorizontally()||this.isFloatableOutOfView())&&this.setHorizontalPosition("end"),(this.isClippedHorizontally()||this.isFloatableOutOfView())&&(t=this.$clippableScrollableContainer.width(),i=this.$clippableScrollableContainer[0]===document.documentElement?0:this.$clippableScrollableContainer.offset().left,this.toggleClipping(!1),this.setHorizontalPosition("start"),this.$clippable.css({"margin-left":-(this.$element.offset().left-i),width:t}))):(this.getElementDocument().removeEventListener("mouseup",this.onPopupDocumentMouseKeyUpHandler,!0),this.getElementDocument().removeEventListener("keyup",this.onPopupDocumentMouseKeyUpHandler,!0),this.$element.removeClass("oo-ui-popupToolGroup-active"),this.$group.removeClass("oo-ui-popupToolGroup-active-tools"),this.togglePositioning(!1),this.toggleClipping(!1)),this.emit("active",this.active),this.updateThemeClasses())},h.ui.ListToolGroup=function(o,t){h.isPlainObject(o)&&void 0===t&&(o=(t=o).toolbar),t=t||{},this.allowCollapse=t.allowCollapse,this.forceExpand=t.forceExpand,this.expanded=void 0!==t.expanded&&t.expanded,this.collapsibleTools=[],h.ui.ListToolGroup.parent.call(this,o,t),this.$element.addClass("oo-ui-listToolGroup"),this.$group.addClass("oo-ui-listToolGroup-tools")},h.inheritClass(h.ui.ListToolGroup,h.ui.PopupToolGroup),h.ui.ListToolGroup.static.name="list",h.ui.ListToolGroup.prototype.populate=function(){var o,t,i=[];for(h.ui.ListToolGroup.parent.prototype.populate.call(this),void 0!==this.allowCollapse?i=this.allowCollapse:void 0!==this.forceExpand&&(i=h.simpleArrayDifference(Object.keys(this.tools),this.forceExpand)),this.collapsibleTools=[],o=0,t=i.length;o