"use strict";(self.webpackChunk_swanclassic_lab_extension=self.webpackChunk_swanclassic_lab_extension||[]).push([[568],{568:(e,o,t)=>{t.r(o),t.d(o,{default:()=>u});var n,a=t(308),c=t(749),s=t(122),l=t(53),i=t(778),r=t(930),d=t(85);!function(e){e.launchNotebookTree="swanclassic:launch-tree",e.openNotebook="swanclassic:open-notebook"}(n||(n={}));const m={id:"@swanclassic/lab-extension:interface-switcher",description:"A plugin to add custom toolbar items to the notebook page.",autoStart:!0,requires:[l.ITranslator,s.INotebookTracker],optional:[a.ICommandPalette,r.INotebookPathOpener,a.IToolbarWidgetRegistry],activate:(e,o,t,a,s,l)=>{const{commands:m,shell:u}=e,b=c.PageConfig.getBaseUrl(),p=o.load("notebook"),h=new i.Menu({commands:m}),k=[],w=null!=s?s:r.defaultNotebookPathOpener;k.push({command:n.openNotebook,commandLabel:p.__("Classic UI"),commandDescription:p.__("Open in %1","Old UI"),buttonLabel:"openNotebook",urlPrefix:`${b}notebooks`});const g=()=>null!==t.currentWidget&&t.currentWidget===u.currentWidget;let f;if(k.forEach((e=>{const{command:o}=e;(e=>{const{command:o,commandLabel:n,commandDescription:c,urlPrefix:s}=e;m.addCommand(o,{label:e=>(e.noLabel,e.isMenu||e.isPalette?c:n),caption:n,execute:()=>{const e=t.currentWidget;e&&w.open({prefix:s,path:e.context.path})},isEnabled:g}),a&&a.addItem({command:o,category:"Other",args:{isPalette:!0}})})(e),h.addItem({command:o})})),1===k.length)f=e=>{const o=new d.CommandToolbarButton({commands:m,id:k[0].command,label:k[0].commandLabel,icon:d.launchIcon});return o.addClass("jp-nb-interface-switcher-button"),o};else{const e={overflowMenuOptions:{isVisible:!1}},o=new i.MenuBar(e);h.title.label=p.__("Open in..."),h.title.icon=d.caretDownIcon,o.addMenu(h),f=o=>{const t=new i.MenuBar(e);return t.addMenu(h),t.addClass("jp-InterfaceSwitcher"),t}}l&&l.addFactory("Notebook","interfaceSwitcher",f)}},u=[{id:"@swanclassic/lab-extension:launch-tree",description:"A plugin to add a command to open the Jupyter Notebook Tree.",autoStart:!0,requires:[l.ITranslator,a.ICommandPalette],optional:[],activate:(e,o,t)=>{const{commands:a}=e,s=o.load("notebook"),l=s.__("Help");a.addCommand(n.launchNotebookTree,{label:s.__("Launch the Classic SWAN UI"),execute:()=>{const e=c.URLExt.join(c.PageConfig.getBaseUrl(),"projects");window.open(e)}}),t.addItem({command:n.launchNotebookTree,category:l})}},m]}}]);