"use strict";(self.webpackChunk_jupyter_shared_docprovider_extension=self.webpackChunk_jupyter_shared_docprovider_extension||[]).push([[612],{612:(e,t,o)=>{o.r(t),o.d(t,{default:()=>w});var r=o(256),n=o(960),a=o(161),i=o(594),l=o(101),s=o(338),c=o(458),d=o(0),u=o(903),p=o(937);const h={id:"@jupyter/docprovider-extension:drive",description:"The default collaborative drive provider",provides:u.ICollaborativeDrive,requires:[l.IDefaultFileBrowser],optional:[c.ITranslator],activate:(e,t,o)=>{const r=(o=o??c.nullTranslator).load("jupyter-shared-drive");return new p.SharedDrive(e,t,r,null,"Shared")}},v={id:"@jupyter/shared-docprovider-extension:yfile",description:"Plugin to register the shared model factory for the content type 'file'",autoStart:!0,requires:[u.ICollaborativeDrive],optional:[],activate:(e,t)=>{t.sharedModelFactory.registerDocumentFactory("file",(()=>new d.YFile))}},b={id:"@jupyter/shared-docprovider-extension:ynotebook",description:"Plugin to register the shared model factory for the content type 'notebook'",autoStart:!0,requires:[u.ICollaborativeDrive],optional:[s.ISettingRegistry],activate:(e,t,o)=>{let r=!0;o&&o.load("@jupyterlab/notebook-extension:tracker").then((e=>{const t=e=>{const t=e?.get("experimentalEnableDocumentWideUndoRedo").composite;r=!t??!0};t(e),e.changed.connect((e=>t(e)))})),t.sharedModelFactory.registerDocumentFactory("notebook",(()=>new d.YNotebook({disableDocumentWideUndoRedo:r})))}},y={id:"jupyter-shared-drive:sharedFileBrowser",description:"The shared file browser factory provider",autoStart:!0,requires:[u.ICollaborativeDrive,l.IFileBrowserFactory],optional:[a.IRouter,a.JupyterFrontEnd.ITreeResolver,a.ILabShell,c.ITranslator],activate:async(e,t,o,r,a,l,s)=>{const{createFileBrowser:d}=o,u=(s=s??c.nullTranslator).load("jupyter-shared-drive");e.serviceManager.contents.addDrive(t);const p=d("jp-shared-contents-browser",{driveName:t.name,restore:!1});p.title.caption=u.__("Shared Drive"),p.title.icon=n.listIcon;const h=new i.ToolbarButton({icon:n.downloadIcon,onClick:async()=>{const e=i.Dialog.okButton({label:u.__("Import"),accept:!0}),o=p.model.path.slice(t.name.length+1),r=await(0,i.showDialog)({title:u.__("Import file: enter source and destination paths"),body:new f("",o),buttons:[i.Dialog.cancelButton(),e]}).then((e=>{if(e.button.accept)return e.value??void 0}));if(r)try{await t.importFile(r[0],r[1])}catch(e){await(0,i.showErrorMessage)(u.__("File Import Error for %1",r),e)}},tooltip:"Import File"}),v=new i.ToolbarButton({icon:n.fileUploadIcon,onClick:async()=>{const o=i.Dialog.okButton({label:u.__("Export"),accept:!0}),r=e.shell.currentWidget.context.contentsModel.name,n=await(0,i.showDialog)({title:u.__("Export file: enter destination path"),body:new f(r),buttons:[i.Dialog.cancelButton(),o]}).then((e=>{if(e.button.accept)return e.value??void 0}));if(n)try{await t.exportFile(n[0])}catch(e){await(0,i.showErrorMessage)(u.__("File Export Error for %1",n),e)}},tooltip:"Export File"}),b=new i.ToolbarButton({icon:n.refreshIcon,onClick:async()=>{p.model.refresh()},tooltip:"Refresh File Browser"});p.toolbar.insertItem(0,"refresh",b),p.toolbar.insertItem(1,"import",h),p.toolbar.insertItem(2,"export",v),e.shell.add(p,"left")}};class f extends r.Widget{constructor(e,t){super({node:m(e,t)})}getValue(){const e=this.node.children,t=[e[0].value];return e.length>1&&t.push(e[1].value),t}}function m(e,t){const o=document.createElement("div"),r=document.createElement("input");if(o.appendChild(r),r.value=e,void 0!==t){const e=document.createElement("input");e.value=t,o.appendChild(e)}return o}const w=[h,v,b,y]}}]);