import globalize from"./../globalize.js";import connectionManager from"./../../emby-apiclient/connectionmanager.js";function showAlert(options){return Emby.importModule("./modules/common/dialogs/alert.js").then(function(alert){return alert(options)})}function showErrorMessage(){return showAlert(globalize.translate("MessagePlayAccessRestricted")).then(function(){return Promise.reject()})}function PlayAccessValidation(){this.name="Playback validation",this.type="preplayintercept",this.id="playaccessvalidation",this.order=-2}PlayAccessValidation.prototype.intercept=function(options){var item=options.item;return(item=item&&item.ServerId)?connectionManager.getApiClient(item).getCurrentUser().then(function(user){return user.Policy.EnableMediaPlayback?Promise.resolve():options.fullscreen?showErrorMessage():Promise.reject()}):Promise.resolve()};export default PlayAccessValidation;