(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[9853,3844],{23844:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>b});var o=n(30603),s=n(60977),a=n(9432),r=n(27693),l=n(89959),c=n(43821),d=n(98056),i=n(34631),u=n(2968);const p="jp-RetroKernelStatus-error",C="jp-RetroKernelStatus-warn",g="jp-RetroKernelStatus-info",h="jp-RetroKernelStatus-fade",k={id:"@retrolab/notebook-extension:checkpoints",autoStart:!0,requires:[a.IDocumentManager,c.ITranslator],optional:[d.IRetroShell],activate:(e,t,n,a)=>{const{shell:r}=e,l=n.load("retrolab"),c=new u.Widget;c.id=o.DOMUtils.createDomID(),c.addClass("jp-RetroCheckpoint"),e.shell.add(c,"top",{rank:100});const d=async()=>{const e=r.currentWidget;if(!e)return;const n=t.contextForWidget(e);null==n||n.fileChanged.disconnect(d),null==n||n.fileChanged.connect(d);const o=await(null==n?void 0:n.listCheckpoints());if(!o)return;const a=o[o.length-1];c.node.textContent=l.__("Last Checkpoint: %1",s.Time.formatHuman(new Date(a.last_modified)))};a&&a.currentChanged.connect(d),new i.Poll({auto:!0,factory:()=>d(),frequency:{interval:2e3,backoff:!1},standby:"when-hidden"})}},m={id:"@retrolab/notebook-extension:kernel-logo",autoStart:!0,requires:[d.IRetroShell],activate:(e,t)=>{const{serviceManager:n}=e;let o;const s=async()=>{var a,l,c,d,i;o&&(o.dispose(),o.parent=null);const p=t.currentWidget;if(!(p instanceof r.NotebookPanel))return;await p.sessionContext.ready,p.sessionContext.kernelChanged.disconnect(s),p.sessionContext.kernelChanged.connect(s);const C=null!==(c=null===(l=null===(a=p.sessionContext.session)||void 0===a?void 0:a.kernel)||void 0===l?void 0:l.name)&&void 0!==c?c:"",g=null===(i=null===(d=n.kernelspecs)||void 0===d?void 0:d.specs)||void 0===i?void 0:i.kernelspecs[C];if(!g)return;const h=g.resources["logo-64x64"];if(!h)return;const k=document.createElement("div"),m=document.createElement("img");m.src=h,m.title=g.display_name,k.appendChild(m),o=new u.Widget({node:k}),o.addClass("jp-RetroKernelLogo"),e.shell.add(o,"top",{rank:10010})};e.started.then((()=>{t.currentChanged.connect(s)}))}},f={id:"@retrolab/notebook-extension:kernel-status",autoStart:!0,requires:[d.IRetroShell,c.ITranslator],activate:(e,t,n)=>{const o=n.load("retrolab"),a=new u.Widget;a.addClass("jp-RetroKernelStatus"),e.shell.add(a,"menu",{rank:10010});const l=e=>{const t=e.kernelDisplayStatus;let n=`Kernel ${s.Text.titleCase(t)}`;switch(a.removeClass(p),a.removeClass(C),a.removeClass(g),a.removeClass(h),t){case"busy":case"idle":n="",a.addClass(h);break;case"dead":case"terminating":a.addClass(p);break;case"unknown":a.addClass(C);break;default:a.addClass(g),a.addClass(h)}a.node.textContent=o.__(n)};t.currentChanged.connect((async()=>{const e=t.currentWidget;e instanceof r.NotebookPanel&&e.sessionContext.statusChanged.connect(l)}))}},v={id:"@retrolab/notebook-extension:scroll-output",autoStart:!0,requires:[r.INotebookTracker],optional:[l.ISettingRegistry],activate:async(e,t,n)=>{let o=!0;const s=e=>{if(!o)return;const{outputArea:t}=e;if(void 0!==e.model.metadata.get("scrolled"))return;const{node:n}=t,s=n.scrollHeight>1.3*(parseFloat(n.style.fontSize.replace("px",""))||14)*100;e.toggleClass("jp-mod-outputsScrolled",s)};if(t.widgetAdded.connect(((e,t)=>{var n;null===(n=t.model)||void 0===n||n.cells.changed.connect(((e,n)=>{if("add"!==n.type)return;const[o]=n.newValues;t.content.widgets.forEach((e=>{if(e.model.id===o.id&&"code"===e.model.type){const t=e;t.outputArea.model.changed.connect((()=>s(t)))}}))})),t.sessionContext.ready.then((()=>{t.content.widgets.forEach((e=>{"code"===e.model.type&&s(e)}))}))})),n){const t=n.load(v.id),s=e=>{o=e.get("autoScrollOutputs").composite};Promise.all([t,e.restored]).then((([e])=>{s(e),e.changed.connect((e=>{s(e)}))})).catch((e=>{console.error(e.message)}))}}},b=[k,m,f,v]}}]);