mbuali's picture
Upload folder using huggingface_hub
d1ceb73 verified
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[545],{60545:(e,n,t)=>{t.r(n),t.d(n,{CommandIDs:()=>w,default:()=>f});var a,o=t(44604),l=t(53312),r=t(68722),s=t(29879),d=t(87408),i=t(23295),c=t(12030),u=t(35613),m=t(33625),p=t(20998),h=t(63485),_=t(5094),g=t(71427);!function(e){e.openRecent="recentmenu:open-recent",e.reopenLast="recentmenu:reopen-last",e.clearRecents="docmanager:clear-recents"}(a||(a={}));class b extends h.Menu{constructor(e){super(e),this._manager=e.manager,this._showDirectories=e.showDirectories,this.updateItems(),this._manager.changed.connect(this.updateItems,this)}async _validateRecentlyOpened(){Promise.all(this._manager.recentlyOpened.map((e=>this._manager.validate(e))))}onBeforeAttach(e){const n=new p.PromiseDelegate;setTimeout((()=>{n.reject("Recents validation timed out.")}),550),Promise.race([n.promise,this._validateRecentlyOpened()]).then((()=>{this.update()})).catch((()=>{})),super.onBeforeAttach(e)}updateItems(){this.clearItems(),this.addItem({command:a.reopenLast}),this.addItem({type:"separator"});let e=!0,n=!1;this._manager.recentlyOpened.sort(((e,n)=>e.contentType===n.contentType?0:"directory"!==e.contentType?1:-1)).forEach((t=>{if("directory"===t.contentType){if(!this._showDirectories)return;n=!0}else e&&n&&(e=!1,this.addItem({type:"separator"}));this.addItem({command:a.openRecent,args:{recent:t}})})),this.addItem({type:"separator"}),this.addItem({command:a.clearRecents})}}const v={id:"@jupyterlab/mainmenu-extension:recents",description:"Adds sub-menu for opening recent documents to the File section of the main menu.",autoStart:!0,requires:[_.IRecentsManager,s.IMainMenu],optional:[g.IFileBrowserCommands,c.ITranslator],activate:(e,n,t,o,s)=>{const{commands:d}=e,i=(null!=s?s:c.nullTranslator).load("jupyterlab"),u=null!==o,m=async e=>{const t=await n.validate(e);return t||await(0,l.showErrorMessage)(i.__("Could Not Open Recent"),i.__("%1 is no longer valid and will be removed from the list",e.path)),t};d.addCommand(a.openRecent,{execute:async e=>{const n=e.recent,t=""===n.path?"/":n.path;await m(n)&&(o&&"directory"===n.contentType?await d.execute(o.openPath,{path:t}):await d.execute("docmanager:open",{path:t,factory:n.factory}))},label:e=>{const n=e.recent;return n?r.PathExt.joinWithLeadingSlash(n.root,n.path):i.__("Open a Recent Document (given by `recent` argument)")},isEnabled:e=>n.recentlyOpened.includes(e.recent)}),e.commands.addCommand(a.reopenLast,{execute:async()=>{const e=n.recentlyClosed[0];e&&await m(e)&&(await d.execute("docmanager:open",{path:e.path,factory:e.factory}),n.removeRecent(e,"closed"))},label:()=>{const e=n.recentlyClosed[0];return e?i.__("Reopen %1",e.path):i.__("Reopen Closed Document")},isEnabled:()=>0!==n.recentlyClosed.length,caption:i.__("Reopen recently closed file or notebook.")});const p=new b({commands:d,manager:n,showDirectories:u});p.title.label=i.__("Open Recent"),t.fileMenu.addItem({type:"submenu",submenu:p,rank:1})}},C="@jupyterlab/mainmenu-extension:plugin";var w;!function(e){e.openEdit="editmenu:open",e.undo="editmenu:undo",e.redo="editmenu:redo",e.clearCurrent="editmenu:clear-current",e.clearAll="editmenu:clear-all",e.find="editmenu:find",e.goToLine="editmenu:go-to-line",e.openFile="filemenu:open",e.closeAndCleanup="filemenu:close-and-cleanup",e.createConsole="filemenu:create-console",e.shutdown="filemenu:shutdown",e.logout="filemenu:logout",e.openKernel="kernelmenu:open",e.interruptKernel="kernelmenu:interrupt",e.reconnectToKernel="kernelmenu:reconnect-to-kernel",e.restartKernel="kernelmenu:restart",e.restartKernelAndClear="kernelmenu:restart-and-clear",e.changeKernel="kernelmenu:change",e.shutdownKernel="kernelmenu:shutdown",e.shutdownAllKernels="kernelmenu:shutdownAll",e.openView="viewmenu:open",e.wordWrap="viewmenu:word-wrap",e.lineNumbering="viewmenu:line-numbering",e.matchBrackets="viewmenu:match-brackets",e.openRun="runmenu:open",e.run="runmenu:run",e.runAll="runmenu:run-all",e.restartAndRunAll="runmenu:restart-and-run-all",e.runAbove="runmenu:run-above",e.runBelow="runmenu:run-below",e.openTabs="tabsmenu:open",e.activateById="tabsmenu:activate-by-id",e.activatePreviouslyUsedTab="tabsmenu:activate-previously-used-tab",e.openSettings="settingsmenu:open",e.openHelp="helpmenu:open",e.getKernel="helpmenu:get-kernel",e.openFirst="mainmenu:open-first"}(w||(w={}));const f=[{id:C,description:"Adds and provides the application main menu.",requires:[o.IRouter,c.ITranslator],optional:[l.ICommandPalette,o.ILabShell,i.ISettingRegistry],provides:s.IMainMenu,activate:async(e,n,t,a,i,c)=>{const{commands:p}=e,_=t.load("jupyterlab"),g=new s.MainMenu(p);g.id="jp-MainMenu",g.addClass("jp-scrollbar-tiny"),c&&(await y.loadSettingsMenu(c,(e=>{g.addMenu(e,!1,{rank:e.rank})}),(e=>s.MainMenu.generateMenu(p,e,_)),t),g.update());const b=r.PageConfig.getOption("quitButton").toLowerCase();g.fileMenu.quitEntry="true"===b,function(e,n,t){const{commands:a,shell:l}=e;(0,o.addSemanticCommand)({id:w.undo,commands:a,shell:l,semanticCommands:n.undoers.undo,default:{label:t.__("Undo")},trans:t}),(0,o.addSemanticCommand)({id:w.redo,commands:a,shell:l,semanticCommands:n.undoers.redo,default:{label:t.__("Redo")},trans:t}),(0,o.addSemanticCommand)({id:w.clearCurrent,commands:a,shell:l,semanticCommands:n.clearers.clearCurrent,default:{label:t.__("Clear")},trans:t}),(0,o.addSemanticCommand)({id:w.clearAll,commands:a,shell:l,semanticCommands:n.clearers.clearAll,default:{label:t.__("Clear All")},trans:t}),(0,o.addSemanticCommand)({id:w.goToLine,commands:a,shell:l,semanticCommands:n.goToLiners,default:{label:t.__("Go to Line…")},trans:t})}(e,g.editMenu,_),function(e,n,t,a){const{commands:s,shell:i}=e;(0,o.addSemanticCommand)({id:w.closeAndCleanup,commands:s,shell:i,semanticCommands:n.closeAndCleaners,default:{execute:"application:close",label:a.__("Close and Shut Down"),isEnabled:!0},overrides:{isEnabled:()=>!!e.shell.currentWidget&&!!e.shell.currentWidget.title.closable},trans:a}),(0,o.addSemanticCommand)({id:w.createConsole,commands:s,shell:i,semanticCommands:n.consoleCreators,default:{label:a.__("New Console for Activity")},trans:a}),s.addCommand(w.shutdown,{label:a.__("Shut Down"),caption:a.__("Shut down %1",e.name),isVisible:()=>n.quitEntry,isEnabled:()=>n.quitEntry,execute:()=>(0,l.showDialog)({title:a.__("Shutdown confirmation"),body:a.__("Please confirm you want to shut down %1.",e.name),buttons:[l.Dialog.cancelButton(),l.Dialog.warnButton({label:a.__("Shut Down")})]}).then((async n=>{if(n.button.accept){const n=d.ServerConnection.makeSettings(),t=r.URLExt.join(n.baseUrl,"api/shutdown");try{await Promise.all([e.serviceManager.sessions.shutdownAll(),e.serviceManager.terminals.shutdownAll()])}catch(e){console.log(`Failed to shutdown sessions and terminals: ${e}`)}return d.ServerConnection.makeRequest(t,{method:"POST"},n).then((n=>{if(!n.ok)throw new d.ServerConnection.ResponseError(n);{const n=document.createElement("div"),t=document.createElement("p");t.textContent=a.__("You have shut down the Jupyter server. You can now close this tab.");const o=document.createElement("p");o.textContent=a.__("To use %1 again, you will need to relaunch it.",e.name),n.appendChild(t),n.appendChild(o),(0,l.showDialog)({title:a.__("Server stopped"),body:new h.Widget({node:n}),buttons:[]}),window.close()}})).catch((e=>{throw new d.ServerConnection.NetworkError(e)}))}}))}),s.addCommand(w.logout,{label:a.__("Log Out"),caption:a.__("Log out of %1",e.name),isVisible:()=>n.quitEntry,isEnabled:()=>n.quitEntry,execute:()=>{t.navigate("/logout",{hard:!0})}})}(e,g.fileMenu,n,_),function(e,n,t){const{commands:a,shell:r}=e;(0,o.addSemanticCommand)({id:w.interruptKernel,commands:a,shell:r,semanticCommands:n.kernelUsers.interruptKernel,default:{label:t.__("Interrupt Kernel"),caption:t.__("Interrupt the kernel")},overrides:{icon:e=>e.toolbar?u.stopIcon:void 0},trans:t}),(0,o.addSemanticCommand)({id:w.reconnectToKernel,commands:a,shell:r,semanticCommands:n.kernelUsers.reconnectToKernel,default:{label:t.__("Reconnect to Kernel")},trans:t}),(0,o.addSemanticCommand)({id:w.restartKernel,commands:a,shell:r,semanticCommands:n.kernelUsers.restartKernel,default:{label:t.__("Restart Kernel…"),caption:t.__("Restart the kernel")},overrides:{icon:e=>e.toolbar?u.refreshIcon:void 0},trans:t}),(0,o.addSemanticCommand)({id:w.restartKernelAndClear,commands:a,shell:r,semanticCommands:[n.kernelUsers.restartKernel,n.kernelUsers.clearWidget],default:{label:t.__("Restart Kernel and Clear…")},trans:t}),(0,o.addSemanticCommand)({id:w.changeKernel,commands:a,shell:r,semanticCommands:n.kernelUsers.changeKernel,default:{label:t.__("Change Kernel…")},trans:t}),(0,o.addSemanticCommand)({id:w.shutdownKernel,commands:a,shell:r,semanticCommands:n.kernelUsers.shutdownKernel,default:{label:t.__("Shut Down Kernel"),caption:t.__("Shut down kernel")},trans:t}),a.addCommand(w.shutdownAllKernels,{label:t.__("Shut Down All Kernels…"),isEnabled:()=>!e.serviceManager.sessions.running().next().done,execute:()=>(0,l.showDialog)({title:t.__("Shut Down All?"),body:t.__("Shut down all kernels?"),buttons:[l.Dialog.cancelButton({label:t.__("Dismiss")}),l.Dialog.warnButton({label:t.__("Shut Down All")})]}).then((n=>{if(n.button.accept)return e.serviceManager.sessions.shutdownAll()}))})}(e,g.kernelMenu,_),function(e,n,t){const{commands:a,shell:l}=e;(0,o.addSemanticCommand)({id:w.run,commands:a,shell:l,semanticCommands:n.codeRunners.run,default:{label:t.__("Run Selected"),caption:t.__("Run Selected")},overrides:{icon:e=>e.toolbar?u.runIcon:void 0},trans:t}),(0,o.addSemanticCommand)({id:w.runAll,commands:a,shell:l,semanticCommands:n.codeRunners.runAll,default:{label:t.__("Run All"),caption:t.__("Run All")},trans:t}),(0,o.addSemanticCommand)({id:w.restartAndRunAll,commands:a,shell:l,semanticCommands:[n.codeRunners.restart,n.codeRunners.runAll],default:{label:t.__("Restart Kernel and Run All"),caption:t.__("Restart Kernel and Run All")},overrides:{icon:e=>e.toolbar?u.fastForwardIcon:void 0},trans:t})}(e,g.runMenu,_),function(e,n,t){const{commands:a,shell:l}=e;(0,o.addSemanticCommand)({id:w.lineNumbering,commands:a,shell:l,semanticCommands:n.editorViewers.toggleLineNumbers,default:{label:t.__("Show Line Numbers")},trans:t}),(0,o.addSemanticCommand)({id:w.matchBrackets,commands:a,shell:l,semanticCommands:n.editorViewers.toggleMatchBrackets,default:{label:t.__("Match Brackets")},trans:t}),(0,o.addSemanticCommand)({id:w.wordWrap,commands:a,shell:l,semanticCommands:n.editorViewers.toggleWordWrap,default:{label:t.__("Wrap Words")},trans:t})}(e,g.viewMenu,_),function(e,n,t){const{commands:a,shell:l}=e;(0,o.addSemanticCommand)({id:w.getKernel,commands:a,shell:l,semanticCommands:n.getKernel,default:{label:t.__("Get Kernel"),isVisible:!1},trans:t})}(e,g.helpMenu,_),i&&function(e,n,t,a){const o=e.commands,l=[];let r;o.addCommand(w.activateById,{label:n=>{if(void 0===n.id)return a.__("Activate a widget by its `id`.");const t=n.id||"",o=(0,m.find)(e.shell.widgets("main"),(e=>e.id===t));return o&&o.title.label||""},isToggled:n=>{const t=n.id||"";return!!e.shell.currentWidget&&e.shell.currentWidget.id===t},execute:n=>e.shell.activateById(n.id||"")});let s="";o.addCommand(w.activatePreviouslyUsedTab,{label:a.__("Activate Previously Used Tab"),isEnabled:()=>!!s,execute:()=>o.execute(w.activateById,{id:s})}),t&&e.restored.then((()=>{const a=()=>{r&&!r.isDisposed&&r.dispose(),l.length=0;let t=!1;for(const n of e.shell.widgets("main"))n.id===s&&(t=!0),l.push({command:w.activateById,args:{id:n.id}});r=n.addGroup(l,1),s=t?s:""};a(),t.layoutModified.connect((()=>{a()})),t.currentChanged.connect(((e,n)=>{const t=n.oldValue;t&&(s=t.id)}))}))}(e,g.tabsMenu,i,_);const v=e=>{g.activeMenu=e,g.openActiveMenu()};return p.addCommand(w.openEdit,{label:_.__("Open Edit Menu"),execute:()=>v(g.editMenu)}),p.addCommand(w.openFile,{label:_.__("Open File Menu"),execute:()=>v(g.fileMenu)}),p.addCommand(w.openKernel,{label:_.__("Open Kernel Menu"),execute:()=>v(g.kernelMenu)}),p.addCommand(w.openRun,{label:_.__("Open Run Menu"),execute:()=>v(g.runMenu)}),p.addCommand(w.openView,{label:_.__("Open View Menu"),execute:()=>v(g.viewMenu)}),p.addCommand(w.openSettings,{label:_.__("Open Settings Menu"),execute:()=>v(g.settingsMenu)}),p.addCommand(w.openTabs,{label:_.__("Open Tabs Menu"),execute:()=>v(g.tabsMenu)}),p.addCommand(w.openHelp,{label:_.__("Open Help Menu"),execute:()=>v(g.helpMenu)}),p.addCommand(w.openFirst,{label:_.__("Open First Menu"),execute:()=>{g.activeIndex=0,g.openActiveMenu()}}),a&&(a.addItem({command:w.shutdown,category:_.__("Main Area")}),a.addItem({command:w.logout,category:_.__("Main Area")}),a.addItem({command:w.shutdownAllKernels,category:_.__("Kernel Operations")}),a.addItem({command:w.activatePreviouslyUsedTab,category:_.__("Main Area")})),e.shell.add(g,"menu",{rank:100}),g}},v];var y;!function(e){async function n(e){(await(0,l.showDialog)({title:e.__("Information"),body:e.__("Menu customization has changed. You will need to reload JupyterLab to see the changes."),buttons:[l.Dialog.cancelButton(),l.Dialog.okButton({label:e.__("Reload")})]})).button.accept&&location.reload()}e.loadSettingsMenu=async function(e,t,a,o){var r;const s=o.load("jupyterlab");let d=null,c={};function u(n){var t,a;c={};const o=Object.keys(e.plugins).map((n=>{var t,a;const o=null!==(a=null===(t=e.plugins[n].schema["jupyter.lab.menus"])||void 0===t?void 0:t.main)&&void 0!==a?a:[];return c[n]=o,o})).concat([null!==(a=null===(t=n["jupyter.lab.menus"])||void 0===t?void 0:t.main)&&void 0!==a?a:[]]).reduceRight(((e,n)=>i.SettingRegistry.reconcileMenus(e,n,!0)),n.properties.menus.default);n.properties.menus.default=i.SettingRegistry.reconcileMenus(o,n.properties.menus.default,!0).sort(((e,n)=>{var t,a;return(null!==(t=e.rank)&&void 0!==t?t:1/0)-(null!==(a=n.rank)&&void 0!==a?a:1/0)}))}e.transform(C,{compose:e=>{var n,t,a,o;d||(d=p.JSONExt.deepCopy(e.schema),u(d));const l=null!==(a=null===(t=null===(n=d.properties)||void 0===n?void 0:n.menus)||void 0===t?void 0:t.default)&&void 0!==a?a:[],r={...e.data.user,menus:null!==(o=e.data.user.menus)&&void 0!==o?o:[]},s={...e.data.composite,menus:i.SettingRegistry.reconcileMenus(l,r.menus)};return e.data={composite:s,user:r},e},fetch:e=>(d||(d=p.JSONExt.deepCopy(e.schema),u(d)),{data:e.data,id:e.id,raw:e.raw,schema:d,version:e.version})});const m=await e.load(C),h=null!==(r=p.JSONExt.deepCopy(m.composite.menus))&&void 0!==r?r:[],_=new Array;l.MenuFactory.createMenus(h.filter((e=>!e.disabled)).map((e=>{var n;return{...e,items:i.SettingRegistry.filterDisabledItems(null!==(n=e.items)&&void 0!==n?n:[])}})),a).forEach((e=>{_.push(e),t(e)})),m.changed.connect((()=>{var e;const t=null!==(e=m.composite.menus)&&void 0!==e?e:[];p.JSONExt.deepEqual(h,t)||n(s)})),e.pluginChanged.connect((async(o,r)=>{var d,u,m;if(r!==C){const o=null!==(d=c[r])&&void 0!==d?d:[],g=null!==(m=null===(u=e.plugins[r].schema["jupyter.lab.menus"])||void 0===u?void 0:u.main)&&void 0!==m?m:[];if(!p.JSONExt.deepEqual(o,g))if(c[r])await n(s);else{c[r]=p.JSONExt.deepCopy(g);const e=i.SettingRegistry.reconcileMenus(g,h,!1,!1).filter((e=>!e.disabled)).map((e=>{var n;return{...e,items:i.SettingRegistry.filterDisabledItems(null!==(n=e.items)&&void 0!==n?n:[])}}));l.MenuFactory.updateMenus(_,e,a).forEach((e=>{t(e)}))}}}))}}(y||(y={}))}}]);