@datalayer/agent-runtimes 1.5.23 → 1.5.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-embed/chunks/{CellSidebarExtension-CDnzN9Cb.js → CellSidebarExtension-B-73cmcQ.js} +1 -1
- package/dist-embed/chunks/{ChatView-BjZ993Ch.js → ChatView-CUWE6I5M.js} +3 -3
- package/dist-embed/chunks/{DeckComponent-Cb4_dZpN.js → DeckComponent-ymp4My5d.js} +1 -1
- package/dist-embed/chunks/{DocumentView-Caxb2xz-.js → DocumentView-i99p_Qzt.js} +1 -1
- package/dist-embed/chunks/{EphemeralDocument-DIHjR5l8.js → EphemeralDocument--pV47gPl.js} +1 -1
- package/dist-embed/chunks/{EphemeralNotebook-1Rwa3anx.js → EphemeralNotebook-BqccUXGd.js} +1 -1
- package/dist-embed/chunks/{ExcalidrawComponent-vJQwgcUt.js → ExcalidrawComponent-DgSMy796.js} +1 -1
- package/dist-embed/chunks/{ExcalidrawModal-BDgjdSz2.js → ExcalidrawModal-DFJW9pQh.js} +1 -1
- package/dist-embed/chunks/{JupyterLexicalExtension-_7FM5Om8.js → JupyterLexicalExtension-CqDatsgf.js} +5 -5
- package/dist-embed/chunks/{KernelVariables-CKIqy599.js → KernelVariables-CS6h5HyK.js} +1 -1
- package/dist-embed/chunks/{NotebookToolSurfaces-YAM1bvZS.js → NotebookToolSurfaces-CTLbTvsS.js} +1 -1
- package/dist-embed/chunks/{NotebookView-C8RCvsR1.js → NotebookView-BJpTApeL.js} +1 -1
- package/dist-embed/chunks/{Output-BWClePP-.js → Output-no9rnFJ7.js} +1 -1
- package/dist-embed/chunks/{SandboxDetailsDialog-CDSxIC0-.js → SandboxDetailsDialog-BAv6RMed.js} +1 -1
- package/dist-embed/chunks/{SchemaForm-CO_2yGg2.js → SchemaForm-CE5NfpBU.js} +1 -1
- package/dist-embed/chunks/{WidgetVariableView--osoOLv8.js → WidgetVariableView-V4DsgfIK.js} +1 -1
- package/dist-embed/chunks/{YouTubePlugin-BB7Z7INn.js → YouTubePlugin-CpgyVTwG.js} +1 -1
- package/dist-embed/chunks/{ar-SA-G6X2FPQ2-D6Ko4I2x.js → ar-SA-G6X2FPQ2-DwUjDWHp.js} +1 -1
- package/dist-embed/chunks/{az-AZ-76LH7QW2-B3UhxnSz.js → az-AZ-76LH7QW2-DROX4pJc.js} +1 -1
- package/dist-embed/chunks/{bg-BG-XCXSNQG7-BS-QRZjB.js → bg-BG-XCXSNQG7-DPLzP9Bm.js} +1 -1
- package/dist-embed/chunks/{bn-BD-2XOGV67Q-DNg0uIV0.js → bn-BD-2XOGV67Q-CCOU2J2j.js} +1 -1
- package/dist-embed/chunks/{ca-ES-6MX7JW3Y-Bn4yHfTY.js → ca-ES-6MX7JW3Y-3RgFapBd.js} +1 -1
- package/dist-embed/chunks/{cs-CZ-2BRQDIVT-DUGnyonZ.js → cs-CZ-2BRQDIVT-BJS7ofhJ.js} +1 -1
- package/dist-embed/chunks/{da-DK-5WZEPLOC-Is8nybqO.js → da-DK-5WZEPLOC-BHDT0zzh.js} +1 -1
- package/dist-embed/chunks/{de-DE-XR44H4JA-D54sMa4L.js → de-DE-XR44H4JA-CWVJKc9t.js} +1 -1
- package/dist-embed/chunks/{el-GR-BZB4AONW-CvM3SWat.js → el-GR-BZB4AONW-2z8DB9lI.js} +1 -1
- package/dist-embed/chunks/{es-ES-U4NZUMDT-BZDRRuRf.js → es-ES-U4NZUMDT-DzXGWPd4.js} +1 -1
- package/dist-embed/chunks/{eu-ES-A7QVB2H4-DAmknI9y.js → eu-ES-A7QVB2H4-CslHE4iE.js} +1 -1
- package/dist-embed/chunks/{fa-IR-HGAKTJCU-CQhKri4O.js → fa-IR-HGAKTJCU-CBWUHs2r.js} +1 -1
- package/dist-embed/chunks/{fi-FI-Z5N7JZ37-DzEDoP64.js → fi-FI-Z5N7JZ37-MAr8kZMI.js} +1 -1
- package/dist-embed/chunks/{fr-FR-RHASNOE6-DiSkyvEB.js → fr-FR-RHASNOE6-BUz3aHQJ.js} +1 -1
- package/dist-embed/chunks/{gl-ES-HMX3MZ6V-3AJMzY-I.js → gl-ES-HMX3MZ6V-DvzQmDYv.js} +1 -1
- package/dist-embed/chunks/{he-IL-6SHJWFNN-Cuh5an4X.js → he-IL-6SHJWFNN-DKR3cKyQ.js} +1 -1
- package/dist-embed/chunks/{hi-IN-IWLTKZ5I-BbeuFB83.js → hi-IN-IWLTKZ5I-C4tyBNwa.js} +1 -1
- package/dist-embed/chunks/{hu-HU-A5ZG7DT2-C1OMfhob.js → hu-HU-A5ZG7DT2-C8BnBgH5.js} +1 -1
- package/dist-embed/chunks/{id-ID-SAP4L64H-BzKILJTZ.js → id-ID-SAP4L64H-Bn1hY5OS.js} +1 -1
- package/dist-embed/chunks/{index-CPpm1tqJ.js → index-5N0EOEHV.js} +1 -1
- package/dist-embed/chunks/{index-f418CYn7.js → index-BKB97UwL.js} +1 -1
- package/dist-embed/chunks/{index-CyQgE_Es.js → index-BN8Bbau-.js} +2 -2
- package/dist-embed/chunks/{index-CKFrz1es.js → index-BTdq_niO.js} +1 -1
- package/dist-embed/chunks/{index-D4QM3qbA.js → index-Bhzj1Pnv.js} +1 -1
- package/dist-embed/chunks/{index-BMandbJB.js → index-BzMt3uYX.js} +1 -1
- package/dist-embed/chunks/{index-DLimRfHQ.js → index-CCRwowMu.js} +1 -1
- package/dist-embed/chunks/{index-BFdE0KFI.js → index-CEbnhuIo.js} +1 -1
- package/dist-embed/chunks/{index-CAd5YQQl.js → index-CZB8DyUw.js} +1 -1
- package/dist-embed/chunks/{index-BO6VQLH6.js → index-Cd5CgKFr.js} +1 -1
- package/dist-embed/chunks/{index-D64QvG43.js → index-CkQ6IAoY.js} +1 -1
- package/dist-embed/chunks/{index-BktUM85c.js → index-Coj9opLJ.js} +1 -1
- package/dist-embed/chunks/{index-dYwQAVs_.js → index-D9_026K2.js} +1 -1
- package/dist-embed/chunks/{index-SbFvdBPQ.js → index-DVaPKQyL.js} +1 -1
- package/dist-embed/chunks/{index-f9WZsG2n.js → index-DWfzdTZo.js} +1 -1
- package/dist-embed/chunks/{index-DY8mjz1l.js → index-DdBQBN76.js} +1 -1
- package/dist-embed/chunks/{index-DEjLPUAD.js → index-Di3aBGLV.js} +1 -1
- package/dist-embed/chunks/{index-Cu0bp_EI.js → index-Gngo0bXi.js} +1 -1
- package/dist-embed/chunks/{index-DyVR0igi.js → index-S4sn4R3i.js} +1 -1
- package/dist-embed/chunks/{index-noRoZrq5.js → index-Z2pxzg3H.js} +1 -1
- package/dist-embed/chunks/{index-PqsSImlj.js → index-_H5U6gal.js} +1 -1
- package/dist-embed/chunks/{index-x45cMPwN.js → index-_nsBY26B.js} +1 -1
- package/dist-embed/chunks/{index-CM7xo08K.js → index-b6e3y1R-.js} +1 -1
- package/dist-embed/chunks/{index-wk9vl2uW.js → index-szXn1pzS.js} +1 -1
- package/dist-embed/chunks/{index.esm-p0OnSU9h.js → index.esm-nZym6gpK.js} +1 -1
- package/dist-embed/chunks/isEqual-g-jK7vY0.js +1 -0
- package/dist-embed/chunks/{it-IT-JPQ66NNP-DuG05fUR.js → it-IT-JPQ66NNP-DEiaanA7.js} +1 -1
- package/dist-embed/chunks/{ja-JP-DBVTYXUO-DeDfL3Bk.js → ja-JP-DBVTYXUO-Bb0GBZrQ.js} +1 -1
- package/dist-embed/chunks/{kaa-6HZHGXH3-BRKFVG6s.js → kaa-6HZHGXH3-DxqTv9uN.js} +1 -1
- package/dist-embed/chunks/{kab-KAB-ZGHBKWFO-Uqakmhz5.js → kab-KAB-ZGHBKWFO-D0V0yQgV.js} +1 -1
- package/dist-embed/chunks/{kk-KZ-P5N5QNE5-DWMXMIAK.js → kk-KZ-P5N5QNE5-CYyEyHXW.js} +1 -1
- package/dist-embed/chunks/{km-KH-HSX4SM5Z-BXNl9QnV.js → km-KH-HSX4SM5Z-CCTEGikY.js} +1 -1
- package/dist-embed/chunks/{ko-KR-MTYHY66A-BZgIqTuN.js → ko-KR-MTYHY66A-C-QDut19.js} +1 -1
- package/dist-embed/chunks/{ku-TR-6OUDTVRD-CQNa5i5U.js → ku-TR-6OUDTVRD-CIqn8p2Y.js} +1 -1
- package/dist-embed/chunks/{lt-LT-XHIRWOB4-BQW2k7iv.js → lt-LT-XHIRWOB4-BDLUWFPH.js} +1 -1
- package/dist-embed/chunks/{lv-LV-5QDEKY6T-B0HRRCC4.js → lv-LV-5QDEKY6T-BItabIJP.js} +1 -1
- package/dist-embed/chunks/{mr-IN-CRQNXWMA-DXR6sWSH.js → mr-IN-CRQNXWMA-DXXb8N2w.js} +1 -1
- package/dist-embed/chunks/{my-MM-5M5IBNSE-BZ5_9oCm.js → my-MM-5M5IBNSE-TidIfjqS.js} +1 -1
- package/dist-embed/chunks/{nb-NO-T6EIAALU-CBtv36wZ.js → nb-NO-T6EIAALU-DEINynK7.js} +1 -1
- package/dist-embed/chunks/{nl-NL-IS3SIHDZ-CcqE3cY8.js → nl-NL-IS3SIHDZ-D04rJzNe.js} +1 -1
- package/dist-embed/chunks/{nn-NO-6E72VCQL-Cl9wPgpU.js → nn-NO-6E72VCQL-oWFzCtpf.js} +1 -1
- package/dist-embed/chunks/{oc-FR-POXYY2M6-CQEkV2p1.js → oc-FR-POXYY2M6-BmFfP6hk.js} +1 -1
- package/dist-embed/chunks/{pa-IN-N4M65BXN-CaE6yG0U.js → pa-IN-N4M65BXN-RkXrgKXw.js} +1 -1
- package/dist-embed/chunks/{percentages-BXMCSKIN-Bk5xifLL.js → percentages-BXMCSKIN-BL_DuU3S.js} +3 -3
- package/dist-embed/chunks/{pl-PL-T2D74RX3-M1pQcF2j.js → pl-PL-T2D74RX3-DqxkHzTj.js} +1 -1
- package/dist-embed/chunks/{pt-BR-5N22H2LF-BFDHu72z.js → pt-BR-5N22H2LF-DFA-wWC5.js} +1 -1
- package/dist-embed/chunks/{pt-PT-UZXXM6DQ-DFcZY1Gz.js → pt-PT-UZXXM6DQ-Z5jw_7aw.js} +1 -1
- package/dist-embed/chunks/{renderer-Dy4lZ1KZ.js → renderer-DKKfWkWv.js} +1 -1
- package/dist-embed/chunks/{ro-RO-JPDTUUEW-BGm_Xwik.js → ro-RO-JPDTUUEW-DjC09bHq.js} +1 -1
- package/dist-embed/chunks/{ru-RU-B4JR7IUQ-BsrZ_x8p.js → ru-RU-B4JR7IUQ-CqwD7Yik.js} +1 -1
- package/dist-embed/chunks/{si-LK-N5RQ5JYF-BfaYS44g.js → si-LK-N5RQ5JYF-OVf4k6G3.js} +1 -1
- package/dist-embed/chunks/{sk-SK-C5VTKIMK-D-K9yMTN.js → sk-SK-C5VTKIMK-BG__kjLT.js} +1 -1
- package/dist-embed/chunks/{sl-SI-NN7IZMDC-B48XvZUw.js → sl-SI-NN7IZMDC-CIgxidVH.js} +1 -1
- package/dist-embed/chunks/{subset-shared.chunk-DzA7mJjZ.js → subset-shared.chunk-BR0LJHtQ.js} +1 -1
- package/dist-embed/chunks/{subset-worker.chunk-CsTEdHAt.js → subset-worker.chunk-52aAcjvz.js} +1 -1
- package/dist-embed/chunks/{sv-SE-XGPEYMSR-DfhLO_Vt.js → sv-SE-XGPEYMSR-CYHz3xCa.js} +1 -1
- package/dist-embed/chunks/{ta-IN-2NMHFXQM-EZA_oxSt.js → ta-IN-2NMHFXQM-BphRr9QY.js} +1 -1
- package/dist-embed/chunks/{th-TH-HPSO5L25-G9vy_zQH.js → th-TH-HPSO5L25-Ba2-2Bo0.js} +1 -1
- package/dist-embed/chunks/{tr-TR-DEFEU3FU-DBj_G5CD.js → tr-TR-DEFEU3FU-CRKE7Roy.js} +1 -1
- package/dist-embed/chunks/{uk-UA-QMV73CPH-DN7lMu5H.js → uk-UA-QMV73CPH-DlNE5CAT.js} +1 -1
- package/dist-embed/chunks/{vi-VN-M7AON7JQ-LoT02qgd.js → vi-VN-M7AON7JQ-Cp44PRXY.js} +1 -1
- package/dist-embed/chunks/{zh-CN-LNUGB5OW-CjexwOqT.js → zh-CN-LNUGB5OW-JHqqwp0j.js} +1 -1
- package/dist-embed/chunks/{zh-HK-E62DVLB3-B0ys_HV6.js → zh-HK-E62DVLB3-YEs97mA8.js} +1 -1
- package/dist-embed/chunks/{zh-TW-RAJ6MFWO-tQJWLJuU.js → zh-TW-RAJ6MFWO-CgmeTbuy.js} +1 -1
- package/dist-embed/datalayer-app-main.js +65 -65
- package/lib/apps/plugins/pap-sign-in/signIn.d.ts +3 -89
- package/lib/apps/plugins/pap-sign-in/signIn.js +5 -142
- package/lib/chat/messages/ChatMessageList.js +3 -1
- package/lib/chat/presence/Presence.d.ts +4 -4
- package/lib/chat/presence/Presence.js +3 -2
- package/lib/chat/presence/presenceStatus.d.ts +3 -34
- package/lib/chat/presence/presenceStatus.js +4 -46
- package/lib/portable/conversation.d.ts +3 -0
- package/lib/portable/conversation.js +15 -1
- package/lib/portable/direct.d.ts +100 -0
- package/lib/portable/direct.js +172 -0
- package/lib/portable/displays.d.ts +109 -0
- package/lib/portable/displays.js +261 -0
- package/lib/portable/fixtures.d.ts +11 -0
- package/lib/portable/fixtures.js +72 -0
- package/lib/portable/index.d.ts +6 -0
- package/lib/portable/index.js +10 -0
- package/lib/portable/presence.d.ts +47 -0
- package/lib/portable/presence.js +71 -0
- package/lib/portable/signIn.d.ts +96 -0
- package/lib/portable/signIn.js +148 -0
- package/lib/portable/views.d.ts +147 -0
- package/lib/portable/views.js +52 -0
- package/lib/runtimes/__tests__/fixtures/accounting-agent-card.json +1 -1
- package/package.json +1 -1
- package/dist-embed/chunks/isEqual-Cwjr2skl.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c2 as Z,v as U,b$ as ee,b_ as F,ak as B,J as K,dJ as pe,ai as j,cx as he,dK as me,c1 as ge,ci as W,ch as C,c6 as Q,dL as fe,ao as _e,ag as ve,cF as ye,dM as be,an as we,r as X,dN as xe,dO as Ce}from"../datalayer-app-main.js";import{T as te,f as Se,b as ne,d as oe}from"./index-CFP9psRB.js";import{I as ie}from"./tokens-BHMD_ju9.js";import{a as ae,b as H,c as V,I as P}from"./tokens-CENaHAHm.js";import{I as re}from"./tokens-BHLmeqjP.js";import{j as se,d as ke,m as Re,c as G,D as z,n as We}from"./index-
|
|
1
|
+
import{c2 as Z,v as U,b$ as ee,b_ as F,ak as B,J as K,dJ as pe,ai as j,cx as he,dK as me,c1 as ge,ci as W,ch as C,c6 as Q,dL as fe,ao as _e,ag as ve,cF as ye,dM as be,an as we,r as X,dN as xe,dO as Ce}from"../datalayer-app-main.js";import{T as te,f as Se,b as ne,d as oe}from"./index-CFP9psRB.js";import{I as ie}from"./tokens-BHMD_ju9.js";import{a as ae,b as H,c as V,I as P}from"./tokens-CENaHAHm.js";import{I as re}from"./tokens-BHLmeqjP.js";import{j as se,d as ke,m as Re,c as G,D as z,n as We}from"./index-BN8Bbau-.js";import"./hoverbox-CStlKQWE.js";import"./Output-no9rnFJ7.js";import"./index-DSN70XMH.js";import"./index-S4sn4R3i.js";import"./color-CG7_7V2-.js";import"./isEqual-g-jK7vY0.js";import"./defaultLocale-5voVPcsN.js";import"./index-DbMBnR4l.js";import"./KebabHorizontalIcon-CXDXtkuL.js";import"./PaintbrushIcon-CLU8RilX.js";import"./index-BJhxZF_K.js";import"./RestartIcon-Ca6_HoK0.js";import"./CellSidebarExtension-B-73cmcQ.js";import"./NotebookSkeleton-CI7ovjNW.js";import"./Avatar-9MpXENSs.js";import"./renderer-DKKfWkWv.js";import"./SquareIcon-e3ygcjpv.js";import"./SortAscIcon-CVKVWIWQ.js";import"./url-DuKx0yk0.js";/* empty css */import"./index-Dro44tIm.js";/* empty css *//* empty css */import"./index-DsG9xhMj.js";/* empty css */import"./index-CNU-WVhQ.js";import"./index--OLIX362.js";import"./index-DYGslHkf.js";import"./index-BSRVX3UN.js";import"./index-BH2OX5l8.js";import"./index-C3vDfO5_.js";import"./index-Ko8lxXFd.js";import"./index-CB9u17_J.js";import"./index-BUVtc_FV.js";import"./ArrowLeftIcon-Y3PTljcl.js";import"./SkubbleIcon-tlg17jBG.js";import"./usePrimerThemeBridge-CoHussa9.js";import"./index-Dobs-OKl.js";import"./KernelVariables-CS6h5HyK.js";import"./index-BvgsWH_d.js";import"./SortDescIcon-CS4EzHeS.js";import"./NotebookToolbar-rtMQZWHQ.js";import"./RepoPushIcon-Cm8g9NuL.js";import"./Toolbar-CGQDY041.js";import"./sessions-BRALW9Yv.js";import"./tokens-DTIgYcNS.js";import"./drivecontents-CxwZz_5W.js";import"./kernel-BI-BLP-K.js";function Fe(i){return U.createElement(te,{source:i.name,title:i.fullPath})}class N extends Z{constructor(e){super(new N.Model(e.docManager)),this.node.title=this.model.path}render(){return U.createElement(Fe,{fullPath:this.model.path,name:this.model.name})}}(function(i){class e extends ee{constructor(n){super(),this._onTitleChange=r=>{const s=this._getAllState();this._name=r.label,this._triggerChange(s,this._getAllState())},this._onPathChange=(r,s)=>{const c=this._getAllState();this._path=s,this._name=F.PathExt.basename(s),this._triggerChange(c,this._getAllState())},this._path="",this._name="",this._widget=null,this._docManager=n}get path(){return this._path}get name(){return this._name}get widget(){return this._widget}set widget(n){const r=this._widget;if(r!==null){const c=this._docManager.contextForWidget(r);c?c.pathChanged.disconnect(this._onPathChange):r.title.changed.disconnect(this._onTitleChange)}const s=this._getAllState();if(this._widget=n,this._widget===null)this._path="",this._name="";else{const c=this._docManager.contextForWidget(this._widget);c?(this._path=c.path,this._name=F.PathExt.basename(c.path),c.pathChanged.connect(this._onPathChange)):(this._path="",this._name=this._widget.title.label,this._widget.title.changed.connect(this._onTitleChange))}this._triggerChange(s,this._getAllState())}_getAllState(){return[this._path,this._name]}_triggerChange(n,r){(n[0]!==r[0]||n[1]!==r[1])&&this.stateChanged.emit(void 0)}}i.Model=e})(N||(N={}));function Te(i){return U.createElement(te,{source:i.fileStatus})}const De=2e3;class O extends Z{constructor(e){super(new O.Model(e.docManager));const n=(e.translator||B).load("jupyterlab");this._statusMap={completed:n.__("Saving completed"),started:n.__("Saving started"),failed:n.__("Saving failed")}}render(){return this.model===null||this.model.status===null?null:U.createElement(Te,{fileStatus:this._statusMap[this.model.status]})}}(function(i){class e extends ee{constructor(n){super(),this._onStatusChange=(r,s)=>{this._status=s,this._status==="completed"?(setTimeout(()=>{this._status=null,this.stateChanged.emit(void 0)},De),this.stateChanged.emit(void 0)):this.stateChanged.emit(void 0)},this._status=null,this._widget=null,this._status=null,this.widget=null,this._docManager=n}get status(){return this._status}get widget(){return this._widget}set widget(n){var r,s;const c=this._widget;if(c!==null){const p=this._docManager.contextForWidget(c);p?p.saveState.disconnect(this._onStatusChange):!((r=this._widget.content)===null||r===void 0)&&r.saveStateChanged&&this._widget.content.saveStateChanged.disconnect(this._onStatusChange)}if(this._widget=n,this._widget===null)this._status=null;else{const p=this._docManager.contextForWidget(this._widget);p?p.saveState.connect(this._onStatusChange):!((s=this._widget.content)===null||s===void 0)&&s.saveStateChanged&&this._widget.content.saveStateChanged.connect(this._onStatusChange)}}}i.Model=e})(O||(O={}));class Be{constructor(e){this._recentsChanged=new K(this),this._recents={opened:[],closed:[]},this._isDisposed=!1,this._maxRecentsLength=10,this._saveDebouncer=new pe(this._save.bind(this),500),this._stateDB=e.stateDB,this._contentsManager=e.contents,this.updateRootDir(),this._loadRecents().catch(t=>{console.error(`Failed to load recent list from state:
|
|
2
2
|
${t}`)})}get isDisposed(){return this._isDisposed}get recentlyOpened(){return(this._recents.opened||[]).filter(t=>t.root===this._serverRoot)}get recentlyClosed(){return(this._recents.closed||[]).filter(t=>t.root===this._serverRoot)}get changed(){return this._recentsChanged}get maximalRecentsLength(){return this._maxRecentsLength}set maximalRecentsLength(e){this._maxRecentsLength=Math.round(Math.max(1,e));let t=!1;for(const n of["opened","closed"])this._recents[n].length>this._maxRecentsLength&&(this._recents[n].length=this._maxRecentsLength,t=!0);t&&this._recentsChanged.emit(void 0)}dispose(){this.isDisposed||(this._isDisposed=!0,K.clearData(this),this._saveDebouncer.dispose())}addRecent(e,t){const n={...e,root:this._serverRoot},r=this._recents[t],s=r.findIndex(c=>c.path===e.path);s>=0&&r.splice(s,1),r.unshift(n),this._setRecents(r,t),this._recentsChanged.emit(void 0)}clearRecents(){this._setRecents([],"opened"),this._setRecents([],"closed"),this._recentsChanged.emit(void 0)}removeRecent(e,t){this._removeRecent(e.path,[t])}async validate(e){const t=await this._isValid(e);return t||this._removeRecent(e.path),t}updateRootDir(){this._serverRoot=F.PageConfig.getOption("serverRoot")}_removeRecent(e,t=["opened","closed"]){let n=!1;for(const r of t){const s=this._recents[r],c=s.filter(p=>e!==p.path);s.length!==c.length&&(this._setRecents(c,r),n=!0)}n&&this._recentsChanged.emit(void 0)}async _isValid(e){var t;try{await this._contentsManager.get(e.path,{content:!1})}catch(n){if(((t=n.response)===null||t===void 0?void 0:t.status)===404)return!1}return!0}_setRecents(e,t){this._recents[t]=e.slice(0,this.maximalRecentsLength).sort((n,r)=>n.root===r.root?0:n.root!==this._serverRoot?1:-1),this._saveDebouncer.invoke().catch(console.warn)}async _loadRecents(){const e=await this._stateDB.fetch(L.stateDBKey)||{opened:[],closed:[]},t=[...e.opened,...e.closed],n=new Set(await this._getInvalidPaths(t));for(const r of["opened","closed"])this._setRecents(e[r].filter(s=>!n.has(s.path)),r);this._recentsChanged.emit(void 0)}async _getInvalidPaths(e){return(await Promise.all(e.map(async n=>await this._isValid(n)?null:n.path))).filter(n=>typeof n=="string")}async _save(){try{await this._stateDB.save(L.stateDBKey,this._recents)}catch(e){console.log("Saving recents failed",e)}}}var L;(function(i){i.stateDBKey="docmanager:recents"})(L||(L={}));var J;(function(i){i.clearRecents="docmanager:clear-recents"})(J||(J={}));var M;(function(i){i.recentsManager="@jupyterlab/docmanager-extension:recents",i.reopenClosed="@jupyterlab/docmanager-extension:reopen-recently-closed",i.mainPlugin="@jupyterlab/docmanager-extension:plugin"})(M||(M={}));const je={id:M.recentsManager,description:"Provides a manager of recently opened and closed documents.",autoStart:!0,requires:[he.IStateDB],optional:[re,j],provides:ae,activate:(i,e,t,n)=>{const{serviceManager:r}=i,s=(n??B).load("jupyterlab"),c=new Be({stateDB:e,contents:r.contents}),p=m=>{c.maximalRecentsLength=m.get("maxNumberRecents").composite};return t&&Promise.all([i.restored,t.load(M.mainPlugin)]).then(([m,a])=>{a.changed.connect(p),p(a)}),i.commands.addCommand(J.clearRecents,{execute:()=>{c.clearRecents()},isEnabled:()=>c.recentlyOpened.length!=0||c.recentlyClosed.length!=0,label:s.__("Clear Recent Documents"),caption:s.__("Clear the list of recently opened items."),describedBy:{args:{type:"object",properties:{}}}}),c}};var h;(function(i){i.clone="docmanager:clone",i.deleteFile="docmanager:delete-file",i.newUntitled="docmanager:new-untitled",i.open="docmanager:open",i.openBrowserTab="docmanager:open-browser-tab",i.reload="docmanager:reload",i.rename="docmanager:rename",i.del="docmanager:delete",i.duplicate="docmanager:duplicate",i.restoreCheckpoint="docmanager:restore-checkpoint",i.save="docmanager:save",i.saveAll="docmanager:save-all",i.saveAs="docmanager:save-as",i.download="docmanager:download",i.toggleAutosave="docmanager:toggle-autosave",i.showInFileBrowser="docmanager:show-in-file-browser"})(h||(h={}));const D="@jupyterlab/docmanager-extension:plugin",Pe={id:"@jupyterlab/docmanager-extension:opener",description:"Provides the widget opener.",autoStart:!0,provides:V,activate:i=>{const{shell:e}=i;return new class{constructor(){this._opened=new K(this)}open(t,n){var r;t.id||(t.id=`document-manager-${++$.id}`),t.title.dataset={type:"document-title",...t.title.dataset},t.isAttached||e.add(t,"main",n||{}),(!((r=n?.activate)!==null&&r!==void 0)||r)&&e.activateById(t.id),this._opened.emit(t)}get opened(){return this._opened}}}},Ee={id:"@jupyterlab/docmanager-extension:contexts",description:"Adds the handling of opened documents dirty state.",autoStart:!0,requires:[P,V],optional:[se],activate:(i,e,t,n)=>{const r=new WeakSet;t.opened.connect((s,c)=>{const p=e.contextForWidget(c);p&&!r.has(p)&&(n&&Ve(n,p),r.add(p))})}},Ae={id:"@jupyterlab/docmanager-extension:manager",description:"Provides the document manager.",provides:P,requires:[V],optional:[j,se,Se,ke.IInfo,ae,Re,H],activate:(i,e,t,n,r,s,c,p,m)=>{var a;const{serviceManager:d,docRegistry:u}=i,_=t??B,f=r??new me({translator:_}),y=m??new z({translator:_}),x=i.restored.then(()=>{});return new We({registry:u,manager:d,opener:e,when:x,setBusy:(a=n&&(()=>n.setBusy()))!==null&&a!==void 0?a:void 0,sessionDialogs:f,translator:_??B,isConnectedCallback:()=>s?s.isConnected:!0,recentsManager:c??void 0,urlResolverFactory:p??void 0,docManagerDialogs:y})}},Ie={id:D,description:"Adds commands and settings to the document manager.",autoStart:!0,requires:[P,V,re],optional:[j,ne,G,H],activate:(i,e,t,n,r,s,c,p)=>{r=r??B;const m=r.load("jupyterlab"),a=i.docRegistry;Me(i,e,t,n,r,c,s,p);const d=u=>{const _=u.get("autosave").composite;e.autosave=_===!0||_===!1?_:!0,i.commands.notifyCommandChanged(h.toggleAutosave);const f=u.get("confirmClosingDocument").composite;e.confirmClosingDocument=f??!0;const y=u.get("autosaveInterval").composite;e.autosaveInterval=y||120;const x=u.get("lastModifiedCheckMargin").composite;e.lastModifiedCheckMargin=x||500;const w=u.get("renameUntitledFileOnSave").composite;e.renameUntitledFileOnSave=w??!0;const T=u.get("defaultViewers").composite,o={};Object.keys(T).forEach(l=>{if(!a.getFileType(l)){console.warn(`File Type ${l} not found`);return}a.getWidgetFactory(T[l])||console.warn(`Document viewer ${T[l]} not found`),o[l]=T[l]});for(const l of a.fileTypes())try{a.setDefaultWidgetFactory(l.name,o[l.name])}catch{console.warn(`Failed to set default viewer ${o[l.name]} for file type ${l.name}`)}};Promise.all([n.load(D),i.restored]).then(([u])=>{u.changed.connect(d),d(u);const _=(f,y)=>{["autosave","autosaveInterval","confirmClosingDocument","lastModifiedCheckMargin","renameUntitledFileOnSave"].includes(y.name)&&u.get(y.name).composite!==y.newValue&&u.set(y.name,y.newValue).catch(x=>{console.error(`Failed to set the setting '${y.name}':
|
|
3
3
|
${x}`)})};e.stateChanged.connect(_)}).catch(u=>{console.error(u.message)}),n.transform(D,{fetch:u=>{const _=Array.from(a.fileTypes()).map(w=>w.name).join(`
|
|
4
4
|
`),f=Array.from(a.widgetFactories()).map(w=>w.name).join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ak as I,J as P,ae as T,ai as R,cj as E,ck as B,ag as A,ca as j}from"../datalayer-app-main.js";import{b as M}from"./index-CFP9psRB.js";import{I as N}from"./tokens-BHLmeqjP.js";import{I as C}from"./tokens-DXLxGbDM.js";import{c as k}from"./index-
|
|
1
|
+
import{ak as I,J as P,ae as T,ai as R,cj as E,ck as B,ag as A,ca as j}from"../datalayer-app-main.js";import{b as M}from"./index-CFP9psRB.js";import{I as N}from"./tokens-BHLmeqjP.js";import{I as C}from"./tokens-DXLxGbDM.js";import{c as k}from"./index-BN8Bbau-.js";import"./hoverbox-CStlKQWE.js";import"./Output-no9rnFJ7.js";import"./index-DSN70XMH.js";import"./index-S4sn4R3i.js";import"./color-CG7_7V2-.js";import"./isEqual-g-jK7vY0.js";import"./defaultLocale-5voVPcsN.js";import"./index-DbMBnR4l.js";import"./KebabHorizontalIcon-CXDXtkuL.js";import"./PaintbrushIcon-CLU8RilX.js";import"./index-BJhxZF_K.js";import"./RestartIcon-Ca6_HoK0.js";import"./CellSidebarExtension-B-73cmcQ.js";import"./NotebookSkeleton-CI7ovjNW.js";import"./Avatar-9MpXENSs.js";import"./renderer-DKKfWkWv.js";import"./SquareIcon-e3ygcjpv.js";import"./SortAscIcon-CVKVWIWQ.js";import"./url-DuKx0yk0.js";/* empty css */import"./index-Dro44tIm.js";/* empty css *//* empty css */import"./index-DsG9xhMj.js";/* empty css */import"./index-CNU-WVhQ.js";import"./index--OLIX362.js";import"./index-DYGslHkf.js";import"./index-BSRVX3UN.js";import"./index-BH2OX5l8.js";import"./index-C3vDfO5_.js";import"./index-Ko8lxXFd.js";import"./index-CB9u17_J.js";import"./index-BUVtc_FV.js";import"./ArrowLeftIcon-Y3PTljcl.js";import"./SkubbleIcon-tlg17jBG.js";import"./usePrimerThemeBridge-CoHussa9.js";import"./index-Dobs-OKl.js";import"./KernelVariables-CS6h5HyK.js";import"./index-BvgsWH_d.js";import"./SortDescIcon-CS4EzHeS.js";import"./NotebookToolbar-rtMQZWHQ.js";import"./RepoPushIcon-Cm8g9NuL.js";import"./Toolbar-CGQDY041.js";import"./sessions-BRALW9Yv.js";import"./tokens-DTIgYcNS.js";import"./drivecontents-CxwZz_5W.js";import"./kernel-BI-BLP-K.js";class V{constructor(n=I){this.translator=n,this._changed=new P(this),this._providerMap=new Map}add(n,c){return this._providerMap.set(n,c),this._changed.emit(),new T(()=>{this._providerMap.delete(n),this._changed.emit()})}getProvider(n){for(const c of this._providerMap.values())if(c.isApplicable(n))return c.createNew(n,this.translator)}hasProvider(n){for(const c of this._providerMap.values())if(c.isApplicable(n))return!0;return!1}get changed(){return this._changed}}const v="jp-mod-searchable",S="jp-mod-search-active";var o;(function(t){t.search="documentsearch:start",t.searchAndReplace="documentsearch:startWithReplace",t.findNext="documentsearch:highlightNext",t.findPrevious="documentsearch:highlightPrevious",t.end="documentsearch:end",t.toggleSearchInSelection="documentsearch:toggleSearchInSelection"})(o||(o={}));const F={id:"@jupyterlab/documentsearch-extension:labShellWidgetListener",description:"Active search on valid document",requires:[k,C],autoStart:!0,activate:(t,n,c)=>{const h=s=>{s&&(c.hasProvider(s)?s.addClass(v):s.removeClass(v))};c.changed.connect(()=>h(n.activeWidget)),n.activeChanged.connect((s,d)=>{const u=d.oldValue;u&&u.removeClass(v),h(d.newValue)})}};class L{constructor(n){this._commandRegistry=n,this._cache=this._buildCache(),this._commandRegistry.keyBindingChanged.connect(this._rebuildCache,this)}get next(){return this._cache.next}get previous(){return this._cache.previous}get toggleSearchInSelection(){return this._cache.toggleSearchInSelection}_rebuildCache(){this._cache=this._buildCache()}_buildCache(){const n=this._commandRegistry.keyBindings.find(s=>s.command===o.findNext),c=this._commandRegistry.keyBindings.find(s=>s.command===o.findPrevious),h=this._commandRegistry.keyBindings.find(s=>s.command===o.toggleSearchInSelection);return{next:n,previous:c,toggleSearchInSelection:h}}dispose(){this._commandRegistry.keyBindingChanged.disconnect(this._rebuildCache,this)}}const W={id:"@jupyterlab/documentsearch-extension:plugin",description:"Provides the document search registry.",provides:C,requires:[R],optional:[M,N],autoStart:!0,activate:(t,n,c,h)=>{var s;const d=n.load("jupyterlab");let u=500,_="never";const p=new V(n),l=new Map;if(h){const e=h.load(W.id),i=r=>{u=r.get("searchDebounceTime").composite,_=r.get("autoSearchInSelection").composite};Promise.all([e,t.restored]).then(([r])=>{i(r),r.changed.connect(a=>{i(a)})}).catch(r=>{console.error(r.message)})}const b=()=>{const e=t.shell.currentWidget;return e?p.hasProvider(e):!1},y=e=>{if(!e)return;const i=e.id;let r=l.get(i);if(!r){const a=p.getProvider(e);if(!a)return;const m=new E(a,u),x=new L(t.commands),g=new B(m,n,x);l.set(i,g),[o.findNext,o.findPrevious,o.end,o.toggleSearchInSelection].forEach(f=>{t.commands.notifyCommandChanged(f)}),g.closed.connect(()=>{e.isDisposed||(e.activate(),e.removeClass(S))}),g.disposed.connect(()=>{e.isDisposed||(e.activate(),e.removeClass(S)),l.delete(i),[o.findNext,o.findPrevious,o.end,o.toggleSearchInSelection].forEach(f=>{t.commands.notifyCommandChanged(f)})}),e.disposed.connect(()=>{g.dispose(),m.dispose(),a.dispose(),x.dispose()}),r=g}return r.isAttached||(A.attach(r,e.node),e.addClass(S),e instanceof j&&(r.node.style.top=`${e.toolbar.node.getBoundingClientRect().height+e.contentHeader.node.getBoundingClientRect().height}px`),r.model.searchExpression&&r.model.refresh()),r};return t.commands.addCommand(o.search,{label:d.__("Find…"),isEnabled:b,describedBy:{args:{type:"object",properties:{searchText:{type:"string",description:d.__("The text to search for")}}}},execute:async e=>{const i=y(t.shell.currentWidget);if(i){const r=e.searchText;r?i.setSearchText(r):i.setSearchText(i.model.suggestedInitialQuery);const a=i.model.selectionState;let m=!1;switch(_){case"multiple-selected":m=a==="multiple";break;case"any-selected":m=a==="multiple"||a==="single";break}m&&await i.model.setFilter("selection",!0),i.focusSearchInput()}}}),t.commands.addCommand(o.searchAndReplace,{label:d.__("Find and Replace…"),isEnabled:b,describedBy:{args:{type:"object",properties:{searchText:{type:"string",description:d.__("The text to search for")},replaceText:{type:"string",description:d.__("The text to replace with")}}}},execute:e=>{const i=y(t.shell.currentWidget);if(i){const r=e.searchText;r?i.setSearchText(r):i.setSearchText(i.model.suggestedInitialQuery);const a=e.replaceText;a&&i.setReplaceText(a),i.showReplace(),i.focusSearchInput()}}}),t.commands.addCommand(o.findNext,{label:d.__("Find Next"),isEnabled:()=>!!t.shell.currentWidget&&l.has(t.shell.currentWidget.id),describedBy:{args:{type:"object",properties:{}}},execute:async()=>{var e;const i=t.shell.currentWidget;i&&await((e=l.get(i.id))===null||e===void 0?void 0:e.model.highlightNext())}}),t.commands.addCommand(o.findPrevious,{label:d.__("Find Previous"),isEnabled:()=>!!t.shell.currentWidget&&l.has(t.shell.currentWidget.id),describedBy:{args:{type:"object",properties:{}}},execute:async()=>{var e;const i=t.shell.currentWidget;i&&await((e=l.get(i.id))===null||e===void 0?void 0:e.model.highlightPrevious())}}),t.commands.addCommand(o.end,{label:d.__("End Search"),isEnabled:()=>!!t.shell.currentWidget&&l.has(t.shell.currentWidget.id),describedBy:{args:{type:"object",properties:{}}},execute:async()=>{var e;const i=t.shell.currentWidget;i&&((e=l.get(i.id))===null||e===void 0||e.close())}}),t.commands.addCommand(o.toggleSearchInSelection,{label:d.__("Search in Selection"),isEnabled:()=>!!t.shell.currentWidget&&l.has(t.shell.currentWidget.id)&&"selection"in l.get(t.shell.currentWidget.id).model.filtersDefinition,describedBy:{args:{type:"object",properties:{}}},execute:async()=>{var e;const i=t.shell.currentWidget;if(!i)return;const r=(e=l.get(i.id))===null||e===void 0?void 0:e.model;if(!r)return;const a=r.filters.selection;return r.setFilter("selection",!a)}}),(s=t.shell.currentChanged)===null||s===void 0||s.connect(()=>{Object.values(o).forEach(e=>{t.commands.notifyCommandChanged(e)})}),c&&[o.search,o.findNext,o.findPrevious,o.end,o.toggleSearchInSelection].forEach(e=>{c.addItem({command:e,category:d.__("Main Area")})}),p}},Le=[W,F];export{Le as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{cT as C,cU as F,cV as I,cW as S,cX as W,ac as O,ag as P,aW as A,J as E,ak as H,cY as D,b_ as R,a9 as j,c6 as B,cZ as V,c_ as q,c$ as L,ai as N,d0 as U,cy as z}from"../datalayer-app-main.js";import{f as Y,I as $}from"./index-
|
|
1
|
+
import{cT as C,cU as F,cV as I,cW as S,cX as W,ac as O,ag as P,aW as A,J as E,ak as H,cY as D,b_ as R,a9 as j,c6 as B,cZ as V,c_ as q,c$ as L,ai as N,d0 as U,cy as z}from"../datalayer-app-main.js";import{f as Y,I as $}from"./index-BN8Bbau-.js";import{I as G}from"./tokens-BHLmeqjP.js";import{a as J,C as T}from"./index-CFP9psRB.js";import{T as K,a as X}from"./model-BziAhKNp.js";import"./Output-no9rnFJ7.js";import"./index-DSN70XMH.js";import"./hoverbox-CStlKQWE.js";import"./index-S4sn4R3i.js";import"./color-CG7_7V2-.js";import"./isEqual-g-jK7vY0.js";import"./defaultLocale-5voVPcsN.js";import"./index-DbMBnR4l.js";import"./KebabHorizontalIcon-CXDXtkuL.js";import"./PaintbrushIcon-CLU8RilX.js";import"./index-BJhxZF_K.js";import"./RestartIcon-Ca6_HoK0.js";import"./CellSidebarExtension-B-73cmcQ.js";import"./NotebookSkeleton-CI7ovjNW.js";import"./Avatar-9MpXENSs.js";import"./renderer-DKKfWkWv.js";import"./SquareIcon-e3ygcjpv.js";import"./SortAscIcon-CVKVWIWQ.js";import"./url-DuKx0yk0.js";/* empty css */import"./index-Dro44tIm.js";/* empty css *//* empty css */import"./index-DsG9xhMj.js";/* empty css */import"./index-CNU-WVhQ.js";import"./index--OLIX362.js";import"./index-DYGslHkf.js";import"./index-BSRVX3UN.js";import"./index-BH2OX5l8.js";import"./index-C3vDfO5_.js";import"./index-Ko8lxXFd.js";import"./index-CB9u17_J.js";import"./index-BUVtc_FV.js";import"./ArrowLeftIcon-Y3PTljcl.js";import"./SkubbleIcon-tlg17jBG.js";import"./usePrimerThemeBridge-CoHussa9.js";import"./index-Dobs-OKl.js";import"./KernelVariables-CS6h5HyK.js";import"./index-BvgsWH_d.js";import"./SortDescIcon-CS4EzHeS.js";import"./NotebookToolbar-rtMQZWHQ.js";import"./RepoPushIcon-Cm8g9NuL.js";import"./Toolbar-CGQDY041.js";import"./sessions-BRALW9Yv.js";import"./tokens-DTIgYcNS.js";import"./drivecontents-CxwZz_5W.js";import"./kernel-BI-BLP-K.js";class Z extends X{constructor(e,r,t){super(e,t),this.parser=r}get documentType(){return"markdown-viewer"}get isAlwaysActive(){return!0}get supportedOptions(){return["maximalDepth","numberingH1","numberHeaders"]}async getHeadings(){const e=this.widget.context.model.toString(),r=await S(e,this.parser),t=W(r,{...this.configuration,baseNumbering:1});return Promise.resolve(t)}}class Q extends K{constructor(e,r,t){super(e),this.parser=r,this.sanitizer=t}_createNew(e,r){const t=new Z(e,this.parser,r);let o=new WeakMap;const l=(c,m)=>{if(m){const a=o.get(m);if(a){const u=e.content.node.getBoundingClientRect(),p=a.getBoundingClientRect();(p.top>u.bottom||p.bottom<u.top)&&a.scrollIntoView({block:"center"})}else console.warn("Heading element not found for heading",m,"in widget",e)}},s=()=>{this.parser&&(C(e.content.node),o=new WeakMap,t.headings.forEach(async c=>{var m,a;const u=await F(this.parser,c.raw,c.level,this.sanitizer);if(!u)return;const p=(m=this.sanitizer.allowNamedProperties)!==null&&m!==void 0&&m?"id":"data-jupyter-id",w=`h${c.level}[${p}="${CSS.escape(u)}"]`;o.set(c,I(e.content.node,w,(a=c.prefix)!==null&&a!==void 0?a:""))}))};return e.content.ready.then(()=>{s(),e.content.rendered.connect(s),t.activeHeadingChanged.connect(l),t.headingsChanged.connect(s),e.disposed.connect(()=>{e.content.rendered.disconnect(s),t.activeHeadingChanged.disconnect(l),t.headingsChanged.disconnect(s)})}),t}}const ee=new O("@jupyterlab/markdownviewer:IMarkdownViewerTracker",`A widget tracker for markdown
|
|
2
2
|
document viewers. Use this if you want to iterate over and interact with rendered markdown documents.`),te="jp-MarkdownViewer",x="text/markdown";class f extends P{constructor(e){super(),this._config={...f.defaultConfig},this._fragment="",this._ready=new A,this._isRendering=!1,this._renderRequested=!1,this._rendered=new E(this),this.context=e.context,this.translator=e.translator||H,this._trans=this.translator.load("jupyterlab"),this.renderer=e.renderer,this.node.tabIndex=0,this.addClass(te),(this.layout=new D).addWidget(this.renderer),this.context.ready.then(async()=>{await this._render(),this._monitor=new R.ActivityMonitor({signal:this.context.model.contentChanged,timeout:this._config.renderTimeout}),this._monitor.activityStopped.connect(this.update,this),this._ready.resolve(void 0)})}get ready(){return this._ready.promise}get rendered(){return this._rendered}setFragment(e){this._fragment=e,this.update()}setOption(e,r){if(this._config[e]===r)return;this._config[e]=r;const{style:t}=this.renderer.node;switch(e){case"fontFamily":t.setProperty("font-family",r);break;case"fontSize":t.setProperty("font-size",r?r+"px":null);break;case"hideFrontMatter":this.update();break;case"lineHeight":t.setProperty("line-height",r?r.toString():null);break;case"lineWidth":{const o=r?`calc(50% - ${r/2}ch)`:null;t.setProperty("padding-left",o),t.setProperty("padding-right",o);break}case"renderTimeout":this._monitor&&(this._monitor.timeout=r);break}}dispose(){this.isDisposed||(this._monitor&&this._monitor.dispose(),this._monitor=null,super.dispose())}onUpdateRequest(e){this.context.isReady&&!this.isDisposed&&(this._render(),this._fragment="")}onActivateRequest(e){this.node.focus()}async _render(){if(this.isDisposed)return;if(this._isRendering){this._renderRequested=!0;return}this._renderRequested=!1;const{context:e}=this,{model:r}=e,t=r.toString(),o={};o[x]=this._config.hideFrontMatter?_.removeFrontMatter(t):t;const l=new j({data:o,metadata:{fragment:this._fragment}});try{if(this._isRendering=!0,await this.renderer.renderModel(l),this._isRendering=!1,this._renderRequested)return this._render();this._rendered.emit()}catch(s){requestAnimationFrame(()=>{this.dispose()}),B(this._trans.__("Renderer Failure: %1",e.path),s)}}}(function(d){d.defaultConfig={fontFamily:null,fontSize:null,lineHeight:null,lineWidth:null,hideFrontMatter:!0,renderTimeout:1e3}})(f||(f={}));class re extends q{setFragment(e){this.content.setFragment(e)}}class ne extends V{constructor(e){super(_.createRegistryOptions(e)),this._fileType=e.primaryFileType,this._rendermime=e.rendermime}createNewWidget(e){var r,t,o,l,s;const m=this._rendermime.clone({resolver:e.urlResolver}).createRenderer(x),a=new f({context:e,renderer:m});return a.title.icon=(r=this._fileType)===null||r===void 0?void 0:r.icon,a.title.iconClass=(o=(t=this._fileType)===null||t===void 0?void 0:t.iconClass)!==null&&o!==void 0?o:"",a.title.iconLabel=(s=(l=this._fileType)===null||l===void 0?void 0:l.iconLabel)!==null&&s!==void 0?s:"",a.title.caption=this.label,new re({content:a,context:e})}}var _;(function(d){function e(t){return{...t,readOnly:!0}}d.createRegistryOptions=e;function r(t){const o=/^---\n[^]*?\n(---|...)\n/,l=t.match(o);if(!l)return t;const{length:s}=l[0];return t.slice(s)}d.removeFrontMatter=r})(_||(_={}));var g;(function(d){d.markdownPreview="markdownviewer:open",d.markdownEditor="markdownviewer:edit",d.trust="markdownviewer:trust"})(g||(g={}));const v="Markdown Preview",ie={activate:oe,id:"@jupyterlab/markdownviewer-extension:plugin",description:"Adds markdown file viewer and provides its tracker.",provides:ee,requires:[$,N],optional:[Y,G,L,J],autoStart:!0};function oe(d,e,r,t,o,l,s){const c=r.load("jupyterlab"),{commands:m,docRegistry:a}=d;e.addFactory(U);const u="markdownviewer-widget",p=new z({namespace:u});let w={...f.defaultConfig};function k(i){Object.keys(w).forEach(n=>{var h;i.setOption(n,(h=w[n])!==null&&h!==void 0?h:null)})}if(o){const i=n=>{w=n.composite,p.forEach(h=>{k(h.content)})};o.load(ie.id).then(n=>{n.changed.connect(()=>{i(n)}),i(n)}).catch(n=>{console.error(n.message)})}const b=new ne({rendermime:e,name:v,label:c.__("Markdown Preview"),primaryFileType:a.getFileType("markdown"),fileTypes:["markdown"],defaultRendered:["markdown"]});return b.widgetCreated.connect((i,n)=>{n.context.pathChanged.connect(()=>{p.save(n)}),k(n.content),n.content.node.setAttribute("data-trust-command",g.trust),p.add(n)}),a.addWidgetFactory(b),t&&t.restore(p,{command:"docmanager:open",args:i=>({path:i.context.path,factory:v}),name:i=>i.context.path}),m.addCommand(g.markdownPreview,{label:c.__("Markdown Preview"),execute:i=>{const n=i.path;if(typeof n=="string")return m.execute("docmanager:open",{path:n,factory:v,options:i.options})},describedBy:{args:{type:"object",properties:{path:{type:"string",description:c.__("The path to the markdown file to preview")},options:{type:"object",description:c.__("Options for opening the preview")}},required:["path"]}}}),m.addCommand(g.markdownEditor,{execute:()=>{const i=p.currentWidget;if(!i)return;const n=i.context.path;return m.execute("docmanager:open",{path:n,factory:"Editor",options:{mode:"split-right"}})},isVisible:()=>{const i=p.currentWidget;return i&&R.PathExt.extname(i.context.path)===".md"||!1},label:c.__("Show Markdown Editor"),describedBy:{args:{type:"object",properties:{}}}}),m.addCommand(g.trust,{label:c.__("Trust Markdown Preview"),execute:i=>{var n;const h=i[T.TRUST_BOUNDARY_ID_ARG],y=typeof h=="string"?(n=p.find(M=>M.content.node.id===h))!==null&&n!==void 0?n:null:p.currentWidget;return y&&!y.isDisposed?(y.content.node.classList.add("jp-mod-trusted"),d.commandLinker.markTrusted(y.content.node),{trusted:!0}):{trusted:!1}},describedBy:{args:{type:"object",properties:{[T.TRUST_BOUNDARY_ID_ARG]:{type:"string",description:c.__("The Markdown preview trust boundary ID")}}}}}),l&&l.add(new Q(p,e.markdownParser,s??e.sanitizer)),p}export{ie as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as ue,t as rt,T as at,p as de,b as Ve,f as Ue,I as dt,j as ct,a as qe,d as ut,C as Ee,g as Ne}from"./index-CFP9psRB.js";import{r as H,ha as ht,c4 as pt,v as A,ag as Z,c1 as ne,ak as O,gN as gt,dH as bt,gE as mt,hb as Ct,an as $e,dN as vt,h3 as ft,dL as _t,cv as Q,c8 as yt,hc as _,cI as Je,cD as De,cJ as ze,gc as Ge,gd as Ye,dK as xe,am as xt,ci as Xe,ch as ve,c2 as we,hd as wt,he as kt,h5 as St,b$ as ke,l as Y,aW as At,gF as Mt,J as Tt,ah as pe,gS as G,hf as he,af as ie,hg as Ce,dE as Oe,hh as Bt,hi as Et,cV as je,cT as Re,hj as le,cX as Ie,hk as Pe,cU as Nt,hl as Ot,hm as jt,ac as Qe,hn as Rt,ho as It,dJ as Pt,ai as F,du as ge,hp as fe,cx as Lt,dC as Wt,c$ as Ht,hq as Ft,hr as se,hs as Ze,d7 as Kt,b_ as Vt,aj as Ut,cy as qt,ca as $t,gQ as Jt,ht as Dt,cN as zt,cQ as Gt,hu as Yt,hv as Xt,hw as Qt,da as Zt,db as eo,cS as to,aV as oo,ee as no}from"../datalayer-app-main.js";import{b as io,I as et}from"./token-BRjncM66.js";import{ToolbarItems as lo}from"./index-DLimRfHQ.js";import{I as so}from"./index-Dv_XGY6Q.js";import{I as Se}from"./tokens-BHMD_ju9.js";import{a as tt,I,b as ot,c as ro}from"./tokens-CydTkiyv.js";import{I as ao,a as nt}from"./tokens-BvmYCqiu.js";import{I as co}from"./tokens-CBD7cd6p.js";import{f as it,e as uo,c as ho,I as po,b as go}from"./index-CyQgE_Es.js";import{I as lt}from"./tokens-D1_9ZFxB.js";import{I as be}from"./tokens-BHLmeqjP.js";import{a as Ae}from"./tokens-_fLcuFXz.js";import{I as bo}from"./tokens-CENaHAHm.js";import{I as mo}from"./index-DSN70XMH.js";import{I as Co}from"./tokens-DXLxGbDM.js";import{W as vo,u as Le,V as fo,I as _o,a as yo,b as xo,c as wo}from"./document-Dluvp7zl.js";import{b as ko,c as So,d as Ao}from"./CellSidebarExtension-CDnzN9Cb.js";import{T as Mo,a as To}from"./model-BziAhKNp.js";import{C as We}from"./celltoolbartracker-DcYHi8Du.js";import"./hoverbox-CStlKQWE.js";import"./Output-BWClePP-.js";import"./index-DyVR0igi.js";import"./color-CG7_7V2-.js";import"./isEqual-Cwjr2skl.js";import"./defaultLocale-5voVPcsN.js";import"./index-DbMBnR4l.js";import"./KebabHorizontalIcon-CXDXtkuL.js";import"./PaintbrushIcon-CLU8RilX.js";import"./index-BJhxZF_K.js";import"./RestartIcon-Ca6_HoK0.js";import"./NotebookSkeleton-CI7ovjNW.js";import"./Avatar-9MpXENSs.js";import"./renderer-Dy4lZ1KZ.js";import"./SquareIcon-e3ygcjpv.js";import"./SortAscIcon-CVKVWIWQ.js";import"./url-DuKx0yk0.js";/* empty css */import"./index-Dro44tIm.js";/* empty css *//* empty css */import"./index-DsG9xhMj.js";/* empty css */import"./index-CNU-WVhQ.js";import"./index--OLIX362.js";import"./index-DYGslHkf.js";import"./index-BSRVX3UN.js";import"./index-BH2OX5l8.js";import"./index-C3vDfO5_.js";import"./index-Ko8lxXFd.js";import"./index-CB9u17_J.js";import"./index-BUVtc_FV.js";import"./ArrowLeftIcon-Y3PTljcl.js";import"./SkubbleIcon-tlg17jBG.js";import"./usePrimerThemeBridge-CoHussa9.js";import"./index-Dobs-OKl.js";import"./KernelVariables-CKIqy599.js";import"./index-BvgsWH_d.js";import"./SortDescIcon-CS4EzHeS.js";import"./NotebookToolbar-rtMQZWHQ.js";import"./RepoPushIcon-Cm8g9NuL.js";import"./Toolbar-CGQDY041.js";import"./sessions-BRALW9Yv.js";import"./tokens-DTIgYcNS.js";import"./drivecontents-CxwZz_5W.js";import"./kernel-BI-BLP-K.js";const Bo="jp-DefaultStyle",Eo="jp-HTMLSelect";class No extends H.Component{render(){const{className:e,defaultStyle:i=!0,disabled:a,elementRef:s,iconProps:l,icon:p=ht,options:n=[],...c}=this.props,d=pt(Eo,{[Bo]:i},e),g=b=>{b.stopPropagation()},m=n.map(b=>{const f=typeof b=="object"?b:{value:b};return H.createElement("option",{...f,key:f.value},f.label||f.value)});return H.createElement("div",{className:d},H.createElement("select",{onFocus:g,disabled:a,ref:s,...c,multiple:!1},m,c.children),H.createElement(p.react,{tag:"span",stylesheet:"select",right:"4px",top:"4px",...l}))}}function Oo(r){const i=a=>{const s=Math.max(a*3.6,.1),l=s*Math.PI/180,p=Math.sin(l)*104,n=Math.cos(l)*-104;return"M 0 0 v -104 A 104 104 1 "+(s<180?1:0)+" 0 "+p.toFixed(4)+" "+n.toFixed(4)+" z"};return A.createElement("div",{className:"jp-Statusbar-ProgressCircle",role:"progressbar","aria-label":r.label||"Unlabelled progress circle","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r.progress,onClick:r.onClick},A.createElement("svg",{viewBox:"0 0 250 250"},A.createElement("circle",{cx:"125",cy:"125",r:"104",stroke:"var(--jp-inverse-layout-color3)",strokeWidth:"20",fill:"none"}),A.createElement("path",{className:"jp-Statusbar-ProgressCirclePath",transform:"translate(125,125) scale(.9)",d:i(r.progress),fill:"var(--jp-inverse-layout-color3)"})))}const jo="jp-JSONEditor",ce="jp-mod-error",Ro="jp-JSONEditor-host",Io="jp-JSONEditor-header";class Po extends Z{constructor(e){super(),this._dataDirty=!1,this._inputDirty=!1,this._source=null,this._originalValue=ne.emptyObject,this._changeGuard=!1,this.translator=e.translator||O,this._trans=this.translator.load("jupyterlab"),this.addClass(jo),this.headerNode=document.createElement("div"),this.headerNode.className=Io,this.revertButtonNode=gt.element({tag:"span",title:this._trans.__("Revert changes to data")}),this.commitButtonNode=bt.element({tag:"span",title:this._trans.__("Commit changes to data"),marginLeft:"8px"}),this.editorHostNode=document.createElement("div"),this.editorHostNode.className=Ro,this.headerNode.appendChild(this.revertButtonNode),this.headerNode.appendChild(this.commitButtonNode),this.node.appendChild(this.headerNode),this.node.appendChild(this.editorHostNode);const i=new mt.Model({mimeType:"application/json"});i.sharedModel.changed.connect(this._onModelChanged,this),this.model=i,this.editor=e.editorFactory({host:this.editorHostNode,model:i,config:{readOnly:!0}})}get source(){return this._source}set source(e){this._source!==e&&(this._source&&this._source.changed.disconnect(this._onSourceChanged,this),this._source=e,this.editor.setOption("readOnly",e===null),e&&e.changed.connect(this._onSourceChanged,this),this._setValue())}get isDirty(){return this._dataDirty||this._inputDirty}dispose(){var e;this.isDisposed||((e=this.source)===null||e===void 0||e.dispose(),this.model.dispose(),this.editor.dispose(),super.dispose())}handleEvent(e){switch(e.type){case"blur":this._evtBlur(e);break;case"click":this._evtClick(e);break}}onAfterAttach(e){const i=this.editorHostNode;i.addEventListener("blur",this,!0),i.addEventListener("click",this,!0),this.revertButtonNode.hidden=!0,this.commitButtonNode.hidden=!0,this.headerNode.addEventListener("click",this)}onBeforeDetach(e){const i=this.editorHostNode;i.removeEventListener("blur",this,!0),i.removeEventListener("click",this,!0),this.headerNode.removeEventListener("click",this)}_onSourceChanged(e,i){if(!this._changeGuard){if(this._inputDirty||this.editor.hasFocus()){this._dataDirty=!0;return}this._setValue()}}_onModelChanged(e,i){if(i.sourceChange){let a=!0;try{const s=JSON.parse(this.editor.model.sharedModel.getSource());this.removeClass(ce),this._inputDirty=!this._changeGuard&&!ne.deepEqual(s,this._originalValue)}catch{this.addClass(ce),this._inputDirty=!0,a=!1}this.revertButtonNode.hidden=!this._inputDirty,this.commitButtonNode.hidden=!a||!this._inputDirty}}_evtBlur(e){!this._inputDirty&&this._dataDirty&&this._setValue()}_evtClick(e){const i=e.target;this.revertButtonNode.contains(i)?this._setValue():this.commitButtonNode.contains(i)?!this.commitButtonNode.hidden&&!this.hasClass(ce)&&(this._changeGuard=!0,this._mergeContent(),this._changeGuard=!1,this._setValue()):this.editorHostNode.contains(i)&&this.editor.focus()}_mergeContent(){const e=this.editor.model,i=this._originalValue,a=JSON.parse(e.sharedModel.getSource()),s=this.source;if(s){for(const l in a)ne.deepEqual(a[l],i[l]||null)||s.set(l,a[l]);for(const l in i)l in a||s.delete(l)}}_setValue(){this._dataDirty=!1,this._inputDirty=!1,this.revertButtonNode.hidden=!0,this.commitButtonNode.hidden=!0,this.removeClass(ce);const e=this.editor.model,i=this._source?this._source.toJSON():{};if(this._changeGuard=!0,i===void 0)e.sharedModel.setSource(this._trans.__("No data!")),this._originalValue=ne.emptyObject;else{const a=JSON.stringify(i,null,4);e.sharedModel.setSource(a),this._originalValue=i,a.length>1&&a[0]==="{"&&this.editor.setCursorPosition({line:0,column:1})}this._changeGuard=!1,this.commitButtonNode.hidden=!0,this.revertButtonNode.hidden=!0}}const Lo="jp-Notebook-toolbarCellType",Wo="jp-Notebook-toolbarCellTypeDropdown";var _e;(function(r){function e(g,m){const b=(m||O).load("jupyterlab");function f(){if(g.context.model.readOnly)return Xe({title:b.__("Cannot Save"),body:b.__("Document is read-only"),buttons:[ve.okButton()]});g.context.save().then(()=>{if(!g.isDisposed)return g.context.createCheckpoint()})}return Ct($e.create(H.createElement(vt,{signal:g.context.fileChanged},()=>H.createElement(ft,{icon:_t,onClick:f,tooltip:b.__("Save the notebook contents and create checkpoint"),enabled:!!(g&&g.context&&g.context.contentsModel&&g.context.contentsModel.writable)}))))}r.createSaveButton=e;function i(g,m){const b=(m||O).load("jupyterlab");return new Q({icon:yt,onClick:()=>{_.insertBelow(g.content)},tooltip:b.__("Insert a cell below")})}r.createInsertButton=i;function a(g,m,b){const f=(m||O).load("jupyterlab");return new Q({icon:Je,onClick:async()=>{b?.get("useSystemClipboardForCells").composite?await _.cutToSystemClipboard(g.content):_.cut(g.content)},tooltip:f.__("Cut the selected cells")})}r.createCutButton=a;function s(g,m,b){const f=(m||O).load("jupyterlab");return new Q({icon:De,onClick:async()=>{b?.get("useSystemClipboardForCells").composite?await _.copyToSystemClipboard(g.content):_.copy(g.content)},tooltip:f.__("Copy the selected cells")})}r.createCopyButton=s;function l(g,m,b){const f=(m||O).load("jupyterlab");return new Q({icon:ze,onClick:async()=>{b?.get("useSystemClipboardForCells").composite?await _.pasteFromSystemClipboard(g.content):_.paste(g.content)},tooltip:f.__("Paste cells from the clipboard")})}r.createPasteButton=l;function p(g,m,b){const f=(b??O).load("jupyterlab");return new Q({icon:Ge,onClick:()=>{_.runAndAdvance(g.content,g.sessionContext,m,b)},tooltip:f.__("Run the selected cells and advance")})}r.createRunButton=p;function n(g,m,b){const f=(b??O).load("jupyterlab");return new Q({icon:Ye,onClick:()=>{const x=m??new xe({translator:b});x.restart(g.sessionContext).then(o=>(o&&_.runAll(g.content,g.sessionContext,x,b),o))},tooltip:f.__("Restart the kernel, then re-run the whole notebook")})}r.createRestartRunAllButton=n;function c(g,m){return new Ho(g.content,m)}r.createCellTypeItem=c;function d(g,m,b,f){return[{name:"save",widget:e(g,b)},{name:"insert",widget:i(g,b)},{name:"cut",widget:a(g,b,f)},{name:"copy",widget:s(g,b,f)},{name:"paste",widget:l(g,b,f)},{name:"run",widget:p(g,m,b)},{name:"interrupt",widget:ue.createInterruptButton(g.sessionContext,b)},{name:"restart",widget:ue.createRestartButton(g.sessionContext,m,b)},{name:"restart-and-run",widget:n(g,m,b)},{name:"cellType",widget:c(g,b)},{name:"spacer",widget:xt.createSpacerItem()},{name:"kernelName",widget:ue.createKernelNameItem(g.sessionContext,m,b)}]}r.getDefaultItems=d})(_e||(_e={}));class Ho extends $e{constructor(e,i){super(),this.handleChange=a=>{a.target.value!=="-"&&(_.changeCellType(this._notebook,a.target.value),this._notebook.activate())},this.handleKeyDown=a=>{a.key==="Enter"&&this._notebook.activate()},this._trans=(i||O).load("jupyterlab"),this.addClass(Lo),this._notebook=e,e.model&&this.update(),e.activeCellChanged.connect(this.update,this),e.selectionChanged.connect(this.update,this)}render(){let e="-";this._notebook.activeCell&&(e=this._notebook.activeCell.model.type);for(const i of this._notebook.widgets)if(this._notebook.isSelectedOrActive(i)&&i.model.type!==e){e="-";break}return H.createElement(No,{className:Wo,onChange:this.handleChange,onKeyDown:this.handleKeyDown,value:e,"aria-label":this._trans.__("Cell type"),title:this._trans.__("Select the cell type")},H.createElement("option",{value:"-"},"-"),H.createElement("option",{value:"code"},this._trans.__("Code")),H.createElement("option",{value:"markdown"},this._trans.__("Markdown")),H.createElement("option",{value:"raw"},this._trans.__("Raw")))}}function He(r){var e;const i=r.translator||O,a=rt(i),s=i.load("jupyterlab"),l=(e=r.displayOption.showJumpToCell)!==null&&e!==void 0?e:!1,p=r.state,n=r.displayOption.showOnToolBar,c=r.displayOption.showProgress,d=n?"down":"up",g=A.createElement("div",null),[m,b]=A.useState(!1);if(A.useEffect(()=>{if(m)return;const j=()=>{b(!0)};return _.executionScheduled.connect(j),()=>{_.executionScheduled.disconnect(j)}},[l,m]),!p)return g;const f=p.kernelStatus,x={alignSelf:"normal",height:"24px"},o=p.totalTime,t=p.scheduledCellNumber||0,u=p.scheduledCell.size||0,C=t-u;let w=100*C/t,B=c?"":"hidden";!c&&w<100&&(w=0);const M=j=>A.createElement(Oo,{progress:j,width:16,height:24,label:s.__("Kernel status")}),K=j=>s.__("Kernel status: %1",j),V=()=>{const j=r.notebook;_.selectLastRunCell(j),j.activeCell&&j.scrollToCell(j.activeCell)},R=(j,$,P)=>A.createElement("div",{className:"jp-Notebook-ExecutionIndicator",title:c?"":K(a[j]),"data-status":j},$,A.createElement("div",{className:`jp-Notebook-ExecutionIndicator-tooltip ${d} ${B}`},A.createElement("span",null," ",K(a[j])," "),P,l&&m&&A.createElement(St,{className:"jp-Notebook-ExecutionIndicator-jumpButton",onClick:V,title:s.__("Jump to current or last executed cell")},s.__("Jump to cell"))));if(p.kernelStatus==="connecting"||p.kernelStatus==="disconnected"||p.kernelStatus==="unknown")return R(f,A.createElement(wt.react,{...x}),[]);if(p.kernelStatus==="starting"||p.kernelStatus==="terminating"||p.kernelStatus==="restarting"||p.kernelStatus==="initializing")return R(f,A.createElement(kt.react,{...x}),[]);if(p.executionStatus==="busy")return R("busy",M(w),[A.createElement("span",{key:0},s.__("Executed %1/%2 cells",C,t)),A.createElement("span",{key:1},s._n("Elapsed time: %1 second","Elapsed time: %1 seconds",o))]);{const j=p.kernelStatus==="busy"?0:100,$=p.kernelStatus==="busy"||o===0?[]:[A.createElement("span",{key:0},s._n("Executed %1 cell","Executed %1 cells",t)),A.createElement("span",{key:1},s._n("Elapsed time: %1 second","Elapsed time: %1 seconds",o))];return R(p.kernelStatus,M(j),$)}}class X extends we{constructor(e,i=!0){super(new X.Model),this.translator=e||O,this.addClass("jp-mod-highlighted")}render(){if(this.model===null||!this.model.renderFlag)return A.createElement("div",null);{const e=this.model.currentNotebook;return e?A.createElement(He,{displayOption:this.model.displayOption,state:this.model.executionState(e),translator:this.translator,notebook:e}):A.createElement(He,{displayOption:this.model.displayOption,state:void 0,translator:this.translator,notebook:void 0})}}}(function(r){class e extends ke{constructor(){super(),this._notebookExecutionProgress=new WeakMap,this._displayOption={showOnToolBar:!0,showProgress:!0,showJumpToCell:!1},this._renderFlag=!0}attachNotebook(l){var p,n,c,d;if(l&&l.content&&l.context){const g=l.content,m=l.context;if(this._currentNotebook=g,!this._notebookExecutionProgress.has(g)){this._notebookExecutionProgress.set(g,{executionStatus:"idle",kernelStatus:"idle",totalTime:0,interval:0,timeout:0,scheduledCell:new Set,scheduledCellNumber:0,needReset:!0});const b=this._notebookExecutionProgress.get(g),f=u=>{b&&(b.kernelStatus=u.kernelDisplayStatus),this.stateChanged.emit(void 0)};m.statusChanged.connect(f,this);const x=u=>{b&&(b.kernelStatus=u.kernelDisplayStatus),this.stateChanged.emit(void 0)};m.connectionStatusChanged.connect(x,this),m.disposed.connect(u=>{u.connectionStatusChanged.disconnect(x,this),u.statusChanged.disconnect(f,this)});const o=(u,C)=>{const w=C.msg,B=w.header.msg_id;if(w.header.msg_type==="execute_request")this._cellScheduledCallback(g,B);else if(Y.KernelMessage.isStatusMsg(w)&&w.content.execution_state==="idle"){const M=w.parent_header.msg_id;this._cellExecutedCallback(g,M)}else Y.KernelMessage.isStatusMsg(w)&&w.content.execution_state==="restarting"?this._restartHandler(g):w.header.msg_type==="execute_input"&&this._startTimer(g)};(n=(p=m.session)===null||p===void 0?void 0:p.kernel)===null||n===void 0||n.anyMessage.connect(o),(d=(c=m.session)===null||c===void 0?void 0:c.kernel)===null||d===void 0||d.disposed.connect(u=>u.anyMessage.disconnect(o));const t=(u,C)=>{b&&(this._resetTime(b),this.stateChanged.emit(void 0),C.newValue&&C.newValue.anyMessage.connect(o))};m.kernelChanged.connect(t),m.disposed.connect(u=>u.kernelChanged.disconnect(t))}}}get currentNotebook(){return this._currentNotebook}get displayOption(){return this._displayOption}set displayOption(l){this._displayOption=l}executionState(l){return this._notebookExecutionProgress.get(l)}_scheduleSwitchToIdle(l){window.setTimeout(()=>{l.executionStatus="idle",clearInterval(l.interval),this.stateChanged.emit(void 0)},150),l.timeout=window.setTimeout(()=>{l.needReset=!0},1e3)}_cellExecutedCallback(l,p){const n=this._notebookExecutionProgress.get(l);n&&n.scheduledCell.has(p)&&(n.scheduledCell.delete(p),n.scheduledCell.size===0&&this._scheduleSwitchToIdle(n))}_restartHandler(l){const p=this._notebookExecutionProgress.get(l);p&&(p.scheduledCell.clear(),this._scheduleSwitchToIdle(p))}_startTimer(l){const p=this._notebookExecutionProgress.get(l);p&&(p.scheduledCell.size>0?p.executionStatus!=="busy"&&(p.executionStatus="busy",clearTimeout(p.timeout),this.stateChanged.emit(void 0),p.interval=window.setInterval(()=>{this._tick(p)},1e3)):this._resetTime(p))}_cellScheduledCallback(l,p){const n=this._notebookExecutionProgress.get(l);n&&!n.scheduledCell.has(p)&&(n.needReset&&this._resetTime(n),n.scheduledCell.add(p),n.scheduledCellNumber+=1)}_tick(l){l.totalTime+=1,this.stateChanged.emit(void 0)}_resetTime(l){l.totalTime=0,l.scheduledCellNumber=0,l.executionStatus="idle",l.scheduledCell=new Set,clearTimeout(l.timeout),clearInterval(l.interval),l.needReset=!1}get renderFlag(){return this._renderFlag}updateRenderOption(l){this.displayOption.showOnToolBar&&(l.showOnToolBar?this._renderFlag=!0:this._renderFlag=!1),this.displayOption.showProgress=l.showProgress,this.displayOption.showJumpToCell=l.showJumpToCell,this.stateChanged.emit(void 0)}}r.Model=e;function i(s,l,p){const n=new r(l);return n.model.displayOption={showOnToolBar:!0,showProgress:!0,showJumpToCell:!1},n.model.attachNotebook({content:s.content,context:s.sessionContext}),p&&p.then(c=>{const d=g=>{const m=a(g);m.showJumpToCell&&(g.get("recordTiming").composite||g.set("recordTiming",!0).catch(f=>{console.error("Failed to auto-enable recordTiming:",f.message)})),n.model.updateRenderOption(m)};c.changed.connect(d),d(c),n.disposed.connect(()=>{c.changed.disconnect(d)})}).catch(c=>{console.error(c.message)}),n}r.createExecutionIndicatorItem=i;function a(s){let l=!0,p=!0,n=!1;const c=s.get("kernelStatus").composite;return c&&(l=!c.showOnStatusBar,p=c.showProgress,n=c.showJumpToRecentExecutionButton),{showOnToolBar:l,showProgress:p,showJumpToCell:n}}r.getSettingValue=a})(X||(X={}));function Fo(r){const e=(r.translator||O).load("jupyterlab");return H.createElement(at,{source:e.__("Mode: %1",r.modeNames[r.notebookMode])})}class re extends we{constructor(e){super(new re.Model),this.translator=e||O,this._trans=this.translator.load("jupyterlab"),this._modeNames={command:this._trans.__("Command"),edit:this._trans.__("Edit")}}render(){return this.model?(this.node.title=this._trans.__("Notebook is in %1 mode",this._modeNames[this.model.notebookMode]),H.createElement(Fo,{notebookMode:this.model.notebookMode,translator:this.translator,modeNames:this._modeNames})):null}}(function(r){class e extends ke{constructor(){super(...arguments),this._onChanged=a=>{const s=this._notebookMode;this._notebook?this._notebookMode=a.mode:this._notebookMode="command",this._triggerChange(s,this._notebookMode)},this._notebookMode="command",this._notebook=null}get notebookMode(){return this._notebookMode}set notebook(a){const s=this._notebook;s!==null&&(s.stateChanged.disconnect(this._onChanged,this),s.activeCellChanged.disconnect(this._onChanged,this),s.modelContentChanged.disconnect(this._onChanged,this));const l=this._notebookMode;this._notebook=a,this._notebook===null?this._notebookMode="command":(this._notebookMode=this._notebook.mode,this._notebook.stateChanged.connect(this._onChanged,this),this._notebook.activeCellChanged.connect(this._onChanged,this),this._notebook.modelContentChanged.connect(this._onChanged,this)),this._triggerChange(l,this._notebookMode)}_triggerChange(a,s){a!==s&&this.stateChanged.emit(void 0)}}r.Model=e})(re||(re={}));class Ko extends vo{constructor(e,i){super(e,i),this.editorWidget=e,this.options=i,this._type="code",this._readyDelegate=new At,this._editorToCell=new Map,this.editor=e.content,this._cellToEditor=new WeakMap,this.isReady=this.isReady.bind(this),Promise.all([this.widget.context.sessionContext.ready,this.connectionManager.ready]).then(async()=>{await this.initOnceReady(),this._readyDelegate.resolve()}).catch(console.error)}get documentPath(){return this.widget.context.path}get mimeType(){var e;let i,a=this.language_info();return!a||!a.mimetype?i=this.widget.content.codeMimetype:i=a.mimetype,Array.isArray(i)?(e=i[0])!==null&&e!==void 0?e:Mt.defaultMimeType:i}get languageFileExtension(){let e=this.language_info();if(!(!e||!e.file_extension))return e.file_extension.replace(".","")}get wrapperElement(){return this.widget.node}get editors(){if(this.isDisposed)return[];let e=this.widget.content;return this._editorToCell.clear(),e.isDisposed?[]:e.widgets.map(i=>({ceEditor:this._getCellEditor(i),type:i.model.type,value:i.model.sharedModel.getSource()}))}get activeEditor(){return this.editor.activeCell?this._getCellEditor(this.editor.activeCell):void 0}get ready(){return this._readyDelegate.promise}getEditorIndexAt(e){let i=this._getCellAt(e);return this.widget.content.widgets.findIndex(s=>i===s)}getEditorIndex(e){let i=this._editorToCell.get(e);return this.editor.widgets.findIndex(a=>i===a)}getEditorWrapper(e){return this._editorToCell.get(e).node}async onKernelChanged(e,i){if(i.newValue)try{const a=this._languageInfo;await Le(this.isReady,-1),await this._updateLanguageInfo();const s=this._languageInfo;a?.name!=s.name||a?.mimetype!=s?.mimetype||a?.file_extension!=s?.file_extension?(console.log(`Changed to ${this._languageInfo.name} kernel, reconnecting`),this.reloadConnection()):console.log("Keeping old LSP connection as the new kernel uses the same language")}catch(a){console.warn(a),this.reloadConnection()}}dispose(){this.isDisposed||(this.widget.context.sessionContext.kernelChanged.disconnect(this.onKernelChanged,this),this.widget.content.activeCellChanged.disconnect(this._activeCellChanged,this),super.dispose(),this._editorToCell.clear(),Tt.clearData(this))}isReady(){var e;return!this.widget.isDisposed&&this.widget.context.isReady&&this.widget.content.isVisible&&this.widget.content.widgets.length>0&&((e=this.widget.context.sessionContext.session)===null||e===void 0?void 0:e.kernel)!=null}async handleCellChange(e,i){let a=[],s=[];const l=this._type;if(i.type==="set"){let p=[],n=[];if(i.newValues.length===i.oldValues.length){for(let c=0;c<i.newValues.length;c++)i.oldValues[c].type===l&&i.newValues[c].type!==l?p.push(i.newValues[c]):i.oldValues[c].type!==l&&i.newValues[c].type===l&&n.push(i.newValues[c]);a=n,s=p}}else i.type=="add"&&(a=i.newValues.filter(p=>p.type===l));(s.length||a.length||i.type==="set"||i.type==="move"||i.type==="remove"||i.type==="clear")&&await this.updateDocuments();for(let p of a){let n=this.widget.content.widgets.find(c=>c.model.id===p.id);if(!n){console.warn(`Widget for added cell with ID: ${p.id} not found!`);continue}this._getCellEditor(n)}}createVirtualDocument(){return new fo({language:this.language,foreignCodeExtractors:this.options.foreignCodeExtractorsManager,path:this.documentPath,fileExtension:this.languageFileExtension,standalone:!1,hasLspSupportedFile:!1})}language_info(){return this._languageInfo}async initOnceReady(){await Le(this.isReady.bind(this),-1),await this._updateLanguageInfo(),this.initVirtual(),this.connectDocument(this.virtualDocument,!1).catch(console.warn),this.widget.context.sessionContext.kernelChanged.connect(this.onKernelChanged,this),this.widget.content.activeCellChanged.connect(this._activeCellChanged,this),this._connectModelSignals(this.widget),this.editor.modelChanged.connect(e=>{console.warn("Model changed, connecting cell change handler; this is not something we were expecting"),this._connectModelSignals(e)})}_connectModelSignals(e){e.model===null?console.warn(`Model is missing for notebook ${e}, cannot connect cell changed signal!`):e.model.cells.changed.connect(this.handleCellChange,this)}async _updateLanguageInfo(){var e,i,a,s;const l=(s=await((a=(i=(e=this.widget.context.sessionContext)===null||e===void 0?void 0:e.session)===null||i===void 0?void 0:i.kernel)===null||a===void 0?void 0:a.info))===null||s===void 0?void 0:s.language_info;if(l)this._languageInfo=l;else throw new Error("Language info update failed (no session, kernel, or info available)")}_activeCellChanged(e,i){!i||i.model.type!==this._type||this._activeEditorChanged.emit({editor:this._getCellEditor(i)})}_getCellAt(e){let i=this.virtualDocument.getEditorAtVirtualLine(e);return this._editorToCell.get(i)}_getCellEditor(e){if(!this._cellToEditor.has(e)){const i=Object.freeze({getEditor:()=>e.editor,ready:async()=>(await e.ready,e.editor),reveal:async()=>(await this.editor.scrollToCell(e),e.editor)});this._cellToEditor.set(e,i),this._editorToCell.set(i,e),e.disposed.connect(()=>{this._cellToEditor.delete(e),this._editorToCell.delete(i),this._editorRemoved.emit({editor:i})}),this._editorAdded.emit({editor:i})}return this._cellToEditor.get(e)}}class Vo extends Z{constructor(){super(),this._items=[],this.layout=new pe,this.addClass("jp-RankedPanel")}addWidget(e,i){const a={widget:e,rank:i},s=ie.upperBound(this._items,a,ye.itemCmp);ie.insert(this._items,s,a),this.layout.insertWidget(s,e)}onChildRemoved(e){const i=ie.findFirstIndex(this._items,a=>a.widget===e.child);i!==-1&&ie.removeAt(this._items,i)}}class q extends Z{constructor(e){super(),this.addClass("jp-NotebookTools"),this.translator=e.translator||O,this._tools=[],this.layout=new pe,this._tracker=e.tracker,this._tracker.currentChanged.connect(this._onActiveNotebookPanelChanged,this),this._tracker.activeCellChanged.connect(this._onActiveCellChanged,this),this._tracker.selectionChanged.connect(this._onSelectionChanged,this),this._onActiveNotebookPanelChanged(),this._onActiveCellChanged(),this._onSelectionChanged()}get activeCell(){return this._tracker.activeCell}get selectedCells(){const e=this._tracker.currentWidget;if(!e)return[];const i=e.content;return i.widgets.filter(a=>i.isSelectedOrActive(a))}get activeNotebookPanel(){return this._tracker.currentWidget}addItem(e){var i;const a=e.tool,s=(i=e.rank)!==null&&i!==void 0?i:100;let l;const p=this._tools.find(n=>n.section===e.section);if(p)l=p.panel;else throw new Error(`The section ${e.section} does not exist`);a.addClass("jp-NotebookTools-tool"),l.addWidget(a,s),a.notebookTools=this,G.sendMessage(a,q.ActiveNotebookPanelMessage),G.sendMessage(a,q.ActiveCellMessage)}addSection(e){var i;const a=e.sectionName,s=e.label||e.sectionName,l=e.tool;let p=(i=e.rank)!==null&&i!==void 0?i:null;const n=new Vo;if(n.title.label=s,l&&n.addWidget(l,0),this._tools.push({section:a,panel:n,rank:p}),p!=null)this.layout.insertWidget(p,new de({widget:n}));else{let c=null;const d=this.layout;for(let g=0;g<d.widgets.length;g++){let m=d.widgets[g];if(m instanceof de&&m.widget.id==="advancedToolsSection"){c=g;break}}c!==null?this.layout.insertWidget(c,new de({widget:n})):this.layout.addWidget(new de({widget:n}))}}_onActiveNotebookPanelChanged(){this._prevActiveNotebookModel&&!this._prevActiveNotebookModel.isDisposed&&this._prevActiveNotebookModel.metadataChanged.disconnect(this._onActiveNotebookPanelMetadataChanged,this);const e=this.activeNotebookPanel&&this.activeNotebookPanel.content?this.activeNotebookPanel.content.model:null;this._prevActiveNotebookModel=e,e&&e.metadataChanged.connect(this._onActiveNotebookPanelMetadataChanged,this);for(const i of this._toolChildren())G.sendMessage(i,q.ActiveNotebookPanelMessage)}_onActiveCellChanged(){this._prevActiveCell&&!this._prevActiveCell.isDisposed&&this._prevActiveCell.metadataChanged.disconnect(this._onActiveCellMetadataChanged,this);const e=this.activeCell?this.activeCell.model:null;this._prevActiveCell=e,e&&e.metadataChanged.connect(this._onActiveCellMetadataChanged,this);for(const i of this._toolChildren())G.sendMessage(i,q.ActiveCellMessage)}_onSelectionChanged(){for(const e of this._toolChildren())G.sendMessage(e,q.SelectionMessage)}_onActiveNotebookPanelMetadataChanged(e,i){const a=new he.ChangeMessage("activenotebookpanel-metadata-changed",{oldValue:void 0,newValue:void 0,...i});for(const s of this._toolChildren())G.sendMessage(s,a)}_onActiveCellMetadataChanged(e,i){const a=new he.ChangeMessage("activecell-metadata-changed",{newValue:void 0,oldValue:void 0,...i});for(const s of this._toolChildren())G.sendMessage(s,a)}*_toolChildren(){for(let e of this._tools)yield*e.panel.children()}}(function(r){r.ActiveNotebookPanelMessage=new Ce("activenotebookpanel-changed"),r.ActiveCellMessage=new Ce("activecell-changed"),r.SelectionMessage=new Ce("selection-changed");class e extends Z{dispose(){super.dispose(),this.notebookTools&&(this.notebookTools=null)}processMessage(s){switch(super.processMessage(s),s.type){case"activenotebookpanel-changed":this.onActiveNotebookPanelChanged(s);break;case"activecell-changed":this.onActiveCellChanged(s);break;case"selection-changed":this.onSelectionChanged(s);break;case"activecell-metadata-changed":this.onActiveCellMetadataChanged(s);break;case"activenotebookpanel-metadata-changed":this.onActiveNotebookPanelMetadataChanged(s);break}}onActiveNotebookPanelChanged(s){}onActiveCellChanged(s){}onSelectionChanged(s){}onActiveCellMetadataChanged(s){}onActiveNotebookPanelMetadataChanged(s){}}r.Tool=e;class i extends e{constructor(s){super();const{editorFactory:l}=s;this.addClass("jp-MetadataEditorTool");const p=this.layout=new pe;this._editorFactory=l,this._editorLabel=s.label||"Edit Metadata",this.createEditor();const n=new Z({node:document.createElement("label")});n.node.textContent=s.label||"Edit Metadata",p.addWidget(n),p.addWidget(this.editor)}get editor(){return this._editor}onActiveNotebookPanelChanged(s){this.editor.dispose(),this.notebookTools.activeNotebookPanel&&this.createEditor()}createEditor(){this._editor=new Po({editorFactory:this._editorFactory}),this.editor.title.label=this._editorLabel,this.layout.addWidget(this.editor)}}r.MetadataEditorTool=i})(q||(q={}));var ye;(function(r){function e(i,a){return i.rank-a.rank}r.itemCmp=e})(ye||(ye={}));const Uo=6;var W;(function(r){r[r.Idle=-1]="Idle",r[r.Error=-.5]="Error",r[r.Scheduled=0]="Scheduled",r[r.Running=1]="Running"})(W||(W={}));class qo extends To{constructor(e,i,a,s){super(e,s),this.parser=i,this.sanitizer=a,this.configMetadataMap={numberHeaders:["toc-autonumbering","toc/number_sections"],numberingH1:["!toc/skip_h1_title"],baseNumbering:["toc/base_numbering"]},this._runningCells=new Array,this._errorCells=new Array,this._cellToHeadingIndex=new WeakMap,e.context.ready.then(()=>{this.setConfiguration({})}),this.widget.context.model.metadataChanged.connect(this.onMetadataChanged,this),this.widget.content.activeCellChanged.connect(this.onActiveCellChanged,this),_.executionScheduled.connect(this.onExecutionScheduled,this),_.executed.connect(this.onExecuted,this),_.outputCleared.connect(this.onOutputCleared,this),this.headingsChanged.connect(this.onHeadingsChanged,this)}get documentType(){return"notebook"}get isAlwaysActive(){return!0}get supportedOptions(){return["baseNumbering","maximalDepth","numberingH1","numberHeaders","includeOutput","syncCollapseState"]}getCellHeadings(e){const i=new Array;let a=this._cellToHeadingIndex.get(e);if(a!==void 0){const s=this.headings[a];for(i.push(s);this.headings[a-1]&&this.headings[a-1].cellRef===s.cellRef;)a--,i.unshift(this.headings[a])}return i}dispose(){var e,i,a;this.isDisposed||(this.headingsChanged.disconnect(this.onHeadingsChanged,this),(i=(e=this.widget.context)===null||e===void 0?void 0:e.model)===null||i===void 0||i.metadataChanged.disconnect(this.onMetadataChanged,this),(a=this.widget.content)===null||a===void 0||a.activeCellChanged.disconnect(this.onActiveCellChanged,this),_.executionScheduled.disconnect(this.onExecutionScheduled,this),_.executed.disconnect(this.onExecuted,this),_.outputCleared.disconnect(this.onOutputCleared,this),this._runningCells.length=0,this._errorCells.length=0,super.dispose())}setConfiguration(e){const i=this.loadConfigurationFromMetadata();super.setConfiguration({...this.configuration,...i,...e})}toggleCollapse(e){super.toggleCollapse(e),this.updateRunningStatus(this.headings)}async getHeadings(){const e=this.widget.content.widgets,i=new Set(e),a=[],s=new Array,l=new WeakMap;for(let p=0;p<e.length;p++){const n=e[p];switch(n.model.type){case"code":{!this.configuration.syncCollapseState&&this.configuration.includeOutput&&a.push(...Ie(await n.getHeadings(),this.configuration,s).map(d=>({...d,cellRef:n,collapsed:!1,isRunning:W.Idle})));break}case"markdown":{const d=Ie(await n.getHeadings(),this.configuration,s).map((g,m)=>({...g,cellRef:n,collapsed:!1,isRunning:W.Idle}));if(this.configuration.syncCollapseState&&n.headingCollapsed){const g=Math.min(...d.map(b=>b.level)),m=d.find(b=>b.level===g);m.collapsed=n.headingCollapsed}a.push(...d);break}}a.length>0&&l.set(n,a.length-1)}return this._cellToHeadingIndex=l,this._runningCells=this._runningCells.filter(p=>i.has(p)),this._errorCells=this._errorCells.filter(p=>i.has(p)),this.updateRunningStatus(a),Promise.resolve(a)}isHeadingEqual(e,i){return super.isHeadingEqual(e,i)&&e.cellRef===i.cellRef&&e.isRunning===i.isRunning}loadConfigurationFromMetadata(){const e=this.widget.content.model,i={};if(e)for(const a in this.configMetadataMap){const s=this.configMetadataMap[a];for(const l of s){let p=l;const n=p[0]==="!";n&&(p=p.slice(1));const c=p.split("/");let d=e.getMetadata(c[0]);for(let g=1;g<c.length;g++)d=(d??{})[c[g]];d!==void 0&&(typeof d=="boolean"&&n&&(d=!d),i[a]=d)}}return i}onActiveCellChanged(e,i){const a=this.getCellHeadings(i)[0];this.setActiveHeading(a??null,!1)}onHeadingsChanged(){this.widget.content.activeCell&&this.onActiveCellChanged(this.widget.content,this.widget.content.activeCell)}onExecuted(e,i){this._runningCells.forEach((a,s)=>{var l;if(a===i.cell){this._runningCells.splice(s,1);const p=this._cellToHeadingIndex.get(a);if(p!==void 0){const n=this.headings[p];if(i.success||((l=i.error)===null||l===void 0?void 0:l.errorName)===void 0){n.isRunning=W.Idle;return}n.isRunning=W.Error,this._errorCells.includes(a)||this._errorCells.push(a)}}}),this.updateRunningStatus(this.headings),this.stateChanged.emit()}onExecutionScheduled(e,i){this._runningCells.includes(i.cell)||this._runningCells.push(i.cell),this._errorCells.forEach((a,s)=>{a===i.cell&&this._errorCells.splice(s,1)}),this.updateRunningStatus(this.headings),this.stateChanged.emit()}onOutputCleared(e,i){this._errorCells.forEach((a,s)=>{if(a===i.cell){this._errorCells.splice(s,1);const l=this._cellToHeadingIndex.get(a);if(l!==void 0){const p=this.headings[l];p.isRunning=W.Idle}}}),this.updateRunningStatus(this.headings),this.stateChanged.emit()}onMetadataChanged(){this.setConfiguration({})}updateRunningStatus(e){e.forEach(s=>{s.isRunning=W.Idle}),this._runningCells.forEach((s,l)=>{const p=this._cellToHeadingIndex.get(s);if(p!==void 0){const n=e[p];n.isRunning!==W.Running&&(n.isRunning=l>0?W.Scheduled:W.Running)}}),this._errorCells.forEach((s,l)=>{const p=this._cellToHeadingIndex.get(s);if(p!==void 0){const n=e[p];n.isRunning===W.Idle&&(n.isRunning=W.Error)}});let i=0;for(;i<e.length;){const s=e[i];if(i++,s.collapsed){const l=Math.max(s.isRunning,a(e,s.level));s.dataset={...s.dataset,"data-running":l.toString()}}else s.dataset={...s.dataset,"data-running":s.isRunning.toString()}}function a(s,l){let p=W.Idle;for(;i<s.length;){const n=s[i];if(n.dataset={...n.dataset,"data-running":n.isRunning.toString()},n.level>l)i++,p=Math.max(n.isRunning,p),n.collapsed&&(p=Math.max(p,a(s,n.level)),n.dataset={...n.dataset,"data-running":p.toString()});else break}return p}}}class $o extends Mo{constructor(e,i,a,s){super(e),this.parser=i,this.sanitizer=a,this.commands=s,this._scrollToTop=!0}get scrollToTop(){return this._scrollToTop}set scrollToTop(e){this._scrollToTop=e}_createNew(e,i){const a=new qo(e,this.parser,this.sanitizer,i);let s=new WeakMap;const l=(m,b)=>{if(b){const f=async u=>{if(!u.inViewport)return;const C=s.get(b);if(C)if(this.scrollToTop)C.scrollIntoView({block:"start"}),e.content.outerNode.scrollTop-=Uo;else{const w=e.content.node.getBoundingClientRect(),B=C.getBoundingClientRect();(B.top>w.bottom||B.bottom<w.top)&&C.scrollIntoView({block:"center"})}else console.debug("scrolling to heading: using fallback strategy"),await e.content.scrollToItem(e.content.activeCellIndex,this.scrollToTop?"start":void 0,0)},x=b.cellRef,t=e.content.widgets.indexOf(x);x.model.type=="markdown"&&e.content.mode!="command"&&(e.content.mode="command"),e.content.activeCellIndex=t,x.inViewport?f(x).catch(u=>{console.error(`Fail to scroll to cell to display the required heading (${u}).`)}):e.content.scrollToItem(t,this.scrollToTop?"start":void 0).then(()=>p(x)).then(()=>f(x)).catch(u=>{console.error(`Fail to scroll to cell to display the required heading (${u}).`)})}},p=m=>Promise.all(a.getCellHeadings(m).map(async b=>{var f,x,o;const t=await Jo(b,this.parser,this.sanitizer),u=(f=this.sanitizer.allowNamedProperties)!==null&&f!==void 0&&f?"id":"data-jupyter-id",C=t?`h${b.level}[${u}="${CSS.escape(t)}"]`:`h${b.level}`;b.outputIndex!==void 0?s.set(b,je(b.cellRef.outputArea.widgets[b.outputIndex].node,C,(x=b.prefix)!==null&&x!==void 0?x:"")):s.set(b,je(b.cellRef.node,C,(o=b.prefix)!==null&&o!==void 0?o:""))})).then(()=>{}),n=m=>{if(this.parser)return Re(e.content.node),s=new WeakMap,Promise.all(e.content.widgets.map(b=>p(b)))},c=(m,b)=>{var f,x,o,t;if(a.configuration.syncCollapseState)if(b!==null){const u=b.cellRef;u.headingCollapsed!==((f=b.collapsed)!==null&&f!==void 0?f:!1)&&(u.headingCollapsed=(x=b.collapsed)!==null&&x!==void 0?x:!1)}else{const u=(t=(o=a.headings[0])===null||o===void 0?void 0:o.collapsed)!==null&&t!==void 0?t:!1;e.content.widgets.forEach(C=>{C instanceof le&&C.headingInfo.level>=0&&(C.headingCollapsed=u)})}},d=(m,b)=>{if(a.configuration.syncCollapseState){const f=a.getCellHeadings(b)[0];f&&a.toggleCollapse({heading:f,collapsed:b.headingCollapsed})}},g=(m,b)=>{var f;b.inViewport?(f=p(b))===null||f===void 0||f.catch(console.warn):Re(b.node)};return e.context.ready.then(()=>{var m;(m=n())===null||m===void 0||m.catch(console.warn),a.activeHeadingChanged.connect(l),a.headingsChanged.connect(n),a.collapseChanged.connect(c),e.content.cellCollapsed.connect(d),e.content.cellInViewportChanged.connect(g),e.disposed.connect(()=>{a.activeHeadingChanged.disconnect(l),a.headingsChanged.disconnect(n),a.collapseChanged.disconnect(c),e.content.cellCollapsed.disconnect(d),e.content.cellInViewportChanged.disconnect(g)})}),a}getToolbarItems(e){return this.commands?[{name:"select-last-modified-back",widget:new Oe({commands:this.commands,id:"notebook:select-last-modified-cell",args:{toolbar:!0},icon:Bt,label:""})},{name:"select-last-modified-forward",widget:new Oe({commands:this.commands,id:"notebook:select-next-modified-cell",args:{toolbar:!0},icon:Et,label:""})}]:[]}}async function Jo(r,e,i){let a=null;return r.type===Pe.HeadingType.Markdown?a=await Nt(e,r.raw,r.level,i):r.type===Pe.HeadingType.HTML&&(a=r.id),a}const Do="jp-StatusItem-trust";function zo(r,e){e=e||O;const i=e.load("jupyterlab");return r.trustedCells===r.totalCells?i.__("Notebook trusted: %1 of %2 code cells trusted.",r.trustedCells,r.totalCells):r.activeCellTrusted?i.__("Active cell trusted: %1 of %2 code cells trusted.",r.trustedCells,r.totalCells):i.__("Notebook not trusted: %1 of %2 code cells trusted.",r.trustedCells,r.totalCells)}function Go(r){return r.allCellsTrusted?A.createElement(Ot.react,{top:"2px",stylesheet:"statusBar"}):A.createElement(jt.react,{top:"2px",stylesheet:"statusBar"})}class ae extends we{constructor(e){super(new ae.Model),this.translator=e||O,this.node.classList.add(Do)}render(){if(!this.model)return null;const e=zo(this.model,this.translator);return e!==this.node.title&&(this.node.title=e),A.createElement(Go,{allCellsTrusted:this.model.trustedCells===this.model.totalCells,activeCellTrusted:this.model.activeCellTrusted,totalCells:this.model.totalCells,trustedCells:this.model.trustedCells})}}(function(r){class e extends ke{constructor(){super(...arguments),this._trustedCells=0,this._totalCells=0,this._activeCellTrusted=!1,this._notebook=null}get trustedCells(){return this._trustedCells}get totalCells(){return this._totalCells}get activeCellTrusted(){return this._activeCellTrusted}get notebook(){return this._notebook}set notebook(a){const s=this._notebook;s!==null&&(s.activeCellChanged.disconnect(this._onActiveCellChanged,this),s.modelContentChanged.disconnect(this._onModelChanged,this));const l=this._getAllState();if(this._notebook=a,this._notebook===null)this._trustedCells=0,this._totalCells=0,this._activeCellTrusted=!1;else{this._notebook.activeCellChanged.connect(this._onActiveCellChanged,this),this._notebook.modelContentChanged.connect(this._onModelChanged,this),this._notebook.activeCell?this._activeCellTrusted=this._notebook.activeCell.model.trusted:this._activeCellTrusted=!1;const{total:p,trusted:n}=this._deriveCellTrustState(this._notebook.model);this._totalCells=p,this._trustedCells=n}this._triggerChange(l,this._getAllState())}_onModelChanged(a){const s=this._getAllState(),{total:l,trusted:p}=this._deriveCellTrustState(a.model);this._totalCells=l,this._trustedCells=p,this._triggerChange(s,this._getAllState())}_onActiveCellChanged(a,s){const l=this._getAllState();s?this._activeCellTrusted=s.model.trusted:this._activeCellTrusted=!1,this._triggerChange(l,this._getAllState())}_deriveCellTrustState(a){if(a===null)return{total:0,trusted:0};let s=0,l=0;for(const p of a.cells)p.type==="code"&&(s++,p.trusted&&l++);return{total:s,trusted:l}}_getAllState(){return[this._trustedCells,this._totalCells,this.activeCellTrusted]}_triggerChange(a,s){(a[0]!==s[0]||a[1]!==s[1]||a[2]!==s[2])&&this.stateChanged.emit(void 0)}}r.Model=e})(ae||(ae={}));const Yo=new Qe("@jupyterlab/metadataform:IMetadataFormProvider","A service to register new metadata editor widgets."),Xo={id:"@jupyterlab/notebook-extension:cell-executor",description:"Provides the notebook cell executor.",autoStart:!0,provides:tt,activate:()=>Object.freeze({runCell:Rt})},Qo=new Qe("@jupyterlab/logconsole:ILoggerRegistry","A service providing a logger infrastructure."),Zo={activate:en,id:"@jupyterlab/notebook-extension:log-output",description:"Adds cell outputs log to the application logger.",requires:[I],optional:[Qo],autoStart:!0};function en(r,e,i){if(!i)return;function a(s){function l(p,n,c){if(Y.KernelMessage.isDisplayDataMsg(p)||Y.KernelMessage.isStreamMsg(p)||Y.KernelMessage.isErrorMsg(p)||Y.KernelMessage.isExecuteResultMsg(p)){const d=i.getLogger(s.context.path);d.rendermime=s.content.rendermime;const g={...p.content,output_type:p.header.msg_type};let m=n;(Y.KernelMessage.isErrorMsg(p)||Y.KernelMessage.isStreamMsg(p)&&p.content.name==="stderr")&&(m=c),d.log({type:"output",data:g,level:m})}}s.context.sessionContext.iopubMessage.connect((p,n)=>l(n,"info","info")),s.context.sessionContext.unhandledMessage.connect((p,n)=>l(n,"warning","error"))}e.forEach(s=>a(s)),e.widgetAdded.connect((s,l)=>a(l))}const tn="jp-ActiveCellTool",on="jp-ActiveCellTool-Content",nn="jp-ActiveCellTool-CellContent";class ln extends q.Tool{constructor(e){super();const{languages:i}=e;this._tracker=e.tracker,this.addClass(tn),this.layout=new pe,this._inputPrompt=new It,this.layout.addWidget(this._inputPrompt);const a=document.createElement("div");a.classList.add(on);const s=a.appendChild(document.createElement("div")),l=s.appendChild(document.createElement("pre"));s.className=nn,this._editorEl=l,this.layout.addWidget(new Z({node:a}));const p=async()=>{var n,c;this._editorEl.innerHTML="",((n=this._cellModel)===null||n===void 0?void 0:n.type)==="code"?(this._inputPrompt.executionCount=`${(c=this._cellModel.executionCount)!==null&&c!==void 0?c:""}`,this._inputPrompt.show()):(this._inputPrompt.executionCount=null,this._inputPrompt.hide()),this._cellModel&&await i.highlight(this._cellModel.sharedModel.getSource().split(`
|
|
1
|
+
import{o as ue,t as rt,T as at,p as de,b as Ve,f as Ue,I as dt,j as ct,a as qe,d as ut,C as Ee,g as Ne}from"./index-CFP9psRB.js";import{r as H,ha as ht,c4 as pt,v as A,ag as Z,c1 as ne,ak as O,gN as gt,dH as bt,gE as mt,hb as Ct,an as $e,dN as vt,h3 as ft,dL as _t,cv as Q,c8 as yt,hc as _,cI as Je,cD as De,cJ as ze,eO as Ge,eP as Ye,dK as xe,am as xt,ci as Xe,ch as ve,c2 as we,hd as wt,he as kt,h5 as St,b$ as ke,l as Y,aW as At,gF as Mt,J as Tt,ah as pe,gS as G,hf as he,af as ie,hg as Ce,dE as Oe,hh as Bt,hi as Et,cV as je,cT as Re,hj as le,cX as Ie,hk as Pe,cU as Nt,hl as Ot,hm as jt,ac as Qe,hn as Rt,ho as It,dJ as Pt,ai as F,du as ge,hp as fe,cx as Lt,dC as Wt,c$ as Ht,hq as Ft,hr as se,hs as Ze,d7 as Kt,b_ as Vt,aj as Ut,cy as qt,ca as $t,gQ as Jt,ht as Dt,cN as zt,cQ as Gt,hu as Yt,hv as Xt,hw as Qt,da as Zt,db as eo,cS as to,aV as oo,ee as no}from"../datalayer-app-main.js";import{b as io,I as et}from"./token-BRjncM66.js";import{ToolbarItems as lo}from"./index-CCRwowMu.js";import{I as so}from"./index-Dv_XGY6Q.js";import{I as Se}from"./tokens-BHMD_ju9.js";import{a as tt,I,b as ot,c as ro}from"./tokens-CydTkiyv.js";import{I as ao,a as nt}from"./tokens-BvmYCqiu.js";import{I as co}from"./tokens-CBD7cd6p.js";import{f as it,e as uo,c as ho,I as po,b as go}from"./index-BN8Bbau-.js";import{I as lt}from"./tokens-D1_9ZFxB.js";import{I as be}from"./tokens-BHLmeqjP.js";import{a as Ae}from"./tokens-_fLcuFXz.js";import{I as bo}from"./tokens-CENaHAHm.js";import{I as mo}from"./index-DSN70XMH.js";import{I as Co}from"./tokens-DXLxGbDM.js";import{W as vo,u as Le,V as fo,I as _o,a as yo,b as xo,c as wo}from"./document-Dluvp7zl.js";import{b as ko,c as So,d as Ao}from"./CellSidebarExtension-B-73cmcQ.js";import{T as Mo,a as To}from"./model-BziAhKNp.js";import{C as We}from"./celltoolbartracker-DcYHi8Du.js";import"./hoverbox-CStlKQWE.js";import"./Output-no9rnFJ7.js";import"./index-S4sn4R3i.js";import"./color-CG7_7V2-.js";import"./isEqual-g-jK7vY0.js";import"./defaultLocale-5voVPcsN.js";import"./index-DbMBnR4l.js";import"./KebabHorizontalIcon-CXDXtkuL.js";import"./PaintbrushIcon-CLU8RilX.js";import"./index-BJhxZF_K.js";import"./RestartIcon-Ca6_HoK0.js";import"./NotebookSkeleton-CI7ovjNW.js";import"./Avatar-9MpXENSs.js";import"./renderer-DKKfWkWv.js";import"./SquareIcon-e3ygcjpv.js";import"./SortAscIcon-CVKVWIWQ.js";import"./url-DuKx0yk0.js";/* empty css */import"./index-Dro44tIm.js";/* empty css *//* empty css */import"./index-DsG9xhMj.js";/* empty css */import"./index-CNU-WVhQ.js";import"./index--OLIX362.js";import"./index-DYGslHkf.js";import"./index-BSRVX3UN.js";import"./index-BH2OX5l8.js";import"./index-C3vDfO5_.js";import"./index-Ko8lxXFd.js";import"./index-CB9u17_J.js";import"./index-BUVtc_FV.js";import"./ArrowLeftIcon-Y3PTljcl.js";import"./SkubbleIcon-tlg17jBG.js";import"./usePrimerThemeBridge-CoHussa9.js";import"./index-Dobs-OKl.js";import"./KernelVariables-CS6h5HyK.js";import"./index-BvgsWH_d.js";import"./SortDescIcon-CS4EzHeS.js";import"./NotebookToolbar-rtMQZWHQ.js";import"./RepoPushIcon-Cm8g9NuL.js";import"./Toolbar-CGQDY041.js";import"./sessions-BRALW9Yv.js";import"./tokens-DTIgYcNS.js";import"./drivecontents-CxwZz_5W.js";import"./kernel-BI-BLP-K.js";const Bo="jp-DefaultStyle",Eo="jp-HTMLSelect";class No extends H.Component{render(){const{className:e,defaultStyle:i=!0,disabled:a,elementRef:s,iconProps:l,icon:p=ht,options:n=[],...c}=this.props,d=pt(Eo,{[Bo]:i},e),g=b=>{b.stopPropagation()},m=n.map(b=>{const f=typeof b=="object"?b:{value:b};return H.createElement("option",{...f,key:f.value},f.label||f.value)});return H.createElement("div",{className:d},H.createElement("select",{onFocus:g,disabled:a,ref:s,...c,multiple:!1},m,c.children),H.createElement(p.react,{tag:"span",stylesheet:"select",right:"4px",top:"4px",...l}))}}function Oo(r){const i=a=>{const s=Math.max(a*3.6,.1),l=s*Math.PI/180,p=Math.sin(l)*104,n=Math.cos(l)*-104;return"M 0 0 v -104 A 104 104 1 "+(s<180?1:0)+" 0 "+p.toFixed(4)+" "+n.toFixed(4)+" z"};return A.createElement("div",{className:"jp-Statusbar-ProgressCircle",role:"progressbar","aria-label":r.label||"Unlabelled progress circle","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r.progress,onClick:r.onClick},A.createElement("svg",{viewBox:"0 0 250 250"},A.createElement("circle",{cx:"125",cy:"125",r:"104",stroke:"var(--jp-inverse-layout-color3)",strokeWidth:"20",fill:"none"}),A.createElement("path",{className:"jp-Statusbar-ProgressCirclePath",transform:"translate(125,125) scale(.9)",d:i(r.progress),fill:"var(--jp-inverse-layout-color3)"})))}const jo="jp-JSONEditor",ce="jp-mod-error",Ro="jp-JSONEditor-host",Io="jp-JSONEditor-header";class Po extends Z{constructor(e){super(),this._dataDirty=!1,this._inputDirty=!1,this._source=null,this._originalValue=ne.emptyObject,this._changeGuard=!1,this.translator=e.translator||O,this._trans=this.translator.load("jupyterlab"),this.addClass(jo),this.headerNode=document.createElement("div"),this.headerNode.className=Io,this.revertButtonNode=gt.element({tag:"span",title:this._trans.__("Revert changes to data")}),this.commitButtonNode=bt.element({tag:"span",title:this._trans.__("Commit changes to data"),marginLeft:"8px"}),this.editorHostNode=document.createElement("div"),this.editorHostNode.className=Ro,this.headerNode.appendChild(this.revertButtonNode),this.headerNode.appendChild(this.commitButtonNode),this.node.appendChild(this.headerNode),this.node.appendChild(this.editorHostNode);const i=new mt.Model({mimeType:"application/json"});i.sharedModel.changed.connect(this._onModelChanged,this),this.model=i,this.editor=e.editorFactory({host:this.editorHostNode,model:i,config:{readOnly:!0}})}get source(){return this._source}set source(e){this._source!==e&&(this._source&&this._source.changed.disconnect(this._onSourceChanged,this),this._source=e,this.editor.setOption("readOnly",e===null),e&&e.changed.connect(this._onSourceChanged,this),this._setValue())}get isDirty(){return this._dataDirty||this._inputDirty}dispose(){var e;this.isDisposed||((e=this.source)===null||e===void 0||e.dispose(),this.model.dispose(),this.editor.dispose(),super.dispose())}handleEvent(e){switch(e.type){case"blur":this._evtBlur(e);break;case"click":this._evtClick(e);break}}onAfterAttach(e){const i=this.editorHostNode;i.addEventListener("blur",this,!0),i.addEventListener("click",this,!0),this.revertButtonNode.hidden=!0,this.commitButtonNode.hidden=!0,this.headerNode.addEventListener("click",this)}onBeforeDetach(e){const i=this.editorHostNode;i.removeEventListener("blur",this,!0),i.removeEventListener("click",this,!0),this.headerNode.removeEventListener("click",this)}_onSourceChanged(e,i){if(!this._changeGuard){if(this._inputDirty||this.editor.hasFocus()){this._dataDirty=!0;return}this._setValue()}}_onModelChanged(e,i){if(i.sourceChange){let a=!0;try{const s=JSON.parse(this.editor.model.sharedModel.getSource());this.removeClass(ce),this._inputDirty=!this._changeGuard&&!ne.deepEqual(s,this._originalValue)}catch{this.addClass(ce),this._inputDirty=!0,a=!1}this.revertButtonNode.hidden=!this._inputDirty,this.commitButtonNode.hidden=!a||!this._inputDirty}}_evtBlur(e){!this._inputDirty&&this._dataDirty&&this._setValue()}_evtClick(e){const i=e.target;this.revertButtonNode.contains(i)?this._setValue():this.commitButtonNode.contains(i)?!this.commitButtonNode.hidden&&!this.hasClass(ce)&&(this._changeGuard=!0,this._mergeContent(),this._changeGuard=!1,this._setValue()):this.editorHostNode.contains(i)&&this.editor.focus()}_mergeContent(){const e=this.editor.model,i=this._originalValue,a=JSON.parse(e.sharedModel.getSource()),s=this.source;if(s){for(const l in a)ne.deepEqual(a[l],i[l]||null)||s.set(l,a[l]);for(const l in i)l in a||s.delete(l)}}_setValue(){this._dataDirty=!1,this._inputDirty=!1,this.revertButtonNode.hidden=!0,this.commitButtonNode.hidden=!0,this.removeClass(ce);const e=this.editor.model,i=this._source?this._source.toJSON():{};if(this._changeGuard=!0,i===void 0)e.sharedModel.setSource(this._trans.__("No data!")),this._originalValue=ne.emptyObject;else{const a=JSON.stringify(i,null,4);e.sharedModel.setSource(a),this._originalValue=i,a.length>1&&a[0]==="{"&&this.editor.setCursorPosition({line:0,column:1})}this._changeGuard=!1,this.commitButtonNode.hidden=!0,this.revertButtonNode.hidden=!0}}const Lo="jp-Notebook-toolbarCellType",Wo="jp-Notebook-toolbarCellTypeDropdown";var _e;(function(r){function e(g,m){const b=(m||O).load("jupyterlab");function f(){if(g.context.model.readOnly)return Xe({title:b.__("Cannot Save"),body:b.__("Document is read-only"),buttons:[ve.okButton()]});g.context.save().then(()=>{if(!g.isDisposed)return g.context.createCheckpoint()})}return Ct($e.create(H.createElement(vt,{signal:g.context.fileChanged},()=>H.createElement(ft,{icon:_t,onClick:f,tooltip:b.__("Save the notebook contents and create checkpoint"),enabled:!!(g&&g.context&&g.context.contentsModel&&g.context.contentsModel.writable)}))))}r.createSaveButton=e;function i(g,m){const b=(m||O).load("jupyterlab");return new Q({icon:yt,onClick:()=>{_.insertBelow(g.content)},tooltip:b.__("Insert a cell below")})}r.createInsertButton=i;function a(g,m,b){const f=(m||O).load("jupyterlab");return new Q({icon:Je,onClick:async()=>{b?.get("useSystemClipboardForCells").composite?await _.cutToSystemClipboard(g.content):_.cut(g.content)},tooltip:f.__("Cut the selected cells")})}r.createCutButton=a;function s(g,m,b){const f=(m||O).load("jupyterlab");return new Q({icon:De,onClick:async()=>{b?.get("useSystemClipboardForCells").composite?await _.copyToSystemClipboard(g.content):_.copy(g.content)},tooltip:f.__("Copy the selected cells")})}r.createCopyButton=s;function l(g,m,b){const f=(m||O).load("jupyterlab");return new Q({icon:ze,onClick:async()=>{b?.get("useSystemClipboardForCells").composite?await _.pasteFromSystemClipboard(g.content):_.paste(g.content)},tooltip:f.__("Paste cells from the clipboard")})}r.createPasteButton=l;function p(g,m,b){const f=(b??O).load("jupyterlab");return new Q({icon:Ge,onClick:()=>{_.runAndAdvance(g.content,g.sessionContext,m,b)},tooltip:f.__("Run the selected cells and advance")})}r.createRunButton=p;function n(g,m,b){const f=(b??O).load("jupyterlab");return new Q({icon:Ye,onClick:()=>{const x=m??new xe({translator:b});x.restart(g.sessionContext).then(o=>(o&&_.runAll(g.content,g.sessionContext,x,b),o))},tooltip:f.__("Restart the kernel, then re-run the whole notebook")})}r.createRestartRunAllButton=n;function c(g,m){return new Ho(g.content,m)}r.createCellTypeItem=c;function d(g,m,b,f){return[{name:"save",widget:e(g,b)},{name:"insert",widget:i(g,b)},{name:"cut",widget:a(g,b,f)},{name:"copy",widget:s(g,b,f)},{name:"paste",widget:l(g,b,f)},{name:"run",widget:p(g,m,b)},{name:"interrupt",widget:ue.createInterruptButton(g.sessionContext,b)},{name:"restart",widget:ue.createRestartButton(g.sessionContext,m,b)},{name:"restart-and-run",widget:n(g,m,b)},{name:"cellType",widget:c(g,b)},{name:"spacer",widget:xt.createSpacerItem()},{name:"kernelName",widget:ue.createKernelNameItem(g.sessionContext,m,b)}]}r.getDefaultItems=d})(_e||(_e={}));class Ho extends $e{constructor(e,i){super(),this.handleChange=a=>{a.target.value!=="-"&&(_.changeCellType(this._notebook,a.target.value),this._notebook.activate())},this.handleKeyDown=a=>{a.key==="Enter"&&this._notebook.activate()},this._trans=(i||O).load("jupyterlab"),this.addClass(Lo),this._notebook=e,e.model&&this.update(),e.activeCellChanged.connect(this.update,this),e.selectionChanged.connect(this.update,this)}render(){let e="-";this._notebook.activeCell&&(e=this._notebook.activeCell.model.type);for(const i of this._notebook.widgets)if(this._notebook.isSelectedOrActive(i)&&i.model.type!==e){e="-";break}return H.createElement(No,{className:Wo,onChange:this.handleChange,onKeyDown:this.handleKeyDown,value:e,"aria-label":this._trans.__("Cell type"),title:this._trans.__("Select the cell type")},H.createElement("option",{value:"-"},"-"),H.createElement("option",{value:"code"},this._trans.__("Code")),H.createElement("option",{value:"markdown"},this._trans.__("Markdown")),H.createElement("option",{value:"raw"},this._trans.__("Raw")))}}function He(r){var e;const i=r.translator||O,a=rt(i),s=i.load("jupyterlab"),l=(e=r.displayOption.showJumpToCell)!==null&&e!==void 0?e:!1,p=r.state,n=r.displayOption.showOnToolBar,c=r.displayOption.showProgress,d=n?"down":"up",g=A.createElement("div",null),[m,b]=A.useState(!1);if(A.useEffect(()=>{if(m)return;const j=()=>{b(!0)};return _.executionScheduled.connect(j),()=>{_.executionScheduled.disconnect(j)}},[l,m]),!p)return g;const f=p.kernelStatus,x={alignSelf:"normal",height:"24px"},o=p.totalTime,t=p.scheduledCellNumber||0,u=p.scheduledCell.size||0,C=t-u;let w=100*C/t,B=c?"":"hidden";!c&&w<100&&(w=0);const M=j=>A.createElement(Oo,{progress:j,width:16,height:24,label:s.__("Kernel status")}),K=j=>s.__("Kernel status: %1",j),V=()=>{const j=r.notebook;_.selectLastRunCell(j),j.activeCell&&j.scrollToCell(j.activeCell)},R=(j,$,P)=>A.createElement("div",{className:"jp-Notebook-ExecutionIndicator",title:c?"":K(a[j]),"data-status":j},$,A.createElement("div",{className:`jp-Notebook-ExecutionIndicator-tooltip ${d} ${B}`},A.createElement("span",null," ",K(a[j])," "),P,l&&m&&A.createElement(St,{className:"jp-Notebook-ExecutionIndicator-jumpButton",onClick:V,title:s.__("Jump to current or last executed cell")},s.__("Jump to cell"))));if(p.kernelStatus==="connecting"||p.kernelStatus==="disconnected"||p.kernelStatus==="unknown")return R(f,A.createElement(wt.react,{...x}),[]);if(p.kernelStatus==="starting"||p.kernelStatus==="terminating"||p.kernelStatus==="restarting"||p.kernelStatus==="initializing")return R(f,A.createElement(kt.react,{...x}),[]);if(p.executionStatus==="busy")return R("busy",M(w),[A.createElement("span",{key:0},s.__("Executed %1/%2 cells",C,t)),A.createElement("span",{key:1},s._n("Elapsed time: %1 second","Elapsed time: %1 seconds",o))]);{const j=p.kernelStatus==="busy"?0:100,$=p.kernelStatus==="busy"||o===0?[]:[A.createElement("span",{key:0},s._n("Executed %1 cell","Executed %1 cells",t)),A.createElement("span",{key:1},s._n("Elapsed time: %1 second","Elapsed time: %1 seconds",o))];return R(p.kernelStatus,M(j),$)}}class X extends we{constructor(e,i=!0){super(new X.Model),this.translator=e||O,this.addClass("jp-mod-highlighted")}render(){if(this.model===null||!this.model.renderFlag)return A.createElement("div",null);{const e=this.model.currentNotebook;return e?A.createElement(He,{displayOption:this.model.displayOption,state:this.model.executionState(e),translator:this.translator,notebook:e}):A.createElement(He,{displayOption:this.model.displayOption,state:void 0,translator:this.translator,notebook:void 0})}}}(function(r){class e extends ke{constructor(){super(),this._notebookExecutionProgress=new WeakMap,this._displayOption={showOnToolBar:!0,showProgress:!0,showJumpToCell:!1},this._renderFlag=!0}attachNotebook(l){var p,n,c,d;if(l&&l.content&&l.context){const g=l.content,m=l.context;if(this._currentNotebook=g,!this._notebookExecutionProgress.has(g)){this._notebookExecutionProgress.set(g,{executionStatus:"idle",kernelStatus:"idle",totalTime:0,interval:0,timeout:0,scheduledCell:new Set,scheduledCellNumber:0,needReset:!0});const b=this._notebookExecutionProgress.get(g),f=u=>{b&&(b.kernelStatus=u.kernelDisplayStatus),this.stateChanged.emit(void 0)};m.statusChanged.connect(f,this);const x=u=>{b&&(b.kernelStatus=u.kernelDisplayStatus),this.stateChanged.emit(void 0)};m.connectionStatusChanged.connect(x,this),m.disposed.connect(u=>{u.connectionStatusChanged.disconnect(x,this),u.statusChanged.disconnect(f,this)});const o=(u,C)=>{const w=C.msg,B=w.header.msg_id;if(w.header.msg_type==="execute_request")this._cellScheduledCallback(g,B);else if(Y.KernelMessage.isStatusMsg(w)&&w.content.execution_state==="idle"){const M=w.parent_header.msg_id;this._cellExecutedCallback(g,M)}else Y.KernelMessage.isStatusMsg(w)&&w.content.execution_state==="restarting"?this._restartHandler(g):w.header.msg_type==="execute_input"&&this._startTimer(g)};(n=(p=m.session)===null||p===void 0?void 0:p.kernel)===null||n===void 0||n.anyMessage.connect(o),(d=(c=m.session)===null||c===void 0?void 0:c.kernel)===null||d===void 0||d.disposed.connect(u=>u.anyMessage.disconnect(o));const t=(u,C)=>{b&&(this._resetTime(b),this.stateChanged.emit(void 0),C.newValue&&C.newValue.anyMessage.connect(o))};m.kernelChanged.connect(t),m.disposed.connect(u=>u.kernelChanged.disconnect(t))}}}get currentNotebook(){return this._currentNotebook}get displayOption(){return this._displayOption}set displayOption(l){this._displayOption=l}executionState(l){return this._notebookExecutionProgress.get(l)}_scheduleSwitchToIdle(l){window.setTimeout(()=>{l.executionStatus="idle",clearInterval(l.interval),this.stateChanged.emit(void 0)},150),l.timeout=window.setTimeout(()=>{l.needReset=!0},1e3)}_cellExecutedCallback(l,p){const n=this._notebookExecutionProgress.get(l);n&&n.scheduledCell.has(p)&&(n.scheduledCell.delete(p),n.scheduledCell.size===0&&this._scheduleSwitchToIdle(n))}_restartHandler(l){const p=this._notebookExecutionProgress.get(l);p&&(p.scheduledCell.clear(),this._scheduleSwitchToIdle(p))}_startTimer(l){const p=this._notebookExecutionProgress.get(l);p&&(p.scheduledCell.size>0?p.executionStatus!=="busy"&&(p.executionStatus="busy",clearTimeout(p.timeout),this.stateChanged.emit(void 0),p.interval=window.setInterval(()=>{this._tick(p)},1e3)):this._resetTime(p))}_cellScheduledCallback(l,p){const n=this._notebookExecutionProgress.get(l);n&&!n.scheduledCell.has(p)&&(n.needReset&&this._resetTime(n),n.scheduledCell.add(p),n.scheduledCellNumber+=1)}_tick(l){l.totalTime+=1,this.stateChanged.emit(void 0)}_resetTime(l){l.totalTime=0,l.scheduledCellNumber=0,l.executionStatus="idle",l.scheduledCell=new Set,clearTimeout(l.timeout),clearInterval(l.interval),l.needReset=!1}get renderFlag(){return this._renderFlag}updateRenderOption(l){this.displayOption.showOnToolBar&&(l.showOnToolBar?this._renderFlag=!0:this._renderFlag=!1),this.displayOption.showProgress=l.showProgress,this.displayOption.showJumpToCell=l.showJumpToCell,this.stateChanged.emit(void 0)}}r.Model=e;function i(s,l,p){const n=new r(l);return n.model.displayOption={showOnToolBar:!0,showProgress:!0,showJumpToCell:!1},n.model.attachNotebook({content:s.content,context:s.sessionContext}),p&&p.then(c=>{const d=g=>{const m=a(g);m.showJumpToCell&&(g.get("recordTiming").composite||g.set("recordTiming",!0).catch(f=>{console.error("Failed to auto-enable recordTiming:",f.message)})),n.model.updateRenderOption(m)};c.changed.connect(d),d(c),n.disposed.connect(()=>{c.changed.disconnect(d)})}).catch(c=>{console.error(c.message)}),n}r.createExecutionIndicatorItem=i;function a(s){let l=!0,p=!0,n=!1;const c=s.get("kernelStatus").composite;return c&&(l=!c.showOnStatusBar,p=c.showProgress,n=c.showJumpToRecentExecutionButton),{showOnToolBar:l,showProgress:p,showJumpToCell:n}}r.getSettingValue=a})(X||(X={}));function Fo(r){const e=(r.translator||O).load("jupyterlab");return H.createElement(at,{source:e.__("Mode: %1",r.modeNames[r.notebookMode])})}class re extends we{constructor(e){super(new re.Model),this.translator=e||O,this._trans=this.translator.load("jupyterlab"),this._modeNames={command:this._trans.__("Command"),edit:this._trans.__("Edit")}}render(){return this.model?(this.node.title=this._trans.__("Notebook is in %1 mode",this._modeNames[this.model.notebookMode]),H.createElement(Fo,{notebookMode:this.model.notebookMode,translator:this.translator,modeNames:this._modeNames})):null}}(function(r){class e extends ke{constructor(){super(...arguments),this._onChanged=a=>{const s=this._notebookMode;this._notebook?this._notebookMode=a.mode:this._notebookMode="command",this._triggerChange(s,this._notebookMode)},this._notebookMode="command",this._notebook=null}get notebookMode(){return this._notebookMode}set notebook(a){const s=this._notebook;s!==null&&(s.stateChanged.disconnect(this._onChanged,this),s.activeCellChanged.disconnect(this._onChanged,this),s.modelContentChanged.disconnect(this._onChanged,this));const l=this._notebookMode;this._notebook=a,this._notebook===null?this._notebookMode="command":(this._notebookMode=this._notebook.mode,this._notebook.stateChanged.connect(this._onChanged,this),this._notebook.activeCellChanged.connect(this._onChanged,this),this._notebook.modelContentChanged.connect(this._onChanged,this)),this._triggerChange(l,this._notebookMode)}_triggerChange(a,s){a!==s&&this.stateChanged.emit(void 0)}}r.Model=e})(re||(re={}));class Ko extends vo{constructor(e,i){super(e,i),this.editorWidget=e,this.options=i,this._type="code",this._readyDelegate=new At,this._editorToCell=new Map,this.editor=e.content,this._cellToEditor=new WeakMap,this.isReady=this.isReady.bind(this),Promise.all([this.widget.context.sessionContext.ready,this.connectionManager.ready]).then(async()=>{await this.initOnceReady(),this._readyDelegate.resolve()}).catch(console.error)}get documentPath(){return this.widget.context.path}get mimeType(){var e;let i,a=this.language_info();return!a||!a.mimetype?i=this.widget.content.codeMimetype:i=a.mimetype,Array.isArray(i)?(e=i[0])!==null&&e!==void 0?e:Mt.defaultMimeType:i}get languageFileExtension(){let e=this.language_info();if(!(!e||!e.file_extension))return e.file_extension.replace(".","")}get wrapperElement(){return this.widget.node}get editors(){if(this.isDisposed)return[];let e=this.widget.content;return this._editorToCell.clear(),e.isDisposed?[]:e.widgets.map(i=>({ceEditor:this._getCellEditor(i),type:i.model.type,value:i.model.sharedModel.getSource()}))}get activeEditor(){return this.editor.activeCell?this._getCellEditor(this.editor.activeCell):void 0}get ready(){return this._readyDelegate.promise}getEditorIndexAt(e){let i=this._getCellAt(e);return this.widget.content.widgets.findIndex(s=>i===s)}getEditorIndex(e){let i=this._editorToCell.get(e);return this.editor.widgets.findIndex(a=>i===a)}getEditorWrapper(e){return this._editorToCell.get(e).node}async onKernelChanged(e,i){if(i.newValue)try{const a=this._languageInfo;await Le(this.isReady,-1),await this._updateLanguageInfo();const s=this._languageInfo;a?.name!=s.name||a?.mimetype!=s?.mimetype||a?.file_extension!=s?.file_extension?(console.log(`Changed to ${this._languageInfo.name} kernel, reconnecting`),this.reloadConnection()):console.log("Keeping old LSP connection as the new kernel uses the same language")}catch(a){console.warn(a),this.reloadConnection()}}dispose(){this.isDisposed||(this.widget.context.sessionContext.kernelChanged.disconnect(this.onKernelChanged,this),this.widget.content.activeCellChanged.disconnect(this._activeCellChanged,this),super.dispose(),this._editorToCell.clear(),Tt.clearData(this))}isReady(){var e;return!this.widget.isDisposed&&this.widget.context.isReady&&this.widget.content.isVisible&&this.widget.content.widgets.length>0&&((e=this.widget.context.sessionContext.session)===null||e===void 0?void 0:e.kernel)!=null}async handleCellChange(e,i){let a=[],s=[];const l=this._type;if(i.type==="set"){let p=[],n=[];if(i.newValues.length===i.oldValues.length){for(let c=0;c<i.newValues.length;c++)i.oldValues[c].type===l&&i.newValues[c].type!==l?p.push(i.newValues[c]):i.oldValues[c].type!==l&&i.newValues[c].type===l&&n.push(i.newValues[c]);a=n,s=p}}else i.type=="add"&&(a=i.newValues.filter(p=>p.type===l));(s.length||a.length||i.type==="set"||i.type==="move"||i.type==="remove"||i.type==="clear")&&await this.updateDocuments();for(let p of a){let n=this.widget.content.widgets.find(c=>c.model.id===p.id);if(!n){console.warn(`Widget for added cell with ID: ${p.id} not found!`);continue}this._getCellEditor(n)}}createVirtualDocument(){return new fo({language:this.language,foreignCodeExtractors:this.options.foreignCodeExtractorsManager,path:this.documentPath,fileExtension:this.languageFileExtension,standalone:!1,hasLspSupportedFile:!1})}language_info(){return this._languageInfo}async initOnceReady(){await Le(this.isReady.bind(this),-1),await this._updateLanguageInfo(),this.initVirtual(),this.connectDocument(this.virtualDocument,!1).catch(console.warn),this.widget.context.sessionContext.kernelChanged.connect(this.onKernelChanged,this),this.widget.content.activeCellChanged.connect(this._activeCellChanged,this),this._connectModelSignals(this.widget),this.editor.modelChanged.connect(e=>{console.warn("Model changed, connecting cell change handler; this is not something we were expecting"),this._connectModelSignals(e)})}_connectModelSignals(e){e.model===null?console.warn(`Model is missing for notebook ${e}, cannot connect cell changed signal!`):e.model.cells.changed.connect(this.handleCellChange,this)}async _updateLanguageInfo(){var e,i,a,s;const l=(s=await((a=(i=(e=this.widget.context.sessionContext)===null||e===void 0?void 0:e.session)===null||i===void 0?void 0:i.kernel)===null||a===void 0?void 0:a.info))===null||s===void 0?void 0:s.language_info;if(l)this._languageInfo=l;else throw new Error("Language info update failed (no session, kernel, or info available)")}_activeCellChanged(e,i){!i||i.model.type!==this._type||this._activeEditorChanged.emit({editor:this._getCellEditor(i)})}_getCellAt(e){let i=this.virtualDocument.getEditorAtVirtualLine(e);return this._editorToCell.get(i)}_getCellEditor(e){if(!this._cellToEditor.has(e)){const i=Object.freeze({getEditor:()=>e.editor,ready:async()=>(await e.ready,e.editor),reveal:async()=>(await this.editor.scrollToCell(e),e.editor)});this._cellToEditor.set(e,i),this._editorToCell.set(i,e),e.disposed.connect(()=>{this._cellToEditor.delete(e),this._editorToCell.delete(i),this._editorRemoved.emit({editor:i})}),this._editorAdded.emit({editor:i})}return this._cellToEditor.get(e)}}class Vo extends Z{constructor(){super(),this._items=[],this.layout=new pe,this.addClass("jp-RankedPanel")}addWidget(e,i){const a={widget:e,rank:i},s=ie.upperBound(this._items,a,ye.itemCmp);ie.insert(this._items,s,a),this.layout.insertWidget(s,e)}onChildRemoved(e){const i=ie.findFirstIndex(this._items,a=>a.widget===e.child);i!==-1&&ie.removeAt(this._items,i)}}class q extends Z{constructor(e){super(),this.addClass("jp-NotebookTools"),this.translator=e.translator||O,this._tools=[],this.layout=new pe,this._tracker=e.tracker,this._tracker.currentChanged.connect(this._onActiveNotebookPanelChanged,this),this._tracker.activeCellChanged.connect(this._onActiveCellChanged,this),this._tracker.selectionChanged.connect(this._onSelectionChanged,this),this._onActiveNotebookPanelChanged(),this._onActiveCellChanged(),this._onSelectionChanged()}get activeCell(){return this._tracker.activeCell}get selectedCells(){const e=this._tracker.currentWidget;if(!e)return[];const i=e.content;return i.widgets.filter(a=>i.isSelectedOrActive(a))}get activeNotebookPanel(){return this._tracker.currentWidget}addItem(e){var i;const a=e.tool,s=(i=e.rank)!==null&&i!==void 0?i:100;let l;const p=this._tools.find(n=>n.section===e.section);if(p)l=p.panel;else throw new Error(`The section ${e.section} does not exist`);a.addClass("jp-NotebookTools-tool"),l.addWidget(a,s),a.notebookTools=this,G.sendMessage(a,q.ActiveNotebookPanelMessage),G.sendMessage(a,q.ActiveCellMessage)}addSection(e){var i;const a=e.sectionName,s=e.label||e.sectionName,l=e.tool;let p=(i=e.rank)!==null&&i!==void 0?i:null;const n=new Vo;if(n.title.label=s,l&&n.addWidget(l,0),this._tools.push({section:a,panel:n,rank:p}),p!=null)this.layout.insertWidget(p,new de({widget:n}));else{let c=null;const d=this.layout;for(let g=0;g<d.widgets.length;g++){let m=d.widgets[g];if(m instanceof de&&m.widget.id==="advancedToolsSection"){c=g;break}}c!==null?this.layout.insertWidget(c,new de({widget:n})):this.layout.addWidget(new de({widget:n}))}}_onActiveNotebookPanelChanged(){this._prevActiveNotebookModel&&!this._prevActiveNotebookModel.isDisposed&&this._prevActiveNotebookModel.metadataChanged.disconnect(this._onActiveNotebookPanelMetadataChanged,this);const e=this.activeNotebookPanel&&this.activeNotebookPanel.content?this.activeNotebookPanel.content.model:null;this._prevActiveNotebookModel=e,e&&e.metadataChanged.connect(this._onActiveNotebookPanelMetadataChanged,this);for(const i of this._toolChildren())G.sendMessage(i,q.ActiveNotebookPanelMessage)}_onActiveCellChanged(){this._prevActiveCell&&!this._prevActiveCell.isDisposed&&this._prevActiveCell.metadataChanged.disconnect(this._onActiveCellMetadataChanged,this);const e=this.activeCell?this.activeCell.model:null;this._prevActiveCell=e,e&&e.metadataChanged.connect(this._onActiveCellMetadataChanged,this);for(const i of this._toolChildren())G.sendMessage(i,q.ActiveCellMessage)}_onSelectionChanged(){for(const e of this._toolChildren())G.sendMessage(e,q.SelectionMessage)}_onActiveNotebookPanelMetadataChanged(e,i){const a=new he.ChangeMessage("activenotebookpanel-metadata-changed",{oldValue:void 0,newValue:void 0,...i});for(const s of this._toolChildren())G.sendMessage(s,a)}_onActiveCellMetadataChanged(e,i){const a=new he.ChangeMessage("activecell-metadata-changed",{newValue:void 0,oldValue:void 0,...i});for(const s of this._toolChildren())G.sendMessage(s,a)}*_toolChildren(){for(let e of this._tools)yield*e.panel.children()}}(function(r){r.ActiveNotebookPanelMessage=new Ce("activenotebookpanel-changed"),r.ActiveCellMessage=new Ce("activecell-changed"),r.SelectionMessage=new Ce("selection-changed");class e extends Z{dispose(){super.dispose(),this.notebookTools&&(this.notebookTools=null)}processMessage(s){switch(super.processMessage(s),s.type){case"activenotebookpanel-changed":this.onActiveNotebookPanelChanged(s);break;case"activecell-changed":this.onActiveCellChanged(s);break;case"selection-changed":this.onSelectionChanged(s);break;case"activecell-metadata-changed":this.onActiveCellMetadataChanged(s);break;case"activenotebookpanel-metadata-changed":this.onActiveNotebookPanelMetadataChanged(s);break}}onActiveNotebookPanelChanged(s){}onActiveCellChanged(s){}onSelectionChanged(s){}onActiveCellMetadataChanged(s){}onActiveNotebookPanelMetadataChanged(s){}}r.Tool=e;class i extends e{constructor(s){super();const{editorFactory:l}=s;this.addClass("jp-MetadataEditorTool");const p=this.layout=new pe;this._editorFactory=l,this._editorLabel=s.label||"Edit Metadata",this.createEditor();const n=new Z({node:document.createElement("label")});n.node.textContent=s.label||"Edit Metadata",p.addWidget(n),p.addWidget(this.editor)}get editor(){return this._editor}onActiveNotebookPanelChanged(s){this.editor.dispose(),this.notebookTools.activeNotebookPanel&&this.createEditor()}createEditor(){this._editor=new Po({editorFactory:this._editorFactory}),this.editor.title.label=this._editorLabel,this.layout.addWidget(this.editor)}}r.MetadataEditorTool=i})(q||(q={}));var ye;(function(r){function e(i,a){return i.rank-a.rank}r.itemCmp=e})(ye||(ye={}));const Uo=6;var W;(function(r){r[r.Idle=-1]="Idle",r[r.Error=-.5]="Error",r[r.Scheduled=0]="Scheduled",r[r.Running=1]="Running"})(W||(W={}));class qo extends To{constructor(e,i,a,s){super(e,s),this.parser=i,this.sanitizer=a,this.configMetadataMap={numberHeaders:["toc-autonumbering","toc/number_sections"],numberingH1:["!toc/skip_h1_title"],baseNumbering:["toc/base_numbering"]},this._runningCells=new Array,this._errorCells=new Array,this._cellToHeadingIndex=new WeakMap,e.context.ready.then(()=>{this.setConfiguration({})}),this.widget.context.model.metadataChanged.connect(this.onMetadataChanged,this),this.widget.content.activeCellChanged.connect(this.onActiveCellChanged,this),_.executionScheduled.connect(this.onExecutionScheduled,this),_.executed.connect(this.onExecuted,this),_.outputCleared.connect(this.onOutputCleared,this),this.headingsChanged.connect(this.onHeadingsChanged,this)}get documentType(){return"notebook"}get isAlwaysActive(){return!0}get supportedOptions(){return["baseNumbering","maximalDepth","numberingH1","numberHeaders","includeOutput","syncCollapseState"]}getCellHeadings(e){const i=new Array;let a=this._cellToHeadingIndex.get(e);if(a!==void 0){const s=this.headings[a];for(i.push(s);this.headings[a-1]&&this.headings[a-1].cellRef===s.cellRef;)a--,i.unshift(this.headings[a])}return i}dispose(){var e,i,a;this.isDisposed||(this.headingsChanged.disconnect(this.onHeadingsChanged,this),(i=(e=this.widget.context)===null||e===void 0?void 0:e.model)===null||i===void 0||i.metadataChanged.disconnect(this.onMetadataChanged,this),(a=this.widget.content)===null||a===void 0||a.activeCellChanged.disconnect(this.onActiveCellChanged,this),_.executionScheduled.disconnect(this.onExecutionScheduled,this),_.executed.disconnect(this.onExecuted,this),_.outputCleared.disconnect(this.onOutputCleared,this),this._runningCells.length=0,this._errorCells.length=0,super.dispose())}setConfiguration(e){const i=this.loadConfigurationFromMetadata();super.setConfiguration({...this.configuration,...i,...e})}toggleCollapse(e){super.toggleCollapse(e),this.updateRunningStatus(this.headings)}async getHeadings(){const e=this.widget.content.widgets,i=new Set(e),a=[],s=new Array,l=new WeakMap;for(let p=0;p<e.length;p++){const n=e[p];switch(n.model.type){case"code":{!this.configuration.syncCollapseState&&this.configuration.includeOutput&&a.push(...Ie(await n.getHeadings(),this.configuration,s).map(d=>({...d,cellRef:n,collapsed:!1,isRunning:W.Idle})));break}case"markdown":{const d=Ie(await n.getHeadings(),this.configuration,s).map((g,m)=>({...g,cellRef:n,collapsed:!1,isRunning:W.Idle}));if(this.configuration.syncCollapseState&&n.headingCollapsed){const g=Math.min(...d.map(b=>b.level)),m=d.find(b=>b.level===g);m.collapsed=n.headingCollapsed}a.push(...d);break}}a.length>0&&l.set(n,a.length-1)}return this._cellToHeadingIndex=l,this._runningCells=this._runningCells.filter(p=>i.has(p)),this._errorCells=this._errorCells.filter(p=>i.has(p)),this.updateRunningStatus(a),Promise.resolve(a)}isHeadingEqual(e,i){return super.isHeadingEqual(e,i)&&e.cellRef===i.cellRef&&e.isRunning===i.isRunning}loadConfigurationFromMetadata(){const e=this.widget.content.model,i={};if(e)for(const a in this.configMetadataMap){const s=this.configMetadataMap[a];for(const l of s){let p=l;const n=p[0]==="!";n&&(p=p.slice(1));const c=p.split("/");let d=e.getMetadata(c[0]);for(let g=1;g<c.length;g++)d=(d??{})[c[g]];d!==void 0&&(typeof d=="boolean"&&n&&(d=!d),i[a]=d)}}return i}onActiveCellChanged(e,i){const a=this.getCellHeadings(i)[0];this.setActiveHeading(a??null,!1)}onHeadingsChanged(){this.widget.content.activeCell&&this.onActiveCellChanged(this.widget.content,this.widget.content.activeCell)}onExecuted(e,i){this._runningCells.forEach((a,s)=>{var l;if(a===i.cell){this._runningCells.splice(s,1);const p=this._cellToHeadingIndex.get(a);if(p!==void 0){const n=this.headings[p];if(i.success||((l=i.error)===null||l===void 0?void 0:l.errorName)===void 0){n.isRunning=W.Idle;return}n.isRunning=W.Error,this._errorCells.includes(a)||this._errorCells.push(a)}}}),this.updateRunningStatus(this.headings),this.stateChanged.emit()}onExecutionScheduled(e,i){this._runningCells.includes(i.cell)||this._runningCells.push(i.cell),this._errorCells.forEach((a,s)=>{a===i.cell&&this._errorCells.splice(s,1)}),this.updateRunningStatus(this.headings),this.stateChanged.emit()}onOutputCleared(e,i){this._errorCells.forEach((a,s)=>{if(a===i.cell){this._errorCells.splice(s,1);const l=this._cellToHeadingIndex.get(a);if(l!==void 0){const p=this.headings[l];p.isRunning=W.Idle}}}),this.updateRunningStatus(this.headings),this.stateChanged.emit()}onMetadataChanged(){this.setConfiguration({})}updateRunningStatus(e){e.forEach(s=>{s.isRunning=W.Idle}),this._runningCells.forEach((s,l)=>{const p=this._cellToHeadingIndex.get(s);if(p!==void 0){const n=e[p];n.isRunning!==W.Running&&(n.isRunning=l>0?W.Scheduled:W.Running)}}),this._errorCells.forEach((s,l)=>{const p=this._cellToHeadingIndex.get(s);if(p!==void 0){const n=e[p];n.isRunning===W.Idle&&(n.isRunning=W.Error)}});let i=0;for(;i<e.length;){const s=e[i];if(i++,s.collapsed){const l=Math.max(s.isRunning,a(e,s.level));s.dataset={...s.dataset,"data-running":l.toString()}}else s.dataset={...s.dataset,"data-running":s.isRunning.toString()}}function a(s,l){let p=W.Idle;for(;i<s.length;){const n=s[i];if(n.dataset={...n.dataset,"data-running":n.isRunning.toString()},n.level>l)i++,p=Math.max(n.isRunning,p),n.collapsed&&(p=Math.max(p,a(s,n.level)),n.dataset={...n.dataset,"data-running":p.toString()});else break}return p}}}class $o extends Mo{constructor(e,i,a,s){super(e),this.parser=i,this.sanitizer=a,this.commands=s,this._scrollToTop=!0}get scrollToTop(){return this._scrollToTop}set scrollToTop(e){this._scrollToTop=e}_createNew(e,i){const a=new qo(e,this.parser,this.sanitizer,i);let s=new WeakMap;const l=(m,b)=>{if(b){const f=async u=>{if(!u.inViewport)return;const C=s.get(b);if(C)if(this.scrollToTop)C.scrollIntoView({block:"start"}),e.content.outerNode.scrollTop-=Uo;else{const w=e.content.node.getBoundingClientRect(),B=C.getBoundingClientRect();(B.top>w.bottom||B.bottom<w.top)&&C.scrollIntoView({block:"center"})}else console.debug("scrolling to heading: using fallback strategy"),await e.content.scrollToItem(e.content.activeCellIndex,this.scrollToTop?"start":void 0,0)},x=b.cellRef,t=e.content.widgets.indexOf(x);x.model.type=="markdown"&&e.content.mode!="command"&&(e.content.mode="command"),e.content.activeCellIndex=t,x.inViewport?f(x).catch(u=>{console.error(`Fail to scroll to cell to display the required heading (${u}).`)}):e.content.scrollToItem(t,this.scrollToTop?"start":void 0).then(()=>p(x)).then(()=>f(x)).catch(u=>{console.error(`Fail to scroll to cell to display the required heading (${u}).`)})}},p=m=>Promise.all(a.getCellHeadings(m).map(async b=>{var f,x,o;const t=await Jo(b,this.parser,this.sanitizer),u=(f=this.sanitizer.allowNamedProperties)!==null&&f!==void 0&&f?"id":"data-jupyter-id",C=t?`h${b.level}[${u}="${CSS.escape(t)}"]`:`h${b.level}`;b.outputIndex!==void 0?s.set(b,je(b.cellRef.outputArea.widgets[b.outputIndex].node,C,(x=b.prefix)!==null&&x!==void 0?x:"")):s.set(b,je(b.cellRef.node,C,(o=b.prefix)!==null&&o!==void 0?o:""))})).then(()=>{}),n=m=>{if(this.parser)return Re(e.content.node),s=new WeakMap,Promise.all(e.content.widgets.map(b=>p(b)))},c=(m,b)=>{var f,x,o,t;if(a.configuration.syncCollapseState)if(b!==null){const u=b.cellRef;u.headingCollapsed!==((f=b.collapsed)!==null&&f!==void 0?f:!1)&&(u.headingCollapsed=(x=b.collapsed)!==null&&x!==void 0?x:!1)}else{const u=(t=(o=a.headings[0])===null||o===void 0?void 0:o.collapsed)!==null&&t!==void 0?t:!1;e.content.widgets.forEach(C=>{C instanceof le&&C.headingInfo.level>=0&&(C.headingCollapsed=u)})}},d=(m,b)=>{if(a.configuration.syncCollapseState){const f=a.getCellHeadings(b)[0];f&&a.toggleCollapse({heading:f,collapsed:b.headingCollapsed})}},g=(m,b)=>{var f;b.inViewport?(f=p(b))===null||f===void 0||f.catch(console.warn):Re(b.node)};return e.context.ready.then(()=>{var m;(m=n())===null||m===void 0||m.catch(console.warn),a.activeHeadingChanged.connect(l),a.headingsChanged.connect(n),a.collapseChanged.connect(c),e.content.cellCollapsed.connect(d),e.content.cellInViewportChanged.connect(g),e.disposed.connect(()=>{a.activeHeadingChanged.disconnect(l),a.headingsChanged.disconnect(n),a.collapseChanged.disconnect(c),e.content.cellCollapsed.disconnect(d),e.content.cellInViewportChanged.disconnect(g)})}),a}getToolbarItems(e){return this.commands?[{name:"select-last-modified-back",widget:new Oe({commands:this.commands,id:"notebook:select-last-modified-cell",args:{toolbar:!0},icon:Bt,label:""})},{name:"select-last-modified-forward",widget:new Oe({commands:this.commands,id:"notebook:select-next-modified-cell",args:{toolbar:!0},icon:Et,label:""})}]:[]}}async function Jo(r,e,i){let a=null;return r.type===Pe.HeadingType.Markdown?a=await Nt(e,r.raw,r.level,i):r.type===Pe.HeadingType.HTML&&(a=r.id),a}const Do="jp-StatusItem-trust";function zo(r,e){e=e||O;const i=e.load("jupyterlab");return r.trustedCells===r.totalCells?i.__("Notebook trusted: %1 of %2 code cells trusted.",r.trustedCells,r.totalCells):r.activeCellTrusted?i.__("Active cell trusted: %1 of %2 code cells trusted.",r.trustedCells,r.totalCells):i.__("Notebook not trusted: %1 of %2 code cells trusted.",r.trustedCells,r.totalCells)}function Go(r){return r.allCellsTrusted?A.createElement(Ot.react,{top:"2px",stylesheet:"statusBar"}):A.createElement(jt.react,{top:"2px",stylesheet:"statusBar"})}class ae extends we{constructor(e){super(new ae.Model),this.translator=e||O,this.node.classList.add(Do)}render(){if(!this.model)return null;const e=zo(this.model,this.translator);return e!==this.node.title&&(this.node.title=e),A.createElement(Go,{allCellsTrusted:this.model.trustedCells===this.model.totalCells,activeCellTrusted:this.model.activeCellTrusted,totalCells:this.model.totalCells,trustedCells:this.model.trustedCells})}}(function(r){class e extends ke{constructor(){super(...arguments),this._trustedCells=0,this._totalCells=0,this._activeCellTrusted=!1,this._notebook=null}get trustedCells(){return this._trustedCells}get totalCells(){return this._totalCells}get activeCellTrusted(){return this._activeCellTrusted}get notebook(){return this._notebook}set notebook(a){const s=this._notebook;s!==null&&(s.activeCellChanged.disconnect(this._onActiveCellChanged,this),s.modelContentChanged.disconnect(this._onModelChanged,this));const l=this._getAllState();if(this._notebook=a,this._notebook===null)this._trustedCells=0,this._totalCells=0,this._activeCellTrusted=!1;else{this._notebook.activeCellChanged.connect(this._onActiveCellChanged,this),this._notebook.modelContentChanged.connect(this._onModelChanged,this),this._notebook.activeCell?this._activeCellTrusted=this._notebook.activeCell.model.trusted:this._activeCellTrusted=!1;const{total:p,trusted:n}=this._deriveCellTrustState(this._notebook.model);this._totalCells=p,this._trustedCells=n}this._triggerChange(l,this._getAllState())}_onModelChanged(a){const s=this._getAllState(),{total:l,trusted:p}=this._deriveCellTrustState(a.model);this._totalCells=l,this._trustedCells=p,this._triggerChange(s,this._getAllState())}_onActiveCellChanged(a,s){const l=this._getAllState();s?this._activeCellTrusted=s.model.trusted:this._activeCellTrusted=!1,this._triggerChange(l,this._getAllState())}_deriveCellTrustState(a){if(a===null)return{total:0,trusted:0};let s=0,l=0;for(const p of a.cells)p.type==="code"&&(s++,p.trusted&&l++);return{total:s,trusted:l}}_getAllState(){return[this._trustedCells,this._totalCells,this.activeCellTrusted]}_triggerChange(a,s){(a[0]!==s[0]||a[1]!==s[1]||a[2]!==s[2])&&this.stateChanged.emit(void 0)}}r.Model=e})(ae||(ae={}));const Yo=new Qe("@jupyterlab/metadataform:IMetadataFormProvider","A service to register new metadata editor widgets."),Xo={id:"@jupyterlab/notebook-extension:cell-executor",description:"Provides the notebook cell executor.",autoStart:!0,provides:tt,activate:()=>Object.freeze({runCell:Rt})},Qo=new Qe("@jupyterlab/logconsole:ILoggerRegistry","A service providing a logger infrastructure."),Zo={activate:en,id:"@jupyterlab/notebook-extension:log-output",description:"Adds cell outputs log to the application logger.",requires:[I],optional:[Qo],autoStart:!0};function en(r,e,i){if(!i)return;function a(s){function l(p,n,c){if(Y.KernelMessage.isDisplayDataMsg(p)||Y.KernelMessage.isStreamMsg(p)||Y.KernelMessage.isErrorMsg(p)||Y.KernelMessage.isExecuteResultMsg(p)){const d=i.getLogger(s.context.path);d.rendermime=s.content.rendermime;const g={...p.content,output_type:p.header.msg_type};let m=n;(Y.KernelMessage.isErrorMsg(p)||Y.KernelMessage.isStreamMsg(p)&&p.content.name==="stderr")&&(m=c),d.log({type:"output",data:g,level:m})}}s.context.sessionContext.iopubMessage.connect((p,n)=>l(n,"info","info")),s.context.sessionContext.unhandledMessage.connect((p,n)=>l(n,"warning","error"))}e.forEach(s=>a(s)),e.widgetAdded.connect((s,l)=>a(l))}const tn="jp-ActiveCellTool",on="jp-ActiveCellTool-Content",nn="jp-ActiveCellTool-CellContent";class ln extends q.Tool{constructor(e){super();const{languages:i}=e;this._tracker=e.tracker,this.addClass(tn),this.layout=new pe,this._inputPrompt=new It,this.layout.addWidget(this._inputPrompt);const a=document.createElement("div");a.classList.add(on);const s=a.appendChild(document.createElement("div")),l=s.appendChild(document.createElement("pre"));s.className=nn,this._editorEl=l,this.layout.addWidget(new Z({node:a}));const p=async()=>{var n,c;this._editorEl.innerHTML="",((n=this._cellModel)===null||n===void 0?void 0:n.type)==="code"?(this._inputPrompt.executionCount=`${(c=this._cellModel.executionCount)!==null&&c!==void 0?c:""}`,this._inputPrompt.show()):(this._inputPrompt.executionCount=null,this._inputPrompt.hide()),this._cellModel&&await i.highlight(this._cellModel.sharedModel.getSource().split(`
|
|
2
2
|
`)[0],i.findByMIME(this._cellModel.mimeType),this._editorEl)};this._refreshDebouncer=new Pt(p,150)}render(e){var i,a;const s=this._tracker.activeCell;return s&&(this._cellModel=s?.model||null),((i=this._cellModel)===null||i===void 0?void 0:i.sharedModel).changed.connect(this.refresh,this),(a=this._cellModel)===null||a===void 0||a.mimeTypeChanged.connect(this.refresh,this),this.refresh().then(()=>{}).catch(()=>{}),A.createElement("div",{ref:l=>l?.appendChild(this.node)})}async refresh(){await this._refreshDebouncer.invoke()}}const sn="jp-CellMetadataEditor",rn="jp-NotebookMetadataEditor";class an extends q.MetadataEditorTool{constructor(e){super(e),this._tracker=e.tracker,this.editor.editorHostNode.addEventListener("blur",this.editor,!0),this.editor.editorHostNode.addEventListener("click",this.editor,!0),this.editor.headerNode.addEventListener("click",this.editor)}_onSourceChanged(){var e,i,a;const s=(e=this._tracker.activeCell)===null||e===void 0?void 0:e.model.sharedModel;if(s&&this.editor.source){const l=Object.keys((i=s.metadata)!==null&&i!==void 0?i:{}),p=(a=this.editor.source.toJSON())!==null&&a!==void 0?a:{};s.transact(()=>{l.forEach(n=>s.deleteMetadata(n)),s.setMetadata(p)})}}render(e){var i;const a=this._tracker.activeCell;return this.editor.source=a?new he({values:a.model.metadata}):null,(i=this.editor.source)===null||i===void 0||i.changed.connect(this._onSourceChanged,this),A.createElement("div",{className:sn},A.createElement("div",{ref:s=>s?.appendChild(this.node)}))}}class dn extends q.MetadataEditorTool{constructor(e){super(e),this._tracker=e.tracker,this.editor.editorHostNode.addEventListener("blur",this.editor,!0),this.editor.editorHostNode.addEventListener("click",this.editor,!0),this.editor.headerNode.addEventListener("click",this.editor)}_onSourceChanged(){var e,i;this.editor.source&&((i=(e=this._tracker.currentWidget)===null||e===void 0?void 0:e.model)===null||i===void 0||i.sharedModel.setMetadata(this.editor.source.toJSON()))}render(e){var i,a;const s=this._tracker.currentWidget;return this.editor.source=s?new he({values:(i=s.model)===null||i===void 0?void 0:i.metadata}):null,(a=this.editor.source)===null||a===void 0||a.changed.connect(this._onSourceChanged,this),A.createElement("div",{className:rn},A.createElement("div",{ref:l=>l?.appendChild(this.node)}))}}var h;(function(r){r.createNew="notebook:create-new",r.interrupt="notebook:interrupt-kernel",r.restart="notebook:restart-kernel",r.restartClear="notebook:restart-clear-output",r.restartAndRunToSelected="notebook:restart-and-run-to-selected",r.restartRunAll="notebook:restart-run-all",r.reconnectToKernel="notebook:reconnect-to-kernel",r.changeKernel="notebook:change-kernel",r.getKernel="notebook:get-kernel",r.createConsole="notebook:create-console",r.createSubshellConsole="notebook:create-subshell-console",r.createOutputView="notebook:create-output-view",r.clearAllOutputs="notebook:clear-all-cell-outputs",r.shutdown="notebook:shutdown-kernel",r.closeAndShutdown="notebook:close-and-shutdown",r.trust="notebook:trust",r.exportToFormat="notebook:export-to-format",r.run="notebook:run-cell",r.runAndAdvance="notebook:run-cell-and-select-next",r.runAndInsert="notebook:run-cell-and-insert-below",r.runInConsole="notebook:run-in-console",r.runAll="notebook:run-all-cells",r.runAllAbove="notebook:run-all-above",r.runAllBelow="notebook:run-all-below",r.renderAllMarkdown="notebook:render-all-markdown",r.toCode="notebook:change-cell-to-code",r.toMarkdown="notebook:change-cell-to-markdown",r.toRaw="notebook:change-cell-to-raw",r.cut="notebook:cut-cell",r.copy="notebook:copy-cell",r.pasteAbove="notebook:paste-cell-above",r.pasteBelow="notebook:paste-cell-below",r.duplicateBelow="notebook:duplicate-below",r.pasteAndReplace="notebook:paste-and-replace-cell",r.moveUp="notebook:move-cell-up",r.moveDown="notebook:move-cell-down",r.clearOutputs="notebook:clear-cell-output",r.deleteCell="notebook:delete-cell",r.insertAbove="notebook:insert-cell-above",r.insertBelow="notebook:insert-cell-below",r.selectAbove="notebook:move-cursor-up",r.selectBelow="notebook:move-cursor-down",r.selectHeadingAboveOrCollapse="notebook:move-cursor-heading-above-or-collapse",r.selectHeadingBelowOrExpand="notebook:move-cursor-heading-below-or-expand",r.insertHeadingAbove="notebook:insert-heading-above",r.insertHeadingBelow="notebook:insert-heading-below",r.extendAbove="notebook:extend-marked-cells-above",r.extendTop="notebook:extend-marked-cells-top",r.extendBelow="notebook:extend-marked-cells-below",r.extendBottom="notebook:extend-marked-cells-bottom",r.selectAll="notebook:select-all",r.deselectAll="notebook:deselect-all",r.editMode="notebook:enter-edit-mode",r.merge="notebook:merge-cells",r.mergeAbove="notebook:merge-cell-above",r.mergeBelow="notebook:merge-cell-below",r.split="notebook:split-cell-at-cursor",r.commandMode="notebook:enter-command-mode",r.toggleAllLines="notebook:toggle-all-cell-line-numbers",r.undoCellAction="notebook:undo-cell-action",r.redoCellAction="notebook:redo-cell-action",r.redo="notebook:redo",r.undo="notebook:undo",r.markdown1="notebook:change-cell-to-heading-1",r.markdown2="notebook:change-cell-to-heading-2",r.markdown3="notebook:change-cell-to-heading-3",r.markdown4="notebook:change-cell-to-heading-4",r.markdown5="notebook:change-cell-to-heading-5",r.markdown6="notebook:change-cell-to-heading-6",r.hideCode="notebook:hide-cell-code",r.showCode="notebook:show-cell-code",r.hideAllCode="notebook:hide-all-cell-code",r.showAllCode="notebook:show-all-cell-code",r.hideOutput="notebook:hide-cell-outputs",r.showOutput="notebook:show-cell-outputs",r.toggleOutput="notebook:toggle-cell-outputs",r.hideAllOutputs="notebook:hide-all-cell-outputs",r.showAllOutputs="notebook:show-all-cell-outputs",r.toggleRenderSideBySideCurrentNotebook="notebook:toggle-render-side-by-side-current",r.setSideBySideRatio="notebook:set-side-by-side-ratio",r.enableOutputScrolling="notebook:enable-output-scrolling",r.disableOutputScrolling="notebook:disable-output-scrolling",r.selectLastRunCell="notebook:select-last-run-cell",r.replaceSelection="notebook:replace-selection",r.autoClosingBrackets="notebook:toggle-autoclosing-brackets",r.toggleCollapseCmd="notebook:toggle-heading-collapse",r.collapseAllCmd="notebook:collapse-all-headings",r.expandAllCmd="notebook:expand-all-headings",r.copyToClipboard="notebook:copy-to-clipboard",r.invokeCompleter="completer:invoke-notebook",r.selectCompleter="completer:select-notebook",r.tocRunCells="toc:run-cells",r.accessPreviousHistory="notebook:access-previous-history-entry",r.accessNextHistory="notebook:access-next-history-entry",r.virtualScrollbar="notebook:toggle-virtual-scrollbar"})(h||(h={}));const J="Notebook",cn=["notebook","python","custom"],un="@jupyterlab/notebook-extension:panel",Fe="jp-NotebookExtension-sideBySideMargins",ee={id:"@jupyterlab/notebook-extension:tracker",description:"Provides the notebook widget tracker.",provides:I,requires:[ot,io,tt],optional:[Ve,ao,co,it,lt,uo,be,Ue,F,Ae,nt],activate:Ln,autoStart:!0},hn={id:"@jupyterlab/notebook-extension:factory",description:"Provides the notebook cell factory.",provides:fe.IContentFactory,requires:[ge],autoStart:!0,activate:(r,e)=>{const i=e.factoryService.newInlineEditor;return new fe.ContentFactory({editorFactory:i})}},pn={activate:On,provides:ro,id:"@jupyterlab/notebook-extension:tools",description:"Provides the notebook tools.",autoStart:!0,requires:[I,ge,et,Lt.IStateDB,F],optional:[so]},gn={id:"@jupyterlab/notebook-extension:mode-status",description:"Adds a notebook mode status widget.",autoStart:!0,requires:[I,F],optional:[Se],activate:(r,e,i,a)=>{if(!a)return;const{shell:s}=r,l=new re(i);e.currentChanged.connect(()=>{const p=e.currentWidget;l.model.notebook=p&&p.content}),a.registerStatusItem("@jupyterlab/notebook-extension:mode-status",{priority:1,item:l,align:"right",rank:4,isActive:()=>!!s.currentWidget&&!!e.currentWidget&&s.currentWidget===e.currentWidget})}},bn={id:"@jupyterlab/notebook-extension:execution-indicator",description:"Adds a notebook execution status widget.",autoStart:!0,requires:[I,ho,F],optional:[Se,be],activate:(r,e,i,a,s,l)=>{let p,n,c;const d=g=>{var m,b;let{showOnToolBar:f,showProgress:x,showJumpToCell:o}=g;if(f)c&&(i.currentChanged.disconnect(n),c.dispose());else{if(!s)return;p?.model||(p=new X(a),n=(t,u)=>{const{newValue:C}=u;if(C&&e.has(C)){const w=C;p.model.attachNotebook({content:w.content,context:w.sessionContext})}},c=s.registerStatusItem("@jupyterlab/notebook-extension:execution-indicator",{item:p,align:"left",rank:3,isActive:()=>{const t=i.currentWidget;return!!t&&e.has(t)}}),p.model.attachNotebook({content:(m=e.currentWidget)===null||m===void 0?void 0:m.content,context:(b=e.currentWidget)===null||b===void 0?void 0:b.sessionContext}),i.currentChanged.connect(n),p.disposed.connect(()=>{i.currentChanged.disconnect(n)})),p.model.displayOption={showOnToolBar:f,showProgress:x,showJumpToCell:o}}};if(l){const g=l.load(ee.id);Promise.all([g,r.restored]).then(([m])=>{d(X.getSettingValue(m)),m.changed.connect(b=>d(X.getSettingValue(b)))}).catch(m=>{console.error(m.message)})}}},mn={id:"@jupyterlab/notebook-extension:export",description:"Adds the export notebook commands.",autoStart:!0,requires:[F,I],optional:[lt,Ve],activate:(r,e,i,a,s)=>{var l;const p=e.load("jupyterlab"),{commands:n,shell:c}=r,d=r.serviceManager,g=()=>L.isEnabled(c,i);n.addCommand(h.exportToFormat,{label:x=>{if(x.label===void 0)return p.__("Save and Export Notebook to the given `format`.");const o=x.label;return x.isPalette?p.__("Save and Export Notebook: %1",o):o},execute:async x=>{var o,t;const u=v(i,c,x);if(!u)return;const{context:C}=u,w={format:x.format,path:u.context.path,exporterOptions:{download:!0}};return C.model.dirty&&!C.model.readOnly&&await C.save(),(t=(o=d.nbconvert).exportAs)===null||t===void 0?void 0:t.call(o,w)},isEnabled:g,describedBy:{args:{type:"object",properties:{format:{type:"string",description:p.__("The export format (e.g., pdf, html, latex)")},label:{type:"string",description:p.__("The label to display for this format")},isPalette:{type:"boolean",description:p.__("Whether the command is called from the command palette")}},required:["format"]}}});let m;a&&(m=(l=a.fileMenu.items.find(x=>{var o;return x.type==="submenu"&&((o=x.submenu)===null||o===void 0?void 0:o.id)==="jp-mainmenu-file-notebookexport"}))===null||l===void 0?void 0:l.submenu);let b=!1;const f=async()=>{if(b)return;i.widgetAdded.disconnect(f),b=!0;const x=await d.nbconvert.getExportFormats(!1);if(!x)return;const o=L.getFormatLabels(e);Object.keys(x).forEach(function(u){const C=p.__(u[0].toUpperCase()+u.substr(1)),w=o[u]?o[u]:C;let B={format:u,label:w,isPalette:!1};if(cn.indexOf(u)===-1&&(m&&m.addItem({command:h.exportToFormat,args:B}),s)){B={format:u,label:w,isPalette:!0};const M=p.__("Notebook Operations");s.addItem({command:h.exportToFormat,category:M,args:B})}})};i.widgetAdded.connect(f)}},Cn={id:"@jupyterlab/notebook-extension:trust-status",description:"Adds the notebook trusted status widget.",autoStart:!0,requires:[I,F],optional:[Se],activate:(r,e,i,a)=>{if(!a)return;const{shell:s}=r,l=new ae(i);e.currentChanged.connect(()=>{const p=e.currentWidget;l.model.notebook=p&&p.content}),a.registerStatusItem("@jupyterlab/notebook-extension:trust-status",{item:l,align:"right",rank:3,isActive:()=>!!s.currentWidget&&!!e.currentWidget&&s.currentWidget===e.currentWidget})}},vn={id:"@jupyterlab/notebook-extension:widget-factory",description:"Provides the notebook widget factory.",provides:ot,requires:[fe.IContentFactory,ge,po,dt],optional:[be,Ue,F],activate:jn,autoStart:!0},fn={id:"@jupyterlab/notebook-extension:cloned-outputs",description:"Adds the clone output feature.",requires:[bo,I,F],optional:[it],activate:Rn,autoStart:!0},_n={id:"@jupyterlab/notebook-extension:code-console",description:"Adds the notebook code consoles features.",requires:[I,F],activate:In,autoStart:!0},yn={id:"@jupyterlab/notebook-extension:copy-output",description:"Adds the copy cell outputs feature.",activate:Pn,requires:[F,I],autoStart:!0},xn={id:"@jupyterlab/notebook-extension:kernel-status",description:"Adds the notebook kernel status.",activate:(r,e,i)=>{const a=s=>{let l=null;return s&&e.has(s)?s.sessionContext:l};i.addSessionProvider(a)},requires:[I,ct],autoStart:!0},wn={id:"@jupyterlab/notebook-extension:cursor-position",description:"Adds the notebook cursor position status.",activate:(r,e,i)=>{let a=null;const s=async l=>{let p=null;if(l!==a){if(a?.content.activeCellChanged.disconnect(i.update),a=null,l&&e.has(l)){l.content.activeCellChanged.connect(i.update);const n=l.content.activeCell;p=null,n&&(await n.ready,p=n.editor),a=l}}else if(l){const n=l.content.activeCell;p=null,n&&(await n.ready,p=n.editor)}return p};i.addEditorProvider(s)},requires:[I,Wt],autoStart:!0},kn={id:"@jupyterlab/notebook-extension:completer",description:"Adds the code completion capability to notebooks.",requires:[I],optional:[mo,F,qe],activate:Wn,autoStart:!0},Sn={id:"@jupyterlab/notebook-extension:search",description:"Adds search capability to notebooks.",requires:[Co],autoStart:!0,activate:(r,e)=>{e.add("jp-notebookSearchProvider",Dt)}},An={id:"@jupyterlab/notebook-extension:toc",description:"Adds table of content capability to the notebooks",requires:[I,Ht,qe],optional:[go,be],autoStart:!0,activate:(r,e,i,a,s,l)=>{const p=new $o(e,s,a);i.add(p),l&&Promise.all([r.restored,l.load(ee.id)]).then(([n,c])=>{const d=()=>{var g;p.scrollToTop=(g=c.composite.scrollHeadingToTop)!==null&&g!==void 0?g:!0};d(),c.changed.connect(d)}).catch(n=>{console.error("Failed to load notebook table of content settings.",n)})}},Mn={id:"@jupyterlab/notebook-extension:language-server",description:"Adds language server capability to the notebooks.",requires:[I,_o,yo,xo,wo],activate:Hn,autoStart:!0},Tn={id:"@jupyterlab/notebook-extension:update-raw-mimetype",description:"Adds metadata form editor for raw cell mimetype.",autoStart:!0,requires:[I,Yo,F],activate:(r,e,i,a)=>{const s=a.load("jupyterlab");let l=!1;async function p(){if(l||!i.get("commonToolsSection"))return;const n=i.get("commonToolsSection").getProperties("/raw_mimetype");if(!n)return;e.widgetAdded.disconnect(p),l=!0;const d=await r.serviceManager.nbconvert.getExportFormats(!1);if(!d)return;const g=Object.keys(d),m=L.getFormatLabels(a);g.forEach(function(b){var f;if(!(((f=n.oneOf)===null||f===void 0?void 0:f.filter(o=>o.const===b).length)>0)){const o=s.__(b[0].toUpperCase()+b.substr(1)),t=m[b]?m[b]:o,u=d[b].output_mimetype;n.oneOf.push({const:u,title:t})}}),i.get("commonToolsSection").setProperties("/raw_mimetype",n)}e.widgetAdded.connect(p)}},Bn={id:"@jupyterlab/notebook-extension:metadata-editor",description:"Adds metadata form for full metadata editor.",autoStart:!0,requires:[I,ge,Ae],optional:[F],activate:(r,e,i,a,s)=>{const l=c=>i.factoryService.newInlineEditor(c),p={fieldRenderer:c=>new an({editorFactory:l,tracker:e,label:"Cell metadata",translator:s}).render(c)};a.addRenderer("@jupyterlab/notebook-extension:metadata-editor.cell-metadata",p);const n={fieldRenderer:c=>new dn({editorFactory:l,tracker:e,label:"Notebook metadata",translator:s}).render(c)};a.addRenderer("@jupyterlab/notebook-extension:metadata-editor.notebook-metadata",n)}},En={id:"@jupyterlab/notebook-extension:active-cell-tool",description:"Adds active cell field in the metadata editor tab.",autoStart:!0,requires:[I,Ae,et],activate:(r,e,i,a)=>{const s={fieldRenderer:l=>new ln({tracker:e,languages:a}).render(l)};i.addRenderer("@jupyterlab/notebook-extension:active-cell-tool.renderer",s)}},Nn={id:"@jupyterlab/notebook-extension:open-with-no-kernel",description:'Adds the "Notebook (no kernel)" option to the Open With menu.',requires:[nt],optional:[F],autoStart:!0,activate:(r,e,i)=>{const{tracker:a}=e,s=(i??O).load("jupyterlab"),l=[];function p(n){var c,d;l.forEach(f=>f.dispose()),l.length=0;const g=(d=(c=n.menu.items.find(f=>{var x;return f.type==="submenu"&&((x=f.submenu)===null||x===void 0?void 0:x.id)==="jp-contextmenu-open-with"}))===null||c===void 0?void 0:c.submenu)!==null&&d!==void 0?d:null;if(!g)return;(a.currentWidget?Array.from(a.currentWidget.selectedItems()):[]).some(f=>f.type==="notebook")&&l.push(g.addItem({command:"filebrowser:open",args:{label:s.__("Notebook (no kernel)"),factory:J,kernelPreference:{shouldStart:!1}}}))}r.contextMenu.opened.connect(p)}},el=[Xo,hn,ee,bn,mn,pn,gn,Cn,vn,Zo,fn,_n,yn,xn,wn,kn,Sn,An,Mn,Tn,Bn,En,Nn];function On(r,e,i,a,s,l,p){const n=l.load("jupyterlab"),c="notebook-tools",d=new q({tracker:e,translator:l}),g=(m,b)=>{switch(b.type){case"activate-request":s.save(c,{open:!0});break;case"after-hide":case"close-request":s.remove(c);break}return!0};return d.title.icon=Kt,d.title.caption=n.__("Notebook Tools"),d.id=c,G.installMessageHook(d,g),p&&e.widgetAdded.connect((m,b)=>{p.register(b).render(d)}),d}function jn(r,e,i,a,s,l,p,n){const c=n??O,d=p??new xe({translator:c}),g=Vt.PageConfig.getOption("notebookStartsKernel"),m=g===""||g.toLowerCase()==="true",{commands:b}=r;let f;s.addFactory(J,"save",t=>lo.createSaveButton(b,t.context.fileChanged)),s.addFactory(J,"cellType",t=>_e.createCellTypeItem(t,c)),s.addFactory(J,"kernelName",t=>ue.createKernelNameItem(t.sessionContext,d,c)),s.addFactory(J,"executionProgress",t=>{const u=l?.load(ee.id),C=X.createExecutionIndicatorItem(t,c,u);return u?.then(w=>{t.disposed.connect(()=>{w.dispose()})}),C}),l&&(f=Ut(s,l,J,un,c));const x=c.load("jupyterlab"),o=new Ao({name:J,label:x.__("Notebook"),fileTypes:["notebook"],modelName:"notebook",defaultFor:["notebook"],preferKernel:m,canStartKernel:!0,rendermime:a,contentFactory:e,editorConfig:se.defaultEditorConfig,notebookConfig:se.defaultNotebookConfig,mimeTypeService:i.mimeTypeService,toolbarFactory:f,translator:c});return r.docRegistry.addWidgetFactory(o),o}function Rn(r,e,i,a,s){const l=a.load("jupyterlab"),p=new qt({namespace:"cloned-outputs"});s&&s.restore(p,{command:h.createOutputView,args:g=>({path:g.content.path,index:g.content.index}),name:g=>`${g.content.path}:${g.content.index}`,when:i.restored});const{commands:n,shell:c}=r,d=()=>L.isEnabledAndSingleSelected(c,i);n.addCommand(h.createOutputView,{label:l.__("Create New View for Cell Output"),execute:async g=>{var m;let b,f;const x=g.path;let o=g.index;if(x&&o!==void 0&&o!==null){if(f=e.findWidget(x,J),!f)return}else{if(f=i.currentWidget,!f)return;b=f.content.activeCell,o=f.content.activeCellIndex}const t=new L.ClonedOutputArea({notebook:f,cell:b,index:o,translator:a}),u=new $t({content:t});f.context.addSibling(u,{ref:f.id,mode:"split-bottom",type:"Cloned Output"});const C=()=>{p.save(u)};f.context.pathChanged.connect(C),(m=f.context.model)===null||m===void 0||m.cells.changed.connect(C),p.add(u),f.content.disposed.connect(()=>{var w;f.context.pathChanged.disconnect(C),(w=f.context.model)===null||w===void 0||w.cells.changed.disconnect(C),u.dispose()})},isEnabled:d,describedBy:{args:{type:"object",properties:{path:{type:"string",description:l.__("The path to the notebook containing the cell")},index:{type:"number",description:l.__("The index of the cell to create an output view for")}}}}})}function In(r,e,i){const a=i.load("jupyterlab"),{commands:s,shell:l}=r,p=()=>L.isEnabled(l,e);s.addCommand(h.createConsole,{label:a.__("New Console for Notebook"),execute:n=>{const c=e.currentWidget;if(c)return L.createConsole(s,c,n.activate)},isEnabled:p,describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:a.__("Whether to activate the console after creation")}}}}}),s.addCommand(h.createSubshellConsole,{label:a.__("New Subshell Console for Notebook"),execute:n=>{const c=e.currentWidget;if(c)return L.createConsole(s,c,n.activate,!0)},isEnabled:p,isVisible:()=>{var n,c,d;const g=(c=(n=e.currentWidget)===null||n===void 0?void 0:n.context.sessionContext.session)===null||c===void 0?void 0:c.kernel;return(d=g?.supportsSubshells)!==null&&d!==void 0?d:!1},describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:a.__("Whether to activate the console after creation")}}}}}),s.addCommand(h.runInConsole,{label:a.__("Run Selected Text or Current Line in Console"),execute:async n=>{var c,d;const g=e.currentWidget;if(!g)return;const{context:m,content:b}=g,f=b.activeCell,x=f?.model.metadata,o=m.path;if(!f||f.model.type!=="code")return;let t;const u=f.editor;if(!u)return;const C=u.getSelection(),{start:w,end:B}=C;if(w.column!==B.column||w.line!==B.line){const K=u.getOffsetAt(C.start),V=u.getOffsetAt(C.end);t=u.model.sharedModel.getSource().substring(K,V)}else{const K=u.getCursorPosition(),V=u.model.sharedModel.getSource().split(`
|
|
3
3
|
`);let R=C.start.line;for(;R<u.lineCount&&!V[R].replace(/\s/g,"").length;)R+=1;let j=R>0,$=0,P=$+1;for(;;){t=V.slice($,P).join(`
|
|
4
4
|
`);const te=await((d=(c=g.context.sessionContext.session)===null||c===void 0?void 0:c.kernel)===null||d===void 0?void 0:d.requestIsComplete({code:t+`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ag as Ve,gD as Ue,cY as Ke,gE as $e,ac as fe,aW as He,gF as ee,gG as qe,ca as Ie,gH as Qe,c2 as Ee,ad as De,ak as D,v as ue,b$ as Ne,gI as Xe,gJ as Ye,cX as Ge,cW as Je,_ as Ze,gK as et,gL as tt,gM as ot,b_ as H,cM as xe,c3 as nt,cL as Te,gN as it,gO as rt,cI as at,cB as Me,cD as dt,cJ as st,gP as lt,cS as he,cb as We,ai as ne,du as Le,c$ as ct,dC as ut,aj as pt,dK as gt,cy as Se,gQ as mt}from"../datalayer-app-main.js";import{I as Pe,b as Be,a as ht}from"./token-BRjncM66.js";import{T as Ae,I as ft,b as yt,f as vt,a as _t}from"./index-CFP9psRB.js";import{I as Fe}from"./tokens-BHMD_ju9.js";import{p as bt,c as Ct,f as wt,b as xt,q as Tt,M as Mt}from"./index-
|
|
1
|
+
import{ag as Ve,gD as Ue,cY as Ke,gE as $e,ac as fe,aW as He,gF as ee,gG as qe,ca as Ie,gH as Qe,c2 as Ee,ad as De,ak as D,v as ue,b$ as Ne,gI as Xe,gJ as Ye,cX as Ge,cW as Je,_ as Ze,gK as et,gL as tt,gM as ot,b_ as H,cM as xe,c3 as nt,cL as Te,gN as it,gO as rt,cI as at,cB as Me,cD as dt,cJ as st,gP as lt,cS as he,cb as We,ai as ne,du as Le,c$ as ct,dC as ut,aj as pt,dK as gt,cy as Se,gQ as mt}from"../datalayer-app-main.js";import{I as Pe,b as Be,a as ht}from"./token-BRjncM66.js";import{T as Ae,I as ft,b as yt,f as vt,a as _t}from"./index-CFP9psRB.js";import{I as Fe}from"./tokens-BHMD_ju9.js";import{p as bt,c as Ct,f as wt,b as xt,q as Tt,M as Mt}from"./index-BN8Bbau-.js";import{s as je}from"./hover-oeJgWZ71.js";import{I as ye}from"./tokens-BHLmeqjP.js";import{I as St}from"./tokens-BvmYCqiu.js";import{I as kt}from"./tokens-CBD7cd6p.js";import{I as It}from"./tokens-D1_9ZFxB.js";import{a as Et}from"./tokens-_fLcuFXz.js";import{I as Nt}from"./index-DSN70XMH.js";import{W as Wt,V as Lt,I as Pt,a as Bt,b as At,c as Ft}from"./document-Dluvp7zl.js";import{I as jt}from"./tokens-DXLxGbDM.js";import{g as ke}from"./kernelfilestypes-D2B-sFfi.js";import{T as Ot,a as ve}from"./model-BziAhKNp.js";import"./hoverbox-CStlKQWE.js";import"./Output-no9rnFJ7.js";import"./index-S4sn4R3i.js";import"./color-CG7_7V2-.js";import"./isEqual-g-jK7vY0.js";import"./defaultLocale-5voVPcsN.js";import"./index-DbMBnR4l.js";import"./KebabHorizontalIcon-CXDXtkuL.js";import"./PaintbrushIcon-CLU8RilX.js";import"./index-BJhxZF_K.js";import"./RestartIcon-Ca6_HoK0.js";import"./CellSidebarExtension-B-73cmcQ.js";import"./NotebookSkeleton-CI7ovjNW.js";import"./Avatar-9MpXENSs.js";import"./renderer-DKKfWkWv.js";import"./SquareIcon-e3ygcjpv.js";import"./SortAscIcon-CVKVWIWQ.js";import"./url-DuKx0yk0.js";/* empty css */import"./index-Dro44tIm.js";/* empty css *//* empty css */import"./index-DsG9xhMj.js";/* empty css */import"./index-CNU-WVhQ.js";import"./index--OLIX362.js";import"./index-DYGslHkf.js";import"./index-BSRVX3UN.js";import"./index-BH2OX5l8.js";import"./index-C3vDfO5_.js";import"./index-Ko8lxXFd.js";import"./index-CB9u17_J.js";import"./index-BUVtc_FV.js";import"./ArrowLeftIcon-Y3PTljcl.js";import"./SkubbleIcon-tlg17jBG.js";import"./usePrimerThemeBridge-CoHussa9.js";import"./index-Dobs-OKl.js";import"./KernelVariables-CS6h5HyK.js";import"./index-BvgsWH_d.js";import"./SortDescIcon-CS4EzHeS.js";import"./NotebookToolbar-rtMQZWHQ.js";import"./RepoPushIcon-Cm8g9NuL.js";import"./Toolbar-CGQDY041.js";import"./sessions-BRALW9Yv.js";import"./tokens-DTIgYcNS.js";import"./drivecontents-CxwZz_5W.js";import"./kernel-BI-BLP-K.js";class _e extends Ve{constructor(o){var d;super(),this.model=o.model;const u=new Ue({factory:o.factory,model:this.model,editorOptions:{...o.editorOptions,config:{...(d=o.editorOptions)===null||d===void 0?void 0:d.config,readOnly:!0}}});this.editor=u.editor,(this.layout=new Ke).addWidget(u)}static createCodeViewer(o){const{content:d,mimeType:u,...m}=o,h=new $e.Model({mimeType:u});h.sharedModel.setSource(d);const f=new _e({...m,model:h});return f.disposed.connect(()=>{h.dispose()}),f}get content(){return this.model.sharedModel.getSource()}get mimeType(){return this.model.mimeType}}const zt=new fe("@jupyterlab/console:IConsoleTracker",`A widget tracker for code consoles.
|
|
2
2
|
Use this if you want to be able to iterate over and interact with code consoles
|
|
3
3
|
created by the application.`);class Rt extends Wt{constructor(o,d){const{docRegistry:u,...m}=d;super(o,m),this._readyDelegate=new He,this.editor=o.content,this._docRegistry=u,this._virtualEditor=Object.freeze({getEditor:()=>this.editor.editor,ready:()=>Promise.resolve(this.editor.editor),reveal:()=>Promise.resolve(this.editor.editor)}),Promise.all([this.editor.context.ready,this.connectionManager.ready]).then(async()=>{await this.initOnceReady(),this._readyDelegate.resolve(),this._editorAdded.emit({editor:this._virtualEditor})}).catch(console.error)}get ready(){return this._readyDelegate.promise}get documentPath(){return this.widget.context.path}get mimeType(){var o;const d=this.editor.model.mimeType,u=Array.isArray(d)?(o=d[0])!==null&&o!==void 0?o:ee.defaultMimeType:d,m=this.editor.context.contentsModel;return u!=ee.defaultMimeType?u:m?this._docRegistry.getFileTypeForModel(m).mimeTypes[0]:u}get languageFileExtension(){let o=this.documentPath.split(".");return o[o.length-1]}get ceEditor(){return this.editor.editor}get activeEditor(){return this._virtualEditor}get wrapperElement(){return this.widget.node}get path(){return this.widget.context.path}get editors(){var o,d;return[{ceEditor:this._virtualEditor,type:"code",value:(d=(o=this.editor)===null||o===void 0?void 0:o.model.sharedModel.getSource())!==null&&d!==void 0?d:""}]}dispose(){this.isDisposed||(this._editorRemoved.emit({editor:this._virtualEditor}),this.editor.model.mimeTypeChanged.disconnect(this.reloadConnection),super.dispose())}createVirtualDocument(){return new Lt({language:this.language,foreignCodeExtractors:this.options.foreignCodeExtractorsManager,path:this.documentPath,fileExtension:this.languageFileExtension,standalone:!0,hasLspSupportedFile:!0})}getEditorIndexAt(o){return 0}getEditorIndex(o){return 0}getEditorWrapper(o){return this.wrapperElement}async initOnceReady(){this.initVirtual(),await this.connectDocument(this.virtualDocument,!1),this.editor.model.mimeTypeChanged.connect(this.reloadConnection,this)}}class be extends qe{constructor(o){super(),this.widget=o,this._searchActive=!1}get isReadOnly(){return this.editor.getOption("readOnly")}get replaceOptionsSupport(){return{preserveCase:!0}}get editor(){return this.widget.content.editor}get model(){return this.widget.content.model}async startQuery(o,d){this._searchActive=!0,await super.startQuery(o,d),await this.highlightNext(!0,{from:"selection-start",scroll:!1,select:!1})}async endQuery(){this._searchActive=!1,await super.endQuery()}async onSharedModelChanged(o,d){if(this._searchActive)return super.onSharedModelChanged(o,d)}static createNew(o,d){return new be(o)}static isApplicable(o){return o instanceof Ie&&o.content instanceof bt&&o.content.editor instanceof Qe}getInitialQuery(){const o=this.editor;return o.state.sliceDoc(o.state.selection.main.from,o.state.selection.main.to)}}function Vt(r){return ue.createElement(Ae,{role:"button","aria-haspopup":!0,tabIndex:0,source:r.language,onClick:r.handleClick,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&r.handleClick()}})}class te extends Ee{constructor(o){var d;super(new te.Model(o.languages)),this._handleClick=()=>{const m=new De({commands:this._commands}),h="fileeditor:change-language";this._popup&&this._popup.dispose(),this.model.languages.getLanguages().sort((f,y)=>{var w,M;const x=(w=f.displayName)!==null&&w!==void 0?w:f.name,I=(M=y.displayName)!==null&&M!==void 0?M:y.name;return x.localeCompare(I)}).forEach(f=>{var y;if(f.name.toLowerCase().indexOf("brainf")===0)return;const w={name:f.name,displayName:(y=f.displayName)!==null&&y!==void 0?y:f.name};m.addItem({command:h,args:w})}),this._popup=je({body:m,anchor:this,align:"left"})},this._popup=null,this._commands=o.commands,this.translator=(d=o.translator)!==null&&d!==void 0?d:D;const u=this.translator.load("jupyterlab");this.addClass("jp-mod-highlighted"),this.title.caption=u.__("Change text editor syntax highlighting")}render(){return this.model?ue.createElement(Vt,{language:this.model.language,handleClick:this._handleClick}):null}}(function(r){class o extends Ne{constructor(u){super(),this.languages=u,this._onMIMETypeChange=(m,h)=>{var f;const y=this._language,w=this.languages.findByMIME(h.newValue);this._language=(f=w?.name)!==null&&f!==void 0?f:ee.defaultMimeType,this._triggerChange(y,this._language)},this._language="",this._editor=null}get language(){return this._language}get editor(){return this._editor}set editor(u){var m;const h=this._editor;h!==null&&h.model.mimeTypeChanged.disconnect(this._onMIMETypeChange);const f=this._language;if(this._editor=u,this._editor===null)this._language="";else{const y=this.languages.findByMIME(this._editor.model.mimeType);this._language=(m=y?.name)!==null&&m!==void 0?m:ee.defaultMimeType,this._editor.model.mimeTypeChanged.connect(this._onMIMETypeChange)}this._triggerChange(f,this._language)}_triggerChange(u,m){u!==m&&this.stateChanged.emit(void 0)}}r.Model=o})(te||(te={}));function Ut(r){const d=(r.translator||D).load("jupyterlab"),u=typeof r.tabSpace=="number"?d.__("Spaces"):d.__("Tab Indent");return ue.createElement(Ae,{role:"button","aria-haspopup":!0,tabIndex:0,onClick:r.handleClick,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&r.handleClick()},source:typeof r.tabSpace=="number"?`${u}: ${r.tabSpace}`:u,title:d.__("Change the indentation…")})}class oe extends Ee{constructor(o){super(new oe.Model),this._popup=null,this._menu=o.menu,this.translator=o.translator||D,this.addClass("jp-mod-highlighted")}render(){var o;if(!((o=this.model)===null||o===void 0)&&o.indentUnit){const d=this.model.indentUnit==="Tab"?null:parseInt(this.model.indentUnit,10);return ue.createElement(Ut,{tabSpace:d,handleClick:()=>this._handleClick(),translator:this.translator})}else return null}_handleClick(){const o=this._menu;this._popup&&this._popup.dispose(),o.aboutToClose.connect(this._menuClosed,this),this._popup=je({body:o,anchor:this,align:"right"}),o.update()}_menuClosed(){this.removeClass("jp-mod-clicked")}}(function(r){class o extends Ne{get indentUnit(){return this._indentUnit}set indentUnit(u){u!==this._indentUnit&&(this._indentUnit=u,this.stateChanged.emit())}}r.Model=o})(oe||(oe={}));class Ce extends Ot{createNew(o,d){const u=super.createNew(o,d),m=(h,f)=>{f&&o.content.editor.setCursorPosition({line:f.line,column:0})};return u.activeHeadingChanged.connect(m),o.disposed.connect(()=>{u.activeHeadingChanged.disconnect(m)}),u}}const Kt={part:1,chapter:1,section:1,subsection:2,subsubsection:3,paragraph:4,subparagraph:5},$t=/^\s*\\(section|subsection|subsubsection)\{(.+)\}/;class Ht extends ve{get documentType(){return"latex"}get supportedOptions(){return["maximalDepth","numberHeaders"]}getHeadings(){if(!this.isActive)return Promise.resolve(null);const o=this.widget.content.model.sharedModel.getSource().split(`
|
|
4
4
|
`),d=new Array;let u=d.length;const m=new Array;for(let h=0;h<o.length;h++){const f=o[h].match($t);if(f){const y=Kt[f[1]];if(y<=this.configuration.maximalDepth){const w=Xe(y,u,d,{...this.configuration,baseNumbering:1,numberingH1:!0});u=y,m.push({text:f[2],prefix:w,level:y,line:h})}}}return Promise.resolve(m)}}class qt extends Ce{isApplicable(o){var d,u;if(super.isApplicable(o)){let h=(u=(d=o.content)===null||d===void 0?void 0:d.model)===null||u===void 0?void 0:u.mimeType;return h&&(h==="text/x-latex"||h==="text/x-stex")}return!1}_createNew(o,d){return new Ht(o,d)}}class Qt extends ve{constructor(o,d,u=null){super(o,d),this.widget=o,this.parser=u}get documentType(){return"markdown"}async getHeadings(){if(!this.isActive)return Promise.resolve(null);const o=this.widget.content.model.sharedModel.getSource();return Ge(await Je(o,this.parser),{...this.configuration,numberHeaders:!1})}}class Dt extends Ce{constructor(o,d=null){super(o),this.parser=d}isApplicable(o){var d,u;if(super.isApplicable(o)){let h=(u=(d=o.content)===null||d===void 0?void 0:d.model)===null||u===void 0?void 0:u.mimeType;return h&&Ye(h)}return!1}_createNew(o,d){return new Qt(o,d,this.parser)}}let Z;try{Z=new RegExp("^\\s*(class |def |async def |from |import )","d")}catch{Z=new RegExp("^\\s*(class |def |async def |from |import )")}class Xt extends ve{get documentType(){return"python"}async getHeadings(){if(!this.isActive)return Promise.resolve(null);const o=this.widget.content.model.sharedModel.getSource().split(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{J as L,ag as D,ak as w,dD as q,r as W,v as I,ai as T,dE as k,dF as M,dG as V,dH as K,cG as G,dI as $}from"../datalayer-app-main.js";import{K as j,b as F,c as z,P as U,d as J,I as E,e as N,f as X}from"./index-DSN70XMH.js";import{a as Q}from"./tokens-_fLcuFXz.js";import{I as B}from"./tokens-BHLmeqjP.js";import{I as H}from"./CellSidebarExtension-
|
|
1
|
+
import{J as L,ag as D,ak as w,dD as q,r as W,v as I,ai as T,dE as k,dF as M,dG as V,dH as K,cG as G,dI as $}from"../datalayer-app-main.js";import{K as j,b as F,c as z,P as U,d as J,I as E,e as N,f as X}from"./index-DSN70XMH.js";import{a as Q}from"./tokens-_fLcuFXz.js";import{I as B}from"./tokens-BHLmeqjP.js";import{I as H}from"./CellSidebarExtension-B-73cmcQ.js";import"./hoverbox-CStlKQWE.js";import"./NotebookSkeleton-CI7ovjNW.js";import"./Avatar-9MpXENSs.js";import"./index-S4sn4R3i.js";import"./color-CG7_7V2-.js";import"./isEqual-g-jK7vY0.js";import"./defaultLocale-5voVPcsN.js";import"./renderer-DKKfWkWv.js";import"./SquareIcon-e3ygcjpv.js";const A="CompletionProvider:context";class Y{constructor(){this.identifier=A,this.rank=500,this.renderer=null}async isApplicable(t){return!0}fetch(t,e){const n=e.editor;return n?new Promise(i=>{i(R.contextHint(n))}):Promise.reject("No editor")}}var R;(function(a){function t(n){const i=n.getTokenAtCursor(),r=e(i,n).filter(c=>c.type).map(c=>c.value),m=new Set(r),u=new Array;return m.forEach(c=>u.push({label:c})),{start:i.offset,end:i.offset+i.value.length,items:u}}a.contextHint=t;function e(n,i){return i.getTokens().filter(r=>r.value.indexOf(n.value)===0&&r.value!==n.value)}})(R||(R={}));class Z{constructor(){this._activeProviders=new Set([j,A]),this._inlineCompleterSettings=H.defaultSettings,this._providers=new Map,this._inlineProviders=new Map,this._panelHandlers=new Map,this._mostRecentContext=new Map,this._activeProvidersChanged=new L(this),this._selected=new L(this),this._inlineCompleterFactory=null}get activeProvidersChanged(){return this._activeProvidersChanged}get selected(){return this._selected}setTimeout(t){this._timeout=t}setShowDocumentationPanel(t){this._panelHandlers.forEach(e=>e.completer.showDocsPanel=t),this._showDoc=t}setSuppressIfInlineCompleterActive(t){this._panelHandlers.forEach(e=>e.completer.suppressIfInlineCompleterActive=t),this._suppressIfInlineCompleterActive=t}setContinuousHinting(t){this._panelHandlers.forEach(e=>e.autoCompletion=t),this._autoCompletion=t}registerProvider(t){const e=t.identifier;this._providers.has(e)?console.warn(`Completion provider with identifier ${e} is already registered`):(this._providers.set(e,t),this._panelHandlers.forEach((n,i)=>{this.updateCompleter(this._mostRecentContext.get(i))}))}registerInlineProvider(t){const e=t.identifier;this._inlineProviders.has(e)?console.warn(`Completion provider with identifier ${e} is already registered`):(this._inlineProviders.set(e,t),this._panelHandlers.forEach((n,i)=>{this.updateCompleter(this._mostRecentContext.get(i))}))}getProviders(){return this._providers}activateProvider(t){this._activeProviders=new Set([]),t.forEach(e=>{this._providers.has(e)&&this._activeProviders.add(e)}),this._activeProviders.size===0&&(this._activeProviders.add(j),this._activeProviders.add(A)),this._activeProvidersChanged.emit()}async updateCompleter(t){var e,n;const{widget:i,editor:o,sanitizer:r}=t,m=i.id,u=this._panelHandlers.get(m),c=[...this._activeProviders][0],l=this._providers.get(c);let _=(e=l?.renderer)!==null&&e!==void 0?e:F.getDefaultRenderer(r);const s=l?.modelFactory;let d;s?d=await s.call(l,t):d=new z,this._mostRecentContext.set(i.id,t);const f={model:d,editor:o,renderer:_,sanitizer:r,showDoc:this._showDoc};if(u){const h=u.completer;(n=h.model)===null||n===void 0||n.dispose(),h.model=f.model,h.renderer=f.renderer,h.showDocsPanel=f.showDoc,h.suppressIfInlineCompleterActive=this._suppressIfInlineCompleterActive,u.autoCompletion=this._autoCompletion,o&&(u.editor=o,u.reconciliator=await this.generateReconciliator(t))}else{const h=await this._generateHandler(t,f);this._panelHandlers.set(i.id,h),h.completer.selected.connect((p,g)=>this._selected.emit({insertText:g})),i.disposed.connect(p=>{this.disposeHandler(p.id,h),this._mostRecentContext.delete(m)})}}invoke(t){const e=this._panelHandlers.get(t);e&&e.invoke()}select(t){const e=this._panelHandlers.get(t);e&&e.completer.selectActive()}setInlineCompleterFactory(t){this._inlineCompleterFactory=t,this._panelHandlers.forEach((e,n)=>{this.updateCompleter(this._mostRecentContext.get(n))}),!this.inline&&(this.inline={invoke:e=>{const n=this._panelHandlers.get(e);n&&n.inlineCompleter&&n.invokeInline()},isActive:e=>{const n=this._panelHandlers.get(e);return n&&n.inlineCompleter?n.inlineCompleter.isActive:!1},cycle:(e,n)=>{const i=this._panelHandlers.get(e);i&&i.inlineCompleter&&i.inlineCompleter.cycle(n)},accept:e=>{const n=this._panelHandlers.get(e);n&&n.inlineCompleter&&n.inlineCompleter.accept()},configure:e=>{this._inlineCompleterSettings=e;for(const[n,i]of this._inlineProviders.entries())i.configure&&i.configure(e.providers[n]);this._panelHandlers.forEach((n,i)=>{n.inlineCompleter&&n.inlineCompleter.configure(e),this.updateCompleter(this._mostRecentContext.get(i))})}})}get inlineProviders(){return[...this._inlineProviders.values()]}async generateReconciliator(t){const e=[];for(const[o,r]of Object.entries(this._inlineCompleterSettings.providers))r.enabled===!0&&e.push(o);const n=[...this._inlineProviders.values()].filter(o=>e.includes(o.identifier)),i=[];for(const o of this._activeProviders){const r=this._providers.get(o);r&&i.push(r)}return new U({context:t,providers:i,inlineProviders:n,inlineProvidersSettings:this._inlineCompleterSettings.providers,timeout:this._timeout})}disposeHandler(t,e){var n,i,o,r;(n=e.completer.model)===null||n===void 0||n.dispose(),e.completer.dispose(),(o=(i=e.inlineCompleter)===null||i===void 0?void 0:i.model)===null||o===void 0||o.dispose(),(r=e.inlineCompleter)===null||r===void 0||r.dispose(),e.dispose(),this._panelHandlers.delete(t)}async _generateHandler(t,e){const n=new F(e),i=this._inlineCompleterFactory?this._inlineCompleterFactory.factory({...e,model:new H.Model}):void 0;n.hide(),D.attach(n,document.body),i&&(D.attach(i,document.body),i.hide(),i.configure(this._inlineCompleterSettings));const o=await this.generateReconciliator(t),r=new J({completer:n,inlineCompleter:i,reconciliator:o});return r.editor=t.editor,r}}class ee{constructor(t){this.options=t,this.identifier="@jupyterlab/inline-completer:history",this._maxSuggestions=100;const e=t.translator||w;this._trans=e.load("jupyterlab")}get name(){return this._trans.__("History")}get icon(){return q}get schema(){return{properties:{maxSuggestions:{title:this._trans.__("Maximum number of suggestions"),description:this._trans.__("The maximum number of suggestions to retrieve from history."),type:"number"}},default:{enabled:!1,maxSuggestions:100}}}configure(t){var e;this._maxSuggestions=(e=t.maxSuggestions)!==null&&e!==void 0?e:100}async fetch(t,e,n){var i;const o=(i=e.session)===null||i===void 0?void 0:i.kernel;if(!o)throw new Error("No kernel for completion request.");const m=t.text.slice(0,t.offset).split(`
|
|
2
2
|
`).slice(-1)[0],u=t.text.slice(t.offset).split(`
|
|
3
3
|
`)[0];let c;const l=[];if(m===""){c={output:!1,raw:!0,hist_access_type:"tail",n:this._maxSuggestions};const _=await o.requestHistory(c);if(_.content.status==="ok"){let s=_.content.history;const d=new Map;for(const p of s.reverse()){const g=p[2];d.set(g,(d.get(g)||0)+1)}const h=Array.from(d.entries()).sort((p,g)=>p[1]>g[1]?-1:p[1]<g[1]?1:0);for(const p of h)l.push({insertText:p[0]})}}else{c={output:!1,raw:!0,hist_access_type:"search",pattern:m+"*"+(u?u+"*":""),unique:!0,n:this._maxSuggestions};const _=await o.requestHistory(c);if(_.content.status==="ok")for(const s of _.content.history){const d=s[2].split(`
|
|
4
4
|
`);for(let f=0;f<d.length;f++){const h=d[f];if(h.startsWith(m)){let p=h.slice(m.length);f+1<d.length&&(p+=`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ag as Y,J as D,ci as q,ch as L,ak as F,ac as le,b_ as w,ae as K,aW as G,ai as P,am as ue,cE as pe,aj as me,cx as ge,r as M,c6 as O,ao as be,c1 as k,cS as he,d7 as fe,d8 as ve,cb as V,cG as ye,d9 as R}from"../datalayer-app-main.js";import{I as _e,S as xe}from"./index-Dv_XGY6Q.js";import{I as we,b as X,e as Te,M as H}from"./index-CFP9psRB.js";import{I as Ee}from"./tokens-BHMD_ju9.js";import{I as $}from"./tokens-BHLmeqjP.js";import{I as Ce}from"./treepathupdater-BPaxwIOs.js";import{i as je,e as W,J as N,c as S,f as Z,j as Q,d as A,k as Be,L as Pe,l as Le}from"./index-
|
|
1
|
+
import{ag as Y,J as D,ci as q,ch as L,ak as F,ac as le,b_ as w,ae as K,aW as G,ai as P,am as ue,cE as pe,aj as me,cx as ge,r as M,c6 as O,ao as be,c1 as k,cS as he,d7 as fe,d8 as ve,cb as V,cG as ye,d9 as R}from"../datalayer-app-main.js";import{I as _e,S as xe}from"./index-Dv_XGY6Q.js";import{I as we,b as X,e as Te,M as H}from"./index-CFP9psRB.js";import{I as Ee}from"./tokens-BHMD_ju9.js";import{I as $}from"./tokens-BHLmeqjP.js";import{I as Ce}from"./treepathupdater-BPaxwIOs.js";import{i as je,e as W,J as N,c as S,f as Z,j as Q,d as A,k as Be,L as Pe,l as Le}from"./index-BN8Bbau-.js";import{R as Me}from"./menu-T4su8As2.js";import"./hoverbox-CStlKQWE.js";import"./Output-no9rnFJ7.js";import"./index-DSN70XMH.js";import"./index-S4sn4R3i.js";import"./color-CG7_7V2-.js";import"./isEqual-g-jK7vY0.js";import"./defaultLocale-5voVPcsN.js";import"./index-DbMBnR4l.js";import"./KebabHorizontalIcon-CXDXtkuL.js";import"./PaintbrushIcon-CLU8RilX.js";import"./index-BJhxZF_K.js";import"./RestartIcon-Ca6_HoK0.js";import"./CellSidebarExtension-B-73cmcQ.js";import"./NotebookSkeleton-CI7ovjNW.js";import"./Avatar-9MpXENSs.js";import"./renderer-DKKfWkWv.js";import"./SquareIcon-e3ygcjpv.js";import"./SortAscIcon-CVKVWIWQ.js";import"./url-DuKx0yk0.js";/* empty css */import"./index-Dro44tIm.js";/* empty css *//* empty css */import"./index-DsG9xhMj.js";/* empty css */import"./index-CNU-WVhQ.js";import"./index--OLIX362.js";import"./index-DYGslHkf.js";import"./index-BSRVX3UN.js";import"./index-BH2OX5l8.js";import"./index-C3vDfO5_.js";import"./index-Ko8lxXFd.js";import"./index-CB9u17_J.js";import"./index-BUVtc_FV.js";import"./ArrowLeftIcon-Y3PTljcl.js";import"./SkubbleIcon-tlg17jBG.js";import"./usePrimerThemeBridge-CoHussa9.js";import"./index-Dobs-OKl.js";import"./KernelVariables-CS6h5HyK.js";import"./index-BvgsWH_d.js";import"./SortDescIcon-CS4EzHeS.js";import"./NotebookToolbar-rtMQZWHQ.js";import"./RepoPushIcon-Cm8g9NuL.js";import"./Toolbar-CGQDY041.js";import"./sessions-BRALW9Yv.js";import"./tokens-DTIgYcNS.js";import"./drivecontents-CxwZz_5W.js";import"./kernel-BI-BLP-K.js";class Ie extends Y{constructor(){super(),this._button=document.createElement("button"),this._label=document.createElement("label"),this._valueChanged=new D(this),this._button.className="jp-switch",this._button.setAttribute("role","switch"),this._button.setAttribute("aria-checked",this._value?this._value.toString():"false"),this._label.className="jp-switch-label";const n=document.createElement("div");n.className="jp-switch-track",n.setAttribute("aria-hidden","true"),this._button.appendChild(this._label),this._button.appendChild(n),this.node.appendChild(this._button)}get value(){return this._value}set value(n){const e=this._value;e!==n&&(this._button.setAttribute("aria-checked",n.toString()),this._value=n,this._valueChanged.emit({name:"value",oldValue:e,newValue:n}))}get valueChanged(){return this._valueChanged}get label(){var n;return(n=this._label.textContent)!==null&&n!==void 0?n:""}set label(n){this._label.textContent=n}get caption(){return this._button.title}set caption(n){this._button.title=n,this._label.title=n}handleEvent(n){n.type==="click"&&(this.value=!this.value)}onAfterAttach(){this._button.addEventListener("click",this)}onBeforeDetach(){this._button.removeEventListener("click",this)}}const Re=async function(i,n,e){e=e||F;const c=e.load("jupyterlab"),a=c.__("Server Connection Error"),o=c.__(`A connection to the Jupyter server could not be established.
|
|
2
2
|
JupyterLab will continue trying to reconnect.
|
|
3
3
|
Check your network connection or Jupyter server configuration.
|
|
4
4
|
`);if(!I.displayConnectionLost)return;if(I.serverConnectionLost){await I.serverConnectionLost;return}const r=q({title:a,body:o,checkbox:{label:c.__("Do not show this message again in this session."),caption:c.__("If checked, you will not see a dialog informing you about an issue with server connection in this session.")},buttons:[L.cancelButton({label:c.__("Close")})]}).then(s=>{s.isChecked&&(I.displayConnectionLost=!1)}).catch(s=>{console.error("An error occurred while showing the dialog: ",s)}).finally(()=>{I.serverConnectionLost=void 0});I.serverConnectionLost=r};var I;(function(i){i.displayConnectionLost=!0})(I||(I={}));class ke{constructor(n){this.stop=new le("@jupyterlab/application:Router#stop"),this._routed=new D(this),this._rules=new Map,this.base=n.base,this.commands=n.commands}get current(){var n,e;const{base:c}=this,a=w.URLExt.parse(window.location.href),{search:o,hash:r}=a,s=(e=(n=a.pathname)===null||n===void 0?void 0:n.replace(c,"/"))!==null&&e!==void 0?e:"",f=s+o+r;return{hash:r,path:s,request:f,search:o}}get routed(){return this._routed}navigate(n,e={}){const{base:c}=this,{history:a}=window,{hard:o}=e,r=document.location.href,s=n&&n.indexOf(c)===0?n:w.URLExt.join(c,n);if(s===r)return o?this.reload():void 0;if(a.pushState({},"",s),o)return this.reload();e.skipRouting||requestAnimationFrame(()=>{this.route()})}register(n){var e;const{command:c,pattern:a}=n,o=(e=n.rank)!==null&&e!==void 0?e:100,r=this._rules;return r.set(a,{command:c,rank:o}),new K(()=>{r.delete(a)})}reload(){window.location.reload()}route(){const{commands:n,current:e,stop:c}=this,{request:a}=e,o=this._routed,r=this._rules,s=[];r.forEach((g,h)=>{a?.match(h)&&s.push(g)});const f=s.sort((g,h)=>h.rank-g.rank),m=new G,v=async()=>{if(!f.length){o.emit(e),m.resolve(void 0);return}const{command:g}=f.pop();try{const h=this.current.request;await n.execute(g,e)===c&&(f.length=0,console.debug(`Routing ${h} was short-circuited by ${g}`))}catch(h){console.warn(`Routing ${a} to ${g} failed`,h)}v()};return v(),m.promise}}const Ae="TopBar",ee={id:"@jupyterlab/application-extension:top-bar",description:"Adds a toolbar to the top area (next to the main menu bar).",autoStart:!0,requires:[$,we],optional:[P],activate:(i,n,e,c)=>{const a=(c??F).load("jupyterlab"),o=new ue;o.id="jp-top-bar",o.node.setAttribute("aria-label",a.__("Topbar toolbar")),pe(o,me(e,n,Ae,ee.id,c??F),o),i.shell.add(o,"top",{rank:900})}},z=100;var l;(function(i){i.activateNextTab="application:activate-next-tab",i.activatePreviousTab="application:activate-previous-tab",i.activateNextTabBar="application:activate-next-tab-bar",i.activatePreviousTabBar="application:activate-previous-tab-bar",i.close="application:close",i.closeOtherTabs="application:close-other-tabs",i.closeRightTabs="application:close-right-tabs",i.closeAll="application:close-all",i.setMode="application:set-mode",i.showPropertyPanel="property-inspector:show-panel",i.resetLayout="application:reset-layout",i.toggleContextMenu="application:toggle-context-menu",i.toggleHeader="application:toggle-header",i.toggleMode="application:toggle-mode",i.toggleLeftArea="application:toggle-left-area",i.toggleRightArea="application:toggle-right-area",i.toggleSideTabBar="application:toggle-side-tabbar",i.toggleSidebarWidget="application:toggle-sidebar-widget",i.togglePresentationMode="application:toggle-presentation-mode",i.toggleFullscreenMode="application:toggle-fullscreen-mode",i.tree="router:tree",i.switchSidebar="sidebar:switch"})(l||(l={}));const Se={id:"@jupyterlab/application-extension:commands",description:"Adds commands related to the shell.",autoStart:!0,requires:[P],optional:[S,X],activate:(i,n,e,c)=>{var a;const{commands:o,shell:r}=i,s=n.load("jupyterlab"),f=s.__("Main Area");o.addCommand(Be.contextMenu,{label:s.__("Shift+Right Click for Browser Menu"),describedBy:{args:{type:"object",properties:{}}},isEnabled:()=>!1,execute:()=>{}});const m=()=>{const t=d=>!!d.dataset.id,p=i.contextMenuHitTest(t);return p&&V(r.widgets("main"),d=>d.id===p.dataset.id)||r.currentWidget},v=t=>{t.forEach(p=>p.close())},g=(t,p)=>{if(t.type==="tab-area")return t.widgets.includes(p)?t:null;if(t.type==="split-area")for(const d of t.children){const b=g(d,p);if(b)return b}return null},h=t=>{var p;const d=e?.saveLayout(),b=d?.mainArea;if(!b||w.PageConfig.getOption("mode")!=="multiple-document")return null;const _=(p=b.dock)===null||p===void 0?void 0:p.main;return _?g(_,t):null},u=t=>{const{id:p}=t,d=h(t),b=d?d.widgets||[]:[],_=b.findIndex(T=>T.id===p);return _<0?[]:b.slice(_+1)},y=t=>{let p;if(t!="left"&&t!="right")throw Error(`Unsupported sidebar: ${t}`);if(t==="left")p=document.querySelector(".lm-TabBar-tab.lm-mod-current");else{const b=document.querySelectorAll(".lm-TabBar-tab.lm-mod-current");p=b[b.length-1]}const d=p?.getAttribute("data-id");return d?d?.toString():""};function x(t){t&&t.focus()}o.addCommand(l.close,{label:()=>s.__("Close Tab"),describedBy:{args:{type:"object",properties:{}}},isEnabled:()=>{const t=m();return!!t&&t.title.closable},execute:()=>{const t=m();t&&t.close()}}),o.addCommand(l.closeOtherTabs,{label:()=>s.__("Close All Other Tabs"),describedBy:{args:{type:"object",properties:{}}},isEnabled:()=>be(r.widgets("main"),(t,p)=>p===1),execute:()=>{const t=m();if(!t)return;const{id:p}=t;for(const d of r.widgets("main"))d.id!==p&&d.close()}}),o.addCommand(l.closeRightTabs,{label:()=>s.__("Close Tabs to Right"),describedBy:{args:{type:"object",properties:{}}},isEnabled:()=>!!m()&&u(m()).length>0,execute:()=>{const t=m();t&&v(u(t))}}),(a=r.currentChanged)===null||a===void 0||a.connect(()=>{[l.close,l.closeOtherTabs,l.closeRightTabs].forEach(t=>o.notifyCommandChanged(t))}),e&&(o.addCommand(l.activateNextTab,{label:s.__("Activate Next Tab"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{e.activateNextTab()}}),o.addCommand(l.activatePreviousTab,{label:s.__("Activate Previous Tab"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{e.activatePreviousTab()}}),o.addCommand(l.activateNextTabBar,{label:s.__("Activate Next Tab Bar"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{e.activateNextTabBar()}}),o.addCommand(l.activatePreviousTabBar,{label:s.__("Activate Previous Tab Bar"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{e.activatePreviousTabBar()}}),o.addCommand(l.closeAll,{label:s.__("Close All Tabs"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{e.closeAll()}}),o.addCommand(l.toggleHeader,{label:s.__("Show Header"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{e.mode==="single-document"&&e.toggleTopInSimpleModeVisibility()},isToggled:()=>e.isTopInSimpleModeVisible(),isVisible:()=>e.mode==="single-document"}),o.addCommand(l.toggleLeftArea,{label:s.__("Show Left Sidebar"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{e.leftCollapsed?e.expandLeft():(e.collapseLeft(),e.currentWidget&&e.activateById(e.currentWidget.id))},isToggled:()=>!e.leftCollapsed,isEnabled:()=>!e.isEmpty("left")}),o.addCommand(l.toggleRightArea,{label:s.__("Show Right Sidebar"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{e.rightCollapsed?e.expandRight():(e.collapseRight(),e.currentWidget&&e.activateById(e.currentWidget.id))},isToggled:()=>!e.rightCollapsed,isEnabled:()=>!e.isEmpty("right")}),o.addCommand(l.toggleSidebarWidget,{label:t=>t===void 0||t.side===void 0||t.index===void 0?s.__("Toggle Sidebar Element"):t.side==="right"?s.__("Toggle Element %1 in Right Sidebar",parseInt(t.index,10)+1):s.__("Toggle Element %1 in Left Sidebar",parseInt(t.index,10)+1),describedBy:{args:{type:"object",properties:{side:{type:"string",enum:["left","right"],description:s.__("The sidebar side")},index:{type:["string","number"],description:s.__("The index of the sidebar widget")}},required:["side","index"]}},execute:t=>{const p=parseInt(t.index,10);if(t.side!="left"&&t.side!="right")throw Error(`Unsupported sidebar: ${t.side}`);const d=Array.from(e.widgets(t.side));if(p>=d.length)return;const b=d[p].id,_=document.querySelector("[data-id='"+b+"']");y(t.side)===b?(t.side=="left"&&(e.collapseLeft(),x(_)),t.side=="right"&&(e.collapseRight(),x(_))):(e.activateById(b),x(_))}}),o.addCommand(l.toggleSideTabBar,{label:t=>t.side==="right"?s.__("Show Right Activity Bar"):s.__("Show Left Activity Bar"),describedBy:{args:{type:"object",properties:{side:{type:"string",enum:["left","right"],description:s.__("The sidebar side")}},required:["side"]}},execute:t=>{t.side==="right"?e.toggleSideTabBarVisibility("right"):e.toggleSideTabBarVisibility("left")},isToggled:t=>t.side==="right"?e.isSideTabBarVisible("right"):e.isSideTabBarVisible("left"),isEnabled:t=>t.side==="right"?!e.isEmpty("right"):!e.isEmpty("left")}),o.addCommand(l.togglePresentationMode,{label:()=>s.__("Presentation Mode"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{e.presentationMode=!e.presentationMode},isToggled:()=>e.presentationMode,isVisible:()=>!0}),o.addCommand(l.toggleFullscreenMode,{label:s.__("Fullscreen Mode"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{document.fullscreenElement===null||document.fullscreenElement===void 0?document.documentElement.requestFullscreen().catch(t=>{console.error("Failed to enter fullscreen mode.",t)}):document.fullscreenElement!==null&&document.exitFullscreen().catch(t=>{console.error("Failed to exit fullscreen mode.",t)})},isToggled:()=>document.fullscreenElement!==null}),o.addCommand(l.setMode,{label:t=>t.mode?s.__("Set %1 mode.",t.mode):s.__("Set the layout `mode`."),caption:s.__('The layout `mode` can be "single-document" or "multiple-document".'),describedBy:{args:{type:"object",properties:{mode:{type:"string",enum:["single-document","multiple-document"],description:s.__("The layout mode")}},required:["mode"]}},isVisible:t=>{const p=t.mode;return p==="single-document"||p==="multiple-document"},execute:t=>{const p=t.mode;if(p==="single-document"||p==="multiple-document"){e.mode=p;return}throw new Error(`Unsupported application shell mode: ${p}`)}}),o.addCommand(l.toggleMode,{label:s.__("Simple Interface"),describedBy:{args:{type:"object",properties:{}}},isToggled:()=>e.mode==="single-document",execute:()=>{const t=e.mode==="multiple-document"?{mode:"single-document"}:{mode:"multiple-document"};return o.execute(l.setMode,t)}}),o.addCommand(l.resetLayout,{label:s.__("Reset Default Layout"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{e.presentationMode&&o.execute(l.togglePresentationMode).catch(t=>{console.error("Failed to undo presentation mode.",t)}),(document.fullscreenElement!==null||document.fullscreenElement!==void 0)&&o.execute(l.toggleFullscreenMode).catch(t=>{console.error("Failed to exit fullscreen mode.",t)}),e.mode==="single-document"&&!e.isTopInSimpleModeVisible()&&o.execute(l.toggleHeader).catch(t=>{console.error("Failed to display title header.",t)}),["left","right"].forEach(t=>{!e.isSideTabBarVisible(t)&&!e.isEmpty(t)&&o.execute(l.toggleSideTabBar,{side:t}).catch(p=>{console.error(`Failed to show ${t} activity bar.`,p)})})}})),c&&([l.activateNextTab,l.activatePreviousTab,l.activateNextTabBar,l.activatePreviousTabBar,l.close,l.closeAll,l.closeOtherTabs,l.closeRightTabs,l.toggleHeader,l.toggleLeftArea,l.toggleRightArea,l.togglePresentationMode,l.toggleFullscreenMode,l.toggleMode,l.resetLayout].forEach(t=>c.addItem({command:t,category:f})),["right","left"].forEach(t=>{c.addItem({command:l.toggleSideTabBar,category:f,args:{side:t}})}))}},te={id:"@jupyterlab/application-extension:main",description:"Initializes the application and provides the URL tree path handler.",requires:[W,Te,P,N.ITreeResolver],optional:[je],provides:Ce,activate:(i,n,e,c,a,o)=>{const r=c.load("jupyterlab");if(!(i instanceof A))throw new Error(`${te.id} must be activated in JupyterLab.`);let s="",f="";function m(u){a.paths.then(()=>{if(f=u,!s){const y=w.PageConfig.getUrl({treePath:u}),x=w.URLExt.parse(y).pathname;n.navigate(x,{skipRouting:!0}),w.PageConfig.setOption("treePath",u)}})}const v=e.name;if(console.debug(`Starting application in workspace: "${v}"`),i.registerPluginErrors.length!==0){const u=M.createElement("pre",null,i.registerPluginErrors.map(y=>y.message).join(`
|