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