define(["exports","./dialogs/confirm.js","./globalize.js"],function(_exports,_confirm,_globalize){function formatTextWithDisruptions(text,disruptions){return text=disruptions.length?(text=(text+="\n\n")+_globalize.default.translate("FollowingActivityWillBeDisrupted")+"\n\n")+disruptions.map(function(i){return"- "+i}).join("\n"):text}function formatHtmlWithDisruptions(text,disruptions){return disruptions.length?(text=(text+="<p>")+_globalize.default.translate("FollowingActivityWillBeDisrupted")+"</p><ul>")+disruptions.map(function(i){return"<li>"+i+"</li>"}).join("")+"</ul>":null}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;_exports.default={confirmRestartOrShutdown:function(options){return function(options){return options=[(options=options.apiClient).getSessions({IsPlaying:!0}),options.getLiveTvRecordings({IsInProgress:!0})],Promise.all(options).then(function(responses){var sessions=responses[0],responses=responses[1].Items,list=[];return 1===sessions.length?list.push(_globalize.default.translate("OneActivePlaybackSession")):sessions.length&&list.push(_globalize.default.translate("NumActivePlaybackSessions",sessions.length)),1===responses.length?list.push(_globalize.default.translate("OneActiveRecording")):responses.length&&list.push(_globalize.default.translate("NumActiveRecordings",responses.length)),list})}(options).then(function(disruptions){return("shutdown"===options.type?function(disruptions){return(0,_confirm.default)({title:_globalize.default.translate("Shutdown"),text:formatTextWithDisruptions(_globalize.default.translate("MessageConfirmShutdown"),disruptions),html:formatHtmlWithDisruptions(_globalize.default.translate("MessageConfirmShutdown"),disruptions),confirmText:_globalize.default.translate("Shutdown"),primary:"cancel",centerText:0===disruptions.length})}:function(disruptions){return(0,_confirm.default)({title:_globalize.default.translate("Restart"),text:formatTextWithDisruptions(_globalize.default.translate("MessageConfirmRestart"),disruptions),html:formatHtmlWithDisruptions(_globalize.default.translate("MessageConfirmRestart"),disruptions),confirmText:_globalize.default.translate("Restart"),primary:"cancel",centerText:0===disruptions.length})})(disruptions)})}}});