define(["appHeader","subtitleSettings","globalize","userSettingsBuilder","connectionManager","userSettings","emby-scroller"],function(appHeader,SubtitleSettings,globalize,userSettingsBuilder,connectionManager,currentUserSettings){"use strict";return function(view,params){var subtitleSettingsInstance,apiClient=connectionManager.getApiClient(params.serverId),userId=params.userId||apiClient.getCurrentUserId(),userSettings=userId===apiClient.getCurrentUserId()?currentUserSettings:new userSettingsBuilder;view.addEventListener("viewshow",function(){subtitleSettingsInstance?subtitleSettingsInstance.loadData():subtitleSettingsInstance=new SubtitleSettings({serverId:apiClient.serverId(),userId:userId,element:view.querySelector(".settingsContainer"),userSettings:userSettings,enableSaveButton:!1,enableSaveConfirmation:!1,autoFocus:!0})}),view.addEventListener("viewbeforehide",function(){subtitleSettingsInstance&&subtitleSettingsInstance.submit()}),view.addEventListener("viewdestroy",function(){subtitleSettingsInstance&&(subtitleSettingsInstance.destroy(),subtitleSettingsInstance=null)})}});