"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[5135,1682],{35135:(n,e,t)=>{t.r(e),t.d(e,{default:()=>c});var s=t(20301),a=t(67846),i=t(86072),o=t(75291),l=t(46605);var r,d=t(10824),h=t(6691);class u{constructor(n){this._tabsChanged=new h.Signal(this),this._widgets=[],this._labShell=n,this._labShell.layoutModified.connect(this._emitTabsChanged,this)}get tabsChanged(){return this._tabsChanged}addWidget(n){n.title.changed.connect(this._emitTabsChanged,this),this._widgets.push(n)}_emitTabsChanged(){this._widgets.forEach((n=>{n.title.changed.disconnect(this._emitTabsChanged,this)})),this._widgets=[],this._tabsChanged.emit(void 0)}}!function(n){n.showPanel="running:show-panel"}(r||(r={}));const c={activate:function(n,e,t,s){const i=e.load("jupyterlab"),h=new a.RunningSessionManagers,c=new a.RunningSessions(h,e);return c.id="jp-running-sessions",c.title.caption=i.__("Running Terminals and Kernels"),c.title.icon=o.runningIcon,c.node.setAttribute("role","region"),c.node.setAttribute("aria-label",i.__("Running Sessions section")),t&&t.add(c,"running-sessions"),s&&function(n,e,t){const s=new u(t),a=e.load("jupyterlab");n.add({name:a.__("Open Tabs"),running:()=>Array.from(t.widgets("main")).map((n=>(s.addWidget(n),new i(n)))),shutdownAll:()=>{for(const n of t.widgets("main"))n.close()},refreshRunning:()=>{},runningChanged:s.tabsChanged,shutdownLabel:a.__("Close"),shutdownAllLabel:a.__("Close All"),shutdownAllConfirmationText:a.__("Are you sure you want to close all open tabs?")});class i{constructor(n){this._widget=n}open(){t.activateById(this._widget.id)}shutdown(){this._widget.close()}icon(){const n=this._widget.title.icon;return n instanceof o.LabIcon?n:o.fileIcon}label(){return this._widget.title.label}labelTitle(){let n;return n=this._widget instanceof d.DocumentWidget?this._widget.context.path:this._widget.title.label,n}}}(h,e,s),function(n,e,t){const s=e.load("jupyterlab"),a=t.serviceManager.sessions,i=t.serviceManager.kernelspecs;function r(n){return!(-1===(n.name||l.PathExt.basename(n.path)).indexOf(".")&&!n.name)}class d{constructor(n){this._model=n}open(){const{path:n,type:e}=this._model;"console"===e.toLowerCase()?t.commands.execute("console:open",{path:n}):t.commands.execute("docmanager:open",{path:n})}shutdown(){return a.shutdown(this._model.id)}icon(){const{name:n,path:e,type:t}=this._model;return-1!==(n||l.PathExt.basename(e)).indexOf(".ipynb")?o.notebookIcon:"console"===t.toLowerCase()?o.consoleIcon:o.fileIcon}label(){return this._model.name||l.PathExt.basename(this._model.path)}labelTitle(){const{kernel:n,path:e}=this._model;let t=null==n?void 0:n.name;if(t&&i.specs){const n=i.specs.kernelspecs[t];t=n?n.display_name:"unknown"}return s.__("Path: %1\nKernel: %2",e,t)}}n.add({name:s.__("Kernels"),running:()=>Array.from(a.running()).filter(r).map((n=>new d(n))),shutdownAll:()=>a.shutdownAll(),refreshRunning:()=>a.refreshRunning(),runningChanged:a.runningChanged,shutdownLabel:s.__("Shut Down"),shutdownAllLabel:s.__("Shut Down All"),shutdownAllConfirmationText:s.__("Are you sure you want to permanently shut down all running kernels?")})}(h,e,n),n.shell.add(c,"left",{rank:200,type:"Sessions and Tabs"}),n.commands.addCommand(r.showPanel,{label:i.__("Sessions and Tabs"),execute:()=>{n.shell.activateById(c.id)}}),h},id:"@jupyterlab/running-extension:plugin",provides:a.IRunningSessionManagers,requires:[i.ITranslator],optional:[s.ILayoutRestorer,s.ILabShell],autoStart:!0}}}]);