"use strict";(self["webpackChunk_quetz_frontend_main_app"]=self["webpackChunk_quetz_frontend_main_app"]||[]).push([[8136,5836],{28136:(e,t,n)=>{n.r(t);n.d(t,{App:()=>f,QuetzServiceManager:()=>c,Shell:()=>m});var i=n(85168);var s=n(79450);var r=n(18303);var a=n(18470);var o=n(4135);var d=n(57e3);var h=n(98078);class c{constructor(){this._isDisposed=false;this._connectionFailure=new d.Signal(this);this.settings=new h.SettingManager({serverSettings:this.serverSettings})}get connectionFailure(){return this._connectionFailure}get isDisposed(){return this._isDisposed}get serverSettings(){return h.ServerConnection.makeSettings()}get isReady(){return true}get ready(){return Promise.resolve()}dispose(){if(this.isDisposed){return}this._isDisposed=true;d.Signal.clearData(this)}}var u=n(62867);var l=n(61389);var p=n(32151);const g=900;class m extends l.Widget{constructor(){super();this.id="main";const e=new l.BoxLayout;this._top=new _.PanelHandler;this._main=new l.Panel;this._top.panel.id="top-panel";this._main.id="main-panel";l.BoxLayout.setStretch(this._top.panel,0);l.BoxLayout.setStretch(this._main,1);e.spacing=0;e.addWidget(this._top.panel);e.addWidget(this._main);this.layout=e}activateById(e){}add(e,t,n){var i;const s=(i=n===null||n===void 0?void 0:n.rank)!==null&&i!==void 0?i:g;if(t==="top"){return this._top.addWidget(e,s)}if(t==="main"||t===undefined){this._addToMainArea(e)}return}get currentWidget(){return this._main.widgets[0]}get top(){return this._topWrapper}widgets(e){if(e==="top"){return(0,u.iter)(this._top.panel.widgets)}return(0,u.iter)(this._main.widgets)}_addToMainArea(e){if(!e.id){console.error("Widgets added to the app shell must have unique id property.");return}const t=this._main;const{title:n}=e;n.dataset=Object.assign(Object.assign({},n.dataset),{id:e.id});if(n.icon instanceof a.LabIcon){n.icon=n.icon.bindprops({stylesheet:"mainAreaTab"})}else if(typeof n.icon==="string"||!n.icon){n.iconClass=(0,a.classes)(n.iconClass,"jp-Icon")}if(t.widgets.length){t.widgets[0].dispose()}t.addWidget(e)}}var _;(function(e){function t(e,t){return e.rank-t.rank}e.itemCmp=t;class n{constructor(){this._panelChildHook=(e,t)=>{switch(t.type){case"child-added":{const e=t.child;if(this._items.find((t=>t.widget===e))){break}const n=this._items[this._items.length-1].rank;this._items.push({widget:e,rank:n})}break;case"child-removed":{const e=t.child;u.ArrayExt.removeFirstWhere(this._items,(t=>t.widget===e))}break;default:break}return true};this._items=new Array;this._panel=new l.Panel;p.MessageLoop.installMessageHook(this._panel,this._panelChildHook)}get panel(){return this._panel}addWidget(t,n){t.parent=null;const i={widget:t,rank:n};const s=u.ArrayExt.upperBound(this._items,i,e.itemCmp);u.ArrayExt.insert(this._items,s,i);this._panel.insertWidget(s,t)}}e.PanelHandler=n})(_||(_={}));class f extends o.Application{constructor(e={}){var t;super(Object.assign(Object.assign({},e),{shell:(t=e.shell)!==null&&t!==void 0?t:new m}));this.name=r.PageConfig.getOption("appName")||"Quetz";this.namespace=r.PageConfig.getOption("appNamespace")||this.name;this.registerPluginErrors=[];this.version=r.PageConfig.getOption("appVersion")||"unknown";this._formatChanged=new d.Signal(this);this.serviceManager=new c;this.contextMenu=new a.ContextMenuSvg({commands:this.commands,renderer:e.contextMenuRenderer,groupByTarget:false,sortBySelector:false});const n=new Promise((e=>{requestAnimationFrame((()=>{e()}))}));this.commandLinker=e.commandLinker||new s.CommandLinker({commands:this.commands});this.restored=e.restored||this.started.then((()=>n)).catch((()=>n))}get format(){return this._format}set format(e){if(this._format!==e){this._format=e;document.body.dataset["format"]=e;this._formatChanged.emit(e)}}get formatChanged(){return this._formatChanged}get paths(){return i.JupyterLab.defaultPaths}contextMenuHitTest(e){if(!this._contextMenuEvent||!(this._contextMenuEvent.target instanceof Node)){return undefined}let t=this._contextMenuEvent.target;do{if(t instanceof HTMLElement&&e(t)){return t}t=t.parentNode}while(t&&t.parentNode&&t!==t.parentNode);return undefined}evtContextMenu(e){this._contextMenuEvent=e;if(e.shiftKey){return}const t=this.contextMenu.open(e);if(t){const t=this.contextMenu.menu.items;if(t.length===1&&t[0].command===i.JupyterFrontEndContextMenu.contextMenu){this.contextMenu.menu.close();return}e.preventDefault();e.stopPropagation()}}registerPluginModule(e){let t=e.default;if(!Object.prototype.hasOwnProperty.call(e,"__esModule")){t=e}if(!Array.isArray(t)){t=[t]}t.forEach((e=>{try{this.registerPlugin(e)}catch(t){this.registerPluginErrors.push(t)}}))}registerPluginModules(e){e.forEach((e=>{this.registerPluginModule(e)}))}}}}]);