define ("core/popover_region_controller",["jquery","core/str","core/custom_interaction_events"],function(a,b,c){var d={CONTENT:".popover-region-content",CONTENT_CONTAINER:".popover-region-content-container",MENU_CONTAINER:".popover-region-container",MENU_TOGGLE:".popover-region-toggle",CAN_RECEIVE_FOCUS:"input:not([type=\"hidden\"]), a[href], button, textarea, select, [tabindex]"},e=function(b){this.root=a(b);this.content=this.root.find(d.CONTENT);this.contentContainer=this.root.find(d.CONTENT_CONTAINER);this.menuContainer=this.root.find(d.MENU_CONTAINER);this.menuToggle=this.root.find(d.MENU_TOGGLE);this.isLoading=!1;this.promises={closeHandlers:a.Deferred(),navigationHandlers:a.Deferred()};this.registerBaseEventListeners()};e.prototype.events=function(){return{menuOpened:"popoverregion:menuopened",menuClosed:"popoverregion:menuclosed",startLoading:"popoverregion:startLoading",stopLoading:"popoverregion:stopLoading"}};e.prototype.getContentContainer=function(){return this.contentContainer};e.prototype.getContent=function(){return this.content};e.prototype.isMenuOpen=function(){return!this.root.hasClass("collapsed")};e.prototype.toggleMenu=function(){if(this.isMenuOpen()){this.closeMenu()}else{this.openMenu()}};e.prototype.closeMenu=function(){if(!this.isMenuOpen()){return}this.root.addClass("collapsed");this.menuContainer.attr("aria-expanded","false");this.menuContainer.attr("aria-hidden","true");this.updateButtonAriaLabel();this.root.trigger(this.events().menuClosed)};e.prototype.openMenu=function(){if(this.isMenuOpen()){return}this.root.removeClass("collapsed");this.menuContainer.attr("aria-expanded","true");this.menuContainer.attr("aria-hidden","false");this.updateButtonAriaLabel();this.promises.closeHandlers.resolve();this.promises.navigationHandlers.resolve();this.root.trigger(this.events().menuOpened)};e.prototype.updateButtonAriaLabel=function(){if(this.isMenuOpen()){b.get_string("hidepopoverwindow").done(function(a){this.menuToggle.attr("aria-label",a)}.bind(this))}else{b.get_string("showpopoverwindow").done(function(a){this.menuToggle.attr("aria-label",a)}.bind(this))}};e.prototype.startLoading=function(){this.isLoading=!0;this.getContentContainer().addClass("loading");this.getContentContainer().attr("aria-busy","true");this.root.trigger(this.events().startLoading)};e.prototype.stopLoading=function(){this.isLoading=!1;this.getContentContainer().removeClass("loading");this.getContentContainer().attr("aria-busy","false");this.root.trigger(this.events().stopLoading)};e.prototype.focusMenuToggle=function(){this.menuToggle.focus()};e.prototype.contentItemHasFocus=function(){return 0