define(["connectionManager","dom","layoutManager","shell","appRouter","apphost","globalize","css!./emby-button"],function(connectionManager,dom,layoutManager,shell,appRouter,appHost,globalize){"use strict";function openPremiumInfo(){require(["registrationServices"],function(registrationServices){registrationServices.showPremiereInfo()})}function showPremiereInfoToPremiereUser(){connectionManager.currentApiClient().getCurrentUser().then(function(user){user.Policy.IsAdministrator&&appRouter.getRouteInfo("/embypremiere")?appRouter.show("embypremiere"):openPremiumInfo()})}function onAnchorClick(e){var href=this.getAttribute("href")||"";"#"===href?(e.preventDefault(),"premiereinfo"===this.getAttribute("data-preset")&&require(["registrationServices"],function(registrationServices){registrationServices.validateFeature("themes",{viewOnly:!0,showDialog:!0}).then(showPremiereInfoToPremiereUser)})):this.getAttribute("target")?-1===href.indexOf("emby.media/premiere")||appHost.supports("externalpremium")?appHost.supports("targetblank")||(e.preventDefault(),shell.openUrl(href)):(e.preventDefault(),openPremiumInfo()):appRouter.handleAnchorClick(e)}function onInit(){this.hasInit||(this.hasInit=!0,this.classList.add("emby-button"),layoutManager.tv&&("false"!==this.getAttribute("data-focusscale")&&this.classList.add("emby-button-focusscale"),this.classList.add("emby-button-tv")))}var EmbyButton=function(_HTMLButtonElement){babelHelpers.inherits(EmbyButton,_HTMLButtonElement);var _super=_createSuper(EmbyButton);function EmbyButton(){var _this;babelHelpers.classCallCheck(this,EmbyButton);var self=_this=_super.call(this);return onInit.call(self),babelHelpers.possibleConstructorReturn(_this,self)}return babelHelpers.createClass(EmbyButton,[{key:"connectedCallback",value:function(){onInit.call(this)}},{key:"disconnectedCallback",value:function(){}}]),EmbyButton}(babelHelpers.wrapNativeSuper(HTMLButtonElement));customElements.define("emby-button",EmbyButton,{extends:"button"});var EmbyAnchor=function(_HTMLAnchorElement){babelHelpers.inherits(EmbyAnchor,_HTMLAnchorElement);var _super2=_createSuper2(EmbyAnchor);function EmbyAnchor(){var _this2;babelHelpers.classCallCheck(this,EmbyAnchor);var self=_this2=_super2.call(this);return onInit.call(self),babelHelpers.possibleConstructorReturn(_this2,self)}return babelHelpers.createClass(EmbyAnchor,[{key:"connectedCallback",value:function(){onInit.call(this),dom.removeEventListener(this,"click",onAnchorClick,{}),dom.addEventListener(this,"click",onAnchorClick,{}),"true"===this.getAttribute("data-autohide")&&(appHost.supports("externallinks")&&appHost.supports("externalappinfo")?this.classList.remove("hide"):this.classList.add("hide"))}},{key:"disconnectedCallback",value:function(){dom.removeEventListener(this,"click",onAnchorClick,{})}}]),EmbyAnchor}(babelHelpers.wrapNativeSuper(HTMLAnchorElement));customElements.define("emby-linkbutton",EmbyAnchor,{extends:"a"});var EmbySectionTitle=function(){babelHelpers.inherits(EmbySectionTitle,EmbyAnchor);var _super3=_createSuper3(EmbySectionTitle);function EmbySectionTitle(){var _this3;babelHelpers.classCallCheck(this,EmbySectionTitle);var self=_this3=_super3.call(this);return babelHelpers.possibleConstructorReturn(_this3,self)}return babelHelpers.createClass(EmbySectionTitle,[{key:"addSeeAllButton",value:function(){var targetAttribute,html,parent,sectionTitleContainer;this.seeAllButton||layoutManager.tv||(targetAttribute="_blank"===this.target?' target="_blank"':"",html='<a href="'+(this.href||"#")+'"'+targetAttribute+' is="emby-linkbutton" class="secondaryText sectionSeeAllButton noautofocus button-link">'+globalize.translate("HeaderSeeAll")+"</a>",(parent=this.parentNode).insertAdjacentHTML("beforeend",html),this.seeAllButton=parent.querySelector(".sectionSeeAllButton"),(sectionTitleContainer=this.closest(".sectionTitleContainer"))&&sectionTitleContainer.classList.add("sectionTitleContainer-withseeall"))}},{key:"connectedCallback",value:function(){EmbyAnchor.prototype.connectedCallback.call(this),this.addSeeAllButton()}},{key:"disconnectedCallback",value:function(){EmbyAnchor.prototype.disconnectedCallback.call(this)}},{key:"href",get:function(){return babelHelpers.get(babelHelpers.getPrototypeOf(EmbySectionTitle.prototype),"href",this)},set:function(value){babelHelpers.set(babelHelpers.getPrototypeOf(EmbySectionTitle.prototype),"href",value,this,!0);var seeAllButton=this.seeAllButton;seeAllButton&&(seeAllButton.href=value)}}]),EmbySectionTitle}();return customElements.define("emby-sectiontitle",EmbySectionTitle,{extends:"a"}),EmbyButton});