"use strict";(self.webpackChunk_jupyterlab_server_proxy=self.webpackChunk_jupyterlab_server_proxy||[]).push([[568],{568:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,a){function l(e){try{i(n.next(e))}catch(e){a(e)}}function s(e){try{i(n.throw(e))}catch(e){a(e)}}function i(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(l,s)}i((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=r(782),a=r(814),l=r(484),s=r(58),i={id:"jupyterlab-server-proxy",autoStart:!0,requires:[a.ILauncher,o.ILayoutRestorer],activate:function(e,t,r){return n(this,void 0,void 0,(function*(){const n=yield fetch(l.PageConfig.getBaseUrl()+"server-proxy/servers-info");if(!n.ok)return console.log("Could not fetch metadata about registered servers. Make sure jupyter-server-proxy is installed."),void console.log(n);const{commands:o,shell:a}=e,i=yield n.json(),c="server-proxy",u=new s.WidgetTracker({namespace:c}),d=c+":open";r&&r.restore(u,{command:d,args:e=>({url:e.content.url,title:e.content.title.label,newBrowserTab:!1,id:e.content.id}),name:e=>e.content.id}),o.addCommand(d,{label:e=>e.title,execute:e=>{const t=e.id,r=e.title,n=e.url;if(e.newBrowserTab)return void window.open(n,"_blank");let o=u.find((e=>e.content.id==t));if(o||(o=function(e,t,r){const n=new s.IFrame({sandbox:["allow-same-origin","allow-scripts","allow-popups","allow-forms","allow-downloads","allow-modals"]});n.title.label=r,n.title.closable=!0,n.url=t,n.addClass("jp-ServerProxy"),n.id=e;const o=new s.MainAreaWidget({content:n});return o.addClass("jp-ServerProxy"),o}(t,n,r)),u.has(o)||u.add(o),!o.isAttached)return a.add(o),o;a.activateById(o.id)}});for(let e of i.server_processes){if(!e.launcher_entry.enabled)continue;const r=l.PageConfig.getBaseUrl()+e.launcher_entry.path_info,n=e.launcher_entry.title,o=e.new_browser_tab,a={command:d,args:{url:r,title:n+(o?" [↗]":""),newBrowserTab:o,id:c+":"+e.name},category:"Notebook"};e.launcher_entry.icon_url&&(a.kernelIconUrl=e.launcher_entry.icon_url),t.add(a)}}))}};t.default=i}}]);