"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[6893,7684],{56893:(t,e,o)=>{o.r(e),o.d(e,{CommandIDs:()=>n,default:()=>s});var n,a=o(89965),r=o(23450),u=o(10806),l=o(98836);!function(t){t.controlPanel="hub:control-panel",t.logout="hub:logout",t.restart="hub:restart"}(n||(n={}));const s=[{activate:function(t,e,o,a){const r=o.load("jupyterlab"),l=e.urls.hubHost||"",s=e.urls.hubPrefix||"",i=e.urls.hubUser||"",c=e.urls.hubServerName||"",b=e.urls.base;if(!s)return;console.debug("hub-extension: Found configuration ",{hubHost:l,hubPrefix:s});const d=c?l+u.URLExt.join(s,"spawn",i,c):l+u.URLExt.join(s,"spawn"),{commands:_}=t;if(_.addCommand(n.restart,{label:r.__("Restart Server"),caption:r.__("Request that the Hub restart this server"),execute:()=>{window.open(d,"_blank")}}),_.addCommand(n.controlPanel,{label:r.__("Hub Control Panel"),caption:r.__("Open the Hub control panel in a new browser tab"),execute:()=>{window.open(l+u.URLExt.join(s,"home"),"_blank")}}),_.addCommand(n.logout,{label:r.__("Log Out"),caption:r.__("Log out of the Hub"),execute:()=>{window.location.href=l+u.URLExt.join(b,"logout")}}),a){const t=r.__("Hub");a.addItem({category:t,command:n.controlPanel}),a.addItem({category:t,command:n.logout})}},id:"@jupyterlab/hub-extension:plugin",requires:[a.JupyterFrontEnd.IPaths,l.ITranslator],optional:[r.ICommandPalette],autoStart:!0},{activate:()=>{},id:"@jupyterlab/hub-extension:menu",autoStart:!0},{id:"@jupyterlab/apputils-extension:connectionlost",requires:[a.JupyterFrontEnd.IPaths,l.ITranslator],optional:[a.JupyterLab.IInfo],activate:(t,e,o,u)=>{const l=o.load("jupyterlab"),s=e.urls.hubPrefix||"",i=e.urls.base;if(!s)return a.ConnectionLost;let c=!1;return async(e,o)=>{if(c)return;c=!0,u&&(u.isConnected=!1);const a=await(0,r.showDialog)({title:l.__("Server unavailable or unreachable"),body:l.__("Your server at %1 is not running.\nWould you like to restart it?",i),buttons:[r.Dialog.okButton({label:l.__("Restart")}),r.Dialog.cancelButton({label:l.__("Dismiss")})]});u&&(u.isConnected=!0),c=!1,a.button.accept&&await t.commands.execute(n.restart)}},autoStart:!0,provides:a.IConnectionLost}]}}]);