@datalayer/agent-runtimes 1.3.103 → 1.3.105
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/{AgentDetails-CO9iM59C.js → AgentDetails-eWkEnFI1.js} +1 -1
- package/dist-embed/chunks/{AgentDetailsDialog-DmD6xm6k.js → AgentDetailsDialog-BXJek5nf.js} +1 -1
- package/dist-embed/chunks/{AgentInspector-kDMuvh45.js → AgentInspector-B1wLMu4Z.js} +1 -1
- package/dist-embed/chunks/{AgentInspectorDialog-fT96Pb4Z.js → AgentInspectorDialog-DcLrhdWo.js} +1 -1
- package/dist-embed/chunks/Avatar-BrPfm89P.js +1 -0
- package/dist-embed/chunks/{CellSidebarExtension-B-vao30u.js → CellSidebarExtension-BWsHtuqs.js} +2 -2
- package/dist-embed/chunks/ChatView-ef0jot57.js +32 -0
- package/dist-embed/chunks/DatalayerAgentBridge-DvlGUOdE.js +1 -0
- package/dist-embed/chunks/{DeckComponent-Fp6Vw8vN.js → DeckComponent-BfOXdQhk.js} +1 -1
- package/dist-embed/chunks/{DocumentView-DKUbyyJg.js → DocumentView-DCgaQoOU.js} +1 -1
- package/dist-embed/chunks/{EphemeralDocument-CgYPEfGC.js → EphemeralDocument-DVAfnQWS.js} +1 -1
- package/dist-embed/chunks/{EphemeralNotebook-DvDbCKnr.js → EphemeralNotebook-C1ANS_1u.js} +1 -1
- package/dist-embed/chunks/{ExcalidrawComponent-BehqBpwC.js → ExcalidrawComponent-0e3KqmKJ.js} +1 -1
- package/dist-embed/chunks/{ExcalidrawModal-B2sXbVJB.js → ExcalidrawModal-C5Or1sZ5.js} +1 -1
- package/dist-embed/chunks/{Flash-DdFxPtBI.js → Flash-C3nF3s4G.js} +1 -1
- package/dist-embed/chunks/{JupyterLexicalExtension-CUsjvchq.js → JupyterLexicalExtension-CEjN8cLT.js} +7 -7
- package/dist-embed/chunks/{KernelVariables-BUmOt4yF.js → KernelVariables-DyYN9sSS.js} +1 -1
- package/dist-embed/chunks/{NotebookSkeleton-D9WNoiWD.js → NotebookSkeleton-z8GKB7Tb.js} +1 -1
- package/dist-embed/chunks/{NotebookToolbar-C2_ZC9Ej.js → NotebookToolbar-Dv7QkxKA.js} +1 -1
- package/dist-embed/chunks/{NotebookView-BActuABH.js → NotebookView-CNHzc28A.js} +1 -1
- package/dist-embed/chunks/{SandboxDetailsDialog-C0afmOA7.js → SandboxDetailsDialog-D4HA7PZA.js} +1 -1
- package/dist-embed/chunks/{SchemaForm-B351kd79.js → SchemaForm-bWlj1cVy.js} +1 -1
- package/dist-embed/chunks/{Toolbar-B6ROXJ-2.js → Toolbar-BxAi9T92.js} +1 -1
- package/dist-embed/chunks/{YouTubePlugin-CqA-IwCx.js → YouTubePlugin-ZawlUPsx.js} +1 -1
- package/dist-embed/chunks/{ar-SA-G6X2FPQ2-DhQlC4AZ.js → ar-SA-G6X2FPQ2-DqE6ftcU.js} +1 -1
- package/dist-embed/chunks/{az-AZ-76LH7QW2-CDvJeI6H.js → az-AZ-76LH7QW2-8y_pqJhn.js} +1 -1
- package/dist-embed/chunks/{bg-BG-XCXSNQG7-B_2t7dwS.js → bg-BG-XCXSNQG7-4NX5jouU.js} +1 -1
- package/dist-embed/chunks/{bn-BD-2XOGV67Q-B7nTDj-4.js → bn-BD-2XOGV67Q-BB87_pS6.js} +1 -1
- package/dist-embed/chunks/{ca-ES-6MX7JW3Y-llJD_i9l.js → ca-ES-6MX7JW3Y-B9gyglRE.js} +1 -1
- package/dist-embed/chunks/{cs-CZ-2BRQDIVT-Cm_uiYT0.js → cs-CZ-2BRQDIVT-CmZhtHam.js} +1 -1
- package/dist-embed/chunks/{da-DK-5WZEPLOC-B0lo6-wZ.js → da-DK-5WZEPLOC-CU6rP6vm.js} +1 -1
- package/dist-embed/chunks/{de-DE-XR44H4JA-DZrN-mJo.js → de-DE-XR44H4JA-wk6_Fx0e.js} +1 -1
- package/dist-embed/chunks/{el-GR-BZB4AONW-C4D5ZbOc.js → el-GR-BZB4AONW-Cy5yeukb.js} +1 -1
- package/dist-embed/chunks/{es-ES-U4NZUMDT-D1yiS-ZI.js → es-ES-U4NZUMDT-Ccr3g95I.js} +1 -1
- package/dist-embed/chunks/{eu-ES-A7QVB2H4-Zm3lJsL6.js → eu-ES-A7QVB2H4-u0DKk40F.js} +1 -1
- package/dist-embed/chunks/{fa-IR-HGAKTJCU-Dhv2lg_O.js → fa-IR-HGAKTJCU-BYSSU2Gx.js} +1 -1
- package/dist-embed/chunks/{fi-FI-Z5N7JZ37-QeFFEfyg.js → fi-FI-Z5N7JZ37-98vDI-0h.js} +1 -1
- package/dist-embed/chunks/{fr-FR-RHASNOE6-DjbRpOS6.js → fr-FR-RHASNOE6-D2BvErn0.js} +1 -1
- package/dist-embed/chunks/{gl-ES-HMX3MZ6V-C-ev9dqC.js → gl-ES-HMX3MZ6V-DP7FRXtT.js} +1 -1
- package/dist-embed/chunks/{he-IL-6SHJWFNN-DHoNpuA6.js → he-IL-6SHJWFNN-B92ZDKBK.js} +1 -1
- package/dist-embed/chunks/{hi-IN-IWLTKZ5I-JZJZPoWj.js → hi-IN-IWLTKZ5I-Dw2EhOq2.js} +1 -1
- package/dist-embed/chunks/{hu-HU-A5ZG7DT2-RzCikyBW.js → hu-HU-A5ZG7DT2-CVh5JW9n.js} +1 -1
- package/dist-embed/chunks/{id-ID-SAP4L64H-Bn08nS9B.js → id-ID-SAP4L64H-CaKn7Yw0.js} +1 -1
- package/dist-embed/chunks/{index-DIHzcHI1.js → index-5Mm_lDnH.js} +1 -1
- package/dist-embed/chunks/{index-B1StFYI5.js → index-B46RcdCt.js} +1 -1
- package/dist-embed/chunks/{index-qzUKNibz.js → index-B6RMWdb4.js} +1 -1
- package/dist-embed/chunks/{index-88CEdMmU.js → index-BI_ojvKX.js} +1 -1
- package/dist-embed/chunks/{index-uutAM7NJ.js → index-BWxQD9cP.js} +1 -1
- package/dist-embed/chunks/{index-DCX_IqLg.js → index-B_WAs-60.js} +1 -1
- package/dist-embed/chunks/{index-BYofH50G.js → index-BaEB7wmN.js} +1 -1
- package/dist-embed/chunks/{index-C0iUgNwj.js → index-BmSB4k4X.js} +1 -1
- package/dist-embed/chunks/{index-KWzHwvvN.js → index-BsGIdntV.js} +4 -4
- package/dist-embed/chunks/{index-DgnVcOqG.js → index-BsP7mWx7.js} +1 -1
- package/dist-embed/chunks/{index-aX9x7qni.js → index-BzZvBTsd.js} +1 -1
- package/dist-embed/chunks/{index-BA2STD4N.js → index-C0ac25cM.js} +2 -2
- package/dist-embed/chunks/{index-DLk6Znxv.js → index-C0fJQ9v3.js} +1 -1
- package/dist-embed/chunks/{index-Bs1pVq7E.js → index-C0p6TrSH.js} +1 -1
- package/dist-embed/chunks/{index-DZN9JYOE.js → index-C9mAUugR.js} +1 -1
- package/dist-embed/chunks/{index-B1Egld01.js → index-CNBMan5A.js} +1 -1
- package/dist-embed/chunks/{index-1Ekpl0uC.js → index-CawAyW3R.js} +1 -1
- package/dist-embed/chunks/{index-DeYQGrTz.js → index-Cb-91zWU.js} +1 -1
- package/dist-embed/chunks/{index-B2dtLxcg.js → index-CkMGJGPw.js} +1 -1
- package/dist-embed/chunks/{index-Cqur_rhw.js → index-CsbfZWj5.js} +1 -1
- package/dist-embed/chunks/{index-DsX9nIHt.js → index-D1HhRyAi.js} +1 -1
- package/dist-embed/chunks/{index-C5xKtdLU.js → index-D3ml5vHy.js} +1 -1
- package/dist-embed/chunks/{index-CqKV027P.js → index-D7SzNRox.js} +1 -1
- package/dist-embed/chunks/{index-BUbwVG__.js → index-DAwoO3Uu.js} +1 -1
- package/dist-embed/chunks/{index-DHVYKZ44.js → index-DQaxtq0S.js} +1 -1
- package/dist-embed/chunks/{index-BbsUSk_Q.js → index-DbPtsB38.js} +1 -1
- package/dist-embed/chunks/{index-DJomc4za.js → index-DoYPeIKg.js} +1 -1
- package/dist-embed/chunks/{index-hqa_ODOD.js → index-Dr_NppDz.js} +1 -1
- package/dist-embed/chunks/{index-D7rnWGLu.js → index-DuDsMDnx.js} +3 -3
- package/dist-embed/chunks/{index-B5MiaXUV.js → index-IIxS-G5t.js} +1 -1
- package/dist-embed/chunks/{index-90Ss7516.js → index-W7nq_bBb.js} +1 -1
- package/dist-embed/chunks/{index-Cjx6uk6z.js → index-r_7Z9Uyr.js} +1 -1
- package/dist-embed/chunks/{index.esm-DlPZAW-m.js → index.esm-D5bfliIL.js} +1 -1
- package/dist-embed/chunks/{it-IT-JPQ66NNP-C2vJMuKM.js → it-IT-JPQ66NNP-CJGzhajv.js} +1 -1
- package/dist-embed/chunks/{ja-JP-DBVTYXUO-C8KOKQt9.js → ja-JP-DBVTYXUO-Jm7LgxUu.js} +1 -1
- package/dist-embed/chunks/{kaa-6HZHGXH3-CvxJbmMB.js → kaa-6HZHGXH3-DH21E_2q.js} +1 -1
- package/dist-embed/chunks/{kab-KAB-ZGHBKWFO-CQJhf9Nn.js → kab-KAB-ZGHBKWFO-2Cx_3mmx.js} +1 -1
- package/dist-embed/chunks/{kk-KZ-P5N5QNE5-Dl6YC0GH.js → kk-KZ-P5N5QNE5-C2v01t5f.js} +1 -1
- package/dist-embed/chunks/{km-KH-HSX4SM5Z-QYB-tJ4i.js → km-KH-HSX4SM5Z-WL_JAugw.js} +1 -1
- package/dist-embed/chunks/{ko-KR-MTYHY66A-D6yzBqJ5.js → ko-KR-MTYHY66A-DWjrj8WD.js} +1 -1
- package/dist-embed/chunks/{ku-TR-6OUDTVRD-C43l2362.js → ku-TR-6OUDTVRD-CwTRLeeu.js} +1 -1
- package/dist-embed/chunks/{lt-LT-XHIRWOB4-BG1v5NwF.js → lt-LT-XHIRWOB4-GVGjjS1d.js} +1 -1
- package/dist-embed/chunks/{lv-LV-5QDEKY6T-CAwm1y_0.js → lv-LV-5QDEKY6T-C29ftTES.js} +1 -1
- package/dist-embed/chunks/{markdown-CH2i4TVR.js → markdown-Bf4-A1yl.js} +1 -1
- package/dist-embed/chunks/{mr-IN-CRQNXWMA-DSk6q1fp.js → mr-IN-CRQNXWMA-Cyym_1yB.js} +1 -1
- package/dist-embed/chunks/{my-MM-5M5IBNSE-BRiKXulk.js → my-MM-5M5IBNSE-BOkGbWeI.js} +1 -1
- package/dist-embed/chunks/{nb-NO-T6EIAALU-CCDnctVd.js → nb-NO-T6EIAALU-BjaVTNUf.js} +1 -1
- package/dist-embed/chunks/{nl-NL-IS3SIHDZ-DwStD_Ch.js → nl-NL-IS3SIHDZ-DSVCFPQj.js} +1 -1
- package/dist-embed/chunks/{nn-NO-6E72VCQL-DNcfjETk.js → nn-NO-6E72VCQL-D5-_rRv0.js} +1 -1
- package/dist-embed/chunks/{oc-FR-POXYY2M6-BOjjS12P.js → oc-FR-POXYY2M6-CxKcn1R4.js} +1 -1
- package/dist-embed/chunks/{pa-IN-N4M65BXN-B4y5cv2_.js → pa-IN-N4M65BXN-D9r6O5PP.js} +1 -1
- package/dist-embed/chunks/{percentages-BXMCSKIN-BpahO1D1.js → percentages-BXMCSKIN-917PkDRT.js} +3 -3
- package/dist-embed/chunks/{pl-PL-T2D74RX3-CfuLoYHB.js → pl-PL-T2D74RX3-CFXCTA5m.js} +1 -1
- package/dist-embed/chunks/{plugin-BMH63P5M.js → plugin-CA_0EWiO.js} +1 -1
- package/dist-embed/chunks/plugin-LDJjixuG.js +1 -0
- package/dist-embed/chunks/{pt-BR-5N22H2LF-Fk60PfdA.js → pt-BR-5N22H2LF-7A-3KOon.js} +1 -1
- package/dist-embed/chunks/{pt-PT-UZXXM6DQ-SNAgJ5Vr.js → pt-PT-UZXXM6DQ-BJLo5w79.js} +1 -1
- package/dist-embed/chunks/{ro-RO-JPDTUUEW-YkxpKkWn.js → ro-RO-JPDTUUEW-DtvOR1_K.js} +1 -1
- package/dist-embed/chunks/{ru-RU-B4JR7IUQ-CaI1rtvc.js → ru-RU-B4JR7IUQ-CGQ0z7l6.js} +1 -1
- package/dist-embed/chunks/{sessions-ZDYLkdi_.js → sessions-By2lggFS.js} +2 -2
- package/dist-embed/chunks/{si-LK-N5RQ5JYF-CQz29xmh.js → si-LK-N5RQ5JYF-D13wg56d.js} +1 -1
- package/dist-embed/chunks/{sk-SK-C5VTKIMK-CZg7PVzd.js → sk-SK-C5VTKIMK-BqAZ0R3f.js} +1 -1
- package/dist-embed/chunks/{sl-SI-NN7IZMDC-D-EjMWyZ.js → sl-SI-NN7IZMDC-BjPUGdws.js} +1 -1
- package/dist-embed/chunks/{standalone-oyxre9MX.js → standalone-DyCMuq_1.js} +1 -1
- package/dist-embed/chunks/{subset-shared.chunk-BIvvzzX2.js → subset-shared.chunk-D-GUkcCO.js} +1 -1
- package/dist-embed/chunks/{subset-worker.chunk-DGgI6iRY.js → subset-worker.chunk-Bz8aK3Nt.js} +1 -1
- package/dist-embed/chunks/{sv-SE-XGPEYMSR-D8CsNMON.js → sv-SE-XGPEYMSR-DrXTnEWd.js} +1 -1
- package/dist-embed/chunks/{ta-IN-2NMHFXQM-CvuxKO7t.js → ta-IN-2NMHFXQM-bK104VxM.js} +1 -1
- package/dist-embed/chunks/{th-TH-HPSO5L25-NgQJigwq.js → th-TH-HPSO5L25-BSo6r7L4.js} +1 -1
- package/dist-embed/chunks/{tr-TR-DEFEU3FU-eu9-qLmi.js → tr-TR-DEFEU3FU-pYKvN-ro.js} +1 -1
- package/dist-embed/chunks/{uk-UA-QMV73CPH-CbjmuLVL.js → uk-UA-QMV73CPH-DFR0z9gx.js} +1 -1
- package/dist-embed/chunks/{usePrimerThemeBridge-LgREOVgz.js → usePrimerThemeBridge-CuRRiOcg.js} +1 -1
- package/dist-embed/chunks/{vi-VN-M7AON7JQ-u84yOuJ-.js → vi-VN-M7AON7JQ-BwMeNi1s.js} +1 -1
- package/dist-embed/chunks/{zh-CN-LNUGB5OW-ojkSgl-t.js → zh-CN-LNUGB5OW-QC_JIHYo.js} +1 -1
- package/dist-embed/chunks/{zh-HK-E62DVLB3-C6M89-Da.js → zh-HK-E62DVLB3-BHs8J1Gl.js} +1 -1
- package/dist-embed/chunks/{zh-TW-RAJ6MFWO-BaTtFORh.js → zh-TW-RAJ6MFWO-DpqpYlIS.js} +1 -1
- package/dist-embed/datalayer-app-main.js +330 -59
- package/lib/apps/apps/AppBrowserSandbox.d.ts +7 -0
- package/lib/apps/apps/AppBrowserSandbox.js +52 -0
- package/lib/apps/apps/AppRenderer.js +11 -2
- package/lib/apps/apps/appspec.js +31 -0
- package/lib/apps/apps/browserSandbox.d.ts +69 -0
- package/lib/apps/apps/browserSandbox.js +159 -0
- package/lib/apps/apps/index.d.ts +2 -0
- package/lib/apps/apps/index.js +2 -0
- package/lib/apps/plugins/chat/ChatView.js +59 -7
- package/lib/components/inspector/a2aSpans.js +5 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/pap/index.d.ts +42 -0
- package/lib/pap/index.js +57 -0
- package/lib/specs/apps.js +345 -8
- package/lib/specs/appspecSchema.js +79 -0
- package/lib/types/agentspecs.d.ts +28 -0
- package/package.json +2 -1
- package/scripts/codegen/generate_apps.py +3 -2
- package/dist-embed/chunks/Avatar-Dqz3ZWjZ.js +0 -1
- package/dist-embed/chunks/ChatView-CubqJum2.js +0 -288
- package/dist-embed/chunks/DatalayerAgentBridge-BmJbZ2Lk.js +0 -1
- package/dist-embed/chunks/plugin-DZPXm2dP.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ai as Y,F as D,cA as q,cz as L,ao as F,ae as le,cg as w,ag as K,b9 as X,am as P,al as ue,ar as pe,d0 as me,an as ge,av as Z,dz as be,cV as he,r as M,co as O,at as fe,cj as R,df as ve,dA as ye,dB as _e,ct as V,d3 as xe,dC as A,dD as z}from"../datalayer-app-main.js";import{I as we,S as Te}from"./index-DkY_OIbM.js";import{I as Ee}from"./tokens-CbEQpcM3.js";import{I as J}from"./tokens-CREF1pN9.js";import{I as Ce}from"./treepathupdater-PWAx8TXe.js";import{i as je,e as W,J as N,c as S,f as G,j as Q,d as k,k as Be,L as Pe,l as Le}from"./index-
|
|
1
|
+
import{ai as Y,F as D,cA as q,cz as L,ao as F,ae as le,cg as w,ag as K,b9 as X,am as P,al as ue,ar as pe,d0 as me,an as ge,av as Z,dz as be,cV as he,r as M,co as O,at as fe,cj as R,df as ve,dA as ye,dB as _e,ct as V,d3 as xe,dC as A,dD as z}from"../datalayer-app-main.js";import{I as we,S as Te}from"./index-DkY_OIbM.js";import{I as Ee}from"./tokens-CbEQpcM3.js";import{I as J}from"./tokens-CREF1pN9.js";import{I as Ce}from"./treepathupdater-PWAx8TXe.js";import{i as je,e as W,J as N,c as S,f as G,j as Q,d as k,k as Be,L as Pe,l as Le}from"./index-DuDsMDnx.js";import{R as Me}from"./menu-YajQJnN4.js";import"./CellSidebarExtension-BWsHtuqs.js";import"./NotebookSkeleton-z8GKB7Tb.js";import"./Avatar-BrPfm89P.js";import"./renderer-jz0zn1Az.js";import"./SquareIcon-e3ygcjpv.js";import"./SortAscIcon-CVKVWIWQ.js";import"./url-DEeTWrO-.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-CuRRiOcg.js";import"./index-5Mm_lDnH.js";import"./KernelVariables-DyYN9sSS.js";import"./Flash-C3nF3s4G.js";import"./index-BxurLo3u.js";import"./SortDescIcon-CS4EzHeS.js";import"./NotebookToolbar-Dv7QkxKA.js";import"./RepoPushIcon-Cm8g9NuL.js";import"./Toolbar-BxAi9T92.js";import"./sessions-By2lggFS.js";import"./tokens-B5KQP74f.js";import"./drivecontents-BHpoQXqz.js";import"./kernel-4uWz8R6G.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 Ae=async function(i,n,e){e=e||F;const d=e.load("jupyterlab"),a=d.__("Server Connection Error"),o=d.__(`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:d.__("Do not show this message again in this session."),caption:d.__("If checked, you will not see a dialog informing you about an issue with server connection in this session.")},buttons:[L.cancelButton({label:d.__("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 Re{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:d}=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(d,"/"))!==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:d}=this,{history:a}=window,{hard:o}=e,r=document.location.href,s=n&&n.indexOf(d)===0?n:w.URLExt.join(d,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:d,pattern:a}=n,o=(e=n.rank)!==null&&e!==void 0?e:100,r=this._rules;return r.set(a,{command:d,rank:o}),new K(()=>{r.delete(a)})}reload(){window.location.reload()}route(){const{commands:n,current:e,stop:d}=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 X,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)===d&&(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 ke="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:[J,ue],optional:[P],activate:(i,n,e,d)=>{const a=(d??F).load("jupyterlab"),o=new pe;o.id="jp-top-bar",o.node.setAttribute("aria-label",a.__("Topbar toolbar")),me(o,ge(e,n,ke,ee.id,d??F),o),i.shell.add(o,"top",{rank:900})}},H=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,Z],activate:(i,n,e,d)=>{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=c=>!!c.dataset.id,p=i.contextMenuHitTest(t);return p&&V(r.widgets("main"),c=>c.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 c of t.children){const b=g(c,p);if(b)return b}return null},h=t=>{var p;const c=e?.saveLayout(),b=c?.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,c=h(t),b=c?c.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 c=p?.getAttribute("data-id");return c?c?.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:()=>fe(r.widgets("main"),(t,p)=>p===1),execute:()=>{const t=m();if(!t)return;const{id:p}=t;for(const c of r.widgets("main"))c.id!==p&&c.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 c=Array.from(e.widgets(t.side));if(p>=c.length)return;const b=c[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)})})}})),d&&([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=>d.addItem({command:t,category:f})),["right","left"].forEach(t=>{d.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,be,P,N.ITreeResolver],optional:[je],provides:Ce,activate:(i,n,e,d,a,o)=>{const r=d.load("jupyterlab");if(!(i instanceof k))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(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as e,r as l}from"../datalayer-app-main.js";import{I as r,r as t}from"./JupyterLexicalExtension-
|
|
1
|
+
import{G as e,r as l}from"../datalayer-app-main.js";import{I as r,r as t}from"./JupyterLexicalExtension-CEjN8cLT.js";import{$ as x,a as I,b as L,c as A,d as M,e as O,C as P,f as S,g as _}from"./JupyterLexicalExtension-CEjN8cLT.js";import"./NotebookSkeleton-z8GKB7Tb.js";import"./Avatar-BrPfm89P.js";import"./url-DEeTWrO-.js";import"./isSymbol-BLtK9CV6.js";import"./toNumber-B1wj8-wx.js";import"./VideoIcon-BjP_LDa4.js";import"./LinkIcon-DUI0jw25.js";import"./Toolbar-BxAi9T92.js";import"./ArrowUpIcon-BUCpIXDR.js";import"./SortDescIcon-CS4EzHeS.js";import"./PrismCss-u5utqjht.js";import"./LexicalToolRegistry-DoZIM1lF.js";function E(){const[o]=e();return l.useEffect(()=>t(o),[o]),null}export{x as $createCollapsibleContainerNode,I as $createCollapsibleContentNode,L as $createCollapsibleTitleNode,A as $isCollapsibleContainerNode,M as $isCollapsibleContentNode,O as $isCollapsibleTitleNode,P as CollapsibleContainerNode,S as CollapsibleContentNode,E as CollapsiblePlugin,_ as CollapsibleTitleNode,r as INSERT_COLLAPSIBLE_COMMAND,E as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as V}from"./LexicalToolRegistry-DoZIM1lF.js";import{D as Ol,a as Ml,b as Dl,e as Bl,c as jl,g as Fl,i as Ul,f as zl,l as Hl,h as ql,j as Wl,k as Xl,m as Jl,n as Vl,r as Yl,o as Gl,p as Zl,q as Kl,s as Ql,t as ec,v as tc,w as nc,x as sc,y as oc,z as rc,u as ic}from"./LexicalToolRegistry-DoZIM1lF.js";import{_ as qt,E as Mn,G as Dn,H as Bn,K as me,M as Wt,O as ot,P as rt,Q as jn,R as Fn,S as Xt,U as Un,V as Jt,W as zn,X as Hn,Y as Vt,Z as Yt,a0 as qn,a1 as Wn,a2 as Xn,a3 as Jn,C as Gt,a4 as Vn,a5 as Zt,a6 as Yn,a7 as Gn,a8 as Ce,a9 as Q,aa as Kt,ab as it,ac as xe,ad as at,ae as Re,af as Zn,ag as Be,ah as Ve,ai as lt,aj as Kn,ak as Ye,al as Qn,am as es,an as ts,ao as Ge,ap as Qt,aq as en,ar as tn,as as Ie,at as ns,au as ss,av as nn,aw as os,ax as Pe,$ as rs,b as is,a as as,c as ls,ay as sn,az as Y,aA as cs,aB as us,aC as Ze,aD as ds,aE as fs,aF as ps,aG as ms,aH as ct,aI as gs,aJ as hs,aK as bs,aL as ys,aM as xs,aN as Es,aO as Oe,aP as Ke,aQ as bt,aR as yt,aS as Ts,aT as Cs,aU as vs,aV as ws,aW as Ss,aX as Ls,aY as ks,aZ as _s,a_ as As,x as on,a$ as Ns,b0 as $s,b1 as Rs,b2 as Is,b3 as Ps,b4 as Os,b5 as Ue,b6 as Ms,b7 as Ds,b8 as Bs,b9 as js,ba as Fs,bb as rn,bc as an,bd as ln,be as cn,j as Us,T as zs,L as Hs,w as qs,k as Ws,l as Xs,D as Js,m as Vs,n as Ys,o as Gs,p as Zs,t as Ks,bf as Qs,s as eo,F as to,u as no,v as so,bg as oo,bh as ro}from"./JupyterLexicalExtension-CUsjvchq.js";import{bi as lc,bj as cc,bk as uc,bl as dc,bm as fc,bn as pc,bo as mc,bp as gc,bq as hc,br as bc,bs as yc,bt as xc,bu as Ec,bv as Tc,d as Cc,e as vc,bw as wc,bx as Sc,B as Lc,by as kc,A as _c,bz as Ac,bA as Nc,bB as $c,bC as Rc,bD as Ic,bE as Pc,bF as Oc,bG as Mc,bH as Dc,bI as Bc,bJ as jc,bK as Fc,bL as Uc,bM as zc,bN as Hc,bO as qc,bP as Wc,f as Xc,bQ as Jc,g as Vc,bR as Yc,bS as Gc,bT as Zc,bU as Kc,bV as Qc,q as eu,bW as tu,bX as nu,bY as su,bZ as ou,b_ as ru,b$ as iu,c0 as au,c1 as lu,c2 as cu,c3 as uu,c4 as du,c5 as fu,c6 as pu,c7 as mu,c8 as gu,c9 as hu,ca as bu,cb as yu,cc as xu,cd as Eu,ce as Tu,cf as Cu,cg as vu,ch as wu,ci as Su,cj as Lu,I as ku,ck as _u,cl as Au,cm as Nu,cn as $u,co as Ru,cp as Iu,cq as Pu,cr as Ou,cs as Mu,ct as Du,cu as Bu,cv as ju,h as Fu,z as Uu,cw as zu,cx as Hu,cy as qu,cz as Wu,cA as Xu,cB as Ju,cC as Vu,cD as Yu,cE as Gu,cF as Zu,cG as Ku,J as Qu,cH as ed,cI as td,cJ as nd,cK as sd,cL as od,cM as rd,cN as id,cO as ad,cP as ld,cQ as cd,cR as ud,cS as dd,cT as fd,cU as pd,cV as md,cW as gd,cX as hd,cY as bd,cZ as yd,c_ as xd,c$ as Ed,d0 as Td,d1 as Cd,d2 as vd,d3 as wd,d4 as Sd,d5 as Ld,d6 as kd,d7 as _d,d8 as Ad,d9 as Nd,da as $d,db as Rd,dc as Id,dd as Pd,de as Od,df as Md,dg as Dd,dh as Bd,di as jd,dj as Fd,dk as Ud,dl as zd,dm as Hd,dn as qd,dp as Wd,dq as Xd,dr as Jd,ds as Vd,dt as Yd,du as Gd,dv as Zd,dw as Kd,dx as Qd,dy as ef,dz as tf,dA as nf,dB as sf,dC as of,dD as rf,dE as af,dF as lf,dG as cf,dH as uf,dI as df,dJ as ff,dK as pf,dL as mf,dM as gf,dN as hf,dO as bf,dP as yf,dQ as xf,dR as Ef,dS as Tf,dT as Cf,dU as vf,dV as wf,dW as Sf,dX as Lf,dY as kf,dZ as _f,d_ as Af,d$ as Nf,e0 as $f,e1 as Rf,e2 as If,e3 as Pf,e4 as Of,e5 as Mf,e6 as Df,e7 as Bf,e8 as jf,e9 as Ff,ea as Uf,eb as zf,ec as Hf,ed as qf,ee as Wf,ef as Xf,eg as Jf,eh as Vf,ei as Yf,ej as Gf,ek as Zf,el as Kf,em as Qf,en as ep,eo as tp,ep as np,eq as sp,er as op,es as rp,et as ip,eu as ap,ev as lp,ew as cp,ex as up,ey as dp,ez as fp,eA as pp,eB as mp,eC as gp,eD as hp,eE as bp,eF as yp,eG as xp,eH as Ep,eI as Tp,eJ as Cp,eK as vp,eL as wp,eM as Sp,eN as Lp,eO as kp,eP as _p,eQ as Ap,eR as Np,eS as $p,eT as Rp,eU as Ip,eV as Pp,eW as Op,eX as Mp,r as Dp,eY as Bp,eZ as jp,e_ as Fp,e$ as Up,i as zp,f0 as Hp,f1 as qp,f2 as Wp,f3 as Xp,f4 as Jp,f5 as Vp,f6 as Yp,f7 as Gp,f8 as Zp,f9 as Kp,fa as Qp,fb as em,fc as tm,fd as nm,fe as sm,ff as om,fg as rm,fh as im,fi as am,fj as lm,fk as cm,fl as um,fm as dm,fn as fm,fo as pm,fp as mm,fq as gm,fr as hm,fs as bm,ft as ym,fu as xm,fv as Em}from"./JupyterLexicalExtension-CUsjvchq.js";import{ky as io,r as m,j as h,aI as ao,aC as lo,B as co,aM as ee,kz as F,kA as ae,kB as un,kC as pe,kD as z,kE as uo,kF as fo,kG as po,kH as mo,kI as j,aL as ce,kJ as Ee,kK as ut,kL as go,kM as ho,kN as bo,kO as yo,kP as dn,kQ as xo,kR as Eo,kS as To,kT as Co,kU as vo,kV as wo,aK as So,G as M,c8 as ve,kW as Lo,kX as se,kY as X,kZ as ye,k_ as ko,k$ as _o,l0 as Ao,c9 as No,l1 as le,cb as fn,l2 as pn,l3 as mn,bk as gn,l4 as fe,l5 as $o,l6 as Ro,bp as ie,cL as Io,I as Le,eK as hn,C as Po,e as Oo,cd as Mo,k as Do,l7 as Bo,l8 as jo,cc as ze,l9 as Fo,la as xt,dw as Uo,f0 as zo,T as Ho,lb as Et,lc as qo,ld as Wo,le as Xo,lf as Tt,lg as Jo,lh as Vo,aD as Yo,aE as Go,ay as Zo,aJ as Ko,li as Qo}from"../datalayer-app-main.js";import{CollapsiblePlugin as Cm}from"./index-DsX9nIHt.js";import{u as er,N as Ct}from"./usePrimerThemeBridge-LgREOVgz.js";import{T as tr}from"./ThemeContext-D9ztCaU3.js";import{a as wm,u as Sm}from"./ThemeContext-D9ztCaU3.js";import{YouTubePlugin as km}from"./YouTubePlugin-CqA-IwCx.js";import"./NotebookSkeleton-D9WNoiWD.js";import"./Avatar-Dqz3ZWjZ.js";import"./url-DEeTWrO-.js";import"./isSymbol-BLtK9CV6.js";import"./toNumber-B1wj8-wx.js";import"./VideoIcon-BjP_LDa4.js";import"./LinkIcon-DUI0jw25.js";import"./Toolbar-B6ROXJ-2.js";import"./ArrowUpIcon-BUCpIXDR.js";import"./SortDescIcon-CS4EzHeS.js";import"./PrismCss-u5utqjht.js";class nr{registry;_debug;constructor(t,n=!1){this.registry=t,this._debug=n}calculateIndent(t){const n=this.registry.getConfigOrDefault(t.language),s=this.getLeadingWhitespaceCount(t.currentLine);let o=s,r=!1,i=!1,l;for(const a of n.indentTriggers)if(this.matchesIndentRule(t.currentLine,a)){o=s+a.indentAmount,r=!0,l=a.name;break}if(!r){for(const a of n.dedentTriggers)if(this.matchesDedentRule(t.currentLine,a)){i=!0,l=a.name;break}}if(n.customRules){for(const a of n.customRules)if(a.condition(t.currentLine,t)){o=a.apply(o,t);break}}return o=Math.max(0,o),{spaces:o,shouldIndent:r,shouldDedent:i,triggeredRule:l}}getTabString(t){const n=this.registry.getConfigOrDefault(t);return n.useTabs?" ":" ".repeat(n.tabSize)}getTabSize(t){return this.registry.getConfigOrDefault(t).tabSize}calculateOutdent(t,n){const s=this.registry.getConfigOrDefault(n),o=t-s.tabSize;return Math.max(0,o)}getLeadingWhitespaceCount(t){const n=t.match(/^[\t ]*/);if(!n)return 0;const s=n[0];let o=0;for(const r of s)r===" "?o+=4:o+=1;return o}getLeadingWhitespace(t){const n=t.match(/^[\t ]*/);return n?n[0]:""}matchesIndentRule(t,n){switch(n.context){case"line-end":return n.pattern.test(t);case"line-start":return n.pattern.test(t);case"anywhere":return n.pattern.test(t);default:return!1}}matchesDedentRule(t,n){switch(n.context){case"line-start":return n.pattern.test(t);case"anywhere":return n.pattern.test(t);default:return!1}}normalizeIndentation(t,n){const s=this.registry.getConfigOrDefault(n);if(s.useTabs){const o=this.getLeadingWhitespace(t),r=o.length,i=Math.floor(r/s.tabSize),l=r%s.tabSize;return" ".repeat(i)+" ".repeat(l)+t.substring(o.length)}else{const o=this.getLeadingWhitespace(t);return o.replace(/\t/g," ".repeat(s.tabSize)).concat(t.substring(o.length))}}}const sr={language:"python",tabSize:4,useTabs:!1,indentTriggers:[{name:"colon-indent",pattern:/:\s*(#.*)?$/,context:"line-end",indentAmount:4},{name:"continuation-backslash",pattern:/\\\s*(#.*)?$/,context:"line-end",indentAmount:4},{name:"open-bracket",pattern:/[[({]\s*$/,context:"line-end",indentAmount:4}],dedentTriggers:[{name:"flow-control-keywords",pattern:/^\s*(return|break|continue|pass)(\s|$)/,context:"line-start",dedentAmount:4},{name:"raise-keyword",pattern:/^\s*raise(\s|$)/,context:"line-start",dedentAmount:4}],customRules:[{name:"close-bracket-dedent",condition:e=>/^\s*[\])}]/.test(e),apply:e=>Math.max(0,e-4)}]},bn={language:"javascript",tabSize:2,useTabs:!1,indentTriggers:[{name:"open-brace",pattern:/\{\s*(\/\/.*)?$/,context:"line-end",indentAmount:2},{name:"open-bracket",pattern:/\[\s*(\/\/.*)?$/,context:"line-end",indentAmount:2},{name:"open-paren",pattern:/\(\s*(\/\/.*)?$/,context:"line-end",indentAmount:2},{name:"arrow-function",pattern:/=>\s*(\/\/.*)?$/,context:"line-end",indentAmount:2},{name:"ternary-operator",pattern:/\?\s*(\/\/.*)?$/,context:"line-end",indentAmount:2}],dedentTriggers:[{name:"return-statement",pattern:/^\s*return(\s|;)/,context:"line-start",dedentAmount:2},{name:"break-continue",pattern:/^\s*(break|continue)(\s|;)/,context:"line-start",dedentAmount:2},{name:"throw-statement",pattern:/^\s*throw(\s|;)/,context:"line-start",dedentAmount:2}],customRules:[{name:"close-brace-dedent",condition:e=>/^\s*}/.test(e),apply:e=>Math.max(0,e-2)},{name:"close-bracket-dedent",condition:e=>/^\s*\]/.test(e),apply:e=>Math.max(0,e-2)},{name:"close-paren-dedent",condition:e=>/^\s*\)/.test(e),apply:e=>Math.max(0,e-2)},{name:"case-label",condition:e=>/^\s*(case\s+.*:|default:)/.test(e),apply:(e,t)=>e}]},or={...bn,language:"typescript"};class rr{configs;options;constructor(t={}){this.configs=new Map,this.options={defaultLanguage:"python",fallbackTabSize:4,debug:!1,...t},this.registerDefaultLanguages(),t.customConfigs&&t.customConfigs.forEach(n=>this.registerLanguage(n))}registerDefaultLanguages(){this.registerLanguage(sr),this.registerLanguage(bn),this.registerLanguage(or),this.registerAlias("py","python"),this.registerAlias("js","javascript"),this.registerAlias("ts","typescript"),this.registerAlias("jsx","javascript"),this.registerAlias("tsx","typescript")}registerLanguage(t){if(this.configs.has(t.language)){this.options.debug&&console.warn(`[LanguageIndentRegistry] Language '${t.language}' already registered. Use updateConfig() to modify.`);return}this.configs.set(t.language,t)}registerAlias(t,n){const s=this.configs.get(n);s&&this.configs.set(t,s)}getConfig(t){if(!t)return this.getConfig(this.options.defaultLanguage);const n=t.toLowerCase().trim();return this.configs.get(n)}getConfigOrDefault(t){const n=this.getConfig(t);if(n)return n;const s=this.getConfig(this.options.defaultLanguage);return s?(this.options.debug&&console.warn(`[LanguageIndentRegistry] Language '${t}' not found, using default: ${this.options.defaultLanguage}`),s):(this.options.debug&&console.error(`[LanguageIndentRegistry] No config found for '${t}' and default '${this.options.defaultLanguage}' missing!`),this.createFallbackConfig(t||"unknown"))}createFallbackConfig(t){return{language:t,tabSize:this.options.fallbackTabSize||4,useTabs:this.options.preserveTabs||!1,indentTriggers:[],dedentTriggers:[]}}hasLanguage(t){if(!t)return!1;const n=t.toLowerCase().trim();return this.configs.has(n)}updateConfig(t,n){const s=t.toLowerCase().trim(),o=this.configs.get(s);if(!o)return this.options.debug&&console.warn(`[LanguageIndentRegistry] Cannot update '${t}' - not registered`),!1;const r={...o,...n,language:o.language};return this.configs.set(s,r),!0}getRegisteredLanguages(){return Array.from(this.configs.keys())}clear(){this.configs.clear()}reset(){this.clear(),this.registerDefaultLanguages()}}const ir="[Deleted Comment]",Qe=e=>e.uid===e.thread_uid,yn=e=>e.anchor?.mark_id??e.uid,ar=(e,t)=>e.created_at!==t.created_at?e.created_at<t.created_at?-1:1:e.uid<t.uid?-1:e.uid>t.uid?1:0,He=(e,t)=>e!==void 0&&e.updated_at>t.updated_at?e:t,vt=e=>{const{uid:t,handle:n,name:s,agent_uid:o}=e.author;return t?{kind:"user",uid:t,handle:n??null,name:s??null,...o?{agentUid:o}:{}}:Bn(s||n)},lr=e=>({type:"comment",id:e.uid,author:Dn(vt(e)),authorPrincipal:vt(e),content:e.deleted?ir:e.body,deleted:e.deleted,...e.mentions&&e.mentions.length>0?{mentions:e.mentions}:{},timeStamp:Date.parse(e.created_at)});function cr(e){const t=[...e].sort(ar),n=new Map;for(const s of t)Qe(s)||n.set(s.thread_uid,[...n.get(s.thread_uid)??[],s]);return t.filter(s=>Qe(s)&&!s.deleted&&s.status==="open").map(s=>({type:"thread",id:yn(s),quote:s.quote??"",assignee:s.assignee??null,comments:[s,...n.get(s.uid)??[]].map(lr)}))}const wt=e=>e&&e.length>0?{mentions:e}:{};class Ka{searchPeople;assignThread;_editor;_backend;_options;_listeners=new Set;_heardDuringReads=new Set;_records=new Map;_comments=[];constructor(t,n,s={}){this._editor=t,this._backend=n,this._options=s;const{searchPeople:o,assign:r}=n;o&&(this.searchPeople=i=>o.call(n,i).catch(l=>{throw this._options.onError?.(l),l})),r&&(this.assignThread=(i,l)=>this._write(()=>r.call(n,this._threadRecord(i).uid,l?.uid??null)))}connect(){const t=this._backend.subscribe({comment:n=>this._heard(n),ready:()=>{this.refresh()}});return this.refresh(),t}async refresh(){const t=new Map;this._heardDuringReads.add(t);try{const n=await this._backend.list(),s=new Map(n.map(o=>[o.uid,o]));for(const[o,r]of t)s.set(o,He(s.get(o),r));this._records=s,this._changed()}catch(n){this._options.onError?.(n)}finally{this._heardDuringReads.delete(t)}}getComments(){return this._comments}addComment(t,n){if(t.type==="thread"){const s=t.id,o=t.comments[0];this._write(()=>this._backend.create({body:o?.content??"",anchor:{mark_id:s},quote:t.quote,...wt(o?.mentions)}),()=>this._unmark(s))}else n!==void 0?this._write(()=>this._backend.create({body:t.content,thread_uid:this._threadRecord(n).uid,...wt(t.mentions)})):this._options.onError?.(new Error("A comment is written in a thread."))}deleteComment(t){this._write(()=>this._backend.delete(t.id))}deleteThread(t){this._write(()=>this._backend.delete(this._threadRecord(t).uid))}resolveThread(t){this._write(()=>this._backend.resolve(this._threadRecord(t).uid))}registerOnChange(t){return this._listeners.add(t),()=>{this._listeners.delete(t)}}_write(t,n){Promise.resolve().then(t).then(s=>this._heard(s),s=>{n?.(),this._options.onError?.(s)})}_threadRecord(t){for(const n of this._records.values())if(Qe(n)&&yn(n)===t.id)return n;throw new Error(`The thread ${t.id} is not one the store read.`)}_heard(t){for(const n of this._heardDuringReads)n.set(t.uid,He(n.get(t.uid),t));this._records.set(t.uid,He(this._records.get(t.uid),t)),this._changed()}_changed(){this._comments=cr(this._records.values());for(const t of this._listeners)t()}_unmark(t){this._editor.update(()=>{for(const{node:n}of io())qt(n)&&n.getIDs().includes(t)&&(n.deleteID(t),n.getIDs().length===0&&Mn(n))})}}const dt=m.createContext(void 0);function ur(){const e=m.useContext(dt);if(!e)throw new Error("useContext must be inside a Provider with a value");return e}const dr=dt.Provider,Qa=dt.Consumer,el=({children:e})=>{const[t,n]=m.useState();return h.jsx(dr,{value:{editor:t,setEditor:n},children:e})};function tl(e){const{useStore:t,children:n}=e,{colorMode:s,resolvedMode:o,themeConfig:r,themeBackground:i,lexicalTheme:l}=er(t);return h.jsx(ao,{colorMode:s,theme:r.primerTheme,themeStyles:r.themeStyles,children:h.jsx(lo,{colormode:o,backgroundColor:i,useBaseStyles:!1,children:h.jsx(co,{sx:{"& .editor-shell":{backgroundColor:i,borderRadius:2},"& .editor-container":{backgroundColor:i},"& .editor-inner":{backgroundColor:i},"& .editor-input":{backgroundColor:i},'& [role="toolbar"][aria-label="Editor toolbar"]':{backgroundColor:i}},children:h.jsx(tr.Provider,{value:{theme:l},children:n})})})})}const fr={"\\":"\\textbackslash{}","{":"\\{","}":"\\}",$:"\\$","&":"\\&","#":"\\#","^":"\\^{}",_:"\\_","%":"\\%","~":"\\~{}"};function K(e){return e.replace(/[\\{}$&#^_%~]/g,t=>fr[t]??t)}function ft(e,t,n="{",s="}"){let o=0;for(let r=t;r<e.length;r++){const i=e[r];if(i==="\\"){r++;continue}if(i===n)o++;else if(i===s&&(o--,o===0))return r}return-1}function W(e,t){let n=t;for(;n<e.length&&(e[n]===" "||e[n]===`
|
|
1
|
+
import{d as V}from"./LexicalToolRegistry-DoZIM1lF.js";import{D as Ol,a as Ml,b as Dl,e as Bl,c as jl,g as Fl,i as Ul,f as zl,l as Hl,h as ql,j as Wl,k as Xl,m as Jl,n as Vl,r as Yl,o as Gl,p as Zl,q as Kl,s as Ql,t as ec,v as tc,w as nc,x as sc,y as oc,z as rc,u as ic}from"./LexicalToolRegistry-DoZIM1lF.js";import{_ as qt,E as Mn,G as Dn,H as Bn,K as me,M as Wt,O as ot,P as rt,Q as jn,R as Fn,S as Xt,U as Un,V as Jt,W as zn,X as Hn,Y as Vt,Z as Yt,a0 as qn,a1 as Wn,a2 as Xn,a3 as Jn,C as Gt,a4 as Vn,a5 as Zt,a6 as Yn,a7 as Gn,a8 as Ce,a9 as Q,aa as Kt,ab as it,ac as xe,ad as at,ae as Re,af as Zn,ag as Be,ah as Ve,ai as lt,aj as Kn,ak as Ye,al as Qn,am as es,an as ts,ao as Ge,ap as Qt,aq as en,ar as tn,as as Ie,at as ns,au as ss,av as nn,aw as os,ax as Pe,$ as rs,b as is,a as as,c as ls,ay as sn,az as Y,aA as cs,aB as us,aC as Ze,aD as ds,aE as fs,aF as ps,aG as ms,aH as ct,aI as gs,aJ as hs,aK as bs,aL as ys,aM as xs,aN as Es,aO as Oe,aP as Ke,aQ as bt,aR as yt,aS as Ts,aT as Cs,aU as vs,aV as ws,aW as Ss,aX as Ls,aY as ks,aZ as _s,a_ as As,x as on,a$ as Ns,b0 as $s,b1 as Rs,b2 as Is,b3 as Ps,b4 as Os,b5 as Ue,b6 as Ms,b7 as Ds,b8 as Bs,b9 as js,ba as Fs,bb as rn,bc as an,bd as ln,be as cn,j as Us,T as zs,L as Hs,w as qs,k as Ws,l as Xs,D as Js,m as Vs,n as Ys,o as Gs,p as Zs,t as Ks,bf as Qs,s as eo,F as to,u as no,v as so,bg as oo,bh as ro}from"./JupyterLexicalExtension-CEjN8cLT.js";import{bi as lc,bj as cc,bk as uc,bl as dc,bm as fc,bn as pc,bo as mc,bp as gc,bq as hc,br as bc,bs as yc,bt as xc,bu as Ec,bv as Tc,d as Cc,e as vc,bw as wc,bx as Sc,B as Lc,by as kc,A as _c,bz as Ac,bA as Nc,bB as $c,bC as Rc,bD as Ic,bE as Pc,bF as Oc,bG as Mc,bH as Dc,bI as Bc,bJ as jc,bK as Fc,bL as Uc,bM as zc,bN as Hc,bO as qc,bP as Wc,f as Xc,bQ as Jc,g as Vc,bR as Yc,bS as Gc,bT as Zc,bU as Kc,bV as Qc,q as eu,bW as tu,bX as nu,bY as su,bZ as ou,b_ as ru,b$ as iu,c0 as au,c1 as lu,c2 as cu,c3 as uu,c4 as du,c5 as fu,c6 as pu,c7 as mu,c8 as gu,c9 as hu,ca as bu,cb as yu,cc as xu,cd as Eu,ce as Tu,cf as Cu,cg as vu,ch as wu,ci as Su,cj as Lu,I as ku,ck as _u,cl as Au,cm as Nu,cn as $u,co as Ru,cp as Iu,cq as Pu,cr as Ou,cs as Mu,ct as Du,cu as Bu,cv as ju,h as Fu,z as Uu,cw as zu,cx as Hu,cy as qu,cz as Wu,cA as Xu,cB as Ju,cC as Vu,cD as Yu,cE as Gu,cF as Zu,cG as Ku,J as Qu,cH as ed,cI as td,cJ as nd,cK as sd,cL as od,cM as rd,cN as id,cO as ad,cP as ld,cQ as cd,cR as ud,cS as dd,cT as fd,cU as pd,cV as md,cW as gd,cX as hd,cY as bd,cZ as yd,c_ as xd,c$ as Ed,d0 as Td,d1 as Cd,d2 as vd,d3 as wd,d4 as Sd,d5 as Ld,d6 as kd,d7 as _d,d8 as Ad,d9 as Nd,da as $d,db as Rd,dc as Id,dd as Pd,de as Od,df as Md,dg as Dd,dh as Bd,di as jd,dj as Fd,dk as Ud,dl as zd,dm as Hd,dn as qd,dp as Wd,dq as Xd,dr as Jd,ds as Vd,dt as Yd,du as Gd,dv as Zd,dw as Kd,dx as Qd,dy as ef,dz as tf,dA as nf,dB as sf,dC as of,dD as rf,dE as af,dF as lf,dG as cf,dH as uf,dI as df,dJ as ff,dK as pf,dL as mf,dM as gf,dN as hf,dO as bf,dP as yf,dQ as xf,dR as Ef,dS as Tf,dT as Cf,dU as vf,dV as wf,dW as Sf,dX as Lf,dY as kf,dZ as _f,d_ as Af,d$ as Nf,e0 as $f,e1 as Rf,e2 as If,e3 as Pf,e4 as Of,e5 as Mf,e6 as Df,e7 as Bf,e8 as jf,e9 as Ff,ea as Uf,eb as zf,ec as Hf,ed as qf,ee as Wf,ef as Xf,eg as Jf,eh as Vf,ei as Yf,ej as Gf,ek as Zf,el as Kf,em as Qf,en as ep,eo as tp,ep as np,eq as sp,er as op,es as rp,et as ip,eu as ap,ev as lp,ew as cp,ex as up,ey as dp,ez as fp,eA as pp,eB as mp,eC as gp,eD as hp,eE as bp,eF as yp,eG as xp,eH as Ep,eI as Tp,eJ as Cp,eK as vp,eL as wp,eM as Sp,eN as Lp,eO as kp,eP as _p,eQ as Ap,eR as Np,eS as $p,eT as Rp,eU as Ip,eV as Pp,eW as Op,eX as Mp,r as Dp,eY as Bp,eZ as jp,e_ as Fp,e$ as Up,i as zp,f0 as Hp,f1 as qp,f2 as Wp,f3 as Xp,f4 as Jp,f5 as Vp,f6 as Yp,f7 as Gp,f8 as Zp,f9 as Kp,fa as Qp,fb as em,fc as tm,fd as nm,fe as sm,ff as om,fg as rm,fh as im,fi as am,fj as lm,fk as cm,fl as um,fm as dm,fn as fm,fo as pm,fp as mm,fq as gm,fr as hm,fs as bm,ft as ym,fu as xm,fv as Em}from"./JupyterLexicalExtension-CEjN8cLT.js";import{ky as io,r as m,j as h,aI as ao,aC as lo,B as co,aM as ee,kz as F,kA as ae,kB as un,kC as pe,kD as z,kE as uo,kF as fo,kG as po,kH as mo,kI as j,aL as ce,kJ as Ee,kK as ut,kL as go,kM as ho,kN as bo,kO as yo,kP as dn,kQ as xo,kR as Eo,kS as To,kT as Co,kU as vo,kV as wo,aK as So,G as M,c8 as ve,kW as Lo,kX as se,kY as X,kZ as ye,k_ as ko,k$ as _o,l0 as Ao,c9 as No,l1 as le,cb as fn,l2 as pn,l3 as mn,br as gn,l4 as fe,l5 as $o,l6 as Ro,bw as ie,cL as Io,I as Le,eK as hn,C as Po,e as Oo,cd as Mo,k as Do,l7 as Bo,l8 as jo,cc as ze,l9 as Fo,la as xt,dw as Uo,f0 as zo,T as Ho,lb as Et,lc as qo,ld as Wo,le as Xo,lf as Tt,lg as Jo,lh as Vo,aD as Yo,aE as Go,ay as Zo,aJ as Ko,li as Qo}from"../datalayer-app-main.js";import{CollapsiblePlugin as Cm}from"./index-D1HhRyAi.js";import{u as er,N as Ct}from"./usePrimerThemeBridge-CuRRiOcg.js";import{T as tr}from"./ThemeContext-D9ztCaU3.js";import{a as wm,u as Sm}from"./ThemeContext-D9ztCaU3.js";import{YouTubePlugin as km}from"./YouTubePlugin-ZawlUPsx.js";import"./NotebookSkeleton-z8GKB7Tb.js";import"./Avatar-BrPfm89P.js";import"./url-DEeTWrO-.js";import"./isSymbol-BLtK9CV6.js";import"./toNumber-B1wj8-wx.js";import"./VideoIcon-BjP_LDa4.js";import"./LinkIcon-DUI0jw25.js";import"./Toolbar-BxAi9T92.js";import"./ArrowUpIcon-BUCpIXDR.js";import"./SortDescIcon-CS4EzHeS.js";import"./PrismCss-u5utqjht.js";class nr{registry;_debug;constructor(t,n=!1){this.registry=t,this._debug=n}calculateIndent(t){const n=this.registry.getConfigOrDefault(t.language),s=this.getLeadingWhitespaceCount(t.currentLine);let o=s,r=!1,i=!1,l;for(const a of n.indentTriggers)if(this.matchesIndentRule(t.currentLine,a)){o=s+a.indentAmount,r=!0,l=a.name;break}if(!r){for(const a of n.dedentTriggers)if(this.matchesDedentRule(t.currentLine,a)){i=!0,l=a.name;break}}if(n.customRules){for(const a of n.customRules)if(a.condition(t.currentLine,t)){o=a.apply(o,t);break}}return o=Math.max(0,o),{spaces:o,shouldIndent:r,shouldDedent:i,triggeredRule:l}}getTabString(t){const n=this.registry.getConfigOrDefault(t);return n.useTabs?" ":" ".repeat(n.tabSize)}getTabSize(t){return this.registry.getConfigOrDefault(t).tabSize}calculateOutdent(t,n){const s=this.registry.getConfigOrDefault(n),o=t-s.tabSize;return Math.max(0,o)}getLeadingWhitespaceCount(t){const n=t.match(/^[\t ]*/);if(!n)return 0;const s=n[0];let o=0;for(const r of s)r===" "?o+=4:o+=1;return o}getLeadingWhitespace(t){const n=t.match(/^[\t ]*/);return n?n[0]:""}matchesIndentRule(t,n){switch(n.context){case"line-end":return n.pattern.test(t);case"line-start":return n.pattern.test(t);case"anywhere":return n.pattern.test(t);default:return!1}}matchesDedentRule(t,n){switch(n.context){case"line-start":return n.pattern.test(t);case"anywhere":return n.pattern.test(t);default:return!1}}normalizeIndentation(t,n){const s=this.registry.getConfigOrDefault(n);if(s.useTabs){const o=this.getLeadingWhitespace(t),r=o.length,i=Math.floor(r/s.tabSize),l=r%s.tabSize;return" ".repeat(i)+" ".repeat(l)+t.substring(o.length)}else{const o=this.getLeadingWhitespace(t);return o.replace(/\t/g," ".repeat(s.tabSize)).concat(t.substring(o.length))}}}const sr={language:"python",tabSize:4,useTabs:!1,indentTriggers:[{name:"colon-indent",pattern:/:\s*(#.*)?$/,context:"line-end",indentAmount:4},{name:"continuation-backslash",pattern:/\\\s*(#.*)?$/,context:"line-end",indentAmount:4},{name:"open-bracket",pattern:/[[({]\s*$/,context:"line-end",indentAmount:4}],dedentTriggers:[{name:"flow-control-keywords",pattern:/^\s*(return|break|continue|pass)(\s|$)/,context:"line-start",dedentAmount:4},{name:"raise-keyword",pattern:/^\s*raise(\s|$)/,context:"line-start",dedentAmount:4}],customRules:[{name:"close-bracket-dedent",condition:e=>/^\s*[\])}]/.test(e),apply:e=>Math.max(0,e-4)}]},bn={language:"javascript",tabSize:2,useTabs:!1,indentTriggers:[{name:"open-brace",pattern:/\{\s*(\/\/.*)?$/,context:"line-end",indentAmount:2},{name:"open-bracket",pattern:/\[\s*(\/\/.*)?$/,context:"line-end",indentAmount:2},{name:"open-paren",pattern:/\(\s*(\/\/.*)?$/,context:"line-end",indentAmount:2},{name:"arrow-function",pattern:/=>\s*(\/\/.*)?$/,context:"line-end",indentAmount:2},{name:"ternary-operator",pattern:/\?\s*(\/\/.*)?$/,context:"line-end",indentAmount:2}],dedentTriggers:[{name:"return-statement",pattern:/^\s*return(\s|;)/,context:"line-start",dedentAmount:2},{name:"break-continue",pattern:/^\s*(break|continue)(\s|;)/,context:"line-start",dedentAmount:2},{name:"throw-statement",pattern:/^\s*throw(\s|;)/,context:"line-start",dedentAmount:2}],customRules:[{name:"close-brace-dedent",condition:e=>/^\s*}/.test(e),apply:e=>Math.max(0,e-2)},{name:"close-bracket-dedent",condition:e=>/^\s*\]/.test(e),apply:e=>Math.max(0,e-2)},{name:"close-paren-dedent",condition:e=>/^\s*\)/.test(e),apply:e=>Math.max(0,e-2)},{name:"case-label",condition:e=>/^\s*(case\s+.*:|default:)/.test(e),apply:(e,t)=>e}]},or={...bn,language:"typescript"};class rr{configs;options;constructor(t={}){this.configs=new Map,this.options={defaultLanguage:"python",fallbackTabSize:4,debug:!1,...t},this.registerDefaultLanguages(),t.customConfigs&&t.customConfigs.forEach(n=>this.registerLanguage(n))}registerDefaultLanguages(){this.registerLanguage(sr),this.registerLanguage(bn),this.registerLanguage(or),this.registerAlias("py","python"),this.registerAlias("js","javascript"),this.registerAlias("ts","typescript"),this.registerAlias("jsx","javascript"),this.registerAlias("tsx","typescript")}registerLanguage(t){if(this.configs.has(t.language)){this.options.debug&&console.warn(`[LanguageIndentRegistry] Language '${t.language}' already registered. Use updateConfig() to modify.`);return}this.configs.set(t.language,t)}registerAlias(t,n){const s=this.configs.get(n);s&&this.configs.set(t,s)}getConfig(t){if(!t)return this.getConfig(this.options.defaultLanguage);const n=t.toLowerCase().trim();return this.configs.get(n)}getConfigOrDefault(t){const n=this.getConfig(t);if(n)return n;const s=this.getConfig(this.options.defaultLanguage);return s?(this.options.debug&&console.warn(`[LanguageIndentRegistry] Language '${t}' not found, using default: ${this.options.defaultLanguage}`),s):(this.options.debug&&console.error(`[LanguageIndentRegistry] No config found for '${t}' and default '${this.options.defaultLanguage}' missing!`),this.createFallbackConfig(t||"unknown"))}createFallbackConfig(t){return{language:t,tabSize:this.options.fallbackTabSize||4,useTabs:this.options.preserveTabs||!1,indentTriggers:[],dedentTriggers:[]}}hasLanguage(t){if(!t)return!1;const n=t.toLowerCase().trim();return this.configs.has(n)}updateConfig(t,n){const s=t.toLowerCase().trim(),o=this.configs.get(s);if(!o)return this.options.debug&&console.warn(`[LanguageIndentRegistry] Cannot update '${t}' - not registered`),!1;const r={...o,...n,language:o.language};return this.configs.set(s,r),!0}getRegisteredLanguages(){return Array.from(this.configs.keys())}clear(){this.configs.clear()}reset(){this.clear(),this.registerDefaultLanguages()}}const ir="[Deleted Comment]",Qe=e=>e.uid===e.thread_uid,yn=e=>e.anchor?.mark_id??e.uid,ar=(e,t)=>e.created_at!==t.created_at?e.created_at<t.created_at?-1:1:e.uid<t.uid?-1:e.uid>t.uid?1:0,He=(e,t)=>e!==void 0&&e.updated_at>t.updated_at?e:t,vt=e=>{const{uid:t,handle:n,name:s,agent_uid:o}=e.author;return t?{kind:"user",uid:t,handle:n??null,name:s??null,...o?{agentUid:o}:{}}:Bn(s||n)},lr=e=>({type:"comment",id:e.uid,author:Dn(vt(e)),authorPrincipal:vt(e),content:e.deleted?ir:e.body,deleted:e.deleted,...e.mentions&&e.mentions.length>0?{mentions:e.mentions}:{},timeStamp:Date.parse(e.created_at)});function cr(e){const t=[...e].sort(ar),n=new Map;for(const s of t)Qe(s)||n.set(s.thread_uid,[...n.get(s.thread_uid)??[],s]);return t.filter(s=>Qe(s)&&!s.deleted&&s.status==="open").map(s=>({type:"thread",id:yn(s),quote:s.quote??"",assignee:s.assignee??null,comments:[s,...n.get(s.uid)??[]].map(lr)}))}const wt=e=>e&&e.length>0?{mentions:e}:{};class Ka{searchPeople;assignThread;_editor;_backend;_options;_listeners=new Set;_heardDuringReads=new Set;_records=new Map;_comments=[];constructor(t,n,s={}){this._editor=t,this._backend=n,this._options=s;const{searchPeople:o,assign:r}=n;o&&(this.searchPeople=i=>o.call(n,i).catch(l=>{throw this._options.onError?.(l),l})),r&&(this.assignThread=(i,l)=>this._write(()=>r.call(n,this._threadRecord(i).uid,l?.uid??null)))}connect(){const t=this._backend.subscribe({comment:n=>this._heard(n),ready:()=>{this.refresh()}});return this.refresh(),t}async refresh(){const t=new Map;this._heardDuringReads.add(t);try{const n=await this._backend.list(),s=new Map(n.map(o=>[o.uid,o]));for(const[o,r]of t)s.set(o,He(s.get(o),r));this._records=s,this._changed()}catch(n){this._options.onError?.(n)}finally{this._heardDuringReads.delete(t)}}getComments(){return this._comments}addComment(t,n){if(t.type==="thread"){const s=t.id,o=t.comments[0];this._write(()=>this._backend.create({body:o?.content??"",anchor:{mark_id:s},quote:t.quote,...wt(o?.mentions)}),()=>this._unmark(s))}else n!==void 0?this._write(()=>this._backend.create({body:t.content,thread_uid:this._threadRecord(n).uid,...wt(t.mentions)})):this._options.onError?.(new Error("A comment is written in a thread."))}deleteComment(t){this._write(()=>this._backend.delete(t.id))}deleteThread(t){this._write(()=>this._backend.delete(this._threadRecord(t).uid))}resolveThread(t){this._write(()=>this._backend.resolve(this._threadRecord(t).uid))}registerOnChange(t){return this._listeners.add(t),()=>{this._listeners.delete(t)}}_write(t,n){Promise.resolve().then(t).then(s=>this._heard(s),s=>{n?.(),this._options.onError?.(s)})}_threadRecord(t){for(const n of this._records.values())if(Qe(n)&&yn(n)===t.id)return n;throw new Error(`The thread ${t.id} is not one the store read.`)}_heard(t){for(const n of this._heardDuringReads)n.set(t.uid,He(n.get(t.uid),t));this._records.set(t.uid,He(this._records.get(t.uid),t)),this._changed()}_changed(){this._comments=cr(this._records.values());for(const t of this._listeners)t()}_unmark(t){this._editor.update(()=>{for(const{node:n}of io())qt(n)&&n.getIDs().includes(t)&&(n.deleteID(t),n.getIDs().length===0&&Mn(n))})}}const dt=m.createContext(void 0);function ur(){const e=m.useContext(dt);if(!e)throw new Error("useContext must be inside a Provider with a value");return e}const dr=dt.Provider,Qa=dt.Consumer,el=({children:e})=>{const[t,n]=m.useState();return h.jsx(dr,{value:{editor:t,setEditor:n},children:e})};function tl(e){const{useStore:t,children:n}=e,{colorMode:s,resolvedMode:o,themeConfig:r,themeBackground:i,lexicalTheme:l}=er(t);return h.jsx(ao,{colorMode:s,theme:r.primerTheme,themeStyles:r.themeStyles,children:h.jsx(lo,{colormode:o,backgroundColor:i,useBaseStyles:!1,children:h.jsx(co,{sx:{"& .editor-shell":{backgroundColor:i,borderRadius:2},"& .editor-container":{backgroundColor:i},"& .editor-inner":{backgroundColor:i},"& .editor-input":{backgroundColor:i},'& [role="toolbar"][aria-label="Editor toolbar"]':{backgroundColor:i}},children:h.jsx(tr.Provider,{value:{theme:l},children:n})})})})}const fr={"\\":"\\textbackslash{}","{":"\\{","}":"\\}",$:"\\$","&":"\\&","#":"\\#","^":"\\^{}",_:"\\_","%":"\\%","~":"\\~{}"};function K(e){return e.replace(/[\\{}$&#^_%~]/g,t=>fr[t]??t)}function ft(e,t,n="{",s="}"){let o=0;for(let r=t;r<e.length;r++){const i=e[r];if(i==="\\"){r++;continue}if(i===n)o++;else if(i===s&&(o--,o===0))return r}return-1}function W(e,t){let n=t;for(;n<e.length&&(e[n]===" "||e[n]===`
|
|
2
2
|
`);)n++;if(e[n]!=="{")return null;const s=ft(e,n);return s===-1?null:{value:e.slice(n+1,s),end:s+1}}function ne(e,t){let n=t;for(;n<e.length&&e[n]===" ";)n++;if(e[n]!=="[")return null;const s=ft(e,n,"[","]");return s===-1?null:{value:e.slice(n+1,s),end:s+1}}function xn(e){return e.split(`
|
|
3
3
|
`).map(t=>{for(let n=0;n<t.length;n++){if(t[n]==="\\"){n++;continue}if(t[n]==="%")return t.slice(0,n)}return t}).join(`
|
|
4
4
|
`)}function En(e,t){if(!e)return null;const n=new RegExp(`(?:^|,)\\s*${t}\\s*=\\s*([^,]+)`).exec(e);return n?n[1].trim():null}function oe(e,t,n){const s=[];let o=t;for(let r=0;r<n;r++){const i=W(e,o);if(!i)break;s.push(i.value),o=i.end}return{values:s,end:o}}function pr(e){const t=e.indexOf("\\begin{document}");if(t===-1)return{body:e,preamble:""};const n=t+16,s=e.lastIndexOf("\\end{document}");return{body:s===-1?e.slice(n):e.slice(n,s),preamble:e.slice(0,t)}}function Tn(e){return e.charAt(0).toUpperCase()+e.slice(1)}const mr=new Set(["book","report","memoir","scrbook","scrreprt","amsbook","thesis","mitthesis","phdthesis","bookest"]);function Cn(e,t){return mr.has((e??"").toLowerCase())||t!==void 0&&/(?<!\\)\\chapter\b/.test(t)}const gr={h1:"section",h2:"subsection",h3:"subsubsection",h4:"paragraph",h5:"subparagraph",h6:"subparagraph"},hr={h1:"chapter",h2:"section",h3:"subsection",h4:"subsubsection",h5:"paragraph",h6:"subparagraph"},br={part:"h1",chapter:"h1",section:"h1",subsection:"h2",subsubsection:"h3",paragraph:"h4",subparagraph:"h5"},yr={part:"h1",chapter:"h1",section:"h2",subsection:"h3",subsubsection:"h4",paragraph:"h5",subparagraph:"h6"};function xr(e){return e?{js:"JavaScript",javascript:"JavaScript",ts:"TypeScript",typescript:"TypeScript",py:"Python",python:"Python",sh:"bash",bash:"bash",r:"R",sql:"SQL",c:"C",cpp:"C++",java:"Java",html:"HTML",xml:"XML",json:"JSON",markdown:"Markdown",md:"Markdown"}[e.toLowerCase()]??e:null}function pt(e){return e.replace(/^\n/,"").replace(/\n[ \t]*$/,"")}function Er(e){if(uo(e))return St(e.text);if(fo(e)||po(e)){const t=e.data["text/plain"];return t===void 0?null:St(t)}return mo(e)?e.traceback.join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ch as E,ag as I,ah as j,ck as N,ao as x,r as s,cl as w,cm as k,cn as A,ai as D,co as O,cp as P,av as M,am as T,cq as R,cr as U,cs as W,ct as q}from"../datalayer-app-main.js";import{I as F}from"./tokens-Av8g3IGm.js";import{c as H}from"./index-
|
|
1
|
+
import{ch as E,ag as I,ah as j,ck as N,ao as x,r as s,cl as w,cm as k,cn as A,ai as D,co as O,cp as P,av as M,am as T,cq as R,cr as U,cs as W,ct as q}from"../datalayer-app-main.js";import{I as F}from"./tokens-Av8g3IGm.js";import{c as H}from"./index-DuDsMDnx.js";import{I as K}from"./tokens-kO65He8_.js";import"./CellSidebarExtension-BWsHtuqs.js";import"./NotebookSkeleton-z8GKB7Tb.js";import"./Avatar-BrPfm89P.js";import"./renderer-jz0zn1Az.js";import"./SquareIcon-e3ygcjpv.js";import"./SortAscIcon-CVKVWIWQ.js";import"./url-DEeTWrO-.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-CuRRiOcg.js";import"./index-5Mm_lDnH.js";import"./KernelVariables-DyYN9sSS.js";import"./Flash-C3nF3s4G.js";import"./index-BxurLo3u.js";import"./SortDescIcon-CS4EzHeS.js";import"./NotebookToolbar-Dv7QkxKA.js";import"./RepoPushIcon-Cm8g9NuL.js";import"./Toolbar-BxAi9T92.js";import"./sessions-By2lggFS.js";import"./tokens-B5KQP74f.js";import"./drivecontents-BHpoQXqz.js";import"./kernel-4uWz8R6G.js";const V="jp-Launcher";class $ extends E{constructor(){super(...arguments),this.itemsList=[]}add(t){const r=y.createItem(t);return this.itemsList.push(r),this.stateChanged.emit(void 0),new I(()=>{j.removeFirstOf(this.itemsList,r),this.stateChanged.emit(void 0)})}items(){return this.itemsList[Symbol.iterator]()}}class z extends N{constructor(t){super(t.model),this._pending=!1,this._cwd="",this._cwd=t.cwd,this.translator=t.translator||x,this._trans=this.translator.load("jupyterlab"),this._callback=t.callback,this._commands=t.commands,this.addClass(V)}get cwd(){return this._cwd}set cwd(t){this._cwd=t,this.update()}get pending(){return this._pending}set pending(t){this._pending=t}render(){if(!this.model)return null;const t=[this._trans.__("Notebook"),this._trans.__("Console"),this._trans.__("Other")],r=[this._trans.__("Notebook"),this._trans.__("Console")],o=Object.create(null);for(const e of this.model.items()){const i=e.category||this._trans.__("Other");i in o||(o[i]=[]),o[i].push(e)}for(const e in o)o[e]=o[e].sort((i,a)=>y.sortCmp(i,a,this._cwd,this._commands));const n=[];let h;const c=[];for(const e of t)c.push(e);for(const e in o)t.indexOf(e)===-1&&c.push(e);return c.forEach(e=>{if(!o[e])return;const i=o[e][0],a={...i.args,cwd:this.cwd},m=r.indexOf(e)>-1,p=this._commands.iconClass(i.command,a),u=this._commands.icon(i.command,a);e in o&&(h=s.createElement("div",{className:"jp-Launcher-section",key:e},s.createElement("div",{className:"jp-Launcher-sectionHeader"},s.createElement(w.resolveReact,{icon:u,iconClass:k(p,"jp-Icon-cover"),stylesheet:"launcherSection","aria-hidden":"true"}),s.createElement("h2",{className:"jp-Launcher-sectionTitle"},e)),s.createElement("div",{className:"jp-Launcher-cardContainer"},Array.from(A(o[e],_=>G(m,_,this,this._commands,this._trans,this._callback))))),n.push(h))}),s.createElement("div",{className:"jp-Launcher-body"},s.createElement("div",{className:"jp-Launcher-content"},s.createElement("div",{className:"jp-Launcher-cwd"},s.createElement("h3",null,this.cwd)),n))}}function G(d,t,r,o,n,h){const c=t.command,e={...t.args,cwd:r.cwd},i=o.caption(c,e),a=o.label(c,e),m=d?a:i||a,p=()=>{r.pending!==!0&&(r.pending=!0,o.execute(c,{...t.args,cwd:r.cwd}).then(l=>{r.pending=!1,l instanceof D&&h(l)}).catch(l=>{console.error(l),r.pending=!1,O(n._p("Error","Launcher Error"),l)}))},u=l=>{l.key==="Enter"&&p()},_=o.iconClass(c,e),C=o.icon(c,e);return s.createElement("div",{className:"jp-LauncherCard",title:m,role:"button",onClick:p,onKeyDown:u,tabIndex:0,"data-category":t.category||n.__("Other"),key:y.keyProperty.get(t)},s.createElement("div",{className:"jp-LauncherCard-icon"},d?t.kernelIconUrl?s.createElement("img",{src:t.kernelIconUrl,className:"jp-Launcher-kernelIcon",alt:m}):s.createElement("div",{className:"jp-LauncherCard-noKernelIcon"},a[0].toUpperCase()):s.createElement(w.resolveReact,{icon:C,iconClass:k(_,"jp-Icon-cover"),stylesheet:"launcherCard"})),s.createElement("div",{className:"jp-LauncherCard-label",title:m},s.createElement("p",null,a)))}var y;(function(d){let t=0;d.keyProperty=new P({name:"key",create:()=>t++});function r(n){return{...n,category:n.category||"",rank:n.rank!==void 0?n.rank:1/0}}d.createItem=r;function o(n,h,c,e){const i=n.rank,a=h.rank;if(i!==a&&i!==void 0&&a!==void 0)return i<a?-1:1;const m=e.label(n.command,{...n.args,cwd:c}),p=e.label(h.command,{...h.args,cwd:c});return m.localeCompare(p)}d.sortCmp=o})(y||(y={}));var g;(function(d){d.create="launcher:create"})(g||(g={}));const Te={activate:J,id:"@jupyterlab/launcher-extension:plugin",description:"Provides the launcher tab service.",requires:[T],optional:[H,M,K],provides:F,autoStart:!0};function J(d,t,r,o,n){const{commands:h,shell:c}=d,e=t.load("jupyterlab"),i=new $;return h.addCommand(g.create,{label:e.__("New Launcher"),icon:a=>a.toolbar?R:void 0,describedBy:{args:{type:"object",properties:{cwd:{type:"string",description:e.__("The current working directory")},toolbar:{type:"boolean",description:e.__("Whether the command is executed from a toolbar")},activate:{type:"boolean",description:e.__("Whether to activate the widget")},ref:{type:"string",description:e.__("The reference widget id")}}}},execute:a=>{var m,p;const u=(p=(m=a.cwd)!==null&&m!==void 0?m:n?.model.path)!==null&&p!==void 0?p:"",_=`launcher-${L.id++}`,C=v=>{q(c.widgets("main"),b=>b===v)&&(c.add(v,"main",{ref:_}),l.dispose())},l=new z({model:i,cwd:u,callback:C,commands:h,translator:t});l.model=i,l.title.icon=U,l.title.label=e.__("Launcher");const f=new W({content:l});if(f.title.closable=!!Array.from(c.widgets("main")).length,f.id=_,c.add(f,"main",{activate:a.activate,ref:a.ref}),r&&r.layoutModified.connect(()=>{f.title.closable=Array.from(r.widgets("main")).length>1},f),n){const v=b=>{l.cwd=b.path};n.model.pathChanged.connect(v),l.disposed.connect(()=>{n.model.pathChanged.disconnect(v)})}return f}}),r&&Promise.all([d.restored,n?.model.restored]).then(()=>{function a(){r.isEmpty("main")&&h.execute(g.create)}r.layoutModified.connect(()=>{a()})}),o&&o.addItem({command:g.create,category:e.__("Launcher")}),r&&(r.addButtonEnabled=!0,r.addRequested.connect((a,m)=>{var p;const u=((p=m.currentTitle)===null||p===void 0?void 0:p.owner.id)||m.titles[m.titles.length-1].owner.id;return h.execute(g.create,{ref:u})})),i}var L;(function(d){d.id=0})(L||(L={}));export{Te as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ck as Z,v as M,cT as ee,ch as te,cg as F,ao as B,F as K,ek as pe,am as j,cV as he,el as me,av as ne,em as ge,cj as fe,cA as W,cz as C,co as Q,en as _e,d1 as oe,at as ve,ai as ye,d2 as be,eo as we,as as xe,r as X,ep as Ce,eq as Se}from"../datalayer-app-main.js";import{I as ie}from"./tokens-CbEQpcM3.js";import{a as ae,b as G,c as V,I as P}from"./tokens-U5a4I4FH.js";import{I as se}from"./tokens-CREF1pN9.js";import{j as re,d as ke,m as Re,c as J,D as z,n as We}from"./index-
|
|
1
|
+
import{ck as Z,v as M,cT as ee,ch as te,cg as F,ao as B,F as K,ek as pe,am as j,cV as he,el as me,av as ne,em as ge,cj as fe,cA as W,cz as C,co as Q,en as _e,d1 as oe,at as ve,ai as ye,d2 as be,eo as we,as as xe,r as X,ep as Ce,eq as Se}from"../datalayer-app-main.js";import{I as ie}from"./tokens-CbEQpcM3.js";import{a as ae,b as G,c as V,I as P}from"./tokens-U5a4I4FH.js";import{I as se}from"./tokens-CREF1pN9.js";import{j as re,d as ke,m as Re,c as J,D as z,n as We}from"./index-DuDsMDnx.js";import"./CellSidebarExtension-BWsHtuqs.js";import"./NotebookSkeleton-z8GKB7Tb.js";import"./Avatar-BrPfm89P.js";import"./renderer-jz0zn1Az.js";import"./SquareIcon-e3ygcjpv.js";import"./SortAscIcon-CVKVWIWQ.js";import"./url-DEeTWrO-.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-CuRRiOcg.js";import"./index-5Mm_lDnH.js";import"./KernelVariables-DyYN9sSS.js";import"./Flash-C3nF3s4G.js";import"./index-BxurLo3u.js";import"./SortDescIcon-CS4EzHeS.js";import"./NotebookToolbar-Dv7QkxKA.js";import"./RepoPushIcon-Cm8g9NuL.js";import"./Toolbar-BxAi9T92.js";import"./sessions-By2lggFS.js";import"./tokens-B5KQP74f.js";import"./drivecontents-BHpoQXqz.js";import"./kernel-4uWz8R6G.js";function Fe(i){return M.createElement(ee,{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 M.createElement(Fe,{fullPath:this.model.path,name:this.model.name})}}(function(i){class e extends te{constructor(n){super(),this._onTitleChange=s=>{const r=this._getAllState();this._name=s.label,this._triggerChange(r,this._getAllState())},this._onPathChange=(s,r)=>{const c=this._getAllState();this._path=r,this._name=F.PathExt.basename(r),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 s=this._widget;if(s!==null){const c=this._docManager.contextForWidget(s);c?c.pathChanged.disconnect(this._onPathChange):s.title.changed.disconnect(this._onTitleChange)}const r=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(r,this._getAllState())}_getAllState(){return[this._path,this._name]}_triggerChange(n,s){(n[0]!==s[0]||n[1]!==s[1])&&this.stateChanged.emit(void 0)}}i.Model=e})(N||(N={}));function Te(i){return M.createElement(ee,{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:M.createElement(Te,{fileStatus:this._statusMap[this.model.status]})}}(function(i){class e extends te{constructor(n){super(),this._onStatusChange=(s,r)=>{this._status=r,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 s,r;const c=this._widget;if(c!==null){const p=this._docManager.contextForWidget(c);p?p.saveState.disconnect(this._onStatusChange):!((s=this._widget.content)===null||s===void 0)&&s.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):!((r=this._widget.content)===null||r===void 0)&&r.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},s=this._recents[t],r=s.findIndex(c=>c.path===e.path);r>=0&&s.splice(r,1),s.unshift(n),this._setRecents(s,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 s of t){const r=this._recents[s],c=r.filter(p=>e!==p.path);r.length!==c.length&&(this._setRecents(c,s),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,s)=>n.root===s.root?0:n.root!==this._serverRoot?1:-1),this._saveDebouncer.invoke().catch(console.warn)}async _loadRecents(){const e=await this._stateDB.fetch(U.stateDBKey)||{opened:[],closed:[]},t=[...e.opened,...e.closed],n=new Set(await this._getInvalidPaths(t));for(const s of["opened","closed"])this._setRecents(e[s].filter(r=>!n.has(r.path)),s);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(U.stateDBKey,this._recents)}catch(e){console.log("Saving recents failed",e)}}}var U;(function(i){i.stateDBKey="docmanager:recents"})(U||(U={}));var H;(function(i){i.clearRecents="docmanager:clear-recents"})(H||(H={}));var L;(function(i){i.recentsManager="@jupyterlab/docmanager-extension:recents",i.reopenClosed="@jupyterlab/docmanager-extension:reopen-recently-closed",i.mainPlugin="@jupyterlab/docmanager-extension:plugin"})(L||(L={}));const je={id:L.recentsManager,description:"Provides a manager of recently opened and closed documents.",autoStart:!0,requires:[he.IStateDB],optional:[se,j],provides:ae,activate:(i,e,t,n)=>{const{serviceManager:s}=i,r=(n??B).load("jupyterlab"),c=new Be({stateDB:e,contents:s.contents}),p=m=>{c.maximalRecentsLength=m.get("maxNumberRecents").composite};return t&&Promise.all([i.restored,t.load(L.mainPlugin)]).then(([m,a])=>{a.changed.connect(p),p(a)}),i.commands.addCommand(H.clearRecents,{execute:()=>{c.clearRecents()},isEnabled:()=>c.recentlyOpened.length!=0||c.recentlyClosed.length!=0,label:r.__("Clear Recent Documents"),caption:r.__("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 s;t.id||(t.id=`document-manager-${++$.id}`),t.title.dataset={type:"document-title",...t.title.dataset},t.isAttached||e.add(t,"main",n||{}),(!((s=n?.activate)!==null&&s!==void 0)||s)&&e.activateById(t.id),this._opened.emit(t)}get opened(){return this._opened}}}},Ae={id:"@jupyterlab/docmanager-extension:contexts",description:"Adds the handling of opened documents dirty state.",autoStart:!0,requires:[P,V],optional:[re],activate:(i,e,t,n)=>{const s=new WeakSet;t.opened.connect((r,c)=>{const p=e.contextForWidget(c);p&&!s.has(p)&&(n&&Ve(n,p),s.add(p))})}},Ee={id:"@jupyterlab/docmanager-extension:manager",description:"Provides the document manager.",provides:P,requires:[V],optional:[j,re,me,ke.IInfo,ae,Re,G],activate:(i,e,t,n,s,r,c,p,m)=>{var a;const{serviceManager:d,docRegistry:u}=i,_=t??B,f=s??new ge({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:()=>r?r.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,se],optional:[j,ne,J,G],activate:(i,e,t,n,s,r,c,p)=>{s=s??B;const m=s.load("jupyterlab"),a=i.docRegistry;Le(i,e,t,n,s,c,r,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,4 +1,4 @@
|
|
|
1
|
-
import{ai as Ve,h5 as Ue,dl as $e,h6 as Ke,ae as fe,b9 as qe,h7 as ee,h8 as He,cs as Ie,h9 as Qe,ck as Ee,af as Xe,ao as X,v as ue,cT as Ne,ch as We,ha as De,hb as Ye,dk as Ge,dj as Ze,_ as Je,hc as et,hd as tt,he as ot,cg as q,d9 as xe,cl as nt,d8 as Te,hf as it,hg as rt,d5 as at,cZ as Me,c$ as dt,d6 as st,hh as lt,df as he,ct as Le,am as ne,al as ct,dX as Pe,av as ut,el as pt,dp as gt,e5 as mt,ec as ht,au as ft,an as yt,em as vt,cW as Se,hi as _t}from"../datalayer-app-main.js";import{I as Be,b as Ae,a as bt}from"./token-3a7imVUX.js";import{I as je}from"./tokens-CbEQpcM3.js";import{p as Ct,c as wt,f as xt,b as Tt,q as Mt,M as St}from"./index-
|
|
1
|
+
import{ai as Ve,h5 as Ue,dl as $e,h6 as Ke,ae as fe,b9 as qe,h7 as ee,h8 as He,cs as Ie,h9 as Qe,ck as Ee,af as Xe,ao as X,v as ue,cT as Ne,ch as We,ha as De,hb as Ye,dk as Ge,dj as Ze,_ as Je,hc as et,hd as tt,he as ot,cg as q,d9 as xe,cl as nt,d8 as Te,hf as it,hg as rt,d5 as at,cZ as Me,c$ as dt,d6 as st,hh as lt,df as he,ct as Le,am as ne,al as ct,dX as Pe,av as ut,el as pt,dp as gt,e5 as mt,ec as ht,au as ft,an as yt,em as vt,cW as Se,hi as _t}from"../datalayer-app-main.js";import{I as Be,b as Ae,a as bt}from"./token-3a7imVUX.js";import{I as je}from"./tokens-CbEQpcM3.js";import{p as Ct,c as wt,f as xt,b as Tt,q as Mt,M as St}from"./index-DuDsMDnx.js";import{s as Fe}from"./hover-D5sw2rKR.js";import{I as ye}from"./tokens-CREF1pN9.js";import{I as kt}from"./tokens-kO65He8_.js";import{I as It}from"./tokens-Av8g3IGm.js";import{I as Et}from"./tokens-D8J1F3WV.js";import{a as Nt}from"./tokens-CTix9W2f.js";import{W as Wt,V as Lt,I as Pt,a as Bt,b as At,c as jt}from"./document-B3yvxR3p.js";import{I as Ft}from"./tokens-D1XOUNu3.js";import{g as ke}from"./kernelfilestypes-D2B-sFfi.js";import{T as Ot,a as ve}from"./model-D7a10Ag0.js";import"./CellSidebarExtension-BWsHtuqs.js";import"./NotebookSkeleton-z8GKB7Tb.js";import"./Avatar-BrPfm89P.js";import"./renderer-jz0zn1Az.js";import"./SquareIcon-e3ygcjpv.js";import"./SortAscIcon-CVKVWIWQ.js";import"./url-DEeTWrO-.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-CuRRiOcg.js";import"./index-5Mm_lDnH.js";import"./KernelVariables-DyYN9sSS.js";import"./Flash-C3nF3s4G.js";import"./index-BxurLo3u.js";import"./SortDescIcon-CS4EzHeS.js";import"./NotebookToolbar-Dv7QkxKA.js";import"./RepoPushIcon-Cm8g9NuL.js";import"./Toolbar-BxAi9T92.js";import"./sessions-By2lggFS.js";import"./tokens-B5KQP74f.js";import"./drivecontents-BHpoQXqz.js";import"./kernel-4uWz8R6G.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 $e).addWidget(u)}static createCodeViewer(o){const{content:d,mimeType:u,...m}=o,h=new Ke.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 qe,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 He{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 Ct&&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(Ne,{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 Xe({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=Fe({body:m,anchor:this,align:"left"})},this._popup=null,this._commands=o.commands,this.translator=(d=o.translator)!==null&&d!==void 0?d:X;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 We{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||X).load("jupyterlab"),u=typeof r.tabSpace=="number"?d.__("Spaces"):d.__("Tab Indent");return ue.createElement(Ne,{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||X,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=Fe({body:o,anchor:this,align:"right"}),o.update()}_menuClosed(){this.removeClass("jp-mod-clicked")}}(function(r){class o extends We{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 $t={part:1,chapter:1,section:1,subsection:2,subsubsection:3,paragraph:4,subparagraph:5},Kt=/^\s*\\(section|subsection|subsubsection)\{(.+)\}/;class qt 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(Kt);if(f){const y=$t[f[1]];if(y<=this.configuration.maximalDepth){const w=De(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 Ht 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 qt(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 Ze(o,this.parser),{...this.configuration,numberHeaders:!1})}}class Xt 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 J;try{J=new RegExp("^\\s*(class |def |async def |from |import )","d")}catch{J=new RegExp("^\\s*(class |def |async def |from |import )")}class Dt 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{hj as Re,hk as me,hl as z,cm as te,ei as De,hm as We,l as D,am as E,ao as M,d2 as x,cg as S,hn as pe,av as $,ho as F,cW as Be,da as $e,hp as ze,cs as W,ef as ne,ar as Ue,as as oe,r as v,ep as he,ai as ge,ch as qe,hq as ae,dH as se,d4 as fe,cU as He,cT as Ke,hr as Je,b9 as be,_ as Ve,hs as Ge,ht as Qe,ag as ye,hu as Ye,hv as Xe,ct as Ze,d3 as ve,cV as B,hw as _e,dC as et,el as we,hx as tt,em as ke,hy as nt,hz as ot,hA as Se,hB as Ce,hC as at,al as st,hD as it,ap as rt,ae as ct,dm as lt,dn as Te,hE as ie,cA as dt,cz as U,dz as je,au as ut,hF as re,hG as mt,hi as pt,ek as ht,hH as gt}from"../datalayer-app-main.js";import{I as L,a as Ee}from"./tokens-CREF1pN9.js";import{f as Ie,c as ft,J as V,e as Z}from"./index-
|
|
1
|
+
import{hj as Re,hk as me,hl as z,cm as te,ei as De,hm as We,l as D,am as E,ao as M,d2 as x,cg as S,hn as pe,av as $,ho as F,cW as Be,da as $e,hp as ze,cs as W,ef as ne,ar as Ue,as as oe,r as v,ep as he,ai as ge,ch as qe,hq as ae,dH as se,d4 as fe,cU as He,cT as Ke,hr as Je,b9 as be,_ as Ve,hs as Ge,ht as Qe,ag as ye,hu as Ye,hv as Xe,ct as Ze,d3 as ve,cV as B,hw as _e,dC as et,el as we,hx as tt,em as ke,hy as nt,hz as ot,hA as Se,hB as Ce,hC as at,al as st,hD as it,ap as rt,ae as ct,dm as lt,dn as Te,hE as ie,cA as dt,cz as U,dz as je,au as ut,hF as re,hG as mt,hi as pt,ek as ht,hH as gt}from"../datalayer-app-main.js";import{I as L,a as Ee}from"./tokens-CREF1pN9.js";import{f as Ie,c as ft,J as V,e as Z}from"./index-DuDsMDnx.js";import{I as xe}from"./tokens-D8J1F3WV.js";import{s as bt}from"./hover-D5sw2rKR.js";import{I as ee}from"./tokens-CbEQpcM3.js";import"./CellSidebarExtension-BWsHtuqs.js";import"./NotebookSkeleton-z8GKB7Tb.js";import"./Avatar-BrPfm89P.js";import"./renderer-jz0zn1Az.js";import"./SquareIcon-e3ygcjpv.js";import"./SortAscIcon-CVKVWIWQ.js";import"./url-DEeTWrO-.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-CuRRiOcg.js";import"./index-5Mm_lDnH.js";import"./KernelVariables-DyYN9sSS.js";import"./Flash-C3nF3s4G.js";import"./index-BxurLo3u.js";import"./SortDescIcon-CS4EzHeS.js";import"./NotebookToolbar-Dv7QkxKA.js";import"./RepoPushIcon-Cm8g9NuL.js";import"./Toolbar-BxAi9T92.js";import"./sessions-By2lggFS.js";import"./tokens-B5KQP74f.js";import"./drivecontents-BHpoQXqz.js";import"./kernel-4uWz8R6G.js";const yt=Re.bindprops({stylesheet:"commandPaletteHeader",className:"jp-icon-hoverShow-content"});var Q;(function(e){class n extends me.Renderer{renderHeader(s){const r=this.formatHeader(s);return z.li({className:te("lm-CommandPalette-header","jp-icon-hoverShow")},r,z.span(yt))}renderItemIcon(s){const r=this.createIconClass(s);return s.item.isToggled?z.div({className:r},De,s.item.iconLabel):z.div({className:r},s.item.icon,s.item.iconLabel)}createIconClass(s){return te(We.styleClass({stylesheet:"commandPaletteItem"}),s.item.iconClass,"lm-CommandPalette-itemIcon")}}e.Renderer=n,e.defaultRenderer=new n})(Q||(Q={}));const ce="help:open",vt="/lab/api/news",_t="/lab/api/update",G="https://jupyterlab.readthedocs.io/en/4.5.x/privacy_policies.html";async function le(e,n={},c){const s=c??D.ServerConnection.makeSettings(),r=S.URLExt.join(s.baseUrl,e);let t;try{t=await D.ServerConnection.makeRequest(r,n,s)}catch(g){throw new D.ServerConnection.NetworkError(g)}const a=await t.json();if(!t.ok)throw new D.ServerConnection.ResponseError(t,a.message);return a}const Ne={id:"@jupyterlab/apputils-extension:announcements",description:"Add the announcement feature. It will fetch news on the internet and check for application updates.",autoStart:!0,optional:[D.IConfigSectionManager,L,E],activate:(e,n,c,s)=>{var r,t;const a=Ne.id.replace(/[^\w]/g,"");Promise.all([e.restored,(r=c?.load("@jupyterlab/apputils-extension:notification"))!==null&&r!==void 0?r:Promise.resolve(null),(t=n?.create({name:a}))!==null&&t!==void 0?t:Promise.resolve(null)]).then(async([g,u,l])=>{const i=(s??M).load("jupyterlab");if(x.manager.changed.connect((f,m)=>{var o;if(m.type!=="removed")return;const{id:p,tags:b}=(o=m.notification.options.data)!==null&&o!==void 0?o:{};if((b??[]).some(y=>["news","update"].includes(y))&&p){const y={};y[p]={seen:!0,dismissed:!0},l?.update(y).catch(_=>{console.error(`Failed to update the announcements config:
|
|
2
2
|
${_}`)})}}),u?.get("fetchNews").composite==="none"){const f=x.emit(i.__("Would you like to get notified about official Jupyter news?"),"default",{autoClose:!1,actions:[{label:i.__("Open privacy policy"),caption:G,callback:m=>{m.preventDefault(),e.commands.hasCommand(ce)?e.commands.execute(ce,{text:i.__("Privacy policies"),url:G}):window.open(G,"_blank","noreferrer")},displayType:"link"},{label:i.__("Yes"),callback:()=>{x.dismiss(f),l?.update({}).then(()=>h()).catch(m=>{console.error(`Failed to get the news:
|
|
3
3
|
${m}`)}),u?.set("fetchNews","true").catch(m=>{console.error(`Failed to save setting 'fetchNews':
|
|
4
4
|
${m}`)})}},{label:i.__("No"),callback:()=>{x.dismiss(f),u?.set("fetchNews","false").catch(m=>{console.error(`Failed to save setting 'fetchNews':
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as o,cj as S,eW as I,ei as K,eX as x,eY as E,eZ as A,e_ as R,ah as T,v as F,am as L,ao as B,F as O,dC as M,d3 as D,df as q}from"../datalayer-app-main.js";import{o as H}from"./index-D7rnWGLu.js";import{a as W}from"./tokens-CTix9W2f.js";import{I as U}from"./tokens-CREF1pN9.js";import"./CellSidebarExtension-B-vao30u.js";import"./NotebookSkeleton-D9WNoiWD.js";import"./Avatar-Dqz3ZWjZ.js";import"./renderer-jz0zn1Az.js";import"./SquareIcon-e3ygcjpv.js";import"./SortAscIcon-CVKVWIWQ.js";import"./url-DEeTWrO-.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-LgREOVgz.js";import"./index-DIHzcHI1.js";import"./KernelVariables-BUmOt4yF.js";import"./Flash-DdFxPtBI.js";import"./index-BxurLo3u.js";import"./SortDescIcon-CS4EzHeS.js";import"./NotebookToolbar-C2_ZC9Ej.js";import"./RepoPushIcon-Cm8g9NuL.js";import"./Toolbar-B6ROXJ-2.js";import"./sessions-ZDYLkdi_.js";import"./tokens-B5KQP74f.js";import"./drivecontents-BHpoQXqz.js";import"./kernel-4uWz8R6G.js";var _;(function(a){a.editBinding="shortcuts:edit-keybinding",a.addBinding="shortcuts:add-keybinding",a.deleteBinding="shortcuts:delete-keybinding",a.toggleSelectors="shortcuts:toggle-selectors",a.resetAll="shortcuts:reset-all"})(_||(_={}));const j="jp-Shortcuts-ConflictContainer";class k extends o.Component{constructor(e){super(e),this.handleSubmit=async()=>{this._isReplacingExistingKeybinding?this.state.selected?this.props.toggleInput():await this._updateShortcut():(await this._updateShortcut(),this.props.toggleInput())},this._updateShortcut=async()=>{const t=[...this.state.keys,this.state.currentChain];this.setState({keys:t}),this.props.keybinding?await this.props.replaceKeybinding(this.props.shortcut,this.props.keybinding,t):await this.props.addKeybinding(this.props.shortcut,t)},this._handleOverwrite=async(t,i)=>{for(const s of t){const n=s.keybindings.filter(r=>S.deepEqual(r.keys,i)||i.some(h=>S.deepEqual(r.keys,[h])))[0];if(!n){console.error(`Conflicting binding could not be found for ${s} using keys ${i}`);continue}await this.props.deleteKeybinding(s,n)}await this._updateShortcut()},this.parseChaining=(t,i,s,n,r)=>{let h=I.keyForKeydownEvent(t.nativeEvent);const m=["Shift","Control","Alt","Meta","Ctrl","Accel"];if(t.key==="Backspace")s="",i="",n=[],r="",this.setState({value:i,userInput:s,keys:n,currentChain:r});else if(t.key!=="CapsLock"){const y=s.substr(s.lastIndexOf(" ")+1,s.length).trim();m.lastIndexOf(y)===-1&&y!=""?(s=s+",",n.push(r),r="",t.ctrlKey&&t.key!="Control"&&(s=(s+" Ctrl").trim(),r=(r+" Ctrl").trim()),t.metaKey&&t.key!="Meta"&&(s=(s+" Accel").trim(),r=(r+" Accel").trim()),t.altKey&&t.key!="Alt"&&(s=(s+" Alt").trim(),r=(r+" Alt").trim()),t.shiftKey&&t.key!="Shift"&&(s=(s+" Shift").trim(),r=(r+" Shift").trim()),m.lastIndexOf(t.key)===-1?(s=(s+" "+h).trim(),r=(r+" "+h).trim()):t.key==="Meta"?(s=(s+" Accel").trim(),r=(r+" Accel").trim()):t.key==="Control"?(s=(s+" Ctrl").trim(),r=(r+" Ctrl").trim()):t.key==="Shift"?(s=(s+" Shift").trim(),r=(r+" Shift").trim()):t.key==="Alt"?(s=(s+" Alt").trim(),r=(r+" Alt").trim()):(s=(s+" "+t.key).trim(),r=(r+" "+t.key).trim())):t.key==="Control"?(s=(s+" Ctrl").trim(),r=(r+" Ctrl").trim()):t.key==="Meta"?(s=(s+" Accel").trim(),r=(r+" Accel").trim()):t.key==="Shift"?(s=(s+" Shift").trim(),r=(r+" Shift").trim()):t.key==="Alt"?(s=(s+" Alt").trim(),r=(r+" Alt").trim()):(s=(s+" "+h).trim(),r=(r+" "+h).trim())}return this.setState({keys:n,currentChain:r}),[s,n,r]},this.checkNonFunctional=()=>{const t=["Ctrl","Alt","Accel","Shift"],i=this.state.currentChain.split(" "),s=i[i.length-1];return this.setState({isFunctional:t.indexOf(s)===-1}),t.indexOf(s)!==-1},this.checkShortcutAvailability=(t,i,s)=>{const n=this.props.findConflictsFor([...i,s],this.props.shortcut.selector),r=t===""||n.length===0;return!r&&n.length===1&&n[0].id===this.props.shortcut.id&&this._isReplacingExistingKeybinding?(this.setState({isAvailable:!0}),[]):(this.setState({isAvailable:r}),n)},this.handleInput=t=>{t.preventDefault(),this.setState({selected:!1});const i=this.parseChaining(t,this.state.value,this.state.userInput,this.state.keys,this.state.currentChain),s=i[0],n=i[1],r=i[2],h=this.props.toSymbols(s);let m=this.checkShortcutAvailability(s,n,r);this.setState({value:h,userInput:s,keys:n,currentChain:r},()=>{this.checkNonFunctional(),this._emitConflicts(m)})},this._handleBlur=t=>{var i,s;!((i=this._ref.current)===null||i===void 0)&&i.contains(t.relatedTarget)||!((s=t.relatedTarget)===null||s===void 0)&&s.closest(`.${j}`)||this.props.toggleInput()},this._ref=o.createRef(),this.state={value:this.props.placeholder,userInput:"",isAvailable:!0,isFunctional:this._isReplacingExistingKeybinding,keys:[],currentChain:"",selected:!0}}get _isReplacingExistingKeybinding(){return!!this.props.keybinding}_emitConflicts(e){const t=[...this.state.keys,this.state.currentChain];this.props.displayConflicts({conflictsWith:e,keys:this.state.keys,overwrite:async()=>{this.setState({isAvailable:!0}),await this._handleOverwrite(e,t),this.props.toggleInput()},cancel:()=>{this.props.toggleInput()}})}render(){const e=this.props.translator.load("jupyterlab");let t="jp-Shortcuts-Input";return this.state.isAvailable||(t+=" jp-mod-unavailable-Input"),o.createElement("div",{className:this.props.displayInput?this._isReplacingExistingKeybinding?"jp-Shortcuts-InputBox":"jp-Shortcuts-InputBox jp-Shortcuts-InputBoxNew":"jp-mod-hidden",ref:this._ref,onBlur:this._handleBlur},o.createElement("div",{tabIndex:0,className:t,onKeyDown:this.handleInput,ref:i=>i&&i.focus(),"data-lm-suppress-shortcuts":"true"},o.createElement("p",{className:this.state.selected&&this._isReplacingExistingKeybinding?"jp-Shortcuts-InputText jp-mod-selected-InputText":this.state.value===""?"jp-Shortcuts-InputText jp-mod-waiting-InputText":"jp-Shortcuts-InputText"},this.state.value===""?e.__("press keys"):this.state.value)),o.createElement("button",{className:this.state.isFunctional?this.state.isAvailable?"jp-Shortcuts-Submit":"jp-Shortcuts-Submit jp-mod-conflict-Submit":"jp-Shortcuts-Submit jp-mod-defunc-Submit",disabled:!this.state.isAvailable||!this.state.isFunctional,onClick:this.handleSubmit,tabIndex:0},this.state.isAvailable?o.createElement(K.react,null):o.createElement(x.react,null)))}}class Q extends o.Component{constructor(e){super(e),this.toggleInputNew=()=>{this.setState({displayNewInput:!this.state.displayNewInput,conflicts:new Map})},this.toSymbols=t=>t.split(" ").reduce((i,s)=>s==="Ctrl"?(i+" ⌃").trim():s==="Alt"?(i+" ⌥").trim():s==="Shift"?(i+" ⇧").trim():s==="Accel"&&E.IS_MAC?(i+" ⌘").trim():s==="Accel"?(i+" ⌃").trim():(i+" "+s).trim(),""),this._trans=this.props.external.translator.load("jupyterlab"),this.state={displayNewInput:!1,displayReplaceInput:Object.freeze({}),conflicts:new Map}}componentDidMount(){this.props.external.actionRequested.connect(this._onActionRequested,this)}componentWillUnmount(){this.props.external.actionRequested.disconnect(this._onActionRequested,this)}async _onActionRequested(e,t){if(!("shortcutId"in t&&t.shortcutId!==this.props.shortcut.id)){if(t.request==="add-keybinding")return this.toggleInputNew();if(t.request==="edit-keybinding"&&this.toggleInputReplaceMethod(t.keybinding),t.request==="delete-keybinding"){const i=this.props.shortcut,s=i.keybindings[t.keybinding];this.props.deleteKeybinding(i,s).catch(console.error)}}}getCategoryCell(){return o.createElement("div",{className:"jp-Shortcuts-Cell"},this.props.shortcut.category)}getLabelCell(){var e;return o.createElement("div",{className:"jp-Shortcuts-Cell"},o.createElement("div",{className:"jp-label"},(e=this.props.shortcut.label)!==null&&e!==void 0?e:this._trans.__("(Command label missing)")))}getResetShortCutLink(){return o.createElement("a",{className:"jp-Shortcuts-Reset",onClick:()=>this.props.resetKeybindings(this.props.shortcut)},this._trans.__("Reset"))}getSourceCell(){const e=this.props.shortcut.keybindings.every(t=>t.isDefault);return o.createElement("div",{className:"jp-Shortcuts-Cell"},o.createElement("div",{className:"jp-Shortcuts-SourceCell"},e?this._trans.__("Default"):this._trans.__("Custom")),e?"":this.getResetShortCutLink())}getOptionalSelectorCell(){return this.props.showSelectors?o.createElement("div",{className:"jp-Shortcuts-Cell"},o.createElement("div",{className:"jp-selector"},this.props.shortcut.selector)):null}getClassNameForShortCuts(e){const t=["jp-Shortcuts-ShortcutCell"];switch(e.length){case 1:t.push("jp-Shortcuts-SingleCell");break;case 0:t.push("jp-Shortcuts-EmptyCell");break}return t.join(" ")}toggleInputReplaceMethod(e){const t=this.state.displayReplaceInput[e];this.setState({displayReplaceInput:{...this.state.displayReplaceInput,[e]:!t},conflicts:new Map})}getDisplayReplaceInput(e){return this.state.displayReplaceInput[e]}getOrDiplayIfNeeded(e){const t=["jp-Shortcuts-Or"];return(e||this.state.displayNewInput)&&t.push("jp-Shortcuts-Or-Forced"),o.createElement("div",{className:t.join(" ")},this._trans.__("or"))}getShortCutAsInput(e,t){return o.createElement(k,{addKeybinding:this.props.addKeybinding,replaceKeybinding:this.props.replaceKeybinding,deleteKeybinding:this.props.deleteKeybinding,findConflictsFor:this.props.findConflictsFor,toggleInput:()=>this.toggleInputReplaceMethod(t),shortcut:this.props.shortcut,keybinding:e,displayConflicts:i=>{const s=new Map(this.state.conflicts);s.set(e,i),this.setState({conflicts:s})},toSymbols:this.toSymbols,displayInput:this.getDisplayReplaceInput(t),placeholder:this.toSymbols(e.keys.join(", ")),translator:this.props.external.translator})}getShortCutForDisplayOnly(e){return e.keys.map((t,i)=>o.createElement("div",{className:"jp-Shortcuts-ShortcutKeysContainer",key:i},o.createElement("div",{className:"jp-Shortcuts-ShortcutKeys"},this.toSymbols(t)),i+1<e.keys.length?o.createElement("div",{className:"jp-Shortcuts-Comma"},","):null))}isLocationBeingEdited(e){return this.state.displayReplaceInput[e]}getDivForKey(e,t,i){return o.createElement("div",{className:"jp-Shortcuts-ShortcutContainer",key:this.props.shortcut.id+"_"+e,"data-keybinding":e,"data-shortcut":this.props.shortcut.id,onClick:()=>this.toggleInputReplaceMethod(e)},this.isLocationBeingEdited(e)?this.getShortCutAsInput(t,e):this.getShortCutForDisplayOnly(t),!(e===this._nonEmptyBindings.length-1&&Object.values(this.state.displayReplaceInput).some(Boolean))&&this.getOrDiplayIfNeeded(e<this._nonEmptyBindings.length-1))}getAddLink(){return o.createElement("a",{className:this.state.displayNewInput?"":"jp-Shortcuts-Plus",onClick:()=>{this.toggleInputNew()}},this._trans.__("Add"))}getInputBoxWhenToggled(){return this.state.displayNewInput?o.createElement(k,{addKeybinding:this.props.addKeybinding,replaceKeybinding:this.props.replaceKeybinding,deleteKeybinding:this.props.deleteKeybinding,findConflictsFor:this.props.findConflictsFor,toggleInput:this.toggleInputNew,shortcut:this.props.shortcut,displayConflicts:e=>{const t=new Map(this.state.conflicts);t.set(null,e),this.setState({conflicts:t})},toSymbols:this.toSymbols,displayInput:this.state.displayNewInput,placeholder:"",translator:this.props.external.translator}):o.createElement("div",null)}getShortCutsCell(e){return o.createElement("div",{className:"jp-Shortcuts-Cell"},o.createElement("div",{className:this.getClassNameForShortCuts(e)},e.map((t,i)=>this.getDivForKey(i,t,e)),e.length>=1&&!this.state.displayNewInput&&!Object.values(this.state.displayReplaceInput).some(Boolean)&&this.getAddLink(),e.length===0&&!this.state.displayNewInput&&this.getAddLink(),this.getInputBoxWhenToggled()))}getConflicts(){const e=[...this.state.conflicts.values()].filter(t=>t.conflictsWith.length!==0);return e.length===0?o.createElement(o.Fragment,null):o.createElement("div",{className:"jp-Shortcuts-Row jp-Shortcuts-RowWithConflict"},o.createElement("div",{className:j},e.map(t=>{const i=t.keys.join(" ")+"_"+t.conflictsWith.map(s=>s.id).join("");return o.createElement("div",{className:"jp-Shortcuts-Conflict",key:i},o.createElement("div",{className:"jp-Shortcuts-ErrorMessage"},this._trans.__("Shortcut already in use by %1. Overwrite it?",t.conflictsWith.map(s=>{var n;return(n=s.label)!==null&&n!==void 0?n:s.command}).join(", "))),o.createElement("div",{className:"jp-Shortcuts-ErrorButton"},o.createElement("button",{className:"jp-Button jp-mod-reject jp-mod-styled",onClick:()=>{this._clearConflict(t),t.cancel()}},this._trans.__("Cancel")),o.createElement("button",{className:"jp-Button jp-mod-warn jp-mod-styled",onClick:()=>{this._clearConflict(t),t.overwrite()}},this._trans.__("Overwrite"))))})))}_clearConflict(e){const t=new Map,i=this._conflictId(e);for(const[s,n]of this.state.conflicts.entries())this._conflictId(n)!==i&&t.set(s,n);this.setState({conflicts:t})}_conflictId(e){return e.keys.join(" ")+"_"+e.conflictsWith.map(t=>t.id).join("")}get _nonEmptyBindings(){return this.props.shortcut.keybindings.filter(e=>e.keys.filter(t=>t!="").length!==0)}render(){return o.createElement(o.Fragment,null,o.createElement("div",{className:"jp-Shortcuts-Row","data-shortcut":this.props.shortcut.id},this.getCategoryCell(),this.getLabelCell(),this.getShortCutsCell(this._nonEmptyBindings),this.getSourceCell(),this.getOptionalSelectorCell()),this.getConflicts())}}const $=115;class z extends o.Component{render(){return o.createElement("div",{className:"jp-Shortcuts-ShortcutListContainer",style:{height:`${this.props.height-$}px`},id:"shortcutListContainer"},o.createElement("div",{className:"jp-Shortcuts-ShortcutList"},this.props.shortcuts.map(e=>o.createElement(Q,{key:e.id,addKeybinding:this.props.addKeybinding,replaceKeybinding:this.props.replaceKeybinding,deleteKeybinding:this.props.deleteKeybinding,resetKeybindings:this.props.resetKeybindings,findConflictsFor:this.props.findConflictsFor,shortcut:e,showSelectors:this.props.showSelectors,external:this.props.external}))))}}class P extends o.Component{render(){return o.createElement("div",{className:this.props.title.toLowerCase()===this.props.active?"jp-Shortcuts-Header jp-Shortcuts-CurrentHeader":"jp-Shortcuts-Header",onClick:()=>this.props.updateSort(this.props.columnId)},this.props.title,o.createElement(A.react,{className:"jp-Shortcuts-SortButton jp-ShortcutTitleItem-sortButton"}))}}function J(a){return o.createElement("div",{className:"jp-Shortcuts-Symbols"},o.createElement("table",null,o.createElement("tbody",null,o.createElement("tr",null,o.createElement("td",null,o.createElement("kbd",null,"Cmd")),o.createElement("td",null,"⌘"),o.createElement("td",null,o.createElement("kbd",null,"Ctrl")),o.createElement("td",null,"⌃")),o.createElement("tr",null,o.createElement("td",null,o.createElement("kbd",null,"Alt")),o.createElement("td",null,"⌥"),o.createElement("td",null,o.createElement("kbd",null,"Shift")),o.createElement("td",null,"⇧")))))}function G(a){const e=a.translator.load("jupyterlab");return o.createElement("div",{className:"jp-Shortcuts-AdvancedOptions"},o.createElement("a",{className:"jp-Shortcuts-AdvancedOptionsLink",onClick:()=>a.toggleSelectors()},a.showSelectors?e.__("Hide Selectors"):e.__("Show Selectors")),o.createElement("a",{className:"jp-Shortcuts-AdvancedOptionsLink",onClick:()=>a.resetShortcuts()},e.__("Reset All")))}class V extends o.Component{constructor(e){super(e)}getShortCutTitleItem(e,t){return o.createElement("div",{className:"jp-Shortcuts-Cell"},o.createElement(P,{title:e,updateSort:this.props.updateSort,active:this.props.currentSort,columnId:t}))}render(){const e=this.props.translator.load("jupyterlab");return o.createElement("div",{className:"jp-Shortcuts-Top"},o.createElement("div",{className:"jp-Shortcuts-TopNav"},o.createElement(J,null),o.createElement(H,{"aria-label":e.__("Search shortcuts"),updateFilter:(t,i)=>this.props.updateSearchQuery(i??""),placeholder:e.__("Search…"),useFuzzyFilter:!1}),o.createElement(G,{toggleSelectors:this.props.toggleSelectors,showSelectors:this.props.showSelectors,resetShortcuts:this.props.resetShortcuts,translator:this.props.translator})),o.createElement("div",{className:"jp-Shortcuts-HeaderRowContainer"},o.createElement("div",{className:"jp-Shortcuts-HeaderRow"},this.getShortCutTitleItem(e.__("Category"),"category"),this.getShortCutTitleItem(e.__("Command"),"command"),o.createElement("div",{className:"jp-Shortcuts-Cell"},o.createElement("div",{className:"title-div"},e.__("Shortcut"))),this.getShortCutTitleItem(e.__("Source"),"source"),this.props.showSelectors&&this.getShortCutTitleItem(e.__("Selectors"),"selector"))))}}class X extends Map{constructor(e){var t,i,s;super();const{settings:n,commandRegistry:r}=e,h=(t=n.user.shortcuts)!==null&&t!==void 0?t:[],m=new Set(h.map(this._computeKeybindingId.bind(this))),y=(i=n.composite.shortcuts)!==null&&i!==void 0?i:[];for(const p of y){const c=this._computeTargetId(p),u=this._computeKeybindingId(p),d={keys:p.keys,isDefault:!m.has(u)},l=this.get(c);if(l)l.keybindings.push(d);else{const g=p.command.split(":"),f=(s=r.label(p.command,p.args))!==null&&s!==void 0?s:g.length>1?g[1]:void 0,v=g[0];this.set(c,{id:c,selector:p.selector,command:p.command,category:v,label:f,args:p.args,keybindings:[d]})}}}findConflictsFor(e,t){const i=new Y({registry:this});let s=i.findConflicts(e,t);if(s.length!==0)return s;for(const n of e)if(s=i.findConflicts([n],t),s.length!==0)return s;return[]}_computeTargetId(e){var t;return e.command+"_"+e.selector+"_"+JSON.stringify((t=e.args)!==null&&t!==void 0?t:{})}_computeKeybindingId(e){var t;return[e.command,e.selector,JSON.stringify((t=e.args)!==null&&t!==void 0?t:{}),e.keys.join(" ")].join("_")}}class Y{constructor(e){var t;const i=new Map;for(const s of e.registry.values())for(const n of s.keybindings){const r=this._keybindingHash(n.keys,s.selector),h=(t=i.get(r))!==null&&t!==void 0?t:[];h.push(s),i.set(r,h)}this._keybindingsMap=i}findConflicts(e,t){var i;const s=this._keybindingHash(e,t);return(i=this._keybindingsMap.get(s))!==null&&i!==void 0?i:[]}_keybindingHash(e,t){return e.join(" ")+"_"+t}}function Z(a){return a.replace(/\s+/g,"").toLowerCase()}function tt(a,e){var t;const i=a.category.toLowerCase(),s=((t=a.label)!==null&&t!==void 0?t:"").toLowerCase(),n=`${i} ${s}`;let r=1/0,h=null;const m=/\b\w/g;for(;;){const d=m.exec(n);if(!d)break;const l=R.matchSumOfDeltas(n,e,d.index);if(!l)break;l&&l.score<=r&&(r=l.score,h=l.indices)}if(!h||r===1/0)return null;const y=i.length+1,p=T.lowerBound(h,y,(d,l)=>d-l),c=h.slice(0,p),u=h.slice(p);for(let d=0,l=u.length;d<l;++d)u[d]-=y;return c.length===0?{matchType:0,categoryIndices:null,labelIndices:u,score:r,item:a}:u.length===0?{matchType:1,categoryIndices:c,labelIndices:null,score:r,item:a}:{matchType:2,categoryIndices:c,labelIndices:u,score:r,item:a}}function et(a,e){e=Z(e);let t=[];for(const i of a.values()){if(!e){t.push({matchType:3,categoryIndices:null,labelIndices:null,score:0,item:i});continue}let s=tt(i,e);s&&t.push(s)}return t}class st extends o.Component{constructor(e){super(e),this.updateSearchQuery=t=>{this.setState({searchQuery:t},()=>{const i=this.state.shortcutRegistry;this.setState({filteredShortcutList:this._searchFilterShortcuts(i)},()=>{this.sortShortcuts()})})},this.resetShortcuts=async()=>{await(await this.props.external.getSettings()).set("shortcuts",[]),await this._refreshShortcutList()},this.resetKeybindings=async t=>{await this._setKeybinding(t,[])},this.replaceKeybinding=async(t,i,s)=>this._setKeybinding(t,s,i),this.deleteKeybinding=async(t,i)=>{await this._setKeybinding(t,[],i)},this.addKeybinding=async(t,i)=>{await this._setKeybinding(t,i)},this.toggleSelectors=()=>{this.setState({showSelectors:!this.state.showSelectors})},this.updateSort=t=>{t!==this.state.currentSort&&this.setState({currentSort:t},this.sortShortcuts)},this.state={shortcutRegistry:null,filteredShortcutList:new Array,shortcutsFetched:!1,searchQuery:"",showSelectors:!1,currentSort:"category"}}componentDidMount(){this.props.external.actionRequested.connect(this._onActionRequested,this),this._refreshShortcutList()}componentWillUnmount(){this.props.external.actionRequested.disconnect(this._onActionRequested,this)}async _onActionRequested(e,t){if(t.request==="toggle-selectors")return this.toggleSelectors();t.request==="reset-all"&&await this.resetShortcuts()}async _refreshShortcutList(){const e=await this.props.external.getSettings(),t=new X({commandRegistry:this.props.external.commandRegistry,settings:e});this.setState({shortcutRegistry:t,filteredShortcutList:this._searchFilterShortcuts(t),shortcutsFetched:!0},()=>{this.sortShortcuts()})}_searchFilterShortcuts(e){return e?et(e,this.state.searchQuery).map(i=>i.item):[]}async _setKeybinding(e,t,i){var s,n,r,h,m;t.length===1&&t[0]==""&&(t=[]);const y=await this.props.external.getSettings(),p=(s=y.user.shortcuts)!==null&&s!==void 0?s:[],c=[];let u=!1;for(let d of p)if(d.command===e.command&&d.selector===e.selector&&S.deepEqual((n=d.args)!==null&&n!==void 0?n:{},(r=e.args)!==null&&r!==void 0?r:{})&&i&&S.deepEqual(i.keys,d.keys)){const l=i&&i.isDefault&&S.deepEqual(i.keys,t);t.length!==0&&!l&&c.push({command:d.command,selector:d.selector,keys:t}),u=!0}else{if(d.command===e.command&&d.selector===e.selector&&S.deepEqual((h=d.args)!==null&&h!==void 0?h:{},(m=e.args)!==null&&m!==void 0?m:{})&&!i&&t.length===0)continue;c.push(d)}if(!u){const d=!i||!S.deepEqual(i.keys,t);i&&i.isDefault&&d&&c.push({command:e.command,selector:e.selector,disabled:!0,keys:i.keys}),t.length!==0&&c.push({command:e.command,selector:e.selector,keys:t})}await y.set("shortcuts",c),await this._refreshShortcutList()}sortShortcuts(){const e=this.state.filteredShortcutList;let t=this.state.currentSort;t==="command"&&(t="label");const i=s=>{var n;return t==="source"?s.keybindings.every(r=>r.isDefault)?"default":"other":(n=s[t])!==null&&n!==void 0?n:""};e.sort((s,n)=>{var r,h;const m=i(s),y=i(n),p=m.localeCompare(y);if(p)return p;{const c=(r=s.label)!==null&&r!==void 0?r:"",u=(h=n.label)!==null&&h!==void 0?h:"";return c.localeCompare(u)}}),this.setState({filteredShortcutList:e})}render(){return this.state.shortcutsFetched?o.createElement("div",{className:"jp-Shortcuts-ShortcutUI",id:"jp-shortcutui"},o.createElement(V,{updateSearchQuery:this.updateSearchQuery,resetShortcuts:this.resetShortcuts,toggleSelectors:this.toggleSelectors,showSelectors:this.state.showSelectors,updateSort:this.updateSort,currentSort:this.state.currentSort,width:this.props.width,translator:this.props.external.translator}),o.createElement(z,{shortcuts:this.state.filteredShortcutList,resetKeybindings:this.resetKeybindings,addKeybinding:this.addKeybinding,replaceKeybinding:this.replaceKeybinding,deleteKeybinding:this.deleteKeybinding,showSelectors:this.state.showSelectors,findConflictsFor:(e,t)=>this.state.shortcutRegistry?this.state.shortcutRegistry.findConflictsFor(e,t):(console.error("Cannot search for keybinding conflicts at this time: registry is not ready"),[]),height:this.props.height,external:this.props.external})):null}}const it=a=>F.createElement(st,{external:a.external,height:1e3,width:1e3}),w="@jupyterlab/shortcuts-extension:shortcuts";function ot(a,e,t,i){return{translator:t,getSettings:()=>a.load(w,!0),commandRegistry:e.commands,actionRequested:i}}const b={id:w,description:"Adds the keyboard shortcuts editor.",requires:[U],optional:[L,W],activate:async(a,e,t,i)=>{const s=t??B,n=s.load("jupyterlab"),{commands:r}=a;let h,m,y={};if(i){const c=new O({}),u=l=>l.dataset.shortcut!==void 0;a.commands.addCommand(_.editBinding,{label:n.__("Edit Keybinding"),caption:n.__("Edit existing keybinding"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const l=a.contextMenuHitTest(u),g=l?.dataset.keybinding,f=l?.dataset.shortcut;if(!f||!g)return console.log("Missing shortcut id/keybinding information");c.emit({request:"edit-keybinding",keybinding:parseInt(g,10),shortcutId:f})}}),a.commands.addCommand(_.deleteBinding,{label:n.__("Delete Keybinding"),caption:n.__("Delete chosen keybinding"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const l=a.contextMenuHitTest(u),g=l?.dataset.keybinding,f=l?.dataset.shortcut;if(!f||!g)return console.log("Missing shortcut id/keybinding information");c.emit({request:"delete-keybinding",keybinding:parseInt(g,10),shortcutId:f})}}),a.commands.addCommand(_.addBinding,{label:n.__("Add Keybinding"),caption:n.__("Add new keybinding for existing shortcut target"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const l=a.contextMenuHitTest(u),g=l?.dataset.shortcut;if(!g)return console.log("Missing shortcut id to add keybinding to");c.emit({request:"add-keybinding",shortcutId:g})}}),r.addCommand(_.toggleSelectors,{label:n.__("Toggle Selectors"),caption:n.__("Toggle command selectors"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{c.emit({request:"toggle-selectors"})}}),r.addCommand(_.resetAll,{label:n.__("Reset All"),caption:n.__("Reset all shortcuts"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{c.emit({request:"reset-all"})}});const d={fieldRenderer:l=>it({external:ot(e,a,s,c),...l})};i.addRenderer(`${b.id}.shortcuts`,d)}function p(c){const u=a.commands.listCommands().join(`
|
|
1
|
+
import{r as o,cj as S,eW as I,ei as K,eX as x,eY as E,eZ as A,e_ as R,ah as T,v as F,am as L,ao as B,F as O,dC as M,d3 as D,df as q}from"../datalayer-app-main.js";import{o as H}from"./index-DuDsMDnx.js";import{a as W}from"./tokens-CTix9W2f.js";import{I as U}from"./tokens-CREF1pN9.js";import"./CellSidebarExtension-BWsHtuqs.js";import"./NotebookSkeleton-z8GKB7Tb.js";import"./Avatar-BrPfm89P.js";import"./renderer-jz0zn1Az.js";import"./SquareIcon-e3ygcjpv.js";import"./SortAscIcon-CVKVWIWQ.js";import"./url-DEeTWrO-.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-CuRRiOcg.js";import"./index-5Mm_lDnH.js";import"./KernelVariables-DyYN9sSS.js";import"./Flash-C3nF3s4G.js";import"./index-BxurLo3u.js";import"./SortDescIcon-CS4EzHeS.js";import"./NotebookToolbar-Dv7QkxKA.js";import"./RepoPushIcon-Cm8g9NuL.js";import"./Toolbar-BxAi9T92.js";import"./sessions-By2lggFS.js";import"./tokens-B5KQP74f.js";import"./drivecontents-BHpoQXqz.js";import"./kernel-4uWz8R6G.js";var _;(function(a){a.editBinding="shortcuts:edit-keybinding",a.addBinding="shortcuts:add-keybinding",a.deleteBinding="shortcuts:delete-keybinding",a.toggleSelectors="shortcuts:toggle-selectors",a.resetAll="shortcuts:reset-all"})(_||(_={}));const j="jp-Shortcuts-ConflictContainer";class k extends o.Component{constructor(e){super(e),this.handleSubmit=async()=>{this._isReplacingExistingKeybinding?this.state.selected?this.props.toggleInput():await this._updateShortcut():(await this._updateShortcut(),this.props.toggleInput())},this._updateShortcut=async()=>{const t=[...this.state.keys,this.state.currentChain];this.setState({keys:t}),this.props.keybinding?await this.props.replaceKeybinding(this.props.shortcut,this.props.keybinding,t):await this.props.addKeybinding(this.props.shortcut,t)},this._handleOverwrite=async(t,i)=>{for(const s of t){const n=s.keybindings.filter(r=>S.deepEqual(r.keys,i)||i.some(h=>S.deepEqual(r.keys,[h])))[0];if(!n){console.error(`Conflicting binding could not be found for ${s} using keys ${i}`);continue}await this.props.deleteKeybinding(s,n)}await this._updateShortcut()},this.parseChaining=(t,i,s,n,r)=>{let h=I.keyForKeydownEvent(t.nativeEvent);const m=["Shift","Control","Alt","Meta","Ctrl","Accel"];if(t.key==="Backspace")s="",i="",n=[],r="",this.setState({value:i,userInput:s,keys:n,currentChain:r});else if(t.key!=="CapsLock"){const y=s.substr(s.lastIndexOf(" ")+1,s.length).trim();m.lastIndexOf(y)===-1&&y!=""?(s=s+",",n.push(r),r="",t.ctrlKey&&t.key!="Control"&&(s=(s+" Ctrl").trim(),r=(r+" Ctrl").trim()),t.metaKey&&t.key!="Meta"&&(s=(s+" Accel").trim(),r=(r+" Accel").trim()),t.altKey&&t.key!="Alt"&&(s=(s+" Alt").trim(),r=(r+" Alt").trim()),t.shiftKey&&t.key!="Shift"&&(s=(s+" Shift").trim(),r=(r+" Shift").trim()),m.lastIndexOf(t.key)===-1?(s=(s+" "+h).trim(),r=(r+" "+h).trim()):t.key==="Meta"?(s=(s+" Accel").trim(),r=(r+" Accel").trim()):t.key==="Control"?(s=(s+" Ctrl").trim(),r=(r+" Ctrl").trim()):t.key==="Shift"?(s=(s+" Shift").trim(),r=(r+" Shift").trim()):t.key==="Alt"?(s=(s+" Alt").trim(),r=(r+" Alt").trim()):(s=(s+" "+t.key).trim(),r=(r+" "+t.key).trim())):t.key==="Control"?(s=(s+" Ctrl").trim(),r=(r+" Ctrl").trim()):t.key==="Meta"?(s=(s+" Accel").trim(),r=(r+" Accel").trim()):t.key==="Shift"?(s=(s+" Shift").trim(),r=(r+" Shift").trim()):t.key==="Alt"?(s=(s+" Alt").trim(),r=(r+" Alt").trim()):(s=(s+" "+h).trim(),r=(r+" "+h).trim())}return this.setState({keys:n,currentChain:r}),[s,n,r]},this.checkNonFunctional=()=>{const t=["Ctrl","Alt","Accel","Shift"],i=this.state.currentChain.split(" "),s=i[i.length-1];return this.setState({isFunctional:t.indexOf(s)===-1}),t.indexOf(s)!==-1},this.checkShortcutAvailability=(t,i,s)=>{const n=this.props.findConflictsFor([...i,s],this.props.shortcut.selector),r=t===""||n.length===0;return!r&&n.length===1&&n[0].id===this.props.shortcut.id&&this._isReplacingExistingKeybinding?(this.setState({isAvailable:!0}),[]):(this.setState({isAvailable:r}),n)},this.handleInput=t=>{t.preventDefault(),this.setState({selected:!1});const i=this.parseChaining(t,this.state.value,this.state.userInput,this.state.keys,this.state.currentChain),s=i[0],n=i[1],r=i[2],h=this.props.toSymbols(s);let m=this.checkShortcutAvailability(s,n,r);this.setState({value:h,userInput:s,keys:n,currentChain:r},()=>{this.checkNonFunctional(),this._emitConflicts(m)})},this._handleBlur=t=>{var i,s;!((i=this._ref.current)===null||i===void 0)&&i.contains(t.relatedTarget)||!((s=t.relatedTarget)===null||s===void 0)&&s.closest(`.${j}`)||this.props.toggleInput()},this._ref=o.createRef(),this.state={value:this.props.placeholder,userInput:"",isAvailable:!0,isFunctional:this._isReplacingExistingKeybinding,keys:[],currentChain:"",selected:!0}}get _isReplacingExistingKeybinding(){return!!this.props.keybinding}_emitConflicts(e){const t=[...this.state.keys,this.state.currentChain];this.props.displayConflicts({conflictsWith:e,keys:this.state.keys,overwrite:async()=>{this.setState({isAvailable:!0}),await this._handleOverwrite(e,t),this.props.toggleInput()},cancel:()=>{this.props.toggleInput()}})}render(){const e=this.props.translator.load("jupyterlab");let t="jp-Shortcuts-Input";return this.state.isAvailable||(t+=" jp-mod-unavailable-Input"),o.createElement("div",{className:this.props.displayInput?this._isReplacingExistingKeybinding?"jp-Shortcuts-InputBox":"jp-Shortcuts-InputBox jp-Shortcuts-InputBoxNew":"jp-mod-hidden",ref:this._ref,onBlur:this._handleBlur},o.createElement("div",{tabIndex:0,className:t,onKeyDown:this.handleInput,ref:i=>i&&i.focus(),"data-lm-suppress-shortcuts":"true"},o.createElement("p",{className:this.state.selected&&this._isReplacingExistingKeybinding?"jp-Shortcuts-InputText jp-mod-selected-InputText":this.state.value===""?"jp-Shortcuts-InputText jp-mod-waiting-InputText":"jp-Shortcuts-InputText"},this.state.value===""?e.__("press keys"):this.state.value)),o.createElement("button",{className:this.state.isFunctional?this.state.isAvailable?"jp-Shortcuts-Submit":"jp-Shortcuts-Submit jp-mod-conflict-Submit":"jp-Shortcuts-Submit jp-mod-defunc-Submit",disabled:!this.state.isAvailable||!this.state.isFunctional,onClick:this.handleSubmit,tabIndex:0},this.state.isAvailable?o.createElement(K.react,null):o.createElement(x.react,null)))}}class Q extends o.Component{constructor(e){super(e),this.toggleInputNew=()=>{this.setState({displayNewInput:!this.state.displayNewInput,conflicts:new Map})},this.toSymbols=t=>t.split(" ").reduce((i,s)=>s==="Ctrl"?(i+" ⌃").trim():s==="Alt"?(i+" ⌥").trim():s==="Shift"?(i+" ⇧").trim():s==="Accel"&&E.IS_MAC?(i+" ⌘").trim():s==="Accel"?(i+" ⌃").trim():(i+" "+s).trim(),""),this._trans=this.props.external.translator.load("jupyterlab"),this.state={displayNewInput:!1,displayReplaceInput:Object.freeze({}),conflicts:new Map}}componentDidMount(){this.props.external.actionRequested.connect(this._onActionRequested,this)}componentWillUnmount(){this.props.external.actionRequested.disconnect(this._onActionRequested,this)}async _onActionRequested(e,t){if(!("shortcutId"in t&&t.shortcutId!==this.props.shortcut.id)){if(t.request==="add-keybinding")return this.toggleInputNew();if(t.request==="edit-keybinding"&&this.toggleInputReplaceMethod(t.keybinding),t.request==="delete-keybinding"){const i=this.props.shortcut,s=i.keybindings[t.keybinding];this.props.deleteKeybinding(i,s).catch(console.error)}}}getCategoryCell(){return o.createElement("div",{className:"jp-Shortcuts-Cell"},this.props.shortcut.category)}getLabelCell(){var e;return o.createElement("div",{className:"jp-Shortcuts-Cell"},o.createElement("div",{className:"jp-label"},(e=this.props.shortcut.label)!==null&&e!==void 0?e:this._trans.__("(Command label missing)")))}getResetShortCutLink(){return o.createElement("a",{className:"jp-Shortcuts-Reset",onClick:()=>this.props.resetKeybindings(this.props.shortcut)},this._trans.__("Reset"))}getSourceCell(){const e=this.props.shortcut.keybindings.every(t=>t.isDefault);return o.createElement("div",{className:"jp-Shortcuts-Cell"},o.createElement("div",{className:"jp-Shortcuts-SourceCell"},e?this._trans.__("Default"):this._trans.__("Custom")),e?"":this.getResetShortCutLink())}getOptionalSelectorCell(){return this.props.showSelectors?o.createElement("div",{className:"jp-Shortcuts-Cell"},o.createElement("div",{className:"jp-selector"},this.props.shortcut.selector)):null}getClassNameForShortCuts(e){const t=["jp-Shortcuts-ShortcutCell"];switch(e.length){case 1:t.push("jp-Shortcuts-SingleCell");break;case 0:t.push("jp-Shortcuts-EmptyCell");break}return t.join(" ")}toggleInputReplaceMethod(e){const t=this.state.displayReplaceInput[e];this.setState({displayReplaceInput:{...this.state.displayReplaceInput,[e]:!t},conflicts:new Map})}getDisplayReplaceInput(e){return this.state.displayReplaceInput[e]}getOrDiplayIfNeeded(e){const t=["jp-Shortcuts-Or"];return(e||this.state.displayNewInput)&&t.push("jp-Shortcuts-Or-Forced"),o.createElement("div",{className:t.join(" ")},this._trans.__("or"))}getShortCutAsInput(e,t){return o.createElement(k,{addKeybinding:this.props.addKeybinding,replaceKeybinding:this.props.replaceKeybinding,deleteKeybinding:this.props.deleteKeybinding,findConflictsFor:this.props.findConflictsFor,toggleInput:()=>this.toggleInputReplaceMethod(t),shortcut:this.props.shortcut,keybinding:e,displayConflicts:i=>{const s=new Map(this.state.conflicts);s.set(e,i),this.setState({conflicts:s})},toSymbols:this.toSymbols,displayInput:this.getDisplayReplaceInput(t),placeholder:this.toSymbols(e.keys.join(", ")),translator:this.props.external.translator})}getShortCutForDisplayOnly(e){return e.keys.map((t,i)=>o.createElement("div",{className:"jp-Shortcuts-ShortcutKeysContainer",key:i},o.createElement("div",{className:"jp-Shortcuts-ShortcutKeys"},this.toSymbols(t)),i+1<e.keys.length?o.createElement("div",{className:"jp-Shortcuts-Comma"},","):null))}isLocationBeingEdited(e){return this.state.displayReplaceInput[e]}getDivForKey(e,t,i){return o.createElement("div",{className:"jp-Shortcuts-ShortcutContainer",key:this.props.shortcut.id+"_"+e,"data-keybinding":e,"data-shortcut":this.props.shortcut.id,onClick:()=>this.toggleInputReplaceMethod(e)},this.isLocationBeingEdited(e)?this.getShortCutAsInput(t,e):this.getShortCutForDisplayOnly(t),!(e===this._nonEmptyBindings.length-1&&Object.values(this.state.displayReplaceInput).some(Boolean))&&this.getOrDiplayIfNeeded(e<this._nonEmptyBindings.length-1))}getAddLink(){return o.createElement("a",{className:this.state.displayNewInput?"":"jp-Shortcuts-Plus",onClick:()=>{this.toggleInputNew()}},this._trans.__("Add"))}getInputBoxWhenToggled(){return this.state.displayNewInput?o.createElement(k,{addKeybinding:this.props.addKeybinding,replaceKeybinding:this.props.replaceKeybinding,deleteKeybinding:this.props.deleteKeybinding,findConflictsFor:this.props.findConflictsFor,toggleInput:this.toggleInputNew,shortcut:this.props.shortcut,displayConflicts:e=>{const t=new Map(this.state.conflicts);t.set(null,e),this.setState({conflicts:t})},toSymbols:this.toSymbols,displayInput:this.state.displayNewInput,placeholder:"",translator:this.props.external.translator}):o.createElement("div",null)}getShortCutsCell(e){return o.createElement("div",{className:"jp-Shortcuts-Cell"},o.createElement("div",{className:this.getClassNameForShortCuts(e)},e.map((t,i)=>this.getDivForKey(i,t,e)),e.length>=1&&!this.state.displayNewInput&&!Object.values(this.state.displayReplaceInput).some(Boolean)&&this.getAddLink(),e.length===0&&!this.state.displayNewInput&&this.getAddLink(),this.getInputBoxWhenToggled()))}getConflicts(){const e=[...this.state.conflicts.values()].filter(t=>t.conflictsWith.length!==0);return e.length===0?o.createElement(o.Fragment,null):o.createElement("div",{className:"jp-Shortcuts-Row jp-Shortcuts-RowWithConflict"},o.createElement("div",{className:j},e.map(t=>{const i=t.keys.join(" ")+"_"+t.conflictsWith.map(s=>s.id).join("");return o.createElement("div",{className:"jp-Shortcuts-Conflict",key:i},o.createElement("div",{className:"jp-Shortcuts-ErrorMessage"},this._trans.__("Shortcut already in use by %1. Overwrite it?",t.conflictsWith.map(s=>{var n;return(n=s.label)!==null&&n!==void 0?n:s.command}).join(", "))),o.createElement("div",{className:"jp-Shortcuts-ErrorButton"},o.createElement("button",{className:"jp-Button jp-mod-reject jp-mod-styled",onClick:()=>{this._clearConflict(t),t.cancel()}},this._trans.__("Cancel")),o.createElement("button",{className:"jp-Button jp-mod-warn jp-mod-styled",onClick:()=>{this._clearConflict(t),t.overwrite()}},this._trans.__("Overwrite"))))})))}_clearConflict(e){const t=new Map,i=this._conflictId(e);for(const[s,n]of this.state.conflicts.entries())this._conflictId(n)!==i&&t.set(s,n);this.setState({conflicts:t})}_conflictId(e){return e.keys.join(" ")+"_"+e.conflictsWith.map(t=>t.id).join("")}get _nonEmptyBindings(){return this.props.shortcut.keybindings.filter(e=>e.keys.filter(t=>t!="").length!==0)}render(){return o.createElement(o.Fragment,null,o.createElement("div",{className:"jp-Shortcuts-Row","data-shortcut":this.props.shortcut.id},this.getCategoryCell(),this.getLabelCell(),this.getShortCutsCell(this._nonEmptyBindings),this.getSourceCell(),this.getOptionalSelectorCell()),this.getConflicts())}}const $=115;class z extends o.Component{render(){return o.createElement("div",{className:"jp-Shortcuts-ShortcutListContainer",style:{height:`${this.props.height-$}px`},id:"shortcutListContainer"},o.createElement("div",{className:"jp-Shortcuts-ShortcutList"},this.props.shortcuts.map(e=>o.createElement(Q,{key:e.id,addKeybinding:this.props.addKeybinding,replaceKeybinding:this.props.replaceKeybinding,deleteKeybinding:this.props.deleteKeybinding,resetKeybindings:this.props.resetKeybindings,findConflictsFor:this.props.findConflictsFor,shortcut:e,showSelectors:this.props.showSelectors,external:this.props.external}))))}}class P extends o.Component{render(){return o.createElement("div",{className:this.props.title.toLowerCase()===this.props.active?"jp-Shortcuts-Header jp-Shortcuts-CurrentHeader":"jp-Shortcuts-Header",onClick:()=>this.props.updateSort(this.props.columnId)},this.props.title,o.createElement(A.react,{className:"jp-Shortcuts-SortButton jp-ShortcutTitleItem-sortButton"}))}}function J(a){return o.createElement("div",{className:"jp-Shortcuts-Symbols"},o.createElement("table",null,o.createElement("tbody",null,o.createElement("tr",null,o.createElement("td",null,o.createElement("kbd",null,"Cmd")),o.createElement("td",null,"⌘"),o.createElement("td",null,o.createElement("kbd",null,"Ctrl")),o.createElement("td",null,"⌃")),o.createElement("tr",null,o.createElement("td",null,o.createElement("kbd",null,"Alt")),o.createElement("td",null,"⌥"),o.createElement("td",null,o.createElement("kbd",null,"Shift")),o.createElement("td",null,"⇧")))))}function G(a){const e=a.translator.load("jupyterlab");return o.createElement("div",{className:"jp-Shortcuts-AdvancedOptions"},o.createElement("a",{className:"jp-Shortcuts-AdvancedOptionsLink",onClick:()=>a.toggleSelectors()},a.showSelectors?e.__("Hide Selectors"):e.__("Show Selectors")),o.createElement("a",{className:"jp-Shortcuts-AdvancedOptionsLink",onClick:()=>a.resetShortcuts()},e.__("Reset All")))}class V extends o.Component{constructor(e){super(e)}getShortCutTitleItem(e,t){return o.createElement("div",{className:"jp-Shortcuts-Cell"},o.createElement(P,{title:e,updateSort:this.props.updateSort,active:this.props.currentSort,columnId:t}))}render(){const e=this.props.translator.load("jupyterlab");return o.createElement("div",{className:"jp-Shortcuts-Top"},o.createElement("div",{className:"jp-Shortcuts-TopNav"},o.createElement(J,null),o.createElement(H,{"aria-label":e.__("Search shortcuts"),updateFilter:(t,i)=>this.props.updateSearchQuery(i??""),placeholder:e.__("Search…"),useFuzzyFilter:!1}),o.createElement(G,{toggleSelectors:this.props.toggleSelectors,showSelectors:this.props.showSelectors,resetShortcuts:this.props.resetShortcuts,translator:this.props.translator})),o.createElement("div",{className:"jp-Shortcuts-HeaderRowContainer"},o.createElement("div",{className:"jp-Shortcuts-HeaderRow"},this.getShortCutTitleItem(e.__("Category"),"category"),this.getShortCutTitleItem(e.__("Command"),"command"),o.createElement("div",{className:"jp-Shortcuts-Cell"},o.createElement("div",{className:"title-div"},e.__("Shortcut"))),this.getShortCutTitleItem(e.__("Source"),"source"),this.props.showSelectors&&this.getShortCutTitleItem(e.__("Selectors"),"selector"))))}}class X extends Map{constructor(e){var t,i,s;super();const{settings:n,commandRegistry:r}=e,h=(t=n.user.shortcuts)!==null&&t!==void 0?t:[],m=new Set(h.map(this._computeKeybindingId.bind(this))),y=(i=n.composite.shortcuts)!==null&&i!==void 0?i:[];for(const p of y){const c=this._computeTargetId(p),u=this._computeKeybindingId(p),d={keys:p.keys,isDefault:!m.has(u)},l=this.get(c);if(l)l.keybindings.push(d);else{const g=p.command.split(":"),f=(s=r.label(p.command,p.args))!==null&&s!==void 0?s:g.length>1?g[1]:void 0,v=g[0];this.set(c,{id:c,selector:p.selector,command:p.command,category:v,label:f,args:p.args,keybindings:[d]})}}}findConflictsFor(e,t){const i=new Y({registry:this});let s=i.findConflicts(e,t);if(s.length!==0)return s;for(const n of e)if(s=i.findConflicts([n],t),s.length!==0)return s;return[]}_computeTargetId(e){var t;return e.command+"_"+e.selector+"_"+JSON.stringify((t=e.args)!==null&&t!==void 0?t:{})}_computeKeybindingId(e){var t;return[e.command,e.selector,JSON.stringify((t=e.args)!==null&&t!==void 0?t:{}),e.keys.join(" ")].join("_")}}class Y{constructor(e){var t;const i=new Map;for(const s of e.registry.values())for(const n of s.keybindings){const r=this._keybindingHash(n.keys,s.selector),h=(t=i.get(r))!==null&&t!==void 0?t:[];h.push(s),i.set(r,h)}this._keybindingsMap=i}findConflicts(e,t){var i;const s=this._keybindingHash(e,t);return(i=this._keybindingsMap.get(s))!==null&&i!==void 0?i:[]}_keybindingHash(e,t){return e.join(" ")+"_"+t}}function Z(a){return a.replace(/\s+/g,"").toLowerCase()}function tt(a,e){var t;const i=a.category.toLowerCase(),s=((t=a.label)!==null&&t!==void 0?t:"").toLowerCase(),n=`${i} ${s}`;let r=1/0,h=null;const m=/\b\w/g;for(;;){const d=m.exec(n);if(!d)break;const l=R.matchSumOfDeltas(n,e,d.index);if(!l)break;l&&l.score<=r&&(r=l.score,h=l.indices)}if(!h||r===1/0)return null;const y=i.length+1,p=T.lowerBound(h,y,(d,l)=>d-l),c=h.slice(0,p),u=h.slice(p);for(let d=0,l=u.length;d<l;++d)u[d]-=y;return c.length===0?{matchType:0,categoryIndices:null,labelIndices:u,score:r,item:a}:u.length===0?{matchType:1,categoryIndices:c,labelIndices:null,score:r,item:a}:{matchType:2,categoryIndices:c,labelIndices:u,score:r,item:a}}function et(a,e){e=Z(e);let t=[];for(const i of a.values()){if(!e){t.push({matchType:3,categoryIndices:null,labelIndices:null,score:0,item:i});continue}let s=tt(i,e);s&&t.push(s)}return t}class st extends o.Component{constructor(e){super(e),this.updateSearchQuery=t=>{this.setState({searchQuery:t},()=>{const i=this.state.shortcutRegistry;this.setState({filteredShortcutList:this._searchFilterShortcuts(i)},()=>{this.sortShortcuts()})})},this.resetShortcuts=async()=>{await(await this.props.external.getSettings()).set("shortcuts",[]),await this._refreshShortcutList()},this.resetKeybindings=async t=>{await this._setKeybinding(t,[])},this.replaceKeybinding=async(t,i,s)=>this._setKeybinding(t,s,i),this.deleteKeybinding=async(t,i)=>{await this._setKeybinding(t,[],i)},this.addKeybinding=async(t,i)=>{await this._setKeybinding(t,i)},this.toggleSelectors=()=>{this.setState({showSelectors:!this.state.showSelectors})},this.updateSort=t=>{t!==this.state.currentSort&&this.setState({currentSort:t},this.sortShortcuts)},this.state={shortcutRegistry:null,filteredShortcutList:new Array,shortcutsFetched:!1,searchQuery:"",showSelectors:!1,currentSort:"category"}}componentDidMount(){this.props.external.actionRequested.connect(this._onActionRequested,this),this._refreshShortcutList()}componentWillUnmount(){this.props.external.actionRequested.disconnect(this._onActionRequested,this)}async _onActionRequested(e,t){if(t.request==="toggle-selectors")return this.toggleSelectors();t.request==="reset-all"&&await this.resetShortcuts()}async _refreshShortcutList(){const e=await this.props.external.getSettings(),t=new X({commandRegistry:this.props.external.commandRegistry,settings:e});this.setState({shortcutRegistry:t,filteredShortcutList:this._searchFilterShortcuts(t),shortcutsFetched:!0},()=>{this.sortShortcuts()})}_searchFilterShortcuts(e){return e?et(e,this.state.searchQuery).map(i=>i.item):[]}async _setKeybinding(e,t,i){var s,n,r,h,m;t.length===1&&t[0]==""&&(t=[]);const y=await this.props.external.getSettings(),p=(s=y.user.shortcuts)!==null&&s!==void 0?s:[],c=[];let u=!1;for(let d of p)if(d.command===e.command&&d.selector===e.selector&&S.deepEqual((n=d.args)!==null&&n!==void 0?n:{},(r=e.args)!==null&&r!==void 0?r:{})&&i&&S.deepEqual(i.keys,d.keys)){const l=i&&i.isDefault&&S.deepEqual(i.keys,t);t.length!==0&&!l&&c.push({command:d.command,selector:d.selector,keys:t}),u=!0}else{if(d.command===e.command&&d.selector===e.selector&&S.deepEqual((h=d.args)!==null&&h!==void 0?h:{},(m=e.args)!==null&&m!==void 0?m:{})&&!i&&t.length===0)continue;c.push(d)}if(!u){const d=!i||!S.deepEqual(i.keys,t);i&&i.isDefault&&d&&c.push({command:e.command,selector:e.selector,disabled:!0,keys:i.keys}),t.length!==0&&c.push({command:e.command,selector:e.selector,keys:t})}await y.set("shortcuts",c),await this._refreshShortcutList()}sortShortcuts(){const e=this.state.filteredShortcutList;let t=this.state.currentSort;t==="command"&&(t="label");const i=s=>{var n;return t==="source"?s.keybindings.every(r=>r.isDefault)?"default":"other":(n=s[t])!==null&&n!==void 0?n:""};e.sort((s,n)=>{var r,h;const m=i(s),y=i(n),p=m.localeCompare(y);if(p)return p;{const c=(r=s.label)!==null&&r!==void 0?r:"",u=(h=n.label)!==null&&h!==void 0?h:"";return c.localeCompare(u)}}),this.setState({filteredShortcutList:e})}render(){return this.state.shortcutsFetched?o.createElement("div",{className:"jp-Shortcuts-ShortcutUI",id:"jp-shortcutui"},o.createElement(V,{updateSearchQuery:this.updateSearchQuery,resetShortcuts:this.resetShortcuts,toggleSelectors:this.toggleSelectors,showSelectors:this.state.showSelectors,updateSort:this.updateSort,currentSort:this.state.currentSort,width:this.props.width,translator:this.props.external.translator}),o.createElement(z,{shortcuts:this.state.filteredShortcutList,resetKeybindings:this.resetKeybindings,addKeybinding:this.addKeybinding,replaceKeybinding:this.replaceKeybinding,deleteKeybinding:this.deleteKeybinding,showSelectors:this.state.showSelectors,findConflictsFor:(e,t)=>this.state.shortcutRegistry?this.state.shortcutRegistry.findConflictsFor(e,t):(console.error("Cannot search for keybinding conflicts at this time: registry is not ready"),[]),height:this.props.height,external:this.props.external})):null}}const it=a=>F.createElement(st,{external:a.external,height:1e3,width:1e3}),w="@jupyterlab/shortcuts-extension:shortcuts";function ot(a,e,t,i){return{translator:t,getSettings:()=>a.load(w,!0),commandRegistry:e.commands,actionRequested:i}}const b={id:w,description:"Adds the keyboard shortcuts editor.",requires:[U],optional:[L,W],activate:async(a,e,t,i)=>{const s=t??B,n=s.load("jupyterlab"),{commands:r}=a;let h,m,y={};if(i){const c=new O({}),u=l=>l.dataset.shortcut!==void 0;a.commands.addCommand(_.editBinding,{label:n.__("Edit Keybinding"),caption:n.__("Edit existing keybinding"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const l=a.contextMenuHitTest(u),g=l?.dataset.keybinding,f=l?.dataset.shortcut;if(!f||!g)return console.log("Missing shortcut id/keybinding information");c.emit({request:"edit-keybinding",keybinding:parseInt(g,10),shortcutId:f})}}),a.commands.addCommand(_.deleteBinding,{label:n.__("Delete Keybinding"),caption:n.__("Delete chosen keybinding"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const l=a.contextMenuHitTest(u),g=l?.dataset.keybinding,f=l?.dataset.shortcut;if(!f||!g)return console.log("Missing shortcut id/keybinding information");c.emit({request:"delete-keybinding",keybinding:parseInt(g,10),shortcutId:f})}}),a.commands.addCommand(_.addBinding,{label:n.__("Add Keybinding"),caption:n.__("Add new keybinding for existing shortcut target"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const l=a.contextMenuHitTest(u),g=l?.dataset.shortcut;if(!g)return console.log("Missing shortcut id to add keybinding to");c.emit({request:"add-keybinding",shortcutId:g})}}),r.addCommand(_.toggleSelectors,{label:n.__("Toggle Selectors"),caption:n.__("Toggle command selectors"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{c.emit({request:"toggle-selectors"})}}),r.addCommand(_.resetAll,{label:n.__("Reset All"),caption:n.__("Reset all shortcuts"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{c.emit({request:"reset-all"})}});const d={fieldRenderer:l=>it({external:ot(e,a,s,c),...l})};i.addRenderer(`${b.id}.shortcuts`,d)}function p(c){const u=a.commands.listCommands().join(`
|
|
2
2
|
`);m||(m=S.deepCopy(c.properties.shortcuts.default)),y={},c.properties.shortcuts.default=Object.keys(e.plugins).map(d=>{const l=e.plugins[d].schema["jupyter.lab.shortcuts"]||[];return y[d]=l,l}).concat([m]).reduce((d,l)=>E.IS_MAC?d.concat(l):d.concat(l.filter(g=>!g.keys.some(f=>{const{cmd:v}=D.parseKeystroke(f);return v}))),[]).sort((d,l)=>d.command.localeCompare(l.command)),c.properties.shortcuts.description=n.__(`Note: To disable a system default shortcut,
|
|
3
3
|
copy it to User Preferences and add the
|
|
4
4
|
"disabled" key, for example:
|