define(["loading","dom","formHelper","emby-input","emby-button"],function(loading,dom,formHelper){"use strict";return function(view,params){view.querySelector("form").addEventListener("submit",function(e){return function(page){var id=params.id;ApiClient.ajax({url:ApiClient.getUrl("Devices/Options",{Id:id}),type:"POST",data:JSON.stringify({CustomName:page.querySelector("#txtCustomName").value}),contentType:"application/json"}).then(formHelper.handleConfigurationSavedResponse)}(this.closest(".page")),e.preventDefault(),!1}),view.addEventListener("viewshow",function(){var page=this;loading.show();var id=params.id,promise1=ApiClient.getJSON(ApiClient.getUrl("Devices/Info",{Id:id})),promise2=ApiClient.getJSON(ApiClient.getUrl("Devices/Options",{Id:id}));Promise.all([promise1,promise2]).then(function(responses){!function(page,device,deviceOptions){page.querySelector("#txtCustomName",page).value=deviceOptions.CustomName||"",page.querySelector(".reportedName",page).textContent=device.Name||""}(page,responses[0],responses[1]),loading.hide()})})}});