"use strict";(self.rspackChunk_jupyter_notebook_lab_extension=self.rspackChunk_jupyter_notebook_lab_extension||[]).push([[590],{8509(e,o,t){t.r(o),t.d(o,{default:()=>m});var n,a,r=t(4064),l=t(277),i=t(1404),c=t(8705),b=t(9645),d=t(1660),s=t(9334),p=t(1823);(n=a||(a={})).launchNotebookTree="jupyter-notebook:launch-tree",n.openNotebook="jupyter-notebook:open-notebook",n.openLab="jupyter-notebook:open-lab",n.openNbClassic="jupyter-notebook:open-nbclassic";let u={id:"@jupyter-notebook/lab-extension:interface-switcher",description:"A plugin to add custom toolbar items to the notebook page.",autoStart:!0,requires:[b.ITranslator],optional:[c.INotebookTracker,l.ICommandPalette,s.INotebookPathOpener,s.INotebookShell,r.ILabShell,l.IToolbarWidgetRegistry],activate:(e,o,t,n,r,l,c,b)=>{let u;if(!t)return;let{commands:m,shell:h}=e,k=i.PageConfig.getBaseUrl(),_=o.load("notebook"),g="true"===i.PageConfig.getOption("nbclassic_enabled"),y=new d.Menu({commands:m}),N=[],f=null!=r?r:s.defaultNotebookPathOpener;l||N.push({command:a.openNotebook,commandLabel:_.__("Notebook"),commandDescription:_.__("Open in %1","Jupyter Notebook"),buttonLabel:"openNotebook",urlPrefix:`${k}tree`}),c||N.push({command:a.openLab,commandLabel:_.__("JupyterLab"),commandDescription:_.__("Open in %1","JupyterLab"),buttonLabel:"openLab",urlPrefix:`${k}doc/tree`}),g&&N.push({command:a.openNbClassic,commandLabel:_.__("NbClassic"),commandDescription:_.__("Open in %1","NbClassic"),buttonLabel:"openNbClassic",urlPrefix:`${k}nbclassic/notebooks`});let C=()=>null!==t.currentWidget&&t.currentWidget===h.currentWidget;if(N.forEach(e=>{let{command:o}=e;(e=>{let{command:o,commandLabel:a,commandDescription:r,urlPrefix:l}=e;m.addCommand(o,{label:e=>e.noLabel?"":e.isMenu||e.isPalette?r:a,caption:a,execute:()=>{let e=t.currentWidget;e&&f.open({prefix:l,path:e.context.path})},isEnabled:C,describedBy:{args:{type:"object",properties:{noLabel:{type:"boolean",description:"Whether to hide the command label."},isMenu:{type:"boolean",description:"Whether the command is rendered in a menu."},isPalette:{type:"boolean",description:"Whether the command is rendered in the command palette."}}}}}),n&&n.addItem({command:o,category:"Other",args:{isPalette:!0}})})(e),y.addItem({command:o})}),1===N.length)u=e=>{let o=new p.CommandToolbarButton({commands:m,id:N[0].command,label:N[0].commandLabel,icon:p.launchIcon});return o.addClass("jp-nb-interface-switcher-button"),o};else{let e={overflowMenuOptions:{isVisible:!1}},o=new d.MenuBar(e);y.title.label=_.__("Open in..."),y.title.icon=p.caretDownIcon,o.addMenu(y),u=o=>{let t=new d.MenuBar(e);return t.addMenu(y),t.addClass("jp-InterfaceSwitcher"),t}}b&&b.addFactory("Notebook","interfaceSwitcher",u)}},m=[{id:"@jupyter-notebook/lab-extension:launch-tree",description:"A plugin to add a command to open the Jupyter Notebook Tree.",autoStart:!0,requires:[b.ITranslator],optional:[l.ICommandPalette],activate:(e,o,t)=>{let{commands:n}=e,r=o.load("notebook"),l=r.__("Help");n.addCommand(a.launchNotebookTree,{label:r.__("Launch Jupyter Notebook File Browser"),execute:()=>{let e=i.URLExt.join(i.PageConfig.getBaseUrl(),"tree");window.open(e)},describedBy:{args:{type:"object",properties:{}}}}),t&&t.addItem({command:a.launchNotebookTree,category:l})}},u]}}]);