@datalayer/agent-runtimes 1.6.95 → 1.6.96

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.
Files changed (362) hide show
  1. package/dist-embed/chunks/{AgentDetails-BvfdY3uO.js → AgentDetails-Ddc6d7Vb.js} +1 -1
  2. package/dist-embed/chunks/{AgentDetailsDialog-fQMt4AfV.js → AgentDetailsDialog-BqYyyNpE.js} +1 -1
  3. package/dist-embed/chunks/{AgentInspector-Bk_6hnzQ.js → AgentInspector-Dwh_YetA.js} +1 -1
  4. package/dist-embed/chunks/{AgentInspectorDialog-COpHclrh.js → AgentInspectorDialog-Cau9xrvM.js} +1 -1
  5. package/dist-embed/chunks/{CellSidebarExtension-BSomRlJ-.js → CellSidebarExtension-DSNmntUX.js} +7 -7
  6. package/dist-embed/chunks/{ChatView-C8fvqoAH.js → ChatView-Dzy1KRzJ.js} +4 -4
  7. package/dist-embed/chunks/{CollapsiblePlugin-BcCRY7vG.js → CollapsiblePlugin-DmoruakD.js} +1 -1
  8. package/dist-embed/chunks/{ContextPie-BHsXiDRO.js → ContextPie-x_xvOUQW.js} +1 -1
  9. package/dist-embed/chunks/{DeckComponent-DGJwaGWE.js → DeckComponent-B2pu-8Gg.js} +1 -1
  10. package/dist-embed/chunks/{DeckRenderer-B8PqIWaS.js → DeckRenderer-BitpK9Co.js} +2 -2
  11. package/dist-embed/chunks/{DeckStage-b6WCYIrt.js → DeckStage-D4emgALl.js} +3 -3
  12. package/dist-embed/chunks/{DocumentView-2NxPEuqp.js → DocumentView-GCdq20sR.js} +1 -1
  13. package/dist-embed/chunks/{EphemeralDocument-GaUco3ov.js → EphemeralDocument-BxEBdArS.js} +1 -1
  14. package/dist-embed/chunks/{EphemeralNotebook-DBs08R5-.js → EphemeralNotebook-iWR0tOaY.js} +1 -1
  15. package/dist-embed/chunks/{ExcalidrawComponent-vHJ6t4Sx.js → ExcalidrawComponent-BNE0rUus.js} +1 -1
  16. package/dist-embed/chunks/{ExcalidrawModal-DwWGmnRQ.js → ExcalidrawModal-B0d7EMm1.js} +1 -1
  17. package/dist-embed/chunks/{FormulaBar-CPCjPhlD.js → FormulaBar-BBm1JXuS.js} +1 -1
  18. package/dist-embed/chunks/{JupyterLexicalExtension-Df6IrbR-.js → JupyterLexicalExtension-DEiuU9XK.js} +29 -29
  19. package/dist-embed/chunks/{KernelVariables-oNW3cYs4.js → KernelVariables-BehGjCby.js} +1 -1
  20. package/dist-embed/chunks/{LexicalToolRegistry-CxE-muFM.js → LexicalToolRegistry-CjiooYJz.js} +1 -1
  21. package/dist-embed/chunks/{NotebookToolSurfaces-B3MY-vYT.js → NotebookToolSurfaces-D2niRSgN.js} +1 -1
  22. package/dist-embed/chunks/{NotebookView-B84bIB_s.js → NotebookView--XqCYFyy.js} +1 -1
  23. package/dist-embed/chunks/{Output-DbuS5mTW.js → Output-DIp_tlWH.js} +6 -6
  24. package/dist-embed/chunks/{SandboxDetailsDialog-DxyOgkVN.js → SandboxDetailsDialog-DXoy-U_w.js} +1 -1
  25. package/dist-embed/chunks/{SchemaForm-BpQuFPdH.js → SchemaForm-Cmv4n0Os.js} +1 -1
  26. package/dist-embed/chunks/{SheetStage-C6XKe73k.js → SheetStage-CPrhxiEk.js} +1 -1
  27. package/dist-embed/chunks/{SheetTabs-L2YN86GJ.js → SheetTabs-CIoATuqe.js} +1 -1
  28. package/dist-embed/chunks/SpreadsheetPreviewView-DA_p2PVw.js +1 -0
  29. package/dist-embed/chunks/{SpreadsheetView-DCMl89-H.js → SpreadsheetView-D6J2ll9x.js} +1 -1
  30. package/dist-embed/chunks/TripMapView-Chu4CxoP.js +800 -0
  31. package/dist-embed/chunks/{WidgetVariableView-tHluwrGK.js → WidgetVariableView-pK_kA46x.js} +1 -1
  32. package/dist-embed/chunks/{YouTubePlugin-C-3vxmlQ.js → YouTubePlugin-DkAnyShg.js} +1 -1
  33. package/dist-embed/chunks/{abnfDiagram-VCTEODGH-Bhd2l8QD.js → abnfDiagram-VCTEODGH-CX9mMYXT.js} +1 -1
  34. package/dist-embed/chunks/{abnfDiagram-VCTEODGH-kVHfIAbZ.js → abnfDiagram-VCTEODGH-D1af2ghA.js} +1 -1
  35. package/dist-embed/chunks/{abnfDiagram-VCTEODGH-BCGK5XKK.js → abnfDiagram-VCTEODGH-Ri346RDd.js} +1 -1
  36. package/dist-embed/chunks/{ar-SA-G6X2FPQ2-UWUqTy-K.js → ar-SA-G6X2FPQ2-CXTKdzGs.js} +1 -1
  37. package/dist-embed/chunks/{architectureDiagram-5GKGNRK7-DXEtcMhi.js → architectureDiagram-5GKGNRK7-2OGYSHGz.js} +1 -1
  38. package/dist-embed/chunks/{architectureDiagram-5GKGNRK7-BV0c57bp.js → architectureDiagram-5GKGNRK7-C0-0iqdj.js} +1 -1
  39. package/dist-embed/chunks/{architectureDiagram-5GKGNRK7-Fw3FuyyK.js → architectureDiagram-5GKGNRK7-CsLrz5V8.js} +1 -1
  40. package/dist-embed/chunks/{az-AZ-76LH7QW2-DWmo_K9N.js → az-AZ-76LH7QW2-C2FVIwGa.js} +1 -1
  41. package/dist-embed/chunks/{bg-BG-XCXSNQG7-DEIS8jN8.js → bg-BG-XCXSNQG7-Do7qP3y5.js} +1 -1
  42. package/dist-embed/chunks/{blockDiagram-868be97b-atYMh58B.js → blockDiagram-868be97b-CCPwkNQD.js} +1 -1
  43. package/dist-embed/chunks/{blockDiagram-I7D4REHJ-B5YMuboC.js → blockDiagram-I7D4REHJ-BwtxKaHd.js} +1 -1
  44. package/dist-embed/chunks/{blockDiagram-I7D4REHJ-c2uxRyEL.js → blockDiagram-I7D4REHJ-Dkac8pDH.js} +1 -1
  45. package/dist-embed/chunks/{blockDiagram-I7D4REHJ-2Nx-2jmD.js → blockDiagram-I7D4REHJ-DuFs7Ehc.js} +1 -1
  46. package/dist-embed/chunks/{bn-BD-2XOGV67Q-CdGydfQA.js → bn-BD-2XOGV67Q-CncsPSj6.js} +1 -1
  47. package/dist-embed/chunks/browser-CjxI_vdc.js +1 -0
  48. package/dist-embed/chunks/{c4Diagram-3f4bdde3-DrAykr_M.js → c4Diagram-3f4bdde3-BLw1hbRS.js} +1 -1
  49. package/dist-embed/chunks/{c4Diagram-7LVT6UL2-CxQfmxDp.js → c4Diagram-7LVT6UL2-COW8SWY8.js} +1 -1
  50. package/dist-embed/chunks/{c4Diagram-7LVT6UL2-D9KYeQdn.js → c4Diagram-7LVT6UL2-Cvhvycsr.js} +1 -1
  51. package/dist-embed/chunks/{c4Diagram-7LVT6UL2-CCUWeXWN.js → c4Diagram-7LVT6UL2-Db67ewBM.js} +1 -1
  52. package/dist-embed/chunks/{ca-ES-6MX7JW3Y-Cmxh4hHb.js → ca-ES-6MX7JW3Y-C0yxvCPt.js} +1 -1
  53. package/dist-embed/chunks/{celltoolbartracker-6bzTgI7x.js → celltoolbartracker-BEMovM_S.js} +1 -1
  54. package/dist-embed/chunks/{chunk-2Q5K7J3B-BlidW8Ew.js → chunk-2Q5K7J3B-Ct-A4CCZ.js} +1 -1
  55. package/dist-embed/chunks/{chunk-2Q5K7J3B-C81BMfQj.js → chunk-2Q5K7J3B-Dth1v10p.js} +1 -1
  56. package/dist-embed/chunks/{chunk-2Q5K7J3B-pB9xAJMI.js → chunk-2Q5K7J3B-TussmrZx.js} +1 -1
  57. package/dist-embed/chunks/{chunk-5VM5RSS4-1bQxgqop.js → chunk-5VM5RSS4--_g5ThPK.js} +1 -1
  58. package/dist-embed/chunks/{chunk-5VM5RSS4-BLaN6vZP.js → chunk-5VM5RSS4-EV3_59Fj.js} +1 -1
  59. package/dist-embed/chunks/{chunk-5VM5RSS4-BTk_puBE.js → chunk-5VM5RSS4-PCyW8e7X.js} +1 -1
  60. package/dist-embed/chunks/{chunk-F27PBJKO-Ccv2Z4Dk.js → chunk-F27PBJKO-BEGqbZOG.js} +1 -1
  61. package/dist-embed/chunks/{chunk-F27PBJKO-V8QZRvNX.js → chunk-F27PBJKO-BElpQlek.js} +1 -1
  62. package/dist-embed/chunks/{chunk-F27PBJKO-DIaRuD6P.js → chunk-F27PBJKO-D_dK9KO0.js} +1 -1
  63. package/dist-embed/chunks/{chunk-IMKFNOWR-ChFGHsmA.js → chunk-IMKFNOWR-63rCyYBN.js} +1 -1
  64. package/dist-embed/chunks/{chunk-IMKFNOWR-C6EghkRl.js → chunk-IMKFNOWR-CXlJYg5e.js} +1 -1
  65. package/dist-embed/chunks/{chunk-IMKFNOWR-eUuKtHwj.js → chunk-IMKFNOWR-CvHJsrEQ.js} +1 -1
  66. package/dist-embed/chunks/{chunk-JWPE2WC7-DaXZnYxt.js → chunk-JWPE2WC7-DjRqg4Bs.js} +1 -1
  67. package/dist-embed/chunks/{chunk-JWPE2WC7-C_--LD31.js → chunk-JWPE2WC7-KjfHmyaP.js} +1 -1
  68. package/dist-embed/chunks/{chunk-JWPE2WC7-TEJpnjgJ.js → chunk-JWPE2WC7-i03aNExK.js} +1 -1
  69. package/dist-embed/chunks/{chunk-POPQ4Y6H-C2h36Rd-.js → chunk-POPQ4Y6H-8SJD7Lj6.js} +1 -1
  70. package/dist-embed/chunks/{chunk-POPQ4Y6H-DFDiDT07.js → chunk-POPQ4Y6H-CTgPwukU.js} +1 -1
  71. package/dist-embed/chunks/{chunk-POPQ4Y6H-DE45RGQz.js → chunk-POPQ4Y6H-DD_FZOBG.js} +1 -1
  72. package/dist-embed/chunks/{chunk-SVP7TREG-NHZa_Cm7.js → chunk-SVP7TREG-Be_dVsBv.js} +1 -1
  73. package/dist-embed/chunks/{chunk-SVP7TREG-DuvZnJuX.js → chunk-SVP7TREG-BmKcdcZf.js} +1 -1
  74. package/dist-embed/chunks/{chunk-SVP7TREG-CguX5xuV.js → chunk-SVP7TREG-oWMhd7-x.js} +1 -1
  75. package/dist-embed/chunks/{chunk-TICWLB2K-DZSn1hoa.js → chunk-TICWLB2K-BWrWaYZh.js} +1 -1
  76. package/dist-embed/chunks/{chunk-TICWLB2K-C6yeHtH-.js → chunk-TICWLB2K-DPw0Zd3X.js} +1 -1
  77. package/dist-embed/chunks/{chunk-TICWLB2K-CdnwBh6S.js → chunk-TICWLB2K-oYX1pnTC.js} +1 -1
  78. package/dist-embed/chunks/{chunk-XXDRQBXY-CkHqIglg.js → chunk-XXDRQBXY-B_8mfvZs.js} +1 -1
  79. package/dist-embed/chunks/{chunk-XXDRQBXY-BfS84YmJ.js → chunk-XXDRQBXY-ClhwppX9.js} +1 -1
  80. package/dist-embed/chunks/{chunk-XXDRQBXY-DgalMoCT.js → chunk-XXDRQBXY-DFqSJS_V.js} +1 -1
  81. package/dist-embed/chunks/{classDiagram-ZZMXUADV-3ejDnz-R.js → classDiagram-ZZMXUADV--KG2C8h5.js} +1 -1
  82. package/dist-embed/chunks/{classDiagram-ZZMXUADV-BBfLN17b.js → classDiagram-ZZMXUADV-B7xDgsRr.js} +1 -1
  83. package/dist-embed/chunks/{classDiagram-ZZMXUADV-ClDeAawy.js → classDiagram-ZZMXUADV-DE4to6sK.js} +1 -1
  84. package/dist-embed/chunks/{classDiagram-f62afe4f-BkVbm46G.js → classDiagram-f62afe4f-Dc6e8Her.js} +1 -1
  85. package/dist-embed/chunks/{classDiagram-v2-604399ef-CHjLgl6H.js → classDiagram-v2-604399ef-C495Aipq.js} +1 -1
  86. package/dist-embed/chunks/{classDiagram-v2-VYDZK3BY-3ejDnz-R.js → classDiagram-v2-VYDZK3BY--KG2C8h5.js} +1 -1
  87. package/dist-embed/chunks/{classDiagram-v2-VYDZK3BY-BBfLN17b.js → classDiagram-v2-VYDZK3BY-B7xDgsRr.js} +1 -1
  88. package/dist-embed/chunks/{classDiagram-v2-VYDZK3BY-ClDeAawy.js → classDiagram-v2-VYDZK3BY-DE4to6sK.js} +1 -1
  89. package/dist-embed/chunks/{code-block-IT6T5CEO-Wkpbh9X2.js → code-block-IT6T5CEO-iJrkFsOH.js} +1 -1
  90. package/dist-embed/chunks/{component-CyKYadVm.js → component-DrP6jrik.js} +1 -1
  91. package/dist-embed/chunks/{core-COPCyO2o.js → core-BGGgYrZ9.js} +1 -1
  92. package/dist-embed/chunks/{cose-bilkent-JH36ORCC-5e8DCgyb.js → cose-bilkent-JH36ORCC-Bsk4YY80.js} +1 -1
  93. package/dist-embed/chunks/{cose-bilkent-JH36ORCC-Bi-L9aFT.js → cose-bilkent-JH36ORCC-MSc1rEXR.js} +1 -1
  94. package/dist-embed/chunks/{cose-bilkent-JH36ORCC-CG1KcI5m.js → cose-bilkent-JH36ORCC-tnzM7MrS.js} +1 -1
  95. package/dist-embed/chunks/{createText-aed3d8b3-dWIlVV-C.js → createText-aed3d8b3-PiG8oTtZ.js} +1 -1
  96. package/dist-embed/chunks/{cs-CZ-2BRQDIVT-B1CoQCS8.js → cs-CZ-2BRQDIVT-BlipVn6W.js} +1 -1
  97. package/dist-embed/chunks/{cynefinDiagram-5FMLGOSQ-DsvgMVdR.js → cynefinDiagram-5FMLGOSQ-BJSLWLpL.js} +1 -1
  98. package/dist-embed/chunks/{cynefinDiagram-5FMLGOSQ-CMqYhCCV.js → cynefinDiagram-5FMLGOSQ-CBkkpqSz.js} +1 -1
  99. package/dist-embed/chunks/{cynefinDiagram-5FMLGOSQ-BVOqZUM5.js → cynefinDiagram-5FMLGOSQ-Cxd4hJ0P.js} +1 -1
  100. package/dist-embed/chunks/{da-DK-5WZEPLOC-cOefviqg.js → da-DK-5WZEPLOC-Bw6Ix-Y_.js} +1 -1
  101. package/dist-embed/chunks/{dagre-GXQ25YYZ-Dv7BBqJM.js → dagre-GXQ25YYZ-CkLWQcoy.js} +1 -1
  102. package/dist-embed/chunks/{dagre-GXQ25YYZ-DB5hgFOJ.js → dagre-GXQ25YYZ-DmOK599e.js} +1 -1
  103. package/dist-embed/chunks/{dagre-GXQ25YYZ-DbL89rL1.js → dagre-GXQ25YYZ-u0MmbdNG.js} +1 -1
  104. package/dist-embed/chunks/{de-DE-XR44H4JA-B8A_EIdX.js → de-DE-XR44H4JA-hT0iw9Bo.js} +1 -1
  105. package/dist-embed/chunks/{diagram-S7CK7UJ4-DH-JGQ3O.js → diagram-S7CK7UJ4--1SOVzNY.js} +1 -1
  106. package/dist-embed/chunks/{diagram-S7CK7UJ4-Djh1lnDY.js → diagram-S7CK7UJ4-B7IcrsxK.js} +1 -1
  107. package/dist-embed/chunks/{diagram-S7CK7UJ4-_oQjxS8J.js → diagram-S7CK7UJ4-D0ZMd2cK.js} +1 -1
  108. package/dist-embed/chunks/{diagram-UQ7AKVKN-DrVhyvuK.js → diagram-UQ7AKVKN-CR9r4bhp.js} +1 -1
  109. package/dist-embed/chunks/{diagram-UQ7AKVKN-CkvISpbc.js → diagram-UQ7AKVKN-CZAZODO9.js} +1 -1
  110. package/dist-embed/chunks/{diagram-UQ7AKVKN-rAdoD-XE.js → diagram-UQ7AKVKN-DGk1jOrN.js} +1 -1
  111. package/dist-embed/chunks/{diagram-VSXAHHWV-6xNoFc1e.js → diagram-VSXAHHWV-BGuGdwAu.js} +1 -1
  112. package/dist-embed/chunks/{diagram-VSXAHHWV-BWRulDaN.js → diagram-VSXAHHWV-CPR3SHv_.js} +1 -1
  113. package/dist-embed/chunks/{diagram-VSXAHHWV-Kq0WyfDW.js → diagram-VSXAHHWV-DO0L5yoE.js} +1 -1
  114. package/dist-embed/chunks/{diagram-VX7I27RA-BSENIJml.js → diagram-VX7I27RA-BOMRUaLY.js} +1 -1
  115. package/dist-embed/chunks/{diagram-VX7I27RA-pBVtEscQ.js → diagram-VX7I27RA-BfmIQLZX.js} +1 -1
  116. package/dist-embed/chunks/{diagram-VX7I27RA-B5e3Qv0x.js → diagram-VX7I27RA-DMRKeXbI.js} +1 -1
  117. package/dist-embed/chunks/{diagram-Z3DM3KII-DkTW7b_d.js → diagram-Z3DM3KII-B2OiuH_C.js} +1 -1
  118. package/dist-embed/chunks/{diagram-Z3DM3KII-dQNfxGJA.js → diagram-Z3DM3KII-DAiKcNEv.js} +1 -1
  119. package/dist-embed/chunks/{diagram-Z3DM3KII-CCtO4ivG.js → diagram-Z3DM3KII-DKDeEH1W.js} +1 -1
  120. package/dist-embed/chunks/{ebnfDiagram-PWID7BFC-fRVaHZix.js → ebnfDiagram-PWID7BFC-Cru7ooRB.js} +1 -1
  121. package/dist-embed/chunks/{ebnfDiagram-PWID7BFC-DFo1owyO.js → ebnfDiagram-PWID7BFC-DRjyqxcH.js} +1 -1
  122. package/dist-embed/chunks/{ebnfDiagram-PWID7BFC-DhashMjX.js → ebnfDiagram-PWID7BFC-uMVSPDOp.js} +1 -1
  123. package/dist-embed/chunks/{edges-b2856ca0-CxR_AYFU.js → edges-b2856ca0-Cggl2xrH.js} +1 -1
  124. package/dist-embed/chunks/{el-GR-BZB4AONW-r6OOggAo.js → el-GR-BZB4AONW-BmNYPiJK.js} +1 -1
  125. package/dist-embed/chunks/{erDiagram-5d81789a-pWCuXn86.js → erDiagram-5d81789a-CGBXBycw.js} +1 -1
  126. package/dist-embed/chunks/{erDiagram-RLTQ6QDP-qBMO3ODf.js → erDiagram-RLTQ6QDP-CN1X55A5.js} +1 -1
  127. package/dist-embed/chunks/{erDiagram-RLTQ6QDP-Cn71QFng.js → erDiagram-RLTQ6QDP-CSpJrmyr.js} +1 -1
  128. package/dist-embed/chunks/{erDiagram-RLTQ6QDP-C1-L32ui.js → erDiagram-RLTQ6QDP-DIFLAmTe.js} +1 -1
  129. package/dist-embed/chunks/{es-ES-U4NZUMDT-B_e9d454.js → es-ES-U4NZUMDT-CE7hUJnw.js} +1 -1
  130. package/dist-embed/chunks/{esm-BBkfzxv_.js → esm-Bs-8Cbf_.js} +1 -1
  131. package/dist-embed/chunks/{esm-DEiQo7YS.js → esm-CsO1ipmZ.js} +1 -1
  132. package/dist-embed/chunks/{eu-ES-A7QVB2H4-Blt0C5Cr.js → eu-ES-A7QVB2H4-BUk5broy.js} +1 -1
  133. package/dist-embed/chunks/{fa-IR-HGAKTJCU-CTozxxBD.js → fa-IR-HGAKTJCU-DvlFAlYH.js} +1 -1
  134. package/dist-embed/chunks/{fi-FI-Z5N7JZ37-CyAB-y-D.js → fi-FI-Z5N7JZ37-DzF1j0vM.js} +1 -1
  135. package/dist-embed/chunks/{flowDb-185abca5-mGOFN4Rm.js → flowDb-185abca5-CR_eNtea.js} +1 -1
  136. package/dist-embed/chunks/{flowDiagram-1629c991-BpFY8YdN.js → flowDiagram-1629c991-BUCdGiy7.js} +1 -1
  137. package/dist-embed/chunks/{flowDiagram-HODETNUW-Bid_pFDK.js → flowDiagram-HODETNUW-40v2AZyg.js} +1 -1
  138. package/dist-embed/chunks/{flowDiagram-HODETNUW-luWVHeDm.js → flowDiagram-HODETNUW-Ehnca2ni.js} +1 -1
  139. package/dist-embed/chunks/{flowDiagram-HODETNUW-DK6nfPXm.js → flowDiagram-HODETNUW-rrCrE8ag.js} +1 -1
  140. package/dist-embed/chunks/{flowDiagram-v2-1d953310-D6OBW8Rm.js → flowDiagram-v2-1d953310-C-mQVR3d.js} +1 -1
  141. package/dist-embed/chunks/{flowchart-elk-definition-6df44142-BVaCKHm8.js → flowchart-elk-definition-6df44142-BUjCU9MT.js} +1 -1
  142. package/dist-embed/chunks/{fr-FR-RHASNOE6-DqQdDGJI.js → fr-FR-RHASNOE6-DGF_Vyig.js} +1 -1
  143. package/dist-embed/chunks/{ganttDiagram-3b0b3873-Cv_0V3zO.js → ganttDiagram-3b0b3873-CU1sjzSg.js} +1 -1
  144. package/dist-embed/chunks/{ganttDiagram-EL5Y4UJY-m6mZe7W0.js → ganttDiagram-EL5Y4UJY-B2NVsC-C.js} +1 -1
  145. package/dist-embed/chunks/{ganttDiagram-EL5Y4UJY-DZHrkG45.js → ganttDiagram-EL5Y4UJY-BHLbHQvv.js} +1 -1
  146. package/dist-embed/chunks/{ganttDiagram-EL5Y4UJY--60tKSM9.js → ganttDiagram-EL5Y4UJY-CL_uGZmq.js} +1 -1
  147. package/dist-embed/chunks/{gitGraphDiagram-WWUBYQGX-aZuraF8j.js → gitGraphDiagram-WWUBYQGX-C9dQonfW.js} +1 -1
  148. package/dist-embed/chunks/{gitGraphDiagram-WWUBYQGX-DQGRL7uj.js → gitGraphDiagram-WWUBYQGX-CCUBvn_Y.js} +1 -1
  149. package/dist-embed/chunks/{gitGraphDiagram-WWUBYQGX-BNb2xhKp.js → gitGraphDiagram-WWUBYQGX-DtuCNBUK.js} +1 -1
  150. package/dist-embed/chunks/{gitGraphDiagram-f01e8bc2-C14H7TVH.js → gitGraphDiagram-f01e8bc2-BbkFL6o9.js} +1 -1
  151. package/dist-embed/chunks/{gl-ES-HMX3MZ6V-DqEBlLxz.js → gl-ES-HMX3MZ6V-xM5HzxAU.js} +1 -1
  152. package/dist-embed/chunks/{he-IL-6SHJWFNN-BvhQ--Ic.js → he-IL-6SHJWFNN-nbUgZbH-.js} +1 -1
  153. package/dist-embed/chunks/{hi-IN-IWLTKZ5I-DYH2l25d.js → hi-IN-IWLTKZ5I-Cdlzp28w.js} +1 -1
  154. package/dist-embed/chunks/{hu-HU-A5ZG7DT2-DQgUyc8H.js → hu-HU-A5ZG7DT2-CMH5lTGq.js} +1 -1
  155. package/dist-embed/chunks/{id-ID-SAP4L64H-pbXSdQ7E.js → id-ID-SAP4L64H-Bi5Ltt4D.js} +1 -1
  156. package/dist-embed/chunks/{index-9bae90f3-FAkVZI_I.js → index-9bae90f3-C-MowVD8.js} +1 -1
  157. package/dist-embed/chunks/{index-Bc6gicqV.js → index-BNjq7TZD.js} +1 -1
  158. package/dist-embed/chunks/{index-B6Qu-Ldt.js → index-BQEJgzm9.js} +4 -4
  159. package/dist-embed/chunks/{index-BXARqQ-K.js → index-BjMNv4qG.js} +1 -1
  160. package/dist-embed/chunks/{index-CnpOaqg6.js → index-CUjcBn1v.js} +3 -3
  161. package/dist-embed/chunks/{index-BQ5muxLJ.js → index-Ch2yqELA.js} +15 -15
  162. package/dist-embed/chunks/{index-BIUfp2AH.js → index-DF5urV1Q.js} +1 -1
  163. package/dist-embed/chunks/{index-UqDGAeD4.js → index-D_112S5W.js} +1 -1
  164. package/dist-embed/chunks/{index-C8Ip0RIO.js → index-PwNNIVgK.js} +1 -1
  165. package/dist-embed/chunks/{index-UMhfKl2p.js → index-tO6w-mHa.js} +2 -2
  166. package/dist-embed/chunks/{index-vGRALwj6.js → index-yjEWxzbP.js} +4 -4
  167. package/dist-embed/chunks/{index.esm-zVCHVwV3.js → index.esm-B7H9qIsG.js} +1 -1
  168. package/dist-embed/chunks/{index.esm-DGPDabeX.js → index.esm-CS_7aH6j.js} +1 -1
  169. package/dist-embed/chunks/{infoDiagram-27XIBGKW-B6XclB9A.js → infoDiagram-27XIBGKW-11rIl0SX.js} +1 -1
  170. package/dist-embed/chunks/{infoDiagram-27XIBGKW-BnvfNhoo.js → infoDiagram-27XIBGKW-B7vKfShh.js} +1 -1
  171. package/dist-embed/chunks/{infoDiagram-27XIBGKW-BSmA5qBE.js → infoDiagram-27XIBGKW-DJuz15cI.js} +1 -1
  172. package/dist-embed/chunks/{infoDiagram-a29d40f1-CaObtgvQ.js → infoDiagram-a29d40f1-DY20od-W.js} +1 -1
  173. package/dist-embed/chunks/{isEqual-BybBNsZK.js → isEqual-niFNV5MZ.js} +1 -1
  174. package/dist-embed/chunks/{ishikawaDiagram-5VMMS53U-CoYeuvtz.js → ishikawaDiagram-5VMMS53U-BxF1LxPw.js} +1 -1
  175. package/dist-embed/chunks/{ishikawaDiagram-5VMMS53U-BjZ55y3a.js → ishikawaDiagram-5VMMS53U-CAgZHNJ1.js} +1 -1
  176. package/dist-embed/chunks/{ishikawaDiagram-5VMMS53U-DZof4mVq.js → ishikawaDiagram-5VMMS53U-CGhkG9xO.js} +1 -1
  177. package/dist-embed/chunks/{it-IT-JPQ66NNP-Dfqt8qws.js → it-IT-JPQ66NNP-CQG7I-7I.js} +1 -1
  178. package/dist-embed/chunks/{ja-JP-DBVTYXUO-CJl2BGZ0.js → ja-JP-DBVTYXUO-N1Fy__-x.js} +1 -1
  179. package/dist-embed/chunks/{journeyDiagram-3NMN7TZE-BQbXSJPZ.js → journeyDiagram-3NMN7TZE-BWry4eJr.js} +1 -1
  180. package/dist-embed/chunks/{journeyDiagram-3NMN7TZE-DUk5noZ3.js → journeyDiagram-3NMN7TZE-PMSgj3LU.js} +1 -1
  181. package/dist-embed/chunks/{journeyDiagram-3NMN7TZE-lMh4QSWD.js → journeyDiagram-3NMN7TZE-ymHKbZWG.js} +1 -1
  182. package/dist-embed/chunks/{journeyDiagram-95396277-B-wKHrA2.js → journeyDiagram-95396277-D8JFKSEp.js} +1 -1
  183. package/dist-embed/chunks/{kaa-6HZHGXH3-CkuYTE9k.js → kaa-6HZHGXH3-CV61GofE.js} +1 -1
  184. package/dist-embed/chunks/{kab-KAB-ZGHBKWFO-DwGUYmYz.js → kab-KAB-ZGHBKWFO-pu8Ov9No.js} +1 -1
  185. package/dist-embed/chunks/{kanban-definition-UXKFOSKX-Dfptc1fl.js → kanban-definition-UXKFOSKX-BnOah8Nd.js} +1 -1
  186. package/dist-embed/chunks/{kanban-definition-UXKFOSKX-DsS5AFXs.js → kanban-definition-UXKFOSKX-C_KPxfzn.js} +1 -1
  187. package/dist-embed/chunks/{kanban-definition-UXKFOSKX-D6Efkxin.js → kanban-definition-UXKFOSKX-UuVYvKiH.js} +1 -1
  188. package/dist-embed/chunks/{kk-KZ-P5N5QNE5-hKF6fBok.js → kk-KZ-P5N5QNE5-B8voVV7U.js} +1 -1
  189. package/dist-embed/chunks/{km-KH-HSX4SM5Z-CZBBU2M1.js → km-KH-HSX4SM5Z-C0VX4oEM.js} +1 -1
  190. package/dist-embed/chunks/{ko-KR-MTYHY66A-C-cMpFID.js → ko-KR-MTYHY66A-CcmFHDM1.js} +1 -1
  191. package/dist-embed/chunks/{ku-TR-6OUDTVRD-BhT89N8u.js → ku-TR-6OUDTVRD-CMFEX55_.js} +1 -1
  192. package/dist-embed/chunks/{layout-DwxE-zZ9.js → layout-CFVjfoYF.js} +1 -1
  193. package/dist-embed/chunks/{layout-3P_7xyJi.js → layout-CkB5JWAM.js} +1 -1
  194. package/dist-embed/chunks/{layout-NgpwW7nA.js → layout-oj4w4R5j.js} +1 -1
  195. package/dist-embed/chunks/{lexicalHooks-CVBA8Kup.js → lexicalHooks-Bh9Bp3P-.js} +1 -1
  196. package/dist-embed/chunks/{lib-DdQRcxuM.js → lib-5rtxMXPk.js} +1 -1
  197. package/dist-embed/chunks/{lib-D3T0Aw2k.js → lib-B8dqehoH.js} +1 -1
  198. package/dist-embed/chunks/{lib-BMrXwoDK.js → lib-BCnNB350.js} +1 -1
  199. package/dist-embed/chunks/{lib-USWrkybh.js → lib-BEADLX2g.js} +1 -1
  200. package/dist-embed/chunks/{lib-qTRu1lKk.js → lib-BPAFvW23.js} +1 -1
  201. package/dist-embed/chunks/{lib-HxF1xu1E.js → lib-BQZeV_uH.js} +1 -1
  202. package/dist-embed/chunks/{lib-BkcHzjVY.js → lib-BewlLHfg.js} +1 -1
  203. package/dist-embed/chunks/{lib-ClNhs2cv.js → lib-Bj-F8WWr.js} +1 -1
  204. package/dist-embed/chunks/{lib-DHt04E5T.js → lib-C-Ggs4iB.js} +1 -1
  205. package/dist-embed/chunks/{lib-DlFNTFJX.js → lib-CBSRQHoK.js} +1 -1
  206. package/dist-embed/chunks/{lib-C553WOkt.js → lib-CXZrbtJ9.js} +1 -1
  207. package/dist-embed/chunks/{lib-CfkV3N1c.js → lib-CiFgHF6H.js} +1 -1
  208. package/dist-embed/chunks/{lib-BkgDQr4b.js → lib-Cs68pT1f.js} +5 -5
  209. package/dist-embed/chunks/{lib-K8ZzEBaR.js → lib-D8Qc-bJh.js} +1 -1
  210. package/dist-embed/chunks/{lib-ClnZlQTa.js → lib-D8bmwG1Q.js} +1 -1
  211. package/dist-embed/chunks/{lib-DNqisZNg.js → lib-DDBakXc_.js} +1 -1
  212. package/dist-embed/chunks/{lib-DjYu7LUh.js → lib-DdHOeWKF.js} +1 -1
  213. package/dist-embed/chunks/{lib-CUuelUb1.js → lib-DtwAoDYT.js} +1 -1
  214. package/dist-embed/chunks/{lib-CSYbEQXY.js → lib-bSDF86bC.js} +1 -1
  215. package/dist-embed/chunks/{lib-CcQ1AdFH.js → lib-euir_64d.js} +1 -1
  216. package/dist-embed/chunks/{lt-LT-XHIRWOB4-DAnwG3pL.js → lt-LT-XHIRWOB4-CSs-cwk2.js} +1 -1
  217. package/dist-embed/chunks/{lv-LV-5QDEKY6T-DKutSEbv.js → lv-LV-5QDEKY6T-DBBrXhCL.js} +1 -1
  218. package/dist-embed/chunks/{mermaid.core-BKpjbvr4.js → mermaid.core-59YcUgz5.js} +3 -3
  219. package/dist-embed/chunks/{mermaid.core-BsYC7G_m.js → mermaid.core-BQpV-itu.js} +5 -5
  220. package/dist-embed/chunks/{mindmap-definition-YA3MSWOX-CHG6GkTy.js → mindmap-definition-YA3MSWOX-CDtT_DYs.js} +1 -1
  221. package/dist-embed/chunks/{mindmap-definition-YA3MSWOX-Cpij5zvN.js → mindmap-definition-YA3MSWOX-Cv6GXhbx.js} +1 -1
  222. package/dist-embed/chunks/{mindmap-definition-YA3MSWOX-BVjt4l-I.js → mindmap-definition-YA3MSWOX-Dpx3iQ9G.js} +1 -1
  223. package/dist-embed/chunks/{mindmap-definition-e4c1d938--68TxVLH.js → mindmap-definition-e4c1d938-BAEXTTXT.js} +1 -1
  224. package/dist-embed/chunks/{model-C6vyI0zW.js → model-BUkhfry_.js} +1 -1
  225. package/dist-embed/chunks/{mr-IN-CRQNXWMA-BHnTqpR5.js → mr-IN-CRQNXWMA-BoxiDYTQ.js} +1 -1
  226. package/dist-embed/chunks/{my-MM-5M5IBNSE-D7B2cCpQ.js → my-MM-5M5IBNSE-O2vgzfJi.js} +1 -1
  227. package/dist-embed/chunks/{nb-NO-T6EIAALU-CcZKsAQj.js → nb-NO-T6EIAALU-t_ME7jfF.js} +1 -1
  228. package/dist-embed/chunks/{nl-NL-IS3SIHDZ-Bg4B5s14.js → nl-NL-IS3SIHDZ-CJOgjJen.js} +1 -1
  229. package/dist-embed/chunks/{nn-NO-6E72VCQL-g7xBg2p-.js → nn-NO-6E72VCQL-CKJROtf6.js} +1 -1
  230. package/dist-embed/chunks/{oc-FR-POXYY2M6-Dhbf2zJv.js → oc-FR-POXYY2M6-hekTJXBh.js} +1 -1
  231. package/dist-embed/chunks/{pa-IN-N4M65BXN-KR1yA3_P.js → pa-IN-N4M65BXN-C0nR_lWW.js} +1 -1
  232. package/dist-embed/chunks/{pegDiagram-XKGWAZYB-BIkw8nt9.js → pegDiagram-XKGWAZYB-6GkUf1Ix.js} +1 -1
  233. package/dist-embed/chunks/{pegDiagram-XKGWAZYB-FCAU3TOo.js → pegDiagram-XKGWAZYB-BLi2ATBT.js} +1 -1
  234. package/dist-embed/chunks/{pegDiagram-XKGWAZYB-CE26qzAb.js → pegDiagram-XKGWAZYB-BxHZsnZc.js} +1 -1
  235. package/dist-embed/chunks/{percentages-BXMCSKIN-NdFZNkF5.js → percentages-BXMCSKIN-aDx1Abuj.js} +5 -5
  236. package/dist-embed/chunks/{pieDiagram-E7YTZNPT-7IUSm4Cd.js → pieDiagram-E7YTZNPT-0y9vHfxN.js} +1 -1
  237. package/dist-embed/chunks/{pieDiagram-E7YTZNPT-CmRfYSUK.js → pieDiagram-E7YTZNPT-BuSxz3f3.js} +1 -1
  238. package/dist-embed/chunks/{pieDiagram-E7YTZNPT-DnfolJly.js → pieDiagram-E7YTZNPT-CdMa7Tp_.js} +1 -1
  239. package/dist-embed/chunks/{pieDiagram-c941bede-BOM0hWZE.js → pieDiagram-c941bede-B4wYxQiG.js} +1 -1
  240. package/dist-embed/chunks/{pl-PL-T2D74RX3-BFMj2kIn.js → pl-PL-T2D74RX3-Bz6-nRIX.js} +1 -1
  241. package/dist-embed/chunks/{plugin-L-k9onR1.js → plugin-BeYApBgc.js} +1 -1
  242. package/dist-embed/chunks/{pt-BR-5N22H2LF-QBjImZeD.js → pt-BR-5N22H2LF-CIsrl0RF.js} +1 -1
  243. package/dist-embed/chunks/{pt-PT-UZXXM6DQ-BOajnzhW.js → pt-PT-UZXXM6DQ-Cm5V6d4j.js} +1 -1
  244. package/dist-embed/chunks/{quadrantDiagram-AXDQQJYC-CBuCLTK0.js → quadrantDiagram-AXDQQJYC-C3pbnXL8.js} +1 -1
  245. package/dist-embed/chunks/{quadrantDiagram-AXDQQJYC-D_YPReS-.js → quadrantDiagram-AXDQQJYC-CR6z5DUd.js} +1 -1
  246. package/dist-embed/chunks/{quadrantDiagram-AXDQQJYC-CAX9oQAl.js → quadrantDiagram-AXDQQJYC-CeT_Rjti.js} +1 -1
  247. package/dist-embed/chunks/{quadrantDiagram-cf8b8fe0-r_4FwxxN.js → quadrantDiagram-cf8b8fe0-CkBzFHkI.js} +1 -1
  248. package/dist-embed/chunks/{railroadDiagram-O6MQD6OU-CtOU0UiI.js → railroadDiagram-O6MQD6OU-BdfroHrK.js} +1 -1
  249. package/dist-embed/chunks/{railroadDiagram-O6MQD6OU-Dyq4RidU.js → railroadDiagram-O6MQD6OU-CqW4kNU7.js} +1 -1
  250. package/dist-embed/chunks/{railroadDiagram-O6MQD6OU-CFRdBxSp.js → railroadDiagram-O6MQD6OU-D4k0ckwJ.js} +1 -1
  251. package/dist-embed/chunks/{renderer-DQzulrO-.js → renderer-BTUDFH3O.js} +1 -1
  252. package/dist-embed/chunks/{requirementDiagram-53bda41b-YrNRNVqN.js → requirementDiagram-53bda41b-CGcKbmSY.js} +1 -1
  253. package/dist-embed/chunks/{requirementDiagram-BXWQKSXE-DW6fqUb-.js → requirementDiagram-BXWQKSXE-BZv3TS5_.js} +1 -1
  254. package/dist-embed/chunks/{requirementDiagram-BXWQKSXE-2Tq7Hgrr.js → requirementDiagram-BXWQKSXE-Bx-qNrGP.js} +1 -1
  255. package/dist-embed/chunks/{requirementDiagram-BXWQKSXE-6gtvqQ6g.js → requirementDiagram-BXWQKSXE-Dv-n3Ik2.js} +1 -1
  256. package/dist-embed/chunks/{ro-RO-JPDTUUEW-BicyuCgI.js → ro-RO-JPDTUUEW-BhCiwtAd.js} +1 -1
  257. package/dist-embed/chunks/{ru-RU-B4JR7IUQ-D5Lzo4K2.js → ru-RU-B4JR7IUQ-1R8PROIW.js} +1 -1
  258. package/dist-embed/chunks/{sankeyDiagram-P5KCCOFB-DBQ1HZxe.js → sankeyDiagram-P5KCCOFB-B1hPyVOc.js} +1 -1
  259. package/dist-embed/chunks/{sankeyDiagram-P5KCCOFB-ywB-7Sh8.js → sankeyDiagram-P5KCCOFB-B23f7m-H.js} +1 -1
  260. package/dist-embed/chunks/{sankeyDiagram-P5KCCOFB-Cjqnuiax.js → sankeyDiagram-P5KCCOFB-BK_3FXbs.js} +1 -1
  261. package/dist-embed/chunks/{sankeyDiagram-c3ef121a-BdHUFbke.js → sankeyDiagram-c3ef121a-B7rPgNOw.js} +1 -1
  262. package/dist-embed/chunks/{sequenceDiagram-82a5b84f-BsYsnScA.js → sequenceDiagram-82a5b84f-C_EzuSFh.js} +1 -1
  263. package/dist-embed/chunks/{sequenceDiagram-WJ2MYXX4-C9wu6JeV.js → sequenceDiagram-WJ2MYXX4-CqoMFij0.js} +1 -1
  264. package/dist-embed/chunks/{sequenceDiagram-WJ2MYXX4-BIU2Cbmw.js → sequenceDiagram-WJ2MYXX4-DiB7s_Dn.js} +1 -1
  265. package/dist-embed/chunks/{sequenceDiagram-WJ2MYXX4-tkRuJaD1.js → sequenceDiagram-WJ2MYXX4-f-0nVisj.js} +1 -1
  266. package/dist-embed/chunks/{server-extension-CwZK4t_R.js → server-extension-BjSjt875.js} +1 -1
  267. package/dist-embed/chunks/{sessions-B7ox-mRM.js → sessions-B0EUsrzs.js} +1 -1
  268. package/dist-embed/chunks/{sheet-BRqBiQwD.js → sheet-Do4NLOO5.js} +1 -1
  269. package/dist-embed/chunks/{si-LK-N5RQ5JYF-DFJ2FmYp.js → si-LK-N5RQ5JYF-V5ENer19.js} +1 -1
  270. package/dist-embed/chunks/{sizeCapture-INFHLROL-o5EsXBaa.js → sizeCapture-INFHLROL-Dn38jHtH.js} +1 -1
  271. package/dist-embed/chunks/{sizeCapture-INFHLROL-Cf65oZaf.js → sizeCapture-INFHLROL-_Af6e7vY.js} +1 -1
  272. package/dist-embed/chunks/{sizeCapture-INFHLROL-vFYFzq10.js → sizeCapture-INFHLROL-iClobhK8.js} +1 -1
  273. package/dist-embed/chunks/{sk-SK-C5VTKIMK-8LPB4Lnr.js → sk-SK-C5VTKIMK-CDbew_Lj.js} +1 -1
  274. package/dist-embed/chunks/{sl-SI-NN7IZMDC-B2BOaojE.js → sl-SI-NN7IZMDC-CYGDd2fT.js} +1 -1
  275. package/dist-embed/chunks/{state-CmWU_Gvx.js → state-DOjezY4E.js} +1 -1
  276. package/dist-embed/chunks/{stateDiagram-43e79a5f-BM8vNgoJ.js → stateDiagram-43e79a5f-CGkwABTG.js} +1 -1
  277. package/dist-embed/chunks/{stateDiagram-D77RDMKH-C900iM9W.js → stateDiagram-D77RDMKH-BYf5AFsH.js} +1 -1
  278. package/dist-embed/chunks/{stateDiagram-D77RDMKH-CuPDKatL.js → stateDiagram-D77RDMKH-DL2pkKsX.js} +1 -1
  279. package/dist-embed/chunks/{stateDiagram-D77RDMKH-LWwb-5tB.js → stateDiagram-D77RDMKH-TNAdn7Fw.js} +1 -1
  280. package/dist-embed/chunks/{stateDiagram-v2-2041ed4f-CyS6v5HY.js → stateDiagram-v2-2041ed4f-DOi2jMsy.js} +1 -1
  281. package/dist-embed/chunks/{stateDiagram-v2-MP3YSRHH-B9nNH36K.js → stateDiagram-v2-MP3YSRHH-BcOB4zh_.js} +1 -1
  282. package/dist-embed/chunks/{stateDiagram-v2-MP3YSRHH-D0oidLuM.js → stateDiagram-v2-MP3YSRHH-COkC2cKQ.js} +1 -1
  283. package/dist-embed/chunks/{stateDiagram-v2-MP3YSRHH-CCTFOmE7.js → stateDiagram-v2-MP3YSRHH-Dkn5bUd0.js} +1 -1
  284. package/dist-embed/chunks/{styles-455b33cd-D9VLOwJ1.js → styles-455b33cd-CLktXgUm.js} +1 -1
  285. package/dist-embed/chunks/{styles-f932cba9-Cd5ppA9M.js → styles-f932cba9-BwPvHxRQ.js} +1 -1
  286. package/dist-embed/chunks/{styles-fcc2142b-wYbY1ne5.js → styles-fcc2142b-CAXdEfcj.js} +1 -1
  287. package/dist-embed/chunks/{subset-shared.chunk-BGJYDNE3.js → subset-shared.chunk-C5GbluZS.js} +1 -1
  288. package/dist-embed/chunks/{subset-worker.chunk-DS6Y9CCK.js → subset-worker.chunk-DdgsqZkc.js} +1 -1
  289. package/dist-embed/chunks/{substates-qiB0bt2l.js → substates-DOXz-cie.js} +1 -1
  290. package/dist-embed/chunks/{sv-SE-XGPEYMSR-UPdAYYSP.js → sv-SE-XGPEYMSR-DC1SNPJE.js} +1 -1
  291. package/dist-embed/chunks/{svgDrawCommon-148a3cd9-Fa5fqeh3.js → svgDrawCommon-148a3cd9-CaQ5vpEO.js} +1 -1
  292. package/dist-embed/chunks/{swimlanes-42K2YHIH-BgvIcpoF.js → swimlanes-42K2YHIH-2IxujMpF.js} +1 -1
  293. package/dist-embed/chunks/{swimlanes-42K2YHIH-BBMKjjkW.js → swimlanes-42K2YHIH-BpCz-Rn6.js} +1 -1
  294. package/dist-embed/chunks/{swimlanes-42K2YHIH-Cq7pR56Q.js → swimlanes-42K2YHIH-DU9K-vT0.js} +1 -1
  295. package/dist-embed/chunks/{swimlanesDiagram-VR7AAH4N-wHfu_rwu.js → swimlanesDiagram-VR7AAH4N-BrV6X3P_.js} +1 -1
  296. package/dist-embed/chunks/{swimlanesDiagram-VR7AAH4N-gjt8K12P.js → swimlanesDiagram-VR7AAH4N-DXze4cE-.js} +1 -1
  297. package/dist-embed/chunks/{swimlanesDiagram-VR7AAH4N-BrssO_ZI.js → swimlanesDiagram-VR7AAH4N-wBxLzBji.js} +1 -1
  298. package/dist-embed/chunks/{ta-IN-2NMHFXQM-BA2NukSS.js → ta-IN-2NMHFXQM-DKSKwTtf.js} +1 -1
  299. package/dist-embed/chunks/{th-TH-HPSO5L25-LUayWo7x.js → th-TH-HPSO5L25-Dr1iFJp8.js} +1 -1
  300. package/dist-embed/chunks/{timeline-definition-24CTP7MA-CFvNBz_D.js → timeline-definition-24CTP7MA-BwZDNvPa.js} +1 -1
  301. package/dist-embed/chunks/{timeline-definition-24CTP7MA-Nut54L6A.js → timeline-definition-24CTP7MA-CVfYW-Nc.js} +1 -1
  302. package/dist-embed/chunks/{timeline-definition-24CTP7MA-BKyvL5dI.js → timeline-definition-24CTP7MA-DfMsrwKw.js} +1 -1
  303. package/dist-embed/chunks/{timeline-definition-7545f45a-RSfH6FTC.js → timeline-definition-7545f45a-DWcYkVIi.js} +1 -1
  304. package/dist-embed/chunks/{tr-TR-DEFEU3FU-BwLe2i48.js → tr-TR-DEFEU3FU-A_BYNcri.js} +1 -1
  305. package/dist-embed/chunks/{uk-UA-QMV73CPH-wjLkWFtn.js → uk-UA-QMV73CPH-lmL1fri3.js} +1 -1
  306. package/dist-embed/chunks/{vennDiagram-4TSXK5OY-CfkoE6en.js → vennDiagram-4TSXK5OY-C8_HpFyJ.js} +1 -1
  307. package/dist-embed/chunks/{vennDiagram-4TSXK5OY-iZRiPWDS.js → vennDiagram-4TSXK5OY-CsoLlfBZ.js} +1 -1
  308. package/dist-embed/chunks/{vennDiagram-4TSXK5OY-DcrhwQNy.js → vennDiagram-4TSXK5OY-MUcXUckP.js} +1 -1
  309. package/dist-embed/chunks/{vi-VN-M7AON7JQ-CVJrQXTE.js → vi-VN-M7AON7JQ-mMTEvrN2.js} +1 -1
  310. package/dist-embed/chunks/{wardleyDiagram-VM6X3IG4-C5LGiOpU.js → wardleyDiagram-VM6X3IG4-BKVSHBPg.js} +1 -1
  311. package/dist-embed/chunks/{wardleyDiagram-VM6X3IG4-CZLSTdrG.js → wardleyDiagram-VM6X3IG4-BksuirOR.js} +1 -1
  312. package/dist-embed/chunks/{wardleyDiagram-VM6X3IG4-W6fZ-zLj.js → wardleyDiagram-VM6X3IG4-CoFe_0Hs.js} +1 -1
  313. package/dist-embed/chunks/workbook-sMECd4Jk.js +1 -0
  314. package/dist-embed/chunks/{write-BPEehXmk.js → write-Q_DIQOWJ.js} +1 -1
  315. package/dist-embed/chunks/{xychartDiagram-3f383b91-DgGr7hwA.js → xychartDiagram-3f383b91-BB4yqnEL.js} +1 -1
  316. package/dist-embed/chunks/{xychartDiagram-S5SC5T6Z-DLQ3Wwtq.js → xychartDiagram-S5SC5T6Z-B6-P99h2.js} +1 -1
  317. package/dist-embed/chunks/{xychartDiagram-S5SC5T6Z-BlXuP2jM.js → xychartDiagram-S5SC5T6Z-BLIy7IJR.js} +1 -1
  318. package/dist-embed/chunks/{xychartDiagram-S5SC5T6Z-CsfBzeiF.js → xychartDiagram-S5SC5T6Z-BQlsBmbt.js} +1 -1
  319. package/dist-embed/chunks/{zh-CN-LNUGB5OW-DHFaH2P8.js → zh-CN-LNUGB5OW-DkgLfOH-.js} +1 -1
  320. package/dist-embed/chunks/{zh-HK-E62DVLB3-DKCAFB1q.js → zh-HK-E62DVLB3-bphdQsyC.js} +1 -1
  321. package/dist-embed/chunks/{zh-TW-RAJ6MFWO-D6WATM0Q.js → zh-TW-RAJ6MFWO-f8qOFFzB.js} +1 -1
  322. package/dist-embed/datalayer-app-main.js +32 -31
  323. package/dist-embed/datalayer-app.css +1 -1
  324. package/lib/apps/Application.d.ts +1 -1
  325. package/lib/apps/Application.js +1 -1
  326. package/lib/apps/agentUiPlugins.js +2 -0
  327. package/lib/apps/embed/AppEmbed.d.ts +1 -1
  328. package/lib/apps/embed/visitorApp.d.ts +4 -4
  329. package/lib/apps/embed/visitorApp.js +10 -10
  330. package/lib/apps/plugins/agents/DatalayerAgentBridge.js +1 -1
  331. package/lib/apps/plugins/agents/plugin.d.ts +1 -1
  332. package/lib/apps/plugins/trip-map/TripMapView.d.ts +18 -0
  333. package/lib/apps/plugins/trip-map/TripMapView.js +138 -0
  334. package/lib/apps/plugins/trip-map/index.d.ts +29 -0
  335. package/lib/apps/plugins/trip-map/index.js +75 -0
  336. package/lib/apps/plugins/trip-map/read.d.ts +47 -0
  337. package/lib/apps/plugins/trip-map/read.js +93 -0
  338. package/lib/apps/plugins/trip-map/style.d.ts +46 -0
  339. package/lib/apps/plugins/trip-map/style.js +249 -0
  340. package/lib/apps/presets.d.ts +1 -1
  341. package/lib/portable/hosts/agentClient.d.ts +1 -1
  342. package/lib/portable/hosts/agentClient.js +8 -8
  343. package/lib/portable/hosts/client.d.ts +2 -2
  344. package/lib/portable/hosts/client.js +2 -2
  345. package/lib/portable/hosts/contracts.d.ts +1 -1
  346. package/lib/portable/hosts/contracts.js +1 -1
  347. package/lib/portable/hosts/contracts.json +1 -1
  348. package/lib/specs/actions.js +18 -0
  349. package/lib/specs/agentPresentations.js +1 -1
  350. package/lib/specs/agents/agents.js +10 -4
  351. package/lib/specs/apps.d.ts +1 -1
  352. package/lib/specs/apps.js +35 -17
  353. package/lib/specs/backendTools.d.ts +1 -0
  354. package/lib/specs/backendTools.js +20 -0
  355. package/lib/specs/mcpServers.d.ts +1 -0
  356. package/lib/specs/mcpServers.js +41 -1
  357. package/lib/specs/ui.d.ts +1 -0
  358. package/lib/specs/ui.js +22 -0
  359. package/package.json +3 -1
  360. package/scripts/codegen/generate_mcp_servers.py +3 -1
  361. package/dist-embed/chunks/SpreadsheetPreviewView-BcPYoRJU.js +0 -1
  362. package/dist-embed/chunks/workbook-4v5EV9v6.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as R,j as f,D as Xs,n7 as yr,n8 as bt,J as T,by as W,n9 as br,cL as N,na as Ta,bD as Zt,bG as Sa,dC as vr,gn as Zs,dD as sn,T as be,el as wr,nb as Cr,bC as Te,bA as Re,H as Er,nc as Pa,y as gs,cK as Aa,nd as Ra,kw as kt,ne as Ia,nf as La,ng as Oa,nh as ka,ai as U,aK as kn,eR as Qs,gT as ae,eS as Fa,cu as xt,gU as xr,ni as Da,kj as ei,aQ as se,cy as Tr,nj as zn,nk as Ma,d_ as Sr,nl as Un,kf as $n,nm as Na,gJ as Ie,aN as X,jk as ja,jg as Ti,ji as Ba,jj as Wa,jh as Ha,nn as Va,jm as za,jA as Ua,jo as qe,jp as Ge,no as ti,jq as $a,jr as Pr,np as Ka,js as qa,jF as Ar,jI as un,jJ as zt,jD as ys,nq as Ga,jK as Rr,nr as Ja,jL as Ir,ns as Ya,jO as Lr,jP as bs,jQ as vs,jG as Or,nt as Si,nu as Xa,nv as Za,nw as Qa,nx as el,jH as Pi,ny as Ai,jW as tl,jX as nl,jU as sl,jT as il,nz as rl,j_ as ol,j$ as ws,k0 as al,k1 as Ye,jR as ll,jM as cl,jN as dl,k3 as kr,k4 as Fr,k5 as Dr,nA as ul,k6 as Ri,k7 as rt,k8 as hl,aW as ni,kh as fl,g2 as Mr,aO as Nr,bs as pt,aV as jr,aJ as Ae,aE as ee,v as si,L as Ut,co as ml,k$ as Kn,kk as Cs,nB as tt,dQ as En,cs as pl,cq as jt,I as Es,dF as Qn,bx as Xe,n4 as _l,nC as $t,ef as Br,gw as gl,bt as it,ee as Wr,cn as O,cw as ve,gO as Ii,aG as yl,eg as Qt,nD as bl,aL as Ve,aM as Y,e6 as Hr,cB as je,hj as vl,dT as Vr,e3 as wl,nE as Cl,nF as El,nG as xl,kl as Li,nH as Tl,nI as Sl,nJ as gt,nK as ot,nL as Ze,k as Be,nM as Ee,nN as Pl,nO as ht,nP as Al,nQ as ii,nR as Rl,nS as ri,nT as Il,nU as Ll,nV as Ol,nW as ke,nX as zr,nY as en,nZ as Ur,n_ as Oi,n$ as xs,o0 as Ne,o1 as kl,o2 as Fl,o3 as Dl,o4 as Ml,fy as Nl,lv as we,dZ as oi,gS as jl,fc as ai,aU as Bl,ki as Pe,lu as Wl,lx as $r,hf as Hl,o5 as Ts,o6 as Kr,eq as q,ha as Vl,kP as ki,kN as zl,cA as Ul,fs as qr,kp as $l,eV as Gr,gD as Kl,eK as Fi,eG as Fn,_ as V,aH as ql,eL as es,eM as Gl,o7 as Jr,aS as _e,aR as ft,dM as Yr,cx as Ct,g_ as Jl,ke as Yl,o8 as Xl,o9 as Dn,gM as Kt,ct as Bt,oa as Zl,ob as Ql,e2 as ec,gv as tc,oc as nc,od as sc,dS as ic,aP as rc,eU as oc,cm as ac,cv as Di,oe as lc,of as cc,og as dc,k_ as Xr,U as uc,kY as Zr,hg as hc,g3 as fc,oh as Qr,a6 as mc,lL as pc,cd as ts,lN as _c,lU as gc,lI as yc,lV as bc,c8 as vc,lX as wc,lY as Cc,bY as Mi,oi as eo,b1 as to,oj as Ec,ok as xc,ol as Tc,om as Sc,on as Pc,oo as Ac,op as Rc,oq as Ic,or as Lc,os as Oc,ot as kc,kW as Fc,ou as Dc,ov as Mc,ow as Nc,ox as jc,oy as Bc,oz as Wc,oA as Hc,oB as Vc,b5 as zc,oC as Uc,bS as $c,oD as Kc,oE as qc,kX as Gc,oF as Jc,l0 as Yc,oG as Xc,oH as Zc,oI as Qc,oJ as ed,oK as td,oL as nd,l1 as sd,oM as id,lw as rd,oN as od,oO as ad,oP as ld,oQ as cd,oR as dd,oS as ud,oT as hd,bd as fd,oU as md,oV as pd,oW as _d,oX as gd,oY as yd,oZ as bd,o_ as vd,o$ as wd,p0 as Cd,p1 as Ed,p2 as xd,p3 as Td,p4 as Sd,p5 as Pd,p6 as Ad,p7 as Rd,l4 as Id,Z as Ld,p8 as Od,p9 as kd,pa as Fd,pb as Dd,pc as Md,pd as Nd,pe as jd,pf as Bd,pg as Wd,ph as Hd,pi as Vd,pj as zd,pk as Ud,pl as $d,pm as Kd,pn as qd,po as Gd,pp as Jd,pq as Yd,pr as Xd,ps as Zd,pt as Qd,ly as eu,fd as tu,pu as nu,ls as su,pv as iu,P as ru,m2 as ou,lr as au,lm as lu}from"../datalayer-app-main.js";import{u as Je,C as no,I as cu,b as du,c as uu,d as hu,e as fu,f as mu,g as pu,h as _u,H as gu,K as yu,i as bu,M as vu,O as wu,j as Cu,k as Eu,a as xu,l as Tu,R as Su,m as Pu,n as Au,r as Ru}from"./Output-DbuS5mTW.js";import{e as Iu,D as so,c as Lu,f as Ou,C as io,a as ro,N as oo,g as ku,h as Fu,i as Du,j as Mu,k as Nu,l as ju,r as Bu,u as Wu,m as Hu,w as Vu}from"./CellSidebarExtension-BSomRlJ-.js";import{S as zu,C as Uu,E as $u,N as Ku,a as qu,b as Gu,s as Ju,w as Yu}from"./NotebookSkeleton-KHb2YSpG.js";import{L as Vt,R as ao,M as Xu,c as Zu,b as Qu,S as eh,a as th,W as nh,j as sh,r as ih}from"./index-Bc6gicqV.js";import{C as lo,a as co,W as rh,j as oh,h as ah}from"./index-UMhfKl2p.js";import{F as lh,a as ch,C as dh}from"./FileDirectoryOpenFillIcon-jGhuRcP3.js";import{p as At,e as uh,s as hh,u as fh}from"./url-DhPU-y-U.js";import{q as mh,C as ph,d as _h,l as gh}from"./index-CnpOaqg6.js";/* empty css *//* empty css */import"./style-DdAxk_bj.js";/* empty css */import"./style-Cj1gzCjo.js";/* empty css */import"./style-rkw8dR9f.js";import"./style-GHJFdtIz.js";import"./style-ZSIOeMoX.js";import"./style-iVfD6mFL.js";import"./style-DA-Ya7rp.js";import"./style-D3tvWcFO.js";import"./style-BOqStzF9.js";import"./style-ADLQJ-E9.js";import"./style-DgglluaK.js";import{A as yh}from"./ArrowLeftIcon-sX3iNMG1.js";import{F as bh,a as vh,b as wh,c as Ni,d as Ch,e as Eh,f as xh,g as Th}from"./SkubbleIcon-CAaVh_BE.js";import{N as Pt,u as Sh}from"./usePrimerThemeBridge-DjRvxgar.js";import{B as hn,U as ns}from"./index-BIUfp2AH.js";import{a as Ph,b as Ah,c as Rh,d as Ih,f as Lh,K as Oh,g as kh,P as Fh,e as Dh,h as Mh,i as Nh,j as jh,k as Bh,l as Wh,m as Hh,n as Vh,o as zh,p as Uh,q as $h,r as Kh,s as qh,t as Gh,u as Jh,v as Yh,w as Xh}from"./KernelVariables-oNW3cYs4.js";import"./index-Dlvxer3A.js";import{K as Zh,L as Qh,W as ef,a as tf}from"./renderer-DQzulrO-.js";import{S as nf}from"./SortAscIcon-CmH04s3F.js";import{S as sf}from"./SortDescIcon-Qif6E10I.js";import{b as rf,N as of,a as af,u as lf}from"./NotebookToolbar-C1fpK-Vi.js";import{S as cf,B as df,C as uf,b as hf,K as ff,I as mf,e as pf,a as _f,c as gf}from"./sessions-B7ox-mRM.js";import{B as yf,C as bf,b as vf,a as wf,c as Cf,D as Ef,d as xf,e as Tf,f as Sf,F as Pf,S as Af,g as Rf,h as If,i as Lf}from"./drivecontents-BcDwFJVW.js";import{I as Of,W as kf,F as Ff,a as Df,c as Mf,M as Nf,e as jf,b as Bf,d as Wf}from"./tokens-S2kPhk0a.js";import{B as Hf}from"./kernel-e4A2ECtn.js";var li={ConfirmationHeader:"prc-ConfirmationDialog-ConfirmationHeader-yiLEc",ConfirmationBody:"prc-ConfirmationDialog-ConfirmationBody-ht9P-",ConfirmationFooter:"prc-ConfirmationDialog-ConfirmationFooter-AqKBI"};const uo=({title:s,onClose:e,dialogLabelId:t})=>{const n=R.useCallback(()=>{e("close-button")},[e]);return f.jsxs("div",{className:li.ConfirmationHeader,children:[f.jsx("h1",{id:t,children:s}),f.jsx(Xs.CloseButton,{onClose:n})]})};uo.displayName="ConfirmationHeader";const ho=({children:s})=>f.jsx("div",{className:li.ConfirmationBody,children:s});ho.displayName="ConfirmationBody";const fo=({footerButtons:s})=>{const{containerRef:e}=yr({bindKeys:bt.ArrowHorizontal|bt.Tab,focusInStrategy:"closest"});return f.jsx("div",{ref:e,className:li.ConfirmationFooter,children:f.jsx(Xs.Buttons,{buttons:s??[]})})};fo.displayName="ConfirmationFooter";const ci=s=>{const{onClose:e,title:t,cancelButtonContent:n="Cancel",confirmButtonContent:i="OK",confirmButtonType:r="normal",children:o,className:a,width:l="medium",height:c}=s,d=R.useCallback(()=>{e("cancel")},[e]),u=R.useCallback(()=>{e("confirm")},[e]),h=r==="danger",b=[{content:n,onClick:d,autoFocus:h},{content:i,buttonType:r,onClick:u,autoFocus:!h}];return f.jsx(Xs,{onClose:e,title:t,footerButtons:b,role:"alertdialog",width:l,height:c,className:a,renderHeader:uo,renderBody:ho,renderFooter:fo,children:o})};ci.displayName="ConfirmationDialog";function Vf(s,e,t,n,i){const r={type:"PREV",num:e-1,disabled:e===1},o={type:"NEXT",num:e+1,disabled:e===s};if(!t)return[r,o];if(s<=0)return[r,{...o,disabled:!0}];const a=[],l=i+n,c=l+l+3;if(s<=c)return p(1,s,!1),[r,...a,o];let d=0,u=0;e-l-1<=1?u=e-l-2:d=e-l-1;let h=0,m=0;s-e-l<=1?m=s-e-l-1:h=s-e-l;const _=d>0,b=h>0;return p(1,n,_),_&&g(n),p(n+d+m+1,s-u-h-n,b),b&&g(s-u-h-n),p(s-n+1,s),[r,...a,o];function g(w){a.push({type:"BREAK",num:w+1})}function p(w,v,y=!1){for(let C=w;C<=v;C++)a.push({type:"NUM",num:C,selected:C===e,precedesBreak:C===v&&y})}}var he={TreeViewRootUlStyles:"prc-TreeView-TreeViewRootUlStyles-eZtxW",TreeViewItem:"prc-TreeView-TreeViewItem-ShJr0",TreeViewItemContainer:"prc-TreeView-TreeViewItemContainer--2Rkn",TreeViewItemSkeleton:"prc-TreeView-TreeViewItemSkeleton-fqk59",TreeViewItemToggle:"prc-TreeView-TreeViewItemToggle-gWUdE",TreeViewItemToggleHover:"prc-TreeView-TreeViewItemToggleHover-nEgP-",TreeViewItemToggleEnd:"prc-TreeView-TreeViewItemToggleEnd-t-AEB",TreeViewItemContent:"prc-TreeView-TreeViewItemContent-f0r0b",TreeViewItemContentText:"prc-TreeView-TreeViewItemContentText-smZM-",TreeViewItemVisual:"prc-TreeView-TreeViewItemVisual-dRlGq",TreeViewItemLeadingAction:"prc-TreeView-TreeViewItemLeadingAction-VXx8I",TreeViewItemLevelLine:"prc-TreeView-TreeViewItemLevelLine-KPSSL",TreeViewDirectoryIcon:"prc-TreeView-TreeViewDirectoryIcon-PHbeP",TreeViewVisuallyHidden:"prc-TreeView-TreeViewVisuallyHidden-4-mPv",TreeViewSkeletonItemContainerStyle:"prc-TreeView-TreeViewSkeletonItemContainerStyle-EB7p0",TreeItemSkeletonTextStyles:"prc-TreeView-TreeItemSkeletonTextStyles-wnBY9"};function zf({name:s="custom",defaultValue:e,value:t,onChange:n}){const[i,r]=T.useState(t??e),o=T.useRef(null),a=T.useRef(n);T.useEffect(()=>{a.current=n}),o.current===null&&(o.current=t!==void 0);const l=T.useCallback(c=>{var d;const u=typeof c=="function"?c(i):c;o.current===!1&&r(u),(d=a.current)===null||d===void 0||d.call(a,u)},[i]);return T.useEffect(()=>{const c=t!==void 0;o.current,o.current},[s,t]),o.current===!0?[t,l]:[i,l]}function xn(s){var e,t,n;const i=s.getAttribute("aria-label"),r=s.getAttribute("aria-labelledby");return i||(r?(e=(t=document.getElementById(r))===null||t===void 0?void 0:t.textContent)!==null&&e!==void 0?e:"":(n=s.textContent)!==null&&n!==void 0?n:"")}function mo(s){return!s||s===document.body?null:Uf(s)?s:mo(s.parentElement)}function Uf(s){return s.scrollHeight>s.clientHeight&&window.getComputedStyle(s).overflowY.indexOf("hidden")===-1}function $f(s){const e=W.c(6),{containerRef:t,mouseDownRef:n}=s;let i;e[0]!==t||e[1]!==n?(i=()=>{var o,a,l;if(n.current)return;const c=(o=t.current)===null||o===void 0?void 0:o.querySelector("[aria-current]"),d=(a=t.current)===null||a===void 0?void 0:a.querySelector('[role="treeitem"]');return c instanceof HTMLElement?c:document.activeElement instanceof HTMLElement&&(l=t.current)!==null&&l!==void 0&&l.contains(document.activeElement)&&document.activeElement.getAttribute("role")==="treeitem"?document.activeElement:d instanceof HTMLElement?d:void 0},e[0]=t,e[1]=n,e[2]=i):i=e[2];let r;e[3]!==t||e[4]!==i?(r={containerRef:t,bindKeys:bt.ArrowVertical|bt.ArrowHorizontal|bt.HomeAndEnd|bt.Backspace|bt.PageUpDown,preventScroll:!0,getNextFocusable:Kf,focusInStrategy:i},e[3]=t,e[4]=i,e[5]=r):r=e[5],yr(r)}function Kf(s,e,t){var n;if(e instanceof HTMLElement){try{if(e.closest("dialog:modal"))return}catch{}return(n=qf(e,t))!==null&&n!==void 0?n:e}}function qf(s,e){switch(`${Gf(s)} ${e.key}`){case"open ArrowRight":return po(s);case"open ArrowLeft":return;case"closed ArrowRight":return;case"closed ArrowLeft":return ss(s);case"end ArrowRight":return;case"end ArrowLeft":return ss(s)}switch(e.key){case"ArrowUp":return ji(s,"previous");case"ArrowDown":return ji(s,"next");case"Backspace":return ss(s);case"Home":return Jf(s);case"End":return Yf(s);case"PageUp":return Qf(s);case"PageDown":return Zf(s)}}function Gf(s){if(s.getAttribute("role")!=="treeitem")throw new Error("Element is not a treeitem");switch(s.getAttribute("aria-expanded")){case"true":return"open";case"false":return"closed";default:return"end"}}function ji(s,e){const t=s.closest("[role=tree]");if(!t)return;const n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,a=>a instanceof HTMLElement&&a.getAttribute("role")==="treeitem"?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP);let i=n.firstChild();for(;i!==s;)i=n.nextNode();let r=e==="next"?n.nextNode():n.previousNode();for(;r instanceof HTMLElement&&(o=r.parentElement)!==null&&o!==void 0&&o.closest("[role=treeitem][aria-expanded=false]");){var o;r=e==="next"?n.nextNode():n.previousNode()}return r instanceof HTMLElement?r:void 0}function po(s){const e=s.querySelector("[role=treeitem]");return e instanceof HTMLElement?e:void 0}function ss(s){const e=s.closest("[role=group]"),t=e?.closest("[role=treeitem]");return t instanceof HTMLElement?t:void 0}function Jf(s){const e=s.closest("[role=tree]"),t=e?.querySelector("[role=treeitem]");return t instanceof HTMLElement?t:void 0}function Yf(s){const e=s.closest("[role=tree]"),t=Array.from(e?.querySelectorAll("[role=treeitem]")||[]);if(t.length===0)return;let n=t.length-1,i=t[n];for(;n>0&&i instanceof HTMLElement&&(r=i.parentElement)!==null&&r!==void 0&&r.closest("[role=treeitem][aria-expanded=false]");){var r;n-=1,i=t[n]}return i instanceof HTMLElement?i:void 0}const Xf={height:32};function _o(s,e){var t,n;const i=mo(s),{height:r}=(t=e?.getBoundingClientRect())!==null&&t!==void 0?t:Xf,o=(n=i?.clientHeight)!==null&&n!==void 0?n:window.innerHeight;return Math.floor(o/r)}function Zf(s){const e=s.closest('[role="tree"]');if(!e)return;const t=Array.from(e.querySelectorAll('[role="treeitem"]'));if(t.length===0)return;const n=t[0].firstElementChild,i=_o(e,n),r=Math.floor(t.indexOf(s)/i),o=t.indexOf(s)-i*r;return t[Math.min(t.length-1,(r+1)*i+o)]}function Qf(s){const e=s.closest('[role="tree"]');if(!e)return;const t=Array.from(e.querySelectorAll('[role="treeitem"]'));if(t.length===0)return;const n=t[0].firstElementChild,i=_o(e,n),r=Math.floor(t.indexOf(s)/i),o=t.indexOf(s)-i*r;return t[Math.max(0,(r-1)*i+o)]}function em(s){const e=W.c(11),{containerRef:t,onFocusChange:n}=s,i=T.useRef(""),r=T.useRef(0),o=T.useRef(n),{safeSetTimeout:a,safeClearTimeout:l}=br();let c,d;e[0]!==n?(c=()=>{o.current=n},d=[n],e[0]=n,e[1]=c,e[2]=d):(c=e[1],d=e[2]),T.useEffect(c,d);let u;e[3]!==t?(u=b=>{if(!b||!t.current)return;const g=t.current,p=Array.from(g.querySelectorAll('[role="treeitem"]')),w=p.findIndex(tm);let v=nm(p,w);b.length===1&&(v=v.slice(1));const y=v.find(C=>xn(C).toLowerCase().startsWith(b.toLowerCase()));y&&o.current(y)},e[3]=t,e[4]=u):u=e[4];const h=u;let m,_;e[5]!==t||e[6]!==h||e[7]!==l||e[8]!==a?(m=()=>{if(!t.current)return;const b=t.current,g=function(w){!w.key||w.key.length>1||w.key===" "||w.ctrlKey||w.altKey||w.metaKey||(i.current=i.current+w.key,h(i.current),l(r.current),r.current=a(()=>i.current="",300),w.preventDefault(),w.stopPropagation())};return b.addEventListener("keydown",g),()=>b.removeEventListener("keydown",g)},_=[t,h,l,a],e[5]=t,e[6]=h,e[7]=l,e[8]=a,e[9]=m,e[10]=_):(m=e[9],_=e[10]),T.useEffect(m,_)}function tm(s){return s===document.activeElement}function nm(s,e){return s.map((t,n)=>s[(e+n)%s.length])}const di=T.createContext({announceUpdate:()=>{},expandedStateCache:{current:new Map}}),_t=T.createContext({itemId:"",level:1,isSubTreeEmpty:!1,setIsSubTreeEmpty:()=>{},isExpanded:!1,setIsExpanded:()=>{},leadingVisualId:"",trailingVisualId:""}),Bi=12,go=s=>{const e=W.c(23),{"aria-label":t,"aria-labelledby":n,children:i,flat:r,truncate:o,className:a,style:l}=s,c=o===void 0?!0:o,d=T.useRef(null),u=T.useRef(!1),[h,m]=T.useState("");let _;e[0]===Symbol.for("react.memo_cache_sentinel")?(_=j=>{m(j)},e[0]=_):_=e[0];const b=_;let g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{u.current=!0},e[1]=g):g=e[1];const p=g;let w,v;e[2]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{const j=function(){u.current=!1};return document.addEventListener("mouseup",j),()=>{document.removeEventListener("mouseup",j)}},v=[],e[2]=w,e[3]=v):(w=e[2],v=e[3]),R.useEffect(w,v);let y;e[4]===Symbol.for("react.memo_cache_sentinel")?(y={containerRef:d,mouseDownRef:u},e[4]=y):y=e[4],$f(y);let C;e[5]===Symbol.for("react.memo_cache_sentinel")?(C={containerRef:d,onFocusChange:hm},e[5]=C):C=e[5],em(C);const E=T.useRef(null);if(E.current===null){let j;e[6]===Symbol.for("react.memo_cache_sentinel")?(j=new Map,e[6]=j):j=e[6],E.current=j}let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x={announceUpdate:b,expandedStateCache:E},e[7]=x):x=e[7];let S;e[8]!==h?(S=f.jsx(Zs,{role:"status","aria-live":"polite","aria-atomic":"true",children:h}),e[8]=h,e[9]=S):S=e[9];const A=c||!1;let I;e[10]!==a?(I=N(a,he.TreeViewRootUlStyles),e[10]=a,e[11]=I):I=e[11];let P;e[12]!==t||e[13]!==n||e[14]!==i||e[15]!==r||e[16]!==l||e[17]!==A||e[18]!==I?(P=f.jsx("ul",{ref:d,role:"tree","aria-label":t,"aria-labelledby":n,"data-omit-spacer":r,"data-truncate-text":A,onMouseDown:p,className:I,style:l,children:i}),e[12]=t,e[13]=n,e[14]=i,e[15]=r,e[16]=l,e[17]=A,e[18]=I,e[19]=P):P=e[19];let M;return e[20]!==P||e[21]!==S?(M=f.jsx(di.Provider,{value:x,children:f.jsxs(f.Fragment,{children:[S,P]})}),e[20]=P,e[21]=S,e[22]=M):M=e[22],M};go.displayName="TreeView";const rn=T.forwardRef(({id:s,containIntrinsicSize:e,current:t=!1,defaultExpanded:n,expanded:i,onExpandedChange:r,onSelect:o,children:a,className:l,"aria-label":c,"aria-labelledby":d},u)=>{const[h,m]=Ta(a,{leadingAction:hi,leadingVisual:Gn,trailingVisual:ui}),{expandedStateCache:_}=T.useContext(di),b=Zt(),g=Zt(),p=Zt(),[w,v]=zf({name:s,defaultValue:()=>{var L,D,z;return(L=(D=(z=_.current)===null||z===void 0?void 0:z.get(s))!==null&&D!==void 0?D:n)!==null&&L!==void 0?L:t},value:i===null?!1:i,onChange:r}),{level:y}=T.useContext(_t),{hasSubTree:C,subTree:E,childrenWithoutSubTree:x}=lm(m),[S,A]=T.useState(!C),[I,P]=T.useState(!1),M=T.useCallback(L=>{var D;v(L),(D=_.current)===null||D===void 0||D.set(s,L)},[s,v,_]),j=T.useCallback(L=>{M(!w),L?.stopPropagation()},[w,M]),H=T.useCallback(L=>{switch(L.key){case"Enter":case" ":o?o(L):j(L),L.stopPropagation();break;case"ArrowRight":if(L.altKey||L.metaKey)return;L.preventDefault(),L.stopPropagation(),M(!0);break;case"ArrowLeft":if(L.altKey||L.metaKey)return;L.preventDefault(),L.stopPropagation(),M(!1);break}},[o,M,j]),$=[h.leadingVisual?g:null,h.trailingVisual?p:null].filter(Boolean);return f.jsx(_t.Provider,{value:{itemId:s,level:y+1,isSubTreeEmpty:S,setIsSubTreeEmpty:A,isExpanded:w,setIsExpanded:M,leadingVisualId:g,trailingVisualId:p},children:f.jsxs("li",{className:N("PRIVATE_TreeView-item",l,he.TreeViewItem),ref:u,tabIndex:0,id:s,role:"treeitem","aria-label":c,"aria-labelledby":c?void 0:d||b,"aria-describedby":$.length?$.join(" "):void 0,"aria-level":y,"aria-expanded":S&&(!w||!C)||i===null?void 0:w,"aria-current":t?"true":void 0,"aria-selected":I?"true":"false","data-has-leading-action":h.leadingAction?!0:void 0,onKeyDown:H,onFocus:L=>{var D;(D=L.currentTarget.firstElementChild)===null||D===void 0||D.scrollIntoView({block:"nearest",inline:"nearest"}),P(!0),L.stopPropagation()},onBlur:()=>P(!1),onClick:L=>{o?o(L):j(L),L.stopPropagation()},onAuxClick:L=>{o&&L.button===1&&o(L),L.stopPropagation()},children:[f.jsxs("div",{className:N("PRIVATE_TreeView-item-container",he.TreeViewItemContainer),style:{"--level":y,contentVisibility:e?"auto":void 0,containIntrinsicSize:e},children:[f.jsx("div",{style:{gridArea:"spacer",display:"flex"},children:f.jsx(sm,{level:y})}),h.leadingAction,C?f.jsx("div",{className:N("PRIVATE_TreeView-item-toggle",o&&"PRIVATE_TreeView-item-toggle--hover",y===1&&"PRIVATE_TreeView-item-toggle--end",he.TreeViewItemToggle,he.TreeViewItemToggleHover,he.TreeViewItemToggleEnd),onClick:L=>{o&&j(L)},children:w?f.jsx(Sa,{size:Bi}):f.jsx(vr,{size:Bi})}):null,f.jsxs("div",{id:b,className:N("PRIVATE_TreeView-item-content",he.TreeViewItemContent),children:[h.leadingVisual,f.jsx("span",{className:N("PRIVATE_TreeView-item-content-text",he.TreeViewItemContentText),children:x}),h.trailingVisual]})]}),E]})})}),sm=s=>{const e=W.c(3),{level:t}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={width:"100%",display:"flex"},e[0]=n):n=e[0];let i;return e[1]!==t?(i=f.jsx("div",{style:n,children:Array.from({length:t-1}).map(bo)}),e[1]=t,e[2]=i):i=e[2],i};rn.displayName="TreeView.Item";const qn=s=>{const e=W.c(29),{count:t,state:n,children:i,"aria-label":r}=s,{announceUpdate:o}=T.useContext(di),{itemId:a,isExpanded:l,isSubTreeEmpty:c,setIsSubTreeEmpty:d}=T.useContext(_t),u=T.useRef(null),h=T.useRef(null),[m,_]=T.useState(!1),[b,g]=T.useState(""),p=im(n),{safeSetTimeout:w}=br();let v,y;e[0]!==i||e[1]!==c||e[2]!==d||e[3]!==n?(v=()=>{(n===void 0||n==="done")&&(!c&&!i?d(!0):c&&i&&d(!1))},y=[n,c,d,i],e[0]=i,e[1]=c,e[2]=d,e[3]=n,e[4]=v,e[5]=y):(v=e[4],y=e[5]),T.useEffect(v,y);let C,E;e[6]!==o||e[7]!==a||e[8]!==m||e[9]!==p||e[10]!==w||e[11]!==n?(C=()=>{const H=document.getElementById(a);if(H){if(g(xn(H)),p==="loading"&&n==="done"){var $;const L=xn(H);if(($=h.current)!==null&&$!==void 0&&$.childElementCount?o(`${L} content loaded`):o(`${L} is empty`),m){const D=po(H);w(D?()=>{D.focus()}:()=>{H.focus()}),_(!1)}}else if(n==="loading"){const L=xn(H);o(`${L} content loading`)}}},E=[m,p,n,a,o,h,w],e[6]=o,e[7]=a,e[8]=m,e[9]=p,e[10]=w,e[11]=n,e[12]=C,e[13]=E):(C=e[12],E=e[13]),T.useEffect(C,E);let x;e[14]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{const H=function(){_(!0)},$=function(z){z.relatedTarget&&_(!1)},L=u.current;if(L)return L.addEventListener("focus",H),L.addEventListener("blur",$),()=>{L.removeEventListener("focus",H),L.removeEventListener("blur",$)}},e[14]=x):x=e[14];let S;if(e[15]!==n?(S=[u,n],e[15]=n,e[16]=S):S=e[16],T.useEffect(x,S),!l)return null;let A;e[17]===Symbol.for("react.memo_cache_sentinel")?(A={listStyle:"none",padding:0,margin:0},e[17]=A):A=e[17];const I=r||b;let P;e[18]!==i||e[19]!==t||e[20]!==n?(P=n==="loading"?f.jsx(om,{ref:u,count:t}):i,e[18]=i,e[19]=t,e[20]=n,e[21]=P):P=e[21];let M;e[22]!==c||e[23]!==n?(M=c&&n!=="loading"?f.jsx(am,{}):null,e[22]=c,e[23]=n,e[24]=M):M=e[24];let j;return e[25]!==M||e[26]!==I||e[27]!==P?(j=f.jsxs("ul",{role:"group",style:A,ref:h,"aria-label":I,children:[P,M]}),e[25]=M,e[26]=I,e[27]=P,e[28]=j):j=e[28],j};qn.displayName="TreeView.SubTree";function im(s){const e=T.useRef(s);return T.useEffect(()=>{e.current=s},[s]),e.current}const rm=()=>{const s=W.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=f.jsxs("span",{className:N(he.TreeViewSkeletonItemContainerStyle,he.TreeViewItemSkeleton,"PRIVATE_TreeView-item-skeleton"),children:[f.jsx(zu,{size:16,square:!0}),f.jsx(wr,{className:he.TreeItemSkeletonTextStyles})]}),s[0]=e):e=s[0],e},om=T.forwardRef((s,e)=>{const t=W.c(15),{count:n}=s,i=Zt();if(n){let l;t[0]!==n?(l=Array.from({length:n}).map(vo),t[0]=n,t[1]=l):l=t[1];let c;t[2]===Symbol.for("react.memo_cache_sentinel")?(c=N("PRIVATE_VisuallyHidden",he.TreeViewVisuallyHidden),t[2]=c):c=t[2];let d;t[3]!==n?(d=f.jsxs("div",{className:c,children:["Loading ",n," items"]}),t[3]=n,t[4]=d):d=t[4];let u;return t[5]!==i||t[6]!==e||t[7]!==l||t[8]!==d?(u=f.jsxs(rn,{id:i,ref:e,children:[l,d]}),t[5]=i,t[6]=e,t[7]=l,t[8]=d,t[9]=u):u=t[9],u}let r,o;t[10]===Symbol.for("react.memo_cache_sentinel")?(r=f.jsx(Gn,{children:f.jsx(sn,{size:"small"})}),o=f.jsx(be,{className:"fgColor-muted",children:"Loading..."}),t[10]=r,t[11]=o):(r=t[10],o=t[11]);let a;return t[12]!==i||t[13]!==e?(a=f.jsxs(rn,{id:i,ref:e,children:[r,o]}),t[12]=i,t[13]=e,t[14]=a):a=t[14],a}),am=T.forwardRef((s,e)=>{const t=W.c(4),n=Zt();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=f.jsx(be,{className:"fgColor-muted",children:"No items found"}),t[0]=i):i=t[0];let r;return t[1]!==e||t[2]!==n?(r=f.jsx(rn,{expanded:null,id:n,ref:e,children:i}),t[1]=e,t[2]=n,t[3]=r):r=t[3],r});function lm(s){const e=W.c(8);let t,n;e[0]!==s?(n=T.Children.toArray(s).find(dm),e[0]=s,e[1]=n):n=e[1];const i=n;let r;e[2]!==s?(r=T.Children.toArray(s).filter(cm),e[2]=s,e[3]=r):r=e[3];const o=r,a=!!i;let l;return e[4]!==o||e[5]!==i||e[6]!==a?(l={subTree:i,childrenWithoutSubTree:o,hasSubTree:a},e[4]=o,e[5]=i,e[6]=a,e[7]=l):l=e[7],t=l,t}function cm(s){return!(T.isValidElement(s)&&s.type===qn)}function dm(s){return T.isValidElement(s)&&s.type===qn}const Gn=s=>{const e=W.c(13),{isExpanded:t,leadingVisualId:n}=T.useContext(_t);let i;e[0]!==t||e[1]!==s.children?(i=typeof s.children=="function"?s.children({isExpanded:t}):s.children,e[0]=t,e[1]=s.children,e[2]=i):i=e[2];const r=i;let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=N("PRIVATE_VisuallyHidden",he.TreeViewVisuallyHidden),e[3]=o):o=e[3];let a;e[4]!==n||e[5]!==s.label?(a=f.jsx("div",{className:o,"aria-hidden":!0,id:n,children:s.label}),e[4]=n,e[5]=s.label,e[6]=a):a=e[6];let l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l=N("PRIVATE_TreeView-item-visual",he.TreeViewItemVisual),e[7]=l):l=e[7];let c;e[8]!==r?(c=f.jsx("div",{className:l,"aria-hidden":!0,children:r}),e[8]=r,e[9]=c):c=e[9];let d;return e[10]!==a||e[11]!==c?(d=f.jsxs(f.Fragment,{children:[a,c]}),e[10]=a,e[11]=c,e[12]=d):d=e[12],d};Gn.displayName="TreeView.LeadingVisual";const ui=s=>{const e=W.c(13),{isExpanded:t,trailingVisualId:n}=T.useContext(_t);let i;e[0]!==t||e[1]!==s.children?(i=typeof s.children=="function"?s.children({isExpanded:t}):s.children,e[0]=t,e[1]=s.children,e[2]=i):i=e[2];const r=i;let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=N("PRIVATE_VisuallyHidden",he.TreeViewVisuallyHidden),e[3]=o):o=e[3];let a;e[4]!==s.label||e[5]!==n?(a=f.jsx("div",{className:o,"aria-hidden":!0,id:n,children:s.label}),e[4]=s.label,e[5]=n,e[6]=a):a=e[6];let l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l=N("PRIVATE_TreeView-item-visual",he.TreeViewItemVisual),e[7]=l):l=e[7];let c;e[8]!==r?(c=f.jsx("div",{className:l,"aria-hidden":!0,children:r}),e[8]=r,e[9]=c):c=e[9];let d;return e[10]!==a||e[11]!==c?(d=f.jsxs(f.Fragment,{children:[a,c]}),e[10]=a,e[11]=c,e[12]=d):d=e[12],d};ui.displayName="TreeView.TrailingVisual";const hi=s=>{const e=W.c(12),{isExpanded:t}=T.useContext(_t);let n;e[0]!==t||e[1]!==s.children?(n=typeof s.children=="function"?s.children({isExpanded:t}):s.children,e[0]=t,e[1]=s.children,e[2]=n):n=e[2];const i=n;let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=N("PRIVATE_VisuallyHidden",he.TreeViewVisuallyHidden),e[3]=r):r=e[3];let o;e[4]!==s.label?(o=f.jsx("div",{className:r,"aria-hidden":!0,children:s.label}),e[4]=s.label,e[5]=o):o=e[5];let a;e[6]===Symbol.for("react.memo_cache_sentinel")?(a=N("PRIVATE_TreeView-item-leading-action",he.TreeViewItemLeadingAction),e[6]=a):a=e[6];let l;e[7]!==i?(l=f.jsx("div",{className:a,"aria-hidden":!0,children:i}),e[7]=i,e[8]=l):l=e[8];let c;return e[9]!==o||e[10]!==l?(c=f.jsxs(f.Fragment,{children:[o,l]}),e[9]=o,e[10]=l,e[11]=c):c=e[11],c};hi.displayName="TreeView.LeadingAction";const um=()=>{const s=W.c(3),{isExpanded:e}=T.useContext(_t),t=e?lh:ch;let n;s[0]===Symbol.for("react.memo_cache_sentinel")?(n=N("PRIVATE_TreeView-directory-icon",he.TreeViewDirectoryIcon),s[0]=n):n=s[0];let i;return s[1]!==t?(i=f.jsx("div",{className:n,children:f.jsx(t,{})}),s[1]=t,s[2]=i):i=s[2],i},yo=s=>{const e=W.c(9),{title:t,children:n,onRetry:i,onDismiss:r}=s,o=t===void 0?"Error":t,{itemId:a,setIsExpanded:l}=T.useContext(_t);let c;e[0]!==a||e[1]!==r||e[2]!==i||e[3]!==l?(c=u=>{setTimeout(()=>{const h=document.getElementById(a);h?.focus()}),u==="confirm"?i?.():(l(!1),r?.())},e[0]=a,e[1]=r,e[2]=i,e[3]=l,e[4]=c):c=e[4];let d;return e[5]!==n||e[6]!==c||e[7]!==o?(d=f.jsx("div",{onKeyDown:fm,children:f.jsx(ci,{title:o,onClose:c,confirmButtonContent:"Retry",cancelButtonContent:"Dismiss",children:n})}),e[5]=n,e[6]=c,e[7]=o,e[8]=d):d=e[8],d};yo.displayName="TreeView.ErrorDialog";const Qe=Object.assign(go,{Item:rn,SubTree:qn,LeadingAction:hi,LeadingVisual:Gn,TrailingVisual:ui,DirectoryIcon:um,ErrorDialog:yo});function hm(s){s instanceof HTMLElement&&s.focus()}function bo(s,e){return f.jsx("div",{className:N("PRIVATE_TreeView-item-level-line",he.TreeViewItemLevelLine)},e)}bo.displayName="_temp2";function vo(s,e){return f.jsx(rm,{"aria-hidden":!0},e)}vo.displayName="_temp3";function fm(s){["Backspace","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Enter"].includes(s.key)&&s.stopPropagation()}function mm(s){if("narrow"in s&&"regular"in s&&"wide"in s){const e=Object.values(s);return e.every(t=>t===e[0])}return!1}function pm(s){return"regular"in s&&"wide"in s?s.regular===s.wide:!1}var Se={PageHeader:"prc-PageHeader-PageHeader-sT1Hp",ContextArea:"prc-PageHeader-ContextArea-6ykSJ",ParentLink:"prc-PageHeader-ParentLink-BvDS0",ContextBar:"prc-PageHeader-ContextBar-XQ8Q0",ContextAreaActions:"prc-PageHeader-ContextAreaActions-RTJRk",TitleArea:"prc-PageHeader-TitleArea-jxJZy",LeadingAction:"prc-PageHeader-LeadingAction-88LQ0",Breadcrumbs:"prc-PageHeader-Breadcrumbs-3c6ig",LeadingVisual:"prc-PageHeader-LeadingVisual-7zjCx",Title:"prc-PageHeader-Title-LKOsd",TrailingVisual:"prc-PageHeader-TrailingVisual-7Ft0D",TrailingAction:"prc-PageHeader-TrailingAction-QOaow",Actions:"prc-PageHeader-Actions-ygtmj",Description:"prc-PageHeader-Description-kFg8r",Navigation:"prc-PageHeader-Navigation-9Uvch"};const Jn={narrow:!1,regular:!0,wide:!0},wo={narrow:!0,regular:!1,wide:!1},_m=T.forwardRef((s,e)=>{const t=W.c(15),{children:n,className:i,sx:r,as:o,"aria-label":a,role:l,hasBorder:c}=s,d=r===void 0?Te:r,u=o===void 0?"div":o,h=Cr(e);let m,_;t[0]!==n||t[1]!==h?(m=function(){},_=[n,h],t[0]=n,t[1]=h,t[2]=m,t[3]=_):(m=t[2],_=t[3]),R.useEffect(m,_);let b;t[4]!==i?(b=N(Se.PageHeader,i),t[4]=i,t[5]=b):b=t[5];const g=c?"true":void 0;let p;return t[6]!==a||t[7]!==u||t[8]!==n||t[9]!==l||t[10]!==h||t[11]!==d||t[12]!==b||t[13]!==g?(p=f.jsx(Re,{as:u,ref:h,className:b,"data-has-border":g,sx:d,"aria-label":a,role:l,children:n}),t[6]=a,t[7]=u,t[8]=n,t[9]=l,t[10]=h,t[11]=d,t[12]=b,t[13]=g,t[14]=p):p=t[14],p}),gm=s=>{const e=W.c(9),{children:t,className:n,hidden:i,sx:r}=s,o=i===void 0?Jn:i,a=r===void 0?Te:r;let l;e[0]!==n?(l=N(Se.ContextArea,n),e[0]=n,e[1]=l):l=e[1];let c;e[2]!==o?(c=xe(o),e[2]=o,e[3]=c):c=e[3];let d;return e[4]!==t||e[5]!==a||e[6]!==l||e[7]!==c?(d=f.jsx(Re,{className:l,sx:a,...c,children:t}),e[4]=t,e[5]=a,e[6]=l,e[7]=c,e[8]=d):d=e[8],d},Co=T.forwardRef((s,e)=>{const t=W.c(16),{children:n,className:i,sx:r,href:o,"aria-label":a,as:l,hidden:c}=s,d=r===void 0?Te:r,u=l===void 0?"a":l,h=c===void 0?Jn:c;let m;t[0]!==i?(m=N(Se.ParentLink,i),t[0]=i,t[1]=m):m=t[1];let _;t[2]!==h?(_=xe(h),t[2]=h,t[3]=_):_=t[3];let b;t[4]===Symbol.for("react.memo_cache_sentinel")?(b=f.jsx(yh,{}),t[4]=b):b=t[4];let g;t[5]!==n?(g=f.jsx("div",{children:n}),t[5]=n,t[6]=g):g=t[6];let p;return t[7]!==a||t[8]!==u||t[9]!==o||t[10]!==e||t[11]!==d||t[12]!==m||t[13]!==_||t[14]!==g?(p=f.jsx(f.Fragment,{children:f.jsxs(gs,{ref:e,as:u,"aria-label":a,muted:!0,className:m,sx:d,..._,href:o,children:[b,g]})}),t[7]=a,t[8]=u,t[9]=o,t[10]=e,t[11]=d,t[12]=m,t[13]=_,t[14]=g,t[15]=p):p=t[15],p});Co.displayName="ParentLink";const ym=s=>{const e=W.c(9),{children:t,className:n,sx:i,hidden:r}=s,o=i===void 0?Te:i,a=r===void 0?Jn:r;let l;e[0]!==n?(l=N(Se.ContextBar,n),e[0]=n,e[1]=l):l=e[1];let c;e[2]!==a?(c=xe(a),e[2]=a,e[3]=c):c=e[3];let d;return e[4]!==t||e[5]!==o||e[6]!==l||e[7]!==c?(d=f.jsx(Re,{className:l,sx:o,...c,children:t}),e[4]=t,e[5]=o,e[6]=l,e[7]=c,e[8]=d):d=e[8],d},bm=s=>{const e=W.c(12),{children:t,className:n,sx:i,hidden:r}=s,o=i===void 0?Te:i,a=r===void 0?Jn:r;let l;e[0]!==n?(l=N(Se.ContextAreaActions,n),e[0]=n,e[1]=l):l=e[1];let c;e[2]!==a?(c=xe(a),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==a?(d=xe(a),e[4]=a,e[5]=d):d=e[5];let u;return e[6]!==t||e[7]!==o||e[8]!==l||e[9]!==c||e[10]!==d?(u=f.jsx(Re,{className:l,...c,sx:o,...d,children:t}),e[6]=t,e[7]=o,e[8]=l,e[9]=c,e[10]=d,e[11]=u):u=e[11],u},Eo=T.forwardRef((s,e)=>{const t=W.c(11),{children:n,className:i,sx:r,hidden:o,variant:a}=s,l=r===void 0?Te:r,c=o===void 0?!1:o,d=a===void 0?"medium":a,u=Cr(e),h=Pa(d,"medium");let m;t[0]!==i?(m=N(Se.TitleArea,i),t[0]=i,t[1]=m):m=t[1];let _;t[2]!==c?(_=xe(c),t[2]=c,t[3]=_):_=t[3];let b;return t[4]!==n||t[5]!==h||t[6]!==l||t[7]!==m||t[8]!==_||t[9]!==u?(b=f.jsx(Re,{className:m,ref:u,"data-component":"TitleArea","data-size-variant":h,sx:l,..._,children:n}),t[4]=n,t[5]=h,t[6]=l,t[7]=m,t[8]=_,t[9]=u,t[10]=b):b=t[10],b});Eo.displayName="TitleArea";const vm=s=>{const e=W.c(12),{children:t,className:n,sx:i,hidden:r}=s,o=i===void 0?Te:i,a=r===void 0?wo:r;let l;if(e[0]!==o){l={};const{height:h}=o;h&&(l["--custom-height"]=h),e[0]=o,e[1]=l}else l=e[1];let c;e[2]!==n?(c=N(Se.LeadingAction,n),e[2]=n,e[3]=c):c=e[3];let d;e[4]!==a?(d=xe(a),e[4]=a,e[5]=d):d=e[5];let u;return e[6]!==t||e[7]!==l||e[8]!==o||e[9]!==c||e[10]!==d?(u=f.jsx(Re,{className:c,"data-component":"PH_LeadingAction",sx:o,style:l,...d,children:t}),e[6]=t,e[7]=l,e[8]=o,e[9]=c,e[10]=d,e[11]=u):u=e[11],u},wm=s=>{const e=W.c(9),{children:t,className:n,sx:i,hidden:r}=s,o=i===void 0?Te:i,a=r===void 0?!1:r;let l;e[0]!==n?(l=N(Se.Breadcrumbs,n),e[0]=n,e[1]=l):l=e[1];let c;e[2]!==a?(c=xe(a),e[2]=a,e[3]=c):c=e[3];let d;return e[4]!==t||e[5]!==o||e[6]!==l||e[7]!==c?(d=f.jsx(Re,{className:l,"data-component":"PH_Breadcrumbs",sx:o,...c,children:t}),e[4]=t,e[5]=o,e[6]=l,e[7]=c,e[8]=d):d=e[8],d},Cm=s=>{const e=W.c(12),{children:t,className:n,sx:i,hidden:r}=s,o=i===void 0?Te:i,a=r===void 0?!1:r;let l;if(e[0]!==o){l={};const{height:h}=o;h&&(l["--custom-height"]=h),e[0]=o,e[1]=l}else l=e[1];let c;e[2]!==n?(c=N(Se.LeadingVisual,n),e[2]=n,e[3]=c):c=e[3];let d;e[4]!==a?(d=xe(a),e[4]=a,e[5]=d):d=e[5];let u;return e[6]!==t||e[7]!==l||e[8]!==o||e[9]!==c||e[10]!==d?(u=f.jsx(Re,{className:c,"data-component":"PH_LeadingVisual",sx:o,style:l,...d,children:t}),e[6]=t,e[7]=l,e[8]=o,e[9]=c,e[10]=d,e[11]=u):u=e[11],u},Em=s=>{const e=W.c(14),{children:t,className:n,sx:i,hidden:r,as:o}=s,a=i===void 0?Te:i,l=r===void 0?!1:r,c=o===void 0?"h2":o;let d;if(e[0]!==a){d={};const{fontSize:_,lineHeight:b,fontWeight:g}=a;_&&(d["--custom-font-size"]=_),b&&(d["--custom-line-height"]=b),g&&(d["--custom-font-weight"]=g),e[0]=a,e[1]=d}else d=e[1];let u;e[2]!==n?(u=N(Se.Title,n),e[2]=n,e[3]=u):u=e[3];let h;e[4]!==l?(h=xe(l),e[4]=l,e[5]=h):h=e[5];let m;return e[6]!==c||e[7]!==t||e[8]!==l||e[9]!==d||e[10]!==a||e[11]!==u||e[12]!==h?(m=f.jsx(Er,{className:u,"data-component":"PH_Title","data-hidden":l,as:c,style:d,sx:a,...h,children:t}),e[6]=c,e[7]=t,e[8]=l,e[9]=d,e[10]=a,e[11]=u,e[12]=h,e[13]=m):m=e[13],m},xm=s=>{const e=W.c(12),{children:t,className:n,sx:i,hidden:r}=s,o=i===void 0?Te:i,a=r===void 0?!1:r;let l;if(e[0]!==o){l={};const{height:h}=o;h&&(l["--custom-height"]=h),e[0]=o,e[1]=l}else l=e[1];let c;e[2]!==n?(c=N(Se.TrailingVisual,n),e[2]=n,e[3]=c):c=e[3];let d;e[4]!==a?(d=xe(a),e[4]=a,e[5]=d):d=e[5];let u;return e[6]!==t||e[7]!==l||e[8]!==o||e[9]!==c||e[10]!==d?(u=f.jsx(Re,{className:c,"data-component":"PH_TrailingVisual",sx:o,style:l,...d,children:t}),e[6]=t,e[7]=l,e[8]=o,e[9]=c,e[10]=d,e[11]=u):u=e[11],u},Tm=s=>{const e=W.c(12),{children:t,className:n,sx:i,hidden:r}=s,o=i===void 0?Te:i,a=r===void 0?wo:r;let l;if(e[0]!==o){l={};const{height:h}=o;h&&(l["--custom-height"]=h),e[0]=o,e[1]=l}else l=e[1];let c;e[2]!==n?(c=N(Se.TrailingAction,n),e[2]=n,e[3]=c):c=e[3];let d;e[4]!==a?(d=xe(a),e[4]=a,e[5]=d):d=e[5];let u;return e[6]!==t||e[7]!==l||e[8]!==o||e[9]!==c||e[10]!==d?(u=f.jsx(Re,{className:c,"data-component":"PH_TrailingAction",sx:o,style:l,...d,children:t}),e[6]=t,e[7]=l,e[8]=o,e[9]=c,e[10]=d,e[11]=u):u=e[11],u},Sm=s=>{const e=W.c(12),{children:t,className:n,sx:i,hidden:r}=s,o=i===void 0?Te:i,a=r===void 0?!1:r;let l;if(e[0]!==o){l={};const{height:h}=o;h&&(l["--custom-height"]=h),e[0]=o,e[1]=l}else l=e[1];let c;e[2]!==n?(c=N(Se.Actions,n),e[2]=n,e[3]=c):c=e[3];let d;e[4]!==a?(d=xe(a),e[4]=a,e[5]=d):d=e[5];let u;return e[6]!==t||e[7]!==l||e[8]!==o||e[9]!==c||e[10]!==d?(u=f.jsx(Re,{className:c,"data-component":"PH_Actions",sx:o,style:l,...d,children:t}),e[6]=t,e[7]=l,e[8]=o,e[9]=c,e[10]=d,e[11]=u):u=e[11],u},Pm=s=>{const e=W.c(9),{children:t,className:n,sx:i,hidden:r}=s,o=i===void 0?Te:i,a=r===void 0?!1:r;let l;e[0]!==n?(l=N(Se.Description,n),e[0]=n,e[1]=l):l=e[1];let c;e[2]!==a?(c=xe(a),e[2]=a,e[3]=c):c=e[3];let d;return e[4]!==t||e[5]!==o||e[6]!==l||e[7]!==c?(d=f.jsx(Re,{className:l,sx:o,...c,children:t}),e[4]=t,e[5]=o,e[6]=l,e[7]=c,e[8]=d):d=e[8],d},Am=s=>{const e=W.c(12),{children:t,className:n,sx:i,hidden:r,as:o,"aria-label":a,"aria-labelledby":l}=s,c=i===void 0?Te:i,d=r===void 0?!1:r,u=o==="nav"?a:void 0,h=o==="nav"?l:void 0;let m;e[0]!==n?(m=N(Se.Navigation,n),e[0]=n,e[1]=m):m=e[1];let _;e[2]!==d?(_=xe(d),e[2]=d,e[3]=_):_=e[3];let b;return e[4]!==o||e[5]!==t||e[6]!==c||e[7]!==u||e[8]!==h||e[9]!==m||e[10]!==_?(b=f.jsx(Re,{as:o,"aria-label":u,"aria-labelledby":h,className:m,"data-component":"PH_Navigation",sx:c,..._,children:t}),e[4]=o,e[5]=t,e[6]=c,e[7]=u,e[8]=h,e[9]=m,e[10]=_,e[11]=b):b=e[11],b};function xe(s){if(Aa(s)){const e=s,t="narrow"in e?{"data-hidden-narrow":e.narrow||void 0}:{},n="regular"in e?{"data-hidden-regular":e.regular||void 0}:{},i="wide"in e?{"data-hidden-wide":e.wide||void 0}:{};return mm(e)?{"data-hidden-all":e.narrow||void 0}:pm(e)?{...t,...n}:{...t,...n,...i}}else return{"data-hidden-all":s||void 0}}const xo=Object.assign(_m,{ContextArea:gm,ParentLink:Co,ContextBar:ym,TitleArea:Eo,ContextAreaActions:bm,LeadingAction:vm,Breadcrumbs:wm,LeadingVisual:Cm,Title:Em,TrailingVisual:xm,TrailingAction:Tm,Actions:Sm,Description:Pm,Navigation:Am});xo.displayName="PageHeader";function Rm(s){const e=W.c(7),{title:t,children:n,onRetry:i,onDismiss:r}=s,o=t===void 0?"Error":t;let a;e[0]!==r||e[1]!==i?(a=c=>{c==="confirm"?i?.():r?.()},e[0]=r,e[1]=i,e[2]=a):a=e[2];let l;return e[3]!==n||e[4]!==a||e[5]!==o?(l=f.jsx(ci,{title:o,onClose:a,confirmButtonContent:"Retry",cancelButtonContent:"Dismiss",children:n}),e[3]=n,e[4]=a,e[5]=o,e[6]=l):l=e[6],l}const We={ASC:"ASC",DESC:"DESC",NONE:"NONE"},To=We.ASC;function Im(s){return s===We.ASC?We.DESC:We.ASC}function Lm(s,e){return s===e?0:s<e?-1:1}function Om(s,e){const t=s instanceof Date?s.getTime():s,n=e instanceof Date?e.getTime():e;return t>n?1:t<n?-1:0}function km(s,e){const t=Wi(s),n=Wi(e);for(;t.length!==0&&n.length!==0;){const i=t.shift(),r=n.shift();if(i!==r){if(typeof i=="string"&&typeof r=="string")return i.localeCompare(r);if(typeof i=="number"&&typeof r=="number")return i>r?1:-1;if(typeof i=="number"&&typeof r=="string")return-1;if(typeof i=="string"&&typeof r=="number")return 1;if(i===void 0||r===void 0)break}}return t.length>n.length?1:-1}function Wi(s){const e=[];let t=0;for(;t<s.length;){let n=s[t];if(is(n)){for(;t+1<s.length&&is(s[t+1]);)n=n+s[t+1],t++;e.push(parseInt(n,10))}else{for(;t+1<s.length&&!is(s[t+1]);)n=n+s[t+1],t++;e.push(n)}t++}return e}function is(s){return!Number.isNaN(parseInt(s,10))}const Hi={alphanumeric:km,basic:Lm,datetime:Om};function Fm(s){const e=W.c(26),{columns:t,data:n,initialSortColumn:i,initialSortDirection:r,getRowId:o}=s,[a,l]=R.useState(n),[c,d]=R.useState(n),[u,h]=R.useState(t);let m;e[0]!==t||e[1]!==i||e[2]!==r?(m=()=>Dm(t,i,r),e[0]=t,e[1]=i,e[2]=r,e[3]=m):m=e[3];const[_,b]=R.useState(m),{gridTemplateColumns:g}=So(t);t!==u&&(h(t),_&&(t.find(x=>{var S;const A=(S=x.id)!==null&&S!==void 0?S:x.field;return _.id===A})||b(null)));let p,w;if(e[4]!==t||e[5]!==n||e[6]!==c||e[7]!==_){let E=function(S){const A=p.find(P=>P.id===S.id);if(!A)throw new Error(`Unable to find header with id: ${S.id}`);if(A.column.sortBy===!1||A.column.sortBy===void 0)throw new Error("The column for this header is not sortable");const I=A.column.sortBy===!0?Hi.basic:typeof A.column.sortBy=="string"?Hi[A.column.sortBy]:A.column.sortBy;l(P=>P.slice().sort((M,j)=>{if(A.column.field===void 0)return 0;if(typeof A.column.sortBy=="function")return S.direction===We.ASC?I(M,j):I(j,M);const H=rs(M,A.column.field),$=rs(j,A.column.field);return H&&$?S.direction===We.ASC?I(H,$):I($,H):H?-1:$?1:0}))},x;e[10]!==_?(x=S=>{var A;const I=(A=S.id)!==null&&A!==void 0?A:S.field;if(I===void 0)throw new Error("Expected either an `id` or `field` to be defined for a Column");const P=S.sortBy!==void 0&&S.sortBy!==!1;return{id:I,column:S,isSortable(){return P},getSortDirection(){return _&&_.id===I?_.direction:We.NONE}}},e[10]=_,e[11]=x):x=e[11],p=t.map(x),n!==c&&(d(n),l(n),_&&E(_)),w=function(A){const I={id:A.id,direction:_&&_.id===A.id?Im(_.direction):To};b(I),E(I)},e[4]=t,e[5]=n,e[6]=c,e[7]=_,e[8]=p,e[9]=w}else p=e[8],w=e[9];let v;if(e[12]!==o||e[13]!==p||e[14]!==a){let E;e[16]!==o||e[17]!==p?(E=x=>{const S=o(x);return{id:`${S}`,getValue(){return x},getCells(){return p.map(A=>{var I;return{id:`${S}:${A.id}`,column:A.column,rowHeader:(I=A.column.rowHeader)!==null&&I!==void 0?I:!1,getValue(){if(A.column.field!==void 0)return rs(x,A.column.field);throw new Error(`Unable to get value for column header ${A.id}`)}}})}}},e[16]=o,e[17]=p,e[18]=E):E=e[18],v=a.map(E),e[12]=o,e[13]=p,e[14]=a,e[15]=v}else v=e[15];let y;e[19]!==w?(y={sortBy:w},e[19]=w,e[20]=y):y=e[20];let C;return e[21]!==g||e[22]!==p||e[23]!==v||e[24]!==y?(C={headers:p,rows:v,actions:y,gridTemplateColumns:g},e[21]=g,e[22]=p,e[23]=v,e[24]=y,e[25]=C):C=e[25],C}function Dm(s,e,t){if(e!==void 0){const i=s.find(r=>r.id===e||r.field===e);return i===void 0||i.sortBy===!1||i.sortBy===void 0?null:{id:`${e}`,direction:t??To}}if(t!==void 0){var n;const i=s.find(o=>o.sortBy!==!1&&o.sortBy!==void 0);if(!i)return null;const r=(n=i.id)!==null&&n!==void 0?n:i.field;return r===void 0?null:{id:r,direction:t}}return null}function So(s){return{gridTemplateColumns:Mm(s).join(" ")}}function Mm(s){return s.map(e=>{var t;const n=(t=e.width)!==null&&t!==void 0?t:"grow";let i="auto",r="1fr";return n==="auto"&&(r="auto"),n==="grow"&&!e.maxWidth&&(i="max-content"),n==="growCollapse"&&(i="0"),e.minWidth&&(i=typeof e.minWidth=="number"?`${e.minWidth}px`:e.minWidth),e.maxWidth&&(r=typeof e.maxWidth=="number"?`${e.maxWidth}px`:e.maxWidth),typeof n!="number"&&["grow","growCollapse","auto"].includes(n)?i===r?i:`minmax(${i}, ${r})`:typeof n=="number"?`${n}px`:n})}function rs(s,e){return e.split(".").reduce((t,n)=>t[n],s)}var Nm={ButtonReset:"prc-components-ButtonReset-9kafa"};const Mn=s=>{const e=W.c(10);let t,n,i;e[0]!==s?({children:t,className:n,...i}=s,e[0]=s,e[1]=t,e[2]=n,e[3]=i):(t=e[1],n=e[2],i=e[3]);let r;e[4]!==n?(r=N(n,Nm.ButtonReset),e[4]=n,e[5]=r):r=e[5];let o;return e[6]!==t||e[7]!==i||e[8]!==r?(o=f.jsx("button",{className:r,type:"button",...i,children:t}),e[6]=t,e[7]=i,e[8]=r,e[9]=o):o=e[9],o};var fe={TableContainer:"prc-DataTable-TableContainer-Gm3sY",TableTitle:"prc-DataTable-TableTitle-Q7qQd",TableSubtitle:"prc-DataTable-TableSubtitle-DEyv-",TableActions:"prc-DataTable-TableActions-IEEii",TableDivider:"prc-DataTable-TableDivider-OsO1X",TableOverflowWrapper:"prc-DataTable-TableOverflowWrapper-PFgsy",Table:"prc-DataTable-Table-qYfrL",TableCell:"prc-DataTable-TableCell-dVc-6",TableHeader:"prc-DataTable-TableHeader-CRPoj",TableSortButton:"prc-DataTable-TableSortButton-LnQla",TableHead:"prc-DataTable-TableHead-eOrJU",TableRow:"prc-DataTable-TableRow-1vLX7",TableBody:"prc-DataTable-TableBody-p56SS",TableCellSkeletonItem:"prc-DataTable-TableCellSkeletonItem-jFqti",TableCellSkeleton:"prc-DataTable-TableCellSkeleton-ge8WK",TableSortIcon:"prc-DataTable-TableSortIcon-2h30n","TableSortIcon--ascending":"prc-DataTable-TableSortIcon--ascending-H9-sb","TableSortIcon--descending":"prc-DataTable-TableSortIcon--descending-7-zjV",TableCellSkeletonItems:"prc-DataTable-TableCellSkeletonItems-XEGdI"};const fi=T.forwardRef(function(e,t){const n=W.c(21);let i,r,o,a,l;n[0]!==e?({"aria-labelledby":o,cellPadding:l,className:i,gridTemplateColumns:r,...a}=e,n[0]=e,n[1]=i,n[2]=r,n[3]=o,n[4]=a,n[5]=l):(i=n[1],r=n[2],o=n[3],a=n[4],l=n[5]);const c=l===void 0?"normal":l;let d;n[6]===Symbol.for("react.memo_cache_sentinel")?(d=N("TableOverflowWrapper",fe.TableOverflowWrapper),n[6]=d):d=n[6];let u;n[7]!==i?(u=N(i,"Table",fe.Table),n[7]=i,n[8]=u):u=n[8];let h;n[9]!==r?(h={"--grid-template-columns":r},n[9]=r,n[10]=h):h=n[10];const m=h;let _;n[11]!==c||n[12]!==o||n[13]!==t||n[14]!==a||n[15]!==u||n[16]!==m?(_=f.jsx("table",{...a,"aria-labelledby":o,"data-cell-padding":c,className:u,role:"table",ref:t,style:m}),n[11]=c,n[12]=o,n[13]=t,n[14]=a,n[15]=u,n[16]=m,n[17]=_):_=n[17];let b;return n[18]!==o||n[19]!==_?(b=f.jsx(Ra,{"aria-labelledby":o,className:d,children:_}),n[18]=o,n[19]=_,n[20]=b):b=n[20],b});function mi(s){const e=W.c(3),{children:t}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=N("TableHead",fe.TableHead),e[0]=n):n=e[0];let i;return e[1]!==t?(i=f.jsx("thead",{className:n,role:"rowgroup",children:t}),e[1]=t,e[2]=i):i=e[2],i}function pi(s){const e=W.c(3),{children:t}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=N("TableBody",fe.TableBody),e[0]=n):n=e[0];let i;return e[1]!==t?(i=f.jsx("tbody",{className:n,role:"rowgroup",children:t}),e[1]=t,e[2]=i):i=e[2],i}function Yn(s){const e=W.c(9);let t,n,i;e[0]!==s?({align:t,children:n,...i}=s,e[0]=s,e[1]=t,e[2]=n,e[3]=i):(t=e[1],n=e[2],i=e[3]);let r;e[4]===Symbol.for("react.memo_cache_sentinel")?(r=N("TableHeader",fe.TableHeader),e[4]=r):r=e[4];let o;return e[5]!==t||e[6]!==n||e[7]!==i?(o=f.jsx("th",{...i,className:r,role:"columnheader",scope:"col","data-cell-align":t,children:n}),e[5]=t,e[6]=n,e[7]=i,e[8]=o):o=e[8],o}function jm(s){const e=W.c(23);let t,n,i,r,o;e[0]!==s?({align:t,children:n,direction:i,onToggleSort:r,...o}=s,e[0]=s,e[1]=t,e[2]=n,e[3]=i,e[4]=r,e[5]=o):(t=e[1],n=e[2],i=e[3],r=e[4],o=e[5]);const a=i==="DESC"?"descending":i==="ASC"?"ascending":void 0;let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=N("TableSortButton",fe.TableSortButton),e[6]=l):l=e[6];let c;e[7]!==r?(c=()=>{r()},e[7]=r,e[8]=c):c=e[8];let d;e[9]!==i?(d=i===We.NONE||i===We.ASC?f.jsxs(f.Fragment,{children:[f.jsx(nf,{className:N("TableSortIcon","TableSortIcon--ascending",fe.TableSortIcon,fe["TableSortIcon--ascending"])}),i===We.NONE?f.jsx(Zs,{children:"sort ascending"}):null]}):null,e[9]=i,e[10]=d):d=e[10];let u;e[11]!==i?(u=i===We.DESC?f.jsx(sf,{className:N("TableSortIcon","TableSortIcon--descending",fe.TableSortIcon,fe["TableSortIcon--descending"])}):null,e[11]=i,e[12]=u):u=e[12];let h;e[13]!==n||e[14]!==c||e[15]!==d||e[16]!==u?(h=f.jsxs(Mn,{type:"button",className:l,onClick:c,children:[n,d,u]}),e[13]=n,e[14]=c,e[15]=d,e[16]=u,e[17]=h):h=e[17];let m;return e[18]!==t||e[19]!==a||e[20]!==o||e[21]!==h?(m=f.jsx(Yn,{...o,"aria-sort":a,align:t,children:h}),e[18]=t,e[19]=a,e[20]=o,e[21]=h,e[22]=m):m=e[22],m}function on(s){const e=W.c(7);let t,n;e[0]!==s?({children:t,...n}=s,e[0]=s,e[1]=t,e[2]=n):(t=e[1],n=e[2]);let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=N("TableRow",fe.TableRow),e[3]=i):i=e[3];let r;return e[4]!==t||e[5]!==n?(r=f.jsx("tr",{...n,className:i,role:"row",children:t}),e[4]=t,e[5]=n,e[6]=r):r=e[6],r}function _i(s){const e=W.c(16);let t,n,i,r,o;e[0]!==s?({align:t,className:i,children:n,scope:o,...r}=s,e[0]=s,e[1]=t,e[2]=n,e[3]=i,e[4]=r,e[5]=o):(t=e[1],n=e[2],i=e[3],r=e[4],o=e[5]);const a=o?"th":"td",l=o?"rowheader":"cell";let c;e[6]!==i?(c=N("TableCell",i,fe.TableCell),e[6]=i,e[7]=c):c=e[7];let d;return e[8]!==a||e[9]!==t||e[10]!==n||e[11]!==r||e[12]!==l||e[13]!==o||e[14]!==c?(d=f.jsx(a,{...r,className:c,scope:o,role:l,"data-cell-align":t,children:n}),e[8]=a,e[9]=t,e[10]=n,e[11]=r,e[12]=l,e[13]=o,e[14]=c,e[15]=d):d=e[15],d}function Bm(s){const e=W.c(2),{children:t}=s;let n;return e[0]!==t?(n=f.jsx(be,{color:"fg.subtle",children:t}),e[0]=t,e[1]=n):n=e[1],n}function Wm(s){const e=W.c(10);let t,n,i;e[0]!==s?({children:t,className:n,...i}=s,e[0]=s,e[1]=t,e[2]=n,e[3]=i):(t=e[1],n=e[2],i=e[3]);let r;e[4]!==n?(r=N(n,fe.TableContainer),e[4]=n,e[5]=r):r=e[5];let o;return e[6]!==t||e[7]!==i||e[8]!==r?(o=f.jsx(Re,{...i,className:r,children:t}),e[6]=t,e[7]=i,e[8]=r,e[9]=o):o=e[9],o}const Hm=T.forwardRef(function(e,t){const n=W.c(6),{as:i,children:r,id:o}=e,l=i===void 0?"h2":i;let c;n[0]===Symbol.for("react.memo_cache_sentinel")?(c=N("TableTitle",fe.TableTitle),n[0]=c):c=n[0];let d;return n[1]!==l||n[2]!==r||n[3]!==o||n[4]!==t?(d=f.jsx(l,{className:c,id:o,ref:t,children:r}),n[1]=l,n[2]=r,n[3]=o,n[4]=t,n[5]=d):d=n[5],d});function Vm(s){const e=W.c(5),{as:t,children:n,id:i}=s,r=t===void 0?"div":t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=N("TableSubtitle",fe.TableSubtitle),e[0]=o):o=e[0];let a;return e[1]!==r||e[2]!==n||e[3]!==i?(a=f.jsx(r,{className:o,id:i,children:n}),e[1]=r,e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function zm(){const s=W.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=f.jsx("div",{className:N("TableDivider",fe.TableDivider),role:"presentation"}),s[0]=e):e=s[0],e}function Um(s){const e=W.c(3),{children:t}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=N("TableActions",fe.TableActions),e[0]=n):n=e[0];let i;return e[1]!==t?(i=f.jsx("div",{className:n,children:t}),e[1]=t,e[2]=i):i=e[2],i}function $m(s){const e=W.c(20);let t,n,i,r;e[0]!==s?({cellPadding:t,columns:n,rows:r,...i}=s,e[0]=s,e[1]=t,e[2]=n,e[3]=i,e[4]=r):(t=e[1],n=e[2],i=e[3],r=e[4]);const o=r===void 0?10:r,{gridTemplateColumns:a}=So(n);let l;e[5]!==n?(l=Array.isArray(n)?n.map(Ao):null,e[5]=n,e[6]=l):l=e[6];let c;e[7]!==l?(c=f.jsx(mi,{children:f.jsx(on,{children:l})}),e[7]=l,e[8]=c):c=e[8];let d;e[9]!==n.length?(d=Array.from({length:n.length}),e[9]=n.length,e[10]=d):d=e[10];let u;e[11]!==o||e[12]!==d?(u=f.jsx(pi,{children:f.jsx(on,{children:d.map((m,_)=>f.jsxs(_i,{className:N("TableCellSkeleton",fe.TableCellSkeleton),children:[f.jsx(Zs,{children:"Loading"}),f.jsx("div",{className:N("TableCellSkeletonItems",fe.TableCellSkeletonItems),children:Array.from({length:o}).map(Po)})]},_))})}),e[11]=o,e[12]=d,e[13]=u):u=e[13];let h;return e[14]!==t||e[15]!==a||e[16]!==i||e[17]!==c||e[18]!==u?(h=f.jsxs(fi,{...i,cellPadding:t,gridTemplateColumns:a,children:[c,u]}),e[14]=t,e[15]=a,e[16]=i,e[17]=c,e[18]=u,e[19]=h):h=e[19],h}function Po(s,e){return f.jsx("div",{className:N("TableCellSkeletonItem",fe.TableCellSkeletonItem),children:f.jsx(wr,{})},e)}Po.displayName="_temp2";function Ao(s,e){return f.jsx(Yn,{children:typeof s.header=="string"?s.header:s.header()},e)}Ao.displayName="_temp";const Ro=T.createContext(null);function Io(){const s=T.useContext(Ro);if(!s)throw new Error("useLiveRegion() must be used within a <LiveRegion>");return s}function Km(s){const e=W.c(5),{children:t}=s,[n,i]=T.useState("");let r,o;e[0]!==n?(o={announce:i,message:n},e[0]=n,e[1]=o):o=e[1],r=o;const a=r;let l;return e[2]!==t||e[3]!==a?(l=f.jsx(Ro.Provider,{value:a,children:t}),e[2]=t,e[3]=a,e[4]=l):l=e[4],l}function qm(){const s=W.c(2),e=Io();let t;return s[0]!==e.message?(t=f.jsx(kt,{role:"status","aria-live":"polite","aria-atomic":!0,children:e.message}),s[0]=e.message,s[1]=t):t=s[1],t}function Gm(s){const e=W.c(8),{value:t}=s,n=Io(),i=T.useRef(n),r=T.useRef(!1);let o,a;e[0]!==n?(o=()=>{i.current=n},a=[n],e[0]=n,e[1]=o,e[2]=a):(o=e[1],a=e[2]),T.useEffect(o,a);let l,c;e[3]!==t?(l=()=>{if(r.current!==!0)return;const h=setTimeout(()=>{i.current.announce(t)},750);return()=>{clearTimeout(h)}},c=[t],e[3]=t,e[4]=l,e[5]=c):(l=e[4],c=e[5]),T.useEffect(l,c);let d,u;return e[6]===Symbol.for("react.memo_cache_sentinel")?(d=()=>(r.current=!0,()=>{r.current=!1}),u=[],e[6]=d,e[7]=u):(d=e[6],u=e[7]),T.useEffect(d,u),null}var dt={TablePagination:"prc-DataTable-TablePagination-ZbY9p",TablePaginationSteps:"prc-DataTable-TablePaginationSteps-Qqz6y",TablePaginationRange:"prc-DataTable-TablePaginationRange-Kp7GT",TablePaginationStep:"prc-DataTable-TablePaginationStep-0FsgZ",TablePaginationAction:"prc-DataTable-TablePaginationAction-kKQK4",TablePaginationPage:"prc-DataTable-TablePaginationPage-MQm-t",TablePaginationTruncationStep:"prc-DataTable-TablePaginationTruncationStep-HEMTY"};const Jm={narrow:!1};function Lo({"aria-label":s,defaultPageIndex:e,id:t,onChange:n,pageSize:i=25,showPages:r=Jm,totalCount:o}){const{pageIndex:a,pageStart:l,pageEnd:c,pageCount:d,hasPreviousPage:u,hasNextPage:h,selectPage:m,selectNextPage:_,selectPreviousPage:b}=Qm({defaultPageIndex:e,onChange:n,pageSize:i,totalCount:o}),g=R.useCallback(()=>typeof r!="boolean"?Object.keys(r).filter(w=>!r[w]):r?[]:Object.keys(Ia),[r]),p=R.useMemo(()=>Vf(d,a+1,!!r,1,2),[d,a,r]);return f.jsxs(Km,{children:[f.jsx(qm,{}),f.jsxs("nav",{"aria-label":s,className:N("TablePagination",dt.TablePagination),id:t,children:[f.jsx(Ym,{pageStart:l,pageEnd:c,totalCount:o}),f.jsxs("ol",{className:N("TablePaginationSteps",dt.TablePaginationSteps),"data-hidden-viewport-ranges":g().join(" "),children:[f.jsx(os,{children:f.jsxs(Mn,{className:N("TablePaginationAction",dt.TablePaginationAction),type:"button","data-has-page":u?!0:void 0,"aria-disabled":u?void 0:!0,onClick:()=>{u&&b()},children:[u?f.jsx(dh,{}):null,f.jsx("span",{children:"Previous"}),f.jsx(kt,{children:" page"})]})}),p.map((w,v)=>{if(w.type==="BREAK")return f.jsx(Xm,{},`truncation-${v}`);if(w.type==="NUM")return f.jsx(os,{children:f.jsxs(Zm,{active:!!w.selected,onClick:()=>{m(w.num-1)},children:[w.num,w.precedesBreak?f.jsx(kt,{children:"…"}):null]})},v)}),f.jsx(os,{children:f.jsxs(Mn,{className:N("TablePaginationAction",dt.TablePaginationAction),type:"button","data-has-page":h?!0:void 0,"aria-disabled":h?void 0:!0,onClick:()=>{h&&_()},children:[f.jsx("span",{children:"Next"}),f.jsx(kt,{children:" page"}),h?f.jsx(vr,{}):null]})})]})]})]})}Lo.displayName="Pagination";function Ym(s){const e=W.c(12),{pageStart:t,pageEnd:n,totalCount:i}=s,r=t+1,o=n,a=`Showing ${r} through ${o} of ${i}`;let l;e[0]!==a?(l=f.jsx(Gm,{value:a}),e[0]=a,e[1]=l):l=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=N("TablePaginationRange",dt.TablePaginationRange),e[2]=c):c=e[2];let d,u;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=f.jsx(kt,{children:" through "}),u=f.jsx("span",{"aria-hidden":"true",children:"‒"}),e[3]=d,e[4]=u):(d=e[3],u=e[4]);let h;e[5]!==o||e[6]!==r||e[7]!==i?(h=f.jsxs("p",{className:c,children:[r,d,u,o," of ",i]}),e[5]=o,e[6]=r,e[7]=i,e[8]=h):h=e[8];let m;return e[9]!==l||e[10]!==h?(m=f.jsxs(f.Fragment,{children:[l,h]}),e[9]=l,e[10]=h,e[11]=m):m=e[11],m}function Xm(){const s=W.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=f.jsx("li",{"aria-hidden":"true",className:N("TablePaginationTruncationStep",dt.TablePaginationTruncationStep),children:"…"}),s[0]=e):e=s[0],e}function os(s){const e=W.c(3),{children:t}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=N("TablePaginationStep",dt.TablePaginationStep),e[0]=n):n=e[0];let i;return e[1]!==t?(i=f.jsx("li",{className:n,children:t}),e[1]=t,e[2]=i):i=e[2],i}function Zm(s){const e=W.c(7),{active:t,children:n,onClick:i}=s;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=N("TablePaginationPage",dt.TablePaginationPage),e[0]=r):r=e[0];const o=t?!0:void 0,a=t?!0:void 0;let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=f.jsx(kt,{children:"Page "}),e[1]=l):l=e[1];let c;return e[2]!==n||e[3]!==i||e[4]!==o||e[5]!==a?(c=f.jsxs(Mn,{className:r,type:"button","data-active":o,"aria-current":a,onClick:i,children:[l,n]}),e[2]=n,e[3]=i,e[4]=o,e[5]=a,e[6]=c):c=e[6],c}function Qm(s){const e=W.c(24),{defaultPageIndex:t,onChange:n,pageSize:i,totalCount:r}=s,o=Math.ceil(r/i);let a;e[0]!==t||e[1]!==o?(a=()=>t!==void 0&&t>=0&&t<o?t:0,e[0]=t,e[1]=o,e[2]=a):a=e[2];const[l,c]=R.useState(a),[d,u]=R.useState(l);t!==void 0&&t>=0&&t<o&&l!==t&&(c(t),u(t),n?.({pageIndex:t}));const m=d*i,_=Math.min((d+1)*i,r),b=d+1<o,g=d>0;let p;e[3]!==n||e[4]!==d?(p=function(A){d!==A&&(u(A),n?.({pageIndex:A}))},e[3]=n,e[4]=d,e[5]=p):p=e[5];const w=p;let v;e[6]!==g||e[7]!==d||e[8]!==w?(v=function(){g&&w(d-1)},e[6]=g,e[7]=d,e[8]=w,e[9]=v):v=e[9];const y=v;let C;e[10]!==b||e[11]!==d||e[12]!==w?(C=function(){b&&w(d+1)},e[10]=b,e[11]=d,e[12]=w,e[13]=C):C=e[13];const E=C;let x;return e[14]!==b||e[15]!==g||e[16]!==o||e[17]!==_||e[18]!==d||e[19]!==m||e[20]!==E||e[21]!==w||e[22]!==y?(x={pageIndex:d,pageStart:m,pageEnd:_,pageCount:o,hasNextPage:b,hasPreviousPage:g,selectPage:w,selectPreviousPage:y,selectNextPage:E},e[14]=b,e[15]=g,e[16]=o,e[17]=_,e[18]=d,e[19]=m,e[20]=E,e[21]=w,e[22]=y,e[23]=x):x=e[23],x}const as=Object.assign(fi,{Container:Wm,Title:Hm,Subtitle:Vm,Actions:Um,Divider:zm,Skeleton:$m,Head:mi,Body:pi,Header:Yn,Row:on,Cell:_i,CellPlaceholder:Bm,Pagination:Lo,ErrorDialog:Rm});function ep(s){return s.id}function tp(s){const e=W.c(26),{"aria-labelledby":t,"aria-describedby":n,cellPadding:i,columns:r,data:o,initialSortColumn:a,initialSortDirection:l,getRowId:c,onToggleSort:d}=s,u=c===void 0?ep:c;let h;e[0]!==r||e[1]!==o||e[2]!==u||e[3]!==a||e[4]!==l?(h={data:o,columns:r,initialSortColumn:a,initialSortDirection:l,getRowId:u},e[0]=r,e[1]=o,e[2]=u,e[3]=a,e[4]=l,e[5]=h):h=e[5];const{headers:m,rows:_,actions:b,gridTemplateColumns:g}=Fm(h);let p;if(e[6]!==b||e[7]!==m||e[8]!==d){let E;e[10]!==b||e[11]!==d?(E=x=>x.isSortable()?f.jsx(jm,{align:x.column.align,direction:x.getSortDirection(),onToggleSort:()=>{const S=x.getSortDirection()==="ASC"?"DESC":"ASC";b.sortBy(x),d?.(x.id,S)},children:typeof x.column.header=="string"?x.column.header:x.column.header()},x.id):f.jsx(Yn,{align:x.column.align,children:typeof x.column.header=="string"?x.column.header:x.column.header()},x.id),e[10]=b,e[11]=d,e[12]=E):E=e[12],p=m.map(E),e[6]=b,e[7]=m,e[8]=d,e[9]=p}else p=e[9];let w;e[13]!==p?(w=f.jsx(mi,{children:f.jsx(on,{children:p})}),e[13]=p,e[14]=w):w=e[14];let v;e[15]!==_?(v=_.map(Oo),e[15]=_,e[16]=v):v=e[16];let y;e[17]!==v?(y=f.jsx(pi,{children:v}),e[17]=v,e[18]=y):y=e[18];let C;return e[19]!==i||e[20]!==n||e[21]!==g||e[22]!==t||e[23]!==w||e[24]!==y?(C=f.jsxs(fi,{"aria-labelledby":t,"aria-describedby":n,cellPadding:i,gridTemplateColumns:g,children:[w,y]}),e[19]=i,e[20]=n,e[21]=g,e[22]=t,e[23]=w,e[24]=y,e[25]=C):C=e[25],C}function Oo(s){return f.jsx(on,{children:s.getCells().map(e=>f.jsx(_i,{scope:e.rowHeader?"row":void 0,align:e.column.align,children:e.column.renderCell?e.column.renderCell(s.getValue()):e.getValue()},e.id))},s.id)}Oo.displayName="_temp";const np={"--jp-collaborator-color1":"#ffad8e","--jp-collaborator-color2":"#dac83d","--jp-collaborator-color3":"#72dd76","--jp-collaborator-color4":"#00e4d0","--jp-collaborator-color5":"#45d4ff","--jp-collaborator-color6":"#e2b1ff","--jp-collaborator-color7":"#ff9de6"},sp=s=>np[s.replaceAll("var(","").replaceAll(")","")];class ko{_serviceManager;constructor(e){this._serviceManager=e}kernelspecs(){return this._serviceManager.kernelspecs}contents(){return this._serviceManager.contents}nbconvert(){return this._serviceManager.nbconvert}sessions(){return this._serviceManager.sessions}settings(){return this._serviceManager.settings}terminals(){return this._serviceManager.terminals}workspaces(){return this._serviceManager.workspaces}builder(){return this._serviceManager.builder}serverSettings(){return this._serviceManager.serverSettings}refreshKernelspecs(){return this.kernelspecs().refreshSpecs()}getKernelspecs(){return this.kernelspecs().specs}}const ip=Object.freeze(Object.defineProperty({__proto__:null,IServiceWorkerManager:Of,JupyterLiteServer:La,Router:Oa,ServiceWorkerManager:cf,WORKER_NAME:kf},Symbol.toStringTag,{value:"Module"})),rp=Object.freeze(Object.defineProperty({__proto__:null,BLOCK_SIZE:yf,BroadcastChannelWrapper:df,Contents:uf,ContentsAPI:bf,DIR_MODE:vf,DRIVE_API_PATH:wf,DRIVE_SEPARATOR:Cf,DriveContentsProcessor:Ef,DriveFS:xf,DriveFSEmscriptenNodeOps:Tf,DriveFSEmscriptenStreamOps:Sf,get FILE(){return Ff},FILE_MODE:Pf,IBroadcastChannelWrapper:Df,IContents:Mf,get MIME(){return Nf},SEEK_CUR:Af,SEEK_END:Rf,ServiceWorkerContentsAPI:If,instanceOfStream:Lf},Symbol.toStringTag,{value:"Module"})),op=Object.freeze(Object.defineProperty({__proto__:null,BaseKernel:Hf,FALLBACK_KERNEL:jf,IKernelSpecs:Bf,IKernels:Wf,KernelSpecs:hf,Kernels:ff},Symbol.toStringTag,{value:"Module"})),ap=Object.freeze(Object.defineProperty({__proto__:null,ILocalForage:mf,ensureMemoryStorage:pf},Symbol.toStringTag,{value:"Module"})),lp=Object.freeze(Object.defineProperty({__proto__:null,ISessions:_f,Sessions:gf},Symbol.toStringTag,{value:"Module"})),cp=Qs.bindprops({stylesheet:"menuItem"});class dp extends ka{constructor(e){super(e),this._isDisposed=!1,this._opened=new U(this),this.menu=new Wt(e)}get isDisposed(){return this._isDisposed}get opened(){return this._opened}dispose(){this._isDisposed||(this._isDisposed=!0,this.menu.dispose(),U.disconnectSender(this))}open(e){if(this._isDisposed)return!1;const t=super.open(e);return t&&this._opened.emit(),t}}class Wt extends kn{constructor(e){e.renderer=e.renderer||Wt.defaultRenderer,super(e),this.addClass("jp-ThemedContainer")}insertItem(e,t){return t.submenu&&Wt.overrideDefaultRenderer(t.submenu),super.insertItem(e,t)}}(function(s){function e(n){n.renderer===kn.defaultRenderer&&(n.renderer=s.defaultRenderer);const i=n.insertItem.bind(n);n.insertItem=(r,o)=>(o.submenu&&s.overrideDefaultRenderer(o.submenu),i(r,o));for(const r of n._items)r.submenu&&e(r.submenu)}s.overrideDefaultRenderer=e;class t extends kn.Renderer{renderIcon(i){const r=this.createIconClass(i);return i.item.isToggled?ae.div({className:r},Fa,i.item.iconLabel):ae.div({className:r},i.item.icon,i.item.iconLabel)}createIconClass(i){let r="lm-Menu-itemIcon";return i.item.type==="separator"?xt(i.item.iconClass,r):xt(xr.styleClass({stylesheet:"menuItem"}),i.item.iconClass,r)}renderSubmenu(i){const r="lm-Menu-itemSubmenuIcon";return i.item.type==="submenu"?ae.div({className:r},cp):ae.div({className:r})}}s.Renderer=t,s.defaultRenderer=new t})(Wt||(Wt={}));class He extends ei{constructor(e={}){var t;super({renderer:He.defaultRenderer,...e});const n=((t=He.translator)!==null&&t!==void 0?t:se).load("jupyterlab");Tr.element({container:this.addButtonNode,title:n.__("New Launcher")})}}He.translator=null;(function(s){function e(n){return n.label||n.dataset.jpTabLabel||n.caption}s.titleLabel=e;class t extends ei.Renderer{renderLabel(i){return ae.div({className:"lm-TabBar-tabLabel"},e(i.title))}renderCloseIcon(i){var r;const o=((r=s.translator)!==null&&r!==void 0?r:se).load("jupyterlab"),a=e(i.title),l=a?o.__("Close %1",a):o.__("Close tab"),c=xt("jp-icon-hover lm-TabBar-tabCloseIcon",xr.styleClass({elementPosition:"center",height:"16px",width:"16px"}));return Ma("div",{className:c,title:l},Sr)}}s.Renderer=t,s.defaultRenderer=new t})(He||(He={}));class an extends zn{constructor(e={}){super({renderer:an.defaultRenderer,...e})}}(function(s){class e extends zn.Renderer{createTabBar(){const n=new He;return n.addClass("lm-DockPanel-tabBar"),n}}s.Renderer=e,s.defaultRenderer=new e})(an||(an={}));class up extends Da{constructor(e={}){e.renderer=e.renderer||He.defaultRenderer,super(e)}}class hp extends Na{constructor(){super(...arguments),this._toolbars=new WeakMap}insertWidget(e,t){t.toolbar&&(this._toolbars.set(t,t.toolbar),t.toolbar.addClass("jp-AccordionPanel-toolbar")),super.insertWidget(e,t)}removeWidgetAt(e){const t=this.widgets[e];super.removeWidgetAt(e),t&&this._toolbars.has(t)&&this._toolbars.delete(t)}updateTitle(e,t){super.updateTitle(e,t),this._addToolbar(e,t)}attachWidget(e,t){super.attachWidget(e,t),this._addToolbar(e,t)}detachWidget(e,t){const n=this._toolbars.get(t);n&&(this.parent.isAttached&&Ie.sendMessage(n,X.Msg.BeforeDetach),this.titles[e].removeChild(n.node),this.parent.isAttached&&Ie.sendMessage(n,X.Msg.AfterDetach)),super.detachWidget(e,t)}onBeforeAttach(e){this.notifyToolbars(e),super.onBeforeAttach(e)}onAfterAttach(e){super.onAfterAttach(e),this.notifyToolbars(e)}onBeforeDetach(e){this.notifyToolbars(e),super.onBeforeDetach(e)}onAfterDetach(e){super.onAfterDetach(e),this.notifyToolbars(e)}_addToolbar(e,t){const n=this._toolbars.get(t);n&&(this.parent.isAttached&&Ie.sendMessage(n,X.Msg.BeforeAttach),this.titles[e].appendChild(n.node),this.parent.isAttached&&Ie.sendMessage(n,X.Msg.AfterAttach))}notifyToolbars(e){this.widgets.forEach(t=>{const n=this._toolbars.get(t);n&&n.processMessage(e)})}}var Nn;(function(s){class e extends Un.Renderer{createCollapseIcon(i){const r=document.createElement("div");return $n.element({container:r}),r}createSectionTitle(i){const r=super.createSectionTitle(i);return r.classList.add("jp-AccordionPanel-title"),r}}s.Renderer=e,s.defaultRenderer=new e;function t(n){var i;return n.layout||new hp({renderer:n.renderer||s.defaultRenderer,orientation:n.orientation,alignment:n.alignment,spacing:n.spacing,titleSpace:(i=n.titleSpace)!==null&&i!==void 0?i:32})}s.createLayout=t})(Nn||(Nn={}));function fp(s,e,t){return s.nodeType!==Node.TEXT_NODE?!0:typeof s.nodeValue=="string"&&!!s.nodeValue.trim().length}const mp=(s,e)=>Ha`
1
+ import{r as R,j as f,D as Xs,n8 as yr,n9 as bt,J as T,by as W,na as br,cL as N,nb as Ta,bD as Zt,bG as Sa,dC as vr,go as Zs,dD as sn,T as be,el as wr,nc as Cr,bC as Te,bA as Re,H as Er,nd as Pa,y as gs,cK as Aa,ne as Ra,kx as kt,nf as Ia,ng as La,nh as Oa,ni as ka,ai as U,aK as kn,eR as Qs,gU as ae,eS as Fa,cu as xt,gV as xr,nj as Ma,kk as ei,aQ as se,cy as Tr,nk as zn,nl as Da,d_ as Sr,nm as Un,kg as $n,nn as Na,gK as Ie,aN as X,jl as ja,jh as Ti,jj as Ba,jk as Wa,ji as Ha,no as Va,jn as za,jB as Ua,jp as qe,jq as Ge,np as ti,jr as $a,js as Pr,nq as Ka,jt as qa,jG as Ar,jJ as un,jK as zt,jE as ys,nr as Ga,jL as Rr,ns as Ja,jM as Ir,nt as Ya,jP as Lr,jQ as bs,jR as vs,jH as Or,nu as Si,nv as Xa,nw as Za,nx as Qa,ny as el,jI as Pi,nz as Ai,jX as tl,jY as nl,jV as sl,jU as il,nA as rl,j$ as ol,k0 as ws,k1 as al,k2 as Ye,jS as ll,jN as cl,jO as dl,k4 as kr,k5 as Fr,k6 as Mr,nB as ul,k7 as Ri,k8 as rt,k9 as hl,aW as ni,ki as fl,g3 as Dr,aO as Nr,bs as pt,aV as jr,aJ as Ae,aE as ee,v as si,L as Ut,co as ml,l0 as Kn,kl as Cs,nC as tt,dQ as En,cs as pl,cq as jt,I as Es,dF as Qn,bx as Xe,n5 as _l,nD as $t,ef as Br,gx as gl,bt as it,ee as Wr,cn as O,cw as ve,gP as Ii,aG as yl,eg as Qt,nE as bl,aL as Ve,aM as Y,e6 as Hr,cB as je,hk as vl,dT as Vr,e3 as wl,nF as Cl,nG as El,nH as xl,km as Li,nI as Tl,nJ as Sl,nK as gt,nL as ot,nM as Ze,k as Be,nN as Ee,nO as Pl,nP as ht,nQ as Al,nR as ii,nS as Rl,nT as ri,nU as Il,nV as Ll,nW as Ol,nX as ke,nY as zr,nZ as en,n_ as Ur,n$ as Oi,o0 as xs,o1 as Ne,o2 as kl,o3 as Fl,o4 as Ml,o5 as Dl,fz as Nl,lw as we,dZ as oi,gT as jl,fc as ai,aU as Bl,kj as Pe,lv as Wl,ly as $r,hg as Hl,o6 as Ts,o7 as Kr,eq as q,hb as Vl,kQ as ki,kO as zl,cA as Ul,ft as qr,kq as $l,eV as Gr,gE as Kl,eK as Fi,eG as Fn,_ as V,aH as ql,eL as es,eM as Gl,o8 as Jr,aS as _e,aR as ft,dM as Yr,cx as Ct,g$ as Jl,kf as Yl,o9 as Xl,oa as Mn,gN as Kt,ct as Bt,ob as Zl,oc as Ql,e2 as ec,gw as tc,od as nc,oe as sc,dS as ic,aP as rc,eU as oc,cm as ac,cv as Mi,of as lc,og as cc,oh as dc,k$ as Xr,U as uc,kZ as Zr,hh as hc,g4 as fc,oi as Qr,a6 as mc,lM as pc,cd as ts,lO as _c,lV as gc,lJ as yc,lW as bc,c8 as vc,lY as wc,lZ as Cc,bY as Di,oj as eo,b1 as to,ok as Ec,ol as xc,om as Tc,on as Sc,oo as Pc,op as Ac,oq as Rc,or as Ic,os as Lc,ot as Oc,ou as kc,kX as Fc,ov as Mc,ow as Dc,ox as Nc,oy as jc,oz as Bc,oA as Wc,oB as Hc,oC as Vc,b5 as zc,oD as Uc,bS as $c,oE as Kc,oF as qc,kY as Gc,oG as Jc,l1 as Yc,oH as Xc,oI as Zc,oJ as Qc,oK as ed,oL as td,oM as nd,l2 as sd,oN as id,lx as rd,oO as od,oP as ad,oQ as ld,oR as cd,oS as dd,oT as ud,oU as hd,bd as fd,oV as md,oW as pd,oX as _d,oY as gd,oZ as yd,o_ as bd,o$ as vd,p0 as wd,p1 as Cd,p2 as Ed,p3 as xd,p4 as Td,p5 as Sd,p6 as Pd,p7 as Ad,p8 as Rd,l5 as Id,Z as Ld,p9 as Od,pa as kd,pb as Fd,pc as Md,pd as Dd,pe as Nd,pf as jd,pg as Bd,ph as Wd,pi as Hd,pj as Vd,pk as zd,pl as Ud,pm as $d,pn as Kd,po as qd,pp as Gd,pq as Jd,pr as Yd,ps as Xd,pt as Zd,pu as Qd,lz as eu,fd as tu,pv as nu,lt as su,pw as iu,P as ru,m3 as ou,ls as au,ln as lu}from"../datalayer-app-main.js";import{u as Je,C as no,I as cu,b as du,c as uu,d as hu,e as fu,f as mu,g as pu,h as _u,H as gu,K as yu,i as bu,M as vu,O as wu,j as Cu,k as Eu,a as xu,l as Tu,R as Su,m as Pu,n as Au,r as Ru}from"./Output-DIp_tlWH.js";import{e as Iu,D as so,c as Lu,f as Ou,C as io,a as ro,N as oo,g as ku,h as Fu,i as Mu,j as Du,k as Nu,l as ju,r as Bu,u as Wu,m as Hu,w as Vu}from"./CellSidebarExtension-DSNmntUX.js";import{S as zu,C as Uu,E as $u,N as Ku,a as qu,b as Gu,s as Ju,w as Yu}from"./NotebookSkeleton-KHb2YSpG.js";import{L as Vt,R as ao,M as Xu,c as Zu,b as Qu,S as eh,a as th,W as nh,j as sh,r as ih}from"./index-BNjq7TZD.js";import{C as lo,a as co,W as rh,j as oh,h as ah}from"./index-tO6w-mHa.js";import{F as lh,a as ch,C as dh}from"./FileDirectoryOpenFillIcon-jGhuRcP3.js";import{p as At,e as uh,s as hh,u as fh}from"./url-DhPU-y-U.js";import{q as mh,C as ph,d as _h,l as gh}from"./index-CUjcBn1v.js";/* empty css *//* empty css */import"./style-DdAxk_bj.js";/* empty css */import"./style-Cj1gzCjo.js";/* empty css */import"./style-rkw8dR9f.js";import"./style-GHJFdtIz.js";import"./style-ZSIOeMoX.js";import"./style-iVfD6mFL.js";import"./style-DA-Ya7rp.js";import"./style-D3tvWcFO.js";import"./style-BOqStzF9.js";import"./style-ADLQJ-E9.js";import"./style-DgglluaK.js";import{A as yh}from"./ArrowLeftIcon-sX3iNMG1.js";import{F as bh,a as vh,b as wh,c as Ni,d as Ch,e as Eh,f as xh,g as Th}from"./SkubbleIcon-CAaVh_BE.js";import{N as Pt,u as Sh}from"./usePrimerThemeBridge-DjRvxgar.js";import{B as hn,U as ns}from"./index-DF5urV1Q.js";import{a as Ph,b as Ah,c as Rh,d as Ih,f as Lh,K as Oh,g as kh,P as Fh,e as Mh,h as Dh,i as Nh,j as jh,k as Bh,l as Wh,m as Hh,n as Vh,o as zh,p as Uh,q as $h,r as Kh,s as qh,t as Gh,u as Jh,v as Yh,w as Xh}from"./KernelVariables-BehGjCby.js";import"./index-Dlvxer3A.js";import{K as Zh,L as Qh,W as ef,a as tf}from"./renderer-BTUDFH3O.js";import{S as nf}from"./SortAscIcon-CmH04s3F.js";import{S as sf}from"./SortDescIcon-Qif6E10I.js";import{b as rf,N as of,a as af,u as lf}from"./NotebookToolbar-C1fpK-Vi.js";import{S as cf,B as df,C as uf,b as hf,K as ff,I as mf,e as pf,a as _f,c as gf}from"./sessions-B0EUsrzs.js";import{B as yf,C as bf,b as vf,a as wf,c as Cf,D as Ef,d as xf,e as Tf,f as Sf,F as Pf,S as Af,g as Rf,h as If,i as Lf}from"./drivecontents-BcDwFJVW.js";import{I as Of,W as kf,F as Ff,a as Mf,c as Df,M as Nf,e as jf,b as Bf,d as Wf}from"./tokens-S2kPhk0a.js";import{B as Hf}from"./kernel-e4A2ECtn.js";var li={ConfirmationHeader:"prc-ConfirmationDialog-ConfirmationHeader-yiLEc",ConfirmationBody:"prc-ConfirmationDialog-ConfirmationBody-ht9P-",ConfirmationFooter:"prc-ConfirmationDialog-ConfirmationFooter-AqKBI"};const uo=({title:s,onClose:e,dialogLabelId:t})=>{const n=R.useCallback(()=>{e("close-button")},[e]);return f.jsxs("div",{className:li.ConfirmationHeader,children:[f.jsx("h1",{id:t,children:s}),f.jsx(Xs.CloseButton,{onClose:n})]})};uo.displayName="ConfirmationHeader";const ho=({children:s})=>f.jsx("div",{className:li.ConfirmationBody,children:s});ho.displayName="ConfirmationBody";const fo=({footerButtons:s})=>{const{containerRef:e}=yr({bindKeys:bt.ArrowHorizontal|bt.Tab,focusInStrategy:"closest"});return f.jsx("div",{ref:e,className:li.ConfirmationFooter,children:f.jsx(Xs.Buttons,{buttons:s??[]})})};fo.displayName="ConfirmationFooter";const ci=s=>{const{onClose:e,title:t,cancelButtonContent:n="Cancel",confirmButtonContent:i="OK",confirmButtonType:r="normal",children:o,className:a,width:l="medium",height:c}=s,d=R.useCallback(()=>{e("cancel")},[e]),u=R.useCallback(()=>{e("confirm")},[e]),h=r==="danger",b=[{content:n,onClick:d,autoFocus:h},{content:i,buttonType:r,onClick:u,autoFocus:!h}];return f.jsx(Xs,{onClose:e,title:t,footerButtons:b,role:"alertdialog",width:l,height:c,className:a,renderHeader:uo,renderBody:ho,renderFooter:fo,children:o})};ci.displayName="ConfirmationDialog";function Vf(s,e,t,n,i){const r={type:"PREV",num:e-1,disabled:e===1},o={type:"NEXT",num:e+1,disabled:e===s};if(!t)return[r,o];if(s<=0)return[r,{...o,disabled:!0}];const a=[],l=i+n,c=l+l+3;if(s<=c)return p(1,s,!1),[r,...a,o];let d=0,u=0;e-l-1<=1?u=e-l-2:d=e-l-1;let h=0,m=0;s-e-l<=1?m=s-e-l-1:h=s-e-l;const _=d>0,b=h>0;return p(1,n,_),_&&g(n),p(n+d+m+1,s-u-h-n,b),b&&g(s-u-h-n),p(s-n+1,s),[r,...a,o];function g(w){a.push({type:"BREAK",num:w+1})}function p(w,v,y=!1){for(let C=w;C<=v;C++)a.push({type:"NUM",num:C,selected:C===e,precedesBreak:C===v&&y})}}var he={TreeViewRootUlStyles:"prc-TreeView-TreeViewRootUlStyles-eZtxW",TreeViewItem:"prc-TreeView-TreeViewItem-ShJr0",TreeViewItemContainer:"prc-TreeView-TreeViewItemContainer--2Rkn",TreeViewItemSkeleton:"prc-TreeView-TreeViewItemSkeleton-fqk59",TreeViewItemToggle:"prc-TreeView-TreeViewItemToggle-gWUdE",TreeViewItemToggleHover:"prc-TreeView-TreeViewItemToggleHover-nEgP-",TreeViewItemToggleEnd:"prc-TreeView-TreeViewItemToggleEnd-t-AEB",TreeViewItemContent:"prc-TreeView-TreeViewItemContent-f0r0b",TreeViewItemContentText:"prc-TreeView-TreeViewItemContentText-smZM-",TreeViewItemVisual:"prc-TreeView-TreeViewItemVisual-dRlGq",TreeViewItemLeadingAction:"prc-TreeView-TreeViewItemLeadingAction-VXx8I",TreeViewItemLevelLine:"prc-TreeView-TreeViewItemLevelLine-KPSSL",TreeViewDirectoryIcon:"prc-TreeView-TreeViewDirectoryIcon-PHbeP",TreeViewVisuallyHidden:"prc-TreeView-TreeViewVisuallyHidden-4-mPv",TreeViewSkeletonItemContainerStyle:"prc-TreeView-TreeViewSkeletonItemContainerStyle-EB7p0",TreeItemSkeletonTextStyles:"prc-TreeView-TreeItemSkeletonTextStyles-wnBY9"};function zf({name:s="custom",defaultValue:e,value:t,onChange:n}){const[i,r]=T.useState(t??e),o=T.useRef(null),a=T.useRef(n);T.useEffect(()=>{a.current=n}),o.current===null&&(o.current=t!==void 0);const l=T.useCallback(c=>{var d;const u=typeof c=="function"?c(i):c;o.current===!1&&r(u),(d=a.current)===null||d===void 0||d.call(a,u)},[i]);return T.useEffect(()=>{const c=t!==void 0;o.current,o.current},[s,t]),o.current===!0?[t,l]:[i,l]}function xn(s){var e,t,n;const i=s.getAttribute("aria-label"),r=s.getAttribute("aria-labelledby");return i||(r?(e=(t=document.getElementById(r))===null||t===void 0?void 0:t.textContent)!==null&&e!==void 0?e:"":(n=s.textContent)!==null&&n!==void 0?n:"")}function mo(s){return!s||s===document.body?null:Uf(s)?s:mo(s.parentElement)}function Uf(s){return s.scrollHeight>s.clientHeight&&window.getComputedStyle(s).overflowY.indexOf("hidden")===-1}function $f(s){const e=W.c(6),{containerRef:t,mouseDownRef:n}=s;let i;e[0]!==t||e[1]!==n?(i=()=>{var o,a,l;if(n.current)return;const c=(o=t.current)===null||o===void 0?void 0:o.querySelector("[aria-current]"),d=(a=t.current)===null||a===void 0?void 0:a.querySelector('[role="treeitem"]');return c instanceof HTMLElement?c:document.activeElement instanceof HTMLElement&&(l=t.current)!==null&&l!==void 0&&l.contains(document.activeElement)&&document.activeElement.getAttribute("role")==="treeitem"?document.activeElement:d instanceof HTMLElement?d:void 0},e[0]=t,e[1]=n,e[2]=i):i=e[2];let r;e[3]!==t||e[4]!==i?(r={containerRef:t,bindKeys:bt.ArrowVertical|bt.ArrowHorizontal|bt.HomeAndEnd|bt.Backspace|bt.PageUpDown,preventScroll:!0,getNextFocusable:Kf,focusInStrategy:i},e[3]=t,e[4]=i,e[5]=r):r=e[5],yr(r)}function Kf(s,e,t){var n;if(e instanceof HTMLElement){try{if(e.closest("dialog:modal"))return}catch{}return(n=qf(e,t))!==null&&n!==void 0?n:e}}function qf(s,e){switch(`${Gf(s)} ${e.key}`){case"open ArrowRight":return po(s);case"open ArrowLeft":return;case"closed ArrowRight":return;case"closed ArrowLeft":return ss(s);case"end ArrowRight":return;case"end ArrowLeft":return ss(s)}switch(e.key){case"ArrowUp":return ji(s,"previous");case"ArrowDown":return ji(s,"next");case"Backspace":return ss(s);case"Home":return Jf(s);case"End":return Yf(s);case"PageUp":return Qf(s);case"PageDown":return Zf(s)}}function Gf(s){if(s.getAttribute("role")!=="treeitem")throw new Error("Element is not a treeitem");switch(s.getAttribute("aria-expanded")){case"true":return"open";case"false":return"closed";default:return"end"}}function ji(s,e){const t=s.closest("[role=tree]");if(!t)return;const n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,a=>a instanceof HTMLElement&&a.getAttribute("role")==="treeitem"?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP);let i=n.firstChild();for(;i!==s;)i=n.nextNode();let r=e==="next"?n.nextNode():n.previousNode();for(;r instanceof HTMLElement&&(o=r.parentElement)!==null&&o!==void 0&&o.closest("[role=treeitem][aria-expanded=false]");){var o;r=e==="next"?n.nextNode():n.previousNode()}return r instanceof HTMLElement?r:void 0}function po(s){const e=s.querySelector("[role=treeitem]");return e instanceof HTMLElement?e:void 0}function ss(s){const e=s.closest("[role=group]"),t=e?.closest("[role=treeitem]");return t instanceof HTMLElement?t:void 0}function Jf(s){const e=s.closest("[role=tree]"),t=e?.querySelector("[role=treeitem]");return t instanceof HTMLElement?t:void 0}function Yf(s){const e=s.closest("[role=tree]"),t=Array.from(e?.querySelectorAll("[role=treeitem]")||[]);if(t.length===0)return;let n=t.length-1,i=t[n];for(;n>0&&i instanceof HTMLElement&&(r=i.parentElement)!==null&&r!==void 0&&r.closest("[role=treeitem][aria-expanded=false]");){var r;n-=1,i=t[n]}return i instanceof HTMLElement?i:void 0}const Xf={height:32};function _o(s,e){var t,n;const i=mo(s),{height:r}=(t=e?.getBoundingClientRect())!==null&&t!==void 0?t:Xf,o=(n=i?.clientHeight)!==null&&n!==void 0?n:window.innerHeight;return Math.floor(o/r)}function Zf(s){const e=s.closest('[role="tree"]');if(!e)return;const t=Array.from(e.querySelectorAll('[role="treeitem"]'));if(t.length===0)return;const n=t[0].firstElementChild,i=_o(e,n),r=Math.floor(t.indexOf(s)/i),o=t.indexOf(s)-i*r;return t[Math.min(t.length-1,(r+1)*i+o)]}function Qf(s){const e=s.closest('[role="tree"]');if(!e)return;const t=Array.from(e.querySelectorAll('[role="treeitem"]'));if(t.length===0)return;const n=t[0].firstElementChild,i=_o(e,n),r=Math.floor(t.indexOf(s)/i),o=t.indexOf(s)-i*r;return t[Math.max(0,(r-1)*i+o)]}function em(s){const e=W.c(11),{containerRef:t,onFocusChange:n}=s,i=T.useRef(""),r=T.useRef(0),o=T.useRef(n),{safeSetTimeout:a,safeClearTimeout:l}=br();let c,d;e[0]!==n?(c=()=>{o.current=n},d=[n],e[0]=n,e[1]=c,e[2]=d):(c=e[1],d=e[2]),T.useEffect(c,d);let u;e[3]!==t?(u=b=>{if(!b||!t.current)return;const g=t.current,p=Array.from(g.querySelectorAll('[role="treeitem"]')),w=p.findIndex(tm);let v=nm(p,w);b.length===1&&(v=v.slice(1));const y=v.find(C=>xn(C).toLowerCase().startsWith(b.toLowerCase()));y&&o.current(y)},e[3]=t,e[4]=u):u=e[4];const h=u;let m,_;e[5]!==t||e[6]!==h||e[7]!==l||e[8]!==a?(m=()=>{if(!t.current)return;const b=t.current,g=function(w){!w.key||w.key.length>1||w.key===" "||w.ctrlKey||w.altKey||w.metaKey||(i.current=i.current+w.key,h(i.current),l(r.current),r.current=a(()=>i.current="",300),w.preventDefault(),w.stopPropagation())};return b.addEventListener("keydown",g),()=>b.removeEventListener("keydown",g)},_=[t,h,l,a],e[5]=t,e[6]=h,e[7]=l,e[8]=a,e[9]=m,e[10]=_):(m=e[9],_=e[10]),T.useEffect(m,_)}function tm(s){return s===document.activeElement}function nm(s,e){return s.map((t,n)=>s[(e+n)%s.length])}const di=T.createContext({announceUpdate:()=>{},expandedStateCache:{current:new Map}}),_t=T.createContext({itemId:"",level:1,isSubTreeEmpty:!1,setIsSubTreeEmpty:()=>{},isExpanded:!1,setIsExpanded:()=>{},leadingVisualId:"",trailingVisualId:""}),Bi=12,go=s=>{const e=W.c(23),{"aria-label":t,"aria-labelledby":n,children:i,flat:r,truncate:o,className:a,style:l}=s,c=o===void 0?!0:o,d=T.useRef(null),u=T.useRef(!1),[h,m]=T.useState("");let _;e[0]===Symbol.for("react.memo_cache_sentinel")?(_=j=>{m(j)},e[0]=_):_=e[0];const b=_;let g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{u.current=!0},e[1]=g):g=e[1];const p=g;let w,v;e[2]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{const j=function(){u.current=!1};return document.addEventListener("mouseup",j),()=>{document.removeEventListener("mouseup",j)}},v=[],e[2]=w,e[3]=v):(w=e[2],v=e[3]),R.useEffect(w,v);let y;e[4]===Symbol.for("react.memo_cache_sentinel")?(y={containerRef:d,mouseDownRef:u},e[4]=y):y=e[4],$f(y);let C;e[5]===Symbol.for("react.memo_cache_sentinel")?(C={containerRef:d,onFocusChange:hm},e[5]=C):C=e[5],em(C);const E=T.useRef(null);if(E.current===null){let j;e[6]===Symbol.for("react.memo_cache_sentinel")?(j=new Map,e[6]=j):j=e[6],E.current=j}let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x={announceUpdate:b,expandedStateCache:E},e[7]=x):x=e[7];let S;e[8]!==h?(S=f.jsx(Zs,{role:"status","aria-live":"polite","aria-atomic":"true",children:h}),e[8]=h,e[9]=S):S=e[9];const A=c||!1;let I;e[10]!==a?(I=N(a,he.TreeViewRootUlStyles),e[10]=a,e[11]=I):I=e[11];let P;e[12]!==t||e[13]!==n||e[14]!==i||e[15]!==r||e[16]!==l||e[17]!==A||e[18]!==I?(P=f.jsx("ul",{ref:d,role:"tree","aria-label":t,"aria-labelledby":n,"data-omit-spacer":r,"data-truncate-text":A,onMouseDown:p,className:I,style:l,children:i}),e[12]=t,e[13]=n,e[14]=i,e[15]=r,e[16]=l,e[17]=A,e[18]=I,e[19]=P):P=e[19];let D;return e[20]!==P||e[21]!==S?(D=f.jsx(di.Provider,{value:x,children:f.jsxs(f.Fragment,{children:[S,P]})}),e[20]=P,e[21]=S,e[22]=D):D=e[22],D};go.displayName="TreeView";const rn=T.forwardRef(({id:s,containIntrinsicSize:e,current:t=!1,defaultExpanded:n,expanded:i,onExpandedChange:r,onSelect:o,children:a,className:l,"aria-label":c,"aria-labelledby":d},u)=>{const[h,m]=Ta(a,{leadingAction:hi,leadingVisual:Gn,trailingVisual:ui}),{expandedStateCache:_}=T.useContext(di),b=Zt(),g=Zt(),p=Zt(),[w,v]=zf({name:s,defaultValue:()=>{var L,M,z;return(L=(M=(z=_.current)===null||z===void 0?void 0:z.get(s))!==null&&M!==void 0?M:n)!==null&&L!==void 0?L:t},value:i===null?!1:i,onChange:r}),{level:y}=T.useContext(_t),{hasSubTree:C,subTree:E,childrenWithoutSubTree:x}=lm(m),[S,A]=T.useState(!C),[I,P]=T.useState(!1),D=T.useCallback(L=>{var M;v(L),(M=_.current)===null||M===void 0||M.set(s,L)},[s,v,_]),j=T.useCallback(L=>{D(!w),L?.stopPropagation()},[w,D]),H=T.useCallback(L=>{switch(L.key){case"Enter":case" ":o?o(L):j(L),L.stopPropagation();break;case"ArrowRight":if(L.altKey||L.metaKey)return;L.preventDefault(),L.stopPropagation(),D(!0);break;case"ArrowLeft":if(L.altKey||L.metaKey)return;L.preventDefault(),L.stopPropagation(),D(!1);break}},[o,D,j]),$=[h.leadingVisual?g:null,h.trailingVisual?p:null].filter(Boolean);return f.jsx(_t.Provider,{value:{itemId:s,level:y+1,isSubTreeEmpty:S,setIsSubTreeEmpty:A,isExpanded:w,setIsExpanded:D,leadingVisualId:g,trailingVisualId:p},children:f.jsxs("li",{className:N("PRIVATE_TreeView-item",l,he.TreeViewItem),ref:u,tabIndex:0,id:s,role:"treeitem","aria-label":c,"aria-labelledby":c?void 0:d||b,"aria-describedby":$.length?$.join(" "):void 0,"aria-level":y,"aria-expanded":S&&(!w||!C)||i===null?void 0:w,"aria-current":t?"true":void 0,"aria-selected":I?"true":"false","data-has-leading-action":h.leadingAction?!0:void 0,onKeyDown:H,onFocus:L=>{var M;(M=L.currentTarget.firstElementChild)===null||M===void 0||M.scrollIntoView({block:"nearest",inline:"nearest"}),P(!0),L.stopPropagation()},onBlur:()=>P(!1),onClick:L=>{o?o(L):j(L),L.stopPropagation()},onAuxClick:L=>{o&&L.button===1&&o(L),L.stopPropagation()},children:[f.jsxs("div",{className:N("PRIVATE_TreeView-item-container",he.TreeViewItemContainer),style:{"--level":y,contentVisibility:e?"auto":void 0,containIntrinsicSize:e},children:[f.jsx("div",{style:{gridArea:"spacer",display:"flex"},children:f.jsx(sm,{level:y})}),h.leadingAction,C?f.jsx("div",{className:N("PRIVATE_TreeView-item-toggle",o&&"PRIVATE_TreeView-item-toggle--hover",y===1&&"PRIVATE_TreeView-item-toggle--end",he.TreeViewItemToggle,he.TreeViewItemToggleHover,he.TreeViewItemToggleEnd),onClick:L=>{o&&j(L)},children:w?f.jsx(Sa,{size:Bi}):f.jsx(vr,{size:Bi})}):null,f.jsxs("div",{id:b,className:N("PRIVATE_TreeView-item-content",he.TreeViewItemContent),children:[h.leadingVisual,f.jsx("span",{className:N("PRIVATE_TreeView-item-content-text",he.TreeViewItemContentText),children:x}),h.trailingVisual]})]}),E]})})}),sm=s=>{const e=W.c(3),{level:t}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={width:"100%",display:"flex"},e[0]=n):n=e[0];let i;return e[1]!==t?(i=f.jsx("div",{style:n,children:Array.from({length:t-1}).map(bo)}),e[1]=t,e[2]=i):i=e[2],i};rn.displayName="TreeView.Item";const qn=s=>{const e=W.c(29),{count:t,state:n,children:i,"aria-label":r}=s,{announceUpdate:o}=T.useContext(di),{itemId:a,isExpanded:l,isSubTreeEmpty:c,setIsSubTreeEmpty:d}=T.useContext(_t),u=T.useRef(null),h=T.useRef(null),[m,_]=T.useState(!1),[b,g]=T.useState(""),p=im(n),{safeSetTimeout:w}=br();let v,y;e[0]!==i||e[1]!==c||e[2]!==d||e[3]!==n?(v=()=>{(n===void 0||n==="done")&&(!c&&!i?d(!0):c&&i&&d(!1))},y=[n,c,d,i],e[0]=i,e[1]=c,e[2]=d,e[3]=n,e[4]=v,e[5]=y):(v=e[4],y=e[5]),T.useEffect(v,y);let C,E;e[6]!==o||e[7]!==a||e[8]!==m||e[9]!==p||e[10]!==w||e[11]!==n?(C=()=>{const H=document.getElementById(a);if(H){if(g(xn(H)),p==="loading"&&n==="done"){var $;const L=xn(H);if(($=h.current)!==null&&$!==void 0&&$.childElementCount?o(`${L} content loaded`):o(`${L} is empty`),m){const M=po(H);w(M?()=>{M.focus()}:()=>{H.focus()}),_(!1)}}else if(n==="loading"){const L=xn(H);o(`${L} content loading`)}}},E=[m,p,n,a,o,h,w],e[6]=o,e[7]=a,e[8]=m,e[9]=p,e[10]=w,e[11]=n,e[12]=C,e[13]=E):(C=e[12],E=e[13]),T.useEffect(C,E);let x;e[14]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{const H=function(){_(!0)},$=function(z){z.relatedTarget&&_(!1)},L=u.current;if(L)return L.addEventListener("focus",H),L.addEventListener("blur",$),()=>{L.removeEventListener("focus",H),L.removeEventListener("blur",$)}},e[14]=x):x=e[14];let S;if(e[15]!==n?(S=[u,n],e[15]=n,e[16]=S):S=e[16],T.useEffect(x,S),!l)return null;let A;e[17]===Symbol.for("react.memo_cache_sentinel")?(A={listStyle:"none",padding:0,margin:0},e[17]=A):A=e[17];const I=r||b;let P;e[18]!==i||e[19]!==t||e[20]!==n?(P=n==="loading"?f.jsx(om,{ref:u,count:t}):i,e[18]=i,e[19]=t,e[20]=n,e[21]=P):P=e[21];let D;e[22]!==c||e[23]!==n?(D=c&&n!=="loading"?f.jsx(am,{}):null,e[22]=c,e[23]=n,e[24]=D):D=e[24];let j;return e[25]!==D||e[26]!==I||e[27]!==P?(j=f.jsxs("ul",{role:"group",style:A,ref:h,"aria-label":I,children:[P,D]}),e[25]=D,e[26]=I,e[27]=P,e[28]=j):j=e[28],j};qn.displayName="TreeView.SubTree";function im(s){const e=T.useRef(s);return T.useEffect(()=>{e.current=s},[s]),e.current}const rm=()=>{const s=W.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=f.jsxs("span",{className:N(he.TreeViewSkeletonItemContainerStyle,he.TreeViewItemSkeleton,"PRIVATE_TreeView-item-skeleton"),children:[f.jsx(zu,{size:16,square:!0}),f.jsx(wr,{className:he.TreeItemSkeletonTextStyles})]}),s[0]=e):e=s[0],e},om=T.forwardRef((s,e)=>{const t=W.c(15),{count:n}=s,i=Zt();if(n){let l;t[0]!==n?(l=Array.from({length:n}).map(vo),t[0]=n,t[1]=l):l=t[1];let c;t[2]===Symbol.for("react.memo_cache_sentinel")?(c=N("PRIVATE_VisuallyHidden",he.TreeViewVisuallyHidden),t[2]=c):c=t[2];let d;t[3]!==n?(d=f.jsxs("div",{className:c,children:["Loading ",n," items"]}),t[3]=n,t[4]=d):d=t[4];let u;return t[5]!==i||t[6]!==e||t[7]!==l||t[8]!==d?(u=f.jsxs(rn,{id:i,ref:e,children:[l,d]}),t[5]=i,t[6]=e,t[7]=l,t[8]=d,t[9]=u):u=t[9],u}let r,o;t[10]===Symbol.for("react.memo_cache_sentinel")?(r=f.jsx(Gn,{children:f.jsx(sn,{size:"small"})}),o=f.jsx(be,{className:"fgColor-muted",children:"Loading..."}),t[10]=r,t[11]=o):(r=t[10],o=t[11]);let a;return t[12]!==i||t[13]!==e?(a=f.jsxs(rn,{id:i,ref:e,children:[r,o]}),t[12]=i,t[13]=e,t[14]=a):a=t[14],a}),am=T.forwardRef((s,e)=>{const t=W.c(4),n=Zt();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=f.jsx(be,{className:"fgColor-muted",children:"No items found"}),t[0]=i):i=t[0];let r;return t[1]!==e||t[2]!==n?(r=f.jsx(rn,{expanded:null,id:n,ref:e,children:i}),t[1]=e,t[2]=n,t[3]=r):r=t[3],r});function lm(s){const e=W.c(8);let t,n;e[0]!==s?(n=T.Children.toArray(s).find(dm),e[0]=s,e[1]=n):n=e[1];const i=n;let r;e[2]!==s?(r=T.Children.toArray(s).filter(cm),e[2]=s,e[3]=r):r=e[3];const o=r,a=!!i;let l;return e[4]!==o||e[5]!==i||e[6]!==a?(l={subTree:i,childrenWithoutSubTree:o,hasSubTree:a},e[4]=o,e[5]=i,e[6]=a,e[7]=l):l=e[7],t=l,t}function cm(s){return!(T.isValidElement(s)&&s.type===qn)}function dm(s){return T.isValidElement(s)&&s.type===qn}const Gn=s=>{const e=W.c(13),{isExpanded:t,leadingVisualId:n}=T.useContext(_t);let i;e[0]!==t||e[1]!==s.children?(i=typeof s.children=="function"?s.children({isExpanded:t}):s.children,e[0]=t,e[1]=s.children,e[2]=i):i=e[2];const r=i;let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=N("PRIVATE_VisuallyHidden",he.TreeViewVisuallyHidden),e[3]=o):o=e[3];let a;e[4]!==n||e[5]!==s.label?(a=f.jsx("div",{className:o,"aria-hidden":!0,id:n,children:s.label}),e[4]=n,e[5]=s.label,e[6]=a):a=e[6];let l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l=N("PRIVATE_TreeView-item-visual",he.TreeViewItemVisual),e[7]=l):l=e[7];let c;e[8]!==r?(c=f.jsx("div",{className:l,"aria-hidden":!0,children:r}),e[8]=r,e[9]=c):c=e[9];let d;return e[10]!==a||e[11]!==c?(d=f.jsxs(f.Fragment,{children:[a,c]}),e[10]=a,e[11]=c,e[12]=d):d=e[12],d};Gn.displayName="TreeView.LeadingVisual";const ui=s=>{const e=W.c(13),{isExpanded:t,trailingVisualId:n}=T.useContext(_t);let i;e[0]!==t||e[1]!==s.children?(i=typeof s.children=="function"?s.children({isExpanded:t}):s.children,e[0]=t,e[1]=s.children,e[2]=i):i=e[2];const r=i;let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=N("PRIVATE_VisuallyHidden",he.TreeViewVisuallyHidden),e[3]=o):o=e[3];let a;e[4]!==s.label||e[5]!==n?(a=f.jsx("div",{className:o,"aria-hidden":!0,id:n,children:s.label}),e[4]=s.label,e[5]=n,e[6]=a):a=e[6];let l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l=N("PRIVATE_TreeView-item-visual",he.TreeViewItemVisual),e[7]=l):l=e[7];let c;e[8]!==r?(c=f.jsx("div",{className:l,"aria-hidden":!0,children:r}),e[8]=r,e[9]=c):c=e[9];let d;return e[10]!==a||e[11]!==c?(d=f.jsxs(f.Fragment,{children:[a,c]}),e[10]=a,e[11]=c,e[12]=d):d=e[12],d};ui.displayName="TreeView.TrailingVisual";const hi=s=>{const e=W.c(12),{isExpanded:t}=T.useContext(_t);let n;e[0]!==t||e[1]!==s.children?(n=typeof s.children=="function"?s.children({isExpanded:t}):s.children,e[0]=t,e[1]=s.children,e[2]=n):n=e[2];const i=n;let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=N("PRIVATE_VisuallyHidden",he.TreeViewVisuallyHidden),e[3]=r):r=e[3];let o;e[4]!==s.label?(o=f.jsx("div",{className:r,"aria-hidden":!0,children:s.label}),e[4]=s.label,e[5]=o):o=e[5];let a;e[6]===Symbol.for("react.memo_cache_sentinel")?(a=N("PRIVATE_TreeView-item-leading-action",he.TreeViewItemLeadingAction),e[6]=a):a=e[6];let l;e[7]!==i?(l=f.jsx("div",{className:a,"aria-hidden":!0,children:i}),e[7]=i,e[8]=l):l=e[8];let c;return e[9]!==o||e[10]!==l?(c=f.jsxs(f.Fragment,{children:[o,l]}),e[9]=o,e[10]=l,e[11]=c):c=e[11],c};hi.displayName="TreeView.LeadingAction";const um=()=>{const s=W.c(3),{isExpanded:e}=T.useContext(_t),t=e?lh:ch;let n;s[0]===Symbol.for("react.memo_cache_sentinel")?(n=N("PRIVATE_TreeView-directory-icon",he.TreeViewDirectoryIcon),s[0]=n):n=s[0];let i;return s[1]!==t?(i=f.jsx("div",{className:n,children:f.jsx(t,{})}),s[1]=t,s[2]=i):i=s[2],i},yo=s=>{const e=W.c(9),{title:t,children:n,onRetry:i,onDismiss:r}=s,o=t===void 0?"Error":t,{itemId:a,setIsExpanded:l}=T.useContext(_t);let c;e[0]!==a||e[1]!==r||e[2]!==i||e[3]!==l?(c=u=>{setTimeout(()=>{const h=document.getElementById(a);h?.focus()}),u==="confirm"?i?.():(l(!1),r?.())},e[0]=a,e[1]=r,e[2]=i,e[3]=l,e[4]=c):c=e[4];let d;return e[5]!==n||e[6]!==c||e[7]!==o?(d=f.jsx("div",{onKeyDown:fm,children:f.jsx(ci,{title:o,onClose:c,confirmButtonContent:"Retry",cancelButtonContent:"Dismiss",children:n})}),e[5]=n,e[6]=c,e[7]=o,e[8]=d):d=e[8],d};yo.displayName="TreeView.ErrorDialog";const Qe=Object.assign(go,{Item:rn,SubTree:qn,LeadingAction:hi,LeadingVisual:Gn,TrailingVisual:ui,DirectoryIcon:um,ErrorDialog:yo});function hm(s){s instanceof HTMLElement&&s.focus()}function bo(s,e){return f.jsx("div",{className:N("PRIVATE_TreeView-item-level-line",he.TreeViewItemLevelLine)},e)}bo.displayName="_temp2";function vo(s,e){return f.jsx(rm,{"aria-hidden":!0},e)}vo.displayName="_temp3";function fm(s){["Backspace","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Enter"].includes(s.key)&&s.stopPropagation()}function mm(s){if("narrow"in s&&"regular"in s&&"wide"in s){const e=Object.values(s);return e.every(t=>t===e[0])}return!1}function pm(s){return"regular"in s&&"wide"in s?s.regular===s.wide:!1}var Se={PageHeader:"prc-PageHeader-PageHeader-sT1Hp",ContextArea:"prc-PageHeader-ContextArea-6ykSJ",ParentLink:"prc-PageHeader-ParentLink-BvDS0",ContextBar:"prc-PageHeader-ContextBar-XQ8Q0",ContextAreaActions:"prc-PageHeader-ContextAreaActions-RTJRk",TitleArea:"prc-PageHeader-TitleArea-jxJZy",LeadingAction:"prc-PageHeader-LeadingAction-88LQ0",Breadcrumbs:"prc-PageHeader-Breadcrumbs-3c6ig",LeadingVisual:"prc-PageHeader-LeadingVisual-7zjCx",Title:"prc-PageHeader-Title-LKOsd",TrailingVisual:"prc-PageHeader-TrailingVisual-7Ft0D",TrailingAction:"prc-PageHeader-TrailingAction-QOaow",Actions:"prc-PageHeader-Actions-ygtmj",Description:"prc-PageHeader-Description-kFg8r",Navigation:"prc-PageHeader-Navigation-9Uvch"};const Jn={narrow:!1,regular:!0,wide:!0},wo={narrow:!0,regular:!1,wide:!1},_m=T.forwardRef((s,e)=>{const t=W.c(15),{children:n,className:i,sx:r,as:o,"aria-label":a,role:l,hasBorder:c}=s,d=r===void 0?Te:r,u=o===void 0?"div":o,h=Cr(e);let m,_;t[0]!==n||t[1]!==h?(m=function(){},_=[n,h],t[0]=n,t[1]=h,t[2]=m,t[3]=_):(m=t[2],_=t[3]),R.useEffect(m,_);let b;t[4]!==i?(b=N(Se.PageHeader,i),t[4]=i,t[5]=b):b=t[5];const g=c?"true":void 0;let p;return t[6]!==a||t[7]!==u||t[8]!==n||t[9]!==l||t[10]!==h||t[11]!==d||t[12]!==b||t[13]!==g?(p=f.jsx(Re,{as:u,ref:h,className:b,"data-has-border":g,sx:d,"aria-label":a,role:l,children:n}),t[6]=a,t[7]=u,t[8]=n,t[9]=l,t[10]=h,t[11]=d,t[12]=b,t[13]=g,t[14]=p):p=t[14],p}),gm=s=>{const e=W.c(9),{children:t,className:n,hidden:i,sx:r}=s,o=i===void 0?Jn:i,a=r===void 0?Te:r;let l;e[0]!==n?(l=N(Se.ContextArea,n),e[0]=n,e[1]=l):l=e[1];let c;e[2]!==o?(c=xe(o),e[2]=o,e[3]=c):c=e[3];let d;return e[4]!==t||e[5]!==a||e[6]!==l||e[7]!==c?(d=f.jsx(Re,{className:l,sx:a,...c,children:t}),e[4]=t,e[5]=a,e[6]=l,e[7]=c,e[8]=d):d=e[8],d},Co=T.forwardRef((s,e)=>{const t=W.c(16),{children:n,className:i,sx:r,href:o,"aria-label":a,as:l,hidden:c}=s,d=r===void 0?Te:r,u=l===void 0?"a":l,h=c===void 0?Jn:c;let m;t[0]!==i?(m=N(Se.ParentLink,i),t[0]=i,t[1]=m):m=t[1];let _;t[2]!==h?(_=xe(h),t[2]=h,t[3]=_):_=t[3];let b;t[4]===Symbol.for("react.memo_cache_sentinel")?(b=f.jsx(yh,{}),t[4]=b):b=t[4];let g;t[5]!==n?(g=f.jsx("div",{children:n}),t[5]=n,t[6]=g):g=t[6];let p;return t[7]!==a||t[8]!==u||t[9]!==o||t[10]!==e||t[11]!==d||t[12]!==m||t[13]!==_||t[14]!==g?(p=f.jsx(f.Fragment,{children:f.jsxs(gs,{ref:e,as:u,"aria-label":a,muted:!0,className:m,sx:d,..._,href:o,children:[b,g]})}),t[7]=a,t[8]=u,t[9]=o,t[10]=e,t[11]=d,t[12]=m,t[13]=_,t[14]=g,t[15]=p):p=t[15],p});Co.displayName="ParentLink";const ym=s=>{const e=W.c(9),{children:t,className:n,sx:i,hidden:r}=s,o=i===void 0?Te:i,a=r===void 0?Jn:r;let l;e[0]!==n?(l=N(Se.ContextBar,n),e[0]=n,e[1]=l):l=e[1];let c;e[2]!==a?(c=xe(a),e[2]=a,e[3]=c):c=e[3];let d;return e[4]!==t||e[5]!==o||e[6]!==l||e[7]!==c?(d=f.jsx(Re,{className:l,sx:o,...c,children:t}),e[4]=t,e[5]=o,e[6]=l,e[7]=c,e[8]=d):d=e[8],d},bm=s=>{const e=W.c(12),{children:t,className:n,sx:i,hidden:r}=s,o=i===void 0?Te:i,a=r===void 0?Jn:r;let l;e[0]!==n?(l=N(Se.ContextAreaActions,n),e[0]=n,e[1]=l):l=e[1];let c;e[2]!==a?(c=xe(a),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==a?(d=xe(a),e[4]=a,e[5]=d):d=e[5];let u;return e[6]!==t||e[7]!==o||e[8]!==l||e[9]!==c||e[10]!==d?(u=f.jsx(Re,{className:l,...c,sx:o,...d,children:t}),e[6]=t,e[7]=o,e[8]=l,e[9]=c,e[10]=d,e[11]=u):u=e[11],u},Eo=T.forwardRef((s,e)=>{const t=W.c(11),{children:n,className:i,sx:r,hidden:o,variant:a}=s,l=r===void 0?Te:r,c=o===void 0?!1:o,d=a===void 0?"medium":a,u=Cr(e),h=Pa(d,"medium");let m;t[0]!==i?(m=N(Se.TitleArea,i),t[0]=i,t[1]=m):m=t[1];let _;t[2]!==c?(_=xe(c),t[2]=c,t[3]=_):_=t[3];let b;return t[4]!==n||t[5]!==h||t[6]!==l||t[7]!==m||t[8]!==_||t[9]!==u?(b=f.jsx(Re,{className:m,ref:u,"data-component":"TitleArea","data-size-variant":h,sx:l,..._,children:n}),t[4]=n,t[5]=h,t[6]=l,t[7]=m,t[8]=_,t[9]=u,t[10]=b):b=t[10],b});Eo.displayName="TitleArea";const vm=s=>{const e=W.c(12),{children:t,className:n,sx:i,hidden:r}=s,o=i===void 0?Te:i,a=r===void 0?wo:r;let l;if(e[0]!==o){l={};const{height:h}=o;h&&(l["--custom-height"]=h),e[0]=o,e[1]=l}else l=e[1];let c;e[2]!==n?(c=N(Se.LeadingAction,n),e[2]=n,e[3]=c):c=e[3];let d;e[4]!==a?(d=xe(a),e[4]=a,e[5]=d):d=e[5];let u;return e[6]!==t||e[7]!==l||e[8]!==o||e[9]!==c||e[10]!==d?(u=f.jsx(Re,{className:c,"data-component":"PH_LeadingAction",sx:o,style:l,...d,children:t}),e[6]=t,e[7]=l,e[8]=o,e[9]=c,e[10]=d,e[11]=u):u=e[11],u},wm=s=>{const e=W.c(9),{children:t,className:n,sx:i,hidden:r}=s,o=i===void 0?Te:i,a=r===void 0?!1:r;let l;e[0]!==n?(l=N(Se.Breadcrumbs,n),e[0]=n,e[1]=l):l=e[1];let c;e[2]!==a?(c=xe(a),e[2]=a,e[3]=c):c=e[3];let d;return e[4]!==t||e[5]!==o||e[6]!==l||e[7]!==c?(d=f.jsx(Re,{className:l,"data-component":"PH_Breadcrumbs",sx:o,...c,children:t}),e[4]=t,e[5]=o,e[6]=l,e[7]=c,e[8]=d):d=e[8],d},Cm=s=>{const e=W.c(12),{children:t,className:n,sx:i,hidden:r}=s,o=i===void 0?Te:i,a=r===void 0?!1:r;let l;if(e[0]!==o){l={};const{height:h}=o;h&&(l["--custom-height"]=h),e[0]=o,e[1]=l}else l=e[1];let c;e[2]!==n?(c=N(Se.LeadingVisual,n),e[2]=n,e[3]=c):c=e[3];let d;e[4]!==a?(d=xe(a),e[4]=a,e[5]=d):d=e[5];let u;return e[6]!==t||e[7]!==l||e[8]!==o||e[9]!==c||e[10]!==d?(u=f.jsx(Re,{className:c,"data-component":"PH_LeadingVisual",sx:o,style:l,...d,children:t}),e[6]=t,e[7]=l,e[8]=o,e[9]=c,e[10]=d,e[11]=u):u=e[11],u},Em=s=>{const e=W.c(14),{children:t,className:n,sx:i,hidden:r,as:o}=s,a=i===void 0?Te:i,l=r===void 0?!1:r,c=o===void 0?"h2":o;let d;if(e[0]!==a){d={};const{fontSize:_,lineHeight:b,fontWeight:g}=a;_&&(d["--custom-font-size"]=_),b&&(d["--custom-line-height"]=b),g&&(d["--custom-font-weight"]=g),e[0]=a,e[1]=d}else d=e[1];let u;e[2]!==n?(u=N(Se.Title,n),e[2]=n,e[3]=u):u=e[3];let h;e[4]!==l?(h=xe(l),e[4]=l,e[5]=h):h=e[5];let m;return e[6]!==c||e[7]!==t||e[8]!==l||e[9]!==d||e[10]!==a||e[11]!==u||e[12]!==h?(m=f.jsx(Er,{className:u,"data-component":"PH_Title","data-hidden":l,as:c,style:d,sx:a,...h,children:t}),e[6]=c,e[7]=t,e[8]=l,e[9]=d,e[10]=a,e[11]=u,e[12]=h,e[13]=m):m=e[13],m},xm=s=>{const e=W.c(12),{children:t,className:n,sx:i,hidden:r}=s,o=i===void 0?Te:i,a=r===void 0?!1:r;let l;if(e[0]!==o){l={};const{height:h}=o;h&&(l["--custom-height"]=h),e[0]=o,e[1]=l}else l=e[1];let c;e[2]!==n?(c=N(Se.TrailingVisual,n),e[2]=n,e[3]=c):c=e[3];let d;e[4]!==a?(d=xe(a),e[4]=a,e[5]=d):d=e[5];let u;return e[6]!==t||e[7]!==l||e[8]!==o||e[9]!==c||e[10]!==d?(u=f.jsx(Re,{className:c,"data-component":"PH_TrailingVisual",sx:o,style:l,...d,children:t}),e[6]=t,e[7]=l,e[8]=o,e[9]=c,e[10]=d,e[11]=u):u=e[11],u},Tm=s=>{const e=W.c(12),{children:t,className:n,sx:i,hidden:r}=s,o=i===void 0?Te:i,a=r===void 0?wo:r;let l;if(e[0]!==o){l={};const{height:h}=o;h&&(l["--custom-height"]=h),e[0]=o,e[1]=l}else l=e[1];let c;e[2]!==n?(c=N(Se.TrailingAction,n),e[2]=n,e[3]=c):c=e[3];let d;e[4]!==a?(d=xe(a),e[4]=a,e[5]=d):d=e[5];let u;return e[6]!==t||e[7]!==l||e[8]!==o||e[9]!==c||e[10]!==d?(u=f.jsx(Re,{className:c,"data-component":"PH_TrailingAction",sx:o,style:l,...d,children:t}),e[6]=t,e[7]=l,e[8]=o,e[9]=c,e[10]=d,e[11]=u):u=e[11],u},Sm=s=>{const e=W.c(12),{children:t,className:n,sx:i,hidden:r}=s,o=i===void 0?Te:i,a=r===void 0?!1:r;let l;if(e[0]!==o){l={};const{height:h}=o;h&&(l["--custom-height"]=h),e[0]=o,e[1]=l}else l=e[1];let c;e[2]!==n?(c=N(Se.Actions,n),e[2]=n,e[3]=c):c=e[3];let d;e[4]!==a?(d=xe(a),e[4]=a,e[5]=d):d=e[5];let u;return e[6]!==t||e[7]!==l||e[8]!==o||e[9]!==c||e[10]!==d?(u=f.jsx(Re,{className:c,"data-component":"PH_Actions",sx:o,style:l,...d,children:t}),e[6]=t,e[7]=l,e[8]=o,e[9]=c,e[10]=d,e[11]=u):u=e[11],u},Pm=s=>{const e=W.c(9),{children:t,className:n,sx:i,hidden:r}=s,o=i===void 0?Te:i,a=r===void 0?!1:r;let l;e[0]!==n?(l=N(Se.Description,n),e[0]=n,e[1]=l):l=e[1];let c;e[2]!==a?(c=xe(a),e[2]=a,e[3]=c):c=e[3];let d;return e[4]!==t||e[5]!==o||e[6]!==l||e[7]!==c?(d=f.jsx(Re,{className:l,sx:o,...c,children:t}),e[4]=t,e[5]=o,e[6]=l,e[7]=c,e[8]=d):d=e[8],d},Am=s=>{const e=W.c(12),{children:t,className:n,sx:i,hidden:r,as:o,"aria-label":a,"aria-labelledby":l}=s,c=i===void 0?Te:i,d=r===void 0?!1:r,u=o==="nav"?a:void 0,h=o==="nav"?l:void 0;let m;e[0]!==n?(m=N(Se.Navigation,n),e[0]=n,e[1]=m):m=e[1];let _;e[2]!==d?(_=xe(d),e[2]=d,e[3]=_):_=e[3];let b;return e[4]!==o||e[5]!==t||e[6]!==c||e[7]!==u||e[8]!==h||e[9]!==m||e[10]!==_?(b=f.jsx(Re,{as:o,"aria-label":u,"aria-labelledby":h,className:m,"data-component":"PH_Navigation",sx:c,..._,children:t}),e[4]=o,e[5]=t,e[6]=c,e[7]=u,e[8]=h,e[9]=m,e[10]=_,e[11]=b):b=e[11],b};function xe(s){if(Aa(s)){const e=s,t="narrow"in e?{"data-hidden-narrow":e.narrow||void 0}:{},n="regular"in e?{"data-hidden-regular":e.regular||void 0}:{},i="wide"in e?{"data-hidden-wide":e.wide||void 0}:{};return mm(e)?{"data-hidden-all":e.narrow||void 0}:pm(e)?{...t,...n}:{...t,...n,...i}}else return{"data-hidden-all":s||void 0}}const xo=Object.assign(_m,{ContextArea:gm,ParentLink:Co,ContextBar:ym,TitleArea:Eo,ContextAreaActions:bm,LeadingAction:vm,Breadcrumbs:wm,LeadingVisual:Cm,Title:Em,TrailingVisual:xm,TrailingAction:Tm,Actions:Sm,Description:Pm,Navigation:Am});xo.displayName="PageHeader";function Rm(s){const e=W.c(7),{title:t,children:n,onRetry:i,onDismiss:r}=s,o=t===void 0?"Error":t;let a;e[0]!==r||e[1]!==i?(a=c=>{c==="confirm"?i?.():r?.()},e[0]=r,e[1]=i,e[2]=a):a=e[2];let l;return e[3]!==n||e[4]!==a||e[5]!==o?(l=f.jsx(ci,{title:o,onClose:a,confirmButtonContent:"Retry",cancelButtonContent:"Dismiss",children:n}),e[3]=n,e[4]=a,e[5]=o,e[6]=l):l=e[6],l}const We={ASC:"ASC",DESC:"DESC",NONE:"NONE"},To=We.ASC;function Im(s){return s===We.ASC?We.DESC:We.ASC}function Lm(s,e){return s===e?0:s<e?-1:1}function Om(s,e){const t=s instanceof Date?s.getTime():s,n=e instanceof Date?e.getTime():e;return t>n?1:t<n?-1:0}function km(s,e){const t=Wi(s),n=Wi(e);for(;t.length!==0&&n.length!==0;){const i=t.shift(),r=n.shift();if(i!==r){if(typeof i=="string"&&typeof r=="string")return i.localeCompare(r);if(typeof i=="number"&&typeof r=="number")return i>r?1:-1;if(typeof i=="number"&&typeof r=="string")return-1;if(typeof i=="string"&&typeof r=="number")return 1;if(i===void 0||r===void 0)break}}return t.length>n.length?1:-1}function Wi(s){const e=[];let t=0;for(;t<s.length;){let n=s[t];if(is(n)){for(;t+1<s.length&&is(s[t+1]);)n=n+s[t+1],t++;e.push(parseInt(n,10))}else{for(;t+1<s.length&&!is(s[t+1]);)n=n+s[t+1],t++;e.push(n)}t++}return e}function is(s){return!Number.isNaN(parseInt(s,10))}const Hi={alphanumeric:km,basic:Lm,datetime:Om};function Fm(s){const e=W.c(26),{columns:t,data:n,initialSortColumn:i,initialSortDirection:r,getRowId:o}=s,[a,l]=R.useState(n),[c,d]=R.useState(n),[u,h]=R.useState(t);let m;e[0]!==t||e[1]!==i||e[2]!==r?(m=()=>Mm(t,i,r),e[0]=t,e[1]=i,e[2]=r,e[3]=m):m=e[3];const[_,b]=R.useState(m),{gridTemplateColumns:g}=So(t);t!==u&&(h(t),_&&(t.find(x=>{var S;const A=(S=x.id)!==null&&S!==void 0?S:x.field;return _.id===A})||b(null)));let p,w;if(e[4]!==t||e[5]!==n||e[6]!==c||e[7]!==_){let E=function(S){const A=p.find(P=>P.id===S.id);if(!A)throw new Error(`Unable to find header with id: ${S.id}`);if(A.column.sortBy===!1||A.column.sortBy===void 0)throw new Error("The column for this header is not sortable");const I=A.column.sortBy===!0?Hi.basic:typeof A.column.sortBy=="string"?Hi[A.column.sortBy]:A.column.sortBy;l(P=>P.slice().sort((D,j)=>{if(A.column.field===void 0)return 0;if(typeof A.column.sortBy=="function")return S.direction===We.ASC?I(D,j):I(j,D);const H=rs(D,A.column.field),$=rs(j,A.column.field);return H&&$?S.direction===We.ASC?I(H,$):I($,H):H?-1:$?1:0}))},x;e[10]!==_?(x=S=>{var A;const I=(A=S.id)!==null&&A!==void 0?A:S.field;if(I===void 0)throw new Error("Expected either an `id` or `field` to be defined for a Column");const P=S.sortBy!==void 0&&S.sortBy!==!1;return{id:I,column:S,isSortable(){return P},getSortDirection(){return _&&_.id===I?_.direction:We.NONE}}},e[10]=_,e[11]=x):x=e[11],p=t.map(x),n!==c&&(d(n),l(n),_&&E(_)),w=function(A){const I={id:A.id,direction:_&&_.id===A.id?Im(_.direction):To};b(I),E(I)},e[4]=t,e[5]=n,e[6]=c,e[7]=_,e[8]=p,e[9]=w}else p=e[8],w=e[9];let v;if(e[12]!==o||e[13]!==p||e[14]!==a){let E;e[16]!==o||e[17]!==p?(E=x=>{const S=o(x);return{id:`${S}`,getValue(){return x},getCells(){return p.map(A=>{var I;return{id:`${S}:${A.id}`,column:A.column,rowHeader:(I=A.column.rowHeader)!==null&&I!==void 0?I:!1,getValue(){if(A.column.field!==void 0)return rs(x,A.column.field);throw new Error(`Unable to get value for column header ${A.id}`)}}})}}},e[16]=o,e[17]=p,e[18]=E):E=e[18],v=a.map(E),e[12]=o,e[13]=p,e[14]=a,e[15]=v}else v=e[15];let y;e[19]!==w?(y={sortBy:w},e[19]=w,e[20]=y):y=e[20];let C;return e[21]!==g||e[22]!==p||e[23]!==v||e[24]!==y?(C={headers:p,rows:v,actions:y,gridTemplateColumns:g},e[21]=g,e[22]=p,e[23]=v,e[24]=y,e[25]=C):C=e[25],C}function Mm(s,e,t){if(e!==void 0){const i=s.find(r=>r.id===e||r.field===e);return i===void 0||i.sortBy===!1||i.sortBy===void 0?null:{id:`${e}`,direction:t??To}}if(t!==void 0){var n;const i=s.find(o=>o.sortBy!==!1&&o.sortBy!==void 0);if(!i)return null;const r=(n=i.id)!==null&&n!==void 0?n:i.field;return r===void 0?null:{id:r,direction:t}}return null}function So(s){return{gridTemplateColumns:Dm(s).join(" ")}}function Dm(s){return s.map(e=>{var t;const n=(t=e.width)!==null&&t!==void 0?t:"grow";let i="auto",r="1fr";return n==="auto"&&(r="auto"),n==="grow"&&!e.maxWidth&&(i="max-content"),n==="growCollapse"&&(i="0"),e.minWidth&&(i=typeof e.minWidth=="number"?`${e.minWidth}px`:e.minWidth),e.maxWidth&&(r=typeof e.maxWidth=="number"?`${e.maxWidth}px`:e.maxWidth),typeof n!="number"&&["grow","growCollapse","auto"].includes(n)?i===r?i:`minmax(${i}, ${r})`:typeof n=="number"?`${n}px`:n})}function rs(s,e){return e.split(".").reduce((t,n)=>t[n],s)}var Nm={ButtonReset:"prc-components-ButtonReset-9kafa"};const Dn=s=>{const e=W.c(10);let t,n,i;e[0]!==s?({children:t,className:n,...i}=s,e[0]=s,e[1]=t,e[2]=n,e[3]=i):(t=e[1],n=e[2],i=e[3]);let r;e[4]!==n?(r=N(n,Nm.ButtonReset),e[4]=n,e[5]=r):r=e[5];let o;return e[6]!==t||e[7]!==i||e[8]!==r?(o=f.jsx("button",{className:r,type:"button",...i,children:t}),e[6]=t,e[7]=i,e[8]=r,e[9]=o):o=e[9],o};var fe={TableContainer:"prc-DataTable-TableContainer-Gm3sY",TableTitle:"prc-DataTable-TableTitle-Q7qQd",TableSubtitle:"prc-DataTable-TableSubtitle-DEyv-",TableActions:"prc-DataTable-TableActions-IEEii",TableDivider:"prc-DataTable-TableDivider-OsO1X",TableOverflowWrapper:"prc-DataTable-TableOverflowWrapper-PFgsy",Table:"prc-DataTable-Table-qYfrL",TableCell:"prc-DataTable-TableCell-dVc-6",TableHeader:"prc-DataTable-TableHeader-CRPoj",TableSortButton:"prc-DataTable-TableSortButton-LnQla",TableHead:"prc-DataTable-TableHead-eOrJU",TableRow:"prc-DataTable-TableRow-1vLX7",TableBody:"prc-DataTable-TableBody-p56SS",TableCellSkeletonItem:"prc-DataTable-TableCellSkeletonItem-jFqti",TableCellSkeleton:"prc-DataTable-TableCellSkeleton-ge8WK",TableSortIcon:"prc-DataTable-TableSortIcon-2h30n","TableSortIcon--ascending":"prc-DataTable-TableSortIcon--ascending-H9-sb","TableSortIcon--descending":"prc-DataTable-TableSortIcon--descending-7-zjV",TableCellSkeletonItems:"prc-DataTable-TableCellSkeletonItems-XEGdI"};const fi=T.forwardRef(function(e,t){const n=W.c(21);let i,r,o,a,l;n[0]!==e?({"aria-labelledby":o,cellPadding:l,className:i,gridTemplateColumns:r,...a}=e,n[0]=e,n[1]=i,n[2]=r,n[3]=o,n[4]=a,n[5]=l):(i=n[1],r=n[2],o=n[3],a=n[4],l=n[5]);const c=l===void 0?"normal":l;let d;n[6]===Symbol.for("react.memo_cache_sentinel")?(d=N("TableOverflowWrapper",fe.TableOverflowWrapper),n[6]=d):d=n[6];let u;n[7]!==i?(u=N(i,"Table",fe.Table),n[7]=i,n[8]=u):u=n[8];let h;n[9]!==r?(h={"--grid-template-columns":r},n[9]=r,n[10]=h):h=n[10];const m=h;let _;n[11]!==c||n[12]!==o||n[13]!==t||n[14]!==a||n[15]!==u||n[16]!==m?(_=f.jsx("table",{...a,"aria-labelledby":o,"data-cell-padding":c,className:u,role:"table",ref:t,style:m}),n[11]=c,n[12]=o,n[13]=t,n[14]=a,n[15]=u,n[16]=m,n[17]=_):_=n[17];let b;return n[18]!==o||n[19]!==_?(b=f.jsx(Ra,{"aria-labelledby":o,className:d,children:_}),n[18]=o,n[19]=_,n[20]=b):b=n[20],b});function mi(s){const e=W.c(3),{children:t}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=N("TableHead",fe.TableHead),e[0]=n):n=e[0];let i;return e[1]!==t?(i=f.jsx("thead",{className:n,role:"rowgroup",children:t}),e[1]=t,e[2]=i):i=e[2],i}function pi(s){const e=W.c(3),{children:t}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=N("TableBody",fe.TableBody),e[0]=n):n=e[0];let i;return e[1]!==t?(i=f.jsx("tbody",{className:n,role:"rowgroup",children:t}),e[1]=t,e[2]=i):i=e[2],i}function Yn(s){const e=W.c(9);let t,n,i;e[0]!==s?({align:t,children:n,...i}=s,e[0]=s,e[1]=t,e[2]=n,e[3]=i):(t=e[1],n=e[2],i=e[3]);let r;e[4]===Symbol.for("react.memo_cache_sentinel")?(r=N("TableHeader",fe.TableHeader),e[4]=r):r=e[4];let o;return e[5]!==t||e[6]!==n||e[7]!==i?(o=f.jsx("th",{...i,className:r,role:"columnheader",scope:"col","data-cell-align":t,children:n}),e[5]=t,e[6]=n,e[7]=i,e[8]=o):o=e[8],o}function jm(s){const e=W.c(23);let t,n,i,r,o;e[0]!==s?({align:t,children:n,direction:i,onToggleSort:r,...o}=s,e[0]=s,e[1]=t,e[2]=n,e[3]=i,e[4]=r,e[5]=o):(t=e[1],n=e[2],i=e[3],r=e[4],o=e[5]);const a=i==="DESC"?"descending":i==="ASC"?"ascending":void 0;let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=N("TableSortButton",fe.TableSortButton),e[6]=l):l=e[6];let c;e[7]!==r?(c=()=>{r()},e[7]=r,e[8]=c):c=e[8];let d;e[9]!==i?(d=i===We.NONE||i===We.ASC?f.jsxs(f.Fragment,{children:[f.jsx(nf,{className:N("TableSortIcon","TableSortIcon--ascending",fe.TableSortIcon,fe["TableSortIcon--ascending"])}),i===We.NONE?f.jsx(Zs,{children:"sort ascending"}):null]}):null,e[9]=i,e[10]=d):d=e[10];let u;e[11]!==i?(u=i===We.DESC?f.jsx(sf,{className:N("TableSortIcon","TableSortIcon--descending",fe.TableSortIcon,fe["TableSortIcon--descending"])}):null,e[11]=i,e[12]=u):u=e[12];let h;e[13]!==n||e[14]!==c||e[15]!==d||e[16]!==u?(h=f.jsxs(Dn,{type:"button",className:l,onClick:c,children:[n,d,u]}),e[13]=n,e[14]=c,e[15]=d,e[16]=u,e[17]=h):h=e[17];let m;return e[18]!==t||e[19]!==a||e[20]!==o||e[21]!==h?(m=f.jsx(Yn,{...o,"aria-sort":a,align:t,children:h}),e[18]=t,e[19]=a,e[20]=o,e[21]=h,e[22]=m):m=e[22],m}function on(s){const e=W.c(7);let t,n;e[0]!==s?({children:t,...n}=s,e[0]=s,e[1]=t,e[2]=n):(t=e[1],n=e[2]);let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=N("TableRow",fe.TableRow),e[3]=i):i=e[3];let r;return e[4]!==t||e[5]!==n?(r=f.jsx("tr",{...n,className:i,role:"row",children:t}),e[4]=t,e[5]=n,e[6]=r):r=e[6],r}function _i(s){const e=W.c(16);let t,n,i,r,o;e[0]!==s?({align:t,className:i,children:n,scope:o,...r}=s,e[0]=s,e[1]=t,e[2]=n,e[3]=i,e[4]=r,e[5]=o):(t=e[1],n=e[2],i=e[3],r=e[4],o=e[5]);const a=o?"th":"td",l=o?"rowheader":"cell";let c;e[6]!==i?(c=N("TableCell",i,fe.TableCell),e[6]=i,e[7]=c):c=e[7];let d;return e[8]!==a||e[9]!==t||e[10]!==n||e[11]!==r||e[12]!==l||e[13]!==o||e[14]!==c?(d=f.jsx(a,{...r,className:c,scope:o,role:l,"data-cell-align":t,children:n}),e[8]=a,e[9]=t,e[10]=n,e[11]=r,e[12]=l,e[13]=o,e[14]=c,e[15]=d):d=e[15],d}function Bm(s){const e=W.c(2),{children:t}=s;let n;return e[0]!==t?(n=f.jsx(be,{color:"fg.subtle",children:t}),e[0]=t,e[1]=n):n=e[1],n}function Wm(s){const e=W.c(10);let t,n,i;e[0]!==s?({children:t,className:n,...i}=s,e[0]=s,e[1]=t,e[2]=n,e[3]=i):(t=e[1],n=e[2],i=e[3]);let r;e[4]!==n?(r=N(n,fe.TableContainer),e[4]=n,e[5]=r):r=e[5];let o;return e[6]!==t||e[7]!==i||e[8]!==r?(o=f.jsx(Re,{...i,className:r,children:t}),e[6]=t,e[7]=i,e[8]=r,e[9]=o):o=e[9],o}const Hm=T.forwardRef(function(e,t){const n=W.c(6),{as:i,children:r,id:o}=e,l=i===void 0?"h2":i;let c;n[0]===Symbol.for("react.memo_cache_sentinel")?(c=N("TableTitle",fe.TableTitle),n[0]=c):c=n[0];let d;return n[1]!==l||n[2]!==r||n[3]!==o||n[4]!==t?(d=f.jsx(l,{className:c,id:o,ref:t,children:r}),n[1]=l,n[2]=r,n[3]=o,n[4]=t,n[5]=d):d=n[5],d});function Vm(s){const e=W.c(5),{as:t,children:n,id:i}=s,r=t===void 0?"div":t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=N("TableSubtitle",fe.TableSubtitle),e[0]=o):o=e[0];let a;return e[1]!==r||e[2]!==n||e[3]!==i?(a=f.jsx(r,{className:o,id:i,children:n}),e[1]=r,e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function zm(){const s=W.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=f.jsx("div",{className:N("TableDivider",fe.TableDivider),role:"presentation"}),s[0]=e):e=s[0],e}function Um(s){const e=W.c(3),{children:t}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=N("TableActions",fe.TableActions),e[0]=n):n=e[0];let i;return e[1]!==t?(i=f.jsx("div",{className:n,children:t}),e[1]=t,e[2]=i):i=e[2],i}function $m(s){const e=W.c(20);let t,n,i,r;e[0]!==s?({cellPadding:t,columns:n,rows:r,...i}=s,e[0]=s,e[1]=t,e[2]=n,e[3]=i,e[4]=r):(t=e[1],n=e[2],i=e[3],r=e[4]);const o=r===void 0?10:r,{gridTemplateColumns:a}=So(n);let l;e[5]!==n?(l=Array.isArray(n)?n.map(Ao):null,e[5]=n,e[6]=l):l=e[6];let c;e[7]!==l?(c=f.jsx(mi,{children:f.jsx(on,{children:l})}),e[7]=l,e[8]=c):c=e[8];let d;e[9]!==n.length?(d=Array.from({length:n.length}),e[9]=n.length,e[10]=d):d=e[10];let u;e[11]!==o||e[12]!==d?(u=f.jsx(pi,{children:f.jsx(on,{children:d.map((m,_)=>f.jsxs(_i,{className:N("TableCellSkeleton",fe.TableCellSkeleton),children:[f.jsx(Zs,{children:"Loading"}),f.jsx("div",{className:N("TableCellSkeletonItems",fe.TableCellSkeletonItems),children:Array.from({length:o}).map(Po)})]},_))})}),e[11]=o,e[12]=d,e[13]=u):u=e[13];let h;return e[14]!==t||e[15]!==a||e[16]!==i||e[17]!==c||e[18]!==u?(h=f.jsxs(fi,{...i,cellPadding:t,gridTemplateColumns:a,children:[c,u]}),e[14]=t,e[15]=a,e[16]=i,e[17]=c,e[18]=u,e[19]=h):h=e[19],h}function Po(s,e){return f.jsx("div",{className:N("TableCellSkeletonItem",fe.TableCellSkeletonItem),children:f.jsx(wr,{})},e)}Po.displayName="_temp2";function Ao(s,e){return f.jsx(Yn,{children:typeof s.header=="string"?s.header:s.header()},e)}Ao.displayName="_temp";const Ro=T.createContext(null);function Io(){const s=T.useContext(Ro);if(!s)throw new Error("useLiveRegion() must be used within a <LiveRegion>");return s}function Km(s){const e=W.c(5),{children:t}=s,[n,i]=T.useState("");let r,o;e[0]!==n?(o={announce:i,message:n},e[0]=n,e[1]=o):o=e[1],r=o;const a=r;let l;return e[2]!==t||e[3]!==a?(l=f.jsx(Ro.Provider,{value:a,children:t}),e[2]=t,e[3]=a,e[4]=l):l=e[4],l}function qm(){const s=W.c(2),e=Io();let t;return s[0]!==e.message?(t=f.jsx(kt,{role:"status","aria-live":"polite","aria-atomic":!0,children:e.message}),s[0]=e.message,s[1]=t):t=s[1],t}function Gm(s){const e=W.c(8),{value:t}=s,n=Io(),i=T.useRef(n),r=T.useRef(!1);let o,a;e[0]!==n?(o=()=>{i.current=n},a=[n],e[0]=n,e[1]=o,e[2]=a):(o=e[1],a=e[2]),T.useEffect(o,a);let l,c;e[3]!==t?(l=()=>{if(r.current!==!0)return;const h=setTimeout(()=>{i.current.announce(t)},750);return()=>{clearTimeout(h)}},c=[t],e[3]=t,e[4]=l,e[5]=c):(l=e[4],c=e[5]),T.useEffect(l,c);let d,u;return e[6]===Symbol.for("react.memo_cache_sentinel")?(d=()=>(r.current=!0,()=>{r.current=!1}),u=[],e[6]=d,e[7]=u):(d=e[6],u=e[7]),T.useEffect(d,u),null}var dt={TablePagination:"prc-DataTable-TablePagination-ZbY9p",TablePaginationSteps:"prc-DataTable-TablePaginationSteps-Qqz6y",TablePaginationRange:"prc-DataTable-TablePaginationRange-Kp7GT",TablePaginationStep:"prc-DataTable-TablePaginationStep-0FsgZ",TablePaginationAction:"prc-DataTable-TablePaginationAction-kKQK4",TablePaginationPage:"prc-DataTable-TablePaginationPage-MQm-t",TablePaginationTruncationStep:"prc-DataTable-TablePaginationTruncationStep-HEMTY"};const Jm={narrow:!1};function Lo({"aria-label":s,defaultPageIndex:e,id:t,onChange:n,pageSize:i=25,showPages:r=Jm,totalCount:o}){const{pageIndex:a,pageStart:l,pageEnd:c,pageCount:d,hasPreviousPage:u,hasNextPage:h,selectPage:m,selectNextPage:_,selectPreviousPage:b}=Qm({defaultPageIndex:e,onChange:n,pageSize:i,totalCount:o}),g=R.useCallback(()=>typeof r!="boolean"?Object.keys(r).filter(w=>!r[w]):r?[]:Object.keys(Ia),[r]),p=R.useMemo(()=>Vf(d,a+1,!!r,1,2),[d,a,r]);return f.jsxs(Km,{children:[f.jsx(qm,{}),f.jsxs("nav",{"aria-label":s,className:N("TablePagination",dt.TablePagination),id:t,children:[f.jsx(Ym,{pageStart:l,pageEnd:c,totalCount:o}),f.jsxs("ol",{className:N("TablePaginationSteps",dt.TablePaginationSteps),"data-hidden-viewport-ranges":g().join(" "),children:[f.jsx(os,{children:f.jsxs(Dn,{className:N("TablePaginationAction",dt.TablePaginationAction),type:"button","data-has-page":u?!0:void 0,"aria-disabled":u?void 0:!0,onClick:()=>{u&&b()},children:[u?f.jsx(dh,{}):null,f.jsx("span",{children:"Previous"}),f.jsx(kt,{children:" page"})]})}),p.map((w,v)=>{if(w.type==="BREAK")return f.jsx(Xm,{},`truncation-${v}`);if(w.type==="NUM")return f.jsx(os,{children:f.jsxs(Zm,{active:!!w.selected,onClick:()=>{m(w.num-1)},children:[w.num,w.precedesBreak?f.jsx(kt,{children:"…"}):null]})},v)}),f.jsx(os,{children:f.jsxs(Dn,{className:N("TablePaginationAction",dt.TablePaginationAction),type:"button","data-has-page":h?!0:void 0,"aria-disabled":h?void 0:!0,onClick:()=>{h&&_()},children:[f.jsx("span",{children:"Next"}),f.jsx(kt,{children:" page"}),h?f.jsx(vr,{}):null]})})]})]})]})}Lo.displayName="Pagination";function Ym(s){const e=W.c(12),{pageStart:t,pageEnd:n,totalCount:i}=s,r=t+1,o=n,a=`Showing ${r} through ${o} of ${i}`;let l;e[0]!==a?(l=f.jsx(Gm,{value:a}),e[0]=a,e[1]=l):l=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=N("TablePaginationRange",dt.TablePaginationRange),e[2]=c):c=e[2];let d,u;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=f.jsx(kt,{children:" through "}),u=f.jsx("span",{"aria-hidden":"true",children:"‒"}),e[3]=d,e[4]=u):(d=e[3],u=e[4]);let h;e[5]!==o||e[6]!==r||e[7]!==i?(h=f.jsxs("p",{className:c,children:[r,d,u,o," of ",i]}),e[5]=o,e[6]=r,e[7]=i,e[8]=h):h=e[8];let m;return e[9]!==l||e[10]!==h?(m=f.jsxs(f.Fragment,{children:[l,h]}),e[9]=l,e[10]=h,e[11]=m):m=e[11],m}function Xm(){const s=W.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=f.jsx("li",{"aria-hidden":"true",className:N("TablePaginationTruncationStep",dt.TablePaginationTruncationStep),children:"…"}),s[0]=e):e=s[0],e}function os(s){const e=W.c(3),{children:t}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=N("TablePaginationStep",dt.TablePaginationStep),e[0]=n):n=e[0];let i;return e[1]!==t?(i=f.jsx("li",{className:n,children:t}),e[1]=t,e[2]=i):i=e[2],i}function Zm(s){const e=W.c(7),{active:t,children:n,onClick:i}=s;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=N("TablePaginationPage",dt.TablePaginationPage),e[0]=r):r=e[0];const o=t?!0:void 0,a=t?!0:void 0;let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=f.jsx(kt,{children:"Page "}),e[1]=l):l=e[1];let c;return e[2]!==n||e[3]!==i||e[4]!==o||e[5]!==a?(c=f.jsxs(Dn,{className:r,type:"button","data-active":o,"aria-current":a,onClick:i,children:[l,n]}),e[2]=n,e[3]=i,e[4]=o,e[5]=a,e[6]=c):c=e[6],c}function Qm(s){const e=W.c(24),{defaultPageIndex:t,onChange:n,pageSize:i,totalCount:r}=s,o=Math.ceil(r/i);let a;e[0]!==t||e[1]!==o?(a=()=>t!==void 0&&t>=0&&t<o?t:0,e[0]=t,e[1]=o,e[2]=a):a=e[2];const[l,c]=R.useState(a),[d,u]=R.useState(l);t!==void 0&&t>=0&&t<o&&l!==t&&(c(t),u(t),n?.({pageIndex:t}));const m=d*i,_=Math.min((d+1)*i,r),b=d+1<o,g=d>0;let p;e[3]!==n||e[4]!==d?(p=function(A){d!==A&&(u(A),n?.({pageIndex:A}))},e[3]=n,e[4]=d,e[5]=p):p=e[5];const w=p;let v;e[6]!==g||e[7]!==d||e[8]!==w?(v=function(){g&&w(d-1)},e[6]=g,e[7]=d,e[8]=w,e[9]=v):v=e[9];const y=v;let C;e[10]!==b||e[11]!==d||e[12]!==w?(C=function(){b&&w(d+1)},e[10]=b,e[11]=d,e[12]=w,e[13]=C):C=e[13];const E=C;let x;return e[14]!==b||e[15]!==g||e[16]!==o||e[17]!==_||e[18]!==d||e[19]!==m||e[20]!==E||e[21]!==w||e[22]!==y?(x={pageIndex:d,pageStart:m,pageEnd:_,pageCount:o,hasNextPage:b,hasPreviousPage:g,selectPage:w,selectPreviousPage:y,selectNextPage:E},e[14]=b,e[15]=g,e[16]=o,e[17]=_,e[18]=d,e[19]=m,e[20]=E,e[21]=w,e[22]=y,e[23]=x):x=e[23],x}const as=Object.assign(fi,{Container:Wm,Title:Hm,Subtitle:Vm,Actions:Um,Divider:zm,Skeleton:$m,Head:mi,Body:pi,Header:Yn,Row:on,Cell:_i,CellPlaceholder:Bm,Pagination:Lo,ErrorDialog:Rm});function ep(s){return s.id}function tp(s){const e=W.c(26),{"aria-labelledby":t,"aria-describedby":n,cellPadding:i,columns:r,data:o,initialSortColumn:a,initialSortDirection:l,getRowId:c,onToggleSort:d}=s,u=c===void 0?ep:c;let h;e[0]!==r||e[1]!==o||e[2]!==u||e[3]!==a||e[4]!==l?(h={data:o,columns:r,initialSortColumn:a,initialSortDirection:l,getRowId:u},e[0]=r,e[1]=o,e[2]=u,e[3]=a,e[4]=l,e[5]=h):h=e[5];const{headers:m,rows:_,actions:b,gridTemplateColumns:g}=Fm(h);let p;if(e[6]!==b||e[7]!==m||e[8]!==d){let E;e[10]!==b||e[11]!==d?(E=x=>x.isSortable()?f.jsx(jm,{align:x.column.align,direction:x.getSortDirection(),onToggleSort:()=>{const S=x.getSortDirection()==="ASC"?"DESC":"ASC";b.sortBy(x),d?.(x.id,S)},children:typeof x.column.header=="string"?x.column.header:x.column.header()},x.id):f.jsx(Yn,{align:x.column.align,children:typeof x.column.header=="string"?x.column.header:x.column.header()},x.id),e[10]=b,e[11]=d,e[12]=E):E=e[12],p=m.map(E),e[6]=b,e[7]=m,e[8]=d,e[9]=p}else p=e[9];let w;e[13]!==p?(w=f.jsx(mi,{children:f.jsx(on,{children:p})}),e[13]=p,e[14]=w):w=e[14];let v;e[15]!==_?(v=_.map(Oo),e[15]=_,e[16]=v):v=e[16];let y;e[17]!==v?(y=f.jsx(pi,{children:v}),e[17]=v,e[18]=y):y=e[18];let C;return e[19]!==i||e[20]!==n||e[21]!==g||e[22]!==t||e[23]!==w||e[24]!==y?(C=f.jsxs(fi,{"aria-labelledby":t,"aria-describedby":n,cellPadding:i,gridTemplateColumns:g,children:[w,y]}),e[19]=i,e[20]=n,e[21]=g,e[22]=t,e[23]=w,e[24]=y,e[25]=C):C=e[25],C}function Oo(s){return f.jsx(on,{children:s.getCells().map(e=>f.jsx(_i,{scope:e.rowHeader?"row":void 0,align:e.column.align,children:e.column.renderCell?e.column.renderCell(s.getValue()):e.getValue()},e.id))},s.id)}Oo.displayName="_temp";const np={"--jp-collaborator-color1":"#ffad8e","--jp-collaborator-color2":"#dac83d","--jp-collaborator-color3":"#72dd76","--jp-collaborator-color4":"#00e4d0","--jp-collaborator-color5":"#45d4ff","--jp-collaborator-color6":"#e2b1ff","--jp-collaborator-color7":"#ff9de6"},sp=s=>np[s.replaceAll("var(","").replaceAll(")","")];class ko{_serviceManager;constructor(e){this._serviceManager=e}kernelspecs(){return this._serviceManager.kernelspecs}contents(){return this._serviceManager.contents}nbconvert(){return this._serviceManager.nbconvert}sessions(){return this._serviceManager.sessions}settings(){return this._serviceManager.settings}terminals(){return this._serviceManager.terminals}workspaces(){return this._serviceManager.workspaces}builder(){return this._serviceManager.builder}serverSettings(){return this._serviceManager.serverSettings}refreshKernelspecs(){return this.kernelspecs().refreshSpecs()}getKernelspecs(){return this.kernelspecs().specs}}const ip=Object.freeze(Object.defineProperty({__proto__:null,IServiceWorkerManager:Of,JupyterLiteServer:La,Router:Oa,ServiceWorkerManager:cf,WORKER_NAME:kf},Symbol.toStringTag,{value:"Module"})),rp=Object.freeze(Object.defineProperty({__proto__:null,BLOCK_SIZE:yf,BroadcastChannelWrapper:df,Contents:uf,ContentsAPI:bf,DIR_MODE:vf,DRIVE_API_PATH:wf,DRIVE_SEPARATOR:Cf,DriveContentsProcessor:Ef,DriveFS:xf,DriveFSEmscriptenNodeOps:Tf,DriveFSEmscriptenStreamOps:Sf,get FILE(){return Ff},FILE_MODE:Pf,IBroadcastChannelWrapper:Mf,IContents:Df,get MIME(){return Nf},SEEK_CUR:Af,SEEK_END:Rf,ServiceWorkerContentsAPI:If,instanceOfStream:Lf},Symbol.toStringTag,{value:"Module"})),op=Object.freeze(Object.defineProperty({__proto__:null,BaseKernel:Hf,FALLBACK_KERNEL:jf,IKernelSpecs:Bf,IKernels:Wf,KernelSpecs:hf,Kernels:ff},Symbol.toStringTag,{value:"Module"})),ap=Object.freeze(Object.defineProperty({__proto__:null,ILocalForage:mf,ensureMemoryStorage:pf},Symbol.toStringTag,{value:"Module"})),lp=Object.freeze(Object.defineProperty({__proto__:null,ISessions:_f,Sessions:gf},Symbol.toStringTag,{value:"Module"})),cp=Qs.bindprops({stylesheet:"menuItem"});class dp extends ka{constructor(e){super(e),this._isDisposed=!1,this._opened=new U(this),this.menu=new Wt(e)}get isDisposed(){return this._isDisposed}get opened(){return this._opened}dispose(){this._isDisposed||(this._isDisposed=!0,this.menu.dispose(),U.disconnectSender(this))}open(e){if(this._isDisposed)return!1;const t=super.open(e);return t&&this._opened.emit(),t}}class Wt extends kn{constructor(e){e.renderer=e.renderer||Wt.defaultRenderer,super(e),this.addClass("jp-ThemedContainer")}insertItem(e,t){return t.submenu&&Wt.overrideDefaultRenderer(t.submenu),super.insertItem(e,t)}}(function(s){function e(n){n.renderer===kn.defaultRenderer&&(n.renderer=s.defaultRenderer);const i=n.insertItem.bind(n);n.insertItem=(r,o)=>(o.submenu&&s.overrideDefaultRenderer(o.submenu),i(r,o));for(const r of n._items)r.submenu&&e(r.submenu)}s.overrideDefaultRenderer=e;class t extends kn.Renderer{renderIcon(i){const r=this.createIconClass(i);return i.item.isToggled?ae.div({className:r},Fa,i.item.iconLabel):ae.div({className:r},i.item.icon,i.item.iconLabel)}createIconClass(i){let r="lm-Menu-itemIcon";return i.item.type==="separator"?xt(i.item.iconClass,r):xt(xr.styleClass({stylesheet:"menuItem"}),i.item.iconClass,r)}renderSubmenu(i){const r="lm-Menu-itemSubmenuIcon";return i.item.type==="submenu"?ae.div({className:r},cp):ae.div({className:r})}}s.Renderer=t,s.defaultRenderer=new t})(Wt||(Wt={}));class He extends ei{constructor(e={}){var t;super({renderer:He.defaultRenderer,...e});const n=((t=He.translator)!==null&&t!==void 0?t:se).load("jupyterlab");Tr.element({container:this.addButtonNode,title:n.__("New Launcher")})}}He.translator=null;(function(s){function e(n){return n.label||n.dataset.jpTabLabel||n.caption}s.titleLabel=e;class t extends ei.Renderer{renderLabel(i){return ae.div({className:"lm-TabBar-tabLabel"},e(i.title))}renderCloseIcon(i){var r;const o=((r=s.translator)!==null&&r!==void 0?r:se).load("jupyterlab"),a=e(i.title),l=a?o.__("Close %1",a):o.__("Close tab"),c=xt("jp-icon-hover lm-TabBar-tabCloseIcon",xr.styleClass({elementPosition:"center",height:"16px",width:"16px"}));return Da("div",{className:c,title:l},Sr)}}s.Renderer=t,s.defaultRenderer=new t})(He||(He={}));class an extends zn{constructor(e={}){super({renderer:an.defaultRenderer,...e})}}(function(s){class e extends zn.Renderer{createTabBar(){const n=new He;return n.addClass("lm-DockPanel-tabBar"),n}}s.Renderer=e,s.defaultRenderer=new e})(an||(an={}));class up extends Ma{constructor(e={}){e.renderer=e.renderer||He.defaultRenderer,super(e)}}class hp extends Na{constructor(){super(...arguments),this._toolbars=new WeakMap}insertWidget(e,t){t.toolbar&&(this._toolbars.set(t,t.toolbar),t.toolbar.addClass("jp-AccordionPanel-toolbar")),super.insertWidget(e,t)}removeWidgetAt(e){const t=this.widgets[e];super.removeWidgetAt(e),t&&this._toolbars.has(t)&&this._toolbars.delete(t)}updateTitle(e,t){super.updateTitle(e,t),this._addToolbar(e,t)}attachWidget(e,t){super.attachWidget(e,t),this._addToolbar(e,t)}detachWidget(e,t){const n=this._toolbars.get(t);n&&(this.parent.isAttached&&Ie.sendMessage(n,X.Msg.BeforeDetach),this.titles[e].removeChild(n.node),this.parent.isAttached&&Ie.sendMessage(n,X.Msg.AfterDetach)),super.detachWidget(e,t)}onBeforeAttach(e){this.notifyToolbars(e),super.onBeforeAttach(e)}onAfterAttach(e){super.onAfterAttach(e),this.notifyToolbars(e)}onBeforeDetach(e){this.notifyToolbars(e),super.onBeforeDetach(e)}onAfterDetach(e){super.onAfterDetach(e),this.notifyToolbars(e)}_addToolbar(e,t){const n=this._toolbars.get(t);n&&(this.parent.isAttached&&Ie.sendMessage(n,X.Msg.BeforeAttach),this.titles[e].appendChild(n.node),this.parent.isAttached&&Ie.sendMessage(n,X.Msg.AfterAttach))}notifyToolbars(e){this.widgets.forEach(t=>{const n=this._toolbars.get(t);n&&n.processMessage(e)})}}var Nn;(function(s){class e extends Un.Renderer{createCollapseIcon(i){const r=document.createElement("div");return $n.element({container:r}),r}createSectionTitle(i){const r=super.createSectionTitle(i);return r.classList.add("jp-AccordionPanel-title"),r}}s.Renderer=e,s.defaultRenderer=new e;function t(n){var i;return n.layout||new hp({renderer:n.renderer||s.defaultRenderer,orientation:n.orientation,alignment:n.alignment,spacing:n.spacing,titleSpace:(i=n.titleSpace)!==null&&i!==void 0?i:32})}s.createLayout=t})(Nn||(Nn={}));function fp(s,e,t){return s.nodeType!==Node.TEXT_NODE?!0:typeof s.nodeValue=="string"&&!!s.nodeValue.trim().length}const mp=(s,e)=>Ha`
2
2
  <template
3
3
  class="
4
4
  ${t=>t.readOnly?"readonly":""}
@@ -256,7 +256,7 @@ import{r as R,j as f,D as Xs,n7 as yr,n8 as bt,J as T,by as W,n9 as br,cL as N,n
256
256
  input::placeholder {
257
257
  color: ${Ye.GrayText};
258
258
  }
259
- `)),yp=kr.create("clear-button-hover").withDefault(s=>{const e=Fr.getValueFor(s),t=Dr.getValueFor(s);return e.evaluate(s,t.evaluate(s).hover).hover}),bp=kr.create("clear-button-active").withDefault(s=>{const e=Fr.getValueFor(s),t=Dr.getValueFor(s);return e.evaluate(s,t.evaluate(s).hover).active}),vp=(s,e)=>ws`
259
+ `)),yp=kr.create("clear-button-hover").withDefault(s=>{const e=Fr.getValueFor(s),t=Mr.getValueFor(s);return e.evaluate(s,t.evaluate(s).hover).hover}),bp=kr.create("clear-button-active").withDefault(s=>{const e=Fr.getValueFor(s),t=Mr.getValueFor(s);return e.evaluate(s,t.evaluate(s).hover).active}),vp=(s,e)=>ws`
260
260
  ${gp}
261
261
 
262
262
  .control::-webkit-search-cancel-button {
@@ -351,7 +351,7 @@ import{r as R,j as f,D as Xs,n7 as yr,n8 as bt,J as T,by as W,n9 as br,cL as N,n
351
351
  :host(:focus-within:not([disabled], [readOnly])) .clear-button__hidden {
352
352
  opacity: 0;
353
353
  }
354
- `;class Do extends Le{constructor(){super(...arguments),this.appearance="outline"}}ul([Ge],Do.prototype,"appearance",void 0);const wp=Do.compose({baseName:"search",baseClass:Le,template:mp,styles:vp,shadowOptions:{delegatesFocus:!0}});hl().register(wp());const Cp=R.forwardRef((s,e)=>{const t=R.useRef(null),{className:n,readonly:i,appearance:r,placeholder:o,list:a,pattern:l,readOnly:c,autofocus:d,maxlength:u,minlength:h,size:m,spellcheck:_,disabled:b,required:g,...p}=s;return Ri(t,"input",s.onInput),Ri(t,"change",s.onChange),rt(t,"readOnly",s.readOnly),rt(t,"autofocus",s.autofocus),rt(t,"maxlength",s.maxlength),rt(t,"minlength",s.minlength),rt(t,"size",s.size),rt(t,"spellcheck",s.spellcheck),rt(t,"disabled",s.disabled),rt(t,"required",s.required),R.useImperativeHandle(e,()=>t.current,[t.current]),T.createElement("jp-search",{ref:t,...p,appearance:s.appearance,placeholder:s.placeholder,list:s.list,pattern:s.pattern,class:s.className,exportparts:s.exportparts,for:s.htmlFor,part:s.part,tabindex:s.tabIndex,readonly:s.readonly?"":void 0,style:{...s.style}},s.children)});function Ep(s,e){let t=1/0,n=null;const i=/[\p{L}\p{N}\p{M}]+/gu;let r=!0;for(;r;){let o=i.exec(s);if(!o)break;let a=Mr.matchSumOfDeltas(s,e,o.index);if(!a)break;a.score<=t&&(t=a.score,n=a.indices)}return!n||t===1/0?null:{score:t,indices:n}}const ls=(s,e,t)=>n=>{if(e){const r=s.toLowerCase();return Ep(n,r)}t||(n=n.toLocaleLowerCase(),s=s.toLocaleLowerCase());const i=n.indexOf(s);return i===-1?null:{indices:[...Array(s.length).keys()].map(r=>r+i)}},xp=s=>{var e,t,n;const[i,r]=R.useState((e=s.initialQuery)!==null&&e!==void 0?e:"");s.forceRefresh&&R.useEffect(()=>{s.updateFilter(d=>({}))},[]);const o=R.useRef(!0),a=(t=s.inputRef)!==null&&t!==void 0?t:R.useRef();R.useEffect(()=>{o.current?(o.current=!1,s.initialQuery!==void 0&&s.updateFilter(ls(s.initialQuery,s.useFuzzyFilter,s.caseSensitive),s.initialQuery)):a.current&&s.updateFilter(ls(a.current.value,s.useFuzzyFilter,s.caseSensitive),a.current.value)},[s.updateFilter,s.useFuzzyFilter,s.caseSensitive]);const l=R.useCallback(d=>{const u=d.target;r(u.value),s.updateFilter(ls(u.value,s.useFuzzyFilter,s.caseSensitive),u.value)},[s.updateFilter,s.useFuzzyFilter,s.caseSensitive]),c=(n=s.showIcon)!==null&&n!==void 0?n:!0;return T.createElement(Cp,{role:"search",className:"jp-FilterBox",ref:s.inputRef,value:i,onChange:l,onInput:l,placeholder:s.placeholder,disabled:s.disabled},c&&T.createElement(fl.react,{slot:"end",tag:null}))};class Tp extends ni{constructor(e){var t;super(),this._filterBoxProps={...e},(t=e?.filterSettingsChanged)===null||t===void 0||t.connect((n,i)=>{this._updateProps(i)},this)}render(){return T.createElement(xp,{...this._filterBoxProps})}_updateProps(e){Object.assign(this._filterBoxProps,e),this.update()}}const Sp=s=>new Tp(s);class Pp extends X{constructor(e={}){var t;super();const n=this.layout=new Nr;this.addClass("jp-SidePanel");const i=this._trans=(e.translator||se).load("jupyterlab");e.header&&this.addHeader(e.header);const r=this._content=(t=e.content)!==null&&t!==void 0?t:new Un({...e,layout:Nn.createLayout(e)});r.node.setAttribute("role","region"),r.node.setAttribute("aria-label",i.__("side panel content")),r.addClass("jp-SidePanel-content"),n.addWidget(r),e.toolbar&&this.addToolbar(e.toolbar)}get content(){return this._content}get header(){return this._header||this.addHeader(),this._header}get toolbar(){return this._toolbar||this.addToolbar(),this._toolbar}get widgets(){return this.content.widgets}addWidget(e){this.content.addWidget(e)}insertWidget(e,t){this.content.insertWidget(e,t)}addHeader(e){const t=this._header=e||new pt;t.addClass("jp-SidePanel-header"),this.layout.insertWidget(0,t)}addToolbar(e){const t=this._toolbar=e??new jr;t.addClass("jp-SidePanel-toolbar"),this.layout.insertWidget(this.layout.widgets.length-1,t)}}const Ap=new Ae("@jupyterlab/rendermime:IRenderMimeRegistry",'A service for the rendermime registry for the application. Use this to create renderers for various mime-types in your extension. Many times it will be easier to create a "mime renderer extension" rather than using this service directly.'),ev=new Ae("@jupyterlab/rendermime:ILatexTypesetter","A service for the LaTeX typesetter for the application. Use this if you want to typeset math in your extension."),tv=new Ae("@jupyterlab/rendermime:IMarkdownParser","A service for rendering markdown syntax as HTML content."),nv=new Ae("@jupyterlab/rendermime:IUrlResolverFactory","A factory for resolver of asset URLs."),Rp=s=>{const{serviceManager:e}=s,[t,n]=R.useState(),[i,r]=R.useState([]),[o,a]=R.useState([]),l=()=>{e&&(n(e.serverSettings),e.sessions.refreshRunning().then(()=>{r(Array.from(e.sessions.running())),e.sessions.runningChanged.connect(()=>{})}),e.kernels.refreshRunning().then(()=>{a(Array.from(e.kernels.running())),e.kernels.runningChanged.connect(()=>{})}))};return R.useEffect(()=>{l()},[e]),f.jsx(f.Fragment,{children:e&&f.jsxs(f.Fragment,{children:[f.jsx(ee,{mb:3,children:f.jsx(si,{onClick:l,children:"Refresh"})}),f.jsxs(ee,{children:[f.jsx(be,{as:"h3",children:"Server Settings"}),f.jsx(Ut,{children:"Base URL"}),f.jsxs(be,{children:[" ",t?.baseUrl]})]}),f.jsxs(ee,{children:[f.jsx(be,{as:"h3",children:"Kernels"}),o.map(c=>f.jsxs(ee,{children:[f.jsx(Ut,{children:"Kernel"}),f.jsxs(be,{children:[" ",c.name," - ",c.id," - ",c.connections," ","connections"]})]},c.id))]}),f.jsxs(ee,{children:[f.jsx(be,{as:"h3",children:"Sessions"}),i.map(c=>f.jsxs(ee,{children:[f.jsx(Ut,{children:"Kernel"}),f.jsxs(be,{children:[" ",c.kernel?.name," - ",c.kernel?.id]}),f.jsx(Ut,{style:{marginLeft:10},children:"Session"}),f.jsxs(be,{children:[" ",c.name," - ",c.path," - ",c.type]})]},c.id))]})]})})};var Ip=Object.create,gi=Object.defineProperty,Lp=Object.getOwnPropertyDescriptor,Mo=Object.getOwnPropertyNames,Op=Object.getPrototypeOf,kp=Object.prototype.hasOwnProperty,yi=(s,e)=>function(){return e||(0,s[Mo(s)[0]])((e={exports:{}}).exports,e),e.exports},Fp=(s,e)=>{for(var t in e)gi(s,t,{get:e[t],enumerable:!0})},Dp=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Mo(e))!kp.call(s,i)&&i!==t&&gi(s,i,{get:()=>e[i],enumerable:!(n=Lp(e,i))||n.enumerable});return s},Mp=(s,e,t)=>(t=s!=null?Ip(Op(s)):{},Dp(gi(t,"default",{value:s,enumerable:!0}),s)),Np=yi({"node_modules/is-object/index.js"(s,e){e.exports=function(n){return typeof n=="object"&&n!==null}}}),jp=yi({"node_modules/is-window/index.js"(s,e){e.exports=function(t){if(t==null)return!1;var n=Object(t);return n===n.window}}}),Bp=yi({"node_modules/is-dom/index.js"(s,e){var t=Np(),n=jp();function i(r){return!t(r)||!n(window)||typeof window.Node!="function"?!1:typeof r.nodeType=="number"&&typeof r.nodeName=="string"}e.exports=i}}),jn={};Fp(jn,{chromeDark:()=>Wp,chromeLight:()=>Hp});var Wp={BASE_FONT_FAMILY:"Menlo, monospace",BASE_FONT_SIZE:"11px",BASE_LINE_HEIGHT:1.2,BASE_BACKGROUND_COLOR:"rgb(36, 36, 36)",BASE_COLOR:"rgb(213, 213, 213)",OBJECT_PREVIEW_ARRAY_MAX_PROPERTIES:10,OBJECT_PREVIEW_OBJECT_MAX_PROPERTIES:5,OBJECT_NAME_COLOR:"rgb(227, 110, 236)",OBJECT_VALUE_NULL_COLOR:"rgb(127, 127, 127)",OBJECT_VALUE_UNDEFINED_COLOR:"rgb(127, 127, 127)",OBJECT_VALUE_REGEXP_COLOR:"rgb(233, 63, 59)",OBJECT_VALUE_STRING_COLOR:"rgb(233, 63, 59)",OBJECT_VALUE_SYMBOL_COLOR:"rgb(233, 63, 59)",OBJECT_VALUE_NUMBER_COLOR:"hsl(252, 100%, 75%)",OBJECT_VALUE_BOOLEAN_COLOR:"hsl(252, 100%, 75%)",OBJECT_VALUE_FUNCTION_PREFIX_COLOR:"rgb(85, 106, 242)",HTML_TAG_COLOR:"rgb(93, 176, 215)",HTML_TAGNAME_COLOR:"rgb(93, 176, 215)",HTML_TAGNAME_TEXT_TRANSFORM:"lowercase",HTML_ATTRIBUTE_NAME_COLOR:"rgb(155, 187, 220)",HTML_ATTRIBUTE_VALUE_COLOR:"rgb(242, 151, 102)",HTML_COMMENT_COLOR:"rgb(137, 137, 137)",HTML_DOCTYPE_COLOR:"rgb(192, 192, 192)",ARROW_COLOR:"rgb(145, 145, 145)",ARROW_MARGIN_RIGHT:3,ARROW_FONT_SIZE:12,ARROW_ANIMATION_DURATION:"0",TREENODE_FONT_FAMILY:"Menlo, monospace",TREENODE_FONT_SIZE:"11px",TREENODE_LINE_HEIGHT:1.2,TREENODE_PADDING_LEFT:12,TABLE_BORDER_COLOR:"rgb(85, 85, 85)",TABLE_TH_BACKGROUND_COLOR:"rgb(44, 44, 44)",TABLE_TH_HOVER_COLOR:"rgb(48, 48, 48)",TABLE_SORT_ICON_COLOR:"black",TABLE_DATA_BACKGROUND_IMAGE:"linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0) 50%, rgba(51, 139, 255, 0.0980392) 50%, rgba(51, 139, 255, 0.0980392))",TABLE_DATA_BACKGROUND_SIZE:"128px 32px"},Hp={BASE_FONT_FAMILY:"Menlo, monospace",BASE_FONT_SIZE:"11px",BASE_LINE_HEIGHT:1.2,BASE_BACKGROUND_COLOR:"white",BASE_COLOR:"black",OBJECT_PREVIEW_ARRAY_MAX_PROPERTIES:10,OBJECT_PREVIEW_OBJECT_MAX_PROPERTIES:5,OBJECT_NAME_COLOR:"rgb(136, 19, 145)",OBJECT_VALUE_NULL_COLOR:"rgb(128, 128, 128)",OBJECT_VALUE_UNDEFINED_COLOR:"rgb(128, 128, 128)",OBJECT_VALUE_REGEXP_COLOR:"rgb(196, 26, 22)",OBJECT_VALUE_STRING_COLOR:"rgb(196, 26, 22)",OBJECT_VALUE_SYMBOL_COLOR:"rgb(196, 26, 22)",OBJECT_VALUE_NUMBER_COLOR:"rgb(28, 0, 207)",OBJECT_VALUE_BOOLEAN_COLOR:"rgb(28, 0, 207)",OBJECT_VALUE_FUNCTION_PREFIX_COLOR:"rgb(13, 34, 170)",HTML_TAG_COLOR:"rgb(168, 148, 166)",HTML_TAGNAME_COLOR:"rgb(136, 18, 128)",HTML_TAGNAME_TEXT_TRANSFORM:"lowercase",HTML_ATTRIBUTE_NAME_COLOR:"rgb(153, 69, 0)",HTML_ATTRIBUTE_VALUE_COLOR:"rgb(26, 26, 166)",HTML_COMMENT_COLOR:"rgb(35, 110, 37)",HTML_DOCTYPE_COLOR:"rgb(192, 192, 192)",ARROW_COLOR:"#6e6e6e",ARROW_MARGIN_RIGHT:3,ARROW_FONT_SIZE:12,ARROW_ANIMATION_DURATION:"0",TREENODE_FONT_FAMILY:"Menlo, monospace",TREENODE_FONT_SIZE:"11px",TREENODE_LINE_HEIGHT:1.2,TREENODE_PADDING_LEFT:12,TABLE_BORDER_COLOR:"#aaa",TABLE_TH_BACKGROUND_COLOR:"#eee",TABLE_TH_HOVER_COLOR:"hsla(0, 0%, 90%, 1)",TABLE_SORT_ICON_COLOR:"#6e6e6e",TABLE_DATA_BACKGROUND_IMAGE:"linear-gradient(to bottom, white, white 50%, rgb(234, 243, 255) 50%, rgb(234, 243, 255))",TABLE_DATA_BACKGROUND_SIZE:"128px 32px"},No=R.createContext([{},()=>{}]),cs={WebkitTouchCallout:"none",WebkitUserSelect:"none",KhtmlUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",OUserSelect:"none",userSelect:"none"},Tn=s=>({DOMNodePreview:{htmlOpenTag:{base:{color:s.HTML_TAG_COLOR},tagName:{color:s.HTML_TAGNAME_COLOR,textTransform:s.HTML_TAGNAME_TEXT_TRANSFORM},htmlAttributeName:{color:s.HTML_ATTRIBUTE_NAME_COLOR},htmlAttributeValue:{color:s.HTML_ATTRIBUTE_VALUE_COLOR}},htmlCloseTag:{base:{color:s.HTML_TAG_COLOR},offsetLeft:{marginLeft:-s.TREENODE_PADDING_LEFT},tagName:{color:s.HTML_TAGNAME_COLOR,textTransform:s.HTML_TAGNAME_TEXT_TRANSFORM}},htmlComment:{color:s.HTML_COMMENT_COLOR},htmlDoctype:{color:s.HTML_DOCTYPE_COLOR}},ObjectPreview:{objectDescription:{fontStyle:"italic"},preview:{fontStyle:"italic"},arrayMaxProperties:s.OBJECT_PREVIEW_ARRAY_MAX_PROPERTIES,objectMaxProperties:s.OBJECT_PREVIEW_OBJECT_MAX_PROPERTIES},ObjectName:{base:{color:s.OBJECT_NAME_COLOR},dimmed:{opacity:.6}},ObjectValue:{objectValueNull:{color:s.OBJECT_VALUE_NULL_COLOR},objectValueUndefined:{color:s.OBJECT_VALUE_UNDEFINED_COLOR},objectValueRegExp:{color:s.OBJECT_VALUE_REGEXP_COLOR},objectValueString:{color:s.OBJECT_VALUE_STRING_COLOR},objectValueSymbol:{color:s.OBJECT_VALUE_SYMBOL_COLOR},objectValueNumber:{color:s.OBJECT_VALUE_NUMBER_COLOR},objectValueBoolean:{color:s.OBJECT_VALUE_BOOLEAN_COLOR},objectValueFunctionPrefix:{color:s.OBJECT_VALUE_FUNCTION_PREFIX_COLOR,fontStyle:"italic"},objectValueFunctionName:{fontStyle:"italic"}},TreeView:{treeViewOutline:{padding:0,margin:0,listStyleType:"none"}},TreeNode:{treeNodeBase:{color:s.BASE_COLOR,backgroundColor:s.BASE_BACKGROUND_COLOR,lineHeight:s.TREENODE_LINE_HEIGHT,cursor:"default",boxSizing:"border-box",listStyle:"none",fontFamily:s.TREENODE_FONT_FAMILY,fontSize:s.TREENODE_FONT_SIZE},treeNodePreviewContainer:{},treeNodePlaceholder:{whiteSpace:"pre",fontSize:s.ARROW_FONT_SIZE,marginRight:s.ARROW_MARGIN_RIGHT,...cs},treeNodeArrow:{base:{color:s.ARROW_COLOR,display:"inline-block",fontSize:s.ARROW_FONT_SIZE,marginRight:s.ARROW_MARGIN_RIGHT,...parseFloat(s.ARROW_ANIMATION_DURATION)>0?{transition:`transform ${s.ARROW_ANIMATION_DURATION} ease 0s`}:{},...cs},expanded:{WebkitTransform:"rotateZ(90deg)",MozTransform:"rotateZ(90deg)",transform:"rotateZ(90deg)"},collapsed:{WebkitTransform:"rotateZ(0deg)",MozTransform:"rotateZ(0deg)",transform:"rotateZ(0deg)"}},treeNodeChildNodesContainer:{margin:0,paddingLeft:s.TREENODE_PADDING_LEFT}},TableInspector:{base:{color:s.BASE_COLOR,position:"relative",border:`1px solid ${s.TABLE_BORDER_COLOR}`,fontFamily:s.BASE_FONT_FAMILY,fontSize:s.BASE_FONT_SIZE,lineHeight:"120%",boxSizing:"border-box",cursor:"default"}},TableInspectorHeaderContainer:{base:{top:0,height:"17px",left:0,right:0,overflowX:"hidden"},table:{tableLayout:"fixed",borderSpacing:0,borderCollapse:"separate",height:"100%",width:"100%",margin:0}},TableInspectorDataContainer:{tr:{display:"table-row"},td:{boxSizing:"border-box",border:"none",height:"16px",verticalAlign:"top",padding:"1px 4px",WebkitUserSelect:"text",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",lineHeight:"14px"},div:{position:"static",top:"17px",bottom:0,overflowY:"overlay",transform:"translateZ(0)",left:0,right:0,overflowX:"hidden"},table:{positon:"static",left:0,top:0,right:0,bottom:0,borderTop:"0 none transparent",margin:0,backgroundImage:s.TABLE_DATA_BACKGROUND_IMAGE,backgroundSize:s.TABLE_DATA_BACKGROUND_SIZE,tableLayout:"fixed",borderSpacing:0,borderCollapse:"separate",width:"100%",fontSize:s.BASE_FONT_SIZE,lineHeight:"120%"}},TableInspectorTH:{base:{position:"relative",height:"auto",textAlign:"left",backgroundColor:s.TABLE_TH_BACKGROUND_COLOR,borderBottom:`1px solid ${s.TABLE_BORDER_COLOR}`,fontWeight:"normal",verticalAlign:"middle",padding:"0 4px",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",lineHeight:"14px",":hover":{backgroundColor:s.TABLE_TH_HOVER_COLOR}},div:{whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",fontSize:s.BASE_FONT_SIZE,lineHeight:"120%"}},TableInspectorLeftBorder:{none:{borderLeft:"none"},solid:{borderLeft:`1px solid ${s.TABLE_BORDER_COLOR}`}},TableInspectorSortIcon:{display:"block",marginRight:3,width:8,height:7,marginTop:-7,color:s.TABLE_SORT_ICON_COLOR,fontSize:12,...cs}}),Ss="chromeLight",jo=R.createContext(Tn(jn[Ss])),cn=s=>R.useContext(jo)[s],Vp=s=>({theme:t=Ss,...n})=>{const i=R.useMemo(()=>{switch(Object.prototype.toString.call(t)){case"[object String]":return Tn(jn[t]);case"[object Object]":return Tn(t);default:return Tn(jn[Ss])}},[t]);return T.createElement(jo.Provider,{value:i},T.createElement(s,{...n}))},zp=({expanded:s,styles:e})=>T.createElement("span",{style:{...e.base,...s?e.expanded:e.collapsed}},"▶"),Up=R.memo(s=>{s={expanded:!0,nodeRenderer:({name:d})=>T.createElement("span",null,d),onClick:()=>{},shouldShowArrow:!1,shouldShowPlaceholder:!0,...s};const{expanded:e,onClick:t,children:n,nodeRenderer:i,title:r,shouldShowArrow:o,shouldShowPlaceholder:a}=s,l=cn("TreeNode"),c=i;return T.createElement("li",{"aria-expanded":e,role:"treeitem",style:l.treeNodeBase,title:r},T.createElement("div",{style:l.treeNodePreviewContainer,onClick:t},o||R.Children.count(n)>0?T.createElement(zp,{expanded:e,styles:l.treeNodeArrow}):a&&T.createElement("span",{style:l.treeNodePlaceholder}," "),T.createElement(c,{...s})),T.createElement("ol",{role:"group",style:l.treeNodeChildNodesContainer},e?n:void 0))}),Bn="$",Vi="*";function Sn(s,e){return!e(s).next().done}var $p=s=>Array.from({length:s},(e,t)=>[Bn].concat(Array.from({length:t},()=>"*")).join(".")),Kp=(s,e,t,n,i)=>{const r=[].concat($p(n)).concat(t).filter(a=>typeof a=="string"),o=[];return r.forEach(a=>{const l=a.split("."),c=(d,u,h)=>{if(h===l.length){o.push(u);return}const m=l[h];if(h===0)Sn(d,e)&&(m===Bn||m===Vi)&&c(d,Bn,h+1);else if(m===Vi)for(const{name:_,data:b}of e(d))Sn(b,e)&&c(b,`${u}.${_}`,h+1);else{const _=d[m];Sn(_,e)&&c(_,`${u}.${m}`,h+1)}};c(s,"",0)}),o.reduce((a,l)=>(a[l]=!0,a),{...i})},Bo=R.memo(s=>{const{data:e,dataIterator:t,path:n,depth:i,nodeRenderer:r}=s,[o,a]=R.useContext(No),l=Sn(e,t),c=!!o[n],d=R.useCallback(()=>l&&a(u=>({...u,[n]:!c})),[l,a,n,c]);return T.createElement(Up,{expanded:c,onClick:d,shouldShowArrow:l,shouldShowPlaceholder:i>0,nodeRenderer:r,...s},c?[...t(e)].map(({name:u,data:h,...m})=>T.createElement(Bo,{name:u,data:h,depth:i+1,path:`${n}.${u}`,key:u,dataIterator:t,nodeRenderer:r,...m})):null)}),qp=R.memo(({name:s,data:e,dataIterator:t,nodeRenderer:n,expandPaths:i,expandLevel:r})=>{const o=cn("TreeView"),a=R.useState({}),[,l]=a;return R.useLayoutEffect(()=>l(c=>Kp(e,t,i,r,c)),[e,t,i,r]),T.createElement(No.Provider,{value:a},T.createElement("ol",{role:"tree",style:o.treeViewOutline},T.createElement(Bo,{name:s,data:e,dataIterator:t,depth:0,path:Bn,nodeRenderer:n})))}),bi=({name:s,dimmed:e=!1,styles:t={}})=>{const n=cn("ObjectName"),i={...n.base,...e?n.dimmed:{},...t};return T.createElement("span",{style:i},s)},Pn=({object:s,styles:e})=>{const t=cn("ObjectValue"),n=i=>({...t[i],...e});switch(typeof s){case"bigint":return T.createElement("span",{style:n("objectValueNumber")},String(s),"n");case"number":return T.createElement("span",{style:n("objectValueNumber")},String(s));case"string":return T.createElement("span",{style:n("objectValueString")},'"',s,'"');case"boolean":return T.createElement("span",{style:n("objectValueBoolean")},String(s));case"undefined":return T.createElement("span",{style:n("objectValueUndefined")},"undefined");case"object":return s===null?T.createElement("span",{style:n("objectValueNull")},"null"):s instanceof Date?T.createElement("span",null,s.toString()):s instanceof RegExp?T.createElement("span",{style:n("objectValueRegExp")},s.toString()):Array.isArray(s)?T.createElement("span",null,`Array(${s.length})`):s.constructor?typeof s.constructor.isBuffer=="function"&&s.constructor.isBuffer(s)?T.createElement("span",null,`Buffer[${s.length}]`):T.createElement("span",null,s.constructor.name):T.createElement("span",null,"Object");case"function":return T.createElement("span",null,T.createElement("span",{style:n("objectValueFunctionPrefix")},"ƒ "),T.createElement("span",{style:n("objectValueFunctionName")},s.name,"()"));case"symbol":return T.createElement("span",{style:n("objectValueSymbol")},s.toString());default:return T.createElement("span",null)}},Gp=Object.prototype.hasOwnProperty,Jp=Object.prototype.propertyIsEnumerable;function Ps(s,e){const t=Object.getOwnPropertyDescriptor(s,e);if(t.get)try{return t.get()}catch{return t.get}return s[e]}function zi(s,e){return s.length===0?[]:s.slice(1).reduce((t,n)=>t.concat([e,n]),[s[0]])}var As=({data:s})=>{const e=cn("ObjectPreview"),t=s;if(typeof t!="object"||t===null||t instanceof Date||t instanceof RegExp)return T.createElement(Pn,{object:t});if(Array.isArray(t)){const n=e.arrayMaxProperties,i=t.slice(0,n).map((o,a)=>T.createElement(Pn,{key:a,object:o}));t.length>n&&i.push(T.createElement("span",{key:"ellipsis"},"…"));const r=t.length;return T.createElement(T.Fragment,null,T.createElement("span",{style:e.objectDescription},r===0?"":`(${r}) `),T.createElement("span",{style:e.preview},"[",zi(i,", "),"]"))}else{const n=e.objectMaxProperties,i=[];for(const o in t)if(Gp.call(t,o)){let a;i.length===n-1&&Object.keys(t).length>n&&(a=T.createElement("span",{key:"ellipsis"},"…"));const l=Ps(t,o);if(i.push(T.createElement("span",{key:o},T.createElement(bi,{name:o||'""'}),": ",T.createElement(Pn,{object:l}),a)),a)break}const r=t.constructor?t.constructor.name:"Object";return T.createElement(T.Fragment,null,T.createElement("span",{style:e.objectDescription},r==="Object"?"":`${r} `),T.createElement("span",{style:e.preview},"{",zi(i,", "),"}"))}},Yp=({name:s,data:e})=>typeof s=="string"?T.createElement("span",null,T.createElement(bi,{name:s}),T.createElement("span",null,": "),T.createElement(As,{data:e})):T.createElement(As,{data:e}),Wo=({name:s,data:e,isNonenumerable:t=!1})=>{const n=e;return T.createElement("span",null,typeof s=="string"?T.createElement(bi,{name:s,dimmed:t}):T.createElement(As,{data:s}),T.createElement("span",null,": "),T.createElement(Pn,{object:n}))},Xp=(s,e)=>function*(n){if(!(typeof n=="object"&&n!==null||typeof n=="function"))return;const r=Array.isArray(n);if(!r&&n[Symbol.iterator]){let o=0;for(const a of n){if(Array.isArray(a)&&a.length===2){const[l,c]=a;yield{name:l,data:c}}else yield{name:o.toString(),data:a};o++}}else{const o=Object.getOwnPropertyNames(n);e===!0&&!r?o.sort():typeof e=="function"&&o.sort(e);for(const a of o)if(Jp.call(n,a)){const l=Ps(n,a);yield{name:a||'""',data:l}}else if(s){let l;try{l=Ps(n,a)}catch{}l!==void 0&&(yield{name:a,data:l,isNonenumerable:!0})}s&&n!==Object.prototype&&(yield{name:"__proto__",data:Object.getPrototypeOf(n),isNonenumerable:!0})}},Zp=({depth:s,name:e,data:t,isNonenumerable:n})=>s===0?T.createElement(Yp,{name:e,data:t}):T.createElement(Wo,{name:e,data:t,isNonenumerable:n}),Qp=({showNonenumerable:s=!1,sortObjectKeys:e,nodeRenderer:t,...n})=>{const i=Xp(s,e),r=t||Zp;return T.createElement(qp,{nodeRenderer:r,dataIterator:i,...n})},e_=Vp(Qp);Mp(Bp());function t_(s){return s.msg_id!==void 0}class Ft{constructor(e,t){this._threads=e,this._collapsed=t,this._index=-1,this._child=null}iter(){return this}[Symbol.iterator](){return{next:()=>{if(this._child){const t=this._child.next();if(t!==void 0)return{value:t,done:!1};this._child=null}if(++this._index,this._index>=this._threads.length)return{done:!0};const e=this._threads[this._index];return e.children.length>0&&!this._collapsed[e.args.msg.header.msg_id]&&(this._child=new Ft(e.children,this._collapsed)),{value:{args:e.args,hasChildren:e.children.length>0},done:!1}}}}next(){if(this._child){const t=this._child.next();if(t!==void 0)return t;this._child=null}if(++this._index,this._index>=this._threads.length)return;const e=this._threads[this._index];return e.children.length>0&&!this._collapsed[e.args.msg.header.msg_id]&&(this._child=new Ft(e.children,this._collapsed)),{args:e.args,hasChildren:e.children.length>0}}clone(){const e=new Ft(this._threads,this._collapsed);return e._index=this._index,this._child&&(e._child=this._child.clone()),e}_index;_child;_threads;_collapsed}class Ho extends ml{constructor(e){super(),this.kernel=e??null}clear(){this._log.splice(0,this._log.length),this._messages={},this._childLUT={},this._roots=[],this.stateChanged.emit(void 0)}get kernel(){return this._kernel}set kernel(e){this._kernel&&this._kernel.anyMessage.disconnect(this.onMessage,this),this._kernel=e,this._kernel&&this._kernel.anyMessage.connect(this.onMessage,this)}get log(){return this._log}get tree(){return this._roots.map(e=>this.getThread(e,!1))}depth(e){if(e===null)return-1;let t=0;for(;e=this._findParent(e);)++t;return t}getThread(e,t=!0){const n=this._messages[e];if(t){let a=n,l;for(;l=this._findParent(a);)a=l;return this.getThread(a.msg.header.msg_id,!1)}const r=(this._childLUT[e]||[]).map(a=>this.getThread(a,!1));return{args:this._messages[e],children:r}}onMessage(e,t){const{msg:n}=t;this._log.push(t),this._messages[n.header.msg_id]=t;const i=this._findParent(t);if(i===null)this._roots.push(n.header.msg_id);else{const r=i.msg.header;this._childLUT[r.msg_id]=this._childLUT[r.msg_id]||[],this._childLUT[r.msg_id].push(n.header.msg_id)}this.stateChanged.emit(void 0)}_findParent(e){return t_(e.msg.parent_header)&&this._messages[e.msg.parent_header.msg_id]||null}_log=[];_kernel=null;_messages={};_childLUT={};_roots=[]}const n_={BASE_FONT_FAMILY:"var(--jp-code-font-family)",BASE_FONT_SIZE:"var(--jp-code-font-size)",BASE_LINE_HEIGHT:"var(--jp-code-line-height)",BASE_BACKGROUND_COLOR:"var(--jp-layout-color0)",BASE_COLOR:"var(--jp-content-font-color1)",OBJECT_NAME_COLOR:"var(--jp-mirror-editor-attribute-color)",OBJECT_VALUE_NULL_COLOR:"var(--jp-mirror-editor-builtin-color)",OBJECT_VALUE_UNDEFINED_COLOR:"var(--jp-mirror-editor-builtin-color)",OBJECT_VALUE_REGEXP_COLOR:"var(--jp-mirror-editor-string-color)",OBJECT_VALUE_STRING_COLOR:"var(--jp-mirror-editor-string-color)",OBJECT_VALUE_SYMBOL_COLOR:"var(--jp-mirror-editor-operator-color)",OBJECT_VALUE_NUMBER_COLOR:"var(--jp-mirror-editor-number-color)",OBJECT_VALUE_BOOLEAN_COLOR:"var(--jp-mirror-editor-builtin-color))",OBJECT_VALUE_FUNCTION_KEYWORD_COLOR:"var(--jp-mirror-editor-def-color))",ARROW_COLOR:"var(--jp-content-font-color2)",ARROW_MARGIN_RIGHT:3,ARROW_FONT_SIZE:12,TREENODE_FONT_FAMILY:"var(--jp-code-font-family)",TREENODE_FONT_SIZE:"var(--jp-code-font-size)",TREENODE_LINE_HEIGHT:"var(--jp-code-line-height)",TREENODE_PADDING_LEFT:12};function s_(s){const{name:e,depth:t,isNonenumerable:n,data:i}=s;if(t!==0)return f.jsx(Wo,{name:e,data:i,isNonenumerable:n},"node-label");const r=i;return f.jsx("span",{children:r.header.msg_id},"node-label")}function i_(s){const e=s.message,t=e.header.msg_id,n=s.collapsed?"jp-mod-collapsed":"",i=s.hasChildren?s.collapsed?Qs:$n:null,r=s.hasChildren?"jp-mod-children":"",o=s.hasChildren?0:-1;return[f.jsx("div",{className:"dla-KernelInspector-threadnode",onClick:()=>{s.onCollapse(s.message)},children:f.jsxs("div",{style:{paddingLeft:16*s.depth},children:[f.jsx("button",{className:`dla-KernelInspector-threadcollapser ${n} ${r}`,tabIndex:o,children:i&&f.jsx(i.react,{className:"kspy-collapser-icon"})}),f.jsxs("span",{className:"dla-KernelInspector-threadlabel",children:[e.channel,".",e.header.msg_type]})]})},`threadnode-${t}`),f.jsx("div",{className:"dla-KernelInspector-message",children:f.jsx(e_,{data:e,theme:n_,nodeRenderer:s_})},`message-${t}`)]}class Vo extends pl{constructor(e){super(e),this.id=`kernelspy-messagelog-${Kn()}`,this.addClass("dla-KernelInspector-messagelog")}render(){const e=this.model,t=[];t.push(f.jsx("span",{className:"dla-KernelInspector-logheader",children:"Threads"},"header-thread"),f.jsx("span",{className:"dla-KernelInspector-logheader",children:"Contents"},"header-contents"),f.jsx("span",{className:"dla-KernelInspector-logheader dla-KernelInspector-divider"},"header-divider"));const n=new Ft(e.tree,this.collapsed);let i=!0;for(const r of n)if(r){const o=e.depth(r.args);o===0&&(i?i=!1:t.push(f.jsx("span",{className:"dla-KernelInspector-divider"},`'divider-${r.args.msg.header.msg_id}`)));const a=this.collapsed[r.args.msg.header.msg_id];t.push(...i_({message:r.args.msg,depth:o,collapsed:a,hasChildren:r.hasChildren,onCollapse:l=>{this.onCollapse(l)}}))}return t}collapseAll(){for(const e of this.model.log)this.collapsed[e.msg.header.msg_id]=!0;this.update()}expandAll(){this.collapsed={},this.update()}onCollapse(e){const t=e.header.msg_id;this.collapsed[t]=!this.collapsed[t],this.update()}collapsed={}}class zo extends X{constructor(e){super(),this._model=new Ho(e),this.addClass("dla-KernelInspector-view"),this.id=`kernelspy-${Kn()}`,this.title.label="Kernel spy",this.title.closable=!0,this.title.icon=Cs;const t=this.layout=new tt;this._toolbar=new mh,this._toolbar.addClass("dla-KernelInspector-toolbar"),this._messagelog=new Vo(this._model),t.addWidget(this._toolbar),t.addWidget(this._messagelog),tt.setStretch(this._toolbar,0),tt.setStretch(this._messagelog,1),this.collapseAllButton=new En({onClick:()=>{this._messagelog.collapseAll()},className:"dla-KernelInspector-collapseAll",icon:Qs,tooltip:"Collapse all threads"}),this._toolbar.addItem("collapse-all",this.collapseAllButton),this.expandAllButton=new En({onClick:()=>{this._messagelog.expandAll()},className:"dla-KernelInspector-expandAll",icon:$n,tooltip:"Expand all threads"}),this._toolbar.addItem("expand-all",this.expandAllButton),this.clearAllButton=new En({onClick:()=>{this._model.clear()},className:"dla-KernelInspector-clearAll",icon:Sr,tooltip:"Clear all threads"}),this._toolbar.addItem("clear-all",this.clearAllButton)}onActivateRequest(e){this.node.contains(document.activeElement)||this.collapseAllButton.node.focus()}get model(){return this._model}_toolbar;_messagelog;_model;clearAllButton;expandAllButton;collapseAllButton}const r_=s=>{const{kernel:e}=s,[t,n]=R.useState();return R.useEffect(()=>{e?.ready.then(()=>{const i=new zo(e?.connection);n(i)})},[e]),t?f.jsx(ee,{sx:{"& dla-KernelInspector-view":{height:"1000px"},"& .dla-KernelInspector-messagelog":{height:"100px",minHeight:"100px"}},children:f.jsx(Vt,{children:t})}):f.jsx(f.Fragment,{})},o_=()=>f.jsx(f.Fragment,{}),a_=()=>f.jsx(f.Fragment,{}),l_=()=>{const{serviceManager:s}=Je(),[e,t]=R.useState(),[n,i]=R.useState(new Map),r=a=>{t(Array.from(a.kernels.running()))};R.useEffect(()=>{s?.kernels.refreshRunning().then(()=>{const a=Array.from(s.kernels.running());t(a)}),s?.kernelspecs.refreshSpecs().then(()=>{const a=Object.values(s.kernelspecs.specs.kernelspecs),l=new Map;a.forEach(d=>{const u=d?.name;if(u?.startsWith("run-")){const h=d?.metadata;if(h){const m=n.get(u),_={description:h.description,notebookExampleUrl:h.notebook_example_url};jt.deepEqual(m??{},_)||l.set(u,_)}}});const c=new Map([...n,...l]);l.size&&i(c)})},[s]);const o=(a,l)=>{a.kernels.shutdown(l).then(()=>{console.log(`Kernel ${l} is terminated.`),r(a)})};return f.jsx(ee,{mt:3,style:{width:"1000px"},children:e?f.jsxs(as.Container,{children:[f.jsx(as.Title,{as:"h2",id:"images",children:"Kernels"}),f.jsx(as.Subtitle,{as:"p",id:"images-subtitle",children:"Available kernels."}),f.jsx(tp,{"aria-labelledby":"running-kernels","aria-describedby":"running-kernels-subtitle",data:e,columns:[{header:"Name",field:"name",renderCell:a=>f.jsx(be,{children:a.name})},{header:"Description",id:"description",renderCell:a=>f.jsx(be,{children:n.get(a.name)?.description})},{header:"State",field:"execution_state",renderCell:a=>f.jsx(be,{children:a.execution_state})},{header:"Example",id:"example-action",renderCell:a=>f.jsx(f.Fragment,{children:f.jsx(Es,{"aria-label":`Create an example notebook for kernel ${a.name}`,icon:bh,size:"small",onClick:()=>{}})})},{header:"Delete",id:"delete-action",renderCell:a=>f.jsx(f.Fragment,{children:f.jsx(Es,{"aria-label":`Delete the kernel ${a.name}`,icon:vh,size:"small",onClick:()=>{o(s,a.id)}})})}]})]}):f.jsxs(hn,{border:!0,children:[f.jsx(hn.Visual,{children:f.jsx(wh,{size:"medium"})}),f.jsx(hn.Heading,{children:"Kernels"}),f.jsx(hn.Description,{children:f.jsxs(ee,{sx:{textAlign:"center"},children:[f.jsx(ee,{children:f.jsx(sn,{})}),f.jsx(ee,{children:"No kernel found so far..."})]})})]})})},c_=s=>{const{selectKernel:e,selectKernelSpec:t}=s,{serviceManager:n}=Je(),[i,r]=R.useState(),[o,a]=R.useState();return R.useEffect(()=>{n?.ready.then(()=>{n.kernelspecs.refreshSpecs().then(()=>{const l=n.kernelspecs.specs?.kernelspecs;a(l)})}),n?.kernels.refreshRunning().then(()=>{const l=Array.from(n.kernels.running());r(l)})},[n]),f.jsx(f.Fragment,{children:f.jsxs(Qn,{children:[f.jsx(Qn.Anchor,{children:f.jsx(Es,{"aria-labelledby":"",icon:Ni,variant:"invisible"})}),f.jsx(Qn.Overlay,{width:"large",children:f.jsxs(Xe,{showDividers:!0,children:[i&&f.jsx(Xe.Group,{title:"Connect to a running Kernel",children:i.map((l,c)=>f.jsxs(Xe.Item,{onSelect:d=>{e(l)},children:[f.jsx(Xe.LeadingVisual,{children:f.jsx(Ch,{})}),l.name,f.jsx(Xe.Description,{variant:"block",children:l.id})]},l?.id||c))}),f.jsx(Xe.Group,{title:"Launch a new Kernel",children:o&&Object.values(o).map((l,c)=>f.jsxs(Xe.Item,{onSelect:d=>{t(l)},children:[f.jsx(Xe.LeadingVisual,{children:f.jsx(Ni,{})}),l?.name,f.jsx(Xe.Description,{variant:"block",children:l?.display_name})]},l?.name||c))})]})})]})})};var d_=typeof window<"u"?R.useLayoutEffect:R.useEffect;function u_(s,e){const t=R.useRef(s);d_(()=>{t.current=s},[s]),R.useEffect(()=>{const n=setInterval(()=>{t.current()},e);return()=>{clearInterval(n)}},[e])}var An={exports:{}},h_=An.exports,Ui;function f_(){return Ui||(Ui=1,(function(s,e){(function(n,i){s.exports=i(_l())})(h_,function(t){return(function(n){var i={};function r(o){if(i[o])return i[o].exports;var a=i[o]={i:o,l:!1,exports:{}};return n[o].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=n,r.c=i,r.d=function(o,a,l){r.o(o,a)||Object.defineProperty(o,a,{configurable:!1,enumerable:!0,get:l})},r.n=function(o){var a=o&&o.__esModule?(function(){return o.default}):(function(){return o});return r.d(a,"a",a),a},r.o=function(o,a){return Object.prototype.hasOwnProperty.call(o,a)},r.p="/",r(r.s=11)})([(function(n,i,r){(function(o){if(o.env.NODE_ENV!=="production"){var a=typeof Symbol=="function"&&Symbol.for&&Symbol.for("react.element")||60103,l=function(d){return typeof d=="object"&&d!==null&&d.$$typeof===a},c=!0;n.exports=r(14)(l,c)}else n.exports=r(16)()}).call(i,r(2))}),(function(n,i){n.exports=t}),(function(n,i){var r=n.exports={},o,a;function l(){throw new Error("setTimeout has not been defined")}function c(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?o=setTimeout:o=l}catch{o=l}try{typeof clearTimeout=="function"?a=clearTimeout:a=c}catch{a=c}})();function d(y){if(o===setTimeout)return setTimeout(y,0);if((o===l||!o)&&setTimeout)return o=setTimeout,setTimeout(y,0);try{return o(y,0)}catch{try{return o.call(null,y,0)}catch{return o.call(this,y,0)}}}function u(y){if(a===clearTimeout)return clearTimeout(y);if((a===c||!a)&&clearTimeout)return a=clearTimeout,clearTimeout(y);try{return a(y)}catch{try{return a.call(null,y)}catch{return a.call(this,y)}}}var h=[],m=!1,_,b=-1;function g(){!m||!_||(m=!1,_.length?h=_.concat(h):b=-1,h.length&&p())}function p(){if(!m){var y=d(g);m=!0;for(var C=h.length;C;){for(_=h,h=[];++b<C;)_&&_[b].run();b=-1,C=h.length}_=null,m=!1,u(y)}}r.nextTick=function(y){var C=new Array(arguments.length-1);if(arguments.length>1)for(var E=1;E<arguments.length;E++)C[E-1]=arguments[E];h.push(new w(y,C)),h.length===1&&!m&&d(p)};function w(y,C){this.fun=y,this.array=C}w.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={};function v(){}r.on=v,r.addListener=v,r.once=v,r.off=v,r.removeListener=v,r.removeAllListeners=v,r.emit=v,r.prependListener=v,r.prependOnceListener=v,r.listeners=function(y){return[]},r.binding=function(y){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(y){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(o){return o.reduce(function(a,l){return a+l})/o.length}}),(function(n,i,r){function o(l){return function(){return l}}var a=function(){};a.thatReturns=o,a.thatReturnsFalse=o(!1),a.thatReturnsTrue=o(!0),a.thatReturnsNull=o(null),a.thatReturnsThis=function(){return this},a.thatReturnsArgument=function(l){return l},n.exports=a}),(function(n,i,r){(function(o){var a=function(d){};o.env.NODE_ENV!=="production"&&(a=function(d){if(d===void 0)throw new Error("invariant requires an error message argument")});function l(c,d,u,h,m,_,b,g){if(a(d),!c){var p;if(d===void 0)p=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var w=[u,h,m,_,b,g],v=0;p=new Error(d.replace(/%s/g,function(){return w[v++]})),p.name="Invariant Violation"}throw p.framesToPop=1,p}}n.exports=l}).call(i,r(2))}),(function(n,i,r){var o="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";n.exports=o}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(o){return Math.min.apply(Math,o)}}),(function(n,i,r){(function(o){var a=r(4),l=a;if(o.env.NODE_ENV!=="production"){var c=function(u){for(var h=arguments.length,m=Array(h>1?h-1:0),_=1;_<h;_++)m[_-1]=arguments[_];var b=0,g="Warning: "+u.replace(/%s/g,function(){return m[b++]});typeof console<"u"&&console.error(g);try{throw new Error(g)}catch{}};l=function(u,h){if(h===void 0)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(h.indexOf("Failed Composite propType: ")!==0&&!u){for(var m=arguments.length,_=Array(m>2?m-2:0),b=2;b<m;b++)_[b-2]=arguments[b];c.apply(void 0,[h].concat(_))}}}n.exports=l}).call(i,r(2))}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(o){return Math.max.apply(Math,o)}}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=r(3),a=l(o);function l(c){return c&&c.__esModule?c:{default:c}}i.default=function(c){var d=(0,a.default)(c),u=c.map(function(m){return Math.pow(m-d,2)}),h=(0,a.default)(u);return Math.sqrt(h)}}),(function(n,i,r){n.exports=r(12)}),(function(n,i,r){n.exports=r(13)}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0}),i.SparklinesText=i.SparklinesNormalBand=i.SparklinesReferenceLine=i.SparklinesSpots=i.SparklinesBars=i.SparklinesCurve=i.SparklinesLine=i.Sparklines=void 0;var o=(function(){function L(D,z){for(var K=0;K<z.length;K++){var ue=z[K];ue.enumerable=ue.enumerable||!1,ue.configurable=!0,"value"in ue&&(ue.writable=!0),Object.defineProperty(D,ue.key,ue)}}return function(D,z,K){return z&&L(D.prototype,z),K&&L(D,K),D}})(),a=r(0),l=P(a),c=r(1),d=P(c),u=r(17),h=P(u),m=r(18),_=P(m),b=r(19),g=P(b),p=r(20),w=P(p),v=r(21),y=P(v),C=r(22),E=P(C),x=r(27),S=P(x),A=r(28),I=P(A);function P(L){return L&&L.__esModule?L:{default:L}}function M(L,D){if(!(L instanceof D))throw new TypeError("Cannot call a class as a function")}function j(L,D){if(!L)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return D&&(typeof D=="object"||typeof D=="function")?D:L}function H(L,D){if(typeof D!="function"&&D!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof D);L.prototype=Object.create(D&&D.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),D&&(Object.setPrototypeOf?Object.setPrototypeOf(L,D):L.__proto__=D)}var $=(function(L){H(D,L);function D(z){return M(this,D),j(this,(D.__proto__||Object.getPrototypeOf(D)).call(this,z))}return o(D,[{key:"render",value:function(){var K=this.props,ue=K.data,De=K.limit,k=K.width,B=K.height,te=K.svgWidth,Z=K.svgHeight,G=K.preserveAspectRatio,ie=K.margin,J=K.style,Q=K.max,ne=K.min;if(ue.length===0)return null;var re=(0,I.default)({data:ue,limit:De,width:k,height:B,margin:ie,max:Q,min:ne}),ce={style:J,viewBox:"0 0 "+k+" "+B,preserveAspectRatio:G};return te>0&&(ce.width=te),Z>0&&(ce.height=Z),d.default.createElement("svg",ce,d.default.Children.map(this.props.children,function(St){return d.default.cloneElement(St,{data:ue,points:re,width:k,height:B,margin:ie})}))}}]),D})(c.PureComponent);$.propTypes={data:l.default.array,limit:l.default.number,width:l.default.number,height:l.default.number,svgWidth:l.default.number,svgHeight:l.default.number,preserveAspectRatio:l.default.string,margin:l.default.number,style:l.default.object,min:l.default.number,max:l.default.number,onMouseMove:l.default.func},$.defaultProps={data:[],width:240,height:60,preserveAspectRatio:"none",margin:2},i.Sparklines=$,i.SparklinesLine=_.default,i.SparklinesCurve=g.default,i.SparklinesBars=w.default,i.SparklinesSpots=y.default,i.SparklinesReferenceLine=E.default,i.SparklinesNormalBand=S.default,i.SparklinesText=h.default}),(function(n,i,r){(function(o){var a=r(4),l=r(5),c=r(8),d=r(6),u=r(15);n.exports=function(h,m){var _=typeof Symbol=="function"&&Symbol.iterator,b="@@iterator";function g(k){var B=k&&(_&&k[_]||k[b]);if(typeof B=="function")return B}var p="<<anonymous>>",w={array:E("array"),bool:E("boolean"),func:E("function"),number:E("number"),object:E("object"),string:E("string"),symbol:E("symbol"),any:x(),arrayOf:S,element:A(),instanceOf:I,node:H(),objectOf:M,oneOf:P,oneOfType:j,shape:$};function v(k,B){return k===B?k!==0||1/k===1/B:k!==k&&B!==B}function y(k){this.message=k,this.stack=""}y.prototype=Error.prototype;function C(k){if(o.env.NODE_ENV!=="production")var B={},te=0;function Z(ie,J,Q,ne,re,ce,St){if(ne=ne||p,ce=ce||Q,St!==d){if(m)l(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if(o.env.NODE_ENV!=="production"&&typeof console<"u"){var xi=ne+":"+Q;!B[xi]&&te<3&&(c(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",ce,ne),B[xi]=!0,te++)}}return J[Q]==null?ie?J[Q]===null?new y("The "+re+" `"+ce+"` is marked as required "+("in `"+ne+"`, but its value is `null`.")):new y("The "+re+" `"+ce+"` is marked as required in "+("`"+ne+"`, but its value is `undefined`.")):null:k(J,Q,ne,re,ce)}var G=Z.bind(null,!1);return G.isRequired=Z.bind(null,!0),G}function E(k){function B(te,Z,G,ie,J,Q){var ne=te[Z],re=z(ne);if(re!==k){var ce=K(ne);return new y("Invalid "+ie+" `"+J+"` of type "+("`"+ce+"` supplied to `"+G+"`, expected ")+("`"+k+"`."))}return null}return C(B)}function x(){return C(a.thatReturnsNull)}function S(k){function B(te,Z,G,ie,J){if(typeof k!="function")return new y("Property `"+J+"` of component `"+G+"` has invalid PropType notation inside arrayOf.");var Q=te[Z];if(!Array.isArray(Q)){var ne=z(Q);return new y("Invalid "+ie+" `"+J+"` of type "+("`"+ne+"` supplied to `"+G+"`, expected an array."))}for(var re=0;re<Q.length;re++){var ce=k(Q,re,G,ie,J+"["+re+"]",d);if(ce instanceof Error)return ce}return null}return C(B)}function A(){function k(B,te,Z,G,ie){var J=B[te];if(!h(J)){var Q=z(J);return new y("Invalid "+G+" `"+ie+"` of type "+("`"+Q+"` supplied to `"+Z+"`, expected a single ReactElement."))}return null}return C(k)}function I(k){function B(te,Z,G,ie,J){if(!(te[Z]instanceof k)){var Q=k.name||p,ne=De(te[Z]);return new y("Invalid "+ie+" `"+J+"` of type "+("`"+ne+"` supplied to `"+G+"`, expected ")+("instance of `"+Q+"`."))}return null}return C(B)}function P(k){if(!Array.isArray(k))return o.env.NODE_ENV!=="production"&&c(!1,"Invalid argument supplied to oneOf, expected an instance of array."),a.thatReturnsNull;function B(te,Z,G,ie,J){for(var Q=te[Z],ne=0;ne<k.length;ne++)if(v(Q,k[ne]))return null;var re=JSON.stringify(k);return new y("Invalid "+ie+" `"+J+"` of value `"+Q+"` "+("supplied to `"+G+"`, expected one of "+re+"."))}return C(B)}function M(k){function B(te,Z,G,ie,J){if(typeof k!="function")return new y("Property `"+J+"` of component `"+G+"` has invalid PropType notation inside objectOf.");var Q=te[Z],ne=z(Q);if(ne!=="object")return new y("Invalid "+ie+" `"+J+"` of type "+("`"+ne+"` supplied to `"+G+"`, expected an object."));for(var re in Q)if(Q.hasOwnProperty(re)){var ce=k(Q,re,G,ie,J+"."+re,d);if(ce instanceof Error)return ce}return null}return C(B)}function j(k){if(!Array.isArray(k))return o.env.NODE_ENV!=="production"&&c(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),a.thatReturnsNull;for(var B=0;B<k.length;B++){var te=k[B];if(typeof te!="function")return c(!1,"Invalid argument supplid to oneOfType. Expected an array of check functions, but received %s at index %s.",ue(te),B),a.thatReturnsNull}function Z(G,ie,J,Q,ne){for(var re=0;re<k.length;re++){var ce=k[re];if(ce(G,ie,J,Q,ne,d)==null)return null}return new y("Invalid "+Q+" `"+ne+"` supplied to "+("`"+J+"`."))}return C(Z)}function H(){function k(B,te,Z,G,ie){return L(B[te])?null:new y("Invalid "+G+" `"+ie+"` supplied to "+("`"+Z+"`, expected a ReactNode."))}return C(k)}function $(k){function B(te,Z,G,ie,J){var Q=te[Z],ne=z(Q);if(ne!=="object")return new y("Invalid "+ie+" `"+J+"` of type `"+ne+"` "+("supplied to `"+G+"`, expected `object`."));for(var re in k){var ce=k[re];if(ce){var St=ce(Q,re,G,ie,J+"."+re,d);if(St)return St}}return null}return C(B)}function L(k){switch(typeof k){case"number":case"string":case"undefined":return!0;case"boolean":return!k;case"object":if(Array.isArray(k))return k.every(L);if(k===null||h(k))return!0;var B=g(k);if(B){var te=B.call(k),Z;if(B!==k.entries){for(;!(Z=te.next()).done;)if(!L(Z.value))return!1}else for(;!(Z=te.next()).done;){var G=Z.value;if(G&&!L(G[1]))return!1}}else return!1;return!0;default:return!1}}function D(k,B){return k==="symbol"||B["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&B instanceof Symbol}function z(k){var B=typeof k;return Array.isArray(k)?"array":k instanceof RegExp?"object":D(B,k)?"symbol":B}function K(k){if(typeof k>"u"||k===null)return""+k;var B=z(k);if(B==="object"){if(k instanceof Date)return"date";if(k instanceof RegExp)return"regexp"}return B}function ue(k){var B=K(k);switch(B){case"array":case"object":return"an "+B;case"boolean":case"date":case"regexp":return"a "+B;default:return B}}function De(k){return!k.constructor||!k.constructor.name?p:k.constructor.name}return w.checkPropTypes=u,w.PropTypes=w,w}}).call(i,r(2))}),(function(n,i,r){(function(o){if(o.env.NODE_ENV!=="production")var a=r(5),l=r(8),c=r(6),d={};function u(h,m,_,b,g){if(o.env.NODE_ENV!=="production"){for(var p in h)if(h.hasOwnProperty(p)){var w;try{a(typeof h[p]=="function","%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",b||"React class",_,p),w=h[p](m,p,b,_,null,c)}catch(y){w=y}if(l(!w||w instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",b||"React class",_,p,typeof w),w instanceof Error&&!(w.message in d)){d[w.message]=!0;var v=g?g():"";l(!1,"Failed %s type: %s%s",_,w.message,v??"")}}}}n.exports=u}).call(i,r(2))}),(function(n,i,r){var o=r(4),a=r(5),l=r(6);n.exports=function(){function c(h,m,_,b,g,p){p!==l&&a(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}c.isRequired=c;function d(){return c}var u={array:c,bool:c,func:c,number:c,object:c,string:c,symbol:c,any:c,arrayOf:d,element:c,instanceOf:d,node:c,objectOf:d,oneOf:d,oneOfType:d,shape:d};return u.checkPropTypes=o,u.PropTypes=u,u}}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=(function(){function g(p,w){for(var v=0;v<w.length;v++){var y=w[v];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}return function(p,w,v){return w&&g(p.prototype,w),v&&g(p,v),p}})(),a=r(0),l=u(a),c=r(1),d=u(c);function u(g){return g&&g.__esModule?g:{default:g}}function h(g,p){if(!(g instanceof p))throw new TypeError("Cannot call a class as a function")}function m(g,p){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:g}function _(g,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);g.prototype=Object.create(p&&p.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(g,p):g.__proto__=p)}var b=(function(g){_(p,g);function p(){return h(this,p),m(this,(p.__proto__||Object.getPrototypeOf(p)).apply(this,arguments))}return o(p,[{key:"render",value:function(){var v=this.props,y=v.point,C=v.text,E=v.fontSize,x=v.fontFamily,S=y.x,A=y.y;return d.default.createElement("g",null,d.default.createElement("text",{x:S,y:A,fontFamily:x||"Verdana",fontSize:E||10},C))}}]),p})(d.default.Component);b.propTypes={text:l.default.string,point:l.default.object,fontSize:l.default.number,fontFamily:l.default.string},b.defaultProps={text:"",point:{x:0,y:0}},i.default=b}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=(function(){function g(p,w){for(var v=0;v<w.length;v++){var y=w[v];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}return function(p,w,v){return w&&g(p.prototype,w),v&&g(p,v),p}})(),a=r(0),l=u(a),c=r(1),d=u(c);function u(g){return g&&g.__esModule?g:{default:g}}function h(g,p){if(!(g instanceof p))throw new TypeError("Cannot call a class as a function")}function m(g,p){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:g}function _(g,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);g.prototype=Object.create(p&&p.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(g,p):g.__proto__=p)}var b=(function(g){_(p,g);function p(){return h(this,p),m(this,(p.__proto__||Object.getPrototypeOf(p)).apply(this,arguments))}return o(p,[{key:"render",value:function(){var v=this.props,y=v.data,C=v.points;v.width;var E=v.height,x=v.margin,S=v.color,A=v.style,I=v.onMouseMove,P=C.map(function(D){return[D.x,D.y]}).reduce(function(D,z){return D.concat(z)}),M=[C[C.length-1].x,E-x,x,E-x,x,C[0].y],j=P.concat(M),H={stroke:S||A.stroke||"slategray",strokeWidth:A.strokeWidth||"1",strokeLinejoin:A.strokeLinejoin||"round",strokeLinecap:A.strokeLinecap||"round",fill:"none"},$={stroke:A.stroke||"none",strokeWidth:"0",fillOpacity:A.fillOpacity||".1",fill:A.fill||S||"slategray",pointerEvents:"auto"},L=C.map(function(D,z){return d.default.createElement("circle",{key:z,cx:D.x,cy:D.y,r:2,style:$,onMouseEnter:function(ue){return I("enter",y[z],D)},onClick:function(ue){return I("click",y[z],D)}})});return d.default.createElement("g",null,L,d.default.createElement("polyline",{points:j.join(" "),style:$}),d.default.createElement("polyline",{points:P.join(" "),style:H}))}}]),p})(d.default.Component);b.propTypes={color:l.default.string,style:l.default.object},b.defaultProps={style:{},onMouseMove:function(){}},i.default=b}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=(function(){function g(p,w){for(var v=0;v<w.length;v++){var y=w[v];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}return function(p,w,v){return w&&g(p.prototype,w),v&&g(p,v),p}})(),a=r(0),l=u(a),c=r(1),d=u(c);function u(g){return g&&g.__esModule?g:{default:g}}function h(g,p){if(!(g instanceof p))throw new TypeError("Cannot call a class as a function")}function m(g,p){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:g}function _(g,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);g.prototype=Object.create(p&&p.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(g,p):g.__proto__=p)}var b=(function(g){_(p,g);function p(){return h(this,p),m(this,(p.__proto__||Object.getPrototypeOf(p)).apply(this,arguments))}return o(p,[{key:"render",value:function(){var v=this.props,y=v.points;v.width;var C=v.height,E=v.margin,x=v.color,S=v.style,A=v.divisor,I=A===void 0?.25:A,P=void 0,M=function(K){var ue=void 0;if(!P)ue=[K.x,K.y];else{var De=(K.x-P.x)*I;ue=["C",P.x+De,P.y,K.x-De,K.y,K.x,K.y]}return P=K,ue},j=y.map(function(z){return M(z)}).reduce(function(z,K){return z.concat(K)}),H=["L"+y[y.length-1].x,C-E,E,C-E,E,y[0].y],$=j.concat(H),L={stroke:x||S.stroke||"slategray",strokeWidth:S.strokeWidth||"1",strokeLinejoin:S.strokeLinejoin||"round",strokeLinecap:S.strokeLinecap||"round",fill:"none"},D={stroke:S.stroke||"none",strokeWidth:"0",fillOpacity:S.fillOpacity||".1",fill:S.fill||x||"slategray"};return d.default.createElement("g",null,d.default.createElement("path",{d:"M"+$.join(" "),style:D}),d.default.createElement("path",{d:"M"+j.join(" "),style:L}))}}]),p})(d.default.Component);b.propTypes={color:l.default.string,style:l.default.object},b.defaultProps={style:{}},i.default=b}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=(function(){function g(p,w){for(var v=0;v<w.length;v++){var y=w[v];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}return function(p,w,v){return w&&g(p.prototype,w),v&&g(p,v),p}})(),a=r(0),l=u(a),c=r(1),d=u(c);function u(g){return g&&g.__esModule?g:{default:g}}function h(g,p){if(!(g instanceof p))throw new TypeError("Cannot call a class as a function")}function m(g,p){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:g}function _(g,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);g.prototype=Object.create(p&&p.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(g,p):g.__proto__=p)}var b=(function(g){_(p,g);function p(){return h(this,p),m(this,(p.__proto__||Object.getPrototypeOf(p)).apply(this,arguments))}return o(p,[{key:"render",value:function(){var v=this,y=this.props,C=y.points,E=y.height,x=y.style,S=y.barWidth,A=y.margin,I=y.onMouseMove,P=1*(x&&x.strokeWidth||0),M=A?2*A:0,j=S||(C&&C.length>=2?Math.max(0,C[1].x-C[0].x-P-M):0);return d.default.createElement("g",{transform:"scale(1,-1)"},C.map(function(H,$){return d.default.createElement("rect",{key:$,x:H.x-(j+P)/2,y:-E,width:j,height:Math.max(0,E-H.y),style:x,onMouseMove:I&&I.bind(v,H)})}))}}]),p})(d.default.Component);b.propTypes={points:l.default.arrayOf(l.default.object),height:l.default.number,style:l.default.object,barWidth:l.default.number,margin:l.default.number,onMouseMove:l.default.func},b.defaultProps={style:{fill:"slategray"}},i.default=b}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=(function(){function g(p,w){for(var v=0;v<w.length;v++){var y=w[v];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}return function(p,w,v){return w&&g(p.prototype,w),v&&g(p,v),p}})(),a=r(0),l=u(a),c=r(1),d=u(c);function u(g){return g&&g.__esModule?g:{default:g}}function h(g,p){if(!(g instanceof p))throw new TypeError("Cannot call a class as a function")}function m(g,p){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:g}function _(g,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);g.prototype=Object.create(p&&p.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(g,p):g.__proto__=p)}var b=(function(g){_(p,g);function p(){return h(this,p),m(this,(p.__proto__||Object.getPrototypeOf(p)).apply(this,arguments))}return o(p,[{key:"lastDirection",value:function(v){return Math.sign=Math.sign||function(y){return y>0?1:-1},v.length<2?0:Math.sign(v[v.length-2].y-v[v.length-1].y)}},{key:"render",value:function(){var v=this.props,y=v.points;v.width,v.height;var C=v.size,E=v.style,x=v.spotColors,S=d.default.createElement("circle",{cx:y[0].x,cy:y[0].y,r:C,style:E}),A=d.default.createElement("circle",{cx:y[y.length-1].x,cy:y[y.length-1].y,r:C,style:E||{fill:x[this.lastDirection(y)]}});return d.default.createElement("g",null,E&&S,A)}}]),p})(d.default.Component);b.propTypes={size:l.default.number,style:l.default.object,spotColors:l.default.object},b.defaultProps={size:2,spotColors:{"-1":"red",0:"black",1:"green"}},i.default=b}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=(function(){function v(y,C){for(var E=0;E<C.length;E++){var x=C[E];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(y,x.key,x)}}return function(y,C,E){return C&&v(y.prototype,C),E&&v(y,E),y}})(),a=r(0),l=_(a),c=r(1),d=_(c),u=r(23),h=m(u);function m(v){if(v&&v.__esModule)return v;var y={};if(v!=null)for(var C in v)Object.prototype.hasOwnProperty.call(v,C)&&(y[C]=v[C]);return y.default=v,y}function _(v){return v&&v.__esModule?v:{default:v}}function b(v,y){if(!(v instanceof y))throw new TypeError("Cannot call a class as a function")}function g(v,y){if(!v)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y&&(typeof y=="object"||typeof y=="function")?y:v}function p(v,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof y);v.prototype=Object.create(y&&y.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),y&&(Object.setPrototypeOf?Object.setPrototypeOf(v,y):v.__proto__=y)}var w=(function(v){p(y,v);function y(){return b(this,y),g(this,(y.__proto__||Object.getPrototypeOf(y)).apply(this,arguments))}return o(y,[{key:"render",value:function(){var E=this.props,x=E.points,S=E.margin,A=E.type,I=E.style,P=E.value,M=x.map(function(H){return H.y}),j=A=="custom"?P:h[A](M);return d.default.createElement("line",{x1:x[0].x,y1:j+S,x2:x[x.length-1].x,y2:j+S,style:I})}}]),y})(d.default.Component);w.propTypes={type:l.default.oneOf(["max","min","mean","avg","median","custom"]),value:l.default.number,style:l.default.object},w.defaultProps={type:"mean",style:{stroke:"red",strokeOpacity:.75,strokeDasharray:"2, 2"}},i.default=w}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0}),i.variance=i.stdev=i.median=i.midRange=i.avg=i.mean=i.max=i.min=void 0;var o=r(7),a=w(o),l=r(3),c=w(l),d=r(24),u=w(d),h=r(25),m=w(h),_=r(10),b=w(_),g=r(26),p=w(g);function w(v){return v&&v.__esModule?v:{default:v}}i.min=a.default,i.max=a.default,i.mean=c.default,i.avg=c.default,i.midRange=u.default,i.median=m.default,i.stdev=b.default,i.variance=p.default}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=r(7),a=d(o),l=r(9),c=d(l);function d(u){return u&&u.__esModule?u:{default:u}}i.default=function(u){return(0,c.default)(u)-(0,a.default)(u)/2}}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(o){return o.sort(function(a,l){return a-l})[Math.floor(o.length/2)]}}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=r(3),a=l(o);function l(c){return c&&c.__esModule?c:{default:c}}i.default=function(c){var d=(0,a.default)(c),u=c.map(function(h){return Math.pow(h-d,2)});return(0,a.default)(u)}}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=(function(){function y(C,E){for(var x=0;x<E.length;x++){var S=E[x];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(C,S.key,S)}}return function(C,E,x){return E&&y(C.prototype,E),x&&y(C,x),C}})(),a=r(0),l=b(a),c=r(1),d=b(c),u=r(3),h=b(u),m=r(10),_=b(m);function b(y){return y&&y.__esModule?y:{default:y}}function g(y,C){if(!(y instanceof C))throw new TypeError("Cannot call a class as a function")}function p(y,C){if(!y)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return C&&(typeof C=="object"||typeof C=="function")?C:y}function w(y,C){if(typeof C!="function"&&C!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof C);y.prototype=Object.create(C&&C.prototype,{constructor:{value:y,enumerable:!1,writable:!0,configurable:!0}}),C&&(Object.setPrototypeOf?Object.setPrototypeOf(y,C):y.__proto__=C)}var v=(function(y){w(C,y);function C(){return g(this,C),p(this,(C.__proto__||Object.getPrototypeOf(C)).apply(this,arguments))}return o(C,[{key:"render",value:function(){var x=this.props,S=x.points,A=x.margin,I=x.style,P=S.map(function(H){return H.y}),M=(0,h.default)(P),j=(0,_.default)(P);return d.default.createElement("rect",{x:S[0].x,y:M-j+A,width:S[S.length-1].x-S[0].x,height:_.default*2,style:I})}}]),C})(d.default.Component);v.propTypes={style:l.default.object},v.defaultProps={style:{fill:"red",fillOpacity:.1}},i.default=v}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=r(7),a=d(o),l=r(9),c=d(l);function d(u){return u&&u.__esModule?u:{default:u}}i.default=function(u){var h=u.data,m=u.limit,_=u.width,b=_===void 0?1:_,g=u.height,p=g===void 0?1:g,w=u.margin,v=w===void 0?0:w,y=u.max,C=y===void 0?(0,c.default)(h):y,E=u.min,x=E===void 0?(0,a.default)(h):E,S=h.length;m&&m<S&&(h=h.slice(S-m));var A=(p-v*2)/(C-x||2),I=(b-v*2)/((m||S)-(S>1?1:0));return h.map(function(P,M){return{x:M*I+v,y:(C===x?1:C-P)*A+v}})}})])})})(An)),An.exports}var fn=f_();const $i=20,m_=`
354
+ `;class Mo extends Le{constructor(){super(...arguments),this.appearance="outline"}}ul([Ge],Mo.prototype,"appearance",void 0);const wp=Mo.compose({baseName:"search",baseClass:Le,template:mp,styles:vp,shadowOptions:{delegatesFocus:!0}});hl().register(wp());const Cp=R.forwardRef((s,e)=>{const t=R.useRef(null),{className:n,readonly:i,appearance:r,placeholder:o,list:a,pattern:l,readOnly:c,autofocus:d,maxlength:u,minlength:h,size:m,spellcheck:_,disabled:b,required:g,...p}=s;return Ri(t,"input",s.onInput),Ri(t,"change",s.onChange),rt(t,"readOnly",s.readOnly),rt(t,"autofocus",s.autofocus),rt(t,"maxlength",s.maxlength),rt(t,"minlength",s.minlength),rt(t,"size",s.size),rt(t,"spellcheck",s.spellcheck),rt(t,"disabled",s.disabled),rt(t,"required",s.required),R.useImperativeHandle(e,()=>t.current,[t.current]),T.createElement("jp-search",{ref:t,...p,appearance:s.appearance,placeholder:s.placeholder,list:s.list,pattern:s.pattern,class:s.className,exportparts:s.exportparts,for:s.htmlFor,part:s.part,tabindex:s.tabIndex,readonly:s.readonly?"":void 0,style:{...s.style}},s.children)});function Ep(s,e){let t=1/0,n=null;const i=/[\p{L}\p{N}\p{M}]+/gu;let r=!0;for(;r;){let o=i.exec(s);if(!o)break;let a=Dr.matchSumOfDeltas(s,e,o.index);if(!a)break;a.score<=t&&(t=a.score,n=a.indices)}return!n||t===1/0?null:{score:t,indices:n}}const ls=(s,e,t)=>n=>{if(e){const r=s.toLowerCase();return Ep(n,r)}t||(n=n.toLocaleLowerCase(),s=s.toLocaleLowerCase());const i=n.indexOf(s);return i===-1?null:{indices:[...Array(s.length).keys()].map(r=>r+i)}},xp=s=>{var e,t,n;const[i,r]=R.useState((e=s.initialQuery)!==null&&e!==void 0?e:"");s.forceRefresh&&R.useEffect(()=>{s.updateFilter(d=>({}))},[]);const o=R.useRef(!0),a=(t=s.inputRef)!==null&&t!==void 0?t:R.useRef();R.useEffect(()=>{o.current?(o.current=!1,s.initialQuery!==void 0&&s.updateFilter(ls(s.initialQuery,s.useFuzzyFilter,s.caseSensitive),s.initialQuery)):a.current&&s.updateFilter(ls(a.current.value,s.useFuzzyFilter,s.caseSensitive),a.current.value)},[s.updateFilter,s.useFuzzyFilter,s.caseSensitive]);const l=R.useCallback(d=>{const u=d.target;r(u.value),s.updateFilter(ls(u.value,s.useFuzzyFilter,s.caseSensitive),u.value)},[s.updateFilter,s.useFuzzyFilter,s.caseSensitive]),c=(n=s.showIcon)!==null&&n!==void 0?n:!0;return T.createElement(Cp,{role:"search",className:"jp-FilterBox",ref:s.inputRef,value:i,onChange:l,onInput:l,placeholder:s.placeholder,disabled:s.disabled},c&&T.createElement(fl.react,{slot:"end",tag:null}))};class Tp extends ni{constructor(e){var t;super(),this._filterBoxProps={...e},(t=e?.filterSettingsChanged)===null||t===void 0||t.connect((n,i)=>{this._updateProps(i)},this)}render(){return T.createElement(xp,{...this._filterBoxProps})}_updateProps(e){Object.assign(this._filterBoxProps,e),this.update()}}const Sp=s=>new Tp(s);class Pp extends X{constructor(e={}){var t;super();const n=this.layout=new Nr;this.addClass("jp-SidePanel");const i=this._trans=(e.translator||se).load("jupyterlab");e.header&&this.addHeader(e.header);const r=this._content=(t=e.content)!==null&&t!==void 0?t:new Un({...e,layout:Nn.createLayout(e)});r.node.setAttribute("role","region"),r.node.setAttribute("aria-label",i.__("side panel content")),r.addClass("jp-SidePanel-content"),n.addWidget(r),e.toolbar&&this.addToolbar(e.toolbar)}get content(){return this._content}get header(){return this._header||this.addHeader(),this._header}get toolbar(){return this._toolbar||this.addToolbar(),this._toolbar}get widgets(){return this.content.widgets}addWidget(e){this.content.addWidget(e)}insertWidget(e,t){this.content.insertWidget(e,t)}addHeader(e){const t=this._header=e||new pt;t.addClass("jp-SidePanel-header"),this.layout.insertWidget(0,t)}addToolbar(e){const t=this._toolbar=e??new jr;t.addClass("jp-SidePanel-toolbar"),this.layout.insertWidget(this.layout.widgets.length-1,t)}}const Ap=new Ae("@jupyterlab/rendermime:IRenderMimeRegistry",'A service for the rendermime registry for the application. Use this to create renderers for various mime-types in your extension. Many times it will be easier to create a "mime renderer extension" rather than using this service directly.'),ev=new Ae("@jupyterlab/rendermime:ILatexTypesetter","A service for the LaTeX typesetter for the application. Use this if you want to typeset math in your extension."),tv=new Ae("@jupyterlab/rendermime:IMarkdownParser","A service for rendering markdown syntax as HTML content."),nv=new Ae("@jupyterlab/rendermime:IUrlResolverFactory","A factory for resolver of asset URLs."),Rp=s=>{const{serviceManager:e}=s,[t,n]=R.useState(),[i,r]=R.useState([]),[o,a]=R.useState([]),l=()=>{e&&(n(e.serverSettings),e.sessions.refreshRunning().then(()=>{r(Array.from(e.sessions.running())),e.sessions.runningChanged.connect(()=>{})}),e.kernels.refreshRunning().then(()=>{a(Array.from(e.kernels.running())),e.kernels.runningChanged.connect(()=>{})}))};return R.useEffect(()=>{l()},[e]),f.jsx(f.Fragment,{children:e&&f.jsxs(f.Fragment,{children:[f.jsx(ee,{mb:3,children:f.jsx(si,{onClick:l,children:"Refresh"})}),f.jsxs(ee,{children:[f.jsx(be,{as:"h3",children:"Server Settings"}),f.jsx(Ut,{children:"Base URL"}),f.jsxs(be,{children:[" ",t?.baseUrl]})]}),f.jsxs(ee,{children:[f.jsx(be,{as:"h3",children:"Kernels"}),o.map(c=>f.jsxs(ee,{children:[f.jsx(Ut,{children:"Kernel"}),f.jsxs(be,{children:[" ",c.name," - ",c.id," - ",c.connections," ","connections"]})]},c.id))]}),f.jsxs(ee,{children:[f.jsx(be,{as:"h3",children:"Sessions"}),i.map(c=>f.jsxs(ee,{children:[f.jsx(Ut,{children:"Kernel"}),f.jsxs(be,{children:[" ",c.kernel?.name," - ",c.kernel?.id]}),f.jsx(Ut,{style:{marginLeft:10},children:"Session"}),f.jsxs(be,{children:[" ",c.name," - ",c.path," - ",c.type]})]},c.id))]})]})})};var Ip=Object.create,gi=Object.defineProperty,Lp=Object.getOwnPropertyDescriptor,Do=Object.getOwnPropertyNames,Op=Object.getPrototypeOf,kp=Object.prototype.hasOwnProperty,yi=(s,e)=>function(){return e||(0,s[Do(s)[0]])((e={exports:{}}).exports,e),e.exports},Fp=(s,e)=>{for(var t in e)gi(s,t,{get:e[t],enumerable:!0})},Mp=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Do(e))!kp.call(s,i)&&i!==t&&gi(s,i,{get:()=>e[i],enumerable:!(n=Lp(e,i))||n.enumerable});return s},Dp=(s,e,t)=>(t=s!=null?Ip(Op(s)):{},Mp(gi(t,"default",{value:s,enumerable:!0}),s)),Np=yi({"node_modules/is-object/index.js"(s,e){e.exports=function(n){return typeof n=="object"&&n!==null}}}),jp=yi({"node_modules/is-window/index.js"(s,e){e.exports=function(t){if(t==null)return!1;var n=Object(t);return n===n.window}}}),Bp=yi({"node_modules/is-dom/index.js"(s,e){var t=Np(),n=jp();function i(r){return!t(r)||!n(window)||typeof window.Node!="function"?!1:typeof r.nodeType=="number"&&typeof r.nodeName=="string"}e.exports=i}}),jn={};Fp(jn,{chromeDark:()=>Wp,chromeLight:()=>Hp});var Wp={BASE_FONT_FAMILY:"Menlo, monospace",BASE_FONT_SIZE:"11px",BASE_LINE_HEIGHT:1.2,BASE_BACKGROUND_COLOR:"rgb(36, 36, 36)",BASE_COLOR:"rgb(213, 213, 213)",OBJECT_PREVIEW_ARRAY_MAX_PROPERTIES:10,OBJECT_PREVIEW_OBJECT_MAX_PROPERTIES:5,OBJECT_NAME_COLOR:"rgb(227, 110, 236)",OBJECT_VALUE_NULL_COLOR:"rgb(127, 127, 127)",OBJECT_VALUE_UNDEFINED_COLOR:"rgb(127, 127, 127)",OBJECT_VALUE_REGEXP_COLOR:"rgb(233, 63, 59)",OBJECT_VALUE_STRING_COLOR:"rgb(233, 63, 59)",OBJECT_VALUE_SYMBOL_COLOR:"rgb(233, 63, 59)",OBJECT_VALUE_NUMBER_COLOR:"hsl(252, 100%, 75%)",OBJECT_VALUE_BOOLEAN_COLOR:"hsl(252, 100%, 75%)",OBJECT_VALUE_FUNCTION_PREFIX_COLOR:"rgb(85, 106, 242)",HTML_TAG_COLOR:"rgb(93, 176, 215)",HTML_TAGNAME_COLOR:"rgb(93, 176, 215)",HTML_TAGNAME_TEXT_TRANSFORM:"lowercase",HTML_ATTRIBUTE_NAME_COLOR:"rgb(155, 187, 220)",HTML_ATTRIBUTE_VALUE_COLOR:"rgb(242, 151, 102)",HTML_COMMENT_COLOR:"rgb(137, 137, 137)",HTML_DOCTYPE_COLOR:"rgb(192, 192, 192)",ARROW_COLOR:"rgb(145, 145, 145)",ARROW_MARGIN_RIGHT:3,ARROW_FONT_SIZE:12,ARROW_ANIMATION_DURATION:"0",TREENODE_FONT_FAMILY:"Menlo, monospace",TREENODE_FONT_SIZE:"11px",TREENODE_LINE_HEIGHT:1.2,TREENODE_PADDING_LEFT:12,TABLE_BORDER_COLOR:"rgb(85, 85, 85)",TABLE_TH_BACKGROUND_COLOR:"rgb(44, 44, 44)",TABLE_TH_HOVER_COLOR:"rgb(48, 48, 48)",TABLE_SORT_ICON_COLOR:"black",TABLE_DATA_BACKGROUND_IMAGE:"linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0) 50%, rgba(51, 139, 255, 0.0980392) 50%, rgba(51, 139, 255, 0.0980392))",TABLE_DATA_BACKGROUND_SIZE:"128px 32px"},Hp={BASE_FONT_FAMILY:"Menlo, monospace",BASE_FONT_SIZE:"11px",BASE_LINE_HEIGHT:1.2,BASE_BACKGROUND_COLOR:"white",BASE_COLOR:"black",OBJECT_PREVIEW_ARRAY_MAX_PROPERTIES:10,OBJECT_PREVIEW_OBJECT_MAX_PROPERTIES:5,OBJECT_NAME_COLOR:"rgb(136, 19, 145)",OBJECT_VALUE_NULL_COLOR:"rgb(128, 128, 128)",OBJECT_VALUE_UNDEFINED_COLOR:"rgb(128, 128, 128)",OBJECT_VALUE_REGEXP_COLOR:"rgb(196, 26, 22)",OBJECT_VALUE_STRING_COLOR:"rgb(196, 26, 22)",OBJECT_VALUE_SYMBOL_COLOR:"rgb(196, 26, 22)",OBJECT_VALUE_NUMBER_COLOR:"rgb(28, 0, 207)",OBJECT_VALUE_BOOLEAN_COLOR:"rgb(28, 0, 207)",OBJECT_VALUE_FUNCTION_PREFIX_COLOR:"rgb(13, 34, 170)",HTML_TAG_COLOR:"rgb(168, 148, 166)",HTML_TAGNAME_COLOR:"rgb(136, 18, 128)",HTML_TAGNAME_TEXT_TRANSFORM:"lowercase",HTML_ATTRIBUTE_NAME_COLOR:"rgb(153, 69, 0)",HTML_ATTRIBUTE_VALUE_COLOR:"rgb(26, 26, 166)",HTML_COMMENT_COLOR:"rgb(35, 110, 37)",HTML_DOCTYPE_COLOR:"rgb(192, 192, 192)",ARROW_COLOR:"#6e6e6e",ARROW_MARGIN_RIGHT:3,ARROW_FONT_SIZE:12,ARROW_ANIMATION_DURATION:"0",TREENODE_FONT_FAMILY:"Menlo, monospace",TREENODE_FONT_SIZE:"11px",TREENODE_LINE_HEIGHT:1.2,TREENODE_PADDING_LEFT:12,TABLE_BORDER_COLOR:"#aaa",TABLE_TH_BACKGROUND_COLOR:"#eee",TABLE_TH_HOVER_COLOR:"hsla(0, 0%, 90%, 1)",TABLE_SORT_ICON_COLOR:"#6e6e6e",TABLE_DATA_BACKGROUND_IMAGE:"linear-gradient(to bottom, white, white 50%, rgb(234, 243, 255) 50%, rgb(234, 243, 255))",TABLE_DATA_BACKGROUND_SIZE:"128px 32px"},No=R.createContext([{},()=>{}]),cs={WebkitTouchCallout:"none",WebkitUserSelect:"none",KhtmlUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",OUserSelect:"none",userSelect:"none"},Tn=s=>({DOMNodePreview:{htmlOpenTag:{base:{color:s.HTML_TAG_COLOR},tagName:{color:s.HTML_TAGNAME_COLOR,textTransform:s.HTML_TAGNAME_TEXT_TRANSFORM},htmlAttributeName:{color:s.HTML_ATTRIBUTE_NAME_COLOR},htmlAttributeValue:{color:s.HTML_ATTRIBUTE_VALUE_COLOR}},htmlCloseTag:{base:{color:s.HTML_TAG_COLOR},offsetLeft:{marginLeft:-s.TREENODE_PADDING_LEFT},tagName:{color:s.HTML_TAGNAME_COLOR,textTransform:s.HTML_TAGNAME_TEXT_TRANSFORM}},htmlComment:{color:s.HTML_COMMENT_COLOR},htmlDoctype:{color:s.HTML_DOCTYPE_COLOR}},ObjectPreview:{objectDescription:{fontStyle:"italic"},preview:{fontStyle:"italic"},arrayMaxProperties:s.OBJECT_PREVIEW_ARRAY_MAX_PROPERTIES,objectMaxProperties:s.OBJECT_PREVIEW_OBJECT_MAX_PROPERTIES},ObjectName:{base:{color:s.OBJECT_NAME_COLOR},dimmed:{opacity:.6}},ObjectValue:{objectValueNull:{color:s.OBJECT_VALUE_NULL_COLOR},objectValueUndefined:{color:s.OBJECT_VALUE_UNDEFINED_COLOR},objectValueRegExp:{color:s.OBJECT_VALUE_REGEXP_COLOR},objectValueString:{color:s.OBJECT_VALUE_STRING_COLOR},objectValueSymbol:{color:s.OBJECT_VALUE_SYMBOL_COLOR},objectValueNumber:{color:s.OBJECT_VALUE_NUMBER_COLOR},objectValueBoolean:{color:s.OBJECT_VALUE_BOOLEAN_COLOR},objectValueFunctionPrefix:{color:s.OBJECT_VALUE_FUNCTION_PREFIX_COLOR,fontStyle:"italic"},objectValueFunctionName:{fontStyle:"italic"}},TreeView:{treeViewOutline:{padding:0,margin:0,listStyleType:"none"}},TreeNode:{treeNodeBase:{color:s.BASE_COLOR,backgroundColor:s.BASE_BACKGROUND_COLOR,lineHeight:s.TREENODE_LINE_HEIGHT,cursor:"default",boxSizing:"border-box",listStyle:"none",fontFamily:s.TREENODE_FONT_FAMILY,fontSize:s.TREENODE_FONT_SIZE},treeNodePreviewContainer:{},treeNodePlaceholder:{whiteSpace:"pre",fontSize:s.ARROW_FONT_SIZE,marginRight:s.ARROW_MARGIN_RIGHT,...cs},treeNodeArrow:{base:{color:s.ARROW_COLOR,display:"inline-block",fontSize:s.ARROW_FONT_SIZE,marginRight:s.ARROW_MARGIN_RIGHT,...parseFloat(s.ARROW_ANIMATION_DURATION)>0?{transition:`transform ${s.ARROW_ANIMATION_DURATION} ease 0s`}:{},...cs},expanded:{WebkitTransform:"rotateZ(90deg)",MozTransform:"rotateZ(90deg)",transform:"rotateZ(90deg)"},collapsed:{WebkitTransform:"rotateZ(0deg)",MozTransform:"rotateZ(0deg)",transform:"rotateZ(0deg)"}},treeNodeChildNodesContainer:{margin:0,paddingLeft:s.TREENODE_PADDING_LEFT}},TableInspector:{base:{color:s.BASE_COLOR,position:"relative",border:`1px solid ${s.TABLE_BORDER_COLOR}`,fontFamily:s.BASE_FONT_FAMILY,fontSize:s.BASE_FONT_SIZE,lineHeight:"120%",boxSizing:"border-box",cursor:"default"}},TableInspectorHeaderContainer:{base:{top:0,height:"17px",left:0,right:0,overflowX:"hidden"},table:{tableLayout:"fixed",borderSpacing:0,borderCollapse:"separate",height:"100%",width:"100%",margin:0}},TableInspectorDataContainer:{tr:{display:"table-row"},td:{boxSizing:"border-box",border:"none",height:"16px",verticalAlign:"top",padding:"1px 4px",WebkitUserSelect:"text",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",lineHeight:"14px"},div:{position:"static",top:"17px",bottom:0,overflowY:"overlay",transform:"translateZ(0)",left:0,right:0,overflowX:"hidden"},table:{positon:"static",left:0,top:0,right:0,bottom:0,borderTop:"0 none transparent",margin:0,backgroundImage:s.TABLE_DATA_BACKGROUND_IMAGE,backgroundSize:s.TABLE_DATA_BACKGROUND_SIZE,tableLayout:"fixed",borderSpacing:0,borderCollapse:"separate",width:"100%",fontSize:s.BASE_FONT_SIZE,lineHeight:"120%"}},TableInspectorTH:{base:{position:"relative",height:"auto",textAlign:"left",backgroundColor:s.TABLE_TH_BACKGROUND_COLOR,borderBottom:`1px solid ${s.TABLE_BORDER_COLOR}`,fontWeight:"normal",verticalAlign:"middle",padding:"0 4px",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",lineHeight:"14px",":hover":{backgroundColor:s.TABLE_TH_HOVER_COLOR}},div:{whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",fontSize:s.BASE_FONT_SIZE,lineHeight:"120%"}},TableInspectorLeftBorder:{none:{borderLeft:"none"},solid:{borderLeft:`1px solid ${s.TABLE_BORDER_COLOR}`}},TableInspectorSortIcon:{display:"block",marginRight:3,width:8,height:7,marginTop:-7,color:s.TABLE_SORT_ICON_COLOR,fontSize:12,...cs}}),Ss="chromeLight",jo=R.createContext(Tn(jn[Ss])),cn=s=>R.useContext(jo)[s],Vp=s=>({theme:t=Ss,...n})=>{const i=R.useMemo(()=>{switch(Object.prototype.toString.call(t)){case"[object String]":return Tn(jn[t]);case"[object Object]":return Tn(t);default:return Tn(jn[Ss])}},[t]);return T.createElement(jo.Provider,{value:i},T.createElement(s,{...n}))},zp=({expanded:s,styles:e})=>T.createElement("span",{style:{...e.base,...s?e.expanded:e.collapsed}},"▶"),Up=R.memo(s=>{s={expanded:!0,nodeRenderer:({name:d})=>T.createElement("span",null,d),onClick:()=>{},shouldShowArrow:!1,shouldShowPlaceholder:!0,...s};const{expanded:e,onClick:t,children:n,nodeRenderer:i,title:r,shouldShowArrow:o,shouldShowPlaceholder:a}=s,l=cn("TreeNode"),c=i;return T.createElement("li",{"aria-expanded":e,role:"treeitem",style:l.treeNodeBase,title:r},T.createElement("div",{style:l.treeNodePreviewContainer,onClick:t},o||R.Children.count(n)>0?T.createElement(zp,{expanded:e,styles:l.treeNodeArrow}):a&&T.createElement("span",{style:l.treeNodePlaceholder}," "),T.createElement(c,{...s})),T.createElement("ol",{role:"group",style:l.treeNodeChildNodesContainer},e?n:void 0))}),Bn="$",Vi="*";function Sn(s,e){return!e(s).next().done}var $p=s=>Array.from({length:s},(e,t)=>[Bn].concat(Array.from({length:t},()=>"*")).join(".")),Kp=(s,e,t,n,i)=>{const r=[].concat($p(n)).concat(t).filter(a=>typeof a=="string"),o=[];return r.forEach(a=>{const l=a.split("."),c=(d,u,h)=>{if(h===l.length){o.push(u);return}const m=l[h];if(h===0)Sn(d,e)&&(m===Bn||m===Vi)&&c(d,Bn,h+1);else if(m===Vi)for(const{name:_,data:b}of e(d))Sn(b,e)&&c(b,`${u}.${_}`,h+1);else{const _=d[m];Sn(_,e)&&c(_,`${u}.${m}`,h+1)}};c(s,"",0)}),o.reduce((a,l)=>(a[l]=!0,a),{...i})},Bo=R.memo(s=>{const{data:e,dataIterator:t,path:n,depth:i,nodeRenderer:r}=s,[o,a]=R.useContext(No),l=Sn(e,t),c=!!o[n],d=R.useCallback(()=>l&&a(u=>({...u,[n]:!c})),[l,a,n,c]);return T.createElement(Up,{expanded:c,onClick:d,shouldShowArrow:l,shouldShowPlaceholder:i>0,nodeRenderer:r,...s},c?[...t(e)].map(({name:u,data:h,...m})=>T.createElement(Bo,{name:u,data:h,depth:i+1,path:`${n}.${u}`,key:u,dataIterator:t,nodeRenderer:r,...m})):null)}),qp=R.memo(({name:s,data:e,dataIterator:t,nodeRenderer:n,expandPaths:i,expandLevel:r})=>{const o=cn("TreeView"),a=R.useState({}),[,l]=a;return R.useLayoutEffect(()=>l(c=>Kp(e,t,i,r,c)),[e,t,i,r]),T.createElement(No.Provider,{value:a},T.createElement("ol",{role:"tree",style:o.treeViewOutline},T.createElement(Bo,{name:s,data:e,dataIterator:t,depth:0,path:Bn,nodeRenderer:n})))}),bi=({name:s,dimmed:e=!1,styles:t={}})=>{const n=cn("ObjectName"),i={...n.base,...e?n.dimmed:{},...t};return T.createElement("span",{style:i},s)},Pn=({object:s,styles:e})=>{const t=cn("ObjectValue"),n=i=>({...t[i],...e});switch(typeof s){case"bigint":return T.createElement("span",{style:n("objectValueNumber")},String(s),"n");case"number":return T.createElement("span",{style:n("objectValueNumber")},String(s));case"string":return T.createElement("span",{style:n("objectValueString")},'"',s,'"');case"boolean":return T.createElement("span",{style:n("objectValueBoolean")},String(s));case"undefined":return T.createElement("span",{style:n("objectValueUndefined")},"undefined");case"object":return s===null?T.createElement("span",{style:n("objectValueNull")},"null"):s instanceof Date?T.createElement("span",null,s.toString()):s instanceof RegExp?T.createElement("span",{style:n("objectValueRegExp")},s.toString()):Array.isArray(s)?T.createElement("span",null,`Array(${s.length})`):s.constructor?typeof s.constructor.isBuffer=="function"&&s.constructor.isBuffer(s)?T.createElement("span",null,`Buffer[${s.length}]`):T.createElement("span",null,s.constructor.name):T.createElement("span",null,"Object");case"function":return T.createElement("span",null,T.createElement("span",{style:n("objectValueFunctionPrefix")},"ƒ "),T.createElement("span",{style:n("objectValueFunctionName")},s.name,"()"));case"symbol":return T.createElement("span",{style:n("objectValueSymbol")},s.toString());default:return T.createElement("span",null)}},Gp=Object.prototype.hasOwnProperty,Jp=Object.prototype.propertyIsEnumerable;function Ps(s,e){const t=Object.getOwnPropertyDescriptor(s,e);if(t.get)try{return t.get()}catch{return t.get}return s[e]}function zi(s,e){return s.length===0?[]:s.slice(1).reduce((t,n)=>t.concat([e,n]),[s[0]])}var As=({data:s})=>{const e=cn("ObjectPreview"),t=s;if(typeof t!="object"||t===null||t instanceof Date||t instanceof RegExp)return T.createElement(Pn,{object:t});if(Array.isArray(t)){const n=e.arrayMaxProperties,i=t.slice(0,n).map((o,a)=>T.createElement(Pn,{key:a,object:o}));t.length>n&&i.push(T.createElement("span",{key:"ellipsis"},"…"));const r=t.length;return T.createElement(T.Fragment,null,T.createElement("span",{style:e.objectDescription},r===0?"":`(${r}) `),T.createElement("span",{style:e.preview},"[",zi(i,", "),"]"))}else{const n=e.objectMaxProperties,i=[];for(const o in t)if(Gp.call(t,o)){let a;i.length===n-1&&Object.keys(t).length>n&&(a=T.createElement("span",{key:"ellipsis"},"…"));const l=Ps(t,o);if(i.push(T.createElement("span",{key:o},T.createElement(bi,{name:o||'""'}),": ",T.createElement(Pn,{object:l}),a)),a)break}const r=t.constructor?t.constructor.name:"Object";return T.createElement(T.Fragment,null,T.createElement("span",{style:e.objectDescription},r==="Object"?"":`${r} `),T.createElement("span",{style:e.preview},"{",zi(i,", "),"}"))}},Yp=({name:s,data:e})=>typeof s=="string"?T.createElement("span",null,T.createElement(bi,{name:s}),T.createElement("span",null,": "),T.createElement(As,{data:e})):T.createElement(As,{data:e}),Wo=({name:s,data:e,isNonenumerable:t=!1})=>{const n=e;return T.createElement("span",null,typeof s=="string"?T.createElement(bi,{name:s,dimmed:t}):T.createElement(As,{data:s}),T.createElement("span",null,": "),T.createElement(Pn,{object:n}))},Xp=(s,e)=>function*(n){if(!(typeof n=="object"&&n!==null||typeof n=="function"))return;const r=Array.isArray(n);if(!r&&n[Symbol.iterator]){let o=0;for(const a of n){if(Array.isArray(a)&&a.length===2){const[l,c]=a;yield{name:l,data:c}}else yield{name:o.toString(),data:a};o++}}else{const o=Object.getOwnPropertyNames(n);e===!0&&!r?o.sort():typeof e=="function"&&o.sort(e);for(const a of o)if(Jp.call(n,a)){const l=Ps(n,a);yield{name:a||'""',data:l}}else if(s){let l;try{l=Ps(n,a)}catch{}l!==void 0&&(yield{name:a,data:l,isNonenumerable:!0})}s&&n!==Object.prototype&&(yield{name:"__proto__",data:Object.getPrototypeOf(n),isNonenumerable:!0})}},Zp=({depth:s,name:e,data:t,isNonenumerable:n})=>s===0?T.createElement(Yp,{name:e,data:t}):T.createElement(Wo,{name:e,data:t,isNonenumerable:n}),Qp=({showNonenumerable:s=!1,sortObjectKeys:e,nodeRenderer:t,...n})=>{const i=Xp(s,e),r=t||Zp;return T.createElement(qp,{nodeRenderer:r,dataIterator:i,...n})},e_=Vp(Qp);Dp(Bp());function t_(s){return s.msg_id!==void 0}class Ft{constructor(e,t){this._threads=e,this._collapsed=t,this._index=-1,this._child=null}iter(){return this}[Symbol.iterator](){return{next:()=>{if(this._child){const t=this._child.next();if(t!==void 0)return{value:t,done:!1};this._child=null}if(++this._index,this._index>=this._threads.length)return{done:!0};const e=this._threads[this._index];return e.children.length>0&&!this._collapsed[e.args.msg.header.msg_id]&&(this._child=new Ft(e.children,this._collapsed)),{value:{args:e.args,hasChildren:e.children.length>0},done:!1}}}}next(){if(this._child){const t=this._child.next();if(t!==void 0)return t;this._child=null}if(++this._index,this._index>=this._threads.length)return;const e=this._threads[this._index];return e.children.length>0&&!this._collapsed[e.args.msg.header.msg_id]&&(this._child=new Ft(e.children,this._collapsed)),{args:e.args,hasChildren:e.children.length>0}}clone(){const e=new Ft(this._threads,this._collapsed);return e._index=this._index,this._child&&(e._child=this._child.clone()),e}_index;_child;_threads;_collapsed}class Ho extends ml{constructor(e){super(),this.kernel=e??null}clear(){this._log.splice(0,this._log.length),this._messages={},this._childLUT={},this._roots=[],this.stateChanged.emit(void 0)}get kernel(){return this._kernel}set kernel(e){this._kernel&&this._kernel.anyMessage.disconnect(this.onMessage,this),this._kernel=e,this._kernel&&this._kernel.anyMessage.connect(this.onMessage,this)}get log(){return this._log}get tree(){return this._roots.map(e=>this.getThread(e,!1))}depth(e){if(e===null)return-1;let t=0;for(;e=this._findParent(e);)++t;return t}getThread(e,t=!0){const n=this._messages[e];if(t){let a=n,l;for(;l=this._findParent(a);)a=l;return this.getThread(a.msg.header.msg_id,!1)}const r=(this._childLUT[e]||[]).map(a=>this.getThread(a,!1));return{args:this._messages[e],children:r}}onMessage(e,t){const{msg:n}=t;this._log.push(t),this._messages[n.header.msg_id]=t;const i=this._findParent(t);if(i===null)this._roots.push(n.header.msg_id);else{const r=i.msg.header;this._childLUT[r.msg_id]=this._childLUT[r.msg_id]||[],this._childLUT[r.msg_id].push(n.header.msg_id)}this.stateChanged.emit(void 0)}_findParent(e){return t_(e.msg.parent_header)&&this._messages[e.msg.parent_header.msg_id]||null}_log=[];_kernel=null;_messages={};_childLUT={};_roots=[]}const n_={BASE_FONT_FAMILY:"var(--jp-code-font-family)",BASE_FONT_SIZE:"var(--jp-code-font-size)",BASE_LINE_HEIGHT:"var(--jp-code-line-height)",BASE_BACKGROUND_COLOR:"var(--jp-layout-color0)",BASE_COLOR:"var(--jp-content-font-color1)",OBJECT_NAME_COLOR:"var(--jp-mirror-editor-attribute-color)",OBJECT_VALUE_NULL_COLOR:"var(--jp-mirror-editor-builtin-color)",OBJECT_VALUE_UNDEFINED_COLOR:"var(--jp-mirror-editor-builtin-color)",OBJECT_VALUE_REGEXP_COLOR:"var(--jp-mirror-editor-string-color)",OBJECT_VALUE_STRING_COLOR:"var(--jp-mirror-editor-string-color)",OBJECT_VALUE_SYMBOL_COLOR:"var(--jp-mirror-editor-operator-color)",OBJECT_VALUE_NUMBER_COLOR:"var(--jp-mirror-editor-number-color)",OBJECT_VALUE_BOOLEAN_COLOR:"var(--jp-mirror-editor-builtin-color))",OBJECT_VALUE_FUNCTION_KEYWORD_COLOR:"var(--jp-mirror-editor-def-color))",ARROW_COLOR:"var(--jp-content-font-color2)",ARROW_MARGIN_RIGHT:3,ARROW_FONT_SIZE:12,TREENODE_FONT_FAMILY:"var(--jp-code-font-family)",TREENODE_FONT_SIZE:"var(--jp-code-font-size)",TREENODE_LINE_HEIGHT:"var(--jp-code-line-height)",TREENODE_PADDING_LEFT:12};function s_(s){const{name:e,depth:t,isNonenumerable:n,data:i}=s;if(t!==0)return f.jsx(Wo,{name:e,data:i,isNonenumerable:n},"node-label");const r=i;return f.jsx("span",{children:r.header.msg_id},"node-label")}function i_(s){const e=s.message,t=e.header.msg_id,n=s.collapsed?"jp-mod-collapsed":"",i=s.hasChildren?s.collapsed?Qs:$n:null,r=s.hasChildren?"jp-mod-children":"",o=s.hasChildren?0:-1;return[f.jsx("div",{className:"dla-KernelInspector-threadnode",onClick:()=>{s.onCollapse(s.message)},children:f.jsxs("div",{style:{paddingLeft:16*s.depth},children:[f.jsx("button",{className:`dla-KernelInspector-threadcollapser ${n} ${r}`,tabIndex:o,children:i&&f.jsx(i.react,{className:"kspy-collapser-icon"})}),f.jsxs("span",{className:"dla-KernelInspector-threadlabel",children:[e.channel,".",e.header.msg_type]})]})},`threadnode-${t}`),f.jsx("div",{className:"dla-KernelInspector-message",children:f.jsx(e_,{data:e,theme:n_,nodeRenderer:s_})},`message-${t}`)]}class Vo extends pl{constructor(e){super(e),this.id=`kernelspy-messagelog-${Kn()}`,this.addClass("dla-KernelInspector-messagelog")}render(){const e=this.model,t=[];t.push(f.jsx("span",{className:"dla-KernelInspector-logheader",children:"Threads"},"header-thread"),f.jsx("span",{className:"dla-KernelInspector-logheader",children:"Contents"},"header-contents"),f.jsx("span",{className:"dla-KernelInspector-logheader dla-KernelInspector-divider"},"header-divider"));const n=new Ft(e.tree,this.collapsed);let i=!0;for(const r of n)if(r){const o=e.depth(r.args);o===0&&(i?i=!1:t.push(f.jsx("span",{className:"dla-KernelInspector-divider"},`'divider-${r.args.msg.header.msg_id}`)));const a=this.collapsed[r.args.msg.header.msg_id];t.push(...i_({message:r.args.msg,depth:o,collapsed:a,hasChildren:r.hasChildren,onCollapse:l=>{this.onCollapse(l)}}))}return t}collapseAll(){for(const e of this.model.log)this.collapsed[e.msg.header.msg_id]=!0;this.update()}expandAll(){this.collapsed={},this.update()}onCollapse(e){const t=e.header.msg_id;this.collapsed[t]=!this.collapsed[t],this.update()}collapsed={}}class zo extends X{constructor(e){super(),this._model=new Ho(e),this.addClass("dla-KernelInspector-view"),this.id=`kernelspy-${Kn()}`,this.title.label="Kernel spy",this.title.closable=!0,this.title.icon=Cs;const t=this.layout=new tt;this._toolbar=new mh,this._toolbar.addClass("dla-KernelInspector-toolbar"),this._messagelog=new Vo(this._model),t.addWidget(this._toolbar),t.addWidget(this._messagelog),tt.setStretch(this._toolbar,0),tt.setStretch(this._messagelog,1),this.collapseAllButton=new En({onClick:()=>{this._messagelog.collapseAll()},className:"dla-KernelInspector-collapseAll",icon:Qs,tooltip:"Collapse all threads"}),this._toolbar.addItem("collapse-all",this.collapseAllButton),this.expandAllButton=new En({onClick:()=>{this._messagelog.expandAll()},className:"dla-KernelInspector-expandAll",icon:$n,tooltip:"Expand all threads"}),this._toolbar.addItem("expand-all",this.expandAllButton),this.clearAllButton=new En({onClick:()=>{this._model.clear()},className:"dla-KernelInspector-clearAll",icon:Sr,tooltip:"Clear all threads"}),this._toolbar.addItem("clear-all",this.clearAllButton)}onActivateRequest(e){this.node.contains(document.activeElement)||this.collapseAllButton.node.focus()}get model(){return this._model}_toolbar;_messagelog;_model;clearAllButton;expandAllButton;collapseAllButton}const r_=s=>{const{kernel:e}=s,[t,n]=R.useState();return R.useEffect(()=>{e?.ready.then(()=>{const i=new zo(e?.connection);n(i)})},[e]),t?f.jsx(ee,{sx:{"& dla-KernelInspector-view":{height:"1000px"},"& .dla-KernelInspector-messagelog":{height:"100px",minHeight:"100px"}},children:f.jsx(Vt,{children:t})}):f.jsx(f.Fragment,{})},o_=()=>f.jsx(f.Fragment,{}),a_=()=>f.jsx(f.Fragment,{}),l_=()=>{const{serviceManager:s}=Je(),[e,t]=R.useState(),[n,i]=R.useState(new Map),r=a=>{t(Array.from(a.kernels.running()))};R.useEffect(()=>{s?.kernels.refreshRunning().then(()=>{const a=Array.from(s.kernels.running());t(a)}),s?.kernelspecs.refreshSpecs().then(()=>{const a=Object.values(s.kernelspecs.specs.kernelspecs),l=new Map;a.forEach(d=>{const u=d?.name;if(u?.startsWith("run-")){const h=d?.metadata;if(h){const m=n.get(u),_={description:h.description,notebookExampleUrl:h.notebook_example_url};jt.deepEqual(m??{},_)||l.set(u,_)}}});const c=new Map([...n,...l]);l.size&&i(c)})},[s]);const o=(a,l)=>{a.kernels.shutdown(l).then(()=>{console.log(`Kernel ${l} is terminated.`),r(a)})};return f.jsx(ee,{mt:3,style:{width:"1000px"},children:e?f.jsxs(as.Container,{children:[f.jsx(as.Title,{as:"h2",id:"images",children:"Kernels"}),f.jsx(as.Subtitle,{as:"p",id:"images-subtitle",children:"Available kernels."}),f.jsx(tp,{"aria-labelledby":"running-kernels","aria-describedby":"running-kernels-subtitle",data:e,columns:[{header:"Name",field:"name",renderCell:a=>f.jsx(be,{children:a.name})},{header:"Description",id:"description",renderCell:a=>f.jsx(be,{children:n.get(a.name)?.description})},{header:"State",field:"execution_state",renderCell:a=>f.jsx(be,{children:a.execution_state})},{header:"Example",id:"example-action",renderCell:a=>f.jsx(f.Fragment,{children:f.jsx(Es,{"aria-label":`Create an example notebook for kernel ${a.name}`,icon:bh,size:"small",onClick:()=>{}})})},{header:"Delete",id:"delete-action",renderCell:a=>f.jsx(f.Fragment,{children:f.jsx(Es,{"aria-label":`Delete the kernel ${a.name}`,icon:vh,size:"small",onClick:()=>{o(s,a.id)}})})}]})]}):f.jsxs(hn,{border:!0,children:[f.jsx(hn.Visual,{children:f.jsx(wh,{size:"medium"})}),f.jsx(hn.Heading,{children:"Kernels"}),f.jsx(hn.Description,{children:f.jsxs(ee,{sx:{textAlign:"center"},children:[f.jsx(ee,{children:f.jsx(sn,{})}),f.jsx(ee,{children:"No kernel found so far..."})]})})]})})},c_=s=>{const{selectKernel:e,selectKernelSpec:t}=s,{serviceManager:n}=Je(),[i,r]=R.useState(),[o,a]=R.useState();return R.useEffect(()=>{n?.ready.then(()=>{n.kernelspecs.refreshSpecs().then(()=>{const l=n.kernelspecs.specs?.kernelspecs;a(l)})}),n?.kernels.refreshRunning().then(()=>{const l=Array.from(n.kernels.running());r(l)})},[n]),f.jsx(f.Fragment,{children:f.jsxs(Qn,{children:[f.jsx(Qn.Anchor,{children:f.jsx(Es,{"aria-labelledby":"",icon:Ni,variant:"invisible"})}),f.jsx(Qn.Overlay,{width:"large",children:f.jsxs(Xe,{showDividers:!0,children:[i&&f.jsx(Xe.Group,{title:"Connect to a running Kernel",children:i.map((l,c)=>f.jsxs(Xe.Item,{onSelect:d=>{e(l)},children:[f.jsx(Xe.LeadingVisual,{children:f.jsx(Ch,{})}),l.name,f.jsx(Xe.Description,{variant:"block",children:l.id})]},l?.id||c))}),f.jsx(Xe.Group,{title:"Launch a new Kernel",children:o&&Object.values(o).map((l,c)=>f.jsxs(Xe.Item,{onSelect:d=>{t(l)},children:[f.jsx(Xe.LeadingVisual,{children:f.jsx(Ni,{})}),l?.name,f.jsx(Xe.Description,{variant:"block",children:l?.display_name})]},l?.name||c))})]})})]})})};var d_=typeof window<"u"?R.useLayoutEffect:R.useEffect;function u_(s,e){const t=R.useRef(s);d_(()=>{t.current=s},[s]),R.useEffect(()=>{const n=setInterval(()=>{t.current()},e);return()=>{clearInterval(n)}},[e])}var An={exports:{}},h_=An.exports,Ui;function f_(){return Ui||(Ui=1,(function(s,e){(function(n,i){s.exports=i(_l())})(h_,function(t){return(function(n){var i={};function r(o){if(i[o])return i[o].exports;var a=i[o]={i:o,l:!1,exports:{}};return n[o].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=n,r.c=i,r.d=function(o,a,l){r.o(o,a)||Object.defineProperty(o,a,{configurable:!1,enumerable:!0,get:l})},r.n=function(o){var a=o&&o.__esModule?(function(){return o.default}):(function(){return o});return r.d(a,"a",a),a},r.o=function(o,a){return Object.prototype.hasOwnProperty.call(o,a)},r.p="/",r(r.s=11)})([(function(n,i,r){(function(o){if(o.env.NODE_ENV!=="production"){var a=typeof Symbol=="function"&&Symbol.for&&Symbol.for("react.element")||60103,l=function(d){return typeof d=="object"&&d!==null&&d.$$typeof===a},c=!0;n.exports=r(14)(l,c)}else n.exports=r(16)()}).call(i,r(2))}),(function(n,i){n.exports=t}),(function(n,i){var r=n.exports={},o,a;function l(){throw new Error("setTimeout has not been defined")}function c(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?o=setTimeout:o=l}catch{o=l}try{typeof clearTimeout=="function"?a=clearTimeout:a=c}catch{a=c}})();function d(y){if(o===setTimeout)return setTimeout(y,0);if((o===l||!o)&&setTimeout)return o=setTimeout,setTimeout(y,0);try{return o(y,0)}catch{try{return o.call(null,y,0)}catch{return o.call(this,y,0)}}}function u(y){if(a===clearTimeout)return clearTimeout(y);if((a===c||!a)&&clearTimeout)return a=clearTimeout,clearTimeout(y);try{return a(y)}catch{try{return a.call(null,y)}catch{return a.call(this,y)}}}var h=[],m=!1,_,b=-1;function g(){!m||!_||(m=!1,_.length?h=_.concat(h):b=-1,h.length&&p())}function p(){if(!m){var y=d(g);m=!0;for(var C=h.length;C;){for(_=h,h=[];++b<C;)_&&_[b].run();b=-1,C=h.length}_=null,m=!1,u(y)}}r.nextTick=function(y){var C=new Array(arguments.length-1);if(arguments.length>1)for(var E=1;E<arguments.length;E++)C[E-1]=arguments[E];h.push(new w(y,C)),h.length===1&&!m&&d(p)};function w(y,C){this.fun=y,this.array=C}w.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={};function v(){}r.on=v,r.addListener=v,r.once=v,r.off=v,r.removeListener=v,r.removeAllListeners=v,r.emit=v,r.prependListener=v,r.prependOnceListener=v,r.listeners=function(y){return[]},r.binding=function(y){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(y){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(o){return o.reduce(function(a,l){return a+l})/o.length}}),(function(n,i,r){function o(l){return function(){return l}}var a=function(){};a.thatReturns=o,a.thatReturnsFalse=o(!1),a.thatReturnsTrue=o(!0),a.thatReturnsNull=o(null),a.thatReturnsThis=function(){return this},a.thatReturnsArgument=function(l){return l},n.exports=a}),(function(n,i,r){(function(o){var a=function(d){};o.env.NODE_ENV!=="production"&&(a=function(d){if(d===void 0)throw new Error("invariant requires an error message argument")});function l(c,d,u,h,m,_,b,g){if(a(d),!c){var p;if(d===void 0)p=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var w=[u,h,m,_,b,g],v=0;p=new Error(d.replace(/%s/g,function(){return w[v++]})),p.name="Invariant Violation"}throw p.framesToPop=1,p}}n.exports=l}).call(i,r(2))}),(function(n,i,r){var o="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";n.exports=o}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(o){return Math.min.apply(Math,o)}}),(function(n,i,r){(function(o){var a=r(4),l=a;if(o.env.NODE_ENV!=="production"){var c=function(u){for(var h=arguments.length,m=Array(h>1?h-1:0),_=1;_<h;_++)m[_-1]=arguments[_];var b=0,g="Warning: "+u.replace(/%s/g,function(){return m[b++]});typeof console<"u"&&console.error(g);try{throw new Error(g)}catch{}};l=function(u,h){if(h===void 0)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(h.indexOf("Failed Composite propType: ")!==0&&!u){for(var m=arguments.length,_=Array(m>2?m-2:0),b=2;b<m;b++)_[b-2]=arguments[b];c.apply(void 0,[h].concat(_))}}}n.exports=l}).call(i,r(2))}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(o){return Math.max.apply(Math,o)}}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=r(3),a=l(o);function l(c){return c&&c.__esModule?c:{default:c}}i.default=function(c){var d=(0,a.default)(c),u=c.map(function(m){return Math.pow(m-d,2)}),h=(0,a.default)(u);return Math.sqrt(h)}}),(function(n,i,r){n.exports=r(12)}),(function(n,i,r){n.exports=r(13)}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0}),i.SparklinesText=i.SparklinesNormalBand=i.SparklinesReferenceLine=i.SparklinesSpots=i.SparklinesBars=i.SparklinesCurve=i.SparklinesLine=i.Sparklines=void 0;var o=(function(){function L(M,z){for(var K=0;K<z.length;K++){var ue=z[K];ue.enumerable=ue.enumerable||!1,ue.configurable=!0,"value"in ue&&(ue.writable=!0),Object.defineProperty(M,ue.key,ue)}}return function(M,z,K){return z&&L(M.prototype,z),K&&L(M,K),M}})(),a=r(0),l=P(a),c=r(1),d=P(c),u=r(17),h=P(u),m=r(18),_=P(m),b=r(19),g=P(b),p=r(20),w=P(p),v=r(21),y=P(v),C=r(22),E=P(C),x=r(27),S=P(x),A=r(28),I=P(A);function P(L){return L&&L.__esModule?L:{default:L}}function D(L,M){if(!(L instanceof M))throw new TypeError("Cannot call a class as a function")}function j(L,M){if(!L)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:L}function H(L,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);L.prototype=Object.create(M&&M.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(L,M):L.__proto__=M)}var $=(function(L){H(M,L);function M(z){return D(this,M),j(this,(M.__proto__||Object.getPrototypeOf(M)).call(this,z))}return o(M,[{key:"render",value:function(){var K=this.props,ue=K.data,Me=K.limit,k=K.width,B=K.height,te=K.svgWidth,Z=K.svgHeight,G=K.preserveAspectRatio,ie=K.margin,J=K.style,Q=K.max,ne=K.min;if(ue.length===0)return null;var re=(0,I.default)({data:ue,limit:Me,width:k,height:B,margin:ie,max:Q,min:ne}),ce={style:J,viewBox:"0 0 "+k+" "+B,preserveAspectRatio:G};return te>0&&(ce.width=te),Z>0&&(ce.height=Z),d.default.createElement("svg",ce,d.default.Children.map(this.props.children,function(St){return d.default.cloneElement(St,{data:ue,points:re,width:k,height:B,margin:ie})}))}}]),M})(c.PureComponent);$.propTypes={data:l.default.array,limit:l.default.number,width:l.default.number,height:l.default.number,svgWidth:l.default.number,svgHeight:l.default.number,preserveAspectRatio:l.default.string,margin:l.default.number,style:l.default.object,min:l.default.number,max:l.default.number,onMouseMove:l.default.func},$.defaultProps={data:[],width:240,height:60,preserveAspectRatio:"none",margin:2},i.Sparklines=$,i.SparklinesLine=_.default,i.SparklinesCurve=g.default,i.SparklinesBars=w.default,i.SparklinesSpots=y.default,i.SparklinesReferenceLine=E.default,i.SparklinesNormalBand=S.default,i.SparklinesText=h.default}),(function(n,i,r){(function(o){var a=r(4),l=r(5),c=r(8),d=r(6),u=r(15);n.exports=function(h,m){var _=typeof Symbol=="function"&&Symbol.iterator,b="@@iterator";function g(k){var B=k&&(_&&k[_]||k[b]);if(typeof B=="function")return B}var p="<<anonymous>>",w={array:E("array"),bool:E("boolean"),func:E("function"),number:E("number"),object:E("object"),string:E("string"),symbol:E("symbol"),any:x(),arrayOf:S,element:A(),instanceOf:I,node:H(),objectOf:D,oneOf:P,oneOfType:j,shape:$};function v(k,B){return k===B?k!==0||1/k===1/B:k!==k&&B!==B}function y(k){this.message=k,this.stack=""}y.prototype=Error.prototype;function C(k){if(o.env.NODE_ENV!=="production")var B={},te=0;function Z(ie,J,Q,ne,re,ce,St){if(ne=ne||p,ce=ce||Q,St!==d){if(m)l(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if(o.env.NODE_ENV!=="production"&&typeof console<"u"){var xi=ne+":"+Q;!B[xi]&&te<3&&(c(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",ce,ne),B[xi]=!0,te++)}}return J[Q]==null?ie?J[Q]===null?new y("The "+re+" `"+ce+"` is marked as required "+("in `"+ne+"`, but its value is `null`.")):new y("The "+re+" `"+ce+"` is marked as required in "+("`"+ne+"`, but its value is `undefined`.")):null:k(J,Q,ne,re,ce)}var G=Z.bind(null,!1);return G.isRequired=Z.bind(null,!0),G}function E(k){function B(te,Z,G,ie,J,Q){var ne=te[Z],re=z(ne);if(re!==k){var ce=K(ne);return new y("Invalid "+ie+" `"+J+"` of type "+("`"+ce+"` supplied to `"+G+"`, expected ")+("`"+k+"`."))}return null}return C(B)}function x(){return C(a.thatReturnsNull)}function S(k){function B(te,Z,G,ie,J){if(typeof k!="function")return new y("Property `"+J+"` of component `"+G+"` has invalid PropType notation inside arrayOf.");var Q=te[Z];if(!Array.isArray(Q)){var ne=z(Q);return new y("Invalid "+ie+" `"+J+"` of type "+("`"+ne+"` supplied to `"+G+"`, expected an array."))}for(var re=0;re<Q.length;re++){var ce=k(Q,re,G,ie,J+"["+re+"]",d);if(ce instanceof Error)return ce}return null}return C(B)}function A(){function k(B,te,Z,G,ie){var J=B[te];if(!h(J)){var Q=z(J);return new y("Invalid "+G+" `"+ie+"` of type "+("`"+Q+"` supplied to `"+Z+"`, expected a single ReactElement."))}return null}return C(k)}function I(k){function B(te,Z,G,ie,J){if(!(te[Z]instanceof k)){var Q=k.name||p,ne=Me(te[Z]);return new y("Invalid "+ie+" `"+J+"` of type "+("`"+ne+"` supplied to `"+G+"`, expected ")+("instance of `"+Q+"`."))}return null}return C(B)}function P(k){if(!Array.isArray(k))return o.env.NODE_ENV!=="production"&&c(!1,"Invalid argument supplied to oneOf, expected an instance of array."),a.thatReturnsNull;function B(te,Z,G,ie,J){for(var Q=te[Z],ne=0;ne<k.length;ne++)if(v(Q,k[ne]))return null;var re=JSON.stringify(k);return new y("Invalid "+ie+" `"+J+"` of value `"+Q+"` "+("supplied to `"+G+"`, expected one of "+re+"."))}return C(B)}function D(k){function B(te,Z,G,ie,J){if(typeof k!="function")return new y("Property `"+J+"` of component `"+G+"` has invalid PropType notation inside objectOf.");var Q=te[Z],ne=z(Q);if(ne!=="object")return new y("Invalid "+ie+" `"+J+"` of type "+("`"+ne+"` supplied to `"+G+"`, expected an object."));for(var re in Q)if(Q.hasOwnProperty(re)){var ce=k(Q,re,G,ie,J+"."+re,d);if(ce instanceof Error)return ce}return null}return C(B)}function j(k){if(!Array.isArray(k))return o.env.NODE_ENV!=="production"&&c(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),a.thatReturnsNull;for(var B=0;B<k.length;B++){var te=k[B];if(typeof te!="function")return c(!1,"Invalid argument supplid to oneOfType. Expected an array of check functions, but received %s at index %s.",ue(te),B),a.thatReturnsNull}function Z(G,ie,J,Q,ne){for(var re=0;re<k.length;re++){var ce=k[re];if(ce(G,ie,J,Q,ne,d)==null)return null}return new y("Invalid "+Q+" `"+ne+"` supplied to "+("`"+J+"`."))}return C(Z)}function H(){function k(B,te,Z,G,ie){return L(B[te])?null:new y("Invalid "+G+" `"+ie+"` supplied to "+("`"+Z+"`, expected a ReactNode."))}return C(k)}function $(k){function B(te,Z,G,ie,J){var Q=te[Z],ne=z(Q);if(ne!=="object")return new y("Invalid "+ie+" `"+J+"` of type `"+ne+"` "+("supplied to `"+G+"`, expected `object`."));for(var re in k){var ce=k[re];if(ce){var St=ce(Q,re,G,ie,J+"."+re,d);if(St)return St}}return null}return C(B)}function L(k){switch(typeof k){case"number":case"string":case"undefined":return!0;case"boolean":return!k;case"object":if(Array.isArray(k))return k.every(L);if(k===null||h(k))return!0;var B=g(k);if(B){var te=B.call(k),Z;if(B!==k.entries){for(;!(Z=te.next()).done;)if(!L(Z.value))return!1}else for(;!(Z=te.next()).done;){var G=Z.value;if(G&&!L(G[1]))return!1}}else return!1;return!0;default:return!1}}function M(k,B){return k==="symbol"||B["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&B instanceof Symbol}function z(k){var B=typeof k;return Array.isArray(k)?"array":k instanceof RegExp?"object":M(B,k)?"symbol":B}function K(k){if(typeof k>"u"||k===null)return""+k;var B=z(k);if(B==="object"){if(k instanceof Date)return"date";if(k instanceof RegExp)return"regexp"}return B}function ue(k){var B=K(k);switch(B){case"array":case"object":return"an "+B;case"boolean":case"date":case"regexp":return"a "+B;default:return B}}function Me(k){return!k.constructor||!k.constructor.name?p:k.constructor.name}return w.checkPropTypes=u,w.PropTypes=w,w}}).call(i,r(2))}),(function(n,i,r){(function(o){if(o.env.NODE_ENV!=="production")var a=r(5),l=r(8),c=r(6),d={};function u(h,m,_,b,g){if(o.env.NODE_ENV!=="production"){for(var p in h)if(h.hasOwnProperty(p)){var w;try{a(typeof h[p]=="function","%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",b||"React class",_,p),w=h[p](m,p,b,_,null,c)}catch(y){w=y}if(l(!w||w instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",b||"React class",_,p,typeof w),w instanceof Error&&!(w.message in d)){d[w.message]=!0;var v=g?g():"";l(!1,"Failed %s type: %s%s",_,w.message,v??"")}}}}n.exports=u}).call(i,r(2))}),(function(n,i,r){var o=r(4),a=r(5),l=r(6);n.exports=function(){function c(h,m,_,b,g,p){p!==l&&a(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}c.isRequired=c;function d(){return c}var u={array:c,bool:c,func:c,number:c,object:c,string:c,symbol:c,any:c,arrayOf:d,element:c,instanceOf:d,node:c,objectOf:d,oneOf:d,oneOfType:d,shape:d};return u.checkPropTypes=o,u.PropTypes=u,u}}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=(function(){function g(p,w){for(var v=0;v<w.length;v++){var y=w[v];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}return function(p,w,v){return w&&g(p.prototype,w),v&&g(p,v),p}})(),a=r(0),l=u(a),c=r(1),d=u(c);function u(g){return g&&g.__esModule?g:{default:g}}function h(g,p){if(!(g instanceof p))throw new TypeError("Cannot call a class as a function")}function m(g,p){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:g}function _(g,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);g.prototype=Object.create(p&&p.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(g,p):g.__proto__=p)}var b=(function(g){_(p,g);function p(){return h(this,p),m(this,(p.__proto__||Object.getPrototypeOf(p)).apply(this,arguments))}return o(p,[{key:"render",value:function(){var v=this.props,y=v.point,C=v.text,E=v.fontSize,x=v.fontFamily,S=y.x,A=y.y;return d.default.createElement("g",null,d.default.createElement("text",{x:S,y:A,fontFamily:x||"Verdana",fontSize:E||10},C))}}]),p})(d.default.Component);b.propTypes={text:l.default.string,point:l.default.object,fontSize:l.default.number,fontFamily:l.default.string},b.defaultProps={text:"",point:{x:0,y:0}},i.default=b}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=(function(){function g(p,w){for(var v=0;v<w.length;v++){var y=w[v];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}return function(p,w,v){return w&&g(p.prototype,w),v&&g(p,v),p}})(),a=r(0),l=u(a),c=r(1),d=u(c);function u(g){return g&&g.__esModule?g:{default:g}}function h(g,p){if(!(g instanceof p))throw new TypeError("Cannot call a class as a function")}function m(g,p){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:g}function _(g,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);g.prototype=Object.create(p&&p.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(g,p):g.__proto__=p)}var b=(function(g){_(p,g);function p(){return h(this,p),m(this,(p.__proto__||Object.getPrototypeOf(p)).apply(this,arguments))}return o(p,[{key:"render",value:function(){var v=this.props,y=v.data,C=v.points;v.width;var E=v.height,x=v.margin,S=v.color,A=v.style,I=v.onMouseMove,P=C.map(function(M){return[M.x,M.y]}).reduce(function(M,z){return M.concat(z)}),D=[C[C.length-1].x,E-x,x,E-x,x,C[0].y],j=P.concat(D),H={stroke:S||A.stroke||"slategray",strokeWidth:A.strokeWidth||"1",strokeLinejoin:A.strokeLinejoin||"round",strokeLinecap:A.strokeLinecap||"round",fill:"none"},$={stroke:A.stroke||"none",strokeWidth:"0",fillOpacity:A.fillOpacity||".1",fill:A.fill||S||"slategray",pointerEvents:"auto"},L=C.map(function(M,z){return d.default.createElement("circle",{key:z,cx:M.x,cy:M.y,r:2,style:$,onMouseEnter:function(ue){return I("enter",y[z],M)},onClick:function(ue){return I("click",y[z],M)}})});return d.default.createElement("g",null,L,d.default.createElement("polyline",{points:j.join(" "),style:$}),d.default.createElement("polyline",{points:P.join(" "),style:H}))}}]),p})(d.default.Component);b.propTypes={color:l.default.string,style:l.default.object},b.defaultProps={style:{},onMouseMove:function(){}},i.default=b}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=(function(){function g(p,w){for(var v=0;v<w.length;v++){var y=w[v];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}return function(p,w,v){return w&&g(p.prototype,w),v&&g(p,v),p}})(),a=r(0),l=u(a),c=r(1),d=u(c);function u(g){return g&&g.__esModule?g:{default:g}}function h(g,p){if(!(g instanceof p))throw new TypeError("Cannot call a class as a function")}function m(g,p){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:g}function _(g,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);g.prototype=Object.create(p&&p.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(g,p):g.__proto__=p)}var b=(function(g){_(p,g);function p(){return h(this,p),m(this,(p.__proto__||Object.getPrototypeOf(p)).apply(this,arguments))}return o(p,[{key:"render",value:function(){var v=this.props,y=v.points;v.width;var C=v.height,E=v.margin,x=v.color,S=v.style,A=v.divisor,I=A===void 0?.25:A,P=void 0,D=function(K){var ue=void 0;if(!P)ue=[K.x,K.y];else{var Me=(K.x-P.x)*I;ue=["C",P.x+Me,P.y,K.x-Me,K.y,K.x,K.y]}return P=K,ue},j=y.map(function(z){return D(z)}).reduce(function(z,K){return z.concat(K)}),H=["L"+y[y.length-1].x,C-E,E,C-E,E,y[0].y],$=j.concat(H),L={stroke:x||S.stroke||"slategray",strokeWidth:S.strokeWidth||"1",strokeLinejoin:S.strokeLinejoin||"round",strokeLinecap:S.strokeLinecap||"round",fill:"none"},M={stroke:S.stroke||"none",strokeWidth:"0",fillOpacity:S.fillOpacity||".1",fill:S.fill||x||"slategray"};return d.default.createElement("g",null,d.default.createElement("path",{d:"M"+$.join(" "),style:M}),d.default.createElement("path",{d:"M"+j.join(" "),style:L}))}}]),p})(d.default.Component);b.propTypes={color:l.default.string,style:l.default.object},b.defaultProps={style:{}},i.default=b}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=(function(){function g(p,w){for(var v=0;v<w.length;v++){var y=w[v];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}return function(p,w,v){return w&&g(p.prototype,w),v&&g(p,v),p}})(),a=r(0),l=u(a),c=r(1),d=u(c);function u(g){return g&&g.__esModule?g:{default:g}}function h(g,p){if(!(g instanceof p))throw new TypeError("Cannot call a class as a function")}function m(g,p){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:g}function _(g,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);g.prototype=Object.create(p&&p.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(g,p):g.__proto__=p)}var b=(function(g){_(p,g);function p(){return h(this,p),m(this,(p.__proto__||Object.getPrototypeOf(p)).apply(this,arguments))}return o(p,[{key:"render",value:function(){var v=this,y=this.props,C=y.points,E=y.height,x=y.style,S=y.barWidth,A=y.margin,I=y.onMouseMove,P=1*(x&&x.strokeWidth||0),D=A?2*A:0,j=S||(C&&C.length>=2?Math.max(0,C[1].x-C[0].x-P-D):0);return d.default.createElement("g",{transform:"scale(1,-1)"},C.map(function(H,$){return d.default.createElement("rect",{key:$,x:H.x-(j+P)/2,y:-E,width:j,height:Math.max(0,E-H.y),style:x,onMouseMove:I&&I.bind(v,H)})}))}}]),p})(d.default.Component);b.propTypes={points:l.default.arrayOf(l.default.object),height:l.default.number,style:l.default.object,barWidth:l.default.number,margin:l.default.number,onMouseMove:l.default.func},b.defaultProps={style:{fill:"slategray"}},i.default=b}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=(function(){function g(p,w){for(var v=0;v<w.length;v++){var y=w[v];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}return function(p,w,v){return w&&g(p.prototype,w),v&&g(p,v),p}})(),a=r(0),l=u(a),c=r(1),d=u(c);function u(g){return g&&g.__esModule?g:{default:g}}function h(g,p){if(!(g instanceof p))throw new TypeError("Cannot call a class as a function")}function m(g,p){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:g}function _(g,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);g.prototype=Object.create(p&&p.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(g,p):g.__proto__=p)}var b=(function(g){_(p,g);function p(){return h(this,p),m(this,(p.__proto__||Object.getPrototypeOf(p)).apply(this,arguments))}return o(p,[{key:"lastDirection",value:function(v){return Math.sign=Math.sign||function(y){return y>0?1:-1},v.length<2?0:Math.sign(v[v.length-2].y-v[v.length-1].y)}},{key:"render",value:function(){var v=this.props,y=v.points;v.width,v.height;var C=v.size,E=v.style,x=v.spotColors,S=d.default.createElement("circle",{cx:y[0].x,cy:y[0].y,r:C,style:E}),A=d.default.createElement("circle",{cx:y[y.length-1].x,cy:y[y.length-1].y,r:C,style:E||{fill:x[this.lastDirection(y)]}});return d.default.createElement("g",null,E&&S,A)}}]),p})(d.default.Component);b.propTypes={size:l.default.number,style:l.default.object,spotColors:l.default.object},b.defaultProps={size:2,spotColors:{"-1":"red",0:"black",1:"green"}},i.default=b}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=(function(){function v(y,C){for(var E=0;E<C.length;E++){var x=C[E];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(y,x.key,x)}}return function(y,C,E){return C&&v(y.prototype,C),E&&v(y,E),y}})(),a=r(0),l=_(a),c=r(1),d=_(c),u=r(23),h=m(u);function m(v){if(v&&v.__esModule)return v;var y={};if(v!=null)for(var C in v)Object.prototype.hasOwnProperty.call(v,C)&&(y[C]=v[C]);return y.default=v,y}function _(v){return v&&v.__esModule?v:{default:v}}function b(v,y){if(!(v instanceof y))throw new TypeError("Cannot call a class as a function")}function g(v,y){if(!v)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y&&(typeof y=="object"||typeof y=="function")?y:v}function p(v,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof y);v.prototype=Object.create(y&&y.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),y&&(Object.setPrototypeOf?Object.setPrototypeOf(v,y):v.__proto__=y)}var w=(function(v){p(y,v);function y(){return b(this,y),g(this,(y.__proto__||Object.getPrototypeOf(y)).apply(this,arguments))}return o(y,[{key:"render",value:function(){var E=this.props,x=E.points,S=E.margin,A=E.type,I=E.style,P=E.value,D=x.map(function(H){return H.y}),j=A=="custom"?P:h[A](D);return d.default.createElement("line",{x1:x[0].x,y1:j+S,x2:x[x.length-1].x,y2:j+S,style:I})}}]),y})(d.default.Component);w.propTypes={type:l.default.oneOf(["max","min","mean","avg","median","custom"]),value:l.default.number,style:l.default.object},w.defaultProps={type:"mean",style:{stroke:"red",strokeOpacity:.75,strokeDasharray:"2, 2"}},i.default=w}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0}),i.variance=i.stdev=i.median=i.midRange=i.avg=i.mean=i.max=i.min=void 0;var o=r(7),a=w(o),l=r(3),c=w(l),d=r(24),u=w(d),h=r(25),m=w(h),_=r(10),b=w(_),g=r(26),p=w(g);function w(v){return v&&v.__esModule?v:{default:v}}i.min=a.default,i.max=a.default,i.mean=c.default,i.avg=c.default,i.midRange=u.default,i.median=m.default,i.stdev=b.default,i.variance=p.default}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=r(7),a=d(o),l=r(9),c=d(l);function d(u){return u&&u.__esModule?u:{default:u}}i.default=function(u){return(0,c.default)(u)-(0,a.default)(u)/2}}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(o){return o.sort(function(a,l){return a-l})[Math.floor(o.length/2)]}}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=r(3),a=l(o);function l(c){return c&&c.__esModule?c:{default:c}}i.default=function(c){var d=(0,a.default)(c),u=c.map(function(h){return Math.pow(h-d,2)});return(0,a.default)(u)}}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=(function(){function y(C,E){for(var x=0;x<E.length;x++){var S=E[x];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(C,S.key,S)}}return function(C,E,x){return E&&y(C.prototype,E),x&&y(C,x),C}})(),a=r(0),l=b(a),c=r(1),d=b(c),u=r(3),h=b(u),m=r(10),_=b(m);function b(y){return y&&y.__esModule?y:{default:y}}function g(y,C){if(!(y instanceof C))throw new TypeError("Cannot call a class as a function")}function p(y,C){if(!y)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return C&&(typeof C=="object"||typeof C=="function")?C:y}function w(y,C){if(typeof C!="function"&&C!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof C);y.prototype=Object.create(C&&C.prototype,{constructor:{value:y,enumerable:!1,writable:!0,configurable:!0}}),C&&(Object.setPrototypeOf?Object.setPrototypeOf(y,C):y.__proto__=C)}var v=(function(y){w(C,y);function C(){return g(this,C),p(this,(C.__proto__||Object.getPrototypeOf(C)).apply(this,arguments))}return o(C,[{key:"render",value:function(){var x=this.props,S=x.points,A=x.margin,I=x.style,P=S.map(function(H){return H.y}),D=(0,h.default)(P),j=(0,_.default)(P);return d.default.createElement("rect",{x:S[0].x,y:D-j+A,width:S[S.length-1].x-S[0].x,height:_.default*2,style:I})}}]),C})(d.default.Component);v.propTypes={style:l.default.object},v.defaultProps={style:{fill:"red",fillOpacity:.1}},i.default=v}),(function(n,i,r){Object.defineProperty(i,"__esModule",{value:!0});var o=r(7),a=d(o),l=r(9),c=d(l);function d(u){return u&&u.__esModule?u:{default:u}}i.default=function(u){var h=u.data,m=u.limit,_=u.width,b=_===void 0?1:_,g=u.height,p=g===void 0?1:g,w=u.margin,v=w===void 0?0:w,y=u.max,C=y===void 0?(0,c.default)(h):y,E=u.min,x=E===void 0?(0,a.default)(h):E,S=h.length;m&&m<S&&(h=h.slice(S-m));var A=(p-v*2)/(C-x||2),I=(b-v*2)/((m||S)-(S>1?1:0));return h.map(function(P,D){return{x:D*I+v,y:(C===x?1:C-P)*A+v}})}})])})})(An)),An.exports}var fn=f_();const $i=20,m_=`
355
355
  import psutil
356
356
 
357
357
  processes: dict[str, psutil.Process] = {}
@@ -405,40 +405,40 @@ print(f"""{{
405
405
  "host_virtual_memory": {str(host_virtual_memory)}
406
406
  }}""")
407
407
  `,p_=s=>{const{kernel:e}=s,[t,n]=R.useState({}),[i,r]=R.useState(),[o,a]=R.useState(new Array),l=async()=>{const c=await e.execute(m_)?.result;if(c){const d=JSON.parse(c.replaceAll("'",'"')),u=o.concat([d.host_virtual_memory.available/1e3]);u.length>$i&&u.shift(),a(u),r(d.host_virtual_memory.total/1e3),n(d)}};return R.useEffect(()=>{e?.ready.then(async()=>{l()})},[e]),u_(()=>{t&&l()},1e3),t?f.jsxs(ee,{children:[f.jsx(ee,{children:f.jsx(be,{children:"Virtual Memory Available"})}),f.jsx(ee,{children:f.jsxs(fn.Sparklines,{data:o,limit:$i,svgHeight:100,svgWidth:200,min:0,max:i,children:[f.jsx(fn.SparklinesBars,{style:{stroke:"white",fill:"#41c3f9",fillOpacity:".25"}}),f.jsx(fn.SparklinesLine,{style:{stroke:"#41c3f9",fill:"none"}}),f.jsx(fn.SparklinesSpots,{})]})})]}):f.jsx(f.Fragment,{})},Ki=5,mn="jp-dragImage",qi="jp-dragImage-singlePrompt",pn="jp-dragImage-content",_n="jp-dragImage-prompt",Gi="jp-dragImage-multipleBack";var vt;(function(s){function e(r,o,a){let l=-1;for(;r&&r.parentElement;){if(a(r)){let c=-1;for(const d of o)if(d.node===r){l=++c;break}break}r=r.parentElement}return l}s.findCell=e;function t(r,o){var a,l;let c;return r?!((a=r.editorWidget)===null||a===void 0)&&a.node.contains(o)?c="input":!((l=r.promptNode)===null||l===void 0)&&l.contains(o)?c="prompt":c="cell":c="unknown",c}s.detectTargetArea=t;function n(r,o,a,l){const c=Math.abs(a-r),d=Math.abs(l-o);return c>=Ki||d>=Ki}s.shouldStartDrag=n;function i(r,o){const a=o.length;let l;if(r.model.type==="code"){const d=r.model.executionCount;l=" ",d&&(l=d.toString())}else l="";const c=r.model.sharedModel.getSource().split(`
408
- `)[0].slice(0,26);return a>1?l!==""?$t.realize(ae.div(ae.div({className:mn},ae.span({className:_n},"["+l+"]:"),ae.span({className:pn},c)),ae.div({className:Gi},""))):$t.realize(ae.div(ae.div({className:mn},ae.span({className:_n}),ae.span({className:pn},c)),ae.div({className:Gi},""))):l!==""?$t.realize(ae.div(ae.div({className:`${mn} ${qi}`},ae.span({className:_n},"["+l+"]:"),ae.span({className:pn},c)))):$t.realize(ae.div(ae.div({className:`${mn} ${qi}`},ae.span({className:_n}),ae.span({className:pn},c))))}s.createCellDragImage=i})(vt||(vt={}));class __ extends X{constructor(e){super(),this._changeCallback=n=>{if(!n.data||!n.data[this.mimeType])return;const i=n.data[this.mimeType];typeof i=="string"?i!==this._context.model.toString()&&this._context.model.fromString(i):i!=null&&!jt.deepEqual(i,this._context.model.toJSON())&&this._context.model.fromJSON(i)},this._fragment="",this._ready=new it,this._isRendering=!1,this._renderRequested=!1,this.addClass("jp-MimeDocument"),this.translator=e.translator||se,this._trans=this.translator.load("jupyterlab"),this.mimeType=e.mimeType,this._dataType=e.dataType||"string",this._context=e.context,this.renderer=e.renderer,(this.layout=new Wr).addWidget(this.renderer),this._context.ready.then(()=>this._render()).then(()=>{this.node===document.activeElement&&Ie.sendMessage(this.renderer,X.Msg.ActivateRequest),this._monitor=new O.ActivityMonitor({signal:this._context.model.contentChanged,timeout:e.renderTimeout}),this._monitor.activityStopped.connect(this.update,this),this._ready.resolve(void 0)}).catch(n=>{requestAnimationFrame(()=>{this.dispose()}),ve(this._trans.__("Renderer Failure: %1",this._context.path),n)})}[Ii.symbol](){return Ii.getPrintFunction(this.renderer)}get ready(){return this._ready.promise}setFragment(e){this._fragment=e,this.update()}dispose(){this.isDisposed||(this._monitor&&this._monitor.dispose(),this._monitor=null,super.dispose())}onUpdateRequest(e){this._context.isReady&&(this._render(),this._fragment="")}async _render(){if(this.isDisposed)return;if(this._isRendering){this._renderRequested=!0;return}this._renderRequested=!1;const e=this._context,t=e.model,n={};this._dataType==="string"?n[this.mimeType]=t.toString():n[this.mimeType]=t.toJSON();const i=new yl({data:n,callback:this._changeCallback,metadata:{fragment:this._fragment}});try{if(this._isRendering=!0,await this.renderer.renderModel(i),this._isRendering=!1,this._renderRequested)return this._render()}catch(r){requestAnimationFrame(()=>{this.dispose()}),ve(this._trans.__("Renderer Failure: %1",e.path),r)}}}class g_ extends Qt{setFragment(e){this.content.setFragment(e)}}class y_ extends Br{constructor(e){super(Rs.createRegistryOptions(e)),this._rendermime=e.rendermime,this._renderTimeout=e.renderTimeout||1e3,this._dataType=e.dataType||"string",this._fileType=e.primaryFileType,this._factory=e.factory}createNewWidget(e){var t,n;const i=this._fileType,r=i?.mimeTypes.length?i.mimeTypes[0]:gl.defaultMimeType,o=this._rendermime.clone({resolver:e.urlResolver});let a;this._factory&&this._factory.mimeTypes.includes(r)?a=this._factory.createRenderer({mimeType:r,resolver:o.resolver,sanitizer:o.sanitizer,linkHandler:o.linkHandler,latexTypesetter:o.latexTypesetter,markdownParser:o.markdownParser}):a=o.createRenderer(r);const l=new __({context:e,renderer:a,mimeType:r,renderTimeout:this._renderTimeout,dataType:this._dataType});return l.title.icon=i?.icon,l.title.iconClass=(t=i?.iconClass)!==null&&t!==void 0?t:"",l.title.iconLabel=(n=i?.iconLabel)!==null&&n!==void 0?n:"",new g_({content:l,context:e})}}var Rs;(function(s){function e(t){return{...t,readOnly:!0}}s.createRegistryOptions=e})(Rs||(Rs={}));class Fe{constructor(e={}){this._modelFactories=Object.create(null),this._widgetFactories=Object.create(null),this._defaultWidgetFactory="",this._defaultWidgetFactoryOverrides=Object.create(null),this._defaultWidgetFactories=Object.create(null),this._defaultRenderedWidgetFactories=Object.create(null),this._widgetFactoriesForFileType=Object.create(null),this._fileTypes=[],this._extenders=Object.create(null),this._changed=new U(this),this._isDisposed=!1;const t=e.textModelFactory;if(this.translator=e.translator||se,t&&t.name!=="text")throw new Error("Text model factory must have the name `text`");this._modelFactories.text=t||new bl(!0),(e.initialFileTypes||Fe.getDefaultFileTypes(this.translator)).forEach(i=>{const r={...Fe.getFileTypeDefaults(this.translator),...i};this._fileTypes.push(r)})}get changed(){return this._changed}get isDisposed(){return this._isDisposed}dispose(){if(!this.isDisposed){this._isDisposed=!0;for(const e in this._modelFactories)this._modelFactories[e].dispose();for(const e in this._widgetFactories)this._widgetFactories[e].dispose();for(const e in this._extenders)this._extenders[e].length=0;this._fileTypes.length=0,U.clearData(this)}}addWidgetFactory(e){const t=e.name.toLowerCase();if(!t||t==="default")throw Error("Invalid factory name");if(this._widgetFactories[t])return console.warn(`Duplicate registered factory ${t}`),new Ve(Lt.noOp);this._widgetFactories[t]=e;for(const n of e.defaultFor||[])e.fileTypes.indexOf(n)!==-1&&(n==="*"?this._defaultWidgetFactory=t:this._defaultWidgetFactories[n]=t);for(const n of e.defaultRendered||[])e.fileTypes.indexOf(n)!==-1&&(this._defaultRenderedWidgetFactories[n]=t);for(const n of e.fileTypes)this._widgetFactoriesForFileType[n]||(this._widgetFactoriesForFileType[n]=[]),this._widgetFactoriesForFileType[n].push(t);return this._changed.emit({type:"widgetFactory",name:t,change:"added"}),new Ve(()=>{delete this._widgetFactories[t],this._defaultWidgetFactory===t&&(this._defaultWidgetFactory="");for(const n of Object.keys(this._defaultWidgetFactories))this._defaultWidgetFactories[n]===t&&delete this._defaultWidgetFactories[n];for(const n of Object.keys(this._defaultRenderedWidgetFactories))this._defaultRenderedWidgetFactories[n]===t&&delete this._defaultRenderedWidgetFactories[n];for(const n of Object.keys(this._widgetFactoriesForFileType))Y.removeFirstOf(this._widgetFactoriesForFileType[n],t),this._widgetFactoriesForFileType[n].length===0&&delete this._widgetFactoriesForFileType[n];for(const n of Object.keys(this._defaultWidgetFactoryOverrides))this._defaultWidgetFactoryOverrides[n]===t&&delete this._defaultWidgetFactoryOverrides[n];this._changed.emit({type:"widgetFactory",name:t,change:"removed"})})}addModelFactory(e){const t=e.name.toLowerCase();return this._modelFactories[t]?(console.warn(`Duplicate registered factory ${t}`),new Ve(Lt.noOp)):(this._modelFactories[t]=e,this._changed.emit({type:"modelFactory",name:t,change:"added"}),new Ve(()=>{delete this._modelFactories[t],this._changed.emit({type:"modelFactory",name:t,change:"removed"})}))}addWidgetExtension(e,t){e=e.toLowerCase(),e in this._extenders||(this._extenders[e]=[]);const n=this._extenders[e];return Y.firstIndexOf(n,t)!==-1?(console.warn(`Duplicate registered extension for ${e}`),new Ve(Lt.noOp)):(this._extenders[e].push(t),this._changed.emit({type:"widgetExtension",name:e,change:"added"}),new Ve(()=>{Y.removeFirstOf(this._extenders[e],t),this._changed.emit({type:"widgetExtension",name:e,change:"removed"})}))}addFileType(e,t){const n={...Fe.getFileTypeDefaults(this.translator),...e,...!(e.icon||e.iconClass)&&{icon:Hr}};if(this._fileTypes.push(n),t){const i=n.name.toLowerCase();t.map(r=>r.toLowerCase()).forEach(r=>{this._widgetFactoriesForFileType[i]||(this._widgetFactoriesForFileType[i]=[]),this._widgetFactoriesForFileType[i].includes(r)||this._widgetFactoriesForFileType[i].push(r)}),this._defaultWidgetFactories[i]||(this._defaultWidgetFactories[i]=this._widgetFactoriesForFileType[i][0])}return this._changed.emit({type:"fileType",name:n.name,change:"added"}),new Ve(()=>{if(Y.removeFirstOf(this._fileTypes,n),t){const i=n.name.toLowerCase();for(const r of t.map(o=>o.toLowerCase()))Y.removeFirstOf(this._widgetFactoriesForFileType[i],r);this._defaultWidgetFactories[i]===t[0].toLowerCase()&&delete this._defaultWidgetFactories[i]}this._changed.emit({type:"fileType",name:e.name,change:"removed"})})}preferredWidgetFactories(e){const t=new Set,n=this.getFileTypesForPath(O.PathExt.basename(e));n.forEach(r=>{r.name in this._defaultWidgetFactoryOverrides&&t.add(this._defaultWidgetFactoryOverrides[r.name])}),n.forEach(r=>{r.name in this._defaultWidgetFactories&&t.add(this._defaultWidgetFactories[r.name])}),n.forEach(r=>{r.name in this._defaultRenderedWidgetFactories&&t.add(this._defaultRenderedWidgetFactories[r.name])}),this._defaultWidgetFactory&&t.add(this._defaultWidgetFactory);for(const r of n)if(r.name in this._widgetFactoriesForFileType)for(const o of this._widgetFactoriesForFileType[r.name])t.add(o);if("*"in this._widgetFactoriesForFileType)for(const r of this._widgetFactoriesForFileType["*"])t.add(r);const i=[];for(const r of t){const o=this._widgetFactories[r];if(!o)continue;(o.modelName||"text")in this._modelFactories&&i.push(o)}return i}defaultRenderedWidgetFactory(e){const t=this.getFileTypesForPath(O.PathExt.basename(e)).map(n=>n.name);for(const n of t)if(n in this._defaultWidgetFactoryOverrides)return this._widgetFactories[this._defaultWidgetFactoryOverrides[n]];for(const n of t)if(n in this._defaultRenderedWidgetFactories)return this._widgetFactories[this._defaultRenderedWidgetFactories[n]];return this.defaultWidgetFactory(e)}defaultWidgetFactory(e){return e?this.preferredWidgetFactories(e)[0]:this._widgetFactories[this._defaultWidgetFactory]}setDefaultWidgetFactory(e,t){if(e=e.toLowerCase(),!this.getFileType(e))throw Error(`Cannot find file type ${e}`);if(!t){this._defaultWidgetFactoryOverrides[e]&&delete this._defaultWidgetFactoryOverrides[e];return}if(!this.getWidgetFactory(t))throw Error(`Cannot find widget factory ${t}`);t=t.toLowerCase();const n=this._widgetFactoriesForFileType[e];if(t!==this._defaultWidgetFactory&&!(n&&n.includes(t)))throw Error(`Factory ${t} cannot view file type ${e}`);this._defaultWidgetFactoryOverrides[e]=t}*widgetFactories(){for(const e in this._widgetFactories)yield this._widgetFactories[e]}*modelFactories(){for(const e in this._modelFactories)yield this._modelFactories[e]}*widgetExtensions(e){if(e=e.toLowerCase(),e in this._extenders)for(const t of this._extenders[e])yield t}*fileTypes(){for(const e of this._fileTypes)yield e}getWidgetFactory(e){return this._widgetFactories[e.toLowerCase()]}getModelFactory(e){return this._modelFactories[e.toLowerCase()]}getFileType(e){return e=e.toLowerCase(),je(this._fileTypes,t=>t.name.toLowerCase()===e)}getKernelPreference(e,t,n){t=t.toLowerCase();const i=this._widgetFactories[t];if(!i)return;const r=this.getModelFactory(i.modelName||"text");if(!r)return;const o=r.preferredLanguage(O.PathExt.basename(e)),a=n&&n.name;return{id:n&&n.id,name:a,language:o,shouldStart:i.preferKernel,canStart:i.canStartKernel,shutdownOnDispose:i.shutdownOnClose,autoStartDefault:i.autoStartDefault}}getFileTypeForModel(e){let t=null;if(e.name||e.path){const n=e.name||O.PathExt.basename(e.path),i=this._getFileTypesForPath(n,e.type);i.length>0&&(t=i[0])}switch(e.type){case"directory":return t!==null&&t.contentType==="directory"?t:je(this._fileTypes,n=>n.contentType==="directory")||Fe.getDefaultDirectoryFileType(this.translator);case"notebook":return t!==null&&t.contentType==="notebook"?t:je(this._fileTypes,n=>n.contentType==="notebook")||Fe.getDefaultNotebookFileType(this.translator);default:return t!==null?t:this.getFileType("text")||Fe.getDefaultTextFileType(this.translator)}}getFileTypesForPath(e){return this._getFileTypesForPath(e)}_getFileTypesForPath(e,t){const n=[],i=O.PathExt.basename(e);let r=je(this._fileTypes,a=>!!((!t||a.contentType==t)&&a.pattern&&i.match(a.pattern)!==null));r&&n.push(r);let o=Lt.extname(i);for(;o.length>1;){const a=this._fileTypes.filter(l=>(!t||l.contentType==t)&&l.extensions.map(c=>c.toLowerCase()).includes(o));n.push(...a),o="."+o.split(".").slice(2).join(".")}return n}}(function(s){function e(o){return o=o||se,{name:"default",displayName:(o?.load("jupyterlab")).__("default"),extensions:[],mimeTypes:[],contentType:"file",fileFormat:"text"}}s.getFileTypeDefaults=e;function t(o){o=o||se;const a=o?.load("jupyterlab");return{...e(o),name:"text",displayName:a.__("Text"),mimeTypes:["text/plain"],extensions:[".txt"],icon:Hr}}s.getDefaultTextFileType=t;function n(o){o=o||se;const a=o?.load("jupyterlab");return{...e(o),name:"notebook",displayName:a.__("Notebook"),mimeTypes:["application/x-ipynb+json"],extensions:[".ipynb"],contentType:"notebook",fileFormat:"json",icon:vl}}s.getDefaultNotebookFileType=n;function i(o){o=o||se;const a=o?.load("jupyterlab");return{...e(o),name:"directory",displayName:a.__("Directory"),extensions:[],mimeTypes:["text/directory"],contentType:"directory",icon:Vr}}s.getDefaultDirectoryFileType=i;function r(o){o=o||se;const a=o?.load("jupyterlab");return[t(o),n(o),i(o),{name:"markdown",displayName:a.__("Markdown File"),extensions:[".md"],mimeTypes:["text/markdown"],icon:wl},{name:"PDF",displayName:a.__("PDF File"),extensions:[".pdf"],mimeTypes:["application/pdf"],icon:Cl},{name:"python",displayName:a.__("Python File"),extensions:[".py"],mimeTypes:["text/x-python"],icon:El},{name:"json",displayName:a.__("JSON File"),extensions:[".json"],mimeTypes:["application/json"],icon:Cs},{name:"jsonl",displayName:a.__("JSONLines File"),extensions:[".jsonl",".ndjson"],mimeTypes:["text/jsonl","application/jsonl","application/json-lines"],icon:Cs},{name:"julia",displayName:a.__("Julia File"),extensions:[".jl"],mimeTypes:["text/x-julia"],icon:xl},{name:"csv",displayName:a.__("CSV File"),extensions:[".csv"],mimeTypes:["text/csv"],icon:Li},{name:"tsv",displayName:a.__("TSV File"),extensions:[".tsv"],mimeTypes:["text/csv"],icon:Li},{name:"r",displayName:a.__("R File"),mimeTypes:["text/x-rsrc"],extensions:[".R"],icon:Tl},{name:"yaml",displayName:a.__("YAML File"),mimeTypes:["text/x-yaml","text/yaml"],extensions:[".yaml",".yml"],icon:Sl},{name:"svg",displayName:a.__("Image"),mimeTypes:["image/svg+xml"],extensions:[".svg"],icon:gt,fileFormat:"base64"},{name:"tiff",displayName:a.__("Image"),mimeTypes:["image/tiff"],extensions:[".tif",".tiff"],icon:gt,fileFormat:"base64"},{name:"jpeg",displayName:a.__("Image"),mimeTypes:["image/jpeg"],extensions:[".jpg",".jpeg"],icon:gt,fileFormat:"base64"},{name:"gif",displayName:a.__("Image"),mimeTypes:["image/gif"],extensions:[".gif"],icon:gt,fileFormat:"base64"},{name:"png",displayName:a.__("Image"),mimeTypes:["image/png"],extensions:[".png"],icon:gt,fileFormat:"base64"},{name:"bmp",displayName:a.__("Image"),mimeTypes:["image/bmp"],extensions:[".bmp"],icon:gt,fileFormat:"base64"},{name:"webp",displayName:a.__("Image"),mimeTypes:["image/webp"],extensions:[".webp"],icon:gt,fileFormat:"base64"},{name:"aac",displayName:a.__("Audio"),extensions:[".aac"],mimeTypes:["audio/aac"],icon:ot,fileFormat:"base64"},{name:"midi",displayName:a.__("Audio"),extensions:[".midi",".mid"],mimeTypes:["audio/midi","audio/x-midi"],icon:ot,fileFormat:"base64"},{name:"mp3",displayName:a.__("Audio"),extensions:[".mp3"],mimeTypes:["audio/mpeg"],icon:ot,fileFormat:"base64"},{name:"wav",displayName:a.__("Audio"),extensions:[".wav"],mimeTypes:["audio/wav","audio/x-wav"],icon:ot,fileFormat:"base64"},{name:"ogg",displayName:a.__("Audio"),extensions:[".ogg"],mimeTypes:["audio/ogg"],icon:ot,fileFormat:"base64"},{name:"m4a",displayName:a.__("Audio"),extensions:[".m4a"],mimeTypes:["audio/mp4"],icon:ot,fileFormat:"base64"},{name:"flac",displayName:a.__("Audio"),extensions:[".flac"],mimeTypes:["audio/flac"],icon:ot,fileFormat:"base64"},{name:"opus",displayName:a.__("Audio"),extensions:[".opus"],mimeTypes:["audio/opus"],icon:ot,fileFormat:"base64"},{name:"mp4",displayName:a.__("Video"),extensions:[".mp4"],mimeTypes:["video/mp4"],fileFormat:"base64",icon:Ze},{name:"mpeg",displayName:a.__("Video"),extensions:[".mpeg"],mimeTypes:["video/mpeg"],fileFormat:"base64",icon:Ze},{name:"webm",displayName:a.__("Video"),extensions:[".webm"],mimeTypes:["video/webm"],fileFormat:"base64",icon:Ze},{name:"ogv",displayName:a.__("Video"),extensions:[".ogv",".ogg"],mimeTypes:["video/ogg"],fileFormat:"base64",icon:Ze},{name:"avi",displayName:a.__("Video"),extensions:[".avi"],mimeTypes:["video/x-msvideo"],fileFormat:"base64",icon:Ze},{name:"mov",displayName:a.__("Video"),extensions:[".mov"],mimeTypes:["video/quicktime"],fileFormat:"base64",icon:Ze},{name:"m4v",displayName:a.__("Video"),extensions:[".m4v"],mimeTypes:["video/mp4","video/x-m4v"],fileFormat:"base64",icon:Ze},{name:"3gp",displayName:a.__("Video"),extensions:[".3gp"],mimeTypes:["video/3gpp"],fileFormat:"base64",icon:Ze},{name:"mkv",displayName:a.__("Video"),extensions:[".mkv"],mimeTypes:["video/x-matroska"],fileFormat:"base64",icon:Ze}]}s.getDefaultFileTypes=r})(Fe||(Fe={}));var Lt;(function(s){function e(n){const i=O.PathExt.basename(n).split(".");return i.shift(),("."+i.join(".")).toLowerCase()}s.extname=e;function t(){}s.noOp=t})(Lt||(Lt={}));const Uo="api/collaboration/room",$o="api/collaboration/session";async function Ko(s,e,t,n){const i=n??Be.ServerConnection.makeSettings(),r=O.URLExt.join(i.baseUrl,$o,encodeURIComponent(t)),o={method:"PUT",body:JSON.stringify({format:s,type:e})};let a;try{a=await Be.ServerConnection.makeRequest(r,o,i)}catch(c){throw new Be.ServerConnection.NetworkError(c)}let l=await a.text();if(l.length>0)try{l=JSON.parse(l)}catch{console.log("Not a JSON response body.",a)}if(!a.ok)throw new Be.ServerConnection.ResponseError(a,l.message||l);return l}var Ce;(function(s){s.Disconnected="disconnected",s.Connecting="connecting",s.Connected="connected",s.Error="error"})(Ce||(Ce={}));class vi{type;_status=Ce.Disconnected;_provider=null;_sharedModel=null;_statusChanged=new U(this);_errorOccurred=new U(this);_syncStateChanged=new U(this);_isDisposed=!1;constructor(e){this.type=e}get status(){return this._status}get isConnected(){return this._status===Ce.Connected}get isDisposed(){return this._isDisposed}get events(){return{statusChanged:this._statusChanged,errorOccurred:this._errorOccurred,syncStateChanged:this._syncStateChanged}}disconnect(){this._provider&&(this._provider.disconnect(),this._provider.destroy(),this._provider=null),this._sharedModel=null,this.setStatus(Ce.Disconnected)}getProvider(){return this._provider}getSharedModel(){return this._sharedModel}handleConnectionClose(e){e.code>1e3&&(console.error("Connection closed unexpectedly:",e),this.setStatus(Ce.Error),this._errorOccurred.emit(new Error(`Connection closed: ${e.reason}`)))}handleSync(e){this._syncStateChanged.emit(e),e&&this.setStatus(Ce.Connected)}dispose(){this._isDisposed||(this.disconnect(),U.clearData(this),this._isDisposed=!0)}setStatus(e){this._status!==e&&(this._status=e,this._statusChanged.emit(e))}}const qo=R.createContext(void 0);function b_({provider:s,children:e}){const[t,n]=R.useState(Ce.Disconnected),[i,r]=R.useState(!1),[o,a]=R.useState(null),l=R.useMemo(()=>s||null,[s]);R.useEffect(()=>{if(!l)return;const h=(b,g)=>{n(g)},m=(b,g)=>{a(g)},_=(b,g)=>{r(g)};return l.events.statusChanged.connect(h),l.events.errorOccurred.connect(m),l.events.syncStateChanged.connect(_),n(l.status),()=>{l.events.statusChanged.disconnect(h),l.events.errorOccurred.disconnect(m),l.events.syncStateChanged.disconnect(_)}},[l]),R.useEffect(()=>()=>{l?.dispose()},[l]);const c=async(h,m,_)=>{if(!l)throw new Error("No collaboration provider configured");a(null);try{await l.connect(h,m,_)}catch(b){throw a(b),b}},d=()=>{l?.disconnect(),r(!1),a(null)},u={provider:l,status:t,isConnected:t===Ce.Connected,isSynced:i,error:o,connect:c,disconnect:d};return f.jsx(qo.Provider,{value:u,children:e})}function wi(){const s=R.useContext(qo);if(!s)throw new Error("useCollaboration must be used within a CollaborationProvider");return s}function v_(){const{status:s}=wi();return s}function w_(){const{isConnected:s}=wi();return s}const Go=0,Ci=1,Jo=2,Is=(s,e)=>{Ee(s,Go);const t=Pl(e);ht(s,t)},Yo=(s,e,t)=>{Ee(s,Ci),ht(s,Al(e,t))},C_=(s,e,t)=>Yo(e,t,ri(s)),Xo=(s,e,t,n)=>{try{Rl(e,ri(s),t)}catch(i){n?.(i),console.error("Caught error while handling a Yjs update",i)}},E_=(s,e)=>{Ee(s,Jo),ht(s,e)},x_=Xo,T_=(s,e,t,n,i)=>{const r=ii(s);switch(r){case Go:C_(s,e,t);break;case Ci:Xo(s,t,n,i);break;case Jo:x_(s,t,n,i);break;default:throw new Error("Unknown message type")}return r},S_=0,P_=(s,e,t)=>{ii(s)===S_&&t(e,Il(s))},Et=0,Zo=3,Dt=1,A_=2,dn=[];dn[Et]=(s,e,t,n,i)=>{Ee(s,Et);const r=T_(e,s,t.doc,t);n&&r===Ci&&!t.synced&&(t.synced=!0)};dn[Zo]=(s,e,t,n,i)=>{Ee(s,Dt),ht(s,en(t.awareness,Array.from(t.awareness.getStates().keys())))};dn[Dt]=(s,e,t,n,i)=>{Ml(t.awareness,ri(e),t)};dn[A_]=(s,e,t,n,i)=>{P_(e,t.doc,(r,o)=>R_(t,o))};const Ji=3e4,R_=(s,e)=>console.warn(`Permission denied to access ${s.url}.
409
- ${e}`),Qo=(s,e,t)=>{const n=Dl(e),i=Ne(),r=ii(n),o=s.messageHandlers[r];return o?o(i,n,s,t,r):console.error("Unable to compute message"),i},Ls=(s,e,t)=>{e===s.ws&&(s.emit("connection-close",[t,s]),s.ws=null,e.close(),s.wsconnecting=!1,s.wsconnected?(s.wsconnected=!1,s.synced=!1,Ur(s.awareness,Array.from(s.awareness.getStates().keys()).filter(n=>n!==s.doc.clientID),s),s.emit("status",[{status:"disconnected"}])):s.wsUnsuccessfulReconnects++,setTimeout(ea,kl(Fl(2,s.wsUnsuccessfulReconnects)*100,s.maxBackoffTime),s))},ea=s=>{if(s.shouldConnect&&s.ws===null){const e=new s._WS(s.url,s.protocols);e.binaryType="arraybuffer",s.ws=e,s.wsconnecting=!0,s.wsconnected=!1,s.synced=!1,e.onmessage=t=>{s.wsLastMessageReceived=xs();const n=Qo(s,new Uint8Array(t.data),!0);zr(n)>1&&e.send(ke(n))},e.onerror=t=>{s.emit("connection-error",[t,s])},e.onclose=t=>{Ls(s,e,t)},e.onopen=()=>{s.wsLastMessageReceived=xs(),s.wsconnecting=!1,s.wsconnected=!0,s.wsUnsuccessfulReconnects=0,s.emit("status",[{status:"connected"}]);const t=Ne();if(Ee(t,Et),Is(t,s.doc),e.send(ke(t)),s.awareness.getLocalState()!==null){const n=Ne();Ee(n,Dt),ht(n,en(s.awareness,[s.doc.clientID])),e.send(ke(n))}},s.emit("status",[{status:"connecting"}])}},ds=(s,e)=>{const t=s.ws;s.wsconnected&&t&&t.readyState===t.OPEN&&t.send(e),s.bcconnected&&At(s.bcChannel,e,s)};class I_ extends Ll{constructor(e,t,n,{connect:i=!0,awareness:r=new Ol(n),params:o={},protocols:a=[],WebSocketPolyfill:l=WebSocket,resyncInterval:c=-1,maxBackoffTime:d=2500,disableBc:u=!1}={}){for(super();e[e.length-1]==="/";)e=e.slice(0,e.length-1);this.serverUrl=e,this.bcChannel=e+"/"+t,this.maxBackoffTime=d,this.params=o,this.protocols=a,this.roomname=t,this.doc=n,this._WS=l,this.awareness=r,this.wsconnected=!1,this.wsconnecting=!1,this.bcconnected=!1,this.disableBc=u,this.wsUnsuccessfulReconnects=0,this.messageHandlers=dn.slice(),this._synced=!1,this.ws=null,this.wsLastMessageReceived=0,this.shouldConnect=i,this._resyncInterval=0,c>0&&(this._resyncInterval=setInterval(()=>{if(this.ws&&this.ws.readyState===WebSocket.OPEN){const h=Ne();Ee(h,Et),Is(h,n),this.ws.send(ke(h))}},c)),this._bcSubscriber=(h,m)=>{if(m!==this){const _=Qo(this,new Uint8Array(h),!1);zr(_)>1&&At(this.bcChannel,ke(_),this)}},this._updateHandler=(h,m)=>{if(m!==this){const _=Ne();Ee(_,Et),E_(_,h),ds(this,ke(_))}},this.doc.on("update",this._updateHandler),this._awarenessUpdateHandler=({added:h,updated:m,removed:_},b)=>{const g=h.concat(m).concat(_),p=Ne();Ee(p,Dt),ht(p,en(r,g)),ds(this,ke(p))},this._exitHandler=()=>{Ur(this.awareness,[n.clientID],"app closed")},Oi&&typeof process<"u"&&process.on("exit",this._exitHandler),r.on("update",this._awarenessUpdateHandler),this._checkInterval=setInterval(()=>{this.wsconnected&&Ji<xs()-this.wsLastMessageReceived&&Ls(this,this.ws,null)},Ji/10),i&&this.connect()}get url(){const e=uh(this.params);return this.serverUrl+"/"+this.roomname+(e.length===0?"":"?"+e)}get synced(){return this._synced}set synced(e){this._synced!==e&&(this._synced=e,this.emit("synced",[e]),this.emit("sync",[e]))}destroy(){this._resyncInterval!==0&&clearInterval(this._resyncInterval),clearInterval(this._checkInterval),this.disconnect(),Oi&&typeof process<"u"&&process.off("exit",this._exitHandler),this.awareness.off("update",this._awarenessUpdateHandler),this.doc.off("update",this._updateHandler),super.destroy()}connectBc(){if(this.disableBc)return;this.bcconnected||(hh(this.bcChannel,this._bcSubscriber),this.bcconnected=!0);const e=Ne();Ee(e,Et),Is(e,this.doc),At(this.bcChannel,ke(e),this);const t=Ne();Ee(t,Et),Yo(t,this.doc),At(this.bcChannel,ke(t),this);const n=Ne();Ee(n,Zo),At(this.bcChannel,ke(n),this);const i=Ne();Ee(i,Dt),ht(i,en(this.awareness,[this.doc.clientID])),At(this.bcChannel,ke(i),this)}disconnectBc(){const e=Ne();Ee(e,Dt),ht(e,en(this.awareness,[this.doc.clientID],new Map)),ds(this,ke(e)),this.bcconnected&&(fh(this.bcChannel,this._bcSubscriber),this.bcconnected=!1)}disconnect(){this.shouldConnect=!1,this.disconnectBc(),this.ws!==null&&Ls(this,this.ws,null)}connect(){this.shouldConnect=!0,!this.wsconnected&&this.ws===null&&(ea(this),this.connectBc())}}class L_ extends vi{_config;_onSync=null;_onConnectionClose=null;_connection=null;_sessionRenewals=0;constructor(e={}){super("jupyter"),this._config=e}async connect(e,t,n){if(this.isConnected||this._status===Ce.Connecting||this._provider){console.warn("Already connected to Jupyter collaboration service");return}this.setStatus(Ce.Connecting),this._connection={sharedModel:e,documentId:t,options:n};try{const i=this._config.serverSettings??Be.ServerConnection.makeSettings(),{ydoc:r,awareness:o}=e,a=n?.path||this._config.path;if(!a)throw new Error("Path is required for Jupyter collaboration. Provide it in the config or via connect options.");const l=await Ko(this._config.format||"json",this._config.documentType||"notebook",a,i),c=i.wsUrl;if(!c)throw new Error("WebSocket URL is not available");const d=O.URLExt.join(c,Uo),u=`${l.format}:${l.type}:${l.fileId}`,h={sessionId:l.sessionId};i.token&&(h.token=i.token),this._provider=new I_(d,u,r,{disableBc:!0,params:h,awareness:o,...n}),this._sharedModel=e,this._onSync=m=>{if(m){this._sessionRenewals=0;try{r.getMap("state").set("document_id",u)}catch(_){console.warn("Failed to record the collaboration room id in the shared document.",_)}}this.handleSync(m)},this._onConnectionClose=m=>{this.handleConnectionClose(m)},this._provider.on("sync",this._onSync),this._provider.on("connection-close",this._onConnectionClose),console.log("Connected to Jupyter collaboration service")}catch(i){throw this.setStatus(Ce.Error),this._errorOccurred.emit(i),i}}disconnect(){this._connection=null,this._provider&&(this._onSync&&this._provider.off("sync",this._onSync),this._onConnectionClose&&this._provider.off("connection-close",this._onConnectionClose)),super.disconnect()}handleConnectionClose(e){if(super.handleConnectionClose(e),e.code===4002){const t=this._sessionRenewals+=1;if(!this._connection||t>5){console.warn("Jupyter collaboration session expired and was not renewed.");return}const{sharedModel:n,documentId:i,options:r}=this._connection;console.info(`Jupyter collaboration session expired: renewing it (attempt ${t}).`),this._provider&&(this._onSync&&this._provider.off("sync",this._onSync),this._onConnectionClose&&this._provider.off("connection-close",this._onConnectionClose),this._provider.destroy(),this._provider=null),this.setStatus(Ce.Disconnected);const o=Math.min(500*2**(t-1),8e3);setTimeout(()=>{this._connection?.sharedModel===n&&(this._connection=null,this.connect(n,i,r).catch(a=>{console.error("Failed to renew the expired Jupyter collaboration session.",a)}))},o)}}}class O_ extends vi{constructor(e){super("none")}async connect(e,t,n){this._sharedModel=e,this.setStatus(Ce.Connected),this._syncStateChanged.emit(!0)}disconnect(){this._sharedModel=null,this.setStatus(Ce.Disconnected)}getProvider(){return null}handleConnectionClose(e){}handleSync(e){this._syncStateChanged.emit(!0)}}const k_=s=>{const{version:e}=s,[t,n]=R.useState(!1);return f.jsxs(f.Fragment,{children:[f.jsxs(xo,{as:"h2",children:["🪐 ⚛️ Jupyter React",f.jsx(Ut,{sx:{marginLeft:1},children:e})]}),f.jsx(ee,{children:f.jsx(be,{children:"React.js components 💯% compatible with 🪐 Jupyter."})}),f.jsx(ee,{children:f.jsx(gs,{href:"https://datalayer.tech/docs/releases/1.2.0-black-snake",target:"_blank",children:f.jsx(be,{as:"h4",children:"Datalayer 1.2.0 Black Snake Release"})})}),f.jsx(ee,{children:f.jsx(gs,{href:"https://github.com/datalayer/jupyter-ui/tree/main/packages/react",target:"_blank",children:f.jsx(be,{as:"h4",children:"Source code"})})}),f.jsx(ee,{mt:3,children:t?f.jsx(Eh,{size:300,onClick:i=>n(!1)}):f.jsx("img",{src:"https://assets.datalayer.tech/releases/datalayer-1.2.0-black-snake_1024.png",onClick:i=>n(!0)})})]})},us={id:"root",name:"File Browser"},ta=s=>{const{serviceManager:e}=s,[t,n]=R.useState(us),[,i]=R.useReducer(a=>a+1,0),r=(a,l,c)=>{((u,h)=>u.contents().get(h.join("/")).then(_=>{const g=_.content.map(p=>p.type==="directory"?{id:"folder_"+p.name,name:p.name,children:new Array}:{id:"file_"+p.name,name:p.name});return g.sort((p,w)=>p.id.startsWith("folder_")&&w.id.startsWith("file_")?-1:p.id.startsWith("file_")&&w.id.startsWith("folder_")?1:p.name.localeCompare(w.name)),g}))(a,c).then(u=>{l.children=u;for(const h of l.children)h.id.startsWith("folder_")&&r(a,h,c.concat(h.name));n(us),i()})};R.useEffect(()=>{if(e){const a=new ko(e);r(a,us,[])}},[e]);const o=a=>a.map(l=>f.jsxs(Qe.Item,{id:l.id,children:[f.jsx(Qe.LeadingVisual,{children:Array.isArray(l.children)?f.jsx(Qe.DirectoryIcon,{}):f.jsx(Nl,{})}),l.name,Array.isArray(l.children)&&f.jsx(Qe.SubTree,{children:o(l.children)})]},l.id));return f.jsx(f.Fragment,{children:f.jsx(Qe,{children:f.jsxs(Qe.Item,{id:t.id,defaultExpanded:!0,children:[f.jsx(Qe.LeadingVisual,{children:f.jsx(Qe.DirectoryIcon,{})}),t.name,Array.isArray(t.children)&&f.jsx(Qe.SubTree,{children:o(t.children)})]})})})},F_=()=>{const{serviceManager:s}=Je();return s?f.jsx(ta,{serviceManager:s}):f.jsx(f.Fragment,{})},na=({id:s="lumino-box-id",height:e="100%",children:t})=>{const n=R.useRef(null);return R.useEffect(()=>{if(n&&n.current){const i=new we;i.spacing=0,i.addWidget(t);try{X.attach(i,n.current)}catch(o){console.warn("Exception while attaching Lumino widget.",o)}const r=new ResizeObserver(()=>{i.isAttached&&Ie.sendMessage(i,X.ResizeMessage.UnknownSize)});return r.observe(n.current),()=>{r.disconnect();try{(i.isAttached||i.node.isConnected)&&(i.dispose(),X.detach(i))}catch{}}}},[n,t]),f.jsx(ee,{style:{height:e,minHeight:e,width:"100%"},children:f.jsx("div",{id:s,ref:n})})};class sa extends T.Component{render(){return f.jsx("div",{ref:e=>{}})}}var Os=function(s,e){return Os=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},Os(s,e)};function ia(s,e){Os(s,e);function t(){this.constructor=s}s.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function ks(s){return typeof s=="function"}var Yi=!1,ze={set useDeprecatedSynchronousErrorHandling(s){if(s){var e=new Error;""+e.stack}Yi=s},get useDeprecatedSynchronousErrorHandling(){return Yi}};function qt(s){setTimeout(function(){throw s},0)}var Wn={closed:!0,next:function(s){},error:function(s){if(ze.useDeprecatedSynchronousErrorHandling)throw s;qt(s)},complete:function(){}},D_=(function(){return Array.isArray||(function(s){return s&&typeof s.length=="number"})})();function M_(s){return s!==null&&typeof s=="object"}var N_=(function(){function s(e){return Error.call(this),this.message=e?e.length+` errors occurred during unsubscription:
408
+ `)[0].slice(0,26);return a>1?l!==""?$t.realize(ae.div(ae.div({className:mn},ae.span({className:_n},"["+l+"]:"),ae.span({className:pn},c)),ae.div({className:Gi},""))):$t.realize(ae.div(ae.div({className:mn},ae.span({className:_n}),ae.span({className:pn},c)),ae.div({className:Gi},""))):l!==""?$t.realize(ae.div(ae.div({className:`${mn} ${qi}`},ae.span({className:_n},"["+l+"]:"),ae.span({className:pn},c)))):$t.realize(ae.div(ae.div({className:`${mn} ${qi}`},ae.span({className:_n}),ae.span({className:pn},c))))}s.createCellDragImage=i})(vt||(vt={}));class __ extends X{constructor(e){super(),this._changeCallback=n=>{if(!n.data||!n.data[this.mimeType])return;const i=n.data[this.mimeType];typeof i=="string"?i!==this._context.model.toString()&&this._context.model.fromString(i):i!=null&&!jt.deepEqual(i,this._context.model.toJSON())&&this._context.model.fromJSON(i)},this._fragment="",this._ready=new it,this._isRendering=!1,this._renderRequested=!1,this.addClass("jp-MimeDocument"),this.translator=e.translator||se,this._trans=this.translator.load("jupyterlab"),this.mimeType=e.mimeType,this._dataType=e.dataType||"string",this._context=e.context,this.renderer=e.renderer,(this.layout=new Wr).addWidget(this.renderer),this._context.ready.then(()=>this._render()).then(()=>{this.node===document.activeElement&&Ie.sendMessage(this.renderer,X.Msg.ActivateRequest),this._monitor=new O.ActivityMonitor({signal:this._context.model.contentChanged,timeout:e.renderTimeout}),this._monitor.activityStopped.connect(this.update,this),this._ready.resolve(void 0)}).catch(n=>{requestAnimationFrame(()=>{this.dispose()}),ve(this._trans.__("Renderer Failure: %1",this._context.path),n)})}[Ii.symbol](){return Ii.getPrintFunction(this.renderer)}get ready(){return this._ready.promise}setFragment(e){this._fragment=e,this.update()}dispose(){this.isDisposed||(this._monitor&&this._monitor.dispose(),this._monitor=null,super.dispose())}onUpdateRequest(e){this._context.isReady&&(this._render(),this._fragment="")}async _render(){if(this.isDisposed)return;if(this._isRendering){this._renderRequested=!0;return}this._renderRequested=!1;const e=this._context,t=e.model,n={};this._dataType==="string"?n[this.mimeType]=t.toString():n[this.mimeType]=t.toJSON();const i=new yl({data:n,callback:this._changeCallback,metadata:{fragment:this._fragment}});try{if(this._isRendering=!0,await this.renderer.renderModel(i),this._isRendering=!1,this._renderRequested)return this._render()}catch(r){requestAnimationFrame(()=>{this.dispose()}),ve(this._trans.__("Renderer Failure: %1",e.path),r)}}}class g_ extends Qt{setFragment(e){this.content.setFragment(e)}}class y_ extends Br{constructor(e){super(Rs.createRegistryOptions(e)),this._rendermime=e.rendermime,this._renderTimeout=e.renderTimeout||1e3,this._dataType=e.dataType||"string",this._fileType=e.primaryFileType,this._factory=e.factory}createNewWidget(e){var t,n;const i=this._fileType,r=i?.mimeTypes.length?i.mimeTypes[0]:gl.defaultMimeType,o=this._rendermime.clone({resolver:e.urlResolver});let a;this._factory&&this._factory.mimeTypes.includes(r)?a=this._factory.createRenderer({mimeType:r,resolver:o.resolver,sanitizer:o.sanitizer,linkHandler:o.linkHandler,latexTypesetter:o.latexTypesetter,markdownParser:o.markdownParser}):a=o.createRenderer(r);const l=new __({context:e,renderer:a,mimeType:r,renderTimeout:this._renderTimeout,dataType:this._dataType});return l.title.icon=i?.icon,l.title.iconClass=(t=i?.iconClass)!==null&&t!==void 0?t:"",l.title.iconLabel=(n=i?.iconLabel)!==null&&n!==void 0?n:"",new g_({content:l,context:e})}}var Rs;(function(s){function e(t){return{...t,readOnly:!0}}s.createRegistryOptions=e})(Rs||(Rs={}));class Fe{constructor(e={}){this._modelFactories=Object.create(null),this._widgetFactories=Object.create(null),this._defaultWidgetFactory="",this._defaultWidgetFactoryOverrides=Object.create(null),this._defaultWidgetFactories=Object.create(null),this._defaultRenderedWidgetFactories=Object.create(null),this._widgetFactoriesForFileType=Object.create(null),this._fileTypes=[],this._extenders=Object.create(null),this._changed=new U(this),this._isDisposed=!1;const t=e.textModelFactory;if(this.translator=e.translator||se,t&&t.name!=="text")throw new Error("Text model factory must have the name `text`");this._modelFactories.text=t||new bl(!0),(e.initialFileTypes||Fe.getDefaultFileTypes(this.translator)).forEach(i=>{const r={...Fe.getFileTypeDefaults(this.translator),...i};this._fileTypes.push(r)})}get changed(){return this._changed}get isDisposed(){return this._isDisposed}dispose(){if(!this.isDisposed){this._isDisposed=!0;for(const e in this._modelFactories)this._modelFactories[e].dispose();for(const e in this._widgetFactories)this._widgetFactories[e].dispose();for(const e in this._extenders)this._extenders[e].length=0;this._fileTypes.length=0,U.clearData(this)}}addWidgetFactory(e){const t=e.name.toLowerCase();if(!t||t==="default")throw Error("Invalid factory name");if(this._widgetFactories[t])return console.warn(`Duplicate registered factory ${t}`),new Ve(Lt.noOp);this._widgetFactories[t]=e;for(const n of e.defaultFor||[])e.fileTypes.indexOf(n)!==-1&&(n==="*"?this._defaultWidgetFactory=t:this._defaultWidgetFactories[n]=t);for(const n of e.defaultRendered||[])e.fileTypes.indexOf(n)!==-1&&(this._defaultRenderedWidgetFactories[n]=t);for(const n of e.fileTypes)this._widgetFactoriesForFileType[n]||(this._widgetFactoriesForFileType[n]=[]),this._widgetFactoriesForFileType[n].push(t);return this._changed.emit({type:"widgetFactory",name:t,change:"added"}),new Ve(()=>{delete this._widgetFactories[t],this._defaultWidgetFactory===t&&(this._defaultWidgetFactory="");for(const n of Object.keys(this._defaultWidgetFactories))this._defaultWidgetFactories[n]===t&&delete this._defaultWidgetFactories[n];for(const n of Object.keys(this._defaultRenderedWidgetFactories))this._defaultRenderedWidgetFactories[n]===t&&delete this._defaultRenderedWidgetFactories[n];for(const n of Object.keys(this._widgetFactoriesForFileType))Y.removeFirstOf(this._widgetFactoriesForFileType[n],t),this._widgetFactoriesForFileType[n].length===0&&delete this._widgetFactoriesForFileType[n];for(const n of Object.keys(this._defaultWidgetFactoryOverrides))this._defaultWidgetFactoryOverrides[n]===t&&delete this._defaultWidgetFactoryOverrides[n];this._changed.emit({type:"widgetFactory",name:t,change:"removed"})})}addModelFactory(e){const t=e.name.toLowerCase();return this._modelFactories[t]?(console.warn(`Duplicate registered factory ${t}`),new Ve(Lt.noOp)):(this._modelFactories[t]=e,this._changed.emit({type:"modelFactory",name:t,change:"added"}),new Ve(()=>{delete this._modelFactories[t],this._changed.emit({type:"modelFactory",name:t,change:"removed"})}))}addWidgetExtension(e,t){e=e.toLowerCase(),e in this._extenders||(this._extenders[e]=[]);const n=this._extenders[e];return Y.firstIndexOf(n,t)!==-1?(console.warn(`Duplicate registered extension for ${e}`),new Ve(Lt.noOp)):(this._extenders[e].push(t),this._changed.emit({type:"widgetExtension",name:e,change:"added"}),new Ve(()=>{Y.removeFirstOf(this._extenders[e],t),this._changed.emit({type:"widgetExtension",name:e,change:"removed"})}))}addFileType(e,t){const n={...Fe.getFileTypeDefaults(this.translator),...e,...!(e.icon||e.iconClass)&&{icon:Hr}};if(this._fileTypes.push(n),t){const i=n.name.toLowerCase();t.map(r=>r.toLowerCase()).forEach(r=>{this._widgetFactoriesForFileType[i]||(this._widgetFactoriesForFileType[i]=[]),this._widgetFactoriesForFileType[i].includes(r)||this._widgetFactoriesForFileType[i].push(r)}),this._defaultWidgetFactories[i]||(this._defaultWidgetFactories[i]=this._widgetFactoriesForFileType[i][0])}return this._changed.emit({type:"fileType",name:n.name,change:"added"}),new Ve(()=>{if(Y.removeFirstOf(this._fileTypes,n),t){const i=n.name.toLowerCase();for(const r of t.map(o=>o.toLowerCase()))Y.removeFirstOf(this._widgetFactoriesForFileType[i],r);this._defaultWidgetFactories[i]===t[0].toLowerCase()&&delete this._defaultWidgetFactories[i]}this._changed.emit({type:"fileType",name:e.name,change:"removed"})})}preferredWidgetFactories(e){const t=new Set,n=this.getFileTypesForPath(O.PathExt.basename(e));n.forEach(r=>{r.name in this._defaultWidgetFactoryOverrides&&t.add(this._defaultWidgetFactoryOverrides[r.name])}),n.forEach(r=>{r.name in this._defaultWidgetFactories&&t.add(this._defaultWidgetFactories[r.name])}),n.forEach(r=>{r.name in this._defaultRenderedWidgetFactories&&t.add(this._defaultRenderedWidgetFactories[r.name])}),this._defaultWidgetFactory&&t.add(this._defaultWidgetFactory);for(const r of n)if(r.name in this._widgetFactoriesForFileType)for(const o of this._widgetFactoriesForFileType[r.name])t.add(o);if("*"in this._widgetFactoriesForFileType)for(const r of this._widgetFactoriesForFileType["*"])t.add(r);const i=[];for(const r of t){const o=this._widgetFactories[r];if(!o)continue;(o.modelName||"text")in this._modelFactories&&i.push(o)}return i}defaultRenderedWidgetFactory(e){const t=this.getFileTypesForPath(O.PathExt.basename(e)).map(n=>n.name);for(const n of t)if(n in this._defaultWidgetFactoryOverrides)return this._widgetFactories[this._defaultWidgetFactoryOverrides[n]];for(const n of t)if(n in this._defaultRenderedWidgetFactories)return this._widgetFactories[this._defaultRenderedWidgetFactories[n]];return this.defaultWidgetFactory(e)}defaultWidgetFactory(e){return e?this.preferredWidgetFactories(e)[0]:this._widgetFactories[this._defaultWidgetFactory]}setDefaultWidgetFactory(e,t){if(e=e.toLowerCase(),!this.getFileType(e))throw Error(`Cannot find file type ${e}`);if(!t){this._defaultWidgetFactoryOverrides[e]&&delete this._defaultWidgetFactoryOverrides[e];return}if(!this.getWidgetFactory(t))throw Error(`Cannot find widget factory ${t}`);t=t.toLowerCase();const n=this._widgetFactoriesForFileType[e];if(t!==this._defaultWidgetFactory&&!(n&&n.includes(t)))throw Error(`Factory ${t} cannot view file type ${e}`);this._defaultWidgetFactoryOverrides[e]=t}*widgetFactories(){for(const e in this._widgetFactories)yield this._widgetFactories[e]}*modelFactories(){for(const e in this._modelFactories)yield this._modelFactories[e]}*widgetExtensions(e){if(e=e.toLowerCase(),e in this._extenders)for(const t of this._extenders[e])yield t}*fileTypes(){for(const e of this._fileTypes)yield e}getWidgetFactory(e){return this._widgetFactories[e.toLowerCase()]}getModelFactory(e){return this._modelFactories[e.toLowerCase()]}getFileType(e){return e=e.toLowerCase(),je(this._fileTypes,t=>t.name.toLowerCase()===e)}getKernelPreference(e,t,n){t=t.toLowerCase();const i=this._widgetFactories[t];if(!i)return;const r=this.getModelFactory(i.modelName||"text");if(!r)return;const o=r.preferredLanguage(O.PathExt.basename(e)),a=n&&n.name;return{id:n&&n.id,name:a,language:o,shouldStart:i.preferKernel,canStart:i.canStartKernel,shutdownOnDispose:i.shutdownOnClose,autoStartDefault:i.autoStartDefault}}getFileTypeForModel(e){let t=null;if(e.name||e.path){const n=e.name||O.PathExt.basename(e.path),i=this._getFileTypesForPath(n,e.type);i.length>0&&(t=i[0])}switch(e.type){case"directory":return t!==null&&t.contentType==="directory"?t:je(this._fileTypes,n=>n.contentType==="directory")||Fe.getDefaultDirectoryFileType(this.translator);case"notebook":return t!==null&&t.contentType==="notebook"?t:je(this._fileTypes,n=>n.contentType==="notebook")||Fe.getDefaultNotebookFileType(this.translator);default:return t!==null?t:this.getFileType("text")||Fe.getDefaultTextFileType(this.translator)}}getFileTypesForPath(e){return this._getFileTypesForPath(e)}_getFileTypesForPath(e,t){const n=[],i=O.PathExt.basename(e);let r=je(this._fileTypes,a=>!!((!t||a.contentType==t)&&a.pattern&&i.match(a.pattern)!==null));r&&n.push(r);let o=Lt.extname(i);for(;o.length>1;){const a=this._fileTypes.filter(l=>(!t||l.contentType==t)&&l.extensions.map(c=>c.toLowerCase()).includes(o));n.push(...a),o="."+o.split(".").slice(2).join(".")}return n}}(function(s){function e(o){return o=o||se,{name:"default",displayName:(o?.load("jupyterlab")).__("default"),extensions:[],mimeTypes:[],contentType:"file",fileFormat:"text"}}s.getFileTypeDefaults=e;function t(o){o=o||se;const a=o?.load("jupyterlab");return{...e(o),name:"text",displayName:a.__("Text"),mimeTypes:["text/plain"],extensions:[".txt"],icon:Hr}}s.getDefaultTextFileType=t;function n(o){o=o||se;const a=o?.load("jupyterlab");return{...e(o),name:"notebook",displayName:a.__("Notebook"),mimeTypes:["application/x-ipynb+json"],extensions:[".ipynb"],contentType:"notebook",fileFormat:"json",icon:vl}}s.getDefaultNotebookFileType=n;function i(o){o=o||se;const a=o?.load("jupyterlab");return{...e(o),name:"directory",displayName:a.__("Directory"),extensions:[],mimeTypes:["text/directory"],contentType:"directory",icon:Vr}}s.getDefaultDirectoryFileType=i;function r(o){o=o||se;const a=o?.load("jupyterlab");return[t(o),n(o),i(o),{name:"markdown",displayName:a.__("Markdown File"),extensions:[".md"],mimeTypes:["text/markdown"],icon:wl},{name:"PDF",displayName:a.__("PDF File"),extensions:[".pdf"],mimeTypes:["application/pdf"],icon:Cl},{name:"python",displayName:a.__("Python File"),extensions:[".py"],mimeTypes:["text/x-python"],icon:El},{name:"json",displayName:a.__("JSON File"),extensions:[".json"],mimeTypes:["application/json"],icon:Cs},{name:"jsonl",displayName:a.__("JSONLines File"),extensions:[".jsonl",".ndjson"],mimeTypes:["text/jsonl","application/jsonl","application/json-lines"],icon:Cs},{name:"julia",displayName:a.__("Julia File"),extensions:[".jl"],mimeTypes:["text/x-julia"],icon:xl},{name:"csv",displayName:a.__("CSV File"),extensions:[".csv"],mimeTypes:["text/csv"],icon:Li},{name:"tsv",displayName:a.__("TSV File"),extensions:[".tsv"],mimeTypes:["text/csv"],icon:Li},{name:"r",displayName:a.__("R File"),mimeTypes:["text/x-rsrc"],extensions:[".R"],icon:Tl},{name:"yaml",displayName:a.__("YAML File"),mimeTypes:["text/x-yaml","text/yaml"],extensions:[".yaml",".yml"],icon:Sl},{name:"svg",displayName:a.__("Image"),mimeTypes:["image/svg+xml"],extensions:[".svg"],icon:gt,fileFormat:"base64"},{name:"tiff",displayName:a.__("Image"),mimeTypes:["image/tiff"],extensions:[".tif",".tiff"],icon:gt,fileFormat:"base64"},{name:"jpeg",displayName:a.__("Image"),mimeTypes:["image/jpeg"],extensions:[".jpg",".jpeg"],icon:gt,fileFormat:"base64"},{name:"gif",displayName:a.__("Image"),mimeTypes:["image/gif"],extensions:[".gif"],icon:gt,fileFormat:"base64"},{name:"png",displayName:a.__("Image"),mimeTypes:["image/png"],extensions:[".png"],icon:gt,fileFormat:"base64"},{name:"bmp",displayName:a.__("Image"),mimeTypes:["image/bmp"],extensions:[".bmp"],icon:gt,fileFormat:"base64"},{name:"webp",displayName:a.__("Image"),mimeTypes:["image/webp"],extensions:[".webp"],icon:gt,fileFormat:"base64"},{name:"aac",displayName:a.__("Audio"),extensions:[".aac"],mimeTypes:["audio/aac"],icon:ot,fileFormat:"base64"},{name:"midi",displayName:a.__("Audio"),extensions:[".midi",".mid"],mimeTypes:["audio/midi","audio/x-midi"],icon:ot,fileFormat:"base64"},{name:"mp3",displayName:a.__("Audio"),extensions:[".mp3"],mimeTypes:["audio/mpeg"],icon:ot,fileFormat:"base64"},{name:"wav",displayName:a.__("Audio"),extensions:[".wav"],mimeTypes:["audio/wav","audio/x-wav"],icon:ot,fileFormat:"base64"},{name:"ogg",displayName:a.__("Audio"),extensions:[".ogg"],mimeTypes:["audio/ogg"],icon:ot,fileFormat:"base64"},{name:"m4a",displayName:a.__("Audio"),extensions:[".m4a"],mimeTypes:["audio/mp4"],icon:ot,fileFormat:"base64"},{name:"flac",displayName:a.__("Audio"),extensions:[".flac"],mimeTypes:["audio/flac"],icon:ot,fileFormat:"base64"},{name:"opus",displayName:a.__("Audio"),extensions:[".opus"],mimeTypes:["audio/opus"],icon:ot,fileFormat:"base64"},{name:"mp4",displayName:a.__("Video"),extensions:[".mp4"],mimeTypes:["video/mp4"],fileFormat:"base64",icon:Ze},{name:"mpeg",displayName:a.__("Video"),extensions:[".mpeg"],mimeTypes:["video/mpeg"],fileFormat:"base64",icon:Ze},{name:"webm",displayName:a.__("Video"),extensions:[".webm"],mimeTypes:["video/webm"],fileFormat:"base64",icon:Ze},{name:"ogv",displayName:a.__("Video"),extensions:[".ogv",".ogg"],mimeTypes:["video/ogg"],fileFormat:"base64",icon:Ze},{name:"avi",displayName:a.__("Video"),extensions:[".avi"],mimeTypes:["video/x-msvideo"],fileFormat:"base64",icon:Ze},{name:"mov",displayName:a.__("Video"),extensions:[".mov"],mimeTypes:["video/quicktime"],fileFormat:"base64",icon:Ze},{name:"m4v",displayName:a.__("Video"),extensions:[".m4v"],mimeTypes:["video/mp4","video/x-m4v"],fileFormat:"base64",icon:Ze},{name:"3gp",displayName:a.__("Video"),extensions:[".3gp"],mimeTypes:["video/3gpp"],fileFormat:"base64",icon:Ze},{name:"mkv",displayName:a.__("Video"),extensions:[".mkv"],mimeTypes:["video/x-matroska"],fileFormat:"base64",icon:Ze}]}s.getDefaultFileTypes=r})(Fe||(Fe={}));var Lt;(function(s){function e(n){const i=O.PathExt.basename(n).split(".");return i.shift(),("."+i.join(".")).toLowerCase()}s.extname=e;function t(){}s.noOp=t})(Lt||(Lt={}));const Uo="api/collaboration/room",$o="api/collaboration/session";async function Ko(s,e,t,n){const i=n??Be.ServerConnection.makeSettings(),r=O.URLExt.join(i.baseUrl,$o,encodeURIComponent(t)),o={method:"PUT",body:JSON.stringify({format:s,type:e})};let a;try{a=await Be.ServerConnection.makeRequest(r,o,i)}catch(c){throw new Be.ServerConnection.NetworkError(c)}let l=await a.text();if(l.length>0)try{l=JSON.parse(l)}catch{console.log("Not a JSON response body.",a)}if(!a.ok)throw new Be.ServerConnection.ResponseError(a,l.message||l);return l}var Ce;(function(s){s.Disconnected="disconnected",s.Connecting="connecting",s.Connected="connected",s.Error="error"})(Ce||(Ce={}));class vi{type;_status=Ce.Disconnected;_provider=null;_sharedModel=null;_statusChanged=new U(this);_errorOccurred=new U(this);_syncStateChanged=new U(this);_isDisposed=!1;constructor(e){this.type=e}get status(){return this._status}get isConnected(){return this._status===Ce.Connected}get isDisposed(){return this._isDisposed}get events(){return{statusChanged:this._statusChanged,errorOccurred:this._errorOccurred,syncStateChanged:this._syncStateChanged}}disconnect(){this._provider&&(this._provider.disconnect(),this._provider.destroy(),this._provider=null),this._sharedModel=null,this.setStatus(Ce.Disconnected)}getProvider(){return this._provider}getSharedModel(){return this._sharedModel}handleConnectionClose(e){e.code>1e3&&(console.error("Connection closed unexpectedly:",e),this.setStatus(Ce.Error),this._errorOccurred.emit(new Error(`Connection closed: ${e.reason}`)))}handleSync(e){this._syncStateChanged.emit(e),e&&this.setStatus(Ce.Connected)}dispose(){this._isDisposed||(this.disconnect(),U.clearData(this),this._isDisposed=!0)}setStatus(e){this._status!==e&&(this._status=e,this._statusChanged.emit(e))}}const qo=R.createContext(void 0);function b_({provider:s,children:e}){const[t,n]=R.useState(Ce.Disconnected),[i,r]=R.useState(!1),[o,a]=R.useState(null),l=R.useMemo(()=>s||null,[s]);R.useEffect(()=>{if(!l)return;const h=(b,g)=>{n(g)},m=(b,g)=>{a(g)},_=(b,g)=>{r(g)};return l.events.statusChanged.connect(h),l.events.errorOccurred.connect(m),l.events.syncStateChanged.connect(_),n(l.status),()=>{l.events.statusChanged.disconnect(h),l.events.errorOccurred.disconnect(m),l.events.syncStateChanged.disconnect(_)}},[l]),R.useEffect(()=>()=>{l?.dispose()},[l]);const c=async(h,m,_)=>{if(!l)throw new Error("No collaboration provider configured");a(null);try{await l.connect(h,m,_)}catch(b){throw a(b),b}},d=()=>{l?.disconnect(),r(!1),a(null)},u={provider:l,status:t,isConnected:t===Ce.Connected,isSynced:i,error:o,connect:c,disconnect:d};return f.jsx(qo.Provider,{value:u,children:e})}function wi(){const s=R.useContext(qo);if(!s)throw new Error("useCollaboration must be used within a CollaborationProvider");return s}function v_(){const{status:s}=wi();return s}function w_(){const{isConnected:s}=wi();return s}const Go=0,Ci=1,Jo=2,Is=(s,e)=>{Ee(s,Go);const t=Pl(e);ht(s,t)},Yo=(s,e,t)=>{Ee(s,Ci),ht(s,Al(e,t))},C_=(s,e,t)=>Yo(e,t,ri(s)),Xo=(s,e,t,n)=>{try{Rl(e,ri(s),t)}catch(i){n?.(i),console.error("Caught error while handling a Yjs update",i)}},E_=(s,e)=>{Ee(s,Jo),ht(s,e)},x_=Xo,T_=(s,e,t,n,i)=>{const r=ii(s);switch(r){case Go:C_(s,e,t);break;case Ci:Xo(s,t,n,i);break;case Jo:x_(s,t,n,i);break;default:throw new Error("Unknown message type")}return r},S_=0,P_=(s,e,t)=>{ii(s)===S_&&t(e,Il(s))},Et=0,Zo=3,Mt=1,A_=2,dn=[];dn[Et]=(s,e,t,n,i)=>{Ee(s,Et);const r=T_(e,s,t.doc,t);n&&r===Ci&&!t.synced&&(t.synced=!0)};dn[Zo]=(s,e,t,n,i)=>{Ee(s,Mt),ht(s,en(t.awareness,Array.from(t.awareness.getStates().keys())))};dn[Mt]=(s,e,t,n,i)=>{Dl(t.awareness,ri(e),t)};dn[A_]=(s,e,t,n,i)=>{P_(e,t.doc,(r,o)=>R_(t,o))};const Ji=3e4,R_=(s,e)=>console.warn(`Permission denied to access ${s.url}.
409
+ ${e}`),Qo=(s,e,t)=>{const n=Ml(e),i=Ne(),r=ii(n),o=s.messageHandlers[r];return o?o(i,n,s,t,r):console.error("Unable to compute message"),i},Ls=(s,e,t)=>{e===s.ws&&(s.emit("connection-close",[t,s]),s.ws=null,e.close(),s.wsconnecting=!1,s.wsconnected?(s.wsconnected=!1,s.synced=!1,Ur(s.awareness,Array.from(s.awareness.getStates().keys()).filter(n=>n!==s.doc.clientID),s),s.emit("status",[{status:"disconnected"}])):s.wsUnsuccessfulReconnects++,setTimeout(ea,kl(Fl(2,s.wsUnsuccessfulReconnects)*100,s.maxBackoffTime),s))},ea=s=>{if(s.shouldConnect&&s.ws===null){const e=new s._WS(s.url,s.protocols);e.binaryType="arraybuffer",s.ws=e,s.wsconnecting=!0,s.wsconnected=!1,s.synced=!1,e.onmessage=t=>{s.wsLastMessageReceived=xs();const n=Qo(s,new Uint8Array(t.data),!0);zr(n)>1&&e.send(ke(n))},e.onerror=t=>{s.emit("connection-error",[t,s])},e.onclose=t=>{Ls(s,e,t)},e.onopen=()=>{s.wsLastMessageReceived=xs(),s.wsconnecting=!1,s.wsconnected=!0,s.wsUnsuccessfulReconnects=0,s.emit("status",[{status:"connected"}]);const t=Ne();if(Ee(t,Et),Is(t,s.doc),e.send(ke(t)),s.awareness.getLocalState()!==null){const n=Ne();Ee(n,Mt),ht(n,en(s.awareness,[s.doc.clientID])),e.send(ke(n))}},s.emit("status",[{status:"connecting"}])}},ds=(s,e)=>{const t=s.ws;s.wsconnected&&t&&t.readyState===t.OPEN&&t.send(e),s.bcconnected&&At(s.bcChannel,e,s)};class I_ extends Ll{constructor(e,t,n,{connect:i=!0,awareness:r=new Ol(n),params:o={},protocols:a=[],WebSocketPolyfill:l=WebSocket,resyncInterval:c=-1,maxBackoffTime:d=2500,disableBc:u=!1}={}){for(super();e[e.length-1]==="/";)e=e.slice(0,e.length-1);this.serverUrl=e,this.bcChannel=e+"/"+t,this.maxBackoffTime=d,this.params=o,this.protocols=a,this.roomname=t,this.doc=n,this._WS=l,this.awareness=r,this.wsconnected=!1,this.wsconnecting=!1,this.bcconnected=!1,this.disableBc=u,this.wsUnsuccessfulReconnects=0,this.messageHandlers=dn.slice(),this._synced=!1,this.ws=null,this.wsLastMessageReceived=0,this.shouldConnect=i,this._resyncInterval=0,c>0&&(this._resyncInterval=setInterval(()=>{if(this.ws&&this.ws.readyState===WebSocket.OPEN){const h=Ne();Ee(h,Et),Is(h,n),this.ws.send(ke(h))}},c)),this._bcSubscriber=(h,m)=>{if(m!==this){const _=Qo(this,new Uint8Array(h),!1);zr(_)>1&&At(this.bcChannel,ke(_),this)}},this._updateHandler=(h,m)=>{if(m!==this){const _=Ne();Ee(_,Et),E_(_,h),ds(this,ke(_))}},this.doc.on("update",this._updateHandler),this._awarenessUpdateHandler=({added:h,updated:m,removed:_},b)=>{const g=h.concat(m).concat(_),p=Ne();Ee(p,Mt),ht(p,en(r,g)),ds(this,ke(p))},this._exitHandler=()=>{Ur(this.awareness,[n.clientID],"app closed")},Oi&&typeof process<"u"&&process.on("exit",this._exitHandler),r.on("update",this._awarenessUpdateHandler),this._checkInterval=setInterval(()=>{this.wsconnected&&Ji<xs()-this.wsLastMessageReceived&&Ls(this,this.ws,null)},Ji/10),i&&this.connect()}get url(){const e=uh(this.params);return this.serverUrl+"/"+this.roomname+(e.length===0?"":"?"+e)}get synced(){return this._synced}set synced(e){this._synced!==e&&(this._synced=e,this.emit("synced",[e]),this.emit("sync",[e]))}destroy(){this._resyncInterval!==0&&clearInterval(this._resyncInterval),clearInterval(this._checkInterval),this.disconnect(),Oi&&typeof process<"u"&&process.off("exit",this._exitHandler),this.awareness.off("update",this._awarenessUpdateHandler),this.doc.off("update",this._updateHandler),super.destroy()}connectBc(){if(this.disableBc)return;this.bcconnected||(hh(this.bcChannel,this._bcSubscriber),this.bcconnected=!0);const e=Ne();Ee(e,Et),Is(e,this.doc),At(this.bcChannel,ke(e),this);const t=Ne();Ee(t,Et),Yo(t,this.doc),At(this.bcChannel,ke(t),this);const n=Ne();Ee(n,Zo),At(this.bcChannel,ke(n),this);const i=Ne();Ee(i,Mt),ht(i,en(this.awareness,[this.doc.clientID])),At(this.bcChannel,ke(i),this)}disconnectBc(){const e=Ne();Ee(e,Mt),ht(e,en(this.awareness,[this.doc.clientID],new Map)),ds(this,ke(e)),this.bcconnected&&(fh(this.bcChannel,this._bcSubscriber),this.bcconnected=!1)}disconnect(){this.shouldConnect=!1,this.disconnectBc(),this.ws!==null&&Ls(this,this.ws,null)}connect(){this.shouldConnect=!0,!this.wsconnected&&this.ws===null&&(ea(this),this.connectBc())}}class L_ extends vi{_config;_onSync=null;_onConnectionClose=null;_connection=null;_sessionRenewals=0;constructor(e={}){super("jupyter"),this._config=e}async connect(e,t,n){if(this.isConnected||this._status===Ce.Connecting||this._provider){console.warn("Already connected to Jupyter collaboration service");return}this.setStatus(Ce.Connecting),this._connection={sharedModel:e,documentId:t,options:n};try{const i=this._config.serverSettings??Be.ServerConnection.makeSettings(),{ydoc:r,awareness:o}=e,a=n?.path||this._config.path;if(!a)throw new Error("Path is required for Jupyter collaboration. Provide it in the config or via connect options.");const l=await Ko(this._config.format||"json",this._config.documentType||"notebook",a,i),c=i.wsUrl;if(!c)throw new Error("WebSocket URL is not available");const d=O.URLExt.join(c,Uo),u=`${l.format}:${l.type}:${l.fileId}`,h={sessionId:l.sessionId};i.token&&(h.token=i.token),this._provider=new I_(d,u,r,{disableBc:!0,params:h,awareness:o,...n}),this._sharedModel=e,this._onSync=m=>{if(m){this._sessionRenewals=0;try{r.getMap("state").set("document_id",u)}catch(_){console.warn("Failed to record the collaboration room id in the shared document.",_)}}this.handleSync(m)},this._onConnectionClose=m=>{this.handleConnectionClose(m)},this._provider.on("sync",this._onSync),this._provider.on("connection-close",this._onConnectionClose),console.log("Connected to Jupyter collaboration service")}catch(i){throw this.setStatus(Ce.Error),this._errorOccurred.emit(i),i}}disconnect(){this._connection=null,this._provider&&(this._onSync&&this._provider.off("sync",this._onSync),this._onConnectionClose&&this._provider.off("connection-close",this._onConnectionClose)),super.disconnect()}handleConnectionClose(e){if(super.handleConnectionClose(e),e.code===4002){const t=this._sessionRenewals+=1;if(!this._connection||t>5){console.warn("Jupyter collaboration session expired and was not renewed.");return}const{sharedModel:n,documentId:i,options:r}=this._connection;console.info(`Jupyter collaboration session expired: renewing it (attempt ${t}).`),this._provider&&(this._onSync&&this._provider.off("sync",this._onSync),this._onConnectionClose&&this._provider.off("connection-close",this._onConnectionClose),this._provider.destroy(),this._provider=null),this.setStatus(Ce.Disconnected);const o=Math.min(500*2**(t-1),8e3);setTimeout(()=>{this._connection?.sharedModel===n&&(this._connection=null,this.connect(n,i,r).catch(a=>{console.error("Failed to renew the expired Jupyter collaboration session.",a)}))},o)}}}class O_ extends vi{constructor(e){super("none")}async connect(e,t,n){this._sharedModel=e,this.setStatus(Ce.Connected),this._syncStateChanged.emit(!0)}disconnect(){this._sharedModel=null,this.setStatus(Ce.Disconnected)}getProvider(){return null}handleConnectionClose(e){}handleSync(e){this._syncStateChanged.emit(!0)}}const k_=s=>{const{version:e}=s,[t,n]=R.useState(!1);return f.jsxs(f.Fragment,{children:[f.jsxs(xo,{as:"h2",children:["🪐 ⚛️ Jupyter React",f.jsx(Ut,{sx:{marginLeft:1},children:e})]}),f.jsx(ee,{children:f.jsx(be,{children:"React.js components 💯% compatible with 🪐 Jupyter."})}),f.jsx(ee,{children:f.jsx(gs,{href:"https://datalayer.tech/docs/releases/1.2.0-black-snake",target:"_blank",children:f.jsx(be,{as:"h4",children:"Datalayer 1.2.0 Black Snake Release"})})}),f.jsx(ee,{children:f.jsx(gs,{href:"https://github.com/datalayer/jupyter-ui/tree/main/packages/react",target:"_blank",children:f.jsx(be,{as:"h4",children:"Source code"})})}),f.jsx(ee,{mt:3,children:t?f.jsx(Eh,{size:300,onClick:i=>n(!1)}):f.jsx("img",{src:"https://assets.datalayer.tech/releases/datalayer-1.2.0-black-snake_1024.png",onClick:i=>n(!0)})})]})},us={id:"root",name:"File Browser"},ta=s=>{const{serviceManager:e}=s,[t,n]=R.useState(us),[,i]=R.useReducer(a=>a+1,0),r=(a,l,c)=>{((u,h)=>u.contents().get(h.join("/")).then(_=>{const g=_.content.map(p=>p.type==="directory"?{id:"folder_"+p.name,name:p.name,children:new Array}:{id:"file_"+p.name,name:p.name});return g.sort((p,w)=>p.id.startsWith("folder_")&&w.id.startsWith("file_")?-1:p.id.startsWith("file_")&&w.id.startsWith("folder_")?1:p.name.localeCompare(w.name)),g}))(a,c).then(u=>{l.children=u;for(const h of l.children)h.id.startsWith("folder_")&&r(a,h,c.concat(h.name));n(us),i()})};R.useEffect(()=>{if(e){const a=new ko(e);r(a,us,[])}},[e]);const o=a=>a.map(l=>f.jsxs(Qe.Item,{id:l.id,children:[f.jsx(Qe.LeadingVisual,{children:Array.isArray(l.children)?f.jsx(Qe.DirectoryIcon,{}):f.jsx(Nl,{})}),l.name,Array.isArray(l.children)&&f.jsx(Qe.SubTree,{children:o(l.children)})]},l.id));return f.jsx(f.Fragment,{children:f.jsx(Qe,{children:f.jsxs(Qe.Item,{id:t.id,defaultExpanded:!0,children:[f.jsx(Qe.LeadingVisual,{children:f.jsx(Qe.DirectoryIcon,{})}),t.name,Array.isArray(t.children)&&f.jsx(Qe.SubTree,{children:o(t.children)})]})})})},F_=()=>{const{serviceManager:s}=Je();return s?f.jsx(ta,{serviceManager:s}):f.jsx(f.Fragment,{})},na=({id:s="lumino-box-id",height:e="100%",children:t})=>{const n=R.useRef(null);return R.useEffect(()=>{if(n&&n.current){const i=new we;i.spacing=0,i.addWidget(t);try{X.attach(i,n.current)}catch(o){console.warn("Exception while attaching Lumino widget.",o)}const r=new ResizeObserver(()=>{i.isAttached&&Ie.sendMessage(i,X.ResizeMessage.UnknownSize)});return r.observe(n.current),()=>{r.disconnect();try{(i.isAttached||i.node.isConnected)&&(i.dispose(),X.detach(i))}catch{}}}},[n,t]),f.jsx(ee,{style:{height:e,minHeight:e,width:"100%"},children:f.jsx("div",{id:s,ref:n})})};class sa extends T.Component{render(){return f.jsx("div",{ref:e=>{}})}}var Os=function(s,e){return Os=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},Os(s,e)};function ia(s,e){Os(s,e);function t(){this.constructor=s}s.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function ks(s){return typeof s=="function"}var Yi=!1,ze={set useDeprecatedSynchronousErrorHandling(s){if(s){var e=new Error;""+e.stack}Yi=s},get useDeprecatedSynchronousErrorHandling(){return Yi}};function qt(s){setTimeout(function(){throw s},0)}var Wn={closed:!0,next:function(s){},error:function(s){if(ze.useDeprecatedSynchronousErrorHandling)throw s;qt(s)},complete:function(){}},M_=(function(){return Array.isArray||(function(s){return s&&typeof s.length=="number"})})();function D_(s){return s!==null&&typeof s=="object"}var N_=(function(){function s(e){return Error.call(this),this.message=e?e.length+` errors occurred during unsubscription:
410
410
  `+e.map(function(t,n){return n+1+") "+t.toString()}).join(`
411
- `):"",this.name="UnsubscriptionError",this.errors=e,this}return s.prototype=Object.create(Error.prototype),s})(),Rn=N_,j_=(function(){function s(e){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,e&&(this._ctorUnsubscribe=!0,this._unsubscribe=e)}return s.prototype.unsubscribe=function(){var e;if(!this.closed){var t=this,n=t._parentOrParents,i=t._ctorUnsubscribe,r=t._unsubscribe,o=t._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof s)n.remove(this);else if(n!==null)for(var a=0;a<n.length;++a){var l=n[a];l.remove(this)}if(ks(r)){i&&(this._unsubscribe=void 0);try{r.call(this)}catch(u){e=u instanceof Rn?Xi(u.errors):[u]}}if(D_(o))for(var a=-1,c=o.length;++a<c;){var d=o[a];if(M_(d))try{d.unsubscribe()}catch(h){e=e||[],h instanceof Rn?e=e.concat(Xi(h.errors)):e.push(h)}}if(e)throw new Rn(e)}},s.prototype.add=function(e){var t=e;if(!e)return s.EMPTY;switch(typeof e){case"function":t=new s(e);case"object":if(t===this||t.closed||typeof t.unsubscribe!="function")return t;if(this.closed)return t.unsubscribe(),t;if(!(t instanceof s)){var n=t;t=new s,t._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var i=t._parentOrParents;if(i===null)t._parentOrParents=this;else if(i instanceof s){if(i===this)return t;t._parentOrParents=[i,this]}else if(i.indexOf(this)===-1)i.push(this);else return t;var r=this._subscriptions;return r===null?this._subscriptions=[t]:r.push(t),t},s.prototype.remove=function(e){var t=this._subscriptions;if(t){var n=t.indexOf(e);n!==-1&&t.splice(n,1)}},s.EMPTY=(function(e){return e.closed=!0,e})(new s),s})();function Xi(s){return s.reduce(function(e,t){return e.concat(t instanceof Rn?t.errors:t)},[])}var Fs=(function(){return typeof Symbol=="function"?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()})(),tn=(function(s){ia(e,s);function e(t,n,i){var r=s.call(this)||this;switch(r.syncErrorValue=null,r.syncErrorThrown=!1,r.syncErrorThrowable=!1,r.isStopped=!1,arguments.length){case 0:r.destination=Wn;break;case 1:if(!t){r.destination=Wn;break}if(typeof t=="object"){t instanceof e?(r.syncErrorThrowable=t.syncErrorThrowable,r.destination=t,t.add(r)):(r.syncErrorThrowable=!0,r.destination=new Zi(r,t));break}default:r.syncErrorThrowable=!0,r.destination=new Zi(r,t,n,i);break}return r}return e.prototype[Fs]=function(){return this},e.create=function(t,n,i){var r=new e(t,n,i);return r.syncErrorThrowable=!1,r},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,s.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},e})(j_),Zi=(function(s){ia(e,s);function e(t,n,i,r){var o=s.call(this)||this;o._parentSubscriber=t;var a,l=o;return ks(n)?a=n:n&&(a=n.next,i=n.error,r=n.complete,n!==Wn&&(l=Object.create(n),ks(l.unsubscribe)&&o.add(l.unsubscribe.bind(l)),l.unsubscribe=o.unsubscribe.bind(o))),o._context=l,o._next=a,o._error=i,o._complete=r,o}return e.prototype.next=function(t){if(!this.isStopped&&this._next){var n=this._parentSubscriber;!ze.useDeprecatedSynchronousErrorHandling||!n.syncErrorThrowable?this.__tryOrUnsub(this._next,t):this.__tryOrSetError(n,this._next,t)&&this.unsubscribe()}},e.prototype.error=function(t){if(!this.isStopped){var n=this._parentSubscriber,i=ze.useDeprecatedSynchronousErrorHandling;if(this._error)!i||!n.syncErrorThrowable?(this.__tryOrUnsub(this._error,t),this.unsubscribe()):(this.__tryOrSetError(n,this._error,t),this.unsubscribe());else if(n.syncErrorThrowable)i?(n.syncErrorValue=t,n.syncErrorThrown=!0):qt(t),this.unsubscribe();else{if(this.unsubscribe(),i)throw t;qt(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var n=this._parentSubscriber;if(this._complete){var i=function(){return t._complete.call(t._context)};!ze.useDeprecatedSynchronousErrorHandling||!n.syncErrorThrowable?(this.__tryOrUnsub(i),this.unsubscribe()):(this.__tryOrSetError(n,i),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,n){try{t.call(this._context,n)}catch(i){if(this.unsubscribe(),ze.useDeprecatedSynchronousErrorHandling)throw i;qt(i)}},e.prototype.__tryOrSetError=function(t,n,i){if(!ze.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{n.call(this._context,i)}catch(r){return ze.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=r,t.syncErrorThrown=!0,!0):(qt(r),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e})(tn);function B_(s){for(;s;){var e=s,t=e.closed,n=e.destination,i=e.isStopped;if(t||i)return!1;n&&n instanceof tn?s=n:s=null}return!0}function W_(s,e,t){if(s){if(s instanceof tn)return s;if(s[Fs])return s[Fs]()}return!s&&!e&&!t?new tn(Wn):new tn(s,e,t)}var H_=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function V_(s){return s}function z_(s){return s.length===0?V_:s.length===1?s[0]:function(t){return s.reduce(function(n,i){return i(n)},t)}}var U_=(function(){function s(e){this._isScalar=!1,e&&(this._subscribe=e)}return s.prototype.lift=function(e){var t=new s;return t.source=this,t.operator=e,t},s.prototype.subscribe=function(e,t,n){var i=this.operator,r=W_(e,t,n);if(i?r.add(i.call(r,this.source)):r.add(this.source||ze.useDeprecatedSynchronousErrorHandling&&!r.syncErrorThrowable?this._subscribe(r):this._trySubscribe(r)),ze.useDeprecatedSynchronousErrorHandling&&r.syncErrorThrowable&&(r.syncErrorThrowable=!1,r.syncErrorThrown))throw r.syncErrorValue;return r},s.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){ze.useDeprecatedSynchronousErrorHandling&&(e.syncErrorThrown=!0,e.syncErrorValue=t),B_(e)?e.error(t):console.warn(t)}},s.prototype.forEach=function(e,t){var n=this;return t=Qi(t),new t(function(i,r){var o;o=n.subscribe(function(a){try{e(a)}catch(l){r(l),o&&o.unsubscribe()}},r,i)})},s.prototype._subscribe=function(e){var t=this.source;return t&&t.subscribe(e)},s.prototype[H_]=function(){return this},s.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length===0?this:z_(e)(this)},s.prototype.toPromise=function(e){var t=this;return e=Qi(e),new e(function(n,i){var r;t.subscribe(function(o){return r=o},function(o){return i(o)},function(){return n(r)})})},s.create=function(e){return new s(e)},s})();function Qi(s){if(s||(s=Promise),!s)throw new Error("no Promise impl found");return s}function $_(s){return new U_(e=>{function t(n,i){e.next(i)}return s.connect(t),()=>{s.disconnect(t)}})}class Xn extends X{static create(e){return new class extends Xn{render(){return e}}}onUpdateRequest(e){this.renderPromise=this.renderDOM()}onAfterAttach(e){Ie.sendMessage(this,X.Msg.UpdateRequest)}onBeforeDetach(e){}renderDOM(){return new Promise(e=>{})}renderPromise}class K_ extends Xn{constructor(e){super(),this.model=e??null}get modelChanged(){return this._modelChanged}set model(e){this._model!==e&&(this._model&&this._model.stateChanged.disconnect(this.update,this),this._model=e,e&&e.stateChanged.connect(this.update,this),this.update(),this._modelChanged.emit(void 0))}get model(){return this._model}dispose(){this.isDisposed||(this._model=null,super.dispose())}_model;_modelChanged=new U(this)}class q_ extends T.Component{constructor(e){super(e),this.state={value:[this.props.initialSender,this.props.initialArgs]}}componentDidMount(){this.props.signal.connect(this.slot)}componentWillUnmount(){this.props.signal.disconnect(this.slot)}slot=(e,t)=>{this.props.shouldUpdate&&!this.props.shouldUpdate(e,t)||this.setState({value:[e,t]})};render(){return this.props.children(...this.state.value)}}class G_{stateChanged=new U(this);get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,U.clearData(this))}_isDisposed=!1}const J_=()=>{const{defaultKernel:s}=Je({startDefaultKernel:!0});return f.jsx(f.Fragment,{children:s&&f.jsx(no,{source:"print('Hello 🪐 ⚛️ Jupyter React')",kernel:s})})},Y_=s=>{const e=s.variant==="danger"?{backgroundColor:"var(--jp-error-color1)",color:"btn.primary.text",borderWidth:0}:s.variant==="primary"?{borderWidth:0}:s.variant==="invisible"?{}:{backgroundColor:"var(--jp-reject-color-normal)",color:"btn.primary.text",borderWidth:0,":active:not([disabled]):not([data-inactive])":{backgroundColor:"var(--jp-reject-color-active)",color:"btn.primary.text"},":hover:not([disabled]):not([data-inactive])":{backgroundColor:"var(--jp-reject-color-hover)",color:"btn.primary.text"}};return f.jsx(si,{sx:e,...s})};class X_{commandsPanel;constructor(){this.commandsPanel=new we,this.commandsPanel.id="datalayer-jupyter-commands",this.commandsPanel.spacing=0;const e=new oi,t=new jl({commands:e});we.setStretch(t,0),this.commandsPanel.addWidget(t),window.addEventListener("resize",()=>{this.commandsPanel.update()});const n=".jp-ConsolePanel",i="Console",r="console:execute";e.addCommand(r,{label:"Execute Cell",execute:()=>{window.alert("Execute Cell")}}),t.addItem({command:r,category:i}),e.addKeyBinding({command:r,selector:n,keys:["Shift Enter"]})}get panel(){return this.commandsPanel}}const Z_=()=>{const s=new X_;return f.jsx(Vt,{children:s.panel})};async function Q_({cell:s,onCellExecuted:e,sessionContext:t}){const n=r=>{if(r&&r.content.status==="ok"){const o=r.content;if(o.payload&&o.payload.length){const a=o.payload.filter(l=>l.source==="set_next_input")[0];if(a){const l=a.text;s.model.sharedModel.setSource(l)}}return e({cell:s,executionDate:new Date,success:!0}),!0}else if(r&&r.content.status==="error"){const o=r.content.ename,a=r.content.evalue;return e({cell:s,executionDate:new Date,success:!1,error:new Error(`KernelReplyNotOK: ${o} ${a}`)}),!1}return e({cell:s,executionDate:new Date,success:!1}),!1},i=r=>(e({cell:s,executionDate:new Date,success:!1,error:new Error(r)}),!1);return ai.execute(s,t).then(n,i)}class eg{constructor(e){this._cursor=0,this._hasSession=!1,this._history=[],this._placeholder="",this._setByHistory=!1,this._isDisposed=!1,this._editor=null,this._filtered=[];const{sessionContext:t}=e;t&&(this.sessionContext=t,this._handleKernel(),this.sessionContext.kernelChanged.connect(this._handleKernel,this))}get editor(){return this._editor}set editor(e){if(this._editor===e)return;const t=this._editor;t&&(t.edgeRequested.disconnect(this.onEdgeRequest,this),t.model.sharedModel.changed.disconnect(this.onTextChange,this)),this._editor=e,e&&(e.edgeRequested.connect(this.onEdgeRequest,this),e.model.sharedModel.changed.connect(this.onTextChange,this))}get placeholder(){return this._placeholder}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed=!0,this._history.length=0,U.clearData(this)}back(e){this._hasSession||(this._hasSession=!0,this._placeholder=e,this.setFilter(e),this._cursor=this._filtered.length-1),--this._cursor,this._cursor=Math.max(0,this._cursor);const t=this._filtered[this._cursor];return Promise.resolve(t)}forward(e){this._hasSession||(this._hasSession=!0,this._placeholder=e,this.setFilter(e),this._cursor=this._filtered.length),++this._cursor,this._cursor=Math.min(this._filtered.length-1,this._cursor);const t=this._filtered[this._cursor];return Promise.resolve(t)}push(e){e&&e!==this._history[this._history.length-1]&&this._history.push(e),this.reset()}reset(){this._cursor=this._history.length,this._hasSession=!1,this._placeholder=""}onHistory(e){this._history.length=0;let t="",n="";if(e.content.status==="ok")for(let i=0;i<e.content.history.length;i++)n=e.content.history[i][2],n!==t&&this._history.push(t=n);this._cursor=this._history.length}onTextChange(){if(this._setByHistory){this._setByHistory=!1;return}this.reset()}onEdgeRequest(e,t){const n=e.model.sharedModel,i=n.getSource();t==="top"||t==="topLine"?this.back(i).then(r=>{if(this.isDisposed||!r||n.getSource()===r)return;this._setByHistory=!0,n.setSource(r);let o=0;o=r.indexOf(`
412
- `),o<0&&(o=r.length),e.setCursorPosition({line:0,column:o})}):this.forward(i).then(r=>{if(this.isDisposed)return;const o=r||this.placeholder;if(n.getSource()===o)return;this._setByHistory=!0,n.setSource(o);const a=e.getPositionAt(o.length);a&&e.setCursorPosition(a)})}async _handleKernel(){var e,t;const n=(t=(e=this.sessionContext)===null||e===void 0?void 0:e.session)===null||t===void 0?void 0:t.kernel;if(!n){this._history.length=0;return}return n.requestHistory(Ds.initialRequest).then(i=>{this.onHistory(i)})}setFilter(e=""){this._filtered.length=0;let t="",n="";for(let i=0;i<this._history.length;i++)n=this._history[i],n!==t&&e===n.slice(0,e.length)&&this._filtered.push(t=n);this._filtered.push(e)}}var Ds;(function(s){s.initialRequest={output:!1,raw:!0,hist_access_type:"tail",n:500}})(Ds||(Ds={}));const tg="jpKernelUser",ng="jpCodeRunner",sg="jp-CodeConsole",er="jp-Console-cell",ig="jp-CodeConsole-banner",tr="jp-CodeConsole-promptCell",rg="jp-CodeConsole-content",og="jp-CodeConsole-input",ag="jp-mod-readWrite",lg=250,cg="application/vnd.jupyter.cells",dg="jpUndoer";class Tt extends X{constructor(e){var t,n,i;super(),this.editorConfig=Tt.defaultEditorConfig,this._banner=null,this._executed=new U(this),this._config={},this._mimetype="text/x-ipython",this._msgIds=new Map,this._msgIdCells=new Map,this._promptCellCreated=new U(this),this._dragData=null,this._drag=null,this._focusedCell=null,this._promptResizeObserver=null,this._hasManualResize=!1,this._resizeAnimationFrameId=null,this._translator=(t=e.translator)!==null&&t!==void 0?t:se,this._executor=(n=e.executor)!==null&&n!==void 0?n:Object.freeze({runCell:Q_}),this.addClass(sg),this.node.dataset[tg]="true",this.node.dataset[ng]="true",this.node.dataset[dg]="true",this.node.tabIndex=-1;const r=this.layout=new Nr;this._cells=new Bl,this._content=new pt,this._input=new pt,this._splitPanel=new Pe({spacing:0}),this._splitPanel.addClass("jp-CodeConsole-split"),this.contentFactory=e.contentFactory,this.modelFactory=(i=e.modelFactory)!==null&&i!==void 0?i:Tt.defaultModelFactory,this.rendermime=e.rendermime,this.sessionContext=e.sessionContext,this._mimeTypeService=e.mimeTypeService,this._content.addClass(rg),this._content.node.tabIndex=0,this._input.addClass(og),this._input.node.tabIndex=0,r.addWidget(this._splitPanel),this._splitPanel.handleMoved.connect(()=>{this._setManualResize()},this),this._splitPanel.node.addEventListener("pointerdown",o=>{o.target.classList.contains("lm-SplitPanel-handle")&&this._setManualResize()},!0),this.setConfig({clearCellsOnExecute:!1,clearCodeContentOnExecute:!0,hideCodeInput:!1,promptCellPosition:"bottom",showBanner:!0}),this._history=new eg({sessionContext:this.sessionContext}),this._onKernelChanged(),this.sessionContext.kernelChanged.connect(this._onKernelChanged,this),this.sessionContext.statusChanged.connect(this._onKernelStatusChanged,this)}get executed(){return this._executed}get promptCellCreated(){return this._promptCellCreated}get cells(){return this._cells}get promptCell(){const e=this._input.layout;return e&&e.widgets[0]||null}addCell(e,t){var n;this._config.clearCellsOnExecute&&this.clear(),e.addClass(er),(n=e.editor)===null||n===void 0||n.setOption("tabFocusable",!1),this._content.addWidget(e),this._cells.push(e),t&&(this._msgIds.set(t,e),this._msgIdCells.set(e,t)),e.disposed.connect(this._onCellDisposed,this),this.update()}addBanner(){if(this._banner){const n=this._banner;this._cells.push(this._banner),n.disposed.connect(this._onCellDisposed,this)}const e=this.modelFactory.createRawCell({sharedModel:Wl({cell_type:"raw",source:"..."})}),t=(this._banner=new $r({model:e,contentFactory:this.contentFactory,placeholder:!1,editorConfig:{autoClosingBrackets:!1,codeFolding:!1,highlightActiveLine:!1,highlightTrailingWhitespace:!1,highlightWhitespace:!1,indentUnit:"4",lineNumbers:!1,lineWrap:!0,matchBrackets:!1,readOnly:!0,rulers:[],scrollPastEnd:!1,smartIndent:!1,tabSize:4,theme:"jupyter",tabFocusable:!1}})).initializeState();t.addClass(ig),t.readOnly=!0,this._content.addWidget(t)}clear(){const e=this._cells;for(;e.length>0;)e.get(0).dispose()}createCodeCell(){const e=this.contentFactory,t=this._createCodeCellOptions(),n=e.createCodeCell(t);return n.readOnly=!0,n.model.mimeType=this._mimetype,n}dispose(){if(this.isDisposed)return;const e=this.promptCell;e&&(this._promptResizeObserver&&(this._promptResizeObserver.disconnect(),this._promptResizeObserver=null),e.model.sharedModel.changed.disconnect(this._onPromptContentChanged,this)),this._cancelPendingResizeAdjustment(),this._msgIdCells=null,this._msgIds=null,this._history.dispose(),super.dispose()}async execute(e=!1,t=lg){var n,i;if(((i=(n=this.sessionContext.session)===null||n===void 0?void 0:n.kernel)===null||i===void 0?void 0:i.status)==="dead")return;const r=this.promptCell;if(!r)throw new Error("Cannot execute without a prompt cell");if(r.model.trusted=!0,e){this.newPromptCell(),await this._execute(r);return}const o=await this._shouldExecute(t);this.isDisposed||(o?(this.newPromptCell(),this.promptCell.editor.focus(),await this._execute(r)):r.editor.newIndentedLine())}getCell(e){return this._msgIds.get(e)}inject(e,t={}){var n;const i=this.createCodeCell();i.model.sharedModel.setSource(e);for(const r of Object.keys(t))i.model.setMetadata(r,t[r]);return this.addCell(i),this._config.hideCodeInput&&((n=i.inputArea)===null||n===void 0||n.setHidden(!0)),this._execute(i)}insertLinebreak(){const e=this.promptCell;e&&e.editor.newIndentedLine()}replaceSelection(e){var t,n;const i=this.promptCell;i&&((n=(t=i.editor).replaceSelection)===null||n===void 0||n.call(t,e))}setConfig(e){const{clearCellsOnExecute:t,clearCodeContentOnExecute:n,hideCodeInput:i,promptCellPosition:r,showBanner:o}=e;this._config={clearCellsOnExecute:t??this._config.clearCellsOnExecute,clearCodeContentOnExecute:n??this._config.clearCodeContentOnExecute,hideCodeInput:i??this._config.hideCodeInput,promptCellPosition:r??this._config.promptCellPosition,showBanner:o??this._config.showBanner},this._updateLayout()}serialize(){const e=[];for(const t of this._cells){const n=t.model;Hl(n)&&e.push(n.toJSON())}return this.promptCell&&e.push(this.promptCell.model.toJSON()),e}_evtMouseDown(e){const{button:t,shiftKey:n}=e;if(!(t===0||t===2)||n&&t===2)return;let i=e.target;const r=c=>c.classList.contains(er);let o=vt.findCell(i,this._cells,r);if(o===-1&&(i=document.elementFromPoint(e.clientX,e.clientY),o=vt.findCell(i,this._cells,r)),o===-1)return;const a=this._cells.get(o);vt.detectTargetArea(a,e.target)==="prompt"&&(this._dragData={pressX:e.clientX,pressY:e.clientY,index:o},this._focusedCell=a,document.addEventListener("mouseup",this,!0),document.addEventListener("mousemove",this,!0),e.preventDefault())}_evtMouseMove(e){const t=this._dragData;t&&vt.shouldStartDrag(t.pressX,t.pressY,e.clientX,e.clientY)&&this._startDrag(t.index,e.clientX,e.clientY)}_startDrag(e,t,n){const i=this._focusedCell.model,r=[i.toJSON()],o=vt.createCellDragImage(this._focusedCell,r);this._drag=new Ts({mimeData:new Kr,dragImage:o,proposedAction:"copy",supportedActions:"copy",source:this}),this._drag.mimeData.setData(cg,r);const a=i.sharedModel.getSource();return this._drag.mimeData.setData("text/plain",a),this._focusedCell=null,document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0),this._drag.start(t,n).then(()=>{this.isDisposed||(this._drag=null,this._dragData=null)})}handleEvent(e){switch(e.type){case"keydown":this._evtKeyDown(e);break;case"mousedown":this._evtMouseDown(e);break;case"mousemove":this._evtMouseMove(e);break;case"mouseup":this._evtMouseUp(e);break;case"resize":this._splitPanel.fit();break;case"focusin":this._evtFocusIn(e);break;case"focusout":this._evtFocusOut(e);break}}onAfterAttach(e){const t=this.node;t.addEventListener("keydown",this,!0),t.addEventListener("click",this),t.addEventListener("mousedown",this),t.addEventListener("focusin",this),t.addEventListener("focusout",this),this.promptCell?(this.promptCell.editor.focus(),this.update()):this.newPromptCell()}onBeforeDetach(e){const t=this.node;t.removeEventListener("keydown",this,!0),t.removeEventListener("click",this),t.removeEventListener("focusin",this),t.removeEventListener("focusout",this)}onActivateRequest(e){const t=this.promptCell&&this.promptCell.editor;t&&t.focus(),this.update()}newPromptCell(){var e,t,n,i,r,o;let a=this.promptCell;const l=this._input,c=(e=a?.model.sharedModel.getSource())!==null&&e!==void 0?e:"",d=(t=a?.editor)===null||t===void 0?void 0:t.getCursorPosition();if(a){a.readOnly=!0,a.removeClass(tr),(n=a.editor)===null||n===void 0||n.setOption("tabFocusable",!1),a.model.sharedModel.changed.disconnect(this._onPromptContentChanged,this);const m=a,_=this._promptResizeObserver;requestIdleCallback(()=>{U.clearData(m.editor),_&&_.disconnect()}),(i=a.editor)===null||i===void 0||i.blur();const b=l.widgets[0];b.parent=null,this._config.hideCodeInput&&((r=a.inputArea)===null||r===void 0||r.setHidden(!0)),this.addCell(a)}const u=this.contentFactory,h=this._createCodeCellOptions();a=u.createCodeCell(h),a.model.mimeType=this._mimetype,a.addClass(tr),this._input.addWidget(a),this._history.editor=a.editor,a.node&&(this._promptResizeObserver=new ResizeObserver(()=>{this._scheduleInputSizeAdjustment()}),this._promptResizeObserver.observe(a.node)),a.model.sharedModel.changed.connect(this._onPromptContentChanged,this),this._config.clearCodeContentOnExecute||(a.model.sharedModel.setSource(c),d&&((o=a.editor)===null||o===void 0||o.setCursorPosition(d))),this._promptCellCreated.emit(a)}onUpdateRequest(e){Ms.scrollToBottom(this._content.node)}_evtKeyDown(e){const t=this.promptCell&&this.promptCell.editor;t&&(e.key==="Enter"&&!t.hasFocus()?(e.preventDefault(),t.focus()):e.key==="Escape"&&t.hasFocus()&&(e.preventDefault(),e.stopPropagation(),t.setOption("tabFocusable",!1),this._input.node.focus()))}_evtMouseUp(e){this.promptCell&&this.promptCell.node.contains(e.target)&&this.promptCell.editor.focus()}_evtFocusIn(e){this._updateReadWrite()}_evtFocusOut(e){this._updateReadWrite()}async _execute(e){const t=e.model.sharedModel.getSource();if(this._history.push(t),t==="clear"||t==="%clear")return this.clear(),Promise.resolve(void 0);e.model.contentChanged.connect(this.update,this);const n={cell:e,sessionContext:this.sessionContext,onCellExecuted:i=>{if(this._executed.emit(i.executionDate),i.error)for(const r of this._cells)r.model.executionCount===null&&(r.model.executionState="idle")}};try{await this._executor.runCell(n)}finally{this.isDisposed||(e.model.contentChanged.disconnect(this.update,this),this.update())}}_handleInfo(e){if(e.status!=="ok"){this._banner&&this._banner.model.sharedModel.setSource("Error in getting kernel banner");return}this._banner&&this._banner.model.sharedModel.setSource(e.banner);const t=e.language_info;this._mimetype=this._mimeTypeService.getMimeTypeByLanguage(t),this.promptCell&&(this.promptCell.model.mimeType=this._mimetype)}_createCodeCellOptions(){const e=this.contentFactory,n=this.modelFactory.createCodeCell({}),i=this.rendermime,r=this.editorConfig;return{model:n,rendermime:i,contentFactory:e,editorConfig:r,placeholder:!1,translator:this._translator}}_onCellDisposed(e,t){if(!this.isDisposed){this._cells.removeValue(e);const n=this._msgIdCells.get(e);n&&(this._msgIdCells.delete(e),this._msgIds.delete(n))}}_shouldExecute(e){const t=this.promptCell;if(!t)return Promise.resolve(!1);const i=t.model.sharedModel.getSource();return new Promise((r,o)=>{var a;const l=setTimeout(()=>{r(!0)},e),c=(a=this.sessionContext.session)===null||a===void 0?void 0:a.kernel;if(!c){r(!1);return}c.requestIsComplete({code:i}).then(d=>{if(clearTimeout(l),this.isDisposed&&r(!1),d.content.status!=="incomplete"){r(!0);return}r(!1)}).catch(()=>{r(!0)})})}async _onKernelChanged(){var e;this.clear(),this._banner&&(this._banner.dispose(),this._banner=null),this._config.showBanner&&this.addBanner(),!((e=this.sessionContext.session)===null||e===void 0)&&e.kernel&&this._handleInfo(await this.sessionContext.session.kernel.info)}async _onKernelStatusChanged(){var e;const t=(e=this.sessionContext.session)===null||e===void 0?void 0:e.kernel;t?.status==="restarting"&&(this._config.showBanner&&this.addBanner(),this._handleInfo(await t?.info))}_updateReadWrite(){const e=q.hasActiveEditableElement(this.node);this.node.classList.toggle(ag,e)}_calculateRelativeSizes(){const{promptCellPosition:e="bottom"}=this._config;let t=[1,1];return e==="top"?t=[1,100]:e==="bottom"&&(t=[100,1]),t}_setManualResize(){this._hasManualResize=!0,this._cancelPendingResizeAdjustment()}_cancelPendingResizeAdjustment(){this._resizeAnimationFrameId!==null&&(cancelAnimationFrame(this._resizeAnimationFrameId),this._resizeAnimationFrameId=null)}_scheduleInputSizeAdjustment(){this._hasManualResize||this._resizeAnimationFrameId===null&&(this._resizeAnimationFrameId=requestAnimationFrame(()=>{this._resizeAnimationFrameId=null,this._adjustSplitPanelForInputGrowth()}))}_onPromptContentChanged(){this._scheduleInputSizeAdjustment()}_adjustSplitPanelForInputGrowth(){if(this.isDisposed||!this._input.node||!this._content.node||this._hasManualResize)return;const{promptCellPosition:e="bottom"}=this._config;if(e==="left"||e==="right")return;const t=this.promptCell;if(!t||!t.editor)return;const i=t.editor.editor.contentHeight,r=this._getInputCellPadding(),o=i+r,a=this._splitPanel.node.clientHeight;if(a<=0||o<=0){this._splitPanel.fit();return}const l=a-o;let c,d;e==="bottom"?(c=l/a,d=o/a):(d=o/a,c=l/a);const u=c+d;if(u>0){const h=e==="bottom"?[c/u,d/u]:[d/u,c/u];this._splitPanel.setRelativeSizes(h)}}_getInputCellPadding(){var e;const t=this._input.node,n=window.getComputedStyle(t),i=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom),r=this.promptCell;if(!r)return i;const o=window.getComputedStyle(r.node),a=parseFloat(o.paddingTop)+parseFloat(o.paddingBottom),l=(e=r.editorWidget)===null||e===void 0?void 0:e.node;let c=0;if(l){const d=window.getComputedStyle(l);c=parseFloat(d.borderTopWidth)+parseFloat(d.borderBottomWidth)}return i+a+c}_updateLayout(){var e,t;this._input.parent=null,this._content.parent=null;const{promptCellPosition:n="bottom"}=this._config;this._hasManualResize=!1,this._splitPanel.orientation=["left","right"].includes(n)?"horizontal":"vertical",Pe.setStretch(this._content,1),Pe.setStretch(this._input,1),n==="bottom"||n==="right"?(this._splitPanel.insertWidget(0,this._content),this._splitPanel.insertWidget(1,this._input)):(this._splitPanel.insertWidget(0,this._input),this._splitPanel.insertWidget(1,this._content)),this._splitPanel.setRelativeSizes(this._calculateRelativeSizes()),requestAnimationFrame(()=>{this._adjustSplitPanelForInputGrowth()}),(t=(e=this.promptCell)===null||e===void 0?void 0:e.editor)===null||t===void 0||t.focus()}}(function(s){s.defaultEditorConfig={codeFolding:!1,lineNumbers:!1,tabFocusable:!1};class e extends Vl.ContentFactory{createCodeCell(i){return new ai(i).initializeState()}createRawCell(i){return new $r(i).initializeState()}}s.ContentFactory=e;class t{constructor(i={}){this.codeCellContentFactory=i.codeCellContentFactory||ki.defaultContentFactory}createCodeCell(i={}){return i.contentFactory||(i.contentFactory=this.codeCellContentFactory),new ki(i)}createRawCell(i){return new zl(i)}}s.ModelFactory=t,s.defaultModelFactory=new t({})})(Tt||(Tt={}));var Ms;(function(s){function e(t){t.scrollTop=t.scrollHeight-t.clientHeight}s.scrollToBottom=e})(Ms||(Ms={}));const ug="jp-ConsolePanel";class Hn extends Ul{constructor(e){var t;super({content:new pt}),this._executed=null,this._connected=null,this._preventTitleUpdate=!1,this.addClass(ug);let{executor:n,rendermime:i,mimeTypeService:r,path:o,basePath:a,name:l,manager:c,modelFactory:d,sessionContext:u,translator:h}=e;this.translator=h??se;const m=this.translator.load("jupyterlab"),_=this.contentFactory=e.contentFactory,b=Vn.count++;o||(o=O.PathExt.join(a||"",`console-${b}-${qr.uuid4()}`)),u=this._sessionContext=u??new $l({kernelManager:c.kernels,sessionManager:c.sessions,specsManager:c.kernelspecs,path:c.contents.localPath(o),name:l||m.__("Console %1",b),type:"console",kernelPreference:e.kernelPreference,setBusy:e.setBusy});const g=new ao.UrlResolver({path:o,contents:c.contents,getKernelId:()=>{var p,w;return(w=(p=u?.session)===null||p===void 0?void 0:p.kernel)===null||w===void 0?void 0:w.id}});i=i.clone({resolver:g}),this.console=_.createConsole({executor:n,rendermime:i,sessionContext:u,mimeTypeService:r,contentFactory:_,modelFactory:d,translator:h}),this.content.addWidget(this.console),u.initialize().then(async p=>{var w;p&&await((w=e.sessionDialogs)!==null&&w!==void 0?w:new Gr({translator:h})).selectKernel(u),this._connected=new Date,this._updateTitlePanel()}),this.console.executed.connect(this._onExecuted,this),this._updateTitlePanel(),e.preventTitleUpdate||(u.kernelChanged.connect(this._updateTitlePanel,this),u.propertyChanged.connect(this._updateTitlePanel,this)),this.title.icon=Kl,this.title.closable=!0,this.id=`console-${b}`,this._preventTitleUpdate=(t=e.preventTitleUpdate)!==null&&t!==void 0?t:!1}get sessionContext(){return this._sessionContext}dispose(){this.sessionContext.dispose(),this.console.dispose(),super.dispose()}onActivateRequest(e){const t=this.console.promptCell;t&&t.editor.focus()}onCloseRequest(e){super.onCloseRequest(e),this.dispose()}_onExecuted(e,t){this._executed=t,this._updateTitlePanel()}_updateTitlePanel(){this._preventTitleUpdate||Vn.updateTitle(this,this._connected,this._executed,this.translator)}}(function(s){class e extends Tt.ContentFactory{createConsole(n){return new Tt(n)}}s.ContentFactory=e,s.IContentFactory=new Ae("@jupyterlab/console:IContentFactory","A factory object that creates new code consoles. Use this if you want to create and host code consoles in your own UI elements.")})(Hn||(Hn={}));var Vn;(function(s){s.count=1;function e(t,n,i,r){r=r||se;const o=r.load("jupyterlab"),a=t.console.sessionContext.session;if(a){let l=o.__(`Name: %1
411
+ `):"",this.name="UnsubscriptionError",this.errors=e,this}return s.prototype=Object.create(Error.prototype),s})(),Rn=N_,j_=(function(){function s(e){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,e&&(this._ctorUnsubscribe=!0,this._unsubscribe=e)}return s.prototype.unsubscribe=function(){var e;if(!this.closed){var t=this,n=t._parentOrParents,i=t._ctorUnsubscribe,r=t._unsubscribe,o=t._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof s)n.remove(this);else if(n!==null)for(var a=0;a<n.length;++a){var l=n[a];l.remove(this)}if(ks(r)){i&&(this._unsubscribe=void 0);try{r.call(this)}catch(u){e=u instanceof Rn?Xi(u.errors):[u]}}if(M_(o))for(var a=-1,c=o.length;++a<c;){var d=o[a];if(D_(d))try{d.unsubscribe()}catch(h){e=e||[],h instanceof Rn?e=e.concat(Xi(h.errors)):e.push(h)}}if(e)throw new Rn(e)}},s.prototype.add=function(e){var t=e;if(!e)return s.EMPTY;switch(typeof e){case"function":t=new s(e);case"object":if(t===this||t.closed||typeof t.unsubscribe!="function")return t;if(this.closed)return t.unsubscribe(),t;if(!(t instanceof s)){var n=t;t=new s,t._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var i=t._parentOrParents;if(i===null)t._parentOrParents=this;else if(i instanceof s){if(i===this)return t;t._parentOrParents=[i,this]}else if(i.indexOf(this)===-1)i.push(this);else return t;var r=this._subscriptions;return r===null?this._subscriptions=[t]:r.push(t),t},s.prototype.remove=function(e){var t=this._subscriptions;if(t){var n=t.indexOf(e);n!==-1&&t.splice(n,1)}},s.EMPTY=(function(e){return e.closed=!0,e})(new s),s})();function Xi(s){return s.reduce(function(e,t){return e.concat(t instanceof Rn?t.errors:t)},[])}var Fs=(function(){return typeof Symbol=="function"?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()})(),tn=(function(s){ia(e,s);function e(t,n,i){var r=s.call(this)||this;switch(r.syncErrorValue=null,r.syncErrorThrown=!1,r.syncErrorThrowable=!1,r.isStopped=!1,arguments.length){case 0:r.destination=Wn;break;case 1:if(!t){r.destination=Wn;break}if(typeof t=="object"){t instanceof e?(r.syncErrorThrowable=t.syncErrorThrowable,r.destination=t,t.add(r)):(r.syncErrorThrowable=!0,r.destination=new Zi(r,t));break}default:r.syncErrorThrowable=!0,r.destination=new Zi(r,t,n,i);break}return r}return e.prototype[Fs]=function(){return this},e.create=function(t,n,i){var r=new e(t,n,i);return r.syncErrorThrowable=!1,r},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,s.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},e})(j_),Zi=(function(s){ia(e,s);function e(t,n,i,r){var o=s.call(this)||this;o._parentSubscriber=t;var a,l=o;return ks(n)?a=n:n&&(a=n.next,i=n.error,r=n.complete,n!==Wn&&(l=Object.create(n),ks(l.unsubscribe)&&o.add(l.unsubscribe.bind(l)),l.unsubscribe=o.unsubscribe.bind(o))),o._context=l,o._next=a,o._error=i,o._complete=r,o}return e.prototype.next=function(t){if(!this.isStopped&&this._next){var n=this._parentSubscriber;!ze.useDeprecatedSynchronousErrorHandling||!n.syncErrorThrowable?this.__tryOrUnsub(this._next,t):this.__tryOrSetError(n,this._next,t)&&this.unsubscribe()}},e.prototype.error=function(t){if(!this.isStopped){var n=this._parentSubscriber,i=ze.useDeprecatedSynchronousErrorHandling;if(this._error)!i||!n.syncErrorThrowable?(this.__tryOrUnsub(this._error,t),this.unsubscribe()):(this.__tryOrSetError(n,this._error,t),this.unsubscribe());else if(n.syncErrorThrowable)i?(n.syncErrorValue=t,n.syncErrorThrown=!0):qt(t),this.unsubscribe();else{if(this.unsubscribe(),i)throw t;qt(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var n=this._parentSubscriber;if(this._complete){var i=function(){return t._complete.call(t._context)};!ze.useDeprecatedSynchronousErrorHandling||!n.syncErrorThrowable?(this.__tryOrUnsub(i),this.unsubscribe()):(this.__tryOrSetError(n,i),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,n){try{t.call(this._context,n)}catch(i){if(this.unsubscribe(),ze.useDeprecatedSynchronousErrorHandling)throw i;qt(i)}},e.prototype.__tryOrSetError=function(t,n,i){if(!ze.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{n.call(this._context,i)}catch(r){return ze.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=r,t.syncErrorThrown=!0,!0):(qt(r),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e})(tn);function B_(s){for(;s;){var e=s,t=e.closed,n=e.destination,i=e.isStopped;if(t||i)return!1;n&&n instanceof tn?s=n:s=null}return!0}function W_(s,e,t){if(s){if(s instanceof tn)return s;if(s[Fs])return s[Fs]()}return!s&&!e&&!t?new tn(Wn):new tn(s,e,t)}var H_=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function V_(s){return s}function z_(s){return s.length===0?V_:s.length===1?s[0]:function(t){return s.reduce(function(n,i){return i(n)},t)}}var U_=(function(){function s(e){this._isScalar=!1,e&&(this._subscribe=e)}return s.prototype.lift=function(e){var t=new s;return t.source=this,t.operator=e,t},s.prototype.subscribe=function(e,t,n){var i=this.operator,r=W_(e,t,n);if(i?r.add(i.call(r,this.source)):r.add(this.source||ze.useDeprecatedSynchronousErrorHandling&&!r.syncErrorThrowable?this._subscribe(r):this._trySubscribe(r)),ze.useDeprecatedSynchronousErrorHandling&&r.syncErrorThrowable&&(r.syncErrorThrowable=!1,r.syncErrorThrown))throw r.syncErrorValue;return r},s.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){ze.useDeprecatedSynchronousErrorHandling&&(e.syncErrorThrown=!0,e.syncErrorValue=t),B_(e)?e.error(t):console.warn(t)}},s.prototype.forEach=function(e,t){var n=this;return t=Qi(t),new t(function(i,r){var o;o=n.subscribe(function(a){try{e(a)}catch(l){r(l),o&&o.unsubscribe()}},r,i)})},s.prototype._subscribe=function(e){var t=this.source;return t&&t.subscribe(e)},s.prototype[H_]=function(){return this},s.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length===0?this:z_(e)(this)},s.prototype.toPromise=function(e){var t=this;return e=Qi(e),new e(function(n,i){var r;t.subscribe(function(o){return r=o},function(o){return i(o)},function(){return n(r)})})},s.create=function(e){return new s(e)},s})();function Qi(s){if(s||(s=Promise),!s)throw new Error("no Promise impl found");return s}function $_(s){return new U_(e=>{function t(n,i){e.next(i)}return s.connect(t),()=>{s.disconnect(t)}})}class Xn extends X{static create(e){return new class extends Xn{render(){return e}}}onUpdateRequest(e){this.renderPromise=this.renderDOM()}onAfterAttach(e){Ie.sendMessage(this,X.Msg.UpdateRequest)}onBeforeDetach(e){}renderDOM(){return new Promise(e=>{})}renderPromise}class K_ extends Xn{constructor(e){super(),this.model=e??null}get modelChanged(){return this._modelChanged}set model(e){this._model!==e&&(this._model&&this._model.stateChanged.disconnect(this.update,this),this._model=e,e&&e.stateChanged.connect(this.update,this),this.update(),this._modelChanged.emit(void 0))}get model(){return this._model}dispose(){this.isDisposed||(this._model=null,super.dispose())}_model;_modelChanged=new U(this)}class q_ extends T.Component{constructor(e){super(e),this.state={value:[this.props.initialSender,this.props.initialArgs]}}componentDidMount(){this.props.signal.connect(this.slot)}componentWillUnmount(){this.props.signal.disconnect(this.slot)}slot=(e,t)=>{this.props.shouldUpdate&&!this.props.shouldUpdate(e,t)||this.setState({value:[e,t]})};render(){return this.props.children(...this.state.value)}}class G_{stateChanged=new U(this);get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,U.clearData(this))}_isDisposed=!1}const J_=()=>{const{defaultKernel:s}=Je({startDefaultKernel:!0});return f.jsx(f.Fragment,{children:s&&f.jsx(no,{source:"print('Hello 🪐 ⚛️ Jupyter React')",kernel:s})})},Y_=s=>{const e=s.variant==="danger"?{backgroundColor:"var(--jp-error-color1)",color:"btn.primary.text",borderWidth:0}:s.variant==="primary"?{borderWidth:0}:s.variant==="invisible"?{}:{backgroundColor:"var(--jp-reject-color-normal)",color:"btn.primary.text",borderWidth:0,":active:not([disabled]):not([data-inactive])":{backgroundColor:"var(--jp-reject-color-active)",color:"btn.primary.text"},":hover:not([disabled]):not([data-inactive])":{backgroundColor:"var(--jp-reject-color-hover)",color:"btn.primary.text"}};return f.jsx(si,{sx:e,...s})};class X_{commandsPanel;constructor(){this.commandsPanel=new we,this.commandsPanel.id="datalayer-jupyter-commands",this.commandsPanel.spacing=0;const e=new oi,t=new jl({commands:e});we.setStretch(t,0),this.commandsPanel.addWidget(t),window.addEventListener("resize",()=>{this.commandsPanel.update()});const n=".jp-ConsolePanel",i="Console",r="console:execute";e.addCommand(r,{label:"Execute Cell",execute:()=>{window.alert("Execute Cell")}}),t.addItem({command:r,category:i}),e.addKeyBinding({command:r,selector:n,keys:["Shift Enter"]})}get panel(){return this.commandsPanel}}const Z_=()=>{const s=new X_;return f.jsx(Vt,{children:s.panel})};async function Q_({cell:s,onCellExecuted:e,sessionContext:t}){const n=r=>{if(r&&r.content.status==="ok"){const o=r.content;if(o.payload&&o.payload.length){const a=o.payload.filter(l=>l.source==="set_next_input")[0];if(a){const l=a.text;s.model.sharedModel.setSource(l)}}return e({cell:s,executionDate:new Date,success:!0}),!0}else if(r&&r.content.status==="error"){const o=r.content.ename,a=r.content.evalue;return e({cell:s,executionDate:new Date,success:!1,error:new Error(`KernelReplyNotOK: ${o} ${a}`)}),!1}return e({cell:s,executionDate:new Date,success:!1}),!1},i=r=>(e({cell:s,executionDate:new Date,success:!1,error:new Error(r)}),!1);return ai.execute(s,t).then(n,i)}class eg{constructor(e){this._cursor=0,this._hasSession=!1,this._history=[],this._placeholder="",this._setByHistory=!1,this._isDisposed=!1,this._editor=null,this._filtered=[];const{sessionContext:t}=e;t&&(this.sessionContext=t,this._handleKernel(),this.sessionContext.kernelChanged.connect(this._handleKernel,this))}get editor(){return this._editor}set editor(e){if(this._editor===e)return;const t=this._editor;t&&(t.edgeRequested.disconnect(this.onEdgeRequest,this),t.model.sharedModel.changed.disconnect(this.onTextChange,this)),this._editor=e,e&&(e.edgeRequested.connect(this.onEdgeRequest,this),e.model.sharedModel.changed.connect(this.onTextChange,this))}get placeholder(){return this._placeholder}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed=!0,this._history.length=0,U.clearData(this)}back(e){this._hasSession||(this._hasSession=!0,this._placeholder=e,this.setFilter(e),this._cursor=this._filtered.length-1),--this._cursor,this._cursor=Math.max(0,this._cursor);const t=this._filtered[this._cursor];return Promise.resolve(t)}forward(e){this._hasSession||(this._hasSession=!0,this._placeholder=e,this.setFilter(e),this._cursor=this._filtered.length),++this._cursor,this._cursor=Math.min(this._filtered.length-1,this._cursor);const t=this._filtered[this._cursor];return Promise.resolve(t)}push(e){e&&e!==this._history[this._history.length-1]&&this._history.push(e),this.reset()}reset(){this._cursor=this._history.length,this._hasSession=!1,this._placeholder=""}onHistory(e){this._history.length=0;let t="",n="";if(e.content.status==="ok")for(let i=0;i<e.content.history.length;i++)n=e.content.history[i][2],n!==t&&this._history.push(t=n);this._cursor=this._history.length}onTextChange(){if(this._setByHistory){this._setByHistory=!1;return}this.reset()}onEdgeRequest(e,t){const n=e.model.sharedModel,i=n.getSource();t==="top"||t==="topLine"?this.back(i).then(r=>{if(this.isDisposed||!r||n.getSource()===r)return;this._setByHistory=!0,n.setSource(r);let o=0;o=r.indexOf(`
412
+ `),o<0&&(o=r.length),e.setCursorPosition({line:0,column:o})}):this.forward(i).then(r=>{if(this.isDisposed)return;const o=r||this.placeholder;if(n.getSource()===o)return;this._setByHistory=!0,n.setSource(o);const a=e.getPositionAt(o.length);a&&e.setCursorPosition(a)})}async _handleKernel(){var e,t;const n=(t=(e=this.sessionContext)===null||e===void 0?void 0:e.session)===null||t===void 0?void 0:t.kernel;if(!n){this._history.length=0;return}return n.requestHistory(Ms.initialRequest).then(i=>{this.onHistory(i)})}setFilter(e=""){this._filtered.length=0;let t="",n="";for(let i=0;i<this._history.length;i++)n=this._history[i],n!==t&&e===n.slice(0,e.length)&&this._filtered.push(t=n);this._filtered.push(e)}}var Ms;(function(s){s.initialRequest={output:!1,raw:!0,hist_access_type:"tail",n:500}})(Ms||(Ms={}));const tg="jpKernelUser",ng="jpCodeRunner",sg="jp-CodeConsole",er="jp-Console-cell",ig="jp-CodeConsole-banner",tr="jp-CodeConsole-promptCell",rg="jp-CodeConsole-content",og="jp-CodeConsole-input",ag="jp-mod-readWrite",lg=250,cg="application/vnd.jupyter.cells",dg="jpUndoer";class Tt extends X{constructor(e){var t,n,i;super(),this.editorConfig=Tt.defaultEditorConfig,this._banner=null,this._executed=new U(this),this._config={},this._mimetype="text/x-ipython",this._msgIds=new Map,this._msgIdCells=new Map,this._promptCellCreated=new U(this),this._dragData=null,this._drag=null,this._focusedCell=null,this._promptResizeObserver=null,this._hasManualResize=!1,this._resizeAnimationFrameId=null,this._translator=(t=e.translator)!==null&&t!==void 0?t:se,this._executor=(n=e.executor)!==null&&n!==void 0?n:Object.freeze({runCell:Q_}),this.addClass(sg),this.node.dataset[tg]="true",this.node.dataset[ng]="true",this.node.dataset[dg]="true",this.node.tabIndex=-1;const r=this.layout=new Nr;this._cells=new Bl,this._content=new pt,this._input=new pt,this._splitPanel=new Pe({spacing:0}),this._splitPanel.addClass("jp-CodeConsole-split"),this.contentFactory=e.contentFactory,this.modelFactory=(i=e.modelFactory)!==null&&i!==void 0?i:Tt.defaultModelFactory,this.rendermime=e.rendermime,this.sessionContext=e.sessionContext,this._mimeTypeService=e.mimeTypeService,this._content.addClass(rg),this._content.node.tabIndex=0,this._input.addClass(og),this._input.node.tabIndex=0,r.addWidget(this._splitPanel),this._splitPanel.handleMoved.connect(()=>{this._setManualResize()},this),this._splitPanel.node.addEventListener("pointerdown",o=>{o.target.classList.contains("lm-SplitPanel-handle")&&this._setManualResize()},!0),this.setConfig({clearCellsOnExecute:!1,clearCodeContentOnExecute:!0,hideCodeInput:!1,promptCellPosition:"bottom",showBanner:!0}),this._history=new eg({sessionContext:this.sessionContext}),this._onKernelChanged(),this.sessionContext.kernelChanged.connect(this._onKernelChanged,this),this.sessionContext.statusChanged.connect(this._onKernelStatusChanged,this)}get executed(){return this._executed}get promptCellCreated(){return this._promptCellCreated}get cells(){return this._cells}get promptCell(){const e=this._input.layout;return e&&e.widgets[0]||null}addCell(e,t){var n;this._config.clearCellsOnExecute&&this.clear(),e.addClass(er),(n=e.editor)===null||n===void 0||n.setOption("tabFocusable",!1),this._content.addWidget(e),this._cells.push(e),t&&(this._msgIds.set(t,e),this._msgIdCells.set(e,t)),e.disposed.connect(this._onCellDisposed,this),this.update()}addBanner(){if(this._banner){const n=this._banner;this._cells.push(this._banner),n.disposed.connect(this._onCellDisposed,this)}const e=this.modelFactory.createRawCell({sharedModel:Wl({cell_type:"raw",source:"..."})}),t=(this._banner=new $r({model:e,contentFactory:this.contentFactory,placeholder:!1,editorConfig:{autoClosingBrackets:!1,codeFolding:!1,highlightActiveLine:!1,highlightTrailingWhitespace:!1,highlightWhitespace:!1,indentUnit:"4",lineNumbers:!1,lineWrap:!0,matchBrackets:!1,readOnly:!0,rulers:[],scrollPastEnd:!1,smartIndent:!1,tabSize:4,theme:"jupyter",tabFocusable:!1}})).initializeState();t.addClass(ig),t.readOnly=!0,this._content.addWidget(t)}clear(){const e=this._cells;for(;e.length>0;)e.get(0).dispose()}createCodeCell(){const e=this.contentFactory,t=this._createCodeCellOptions(),n=e.createCodeCell(t);return n.readOnly=!0,n.model.mimeType=this._mimetype,n}dispose(){if(this.isDisposed)return;const e=this.promptCell;e&&(this._promptResizeObserver&&(this._promptResizeObserver.disconnect(),this._promptResizeObserver=null),e.model.sharedModel.changed.disconnect(this._onPromptContentChanged,this)),this._cancelPendingResizeAdjustment(),this._msgIdCells=null,this._msgIds=null,this._history.dispose(),super.dispose()}async execute(e=!1,t=lg){var n,i;if(((i=(n=this.sessionContext.session)===null||n===void 0?void 0:n.kernel)===null||i===void 0?void 0:i.status)==="dead")return;const r=this.promptCell;if(!r)throw new Error("Cannot execute without a prompt cell");if(r.model.trusted=!0,e){this.newPromptCell(),await this._execute(r);return}const o=await this._shouldExecute(t);this.isDisposed||(o?(this.newPromptCell(),this.promptCell.editor.focus(),await this._execute(r)):r.editor.newIndentedLine())}getCell(e){return this._msgIds.get(e)}inject(e,t={}){var n;const i=this.createCodeCell();i.model.sharedModel.setSource(e);for(const r of Object.keys(t))i.model.setMetadata(r,t[r]);return this.addCell(i),this._config.hideCodeInput&&((n=i.inputArea)===null||n===void 0||n.setHidden(!0)),this._execute(i)}insertLinebreak(){const e=this.promptCell;e&&e.editor.newIndentedLine()}replaceSelection(e){var t,n;const i=this.promptCell;i&&((n=(t=i.editor).replaceSelection)===null||n===void 0||n.call(t,e))}setConfig(e){const{clearCellsOnExecute:t,clearCodeContentOnExecute:n,hideCodeInput:i,promptCellPosition:r,showBanner:o}=e;this._config={clearCellsOnExecute:t??this._config.clearCellsOnExecute,clearCodeContentOnExecute:n??this._config.clearCodeContentOnExecute,hideCodeInput:i??this._config.hideCodeInput,promptCellPosition:r??this._config.promptCellPosition,showBanner:o??this._config.showBanner},this._updateLayout()}serialize(){const e=[];for(const t of this._cells){const n=t.model;Hl(n)&&e.push(n.toJSON())}return this.promptCell&&e.push(this.promptCell.model.toJSON()),e}_evtMouseDown(e){const{button:t,shiftKey:n}=e;if(!(t===0||t===2)||n&&t===2)return;let i=e.target;const r=c=>c.classList.contains(er);let o=vt.findCell(i,this._cells,r);if(o===-1&&(i=document.elementFromPoint(e.clientX,e.clientY),o=vt.findCell(i,this._cells,r)),o===-1)return;const a=this._cells.get(o);vt.detectTargetArea(a,e.target)==="prompt"&&(this._dragData={pressX:e.clientX,pressY:e.clientY,index:o},this._focusedCell=a,document.addEventListener("mouseup",this,!0),document.addEventListener("mousemove",this,!0),e.preventDefault())}_evtMouseMove(e){const t=this._dragData;t&&vt.shouldStartDrag(t.pressX,t.pressY,e.clientX,e.clientY)&&this._startDrag(t.index,e.clientX,e.clientY)}_startDrag(e,t,n){const i=this._focusedCell.model,r=[i.toJSON()],o=vt.createCellDragImage(this._focusedCell,r);this._drag=new Ts({mimeData:new Kr,dragImage:o,proposedAction:"copy",supportedActions:"copy",source:this}),this._drag.mimeData.setData(cg,r);const a=i.sharedModel.getSource();return this._drag.mimeData.setData("text/plain",a),this._focusedCell=null,document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0),this._drag.start(t,n).then(()=>{this.isDisposed||(this._drag=null,this._dragData=null)})}handleEvent(e){switch(e.type){case"keydown":this._evtKeyDown(e);break;case"mousedown":this._evtMouseDown(e);break;case"mousemove":this._evtMouseMove(e);break;case"mouseup":this._evtMouseUp(e);break;case"resize":this._splitPanel.fit();break;case"focusin":this._evtFocusIn(e);break;case"focusout":this._evtFocusOut(e);break}}onAfterAttach(e){const t=this.node;t.addEventListener("keydown",this,!0),t.addEventListener("click",this),t.addEventListener("mousedown",this),t.addEventListener("focusin",this),t.addEventListener("focusout",this),this.promptCell?(this.promptCell.editor.focus(),this.update()):this.newPromptCell()}onBeforeDetach(e){const t=this.node;t.removeEventListener("keydown",this,!0),t.removeEventListener("click",this),t.removeEventListener("focusin",this),t.removeEventListener("focusout",this)}onActivateRequest(e){const t=this.promptCell&&this.promptCell.editor;t&&t.focus(),this.update()}newPromptCell(){var e,t,n,i,r,o;let a=this.promptCell;const l=this._input,c=(e=a?.model.sharedModel.getSource())!==null&&e!==void 0?e:"",d=(t=a?.editor)===null||t===void 0?void 0:t.getCursorPosition();if(a){a.readOnly=!0,a.removeClass(tr),(n=a.editor)===null||n===void 0||n.setOption("tabFocusable",!1),a.model.sharedModel.changed.disconnect(this._onPromptContentChanged,this);const m=a,_=this._promptResizeObserver;requestIdleCallback(()=>{U.clearData(m.editor),_&&_.disconnect()}),(i=a.editor)===null||i===void 0||i.blur();const b=l.widgets[0];b.parent=null,this._config.hideCodeInput&&((r=a.inputArea)===null||r===void 0||r.setHidden(!0)),this.addCell(a)}const u=this.contentFactory,h=this._createCodeCellOptions();a=u.createCodeCell(h),a.model.mimeType=this._mimetype,a.addClass(tr),this._input.addWidget(a),this._history.editor=a.editor,a.node&&(this._promptResizeObserver=new ResizeObserver(()=>{this._scheduleInputSizeAdjustment()}),this._promptResizeObserver.observe(a.node)),a.model.sharedModel.changed.connect(this._onPromptContentChanged,this),this._config.clearCodeContentOnExecute||(a.model.sharedModel.setSource(c),d&&((o=a.editor)===null||o===void 0||o.setCursorPosition(d))),this._promptCellCreated.emit(a)}onUpdateRequest(e){Ds.scrollToBottom(this._content.node)}_evtKeyDown(e){const t=this.promptCell&&this.promptCell.editor;t&&(e.key==="Enter"&&!t.hasFocus()?(e.preventDefault(),t.focus()):e.key==="Escape"&&t.hasFocus()&&(e.preventDefault(),e.stopPropagation(),t.setOption("tabFocusable",!1),this._input.node.focus()))}_evtMouseUp(e){this.promptCell&&this.promptCell.node.contains(e.target)&&this.promptCell.editor.focus()}_evtFocusIn(e){this._updateReadWrite()}_evtFocusOut(e){this._updateReadWrite()}async _execute(e){const t=e.model.sharedModel.getSource();if(this._history.push(t),t==="clear"||t==="%clear")return this.clear(),Promise.resolve(void 0);e.model.contentChanged.connect(this.update,this);const n={cell:e,sessionContext:this.sessionContext,onCellExecuted:i=>{if(this._executed.emit(i.executionDate),i.error)for(const r of this._cells)r.model.executionCount===null&&(r.model.executionState="idle")}};try{await this._executor.runCell(n)}finally{this.isDisposed||(e.model.contentChanged.disconnect(this.update,this),this.update())}}_handleInfo(e){if(e.status!=="ok"){this._banner&&this._banner.model.sharedModel.setSource("Error in getting kernel banner");return}this._banner&&this._banner.model.sharedModel.setSource(e.banner);const t=e.language_info;this._mimetype=this._mimeTypeService.getMimeTypeByLanguage(t),this.promptCell&&(this.promptCell.model.mimeType=this._mimetype)}_createCodeCellOptions(){const e=this.contentFactory,n=this.modelFactory.createCodeCell({}),i=this.rendermime,r=this.editorConfig;return{model:n,rendermime:i,contentFactory:e,editorConfig:r,placeholder:!1,translator:this._translator}}_onCellDisposed(e,t){if(!this.isDisposed){this._cells.removeValue(e);const n=this._msgIdCells.get(e);n&&(this._msgIdCells.delete(e),this._msgIds.delete(n))}}_shouldExecute(e){const t=this.promptCell;if(!t)return Promise.resolve(!1);const i=t.model.sharedModel.getSource();return new Promise((r,o)=>{var a;const l=setTimeout(()=>{r(!0)},e),c=(a=this.sessionContext.session)===null||a===void 0?void 0:a.kernel;if(!c){r(!1);return}c.requestIsComplete({code:i}).then(d=>{if(clearTimeout(l),this.isDisposed&&r(!1),d.content.status!=="incomplete"){r(!0);return}r(!1)}).catch(()=>{r(!0)})})}async _onKernelChanged(){var e;this.clear(),this._banner&&(this._banner.dispose(),this._banner=null),this._config.showBanner&&this.addBanner(),!((e=this.sessionContext.session)===null||e===void 0)&&e.kernel&&this._handleInfo(await this.sessionContext.session.kernel.info)}async _onKernelStatusChanged(){var e;const t=(e=this.sessionContext.session)===null||e===void 0?void 0:e.kernel;t?.status==="restarting"&&(this._config.showBanner&&this.addBanner(),this._handleInfo(await t?.info))}_updateReadWrite(){const e=q.hasActiveEditableElement(this.node);this.node.classList.toggle(ag,e)}_calculateRelativeSizes(){const{promptCellPosition:e="bottom"}=this._config;let t=[1,1];return e==="top"?t=[1,100]:e==="bottom"&&(t=[100,1]),t}_setManualResize(){this._hasManualResize=!0,this._cancelPendingResizeAdjustment()}_cancelPendingResizeAdjustment(){this._resizeAnimationFrameId!==null&&(cancelAnimationFrame(this._resizeAnimationFrameId),this._resizeAnimationFrameId=null)}_scheduleInputSizeAdjustment(){this._hasManualResize||this._resizeAnimationFrameId===null&&(this._resizeAnimationFrameId=requestAnimationFrame(()=>{this._resizeAnimationFrameId=null,this._adjustSplitPanelForInputGrowth()}))}_onPromptContentChanged(){this._scheduleInputSizeAdjustment()}_adjustSplitPanelForInputGrowth(){if(this.isDisposed||!this._input.node||!this._content.node||this._hasManualResize)return;const{promptCellPosition:e="bottom"}=this._config;if(e==="left"||e==="right")return;const t=this.promptCell;if(!t||!t.editor)return;const i=t.editor.editor.contentHeight,r=this._getInputCellPadding(),o=i+r,a=this._splitPanel.node.clientHeight;if(a<=0||o<=0){this._splitPanel.fit();return}const l=a-o;let c,d;e==="bottom"?(c=l/a,d=o/a):(d=o/a,c=l/a);const u=c+d;if(u>0){const h=e==="bottom"?[c/u,d/u]:[d/u,c/u];this._splitPanel.setRelativeSizes(h)}}_getInputCellPadding(){var e;const t=this._input.node,n=window.getComputedStyle(t),i=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom),r=this.promptCell;if(!r)return i;const o=window.getComputedStyle(r.node),a=parseFloat(o.paddingTop)+parseFloat(o.paddingBottom),l=(e=r.editorWidget)===null||e===void 0?void 0:e.node;let c=0;if(l){const d=window.getComputedStyle(l);c=parseFloat(d.borderTopWidth)+parseFloat(d.borderBottomWidth)}return i+a+c}_updateLayout(){var e,t;this._input.parent=null,this._content.parent=null;const{promptCellPosition:n="bottom"}=this._config;this._hasManualResize=!1,this._splitPanel.orientation=["left","right"].includes(n)?"horizontal":"vertical",Pe.setStretch(this._content,1),Pe.setStretch(this._input,1),n==="bottom"||n==="right"?(this._splitPanel.insertWidget(0,this._content),this._splitPanel.insertWidget(1,this._input)):(this._splitPanel.insertWidget(0,this._input),this._splitPanel.insertWidget(1,this._content)),this._splitPanel.setRelativeSizes(this._calculateRelativeSizes()),requestAnimationFrame(()=>{this._adjustSplitPanelForInputGrowth()}),(t=(e=this.promptCell)===null||e===void 0?void 0:e.editor)===null||t===void 0||t.focus()}}(function(s){s.defaultEditorConfig={codeFolding:!1,lineNumbers:!1,tabFocusable:!1};class e extends Vl.ContentFactory{createCodeCell(i){return new ai(i).initializeState()}createRawCell(i){return new $r(i).initializeState()}}s.ContentFactory=e;class t{constructor(i={}){this.codeCellContentFactory=i.codeCellContentFactory||ki.defaultContentFactory}createCodeCell(i={}){return i.contentFactory||(i.contentFactory=this.codeCellContentFactory),new ki(i)}createRawCell(i){return new zl(i)}}s.ModelFactory=t,s.defaultModelFactory=new t({})})(Tt||(Tt={}));var Ds;(function(s){function e(t){t.scrollTop=t.scrollHeight-t.clientHeight}s.scrollToBottom=e})(Ds||(Ds={}));const ug="jp-ConsolePanel";class Hn extends Ul{constructor(e){var t;super({content:new pt}),this._executed=null,this._connected=null,this._preventTitleUpdate=!1,this.addClass(ug);let{executor:n,rendermime:i,mimeTypeService:r,path:o,basePath:a,name:l,manager:c,modelFactory:d,sessionContext:u,translator:h}=e;this.translator=h??se;const m=this.translator.load("jupyterlab"),_=this.contentFactory=e.contentFactory,b=Vn.count++;o||(o=O.PathExt.join(a||"",`console-${b}-${qr.uuid4()}`)),u=this._sessionContext=u??new $l({kernelManager:c.kernels,sessionManager:c.sessions,specsManager:c.kernelspecs,path:c.contents.localPath(o),name:l||m.__("Console %1",b),type:"console",kernelPreference:e.kernelPreference,setBusy:e.setBusy});const g=new ao.UrlResolver({path:o,contents:c.contents,getKernelId:()=>{var p,w;return(w=(p=u?.session)===null||p===void 0?void 0:p.kernel)===null||w===void 0?void 0:w.id}});i=i.clone({resolver:g}),this.console=_.createConsole({executor:n,rendermime:i,sessionContext:u,mimeTypeService:r,contentFactory:_,modelFactory:d,translator:h}),this.content.addWidget(this.console),u.initialize().then(async p=>{var w;p&&await((w=e.sessionDialogs)!==null&&w!==void 0?w:new Gr({translator:h})).selectKernel(u),this._connected=new Date,this._updateTitlePanel()}),this.console.executed.connect(this._onExecuted,this),this._updateTitlePanel(),e.preventTitleUpdate||(u.kernelChanged.connect(this._updateTitlePanel,this),u.propertyChanged.connect(this._updateTitlePanel,this)),this.title.icon=Kl,this.title.closable=!0,this.id=`console-${b}`,this._preventTitleUpdate=(t=e.preventTitleUpdate)!==null&&t!==void 0?t:!1}get sessionContext(){return this._sessionContext}dispose(){this.sessionContext.dispose(),this.console.dispose(),super.dispose()}onActivateRequest(e){const t=this.console.promptCell;t&&t.editor.focus()}onCloseRequest(e){super.onCloseRequest(e),this.dispose()}_onExecuted(e,t){this._executed=t,this._updateTitlePanel()}_updateTitlePanel(){this._preventTitleUpdate||Vn.updateTitle(this,this._connected,this._executed,this.translator)}}(function(s){class e extends Tt.ContentFactory{createConsole(n){return new Tt(n)}}s.ContentFactory=e,s.IContentFactory=new Ae("@jupyterlab/console:IContentFactory","A factory object that creates new code consoles. Use this if you want to create and host code consoles in your own UI elements.")})(Hn||(Hn={}));var Vn;(function(s){s.count=1;function e(t,n,i,r){r=r||se;const o=r.load("jupyterlab"),a=t.console.sessionContext.session;if(a){let l=o.__(`Name: %1
413
413
  `,a.name)+o.__(`Directory: %1
414
414
  `,O.PathExt.dirname(a.path))+o.__("Kernel: %1",t.console.sessionContext.kernelDisplayName);n&&(l+=o.__(`
415
415
  Connected: %1`,O.Time.format(n.toISOString()))),i&&(l+=o.__(`
416
416
  Last Execution: %1`,O.Time.format(i.toISOString()))),t.title.label=a.name,t.title.caption=l}else t.title.label=o.__("Console"),t.title.caption=""}s.updateTitle=e})(Vn||(Vn={}));const hg="console-path";class ra{_panel;_code;constructor(e){const{kernel:t,serviceManager:n,code:i}=e;this._code=i,this._panel=new we,this._panel.direction="top-to-bottom",this._panel.spacing=0,this._panel.addClass("dla-JupyterLab-Console"),Promise.all([n.ready,t?.ready]).then(()=>{this.setupConsole(n,t)})}setupConsole(e,t){const n=new oi;this._panel.node.addEventListener("keydown",b=>{n.processKeydownEvent(b)});const i=new Fi;for(const b of Fi.getDefaultThemes())i.addTheme(b);const r=()=>{const b=new es;for(const g of es.getDefaultExtensions({themes:i}))b.addExtension(g);return b.addExtension({name:"shared-model-binding",factory:g=>{const p=g.model.sharedModel;return es.createImmutableExtension(Gl({ytext:p.ysource,undoManager:p.undoManager??void 0}))}}),b},o=new Fn;for(const b of Fn.getDefaultLanguages())o.addLanguage(b);o.addLanguage({name:"ipythongfm",mime:"text/x-ipythongfm",load:async()=>(await V(()=>import("./dist-DFPs7B3v.js"),[],import.meta.url)).markdown({codeLanguages:g=>o.findBest(g)})});const a=new lo({extensions:r(),languages:o}),l=new ao({initialFactories:ql}),c=new co(o),d=a.newInlineEditor,u=new Hn.ContentFactory({editorFactory:d}),h=new Hn({name:t?.session.name,manager:e,rendermime:l,path:t?.session.path??hg,contentFactory:u,mimeTypeService:c,kernelPreference:{shouldStart:!0,name:t?.connection?.name??"python",id:t?.id,language:t?.info?.language_info.name}});h.title.label="Console",we.setStretch(h,1),this._panel.addWidget(h),window.addEventListener("resize",()=>{this._panel.update()});const m=".jp-ConsolePanel";let _;_="console:clear",n.addCommand(_,{label:"Clear",execute:()=>{h.console.clear()}}),_="console:execute",n.addCommand(_,{label:"Execute Prompt",execute:()=>h.console.execute()}),n.addKeyBinding({command:_,selector:m,keys:["Enter"]}),_="console:execute-forced",n.addCommand(_,{label:"Execute Cell (forced)",execute:()=>h.console.execute(!0)}),n.addKeyBinding({command:_,selector:m,keys:["Shift Enter"]}),_="console:linebreak",n.addCommand(_,{label:"Insert Line Break",execute:()=>{h.console.insertLinebreak()}}),n.addKeyBinding({command:_,selector:m,keys:["Ctrl Enter"]}),this._code&&h.console.sessionContext.ready.then(()=>{h.console.inject(this._code??"")})}get panel(){return this._panel}}const fg=s=>{const{defaultKernel:e,serviceManager:t}=Je(),[n,i]=R.useState(),r=Jr();return R.useEffect(()=>{if(t){const o=new ra({kernel:e,serviceManager:t,code:s.code});i(o),r.setAdapter(o)}},[e,t]),n?f.jsx(Vt,{children:n.panel}):f.jsx(f.Fragment,{children:"Loading Jupyter Console..."})};class oa{dialog;constructor(){this.dialog=new _e({title:"Dialog Title",body:"This is the body of the dialog...",buttons:[_e.cancelButton(),_e.okButton()]})}}const mg=()=>{const[s,e]=R.useState(new oa);return R.useEffect(()=>{s.dialog.launch().then(t=>t)},[]),f.jsx(sa,{children:s.dialog})},pg="jp-FileDialog",_g="jp-new-name-title";class aa{constructor(e={}){this._translator=e.translator||se}async rename(e){const t=this._translator.load("jupyterlab"),i=e.localPath.split("/").pop()||e.localPath,r=new gg(i,this._translator),o=await ft({title:t.__("Rename File"),body:r,buttons:[_e.cancelButton(),_e.okButton({label:t.__("Rename"),ariaLabel:t.__("Rename File")})],focusNodeSelector:"input"});if(!o.button.accept)return null;const a=o.value;return!a||a===i?null:ca(a)?e.rename(a):(ve(t.__("Rename Error"),Error(t.__('"%1" is not a valid name for a file. Names must have nonzero length, and cannot include "/", "\\", or ":"',o.value))),null)}async confirmClose(e){const t=this._translator.load("jupyterlab"),{fileName:n,isDirty:i}=e,r=[_e.cancelButton(),_e.okButton({label:i?t.__("Close and save"):t.__("Close"),ariaLabel:i?t.__("Close and save Document"):t.__("Close Document")})];i&&r.splice(1,0,_e.warnButton({label:t.__("Close without saving"),ariaLabel:t.__("Close Document without saving")}));const o=await ft({title:t.__("Confirmation"),body:t.__('Please confirm you want to close "%1".',n),checkbox:i?null:{label:t.__("Do not ask me again."),caption:t.__("If checked, no confirmation to close a document will be asked in the future.")},buttons:r}),a=o.button.accept,l=i?o.button.displayType==="warn":!0,c=o.isChecked===!0;return{shouldClose:a,ignoreSave:l,doNotAskAgain:c}}async saveBeforeClose(e){const t=this._translator.load("jupyterlab"),{fileName:n,writable:i}=e,r=i?t.__("Save"):t.__("Save as"),o=await ft({title:t.__("Save your work"),body:t.__('Save changes in "%1" before closing?',n),buttons:[_e.cancelButton(),_e.warnButton({label:t.__("Discard"),ariaLabel:t.__("Discard changes to file")}),_e.okButton({label:r})]}),a=o.button.accept,l=o.button.displayType==="warn";return{shouldClose:a,ignoreSave:l}}}function In(s,e,t){return s.rename(e,t).catch(async n=>{var i;if(((i=n?.response)===null||i===void 0?void 0:i.status)!==409)throw n;const r=await s.services.contents.get(t,{content:!1}).catch(()=>null);if(r?.type==="directory")throw n;return la(t).then(o=>o?s.overwrite(e,t):Promise.reject("File not renamed"))})}function la(s,e){e=e||se;const t=e.load("jupyterlab"),n={title:t.__("Overwrite file?"),body:t.__('"%1" already exists, overwrite?',s),buttons:[_e.cancelButton(),_e.warnButton({label:t.__("Overwrite"),ariaLabel:t.__("Overwrite Existing File")})]};return ft(n).then(i=>Promise.resolve(i.button.accept))}function ca(s){const e=/[/\\:]/;return s.length>0&&!e.test(s)}class gg extends X{constructor(e,t){super({node:Ns.createRenameNode(e,t)}),this.addClass(pg);const n=O.PathExt.extname(e),i=this.inputNode.value=O.PathExt.basename(e);this.inputNode.setSelectionRange(0,i.length-n.length)}get inputNode(){return this.node.getElementsByTagName("input")[0]}getValue(){return this.inputNode.value}}var Ns;(function(s){function e(t,n){n=n||se;const i=n.load("jupyterlab"),r=document.createElement("div"),o=document.createElement("label");o.textContent=i.__("File Path");const a=document.createElement("span");a.textContent=t;const l=document.createElement("label");l.textContent=i.__("New Name"),l.className=_g;const c=document.createElement("input");return r.appendChild(o),r.appendChild(a),r.appendChild(l),r.appendChild(c),r}s.createRenameNode=e})(Ns||(Ns={}));class yg{constructor(e){this._autosaveTimer=-1,this._minInterval=-1,this._interval=-1,this._isActive=!1,this._inDialog=!1,this._isDisposed=!1,this._multiplier=10,this._context=e.context,this._isConnectedCallback=e.isConnectedCallback||(()=>!0);const t=e.saveInterval||120;this._minInterval=t*1e3,this._interval=this._minInterval,this._context.fileChanged.connect(this._setTimer,this),this._context.disposed.connect(this.dispose,this)}get saveInterval(){return this._interval/1e3}set saveInterval(e){this._minInterval=this._interval=e*1e3,this._isActive&&this._setTimer()}get isActive(){return this._isActive}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,clearTimeout(this._autosaveTimer),U.clearData(this))}start(){this._isActive=!0,this._setTimer()}stop(){this._isActive=!1,clearTimeout(this._autosaveTimer)}_setTimer(){clearTimeout(this._autosaveTimer),this._isActive&&(this._autosaveTimer=window.setTimeout(()=>{this._isConnectedCallback()?this._save():this._setTimer()},this._interval))}_save(){var e;const t=this._context;if(this._setTimer(),!t||!(!((e=t.canSave)!==null&&e!==void 0)||e)||!t.model.dirty||this._inDialog)return;const n=new Date().getTime();t.save().then(()=>{if(this.isDisposed)return;const i=new Date().getTime()-n;this._interval=Math.max(this._multiplier*i,this._minInterval),this._setTimer()}).catch(i=>{const{name:r}=i;r==="ModalCancelError"||r==="ModalDuplicateError"||console.error("Error in Auto-Save",i.message)})}}const bg="jp-Document";class vg{constructor(e){this._activateRequested=new U(this),this._confirmClosingTab=!1,this._isDisposed=!1,this._stateChanged=new U(this),this._registry=e.registry,this.translator=e.translator||se,this._recentsManager=e.recentsManager||null,this._dialogs=e.dialogs||null}get activateRequested(){return this._activateRequested}get confirmClosingDocument(){return this._confirmClosingTab}set confirmClosingDocument(e){if(this._confirmClosingTab!==e){const t=this._confirmClosingTab;this._confirmClosingTab=e,this._stateChanged.emit({name:"confirmClosingDocument",oldValue:t,newValue:e})}}get stateChanged(){return this._stateChanged}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,U.disconnectReceiver(this))}createWidget(e,t){const n=e.createNew(t);return this._initializeWidget(n,e,t),n}_initializeWidget(e,t,n){oe.factoryProperty.set(e,t);const i=new Yr;for(const r of this._registry.widgetExtensions(t.name)){const o=r.createNew(e,n);o&&i.add(o)}oe.disposablesProperty.set(e,i),e.disposed.connect(this._onWidgetDisposed,this),this.adoptWidget(n,e),n.fileChanged.connect(this._onFileChanged,this),n.pathChanged.connect(this._onPathChanged,this),n.ready.then(()=>{this.setCaption(e)})}adoptWidget(e,t){oe.widgetsProperty.get(e).push(t),Ie.installMessageHook(t,this),t.addClass(bg),t.title.closable=!0,t.disposed.connect(this._widgetDisposed,this),oe.contextProperty.set(t,e)}findWidget(e,t){const n=oe.widgetsProperty.get(e);if(n)return je(n,i=>{const r=oe.factoryProperty.get(i);return r?!t||r.name===t:!1})}contextForWidget(e){return oe.contextProperty.get(e)}cloneWidget(e){const t=oe.contextProperty.get(e);if(!t)return;const n=oe.factoryProperty.get(e);if(!n)return;const i=n.createNew(t,e);return this._initializeWidget(i,n,t),i}closeWidgets(e){const t=oe.widgetsProperty.get(e);return Promise.all(t.map(n=>this.onClose(n))).then(()=>{})}deleteWidgets(e){const t=oe.widgetsProperty.get(e);return Promise.all(t.map(n=>this.onDelete(n))).then(()=>{})}messageHook(e,t){switch(t.type){case"close-request":return this.onClose(e),!1;case"activate-request":{const n=e,i=this.contextForWidget(n);i&&(i.ready.then(()=>{this._recordAsRecentlyOpened(n,i.contentsModel)}).catch(()=>{console.warn("Could not record the recents status for",i)}),this._activateRequested.emit(i.path));break}}return!0}async setCaption(e){const t=this.translator.load("jupyterlab"),n=oe.contextProperty.get(e);if(!n)return;const i=n.contentsModel;if(!i){e.title.caption="";return}return n.listCheckpoints().then(r=>{if(e.isDisposed)return;const o=r[r.length-1],a=o?O.Time.format(o.last_modified):"None";let l=t.__(`Name: %1
417
417
  Path: %2
418
418
  `,i.name,i.path);n.model.readOnly?l+=t.__("Read-only"):l+=t.__(`Last Saved: %1
419
- `,O.Time.format(i.last_modified))+t.__("Last Checkpoint: %1",a),e.title.caption=l})}async onClose(e){var t;const[n,i]=await this._maybeClose(e,this.translator);if(e.isDisposed)return!0;if(n){const r=oe.contextProperty.get(e);if(!i){if(!r)return!0;if(!((t=r.contentsModel)===null||t===void 0)&&t.writable)await r.save();else if(!await r.saveAs())return!1}if(r&&(await Promise.race([r.ready,new Promise(a=>setTimeout(a,3e3,"timeout"))])==="timeout"?console.warn("Could not record the widget as recently closed because the context did not become ready in 3 seconds"):this._recordAsRecentlyClosed(e,r.contentsModel)),e.isDisposed)return!0;e.dispose()}return n}onDelete(e){return e.dispose(),Promise.resolve(void 0)}_recordAsRecentlyOpened(e,t){var n;const i=this._recentsManager;if(!i)return;const r=t.path,a=this._registry.getFileTypeForModel(t).contentType,l=(n=oe.factoryProperty.get(e))===null||n===void 0?void 0:n.name;if(i.addRecent({path:r,contentType:a,factory:l},"opened"),a!=="directory"){const c=r.lastIndexOf("/")>0?r.slice(0,r.lastIndexOf("/")):"";i.addRecent({path:c,contentType:"directory"},"opened")}}_recordAsRecentlyClosed(e,t){var n;const i=this._recentsManager;if(!i)return;const r=t.path,a=this._registry.getFileTypeForModel(t).contentType,l=(n=oe.factoryProperty.get(e))===null||n===void 0?void 0:n.name;i.addRecent({path:r,contentType:a,factory:l},"closed")}async _maybeClose(e,t){var n,i,r;t=t||se;const o=oe.contextProperty.get(e);if(!o)return Promise.resolve([!0,!0]);let a=oe.widgetsProperty.get(o);if(!a)return Promise.resolve([!0,!0]);a=a.filter(h=>{const m=oe.factoryProperty.get(h);return m?m.readOnly===!1:!1});const l=e.title.label,c=oe.factoryProperty.get(e),d=o.model.dirty&&a.length<=1&&!(!((n=c?.readOnly)!==null&&n!==void 0)||n),u=(i=this._dialogs)!==null&&i!==void 0?i:new aa({translator:t});if(this.confirmClosingDocument){const{shouldClose:h,ignoreSave:m,doNotAskAgain:_}=await u.confirmClose({fileName:l,isDirty:d});return _&&(this.confirmClosingDocument=!1),Promise.resolve([h,m])}else{if(!d)return Promise.resolve([!0,!0]);const h=await u?.saveBeforeClose({fileName:l,writable:(r=o.contentsModel)===null||r===void 0?void 0:r.writable});return[h.shouldClose,h.ignoreSave]}}_widgetDisposed(e){const t=oe.contextProperty.get(e);if(!t)return;const n=oe.widgetsProperty.get(t);n&&(Y.removeFirstOf(n,e),n.length||t.dispose())}_onWidgetDisposed(e){oe.disposablesProperty.get(e).dispose()}_onFileChanged(e){const t=oe.widgetsProperty.get(e);for(const n of t)this.setCaption(n)}_onPathChanged(e){const t=oe.widgetsProperty.get(e);for(const n of t)this.setCaption(n)}}var oe;(function(s){s.contextProperty=new Ct({name:"context",create:()=>{}}),s.factoryProperty=new Ct({name:"factory",create:()=>{}}),s.widgetsProperty=new Ct({name:"widgets",create:()=>[]}),s.disposablesProperty=new Ct({name:"disposables",create:()=>new Yr})})(oe||(oe={}));class wg{constructor(e){var t,n;this._activateRequested=new U(this),this._contexts=[],this._isDisposed=!1,this._autosave=!0,this._autosaveInterval=120,this._lastModifiedCheckMargin=500,this._renameUntitledFileOnSave=!0,this._stateChanged=new U(this),this.translator=e.translator||se,this.registry=e.registry,this.services=e.manager,this._docManagerDialogs=(t=e.docManagerDialogs)!==null&&t!==void 0?t:new aa({translator:this.translator}),this._dialogs=(n=e.sessionDialogs)!==null&&n!==void 0?n:new Gr({translator:e.translator}),this._isConnectedCallback=e.isConnectedCallback||(()=>!0),this._opener=e.opener,this._when=e.when||e.manager.ready;const i=new vg({registry:this.registry,translator:this.translator,recentsManager:e.recentsManager,dialogs:this._docManagerDialogs});i.activateRequested.connect(this._onActivateRequested,this),i.stateChanged.connect(this._onWidgetStateChanged,this),this._widgetManager=i,this._setBusy=e.setBusy,this._urlResolverFactory=e.urlResolverFactory}get activateRequested(){return this._activateRequested}get autosave(){return this._autosave}set autosave(e){if(this._autosave!==e){const t=this._autosave;this._autosave=e,this._contexts.forEach(n=>{const i=nn.saveHandlerProperty.get(n);i&&(e===!0&&!i.isActive?i.start():e===!1&&i.isActive&&i.stop())}),this._stateChanged.emit({name:"autosave",oldValue:t,newValue:e})}}get autosaveInterval(){return this._autosaveInterval}set autosaveInterval(e){if(this._autosaveInterval!==e){const t=this._autosaveInterval;this._autosaveInterval=e,this._contexts.forEach(n=>{const i=nn.saveHandlerProperty.get(n);i&&(i.saveInterval=e||120)}),this._stateChanged.emit({name:"autosaveInterval",oldValue:t,newValue:e})}}get confirmClosingDocument(){return this._widgetManager.confirmClosingDocument}set confirmClosingDocument(e){if(this._widgetManager.confirmClosingDocument!==e){const t=this._widgetManager.confirmClosingDocument;this._widgetManager.confirmClosingDocument=e,this._stateChanged.emit({name:"confirmClosingDocument",oldValue:t,newValue:e})}}get lastModifiedCheckMargin(){return this._lastModifiedCheckMargin}set lastModifiedCheckMargin(e){if(this._lastModifiedCheckMargin!==e){const t=this._lastModifiedCheckMargin;this._lastModifiedCheckMargin=e,this._contexts.forEach(n=>{n.lastModifiedCheckMargin=e}),this._stateChanged.emit({name:"lastModifiedCheckMargin",oldValue:t,newValue:e})}}get renameUntitledFileOnSave(){return this._renameUntitledFileOnSave}set renameUntitledFileOnSave(e){if(this._renameUntitledFileOnSave!==e){const t=this._renameUntitledFileOnSave;this._renameUntitledFileOnSave=e,this._stateChanged.emit({name:"renameUntitledFileOnSave",oldValue:t,newValue:e})}}get stateChanged(){return this._stateChanged}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,U.clearData(this),this._contexts.forEach(e=>this._widgetManager.closeWidgets(e)),this._widgetManager.dispose(),this._contexts.length=0)}cloneWidget(e){return this._widgetManager.cloneWidget(e)}closeAll(){return Promise.all(this._contexts.map(e=>this._widgetManager.closeWidgets(e))).then(()=>{})}closeFile(e){const t=this._contextsForPath(e).map(n=>this._widgetManager.closeWidgets(n));return Promise.all(t).then(n=>{})}contextForWidget(e){return this._widgetManager.contextForWidget(e)}copy(e,t){return this.services.contents.copy(e,t)}createNew(e,t="default",n){return this._createOrOpenDocument("create",e,t,n)}deleteFile(e){return this.services.sessions.stopIfNeeded(e).then(()=>this.services.contents.delete(e)).then(()=>(this._contextsForPath(e).forEach(t=>this._widgetManager.deleteWidgets(t)),Promise.resolve(void 0)))}duplicate(e){const t=O.PathExt.dirname(e);return this.services.contents.copy(e,t)}findWidget(e,t="default"){const n=O.PathExt.normalize(e);let i=[t];if(t==="default"){const r=this.registry.defaultWidgetFactory(n);if(!r)return;i=[r.name]}else t===null&&(i=this.registry.preferredWidgetFactories(n).map(r=>r.name));for(const r of this._contextsForPath(n))for(const o of i)if(o!==null){const a=this._widgetManager.findWidget(r,o);if(a)return a}if(t===null)for(const r of this._contextsForPath(n)){const o=this._widgetManager.findWidget(r,null);if(o)return o}}newUntitled(e){return e.type==="file"&&(e.ext=e.ext||".txt"),this.services.contents.newUntitled(e)}open(e,t="default",n,i,r){return this._createOrOpenDocument("open",e,t,n,i,r)}openOrReveal(e,t=null,n,i,r){const o=this.findWidget(e,t);return o?(this._opener.open(o,{type:t||"default",...i}),o):this.open(e,t||"default",n,i??{},r)}async overwrite(e,t){const n=`${t}.${qr.uuid4()}`;await this.rename(e,n);try{return await this.deleteFile(t),await this.rename(n,t)}catch(i){throw await this.rename(n,e),i}}rename(e,t){return this.services.contents.rename(e,t)}_findContext(e,t){const n=this.services.contents.normalize(e);return je(this._contexts,i=>i.path===n&&i.factoryName===t)}_contextsForPath(e){const t=this.services.contents.normalize(e);return this._contexts.filter(n=>n.path===t)}_createContext(e,t,n,i){const r=(l,c)=>{this._widgetManager.adoptWidget(o,l),this._opener.open(l,c)},o=new Iu({opener:r,manager:this.services,factory:t,path:e,kernelPreference:n,setBusy:this._setBusy,sessionDialogs:this._dialogs,lastModifiedCheckMargin:this._lastModifiedCheckMargin,translator:this.translator,contentProviderId:i,urlResolverFactory:this._urlResolverFactory}),a=new yg({context:o,isConnectedCallback:this._isConnectedCallback,saveInterval:this.autosaveInterval});return nn.saveHandlerProperty.set(o,a),o.ready.then(()=>{this.autosave&&a.start()}),o.disposed.connect(this._onContextDisposed,this),this._contexts.push(o),o}_onContextDisposed(e){Y.removeFirstOf(this._contexts,e)}_widgetFactoryFor(e,t){const{registry:n}=this;if(t==="default"){const i=n.defaultWidgetFactory(e);if(!i)return;t=i.name}return n.getWidgetFactory(t)}_createOrOpenDocument(e,t,n="default",i,r,o){const a=this._widgetFactoryFor(t,n);if(!a)return;const l=a.modelName||"text",c=this.registry.getModelFactory(l);if(!c)return;const d={...this.registry.getKernelPreference(t,a.name,i),...o};let u,h=Promise.resolve(void 0);if(e==="open")u=this._findContext(t,c.name)||null,u||(u=this._createContext(t,c,d,a.contentProviderId),h=this._when.then(()=>u.initialize(!1)));else if(e==="create")u=this._createContext(t,c,d,a.contentProviderId),h=this._when.then(()=>u.initialize(!0));else throw new Error(`Invalid argument 'which': ${e}`);const m=this._widgetManager.createWidget(a,u);return this._opener.open(m,{type:a.name,...r}),h.catch(_=>{console.error(`Failed to initialize the context with '${c.name}' for ${t}`,_),m.close()}),m}_onActivateRequested(e,t){this._activateRequested.emit(t)}_onWidgetStateChanged(e,t){t.name==="confirmClosingDocument"&&this._stateChanged.emit(t)}}var nn;(function(s){s.saveHandlerProperty=new Ct({name:"saveHandler",create:()=>{}})})(nn||(nn={}));function da(s,e){if(!e)return!0;const t=O.PathExt.removeSlash(s),n=O.PathExt.removeSlash(e);return t===n||t.startsWith(n+"/")}const Cg=5e3,Eg="jp-PathNavigator",xg="jp-PathNavigator-suggestions";class Tg extends X{constructor(e){var t;super({node:document.createElement("span")}),this._closed=new U(this),this._isOpen=!1,this._suggestions=[],this._currentFilteredSuggestions=[],this._activeSuggestionIndex=-1,this._suggestionDirPath="",this._suggestionFetchTime=0,this._fetchId=0,this._submittedLocalPath=null,this.addClass(Eg),this._model=e.model,this._trans=((t=e.translator)!==null&&t!==void 0?t:se).load("jupyterlab"),this._inputNode=document.createElement("input"),this._inputNode.type="text",this._inputNode.placeholder=this._trans.__("Type a path…"),this._suggestionsNode=document.createElement("ul"),this._suggestionsNode.className=xg,this._suggestionsNode.style.display="none",this.node.appendChild(this._inputNode),this.node.appendChild(this._suggestionsNode),this._model.refreshed.connect(this._onModelRefreshed,this)}get closed(){return this._closed}dispose(){this.isDisposed||(this._model.refreshed.disconnect(this._onModelRefreshed,this),U.clearData(this),super.dispose())}open(){this._isOpen=!0;const t=this._model.manager.services.contents.localPath(this._model.path),n=t?t+"/":"";this._inputNode.value=n,requestAnimationFrame(()=>{!this._isOpen||this.isDisposed||(this._inputNode.focus(),this._inputNode.setSelectionRange(n.length,n.length))}),this._updateSuggestions(n)}onAfterAttach(e){super.onAfterAttach(e),this._inputNode.addEventListener("input",this),this._inputNode.addEventListener("keydown",this),this._inputNode.addEventListener("blur",this),this._suggestionsNode.addEventListener("mousedown",this)}onBeforeDetach(e){this._inputNode.removeEventListener("input",this),this._inputNode.removeEventListener("keydown",this),this._inputNode.removeEventListener("blur",this),this._suggestionsNode.removeEventListener("mousedown",this),super.onBeforeDetach(e)}handleEvent(e){switch(e.type){case"input":this._updateSuggestions(this._inputNode.value);break;case"keydown":this._evtKeydown(e);break;case"blur":this._close();break;case"mousedown":this._evtSuggestionMousedown(e);break}}_close(){!this._isOpen||this.isDisposed||(this._isOpen=!1,this._submittedLocalPath=null,this._suggestionsNode.style.display="none",this._closed.emit())}_commitNavigation(e){let t=e.endsWith("/")&&e.length>1?e.slice(0,-1):e;t.startsWith("/")||(t="/"+t),t=t.replace(/\/{2,}/g,"/"),this._submittedLocalPath=this._model.manager.services.contents.localPath(t||"/"),this._suggestionsNode.style.display="none",this._model.cd(t||"/").then(()=>this._close()).catch(n=>{this._submittedLocalPath=null,ve(this._trans.__("Open Error"),n),this._close()})}matchesSubmittedPath(e){return this._submittedLocalPath===e}async _updateSuggestions(e){if(!this._isOpen)return;const t=e.lastIndexOf("/"),n=t>=0?e.slice(0,t):"",i=n.startsWith("/")?n.slice(1):n,r=t>=0?e.slice(t+1):e,o=Date.now()-this._suggestionFetchTime>Cg;if(i!==this._suggestionDirPath||o){const d=++this._fetchId;try{const u=this._model.manager.services.contents,h=u.resolvePath(this._model.path,"/"+i),m=da(h,this._model.root)?await u.get(h,{content:!0}):null;if(d!==this._fetchId||!this._isOpen)return;this._suggestionDirPath=i,this._suggestionFetchTime=Date.now();const _=m?.type==="directory"?m.content:[];this._suggestions=_.filter(b=>b.type==="directory").map(b=>i?`${i}/${b.name}`:b.name)}catch{this._suggestionDirPath=i,this._suggestionFetchTime=Date.now(),this._suggestions=[]}}const a=r.toLowerCase(),l=r.startsWith(".")||"includeHiddenFiles"in this._model&&this._model.includeHiddenFiles,c=this._suggestions.filter(d=>{const u=d.slice(d.lastIndexOf("/")+1);return!l&&u.startsWith(".")?!1:u.toLowerCase().startsWith(a)});this._activeSuggestionIndex=-1,this._renderSuggestions(c.slice().sort((d,u)=>{const h=d.slice(d.lastIndexOf("/")+1),m=u.slice(u.lastIndexOf("/")+1);return h.localeCompare(m)}))}_renderSuggestions(e){if(this._suggestionsNode.replaceChildren(),this._currentFilteredSuggestions=e,e.length===0){this._suggestionsNode.style.display="none";return}for(const t of e){const n=document.createElement("li"),i=t.slice(t.lastIndexOf("/")+1);n.textContent=i,n.dataset.path=t,i.startsWith(".")&&(n.dataset.isDot=""),this._suggestionsNode.appendChild(n)}this._suggestionsNode.style.display=""}_evtKeydown(e){var t;switch(e.key){case"Enter":this._commitNavigation(this._inputNode.value);break;case"Escape":this._close();break;case"Tab":!((t=this._currentFilteredSuggestions)===null||t===void 0)&&t.length&&(e.preventDefault(),this._acceptSuggestion());break;case"ArrowDown":e.preventDefault(),this._navigateSuggestions(1);break;case"ArrowUp":e.preventDefault(),this._navigateSuggestions(-1);break}}_evtSuggestionMousedown(e){e.preventDefault();let t=e.target;for(;t&&t!==this._suggestionsNode;){if(t.tagName==="LI"){const n=t.dataset.path;n&&this._commitNavigation(n);return}t=t.parentElement}}_navigateSuggestions(e){const t=Array.from(this._suggestionsNode.children);if(t.length===0)return;this._activeSuggestionIndex>=0&&t[this._activeSuggestionIndex].classList.remove("jp-mod-active"),this._activeSuggestionIndex+=e,this._activeSuggestionIndex<0?this._activeSuggestionIndex=t.length-1:this._activeSuggestionIndex>=t.length&&(this._activeSuggestionIndex=0);const n=t[this._activeSuggestionIndex];n.classList.add("jp-mod-active"),n.scrollIntoView({block:"nearest"});const i=n.dataset.path;i&&(this._inputNode.value=i)}_acceptSuggestion(){const e=Array.from(this._suggestionsNode.children);if(this._activeSuggestionIndex>=0&&e[this._activeSuggestionIndex]){const t=e[this._activeSuggestionIndex].dataset.path;t&&(this._inputNode.value=t+"/",this._updateSuggestions(this._inputNode.value))}else if(this._currentFilteredSuggestions.length===1)this._inputNode.value=this._currentFilteredSuggestions[0]+"/",this._updateSuggestions(this._inputNode.value);else if(this._currentFilteredSuggestions.length>1){const t=this._currentFilteredSuggestions.map(i=>i.slice(i.lastIndexOf("/")+1));let n=t[0];for(const i of t.slice(1)){let r=0;for(;r<n.length&&r<i.length&&n[r]===i[r];)r++;n=n.slice(0,r)}if(n){const i=this._inputNode.value.lastIndexOf("/"),r=i>=0?this._inputNode.value.slice(0,i+1):"";this._inputNode.value=r+n,this._updateSuggestions(this._inputNode.value)}}}_onModelRefreshed(){this._suggestionFetchTime=0,this._isOpen&&this._updateSuggestions(this._inputNode.value)}}const nr="jp-BreadCrumbs",ct="jp-BreadCrumbs-home",yt="jp-BreadCrumbs-preferred",et="jp-BreadCrumbs-item",js="jp-BreadCrumbs-ellipsis",ua="jp-BreadCrumbs-separator",hs="application/x-jupyter-icontents",at="jp-mod-dropTarget",Sg="jp-BreadCrumbs-container",Pg="jp-BreadCrumbs-content",sr="jp-mod-editMode";class Ag extends X{constructor(e){var t,n;super(),this._previousState=null,this._cachedWidths=null,this._lastRenderedWidth=0,this._isEditMode=!1,this._lastPath="",this._restoreBreadcrumbFocusAfterUpdate=!1,this.translator=e.translator||se,this._trans=this.translator.load("jupyterlab"),this._model=e.model,this._fullPath=e.fullPath||!1,this._minimumLeftItems=(t=e.minimumLeftItems)!==null&&t!==void 0?t:0,this._minimumRightItems=(n=e.minimumRightItems)!==null&&n!==void 0?n:2,this._onPathEdited=e.onPathEdited,this._onPathActivated=e.onPathActivated,this.addClass(nr),this._crumbs=wt.createCrumbs();const i=O.PageConfig.getOption("preferredPath");this._hasPreferred=!!(i&&i!=="/"),this._crumbContainer=document.createElement("span"),this._crumbContainer.className=Sg,this._crumbContent=document.createElement("span"),this._crumbContent.className=Pg,this._crumbContainer.appendChild(this._crumbContent),this.node.appendChild(this._crumbContainer),this._model.refreshed.connect(this._onModelRefreshed,this),this._resizeThrottler=new Jl(()=>this._onResize(),50),this._resizeObserver=new ResizeObserver(r=>{const o=r[0];if(!o)return;const a=o.contentRect.width;this._lastRenderedWidth>0&&a<this._lastRenderedWidth?this._onResize():this._resizeThrottler.invoke()}),this._pathNavigator=new Tg({model:this._model,translator:e.translator}),this._pathNavigator.closed.connect(this._exitEditMode,this)}handleEvent(e){switch(e.type){case"keydown":this._evtKeyDown(e);break;case"click":this._evtClick(e);break;case"lm-dragenter":this._evtDragEnter(e);break;case"lm-dragleave":this._evtDragLeave(e);break;case"lm-dragover":this._evtDragOver(e);break;case"lm-drop":this._evtDrop(e);break;default:return}}get fullPath(){return this._fullPath}set fullPath(e){this._fullPath=e}get minimumLeftItems(){return this._minimumLeftItems}set minimumLeftItems(e){this._minimumLeftItems=e}get minimumRightItems(){return this._minimumRightItems}set minimumRightItems(e){this._minimumRightItems=e}dispose(){this.isDisposed||(this._model.refreshed.disconnect(this._onModelRefreshed,this),this._pathNavigator.closed.disconnect(this._exitEditMode,this),this._pathNavigator.dispose(),this._resizeObserver.disconnect(),this._resizeThrottler.dispose(),super.dispose())}onAfterAttach(e){super.onAfterAttach(e),this.update();const t=this.node;t.addEventListener("keydown",this),t.addEventListener("click",this),t.addEventListener("lm-dragenter",this),t.addEventListener("lm-dragleave",this),t.addEventListener("lm-dragover",this),this._resizeObserver.observe(t),t.addEventListener("lm-drop",this),X.attach(this._pathNavigator,this.node)}onBeforeDetach(e){X.detach(this._pathNavigator),super.onBeforeDetach(e);const t=this.node;t.removeEventListener("keydown",this),t.removeEventListener("click",this),t.removeEventListener("lm-dragenter",this),t.removeEventListener("lm-dragleave",this),t.removeEventListener("lm-dragover",this),t.removeEventListener("lm-drop",this),this._resizeObserver.unobserve(t)}onUpdateRequest(e){if(this._isEditMode)return;const n=this._model.manager.services.contents.localPath(this._model.path);this._lastPath=n,this._previousState&&this._previousState.path!==n&&(this._cachedWidths=null);const i=this._calculateAdaptiveItems(n),r={path:n,root:this._model.root,hasPreferred:this._hasPreferred,fullPath:this._fullPath,minimumLeftItems:i.left,minimumRightItems:i.right};this._previousState!==null&&jt.deepEqual(r,this._previousState)||(this._previousState=r,wt.updateCrumbs(this._crumbContent,this._crumbs,r),this._syncCrumbTabIndices()),this._runPostActivationFocus()}_runPostActivationFocus(){this._restoreBreadcrumbFocusAfterUpdate&&(this._restoreBreadcrumbFocusAfterUpdate=!1,requestAnimationFrame(()=>{var e;this.isDisposed||this._isEditMode||(e=this._onPathActivated)===null||e===void 0||e.call(this)}))}_getFocusableCrumbElements(){const e=[],t=this._crumbContent.children;for(let n=0;n<t.length;n++){const i=t[n];(i.classList.contains(yt)||i.classList.contains(ct)||i.classList.contains(et))&&e.push(i)}return e}_syncCrumbTabIndices(){const e=this._getFocusableCrumbElements();for(let t=0;t<e.length;t++)e[t].tabIndex=t===0?0:-1}_focusCrumb(e){const t=this._getFocusableCrumbElements(),n=t.indexOf(e);if(n!==-1){for(let i=0;i<t.length;i++)t[i].tabIndex=i===n?0:-1;e.focus()}}_focusTrailingCrumb(){const e=this._getFocusableCrumbElements();if(e.length===0){this.node.tabIndex=-1,this.node.focus();return}this._focusCrumb(e[e.length-1])}_resolveCrumbFromEventTarget(e){let t=e;for(;t&&t!==this.node;){if(t.classList.contains(yt)||t.classList.contains(ct)||t.classList.contains(et))return t;t=t.parentElement}return null}_isCurrentDirectoryCrumb(e){if(!e.classList.contains(et)||e.classList.contains(js))return!1;const n=this._model.manager.services.contents.localPath(this._model.path);return e.dataset.path===n}_activateCrumbSegment(e){this._focusCrumb(e);const t=this._destinationForCrumb(e);t&&(this._restoreBreadcrumbFocusAfterUpdate=!0,this._model.cd(t).catch(n=>{this._restoreBreadcrumbFocusAfterUpdate=!1,ve(this._trans.__("Open Error"),n)}))}_destinationForCrumb(e){if(e.classList.contains(yt)){const t=O.PageConfig.getOption("preferredPath");return t?"/"+t:"/"}return e.classList.contains(ct)?"/":e.classList.contains(et)?`/${e.dataset.path}`:null}_evtKeyDown(e){if(this._isEditMode)return;const t=e.key==="Enter"||e.key===" ",n=this._resolveCrumbFromEventTarget(e.target),i=this._model.manager.services.contents.localPath(this._model.path);if(t&&n&&this._crumbContent.contains(n)){const c=e.key===" "&&n.classList.contains(ct)&&i==="";this._isCurrentDirectoryCrumb(n)||c?this.enterEditMode():this._activateCrumbSegment(n),e.preventDefault(),e.stopPropagation();return}if(e.key!=="ArrowLeft"&&e.key!=="ArrowRight"||!n||!this._crumbContent.contains(n))return;const r=this._getFocusableCrumbElements(),o=r.indexOf(n);if(o===-1)return;const a=e.key==="ArrowLeft"?-1:1,l=o+a;l<0||l>=r.length||(this._focusCrumb(r[l]),e.preventDefault(),e.stopPropagation())}_evtClick(e){if(e.button!==0||this._isEditMode)return;let t=e.target;for(;t&&t!==this.node;){if(t.classList.contains(yt)||t.classList.contains(et)||t.classList.contains(ct)){this._activateCrumbSegment(t),e.preventDefault(),e.stopPropagation();return}t=t.parentElement}this.enterEditMode()}_evtDragEnter(e){if(e.mimeData.hasData(hs)){const t=this._getBreadcrumbElements();let n=-1,i=e.target;for(;i&&i!==this.node&&(n=t.indexOf(i),n===-1);)i=i.parentElement;if(n!==-1){const r=t[n],o=this._model.manager.services.contents.localPath(this._model.path);r.dataset.path!==o&&(r.classList.add(at),e.preventDefault(),e.stopPropagation())}}}_evtDragLeave(e){e.preventDefault(),e.stopPropagation();const t=q.findElement(this.node,at);t&&t.classList.remove(at)}_evtDragOver(e){e.preventDefault(),e.stopPropagation(),e.dropAction=e.proposedAction;const t=q.findElement(this.node,at);t&&t.classList.remove(at);const n=this._getBreadcrumbElements();let i=-1,r=e.target;for(;r&&r!==this.node&&(i=n.indexOf(r),i===-1);)r=r.parentElement;i!==-1&&n[i].classList.add(at)}_evtDrop(e){if(e.preventDefault(),e.stopPropagation(),e.proposedAction==="none"){e.dropAction="none";return}if(!e.mimeData.hasData(hs))return;e.dropAction=e.proposedAction;let t=e.target;for(;t&&t.parentElement;){if(t.classList.contains(at)){t.classList.remove(at);break}t=t.parentElement}let n=null;if(t.classList.contains(ct))n="/";else if(t.classList.contains(yt)){const l=O.PageConfig.getOption("preferredPath");n=l?"/"+l:"/"}else t.dataset.path&&(n=t.dataset.path);if(!n)return;const r=this._model.manager,o=[],a=e.mimeData.getData(hs);for(const l of a){const c=O.PathExt.basename(l),d=O.PathExt.join(n,c);o.push(In(r,l,d))}Promise.all(o).catch(l=>ve(this._trans.__("Move Error"),l))}_getBreadcrumbElements(){const e=[],t=this._crumbContent.children;for(let n=0;n<t.length;n++){const i=t[n];(i.classList.contains(et)||i.classList.contains(ct)||i.classList.contains(yt))&&!i.classList.contains(js)&&e.push(i)}return e}_onResize(){this.isDisposed||!this.isAttached||(this._previousState=null,this.update())}_measureAllItemWidths(e){const t=this._crumbContent,n=this._crumbs[wt.Crumb.Home],i=this._crumbs[wt.Crumb.Ellipsis],r=this._crumbs[wt.Crumb.Preferred],o=t.getElementsByClassName(ua),a=o.length>0?o[0]:null,l=document.createElement("div");l.style.position="absolute",l.style.visibility="hidden",l.style.height="0",l.style.overflow="hidden",l.style.whiteSpace="nowrap",l.className=nr,t.appendChild(l);const c=[];for(let d=0;d<e.length;d++){const u=document.createElement("span");u.className=et,u.textContent=e[d],l.appendChild(u);const h=u.getBoundingClientRect().width;c.push((h>0?h:Math.max(e[d].length*8,20))+4)}t.removeChild(l),this._cachedWidths={home:(n.getBoundingClientRect().width||22)+4,ellipsis:(i.getBoundingClientRect().width||28)+4,separator:a?.getBoundingClientRect().width||4,preferred:this._hasPreferred?(r.getBoundingClientRect().width||22)+4:0,itemWidths:c}}_calculateAdaptiveItems(e){this._lastRenderedWidth=0;const t=e.split("/").filter(E=>E!==""),n=t.length;if(this._fullPath||n===0)return{left:this._minimumLeftItems,right:this._minimumRightItems};const i=this._minimumLeftItems+this._minimumRightItems;if(n<=i)return{left:this._minimumLeftItems,right:this._minimumRightItems};const r=this.node.clientWidth;if(r===0)return{left:this._minimumLeftItems,right:this._minimumRightItems};(!this._cachedWidths||this._cachedWidths.itemWidths.length!==n)&&this._measureAllItemWidths(t);const o=this._cachedWidths.home,a=this._cachedWidths.separator,l=this._cachedWidths.ellipsis,c=this._cachedWidths.preferred,d=this._cachedWidths.itemWidths;let u=o+a;this._hasPreferred&&(u+=c);const h=r-u;let m=0;for(let E=0;E<n;E++)m+=d[E]+a;if(m<=h)return this._lastRenderedWidth=u+m,{left:n,right:0};const _=l+a,b=h-_;let g=0;for(let E=0;E<this._minimumLeftItems&&E<n;E++)g+=d[E]+a;const p=b-g;let w=0,v=0;for(let E=n-1;E>=this._minimumLeftItems;E--){const x=d[E]+a;if(v+x<=p)v+=x,w++;else break}const y=Math.max(w,this._minimumRightItems);let C=v;if(y>w){C=0;for(let E=n-y;E<n;E++)C+=d[E]+a}return this._lastRenderedWidth=u+_+g+C,{left:this._minimumLeftItems,right:y}}enterEditMode(){this._isEditMode=!0;const e=this._model.manager.services.contents;this._lastPath=e.localPath(this._model.path),this.node.classList.add(sr),this._previousState=null,this._pathNavigator.open()}focusLastCrumb(){requestAnimationFrame(()=>{this._focusTrailingCrumb()})}_exitEditMode(){this._isEditMode&&(this._isEditMode=!1,this.node.classList.remove(sr),this._previousState=null,this.update())}_onModelRefreshed(){var e;const n=this._model.manager.services.contents.localPath(this._model.path);if(this._isEditMode){(this._pathNavigator.matchesSubmittedPath(n)||n!==this._lastPath)&&(this._exitEditMode(),(e=this._onPathEdited)===null||e===void 0||e.call(this));return}this.update()}}var wt;(function(s){let e;(function(o){o[o.Home=0]="Home",o[o.Ellipsis=1]="Ellipsis",o[o.Preferred=2]="Preferred"})(e=s.Crumb||(s.Crumb={}));function t(o,a,l){const c=[],u=(l.root?l.root.split("/").filter(b=>b!==""):[]).length;l.root?c.push(r()):(l.hasPreferred&&c.push(a[s.Crumb.Preferred]),c.push(a[e.Home],r()));const h=l.path.split("/").filter(b=>b!==""),m=l.root?h.slice(u):h,_=u;if(!l.fullPath&&m.length>0){const b=l.minimumLeftItems,g=l.minimumRightItems;if(m.length>b+g){for(let E=0;E<b;E++){const x=_+E,S=h.slice(0,x+1).join("/");c.push(n(m[E],S)),c.push(r())}const p=b,w=m.length-g,v=m.slice(p,w),y=a[e.Ellipsis];y.title=v.join("/"),y.dataset.path=v.length>0?h.slice(0,_+w).join("/"):h.slice(0,_+b).join("/"),c.push(y,r());const C=m.length-g;for(let E=C;E<m.length;E++){const x=_+E,S=h.slice(0,x+1).join("/");c.push(n(m[E],S)),c.push(r())}}else for(let p=0;p<m.length;p++){const w=_+p,v=h.slice(0,w+1).join("/");c.push(n(m[p],v)),c.push(r())}}else if(l.fullPath&&m.length>0)for(let b=0;b<m.length;b++){const g=_+b,p=h.slice(0,g+1).join("/");c.push(n(m[b],p)),c.push(r())}o.replaceChildren(...c)}s.updateCrumbs=t;function n(o,a){const l=document.createElement("span");return l.className=et,l.textContent=o,l.title=a,l.dataset.path=a,l.tabIndex=-1,l}function i(){const o=Vr.element({className:ct,tag:"span",title:O.PageConfig.getOption("serverRoot")||"Jupyter Server Root",stylesheet:"breadCrumb"});o.dataset.path="/",o.tabIndex=-1;const a=Yl.element({className:`${et} ${js}`,tag:"span",stylesheet:"breadCrumb"});a.tabIndex=-1;const l=O.PageConfig.getOption("preferredPath"),c=l&&"/"+l,d=Xl.element({className:yt,tag:"span",title:c||"Jupyter Preferred Path",stylesheet:"breadCrumb"});return d.dataset.path=c||"/",d.tabIndex=-1,[o,a,d]}s.createCrumbs=i;function r(){const o=document.createElement("span");return o.className=ua,o.textContent="/",o}s.createCrumbSeparator=r})(wt||(wt={}));const Rg="jp-DirListing",Bs="jp-DirListing-header",ir="jp-DirListing-headerItem",fs="jp-DirListing-headerItemText",Ln="jp-DirListing-headerItemIcon",Rt="jp-DirListing-content",Ig="jp-DirListing-item",Gt="jp-DirListing-itemText",ms="jp-DirListing-itemName",gn="jp-DirListing-itemIcon",Jt="jp-DirListing-itemModified",ps="jp-DirListing-itemFileSize",Yt="jp-DirListing-itemCreated",It="jp-DirListing-checkboxWrapper",Lg="jp-DirListing-editor",Og="jp-id-name",ha="jp-id-modified",kg="jp-id-filesize",fa="jp-id-created",yn="application/x-jupyter-icontents",Fg="application/x-jupyter-icontentsrich",lt="jp-mod-dropTarget",ut="jp-mod-selected",Dg="jp-DragIcon",On="jp-DirListing-resizeHandle",Mg="jp-mod-clipboard",_s="jp-mod-cut",rr="jp-mod-multiSelected",or="jp-mod-running",ar="jp-mod-active",bn="jp-mod-descending",Ng=1e3,lr=5,cr=5,vn=!!navigator.platform.match(/Mac/i),jg="application/vnd.lumino.widget-factory";class Ue extends X{constructor(e){var t;super({node:(e.renderer||Ue.defaultRenderer).createNode()}),this._items=[],this._sortedItems=[],this._sortState={direction:"ascending",key:"name"},this._onItemOpened=new U(this),this._selectionChanged=new U(this),this._drag=null,this._dragData=null,this._resizeData=null,this._selectTimer=-1,this._isCut=!1,this._prevPath="",this._clipboard=[],this._clipboardRevision=0,this._softSelection="",this.selection=Object.create(null),this._searchPrefix="",this._searchPrefixTimer=-1,this._inRename=!1,this._isDirty=!1,this._hiddenColumns=new Set,this._columnSizes={name:null,file_size:null,is_selected:null,last_modified:null,date_created:null},this._sortNotebooksFirst=!1,this._sortFileNamesNaturally=!0,this._allowSingleClick=!1,this._allowDragDropUpload=!0,this._focusIndex=0,this._focusPath="",this._modifiedStyle="short",this._createdStyle="short",this._allUploaded=new U(this),this._width=null,this._state=null,this._contentScrollbarWidth=0,this._contentSizeObserver=new ResizeObserver(this._onContentResize.bind(this)),this._paddingWidth=0,this._handleWidth=lr,this._lastRenderedState=new WeakMap,this.addClass(Rg),this.translator=e.translator||se,this._trans=this.translator.load("jupyterlab"),this._model=e.model,this._model.fileChanged.connect(this._onFileChanged,this),this._model.refreshed.connect(this._onModelRefreshed,this),this._model.pathChanged.connect(this._onPathChanged,this),this._editNode=document.createElement("input"),this._editNode.className=Lg,this._manager=this._model.manager,this._renderer=e.renderer||Ue.defaultRenderer,this._state=e.state||null,this._allowDragDropUpload=(t=e.allowDragDropUpload)!==null&&t!==void 0?t:!0,this._handleOpenFile=e.handleOpenFile||(i=>{this._manager.openOrReveal(i)}),this._updateModifiedSize(this.node),this._updateCreatedSize(this.node);const n=q.findElement(this.node,Bs);this._hiddenColumns.add("file_size"),this._hiddenColumns.add("date_created"),this._renderer.populateHeaderNode(n,this.translator,this._hiddenColumns,this._columnSizes),this._manager.activateRequested.connect(this._onActivateRequested,this)}dispose(){this._items.length=0,this._sortedItems.length=0,this._clipboard.length=0,super.dispose()}get model(){return this._model}get headerNode(){return q.findElement(this.node,Bs)}get contentNode(){return q.findElement(this.node,Rt)}get renderer(){return this._renderer}get sortState(){return this._sortState}get onItemOpened(){return this._onItemOpened}get selectionChanged(){return this._selectionChanged}selectedItems(){const e=this._sortedItems;return Dn(e,t=>this.selection[t.path])}sortedItems(){return this._sortedItems[Symbol.iterator]()}sort(e){this._sortedItems=le.sort(this.model.items(),e,this._sortNotebooksFirst,this._sortFileNamesNaturally,this.translator),this._sortState=e,this.update(),this._saveState()}rename(){return this._doRename()}cut(){this._isCut=!0,this._copy(),this.update()}copy(){this._isCut=!1,this._copy()}async paste(){if(!this._clipboard.length){this._isCut=!1;return}const e=this._model.path,t=this._isCut,n=[...this._clipboard],i=this._clipboardRevision;for(const c of this._items)c.classList.remove(_s);this._clipboard.length=0,this._isCut=!1,this.removeClass(Mg);const r=n.map(async c=>{if(t){const u=this._manager.services.contents.localPath(c).split("/"),h=u[u.length-1],m=O.PathExt.join(e,h);m!==c&&await In(this._manager,c,m)}else await this._model.manager.copy(c,e);return c}),o=await Promise.all(r.map(async c=>{try{return{status:"fulfilled",value:await c}}catch(d){return{status:"rejected",reason:d}}})),a=new Set,l=[];for(const c of o)c.status==="fulfilled"?a.add(c.value):c.reason!=="File not renamed"&&l.push(c.reason);this._clipboardRevision===i&&(this._clipboard=n.filter(c=>!a.has(c)),this._isCut=t&&this._clipboard.length>0),l.length>0&&ve(this._trans._p("showErrorMessage","Paste Error"),l[0]instanceof Error?l[0]:String(l[0]))}async delete(){const e=O.PageConfig.getOption("delete_to_trash")==="true",t=this._sortedItems.filter(_=>this.selection[_.path]);if(!t.length)return;const n=this._trans.__("Are you sure you want to move to trash: %1?",t[0].name),i=this._trans.__("Are you sure you want to permanently delete: %1?",t[0].name),r=this._trans._n("Are you sure you want to move to trash the %1 selected item?","Are you sure you want to move to trash the %1 selected items?",t.length),o=this._trans._n("Are you sure you want to permanently delete the %1 selected item?","Are you sure you want to permanently delete the %1 selected items?",t.length),a=e?n:i,l=e?r:o,c=e?this._trans.__("Move to Trash"):this._trans.__("Delete"),d=t.length===1?a:l,u=await ft({title:c,body:d,buttons:[_e.cancelButton({label:this._trans.__("Cancel")}),_e.warnButton({label:c})],defaultButton:0});!this.isDisposed&&u.button.accept&&await this._delete(t.map(_=>_.path));let h=this._focusIndex;const m=this._sortedItems.length-t.length-1;h>m&&(h=Math.max(0,m)),this._focusItem(h)}duplicate(){const e=this._model.path,t=[];for(const n of this.selectedItems())n.type!=="directory"&&t.push(this._model.manager.copy(n.path,e));return Promise.all(t).then(()=>{}).catch(n=>{ve(this._trans._p("showErrorMessage","Duplicate file"),n)})}async selectAll(){const e=this._model.items(),t={};for(const n of e)t[n.path]=!0;this.selection=t,this._selectionChanged.emit(),this.update()}async download(){await Promise.all(Array.from(this.selectedItems()).filter(e=>e.type!=="directory").map(e=>this._model.download(e.path)))}async restore(e){const t=`file-browser-${e}:columns`,n=this._state;if(this._stateColumnsKey=t,!!n)try{const i=await n.fetch(t);if(!i)return;const r=i.sizes,o=i.sortState;if(o&&(this._sortState=o),r){for(const[a,l]of Object.entries(r))this._columnSizes[a]=l;this._updateColumnSizes()}o&&(this._sortedItems=le.sort(this.model.items(),o,this._sortNotebooksFirst,this._sortFileNamesNaturally,this.translator),this.headerNode.innerHTML="",this._renderer.populateHeaderNode(this.headerNode,this.translator,this._hiddenColumns,this._columnSizes,o),this.update())}catch{await n.remove(t)}}_saveState(){this._state&&this._stateColumnsKey&&this._state.save(this._stateColumnsKey,{sizes:this._columnSizes,sortState:{...this._sortState}})}shutdownKernels(){const e=this._model,t=this._sortedItems,n=t.map(r=>r.path),i=Array.from(this._model.sessions()).filter(r=>{const o=Y.firstIndexOf(n,r.path);return this.selection[t[o].path]}).map(r=>e.manager.services.sessions.shutdown(r.id));return Promise.all(i).then(()=>{}).catch(r=>{ve(this._trans._p("showErrorMessage","Shut down kernel"),r)})}selectNext(e=!1){let t=-1;const n=Object.keys(this.selection),i=this._sortedItems;if(n.length===1||e){const r=n[n.length-1];t=Y.findFirstIndex(i,o=>o.path===r),t+=1,t===this._items.length&&(t=0)}else if(n.length===0)t=0;else{const r=n[n.length-1];t=Y.findFirstIndex(i,o=>o.path===r)}t!==-1&&(this._selectItem(t,e),Kt.scrollIntoViewIfNeeded(this.contentNode,this._items[t]))}selectPrevious(e=!1){let t=-1;const n=Object.keys(this.selection),i=this._sortedItems;if(n.length===1||e){const r=n[0];t=Y.findFirstIndex(i,o=>o.path===r),t-=1,t===-1&&(t=this._items.length-1)}else if(n.length===0)t=this._items.length-1;else{const r=n[0];t=Y.findFirstIndex(i,o=>o.path===r)}t!==-1&&(this._selectItem(t,e),Kt.scrollIntoViewIfNeeded(this.contentNode,this._items[t]))}selectByPrefix(){const e=this._searchPrefix.toLowerCase(),t=this._sortedItems,n=Y.findFirstIndex(t,i=>i.name.toLowerCase().substr(0,e.length)===e);n!==-1&&(this._selectItem(n,!1),Kt.scrollIntoViewIfNeeded(this.contentNode,this._items[n]))}isSelected(e){const t=this._sortedItems;return Array.from(Dn(t,n=>n.name===e&&this.selection[n.path])).length!==0}modelForClick(e){const t=this._sortedItems,n=le.hitTestNodes(this._items,e);if(n!==-1)return t[n]}clearSelectedItems(e=!0){this.selection=Object.create(null),e&&this._selectionChanged.emit()}_focusContent(){const e=this._sortedItems;if(e.length===0){this._focusItem(0);return}let t=this._focusPath!==""?Y.findFirstIndex(e,n=>n.path===this._focusPath):-1;t===-1&&(t=Math.min(Math.max(this._focusIndex,0),e.length-1)),this._selectItem(t,!1,!0)}onActivateRequest(e){this._focusContent()}async selectItemByName(e,t=!1){return this._selectItemByName(e,t)}async _selectItemByName(e,t=!1,n=!1){if(!n&&this.isSelected(e))return;if(await this.model.refresh(),this.isDisposed)throw new Error("File browser is disposed.");const i=this._sortedItems,r=Y.findFirstIndex(i,o=>o.name===e);if(r===-1)throw new Error("Item does not exist.");this._selectItem(r,!1,t),Ie.sendMessage(this,X.Msg.UpdateRequest),Kt.scrollIntoViewIfNeeded(this.contentNode,this._items[r])}handleEvent(e){switch(e.type){case"mousedown":this._evtMousedown(e);break;case"mouseup":this._evtMouseup(e);break;case"mousemove":this._evtMousemove(e);break;case"keydown":this.evtKeydown(e);break;case"click":this._evtClick(e);break;case"dblclick":this.evtDblClick(e);break;case"dragenter":case"dragover":this._allowDragDropUpload&&this.addClass("jp-mod-native-drop"),e.preventDefault();break;case"dragleave":case"dragend":this.removeClass("jp-mod-native-drop");break;case"drop":this.removeClass("jp-mod-native-drop"),this.evtNativeDrop(e);break;case"scroll":this._evtScroll(e);break;case"lm-dragenter":this.evtDragEnter(e);break;case"lm-dragleave":this.evtDragLeave(e);break;case"lm-dragover":this.evtDragOver(e);break;case"lm-drop":this.evtDrop(e);break}}onAfterAttach(e){super.onAfterAttach(e);const t=this.node;this._width=this._computeContentWidth();const n=q.findElement(t,Rt);t.addEventListener("mousedown",this),t.addEventListener("keydown",this),t.addEventListener("click",this),t.addEventListener("dblclick",this),this._contentSizeObserver.observe(n),n.addEventListener("dragenter",this),n.addEventListener("dragover",this),n.addEventListener("dragleave",this),n.addEventListener("dragend",this),n.addEventListener("drop",this),n.addEventListener("scroll",this),n.addEventListener("lm-dragenter",this),n.addEventListener("lm-dragleave",this),n.addEventListener("lm-dragover",this),n.addEventListener("lm-drop",this),this._updateColumnSizes()}onBeforeDetach(e){super.onBeforeDetach(e);const t=this.node,n=q.findElement(t,Rt);t.removeEventListener("mousedown",this),t.removeEventListener("keydown",this),t.removeEventListener("click",this),t.removeEventListener("dblclick",this),this._contentSizeObserver.disconnect(),n.removeEventListener("scroll",this),n.removeEventListener("dragover",this),n.removeEventListener("dragover",this),n.removeEventListener("dragleave",this),n.removeEventListener("dragend",this),n.removeEventListener("drop",this),n.removeEventListener("lm-dragenter",this),n.removeEventListener("lm-dragleave",this),n.removeEventListener("lm-dragover",this),n.removeEventListener("lm-drop",this),document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0)}onAfterShow(e){this._isDirty&&(this.sort(this.sortState),this.update())}_onContentResize(){const e=q.findElement(this.node,Rt),t=e.offsetWidth-e.clientWidth;t!=this._contentScrollbarWidth&&(this._contentScrollbarWidth=t,this._width=this._computeContentWidth(),this._updateColumnSizes())}_computeContentWidth(e=null){e||(e=this.node.getBoundingClientRect().width),this._paddingWidth=parseFloat(window.getComputedStyle(this.node).getPropertyValue("--jp-dirlisting-padding-width"));const t=this.node.querySelector(`.${On}`);return this._handleWidth=t?t.getBoundingClientRect().width:lr,e-this._paddingWidth*2-this._contentScrollbarWidth}_updateModifiedSize(e){this._modifiedStyle=this._computeDateColumnStyle(e,ha,"last_modified")}_updateCreatedSize(e){this._createdStyle=this._computeDateColumnStyle(e,fa,"date_created")}_computeDateColumnStyle(e,t,n){var i,r;const o=q.findElement(e,t),a=(r=(i=this._columnSizes[n])!==null&&i!==void 0?i:o?.getBoundingClientRect().width)!==null&&r!==void 0?r:83;return a<100?"narrow":a>120?"long":"short"}_updateModifiedStyleAndSize(){const e=this._modifiedStyle;this._updateModifiedSize(this.node),e!==this._modifiedStyle&&this.updateModified(this._sortedItems,this._items)}_updateCreatedStyleAndSize(){const e=this._createdStyle;this._updateCreatedSize(this.node),e!==this._createdStyle&&this.updateCreated(this._sortedItems,this._items)}updateModified(e,t){e.forEach((n,i)=>{const r=t[i];if(r&&n.last_modified){const o=q.findElement(r,Jt);if(!o)return;this.renderer.updateItemModified!==void 0?this.renderer.updateItemModified(o,n.last_modified,this._modifiedStyle):Ue.defaultRenderer.updateItemModified(o,n.last_modified,this._modifiedStyle)}})}updateCreated(e,t){e.forEach((n,i)=>{const r=t[i];if(r&&n.created){const o=q.findElement(r,Yt);if(!o)return;this.renderer.updateItemCreated!==void 0?this.renderer.updateItemCreated(o,n.created,this._createdStyle):Ue.defaultRenderer.updateItemCreated(o,n.created,this._createdStyle)}})}updateNodes(e,t,n=!1){var i;e.forEach((a,l)=>{const c=t[l];if(n&&this.renderer.updateItemSize)return c?this.renderer.updateItemSize(c,a,this._modifiedStyle,this._columnSizes,this._createdStyle):void 0;const d=this._manager.registry.getFileTypeForModel(a);this.renderer.updateItemNode(c,a,d,this.translator,this._hiddenColumns,this.selection[a.path],this._modifiedStyle,this._columnSizes,this._createdStyle),this.selection[a.path]&&this._isCut&&this._model.path===this._prevPath&&c.classList.add(_s),c.setAttribute("data-isdir",a.type==="directory"?"true":"false")});const r=Object.keys(this.selection).length;r&&(this.addClass(ut),r>1&&this.addClass(rr));const o=e.map(a=>a.path);for(const a of this._model.sessions()){const l=Y.firstIndexOf(o,a.path),c=t[l];if(c){let d=(i=a.kernel)===null||i===void 0?void 0:i.name;const u=this._model.specs;if(c.classList.add(or),u&&d){const m=u.kernelspecs[d];d=m?m.display_name:this._trans.__("unknown")}this._lastRenderedState.get(c)!==c.title&&(c.title=this._trans.__(`%1
420
- Kernel: %2`,c.title,d),this._lastRenderedState.set(c,c.title))}}}onUpdateRequest(e){this._isDirty=!1;const t=this._sortedItems,n=this._items,i=n.length===0,r=q.findElement(this.node,Rt),o=this._renderer;for(this.removeClass(rr),this.removeClass(ut);n.length>t.length;)r.removeChild(n.pop());for(;n.length<t.length;){const l=o.createItemNode(this._hiddenColumns,this._columnSizes);l.classList.add(Ig),n.push(l),r.appendChild(l)}n.forEach((l,c)=>{l.classList.remove(ut),l.classList.remove(or),l.classList.remove(_s);const d=o.getCheckboxNode(l);d&&(d.checked=!1);const u=o.getNameNode(l);u&&(c===this._focusIndex?(u.setAttribute("tabIndex","0"),u.setAttribute("role","button")):(u.setAttribute("tabIndex","-1"),u.removeAttribute("role")))});const a=o.getCheckboxNode(this.headerNode);if(a){const l=Object.keys(this.selection).length,c=t.length>0&&l===t.length,d=!c&&l>0;a.checked=c,a.indeterminate=d,a.dataset.checked=String(c),a.dataset.indeterminate=String(d);const u=this.translator.load("jupyterlab");a?.setAttribute("aria-label",c||d?u.__("Deselect all files and directories"):u.__("Select all files and directories"))}this.updateNodes(t,n),i&&(this._width=this._computeContentWidth(),this._updateColumnSizes()),this._prevPath=this._model.path}onResize(e){const{width:t}=e.width===-1?this.node.getBoundingClientRect():e;this._width=this._computeContentWidth(t),this._updateColumnSizes()}setColumnVisibility(e,t){t?this._hiddenColumns.delete(e):this._hiddenColumns.add(e),this.headerNode.innerHTML="",this._renderer.populateHeaderNode(this.headerNode,this.translator,this._hiddenColumns,this._columnSizes,this._sortState),this._updateColumnSizes()}_updateColumnSizes(e=null){const t=this._visibleColumns.map(a=>({...a,element:q.findElement(this.node,a.className)})).filter(a=>a.element);let n=0;for(const a of t){let l=this._columnSizes[a.id];if(l===null&&(l=a.element.getBoundingClientRect().width),l=Math.max(l,a.minWidth),this._width){let c=0;for(const d of t)d.id!==a.id&&(c+=d.minWidth);l=Math.min(l,this._width-c)}this._columnSizes[a.id]=l,n+=l}if(this._width){const a=this._width-n;let l=e===null;const c=t.filter(u=>l?!0:(u.id===e&&(l=!0),!1)),d=c.map(u=>u.grow).reduce((u,h)=>u+h,0);for(const u of c){const h=a*u.grow/d;this._columnSizes[u.id]=this._columnSizes[u.id]+h}}const i=this.node.getElementsByClassName(On),r=t.map(a=>le.isResizable(a));let o=0;for(const a of t){let l=this._columnSizes[a.id];le.isResizable(a)&&l&&(l-=this._handleWidth*i.length/r.length,(o===0||o===r.length-1)&&(l+=this._paddingWidth),o+=1),a.element.style.width=l===null?"":l+"px"}this._updateModifiedStyleAndSize(),this._updateCreatedStyleAndSize(),this.isVisible&&this._items.length!==0&&this.updateNodes(this._sortedItems,this._items,!0),this._saveState()}get _visibleColumns(){return Ue.columns.filter(e=>{var t;return e.id==="name"||!(!((t=this._hiddenColumns)===null||t===void 0)&&t.has(e.id))})}_setColumnSize(e,t){var n;const i=this._columnSizes[e];if(i&&t&&t>i){let r=0,o=!0;for(const a of this._visibleColumns){if(a.id===e){r+=t,o=!1;continue}if(o){const l=q.findElement(this.node,a.className);r+=(n=this._columnSizes[a.id])!==null&&n!==void 0?n:l.getBoundingClientRect().width}else r+=a.minWidth}if(this._width&&r>this._width)return}this._columnSizes[e]=t,this._updateColumnSizes(e)}setNotebooksFirstSorting(e){let t=this._sortNotebooksFirst;this._sortNotebooksFirst=e,this._sortNotebooksFirst!==t&&this.sort(this._sortState)}setSortFileNamesNaturally(e){const t=this._sortFileNamesNaturally;this._sortFileNamesNaturally=e,this._sortFileNamesNaturally!==t&&this.sort(this._sortState)}setAllowSingleClickNavigation(e){this._allowSingleClick=e}setAllowDragDropUpload(e){this._allowDragDropUpload=e}isWithinCheckboxHitArea(e){let t=e.target;for(;t;){if(t.classList.contains(It))return!0;t=t.parentElement}return!1}_evtClick(e){const t=e.target,n=this.headerNode,i=this._renderer;if(n.contains(t)){const r=i.getCheckboxNode(n);if(r&&this.isWithinCheckboxHitArea(e))r.dataset.indeterminate==="false"&&r.dataset.checked==="false"?(this._sortedItems.forEach(a=>this.selection[a.path]=!0),this._selectionChanged.emit()):this.clearSelectedItems(),this.update();else{const o=this.renderer.handleHeaderClick(n,e);o&&this.sort(o)}return}else this._focusItem(this._focusIndex);this._allowSingleClick&&this.evtDblClick(e)}_evtScroll(e){this.headerNode.scrollLeft=this.contentNode.scrollLeft}_evtMousedown(e){if(e.target===this._editNode)return;if(this._editNode.parentNode)if(this._editNode!==e.target)this._editNode.focus(),this._editNode.blur(),clearTimeout(this._selectTimer);else return;let t=le.hitTestNodes(this._items,e);if(t===-1){if(e.button===0){const i=e.target;if(i instanceof HTMLElement&&i.classList.contains(On)){const r=i.dataset.column;if(!r)throw Error("Column resize handle is missing data-column attribute");const o=Ue.columns.find(c=>c.id===r);if(!o)throw Error(`Column with identifier ${r} not found`);const a=q.findElement(this.node,o.className);i.classList.add(ar);const l=Ts.overrideCursor("col-resize");this._resizeData={pressX:e.clientX,column:r,initialSize:a.getBoundingClientRect().width,overrides:new Ve(()=>{l.dispose(),i.classList.remove(ar)})},document.addEventListener("mouseup",this,!0),document.addEventListener("mousemove",this,!0);return}}return}this.handleFileSelect(e),e.button!==0&&clearTimeout(this._selectTimer),!(vn&&e.ctrlKey||e.button===2)&&e.button===0&&(this._dragData={pressX:e.clientX,pressY:e.clientY,index:t},document.addEventListener("mouseup",this,!0),document.addEventListener("mousemove",this,!0))}_evtMouseup(e){if(this._softSelection&&(!(e.metaKey||e.shiftKey||e.ctrlKey)&&e.button===0&&(this.clearSelectedItems(),this.selection[this._softSelection]=!0,this._selectionChanged.emit(),this.update()),this._softSelection=""),e.button===0&&this._focusItem(this._focusIndex),this._resizeData){this._resizeData.overrides.dispose(),this._resizeData=null,document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0);return}if(e.button!==0||!this._drag){document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0);return}e.preventDefault(),e.stopPropagation()}_evtMousemove(e){if(e.preventDefault(),e.stopPropagation(),this._resizeData){const{initialSize:r,column:o,pressX:a}=this._resizeData;this._setColumnSize(o,r+e.clientX-a);return}if(this._drag||!this._dragData)return;const t=this._dragData,n=Math.abs(e.clientX-t.pressX),i=Math.abs(e.clientY-t.pressY);n<cr&&i<cr||this._startDrag(t.index,e.clientX,e.clientY)}handleOpen(e){if(this._onItemOpened.emit(e),e.type==="directory"){const t=this._manager.services.contents.localPath(e.path);this._model.cd(`/${t}`).catch(n=>ve(this._trans._p("showErrorMessage","Open directory"),n))}else{const t=e.path;this._handleOpenFile(t)}}_getNextFocusIndex(e,t){const n=e+t;return n===-1||n===this._items.length?e:n}_handleArrowY(e,t){if(e.altKey||e.metaKey||!this._items.length||!e.target.classList.contains(Gt))return;e.stopPropagation(),e.preventDefault();const n=this._focusIndex;let i=this._getNextFocusIndex(n,t);t>0&&n===0&&!e.ctrlKey&&Object.keys(this.selection).length===0&&(i=0),e.shiftKey?this._handleMultiSelect(i):e.ctrlKey||this._selectItem(i,e.shiftKey,!1),this._focusItem(i),this.update()}async goUp(){const e=this.model;if(e.path!==e.rootPath&&!(e.root&&e.path===e.root))try{await e.cd("..")}catch(t){console.warn(`Failed to go to parent directory of ${e.path}`,t)}}evtKeydown(e){if(!this._inRename){switch(e.key){case"Enter":{if(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;e.preventDefault(),e.stopPropagation();for(const t of this.selectedItems())this.handleOpen(t);return}case"ArrowUp":this._handleArrowY(e,-1);return;case"ArrowDown":this._handleArrowY(e,1);return;case" ":case"Spacebar":{if(e.ctrlKey){if(e.metaKey||e.shiftKey||e.altKey)return;const t=this._items[this._focusIndex];if(!(t.contains(e.target)&&t.contains(document.activeElement)))return;e.stopPropagation(),e.preventDefault();const{path:n}=this._sortedItems[this._focusIndex];this.selection[n]?delete this.selection[n]:this.selection[n]=!0,this._selectionChanged.emit(),this.update();return}break}}if(e.key!==void 0&&e.key.length===1&&!((e.key===" "||e.key==="Spacebar")&&e.target.type==="checkbox")){if(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;this._searchPrefix+=e.key,clearTimeout(this._searchPrefixTimer),this._searchPrefixTimer=window.setTimeout(()=>{this._searchPrefix=""},Ng),this.selectByPrefix(),e.stopPropagation(),e.preventDefault()}}}evtDblClick(e){if(e.button!==0||e.ctrlKey||e.shiftKey||e.altKey||e.metaKey||this.isWithinCheckboxHitArea(e))return;e.preventDefault(),e.stopPropagation(),clearTimeout(this._selectTimer),this._editNode.blur();const t=e.target,n=Y.findFirstIndex(this._items,r=>r.contains(t));if(n===-1)return;const i=this._sortedItems[n];this.handleOpen(i)}evtNativeDrop(e){var t,n,i;if(e.preventDefault(),!this._allowDragDropUpload)return;const r=(t=e.dataTransfer)===null||t===void 0?void 0:t.items;if(!r){const l=(n=e.dataTransfer)===null||n===void 0?void 0:n.files;if(!l||l.length===0)return;const c=[];for(const d of l){const u=this._model.upload(d);c.push(u)}Promise.all(c).then(()=>this._allUploaded.emit()).catch(d=>{console.error("Error while uploading files: ",d)});return}const o=async(l,c)=>{if(le.isDirectoryEntry(l)){const d=await le.createDirectory(this._model.manager,c,l.name),u=l.createReader(),h=await le.collectEntries(u);for(const m of h)await o(m,d)}else if(le.isFileEntry(l)){const d=await le.readFile(l);await this._model.upload(d,c)}},a=[];for(const l of r){const c=le.defensiveGetAsEntry(l);if(!c)continue;const d=o(c,(i=this._model.path)!==null&&i!==void 0?i:"/");a.push(d)}Promise.all(a).then(()=>this._allUploaded.emit()).catch(l=>{console.error("Error while uploading files: ",l)})}get allUploaded(){return this._allUploaded}evtDragEnter(e){if(e.mimeData.hasData(yn)){const t=le.hitTestNodes(this._items,e);if(t===-1)return;const n=this._sortedItems[t];if(n.type!=="directory"||this.selection[n.path])return;e.target.classList.add(lt),e.preventDefault(),e.stopPropagation()}}evtDragLeave(e){e.preventDefault(),e.stopPropagation();const t=q.findElement(this.node,lt);t&&t.classList.remove(lt)}evtDragOver(e){e.preventDefault(),e.stopPropagation(),e.dropAction=e.proposedAction;const t=q.findElement(this.node,lt);t&&t.classList.remove(lt);const n=le.hitTestNodes(this._items,e);if(n===-1||n>=this._items.length){e.dropAction="none";return}this._items[n].classList.add(lt)}evtDrop(e){if(e.preventDefault(),e.stopPropagation(),clearTimeout(this._selectTimer),e.proposedAction==="none"){e.dropAction="none";return}if(!e.mimeData.hasData(yn))return;let t=e.target;for(;t&&t.parentElement;){if(t.classList.contains(lt)){t.classList.remove(lt);break}t=t.parentElement}const n=Y.firstIndexOf(this._items,t),i=this._sortedItems;let r=this._model.path;i[n].type==="directory"&&(r=O.PathExt.join(r,i[n].name));const o=this._manager,a=[],l=e.mimeData.getData(yn);e.ctrlKey&&e.proposedAction==="move"?e.dropAction="copy":e.dropAction=e.proposedAction;for(const c of l){const d=o.services.contents.localPath(c),u=O.PathExt.basename(d),h=O.PathExt.join(r,u);h!==c&&(e.dropAction==="copy"?a.push(o.copy(c,r)):a.push(In(o,c,h)))}Promise.all(a).catch(c=>{ve(this._trans._p("showErrorMessage","Error while copying/moving files"),c)})}_startDrag(e,t,n){let i=Object.keys(this.selection);const r=this._items[e],o=this._sortedItems;let a,l;if(!r.classList.contains(ut))l=o[e],i=[l.path],a=[l];else{const h=i[0];l=o.find(m=>m.path===h),a=this.selectedItems()}if(!l)return;const c=this._manager.registry.getFileTypeForModel(l),d=this.renderer.createDragImage(r,i.length,this._trans,c);this._drag=new Ts({dragImage:d,mimeData:new Kr,supportedActions:"move",proposedAction:"move"}),this._drag.mimeData.setData(yn,i);const u=this.model.manager.services;for(const h of a)this._drag.mimeData.setData(Fg,{model:h,withContent:async()=>await u.contents.get(h.path)});if(l.type!=="directory"){const h=i.slice(1).reverse();this._drag.mimeData.setData(jg,()=>{if(!l)return;const m=l.path;let _=this._manager.findWidget(m);if(_||(_=this._manager.open(l.path)),h.length){const b=new it;b.promise.then(()=>{let g=_;h.forEach(p=>{const w={ref:g?.id,mode:"tab-after"};g=this._manager.openOrReveal(p,void 0,void 0,w),this._manager.openOrReveal(l.path)})}),b.resolve(void 0)}return _})}document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0),clearTimeout(this._selectTimer),this._drag.start(t,n).then(h=>{this._drag=null,clearTimeout(this._selectTimer)})}handleFileSelect(e){const t=this._sortedItems,n=le.hitTestNodes(this._items,e);if(clearTimeout(this._selectTimer),n===-1)return;this._softSelection="";const i=t[n].path,r=Object.keys(this.selection),o=e.button===0&&!(vn&&e.ctrlKey)&&this.isWithinCheckboxHitArea(e);if(vn&&e.metaKey||!vn&&e.ctrlKey||o)this.selection[i]?delete this.selection[i]:this.selection[i]=!0,this._selectionChanged.emit(),this._focusItem(n);else if(e.shiftKey)this._handleMultiSelect(n),this._focusItem(n);else if(i in this.selection&&r.length>1)this._softSelection=i;else return this._selectItem(n,!1,!0);this.update()}_focusItem(e){var t,n;const i=this._items;if(i.length===0){this._focusIndex=0,this._focusPath="",this.node.focus();return}const r=Math.min(Math.max(e,0),i.length-1);this._focusIndex=r,this._focusPath=(n=(t=this._sortedItems[r])===null||t===void 0?void 0:t.path)!==null&&n!==void 0?n:"";const o=i[r],a=this.renderer.getNameNode(o);a&&(a.tabIndex=0,a.focus())}_allSelectedBetween(e,t){if(e===t)return;const[n,i]=e<t?[e+1,t]:[t+1,e];return this._sortedItems.slice(n,i).reduce((r,o)=>r&&this.selection[o.path],!0)}_handleMultiSelect(e){const t=this._sortedItems,n=this._focusIndex,i=t[e];let r=!0;if(e===n){this.selection[i.path]||(this.selection[i.path]=!0,this._selectionChanged.emit());return}if(this.selection[i.path])if(Math.abs(e-n)===1){const l=t[n],c=t[n+(e<n?1:-1)];this.selection[l.path]&&(!c||!this.selection[c.path])&&(delete this.selection[l.path],this._selectionChanged.emit())}else this._allSelectedBetween(n,e)&&(r=!1);const o=n<e?1:-1;let a=!1;for(let l=n;l!==e+o;l+=o)if(r){if(l===n)continue;this.selection[t[l].path]||(this.selection[t[l].path]=!0,a=!0)}else{if(l===e)continue;this.selection[t[l].path]&&(delete this.selection[t[l].path],a=!0)}a&&this._selectionChanged.emit()}_copy(){this._clipboard.length=0;for(const e of this.selectedItems())this._clipboard.push(e.path);this._clipboardRevision++}async _delete(e){await Promise.all(e.map(t=>this._model.manager.deleteFile(t).catch(n=>{ve(this._trans._p("showErrorMessage","Delete Failed"),n)})))}async _doRename(){this._inRename=!0;const e=Object.keys(this.selection);if(e.length===0)return this._inRename=!1,Promise.resolve("");const t=this._sortedItems;let{path:n}=t[this._focusIndex];this.selection[n]||(n=e.slice(-1)[0]);const i=Y.findFirstIndex(t,u=>u.path===n),r=this._items[i],o=t[i],a=this.renderer.getNameNode(r),l=o.name;this._editNode.value=l,this._selectItem(i,!1,!0);const c=await le.userInputForRename(a,this._editNode,l);if(this.isDisposed)throw this._inRename=!1,new Error("File browser is disposed.");let d=c;if(!c||c===l)d=l;else if(!ca(c))ve(this._trans.__("Rename Error"),Error(this._trans._p("showErrorMessage",'"%1" is not a valid name for a file. Names must have nonzero length, and cannot include "/", "\\", or ":"',c))),d=l;else{const u=this._manager,h=O.PathExt.join(this._model.path,l),m=O.PathExt.join(this._model.path,c);try{await In(u,h,m)}catch(_){_!=="File not renamed"&&ve(this._trans._p("showErrorMessage","Rename Error"),_),d=l}if(this.isDisposed)throw this._inRename=!1,new Error("File browser is disposed.")}if(!this.isDisposed&&Object.keys(this.selection).length===1&&this.selection[o.path])try{await this._selectItemByName(d,!0,!0)}catch{console.warn("After rename, failed to select file",d)}return this._inRename=!1,d}_selectItem(e,t,n=!0){const i=this._sortedItems;t||this.clearSelectedItems();const r=i[e].path;this.selection[r]=!0,this._selectionChanged.emit(),n&&this._focusItem(e),this.update()}_onModelRefreshed(){const e=Object.keys(this.selection);this.clearSelectedItems(!1);for(const t of this._model.items()){const n=t.path;e.indexOf(n)!==-1&&(this.selection[n]=!0)}this.isVisible?this.sort(this.sortState):this._isDirty=!0}_onPathChanged(){const e=this.node.contains(document.activeElement);this.clearSelectedItems(),this.sort(this.sortState),requestAnimationFrame(()=>{this.isDisposed||(e?this._focusItem(0):this._focusIndex=0)})}_onFileChanged(e,t){const n=t.newValue;if(!n)return;const i=n.name;t.type!=="new"||!i||this.selectItemByName(i).catch(()=>{})}_onActivateRequested(e,t){if(O.PathExt.dirname(t)!==this._model.path)return;const i=O.PathExt.basename(t);this.selectItemByName(i).catch(()=>{})}}(function(s){s.columns=[{id:"is_selected",className:It,itemClassName:It,minWidth:18,resizable:!1,sortable:!1,grow:0},{id:"name",className:Og,itemClassName:ms,minWidth:60,resizable:!0,sortable:!0,caretSide:"right",grow:3},{id:"last_modified",className:ha,itemClassName:Jt,minWidth:60,resizable:!0,sortable:!0,caretSide:"left",grow:1},{id:"date_created",className:fa,itemClassName:Yt,minWidth:60,resizable:!0,sortable:!0,caretSide:"left",grow:1},{id:"file_size",className:kg,itemClassName:ps,minWidth:60,resizable:!0,sortable:!0,caretSide:"left",grow:.5}];class e{constructor(){this.itemFactories={name:()=>{const n=document.createElement("span"),i=document.createElement("span"),r=document.createElement("span");return i.className=gn,r.className=Gt,n.className=ms,n.appendChild(i),n.appendChild(r),n},last_modified:()=>{const n=document.createElement("span");return n.className=Jt,n},file_size:()=>{const n=document.createElement("span");return n.className=ps,n},date_created:()=>{const n=document.createElement("span");return n.className=Yt,n},is_selected:()=>this.createCheckboxWrapperNode()},this._modifiedColumnLastUpdate=new WeakMap,this._createdColumnLastUpdate=new WeakMap,this._lastRenderedState=new WeakMap}createNode(){const n=document.createElement("div"),i=document.createElement("div"),r=document.createElement("ul");return r.setAttribute("data-lm-dragscroll","true"),r.className=Rt,i.className=Bs,n.appendChild(i),n.appendChild(r),n.tabIndex=-1,n}populateHeaderNode(n,i,r,o,a){i=i||se;const l=i.load("jupyterlab"),c={name:()=>this.createHeaderItemNode(l.__("Name")),last_modified:()=>this._createHeaderItemNodeWithSizes({small:l.__("Modified"),large:l.__("Last Modified")}),file_size:()=>this._createHeaderItemNodeWithSizes({small:l.__("Size"),large:l.__("File Size")}),date_created:()=>this._createHeaderItemNodeWithSizes({small:l.__("Created"),large:l.__("Date Created")}),is_selected:()=>this.createCheckboxWrapperNode({alwaysVisible:!0,headerNode:!0})},d=s.columns.filter(u=>u.id==="name"||!r?.has(u.id));for(const u of d){const h=c[u.id],m=h();m.classList.add(u.className);const _=u.id===d[d.length-1].id;if(o){const b=o[u.id];_||(m.style.width=b+"px")}if(n.appendChild(m),le.isResizable(u)&&!_){const b=document.createElement("div");b.classList.add(On),b.dataset.column=u.id,n.appendChild(b)}}this._updateSortIndicator(n,a??{direction:"ascending",key:"name"})}handleHeaderClick(n,i){const r=i.target,o=s.columns.filter(le.isSortable);for(const a of o){const l=n.querySelector(`.${a.className}`);if(l&&l.contains(r)){const c=l.classList.contains(ut),d=l.classList.contains(bn);let u="ascending";c&&!d&&(u="descending");const h={direction:u,key:a.id};return this._updateSortIndicator(n,h),h}}return{direction:"ascending",key:"name"}}_updateSortIndicator(n,i){const r=s.columns.filter(le.isSortable);for(const o of r){const a=n.querySelector(`.${o.className}`);if(!a)continue;const l=q.findElement(a,Ln);o.id===i.key?(a.classList.add(ut),i.direction==="descending"?(a.classList.add(bn),le.updateCaret(l,o.caretSide,"down")):(a.classList.remove(bn),le.updateCaret(l,o.caretSide,"up"))):(a.classList.remove(ut),a.classList.remove(bn),le.updateCaret(l,o.caretSide))}}createItemNode(n,i){const r=document.createElement("li");for(const o of s.columns){if(o.id!="name"&&n?.has(o.id))continue;const a=this.itemFactories[o.id],l=a();if(r.appendChild(l),i){const c=i[o.id];l.style.width=c+"px"}}return r}createCheckboxWrapperNode(n){const i=document.createElement("label");i.classList.add(It);const r=document.createElement("input");return r.type="checkbox",n?.headerNode||r.addEventListener("click",o=>{o.preventDefault()}),n?.alwaysVisible?i.classList.add("jp-mod-visible"):r.tabIndex=-1,i.appendChild(r),i}updateItemModified(n,i,r){this._updateItemDate(n,i,r,this._modifiedColumnLastUpdate)}updateItemCreated(n,i,r){this._updateItemDate(n,i,r,this._createdColumnLastUpdate)}_updateItemDate(n,i,r,o){const a=o.get(n);if(a?.date===i&&a?.style===r)return;const l=new Date(i);n.textContent=O.Time.formatHuman(l,r),n.title=O.Time.format(l),o.set(n,{date:i,style:r})}updateItemNode(n,i,r,o,a,l,c,d,u){var h;l&&n.classList.add(ut),r=r||Fe.getDefaultTextFileType(o);const{icon:m,iconClass:_,name:b}=r;o=o||se;const g=o.load("jupyterlab"),p=this._lastRenderedState.get(n),w=JSON.stringify({name:i.name,selected:l,lastModified:i.last_modified,created:i.created,modifiedStyle:c,createdStyle:u,hiddenColumns:Array.from(a??[]).sort(),columnsSizes:d,fileSize:i.size}),v=q.findElement(n,It),y=v?.querySelector('input[type="checkbox"]');if(y&&(y.checked=l??!1),p===w)return;this._lastRenderedState.set(n,w);const C=q.findElement(n,gn),E=q.findElement(n,Gt),x=q.findElement(n,ms);let S=q.findElement(n,Jt),A=q.findElement(n,ps),I=q.findElement(n,Yt);const P=!a?.has("is_selected");if(v&&!P)n.removeChild(v);else if(P&&!v){const z=this.createCheckboxWrapperNode();x.insertAdjacentElement("beforebegin",z)}const M=!a?.has("last_modified");S&&!M?(n.removeChild(S),S=void 0):M&&!S&&(S=this.itemFactories.last_modified(),x.insertAdjacentElement("afterend",S));const j=!a?.has("date_created");I&&!j?(n.removeChild(I),I=void 0):j&&!I&&(I=this.itemFactories.date_created(),(S??x).insertAdjacentElement("afterend",I));const H=!a?.has("file_size");if(A&&!H)n.removeChild(A);else if(H&&!A){A=this.itemFactories.file_size();const z=(h=I??S)!==null&&h!==void 0?h:x;z&&z.insertAdjacentElement("afterend",A)}requestAnimationFrame(()=>{Bt.resolveElement({icon:m,iconClass:xt(_,"jp-Icon"),container:C,className:gn,stylesheet:"listing"})});let $=g.__("Name: %1",i.name);if(i.size!==null&&i.size!==void 0){const z=dr(i.size,1,1024);A&&(A.textContent=z),$+=g.__(`
419
+ `,O.Time.format(i.last_modified))+t.__("Last Checkpoint: %1",a),e.title.caption=l})}async onClose(e){var t;const[n,i]=await this._maybeClose(e,this.translator);if(e.isDisposed)return!0;if(n){const r=oe.contextProperty.get(e);if(!i){if(!r)return!0;if(!((t=r.contentsModel)===null||t===void 0)&&t.writable)await r.save();else if(!await r.saveAs())return!1}if(r&&(await Promise.race([r.ready,new Promise(a=>setTimeout(a,3e3,"timeout"))])==="timeout"?console.warn("Could not record the widget as recently closed because the context did not become ready in 3 seconds"):this._recordAsRecentlyClosed(e,r.contentsModel)),e.isDisposed)return!0;e.dispose()}return n}onDelete(e){return e.dispose(),Promise.resolve(void 0)}_recordAsRecentlyOpened(e,t){var n;const i=this._recentsManager;if(!i)return;const r=t.path,a=this._registry.getFileTypeForModel(t).contentType,l=(n=oe.factoryProperty.get(e))===null||n===void 0?void 0:n.name;if(i.addRecent({path:r,contentType:a,factory:l},"opened"),a!=="directory"){const c=r.lastIndexOf("/")>0?r.slice(0,r.lastIndexOf("/")):"";i.addRecent({path:c,contentType:"directory"},"opened")}}_recordAsRecentlyClosed(e,t){var n;const i=this._recentsManager;if(!i)return;const r=t.path,a=this._registry.getFileTypeForModel(t).contentType,l=(n=oe.factoryProperty.get(e))===null||n===void 0?void 0:n.name;i.addRecent({path:r,contentType:a,factory:l},"closed")}async _maybeClose(e,t){var n,i,r;t=t||se;const o=oe.contextProperty.get(e);if(!o)return Promise.resolve([!0,!0]);let a=oe.widgetsProperty.get(o);if(!a)return Promise.resolve([!0,!0]);a=a.filter(h=>{const m=oe.factoryProperty.get(h);return m?m.readOnly===!1:!1});const l=e.title.label,c=oe.factoryProperty.get(e),d=o.model.dirty&&a.length<=1&&!(!((n=c?.readOnly)!==null&&n!==void 0)||n),u=(i=this._dialogs)!==null&&i!==void 0?i:new aa({translator:t});if(this.confirmClosingDocument){const{shouldClose:h,ignoreSave:m,doNotAskAgain:_}=await u.confirmClose({fileName:l,isDirty:d});return _&&(this.confirmClosingDocument=!1),Promise.resolve([h,m])}else{if(!d)return Promise.resolve([!0,!0]);const h=await u?.saveBeforeClose({fileName:l,writable:(r=o.contentsModel)===null||r===void 0?void 0:r.writable});return[h.shouldClose,h.ignoreSave]}}_widgetDisposed(e){const t=oe.contextProperty.get(e);if(!t)return;const n=oe.widgetsProperty.get(t);n&&(Y.removeFirstOf(n,e),n.length||t.dispose())}_onWidgetDisposed(e){oe.disposablesProperty.get(e).dispose()}_onFileChanged(e){const t=oe.widgetsProperty.get(e);for(const n of t)this.setCaption(n)}_onPathChanged(e){const t=oe.widgetsProperty.get(e);for(const n of t)this.setCaption(n)}}var oe;(function(s){s.contextProperty=new Ct({name:"context",create:()=>{}}),s.factoryProperty=new Ct({name:"factory",create:()=>{}}),s.widgetsProperty=new Ct({name:"widgets",create:()=>[]}),s.disposablesProperty=new Ct({name:"disposables",create:()=>new Yr})})(oe||(oe={}));class wg{constructor(e){var t,n;this._activateRequested=new U(this),this._contexts=[],this._isDisposed=!1,this._autosave=!0,this._autosaveInterval=120,this._lastModifiedCheckMargin=500,this._renameUntitledFileOnSave=!0,this._stateChanged=new U(this),this.translator=e.translator||se,this.registry=e.registry,this.services=e.manager,this._docManagerDialogs=(t=e.docManagerDialogs)!==null&&t!==void 0?t:new aa({translator:this.translator}),this._dialogs=(n=e.sessionDialogs)!==null&&n!==void 0?n:new Gr({translator:e.translator}),this._isConnectedCallback=e.isConnectedCallback||(()=>!0),this._opener=e.opener,this._when=e.when||e.manager.ready;const i=new vg({registry:this.registry,translator:this.translator,recentsManager:e.recentsManager,dialogs:this._docManagerDialogs});i.activateRequested.connect(this._onActivateRequested,this),i.stateChanged.connect(this._onWidgetStateChanged,this),this._widgetManager=i,this._setBusy=e.setBusy,this._urlResolverFactory=e.urlResolverFactory}get activateRequested(){return this._activateRequested}get autosave(){return this._autosave}set autosave(e){if(this._autosave!==e){const t=this._autosave;this._autosave=e,this._contexts.forEach(n=>{const i=nn.saveHandlerProperty.get(n);i&&(e===!0&&!i.isActive?i.start():e===!1&&i.isActive&&i.stop())}),this._stateChanged.emit({name:"autosave",oldValue:t,newValue:e})}}get autosaveInterval(){return this._autosaveInterval}set autosaveInterval(e){if(this._autosaveInterval!==e){const t=this._autosaveInterval;this._autosaveInterval=e,this._contexts.forEach(n=>{const i=nn.saveHandlerProperty.get(n);i&&(i.saveInterval=e||120)}),this._stateChanged.emit({name:"autosaveInterval",oldValue:t,newValue:e})}}get confirmClosingDocument(){return this._widgetManager.confirmClosingDocument}set confirmClosingDocument(e){if(this._widgetManager.confirmClosingDocument!==e){const t=this._widgetManager.confirmClosingDocument;this._widgetManager.confirmClosingDocument=e,this._stateChanged.emit({name:"confirmClosingDocument",oldValue:t,newValue:e})}}get lastModifiedCheckMargin(){return this._lastModifiedCheckMargin}set lastModifiedCheckMargin(e){if(this._lastModifiedCheckMargin!==e){const t=this._lastModifiedCheckMargin;this._lastModifiedCheckMargin=e,this._contexts.forEach(n=>{n.lastModifiedCheckMargin=e}),this._stateChanged.emit({name:"lastModifiedCheckMargin",oldValue:t,newValue:e})}}get renameUntitledFileOnSave(){return this._renameUntitledFileOnSave}set renameUntitledFileOnSave(e){if(this._renameUntitledFileOnSave!==e){const t=this._renameUntitledFileOnSave;this._renameUntitledFileOnSave=e,this._stateChanged.emit({name:"renameUntitledFileOnSave",oldValue:t,newValue:e})}}get stateChanged(){return this._stateChanged}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,U.clearData(this),this._contexts.forEach(e=>this._widgetManager.closeWidgets(e)),this._widgetManager.dispose(),this._contexts.length=0)}cloneWidget(e){return this._widgetManager.cloneWidget(e)}closeAll(){return Promise.all(this._contexts.map(e=>this._widgetManager.closeWidgets(e))).then(()=>{})}closeFile(e){const t=this._contextsForPath(e).map(n=>this._widgetManager.closeWidgets(n));return Promise.all(t).then(n=>{})}contextForWidget(e){return this._widgetManager.contextForWidget(e)}copy(e,t){return this.services.contents.copy(e,t)}createNew(e,t="default",n){return this._createOrOpenDocument("create",e,t,n)}deleteFile(e){return this.services.sessions.stopIfNeeded(e).then(()=>this.services.contents.delete(e)).then(()=>(this._contextsForPath(e).forEach(t=>this._widgetManager.deleteWidgets(t)),Promise.resolve(void 0)))}duplicate(e){const t=O.PathExt.dirname(e);return this.services.contents.copy(e,t)}findWidget(e,t="default"){const n=O.PathExt.normalize(e);let i=[t];if(t==="default"){const r=this.registry.defaultWidgetFactory(n);if(!r)return;i=[r.name]}else t===null&&(i=this.registry.preferredWidgetFactories(n).map(r=>r.name));for(const r of this._contextsForPath(n))for(const o of i)if(o!==null){const a=this._widgetManager.findWidget(r,o);if(a)return a}if(t===null)for(const r of this._contextsForPath(n)){const o=this._widgetManager.findWidget(r,null);if(o)return o}}newUntitled(e){return e.type==="file"&&(e.ext=e.ext||".txt"),this.services.contents.newUntitled(e)}open(e,t="default",n,i,r){return this._createOrOpenDocument("open",e,t,n,i,r)}openOrReveal(e,t=null,n,i,r){const o=this.findWidget(e,t);return o?(this._opener.open(o,{type:t||"default",...i}),o):this.open(e,t||"default",n,i??{},r)}async overwrite(e,t){const n=`${t}.${qr.uuid4()}`;await this.rename(e,n);try{return await this.deleteFile(t),await this.rename(n,t)}catch(i){throw await this.rename(n,e),i}}rename(e,t){return this.services.contents.rename(e,t)}_findContext(e,t){const n=this.services.contents.normalize(e);return je(this._contexts,i=>i.path===n&&i.factoryName===t)}_contextsForPath(e){const t=this.services.contents.normalize(e);return this._contexts.filter(n=>n.path===t)}_createContext(e,t,n,i){const r=(l,c)=>{this._widgetManager.adoptWidget(o,l),this._opener.open(l,c)},o=new Iu({opener:r,manager:this.services,factory:t,path:e,kernelPreference:n,setBusy:this._setBusy,sessionDialogs:this._dialogs,lastModifiedCheckMargin:this._lastModifiedCheckMargin,translator:this.translator,contentProviderId:i,urlResolverFactory:this._urlResolverFactory}),a=new yg({context:o,isConnectedCallback:this._isConnectedCallback,saveInterval:this.autosaveInterval});return nn.saveHandlerProperty.set(o,a),o.ready.then(()=>{this.autosave&&a.start()}),o.disposed.connect(this._onContextDisposed,this),this._contexts.push(o),o}_onContextDisposed(e){Y.removeFirstOf(this._contexts,e)}_widgetFactoryFor(e,t){const{registry:n}=this;if(t==="default"){const i=n.defaultWidgetFactory(e);if(!i)return;t=i.name}return n.getWidgetFactory(t)}_createOrOpenDocument(e,t,n="default",i,r,o){const a=this._widgetFactoryFor(t,n);if(!a)return;const l=a.modelName||"text",c=this.registry.getModelFactory(l);if(!c)return;const d={...this.registry.getKernelPreference(t,a.name,i),...o};let u,h=Promise.resolve(void 0);if(e==="open")u=this._findContext(t,c.name)||null,u||(u=this._createContext(t,c,d,a.contentProviderId),h=this._when.then(()=>u.initialize(!1)));else if(e==="create")u=this._createContext(t,c,d,a.contentProviderId),h=this._when.then(()=>u.initialize(!0));else throw new Error(`Invalid argument 'which': ${e}`);const m=this._widgetManager.createWidget(a,u);return this._opener.open(m,{type:a.name,...r}),h.catch(_=>{console.error(`Failed to initialize the context with '${c.name}' for ${t}`,_),m.close()}),m}_onActivateRequested(e,t){this._activateRequested.emit(t)}_onWidgetStateChanged(e,t){t.name==="confirmClosingDocument"&&this._stateChanged.emit(t)}}var nn;(function(s){s.saveHandlerProperty=new Ct({name:"saveHandler",create:()=>{}})})(nn||(nn={}));function da(s,e){if(!e)return!0;const t=O.PathExt.removeSlash(s),n=O.PathExt.removeSlash(e);return t===n||t.startsWith(n+"/")}const Cg=5e3,Eg="jp-PathNavigator",xg="jp-PathNavigator-suggestions";class Tg extends X{constructor(e){var t;super({node:document.createElement("span")}),this._closed=new U(this),this._isOpen=!1,this._suggestions=[],this._currentFilteredSuggestions=[],this._activeSuggestionIndex=-1,this._suggestionDirPath="",this._suggestionFetchTime=0,this._fetchId=0,this._submittedLocalPath=null,this.addClass(Eg),this._model=e.model,this._trans=((t=e.translator)!==null&&t!==void 0?t:se).load("jupyterlab"),this._inputNode=document.createElement("input"),this._inputNode.type="text",this._inputNode.placeholder=this._trans.__("Type a path…"),this._suggestionsNode=document.createElement("ul"),this._suggestionsNode.className=xg,this._suggestionsNode.style.display="none",this.node.appendChild(this._inputNode),this.node.appendChild(this._suggestionsNode),this._model.refreshed.connect(this._onModelRefreshed,this)}get closed(){return this._closed}dispose(){this.isDisposed||(this._model.refreshed.disconnect(this._onModelRefreshed,this),U.clearData(this),super.dispose())}open(){this._isOpen=!0;const t=this._model.manager.services.contents.localPath(this._model.path),n=t?t+"/":"";this._inputNode.value=n,requestAnimationFrame(()=>{!this._isOpen||this.isDisposed||(this._inputNode.focus(),this._inputNode.setSelectionRange(n.length,n.length))}),this._updateSuggestions(n)}onAfterAttach(e){super.onAfterAttach(e),this._inputNode.addEventListener("input",this),this._inputNode.addEventListener("keydown",this),this._inputNode.addEventListener("blur",this),this._suggestionsNode.addEventListener("mousedown",this)}onBeforeDetach(e){this._inputNode.removeEventListener("input",this),this._inputNode.removeEventListener("keydown",this),this._inputNode.removeEventListener("blur",this),this._suggestionsNode.removeEventListener("mousedown",this),super.onBeforeDetach(e)}handleEvent(e){switch(e.type){case"input":this._updateSuggestions(this._inputNode.value);break;case"keydown":this._evtKeydown(e);break;case"blur":this._close();break;case"mousedown":this._evtSuggestionMousedown(e);break}}_close(){!this._isOpen||this.isDisposed||(this._isOpen=!1,this._submittedLocalPath=null,this._suggestionsNode.style.display="none",this._closed.emit())}_commitNavigation(e){let t=e.endsWith("/")&&e.length>1?e.slice(0,-1):e;t.startsWith("/")||(t="/"+t),t=t.replace(/\/{2,}/g,"/"),this._submittedLocalPath=this._model.manager.services.contents.localPath(t||"/"),this._suggestionsNode.style.display="none",this._model.cd(t||"/").then(()=>this._close()).catch(n=>{this._submittedLocalPath=null,ve(this._trans.__("Open Error"),n),this._close()})}matchesSubmittedPath(e){return this._submittedLocalPath===e}async _updateSuggestions(e){if(!this._isOpen)return;const t=e.lastIndexOf("/"),n=t>=0?e.slice(0,t):"",i=n.startsWith("/")?n.slice(1):n,r=t>=0?e.slice(t+1):e,o=Date.now()-this._suggestionFetchTime>Cg;if(i!==this._suggestionDirPath||o){const d=++this._fetchId;try{const u=this._model.manager.services.contents,h=u.resolvePath(this._model.path,"/"+i),m=da(h,this._model.root)?await u.get(h,{content:!0}):null;if(d!==this._fetchId||!this._isOpen)return;this._suggestionDirPath=i,this._suggestionFetchTime=Date.now();const _=m?.type==="directory"?m.content:[];this._suggestions=_.filter(b=>b.type==="directory").map(b=>i?`${i}/${b.name}`:b.name)}catch{this._suggestionDirPath=i,this._suggestionFetchTime=Date.now(),this._suggestions=[]}}const a=r.toLowerCase(),l=r.startsWith(".")||"includeHiddenFiles"in this._model&&this._model.includeHiddenFiles,c=this._suggestions.filter(d=>{const u=d.slice(d.lastIndexOf("/")+1);return!l&&u.startsWith(".")?!1:u.toLowerCase().startsWith(a)});this._activeSuggestionIndex=-1,this._renderSuggestions(c.slice().sort((d,u)=>{const h=d.slice(d.lastIndexOf("/")+1),m=u.slice(u.lastIndexOf("/")+1);return h.localeCompare(m)}))}_renderSuggestions(e){if(this._suggestionsNode.replaceChildren(),this._currentFilteredSuggestions=e,e.length===0){this._suggestionsNode.style.display="none";return}for(const t of e){const n=document.createElement("li"),i=t.slice(t.lastIndexOf("/")+1);n.textContent=i,n.dataset.path=t,i.startsWith(".")&&(n.dataset.isDot=""),this._suggestionsNode.appendChild(n)}this._suggestionsNode.style.display=""}_evtKeydown(e){var t;switch(e.key){case"Enter":this._commitNavigation(this._inputNode.value);break;case"Escape":this._close();break;case"Tab":!((t=this._currentFilteredSuggestions)===null||t===void 0)&&t.length&&(e.preventDefault(),this._acceptSuggestion());break;case"ArrowDown":e.preventDefault(),this._navigateSuggestions(1);break;case"ArrowUp":e.preventDefault(),this._navigateSuggestions(-1);break}}_evtSuggestionMousedown(e){e.preventDefault();let t=e.target;for(;t&&t!==this._suggestionsNode;){if(t.tagName==="LI"){const n=t.dataset.path;n&&this._commitNavigation(n);return}t=t.parentElement}}_navigateSuggestions(e){const t=Array.from(this._suggestionsNode.children);if(t.length===0)return;this._activeSuggestionIndex>=0&&t[this._activeSuggestionIndex].classList.remove("jp-mod-active"),this._activeSuggestionIndex+=e,this._activeSuggestionIndex<0?this._activeSuggestionIndex=t.length-1:this._activeSuggestionIndex>=t.length&&(this._activeSuggestionIndex=0);const n=t[this._activeSuggestionIndex];n.classList.add("jp-mod-active"),n.scrollIntoView({block:"nearest"});const i=n.dataset.path;i&&(this._inputNode.value=i)}_acceptSuggestion(){const e=Array.from(this._suggestionsNode.children);if(this._activeSuggestionIndex>=0&&e[this._activeSuggestionIndex]){const t=e[this._activeSuggestionIndex].dataset.path;t&&(this._inputNode.value=t+"/",this._updateSuggestions(this._inputNode.value))}else if(this._currentFilteredSuggestions.length===1)this._inputNode.value=this._currentFilteredSuggestions[0]+"/",this._updateSuggestions(this._inputNode.value);else if(this._currentFilteredSuggestions.length>1){const t=this._currentFilteredSuggestions.map(i=>i.slice(i.lastIndexOf("/")+1));let n=t[0];for(const i of t.slice(1)){let r=0;for(;r<n.length&&r<i.length&&n[r]===i[r];)r++;n=n.slice(0,r)}if(n){const i=this._inputNode.value.lastIndexOf("/"),r=i>=0?this._inputNode.value.slice(0,i+1):"";this._inputNode.value=r+n,this._updateSuggestions(this._inputNode.value)}}}_onModelRefreshed(){this._suggestionFetchTime=0,this._isOpen&&this._updateSuggestions(this._inputNode.value)}}const nr="jp-BreadCrumbs",ct="jp-BreadCrumbs-home",yt="jp-BreadCrumbs-preferred",et="jp-BreadCrumbs-item",js="jp-BreadCrumbs-ellipsis",ua="jp-BreadCrumbs-separator",hs="application/x-jupyter-icontents",at="jp-mod-dropTarget",Sg="jp-BreadCrumbs-container",Pg="jp-BreadCrumbs-content",sr="jp-mod-editMode";class Ag extends X{constructor(e){var t,n;super(),this._previousState=null,this._cachedWidths=null,this._lastRenderedWidth=0,this._isEditMode=!1,this._lastPath="",this._restoreBreadcrumbFocusAfterUpdate=!1,this.translator=e.translator||se,this._trans=this.translator.load("jupyterlab"),this._model=e.model,this._fullPath=e.fullPath||!1,this._minimumLeftItems=(t=e.minimumLeftItems)!==null&&t!==void 0?t:0,this._minimumRightItems=(n=e.minimumRightItems)!==null&&n!==void 0?n:2,this._onPathEdited=e.onPathEdited,this._onPathActivated=e.onPathActivated,this.addClass(nr),this._crumbs=wt.createCrumbs();const i=O.PageConfig.getOption("preferredPath");this._hasPreferred=!!(i&&i!=="/"),this._crumbContainer=document.createElement("span"),this._crumbContainer.className=Sg,this._crumbContent=document.createElement("span"),this._crumbContent.className=Pg,this._crumbContainer.appendChild(this._crumbContent),this.node.appendChild(this._crumbContainer),this._model.refreshed.connect(this._onModelRefreshed,this),this._resizeThrottler=new Jl(()=>this._onResize(),50),this._resizeObserver=new ResizeObserver(r=>{const o=r[0];if(!o)return;const a=o.contentRect.width;this._lastRenderedWidth>0&&a<this._lastRenderedWidth?this._onResize():this._resizeThrottler.invoke()}),this._pathNavigator=new Tg({model:this._model,translator:e.translator}),this._pathNavigator.closed.connect(this._exitEditMode,this)}handleEvent(e){switch(e.type){case"keydown":this._evtKeyDown(e);break;case"click":this._evtClick(e);break;case"lm-dragenter":this._evtDragEnter(e);break;case"lm-dragleave":this._evtDragLeave(e);break;case"lm-dragover":this._evtDragOver(e);break;case"lm-drop":this._evtDrop(e);break;default:return}}get fullPath(){return this._fullPath}set fullPath(e){this._fullPath=e}get minimumLeftItems(){return this._minimumLeftItems}set minimumLeftItems(e){this._minimumLeftItems=e}get minimumRightItems(){return this._minimumRightItems}set minimumRightItems(e){this._minimumRightItems=e}dispose(){this.isDisposed||(this._model.refreshed.disconnect(this._onModelRefreshed,this),this._pathNavigator.closed.disconnect(this._exitEditMode,this),this._pathNavigator.dispose(),this._resizeObserver.disconnect(),this._resizeThrottler.dispose(),super.dispose())}onAfterAttach(e){super.onAfterAttach(e),this.update();const t=this.node;t.addEventListener("keydown",this),t.addEventListener("click",this),t.addEventListener("lm-dragenter",this),t.addEventListener("lm-dragleave",this),t.addEventListener("lm-dragover",this),this._resizeObserver.observe(t),t.addEventListener("lm-drop",this),X.attach(this._pathNavigator,this.node)}onBeforeDetach(e){X.detach(this._pathNavigator),super.onBeforeDetach(e);const t=this.node;t.removeEventListener("keydown",this),t.removeEventListener("click",this),t.removeEventListener("lm-dragenter",this),t.removeEventListener("lm-dragleave",this),t.removeEventListener("lm-dragover",this),t.removeEventListener("lm-drop",this),this._resizeObserver.unobserve(t)}onUpdateRequest(e){if(this._isEditMode)return;const n=this._model.manager.services.contents.localPath(this._model.path);this._lastPath=n,this._previousState&&this._previousState.path!==n&&(this._cachedWidths=null);const i=this._calculateAdaptiveItems(n),r={path:n,root:this._model.root,hasPreferred:this._hasPreferred,fullPath:this._fullPath,minimumLeftItems:i.left,minimumRightItems:i.right};this._previousState!==null&&jt.deepEqual(r,this._previousState)||(this._previousState=r,wt.updateCrumbs(this._crumbContent,this._crumbs,r),this._syncCrumbTabIndices()),this._runPostActivationFocus()}_runPostActivationFocus(){this._restoreBreadcrumbFocusAfterUpdate&&(this._restoreBreadcrumbFocusAfterUpdate=!1,requestAnimationFrame(()=>{var e;this.isDisposed||this._isEditMode||(e=this._onPathActivated)===null||e===void 0||e.call(this)}))}_getFocusableCrumbElements(){const e=[],t=this._crumbContent.children;for(let n=0;n<t.length;n++){const i=t[n];(i.classList.contains(yt)||i.classList.contains(ct)||i.classList.contains(et))&&e.push(i)}return e}_syncCrumbTabIndices(){const e=this._getFocusableCrumbElements();for(let t=0;t<e.length;t++)e[t].tabIndex=t===0?0:-1}_focusCrumb(e){const t=this._getFocusableCrumbElements(),n=t.indexOf(e);if(n!==-1){for(let i=0;i<t.length;i++)t[i].tabIndex=i===n?0:-1;e.focus()}}_focusTrailingCrumb(){const e=this._getFocusableCrumbElements();if(e.length===0){this.node.tabIndex=-1,this.node.focus();return}this._focusCrumb(e[e.length-1])}_resolveCrumbFromEventTarget(e){let t=e;for(;t&&t!==this.node;){if(t.classList.contains(yt)||t.classList.contains(ct)||t.classList.contains(et))return t;t=t.parentElement}return null}_isCurrentDirectoryCrumb(e){if(!e.classList.contains(et)||e.classList.contains(js))return!1;const n=this._model.manager.services.contents.localPath(this._model.path);return e.dataset.path===n}_activateCrumbSegment(e){this._focusCrumb(e);const t=this._destinationForCrumb(e);t&&(this._restoreBreadcrumbFocusAfterUpdate=!0,this._model.cd(t).catch(n=>{this._restoreBreadcrumbFocusAfterUpdate=!1,ve(this._trans.__("Open Error"),n)}))}_destinationForCrumb(e){if(e.classList.contains(yt)){const t=O.PageConfig.getOption("preferredPath");return t?"/"+t:"/"}return e.classList.contains(ct)?"/":e.classList.contains(et)?`/${e.dataset.path}`:null}_evtKeyDown(e){if(this._isEditMode)return;const t=e.key==="Enter"||e.key===" ",n=this._resolveCrumbFromEventTarget(e.target),i=this._model.manager.services.contents.localPath(this._model.path);if(t&&n&&this._crumbContent.contains(n)){const c=e.key===" "&&n.classList.contains(ct)&&i==="";this._isCurrentDirectoryCrumb(n)||c?this.enterEditMode():this._activateCrumbSegment(n),e.preventDefault(),e.stopPropagation();return}if(e.key!=="ArrowLeft"&&e.key!=="ArrowRight"||!n||!this._crumbContent.contains(n))return;const r=this._getFocusableCrumbElements(),o=r.indexOf(n);if(o===-1)return;const a=e.key==="ArrowLeft"?-1:1,l=o+a;l<0||l>=r.length||(this._focusCrumb(r[l]),e.preventDefault(),e.stopPropagation())}_evtClick(e){if(e.button!==0||this._isEditMode)return;let t=e.target;for(;t&&t!==this.node;){if(t.classList.contains(yt)||t.classList.contains(et)||t.classList.contains(ct)){this._activateCrumbSegment(t),e.preventDefault(),e.stopPropagation();return}t=t.parentElement}this.enterEditMode()}_evtDragEnter(e){if(e.mimeData.hasData(hs)){const t=this._getBreadcrumbElements();let n=-1,i=e.target;for(;i&&i!==this.node&&(n=t.indexOf(i),n===-1);)i=i.parentElement;if(n!==-1){const r=t[n],o=this._model.manager.services.contents.localPath(this._model.path);r.dataset.path!==o&&(r.classList.add(at),e.preventDefault(),e.stopPropagation())}}}_evtDragLeave(e){e.preventDefault(),e.stopPropagation();const t=q.findElement(this.node,at);t&&t.classList.remove(at)}_evtDragOver(e){e.preventDefault(),e.stopPropagation(),e.dropAction=e.proposedAction;const t=q.findElement(this.node,at);t&&t.classList.remove(at);const n=this._getBreadcrumbElements();let i=-1,r=e.target;for(;r&&r!==this.node&&(i=n.indexOf(r),i===-1);)r=r.parentElement;i!==-1&&n[i].classList.add(at)}_evtDrop(e){if(e.preventDefault(),e.stopPropagation(),e.proposedAction==="none"){e.dropAction="none";return}if(!e.mimeData.hasData(hs))return;e.dropAction=e.proposedAction;let t=e.target;for(;t&&t.parentElement;){if(t.classList.contains(at)){t.classList.remove(at);break}t=t.parentElement}let n=null;if(t.classList.contains(ct))n="/";else if(t.classList.contains(yt)){const l=O.PageConfig.getOption("preferredPath");n=l?"/"+l:"/"}else t.dataset.path&&(n=t.dataset.path);if(!n)return;const r=this._model.manager,o=[],a=e.mimeData.getData(hs);for(const l of a){const c=O.PathExt.basename(l),d=O.PathExt.join(n,c);o.push(In(r,l,d))}Promise.all(o).catch(l=>ve(this._trans.__("Move Error"),l))}_getBreadcrumbElements(){const e=[],t=this._crumbContent.children;for(let n=0;n<t.length;n++){const i=t[n];(i.classList.contains(et)||i.classList.contains(ct)||i.classList.contains(yt))&&!i.classList.contains(js)&&e.push(i)}return e}_onResize(){this.isDisposed||!this.isAttached||(this._previousState=null,this.update())}_measureAllItemWidths(e){const t=this._crumbContent,n=this._crumbs[wt.Crumb.Home],i=this._crumbs[wt.Crumb.Ellipsis],r=this._crumbs[wt.Crumb.Preferred],o=t.getElementsByClassName(ua),a=o.length>0?o[0]:null,l=document.createElement("div");l.style.position="absolute",l.style.visibility="hidden",l.style.height="0",l.style.overflow="hidden",l.style.whiteSpace="nowrap",l.className=nr,t.appendChild(l);const c=[];for(let d=0;d<e.length;d++){const u=document.createElement("span");u.className=et,u.textContent=e[d],l.appendChild(u);const h=u.getBoundingClientRect().width;c.push((h>0?h:Math.max(e[d].length*8,20))+4)}t.removeChild(l),this._cachedWidths={home:(n.getBoundingClientRect().width||22)+4,ellipsis:(i.getBoundingClientRect().width||28)+4,separator:a?.getBoundingClientRect().width||4,preferred:this._hasPreferred?(r.getBoundingClientRect().width||22)+4:0,itemWidths:c}}_calculateAdaptiveItems(e){this._lastRenderedWidth=0;const t=e.split("/").filter(E=>E!==""),n=t.length;if(this._fullPath||n===0)return{left:this._minimumLeftItems,right:this._minimumRightItems};const i=this._minimumLeftItems+this._minimumRightItems;if(n<=i)return{left:this._minimumLeftItems,right:this._minimumRightItems};const r=this.node.clientWidth;if(r===0)return{left:this._minimumLeftItems,right:this._minimumRightItems};(!this._cachedWidths||this._cachedWidths.itemWidths.length!==n)&&this._measureAllItemWidths(t);const o=this._cachedWidths.home,a=this._cachedWidths.separator,l=this._cachedWidths.ellipsis,c=this._cachedWidths.preferred,d=this._cachedWidths.itemWidths;let u=o+a;this._hasPreferred&&(u+=c);const h=r-u;let m=0;for(let E=0;E<n;E++)m+=d[E]+a;if(m<=h)return this._lastRenderedWidth=u+m,{left:n,right:0};const _=l+a,b=h-_;let g=0;for(let E=0;E<this._minimumLeftItems&&E<n;E++)g+=d[E]+a;const p=b-g;let w=0,v=0;for(let E=n-1;E>=this._minimumLeftItems;E--){const x=d[E]+a;if(v+x<=p)v+=x,w++;else break}const y=Math.max(w,this._minimumRightItems);let C=v;if(y>w){C=0;for(let E=n-y;E<n;E++)C+=d[E]+a}return this._lastRenderedWidth=u+_+g+C,{left:this._minimumLeftItems,right:y}}enterEditMode(){this._isEditMode=!0;const e=this._model.manager.services.contents;this._lastPath=e.localPath(this._model.path),this.node.classList.add(sr),this._previousState=null,this._pathNavigator.open()}focusLastCrumb(){requestAnimationFrame(()=>{this._focusTrailingCrumb()})}_exitEditMode(){this._isEditMode&&(this._isEditMode=!1,this.node.classList.remove(sr),this._previousState=null,this.update())}_onModelRefreshed(){var e;const n=this._model.manager.services.contents.localPath(this._model.path);if(this._isEditMode){(this._pathNavigator.matchesSubmittedPath(n)||n!==this._lastPath)&&(this._exitEditMode(),(e=this._onPathEdited)===null||e===void 0||e.call(this));return}this.update()}}var wt;(function(s){let e;(function(o){o[o.Home=0]="Home",o[o.Ellipsis=1]="Ellipsis",o[o.Preferred=2]="Preferred"})(e=s.Crumb||(s.Crumb={}));function t(o,a,l){const c=[],u=(l.root?l.root.split("/").filter(b=>b!==""):[]).length;l.root?c.push(r()):(l.hasPreferred&&c.push(a[s.Crumb.Preferred]),c.push(a[e.Home],r()));const h=l.path.split("/").filter(b=>b!==""),m=l.root?h.slice(u):h,_=u;if(!l.fullPath&&m.length>0){const b=l.minimumLeftItems,g=l.minimumRightItems;if(m.length>b+g){for(let E=0;E<b;E++){const x=_+E,S=h.slice(0,x+1).join("/");c.push(n(m[E],S)),c.push(r())}const p=b,w=m.length-g,v=m.slice(p,w),y=a[e.Ellipsis];y.title=v.join("/"),y.dataset.path=v.length>0?h.slice(0,_+w).join("/"):h.slice(0,_+b).join("/"),c.push(y,r());const C=m.length-g;for(let E=C;E<m.length;E++){const x=_+E,S=h.slice(0,x+1).join("/");c.push(n(m[E],S)),c.push(r())}}else for(let p=0;p<m.length;p++){const w=_+p,v=h.slice(0,w+1).join("/");c.push(n(m[p],v)),c.push(r())}}else if(l.fullPath&&m.length>0)for(let b=0;b<m.length;b++){const g=_+b,p=h.slice(0,g+1).join("/");c.push(n(m[b],p)),c.push(r())}o.replaceChildren(...c)}s.updateCrumbs=t;function n(o,a){const l=document.createElement("span");return l.className=et,l.textContent=o,l.title=a,l.dataset.path=a,l.tabIndex=-1,l}function i(){const o=Vr.element({className:ct,tag:"span",title:O.PageConfig.getOption("serverRoot")||"Jupyter Server Root",stylesheet:"breadCrumb"});o.dataset.path="/",o.tabIndex=-1;const a=Yl.element({className:`${et} ${js}`,tag:"span",stylesheet:"breadCrumb"});a.tabIndex=-1;const l=O.PageConfig.getOption("preferredPath"),c=l&&"/"+l,d=Xl.element({className:yt,tag:"span",title:c||"Jupyter Preferred Path",stylesheet:"breadCrumb"});return d.dataset.path=c||"/",d.tabIndex=-1,[o,a,d]}s.createCrumbs=i;function r(){const o=document.createElement("span");return o.className=ua,o.textContent="/",o}s.createCrumbSeparator=r})(wt||(wt={}));const Rg="jp-DirListing",Bs="jp-DirListing-header",ir="jp-DirListing-headerItem",fs="jp-DirListing-headerItemText",Ln="jp-DirListing-headerItemIcon",Rt="jp-DirListing-content",Ig="jp-DirListing-item",Gt="jp-DirListing-itemText",ms="jp-DirListing-itemName",gn="jp-DirListing-itemIcon",Jt="jp-DirListing-itemModified",ps="jp-DirListing-itemFileSize",Yt="jp-DirListing-itemCreated",It="jp-DirListing-checkboxWrapper",Lg="jp-DirListing-editor",Og="jp-id-name",ha="jp-id-modified",kg="jp-id-filesize",fa="jp-id-created",yn="application/x-jupyter-icontents",Fg="application/x-jupyter-icontentsrich",lt="jp-mod-dropTarget",ut="jp-mod-selected",Mg="jp-DragIcon",On="jp-DirListing-resizeHandle",Dg="jp-mod-clipboard",_s="jp-mod-cut",rr="jp-mod-multiSelected",or="jp-mod-running",ar="jp-mod-active",bn="jp-mod-descending",Ng=1e3,lr=5,cr=5,vn=!!navigator.platform.match(/Mac/i),jg="application/vnd.lumino.widget-factory";class Ue extends X{constructor(e){var t;super({node:(e.renderer||Ue.defaultRenderer).createNode()}),this._items=[],this._sortedItems=[],this._sortState={direction:"ascending",key:"name"},this._onItemOpened=new U(this),this._selectionChanged=new U(this),this._drag=null,this._dragData=null,this._resizeData=null,this._selectTimer=-1,this._isCut=!1,this._prevPath="",this._clipboard=[],this._clipboardRevision=0,this._softSelection="",this.selection=Object.create(null),this._searchPrefix="",this._searchPrefixTimer=-1,this._inRename=!1,this._isDirty=!1,this._hiddenColumns=new Set,this._columnSizes={name:null,file_size:null,is_selected:null,last_modified:null,date_created:null},this._sortNotebooksFirst=!1,this._sortFileNamesNaturally=!0,this._allowSingleClick=!1,this._allowDragDropUpload=!0,this._focusIndex=0,this._focusPath="",this._modifiedStyle="short",this._createdStyle="short",this._allUploaded=new U(this),this._width=null,this._state=null,this._contentScrollbarWidth=0,this._contentSizeObserver=new ResizeObserver(this._onContentResize.bind(this)),this._paddingWidth=0,this._handleWidth=lr,this._lastRenderedState=new WeakMap,this.addClass(Rg),this.translator=e.translator||se,this._trans=this.translator.load("jupyterlab"),this._model=e.model,this._model.fileChanged.connect(this._onFileChanged,this),this._model.refreshed.connect(this._onModelRefreshed,this),this._model.pathChanged.connect(this._onPathChanged,this),this._editNode=document.createElement("input"),this._editNode.className=Lg,this._manager=this._model.manager,this._renderer=e.renderer||Ue.defaultRenderer,this._state=e.state||null,this._allowDragDropUpload=(t=e.allowDragDropUpload)!==null&&t!==void 0?t:!0,this._handleOpenFile=e.handleOpenFile||(i=>{this._manager.openOrReveal(i)}),this._updateModifiedSize(this.node),this._updateCreatedSize(this.node);const n=q.findElement(this.node,Bs);this._hiddenColumns.add("file_size"),this._hiddenColumns.add("date_created"),this._renderer.populateHeaderNode(n,this.translator,this._hiddenColumns,this._columnSizes),this._manager.activateRequested.connect(this._onActivateRequested,this)}dispose(){this._items.length=0,this._sortedItems.length=0,this._clipboard.length=0,super.dispose()}get model(){return this._model}get headerNode(){return q.findElement(this.node,Bs)}get contentNode(){return q.findElement(this.node,Rt)}get renderer(){return this._renderer}get sortState(){return this._sortState}get onItemOpened(){return this._onItemOpened}get selectionChanged(){return this._selectionChanged}selectedItems(){const e=this._sortedItems;return Mn(e,t=>this.selection[t.path])}sortedItems(){return this._sortedItems[Symbol.iterator]()}sort(e){this._sortedItems=le.sort(this.model.items(),e,this._sortNotebooksFirst,this._sortFileNamesNaturally,this.translator),this._sortState=e,this.update(),this._saveState()}rename(){return this._doRename()}cut(){this._isCut=!0,this._copy(),this.update()}copy(){this._isCut=!1,this._copy()}async paste(){if(!this._clipboard.length){this._isCut=!1;return}const e=this._model.path,t=this._isCut,n=[...this._clipboard],i=this._clipboardRevision;for(const c of this._items)c.classList.remove(_s);this._clipboard.length=0,this._isCut=!1,this.removeClass(Dg);const r=n.map(async c=>{if(t){const u=this._manager.services.contents.localPath(c).split("/"),h=u[u.length-1],m=O.PathExt.join(e,h);m!==c&&await In(this._manager,c,m)}else await this._model.manager.copy(c,e);return c}),o=await Promise.all(r.map(async c=>{try{return{status:"fulfilled",value:await c}}catch(d){return{status:"rejected",reason:d}}})),a=new Set,l=[];for(const c of o)c.status==="fulfilled"?a.add(c.value):c.reason!=="File not renamed"&&l.push(c.reason);this._clipboardRevision===i&&(this._clipboard=n.filter(c=>!a.has(c)),this._isCut=t&&this._clipboard.length>0),l.length>0&&ve(this._trans._p("showErrorMessage","Paste Error"),l[0]instanceof Error?l[0]:String(l[0]))}async delete(){const e=O.PageConfig.getOption("delete_to_trash")==="true",t=this._sortedItems.filter(_=>this.selection[_.path]);if(!t.length)return;const n=this._trans.__("Are you sure you want to move to trash: %1?",t[0].name),i=this._trans.__("Are you sure you want to permanently delete: %1?",t[0].name),r=this._trans._n("Are you sure you want to move to trash the %1 selected item?","Are you sure you want to move to trash the %1 selected items?",t.length),o=this._trans._n("Are you sure you want to permanently delete the %1 selected item?","Are you sure you want to permanently delete the %1 selected items?",t.length),a=e?n:i,l=e?r:o,c=e?this._trans.__("Move to Trash"):this._trans.__("Delete"),d=t.length===1?a:l,u=await ft({title:c,body:d,buttons:[_e.cancelButton({label:this._trans.__("Cancel")}),_e.warnButton({label:c})],defaultButton:0});!this.isDisposed&&u.button.accept&&await this._delete(t.map(_=>_.path));let h=this._focusIndex;const m=this._sortedItems.length-t.length-1;h>m&&(h=Math.max(0,m)),this._focusItem(h)}duplicate(){const e=this._model.path,t=[];for(const n of this.selectedItems())n.type!=="directory"&&t.push(this._model.manager.copy(n.path,e));return Promise.all(t).then(()=>{}).catch(n=>{ve(this._trans._p("showErrorMessage","Duplicate file"),n)})}async selectAll(){const e=this._model.items(),t={};for(const n of e)t[n.path]=!0;this.selection=t,this._selectionChanged.emit(),this.update()}async download(){await Promise.all(Array.from(this.selectedItems()).filter(e=>e.type!=="directory").map(e=>this._model.download(e.path)))}async restore(e){const t=`file-browser-${e}:columns`,n=this._state;if(this._stateColumnsKey=t,!!n)try{const i=await n.fetch(t);if(!i)return;const r=i.sizes,o=i.sortState;if(o&&(this._sortState=o),r){for(const[a,l]of Object.entries(r))this._columnSizes[a]=l;this._updateColumnSizes()}o&&(this._sortedItems=le.sort(this.model.items(),o,this._sortNotebooksFirst,this._sortFileNamesNaturally,this.translator),this.headerNode.innerHTML="",this._renderer.populateHeaderNode(this.headerNode,this.translator,this._hiddenColumns,this._columnSizes,o),this.update())}catch{await n.remove(t)}}_saveState(){this._state&&this._stateColumnsKey&&this._state.save(this._stateColumnsKey,{sizes:this._columnSizes,sortState:{...this._sortState}})}shutdownKernels(){const e=this._model,t=this._sortedItems,n=t.map(r=>r.path),i=Array.from(this._model.sessions()).filter(r=>{const o=Y.firstIndexOf(n,r.path);return this.selection[t[o].path]}).map(r=>e.manager.services.sessions.shutdown(r.id));return Promise.all(i).then(()=>{}).catch(r=>{ve(this._trans._p("showErrorMessage","Shut down kernel"),r)})}selectNext(e=!1){let t=-1;const n=Object.keys(this.selection),i=this._sortedItems;if(n.length===1||e){const r=n[n.length-1];t=Y.findFirstIndex(i,o=>o.path===r),t+=1,t===this._items.length&&(t=0)}else if(n.length===0)t=0;else{const r=n[n.length-1];t=Y.findFirstIndex(i,o=>o.path===r)}t!==-1&&(this._selectItem(t,e),Kt.scrollIntoViewIfNeeded(this.contentNode,this._items[t]))}selectPrevious(e=!1){let t=-1;const n=Object.keys(this.selection),i=this._sortedItems;if(n.length===1||e){const r=n[0];t=Y.findFirstIndex(i,o=>o.path===r),t-=1,t===-1&&(t=this._items.length-1)}else if(n.length===0)t=this._items.length-1;else{const r=n[0];t=Y.findFirstIndex(i,o=>o.path===r)}t!==-1&&(this._selectItem(t,e),Kt.scrollIntoViewIfNeeded(this.contentNode,this._items[t]))}selectByPrefix(){const e=this._searchPrefix.toLowerCase(),t=this._sortedItems,n=Y.findFirstIndex(t,i=>i.name.toLowerCase().substr(0,e.length)===e);n!==-1&&(this._selectItem(n,!1),Kt.scrollIntoViewIfNeeded(this.contentNode,this._items[n]))}isSelected(e){const t=this._sortedItems;return Array.from(Mn(t,n=>n.name===e&&this.selection[n.path])).length!==0}modelForClick(e){const t=this._sortedItems,n=le.hitTestNodes(this._items,e);if(n!==-1)return t[n]}clearSelectedItems(e=!0){this.selection=Object.create(null),e&&this._selectionChanged.emit()}_focusContent(){const e=this._sortedItems;if(e.length===0){this._focusItem(0);return}let t=this._focusPath!==""?Y.findFirstIndex(e,n=>n.path===this._focusPath):-1;t===-1&&(t=Math.min(Math.max(this._focusIndex,0),e.length-1)),this._selectItem(t,!1,!0)}onActivateRequest(e){this._focusContent()}async selectItemByName(e,t=!1){return this._selectItemByName(e,t)}async _selectItemByName(e,t=!1,n=!1){if(!n&&this.isSelected(e))return;if(await this.model.refresh(),this.isDisposed)throw new Error("File browser is disposed.");const i=this._sortedItems,r=Y.findFirstIndex(i,o=>o.name===e);if(r===-1)throw new Error("Item does not exist.");this._selectItem(r,!1,t),Ie.sendMessage(this,X.Msg.UpdateRequest),Kt.scrollIntoViewIfNeeded(this.contentNode,this._items[r])}handleEvent(e){switch(e.type){case"mousedown":this._evtMousedown(e);break;case"mouseup":this._evtMouseup(e);break;case"mousemove":this._evtMousemove(e);break;case"keydown":this.evtKeydown(e);break;case"click":this._evtClick(e);break;case"dblclick":this.evtDblClick(e);break;case"dragenter":case"dragover":this._allowDragDropUpload&&this.addClass("jp-mod-native-drop"),e.preventDefault();break;case"dragleave":case"dragend":this.removeClass("jp-mod-native-drop");break;case"drop":this.removeClass("jp-mod-native-drop"),this.evtNativeDrop(e);break;case"scroll":this._evtScroll(e);break;case"lm-dragenter":this.evtDragEnter(e);break;case"lm-dragleave":this.evtDragLeave(e);break;case"lm-dragover":this.evtDragOver(e);break;case"lm-drop":this.evtDrop(e);break}}onAfterAttach(e){super.onAfterAttach(e);const t=this.node;this._width=this._computeContentWidth();const n=q.findElement(t,Rt);t.addEventListener("mousedown",this),t.addEventListener("keydown",this),t.addEventListener("click",this),t.addEventListener("dblclick",this),this._contentSizeObserver.observe(n),n.addEventListener("dragenter",this),n.addEventListener("dragover",this),n.addEventListener("dragleave",this),n.addEventListener("dragend",this),n.addEventListener("drop",this),n.addEventListener("scroll",this),n.addEventListener("lm-dragenter",this),n.addEventListener("lm-dragleave",this),n.addEventListener("lm-dragover",this),n.addEventListener("lm-drop",this),this._updateColumnSizes()}onBeforeDetach(e){super.onBeforeDetach(e);const t=this.node,n=q.findElement(t,Rt);t.removeEventListener("mousedown",this),t.removeEventListener("keydown",this),t.removeEventListener("click",this),t.removeEventListener("dblclick",this),this._contentSizeObserver.disconnect(),n.removeEventListener("scroll",this),n.removeEventListener("dragover",this),n.removeEventListener("dragover",this),n.removeEventListener("dragleave",this),n.removeEventListener("dragend",this),n.removeEventListener("drop",this),n.removeEventListener("lm-dragenter",this),n.removeEventListener("lm-dragleave",this),n.removeEventListener("lm-dragover",this),n.removeEventListener("lm-drop",this),document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0)}onAfterShow(e){this._isDirty&&(this.sort(this.sortState),this.update())}_onContentResize(){const e=q.findElement(this.node,Rt),t=e.offsetWidth-e.clientWidth;t!=this._contentScrollbarWidth&&(this._contentScrollbarWidth=t,this._width=this._computeContentWidth(),this._updateColumnSizes())}_computeContentWidth(e=null){e||(e=this.node.getBoundingClientRect().width),this._paddingWidth=parseFloat(window.getComputedStyle(this.node).getPropertyValue("--jp-dirlisting-padding-width"));const t=this.node.querySelector(`.${On}`);return this._handleWidth=t?t.getBoundingClientRect().width:lr,e-this._paddingWidth*2-this._contentScrollbarWidth}_updateModifiedSize(e){this._modifiedStyle=this._computeDateColumnStyle(e,ha,"last_modified")}_updateCreatedSize(e){this._createdStyle=this._computeDateColumnStyle(e,fa,"date_created")}_computeDateColumnStyle(e,t,n){var i,r;const o=q.findElement(e,t),a=(r=(i=this._columnSizes[n])!==null&&i!==void 0?i:o?.getBoundingClientRect().width)!==null&&r!==void 0?r:83;return a<100?"narrow":a>120?"long":"short"}_updateModifiedStyleAndSize(){const e=this._modifiedStyle;this._updateModifiedSize(this.node),e!==this._modifiedStyle&&this.updateModified(this._sortedItems,this._items)}_updateCreatedStyleAndSize(){const e=this._createdStyle;this._updateCreatedSize(this.node),e!==this._createdStyle&&this.updateCreated(this._sortedItems,this._items)}updateModified(e,t){e.forEach((n,i)=>{const r=t[i];if(r&&n.last_modified){const o=q.findElement(r,Jt);if(!o)return;this.renderer.updateItemModified!==void 0?this.renderer.updateItemModified(o,n.last_modified,this._modifiedStyle):Ue.defaultRenderer.updateItemModified(o,n.last_modified,this._modifiedStyle)}})}updateCreated(e,t){e.forEach((n,i)=>{const r=t[i];if(r&&n.created){const o=q.findElement(r,Yt);if(!o)return;this.renderer.updateItemCreated!==void 0?this.renderer.updateItemCreated(o,n.created,this._createdStyle):Ue.defaultRenderer.updateItemCreated(o,n.created,this._createdStyle)}})}updateNodes(e,t,n=!1){var i;e.forEach((a,l)=>{const c=t[l];if(n&&this.renderer.updateItemSize)return c?this.renderer.updateItemSize(c,a,this._modifiedStyle,this._columnSizes,this._createdStyle):void 0;const d=this._manager.registry.getFileTypeForModel(a);this.renderer.updateItemNode(c,a,d,this.translator,this._hiddenColumns,this.selection[a.path],this._modifiedStyle,this._columnSizes,this._createdStyle),this.selection[a.path]&&this._isCut&&this._model.path===this._prevPath&&c.classList.add(_s),c.setAttribute("data-isdir",a.type==="directory"?"true":"false")});const r=Object.keys(this.selection).length;r&&(this.addClass(ut),r>1&&this.addClass(rr));const o=e.map(a=>a.path);for(const a of this._model.sessions()){const l=Y.firstIndexOf(o,a.path),c=t[l];if(c){let d=(i=a.kernel)===null||i===void 0?void 0:i.name;const u=this._model.specs;if(c.classList.add(or),u&&d){const m=u.kernelspecs[d];d=m?m.display_name:this._trans.__("unknown")}this._lastRenderedState.get(c)!==c.title&&(c.title=this._trans.__(`%1
420
+ Kernel: %2`,c.title,d),this._lastRenderedState.set(c,c.title))}}}onUpdateRequest(e){this._isDirty=!1;const t=this._sortedItems,n=this._items,i=n.length===0,r=q.findElement(this.node,Rt),o=this._renderer;for(this.removeClass(rr),this.removeClass(ut);n.length>t.length;)r.removeChild(n.pop());for(;n.length<t.length;){const l=o.createItemNode(this._hiddenColumns,this._columnSizes);l.classList.add(Ig),n.push(l),r.appendChild(l)}n.forEach((l,c)=>{l.classList.remove(ut),l.classList.remove(or),l.classList.remove(_s);const d=o.getCheckboxNode(l);d&&(d.checked=!1);const u=o.getNameNode(l);u&&(c===this._focusIndex?(u.setAttribute("tabIndex","0"),u.setAttribute("role","button")):(u.setAttribute("tabIndex","-1"),u.removeAttribute("role")))});const a=o.getCheckboxNode(this.headerNode);if(a){const l=Object.keys(this.selection).length,c=t.length>0&&l===t.length,d=!c&&l>0;a.checked=c,a.indeterminate=d,a.dataset.checked=String(c),a.dataset.indeterminate=String(d);const u=this.translator.load("jupyterlab");a?.setAttribute("aria-label",c||d?u.__("Deselect all files and directories"):u.__("Select all files and directories"))}this.updateNodes(t,n),i&&(this._width=this._computeContentWidth(),this._updateColumnSizes()),this._prevPath=this._model.path}onResize(e){const{width:t}=e.width===-1?this.node.getBoundingClientRect():e;this._width=this._computeContentWidth(t),this._updateColumnSizes()}setColumnVisibility(e,t){t?this._hiddenColumns.delete(e):this._hiddenColumns.add(e),this.headerNode.innerHTML="",this._renderer.populateHeaderNode(this.headerNode,this.translator,this._hiddenColumns,this._columnSizes,this._sortState),this._updateColumnSizes()}_updateColumnSizes(e=null){const t=this._visibleColumns.map(a=>({...a,element:q.findElement(this.node,a.className)})).filter(a=>a.element);let n=0;for(const a of t){let l=this._columnSizes[a.id];if(l===null&&(l=a.element.getBoundingClientRect().width),l=Math.max(l,a.minWidth),this._width){let c=0;for(const d of t)d.id!==a.id&&(c+=d.minWidth);l=Math.min(l,this._width-c)}this._columnSizes[a.id]=l,n+=l}if(this._width){const a=this._width-n;let l=e===null;const c=t.filter(u=>l?!0:(u.id===e&&(l=!0),!1)),d=c.map(u=>u.grow).reduce((u,h)=>u+h,0);for(const u of c){const h=a*u.grow/d;this._columnSizes[u.id]=this._columnSizes[u.id]+h}}const i=this.node.getElementsByClassName(On),r=t.map(a=>le.isResizable(a));let o=0;for(const a of t){let l=this._columnSizes[a.id];le.isResizable(a)&&l&&(l-=this._handleWidth*i.length/r.length,(o===0||o===r.length-1)&&(l+=this._paddingWidth),o+=1),a.element.style.width=l===null?"":l+"px"}this._updateModifiedStyleAndSize(),this._updateCreatedStyleAndSize(),this.isVisible&&this._items.length!==0&&this.updateNodes(this._sortedItems,this._items,!0),this._saveState()}get _visibleColumns(){return Ue.columns.filter(e=>{var t;return e.id==="name"||!(!((t=this._hiddenColumns)===null||t===void 0)&&t.has(e.id))})}_setColumnSize(e,t){var n;const i=this._columnSizes[e];if(i&&t&&t>i){let r=0,o=!0;for(const a of this._visibleColumns){if(a.id===e){r+=t,o=!1;continue}if(o){const l=q.findElement(this.node,a.className);r+=(n=this._columnSizes[a.id])!==null&&n!==void 0?n:l.getBoundingClientRect().width}else r+=a.minWidth}if(this._width&&r>this._width)return}this._columnSizes[e]=t,this._updateColumnSizes(e)}setNotebooksFirstSorting(e){let t=this._sortNotebooksFirst;this._sortNotebooksFirst=e,this._sortNotebooksFirst!==t&&this.sort(this._sortState)}setSortFileNamesNaturally(e){const t=this._sortFileNamesNaturally;this._sortFileNamesNaturally=e,this._sortFileNamesNaturally!==t&&this.sort(this._sortState)}setAllowSingleClickNavigation(e){this._allowSingleClick=e}setAllowDragDropUpload(e){this._allowDragDropUpload=e}isWithinCheckboxHitArea(e){let t=e.target;for(;t;){if(t.classList.contains(It))return!0;t=t.parentElement}return!1}_evtClick(e){const t=e.target,n=this.headerNode,i=this._renderer;if(n.contains(t)){const r=i.getCheckboxNode(n);if(r&&this.isWithinCheckboxHitArea(e))r.dataset.indeterminate==="false"&&r.dataset.checked==="false"?(this._sortedItems.forEach(a=>this.selection[a.path]=!0),this._selectionChanged.emit()):this.clearSelectedItems(),this.update();else{const o=this.renderer.handleHeaderClick(n,e);o&&this.sort(o)}return}else this._focusItem(this._focusIndex);this._allowSingleClick&&this.evtDblClick(e)}_evtScroll(e){this.headerNode.scrollLeft=this.contentNode.scrollLeft}_evtMousedown(e){if(e.target===this._editNode)return;if(this._editNode.parentNode)if(this._editNode!==e.target)this._editNode.focus(),this._editNode.blur(),clearTimeout(this._selectTimer);else return;let t=le.hitTestNodes(this._items,e);if(t===-1){if(e.button===0){const i=e.target;if(i instanceof HTMLElement&&i.classList.contains(On)){const r=i.dataset.column;if(!r)throw Error("Column resize handle is missing data-column attribute");const o=Ue.columns.find(c=>c.id===r);if(!o)throw Error(`Column with identifier ${r} not found`);const a=q.findElement(this.node,o.className);i.classList.add(ar);const l=Ts.overrideCursor("col-resize");this._resizeData={pressX:e.clientX,column:r,initialSize:a.getBoundingClientRect().width,overrides:new Ve(()=>{l.dispose(),i.classList.remove(ar)})},document.addEventListener("mouseup",this,!0),document.addEventListener("mousemove",this,!0);return}}return}this.handleFileSelect(e),e.button!==0&&clearTimeout(this._selectTimer),!(vn&&e.ctrlKey||e.button===2)&&e.button===0&&(this._dragData={pressX:e.clientX,pressY:e.clientY,index:t},document.addEventListener("mouseup",this,!0),document.addEventListener("mousemove",this,!0))}_evtMouseup(e){if(this._softSelection&&(!(e.metaKey||e.shiftKey||e.ctrlKey)&&e.button===0&&(this.clearSelectedItems(),this.selection[this._softSelection]=!0,this._selectionChanged.emit(),this.update()),this._softSelection=""),e.button===0&&this._focusItem(this._focusIndex),this._resizeData){this._resizeData.overrides.dispose(),this._resizeData=null,document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0);return}if(e.button!==0||!this._drag){document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0);return}e.preventDefault(),e.stopPropagation()}_evtMousemove(e){if(e.preventDefault(),e.stopPropagation(),this._resizeData){const{initialSize:r,column:o,pressX:a}=this._resizeData;this._setColumnSize(o,r+e.clientX-a);return}if(this._drag||!this._dragData)return;const t=this._dragData,n=Math.abs(e.clientX-t.pressX),i=Math.abs(e.clientY-t.pressY);n<cr&&i<cr||this._startDrag(t.index,e.clientX,e.clientY)}handleOpen(e){if(this._onItemOpened.emit(e),e.type==="directory"){const t=this._manager.services.contents.localPath(e.path);this._model.cd(`/${t}`).catch(n=>ve(this._trans._p("showErrorMessage","Open directory"),n))}else{const t=e.path;this._handleOpenFile(t)}}_getNextFocusIndex(e,t){const n=e+t;return n===-1||n===this._items.length?e:n}_handleArrowY(e,t){if(e.altKey||e.metaKey||!this._items.length||!e.target.classList.contains(Gt))return;e.stopPropagation(),e.preventDefault();const n=this._focusIndex;let i=this._getNextFocusIndex(n,t);t>0&&n===0&&!e.ctrlKey&&Object.keys(this.selection).length===0&&(i=0),e.shiftKey?this._handleMultiSelect(i):e.ctrlKey||this._selectItem(i,e.shiftKey,!1),this._focusItem(i),this.update()}async goUp(){const e=this.model;if(e.path!==e.rootPath&&!(e.root&&e.path===e.root))try{await e.cd("..")}catch(t){console.warn(`Failed to go to parent directory of ${e.path}`,t)}}evtKeydown(e){if(!this._inRename){switch(e.key){case"Enter":{if(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;e.preventDefault(),e.stopPropagation();for(const t of this.selectedItems())this.handleOpen(t);return}case"ArrowUp":this._handleArrowY(e,-1);return;case"ArrowDown":this._handleArrowY(e,1);return;case" ":case"Spacebar":{if(e.ctrlKey){if(e.metaKey||e.shiftKey||e.altKey)return;const t=this._items[this._focusIndex];if(!(t.contains(e.target)&&t.contains(document.activeElement)))return;e.stopPropagation(),e.preventDefault();const{path:n}=this._sortedItems[this._focusIndex];this.selection[n]?delete this.selection[n]:this.selection[n]=!0,this._selectionChanged.emit(),this.update();return}break}}if(e.key!==void 0&&e.key.length===1&&!((e.key===" "||e.key==="Spacebar")&&e.target.type==="checkbox")){if(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;this._searchPrefix+=e.key,clearTimeout(this._searchPrefixTimer),this._searchPrefixTimer=window.setTimeout(()=>{this._searchPrefix=""},Ng),this.selectByPrefix(),e.stopPropagation(),e.preventDefault()}}}evtDblClick(e){if(e.button!==0||e.ctrlKey||e.shiftKey||e.altKey||e.metaKey||this.isWithinCheckboxHitArea(e))return;e.preventDefault(),e.stopPropagation(),clearTimeout(this._selectTimer),this._editNode.blur();const t=e.target,n=Y.findFirstIndex(this._items,r=>r.contains(t));if(n===-1)return;const i=this._sortedItems[n];this.handleOpen(i)}evtNativeDrop(e){var t,n,i;if(e.preventDefault(),!this._allowDragDropUpload)return;const r=(t=e.dataTransfer)===null||t===void 0?void 0:t.items;if(!r){const l=(n=e.dataTransfer)===null||n===void 0?void 0:n.files;if(!l||l.length===0)return;const c=[];for(const d of l){const u=this._model.upload(d);c.push(u)}Promise.all(c).then(()=>this._allUploaded.emit()).catch(d=>{console.error("Error while uploading files: ",d)});return}const o=async(l,c)=>{if(le.isDirectoryEntry(l)){const d=await le.createDirectory(this._model.manager,c,l.name),u=l.createReader(),h=await le.collectEntries(u);for(const m of h)await o(m,d)}else if(le.isFileEntry(l)){const d=await le.readFile(l);await this._model.upload(d,c)}},a=[];for(const l of r){const c=le.defensiveGetAsEntry(l);if(!c)continue;const d=o(c,(i=this._model.path)!==null&&i!==void 0?i:"/");a.push(d)}Promise.all(a).then(()=>this._allUploaded.emit()).catch(l=>{console.error("Error while uploading files: ",l)})}get allUploaded(){return this._allUploaded}evtDragEnter(e){if(e.mimeData.hasData(yn)){const t=le.hitTestNodes(this._items,e);if(t===-1)return;const n=this._sortedItems[t];if(n.type!=="directory"||this.selection[n.path])return;e.target.classList.add(lt),e.preventDefault(),e.stopPropagation()}}evtDragLeave(e){e.preventDefault(),e.stopPropagation();const t=q.findElement(this.node,lt);t&&t.classList.remove(lt)}evtDragOver(e){e.preventDefault(),e.stopPropagation(),e.dropAction=e.proposedAction;const t=q.findElement(this.node,lt);t&&t.classList.remove(lt);const n=le.hitTestNodes(this._items,e);if(n===-1||n>=this._items.length){e.dropAction="none";return}this._items[n].classList.add(lt)}evtDrop(e){if(e.preventDefault(),e.stopPropagation(),clearTimeout(this._selectTimer),e.proposedAction==="none"){e.dropAction="none";return}if(!e.mimeData.hasData(yn))return;let t=e.target;for(;t&&t.parentElement;){if(t.classList.contains(lt)){t.classList.remove(lt);break}t=t.parentElement}const n=Y.firstIndexOf(this._items,t),i=this._sortedItems;let r=this._model.path;i[n].type==="directory"&&(r=O.PathExt.join(r,i[n].name));const o=this._manager,a=[],l=e.mimeData.getData(yn);e.ctrlKey&&e.proposedAction==="move"?e.dropAction="copy":e.dropAction=e.proposedAction;for(const c of l){const d=o.services.contents.localPath(c),u=O.PathExt.basename(d),h=O.PathExt.join(r,u);h!==c&&(e.dropAction==="copy"?a.push(o.copy(c,r)):a.push(In(o,c,h)))}Promise.all(a).catch(c=>{ve(this._trans._p("showErrorMessage","Error while copying/moving files"),c)})}_startDrag(e,t,n){let i=Object.keys(this.selection);const r=this._items[e],o=this._sortedItems;let a,l;if(!r.classList.contains(ut))l=o[e],i=[l.path],a=[l];else{const h=i[0];l=o.find(m=>m.path===h),a=this.selectedItems()}if(!l)return;const c=this._manager.registry.getFileTypeForModel(l),d=this.renderer.createDragImage(r,i.length,this._trans,c);this._drag=new Ts({dragImage:d,mimeData:new Kr,supportedActions:"move",proposedAction:"move"}),this._drag.mimeData.setData(yn,i);const u=this.model.manager.services;for(const h of a)this._drag.mimeData.setData(Fg,{model:h,withContent:async()=>await u.contents.get(h.path)});if(l.type!=="directory"){const h=i.slice(1).reverse();this._drag.mimeData.setData(jg,()=>{if(!l)return;const m=l.path;let _=this._manager.findWidget(m);if(_||(_=this._manager.open(l.path)),h.length){const b=new it;b.promise.then(()=>{let g=_;h.forEach(p=>{const w={ref:g?.id,mode:"tab-after"};g=this._manager.openOrReveal(p,void 0,void 0,w),this._manager.openOrReveal(l.path)})}),b.resolve(void 0)}return _})}document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0),clearTimeout(this._selectTimer),this._drag.start(t,n).then(h=>{this._drag=null,clearTimeout(this._selectTimer)})}handleFileSelect(e){const t=this._sortedItems,n=le.hitTestNodes(this._items,e);if(clearTimeout(this._selectTimer),n===-1)return;this._softSelection="";const i=t[n].path,r=Object.keys(this.selection),o=e.button===0&&!(vn&&e.ctrlKey)&&this.isWithinCheckboxHitArea(e);if(vn&&e.metaKey||!vn&&e.ctrlKey||o)this.selection[i]?delete this.selection[i]:this.selection[i]=!0,this._selectionChanged.emit(),this._focusItem(n);else if(e.shiftKey)this._handleMultiSelect(n),this._focusItem(n);else if(i in this.selection&&r.length>1)this._softSelection=i;else return this._selectItem(n,!1,!0);this.update()}_focusItem(e){var t,n;const i=this._items;if(i.length===0){this._focusIndex=0,this._focusPath="",this.node.focus();return}const r=Math.min(Math.max(e,0),i.length-1);this._focusIndex=r,this._focusPath=(n=(t=this._sortedItems[r])===null||t===void 0?void 0:t.path)!==null&&n!==void 0?n:"";const o=i[r],a=this.renderer.getNameNode(o);a&&(a.tabIndex=0,a.focus())}_allSelectedBetween(e,t){if(e===t)return;const[n,i]=e<t?[e+1,t]:[t+1,e];return this._sortedItems.slice(n,i).reduce((r,o)=>r&&this.selection[o.path],!0)}_handleMultiSelect(e){const t=this._sortedItems,n=this._focusIndex,i=t[e];let r=!0;if(e===n){this.selection[i.path]||(this.selection[i.path]=!0,this._selectionChanged.emit());return}if(this.selection[i.path])if(Math.abs(e-n)===1){const l=t[n],c=t[n+(e<n?1:-1)];this.selection[l.path]&&(!c||!this.selection[c.path])&&(delete this.selection[l.path],this._selectionChanged.emit())}else this._allSelectedBetween(n,e)&&(r=!1);const o=n<e?1:-1;let a=!1;for(let l=n;l!==e+o;l+=o)if(r){if(l===n)continue;this.selection[t[l].path]||(this.selection[t[l].path]=!0,a=!0)}else{if(l===e)continue;this.selection[t[l].path]&&(delete this.selection[t[l].path],a=!0)}a&&this._selectionChanged.emit()}_copy(){this._clipboard.length=0;for(const e of this.selectedItems())this._clipboard.push(e.path);this._clipboardRevision++}async _delete(e){await Promise.all(e.map(t=>this._model.manager.deleteFile(t).catch(n=>{ve(this._trans._p("showErrorMessage","Delete Failed"),n)})))}async _doRename(){this._inRename=!0;const e=Object.keys(this.selection);if(e.length===0)return this._inRename=!1,Promise.resolve("");const t=this._sortedItems;let{path:n}=t[this._focusIndex];this.selection[n]||(n=e.slice(-1)[0]);const i=Y.findFirstIndex(t,u=>u.path===n),r=this._items[i],o=t[i],a=this.renderer.getNameNode(r),l=o.name;this._editNode.value=l,this._selectItem(i,!1,!0);const c=await le.userInputForRename(a,this._editNode,l);if(this.isDisposed)throw this._inRename=!1,new Error("File browser is disposed.");let d=c;if(!c||c===l)d=l;else if(!ca(c))ve(this._trans.__("Rename Error"),Error(this._trans._p("showErrorMessage",'"%1" is not a valid name for a file. Names must have nonzero length, and cannot include "/", "\\", or ":"',c))),d=l;else{const u=this._manager,h=O.PathExt.join(this._model.path,l),m=O.PathExt.join(this._model.path,c);try{await In(u,h,m)}catch(_){_!=="File not renamed"&&ve(this._trans._p("showErrorMessage","Rename Error"),_),d=l}if(this.isDisposed)throw this._inRename=!1,new Error("File browser is disposed.")}if(!this.isDisposed&&Object.keys(this.selection).length===1&&this.selection[o.path])try{await this._selectItemByName(d,!0,!0)}catch{console.warn("After rename, failed to select file",d)}return this._inRename=!1,d}_selectItem(e,t,n=!0){const i=this._sortedItems;t||this.clearSelectedItems();const r=i[e].path;this.selection[r]=!0,this._selectionChanged.emit(),n&&this._focusItem(e),this.update()}_onModelRefreshed(){const e=Object.keys(this.selection);this.clearSelectedItems(!1);for(const t of this._model.items()){const n=t.path;e.indexOf(n)!==-1&&(this.selection[n]=!0)}this.isVisible?this.sort(this.sortState):this._isDirty=!0}_onPathChanged(){const e=this.node.contains(document.activeElement);this.clearSelectedItems(),this.sort(this.sortState),requestAnimationFrame(()=>{this.isDisposed||(e?this._focusItem(0):this._focusIndex=0)})}_onFileChanged(e,t){const n=t.newValue;if(!n)return;const i=n.name;t.type!=="new"||!i||this.selectItemByName(i).catch(()=>{})}_onActivateRequested(e,t){if(O.PathExt.dirname(t)!==this._model.path)return;const i=O.PathExt.basename(t);this.selectItemByName(i).catch(()=>{})}}(function(s){s.columns=[{id:"is_selected",className:It,itemClassName:It,minWidth:18,resizable:!1,sortable:!1,grow:0},{id:"name",className:Og,itemClassName:ms,minWidth:60,resizable:!0,sortable:!0,caretSide:"right",grow:3},{id:"last_modified",className:ha,itemClassName:Jt,minWidth:60,resizable:!0,sortable:!0,caretSide:"left",grow:1},{id:"date_created",className:fa,itemClassName:Yt,minWidth:60,resizable:!0,sortable:!0,caretSide:"left",grow:1},{id:"file_size",className:kg,itemClassName:ps,minWidth:60,resizable:!0,sortable:!0,caretSide:"left",grow:.5}];class e{constructor(){this.itemFactories={name:()=>{const n=document.createElement("span"),i=document.createElement("span"),r=document.createElement("span");return i.className=gn,r.className=Gt,n.className=ms,n.appendChild(i),n.appendChild(r),n},last_modified:()=>{const n=document.createElement("span");return n.className=Jt,n},file_size:()=>{const n=document.createElement("span");return n.className=ps,n},date_created:()=>{const n=document.createElement("span");return n.className=Yt,n},is_selected:()=>this.createCheckboxWrapperNode()},this._modifiedColumnLastUpdate=new WeakMap,this._createdColumnLastUpdate=new WeakMap,this._lastRenderedState=new WeakMap}createNode(){const n=document.createElement("div"),i=document.createElement("div"),r=document.createElement("ul");return r.setAttribute("data-lm-dragscroll","true"),r.className=Rt,i.className=Bs,n.appendChild(i),n.appendChild(r),n.tabIndex=-1,n}populateHeaderNode(n,i,r,o,a){i=i||se;const l=i.load("jupyterlab"),c={name:()=>this.createHeaderItemNode(l.__("Name")),last_modified:()=>this._createHeaderItemNodeWithSizes({small:l.__("Modified"),large:l.__("Last Modified")}),file_size:()=>this._createHeaderItemNodeWithSizes({small:l.__("Size"),large:l.__("File Size")}),date_created:()=>this._createHeaderItemNodeWithSizes({small:l.__("Created"),large:l.__("Date Created")}),is_selected:()=>this.createCheckboxWrapperNode({alwaysVisible:!0,headerNode:!0})},d=s.columns.filter(u=>u.id==="name"||!r?.has(u.id));for(const u of d){const h=c[u.id],m=h();m.classList.add(u.className);const _=u.id===d[d.length-1].id;if(o){const b=o[u.id];_||(m.style.width=b+"px")}if(n.appendChild(m),le.isResizable(u)&&!_){const b=document.createElement("div");b.classList.add(On),b.dataset.column=u.id,n.appendChild(b)}}this._updateSortIndicator(n,a??{direction:"ascending",key:"name"})}handleHeaderClick(n,i){const r=i.target,o=s.columns.filter(le.isSortable);for(const a of o){const l=n.querySelector(`.${a.className}`);if(l&&l.contains(r)){const c=l.classList.contains(ut),d=l.classList.contains(bn);let u="ascending";c&&!d&&(u="descending");const h={direction:u,key:a.id};return this._updateSortIndicator(n,h),h}}return{direction:"ascending",key:"name"}}_updateSortIndicator(n,i){const r=s.columns.filter(le.isSortable);for(const o of r){const a=n.querySelector(`.${o.className}`);if(!a)continue;const l=q.findElement(a,Ln);o.id===i.key?(a.classList.add(ut),i.direction==="descending"?(a.classList.add(bn),le.updateCaret(l,o.caretSide,"down")):(a.classList.remove(bn),le.updateCaret(l,o.caretSide,"up"))):(a.classList.remove(ut),a.classList.remove(bn),le.updateCaret(l,o.caretSide))}}createItemNode(n,i){const r=document.createElement("li");for(const o of s.columns){if(o.id!="name"&&n?.has(o.id))continue;const a=this.itemFactories[o.id],l=a();if(r.appendChild(l),i){const c=i[o.id];l.style.width=c+"px"}}return r}createCheckboxWrapperNode(n){const i=document.createElement("label");i.classList.add(It);const r=document.createElement("input");return r.type="checkbox",n?.headerNode||r.addEventListener("click",o=>{o.preventDefault()}),n?.alwaysVisible?i.classList.add("jp-mod-visible"):r.tabIndex=-1,i.appendChild(r),i}updateItemModified(n,i,r){this._updateItemDate(n,i,r,this._modifiedColumnLastUpdate)}updateItemCreated(n,i,r){this._updateItemDate(n,i,r,this._createdColumnLastUpdate)}_updateItemDate(n,i,r,o){const a=o.get(n);if(a?.date===i&&a?.style===r)return;const l=new Date(i);n.textContent=O.Time.formatHuman(l,r),n.title=O.Time.format(l),o.set(n,{date:i,style:r})}updateItemNode(n,i,r,o,a,l,c,d,u){var h;l&&n.classList.add(ut),r=r||Fe.getDefaultTextFileType(o);const{icon:m,iconClass:_,name:b}=r;o=o||se;const g=o.load("jupyterlab"),p=this._lastRenderedState.get(n),w=JSON.stringify({name:i.name,selected:l,lastModified:i.last_modified,created:i.created,modifiedStyle:c,createdStyle:u,hiddenColumns:Array.from(a??[]).sort(),columnsSizes:d,fileSize:i.size}),v=q.findElement(n,It),y=v?.querySelector('input[type="checkbox"]');if(y&&(y.checked=l??!1),p===w)return;this._lastRenderedState.set(n,w);const C=q.findElement(n,gn),E=q.findElement(n,Gt),x=q.findElement(n,ms);let S=q.findElement(n,Jt),A=q.findElement(n,ps),I=q.findElement(n,Yt);const P=!a?.has("is_selected");if(v&&!P)n.removeChild(v);else if(P&&!v){const z=this.createCheckboxWrapperNode();x.insertAdjacentElement("beforebegin",z)}const D=!a?.has("last_modified");S&&!D?(n.removeChild(S),S=void 0):D&&!S&&(S=this.itemFactories.last_modified(),x.insertAdjacentElement("afterend",S));const j=!a?.has("date_created");I&&!j?(n.removeChild(I),I=void 0):j&&!I&&(I=this.itemFactories.date_created(),(S??x).insertAdjacentElement("afterend",I));const H=!a?.has("file_size");if(A&&!H)n.removeChild(A);else if(H&&!A){A=this.itemFactories.file_size();const z=(h=I??S)!==null&&h!==void 0?h:x;z&&z.insertAdjacentElement("afterend",A)}requestAnimationFrame(()=>{Bt.resolveElement({icon:m,iconClass:xt(_,"jp-Icon"),container:C,className:gn,stylesheet:"listing"})});let $=g.__("Name: %1",i.name);if(i.size!==null&&i.size!==void 0){const z=dr(i.size,1,1024);A&&(A.textContent=z),$+=g.__(`
421
421
  Size: %1`,dr(i.size,1,1024))}else A&&(A.textContent="");if(i.path){const z=O.PathExt.dirname(i.path);z&&($+=g.__(`
422
422
  Path: %1`,z.substr(0,50)),z.length>50&&($+="..."))}i.created&&($+=g.__(`
423
423
  Created: %1`,O.Time.format(new Date(i.created)))),i.last_modified&&($+=g.__(`
424
424
  Modified: %1`,O.Time.format(new Date(i.last_modified)))),$+=g.__(`
425
- Writable: %1`,i.writable),n.title=$,n.setAttribute("data-file-type",b),i.name.startsWith(".")?n.setAttribute("data-is-dot","true"):n.removeAttribute("data-is-dot");const L=i.indices?i.indices:[];let D=Mr.highlight(i.name,L,ae.mark);if(E&&$t.render(ae.span(D),E),y){let z;r.contentType==="directory"?z=l?g.__('Deselect directory "%1"',D):g.__('Select directory "%1"',D):z=l?g.__('Deselect file "%1"',D):g.__('Select file "%1"',D),y.setAttribute("aria-label",z),y.checked=l??!1}this.updateItemSize(n,i,c,d,u)}updateItemSize(n,i,r,o,a){if(o)for(const d of s.columns){const u=q.findElement(n,d.itemClassName);if(!u)continue;const h=o[d.id],m=h===null?"":h+"px";m!==u.style.width&&(u.style.width=m)}let l=q.findElement(n,Jt);i.last_modified&&l&&this.updateItemModified(l,i.last_modified,r??"short");let c=q.findElement(n,Yt);i.created&&c&&this.updateItemCreated(c,i.created,a??"short")}getNameNode(n){return q.findElement(n,Gt)}getCheckboxNode(n){return n.querySelector(`.${It} input[type=checkbox]`)}createDragImage(n,i,r,o){const a=n.cloneNode(!0),l=q.findElement(a,gn),c=s.columns.filter(d=>d.id!=="name");for(const d of c){const u=q.findElement(a,d.itemClassName);u&&a.removeChild(u)}if(o?(l.textContent=o.iconLabel||"",l.className=o.iconClass||""):(l.textContent="",l.className=""),l.classList.add(Dg),i>1){const d=q.findElement(a,Gt);d.textContent=r._n("%1 Item","%1 Items",i)}return a}createHeaderItemNode(n){const i=document.createElement("div"),r=document.createElement("span"),o=document.createElement("span");return i.className=ir,r.className=fs,o.className=Ln,r.textContent=n,i.appendChild(r),i.appendChild(o),i}_createHeaderItemNodeWithSizes(n){const i=document.createElement("div");i.className=ir;const r=document.createElement("span");r.className=Ln;for(let o of Object.keys(n)){const a=document.createElement("span");a.classList.add(fs,fs+"-"+o),a.textContent=n[o],i.appendChild(a)}return i.appendChild(r),i}}s.Renderer=e,s.defaultRenderer=new e})(Ue||(Ue={}));var le;(function(s){function e(h,m,_){const b=h.parentElement;b.replaceChild(m,h),m.focus();const g=m.value.lastIndexOf(".");return g===-1?m.setSelectionRange(0,m.value.length):m.setSelectionRange(0,g),new Promise(p=>{m.onblur=()=>{b.replaceChild(h,m),p(m.value)},m.onkeydown=w=>{switch(w.key){case"Enter":w.stopPropagation(),w.preventDefault(),m.blur();break;case"Escape":w.stopPropagation(),w.preventDefault(),m.value=_,m.blur(),h.focus();break}}})}s.userInputForRename=e;function t(h,m,_=!1,b=!0,g){const p=Array.from(h),w=m.direction==="descending"?1:-1;function v(x,S){return _?x.type!==S.type:x.type==="directory"!=(S.type==="directory")}function y(x){return x.type==="directory"?2:x.type==="notebook"&&_?1:0}function C(x,S){var A;const I=navigator.language.split("@")[0],P=((A=g.languageCode)!==null&&A!==void 0?A:I).replace("_","-"),M={numeric:b,sensitivity:"base"};try{return x.name.localeCompare(S.name,P,M)}catch{return console.warn(`localeCompare failed to compare ${x.name} and ${S.name} under languageCode: ${P}`),x.name.localeCompare(S.name,I,M)}}function E(x){return(S,A)=>{if(v(S,A))return y(A)-y(S);const I=x(S,A);return I!==0?I*w:C(S,A)}}return m.key==="last_modified"?p.sort(E((x,S)=>new Date(x.last_modified).getTime()-new Date(S.last_modified).getTime())):m.key==="file_size"?p.sort(E((x,S)=>{var A,I;return((A=S.size)!==null&&A!==void 0?A:0)-((I=x.size)!==null&&I!==void 0?I:0)})):m.key==="date_created"?p.sort(E((x,S)=>{var A,I;return new Date((A=x.created)!==null&&A!==void 0?A:"").getTime()-new Date((I=S.created)!==null&&I!==void 0?I:"").getTime()})):p.sort(E((x,S)=>C(S,x))),p}s.sort=t,s.isResizable=h=>"resizable"in h&&h.resizable,s.isSortable=h=>"sortable"in h&&h.sortable;function n(h,m){return Y.findFirstIndex(h,_=>Kt.hitTest(_,m.clientX,m.clientY)||m.target===_)}s.hitTestNodes=n;function i(h,m,_){_?((_==="down"?$n:Zl).element({container:h,tag:"span",stylesheet:"listingHeaderItem"}),m==="left"?h.style.order="-1":h.style.order=""):(Bt.remove(h),h.className=Ln)}s.updateCaret=i;async function r(h,m,_){const b=await h.newUntitled({path:m,type:"directory"}),g=O.PathExt.join(m,b.name),p=O.PathExt.join(m,_);try{await h.rename(g,p)}catch{await h.deleteFile(g)}return p}s.createDirectory=r;function o(h){return h.isDirectory}s.isDirectoryEntry=o;function a(h){return h.isFile}s.isFileEntry=a;function l(h){return h.webkitGetAsEntry?h.webkitGetAsEntry():"getAsEntry"in h?h.getAsEntry():null}s.defensiveGetAsEntry=l;function c(h){return new Promise((m,_)=>h.readEntries(m,_))}function d(h){return new Promise((m,_)=>h.file(m,_))}s.readFile=d;async function u(h){const m=[];let _=!1;for(;!_;){const b=await c(h);b.length===0?_=!0:m.push(...b)}return m}s.collectEntries=u})(le||(le={}));function dr(s,e,t){if(s===0)return"0 B";const n=e,i=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],r=Math.floor(Math.log(s)/Math.log(t));return r>=0&&r<i.length?parseFloat((s/Math.pow(t,r)).toFixed(n))+" "+i[r]:String(s)}const Bg="jp-FileBrowser",Wg="jp-FileBrowser-Panel",Hg="jp-FileBrowser-accordion",Vg="jp-FileBrowser-crumbs",zg="jp-FileBrowser-toolbar",Ug="jp-FileBrowser-filterToolbar",$g="jp-FileBrowser-listing",Kg="jp-FileBrowser-filterBox";class qg extends Pp{constructor(e){var t;super({content:new pt,translator:e.translator}),this._directoryPending=null,this._filePending=null,this._fileFilterRef=R.createRef(),this._clearFilterOnNavigation=!0,this._allowSingleClick=!1,this._showFileCheckboxes=!1,this._showFileFilter=!1,this._showDateCreatedColumn=!1,this._showFileSizeColumn=!1,this._showHiddenFiles=!1,this._showLastModifiedColumn=!0,this._sortNotebooksFirst=!1,this._sortFileNamesNaturally=!0,this._allowFileUploads=!0,this._selectionChanged=new U(this),this._sectionChanged=new U(this),this._accordion=null,this.addClass(Bg),this.toolbar.addClass(zg),this.id=e.id;const n=this.translator=(t=e.translator)!==null&&t!==void 0?t:se,i=this.model=e.model,r=e.renderer;i.connectionFailure.connect(this._onConnectionFailure,this),i.pathChanged.connect(this._onPathChanged,this),this._manager=i.manager,this.toolbar.node.setAttribute("aria-label",this._trans.__("file browser")),this.mainPanel=new pt,this.mainPanel.addClass(Wg),this.mainPanel.title.label=this._trans.__("File Browser"),this.crumbs=new Ag({model:i,translator:n,onPathEdited:()=>{requestAnimationFrame(()=>{this._focusListingContentOrCrumb()})},onPathActivated:()=>{requestAnimationFrame(()=>{this._focusListingContentOrCrumb()})}}),this.crumbs.addClass(Vg);const o=Sp({updateFilter:(a,l)=>{this.model.setFilter(c=>a(c.name.toLowerCase()))},useFuzzyFilter:this.model.useFuzzyFilter,placeholder:this._trans.__("Filter files by name"),forceRefresh:!1,showIcon:!1,inputRef:this._fileFilterRef,filterSettingsChanged:this.model.filterSettingsChanged});o.addClass(Kg),this.filterToolbar=new jr,this.filterToolbar.addClass(Ug),this.filterToolbar.node.setAttribute("aria-label",this._trans.__("File browser toolbar")),this.filterToolbar.addItem("fileNameSearcher",o),this.filterToolbar.setHidden(!this.showFileFilter),this.listing=this.createDirListing({model:i,renderer:r,translator:n,state:e.state,handleOpenFile:e.handleOpenFile}),this.listing.addClass($g),this.listing.selectionChanged.connect(()=>{this._selectionChanged.emit()}),this.mainPanel.addWidget(this.crumbs),this.mainPanel.addWidget(this.filterToolbar),this.mainPanel.addWidget(this.listing),this.addWidget(this.mainPanel),e.restore!==!1&&i.restore(this.id),this.listing.restore(this.id)}get navigateToCurrentDirectory(){return this._navigateToCurrentDirectory}set navigateToCurrentDirectory(e){this._navigateToCurrentDirectory=e}get showLastModifiedColumn(){return this._showLastModifiedColumn}set showLastModifiedColumn(e){this.listing.setColumnVisibility?(this.listing.setColumnVisibility("last_modified",e),this._showLastModifiedColumn=e):console.warn("Listing does not support toggling column visibility")}get minimumBreadcrumbsLeftItems(){return this.crumbs.minimumLeftItems}set minimumBreadcrumbsLeftItems(e){this.crumbs.minimumLeftItems=e}get minimumBreadcrumbsRightItems(){return this.crumbs.minimumRightItems}set minimumBreadcrumbsRightItems(e){this.crumbs.minimumRightItems=e}get showFullPath(){return this.crumbs.fullPath}set showFullPath(e){this.crumbs.fullPath=e}editPath(){this.crumbs.enterEditMode()}get showDateCreatedColumn(){return this._showDateCreatedColumn}set showDateCreatedColumn(e){this.listing.setColumnVisibility?(this.listing.setColumnVisibility("date_created",e),this._showDateCreatedColumn=e):console.warn("Listing does not support toggling column visibility")}get showFileSizeColumn(){return this._showFileSizeColumn}set showFileSizeColumn(e){this.listing.setColumnVisibility?(this.listing.setColumnVisibility("file_size",e),this._showFileSizeColumn=e):console.warn("Listing does not support toggling column visibility")}get showHiddenFiles(){return this._showHiddenFiles}set showHiddenFiles(e){this.model.showHiddenFiles(e),this._showHiddenFiles=e}get showFileCheckboxes(){return this._showFileCheckboxes}set showFileCheckboxes(e){this.listing.setColumnVisibility?(this.listing.setColumnVisibility("is_selected",e),this._showFileCheckboxes=e):console.warn("Listing does not support toggling column visibility")}get showFileFilter(){return this._showFileFilter}set showFileFilter(e){var t;this.showFileFilter&&!e&&(this._fileFilterRef.current&&(this._fileFilterRef.current.value=""),this.model.setFilter(i=>({})),this.model.refresh().catch(console.warn)),this._showFileFilter=e,this.filterToolbar.setHidden(!this.showFileFilter),this.showFileFilter&&((t=this._fileFilterRef.current)===null||t===void 0||t.focus())}get clearFilterOnNavigation(){return this._clearFilterOnNavigation}set clearFilterOnNavigation(e){this._clearFilterOnNavigation=e}get sortNotebooksFirst(){return this._sortNotebooksFirst}set sortNotebooksFirst(e){this.listing.setNotebooksFirstSorting?(this.listing.setNotebooksFirstSorting(e),this._sortNotebooksFirst=e):console.warn("Listing does not support sorting notebooks first")}get sortFileNamesNaturally(){return this._sortFileNamesNaturally}set sortFileNamesNaturally(e){this.listing.setSortFileNamesNaturally?(this.listing.setSortFileNamesNaturally(e),this._sortFileNamesNaturally=e):console.warn("Listing does not support natural file name sorting")}get singleClickNavigation(){return this._allowSingleClick}set singleClickNavigation(e){this.listing.setAllowSingleClickNavigation?(this.listing.setAllowSingleClickNavigation(e),this._allowSingleClick=e):console.warn("Listing does not support single click navigation")}get allowFileUploads(){return this._allowFileUploads}set allowFileUploads(e){this.model.allowFileUploads=e,this.listing.setAllowDragDropUpload?(this.listing.setAllowDragDropUpload(e),this._allowFileUploads=e):console.warn("Listing does not support setting upload")}selectedItems(){return this.listing.selectedItems()}get selectionChanged(){return this._selectionChanged}get sectionChanged(){return this._sectionChanged}async selectItemByName(e){await this.listing.selectItemByName(e)}clearSelectedItems(){this.listing.clearSelectedItems()}_focusListingContentOrCrumb(){var e;if((e=this.listing.sortedItems().next().done)!==null&&e!==void 0&&e){this.crumbs.focusLastCrumb();return}this.listing.activate()}rename(){return this.listing.rename()}cut(){this.listing.cut()}copy(){this.listing.copy()}paste(){return this.listing.paste()}_onPathChanged(){if(this._clearFilterOnNavigation){const e=this._fileFilterRef.current,t=e?e.value:"";t&&t.trim()!==""&&(this.model.setFilter(n=>({})),e&&(e.value=""))}}async _createNew(e){if(e.path){const t=this._manager.services.contents.localPath(e.path);e.path=this._toDrivePath(this.model.driveName,t)}try{const t=await this._manager.newUntitled(e);return await this.listing.selectItemByName(t.name,!0),await this.rename(),t}catch(t){throw ve(this._trans.__("Error"),t),t}}async createNewDirectory(){if(this._directoryPending)return this._directoryPending;this._directoryPending=this._createNew({path:this.model.path,type:"directory"});try{return await this._directoryPending}finally{this._directoryPending=null}}async createNewFile(e){if(this._filePending)return this._filePending;this._filePending=this._createNew({path:this.model.path,type:"file",ext:e.ext});try{return await this._filePending}finally{this._filePending=null}}delete(){return this.listing.delete()}duplicate(){return this.listing.duplicate()}selectAll(){return this.listing.selectAll()}download(){return this.listing.download()}async goUp(){return this.listing.goUp()}shutdownKernels(){return this.listing.shutdownKernels()}selectNext(){this.listing.selectNext()}selectPrevious(){this.listing.selectPrevious()}modelForClick(e){return this.listing.modelForClick(e)}createDirListing(e){return new Ue(e)}_onConnectionFailure(e,t){if(t instanceof Be.ServerConnection.ResponseError&&t.response.status===404){const n=this._trans.__("Directory not found");t.message=this._trans.__('Directory not found: "%1"',this.model.path),ve(n,t)}}addSection(e){if(this._accordion)this._accordion.addWidget(e);else{const t=new Un({layout:Nn.createLayout({})});t.addClass(Hg),t.addWidget(this.mainPanel),t.addWidget(e),this._accordion=t,this.content.addWidget(t)}this._sectionChanged.emit()}removeSectionWidget(e){!this._accordion||e.parent!==this._accordion||(e.parent=null,this._accordion.widgets.length===1&&this._accordion.widgets[0]===this.mainPanel&&(this.mainPanel.isHidden&&this.mainPanel.show(),this.content.addWidget(this.mainPanel),this._accordion.dispose(),this._accordion=null),this._sectionChanged.emit())}get sections(){return this._accordion?this._accordion.widgets.filter(e=>e!==this.mainPanel):[]}get accordionPanel(){return this._accordion}_toDrivePath(e,t){return e===""?t:`${e}:${O.PathExt.removeSlash(t)}`}}const Gg=1e4,ur=15*1024*1024,wn=1024*1024;class Jg{constructor(e){var t,n;this._connectionFailure=new U(this),this._fileChanged=new U(this),this._items=[],this._key="",this._pathChanged=new U(this),this._paths=new Set,this._pending=null,this._pendingPath=null,this._refreshed=new U(this),this._sessions=[],this._state=null,this._isDisposed=!1,this._restored=new it,this._uploads=[],this._uploadChanged=new U(this),this.manager=e.manager,this.translator=e.translator||se,this._trans=this.translator.load("jupyterlab"),this._driveName=e.driveName||"",this._root=e.root||"",this._allowFileUploads=(t=e.allowFileUploads)!==null&&t!==void 0?t:!0,this._model={path:this.rootPath,name:O.PathExt.basename(this.rootPath),type:"directory",content:void 0,writable:!1,created:"unknown",last_modified:"unknown",mimetype:"text/plain",format:"text"},this._state=e.state||null;const i=e.refreshInterval||Gg,{services:r}=e.manager;r.contents.fileChanged.connect(this.onFileChanged,this),r.sessions.runningChanged.connect(this.onRunningChanged,this),this._unloadEventListener=o=>{if(this._uploads.length>0){const a=this._trans.__("Files still uploading");return o.returnValue=a,a}},window.addEventListener("beforeunload",this._unloadEventListener),this._poll=new Ql({auto:(n=e.auto)!==null&&n!==void 0?n:!0,name:"@jupyterlab/filebrowser:Model",factory:()=>this.cd("."),frequency:{interval:i,backoff:!0,max:300*1e3},standby:e.refreshStandby||"when-hidden"})}get connectionFailure(){return this._connectionFailure}get driveName(){return this._driveName}get restored(){return this._restored.promise}get fileChanged(){return this._fileChanged}get path(){return this._model?this._model.path:""}get rootPath(){return this._driveName?this._driveName+":":""}get root(){return this._root}get pathChanged(){return this._pathChanged}get refreshed(){return this._refreshed}get specs(){return this.manager.services.kernelspecs.specs}get isDisposed(){return this._isDisposed}get uploadChanged(){return this._uploadChanged}uploads(){return this._uploads[Symbol.iterator]()}dispose(){this.isDisposed||(window.removeEventListener("beforeunload",this._unloadEventListener),this._isDisposed=!0,this._poll.dispose(),this._sessions.length=0,this._items.length=0,U.clearData(this))}items(){return this._items[Symbol.iterator]()}sessions(){return this._sessions[Symbol.iterator]()}async refresh(){await this._poll.refresh(),await this._poll.tick,this._refreshed.emit(void 0)}async cd(e="."){const t=e===".";if(e!=="."?e=this.manager.services.contents.resolvePath(this._model.path,e):e=this._pendingPath||this._model.path,!da(e,this._root))if(t)e=this._root;else return;if(this._pending){if(e===this._pendingPath)return this._pending;await this._pending}const n=this.path,i={content:!0};this._pendingPath=e,n!==e&&(this._sessions.length=0);const r=this.manager.services;return this._pending=r.contents.get(e,i).then(o=>{this.isDisposed||(this.handleContents(o),this._pendingPath=null,this._pending=null,n!==e&&(this._state&&this._key&&this._state.save(this._key,{path:e}),this._pathChanged.emit({name:"path",oldValue:n,newValue:e})),this.onRunningChanged(r.sessions,r.sessions.running()),this._refreshed.emit(void 0))}).catch(o=>{this._pendingPath=null,this._pending=null;const a=this._root||"/";if(o.response&&o.response.status===404&&e!==a)return o.message=this._trans.__('Directory not found: "%1"',this._model.path),console.error(o),this._connectionFailure.emit(o),this.cd(a);this._connectionFailure.emit(o)}),this._pending}async download(e){const t=await this.manager.services.contents.getDownloadUrl(e),n=document.createElement("a");n.href=t,n.download="",document.body.appendChild(n),n.click(),document.body.removeChild(n)}async restore(e,t=!0){const{manager:n}=this,i=`file-browser-${e}:cwd`,r=this._state;if(!this._key){if(this._key=i,!t||!r){this._restored.resolve(void 0);return}await n.services.ready;try{const a=await r.fetch(i);if(!a){this._restored.resolve(void 0);return}const l=a.path;l&&await this.cd("/");const c=n.services.contents.localPath(l);await n.services.contents.get(l),await this.cd(c)}catch{await r.remove(i)}this._restored.resolve(void 0)}}get allowFileUploads(){return this._allowFileUploads}set allowFileUploads(e){this._allowFileUploads=e}async upload(e,t){if(!this._allowFileUploads)throw new Error(this._trans.__("File uploads are disabled"));const n=O.PageConfig.getNotebookVersion(),i=O.compareVersions(n,[4,0,0])<0||O.compareVersions(n,[5,1,0])>=0,r=e.size>ur;if(r&&!i){const l=this._trans.__("Cannot upload file (>%1 MB). %2",ur/1048576,e.name);throw console.warn(l),l}const o="File not uploaded";if(r&&!await this._shouldUploadLarge(e))throw"Cancelled large file upload";if(await this._uploadCheckDisposed(),await this.refresh(),await this._uploadCheckDisposed(),this._items.find(l=>l.name===e.name)&&!await la(e.name))throw o;await this._uploadCheckDisposed();const a=i&&e.size>wn;return await this._upload(e,a,t)}async _shouldUploadLarge(e){const{button:t}=await ft({title:this._trans.__("Large file size warning"),body:this._trans.__("The file size is %1 MB. Do you still want to upload it?",Math.round(e.size/1048576)),buttons:[_e.cancelButton({label:this._trans.__("Cancel")}),_e.warnButton({label:this._trans.__("Upload")})]});return t.accept}async _upload(e,t,n){let i=typeof n>"u"?this._model.path:n;i=i?i+"/"+e.name:e.name;const r=e.name,o="file",a="base64",l=async(u,h)=>{await this._uploadCheckDisposed();const m=new FileReader;m.readAsDataURL(u),await new Promise((g,p)=>{m.onload=g,m.onerror=w=>p(`Failed to upload "${e.name}":`+w)}),await this._uploadCheckDisposed();const _=m.result.split(",")[1],b={type:o,format:a,name:r,chunk:h,content:_};return await this.manager.services.contents.save(i,b)};if(!t)return await l(e);let c,d={path:i,progress:0};this._uploadChanged.emit({name:"start",newValue:d,oldValue:null});for(let u=0;!c;u+=wn){const h=u+wn,m=h>=e.size,_=m?-1:h/wn,b={path:i,progress:u/e.size};Y.removeFirstOf(this._uploads,d),this._uploads.push(b),this._uploadChanged.emit({name:"update",newValue:b,oldValue:d}),d=b;let g;try{g=await l(e.slice(u,h),_)}catch(p){throw Y.removeFirstOf(this._uploads,d),this._uploadChanged.emit({name:"failure",newValue:d,oldValue:null}),p}m&&(c=g)}return Y.removeFirstOf(this._uploads,d),this._uploadChanged.emit({name:"finish",newValue:null,oldValue:d}),c}_uploadCheckDisposed(){return this.isDisposed?Promise.reject("Filemanager disposed. File upload canceled"):Promise.resolve()}handleContents(e){this._model={name:e.name,path:e.path,type:e.type,content:void 0,writable:e.writable,created:e.created,last_modified:e.last_modified,size:e.size,mimetype:e.mimetype,format:e.format},this._items=e.content,this._paths.clear(),e.content.forEach(t=>{this._paths.add(t.path)})}onRunningChanged(e,t){this._populateSessions(t),this._refreshed.emit(void 0)}onFileChanged(e,t){const n=this._model.path,{sessions:i}=this.manager.services,{oldValue:r,newValue:o}=t,a=this.driveName.length>0?this.driveName+":":"";if(r&&r.path&&a+O.PathExt.dirname(r.path)===n?r:o&&o.path&&a+O.PathExt.dirname(o.path)===n?o:void 0){this._poll.refresh(),this._populateSessions(i.running()),this._fileChanged.emit(t);return}}_populateSessions(e){this._sessions.length=0;for(const t of e)this._paths.has(t.path)&&this._sessions.push(t)}}class Yg extends Jg{constructor(e){super(e),this._includeHiddenFiles=e.includeHiddenFiles||!1}items(){return this._includeHiddenFiles?super.items():Dn(super.items(),e=>!e.name.startsWith("."))}get includeHiddenFiles(){return this._includeHiddenFiles}showHiddenFiles(e){this._includeHiddenFiles=e,this.refresh()}}class Xg extends Yg{constructor(e){var t,n,i;super(e),this._filterSettingsChanged=new U(this),this._filter=(t=e.filter)!==null&&t!==void 0?t:(r=>({})),this._filterDirectories=(n=e.filterDirectories)!==null&&n!==void 0?n:!0,this._useFuzzyFilter=(i=e.useFuzzyFilter)!==null&&i!==void 0?i:!0}get filterDirectories(){return this._filterDirectories}set filterDirectories(e){this._filterDirectories=e}get useFuzzyFilter(){return this._useFuzzyFilter}set useFuzzyFilter(e){this._useFuzzyFilter!==e&&(this._useFuzzyFilter=e,this._filterSettingsChanged.emit({useFuzzyFilter:e}))}get filterSettingsChanged(){return this._filterSettingsChanged}items(){return Dn(super.items(),e=>{if(!this._filterDirectories&&e.type==="directory")return!0;{const t=this._filter(e);return e.indices=t?.indices,!!t}})}setFilter(e){this._filter=e,this.refresh()}}const Zg="jpCodeRunner",Qg="jpUndoer";class Ht extends X{constructor(e){super(),this._ready=new it,this.addClass("jp-FileEditor");const t=this._context=e.context;this._mimeTypeService=e.mimeTypeService;const n=this._editorWidget=new tc({factory:e.factory,model:t.model,editorOptions:{config:Ht.defaultEditorConfig}});this._editorWidget.addClass("jp-FileEditorCodeWrapper"),this._editorWidget.node.dataset[Zg]="true",this._editorWidget.node.dataset[Qg]="true",this.editor=n.editor,this.model=n.model;const i=Ht.defaultEditorConfig.scrollPastEnd;this.toggleClass("jp-mod-scrollPastEnd",i),t.ready.then(()=>{this._onContextReady()}),this._onPathChanged(),t.pathChanged.connect(this._onPathChanged,this),(this.layout=new Wr).addWidget(n)}get context(){return this._context}get ready(){return this._ready.promise}handleEvent(e){this.model&&e.type==="mousedown"&&this._ensureFocus()}onAfterAttach(e){super.onAfterAttach(e),this.node.addEventListener("mousedown",this)}onBeforeDetach(e){this.node.removeEventListener("mousedown",this)}onActivateRequest(e){this._ensureFocus()}_ensureFocus(){this.editor.hasFocus()||this.editor.focus()}_onContextReady(){this.isDisposed||(this.editor.clearHistory(),this._ready.resolve(void 0))}_onPathChanged(){const e=this.editor,t=this._context.localPath;e.model.mimeType=this._mimeTypeService.getMimeTypeByFilePath(t)}}(function(s){s.defaultEditorConfig={lineNumbers:!0,scrollPastEnd:!0}})(Ht||(Ht={}));class ey extends Qt{async setFragment(e){const t=e.split("=");if(t[0]!=="#line")return;const n=t[1];let i;return n.includes(",")?i=n.split(",")[0]||"0":i=n,this.context.ready.then(()=>{const r={line:parseInt(i,10),column:0};this.content.editor.setCursorPosition(r),this.content.editor.revealPosition(r)})}}class ty extends Br{constructor(e){super(e.factoryOptions),this._services=e.editorServices}createNewWidget(e){const t=this._services.factoryService.newDocumentEditor,n=o=>t(o),i=new Ht({factory:n,context:e,mimeTypeService:this._services.mimeTypeService});return i.title.icon=ec,new ey({content:i,context:e})}}class ny{_fileBrowserPanel;constructor(e){this._fileBrowserPanel=new Pe,this._fileBrowserPanel.id="dla-jlab-FleBrowser",this._fileBrowserPanel.orientation="horizontal",this._fileBrowserPanel.spacing=0,e.ready.then(()=>{t(e,this._fileBrowserPanel)});function t(i,r){const o=[];let a;const l={opened:new U(this),open:C=>{o.indexOf(C)===-1&&(w.addWidget(C,{mode:"tab-after"}),o.push(C)),w.activateWidget(C),a=C,C.disposed.connect(E=>{const x=o.indexOf(E);o.splice(x,1)})}},c=new Fe,d=new wg({registry:c,manager:i,opener:l}),u=new Fn;Fn.getDefaultLanguages().filter(C=>["ipython","julia","python"].includes(C.name.toLowerCase())).forEach(C=>{u.addLanguage(C)}),u.addLanguage({name:"ipythongfm",mime:"text/x-ipythongfm",load:async()=>(await V(()=>import("./dist-DFPs7B3v.js"),[],import.meta.url)).markdown({codeLanguages:E=>u.findBest(E)})});const h={factoryService:new lo,mimeTypeService:new co(u)},m=new ty({editorServices:h,factoryOptions:{name:"Editor",modelName:"text",fileTypes:["*"],defaultFor:["*"],preferKernel:!1,canStartKernel:!0}});c.addWidgetFactory(m);const _=new oi,b=new Xg({manager:d}),g=new qg({id:"filebrowser",model:b}),p=new En({icon:Tr,onClick:()=>{d.newUntitled({type:"file",path:b.path}).then(C=>{d.open(C.path)})}});g.toolbar.insertItem(0,"create",p),r.addWidget(g),Pe.setStretch(g,0);const w=new zn;r.addWidget(w),Pe.setStretch(w,1),w.spacing=8,document.addEventListener("focus",C=>{for(let E=0;E<o.length;E++){const x=o[E];if(x.node.contains(C.target)){a=x;break}}}),_.addCommand("file-open",{label:"Open",mnemonic:0,execute:()=>{nc(g.selectedItems(),C=>{d.openOrReveal(C.path)})}}),_.addCommand("file-rename",{label:"Rename",mnemonic:0,execute:()=>g.rename()}),_.addCommand("file-save",{execute:()=>d.contextForWidget(a)?.save()}),_.addCommand("file-cut",{label:"Cut",execute:()=>{g.cut()}}),_.addCommand("file-copy",{label:"Copy",mnemonic:0,execute:()=>{g.copy()}}),_.addCommand("file-delete",{label:"Delete",mnemonic:0,execute:()=>g.delete()}),_.addCommand("file-duplicate",{label:"Duplicate",mnemonic:0,execute:()=>g.duplicate()}),_.addCommand("file-paste",{label:"Paste",mnemonic:0,execute:()=>g.paste()}),_.addCommand("file-download",{label:"Download",execute:()=>g.download()}),_.addCommand("file-shutdown-kernel",{label:"Shut Down Kernel",execute:()=>g.shutdownKernels()}),_.addCommand("file-dialog-demo",{label:"Dialog Demo",execute:()=>{n()}}),_.addCommand("file-info-demo",{label:"Info Demo",execute:()=>{ft({title:"Cool Title",body:"The quick brown fox jumped over the lazy dog",buttons:[_e.okButton()]})}}),_.addKeyBinding({keys:["Enter"],selector:".jp-DirListing",command:"file-open"}),_.addKeyBinding({keys:["Accel S"],selector:".jp-CodeMirrorEditor",command:"file-save"}),window.addEventListener("keydown",C=>{_.processKeydownEvent(C)});const v=new kn({commands:_});v.addItem({command:"file-open"}),v.addItem({command:"file-rename"}),v.addItem({command:"file-remove"}),v.addItem({command:"file-duplicate"}),v.addItem({command:"file-delete"}),v.addItem({command:"file-cut"}),v.addItem({command:"file-copy"}),v.addItem({command:"file-paste"}),v.addItem({command:"file-shutdown-kernel"}),v.addItem({command:"file-dialog-demo"}),v.addItem({command:"file-info-demo"}),g.node.getElementsByClassName("jp-DirListing-content")[0].addEventListener("contextmenu",C=>{C.preventDefault();const E=C.clientX,x=C.clientY;v.open(E,x)}),window.addEventListener("resize",()=>{r.update()})}function n(){const i=document.createElement("div"),r=document.createElement("input");r.value="Untitled.ipynb";const o=document.createElement("select"),a=document.createElement("option");a.value="python",a.text="Python",o.appendChild(a);const l=document.createElement("option");l.value="julia",l.text="Julia",o.appendChild(l),i.appendChild(r),i.appendChild(o),ft({title:"Create new notebook"})}}get panel(){return this._fileBrowserPanel}}const sy=()=>{const{serviceManager:s}=Je(),[e,t]=R.useState();return R.useEffect(()=>{if(s){const n=new ny(s);t(n)}},[s]),e?f.jsx(Vt,{children:e.panel}):f.jsx(f.Fragment,{})},iy={extensionPromises:[V(()=>import("./lib-CUuelUb1.js"),[],import.meta.url),V(()=>import("./lib-ClnZlQTa.js"),[],import.meta.url),V(()=>import("./lib-DjYu7LUh.js"),[],import.meta.url),V(()=>import("./lib-DlFNTFJX.js"),[],import.meta.url),V(()=>import("./lib-HxF1xu1E.js"),[],import.meta.url),V(()=>import("./lib-qTRu1lKk.js"),[],import.meta.url),V(()=>import("./lib-BkcHzjVY.js"),[],import.meta.url),V(()=>import("./lib-DHt04E5T.js"),[],import.meta.url),V(()=>import("./lib-DdQRcxuM.js"),[],import.meta.url),V(()=>import("./lib-CfkV3N1c.js"),[],import.meta.url),V(()=>import("./lib-BkgDQr4b.js"),[],import.meta.url),V(()=>import("./lib-D3T0Aw2k.js"),[],import.meta.url),V(()=>import("./lib-USWrkybh.js"),[],import.meta.url),V(()=>import("./lib-BMrXwoDK.js"),[],import.meta.url),V(()=>import("./lib-CcQ1AdFH.js"),[],import.meta.url),V(()=>import("./lib-K8ZzEBaR.js"),[],import.meta.url),V(()=>import("./lib-ClNhs2cv.js"),[],import.meta.url),V(()=>import("./lib-DoORityU.js"),[],import.meta.url)],mimeExtensionPromises:[V(()=>import("./index-UMhfKl2p.js").then(s=>s.l),[],import.meta.url),V(()=>import("./index-UMhfKl2p.js").then(s=>s.k),[],import.meta.url)]},Ws=()=>({extensionPromises:[V(()=>import("./lib-CUuelUb1.js"),[],import.meta.url),V(()=>import("./lib-ClnZlQTa.js"),[],import.meta.url),V(()=>import("./lib-DjYu7LUh.js"),[],import.meta.url),V(()=>import("./lib-DlFNTFJX.js"),[],import.meta.url),V(()=>import("./lib-HxF1xu1E.js"),[],import.meta.url),V(()=>import("./lib-qTRu1lKk.js"),[],import.meta.url),V(()=>import("./lib-C553WOkt.js"),[],import.meta.url),V(()=>import("./lib-BkcHzjVY.js"),[],import.meta.url),V(()=>import("./lib-DHt04E5T.js"),[],import.meta.url),V(()=>import("./lib-DdQRcxuM.js"),[],import.meta.url),V(()=>import("./lib-CfkV3N1c.js"),[],import.meta.url),V(()=>import("./lib-BkgDQr4b.js"),[],import.meta.url),V(()=>import("./lib-D3T0Aw2k.js"),[],import.meta.url),V(()=>import("./lib-USWrkybh.js"),[],import.meta.url),V(()=>import("./lib-BMrXwoDK.js"),[],import.meta.url),V(()=>import("./lib-CcQ1AdFH.js"),[],import.meta.url),V(()=>import("./lib-K8ZzEBaR.js"),[],import.meta.url),V(()=>import("./lib-ClNhs2cv.js"),[],import.meta.url),V(()=>import("./lib-CSYbEQXY.js"),[],import.meta.url),V(()=>import("./lib-DoORityU.js"),[],import.meta.url)],mimeExtensionPromises:[V(()=>import("./index-UMhfKl2p.js").then(s=>s.l),[],import.meta.url),V(()=>import("./index-UMhfKl2p.js").then(s=>s.k),[],import.meta.url)]});class Hs extends sc{constructor(e){super(e),this._formatChanged=new U(this),e.shell.addClass("jp-ThemedContainer"),this.contextMenu=new dp({commands:this.commands,renderer:e.contextMenuRenderer,groupByTarget:!1,sortBySelector:!1});const t=new Promise(n=>{requestAnimationFrame(()=>{n()})});this.commandLinker=e.commandLinker||new ph({commands:this.commands}),this.docRegistry=e.docRegistry||new Fe,this.restored=e.restored||this.started.then(()=>t).catch(()=>t),this.serviceManager=e.serviceManager||new Be.ServiceManager}get format(){return this._format}set format(e){this._format!==e&&(this._format=e,document.body.dataset.format=e,this._formatChanged.emit(e))}get formatChanged(){return this._formatChanged}contextMenuHitTest(e){if(!this._contextMenuEvent||!(this._contextMenuEvent.target instanceof Node))return;let t=this._contextMenuEvent.target;do{if(t instanceof HTMLElement&&e(t))return t;t=t.parentNode}while(t&&t.parentNode&&t!==t.parentNode)}evtContextMenu(e){if(this._contextMenuEvent=e,e.shiftKey||Vs.suppressContextMenu(e.target))return;if(this.contextMenu.open(e)){const n=this.contextMenu.menu.items;if(n.length===1&&n[0].command===zs.contextMenu){this.contextMenu.menu.close();return}e.preventDefault(),e.stopPropagation()}}}(function(s){function e(t,n){const i=new RegExp(`^${n.urls.doc}`);return!!t.match(i)}s.inDocMode=e,s.IPaths=new Ae("@jupyterlab/application:IPaths",`A service providing information about various
425
+ Writable: %1`,i.writable),n.title=$,n.setAttribute("data-file-type",b),i.name.startsWith(".")?n.setAttribute("data-is-dot","true"):n.removeAttribute("data-is-dot");const L=i.indices?i.indices:[];let M=Dr.highlight(i.name,L,ae.mark);if(E&&$t.render(ae.span(M),E),y){let z;r.contentType==="directory"?z=l?g.__('Deselect directory "%1"',M):g.__('Select directory "%1"',M):z=l?g.__('Deselect file "%1"',M):g.__('Select file "%1"',M),y.setAttribute("aria-label",z),y.checked=l??!1}this.updateItemSize(n,i,c,d,u)}updateItemSize(n,i,r,o,a){if(o)for(const d of s.columns){const u=q.findElement(n,d.itemClassName);if(!u)continue;const h=o[d.id],m=h===null?"":h+"px";m!==u.style.width&&(u.style.width=m)}let l=q.findElement(n,Jt);i.last_modified&&l&&this.updateItemModified(l,i.last_modified,r??"short");let c=q.findElement(n,Yt);i.created&&c&&this.updateItemCreated(c,i.created,a??"short")}getNameNode(n){return q.findElement(n,Gt)}getCheckboxNode(n){return n.querySelector(`.${It} input[type=checkbox]`)}createDragImage(n,i,r,o){const a=n.cloneNode(!0),l=q.findElement(a,gn),c=s.columns.filter(d=>d.id!=="name");for(const d of c){const u=q.findElement(a,d.itemClassName);u&&a.removeChild(u)}if(o?(l.textContent=o.iconLabel||"",l.className=o.iconClass||""):(l.textContent="",l.className=""),l.classList.add(Mg),i>1){const d=q.findElement(a,Gt);d.textContent=r._n("%1 Item","%1 Items",i)}return a}createHeaderItemNode(n){const i=document.createElement("div"),r=document.createElement("span"),o=document.createElement("span");return i.className=ir,r.className=fs,o.className=Ln,r.textContent=n,i.appendChild(r),i.appendChild(o),i}_createHeaderItemNodeWithSizes(n){const i=document.createElement("div");i.className=ir;const r=document.createElement("span");r.className=Ln;for(let o of Object.keys(n)){const a=document.createElement("span");a.classList.add(fs,fs+"-"+o),a.textContent=n[o],i.appendChild(a)}return i.appendChild(r),i}}s.Renderer=e,s.defaultRenderer=new e})(Ue||(Ue={}));var le;(function(s){function e(h,m,_){const b=h.parentElement;b.replaceChild(m,h),m.focus();const g=m.value.lastIndexOf(".");return g===-1?m.setSelectionRange(0,m.value.length):m.setSelectionRange(0,g),new Promise(p=>{m.onblur=()=>{b.replaceChild(h,m),p(m.value)},m.onkeydown=w=>{switch(w.key){case"Enter":w.stopPropagation(),w.preventDefault(),m.blur();break;case"Escape":w.stopPropagation(),w.preventDefault(),m.value=_,m.blur(),h.focus();break}}})}s.userInputForRename=e;function t(h,m,_=!1,b=!0,g){const p=Array.from(h),w=m.direction==="descending"?1:-1;function v(x,S){return _?x.type!==S.type:x.type==="directory"!=(S.type==="directory")}function y(x){return x.type==="directory"?2:x.type==="notebook"&&_?1:0}function C(x,S){var A;const I=navigator.language.split("@")[0],P=((A=g.languageCode)!==null&&A!==void 0?A:I).replace("_","-"),D={numeric:b,sensitivity:"base"};try{return x.name.localeCompare(S.name,P,D)}catch{return console.warn(`localeCompare failed to compare ${x.name} and ${S.name} under languageCode: ${P}`),x.name.localeCompare(S.name,I,D)}}function E(x){return(S,A)=>{if(v(S,A))return y(A)-y(S);const I=x(S,A);return I!==0?I*w:C(S,A)}}return m.key==="last_modified"?p.sort(E((x,S)=>new Date(x.last_modified).getTime()-new Date(S.last_modified).getTime())):m.key==="file_size"?p.sort(E((x,S)=>{var A,I;return((A=S.size)!==null&&A!==void 0?A:0)-((I=x.size)!==null&&I!==void 0?I:0)})):m.key==="date_created"?p.sort(E((x,S)=>{var A,I;return new Date((A=x.created)!==null&&A!==void 0?A:"").getTime()-new Date((I=S.created)!==null&&I!==void 0?I:"").getTime()})):p.sort(E((x,S)=>C(S,x))),p}s.sort=t,s.isResizable=h=>"resizable"in h&&h.resizable,s.isSortable=h=>"sortable"in h&&h.sortable;function n(h,m){return Y.findFirstIndex(h,_=>Kt.hitTest(_,m.clientX,m.clientY)||m.target===_)}s.hitTestNodes=n;function i(h,m,_){_?((_==="down"?$n:Zl).element({container:h,tag:"span",stylesheet:"listingHeaderItem"}),m==="left"?h.style.order="-1":h.style.order=""):(Bt.remove(h),h.className=Ln)}s.updateCaret=i;async function r(h,m,_){const b=await h.newUntitled({path:m,type:"directory"}),g=O.PathExt.join(m,b.name),p=O.PathExt.join(m,_);try{await h.rename(g,p)}catch{await h.deleteFile(g)}return p}s.createDirectory=r;function o(h){return h.isDirectory}s.isDirectoryEntry=o;function a(h){return h.isFile}s.isFileEntry=a;function l(h){return h.webkitGetAsEntry?h.webkitGetAsEntry():"getAsEntry"in h?h.getAsEntry():null}s.defensiveGetAsEntry=l;function c(h){return new Promise((m,_)=>h.readEntries(m,_))}function d(h){return new Promise((m,_)=>h.file(m,_))}s.readFile=d;async function u(h){const m=[];let _=!1;for(;!_;){const b=await c(h);b.length===0?_=!0:m.push(...b)}return m}s.collectEntries=u})(le||(le={}));function dr(s,e,t){if(s===0)return"0 B";const n=e,i=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],r=Math.floor(Math.log(s)/Math.log(t));return r>=0&&r<i.length?parseFloat((s/Math.pow(t,r)).toFixed(n))+" "+i[r]:String(s)}const Bg="jp-FileBrowser",Wg="jp-FileBrowser-Panel",Hg="jp-FileBrowser-accordion",Vg="jp-FileBrowser-crumbs",zg="jp-FileBrowser-toolbar",Ug="jp-FileBrowser-filterToolbar",$g="jp-FileBrowser-listing",Kg="jp-FileBrowser-filterBox";class qg extends Pp{constructor(e){var t;super({content:new pt,translator:e.translator}),this._directoryPending=null,this._filePending=null,this._fileFilterRef=R.createRef(),this._clearFilterOnNavigation=!0,this._allowSingleClick=!1,this._showFileCheckboxes=!1,this._showFileFilter=!1,this._showDateCreatedColumn=!1,this._showFileSizeColumn=!1,this._showHiddenFiles=!1,this._showLastModifiedColumn=!0,this._sortNotebooksFirst=!1,this._sortFileNamesNaturally=!0,this._allowFileUploads=!0,this._selectionChanged=new U(this),this._sectionChanged=new U(this),this._accordion=null,this.addClass(Bg),this.toolbar.addClass(zg),this.id=e.id;const n=this.translator=(t=e.translator)!==null&&t!==void 0?t:se,i=this.model=e.model,r=e.renderer;i.connectionFailure.connect(this._onConnectionFailure,this),i.pathChanged.connect(this._onPathChanged,this),this._manager=i.manager,this.toolbar.node.setAttribute("aria-label",this._trans.__("file browser")),this.mainPanel=new pt,this.mainPanel.addClass(Wg),this.mainPanel.title.label=this._trans.__("File Browser"),this.crumbs=new Ag({model:i,translator:n,onPathEdited:()=>{requestAnimationFrame(()=>{this._focusListingContentOrCrumb()})},onPathActivated:()=>{requestAnimationFrame(()=>{this._focusListingContentOrCrumb()})}}),this.crumbs.addClass(Vg);const o=Sp({updateFilter:(a,l)=>{this.model.setFilter(c=>a(c.name.toLowerCase()))},useFuzzyFilter:this.model.useFuzzyFilter,placeholder:this._trans.__("Filter files by name"),forceRefresh:!1,showIcon:!1,inputRef:this._fileFilterRef,filterSettingsChanged:this.model.filterSettingsChanged});o.addClass(Kg),this.filterToolbar=new jr,this.filterToolbar.addClass(Ug),this.filterToolbar.node.setAttribute("aria-label",this._trans.__("File browser toolbar")),this.filterToolbar.addItem("fileNameSearcher",o),this.filterToolbar.setHidden(!this.showFileFilter),this.listing=this.createDirListing({model:i,renderer:r,translator:n,state:e.state,handleOpenFile:e.handleOpenFile}),this.listing.addClass($g),this.listing.selectionChanged.connect(()=>{this._selectionChanged.emit()}),this.mainPanel.addWidget(this.crumbs),this.mainPanel.addWidget(this.filterToolbar),this.mainPanel.addWidget(this.listing),this.addWidget(this.mainPanel),e.restore!==!1&&i.restore(this.id),this.listing.restore(this.id)}get navigateToCurrentDirectory(){return this._navigateToCurrentDirectory}set navigateToCurrentDirectory(e){this._navigateToCurrentDirectory=e}get showLastModifiedColumn(){return this._showLastModifiedColumn}set showLastModifiedColumn(e){this.listing.setColumnVisibility?(this.listing.setColumnVisibility("last_modified",e),this._showLastModifiedColumn=e):console.warn("Listing does not support toggling column visibility")}get minimumBreadcrumbsLeftItems(){return this.crumbs.minimumLeftItems}set minimumBreadcrumbsLeftItems(e){this.crumbs.minimumLeftItems=e}get minimumBreadcrumbsRightItems(){return this.crumbs.minimumRightItems}set minimumBreadcrumbsRightItems(e){this.crumbs.minimumRightItems=e}get showFullPath(){return this.crumbs.fullPath}set showFullPath(e){this.crumbs.fullPath=e}editPath(){this.crumbs.enterEditMode()}get showDateCreatedColumn(){return this._showDateCreatedColumn}set showDateCreatedColumn(e){this.listing.setColumnVisibility?(this.listing.setColumnVisibility("date_created",e),this._showDateCreatedColumn=e):console.warn("Listing does not support toggling column visibility")}get showFileSizeColumn(){return this._showFileSizeColumn}set showFileSizeColumn(e){this.listing.setColumnVisibility?(this.listing.setColumnVisibility("file_size",e),this._showFileSizeColumn=e):console.warn("Listing does not support toggling column visibility")}get showHiddenFiles(){return this._showHiddenFiles}set showHiddenFiles(e){this.model.showHiddenFiles(e),this._showHiddenFiles=e}get showFileCheckboxes(){return this._showFileCheckboxes}set showFileCheckboxes(e){this.listing.setColumnVisibility?(this.listing.setColumnVisibility("is_selected",e),this._showFileCheckboxes=e):console.warn("Listing does not support toggling column visibility")}get showFileFilter(){return this._showFileFilter}set showFileFilter(e){var t;this.showFileFilter&&!e&&(this._fileFilterRef.current&&(this._fileFilterRef.current.value=""),this.model.setFilter(i=>({})),this.model.refresh().catch(console.warn)),this._showFileFilter=e,this.filterToolbar.setHidden(!this.showFileFilter),this.showFileFilter&&((t=this._fileFilterRef.current)===null||t===void 0||t.focus())}get clearFilterOnNavigation(){return this._clearFilterOnNavigation}set clearFilterOnNavigation(e){this._clearFilterOnNavigation=e}get sortNotebooksFirst(){return this._sortNotebooksFirst}set sortNotebooksFirst(e){this.listing.setNotebooksFirstSorting?(this.listing.setNotebooksFirstSorting(e),this._sortNotebooksFirst=e):console.warn("Listing does not support sorting notebooks first")}get sortFileNamesNaturally(){return this._sortFileNamesNaturally}set sortFileNamesNaturally(e){this.listing.setSortFileNamesNaturally?(this.listing.setSortFileNamesNaturally(e),this._sortFileNamesNaturally=e):console.warn("Listing does not support natural file name sorting")}get singleClickNavigation(){return this._allowSingleClick}set singleClickNavigation(e){this.listing.setAllowSingleClickNavigation?(this.listing.setAllowSingleClickNavigation(e),this._allowSingleClick=e):console.warn("Listing does not support single click navigation")}get allowFileUploads(){return this._allowFileUploads}set allowFileUploads(e){this.model.allowFileUploads=e,this.listing.setAllowDragDropUpload?(this.listing.setAllowDragDropUpload(e),this._allowFileUploads=e):console.warn("Listing does not support setting upload")}selectedItems(){return this.listing.selectedItems()}get selectionChanged(){return this._selectionChanged}get sectionChanged(){return this._sectionChanged}async selectItemByName(e){await this.listing.selectItemByName(e)}clearSelectedItems(){this.listing.clearSelectedItems()}_focusListingContentOrCrumb(){var e;if((e=this.listing.sortedItems().next().done)!==null&&e!==void 0&&e){this.crumbs.focusLastCrumb();return}this.listing.activate()}rename(){return this.listing.rename()}cut(){this.listing.cut()}copy(){this.listing.copy()}paste(){return this.listing.paste()}_onPathChanged(){if(this._clearFilterOnNavigation){const e=this._fileFilterRef.current,t=e?e.value:"";t&&t.trim()!==""&&(this.model.setFilter(n=>({})),e&&(e.value=""))}}async _createNew(e){if(e.path){const t=this._manager.services.contents.localPath(e.path);e.path=this._toDrivePath(this.model.driveName,t)}try{const t=await this._manager.newUntitled(e);return await this.listing.selectItemByName(t.name,!0),await this.rename(),t}catch(t){throw ve(this._trans.__("Error"),t),t}}async createNewDirectory(){if(this._directoryPending)return this._directoryPending;this._directoryPending=this._createNew({path:this.model.path,type:"directory"});try{return await this._directoryPending}finally{this._directoryPending=null}}async createNewFile(e){if(this._filePending)return this._filePending;this._filePending=this._createNew({path:this.model.path,type:"file",ext:e.ext});try{return await this._filePending}finally{this._filePending=null}}delete(){return this.listing.delete()}duplicate(){return this.listing.duplicate()}selectAll(){return this.listing.selectAll()}download(){return this.listing.download()}async goUp(){return this.listing.goUp()}shutdownKernels(){return this.listing.shutdownKernels()}selectNext(){this.listing.selectNext()}selectPrevious(){this.listing.selectPrevious()}modelForClick(e){return this.listing.modelForClick(e)}createDirListing(e){return new Ue(e)}_onConnectionFailure(e,t){if(t instanceof Be.ServerConnection.ResponseError&&t.response.status===404){const n=this._trans.__("Directory not found");t.message=this._trans.__('Directory not found: "%1"',this.model.path),ve(n,t)}}addSection(e){if(this._accordion)this._accordion.addWidget(e);else{const t=new Un({layout:Nn.createLayout({})});t.addClass(Hg),t.addWidget(this.mainPanel),t.addWidget(e),this._accordion=t,this.content.addWidget(t)}this._sectionChanged.emit()}removeSectionWidget(e){!this._accordion||e.parent!==this._accordion||(e.parent=null,this._accordion.widgets.length===1&&this._accordion.widgets[0]===this.mainPanel&&(this.mainPanel.isHidden&&this.mainPanel.show(),this.content.addWidget(this.mainPanel),this._accordion.dispose(),this._accordion=null),this._sectionChanged.emit())}get sections(){return this._accordion?this._accordion.widgets.filter(e=>e!==this.mainPanel):[]}get accordionPanel(){return this._accordion}_toDrivePath(e,t){return e===""?t:`${e}:${O.PathExt.removeSlash(t)}`}}const Gg=1e4,ur=15*1024*1024,wn=1024*1024;class Jg{constructor(e){var t,n;this._connectionFailure=new U(this),this._fileChanged=new U(this),this._items=[],this._key="",this._pathChanged=new U(this),this._paths=new Set,this._pending=null,this._pendingPath=null,this._refreshed=new U(this),this._sessions=[],this._state=null,this._isDisposed=!1,this._restored=new it,this._uploads=[],this._uploadChanged=new U(this),this.manager=e.manager,this.translator=e.translator||se,this._trans=this.translator.load("jupyterlab"),this._driveName=e.driveName||"",this._root=e.root||"",this._allowFileUploads=(t=e.allowFileUploads)!==null&&t!==void 0?t:!0,this._model={path:this.rootPath,name:O.PathExt.basename(this.rootPath),type:"directory",content:void 0,writable:!1,created:"unknown",last_modified:"unknown",mimetype:"text/plain",format:"text"},this._state=e.state||null;const i=e.refreshInterval||Gg,{services:r}=e.manager;r.contents.fileChanged.connect(this.onFileChanged,this),r.sessions.runningChanged.connect(this.onRunningChanged,this),this._unloadEventListener=o=>{if(this._uploads.length>0){const a=this._trans.__("Files still uploading");return o.returnValue=a,a}},window.addEventListener("beforeunload",this._unloadEventListener),this._poll=new Ql({auto:(n=e.auto)!==null&&n!==void 0?n:!0,name:"@jupyterlab/filebrowser:Model",factory:()=>this.cd("."),frequency:{interval:i,backoff:!0,max:300*1e3},standby:e.refreshStandby||"when-hidden"})}get connectionFailure(){return this._connectionFailure}get driveName(){return this._driveName}get restored(){return this._restored.promise}get fileChanged(){return this._fileChanged}get path(){return this._model?this._model.path:""}get rootPath(){return this._driveName?this._driveName+":":""}get root(){return this._root}get pathChanged(){return this._pathChanged}get refreshed(){return this._refreshed}get specs(){return this.manager.services.kernelspecs.specs}get isDisposed(){return this._isDisposed}get uploadChanged(){return this._uploadChanged}uploads(){return this._uploads[Symbol.iterator]()}dispose(){this.isDisposed||(window.removeEventListener("beforeunload",this._unloadEventListener),this._isDisposed=!0,this._poll.dispose(),this._sessions.length=0,this._items.length=0,U.clearData(this))}items(){return this._items[Symbol.iterator]()}sessions(){return this._sessions[Symbol.iterator]()}async refresh(){await this._poll.refresh(),await this._poll.tick,this._refreshed.emit(void 0)}async cd(e="."){const t=e===".";if(e!=="."?e=this.manager.services.contents.resolvePath(this._model.path,e):e=this._pendingPath||this._model.path,!da(e,this._root))if(t)e=this._root;else return;if(this._pending){if(e===this._pendingPath)return this._pending;await this._pending}const n=this.path,i={content:!0};this._pendingPath=e,n!==e&&(this._sessions.length=0);const r=this.manager.services;return this._pending=r.contents.get(e,i).then(o=>{this.isDisposed||(this.handleContents(o),this._pendingPath=null,this._pending=null,n!==e&&(this._state&&this._key&&this._state.save(this._key,{path:e}),this._pathChanged.emit({name:"path",oldValue:n,newValue:e})),this.onRunningChanged(r.sessions,r.sessions.running()),this._refreshed.emit(void 0))}).catch(o=>{this._pendingPath=null,this._pending=null;const a=this._root||"/";if(o.response&&o.response.status===404&&e!==a)return o.message=this._trans.__('Directory not found: "%1"',this._model.path),console.error(o),this._connectionFailure.emit(o),this.cd(a);this._connectionFailure.emit(o)}),this._pending}async download(e){const t=await this.manager.services.contents.getDownloadUrl(e),n=document.createElement("a");n.href=t,n.download="",document.body.appendChild(n),n.click(),document.body.removeChild(n)}async restore(e,t=!0){const{manager:n}=this,i=`file-browser-${e}:cwd`,r=this._state;if(!this._key){if(this._key=i,!t||!r){this._restored.resolve(void 0);return}await n.services.ready;try{const a=await r.fetch(i);if(!a){this._restored.resolve(void 0);return}const l=a.path;l&&await this.cd("/");const c=n.services.contents.localPath(l);await n.services.contents.get(l),await this.cd(c)}catch{await r.remove(i)}this._restored.resolve(void 0)}}get allowFileUploads(){return this._allowFileUploads}set allowFileUploads(e){this._allowFileUploads=e}async upload(e,t){if(!this._allowFileUploads)throw new Error(this._trans.__("File uploads are disabled"));const n=O.PageConfig.getNotebookVersion(),i=O.compareVersions(n,[4,0,0])<0||O.compareVersions(n,[5,1,0])>=0,r=e.size>ur;if(r&&!i){const l=this._trans.__("Cannot upload file (>%1 MB). %2",ur/1048576,e.name);throw console.warn(l),l}const o="File not uploaded";if(r&&!await this._shouldUploadLarge(e))throw"Cancelled large file upload";if(await this._uploadCheckDisposed(),await this.refresh(),await this._uploadCheckDisposed(),this._items.find(l=>l.name===e.name)&&!await la(e.name))throw o;await this._uploadCheckDisposed();const a=i&&e.size>wn;return await this._upload(e,a,t)}async _shouldUploadLarge(e){const{button:t}=await ft({title:this._trans.__("Large file size warning"),body:this._trans.__("The file size is %1 MB. Do you still want to upload it?",Math.round(e.size/1048576)),buttons:[_e.cancelButton({label:this._trans.__("Cancel")}),_e.warnButton({label:this._trans.__("Upload")})]});return t.accept}async _upload(e,t,n){let i=typeof n>"u"?this._model.path:n;i=i?i+"/"+e.name:e.name;const r=e.name,o="file",a="base64",l=async(u,h)=>{await this._uploadCheckDisposed();const m=new FileReader;m.readAsDataURL(u),await new Promise((g,p)=>{m.onload=g,m.onerror=w=>p(`Failed to upload "${e.name}":`+w)}),await this._uploadCheckDisposed();const _=m.result.split(",")[1],b={type:o,format:a,name:r,chunk:h,content:_};return await this.manager.services.contents.save(i,b)};if(!t)return await l(e);let c,d={path:i,progress:0};this._uploadChanged.emit({name:"start",newValue:d,oldValue:null});for(let u=0;!c;u+=wn){const h=u+wn,m=h>=e.size,_=m?-1:h/wn,b={path:i,progress:u/e.size};Y.removeFirstOf(this._uploads,d),this._uploads.push(b),this._uploadChanged.emit({name:"update",newValue:b,oldValue:d}),d=b;let g;try{g=await l(e.slice(u,h),_)}catch(p){throw Y.removeFirstOf(this._uploads,d),this._uploadChanged.emit({name:"failure",newValue:d,oldValue:null}),p}m&&(c=g)}return Y.removeFirstOf(this._uploads,d),this._uploadChanged.emit({name:"finish",newValue:null,oldValue:d}),c}_uploadCheckDisposed(){return this.isDisposed?Promise.reject("Filemanager disposed. File upload canceled"):Promise.resolve()}handleContents(e){this._model={name:e.name,path:e.path,type:e.type,content:void 0,writable:e.writable,created:e.created,last_modified:e.last_modified,size:e.size,mimetype:e.mimetype,format:e.format},this._items=e.content,this._paths.clear(),e.content.forEach(t=>{this._paths.add(t.path)})}onRunningChanged(e,t){this._populateSessions(t),this._refreshed.emit(void 0)}onFileChanged(e,t){const n=this._model.path,{sessions:i}=this.manager.services,{oldValue:r,newValue:o}=t,a=this.driveName.length>0?this.driveName+":":"";if(r&&r.path&&a+O.PathExt.dirname(r.path)===n?r:o&&o.path&&a+O.PathExt.dirname(o.path)===n?o:void 0){this._poll.refresh(),this._populateSessions(i.running()),this._fileChanged.emit(t);return}}_populateSessions(e){this._sessions.length=0;for(const t of e)this._paths.has(t.path)&&this._sessions.push(t)}}class Yg extends Jg{constructor(e){super(e),this._includeHiddenFiles=e.includeHiddenFiles||!1}items(){return this._includeHiddenFiles?super.items():Mn(super.items(),e=>!e.name.startsWith("."))}get includeHiddenFiles(){return this._includeHiddenFiles}showHiddenFiles(e){this._includeHiddenFiles=e,this.refresh()}}class Xg extends Yg{constructor(e){var t,n,i;super(e),this._filterSettingsChanged=new U(this),this._filter=(t=e.filter)!==null&&t!==void 0?t:(r=>({})),this._filterDirectories=(n=e.filterDirectories)!==null&&n!==void 0?n:!0,this._useFuzzyFilter=(i=e.useFuzzyFilter)!==null&&i!==void 0?i:!0}get filterDirectories(){return this._filterDirectories}set filterDirectories(e){this._filterDirectories=e}get useFuzzyFilter(){return this._useFuzzyFilter}set useFuzzyFilter(e){this._useFuzzyFilter!==e&&(this._useFuzzyFilter=e,this._filterSettingsChanged.emit({useFuzzyFilter:e}))}get filterSettingsChanged(){return this._filterSettingsChanged}items(){return Mn(super.items(),e=>{if(!this._filterDirectories&&e.type==="directory")return!0;{const t=this._filter(e);return e.indices=t?.indices,!!t}})}setFilter(e){this._filter=e,this.refresh()}}const Zg="jpCodeRunner",Qg="jpUndoer";class Ht extends X{constructor(e){super(),this._ready=new it,this.addClass("jp-FileEditor");const t=this._context=e.context;this._mimeTypeService=e.mimeTypeService;const n=this._editorWidget=new tc({factory:e.factory,model:t.model,editorOptions:{config:Ht.defaultEditorConfig}});this._editorWidget.addClass("jp-FileEditorCodeWrapper"),this._editorWidget.node.dataset[Zg]="true",this._editorWidget.node.dataset[Qg]="true",this.editor=n.editor,this.model=n.model;const i=Ht.defaultEditorConfig.scrollPastEnd;this.toggleClass("jp-mod-scrollPastEnd",i),t.ready.then(()=>{this._onContextReady()}),this._onPathChanged(),t.pathChanged.connect(this._onPathChanged,this),(this.layout=new Wr).addWidget(n)}get context(){return this._context}get ready(){return this._ready.promise}handleEvent(e){this.model&&e.type==="mousedown"&&this._ensureFocus()}onAfterAttach(e){super.onAfterAttach(e),this.node.addEventListener("mousedown",this)}onBeforeDetach(e){this.node.removeEventListener("mousedown",this)}onActivateRequest(e){this._ensureFocus()}_ensureFocus(){this.editor.hasFocus()||this.editor.focus()}_onContextReady(){this.isDisposed||(this.editor.clearHistory(),this._ready.resolve(void 0))}_onPathChanged(){const e=this.editor,t=this._context.localPath;e.model.mimeType=this._mimeTypeService.getMimeTypeByFilePath(t)}}(function(s){s.defaultEditorConfig={lineNumbers:!0,scrollPastEnd:!0}})(Ht||(Ht={}));class ey extends Qt{async setFragment(e){const t=e.split("=");if(t[0]!=="#line")return;const n=t[1];let i;return n.includes(",")?i=n.split(",")[0]||"0":i=n,this.context.ready.then(()=>{const r={line:parseInt(i,10),column:0};this.content.editor.setCursorPosition(r),this.content.editor.revealPosition(r)})}}class ty extends Br{constructor(e){super(e.factoryOptions),this._services=e.editorServices}createNewWidget(e){const t=this._services.factoryService.newDocumentEditor,n=o=>t(o),i=new Ht({factory:n,context:e,mimeTypeService:this._services.mimeTypeService});return i.title.icon=ec,new ey({content:i,context:e})}}class ny{_fileBrowserPanel;constructor(e){this._fileBrowserPanel=new Pe,this._fileBrowserPanel.id="dla-jlab-FleBrowser",this._fileBrowserPanel.orientation="horizontal",this._fileBrowserPanel.spacing=0,e.ready.then(()=>{t(e,this._fileBrowserPanel)});function t(i,r){const o=[];let a;const l={opened:new U(this),open:C=>{o.indexOf(C)===-1&&(w.addWidget(C,{mode:"tab-after"}),o.push(C)),w.activateWidget(C),a=C,C.disposed.connect(E=>{const x=o.indexOf(E);o.splice(x,1)})}},c=new Fe,d=new wg({registry:c,manager:i,opener:l}),u=new Fn;Fn.getDefaultLanguages().filter(C=>["ipython","julia","python"].includes(C.name.toLowerCase())).forEach(C=>{u.addLanguage(C)}),u.addLanguage({name:"ipythongfm",mime:"text/x-ipythongfm",load:async()=>(await V(()=>import("./dist-DFPs7B3v.js"),[],import.meta.url)).markdown({codeLanguages:E=>u.findBest(E)})});const h={factoryService:new lo,mimeTypeService:new co(u)},m=new ty({editorServices:h,factoryOptions:{name:"Editor",modelName:"text",fileTypes:["*"],defaultFor:["*"],preferKernel:!1,canStartKernel:!0}});c.addWidgetFactory(m);const _=new oi,b=new Xg({manager:d}),g=new qg({id:"filebrowser",model:b}),p=new En({icon:Tr,onClick:()=>{d.newUntitled({type:"file",path:b.path}).then(C=>{d.open(C.path)})}});g.toolbar.insertItem(0,"create",p),r.addWidget(g),Pe.setStretch(g,0);const w=new zn;r.addWidget(w),Pe.setStretch(w,1),w.spacing=8,document.addEventListener("focus",C=>{for(let E=0;E<o.length;E++){const x=o[E];if(x.node.contains(C.target)){a=x;break}}}),_.addCommand("file-open",{label:"Open",mnemonic:0,execute:()=>{nc(g.selectedItems(),C=>{d.openOrReveal(C.path)})}}),_.addCommand("file-rename",{label:"Rename",mnemonic:0,execute:()=>g.rename()}),_.addCommand("file-save",{execute:()=>d.contextForWidget(a)?.save()}),_.addCommand("file-cut",{label:"Cut",execute:()=>{g.cut()}}),_.addCommand("file-copy",{label:"Copy",mnemonic:0,execute:()=>{g.copy()}}),_.addCommand("file-delete",{label:"Delete",mnemonic:0,execute:()=>g.delete()}),_.addCommand("file-duplicate",{label:"Duplicate",mnemonic:0,execute:()=>g.duplicate()}),_.addCommand("file-paste",{label:"Paste",mnemonic:0,execute:()=>g.paste()}),_.addCommand("file-download",{label:"Download",execute:()=>g.download()}),_.addCommand("file-shutdown-kernel",{label:"Shut Down Kernel",execute:()=>g.shutdownKernels()}),_.addCommand("file-dialog-demo",{label:"Dialog Demo",execute:()=>{n()}}),_.addCommand("file-info-demo",{label:"Info Demo",execute:()=>{ft({title:"Cool Title",body:"The quick brown fox jumped over the lazy dog",buttons:[_e.okButton()]})}}),_.addKeyBinding({keys:["Enter"],selector:".jp-DirListing",command:"file-open"}),_.addKeyBinding({keys:["Accel S"],selector:".jp-CodeMirrorEditor",command:"file-save"}),window.addEventListener("keydown",C=>{_.processKeydownEvent(C)});const v=new kn({commands:_});v.addItem({command:"file-open"}),v.addItem({command:"file-rename"}),v.addItem({command:"file-remove"}),v.addItem({command:"file-duplicate"}),v.addItem({command:"file-delete"}),v.addItem({command:"file-cut"}),v.addItem({command:"file-copy"}),v.addItem({command:"file-paste"}),v.addItem({command:"file-shutdown-kernel"}),v.addItem({command:"file-dialog-demo"}),v.addItem({command:"file-info-demo"}),g.node.getElementsByClassName("jp-DirListing-content")[0].addEventListener("contextmenu",C=>{C.preventDefault();const E=C.clientX,x=C.clientY;v.open(E,x)}),window.addEventListener("resize",()=>{r.update()})}function n(){const i=document.createElement("div"),r=document.createElement("input");r.value="Untitled.ipynb";const o=document.createElement("select"),a=document.createElement("option");a.value="python",a.text="Python",o.appendChild(a);const l=document.createElement("option");l.value="julia",l.text="Julia",o.appendChild(l),i.appendChild(r),i.appendChild(o),ft({title:"Create new notebook"})}}get panel(){return this._fileBrowserPanel}}const sy=()=>{const{serviceManager:s}=Je(),[e,t]=R.useState();return R.useEffect(()=>{if(s){const n=new ny(s);t(n)}},[s]),e?f.jsx(Vt,{children:e.panel}):f.jsx(f.Fragment,{})},iy={extensionPromises:[V(()=>import("./lib-DtwAoDYT.js"),[],import.meta.url),V(()=>import("./lib-D8bmwG1Q.js"),[],import.meta.url),V(()=>import("./lib-DdHOeWKF.js"),[],import.meta.url),V(()=>import("./lib-CBSRQHoK.js"),[],import.meta.url),V(()=>import("./lib-BQZeV_uH.js"),[],import.meta.url),V(()=>import("./lib-BPAFvW23.js"),[],import.meta.url),V(()=>import("./lib-BewlLHfg.js"),[],import.meta.url),V(()=>import("./lib-C-Ggs4iB.js"),[],import.meta.url),V(()=>import("./lib-5rtxMXPk.js"),[],import.meta.url),V(()=>import("./lib-CiFgHF6H.js"),[],import.meta.url),V(()=>import("./lib-Cs68pT1f.js"),[],import.meta.url),V(()=>import("./lib-B8dqehoH.js"),[],import.meta.url),V(()=>import("./lib-BEADLX2g.js"),[],import.meta.url),V(()=>import("./lib-BCnNB350.js"),[],import.meta.url),V(()=>import("./lib-euir_64d.js"),[],import.meta.url),V(()=>import("./lib-D8Qc-bJh.js"),[],import.meta.url),V(()=>import("./lib-Bj-F8WWr.js"),[],import.meta.url),V(()=>import("./lib-DoORityU.js"),[],import.meta.url)],mimeExtensionPromises:[V(()=>import("./index-tO6w-mHa.js").then(s=>s.l),[],import.meta.url),V(()=>import("./index-tO6w-mHa.js").then(s=>s.k),[],import.meta.url)]},Ws=()=>({extensionPromises:[V(()=>import("./lib-DtwAoDYT.js"),[],import.meta.url),V(()=>import("./lib-D8bmwG1Q.js"),[],import.meta.url),V(()=>import("./lib-DdHOeWKF.js"),[],import.meta.url),V(()=>import("./lib-CBSRQHoK.js"),[],import.meta.url),V(()=>import("./lib-BQZeV_uH.js"),[],import.meta.url),V(()=>import("./lib-BPAFvW23.js"),[],import.meta.url),V(()=>import("./lib-CXZrbtJ9.js"),[],import.meta.url),V(()=>import("./lib-BewlLHfg.js"),[],import.meta.url),V(()=>import("./lib-C-Ggs4iB.js"),[],import.meta.url),V(()=>import("./lib-5rtxMXPk.js"),[],import.meta.url),V(()=>import("./lib-CiFgHF6H.js"),[],import.meta.url),V(()=>import("./lib-Cs68pT1f.js"),[],import.meta.url),V(()=>import("./lib-B8dqehoH.js"),[],import.meta.url),V(()=>import("./lib-BEADLX2g.js"),[],import.meta.url),V(()=>import("./lib-BCnNB350.js"),[],import.meta.url),V(()=>import("./lib-euir_64d.js"),[],import.meta.url),V(()=>import("./lib-D8Qc-bJh.js"),[],import.meta.url),V(()=>import("./lib-Bj-F8WWr.js"),[],import.meta.url),V(()=>import("./lib-bSDF86bC.js"),[],import.meta.url),V(()=>import("./lib-DoORityU.js"),[],import.meta.url)],mimeExtensionPromises:[V(()=>import("./index-tO6w-mHa.js").then(s=>s.l),[],import.meta.url),V(()=>import("./index-tO6w-mHa.js").then(s=>s.k),[],import.meta.url)]});class Hs extends sc{constructor(e){super(e),this._formatChanged=new U(this),e.shell.addClass("jp-ThemedContainer"),this.contextMenu=new dp({commands:this.commands,renderer:e.contextMenuRenderer,groupByTarget:!1,sortBySelector:!1});const t=new Promise(n=>{requestAnimationFrame(()=>{n()})});this.commandLinker=e.commandLinker||new ph({commands:this.commands}),this.docRegistry=e.docRegistry||new Fe,this.restored=e.restored||this.started.then(()=>t).catch(()=>t),this.serviceManager=e.serviceManager||new Be.ServiceManager}get format(){return this._format}set format(e){this._format!==e&&(this._format=e,document.body.dataset.format=e,this._formatChanged.emit(e))}get formatChanged(){return this._formatChanged}contextMenuHitTest(e){if(!this._contextMenuEvent||!(this._contextMenuEvent.target instanceof Node))return;let t=this._contextMenuEvent.target;do{if(t instanceof HTMLElement&&e(t))return t;t=t.parentNode}while(t&&t.parentNode&&t!==t.parentNode)}evtContextMenu(e){if(this._contextMenuEvent=e,e.shiftKey||Vs.suppressContextMenu(e.target))return;if(this.contextMenu.open(e)){const n=this.contextMenu.menu.items;if(n.length===1&&n[0].command===zs.contextMenu){this.contextMenu.menu.close();return}e.preventDefault(),e.stopPropagation()}}}(function(s){function e(t,n){const i=new RegExp(`^${n.urls.doc}`);return!!t.match(i)}s.inDocMode=e,s.IPaths=new Ae("@jupyterlab/application:IPaths",`A service providing information about various
426
426
  URLs and server paths for the current application. Use this service if you want to
427
- assemble URLs to use the JupyterLab REST API.`),s.ITreeResolver=new Ae("@jupyterlab/application:ITreeResolver","A service to resolve the tree path.")})(Hs||(Hs={}));var Vs;(function(s){function e(t){return t.closest("[data-jp-suppress-context-menu]")!==null}s.suppressContextMenu=e})(Vs||(Vs={}));var zs;(function(s){s.contextMenu="__internal:context-menu-info"})(zs||(zs={}));const ma=new Ae("@jupyterlab/application:ILayoutRestorer","A service providing application layout restoration functionality. Use this to have your activities restored across page loads."),hr="layout-restorer:data";class sv{constructor(e){this._deferred=new Array,this._deferredMainArea=null,this._firstDone=!1,this._promisesDone=!1,this._promises=[],this._restored=new it,this._trackers=new Set,this._widgets=new Map,this._mode="multiple-document",this._connector=e.connector,this._first=e.first,this._registry=e.registry,e.mode&&(this._mode=e.mode),this._first.then(()=>{this._firstDone=!0}).then(()=>Promise.all(this._promises)).then(()=>{this._promisesDone=!0,this._trackers.clear()}).then(()=>{this._restored.resolve(void 0)})}get isDeferred(){return this._deferred.length>0}get restored(){return this._restored.promise}add(e,t){Oe.nameProperty.set(e,t),this._widgets.set(t,e),e.disposed.connect(this._onWidgetDisposed,this)}async fetch(){var e;const t={fresh:!0,mainArea:null,downArea:null,leftArea:null,rightArea:null,topArea:null,relativeSizes:null},n=this._connector.fetch(hr);try{const[i]=await Promise.all([n,this.restored]);if(!i)return t;const{main:r,down:o,left:a,right:l,relativeSizes:c,top:d}=i,u=!1;let h=null;this._mode==="multiple-document"?h=this._rehydrateMainArea(r):this._deferredMainArea=r;const m=this._rehydrateDownArea(o),_=this._rehydrateSideArea(a),b=this._rehydrateSideArea(l);return{fresh:u,mainArea:h,downArea:m,leftArea:_,rightArea:b,relativeSizes:c||null,topArea:(e=d)!==null&&e!==void 0?e:null}}catch{return t}}async restore(e,t){if(this._firstDone)throw new Error("restore() must be called before `first` has resolved.");const{namespace:n}=e;if(this._trackers.has(n))throw new Error(`The tracker "${n}" is already restored.`);const{args:i,command:r,name:o,when:a}=t;this._trackers.add(n),e.widgetAdded.connect((c,d)=>{const u=o(d);u&&this.add(d,`${n}:${u}`)},this),e.widgetUpdated.connect((c,d)=>{const u=o(d);if(u){const h=`${n}:${u}`;Oe.nameProperty.set(d,h),this._widgets.set(h,d)}});const l=this._first;if(this._mode=="multiple-document"){const c=e.restore({args:i||(()=>jt.emptyObject),command:r,connector:this._connector,name:o,registry:this._registry,when:a?[l].concat(a):l}).catch(d=>{console.error(d)});return this._promises.push(c),c}e.defer({args:i||(()=>jt.emptyObject),command:r,connector:this._connector,name:o,registry:this._registry,when:a?[l].concat(a):l}),this._deferred.push(e)}async restoreDeferred(){if(!this.isDeferred)return null;const e=Promise.resolve(),t=this._deferred.map(n=>e.then(()=>n.restore()));return this._deferred.length=0,await Promise.all(t),this._rehydrateMainArea(this._deferredMainArea)}save(e){var t;if(!this._promisesDone){const i="save() was called prematurely.";return console.warn(i),Promise.reject(i)}const n={};if(n.main=this.isDeferred?this._deferredMainArea:this._dehydrateMainArea(e.mainArea),this.isDeferred){const i=(t=e.mainArea)===null||t===void 0?void 0:t.currentWidget;if(i){const r=Oe.nameProperty.get(i);n.main={...n.main,current:r||void 0}}}return n.down=this._dehydrateDownArea(e.downArea),n.left=this._dehydrateSideArea(e.leftArea),n.right=this._dehydrateSideArea(e.rightArea),n.relativeSizes=e.relativeSizes,n.top={...e.topArea},this._connector.save(hr,n)}_dehydrateMainArea(e){return e?Oe.serializeMain(e):null}_rehydrateMainArea(e){return e?Oe.deserializeMain(e,this._widgets):null}_dehydrateDownArea(e){if(!e)return null;const t={size:e.size};if(e.collapsed!==void 0&&(t.collapsed=e.collapsed),e.currentWidget){const n=Oe.nameProperty.get(e.currentWidget);n&&(t.current=n)}return e.widgets&&(t.widgets=e.widgets.map(n=>Oe.nameProperty.get(n)).filter(n=>!!n)),t}_rehydrateDownArea(e){var t;if(!e)return{currentWidget:null,size:0,widgets:null};const n=this._widgets,i=e.current&&n.has(`${e.current}`)?n.get(`${e.current}`):null,r=Array.isArray(e.widgets)?e.widgets.map(o=>n.has(`${o}`)?n.get(`${o}`):null).filter(o=>!!o):null;return{...typeof e.collapsed=="boolean"?{collapsed:e.collapsed}:{},currentWidget:i,size:(t=e.size)!==null&&t!==void 0?t:0,widgets:r}}_dehydrateSideArea(e){if(!e)return null;const t={collapsed:e.collapsed,visible:e.visible};if(e.currentWidget){const n=Oe.nameProperty.get(e.currentWidget);n&&(t.current=n)}return e.widgets&&(t.widgets=e.widgets.map(n=>Oe.nameProperty.get(n)).filter(n=>!!n)),e.widgetStates&&(t.widgetStates=e.widgetStates),t}_rehydrateSideArea(e){var t,n;if(!e)return{collapsed:!0,currentWidget:null,visible:!0,widgets:null,widgetStates:{null:{sizes:null,expansionStates:null}}};const i=this._widgets,r=(t=e.collapsed)!==null&&t!==void 0?t:!1,o=e.current&&i.has(`${e.current}`)?i.get(`${e.current}`):null,a=Array.isArray(e.widgets)?e.widgets.map(c=>i.has(`${c}`)?i.get(`${c}`):null).filter(c=>!!c):null,l=e.widgetStates;return{collapsed:r,currentWidget:o,widgets:a,visible:(n=e.visible)!==null&&n!==void 0?n:!0,widgetStates:l}}_onWidgetDisposed(e){const t=Oe.nameProperty.get(e);this._widgets.delete(t)}}var Oe;(function(s){s.nameProperty=new Ct({name:"name",create:d=>""});function e(d,u){for(let h=Math.min(u,d.length-1);h>=0;h--){const m=s.nameProperty.get(d[h]);if(m)return m}for(let h=u+1;h<d.length;h++){const m=s.nameProperty.get(d[h]);if(m)return m}return null}function t(d){if(!d||!d.type)return null;if(d.type==="tab-area"){const u=d.widgets.map(m=>s.nameProperty.get(m)).filter(m=>!!m),h=e(d.widgets,d.currentIndex);return{type:"tab-area",currentIndex:h?u.indexOf(h):0,widgets:u}}return{type:"split-area",orientation:d.orientation,sizes:d.sizes,children:d.children.map(t).filter(u=>!!u)}}function n(d){var u,h;const m={dock:d&&d.dock&&t(d.dock.main)||null};if(d&&d.currentWidget){const _=s.nameProperty.get(d.currentWidget)||i((h=(u=d.dock)===null||u===void 0?void 0:u.main)!==null&&h!==void 0?h:null,d.currentWidget);_&&(m.current=_)}return m}s.serializeMain=n;function i(d,u){if(!d)return null;if(d.type==="tab-area"){const h=d.widgets.indexOf(u);return h===-1?null:e(d.widgets,h)}for(const h of d.children){const m=i(h,u);if(m)return m}return null}function r(d,u,h){const m=[];let _=0;return d.forEach((b,g)=>{const p=h.get(b);p&&(g<=u&&(_=m.length),m.push(p))}),{type:"tab-area",currentIndex:_,widgets:m}}function o(d,u){if(!d)return null;const h=d.type||"unknown";if(h==="unknown"||h!=="tab-area"&&h!=="split-area")return console.warn(`Attempted to deserialize unknown type: ${h}`),null;if(h==="tab-area"){const{currentIndex:p,widgets:w}=d;return r(w||[],p||0,u)}const{orientation:m,sizes:_,children:b}=d;return{type:"split-area",orientation:m,sizes:_||[],children:b&&b.map(p=>o(p,u)).filter(p=>!!p)||[]}}function a(d,u){if(!d)return null;const h=d.current||null,m=d.dock||null,_=m?o(m,u):null;return{currentWidget:h&&(u.get(h)||l(m,h,u))||c(_),dock:m?{main:_}:null}}s.deserializeMain=a;function l(d,u,h){var m;if(!d)return null;if(d.type==="tab-area"){const _=d.widgets||[],b=_.indexOf(u);if(b===-1)return null;const g=r(_,b,h);return(m=g.widgets[g.currentIndex])!==null&&m!==void 0?m:null}for(const _ of d.children||[]){const b=l(_,u,h);if(b)return b}return null}function c(d){var u;if(!d)return null;if(d.type==="tab-area")return(u=d.widgets[d.currentIndex])!==null&&u!==void 0?u:null;for(const h of d.children){const m=c(h);if(m)return m}return null}})(Oe||(Oe={}));const ry=new Ae("@jupyterlab/application:IMimeDocumentTracker","A widget tracker for documents rendered using a mime renderer extension. Use this if you want to list and interact with documents rendered by such extensions.");function oy(s){const e=[],t="application-mimedocuments",n=new ic({namespace:t});return s.forEach(i=>{let r=i.default;i.hasOwnProperty("__esModule")||(r=i),Array.isArray(r)||(r=[r]),r.forEach(o=>{e.push(ay(n,o))})}),e.push({id:"@jupyterlab/application-extension:mimedocument",description:"Provides a mime document widget tracker.",optional:[ma],provides:ry,autoStart:!0,activate:(i,r)=>(r&&r.restore(n,{command:"docmanager:open",args:o=>({path:o.context.path,factory:ln.factoryNameProperty.get(o)}),name:o=>`${o.context.path}:${ln.factoryNameProperty.get(o)}`}),n)}),e}function ay(s,e){return{id:e.id,description:e.description,requires:[Ap,rc],autoStart:!0,activate:(t,n,i)=>{if(e.rank!==void 0?n.addFactory(e.rendererFactory,e.rank):n.addFactory(e.rendererFactory),!e.documentWidgetFactoryOptions)return;const r=t.docRegistry;let o=[];Array.isArray(e.documentWidgetFactoryOptions)?o=e.documentWidgetFactoryOptions:o=[e.documentWidgetFactoryOptions],e.fileTypes&&e.fileTypes.forEach(a=>{a.icon&&(a={...a,icon:Bt.resolve({icon:a.icon})}),t.docRegistry.addFileType(a)}),o.forEach(a=>{const l=a.toolbarFactory?d=>a.toolbarFactory(d.content.renderer):void 0,c=new y_({renderTimeout:e.renderTimeout,dataType:e.dataType,rendermime:n,modelName:a.modelName,name:a.name,primaryFileType:r.getFileType(a.primaryFileType),fileTypes:a.fileTypes,defaultFor:a.defaultFor,defaultRendered:a.defaultRendered,toolbarFactory:l,translator:i,factory:e.rendererFactory});r.addWidgetFactory(c),c.widgetCreated.connect((d,u)=>{ln.factoryNameProperty.set(u,c.name),u.context.pathChanged.connect(()=>{s.save(u)}),s.add(u)})})}}}var ln;(function(s){s.factoryNameProperty=new Ct({name:"factoryName",create:()=>{}})})(ln||(ln={}));const ly=1e3,cy=25e3,dy=300,uy=3e3;class hy extends an{constructor(){super(...arguments),this._optimizeResize=!0,this._isResizeDragActive=!1,this._dragPointerId=-1,this._cancelListener=null,this._frozenGroups=[],this._refreshTimerId=0,this._refreshRAFId=0,this._refreshGeneration=0,this._intervalId=0}handleEvent(e){e.type==="pointerdown"&&!this._isResizeDragActive&&(this._isResizeDragActive=this._isHandlePointerDown(e),this._isResizeDragActive&&(this._dragPointerId=e.pointerId,this._listenForCancel())),this._isResizeDragActive&&Ot.endsDrag(e,this._dragPointerId)&&this._endDrag(),super.handleEvent(e),this._optimizeResize&&(e.type==="pointerdown"&&this._isResizeDragActive?this._freezeHeavyLeaves():e.type==="pointermove"&&this._isResizeDragActive&&this._scheduleRefresh())}dispose(){this._endDrag(),super.dispose()}onAfterDetach(e){this._endDrag(),super.onAfterDetach(e)}_endDrag(){this._isResizeDragActive=!1,this._dragPointerId=-1,this._cancelListener&&(this._cancelListener.removeEventListener("pointercancel",this,!0),this._cancelListener=null),this._unfreezeElements()}_listenForCancel(){this._cancelListener||(this._cancelListener=this.node.ownerDocument,this._cancelListener.addEventListener("pointercancel",this,!0))}_isHandlePointerDown(e){const t=e;if(t.button!==0)return!1;const n=t.target;if(!(n instanceof HTMLElement))return!1;for(const i of this.handles())if(i.contains(n))return!0;return!1}get optimizeResize(){return this._optimizeResize}set optimizeResize(e){this._optimizeResize=e,e||this._unfreezeElements()}_freezeHeavyLeaves(){if(this._frozenGroups.length>0)return;const e=[];for(const t of this.widgets())this._collectHeavyWidgets(t,e);for(const t of e){const n=t.node,i=[n];for(let l=0;l<n.children.length;l++)i.push(n.children[l]);const r=i.filter(l=>!Ot.isLayoutManaged(l));if(r.length===0)continue;const o=r.map(l=>l.getBoundingClientRect()),a=r.map(l=>({element:l,prevWidth:l.style.width,prevMaxWidth:l.style.maxWidth,prevHeight:l.style.height,prevMaxHeight:l.style.maxHeight}));for(let l=0;l<a.length;l++)Ot.pinToRect(a[l].element,o[l]);this._frozenGroups.push(a)}this._frozenGroups.length>0&&this._intervalId===0&&(this._intervalId=window.setInterval(()=>{this._refreshFrozenElements()},uy))}_scheduleRefresh(){this._frozenGroups.length!==0&&(this._refreshTimerId!==0&&clearTimeout(this._refreshTimerId),this._refreshTimerId=window.setTimeout(()=>{this._refreshTimerId=0,this._refreshFrozenElements()},dy))}_refreshFrozenElements(){this._cancelRefresh();const e=this._refreshGeneration;let t=0;const n=()=>{if(e!==this._refreshGeneration)return;if(t>=this._frozenGroups.length){this._refreshRAFId=0;return}let i=this._frozenGroups[t];for(let r of i){let o=r.element;o.style.width="",o.style.maxWidth="",o.style.height="",o.style.maxHeight=""}this._refreshRAFId=requestAnimationFrame(()=>{if(e!==this._refreshGeneration)return;let r=i.map(o=>o.element.getBoundingClientRect());for(let o=0;o<i.length;o++)Ot.pinToRect(i[o].element,r[o]);t++,this._refreshRAFId=requestAnimationFrame(n)})};this._refreshRAFId=requestAnimationFrame(n)}_cancelRefresh(){this._refreshGeneration++,this._refreshRAFId!==0&&(cancelAnimationFrame(this._refreshRAFId),this._refreshRAFId=0)}_unfreezeElements(){this._refreshTimerId!==0&&(clearTimeout(this._refreshTimerId),this._refreshTimerId=0),this._cancelRefresh(),this._intervalId!==0&&(clearInterval(this._intervalId),this._intervalId=0);for(let e of this._frozenGroups)for(let t of e)t.element.style.width=t.prevWidth,t.element.style.maxWidth=t.prevMaxWidth,t.element.style.height=t.prevHeight,t.element.style.maxHeight=t.prevMaxHeight;this._frozenGroups=[]}_collectHeavyWidgets(e,t){if(!this._isDOMHeavy(e.node))return;let n=e.layout;if(!n){t.push(e);return}let i=!1;for(let r of n)if(this._isDOMHeavy(r.node)){i=!0;break}if(i)for(let r of n)this._collectHeavyWidgets(r,t);else t.push(e)}_isDOMHeavy(e){var t,n;return e.querySelectorAll("*").length>=ly||((n=(t=e.textContent)===null||t===void 0?void 0:t.length)!==null&&n!==void 0?n:0)>=cy}}var Ot;(function(s){function e(i){return i.style.position==="absolute"}s.isLayoutManaged=e;function t(i,r){switch(i.type){case"pointerup":return i.button===0;case"pointercancel":return i.pointerId===r;case"keydown":return i.keyCode===27;default:return!1}}s.endsDrag=t;function n(i,r){i.style.width=`${r.width}px`,i.style.maxWidth=`${r.width}px`,i.style.height=`${r.height}px`,i.style.maxHeight=`${r.height}px`}s.pinToRect=n})(Ot||(Ot={}));const fy="jp-LabShell",fr="jp-SideBar",mr="jp-mod-current",pr="jp-mod-active",Xt=900,_r="jp-Activity",gr=.25,iv=new Ae("@jupyterlab/application:ILabShell","A service for interacting with the JupyterLab shell. The top-level `application` object also has a reference to the shell, but it has a restricted interface in order to be agnostic to different shell implementations on the application. Use this to get more detailed information about currently active widgets and layout state.");class Us extends X{constructor(e){super(),this._dockChildHook=(p,w)=>{switch(w.type){case"child-added":w.child.addClass(_r),this._tracker.add(w.child);break;case"child-removed":w.child.removeClass(_r),this._tracker.remove(w.child);break}return!0},this._activeChanged=new U(this),this._cachedLayout=null,this._currentChanged=new U(this),this._currentPath="",this._currentPathChanged=new U(this),this._modeChanged=new U(this),this._isRestored=!1,this._lastDownAreaSize=gr,this._layoutModified=new U(this),this._layoutDebouncer=new oc(()=>{this._layoutModified.emit(void 0)},0),this._restored=new it,this._tracker=new ac,this._topHandlerHiddenByUser=!1,this._idTypeMap=new Map,this._mainOptionsCache=new Map,this._sideOptionsCache=new Map,this._delayedWidget=new Array,this.addClass(fy),this.id="main",e?.waitForRestore===!1&&(this._userLayout={"multiple-document":{},"single-document":{}});const t=this._skipLinkWidget=new Me.SkipLinkWidget(this);this._skipLinkWidget.show();const n=new pt;n.addClass("jp-skiplink-wrapper"),n.addWidget(t);const i=this._headerPanel=new we,r=this._menuHandler=new Me.PanelHandler;r.panel.node.setAttribute("role","navigation");const o=this._topHandler=new Me.PanelHandler;o.panel.node.setAttribute("role","banner");const a=this._bottomPanel=new we;a.node.setAttribute("role","contentinfo");const l=new we,c=this._vsplitPanel=new Me.RestorableSplitPanel,d=this._dockPanel=new hy({hiddenMode:X.HiddenMode.Display});Ie.installMessageHook(d,this._dockChildHook);const u=this._hsplitPanel=new Me.RestorableSplitPanel,h=this._downPanel=new up({tabsMovable:!0}),m=this._leftHandler=new Me.SideBarHandler({side:"left",host:l}),_=this._rightHandler=new Me.SideBarHandler({side:"right",host:l}),b=new tt;i.id="jp-header-panel",r.panel.id="jp-menu-panel",o.panel.id="jp-top-panel",a.id="jp-bottom-panel",l.id="jp-main-content-panel",c.id="jp-main-vsplit-panel",d.id="jp-main-dock-panel",u.id="jp-main-split-panel",h.id="jp-down-stack",m.sideBar.addClass(fr),m.sideBar.addClass("jp-mod-left"),m.sideBar.node.setAttribute("role","complementary"),m.stackedPanel.id="jp-left-stack",m.area.addClass("jp-SideArea"),m.area.node.setAttribute("data-side","left"),_.sideBar.addClass(fr),_.sideBar.addClass("jp-mod-right"),_.sideBar.node.setAttribute("role","complementary"),_.stackedPanel.id="jp-right-stack",_.area.addClass("jp-SideArea"),_.area.node.setAttribute("data-side","right"),d.node.setAttribute("role","main"),l.spacing=0,c.spacing=1,d.spacing=5,u.spacing=1,i.direction="top-to-bottom",c.orientation="vertical",l.direction="left-to-right",u.orientation="horizontal",a.direction="bottom-to-top",Pe.setStretch(m.area,0),Pe.setStretch(h,0),Pe.setStretch(d,1),Pe.setStretch(_.area,0),we.setStretch(m.sideBar,0),we.setStretch(u,1),we.setStretch(_.sideBar,0),Pe.setStretch(c,1),u.addWidget(m.area),u.addWidget(d),u.addWidget(_.area),c.addWidget(u),c.addWidget(h),l.addWidget(m.sideBar),l.addWidget(c),l.addWidget(_.sideBar),b.direction="top-to-bottom",b.spacing=0,c.setRelativeSizes([3,1]),u.setRelativeSizes([1,2.5,1]),tt.setStretch(i,0),tt.setStretch(r.panel,0),tt.setStretch(o.panel,0),tt.setStretch(l,1),tt.setStretch(a,0),b.addWidget(n),b.addWidget(i),b.addWidget(o.panel),b.addWidget(l),b.addWidget(a),this._headerPanel.hide(),this._bottomPanel.hide(),this._downPanel.hide(),this.layout=b,this._tracker.currentChanged.connect(this._onCurrentChanged,this),this._tracker.activeChanged.connect(this._onActiveChanged,this),this._dockPanel.layoutModified.connect(this._onLayoutModified,this),this._vsplitPanel.updated.connect(this._onLayoutModified,this),this._downPanel.currentChanged.connect(this._onLayoutModified,this),this._downPanel.tabBar.tabMoved.connect(this._onTabPanelChanged,this),this._downPanel.stackedPanel.widgetRemoved.connect(this._onTabPanelChanged,this),this._leftHandler.updated.connect(this._onLayoutModified,this),this._rightHandler.updated.connect(this._onLayoutModified,this),this._hsplitPanel.updated.connect(this._onLayoutModified,this);const g=this._titleHandler=new Me.TitleHandler(this);this.add(g,"top",{rank:100}),this._dockPanel.mode==="multiple-document"?(this._topHandler.addWidget(this._menuHandler.panel,100),g.hide()):b.insertWidget(3,this._menuHandler.panel),this.translator=se,this.currentChanged.connect((p,w)=>{let v=w.newValue,y=w.oldValue;y&&(y.title.changed.disconnect(this._updateTitlePanelTitle,this),y instanceof Qt&&y.context.pathChanged.disconnect(this._updateCurrentPath,this)),v&&(v.title.changed.connect(this._updateTitlePanelTitle,this),this._updateTitlePanelTitle(),v instanceof Qt&&v.context.pathChanged.connect(this._updateCurrentPath,this)),this._updateCurrentPath()})}get activeChanged(){return this._activeChanged}get activeWidget(){return this._tracker.activeWidget}get addButtonEnabled(){return this._dockPanel.addButtonEnabled}set addButtonEnabled(e){this._dockPanel.addButtonEnabled=e}get addRequested(){return this._dockPanel.addRequested}get currentChanged(){return this._currentChanged}get currentPath(){return this._currentPath}get currentPathChanged(){return this._currentPathChanged}get currentWidget(){return this._tracker.currentWidget}get downCollapsed(){return this._downPanel.isHidden}get layoutModified(){return this._layoutModified}get leftCollapsed(){return!this._leftHandler.sideBar.currentTitle}get rightCollapsed(){return!this._rightHandler.sideBar.currentTitle}get presentationMode(){return this.hasClass("jp-mod-presentationMode")}set presentationMode(e){this.toggleClass("jp-mod-presentationMode",e)}get mode(){return this._dockPanel.mode}set mode(e){const t=this._dockPanel;if(e===t.mode)return;const n=this.currentWidget;if(e==="single-document")this._cachedLayout=t.saveLayout(),t.mode=e,this.currentWidget&&t.activateWidget(this.currentWidget),this.layout.insertWidget(3,this._menuHandler.panel),this._titleHandler.show(),this._updateTitlePanelTitle(),this._topHandlerHiddenByUser&&this._topHandler.panel.hide();else{const i=Array.from(t.widgets());t.mode=e,this._cachedLayout&&(Me.normalizeAreaConfig(t,this._cachedLayout.main),t.restoreLayout(this._cachedLayout),this._cachedLayout=null),this._layoutRestorer.isDeferred&&this._layoutRestorer.restoreDeferred().then(r=>{if(r){const{currentWidget:o,dock:a}=r;a&&this._dockPanel.restoreLayout(a),o&&this.activateById(o.id)}}).catch(r=>{console.error("Failed to restore the deferred layout."),console.error(r)}),i.forEach(r=>{r.parent||this._addToMainArea(r,{...this._mainOptionsCache.get(r),activate:!1})}),this._mainOptionsCache.clear(),n&&t.activateWidget(n),this.add(this._menuHandler.panel,"top",{rank:100}),this._titleHandler.hide()}this.node.dataset.shellMode=e,this._downPanel.fit(),this._modeChanged.emit(e)}get modeChanged(){return this._modeChanged}get restored(){return this._restored.promise}get translator(){var e;return(e=this._translator)!==null&&e!==void 0?e:se}set translator(e){if(e!==this._translator){this._translator=e,He.translator=e;const t=e.load("jupyterlab");this._menuHandler.panel.node.setAttribute("aria-label",t.__("main menu")),this._leftHandler.sideBar.node.setAttribute("aria-label",t.__("main sidebar")),this._leftHandler.sideBar.contentNode.setAttribute("aria-label",t.__("main sidebar")),this._rightHandler.sideBar.node.setAttribute("aria-label",t.__("alternate sidebar")),this._rightHandler.sideBar.contentNode.setAttribute("aria-label",t.__("alternate sidebar")),this._topHandler.panel.node.setAttribute("aria-label",t.__("Top Bar")),this._bottomPanel.node.setAttribute("aria-label",t.__("Bottom Panel")),this._dockPanel.node.setAttribute("aria-label",t.__("Main Content"))}}get userLayout(){return jt.deepCopy(this._userLayout)}activateById(e){var t;if(this._leftHandler.has(e)){this._leftHandler.activate(e);return}if(this._rightHandler.has(e)){this._rightHandler.activate(e);return}const n=this._downPanel.tabBar.titles.findIndex(o=>o.owner.id===e);if(n>=0){const o=this._downPanel.isHidden;this._downPanel.currentIndex=n,o&&(this._showDownPanel(),this._onLayoutModified()),(t=this._downPanel.currentWidget)===null||t===void 0||t.activate();return}const i=this._dockPanel,r=je(i.widgets(),o=>o.id===e);r&&i.activateWidget(r)}activateArea(e="main"){switch(e){case"main":{const t=this._currentTabBar();if(!t)return;t.currentTitle&&t.currentTitle.owner.activate()}return;case"left":case"right":case"header":case"top":case"menu":case"bottom":console.debug(`Area: ${e} activation not yet implemented`);break;default:throw new Error(`Invalid area: ${e}`)}}activateNextTab(){const e=this._currentTabBar();if(!e)return;const t=e.currentIndex;if(t!==-1){if(t<e.titles.length-1){e.currentIndex+=1,e.currentTitle&&e.currentTitle.owner.activate();return}if(t===e.titles.length-1){const n=this._adjacentBar("next");n&&(n.currentIndex=0,n.currentTitle&&n.currentTitle.owner.activate())}}}activatePreviousTab(){const e=this._currentTabBar();if(!e)return;const t=e.currentIndex;if(t!==-1){if(t>0){e.currentIndex-=1,e.currentTitle&&e.currentTitle.owner.activate();return}if(t===0){const n=this._adjacentBar("previous");if(n){const i=n.titles.length;n.currentIndex=i-1,n.currentTitle&&n.currentTitle.owner.activate()}}}}activateNextTabBar(){const e=this._adjacentBar("next");e&&e.currentTitle&&e.currentTitle.owner.activate()}activatePreviousTabBar(){const e=this._adjacentBar("previous");e&&e.currentTitle&&e.currentTitle.owner.activate()}add(e,t="main",n){var i;if(!this._userLayout){this._delayedWidget.push({widget:e,area:t,options:n});return}let r;switch(n?.type&&this._userLayout[this.mode][n.type]?(r=this._userLayout[this.mode][n.type],this._idTypeMap.set(e.id,n.type)):r=this._userLayout[this.mode][e.id],n?.type&&(this._idTypeMap.set(e.id,n.type),e.disposed.connect(()=>{this._idTypeMap.delete(e.id)})),t=(i=r?.area)!==null&&i!==void 0?i:t,n=n||r?.options?{...n,...r?.options}:void 0,n?.rank!==void 0&&this._sideOptionsCache.set(e,{...this._sideOptionsCache.get(e),rank:n.rank}),t||"main"){case"bottom":return this._addToBottomArea(e,n);case"down":return this._addToDownArea(e,n);case"header":return this._addToHeaderArea(e,n);case"left":return this._addToLeftArea(e,n);case"main":return this._addToMainArea(e,n);case"menu":return this._addToMenuArea(e,n);case"right":return this._addToRightArea(e,n);case"top":return this._addToTopArea(e,n);default:throw new Error(`Invalid area: ${t}`)}}move(e,t,n){var i,r;const o=(i=this._idTypeMap.get(e.id))!==null&&i!==void 0?i:e.id,a=(r=this._sideOptionsCache.get(e))===null||r===void 0?void 0:r.rank;for(const l of["single-document","multiple-document"].filter(c=>!n||c===n)){const c=this._userLayout[l][o];this._userLayout[l][o]={...c,area:t,...a!==void 0?{options:{...c?.options,rank:a}}:{}}}return this.add(e,t),this._userLayout}collapseLeft(){this._leftHandler.collapse(),this._onLayoutModified()}collapseRight(){this._rightHandler.collapse(),this._onLayoutModified()}collapseDown(){this._downPanel.isHidden||(this._hideDownPanel(),this._onLayoutModified())}dispose(){this.isDisposed||(this._layoutDebouncer.dispose(),super.dispose())}expandLeft(){this._leftHandler.expand(),this._onLayoutModified()}expandRight(){this._rightHandler.expand(),this._onLayoutModified()}expandDown(){var e;this._downPanel.stackedPanel.widgets.length!==0&&(this._showDownPanel(),(e=this._downPanel.currentWidget)===null||e===void 0||e.activate(),this._onLayoutModified())}closeAll(){Array.from(this._dockPanel.widgets()).forEach(e=>e.close()),this._downPanel.stackedPanel.widgets.forEach(e=>e.close())}isSideTabBarVisible(e){switch(e){case"left":return this._leftHandler.isVisible;case"right":return this._rightHandler.isVisible}}isTopInSimpleModeVisible(){return!this._topHandlerHiddenByUser}isEmpty(e){switch(e){case"bottom":return this._bottomPanel.widgets.length===0;case"down":return this._downPanel.stackedPanel.widgets.length===0;case"header":return this._headerPanel.widgets.length===0;case"left":return this._leftHandler.stackedPanel.widgets.length===0;case"main":return this._dockPanel.isEmpty;case"menu":return this._menuHandler.panel.widgets.length===0;case"right":return this._rightHandler.stackedPanel.widgets.length===0;case"top":return this._topHandler.panel.widgets.length===0;default:return!0}}async restoreLayout(e,t,n={}){var i,r,o,a,l,c,d,u;this._userLayout={"single-document":(i=n["single-document"])!==null&&i!==void 0?i:{},"multiple-document":(r=n["multiple-document"])!==null&&r!==void 0?r:{}},this._delayedWidget.forEach(({widget:v,area:y,options:C})=>{this.add(v,y,C)}),this._delayedWidget.length=0,this._layoutRestorer=t;const h=await t.fetch(),{mainArea:m,downArea:_,leftArea:b,rightArea:g,topArea:p,relativeSizes:w}=h;if(m){const{currentWidget:v,dock:y}=m;y&&e==="multiple-document"&&this._dockPanel.restoreLayout(y),e&&(this.mode=e),v&&this.activateById(v.id)}else e&&(this.mode=e);if(p?.simpleVisibility!==void 0&&(this._topHandlerHiddenByUser=!p.simpleVisibility,this.mode==="single-document"&&this._topHandler.panel.setHidden(this._topHandlerHiddenByUser)),_){const{currentWidget:v,widgets:y,size:C}=_,E=(o=_.collapsed)!==null&&o!==void 0?o:!C,x=(a=y?.map(P=>P.id))!==null&&a!==void 0?a:[],S=new Set,A=P=>{if(P){if(P.type==="tab-area"){P.widgets.forEach(M=>{S.add(M.id)});return}P.children.forEach(A)}};A((l=m?.dock)===null||l===void 0?void 0:l.main),(c=b?.widgets)===null||c===void 0||c.forEach(P=>{S.add(P.id)}),(d=g?.widgets)===null||d===void 0||d.forEach(P=>{S.add(P.id)}),this._downPanel.tabBar.titles.filter(P=>!x.includes(P.owner.id)).forEach(P=>{S.has(P.owner.id)?P.owner.parent=null:P.owner.close()});const I=this._downPanel.tabBar.titles.map(P=>P.owner.id);for(y?.filter(P=>!I.includes(P.id)).map(P=>this._downPanel.addWidget(P));!Y.shallowEqual(x,this._downPanel.tabBar.titles.map(P=>P.owner.id));)this._downPanel.tabBar.titles.forEach((P,M)=>{const j=x.findIndex(H=>P.owner.id==H);j>=0&&j!=M&&this._downPanel.tabBar.insertTab(j,P)});if(v){const P=this._downPanel.stackedPanel.widgets.findIndex(M=>M.id===v.id);P>=0&&(this._downPanel.currentIndex=P)}!E&&y?.length&&C&&C>0?(this._showDownPanel(C),(u=this._downPanel.currentWidget)===null||u===void 0||u.activate()):(this._hideDownPanel(),C&&C>0&&(this._lastDownAreaSize=C))}b?this._leftHandler.rehydrate(b):e==="single-document"&&this.collapseLeft(),g?this._rightHandler.rehydrate(g):e==="single-document"&&this.collapseRight(),w&&this._hsplitPanel.setRelativeSizes(w),this._isRestored||(Ie.flush(),this._restored.resolve(h))}saveLayout(){return{mainArea:{currentWidget:this._tracker.currentWidget,dock:this.mode==="single-document"?this._cachedLayout||this._dockPanel.saveLayout():this._dockPanel.saveLayout()},downArea:{collapsed:this.downCollapsed,currentWidget:this._downPanel.currentWidget,widgets:Array.from(this._downPanel.stackedPanel.widgets),size:this._downPanel.stackedPanel.widgets.length===0?0:this.downCollapsed?this._lastDownAreaSize:this._vsplitPanel.relativeSizes()[1]},leftArea:this._leftHandler.dehydrate(),rightArea:this._rightHandler.dehydrate(),topArea:{simpleVisibility:!this._topHandlerHiddenByUser},relativeSizes:this._hsplitPanel.relativeSizes()}}toggleTopInSimpleModeVisibility(){this.mode==="single-document"&&(this._topHandler.panel.isVisible?(this._topHandlerHiddenByUser=!0,this._topHandler.panel.hide()):(this._topHandlerHiddenByUser=!1,this._topHandler.panel.show(),this._updateTitlePanelTitle()),this._onLayoutModified())}toggleSideTabBarVisibility(e){e==="right"?this._rightHandler.isVisible?this._rightHandler.hide():this._rightHandler.show():this._leftHandler.isVisible?this._leftHandler.hide():this._leftHandler.show()}updateConfig(e){if(e.hiddenMode)switch(e.hiddenMode){case"display":this._dockPanel.hiddenMode=X.HiddenMode.Display;break;case"scale":this._dockPanel.hiddenMode=X.HiddenMode.Scale;break;case"contentVisibility":this._dockPanel.hiddenMode=X.HiddenMode.ContentVisibility;break}e.dockPanelPadding!==void 0&&(e.dockPanelPadding===!1?this._dockPanel.node.style.setProperty("--jp-private-dock-panel-padding","0px"):this._dockPanel.node.style.removeProperty("--jp-private-dock-panel-padding"),this._dockPanel.fit()),e.optimizeResize!==void 0&&(this._dockPanel.optimizeResize=e.optimizeResize),e.activityBarPosition!==void 0&&(this._setActivityBarPosition("left",e.activityBarPosition),this._setActivityBarPosition("right",e.activityBarPosition))}_setActivityBarPosition(e,t){const n=e==="left"?this._leftHandler:this._rightHandler;n.position!==t&&(n.position=t,this._onLayoutModified())}widgets(e){switch(e??"main"){case"main":return this._dockPanel.widgets();case"left":return Di(this._leftHandler.sideBar.titles,t=>t.owner);case"right":return Di(this._rightHandler.sideBar.titles,t=>t.owner);case"header":return this._headerPanel.children();case"top":return this._topHandler.panel.children();case"menu":return this._menuHandler.panel.children();case"bottom":return this._bottomPanel.children();case"down":return this._downPanel.stackedPanel.children();default:throw new Error(`Invalid area: ${e}`)}}onAfterAttach(e){this.node.dataset.shellMode=this.mode}_updateTitlePanelTitle(){let e=this.currentWidget;const t=this._titleHandler.inputElement;t.value=e?He.titleLabel(e.title):"",t.title=e?e.title.caption:""}_updateCurrentPath(){let e=this.currentWidget,t="";e&&e instanceof Qt&&(t=e.context.path),this._currentPathChanged.emit({newValue:t,oldValue:this._currentPath}),this._currentPath=t}_addToLeftArea(e,t){if(!e.id){console.error("Widgets added to app shell must have unique id property.");return}t=t||this._sideOptionsCache.get(e)||{},this._sideOptionsCache.set(e,t);const n="rank"in t?t.rank:Xt;this._leftHandler.addWidget(e,n),this._onLayoutModified()}_addToMainArea(e,t){if(!e.id){console.error("Widgets added to app shell must have unique id property.");return}t=t||{};const n=this._dockPanel,i=t.mode||"tab-after";let r=this.currentWidget;t.ref&&(r=je(n.widgets(),a=>a.id===t.ref)||null);const{title:o}=e;o.dataset={...o.dataset,id:e.id},o.icon instanceof Bt?o.icon=o.icon.bindprops({stylesheet:"mainAreaTab"}):(typeof o.icon=="string"||!o.icon)&&(o.iconClass=xt(o.iconClass,"jp-Icon")),n.addWidget(e,{mode:i,ref:r}),n.mode==="single-document"&&this._mainOptionsCache.set(e,t),t.activate!==!1&&n.activateWidget(e)}_addToRightArea(e,t){if(!e.id){console.error("Widgets added to app shell must have unique id property.");return}t=t||this._sideOptionsCache.get(e)||{};const n="rank"in t?t.rank:Xt;this._sideOptionsCache.set(e,t),this._rightHandler.addWidget(e,n),this._onLayoutModified()}_addToTopArea(e,t){var n;if(!e.id){console.error("Widgets added to app shell must have unique id property.");return}t=t||{};const i=(n=t.rank)!==null&&n!==void 0?n:Xt;this._topHandler.addWidget(e,i),this._onLayoutModified(),this._topHandler.panel.isHidden&&this._topHandler.panel.show()}_addToMenuArea(e,t){var n;if(!e.id){console.error("Widgets added to app shell must have unique id property.");return}t=t||{};const i=(n=t.rank)!==null&&n!==void 0?n:Xt;this._menuHandler.addWidget(e,i),this._onLayoutModified(),this._menuHandler.panel.isHidden&&this._menuHandler.panel.show()}_addToHeaderArea(e,t){if(!e.id){console.error("Widgets added to app shell must have unique id property.");return}this._headerPanel.addWidget(e),this._onLayoutModified(),this._headerPanel.isHidden&&this._headerPanel.show()}_addToBottomArea(e,t){if(!e.id){console.error("Widgets added to app shell must have unique id property.");return}this._bottomPanel.addWidget(e),this._onLayoutModified(),this._bottomPanel.isHidden&&this._bottomPanel.show()}_addToDownArea(e,t){if(!e.id){console.error("Widgets added to app shell must have unique id property.");return}const{title:n}=e;n.dataset={...n.dataset,id:e.id},n.icon instanceof Bt?n.icon=n.icon.bindprops({stylesheet:"mainAreaTab"}):(typeof n.icon=="string"||!n.icon)&&(n.iconClass=xt(n.iconClass,"jp-Icon")),this._downPanel.addWidget(e),this._downPanel.isHidden&&this._showDownPanel(),this._onLayoutModified()}_showDownPanel(e=this._lastDownAreaSize){const t=e>0?e:gr;this._lastDownAreaSize=t,this._vsplitPanel.setRelativeSizes([Math.max(1-t,0),t]),this._downPanel.show()}_hideDownPanel(){const e=this._vsplitPanel.relativeSizes()[1];e>0&&(this._lastDownAreaSize=e),this._downPanel.hide()}_adjacentBar(e){const t=this._currentTabBar();if(!t)return null;const n=Array.from(this._dockPanel.tabBars()),i=n.length,r=n.indexOf(t);return e==="previous"?r>0?n[r-1]:r===0?n[i-1]:null:r<i-1?n[r+1]:r===i-1?n[0]:null}_currentTabBar(){const e=this._tracker.currentWidget;if(!e)return null;const t=e.title,n=this._dockPanel.tabBars();return je(n,i=>i.titles.indexOf(t)>-1)||null}_onActiveChanged(e,t){t.newValue&&(t.newValue.title.className+=` ${pr}`),t.oldValue&&(t.oldValue.title.className=t.oldValue.title.className.replace(pr,"")),this._activeChanged.emit(t)}_onCurrentChanged(e,t){t.newValue&&(t.newValue.title.className+=` ${mr}`),t.oldValue&&(t.oldValue.title.className=t.oldValue.title.className.replace(mr,"")),this._currentChanged.emit(t),this._onLayoutModified()}_onTabPanelChanged(){this._downPanel.stackedPanel.widgets.length===0&&this._hideDownPanel(),this._onLayoutModified()}_onLayoutModified(){this._layoutDebouncer.invoke()}moveTab(e,t){const n=e,r={left:"split-left",right:"split-right",top:"split-top",bottom:"split-bottom"}[t];this._dockPanel.addWidget(e,{mode:r,ref:n})}getMainAreaTabBar(e){for(const t of this._dockPanel.tabBars())if(t.titles.includes(e.title))return t;return null}}var Me;(function(s){function e(l,c){return l.rank-c.rank}s.itemCmp=e;function t(l,c){if(c){if(c.type==="tab-area"){c.widgets=c.widgets.filter(d=>!d.isDisposed&&d.parent===l);return}c.children.forEach(d=>{t(l,d)})}}s.normalizeAreaConfig=t;class n{constructor(){this._panelChildHook=(c,d)=>{switch(d.type){case"child-added":{const u=d.child;if(this._items.find(m=>m.widget===u))break;const h=this._items[this._items.length-1].rank;this._items.push({widget:u,rank:h})}break;case"child-removed":{const u=d.child;Y.removeFirstWhere(this._items,h=>h.widget===u)}break}return!0},this._items=new Array,this._panel=new pt,Ie.installMessageHook(this._panel,this._panelChildHook)}get panel(){return this._panel}addWidget(c,d){c.parent=null;const u={widget:c,rank:d},h=Y.upperBound(this._items,u,s.itemCmp);Y.insert(this._items,h,u),this._panel.insertWidget(h,c)}}s.PanelHandler=n;class i{constructor(c){this._isHiddenByUser=!1,this._isCollapsedByUser=!1,this._items=new Array,this._position="side",this._updated=new U(this),this._side=c.side,this._host=c.host,this._sideBar=new ei({insertBehavior:"none",removeBehavior:"none",allowDeselect:!0,orientation:"vertical"}),this._sideBar.node.setAttribute("data-side",this._side),this._stackedPanel=new lc,this._area=new we({direction:"top-to-bottom",spacing:0}),we.setStretch(this._stackedPanel,1),we.setStretch(this._sideBar,0),this._area.addWidget(this._stackedPanel),this._sideBar.hide(),this._stackedPanel.hide(),this._lastCurrent=null,this._sideBar.currentChanged.connect(this._onCurrentChanged,this),this._sideBar.tabCloseRequested.connect(this._onTabCloseRequested,this),this._sideBar.tabActivateRequested.connect(this._onTabActivateRequested,this),this._stackedPanel.widgetRemoved.connect(this._onWidgetRemoved,this)}get isVisible(){return this._sideBar.isVisible}get sideBar(){return this._sideBar}get stackedPanel(){return this._stackedPanel}get area(){return this._area}get position(){return this._position}set position(c){if(this._position===c)return;this._position=c,this._isCollapsedByUser=!1,this._sideBar.parent=null;const d=this._side==="left";this._sideBar.orientation=c==="side"?"vertical":"horizontal",this._sideBar.toggleClass("jp-mod-left",d&&c==="side"),this._sideBar.toggleClass("jp-mod-right",!d&&c==="side");const u=c==="side"?d?"left":"right":c;if(this._sideBar.node.setAttribute("data-side",u),this._sideBar.allowDeselect=c==="side",c==="side"){const h=d?0:this._host.widgets.length;this._host.insertWidget(h,this._sideBar)}else c==="top"?this._area.insertWidget(0,this._sideBar):this._area.addWidget(this._sideBar);this._refreshVisibility()}get updated(){return this._updated}_onHandleMoved(){return this._refreshVisibility()}_onExpansionToggle(c,d){return this._refreshVisibility()}expand(){this._isCollapsedByUser=!1;const c=this._lastCurrent||this._items.length>0&&this._items[0].widget;c?this.activate(c.id):this._refreshVisibility()}activate(c){const d=this._findWidgetByID(c);d&&(this._isCollapsedByUser=!1,this._sideBar.currentTitle=d.title,d.activate())}has(c){return this._findWidgetByID(c)!==null}collapse(){this._isCollapsedByUser=!0,this._sideBar.currentTitle=null,this._refreshVisibility()}addWidget(c,d){var u,h,m,_;c.parent=null,c.hide();const b={widget:c,rank:d},g=this._findInsertIndex(b);Y.insert(this._items,g,b),this._stackedPanel.insertWidget(g,c);const p=this._sideBar.insertTab(g,c.title);p.dataset={...p.dataset,id:c.id},p.icon instanceof Bt?p.icon=p.icon.bindprops({stylesheet:"sideBar"}):typeof p.icon=="string"&&p.icon!=""?p.iconClass=xt(p.iconClass,"jp-Icon","jp-Icon-20"):!p.icon&&!p.label&&(p.icon=cc.bindprops({stylesheet:"sideBar"})),(h=(u=c.content)===null||u===void 0?void 0:u.expansionToggled)===null||h===void 0||h.connect(this._onExpansionToggle,this),(_=(m=c.content)===null||m===void 0?void 0:m.handleMoved)===null||_===void 0||_.connect(this._onHandleMoved,this),this._refreshVisibility()}dehydrate(){const c=this._position==="side"?this._sideBar.currentTitle===null:this._isCollapsedByUser,d=Array.from(this._stackedPanel.widgets),u=d[this._sideBar.currentIndex],h={};return this._stackedPanel.widgets.forEach(m=>{m.id&&m.content instanceof Pe&&(h[m.id]={sizes:m.content.relativeSizes(),expansionStates:m.content.widgets.map(_=>!_.isHidden)})}),{collapsed:c,currentWidget:u,visible:!this._isHiddenByUser,widgets:d,widgetStates:h}}rehydrate(c){if(Array.isArray(c.widgets)){const d=c.widgets.map(b=>b.id),u=new Set(d),h=this._stackedPanel.widgets.map(b=>b.id);c.widgets.filter(b=>!h.includes(b.id)).forEach(b=>{this.addWidget(b,Xt)});let m=0;this._stackedPanel.widgets.map(b=>u.has(b.id)?d[m++]:b.id).forEach((b,g)=>{const p=this._stackedPanel.widgets.findIndex(w=>w.id===b);if(p>=0&&p!==g){const w=this._stackedPanel.widgets[p];Y.move(this._items,p,g),this._stackedPanel.insertWidget(g,w),this._sideBar.insertTab(g,w.title)}})}c.visible?this.show():this.hide(),c.currentWidget?this.activate(c.currentWidget.id):c.collapsed&&this.collapse(),c.widgetStates&&this._stackedPanel.widgets.forEach(d=>{var u;if(d.id&&d.content instanceof Pe){const h=(u=c.widgetStates[d.id])!==null&&u!==void 0?u:{};d.content.widgets.forEach((m,_)=>{var b;const g=((b=h.expansionStates)!==null&&b!==void 0?b:[])[_];typeof g=="boolean"&&d.content instanceof Un&&(g?d.content.expand(_):d.content.collapse(_))}),h.sizes&&d.content.setRelativeSizes(h.sizes)}})}hide(){this._isHiddenByUser=!0,this._refreshVisibility()}show(){this._isHiddenByUser=!1,this._isCollapsedByUser=!1,this._refreshVisibility()}_findInsertIndex(c){return Y.upperBound(this._items,c,s.itemCmp)}_findWidgetIndex(c){return Y.findFirstIndex(this._items,d=>d.widget===c)}_findWidgetByTitle(c){const d=je(this._items,u=>u.widget.title===c);return d?d.widget:null}_findWidgetByID(c){const d=je(this._items,u=>u.widget.id===c);return d?d.widget:null}_refreshVisibility(){this._position==="side"?this._stackedPanel.setHidden(this._sideBar.currentTitle===null):this._stackedPanel.setHidden(this._items.length===0),this._sideBar.setHidden(this._isHiddenByUser||this._sideBar.titles.length===0),this._position==="side"?this._area.setHidden(this._stackedPanel.isHidden):this._area.setHidden(this._isCollapsedByUser||this._sideBar.titles.length===0),this._updated.emit()}_onCurrentChanged(c,d){const u=d.previousTitle?this._findWidgetByTitle(d.previousTitle):null,h=d.currentTitle?this._findWidgetByTitle(d.currentTitle):null;u&&u.hide(),h&&h.show(),this._lastCurrent=h||u,this._refreshVisibility()}_onTabActivateRequested(c,d){d.title.owner.activate()}_onTabCloseRequested(c,d){d.title.owner.close()}_onWidgetRemoved(c,d){d===this._lastCurrent&&(this._lastCurrent=null),Y.removeAt(this._items,this._findWidgetIndex(d)),this._sideBar.removeTab(d.title),this._refreshVisibility()}}s.SideBarHandler=i;class r extends X{constructor(c){super(),this.addClass("jp-skiplink"),this.id="jp-skiplink",this._shell=c,this._createSkipLink("Skip to main panel","main")}handleEvent(c){var d,u;c.type==="click"&&c.target instanceof HTMLElement&&this._shell.activateArea((u=(d=c.target)===null||d===void 0?void 0:d.dataset)===null||u===void 0?void 0:u.targetarea)}onAfterAttach(c){super.onAfterAttach(c),this.node.addEventListener("click",this)}onBeforeDetach(c){this.node.removeEventListener("click",this),super.onBeforeDetach(c)}_createSkipLink(c,d){const u=document.createElement("a");u.href="#",u.tabIndex=0,u.text=c,u.className="skip-link",u.dataset.targetarea=d,this.node.appendChild(u)}}s.SkipLinkWidget=r;class o extends X{constructor(c){super(),this._selected=!1;const d=document.createElement("input");d.type="text",this.node.appendChild(d),this._shell=c,this.id="jp-title-panel-title"}onAfterAttach(c){super.onAfterAttach(c),this.inputElement.addEventListener("keyup",this),this.inputElement.addEventListener("click",this),this.inputElement.addEventListener("blur",this)}onBeforeDetach(c){super.onBeforeDetach(c),this.inputElement.removeEventListener("keyup",this),this.inputElement.removeEventListener("click",this),this.inputElement.removeEventListener("blur",this)}handleEvent(c){switch(c.type){case"keyup":this._evtKeyUp(c);break;case"click":this._evtClick(c);break;case"blur":this._selected=!1;break}}async _evtKeyUp(c){if(c.key=="Enter"){const d=this._shell.currentWidget;if(d==null)return;const u=He.titleLabel(d.title),h=this.inputElement,m=h.value;h.blur(),m!==u?d.title.label=m:h.value=u}}_evtClick(c){if(c.button!==0||this._selected)return;const d=this.inputElement;c.preventDefault(),c.stopPropagation(),this._selected=!0;const u=d.value.indexOf(".");u===-1?d.select():d.setSelectionRange(0,u)}get inputElement(){return this.node.children[0]}}s.TitleHandler=o;class a extends Pe{constructor(c={}){super(c),this._updated=new U(this)}get updated(){return this._updated}onUpdateRequest(c){super.onUpdateRequest(c),this._updated.emit()}}s.RestorableSplitPanel=a})(Me||(Me={}));class my{constructor(e){this._busyCount=0,this._dirtyCount=0,this._busySignal=new U(e),this._dirtySignal=new U(e)}get busySignal(){return this._busySignal}get dirtySignal(){return this._dirtySignal}get isBusy(){return this._busyCount>0}get isDirty(){return this._dirtyCount>0}setDirty(){const e=this.isDirty;return this._dirtyCount++,this.isDirty!==e&&this._dirtySignal.emit(this.isDirty),new Ve(()=>{const t=this.isDirty;this._dirtyCount=Math.max(0,this._dirtyCount-1),this.isDirty!==t&&this._dirtySignal.emit(this.isDirty)})}setBusy(){const e=this.isBusy;return this._busyCount++,this.isBusy!==e&&this._busySignal.emit(this.isBusy),new Ve(()=>{const t=this.isBusy;this._busyCount--,this.isBusy!==t&&this._busySignal.emit(this.isBusy)})}}class $e extends Hs{constructor(e={shell:new Us}){super({...e,shell:e.shell||new Us,serviceManager:e.serviceManager||new Be.ServiceManager({standby:()=>!this._info.isConnected||"when-hidden"})}),this.name=O.PageConfig.getOption("appName")||"JupyterLab",this.namespace=O.PageConfig.getOption("appNamespace")||this.name,this.registerPluginErrors=[],this.status=new my(this),this.version=O.PageConfig.getOption("appVersion")||"unknown",this._allPluginsActivated=new it,this._info=new $e.Info(e),this.restored=this.shell.restored.then(async()=>{const o=[],a=this.activateDeferredPlugins().catch(l=>{console.error(`Error when activating deferred plugins
427
+ assemble URLs to use the JupyterLab REST API.`),s.ITreeResolver=new Ae("@jupyterlab/application:ITreeResolver","A service to resolve the tree path.")})(Hs||(Hs={}));var Vs;(function(s){function e(t){return t.closest("[data-jp-suppress-context-menu]")!==null}s.suppressContextMenu=e})(Vs||(Vs={}));var zs;(function(s){s.contextMenu="__internal:context-menu-info"})(zs||(zs={}));const ma=new Ae("@jupyterlab/application:ILayoutRestorer","A service providing application layout restoration functionality. Use this to have your activities restored across page loads."),hr="layout-restorer:data";class sv{constructor(e){this._deferred=new Array,this._deferredMainArea=null,this._firstDone=!1,this._promisesDone=!1,this._promises=[],this._restored=new it,this._trackers=new Set,this._widgets=new Map,this._mode="multiple-document",this._connector=e.connector,this._first=e.first,this._registry=e.registry,e.mode&&(this._mode=e.mode),this._first.then(()=>{this._firstDone=!0}).then(()=>Promise.all(this._promises)).then(()=>{this._promisesDone=!0,this._trackers.clear()}).then(()=>{this._restored.resolve(void 0)})}get isDeferred(){return this._deferred.length>0}get restored(){return this._restored.promise}add(e,t){Oe.nameProperty.set(e,t),this._widgets.set(t,e),e.disposed.connect(this._onWidgetDisposed,this)}async fetch(){var e;const t={fresh:!0,mainArea:null,downArea:null,leftArea:null,rightArea:null,topArea:null,relativeSizes:null},n=this._connector.fetch(hr);try{const[i]=await Promise.all([n,this.restored]);if(!i)return t;const{main:r,down:o,left:a,right:l,relativeSizes:c,top:d}=i,u=!1;let h=null;this._mode==="multiple-document"?h=this._rehydrateMainArea(r):this._deferredMainArea=r;const m=this._rehydrateDownArea(o),_=this._rehydrateSideArea(a),b=this._rehydrateSideArea(l);return{fresh:u,mainArea:h,downArea:m,leftArea:_,rightArea:b,relativeSizes:c||null,topArea:(e=d)!==null&&e!==void 0?e:null}}catch{return t}}async restore(e,t){if(this._firstDone)throw new Error("restore() must be called before `first` has resolved.");const{namespace:n}=e;if(this._trackers.has(n))throw new Error(`The tracker "${n}" is already restored.`);const{args:i,command:r,name:o,when:a}=t;this._trackers.add(n),e.widgetAdded.connect((c,d)=>{const u=o(d);u&&this.add(d,`${n}:${u}`)},this),e.widgetUpdated.connect((c,d)=>{const u=o(d);if(u){const h=`${n}:${u}`;Oe.nameProperty.set(d,h),this._widgets.set(h,d)}});const l=this._first;if(this._mode=="multiple-document"){const c=e.restore({args:i||(()=>jt.emptyObject),command:r,connector:this._connector,name:o,registry:this._registry,when:a?[l].concat(a):l}).catch(d=>{console.error(d)});return this._promises.push(c),c}e.defer({args:i||(()=>jt.emptyObject),command:r,connector:this._connector,name:o,registry:this._registry,when:a?[l].concat(a):l}),this._deferred.push(e)}async restoreDeferred(){if(!this.isDeferred)return null;const e=Promise.resolve(),t=this._deferred.map(n=>e.then(()=>n.restore()));return this._deferred.length=0,await Promise.all(t),this._rehydrateMainArea(this._deferredMainArea)}save(e){var t;if(!this._promisesDone){const i="save() was called prematurely.";return console.warn(i),Promise.reject(i)}const n={};if(n.main=this.isDeferred?this._deferredMainArea:this._dehydrateMainArea(e.mainArea),this.isDeferred){const i=(t=e.mainArea)===null||t===void 0?void 0:t.currentWidget;if(i){const r=Oe.nameProperty.get(i);n.main={...n.main,current:r||void 0}}}return n.down=this._dehydrateDownArea(e.downArea),n.left=this._dehydrateSideArea(e.leftArea),n.right=this._dehydrateSideArea(e.rightArea),n.relativeSizes=e.relativeSizes,n.top={...e.topArea},this._connector.save(hr,n)}_dehydrateMainArea(e){return e?Oe.serializeMain(e):null}_rehydrateMainArea(e){return e?Oe.deserializeMain(e,this._widgets):null}_dehydrateDownArea(e){if(!e)return null;const t={size:e.size};if(e.collapsed!==void 0&&(t.collapsed=e.collapsed),e.currentWidget){const n=Oe.nameProperty.get(e.currentWidget);n&&(t.current=n)}return e.widgets&&(t.widgets=e.widgets.map(n=>Oe.nameProperty.get(n)).filter(n=>!!n)),t}_rehydrateDownArea(e){var t;if(!e)return{currentWidget:null,size:0,widgets:null};const n=this._widgets,i=e.current&&n.has(`${e.current}`)?n.get(`${e.current}`):null,r=Array.isArray(e.widgets)?e.widgets.map(o=>n.has(`${o}`)?n.get(`${o}`):null).filter(o=>!!o):null;return{...typeof e.collapsed=="boolean"?{collapsed:e.collapsed}:{},currentWidget:i,size:(t=e.size)!==null&&t!==void 0?t:0,widgets:r}}_dehydrateSideArea(e){if(!e)return null;const t={collapsed:e.collapsed,visible:e.visible};if(e.currentWidget){const n=Oe.nameProperty.get(e.currentWidget);n&&(t.current=n)}return e.widgets&&(t.widgets=e.widgets.map(n=>Oe.nameProperty.get(n)).filter(n=>!!n)),e.widgetStates&&(t.widgetStates=e.widgetStates),t}_rehydrateSideArea(e){var t,n;if(!e)return{collapsed:!0,currentWidget:null,visible:!0,widgets:null,widgetStates:{null:{sizes:null,expansionStates:null}}};const i=this._widgets,r=(t=e.collapsed)!==null&&t!==void 0?t:!1,o=e.current&&i.has(`${e.current}`)?i.get(`${e.current}`):null,a=Array.isArray(e.widgets)?e.widgets.map(c=>i.has(`${c}`)?i.get(`${c}`):null).filter(c=>!!c):null,l=e.widgetStates;return{collapsed:r,currentWidget:o,widgets:a,visible:(n=e.visible)!==null&&n!==void 0?n:!0,widgetStates:l}}_onWidgetDisposed(e){const t=Oe.nameProperty.get(e);this._widgets.delete(t)}}var Oe;(function(s){s.nameProperty=new Ct({name:"name",create:d=>""});function e(d,u){for(let h=Math.min(u,d.length-1);h>=0;h--){const m=s.nameProperty.get(d[h]);if(m)return m}for(let h=u+1;h<d.length;h++){const m=s.nameProperty.get(d[h]);if(m)return m}return null}function t(d){if(!d||!d.type)return null;if(d.type==="tab-area"){const u=d.widgets.map(m=>s.nameProperty.get(m)).filter(m=>!!m),h=e(d.widgets,d.currentIndex);return{type:"tab-area",currentIndex:h?u.indexOf(h):0,widgets:u}}return{type:"split-area",orientation:d.orientation,sizes:d.sizes,children:d.children.map(t).filter(u=>!!u)}}function n(d){var u,h;const m={dock:d&&d.dock&&t(d.dock.main)||null};if(d&&d.currentWidget){const _=s.nameProperty.get(d.currentWidget)||i((h=(u=d.dock)===null||u===void 0?void 0:u.main)!==null&&h!==void 0?h:null,d.currentWidget);_&&(m.current=_)}return m}s.serializeMain=n;function i(d,u){if(!d)return null;if(d.type==="tab-area"){const h=d.widgets.indexOf(u);return h===-1?null:e(d.widgets,h)}for(const h of d.children){const m=i(h,u);if(m)return m}return null}function r(d,u,h){const m=[];let _=0;return d.forEach((b,g)=>{const p=h.get(b);p&&(g<=u&&(_=m.length),m.push(p))}),{type:"tab-area",currentIndex:_,widgets:m}}function o(d,u){if(!d)return null;const h=d.type||"unknown";if(h==="unknown"||h!=="tab-area"&&h!=="split-area")return console.warn(`Attempted to deserialize unknown type: ${h}`),null;if(h==="tab-area"){const{currentIndex:p,widgets:w}=d;return r(w||[],p||0,u)}const{orientation:m,sizes:_,children:b}=d;return{type:"split-area",orientation:m,sizes:_||[],children:b&&b.map(p=>o(p,u)).filter(p=>!!p)||[]}}function a(d,u){if(!d)return null;const h=d.current||null,m=d.dock||null,_=m?o(m,u):null;return{currentWidget:h&&(u.get(h)||l(m,h,u))||c(_),dock:m?{main:_}:null}}s.deserializeMain=a;function l(d,u,h){var m;if(!d)return null;if(d.type==="tab-area"){const _=d.widgets||[],b=_.indexOf(u);if(b===-1)return null;const g=r(_,b,h);return(m=g.widgets[g.currentIndex])!==null&&m!==void 0?m:null}for(const _ of d.children||[]){const b=l(_,u,h);if(b)return b}return null}function c(d){var u;if(!d)return null;if(d.type==="tab-area")return(u=d.widgets[d.currentIndex])!==null&&u!==void 0?u:null;for(const h of d.children){const m=c(h);if(m)return m}return null}})(Oe||(Oe={}));const ry=new Ae("@jupyterlab/application:IMimeDocumentTracker","A widget tracker for documents rendered using a mime renderer extension. Use this if you want to list and interact with documents rendered by such extensions.");function oy(s){const e=[],t="application-mimedocuments",n=new ic({namespace:t});return s.forEach(i=>{let r=i.default;i.hasOwnProperty("__esModule")||(r=i),Array.isArray(r)||(r=[r]),r.forEach(o=>{e.push(ay(n,o))})}),e.push({id:"@jupyterlab/application-extension:mimedocument",description:"Provides a mime document widget tracker.",optional:[ma],provides:ry,autoStart:!0,activate:(i,r)=>(r&&r.restore(n,{command:"docmanager:open",args:o=>({path:o.context.path,factory:ln.factoryNameProperty.get(o)}),name:o=>`${o.context.path}:${ln.factoryNameProperty.get(o)}`}),n)}),e}function ay(s,e){return{id:e.id,description:e.description,requires:[Ap,rc],autoStart:!0,activate:(t,n,i)=>{if(e.rank!==void 0?n.addFactory(e.rendererFactory,e.rank):n.addFactory(e.rendererFactory),!e.documentWidgetFactoryOptions)return;const r=t.docRegistry;let o=[];Array.isArray(e.documentWidgetFactoryOptions)?o=e.documentWidgetFactoryOptions:o=[e.documentWidgetFactoryOptions],e.fileTypes&&e.fileTypes.forEach(a=>{a.icon&&(a={...a,icon:Bt.resolve({icon:a.icon})}),t.docRegistry.addFileType(a)}),o.forEach(a=>{const l=a.toolbarFactory?d=>a.toolbarFactory(d.content.renderer):void 0,c=new y_({renderTimeout:e.renderTimeout,dataType:e.dataType,rendermime:n,modelName:a.modelName,name:a.name,primaryFileType:r.getFileType(a.primaryFileType),fileTypes:a.fileTypes,defaultFor:a.defaultFor,defaultRendered:a.defaultRendered,toolbarFactory:l,translator:i,factory:e.rendererFactory});r.addWidgetFactory(c),c.widgetCreated.connect((d,u)=>{ln.factoryNameProperty.set(u,c.name),u.context.pathChanged.connect(()=>{s.save(u)}),s.add(u)})})}}}var ln;(function(s){s.factoryNameProperty=new Ct({name:"factoryName",create:()=>{}})})(ln||(ln={}));const ly=1e3,cy=25e3,dy=300,uy=3e3;class hy extends an{constructor(){super(...arguments),this._optimizeResize=!0,this._isResizeDragActive=!1,this._dragPointerId=-1,this._cancelListener=null,this._frozenGroups=[],this._refreshTimerId=0,this._refreshRAFId=0,this._refreshGeneration=0,this._intervalId=0}handleEvent(e){e.type==="pointerdown"&&!this._isResizeDragActive&&(this._isResizeDragActive=this._isHandlePointerDown(e),this._isResizeDragActive&&(this._dragPointerId=e.pointerId,this._listenForCancel())),this._isResizeDragActive&&Ot.endsDrag(e,this._dragPointerId)&&this._endDrag(),super.handleEvent(e),this._optimizeResize&&(e.type==="pointerdown"&&this._isResizeDragActive?this._freezeHeavyLeaves():e.type==="pointermove"&&this._isResizeDragActive&&this._scheduleRefresh())}dispose(){this._endDrag(),super.dispose()}onAfterDetach(e){this._endDrag(),super.onAfterDetach(e)}_endDrag(){this._isResizeDragActive=!1,this._dragPointerId=-1,this._cancelListener&&(this._cancelListener.removeEventListener("pointercancel",this,!0),this._cancelListener=null),this._unfreezeElements()}_listenForCancel(){this._cancelListener||(this._cancelListener=this.node.ownerDocument,this._cancelListener.addEventListener("pointercancel",this,!0))}_isHandlePointerDown(e){const t=e;if(t.button!==0)return!1;const n=t.target;if(!(n instanceof HTMLElement))return!1;for(const i of this.handles())if(i.contains(n))return!0;return!1}get optimizeResize(){return this._optimizeResize}set optimizeResize(e){this._optimizeResize=e,e||this._unfreezeElements()}_freezeHeavyLeaves(){if(this._frozenGroups.length>0)return;const e=[];for(const t of this.widgets())this._collectHeavyWidgets(t,e);for(const t of e){const n=t.node,i=[n];for(let l=0;l<n.children.length;l++)i.push(n.children[l]);const r=i.filter(l=>!Ot.isLayoutManaged(l));if(r.length===0)continue;const o=r.map(l=>l.getBoundingClientRect()),a=r.map(l=>({element:l,prevWidth:l.style.width,prevMaxWidth:l.style.maxWidth,prevHeight:l.style.height,prevMaxHeight:l.style.maxHeight}));for(let l=0;l<a.length;l++)Ot.pinToRect(a[l].element,o[l]);this._frozenGroups.push(a)}this._frozenGroups.length>0&&this._intervalId===0&&(this._intervalId=window.setInterval(()=>{this._refreshFrozenElements()},uy))}_scheduleRefresh(){this._frozenGroups.length!==0&&(this._refreshTimerId!==0&&clearTimeout(this._refreshTimerId),this._refreshTimerId=window.setTimeout(()=>{this._refreshTimerId=0,this._refreshFrozenElements()},dy))}_refreshFrozenElements(){this._cancelRefresh();const e=this._refreshGeneration;let t=0;const n=()=>{if(e!==this._refreshGeneration)return;if(t>=this._frozenGroups.length){this._refreshRAFId=0;return}let i=this._frozenGroups[t];for(let r of i){let o=r.element;o.style.width="",o.style.maxWidth="",o.style.height="",o.style.maxHeight=""}this._refreshRAFId=requestAnimationFrame(()=>{if(e!==this._refreshGeneration)return;let r=i.map(o=>o.element.getBoundingClientRect());for(let o=0;o<i.length;o++)Ot.pinToRect(i[o].element,r[o]);t++,this._refreshRAFId=requestAnimationFrame(n)})};this._refreshRAFId=requestAnimationFrame(n)}_cancelRefresh(){this._refreshGeneration++,this._refreshRAFId!==0&&(cancelAnimationFrame(this._refreshRAFId),this._refreshRAFId=0)}_unfreezeElements(){this._refreshTimerId!==0&&(clearTimeout(this._refreshTimerId),this._refreshTimerId=0),this._cancelRefresh(),this._intervalId!==0&&(clearInterval(this._intervalId),this._intervalId=0);for(let e of this._frozenGroups)for(let t of e)t.element.style.width=t.prevWidth,t.element.style.maxWidth=t.prevMaxWidth,t.element.style.height=t.prevHeight,t.element.style.maxHeight=t.prevMaxHeight;this._frozenGroups=[]}_collectHeavyWidgets(e,t){if(!this._isDOMHeavy(e.node))return;let n=e.layout;if(!n){t.push(e);return}let i=!1;for(let r of n)if(this._isDOMHeavy(r.node)){i=!0;break}if(i)for(let r of n)this._collectHeavyWidgets(r,t);else t.push(e)}_isDOMHeavy(e){var t,n;return e.querySelectorAll("*").length>=ly||((n=(t=e.textContent)===null||t===void 0?void 0:t.length)!==null&&n!==void 0?n:0)>=cy}}var Ot;(function(s){function e(i){return i.style.position==="absolute"}s.isLayoutManaged=e;function t(i,r){switch(i.type){case"pointerup":return i.button===0;case"pointercancel":return i.pointerId===r;case"keydown":return i.keyCode===27;default:return!1}}s.endsDrag=t;function n(i,r){i.style.width=`${r.width}px`,i.style.maxWidth=`${r.width}px`,i.style.height=`${r.height}px`,i.style.maxHeight=`${r.height}px`}s.pinToRect=n})(Ot||(Ot={}));const fy="jp-LabShell",fr="jp-SideBar",mr="jp-mod-current",pr="jp-mod-active",Xt=900,_r="jp-Activity",gr=.25,iv=new Ae("@jupyterlab/application:ILabShell","A service for interacting with the JupyterLab shell. The top-level `application` object also has a reference to the shell, but it has a restricted interface in order to be agnostic to different shell implementations on the application. Use this to get more detailed information about currently active widgets and layout state.");class Us extends X{constructor(e){super(),this._dockChildHook=(p,w)=>{switch(w.type){case"child-added":w.child.addClass(_r),this._tracker.add(w.child);break;case"child-removed":w.child.removeClass(_r),this._tracker.remove(w.child);break}return!0},this._activeChanged=new U(this),this._cachedLayout=null,this._currentChanged=new U(this),this._currentPath="",this._currentPathChanged=new U(this),this._modeChanged=new U(this),this._isRestored=!1,this._lastDownAreaSize=gr,this._layoutModified=new U(this),this._layoutDebouncer=new oc(()=>{this._layoutModified.emit(void 0)},0),this._restored=new it,this._tracker=new ac,this._topHandlerHiddenByUser=!1,this._idTypeMap=new Map,this._mainOptionsCache=new Map,this._sideOptionsCache=new Map,this._delayedWidget=new Array,this.addClass(fy),this.id="main",e?.waitForRestore===!1&&(this._userLayout={"multiple-document":{},"single-document":{}});const t=this._skipLinkWidget=new De.SkipLinkWidget(this);this._skipLinkWidget.show();const n=new pt;n.addClass("jp-skiplink-wrapper"),n.addWidget(t);const i=this._headerPanel=new we,r=this._menuHandler=new De.PanelHandler;r.panel.node.setAttribute("role","navigation");const o=this._topHandler=new De.PanelHandler;o.panel.node.setAttribute("role","banner");const a=this._bottomPanel=new we;a.node.setAttribute("role","contentinfo");const l=new we,c=this._vsplitPanel=new De.RestorableSplitPanel,d=this._dockPanel=new hy({hiddenMode:X.HiddenMode.Display});Ie.installMessageHook(d,this._dockChildHook);const u=this._hsplitPanel=new De.RestorableSplitPanel,h=this._downPanel=new up({tabsMovable:!0}),m=this._leftHandler=new De.SideBarHandler({side:"left",host:l}),_=this._rightHandler=new De.SideBarHandler({side:"right",host:l}),b=new tt;i.id="jp-header-panel",r.panel.id="jp-menu-panel",o.panel.id="jp-top-panel",a.id="jp-bottom-panel",l.id="jp-main-content-panel",c.id="jp-main-vsplit-panel",d.id="jp-main-dock-panel",u.id="jp-main-split-panel",h.id="jp-down-stack",m.sideBar.addClass(fr),m.sideBar.addClass("jp-mod-left"),m.sideBar.node.setAttribute("role","complementary"),m.stackedPanel.id="jp-left-stack",m.area.addClass("jp-SideArea"),m.area.node.setAttribute("data-side","left"),_.sideBar.addClass(fr),_.sideBar.addClass("jp-mod-right"),_.sideBar.node.setAttribute("role","complementary"),_.stackedPanel.id="jp-right-stack",_.area.addClass("jp-SideArea"),_.area.node.setAttribute("data-side","right"),d.node.setAttribute("role","main"),l.spacing=0,c.spacing=1,d.spacing=5,u.spacing=1,i.direction="top-to-bottom",c.orientation="vertical",l.direction="left-to-right",u.orientation="horizontal",a.direction="bottom-to-top",Pe.setStretch(m.area,0),Pe.setStretch(h,0),Pe.setStretch(d,1),Pe.setStretch(_.area,0),we.setStretch(m.sideBar,0),we.setStretch(u,1),we.setStretch(_.sideBar,0),Pe.setStretch(c,1),u.addWidget(m.area),u.addWidget(d),u.addWidget(_.area),c.addWidget(u),c.addWidget(h),l.addWidget(m.sideBar),l.addWidget(c),l.addWidget(_.sideBar),b.direction="top-to-bottom",b.spacing=0,c.setRelativeSizes([3,1]),u.setRelativeSizes([1,2.5,1]),tt.setStretch(i,0),tt.setStretch(r.panel,0),tt.setStretch(o.panel,0),tt.setStretch(l,1),tt.setStretch(a,0),b.addWidget(n),b.addWidget(i),b.addWidget(o.panel),b.addWidget(l),b.addWidget(a),this._headerPanel.hide(),this._bottomPanel.hide(),this._downPanel.hide(),this.layout=b,this._tracker.currentChanged.connect(this._onCurrentChanged,this),this._tracker.activeChanged.connect(this._onActiveChanged,this),this._dockPanel.layoutModified.connect(this._onLayoutModified,this),this._vsplitPanel.updated.connect(this._onLayoutModified,this),this._downPanel.currentChanged.connect(this._onLayoutModified,this),this._downPanel.tabBar.tabMoved.connect(this._onTabPanelChanged,this),this._downPanel.stackedPanel.widgetRemoved.connect(this._onTabPanelChanged,this),this._leftHandler.updated.connect(this._onLayoutModified,this),this._rightHandler.updated.connect(this._onLayoutModified,this),this._hsplitPanel.updated.connect(this._onLayoutModified,this);const g=this._titleHandler=new De.TitleHandler(this);this.add(g,"top",{rank:100}),this._dockPanel.mode==="multiple-document"?(this._topHandler.addWidget(this._menuHandler.panel,100),g.hide()):b.insertWidget(3,this._menuHandler.panel),this.translator=se,this.currentChanged.connect((p,w)=>{let v=w.newValue,y=w.oldValue;y&&(y.title.changed.disconnect(this._updateTitlePanelTitle,this),y instanceof Qt&&y.context.pathChanged.disconnect(this._updateCurrentPath,this)),v&&(v.title.changed.connect(this._updateTitlePanelTitle,this),this._updateTitlePanelTitle(),v instanceof Qt&&v.context.pathChanged.connect(this._updateCurrentPath,this)),this._updateCurrentPath()})}get activeChanged(){return this._activeChanged}get activeWidget(){return this._tracker.activeWidget}get addButtonEnabled(){return this._dockPanel.addButtonEnabled}set addButtonEnabled(e){this._dockPanel.addButtonEnabled=e}get addRequested(){return this._dockPanel.addRequested}get currentChanged(){return this._currentChanged}get currentPath(){return this._currentPath}get currentPathChanged(){return this._currentPathChanged}get currentWidget(){return this._tracker.currentWidget}get downCollapsed(){return this._downPanel.isHidden}get layoutModified(){return this._layoutModified}get leftCollapsed(){return!this._leftHandler.sideBar.currentTitle}get rightCollapsed(){return!this._rightHandler.sideBar.currentTitle}get presentationMode(){return this.hasClass("jp-mod-presentationMode")}set presentationMode(e){this.toggleClass("jp-mod-presentationMode",e)}get mode(){return this._dockPanel.mode}set mode(e){const t=this._dockPanel;if(e===t.mode)return;const n=this.currentWidget;if(e==="single-document")this._cachedLayout=t.saveLayout(),t.mode=e,this.currentWidget&&t.activateWidget(this.currentWidget),this.layout.insertWidget(3,this._menuHandler.panel),this._titleHandler.show(),this._updateTitlePanelTitle(),this._topHandlerHiddenByUser&&this._topHandler.panel.hide();else{const i=Array.from(t.widgets());t.mode=e,this._cachedLayout&&(De.normalizeAreaConfig(t,this._cachedLayout.main),t.restoreLayout(this._cachedLayout),this._cachedLayout=null),this._layoutRestorer.isDeferred&&this._layoutRestorer.restoreDeferred().then(r=>{if(r){const{currentWidget:o,dock:a}=r;a&&this._dockPanel.restoreLayout(a),o&&this.activateById(o.id)}}).catch(r=>{console.error("Failed to restore the deferred layout."),console.error(r)}),i.forEach(r=>{r.parent||this._addToMainArea(r,{...this._mainOptionsCache.get(r),activate:!1})}),this._mainOptionsCache.clear(),n&&t.activateWidget(n),this.add(this._menuHandler.panel,"top",{rank:100}),this._titleHandler.hide()}this.node.dataset.shellMode=e,this._downPanel.fit(),this._modeChanged.emit(e)}get modeChanged(){return this._modeChanged}get restored(){return this._restored.promise}get translator(){var e;return(e=this._translator)!==null&&e!==void 0?e:se}set translator(e){if(e!==this._translator){this._translator=e,He.translator=e;const t=e.load("jupyterlab");this._menuHandler.panel.node.setAttribute("aria-label",t.__("main menu")),this._leftHandler.sideBar.node.setAttribute("aria-label",t.__("main sidebar")),this._leftHandler.sideBar.contentNode.setAttribute("aria-label",t.__("main sidebar")),this._rightHandler.sideBar.node.setAttribute("aria-label",t.__("alternate sidebar")),this._rightHandler.sideBar.contentNode.setAttribute("aria-label",t.__("alternate sidebar")),this._topHandler.panel.node.setAttribute("aria-label",t.__("Top Bar")),this._bottomPanel.node.setAttribute("aria-label",t.__("Bottom Panel")),this._dockPanel.node.setAttribute("aria-label",t.__("Main Content"))}}get userLayout(){return jt.deepCopy(this._userLayout)}activateById(e){var t;if(this._leftHandler.has(e)){this._leftHandler.activate(e);return}if(this._rightHandler.has(e)){this._rightHandler.activate(e);return}const n=this._downPanel.tabBar.titles.findIndex(o=>o.owner.id===e);if(n>=0){const o=this._downPanel.isHidden;this._downPanel.currentIndex=n,o&&(this._showDownPanel(),this._onLayoutModified()),(t=this._downPanel.currentWidget)===null||t===void 0||t.activate();return}const i=this._dockPanel,r=je(i.widgets(),o=>o.id===e);r&&i.activateWidget(r)}activateArea(e="main"){switch(e){case"main":{const t=this._currentTabBar();if(!t)return;t.currentTitle&&t.currentTitle.owner.activate()}return;case"left":case"right":case"header":case"top":case"menu":case"bottom":console.debug(`Area: ${e} activation not yet implemented`);break;default:throw new Error(`Invalid area: ${e}`)}}activateNextTab(){const e=this._currentTabBar();if(!e)return;const t=e.currentIndex;if(t!==-1){if(t<e.titles.length-1){e.currentIndex+=1,e.currentTitle&&e.currentTitle.owner.activate();return}if(t===e.titles.length-1){const n=this._adjacentBar("next");n&&(n.currentIndex=0,n.currentTitle&&n.currentTitle.owner.activate())}}}activatePreviousTab(){const e=this._currentTabBar();if(!e)return;const t=e.currentIndex;if(t!==-1){if(t>0){e.currentIndex-=1,e.currentTitle&&e.currentTitle.owner.activate();return}if(t===0){const n=this._adjacentBar("previous");if(n){const i=n.titles.length;n.currentIndex=i-1,n.currentTitle&&n.currentTitle.owner.activate()}}}}activateNextTabBar(){const e=this._adjacentBar("next");e&&e.currentTitle&&e.currentTitle.owner.activate()}activatePreviousTabBar(){const e=this._adjacentBar("previous");e&&e.currentTitle&&e.currentTitle.owner.activate()}add(e,t="main",n){var i;if(!this._userLayout){this._delayedWidget.push({widget:e,area:t,options:n});return}let r;switch(n?.type&&this._userLayout[this.mode][n.type]?(r=this._userLayout[this.mode][n.type],this._idTypeMap.set(e.id,n.type)):r=this._userLayout[this.mode][e.id],n?.type&&(this._idTypeMap.set(e.id,n.type),e.disposed.connect(()=>{this._idTypeMap.delete(e.id)})),t=(i=r?.area)!==null&&i!==void 0?i:t,n=n||r?.options?{...n,...r?.options}:void 0,n?.rank!==void 0&&this._sideOptionsCache.set(e,{...this._sideOptionsCache.get(e),rank:n.rank}),t||"main"){case"bottom":return this._addToBottomArea(e,n);case"down":return this._addToDownArea(e,n);case"header":return this._addToHeaderArea(e,n);case"left":return this._addToLeftArea(e,n);case"main":return this._addToMainArea(e,n);case"menu":return this._addToMenuArea(e,n);case"right":return this._addToRightArea(e,n);case"top":return this._addToTopArea(e,n);default:throw new Error(`Invalid area: ${t}`)}}move(e,t,n){var i,r;const o=(i=this._idTypeMap.get(e.id))!==null&&i!==void 0?i:e.id,a=(r=this._sideOptionsCache.get(e))===null||r===void 0?void 0:r.rank;for(const l of["single-document","multiple-document"].filter(c=>!n||c===n)){const c=this._userLayout[l][o];this._userLayout[l][o]={...c,area:t,...a!==void 0?{options:{...c?.options,rank:a}}:{}}}return this.add(e,t),this._userLayout}collapseLeft(){this._leftHandler.collapse(),this._onLayoutModified()}collapseRight(){this._rightHandler.collapse(),this._onLayoutModified()}collapseDown(){this._downPanel.isHidden||(this._hideDownPanel(),this._onLayoutModified())}dispose(){this.isDisposed||(this._layoutDebouncer.dispose(),super.dispose())}expandLeft(){this._leftHandler.expand(),this._onLayoutModified()}expandRight(){this._rightHandler.expand(),this._onLayoutModified()}expandDown(){var e;this._downPanel.stackedPanel.widgets.length!==0&&(this._showDownPanel(),(e=this._downPanel.currentWidget)===null||e===void 0||e.activate(),this._onLayoutModified())}closeAll(){Array.from(this._dockPanel.widgets()).forEach(e=>e.close()),this._downPanel.stackedPanel.widgets.forEach(e=>e.close())}isSideTabBarVisible(e){switch(e){case"left":return this._leftHandler.isVisible;case"right":return this._rightHandler.isVisible}}isTopInSimpleModeVisible(){return!this._topHandlerHiddenByUser}isEmpty(e){switch(e){case"bottom":return this._bottomPanel.widgets.length===0;case"down":return this._downPanel.stackedPanel.widgets.length===0;case"header":return this._headerPanel.widgets.length===0;case"left":return this._leftHandler.stackedPanel.widgets.length===0;case"main":return this._dockPanel.isEmpty;case"menu":return this._menuHandler.panel.widgets.length===0;case"right":return this._rightHandler.stackedPanel.widgets.length===0;case"top":return this._topHandler.panel.widgets.length===0;default:return!0}}async restoreLayout(e,t,n={}){var i,r,o,a,l,c,d,u;this._userLayout={"single-document":(i=n["single-document"])!==null&&i!==void 0?i:{},"multiple-document":(r=n["multiple-document"])!==null&&r!==void 0?r:{}},this._delayedWidget.forEach(({widget:v,area:y,options:C})=>{this.add(v,y,C)}),this._delayedWidget.length=0,this._layoutRestorer=t;const h=await t.fetch(),{mainArea:m,downArea:_,leftArea:b,rightArea:g,topArea:p,relativeSizes:w}=h;if(m){const{currentWidget:v,dock:y}=m;y&&e==="multiple-document"&&this._dockPanel.restoreLayout(y),e&&(this.mode=e),v&&this.activateById(v.id)}else e&&(this.mode=e);if(p?.simpleVisibility!==void 0&&(this._topHandlerHiddenByUser=!p.simpleVisibility,this.mode==="single-document"&&this._topHandler.panel.setHidden(this._topHandlerHiddenByUser)),_){const{currentWidget:v,widgets:y,size:C}=_,E=(o=_.collapsed)!==null&&o!==void 0?o:!C,x=(a=y?.map(P=>P.id))!==null&&a!==void 0?a:[],S=new Set,A=P=>{if(P){if(P.type==="tab-area"){P.widgets.forEach(D=>{S.add(D.id)});return}P.children.forEach(A)}};A((l=m?.dock)===null||l===void 0?void 0:l.main),(c=b?.widgets)===null||c===void 0||c.forEach(P=>{S.add(P.id)}),(d=g?.widgets)===null||d===void 0||d.forEach(P=>{S.add(P.id)}),this._downPanel.tabBar.titles.filter(P=>!x.includes(P.owner.id)).forEach(P=>{S.has(P.owner.id)?P.owner.parent=null:P.owner.close()});const I=this._downPanel.tabBar.titles.map(P=>P.owner.id);for(y?.filter(P=>!I.includes(P.id)).map(P=>this._downPanel.addWidget(P));!Y.shallowEqual(x,this._downPanel.tabBar.titles.map(P=>P.owner.id));)this._downPanel.tabBar.titles.forEach((P,D)=>{const j=x.findIndex(H=>P.owner.id==H);j>=0&&j!=D&&this._downPanel.tabBar.insertTab(j,P)});if(v){const P=this._downPanel.stackedPanel.widgets.findIndex(D=>D.id===v.id);P>=0&&(this._downPanel.currentIndex=P)}!E&&y?.length&&C&&C>0?(this._showDownPanel(C),(u=this._downPanel.currentWidget)===null||u===void 0||u.activate()):(this._hideDownPanel(),C&&C>0&&(this._lastDownAreaSize=C))}b?this._leftHandler.rehydrate(b):e==="single-document"&&this.collapseLeft(),g?this._rightHandler.rehydrate(g):e==="single-document"&&this.collapseRight(),w&&this._hsplitPanel.setRelativeSizes(w),this._isRestored||(Ie.flush(),this._restored.resolve(h))}saveLayout(){return{mainArea:{currentWidget:this._tracker.currentWidget,dock:this.mode==="single-document"?this._cachedLayout||this._dockPanel.saveLayout():this._dockPanel.saveLayout()},downArea:{collapsed:this.downCollapsed,currentWidget:this._downPanel.currentWidget,widgets:Array.from(this._downPanel.stackedPanel.widgets),size:this._downPanel.stackedPanel.widgets.length===0?0:this.downCollapsed?this._lastDownAreaSize:this._vsplitPanel.relativeSizes()[1]},leftArea:this._leftHandler.dehydrate(),rightArea:this._rightHandler.dehydrate(),topArea:{simpleVisibility:!this._topHandlerHiddenByUser},relativeSizes:this._hsplitPanel.relativeSizes()}}toggleTopInSimpleModeVisibility(){this.mode==="single-document"&&(this._topHandler.panel.isVisible?(this._topHandlerHiddenByUser=!0,this._topHandler.panel.hide()):(this._topHandlerHiddenByUser=!1,this._topHandler.panel.show(),this._updateTitlePanelTitle()),this._onLayoutModified())}toggleSideTabBarVisibility(e){e==="right"?this._rightHandler.isVisible?this._rightHandler.hide():this._rightHandler.show():this._leftHandler.isVisible?this._leftHandler.hide():this._leftHandler.show()}updateConfig(e){if(e.hiddenMode)switch(e.hiddenMode){case"display":this._dockPanel.hiddenMode=X.HiddenMode.Display;break;case"scale":this._dockPanel.hiddenMode=X.HiddenMode.Scale;break;case"contentVisibility":this._dockPanel.hiddenMode=X.HiddenMode.ContentVisibility;break}e.dockPanelPadding!==void 0&&(e.dockPanelPadding===!1?this._dockPanel.node.style.setProperty("--jp-private-dock-panel-padding","0px"):this._dockPanel.node.style.removeProperty("--jp-private-dock-panel-padding"),this._dockPanel.fit()),e.optimizeResize!==void 0&&(this._dockPanel.optimizeResize=e.optimizeResize),e.activityBarPosition!==void 0&&(this._setActivityBarPosition("left",e.activityBarPosition),this._setActivityBarPosition("right",e.activityBarPosition))}_setActivityBarPosition(e,t){const n=e==="left"?this._leftHandler:this._rightHandler;n.position!==t&&(n.position=t,this._onLayoutModified())}widgets(e){switch(e??"main"){case"main":return this._dockPanel.widgets();case"left":return Mi(this._leftHandler.sideBar.titles,t=>t.owner);case"right":return Mi(this._rightHandler.sideBar.titles,t=>t.owner);case"header":return this._headerPanel.children();case"top":return this._topHandler.panel.children();case"menu":return this._menuHandler.panel.children();case"bottom":return this._bottomPanel.children();case"down":return this._downPanel.stackedPanel.children();default:throw new Error(`Invalid area: ${e}`)}}onAfterAttach(e){this.node.dataset.shellMode=this.mode}_updateTitlePanelTitle(){let e=this.currentWidget;const t=this._titleHandler.inputElement;t.value=e?He.titleLabel(e.title):"",t.title=e?e.title.caption:""}_updateCurrentPath(){let e=this.currentWidget,t="";e&&e instanceof Qt&&(t=e.context.path),this._currentPathChanged.emit({newValue:t,oldValue:this._currentPath}),this._currentPath=t}_addToLeftArea(e,t){if(!e.id){console.error("Widgets added to app shell must have unique id property.");return}t=t||this._sideOptionsCache.get(e)||{},this._sideOptionsCache.set(e,t);const n="rank"in t?t.rank:Xt;this._leftHandler.addWidget(e,n),this._onLayoutModified()}_addToMainArea(e,t){if(!e.id){console.error("Widgets added to app shell must have unique id property.");return}t=t||{};const n=this._dockPanel,i=t.mode||"tab-after";let r=this.currentWidget;t.ref&&(r=je(n.widgets(),a=>a.id===t.ref)||null);const{title:o}=e;o.dataset={...o.dataset,id:e.id},o.icon instanceof Bt?o.icon=o.icon.bindprops({stylesheet:"mainAreaTab"}):(typeof o.icon=="string"||!o.icon)&&(o.iconClass=xt(o.iconClass,"jp-Icon")),n.addWidget(e,{mode:i,ref:r}),n.mode==="single-document"&&this._mainOptionsCache.set(e,t),t.activate!==!1&&n.activateWidget(e)}_addToRightArea(e,t){if(!e.id){console.error("Widgets added to app shell must have unique id property.");return}t=t||this._sideOptionsCache.get(e)||{};const n="rank"in t?t.rank:Xt;this._sideOptionsCache.set(e,t),this._rightHandler.addWidget(e,n),this._onLayoutModified()}_addToTopArea(e,t){var n;if(!e.id){console.error("Widgets added to app shell must have unique id property.");return}t=t||{};const i=(n=t.rank)!==null&&n!==void 0?n:Xt;this._topHandler.addWidget(e,i),this._onLayoutModified(),this._topHandler.panel.isHidden&&this._topHandler.panel.show()}_addToMenuArea(e,t){var n;if(!e.id){console.error("Widgets added to app shell must have unique id property.");return}t=t||{};const i=(n=t.rank)!==null&&n!==void 0?n:Xt;this._menuHandler.addWidget(e,i),this._onLayoutModified(),this._menuHandler.panel.isHidden&&this._menuHandler.panel.show()}_addToHeaderArea(e,t){if(!e.id){console.error("Widgets added to app shell must have unique id property.");return}this._headerPanel.addWidget(e),this._onLayoutModified(),this._headerPanel.isHidden&&this._headerPanel.show()}_addToBottomArea(e,t){if(!e.id){console.error("Widgets added to app shell must have unique id property.");return}this._bottomPanel.addWidget(e),this._onLayoutModified(),this._bottomPanel.isHidden&&this._bottomPanel.show()}_addToDownArea(e,t){if(!e.id){console.error("Widgets added to app shell must have unique id property.");return}const{title:n}=e;n.dataset={...n.dataset,id:e.id},n.icon instanceof Bt?n.icon=n.icon.bindprops({stylesheet:"mainAreaTab"}):(typeof n.icon=="string"||!n.icon)&&(n.iconClass=xt(n.iconClass,"jp-Icon")),this._downPanel.addWidget(e),this._downPanel.isHidden&&this._showDownPanel(),this._onLayoutModified()}_showDownPanel(e=this._lastDownAreaSize){const t=e>0?e:gr;this._lastDownAreaSize=t,this._vsplitPanel.setRelativeSizes([Math.max(1-t,0),t]),this._downPanel.show()}_hideDownPanel(){const e=this._vsplitPanel.relativeSizes()[1];e>0&&(this._lastDownAreaSize=e),this._downPanel.hide()}_adjacentBar(e){const t=this._currentTabBar();if(!t)return null;const n=Array.from(this._dockPanel.tabBars()),i=n.length,r=n.indexOf(t);return e==="previous"?r>0?n[r-1]:r===0?n[i-1]:null:r<i-1?n[r+1]:r===i-1?n[0]:null}_currentTabBar(){const e=this._tracker.currentWidget;if(!e)return null;const t=e.title,n=this._dockPanel.tabBars();return je(n,i=>i.titles.indexOf(t)>-1)||null}_onActiveChanged(e,t){t.newValue&&(t.newValue.title.className+=` ${pr}`),t.oldValue&&(t.oldValue.title.className=t.oldValue.title.className.replace(pr,"")),this._activeChanged.emit(t)}_onCurrentChanged(e,t){t.newValue&&(t.newValue.title.className+=` ${mr}`),t.oldValue&&(t.oldValue.title.className=t.oldValue.title.className.replace(mr,"")),this._currentChanged.emit(t),this._onLayoutModified()}_onTabPanelChanged(){this._downPanel.stackedPanel.widgets.length===0&&this._hideDownPanel(),this._onLayoutModified()}_onLayoutModified(){this._layoutDebouncer.invoke()}moveTab(e,t){const n=e,r={left:"split-left",right:"split-right",top:"split-top",bottom:"split-bottom"}[t];this._dockPanel.addWidget(e,{mode:r,ref:n})}getMainAreaTabBar(e){for(const t of this._dockPanel.tabBars())if(t.titles.includes(e.title))return t;return null}}var De;(function(s){function e(l,c){return l.rank-c.rank}s.itemCmp=e;function t(l,c){if(c){if(c.type==="tab-area"){c.widgets=c.widgets.filter(d=>!d.isDisposed&&d.parent===l);return}c.children.forEach(d=>{t(l,d)})}}s.normalizeAreaConfig=t;class n{constructor(){this._panelChildHook=(c,d)=>{switch(d.type){case"child-added":{const u=d.child;if(this._items.find(m=>m.widget===u))break;const h=this._items[this._items.length-1].rank;this._items.push({widget:u,rank:h})}break;case"child-removed":{const u=d.child;Y.removeFirstWhere(this._items,h=>h.widget===u)}break}return!0},this._items=new Array,this._panel=new pt,Ie.installMessageHook(this._panel,this._panelChildHook)}get panel(){return this._panel}addWidget(c,d){c.parent=null;const u={widget:c,rank:d},h=Y.upperBound(this._items,u,s.itemCmp);Y.insert(this._items,h,u),this._panel.insertWidget(h,c)}}s.PanelHandler=n;class i{constructor(c){this._isHiddenByUser=!1,this._isCollapsedByUser=!1,this._items=new Array,this._position="side",this._updated=new U(this),this._side=c.side,this._host=c.host,this._sideBar=new ei({insertBehavior:"none",removeBehavior:"none",allowDeselect:!0,orientation:"vertical"}),this._sideBar.node.setAttribute("data-side",this._side),this._stackedPanel=new lc,this._area=new we({direction:"top-to-bottom",spacing:0}),we.setStretch(this._stackedPanel,1),we.setStretch(this._sideBar,0),this._area.addWidget(this._stackedPanel),this._sideBar.hide(),this._stackedPanel.hide(),this._lastCurrent=null,this._sideBar.currentChanged.connect(this._onCurrentChanged,this),this._sideBar.tabCloseRequested.connect(this._onTabCloseRequested,this),this._sideBar.tabActivateRequested.connect(this._onTabActivateRequested,this),this._stackedPanel.widgetRemoved.connect(this._onWidgetRemoved,this)}get isVisible(){return this._sideBar.isVisible}get sideBar(){return this._sideBar}get stackedPanel(){return this._stackedPanel}get area(){return this._area}get position(){return this._position}set position(c){if(this._position===c)return;this._position=c,this._isCollapsedByUser=!1,this._sideBar.parent=null;const d=this._side==="left";this._sideBar.orientation=c==="side"?"vertical":"horizontal",this._sideBar.toggleClass("jp-mod-left",d&&c==="side"),this._sideBar.toggleClass("jp-mod-right",!d&&c==="side");const u=c==="side"?d?"left":"right":c;if(this._sideBar.node.setAttribute("data-side",u),this._sideBar.allowDeselect=c==="side",c==="side"){const h=d?0:this._host.widgets.length;this._host.insertWidget(h,this._sideBar)}else c==="top"?this._area.insertWidget(0,this._sideBar):this._area.addWidget(this._sideBar);this._refreshVisibility()}get updated(){return this._updated}_onHandleMoved(){return this._refreshVisibility()}_onExpansionToggle(c,d){return this._refreshVisibility()}expand(){this._isCollapsedByUser=!1;const c=this._lastCurrent||this._items.length>0&&this._items[0].widget;c?this.activate(c.id):this._refreshVisibility()}activate(c){const d=this._findWidgetByID(c);d&&(this._isCollapsedByUser=!1,this._sideBar.currentTitle=d.title,d.activate())}has(c){return this._findWidgetByID(c)!==null}collapse(){this._isCollapsedByUser=!0,this._sideBar.currentTitle=null,this._refreshVisibility()}addWidget(c,d){var u,h,m,_;c.parent=null,c.hide();const b={widget:c,rank:d},g=this._findInsertIndex(b);Y.insert(this._items,g,b),this._stackedPanel.insertWidget(g,c);const p=this._sideBar.insertTab(g,c.title);p.dataset={...p.dataset,id:c.id},p.icon instanceof Bt?p.icon=p.icon.bindprops({stylesheet:"sideBar"}):typeof p.icon=="string"&&p.icon!=""?p.iconClass=xt(p.iconClass,"jp-Icon","jp-Icon-20"):!p.icon&&!p.label&&(p.icon=cc.bindprops({stylesheet:"sideBar"})),(h=(u=c.content)===null||u===void 0?void 0:u.expansionToggled)===null||h===void 0||h.connect(this._onExpansionToggle,this),(_=(m=c.content)===null||m===void 0?void 0:m.handleMoved)===null||_===void 0||_.connect(this._onHandleMoved,this),this._refreshVisibility()}dehydrate(){const c=this._position==="side"?this._sideBar.currentTitle===null:this._isCollapsedByUser,d=Array.from(this._stackedPanel.widgets),u=d[this._sideBar.currentIndex],h={};return this._stackedPanel.widgets.forEach(m=>{m.id&&m.content instanceof Pe&&(h[m.id]={sizes:m.content.relativeSizes(),expansionStates:m.content.widgets.map(_=>!_.isHidden)})}),{collapsed:c,currentWidget:u,visible:!this._isHiddenByUser,widgets:d,widgetStates:h}}rehydrate(c){if(Array.isArray(c.widgets)){const d=c.widgets.map(b=>b.id),u=new Set(d),h=this._stackedPanel.widgets.map(b=>b.id);c.widgets.filter(b=>!h.includes(b.id)).forEach(b=>{this.addWidget(b,Xt)});let m=0;this._stackedPanel.widgets.map(b=>u.has(b.id)?d[m++]:b.id).forEach((b,g)=>{const p=this._stackedPanel.widgets.findIndex(w=>w.id===b);if(p>=0&&p!==g){const w=this._stackedPanel.widgets[p];Y.move(this._items,p,g),this._stackedPanel.insertWidget(g,w),this._sideBar.insertTab(g,w.title)}})}c.visible?this.show():this.hide(),c.currentWidget?this.activate(c.currentWidget.id):c.collapsed&&this.collapse(),c.widgetStates&&this._stackedPanel.widgets.forEach(d=>{var u;if(d.id&&d.content instanceof Pe){const h=(u=c.widgetStates[d.id])!==null&&u!==void 0?u:{};d.content.widgets.forEach((m,_)=>{var b;const g=((b=h.expansionStates)!==null&&b!==void 0?b:[])[_];typeof g=="boolean"&&d.content instanceof Un&&(g?d.content.expand(_):d.content.collapse(_))}),h.sizes&&d.content.setRelativeSizes(h.sizes)}})}hide(){this._isHiddenByUser=!0,this._refreshVisibility()}show(){this._isHiddenByUser=!1,this._isCollapsedByUser=!1,this._refreshVisibility()}_findInsertIndex(c){return Y.upperBound(this._items,c,s.itemCmp)}_findWidgetIndex(c){return Y.findFirstIndex(this._items,d=>d.widget===c)}_findWidgetByTitle(c){const d=je(this._items,u=>u.widget.title===c);return d?d.widget:null}_findWidgetByID(c){const d=je(this._items,u=>u.widget.id===c);return d?d.widget:null}_refreshVisibility(){this._position==="side"?this._stackedPanel.setHidden(this._sideBar.currentTitle===null):this._stackedPanel.setHidden(this._items.length===0),this._sideBar.setHidden(this._isHiddenByUser||this._sideBar.titles.length===0),this._position==="side"?this._area.setHidden(this._stackedPanel.isHidden):this._area.setHidden(this._isCollapsedByUser||this._sideBar.titles.length===0),this._updated.emit()}_onCurrentChanged(c,d){const u=d.previousTitle?this._findWidgetByTitle(d.previousTitle):null,h=d.currentTitle?this._findWidgetByTitle(d.currentTitle):null;u&&u.hide(),h&&h.show(),this._lastCurrent=h||u,this._refreshVisibility()}_onTabActivateRequested(c,d){d.title.owner.activate()}_onTabCloseRequested(c,d){d.title.owner.close()}_onWidgetRemoved(c,d){d===this._lastCurrent&&(this._lastCurrent=null),Y.removeAt(this._items,this._findWidgetIndex(d)),this._sideBar.removeTab(d.title),this._refreshVisibility()}}s.SideBarHandler=i;class r extends X{constructor(c){super(),this.addClass("jp-skiplink"),this.id="jp-skiplink",this._shell=c,this._createSkipLink("Skip to main panel","main")}handleEvent(c){var d,u;c.type==="click"&&c.target instanceof HTMLElement&&this._shell.activateArea((u=(d=c.target)===null||d===void 0?void 0:d.dataset)===null||u===void 0?void 0:u.targetarea)}onAfterAttach(c){super.onAfterAttach(c),this.node.addEventListener("click",this)}onBeforeDetach(c){this.node.removeEventListener("click",this),super.onBeforeDetach(c)}_createSkipLink(c,d){const u=document.createElement("a");u.href="#",u.tabIndex=0,u.text=c,u.className="skip-link",u.dataset.targetarea=d,this.node.appendChild(u)}}s.SkipLinkWidget=r;class o extends X{constructor(c){super(),this._selected=!1;const d=document.createElement("input");d.type="text",this.node.appendChild(d),this._shell=c,this.id="jp-title-panel-title"}onAfterAttach(c){super.onAfterAttach(c),this.inputElement.addEventListener("keyup",this),this.inputElement.addEventListener("click",this),this.inputElement.addEventListener("blur",this)}onBeforeDetach(c){super.onBeforeDetach(c),this.inputElement.removeEventListener("keyup",this),this.inputElement.removeEventListener("click",this),this.inputElement.removeEventListener("blur",this)}handleEvent(c){switch(c.type){case"keyup":this._evtKeyUp(c);break;case"click":this._evtClick(c);break;case"blur":this._selected=!1;break}}async _evtKeyUp(c){if(c.key=="Enter"){const d=this._shell.currentWidget;if(d==null)return;const u=He.titleLabel(d.title),h=this.inputElement,m=h.value;h.blur(),m!==u?d.title.label=m:h.value=u}}_evtClick(c){if(c.button!==0||this._selected)return;const d=this.inputElement;c.preventDefault(),c.stopPropagation(),this._selected=!0;const u=d.value.indexOf(".");u===-1?d.select():d.setSelectionRange(0,u)}get inputElement(){return this.node.children[0]}}s.TitleHandler=o;class a extends Pe{constructor(c={}){super(c),this._updated=new U(this)}get updated(){return this._updated}onUpdateRequest(c){super.onUpdateRequest(c),this._updated.emit()}}s.RestorableSplitPanel=a})(De||(De={}));class my{constructor(e){this._busyCount=0,this._dirtyCount=0,this._busySignal=new U(e),this._dirtySignal=new U(e)}get busySignal(){return this._busySignal}get dirtySignal(){return this._dirtySignal}get isBusy(){return this._busyCount>0}get isDirty(){return this._dirtyCount>0}setDirty(){const e=this.isDirty;return this._dirtyCount++,this.isDirty!==e&&this._dirtySignal.emit(this.isDirty),new Ve(()=>{const t=this.isDirty;this._dirtyCount=Math.max(0,this._dirtyCount-1),this.isDirty!==t&&this._dirtySignal.emit(this.isDirty)})}setBusy(){const e=this.isBusy;return this._busyCount++,this.isBusy!==e&&this._busySignal.emit(this.isBusy),new Ve(()=>{const t=this.isBusy;this._busyCount--,this.isBusy!==t&&this._busySignal.emit(this.isBusy)})}}class $e extends Hs{constructor(e={shell:new Us}){super({...e,shell:e.shell||new Us,serviceManager:e.serviceManager||new Be.ServiceManager({standby:()=>!this._info.isConnected||"when-hidden"})}),this.name=O.PageConfig.getOption("appName")||"JupyterLab",this.namespace=O.PageConfig.getOption("appNamespace")||this.name,this.registerPluginErrors=[],this.status=new my(this),this.version=O.PageConfig.getOption("appVersion")||"unknown",this._allPluginsActivated=new it,this._info=new $e.Info(e),this.restored=this.shell.restored.then(async()=>{const o=[],a=this.activateDeferredPlugins().catch(l=>{console.error(`Error when activating deferred plugins
428
428
  :`,l)});if(o.push(a),this._info.deferred){const l=Promise.all(this._info.deferred.matches.map(c=>this.activatePlugin(c))).catch(c=>{console.error(`Error when activating customized list of deferred plugins:
429
429
  `,c)});o.push(l)}Promise.all(o).then(()=>{this._allPluginsActivated.resolve()}).catch(()=>{})}).catch(()=>{});const t=$e.defaultPaths.urls,n=$e.defaultPaths.directories,i=e.paths&&e.paths.urls||{},r=e.paths&&e.paths.directories||{};if(this._paths={urls:Object.keys(t).reduce((o,a)=>{if(a in i){const l=i[a];o[a]=l}else o[a]=t[a];return o},{}),directories:Object.keys($e.defaultPaths.directories).reduce((o,a)=>{if(a in r){const l=r[a];o[a]=l}else o[a]=n[a];return o},{})},this._info.devMode&&this.shell.addClass("jp-mod-devMode"),this.docRegistry.addModelFactory(new dc),e.mimeExtensions)for(const o of oy(e.mimeExtensions))this.registerPlugin(o)}get info(){return this._info}get paths(){return this._paths}get allPluginsActivated(){return this._allPluginsActivated.promise}registerPluginModule(e){let t=e.default;e.hasOwnProperty("__esModule")||(t=e),Array.isArray(t)||(t=[t]),t.forEach(n=>{try{this.registerPlugin(n)}catch(i){this.registerPluginErrors.push(i)}})}registerPluginModules(e){e.forEach(t=>{this.registerPluginModule(t)})}evtKeydown(e){const t=new it;this.commands.holdKeyBindingExecution(e,t.promise),this.commands.processKeydownEvent(e);const n=e.target;if(!n)return t.resolve(!0);let i=null,r=null;const o=()=>{i&&n.removeEventListener("beforeinput",i),r&&n.removeEventListener("keyup",r)};Promise.race([new Promise(l=>{i=c=>{switch(c.inputType){case"historyUndo":case"historyRedo":{if(c.target instanceof Element&&c.target.closest("[data-jp-undoer]"))return c.preventDefault(),o(),l(!1);break}case"insertLineBreak":{if(c.target instanceof Element&&c.target.closest(".jp-Cell"))return c.preventDefault(),o(),l(!1);break}}return o(),l(!0)},n.addEventListener("beforeinput",i,{once:!0})}),new Promise(l=>{r=c=>{if(c.code===e.code)return o(),l(!1)},n.addEventListener("keyup",r,{once:!0})}),new Promise(l=>{setTimeout(()=>(o(),l(!1)),$s.INPUT_GUARD_TIMEOUT)})]).then(l=>{t.resolve(!l)}).catch(console.warn)}}(function(s){s.IInfo=new Ae("@jupyterlab/application:IInfo","A service providing metadata about the current application, including disabled extensions and whether dev mode is enabled.");class e{constructor({connectionStatus:n,...i}={}){var r,o,a,l,c,d,u;this._connectionStatus=n??new Be.ConnectionStatus,this._availablePlugins=(r=i.availablePlugins)!==null&&r!==void 0?r:s.defaultInfo.availablePlugins,this._devMode=(o=i.devMode)!==null&&o!==void 0?o:s.defaultInfo.devMode,this._deferred=JSON.parse(JSON.stringify((a=i.deferred)!==null&&a!==void 0?a:s.defaultInfo.deferred)),this._disabled=JSON.parse(JSON.stringify((l=i.disabled)!==null&&l!==void 0?l:s.defaultInfo.disabled)),this._filesCached=(c=i.filesCached)!==null&&c!==void 0?c:s.defaultInfo.filesCached,this._mimeExtensions=JSON.parse(JSON.stringify((d=i.mimeExtensions)!==null&&d!==void 0?d:s.defaultInfo.mimeExtensions)),this.isConnected=(u=i.isConnected)!==null&&u!==void 0?u:s.defaultInfo.isConnected}get availablePlugins(){return this._availablePlugins}get devMode(){return this._devMode}get deferred(){return this._deferred}get disabled(){return this._disabled}get filesCached(){return this._filesCached}get isConnected(){return this._connectionStatus.isConnected}set isConnected(n){this._connectionStatus.isConnected=n}get mimeExtensions(){return this._mimeExtensions}}s.Info=e,s.defaultInfo={devMode:O.PageConfig.getOption("devMode").toLowerCase()==="true",deferred:{patterns:[],matches:[]},disabled:{patterns:[],matches:[]},mimeExtensions:[],availablePlugins:[],filesCached:O.PageConfig.getOption("cacheFiles").toLowerCase()==="true",isConnected:!0},s.defaultPaths={urls:{base:O.PageConfig.getOption("baseUrl"),notFound:O.PageConfig.getOption("notFoundUrl"),app:O.PageConfig.getOption("appUrl"),doc:O.PageConfig.getOption("docUrl"),static:O.PageConfig.getOption("staticUrl"),settings:O.PageConfig.getOption("settingsUrl"),themes:O.PageConfig.getOption("themesUrl"),translations:O.PageConfig.getOption("translationsApiUrl"),hubHost:O.PageConfig.getOption("hubHost")||void 0,hubPrefix:O.PageConfig.getOption("hubPrefix")||void 0,hubUser:O.PageConfig.getOption("hubUser")||void 0,hubServerName:O.PageConfig.getOption("hubServerName")||void 0},directories:{appSettings:O.PageConfig.getOption("appSettingsDir"),schemas:O.PageConfig.getOption("schemasDir"),static:O.PageConfig.getOption("staticDir"),templates:O.PageConfig.getOption("templatesDir"),themes:O.PageConfig.getOption("themesDir"),userSettings:O.PageConfig.getOption("userSettingsDir"),serverRoot:O.PageConfig.getOption("serverRoot"),workspaces:O.PageConfig.getOption("workspacesDir")}}})($e||($e={}));var $s;(function(s){s.INPUT_GUARD_TIMEOUT=10})($s||($s={}));const rv=new Ae("@jupyterlab/application:IConnectionLost",`A service for invoking the dialog shown
430
430
  when JupyterLab has lost its connection to the server. Use this if, for some reason,
431
431
  you want to bring up the "connection lost" dialog under new circumstances.`),ov=new Ae("@jupyterlab/application:ILabStatus",`A service for interacting with the application busy/dirty
432
432
  status. Use this if you want to set the application "busy" favicon, or to set
433
- the application "dirty" status, which asks the user for confirmation before leaving the application page.`),py=new Ae("@jupyterlab/application:IRouter","The URL router used by the application. Use this to add custom URL-routing for your extension (e.g., to invoke a command if the user navigates to a sub-path)."),pa=()=>Array.from(new Set([O.PageConfig.getOption("appUrl")||"/lab",O.PageConfig.getOption("docUrl")||"/doc","/lab","/doc"].map(s=>String(s||"").trim()).filter(s=>s.startsWith("/")).map(s=>s.length>1&&s.endsWith("/")?s.slice(0,-1):s))),_y=(s,e=pa())=>typeof s!="string"||s===""||s.startsWith("/api/jupyter-server/lab/")?!0:e.some(t=>s===t||s.startsWith(`${t}/`));class Zn{_jupyterLab;_shell;_plugins;_ready;_readyResolve;normalizeJupyterModule(e){if(e&&typeof e=="object"&&typeof e.hasOwnProperty!="function"){const t={...e};return"default"in t&&!("__esModule"in t)&&(t.__esModule=!0),t}return e}normalizeKernelSpecResources(e,t){if(!e?.kernelspecs)return;const n=t.serverSettings.baseUrl;n&&Object.values(e.kernelspecs).forEach(i=>{i?.resources&&Object.entries(i.resources).forEach(([r,o])=>{typeof o!="string"||!o||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(o)||(i.resources[r]=new URL(o,n).toString())})})}constructor(e,t){if(t){this._jupyterLab=t,this._ready=new Promise((n,i)=>{this._readyResolve=n}),this._plugins=this._jupyterLab.pluginRegistry._plugins,this._readyResolve();return}this._ready=new Promise((n,i)=>{this._readyResolve=n}),this.load(e)}async waitForShellAttachment(e=1e4){const t=this._jupyterLab.shell;t.isAttached||await new Promise(n=>{const i=Date.now()+e,r=()=>{if(t.isAttached){n();return}if(Date.now()>=i){n();return}window.requestAnimationFrame(r)};r()})}async load(e){const{disabledPlugins:t=[],headless:n,hostId:i,plugins:r=[],mimeRenderers:o=[],nosplash:a,pluginPromises:l=[],mimeRendererPromises:c=[],devMode:d,serviceManager:u}=e,h=await Promise.all(c);o.push(...h);const m=o.map(A=>this.normalizeJupyterModule(A)),_=new URL(".",window.location.href).toString(),b={urls:{...$e.defaultPaths.urls,base:_},directories:{...$e.defaultPaths.directories}};this._shell=new Us,this._jupyterLab=new $e({shell:this._shell,mimeExtensions:m,devMode:d,serviceManager:u,paths:b,disabled:{matches:[],patterns:[]},deferred:{patterns:[],matches:[]}}),this.normalizeKernelSpecResources(u.kernelspecs.specs,u),u.kernelspecs.specsChanged.connect((A,I)=>{this.normalizeKernelSpecResources(I,u)}),this._plugins=this._jupyterLab.pluginRegistry._plugins;const g=await Promise.all(l);t.push("@jupyterlab/notebook-extension:language-server","@jupyterlab/notebook-extension:update-raw-mimetype","@jupyterlab/fileeditor-extension:language-server","@jupyterlab/apputils-extension:sessionDialogs","@jupyterlab/apputils-extension:resolver");const p={id:"@datalayer/jupyter-react:window-resolver",description:"No-op IWindowResolver for embedded JupyterLab.",autoStart:!0,provides:_h,activate:()=>({name:O.PageConfig.getOption("workspace")||O.PageConfig.defaultWorkspace})},w={id:"@datalayer/jupyter-react:theme-load-guard",description:"Prevent ThemeManager loadCSS deadlocks in embedded mode.",autoStart:!0,requires:[gh],activate:(A,I)=>{const P=I;if(P.__datalayerThemeLoadGuardPatched)return;const M="[jupyter-react] canceled detached theme load",j=typeof P.loadCSS=="function"?P.loadCSS.bind(P):null,H=typeof P._onError=="function"?P._onError.bind(P):null;j&&(H&&(P._onError=$=>{String($??"").includes(M)||H($)}),P.loadCSS=$=>{const L=j($),D=P._links?.[P._links.length-1];if(!D)return L;const z=new Promise((K,ue)=>{let De=0;const k=()=>{window.clearInterval(Z),window.clearTimeout(G)},B=()=>{k()},te=()=>{k(),ue(new Error(`${M}: ${D.href}`))},Z=window.setInterval(()=>{if(D.isConnected){De=0;return}De||(De=Date.now()),((P._links||[]).some(J=>J!==D&&J.href===D.href&&J.isConnected)||Date.now()-De>500)&&te()},50),G=window.setTimeout(B,15e3);L.finally(B)});return Promise.race([L,z])},P.__datalayerThemeLoadGuardPatched=!0)}},v={id:"@datalayer/jupyter-react:notebook-restore-guard",description:"Disable tracker restoration replay in embedded JupyterLab mode.",autoStart:!0,requires:[ma],activate:(A,I)=>{const P=I;P.__datalayerNotebookRestoreGuardPatched||!(typeof P.restore=="function"&&P.restore.bind(P))||(P.restore=(...j)=>Promise.resolve(),P.__datalayerNotebookRestoreGuardPatched=!0)}},y=pa(),C={id:"@datalayer/jupyter-react:router-navigate-guard",description:"Keep embedded JupyterLab out of the host page history.",autoStart:!0,requires:[py],activate:(A,I)=>{const P=I;if(P.__datalayerRouterNavigateGuardPatched)return;const M=typeof P.navigate=="function"?P.navigate.bind(P):null;M&&(P.navigate=(j,H)=>{if(!_y(j,y))return M(j,H)},P.__datalayerRouterNavigateGuardPatched=!0)}};r.push(p),r.push(w),r.push(v),r.push(C),a&&t.push("@jupyterlab/apputils-extension:splash"),n&&t.push("@jupyterlab/apputils-extension:notification");const E=new Set(t);g.forEach(A=>{Array.isArray(A.default)?A.default.forEach(I=>{E.has(I.id)||r.push(I)}):E.has(A.default.id)||r.push(A)});const x=r.map(A=>this.normalizeJupyterModule(A));this._jupyterLab.registerPluginModules(x);const S=this._jupyterLab.start({hostID:i,bubblingKeydown:!0,startPlugins:[],ignorePlugins:[]});Promise.all([S,this._jupyterLab.started]).then(async()=>{await this.waitForShellAttachment(),await new Promise(A=>window.requestAnimationFrame(()=>A())),this._plugins=this._jupyterLab.pluginRegistry._plugins,this._readyResolve()})}static create(e){return new Zn(void 0,e)}get jupyterLab(){return this._jupyterLab}get shell(){return this._jupyterLab.shell}get docRegistry(){return this._jupyterLab.docRegistry}get commands(){return this._jupyterLab.commands}get serviceManager(){return this._jupyterLab.serviceManager}get mimeExtensions(){return this._jupyterLab.info.mimeExtensions}get info(){return this._jupyterLab.info}get path(){return this._jupyterLab.paths}get plugins(){return this._plugins}get ready(){return this._ready}get focusTracker(){return this.shell._tracker}plugin(e){return(this._plugins||this._jupyterLab?.pluginRegistry?._plugins)?.get(e)}service(e){return(this._plugins||this._jupyterLab?.pluginRegistry?._plugins)?.get(e)?.service}async notebook(e){await this.commands.execute("apputils:reset");const t=await this.commands.execute("docmanager:open",{path:e,factory:"Notebook",kernel:{name:"python3"}}),n=new we;return n.addClass("dla-Jupyter-Notebook"),n.spacing=0,n.addWidget(t),this.focusTracker.add(t),n}}const gy=({theme:s="light"})=>(R.useEffect(()=>{},[s]),f.jsxs(f.Fragment,{children:[f.jsx("div",{id:"dla-JupyterLabAppCss-id"}),f.jsx("style",{children:`#jupyterlab-splash {
433
+ the application "dirty" status, which asks the user for confirmation before leaving the application page.`),py=new Ae("@jupyterlab/application:IRouter","The URL router used by the application. Use this to add custom URL-routing for your extension (e.g., to invoke a command if the user navigates to a sub-path)."),pa=()=>Array.from(new Set([O.PageConfig.getOption("appUrl")||"/lab",O.PageConfig.getOption("docUrl")||"/doc","/lab","/doc"].map(s=>String(s||"").trim()).filter(s=>s.startsWith("/")).map(s=>s.length>1&&s.endsWith("/")?s.slice(0,-1):s))),_y=(s,e=pa())=>typeof s!="string"||s===""||s.startsWith("/api/jupyter-server/lab/")?!0:e.some(t=>s===t||s.startsWith(`${t}/`));class Zn{_jupyterLab;_shell;_plugins;_ready;_readyResolve;normalizeJupyterModule(e){if(e&&typeof e=="object"&&typeof e.hasOwnProperty!="function"){const t={...e};return"default"in t&&!("__esModule"in t)&&(t.__esModule=!0),t}return e}normalizeKernelSpecResources(e,t){if(!e?.kernelspecs)return;const n=t.serverSettings.baseUrl;n&&Object.values(e.kernelspecs).forEach(i=>{i?.resources&&Object.entries(i.resources).forEach(([r,o])=>{typeof o!="string"||!o||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(o)||(i.resources[r]=new URL(o,n).toString())})})}constructor(e,t){if(t){this._jupyterLab=t,this._ready=new Promise((n,i)=>{this._readyResolve=n}),this._plugins=this._jupyterLab.pluginRegistry._plugins,this._readyResolve();return}this._ready=new Promise((n,i)=>{this._readyResolve=n}),this.load(e)}async waitForShellAttachment(e=1e4){const t=this._jupyterLab.shell;t.isAttached||await new Promise(n=>{const i=Date.now()+e,r=()=>{if(t.isAttached){n();return}if(Date.now()>=i){n();return}window.requestAnimationFrame(r)};r()})}async load(e){const{disabledPlugins:t=[],headless:n,hostId:i,plugins:r=[],mimeRenderers:o=[],nosplash:a,pluginPromises:l=[],mimeRendererPromises:c=[],devMode:d,serviceManager:u}=e,h=await Promise.all(c);o.push(...h);const m=o.map(A=>this.normalizeJupyterModule(A)),_=new URL(".",window.location.href).toString(),b={urls:{...$e.defaultPaths.urls,base:_},directories:{...$e.defaultPaths.directories}};this._shell=new Us,this._jupyterLab=new $e({shell:this._shell,mimeExtensions:m,devMode:d,serviceManager:u,paths:b,disabled:{matches:[],patterns:[]},deferred:{patterns:[],matches:[]}}),this.normalizeKernelSpecResources(u.kernelspecs.specs,u),u.kernelspecs.specsChanged.connect((A,I)=>{this.normalizeKernelSpecResources(I,u)}),this._plugins=this._jupyterLab.pluginRegistry._plugins;const g=await Promise.all(l);t.push("@jupyterlab/notebook-extension:language-server","@jupyterlab/notebook-extension:update-raw-mimetype","@jupyterlab/fileeditor-extension:language-server","@jupyterlab/apputils-extension:sessionDialogs","@jupyterlab/apputils-extension:resolver");const p={id:"@datalayer/jupyter-react:window-resolver",description:"No-op IWindowResolver for embedded JupyterLab.",autoStart:!0,provides:_h,activate:()=>({name:O.PageConfig.getOption("workspace")||O.PageConfig.defaultWorkspace})},w={id:"@datalayer/jupyter-react:theme-load-guard",description:"Prevent ThemeManager loadCSS deadlocks in embedded mode.",autoStart:!0,requires:[gh],activate:(A,I)=>{const P=I;if(P.__datalayerThemeLoadGuardPatched)return;const D="[jupyter-react] canceled detached theme load",j=typeof P.loadCSS=="function"?P.loadCSS.bind(P):null,H=typeof P._onError=="function"?P._onError.bind(P):null;j&&(H&&(P._onError=$=>{String($??"").includes(D)||H($)}),P.loadCSS=$=>{const L=j($),M=P._links?.[P._links.length-1];if(!M)return L;const z=new Promise((K,ue)=>{let Me=0;const k=()=>{window.clearInterval(Z),window.clearTimeout(G)},B=()=>{k()},te=()=>{k(),ue(new Error(`${D}: ${M.href}`))},Z=window.setInterval(()=>{if(M.isConnected){Me=0;return}Me||(Me=Date.now()),((P._links||[]).some(J=>J!==M&&J.href===M.href&&J.isConnected)||Date.now()-Me>500)&&te()},50),G=window.setTimeout(B,15e3);L.finally(B)});return Promise.race([L,z])},P.__datalayerThemeLoadGuardPatched=!0)}},v={id:"@datalayer/jupyter-react:notebook-restore-guard",description:"Disable tracker restoration replay in embedded JupyterLab mode.",autoStart:!0,requires:[ma],activate:(A,I)=>{const P=I;P.__datalayerNotebookRestoreGuardPatched||!(typeof P.restore=="function"&&P.restore.bind(P))||(P.restore=(...j)=>Promise.resolve(),P.__datalayerNotebookRestoreGuardPatched=!0)}},y=pa(),C={id:"@datalayer/jupyter-react:router-navigate-guard",description:"Keep embedded JupyterLab out of the host page history.",autoStart:!0,requires:[py],activate:(A,I)=>{const P=I;if(P.__datalayerRouterNavigateGuardPatched)return;const D=typeof P.navigate=="function"?P.navigate.bind(P):null;D&&(P.navigate=(j,H)=>{if(!_y(j,y))return D(j,H)},P.__datalayerRouterNavigateGuardPatched=!0)}};r.push(p),r.push(w),r.push(v),r.push(C),a&&t.push("@jupyterlab/apputils-extension:splash"),n&&t.push("@jupyterlab/apputils-extension:notification");const E=new Set(t);g.forEach(A=>{Array.isArray(A.default)?A.default.forEach(I=>{E.has(I.id)||r.push(I)}):E.has(A.default.id)||r.push(A)});const x=r.map(A=>this.normalizeJupyterModule(A));this._jupyterLab.registerPluginModules(x);const S=this._jupyterLab.start({hostID:i,bubblingKeydown:!0,startPlugins:[],ignorePlugins:[]});Promise.all([S,this._jupyterLab.started]).then(async()=>{await this.waitForShellAttachment(),await new Promise(A=>window.requestAnimationFrame(()=>A())),this._plugins=this._jupyterLab.pluginRegistry._plugins,this._readyResolve()})}static create(e){return new Zn(void 0,e)}get jupyterLab(){return this._jupyterLab}get shell(){return this._jupyterLab.shell}get docRegistry(){return this._jupyterLab.docRegistry}get commands(){return this._jupyterLab.commands}get serviceManager(){return this._jupyterLab.serviceManager}get mimeExtensions(){return this._jupyterLab.info.mimeExtensions}get info(){return this._jupyterLab.info}get path(){return this._jupyterLab.paths}get plugins(){return this._plugins}get ready(){return this._ready}get focusTracker(){return this.shell._tracker}plugin(e){return(this._plugins||this._jupyterLab?.pluginRegistry?._plugins)?.get(e)}service(e){return(this._plugins||this._jupyterLab?.pluginRegistry?._plugins)?.get(e)?.service}async notebook(e){await this.commands.execute("apputils:reset");const t=await this.commands.execute("docmanager:open",{path:e,factory:"Notebook",kernel:{name:"python3"}}),n=new we;return n.addClass("dla-Jupyter-Notebook"),n.spacing=0,n.addWidget(t),this.focusTracker.add(t),n}}const gy=({theme:s="light"})=>(R.useEffect(()=>{},[s]),f.jsxs(f.Fragment,{children:[f.jsx("div",{id:"dla-JupyterLabAppCss-id"}),f.jsx("style",{children:`#jupyterlab-splash {
434
434
  top: 0;
435
435
  left: 0;
436
- }`})]}));globalThis.__webpack_public_path__=O.PageConfig.getOption("fullStaticUrl")+"/";window.__webpack_public_path__=O.PageConfig.getOption("fullStaticUrl")+"/";const yy=s=>{const{PluginType:e,devMode:t=!1,disabledPlugins:n=[],headless:i=!1,height:r="100vh",hostId:o="app-example-id",mimeRendererPromises:a,mimeRenderers:l=[],nosplash:c=!1,onJupyterLab:d=H=>{},onPlugin:u,pluginId:h,pluginPromises:m,plugins:_=[],position:b="relative",serverless:g=!1,serviceManager:p,startDefaultKernel:w=!1,theme:v="light",width:y="100%",...C}=s,{serviceManager:E}=Je({serverless:g,serviceManager:p,startDefaultKernel:w}),x=Xr(H=>H.setJupyterLabAdapter),S=R.useMemo(()=>a??Ws().mimeExtensionPromises,[a]),A=R.useMemo(()=>m??Ws().extensionPromises,[m]),I=R.useRef(null),P=R.useRef(null),[M,j]=R.useState();return R.useEffect(()=>{if(!P.current&&I&&E){const H=new Zn({PluginType:e,devMode:t,disabledPlugins:n,headless:i,height:r,hostId:o,mimeRendererPromises:S,mimeRenderers:l,nosplash:c,onJupyterLab:d,onPlugin:u,pluginId:h,pluginPromises:A,plugins:_,position:b,serverless:g,serviceManager:E,startDefaultKernel:w,theme:v,width:y,...C});H.ready.then(()=>{if(x(H),d(H),h&&e&&u){const $=H.service(h);u($)}}),P.current=H,j(H)}},[o,I,E,v]),f.jsx(f.Fragment,{children:f.jsxs(ee,{sx:{"& .jp-LabShell":{position:b,height:r,width:y,display:i?"none":"inherit"}},children:[f.jsx(gy,{theme:v}),f.jsx("div",{ref:I,id:o})]})})},by=R.memo(yy),Ei=s=>{const[e,t]=R.useState(s.count),n=R.useRef(void 0),i=()=>t(r=>r-1);return R.useEffect(()=>{t(s.count)},[s.count]),R.useEffect(()=>(n.current=setInterval(i,1e3),()=>clearInterval(n.current)),[]),f.jsxs(f.Fragment,{children:["[",e,"]"]})},vy="jp-InputPrompt";class wy extends ni{_executionCount=null;state={count:100};constructor(){super(),this.addClass(vy)}render(){return f.jsx(Ei,{count:this.state.count})}get executionCount(){return this._executionCount}set executionCount(e){this._executionCount=e,e===null?this.state={count:0}:e==="*"?this.state={count:0}:(this.state={count:Number(e)},this.update())}}const Cy="jp-OutputPrompt";class Ey extends ni{_executionCount=null;state={count:100};constructor(){super(),this.addClass(Cy)}render(){return f.jsx(Ei,{count:this.state.count})}get executionCount(){return this._executionCount}set executionCount(e){this._executionCount=e,e===null?this.state={count:0}:(this.state={count:Number(e)},this.update())}}function xy(s){const{commands:e}=s;return f.jsx(ee,{className:so,sx:{"& p":{marginBottom:"0 !important"}},children:f.jsx(si,{trailingVisual:uc,size:"small",variant:"invisible",onClick:t=>{t.preventDefault(),e.execute(Zr.run).catch(n=>{console.error("Failed to run cell.",n)})},children:"Run"})})}const Ty="text/x-ipython",_a="application/sql",ga=s=>{const e=s.model?.getMetadata("datalayer");return e?e.sql===!0:!1};class Sy extends ai{constructor(e){super(e)}}class Py extends hc.ContentFactory{_updateSQLEditor=e=>{ga(e)&&(e.editor.model.mimeType=_a)};_updateEditor=e=>{e.editor&&(e.editor.model.mimeTypeChanged.connect((t,n)=>{this._updateSQLEditor(e)}),this._updateSQLEditor(e))};createNotebook(e){return super.createNotebook(e)}createCodeCell(e){const t=new Sy(e);return t.inViewport&&this._updateEditor(t),t.displayChanged.connect(()=>{this._updateEditor(t)}),t.inViewportChanged.connect(()=>{this._updateEditor(t)}),t}}class Ay extends Lu{_nbformat;_readonly;constructor(e){super(e),this._nbformat=e.nbformat,this._readonly=e.readonly}get disableDocumentWideUndoRedo(){return super.disableDocumentWideUndoRedo}set disableDocumentWideUndoRedo(e){super.disableDocumentWideUndoRedo=e}createNew(e){if(this._nbformat){this._nbformat.cells.forEach(n=>{n.metadata.editable=!this._readonly});const t=new Ou;return t.fromJSON(this._nbformat),t}else{const t=super.createNew(e);return t.readOnly=this._readonly,t}}}class Ry extends Xu{el;constructor(e){super(),this.el=e}async loadClass(e,t,n){return new Promise((i,r)=>{if(t==="@jupyter-widgets/controls")i(Zu);else if(t==="@jupyter-widgets/base")i(Qu);else{const o=function(a){if(a.requireModules&&a.requireModules[0])console.log(`Falling back to jsDelivr for ${t}@${n}`),window.require([`https://cdn.jsdelivr.net/npm/${t}@${n}/dist/index.js`],i,r);else throw a};window.require([`${t}.js`],i,o)}}).then(i=>i[e]?i[e]:Promise.reject(`Class ${e} not found in module ${t}@${n}`))}async display_view(e){return Promise.resolve(e).then(t=>(X.attach(t.luminoWidget,this.el),t))}_get_comm_info(){return Promise.resolve({})}_create_comm(){return Promise.reject("no comms available")}}const Iy=s=>{const{view:e,state:t}=s,n=R.useRef(null),i=R.useRef(null);return R.useEffect(()=>{const r=n.current,o=e?.model_id;if(!r||!o)return;const a=String(o);if(i.current===a)return;i.current=a,r.replaceChildren();let l=!1;const c=new Ry(r);return c.set_state(t).then(d=>c.create_view(d.find(u=>u.model_id===o))).then(d=>{l||c.display_view(d)}).catch(d=>{console.error("[jupyter-react] could not render the widget",d)}),()=>{l=!0}},[e,t]),f.jsx("div",{ref:n})},ya=s=>{const{view:e,state:t}=s;return f.jsx(f.Fragment,{children:f.jsx(Iy,{view:e,state:t})})};class Ly{settingsPanel;constructor(){this.settingsPanel=new zn,this.settingsPanel.id="dla-jlab-settings",this.settingsPanel.spacing=0}get panel(){return this.settingsPanel}}const Oy=()=>{const s=new Ly;return f.jsx(f.Fragment,{children:f.jsx(Vt,{children:s.panel})})};var Ks;(function(s){s.defaultOptions={theme:"inherit",fontFamily:'Menlo, Consolas, "DejaVu Sans Mono", monospace',fontSize:13,lineHeight:1,scrollback:1e3,shutdownOnClose:!1,closeOnExit:!0,cursorBlink:!0,initialCommand:"",screenReaderMode:!1,pasteWithCtrlV:!0,autoFit:!0,macOptionIsMeta:!1}})(Ks||(Ks={}));const qs={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};for(const s in qs)Object.freeze(qs[s]);const Ke=Object.freeze(qs),ba=Object.create(null);for(const s in Ke)Object.hasOwn(Ke,s)&&(ba[Ke[s]]=s);const pe={to:{},get:{}};pe.get=function(s){const e=s.slice(0,3).toLowerCase();let t,n;switch(e){case"hsl":{t=pe.get.hsl(s),n="hsl";break}case"hwb":{t=pe.get.hwb(s),n="hwb";break}default:{t=pe.get.rgb(s),n="rgb";break}}return t?{model:n,value:t}:null};pe.get.rgb=function(s){if(!s)return null;const e=/^#([a-f\d]{3,4})$/i,t=/^#([a-f\d]{6})([a-f\d]{2})?$/i,n=/^rgba?\(\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)\s*(?:[\s,|/]\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(%?)\s*)?\)$/i,i=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/i,r=/^(\w+)$/;let o=[0,0,0,1],a,l,c;if(a=s.match(t)){for(c=a[2],a=a[1],l=0;l<3;l++){const d=l*2;o[l]=Number.parseInt(a.slice(d,d+2),16)}c&&(o[3]=Number.parseInt(c,16)/255)}else if(a=s.match(e)){for(a=a[1],c=a[3],l=0;l<3;l++)o[l]=Number.parseInt(a[l]+a[l],16);c&&(o[3]=Number.parseInt(c+c,16)/255)}else if(a=s.match(n)){for(l=0;l<3;l++)o[l]=Number.parseFloat(a[l+1]);a[4]&&(o[3]=a[5]?Number.parseFloat(a[4])*.01:Number.parseFloat(a[4]))}else if(a=s.match(i)){for(l=0;l<3;l++)o[l]=Math.round(Number.parseFloat(a[l+1])*2.55);a[4]&&(o[3]=a[5]?Number.parseFloat(a[4])*.01:Number.parseFloat(a[4]))}else return(a=s.toLowerCase().match(r))?a[1]==="transparent"?[0,0,0,0]:Object.hasOwn(Ke,a[1])?(o=Ke[a[1]].slice(),o[3]=1,o):null:null;for(l=0;l<3;l++)o[l]=mt(o[l],0,255);return o[3]=mt(o[3],0,1),o};pe.get.hsl=function(s){if(!s)return null;const e=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i,t=s.match(e);if(t){const n=Number.parseFloat(t[4]),i=(Number.parseFloat(t[1])%360+360)%360,r=mt(Number.parseFloat(t[2]),0,100),o=mt(Number.parseFloat(t[3]),0,100),a=mt(Number.isNaN(n)?1:n,0,1);return[i,r,o,a]}return null};pe.get.hwb=function(s){if(!s)return null;const e=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i,t=s.match(e);if(t){const n=Number.parseFloat(t[4]),i=(Number.parseFloat(t[1])%360+360)%360,r=mt(Number.parseFloat(t[2]),0,100),o=mt(Number.parseFloat(t[3]),0,100),a=mt(Number.isNaN(n)?1:n,0,1);return[i,r,o,a]}return null};pe.to.hex=function(...s){return"#"+Cn(s[0])+Cn(s[1])+Cn(s[2])+(s[3]<1?Cn(Math.round(s[3]*255)):"")};pe.to.rgb=function(...s){return s.length<4||s[3]===1?"rgb("+Math.round(s[0])+", "+Math.round(s[1])+", "+Math.round(s[2])+")":"rgba("+Math.round(s[0])+", "+Math.round(s[1])+", "+Math.round(s[2])+", "+s[3]+")"};pe.to.rgb.percent=function(...s){const e=Math.round(s[0]/255*100),t=Math.round(s[1]/255*100),n=Math.round(s[2]/255*100);return s.length<4||s[3]===1?"rgb("+e+"%, "+t+"%, "+n+"%)":"rgba("+e+"%, "+t+"%, "+n+"%, "+s[3]+")"};pe.to.hsl=function(...s){return s.length<4||s[3]===1?"hsl("+s[0]+", "+s[1]+"%, "+s[2]+"%)":"hsla("+s[0]+", "+s[1]+"%, "+s[2]+"%, "+s[3]+")"};pe.to.hwb=function(...s){let e="";return s.length>=4&&s[3]!==1&&(e=", "+s[3]),"hwb("+s[0]+", "+s[1]+"%, "+s[2]+"%"+e+")"};pe.to.keyword=function(...s){return ba[s.slice(0,3)]};function mt(s,e,t){return Math.min(Math.max(e,s),t)}function Cn(s){const e=Math.round(s).toString(16).toUpperCase();return e.length<2?"0"+e:e}const va={};for(const s of Object.keys(Ke))va[Ke[s]]=s;const F={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},st=(6/29)**3;function Mt(s){const e=s>.0031308?1.055*s**.4166666666666667-.055:s*12.92;return Math.min(Math.max(0,e),1)}function Nt(s){return s>.04045?((s+.055)/1.055)**2.4:s/12.92}for(const s of Object.keys(F)){if(!("channels"in F[s]))throw new Error("missing channels property: "+s);if(!("labels"in F[s]))throw new Error("missing channel labels property: "+s);if(F[s].labels.length!==F[s].channels)throw new Error("channel and label counts mismatch: "+s);const{channels:e,labels:t}=F[s];delete F[s].channels,delete F[s].labels,Object.defineProperty(F[s],"channels",{value:e}),Object.defineProperty(F[s],"labels",{value:t})}F.rgb.hsl=function(s){const e=s[0]/255,t=s[1]/255,n=s[2]/255,i=Math.min(e,t,n),r=Math.max(e,t,n),o=r-i;let a,l;switch(r){case i:{a=0;break}case e:{a=(t-n)/o;break}case t:{a=2+(n-e)/o;break}case n:{a=4+(e-t)/o;break}}a=Math.min(a*60,360),a<0&&(a+=360);const c=(i+r)/2;return r===i?l=0:c<=.5?l=o/(r+i):l=o/(2-r-i),[a,l*100,c*100]};F.rgb.hsv=function(s){let e,t,n,i,r;const o=s[0]/255,a=s[1]/255,l=s[2]/255,c=Math.max(o,a,l),d=c-Math.min(o,a,l),u=function(h){return(c-h)/6/d+1/2};if(d===0)i=0,r=0;else{switch(r=d/c,e=u(o),t=u(a),n=u(l),c){case o:{i=n-t;break}case a:{i=1/3+e-n;break}case l:{i=2/3+t-e;break}}i<0?i+=1:i>1&&(i-=1)}return[i*360,r*100,c*100]};F.rgb.hwb=function(s){const e=s[0],t=s[1];let n=s[2];const i=F.rgb.hsl(s)[0],r=1/255*Math.min(e,Math.min(t,n));return n=1-1/255*Math.max(e,Math.max(t,n)),[i,r*100,n*100]};F.rgb.oklab=function(s){const e=Nt(s[0]/255),t=Nt(s[1]/255),n=Nt(s[2]/255),i=Math.cbrt(.4122214708*e+.5363325363*t+.0514459929*n),r=Math.cbrt(.2119034982*e+.6806995451*t+.1073969566*n),o=Math.cbrt(.0883024619*e+.2817188376*t+.6299787005*n),a=.2104542553*i+.793617785*r-.0040720468*o,l=1.9779984951*i-2.428592205*r+.4505937099*o,c=.0259040371*i+.7827717662*r-.808675766*o;return[a*100,l*100,c*100]};F.rgb.cmyk=function(s){const e=s[0]/255,t=s[1]/255,n=s[2]/255,i=Math.min(1-e,1-t,1-n),r=(1-e-i)/(1-i)||0,o=(1-t-i)/(1-i)||0,a=(1-n-i)/(1-i)||0;return[r*100,o*100,a*100,i*100]};function ky(s,e){return(s[0]-e[0])**2+(s[1]-e[1])**2+(s[2]-e[2])**2}F.rgb.keyword=function(s){const e=va[s];if(e)return e;let t=Number.POSITIVE_INFINITY,n;for(const i of Object.keys(Ke)){const r=Ke[i],o=ky(s,r);o<t&&(t=o,n=i)}return n};F.keyword.rgb=function(s){return[...Ke[s]]};F.rgb.xyz=function(s){const e=Nt(s[0]/255),t=Nt(s[1]/255),n=Nt(s[2]/255),i=e*.4124564+t*.3575761+n*.1804375,r=e*.2126729+t*.7151522+n*.072175,o=e*.0193339+t*.119192+n*.9503041;return[i*100,r*100,o*100]};F.rgb.lab=function(s){const e=F.rgb.xyz(s);let t=e[0],n=e[1],i=e[2];t/=95.047,n/=100,i/=108.883,t=t>st?t**(1/3):7.787*t+16/116,n=n>st?n**(1/3):7.787*n+16/116,i=i>st?i**(1/3):7.787*i+16/116;const r=116*n-16,o=500*(t-n),a=200*(n-i);return[r,o,a]};F.hsl.rgb=function(s){const e=s[0]/360,t=s[1]/100,n=s[2]/100;let i,r;if(t===0)return r=n*255,[r,r,r];const o=n<.5?n*(1+t):n+t-n*t,a=2*n-o,l=[0,0,0];for(let c=0;c<3;c++)i=e+1/3*-(c-1),i<0&&i++,i>1&&i--,6*i<1?r=a+(o-a)*6*i:2*i<1?r=o:3*i<2?r=a+(o-a)*(2/3-i)*6:r=a,l[c]=r*255;return l};F.hsl.hsv=function(s){const e=s[0];let t=s[1]/100,n=s[2]/100,i=t;const r=Math.max(n,.01);n*=2,t*=n<=1?n:2-n,i*=r<=1?r:2-r;const o=(n+t)/2,a=n===0?2*i/(r+i):2*t/(n+t);return[e,a*100,o*100]};F.hsv.rgb=function(s){const e=s[0]/60,t=s[1]/100;let n=s[2]/100;const i=Math.floor(e)%6,r=e-Math.floor(e),o=255*n*(1-t),a=255*n*(1-t*r),l=255*n*(1-t*(1-r));switch(n*=255,i){case 0:return[n,l,o];case 1:return[a,n,o];case 2:return[o,n,l];case 3:return[o,a,n];case 4:return[l,o,n];case 5:return[n,o,a]}};F.hsv.hsl=function(s){const e=s[0],t=s[1]/100,n=s[2]/100,i=Math.max(n,.01);let r,o;o=(2-t)*n;const a=(2-t)*i;return r=t*i,r/=a<=1?a:2-a,r=r||0,o/=2,[e,r*100,o*100]};F.hwb.rgb=function(s){const e=s[0]/360;let t=s[1]/100,n=s[2]/100;const i=t+n;let r;i>1&&(t/=i,n/=i);const o=Math.floor(6*e),a=1-n;r=6*e-o,(o&1)!==0&&(r=1-r);const l=t+r*(a-t);let c,d,u;switch(o){default:case 6:case 0:{c=a,d=l,u=t;break}case 1:{c=l,d=a,u=t;break}case 2:{c=t,d=a,u=l;break}case 3:{c=t,d=l,u=a;break}case 4:{c=l,d=t,u=a;break}case 5:{c=a,d=t,u=l;break}}return[c*255,d*255,u*255]};F.cmyk.rgb=function(s){const e=s[0]/100,t=s[1]/100,n=s[2]/100,i=s[3]/100,r=1-Math.min(1,e*(1-i)+i),o=1-Math.min(1,t*(1-i)+i),a=1-Math.min(1,n*(1-i)+i);return[r*255,o*255,a*255]};F.xyz.rgb=function(s){const e=s[0]/100,t=s[1]/100,n=s[2]/100;let i,r,o;return i=e*3.2404542+t*-1.5371385+n*-.4985314,r=e*-.969266+t*1.8760108+n*.041556,o=e*.0556434+t*-.2040259+n*1.0572252,i=Mt(i),r=Mt(r),o=Mt(o),[i*255,r*255,o*255]};F.xyz.lab=function(s){let e=s[0],t=s[1],n=s[2];e/=95.047,t/=100,n/=108.883,e=e>st?e**(1/3):7.787*e+16/116,t=t>st?t**(1/3):7.787*t+16/116,n=n>st?n**(1/3):7.787*n+16/116;const i=116*t-16,r=500*(e-t),o=200*(t-n);return[i,r,o]};F.xyz.oklab=function(s){const e=s[0]/100,t=s[1]/100,n=s[2]/100,i=Math.cbrt(.8189330101*e+.3618667424*t-.1288597137*n),r=Math.cbrt(.0329845436*e+.9293118715*t+.0361456387*n),o=Math.cbrt(.0482003018*e+.2643662691*t+.633851707*n),a=.2104542553*i+.793617785*r-.0040720468*o,l=1.9779984951*i-2.428592205*r+.4505937099*o,c=.0259040371*i+.7827717662*r-.808675766*o;return[a*100,l*100,c*100]};F.oklab.oklch=function(s){return F.lab.lch(s)};F.oklab.xyz=function(s){const e=s[0]/100,t=s[1]/100,n=s[2]/100,i=(.999999998*e+.396337792*t+.215803758*n)**3,r=(1.000000008*e-.105561342*t-.063854175*n)**3,o=(1.000000055*e-.089484182*t-1.291485538*n)**3,a=1.227013851*i-.55779998*r+.281256149*o,l=-.040580178*i+1.11225687*r-.071676679*o,c=-.076381285*i-.421481978*r+1.58616322*o;return[a*100,l*100,c*100]};F.oklab.rgb=function(s){const e=s[0]/100,t=s[1]/100,n=s[2]/100,i=(e+.3963377774*t+.2158037573*n)**3,r=(e-.1055613458*t-.0638541728*n)**3,o=(e-.0894841775*t-1.291485548*n)**3,a=Mt(4.0767416621*i-3.3077115913*r+.2309699292*o),l=Mt(-1.2684380046*i+2.6097574011*r-.3413193965*o),c=Mt(-.0041960863*i-.7034186147*r+1.707614701*o);return[a*255,l*255,c*255]};F.oklch.oklab=function(s){return F.lch.lab(s)};F.lab.xyz=function(s){const e=s[0],t=s[1],n=s[2];let i,r,o;r=(e+16)/116,i=t/500+r,o=r-n/200;const a=r**3,l=i**3,c=o**3;return r=a>st?a:(r-16/116)/7.787,i=l>st?l:(i-16/116)/7.787,o=c>st?c:(o-16/116)/7.787,i*=95.047,r*=100,o*=108.883,[i,r,o]};F.lab.lch=function(s){const e=s[0],t=s[1],n=s[2];let i;i=Math.atan2(n,t)*360/2/Math.PI,i<0&&(i+=360);const o=Math.sqrt(t*t+n*n);return[e,o,i]};F.lch.lab=function(s){const e=s[0],t=s[1],i=s[2]/360*2*Math.PI,r=t*Math.cos(i),o=t*Math.sin(i);return[e,r,o]};F.rgb.ansi16=function(s,e=null){const[t,n,i]=s;let r=e===null?F.rgb.hsv(s)[2]:e;if(r=Math.round(r/50),r===0)return 30;let o=30+(Math.round(i/255)<<2|Math.round(n/255)<<1|Math.round(t/255));return r===2&&(o+=60),o};F.hsv.ansi16=function(s){return F.rgb.ansi16(F.hsv.rgb(s),s[2])};F.rgb.ansi256=function(s){const e=s[0],t=s[1],n=s[2];return e>>4===t>>4&&t>>4===n>>4?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)};F.ansi16.rgb=function(s){s=s[0];let e=s%10;if(e===0||e===7)return s>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const t=(Math.trunc(s>50)+1)*.5,n=(e&1)*t*255,i=(e>>1&1)*t*255,r=(e>>2&1)*t*255;return[n,i,r]};F.ansi256.rgb=function(s){if(s=s[0],s>=232){const r=(s-232)*10+8;return[r,r,r]}s-=16;let e;const t=Math.floor(s/36)/5*255,n=Math.floor((e=s%36)/6)/5*255,i=e%6/5*255;return[t,n,i]};F.rgb.hex=function(s){const t=(((Math.round(s[0])&255)<<16)+((Math.round(s[1])&255)<<8)+(Math.round(s[2])&255)).toString(16).toUpperCase();return"000000".slice(t.length)+t};F.hex.rgb=function(s){const e=s.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!e)return[0,0,0];let t=e[0];e[0].length===3&&(t=[...t].map(a=>a+a).join(""));const n=Number.parseInt(t,16),i=n>>16&255,r=n>>8&255,o=n&255;return[i,r,o]};F.rgb.hcg=function(s){const e=s[0]/255,t=s[1]/255,n=s[2]/255,i=Math.max(Math.max(e,t),n),r=Math.min(Math.min(e,t),n),o=i-r;let a;const l=o<1?r/(1-o):0;return o<=0?a=0:i===e?a=(t-n)/o%6:i===t?a=2+(n-e)/o:a=4+(e-t)/o,a/=6,a%=1,[a*360,o*100,l*100]};F.hsl.hcg=function(s){const e=s[1]/100,t=s[2]/100,n=t<.5?2*e*t:2*e*(1-t);let i=0;return n<1&&(i=(t-.5*n)/(1-n)),[s[0],n*100,i*100]};F.hsv.hcg=function(s){const e=s[1]/100,t=s[2]/100,n=e*t;let i=0;return n<1&&(i=(t-n)/(1-n)),[s[0],n*100,i*100]};F.hcg.rgb=function(s){const e=s[0]/360,t=s[1]/100,n=s[2]/100;if(t===0)return[n*255,n*255,n*255];const i=[0,0,0],r=e%1*6,o=r%1,a=1-o;let l=0;switch(Math.floor(r)){case 0:{i[0]=1,i[1]=o,i[2]=0;break}case 1:{i[0]=a,i[1]=1,i[2]=0;break}case 2:{i[0]=0,i[1]=1,i[2]=o;break}case 3:{i[0]=0,i[1]=a,i[2]=1;break}case 4:{i[0]=o,i[1]=0,i[2]=1;break}default:i[0]=1,i[1]=0,i[2]=a}return l=(1-t)*n,[(t*i[0]+l)*255,(t*i[1]+l)*255,(t*i[2]+l)*255]};F.hcg.hsv=function(s){const e=s[1]/100,t=s[2]/100,n=e+t*(1-e);let i=0;return n>0&&(i=e/n),[s[0],i*100,n*100]};F.hcg.hsl=function(s){const e=s[1]/100,n=s[2]/100*(1-e)+.5*e;let i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[s[0],i*100,n*100]};F.hcg.hwb=function(s){const e=s[1]/100,t=s[2]/100,n=e+t*(1-e);return[s[0],(n-e)*100,(1-n)*100]};F.hwb.hcg=function(s){const e=s[1]/100,n=1-s[2]/100,i=n-e;let r=0;return i<1&&(r=(n-i)/(1-i)),[s[0],i*100,r*100]};F.apple.rgb=function(s){return[s[0]/65535*255,s[1]/65535*255,s[2]/65535*255]};F.rgb.apple=function(s){return[s[0]/255*65535,s[1]/255*65535,s[2]/255*65535]};F.gray.rgb=function(s){return[s[0]/100*255,s[0]/100*255,s[0]/100*255]};F.gray.hsl=function(s){return[0,0,s[0]]};F.gray.hsv=F.gray.hsl;F.gray.hwb=function(s){return[0,100,s[0]]};F.gray.cmyk=function(s){return[0,0,0,s[0]]};F.gray.lab=function(s){return[s[0],0,0]};F.gray.hex=function(s){const e=Math.round(s[0]/100*255)&255,n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".slice(n.length)+n};F.rgb.gray=function(s){return[(s[0]+s[1]+s[2])/3/255*100]};function Fy(){const s={},e=Object.keys(F);for(let{length:t}=e,n=0;n<t;n++)s[e[n]]={distance:-1,parent:null};return s}function Dy(s){const e=Fy(),t=[s];for(e[s].distance=0;t.length>0;){const n=t.pop(),i=Object.keys(F[n]);for(let{length:r}=i,o=0;o<r;o++){const a=i[o],l=e[a];l.distance===-1&&(l.distance=e[n].distance+1,l.parent=n,t.unshift(a))}}return e}function My(s,e){return function(t){return e(s(t))}}function Ny(s,e){const t=[e[s].parent,s];let n=F[e[s].parent][s],i=e[s].parent;for(;e[i].parent;)t.unshift(e[i].parent),n=My(F[e[i].parent][i],n),i=e[i].parent;return n.conversion=t,n}function jy(s){const e=Dy(s),t={},n=Object.keys(e);for(let{length:i}=n,r=0;r<i;r++){const o=n[r];e[o].parent!==null&&(t[o]=Ny(o,e))}return t}const ye={},By=Object.keys(F);function Wy(s){const e=function(...t){const n=t[0];return n==null?n:(n.length>1&&(t=n),s(t))};return"conversion"in s&&(e.conversion=s.conversion),e}function Hy(s){const e=function(...t){const n=t[0];if(n==null)return n;n.length>1&&(t=n);const i=s(t);if(typeof i=="object")for(let{length:r}=i,o=0;o<r;o++)i[o]=Math.round(i[o]);return i};return"conversion"in s&&(e.conversion=s.conversion),e}for(const s of By){ye[s]={},Object.defineProperty(ye[s],"channels",{value:F[s].channels}),Object.defineProperty(ye[s],"labels",{value:F[s].labels});const e=jy(s),t=Object.keys(e);for(const n of t){const i=e[n];ye[s][n]=Hy(i),ye[s][n].raw=Wy(i)}}const wa=["keyword","gray","hex"],Gs={};for(const s of Object.keys(ye))Gs[[...ye[s].labels].sort().join("")]=s;const Js={};function ge(s,e){if(!(this instanceof ge))return new ge(s,e);if(e&&e in wa&&(e=null),e&&!(e in ye))throw new Error("Unknown model: "+e);let t,n;if(s==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(s instanceof ge)this.model=s.model,this.color=[...s.color],this.valpha=s.valpha;else if(typeof s=="string"){const i=pe.get(s);if(i===null)throw new Error("Unable to parse color from string: "+s);this.model=i.model,n=ye[this.model].channels,this.color=i.value.slice(0,n),this.valpha=typeof i.value[n]=="number"?i.value[n]:1}else if(s.length>0){this.model=e||"rgb",n=ye[this.model].channels;const i=Array.prototype.slice.call(s,0,n);this.color=Ys(i,n),this.valpha=typeof s[n]=="number"?s[n]:1}else if(typeof s=="number")this.model="rgb",this.color=[s>>16&255,s>>8&255,s&255],this.valpha=1;else{this.valpha=1;const i=Object.keys(s);"alpha"in s&&(i.splice(i.indexOf("alpha"),1),this.valpha=typeof s.alpha=="number"?s.alpha:0);const r=i.sort().join("");if(!(r in Gs))throw new Error("Unable to parse color from object: "+JSON.stringify(s));this.model=Gs[r];const{labels:o}=ye[this.model],a=[];for(t=0;t<o.length;t++)a.push(s[o[t]]);this.color=Ys(a)}if(Js[this.model])for(n=ye[this.model].channels,t=0;t<n;t++){const i=Js[this.model][t];i&&(this.color[t]=i(this.color[t]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}ge.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(s){let e=this.model in pe.to?this:this.rgb();e=e.round(typeof s=="number"?s:1);const t=e.valpha===1?e.color:[...e.color,this.valpha];return pe.to[e.model](...t)},percentString(s){const e=this.rgb().round(typeof s=="number"?s:1),t=e.valpha===1?e.color:[...e.color,this.valpha];return pe.to.rgb.percent(...t)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){const s={},{channels:e}=ye[this.model],{labels:t}=ye[this.model];for(let n=0;n<e;n++)s[t[n]]=this.color[n];return this.valpha!==1&&(s.alpha=this.valpha),s},unitArray(){const s=this.rgb().color;return s[0]/=255,s[1]/=255,s[2]/=255,this.valpha!==1&&s.push(this.valpha),s},unitObject(){const s=this.rgb().object();return s.r/=255,s.g/=255,s.b/=255,this.valpha!==1&&(s.alpha=this.valpha),s},round(s){return s=Math.max(s||0,0),new ge([...this.color.map(zy(s)),this.valpha],this.model)},alpha(s){return s!==void 0?new ge([...this.color,Math.max(0,Math.min(1,s))],this.model):this.valpha},red:de("rgb",0,me(255)),green:de("rgb",1,me(255)),blue:de("rgb",2,me(255)),hue:de(["hsl","hsv","hsl","hwb","hcg"],0,s=>(s%360+360)%360),saturationl:de("hsl",1,me(100)),lightness:de("hsl",2,me(100)),saturationv:de("hsv",1,me(100)),value:de("hsv",2,me(100)),chroma:de("hcg",1,me(100)),gray:de("hcg",2,me(100)),white:de("hwb",1,me(100)),wblack:de("hwb",2,me(100)),cyan:de("cmyk",0,me(100)),magenta:de("cmyk",1,me(100)),yellow:de("cmyk",2,me(100)),black:de("cmyk",3,me(100)),x:de("xyz",0,me(95.047)),y:de("xyz",1,me(100)),z:de("xyz",2,me(108.833)),l:de("lab",0,me(100)),a:de("lab",1),b:de("lab",2),keyword(s){return s!==void 0?new ge(s):ye[this.model].keyword(this.color)},hex(s){return s!==void 0?new ge(s):pe.to.hex(...this.rgb().round().color)},hexa(s){if(s!==void 0)return new ge(s);const e=this.rgb().round().color;let t=Math.round(this.valpha*255).toString(16).toUpperCase();return t.length===1&&(t="0"+t),pe.to.hex(...e)+t},rgbNumber(){const s=this.rgb().color;return(s[0]&255)<<16|(s[1]&255)<<8|s[2]&255},luminosity(){const s=this.rgb().color,e=[];for(const[t,n]of s.entries()){const i=n/255;e[t]=i<=.04045?i/12.92:((i+.055)/1.055)**2.4}return .2126*e[0]+.7152*e[1]+.0722*e[2]},contrast(s){const e=this.luminosity(),t=s.luminosity();return e>t?(e+.05)/(t+.05):(t+.05)/(e+.05)},level(s){const e=this.contrast(s);return e>=7?"AAA":e>=4.5?"AA":""},isDark(){const s=this.rgb().color;return(s[0]*2126+s[1]*7152+s[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){const s=this.rgb();for(let e=0;e<3;e++)s.color[e]=255-s.color[e];return s},lighten(s){const e=this.hsl();return e.color[2]+=e.color[2]*s,e},darken(s){const e=this.hsl();return e.color[2]-=e.color[2]*s,e},saturate(s){const e=this.hsl();return e.color[1]+=e.color[1]*s,e},desaturate(s){const e=this.hsl();return e.color[1]-=e.color[1]*s,e},whiten(s){const e=this.hwb();return e.color[1]+=e.color[1]*s,e},blacken(s){const e=this.hwb();return e.color[2]+=e.color[2]*s,e},grayscale(){const s=this.rgb().color,e=s[0]*.3+s[1]*.59+s[2]*.11;return ge.rgb(e,e,e)},fade(s){return this.alpha(this.valpha-this.valpha*s)},opaquer(s){return this.alpha(this.valpha+this.valpha*s)},rotate(s){const e=this.hsl();let t=e.color[0];return t=(t+s)%360,t=t<0?360+t:t,e.color[0]=t,e},mix(s,e){if(!s||!s.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof s);const t=s.rgb(),n=this.rgb(),i=e===void 0?.5:e,r=2*i-1,o=t.alpha()-n.alpha(),a=((r*o===-1?r:(r+o)/(1+r*o))+1)/2,l=1-a;return ge.rgb(a*t.red()+l*n.red(),a*t.green()+l*n.green(),a*t.blue()+l*n.blue(),t.alpha()*i+n.alpha()*(1-i))}};for(const s of Object.keys(ye)){if(wa.includes(s))continue;const{channels:e}=ye[s];ge.prototype[s]=function(...t){return this.model===s?new ge(this):t.length>0?new ge(t,s):new ge([...Uy(ye[this.model][s].raw(this.color)),this.valpha],s)},ge[s]=function(...t){let n=t[0];return typeof n=="number"&&(n=Ys(t,e)),new ge(n,s)}}function Vy(s,e){return Number(s.toFixed(e))}function zy(s){return function(e){return Vy(e,s)}}function de(s,e,t){s=Array.isArray(s)?s:[s];for(const n of s)(Js[n]||=[])[e]=t;return s=s[0],function(n){let i;return n!==void 0?(t&&(n=t(n)),i=this[s](),i.color[e]=n,i):(i=this[s]().color[e],t&&(i=t(i)),i)}}function me(s){return function(e){return Math.max(0,Math.min(s,e))}}function Uy(s){return Array.isArray(s)?s:[s]}function Ys(s,e){for(let t=0;t<e;t++)typeof s[t]!="number"&&(s[t]=0);return s}const $y="jp-Terminal",Ky="jp-Terminal-body",qy="jp-sr-only",Gy=350;let Jy=class extends X{constructor(e,t={},n){super(),this._needsResize=!0,this._offsetWidth=-1,this._offsetHeight=-1,this._isReady=!1,this._ready=new it,this._termOpened=!1,this._themeChanged=new U(this),this._escapeHintRequested=new U(this),this._escapePressedOnce=!1,this._escapeResetTimer=null,n=n||se,this._trans=n.load("jupyterlab"),this.session=e,this._options={...Ks.defaultOptions,...t};const{theme:i,...r}=this._options,o={theme:nt.getXTermTheme(i),allowProposedApi:!0,...r};this.addClass($y),this._setThemeAttribute(i),this._terminalId=nt.id++,this.id=`jp-Terminal-${this._terminalId}`,this._escapeInstructionsId=`jp-Terminal-escape-instructions-${this._terminalId}`;const a=document.createElement("p");a.id=this._escapeInstructionsId,a.className=qy,a.textContent=this._trans.__("Press Escape twice to leave terminal focus. Press Enter to return focus to the terminal input."),this.node.appendChild(a);let l="";const c=(d,u)=>{u.type==="stdout"&&u.content&&(l+=u.content[0])};e.messageReceived.connect(c),e.disposed.connect(()=>{this.getOption("closeOnExit")&&this.dispose()},this),nt.createTerminal(o).then(([d,u,h])=>{this._term=d,this._fitAddon=u,this._searchAddon=h,this._initializeTerm(),this.title.label=this._trans.__("Terminal"),this._isReady=!0,this._ready.resolve(),l&&this._term.write(l),e.messageReceived.disconnect(c),e.messageReceived.connect(this._onMessage,this),e.connectionStatus==="connected"?this._initialConnection():e.connectionStatusChanged.connect(this._initialConnection,this),this.update()}).catch(d=>{console.error(`Failed to create a terminal.
436
+ }`})]}));globalThis.__webpack_public_path__=O.PageConfig.getOption("fullStaticUrl")+"/";window.__webpack_public_path__=O.PageConfig.getOption("fullStaticUrl")+"/";const yy=s=>{const{PluginType:e,devMode:t=!1,disabledPlugins:n=[],headless:i=!1,height:r="100vh",hostId:o="app-example-id",mimeRendererPromises:a,mimeRenderers:l=[],nosplash:c=!1,onJupyterLab:d=H=>{},onPlugin:u,pluginId:h,pluginPromises:m,plugins:_=[],position:b="relative",serverless:g=!1,serviceManager:p,startDefaultKernel:w=!1,theme:v="light",width:y="100%",...C}=s,{serviceManager:E}=Je({serverless:g,serviceManager:p,startDefaultKernel:w}),x=Xr(H=>H.setJupyterLabAdapter),S=R.useMemo(()=>a??Ws().mimeExtensionPromises,[a]),A=R.useMemo(()=>m??Ws().extensionPromises,[m]),I=R.useRef(null),P=R.useRef(null),[D,j]=R.useState();return R.useEffect(()=>{if(!P.current&&I&&E){const H=new Zn({PluginType:e,devMode:t,disabledPlugins:n,headless:i,height:r,hostId:o,mimeRendererPromises:S,mimeRenderers:l,nosplash:c,onJupyterLab:d,onPlugin:u,pluginId:h,pluginPromises:A,plugins:_,position:b,serverless:g,serviceManager:E,startDefaultKernel:w,theme:v,width:y,...C});H.ready.then(()=>{if(x(H),d(H),h&&e&&u){const $=H.service(h);u($)}}),P.current=H,j(H)}},[o,I,E,v]),f.jsx(f.Fragment,{children:f.jsxs(ee,{sx:{"& .jp-LabShell":{position:b,height:r,width:y,display:i?"none":"inherit"}},children:[f.jsx(gy,{theme:v}),f.jsx("div",{ref:I,id:o})]})})},by=R.memo(yy),Ei=s=>{const[e,t]=R.useState(s.count),n=R.useRef(void 0),i=()=>t(r=>r-1);return R.useEffect(()=>{t(s.count)},[s.count]),R.useEffect(()=>(n.current=setInterval(i,1e3),()=>clearInterval(n.current)),[]),f.jsxs(f.Fragment,{children:["[",e,"]"]})},vy="jp-InputPrompt";class wy extends ni{_executionCount=null;state={count:100};constructor(){super(),this.addClass(vy)}render(){return f.jsx(Ei,{count:this.state.count})}get executionCount(){return this._executionCount}set executionCount(e){this._executionCount=e,e===null?this.state={count:0}:e==="*"?this.state={count:0}:(this.state={count:Number(e)},this.update())}}const Cy="jp-OutputPrompt";class Ey extends ni{_executionCount=null;state={count:100};constructor(){super(),this.addClass(Cy)}render(){return f.jsx(Ei,{count:this.state.count})}get executionCount(){return this._executionCount}set executionCount(e){this._executionCount=e,e===null?this.state={count:0}:(this.state={count:Number(e)},this.update())}}function xy(s){const{commands:e}=s;return f.jsx(ee,{className:so,sx:{"& p":{marginBottom:"0 !important"}},children:f.jsx(si,{trailingVisual:uc,size:"small",variant:"invisible",onClick:t=>{t.preventDefault(),e.execute(Zr.run).catch(n=>{console.error("Failed to run cell.",n)})},children:"Run"})})}const Ty="text/x-ipython",_a="application/sql",ga=s=>{const e=s.model?.getMetadata("datalayer");return e?e.sql===!0:!1};class Sy extends ai{constructor(e){super(e)}}class Py extends hc.ContentFactory{_updateSQLEditor=e=>{ga(e)&&(e.editor.model.mimeType=_a)};_updateEditor=e=>{e.editor&&(e.editor.model.mimeTypeChanged.connect((t,n)=>{this._updateSQLEditor(e)}),this._updateSQLEditor(e))};createNotebook(e){return super.createNotebook(e)}createCodeCell(e){const t=new Sy(e);return t.inViewport&&this._updateEditor(t),t.displayChanged.connect(()=>{this._updateEditor(t)}),t.inViewportChanged.connect(()=>{this._updateEditor(t)}),t}}class Ay extends Lu{_nbformat;_readonly;constructor(e){super(e),this._nbformat=e.nbformat,this._readonly=e.readonly}get disableDocumentWideUndoRedo(){return super.disableDocumentWideUndoRedo}set disableDocumentWideUndoRedo(e){super.disableDocumentWideUndoRedo=e}createNew(e){if(this._nbformat){this._nbformat.cells.forEach(n=>{n.metadata.editable=!this._readonly});const t=new Ou;return t.fromJSON(this._nbformat),t}else{const t=super.createNew(e);return t.readOnly=this._readonly,t}}}class Ry extends Xu{el;constructor(e){super(),this.el=e}async loadClass(e,t,n){return new Promise((i,r)=>{if(t==="@jupyter-widgets/controls")i(Zu);else if(t==="@jupyter-widgets/base")i(Qu);else{const o=function(a){if(a.requireModules&&a.requireModules[0])console.log(`Falling back to jsDelivr for ${t}@${n}`),window.require([`https://cdn.jsdelivr.net/npm/${t}@${n}/dist/index.js`],i,r);else throw a};window.require([`${t}.js`],i,o)}}).then(i=>i[e]?i[e]:Promise.reject(`Class ${e} not found in module ${t}@${n}`))}async display_view(e){return Promise.resolve(e).then(t=>(X.attach(t.luminoWidget,this.el),t))}_get_comm_info(){return Promise.resolve({})}_create_comm(){return Promise.reject("no comms available")}}const Iy=s=>{const{view:e,state:t}=s,n=R.useRef(null),i=R.useRef(null);return R.useEffect(()=>{const r=n.current,o=e?.model_id;if(!r||!o)return;const a=String(o);if(i.current===a)return;i.current=a,r.replaceChildren();let l=!1;const c=new Ry(r);return c.set_state(t).then(d=>c.create_view(d.find(u=>u.model_id===o))).then(d=>{l||c.display_view(d)}).catch(d=>{console.error("[jupyter-react] could not render the widget",d)}),()=>{l=!0}},[e,t]),f.jsx("div",{ref:n})},ya=s=>{const{view:e,state:t}=s;return f.jsx(f.Fragment,{children:f.jsx(Iy,{view:e,state:t})})};class Ly{settingsPanel;constructor(){this.settingsPanel=new zn,this.settingsPanel.id="dla-jlab-settings",this.settingsPanel.spacing=0}get panel(){return this.settingsPanel}}const Oy=()=>{const s=new Ly;return f.jsx(f.Fragment,{children:f.jsx(Vt,{children:s.panel})})};var Ks;(function(s){s.defaultOptions={theme:"inherit",fontFamily:'Menlo, Consolas, "DejaVu Sans Mono", monospace',fontSize:13,lineHeight:1,scrollback:1e3,shutdownOnClose:!1,closeOnExit:!0,cursorBlink:!0,initialCommand:"",screenReaderMode:!1,pasteWithCtrlV:!0,autoFit:!0,macOptionIsMeta:!1}})(Ks||(Ks={}));const qs={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};for(const s in qs)Object.freeze(qs[s]);const Ke=Object.freeze(qs),ba=Object.create(null);for(const s in Ke)Object.hasOwn(Ke,s)&&(ba[Ke[s]]=s);const pe={to:{},get:{}};pe.get=function(s){const e=s.slice(0,3).toLowerCase();let t,n;switch(e){case"hsl":{t=pe.get.hsl(s),n="hsl";break}case"hwb":{t=pe.get.hwb(s),n="hwb";break}default:{t=pe.get.rgb(s),n="rgb";break}}return t?{model:n,value:t}:null};pe.get.rgb=function(s){if(!s)return null;const e=/^#([a-f\d]{3,4})$/i,t=/^#([a-f\d]{6})([a-f\d]{2})?$/i,n=/^rgba?\(\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)\s*(?:[\s,|/]\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(%?)\s*)?\)$/i,i=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/i,r=/^(\w+)$/;let o=[0,0,0,1],a,l,c;if(a=s.match(t)){for(c=a[2],a=a[1],l=0;l<3;l++){const d=l*2;o[l]=Number.parseInt(a.slice(d,d+2),16)}c&&(o[3]=Number.parseInt(c,16)/255)}else if(a=s.match(e)){for(a=a[1],c=a[3],l=0;l<3;l++)o[l]=Number.parseInt(a[l]+a[l],16);c&&(o[3]=Number.parseInt(c+c,16)/255)}else if(a=s.match(n)){for(l=0;l<3;l++)o[l]=Number.parseFloat(a[l+1]);a[4]&&(o[3]=a[5]?Number.parseFloat(a[4])*.01:Number.parseFloat(a[4]))}else if(a=s.match(i)){for(l=0;l<3;l++)o[l]=Math.round(Number.parseFloat(a[l+1])*2.55);a[4]&&(o[3]=a[5]?Number.parseFloat(a[4])*.01:Number.parseFloat(a[4]))}else return(a=s.toLowerCase().match(r))?a[1]==="transparent"?[0,0,0,0]:Object.hasOwn(Ke,a[1])?(o=Ke[a[1]].slice(),o[3]=1,o):null:null;for(l=0;l<3;l++)o[l]=mt(o[l],0,255);return o[3]=mt(o[3],0,1),o};pe.get.hsl=function(s){if(!s)return null;const e=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i,t=s.match(e);if(t){const n=Number.parseFloat(t[4]),i=(Number.parseFloat(t[1])%360+360)%360,r=mt(Number.parseFloat(t[2]),0,100),o=mt(Number.parseFloat(t[3]),0,100),a=mt(Number.isNaN(n)?1:n,0,1);return[i,r,o,a]}return null};pe.get.hwb=function(s){if(!s)return null;const e=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i,t=s.match(e);if(t){const n=Number.parseFloat(t[4]),i=(Number.parseFloat(t[1])%360+360)%360,r=mt(Number.parseFloat(t[2]),0,100),o=mt(Number.parseFloat(t[3]),0,100),a=mt(Number.isNaN(n)?1:n,0,1);return[i,r,o,a]}return null};pe.to.hex=function(...s){return"#"+Cn(s[0])+Cn(s[1])+Cn(s[2])+(s[3]<1?Cn(Math.round(s[3]*255)):"")};pe.to.rgb=function(...s){return s.length<4||s[3]===1?"rgb("+Math.round(s[0])+", "+Math.round(s[1])+", "+Math.round(s[2])+")":"rgba("+Math.round(s[0])+", "+Math.round(s[1])+", "+Math.round(s[2])+", "+s[3]+")"};pe.to.rgb.percent=function(...s){const e=Math.round(s[0]/255*100),t=Math.round(s[1]/255*100),n=Math.round(s[2]/255*100);return s.length<4||s[3]===1?"rgb("+e+"%, "+t+"%, "+n+"%)":"rgba("+e+"%, "+t+"%, "+n+"%, "+s[3]+")"};pe.to.hsl=function(...s){return s.length<4||s[3]===1?"hsl("+s[0]+", "+s[1]+"%, "+s[2]+"%)":"hsla("+s[0]+", "+s[1]+"%, "+s[2]+"%, "+s[3]+")"};pe.to.hwb=function(...s){let e="";return s.length>=4&&s[3]!==1&&(e=", "+s[3]),"hwb("+s[0]+", "+s[1]+"%, "+s[2]+"%"+e+")"};pe.to.keyword=function(...s){return ba[s.slice(0,3)]};function mt(s,e,t){return Math.min(Math.max(e,s),t)}function Cn(s){const e=Math.round(s).toString(16).toUpperCase();return e.length<2?"0"+e:e}const va={};for(const s of Object.keys(Ke))va[Ke[s]]=s;const F={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},st=(6/29)**3;function Dt(s){const e=s>.0031308?1.055*s**.4166666666666667-.055:s*12.92;return Math.min(Math.max(0,e),1)}function Nt(s){return s>.04045?((s+.055)/1.055)**2.4:s/12.92}for(const s of Object.keys(F)){if(!("channels"in F[s]))throw new Error("missing channels property: "+s);if(!("labels"in F[s]))throw new Error("missing channel labels property: "+s);if(F[s].labels.length!==F[s].channels)throw new Error("channel and label counts mismatch: "+s);const{channels:e,labels:t}=F[s];delete F[s].channels,delete F[s].labels,Object.defineProperty(F[s],"channels",{value:e}),Object.defineProperty(F[s],"labels",{value:t})}F.rgb.hsl=function(s){const e=s[0]/255,t=s[1]/255,n=s[2]/255,i=Math.min(e,t,n),r=Math.max(e,t,n),o=r-i;let a,l;switch(r){case i:{a=0;break}case e:{a=(t-n)/o;break}case t:{a=2+(n-e)/o;break}case n:{a=4+(e-t)/o;break}}a=Math.min(a*60,360),a<0&&(a+=360);const c=(i+r)/2;return r===i?l=0:c<=.5?l=o/(r+i):l=o/(2-r-i),[a,l*100,c*100]};F.rgb.hsv=function(s){let e,t,n,i,r;const o=s[0]/255,a=s[1]/255,l=s[2]/255,c=Math.max(o,a,l),d=c-Math.min(o,a,l),u=function(h){return(c-h)/6/d+1/2};if(d===0)i=0,r=0;else{switch(r=d/c,e=u(o),t=u(a),n=u(l),c){case o:{i=n-t;break}case a:{i=1/3+e-n;break}case l:{i=2/3+t-e;break}}i<0?i+=1:i>1&&(i-=1)}return[i*360,r*100,c*100]};F.rgb.hwb=function(s){const e=s[0],t=s[1];let n=s[2];const i=F.rgb.hsl(s)[0],r=1/255*Math.min(e,Math.min(t,n));return n=1-1/255*Math.max(e,Math.max(t,n)),[i,r*100,n*100]};F.rgb.oklab=function(s){const e=Nt(s[0]/255),t=Nt(s[1]/255),n=Nt(s[2]/255),i=Math.cbrt(.4122214708*e+.5363325363*t+.0514459929*n),r=Math.cbrt(.2119034982*e+.6806995451*t+.1073969566*n),o=Math.cbrt(.0883024619*e+.2817188376*t+.6299787005*n),a=.2104542553*i+.793617785*r-.0040720468*o,l=1.9779984951*i-2.428592205*r+.4505937099*o,c=.0259040371*i+.7827717662*r-.808675766*o;return[a*100,l*100,c*100]};F.rgb.cmyk=function(s){const e=s[0]/255,t=s[1]/255,n=s[2]/255,i=Math.min(1-e,1-t,1-n),r=(1-e-i)/(1-i)||0,o=(1-t-i)/(1-i)||0,a=(1-n-i)/(1-i)||0;return[r*100,o*100,a*100,i*100]};function ky(s,e){return(s[0]-e[0])**2+(s[1]-e[1])**2+(s[2]-e[2])**2}F.rgb.keyword=function(s){const e=va[s];if(e)return e;let t=Number.POSITIVE_INFINITY,n;for(const i of Object.keys(Ke)){const r=Ke[i],o=ky(s,r);o<t&&(t=o,n=i)}return n};F.keyword.rgb=function(s){return[...Ke[s]]};F.rgb.xyz=function(s){const e=Nt(s[0]/255),t=Nt(s[1]/255),n=Nt(s[2]/255),i=e*.4124564+t*.3575761+n*.1804375,r=e*.2126729+t*.7151522+n*.072175,o=e*.0193339+t*.119192+n*.9503041;return[i*100,r*100,o*100]};F.rgb.lab=function(s){const e=F.rgb.xyz(s);let t=e[0],n=e[1],i=e[2];t/=95.047,n/=100,i/=108.883,t=t>st?t**(1/3):7.787*t+16/116,n=n>st?n**(1/3):7.787*n+16/116,i=i>st?i**(1/3):7.787*i+16/116;const r=116*n-16,o=500*(t-n),a=200*(n-i);return[r,o,a]};F.hsl.rgb=function(s){const e=s[0]/360,t=s[1]/100,n=s[2]/100;let i,r;if(t===0)return r=n*255,[r,r,r];const o=n<.5?n*(1+t):n+t-n*t,a=2*n-o,l=[0,0,0];for(let c=0;c<3;c++)i=e+1/3*-(c-1),i<0&&i++,i>1&&i--,6*i<1?r=a+(o-a)*6*i:2*i<1?r=o:3*i<2?r=a+(o-a)*(2/3-i)*6:r=a,l[c]=r*255;return l};F.hsl.hsv=function(s){const e=s[0];let t=s[1]/100,n=s[2]/100,i=t;const r=Math.max(n,.01);n*=2,t*=n<=1?n:2-n,i*=r<=1?r:2-r;const o=(n+t)/2,a=n===0?2*i/(r+i):2*t/(n+t);return[e,a*100,o*100]};F.hsv.rgb=function(s){const e=s[0]/60,t=s[1]/100;let n=s[2]/100;const i=Math.floor(e)%6,r=e-Math.floor(e),o=255*n*(1-t),a=255*n*(1-t*r),l=255*n*(1-t*(1-r));switch(n*=255,i){case 0:return[n,l,o];case 1:return[a,n,o];case 2:return[o,n,l];case 3:return[o,a,n];case 4:return[l,o,n];case 5:return[n,o,a]}};F.hsv.hsl=function(s){const e=s[0],t=s[1]/100,n=s[2]/100,i=Math.max(n,.01);let r,o;o=(2-t)*n;const a=(2-t)*i;return r=t*i,r/=a<=1?a:2-a,r=r||0,o/=2,[e,r*100,o*100]};F.hwb.rgb=function(s){const e=s[0]/360;let t=s[1]/100,n=s[2]/100;const i=t+n;let r;i>1&&(t/=i,n/=i);const o=Math.floor(6*e),a=1-n;r=6*e-o,(o&1)!==0&&(r=1-r);const l=t+r*(a-t);let c,d,u;switch(o){default:case 6:case 0:{c=a,d=l,u=t;break}case 1:{c=l,d=a,u=t;break}case 2:{c=t,d=a,u=l;break}case 3:{c=t,d=l,u=a;break}case 4:{c=l,d=t,u=a;break}case 5:{c=a,d=t,u=l;break}}return[c*255,d*255,u*255]};F.cmyk.rgb=function(s){const e=s[0]/100,t=s[1]/100,n=s[2]/100,i=s[3]/100,r=1-Math.min(1,e*(1-i)+i),o=1-Math.min(1,t*(1-i)+i),a=1-Math.min(1,n*(1-i)+i);return[r*255,o*255,a*255]};F.xyz.rgb=function(s){const e=s[0]/100,t=s[1]/100,n=s[2]/100;let i,r,o;return i=e*3.2404542+t*-1.5371385+n*-.4985314,r=e*-.969266+t*1.8760108+n*.041556,o=e*.0556434+t*-.2040259+n*1.0572252,i=Dt(i),r=Dt(r),o=Dt(o),[i*255,r*255,o*255]};F.xyz.lab=function(s){let e=s[0],t=s[1],n=s[2];e/=95.047,t/=100,n/=108.883,e=e>st?e**(1/3):7.787*e+16/116,t=t>st?t**(1/3):7.787*t+16/116,n=n>st?n**(1/3):7.787*n+16/116;const i=116*t-16,r=500*(e-t),o=200*(t-n);return[i,r,o]};F.xyz.oklab=function(s){const e=s[0]/100,t=s[1]/100,n=s[2]/100,i=Math.cbrt(.8189330101*e+.3618667424*t-.1288597137*n),r=Math.cbrt(.0329845436*e+.9293118715*t+.0361456387*n),o=Math.cbrt(.0482003018*e+.2643662691*t+.633851707*n),a=.2104542553*i+.793617785*r-.0040720468*o,l=1.9779984951*i-2.428592205*r+.4505937099*o,c=.0259040371*i+.7827717662*r-.808675766*o;return[a*100,l*100,c*100]};F.oklab.oklch=function(s){return F.lab.lch(s)};F.oklab.xyz=function(s){const e=s[0]/100,t=s[1]/100,n=s[2]/100,i=(.999999998*e+.396337792*t+.215803758*n)**3,r=(1.000000008*e-.105561342*t-.063854175*n)**3,o=(1.000000055*e-.089484182*t-1.291485538*n)**3,a=1.227013851*i-.55779998*r+.281256149*o,l=-.040580178*i+1.11225687*r-.071676679*o,c=-.076381285*i-.421481978*r+1.58616322*o;return[a*100,l*100,c*100]};F.oklab.rgb=function(s){const e=s[0]/100,t=s[1]/100,n=s[2]/100,i=(e+.3963377774*t+.2158037573*n)**3,r=(e-.1055613458*t-.0638541728*n)**3,o=(e-.0894841775*t-1.291485548*n)**3,a=Dt(4.0767416621*i-3.3077115913*r+.2309699292*o),l=Dt(-1.2684380046*i+2.6097574011*r-.3413193965*o),c=Dt(-.0041960863*i-.7034186147*r+1.707614701*o);return[a*255,l*255,c*255]};F.oklch.oklab=function(s){return F.lch.lab(s)};F.lab.xyz=function(s){const e=s[0],t=s[1],n=s[2];let i,r,o;r=(e+16)/116,i=t/500+r,o=r-n/200;const a=r**3,l=i**3,c=o**3;return r=a>st?a:(r-16/116)/7.787,i=l>st?l:(i-16/116)/7.787,o=c>st?c:(o-16/116)/7.787,i*=95.047,r*=100,o*=108.883,[i,r,o]};F.lab.lch=function(s){const e=s[0],t=s[1],n=s[2];let i;i=Math.atan2(n,t)*360/2/Math.PI,i<0&&(i+=360);const o=Math.sqrt(t*t+n*n);return[e,o,i]};F.lch.lab=function(s){const e=s[0],t=s[1],i=s[2]/360*2*Math.PI,r=t*Math.cos(i),o=t*Math.sin(i);return[e,r,o]};F.rgb.ansi16=function(s,e=null){const[t,n,i]=s;let r=e===null?F.rgb.hsv(s)[2]:e;if(r=Math.round(r/50),r===0)return 30;let o=30+(Math.round(i/255)<<2|Math.round(n/255)<<1|Math.round(t/255));return r===2&&(o+=60),o};F.hsv.ansi16=function(s){return F.rgb.ansi16(F.hsv.rgb(s),s[2])};F.rgb.ansi256=function(s){const e=s[0],t=s[1],n=s[2];return e>>4===t>>4&&t>>4===n>>4?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)};F.ansi16.rgb=function(s){s=s[0];let e=s%10;if(e===0||e===7)return s>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const t=(Math.trunc(s>50)+1)*.5,n=(e&1)*t*255,i=(e>>1&1)*t*255,r=(e>>2&1)*t*255;return[n,i,r]};F.ansi256.rgb=function(s){if(s=s[0],s>=232){const r=(s-232)*10+8;return[r,r,r]}s-=16;let e;const t=Math.floor(s/36)/5*255,n=Math.floor((e=s%36)/6)/5*255,i=e%6/5*255;return[t,n,i]};F.rgb.hex=function(s){const t=(((Math.round(s[0])&255)<<16)+((Math.round(s[1])&255)<<8)+(Math.round(s[2])&255)).toString(16).toUpperCase();return"000000".slice(t.length)+t};F.hex.rgb=function(s){const e=s.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!e)return[0,0,0];let t=e[0];e[0].length===3&&(t=[...t].map(a=>a+a).join(""));const n=Number.parseInt(t,16),i=n>>16&255,r=n>>8&255,o=n&255;return[i,r,o]};F.rgb.hcg=function(s){const e=s[0]/255,t=s[1]/255,n=s[2]/255,i=Math.max(Math.max(e,t),n),r=Math.min(Math.min(e,t),n),o=i-r;let a;const l=o<1?r/(1-o):0;return o<=0?a=0:i===e?a=(t-n)/o%6:i===t?a=2+(n-e)/o:a=4+(e-t)/o,a/=6,a%=1,[a*360,o*100,l*100]};F.hsl.hcg=function(s){const e=s[1]/100,t=s[2]/100,n=t<.5?2*e*t:2*e*(1-t);let i=0;return n<1&&(i=(t-.5*n)/(1-n)),[s[0],n*100,i*100]};F.hsv.hcg=function(s){const e=s[1]/100,t=s[2]/100,n=e*t;let i=0;return n<1&&(i=(t-n)/(1-n)),[s[0],n*100,i*100]};F.hcg.rgb=function(s){const e=s[0]/360,t=s[1]/100,n=s[2]/100;if(t===0)return[n*255,n*255,n*255];const i=[0,0,0],r=e%1*6,o=r%1,a=1-o;let l=0;switch(Math.floor(r)){case 0:{i[0]=1,i[1]=o,i[2]=0;break}case 1:{i[0]=a,i[1]=1,i[2]=0;break}case 2:{i[0]=0,i[1]=1,i[2]=o;break}case 3:{i[0]=0,i[1]=a,i[2]=1;break}case 4:{i[0]=o,i[1]=0,i[2]=1;break}default:i[0]=1,i[1]=0,i[2]=a}return l=(1-t)*n,[(t*i[0]+l)*255,(t*i[1]+l)*255,(t*i[2]+l)*255]};F.hcg.hsv=function(s){const e=s[1]/100,t=s[2]/100,n=e+t*(1-e);let i=0;return n>0&&(i=e/n),[s[0],i*100,n*100]};F.hcg.hsl=function(s){const e=s[1]/100,n=s[2]/100*(1-e)+.5*e;let i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[s[0],i*100,n*100]};F.hcg.hwb=function(s){const e=s[1]/100,t=s[2]/100,n=e+t*(1-e);return[s[0],(n-e)*100,(1-n)*100]};F.hwb.hcg=function(s){const e=s[1]/100,n=1-s[2]/100,i=n-e;let r=0;return i<1&&(r=(n-i)/(1-i)),[s[0],i*100,r*100]};F.apple.rgb=function(s){return[s[0]/65535*255,s[1]/65535*255,s[2]/65535*255]};F.rgb.apple=function(s){return[s[0]/255*65535,s[1]/255*65535,s[2]/255*65535]};F.gray.rgb=function(s){return[s[0]/100*255,s[0]/100*255,s[0]/100*255]};F.gray.hsl=function(s){return[0,0,s[0]]};F.gray.hsv=F.gray.hsl;F.gray.hwb=function(s){return[0,100,s[0]]};F.gray.cmyk=function(s){return[0,0,0,s[0]]};F.gray.lab=function(s){return[s[0],0,0]};F.gray.hex=function(s){const e=Math.round(s[0]/100*255)&255,n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".slice(n.length)+n};F.rgb.gray=function(s){return[(s[0]+s[1]+s[2])/3/255*100]};function Fy(){const s={},e=Object.keys(F);for(let{length:t}=e,n=0;n<t;n++)s[e[n]]={distance:-1,parent:null};return s}function My(s){const e=Fy(),t=[s];for(e[s].distance=0;t.length>0;){const n=t.pop(),i=Object.keys(F[n]);for(let{length:r}=i,o=0;o<r;o++){const a=i[o],l=e[a];l.distance===-1&&(l.distance=e[n].distance+1,l.parent=n,t.unshift(a))}}return e}function Dy(s,e){return function(t){return e(s(t))}}function Ny(s,e){const t=[e[s].parent,s];let n=F[e[s].parent][s],i=e[s].parent;for(;e[i].parent;)t.unshift(e[i].parent),n=Dy(F[e[i].parent][i],n),i=e[i].parent;return n.conversion=t,n}function jy(s){const e=My(s),t={},n=Object.keys(e);for(let{length:i}=n,r=0;r<i;r++){const o=n[r];e[o].parent!==null&&(t[o]=Ny(o,e))}return t}const ye={},By=Object.keys(F);function Wy(s){const e=function(...t){const n=t[0];return n==null?n:(n.length>1&&(t=n),s(t))};return"conversion"in s&&(e.conversion=s.conversion),e}function Hy(s){const e=function(...t){const n=t[0];if(n==null)return n;n.length>1&&(t=n);const i=s(t);if(typeof i=="object")for(let{length:r}=i,o=0;o<r;o++)i[o]=Math.round(i[o]);return i};return"conversion"in s&&(e.conversion=s.conversion),e}for(const s of By){ye[s]={},Object.defineProperty(ye[s],"channels",{value:F[s].channels}),Object.defineProperty(ye[s],"labels",{value:F[s].labels});const e=jy(s),t=Object.keys(e);for(const n of t){const i=e[n];ye[s][n]=Hy(i),ye[s][n].raw=Wy(i)}}const wa=["keyword","gray","hex"],Gs={};for(const s of Object.keys(ye))Gs[[...ye[s].labels].sort().join("")]=s;const Js={};function ge(s,e){if(!(this instanceof ge))return new ge(s,e);if(e&&e in wa&&(e=null),e&&!(e in ye))throw new Error("Unknown model: "+e);let t,n;if(s==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(s instanceof ge)this.model=s.model,this.color=[...s.color],this.valpha=s.valpha;else if(typeof s=="string"){const i=pe.get(s);if(i===null)throw new Error("Unable to parse color from string: "+s);this.model=i.model,n=ye[this.model].channels,this.color=i.value.slice(0,n),this.valpha=typeof i.value[n]=="number"?i.value[n]:1}else if(s.length>0){this.model=e||"rgb",n=ye[this.model].channels;const i=Array.prototype.slice.call(s,0,n);this.color=Ys(i,n),this.valpha=typeof s[n]=="number"?s[n]:1}else if(typeof s=="number")this.model="rgb",this.color=[s>>16&255,s>>8&255,s&255],this.valpha=1;else{this.valpha=1;const i=Object.keys(s);"alpha"in s&&(i.splice(i.indexOf("alpha"),1),this.valpha=typeof s.alpha=="number"?s.alpha:0);const r=i.sort().join("");if(!(r in Gs))throw new Error("Unable to parse color from object: "+JSON.stringify(s));this.model=Gs[r];const{labels:o}=ye[this.model],a=[];for(t=0;t<o.length;t++)a.push(s[o[t]]);this.color=Ys(a)}if(Js[this.model])for(n=ye[this.model].channels,t=0;t<n;t++){const i=Js[this.model][t];i&&(this.color[t]=i(this.color[t]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}ge.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(s){let e=this.model in pe.to?this:this.rgb();e=e.round(typeof s=="number"?s:1);const t=e.valpha===1?e.color:[...e.color,this.valpha];return pe.to[e.model](...t)},percentString(s){const e=this.rgb().round(typeof s=="number"?s:1),t=e.valpha===1?e.color:[...e.color,this.valpha];return pe.to.rgb.percent(...t)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){const s={},{channels:e}=ye[this.model],{labels:t}=ye[this.model];for(let n=0;n<e;n++)s[t[n]]=this.color[n];return this.valpha!==1&&(s.alpha=this.valpha),s},unitArray(){const s=this.rgb().color;return s[0]/=255,s[1]/=255,s[2]/=255,this.valpha!==1&&s.push(this.valpha),s},unitObject(){const s=this.rgb().object();return s.r/=255,s.g/=255,s.b/=255,this.valpha!==1&&(s.alpha=this.valpha),s},round(s){return s=Math.max(s||0,0),new ge([...this.color.map(zy(s)),this.valpha],this.model)},alpha(s){return s!==void 0?new ge([...this.color,Math.max(0,Math.min(1,s))],this.model):this.valpha},red:de("rgb",0,me(255)),green:de("rgb",1,me(255)),blue:de("rgb",2,me(255)),hue:de(["hsl","hsv","hsl","hwb","hcg"],0,s=>(s%360+360)%360),saturationl:de("hsl",1,me(100)),lightness:de("hsl",2,me(100)),saturationv:de("hsv",1,me(100)),value:de("hsv",2,me(100)),chroma:de("hcg",1,me(100)),gray:de("hcg",2,me(100)),white:de("hwb",1,me(100)),wblack:de("hwb",2,me(100)),cyan:de("cmyk",0,me(100)),magenta:de("cmyk",1,me(100)),yellow:de("cmyk",2,me(100)),black:de("cmyk",3,me(100)),x:de("xyz",0,me(95.047)),y:de("xyz",1,me(100)),z:de("xyz",2,me(108.833)),l:de("lab",0,me(100)),a:de("lab",1),b:de("lab",2),keyword(s){return s!==void 0?new ge(s):ye[this.model].keyword(this.color)},hex(s){return s!==void 0?new ge(s):pe.to.hex(...this.rgb().round().color)},hexa(s){if(s!==void 0)return new ge(s);const e=this.rgb().round().color;let t=Math.round(this.valpha*255).toString(16).toUpperCase();return t.length===1&&(t="0"+t),pe.to.hex(...e)+t},rgbNumber(){const s=this.rgb().color;return(s[0]&255)<<16|(s[1]&255)<<8|s[2]&255},luminosity(){const s=this.rgb().color,e=[];for(const[t,n]of s.entries()){const i=n/255;e[t]=i<=.04045?i/12.92:((i+.055)/1.055)**2.4}return .2126*e[0]+.7152*e[1]+.0722*e[2]},contrast(s){const e=this.luminosity(),t=s.luminosity();return e>t?(e+.05)/(t+.05):(t+.05)/(e+.05)},level(s){const e=this.contrast(s);return e>=7?"AAA":e>=4.5?"AA":""},isDark(){const s=this.rgb().color;return(s[0]*2126+s[1]*7152+s[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){const s=this.rgb();for(let e=0;e<3;e++)s.color[e]=255-s.color[e];return s},lighten(s){const e=this.hsl();return e.color[2]+=e.color[2]*s,e},darken(s){const e=this.hsl();return e.color[2]-=e.color[2]*s,e},saturate(s){const e=this.hsl();return e.color[1]+=e.color[1]*s,e},desaturate(s){const e=this.hsl();return e.color[1]-=e.color[1]*s,e},whiten(s){const e=this.hwb();return e.color[1]+=e.color[1]*s,e},blacken(s){const e=this.hwb();return e.color[2]+=e.color[2]*s,e},grayscale(){const s=this.rgb().color,e=s[0]*.3+s[1]*.59+s[2]*.11;return ge.rgb(e,e,e)},fade(s){return this.alpha(this.valpha-this.valpha*s)},opaquer(s){return this.alpha(this.valpha+this.valpha*s)},rotate(s){const e=this.hsl();let t=e.color[0];return t=(t+s)%360,t=t<0?360+t:t,e.color[0]=t,e},mix(s,e){if(!s||!s.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof s);const t=s.rgb(),n=this.rgb(),i=e===void 0?.5:e,r=2*i-1,o=t.alpha()-n.alpha(),a=((r*o===-1?r:(r+o)/(1+r*o))+1)/2,l=1-a;return ge.rgb(a*t.red()+l*n.red(),a*t.green()+l*n.green(),a*t.blue()+l*n.blue(),t.alpha()*i+n.alpha()*(1-i))}};for(const s of Object.keys(ye)){if(wa.includes(s))continue;const{channels:e}=ye[s];ge.prototype[s]=function(...t){return this.model===s?new ge(this):t.length>0?new ge(t,s):new ge([...Uy(ye[this.model][s].raw(this.color)),this.valpha],s)},ge[s]=function(...t){let n=t[0];return typeof n=="number"&&(n=Ys(t,e)),new ge(n,s)}}function Vy(s,e){return Number(s.toFixed(e))}function zy(s){return function(e){return Vy(e,s)}}function de(s,e,t){s=Array.isArray(s)?s:[s];for(const n of s)(Js[n]||=[])[e]=t;return s=s[0],function(n){let i;return n!==void 0?(t&&(n=t(n)),i=this[s](),i.color[e]=n,i):(i=this[s]().color[e],t&&(i=t(i)),i)}}function me(s){return function(e){return Math.max(0,Math.min(s,e))}}function Uy(s){return Array.isArray(s)?s:[s]}function Ys(s,e){for(let t=0;t<e;t++)typeof s[t]!="number"&&(s[t]=0);return s}const $y="jp-Terminal",Ky="jp-Terminal-body",qy="jp-sr-only",Gy=350;let Jy=class extends X{constructor(e,t={},n){super(),this._needsResize=!0,this._offsetWidth=-1,this._offsetHeight=-1,this._isReady=!1,this._ready=new it,this._termOpened=!1,this._themeChanged=new U(this),this._escapeHintRequested=new U(this),this._escapePressedOnce=!1,this._escapeResetTimer=null,n=n||se,this._trans=n.load("jupyterlab"),this.session=e,this._options={...Ks.defaultOptions,...t};const{theme:i,...r}=this._options,o={theme:nt.getXTermTheme(i),allowProposedApi:!0,...r};this.addClass($y),this._setThemeAttribute(i),this._terminalId=nt.id++,this.id=`jp-Terminal-${this._terminalId}`,this._escapeInstructionsId=`jp-Terminal-escape-instructions-${this._terminalId}`;const a=document.createElement("p");a.id=this._escapeInstructionsId,a.className=qy,a.textContent=this._trans.__("Press Escape twice to leave terminal focus. Press Enter to return focus to the terminal input."),this.node.appendChild(a);let l="";const c=(d,u)=>{u.type==="stdout"&&u.content&&(l+=u.content[0])};e.messageReceived.connect(c),e.disposed.connect(()=>{this.getOption("closeOnExit")&&this.dispose()},this),nt.createTerminal(o).then(([d,u,h])=>{this._term=d,this._fitAddon=u,this._searchAddon=h,this._initializeTerm(),this.title.label=this._trans.__("Terminal"),this._isReady=!0,this._ready.resolve(),l&&this._term.write(l),e.messageReceived.disconnect(c),e.messageReceived.connect(this._onMessage,this),e.connectionStatus==="connected"?this._initialConnection():e.connectionStatusChanged.connect(this._initialConnection,this),this.update()}).catch(d=>{console.error(`Failed to create a terminal.
437
437
  `,d),this._ready.reject(d)})}get ready(){return this._ready.promise}getOption(e){return this._options[e]}setOption(e,t){if(!(e!=="theme"&&(this._options[e]===t||e==="initialCommand"))){switch(this._options[e]=t,e){case"fontFamily":this._term.options.fontFamily=t;break;case"fontSize":this._term.options.fontSize=t;break;case"lineHeight":this._term.options.lineHeight=t;break;case"screenReaderMode":this._term.options.screenReaderMode=t;break;case"scrollback":this._term.options.scrollback=t;break;case"theme":this._term.options.theme={...nt.getXTermTheme(t)},this._setThemeAttribute(t),this._themeChanged.emit();break;case"macOptionIsMeta":this._term.options.macOptionIsMeta=t;break}this._needsResize=!0,this.update()}}dispose(){this.session.isDisposed||this.getOption("shutdownOnClose")&&this.session.shutdown().catch(e=>{console.error(`Terminal not shut down: ${e}`)}),this.ready.then(()=>{this._term.dispose()}),super.dispose()}async refresh(){!this.isDisposed&&this._isReady&&(await this.session.reconnect(),this._term.clear())}hasSelection(){return!this.isDisposed&&this._isReady?this._term.hasSelection():!1}paste(e){if(!this.isDisposed&&this._isReady)return this._term.paste(e)}getSelection(){return!this.isDisposed&&this._isReady?this._term.getSelection():null}processMessage(e){super.processMessage(e),e.type==="fit-request"&&this.onFitRequest(e)}get searchAddon(){return this._searchAddon}getXTermTheme(){const{theme:e}=this._options;return nt.getXTermTheme(e)}get themeChanged(){return this._themeChanged}get escapeHintRequested(){return this._escapeHintRequested}onAfterAttach(e){this.node.addEventListener("keydown",this,!0),this.update()}onBeforeDetach(e){this.node.removeEventListener("keydown",this,!0),this._clearEscapeResetTimer(),this._escapePressedOnce=!1}onAfterShow(e){this.update()}onResize(e){this._offsetWidth=e.width,this._offsetHeight=e.height,this._needsResize=!0,this.update()}onUpdateRequest(e){var t,n,i,r;!this.isVisible||!this.isAttached||!this._isReady||(this._termOpened||(this._term.open(this.node),(t=this._term.element)===null||t===void 0||t.classList.add(Ky),(n=this._term.textarea)===null||n===void 0||n.setAttribute("aria-describedby",this._escapeInstructionsId),(r=(i=this._term.element)===null||i===void 0?void 0:i.querySelector(".xterm-viewport"))===null||r===void 0||r.setAttribute("aria-describedby",this._escapeInstructionsId),this._termOpened=!0),this._needsResize&&this._resizeTerminal())}onFitRequest(e){const t=X.ResizeMessage.UnknownSize;Ie.sendMessage(this,t)}onActivateRequest(e){var t;(t=this._term)===null||t===void 0||t.focus()}_initialConnection(){this.isDisposed||this.session.connectionStatus==="connected"&&(this.title.label=this._trans.__("Terminal %1",this.session.name),this._setSessionSize(),this._options.initialCommand&&this.session.send({type:"stdin",content:[this._options.initialCommand+"\r"]}),this.session.connectionStatusChanged.disconnect(this._initialConnection,this))}_initializeTerm(){const e=this._term;e.onData(t=>{this.isDisposed||this.session.send({type:"stdin",content:[t]})}),e.onTitleChange(t=>{this.title.label=t}),e.attachCustomKeyEventHandler(t=>t.type==="keydown"&&t.shiftKey&&t.key==="Enter"&&!t.isComposing&&t.keyCode!==229?(t.preventDefault(),this.session.send({type:"stdin",content:[`
438
438
  `]}),!1):fc.IS_MAC?!0:!(t.ctrlKey&&t.key==="c"&&e.hasSelection()||t.ctrlKey&&t.key==="v"&&this._options.pasteWithCtrlV))}_onMessage(e,t){switch(t.type){case"stdout":t.content&&this._term.write(t.content[0]);break;case"disconnect":this._term.write(`\r
439
439
  \r
440
440
  [Finished… Term Session]\r
441
- `);break}}_resizeTerminal(){this._options.autoFit&&this._fitAddon.fit(),this._offsetWidth===-1&&(this._offsetWidth=this.node.offsetWidth),this._offsetHeight===-1&&(this._offsetHeight=this.node.offsetHeight),this._setSessionSize(),this._needsResize=!1}_setSessionSize(){const e=[this._term.rows,this._term.cols,this._offsetHeight,this._offsetWidth];this.isDisposed||this.session.send({type:"set_size",content:e})}_setThemeAttribute(e){this.isDisposed||this.node.setAttribute("data-term-theme",e?e.toLowerCase():"inherit")}_evtKeyDown(e){var t;const n=(t=this._term.element)===null||t===void 0?void 0:t.querySelector(".xterm-viewport"),i=this._term.textarea,r=document.activeElement,o=!!r&&!!n&&(r===n||n.contains(r)),a=!!i&&r===i;if(e.key==="Escape"){if(!a){this._clearEscapeResetTimer(),this._escapePressedOnce=!1;return}if(!this._escapePressedOnce){this._escapePressedOnce=!0,this._scheduleEscapeReset();return}e.preventDefault(),e.stopPropagation(),this._clearEscapeResetTimer(),this._escapePressedOnce=!1,i&&(i.tabIndex=-1),n?.setAttribute("tabindex","0"),n?.focus();return}if(this._clearEscapeResetTimer(),this._escapePressedOnce=!1,o&&e.key==="Enter"){e.preventDefault(),e.stopPropagation(),i&&(i.tabIndex=0,i.focus());return}o&&e.key==="Tab"&&i&&(i.tabIndex=-1)}_scheduleEscapeReset(){this._clearEscapeResetTimer(),this._escapeResetTimer=window.setTimeout(()=>{this._escapePressedOnce=!1,this._escapeHintRequested.emit(),this._escapeResetTimer=null},Gy)}_clearEscapeResetTimer(){this._escapeResetTimer!==null&&(window.clearTimeout(this._escapeResetTimer),this._escapeResetTimer=null)}handleEvent(e){e.type==="keydown"&&this._evtKeyDown(e)}};var nt;(function(s){s.id=0,s.lightTheme={foreground:"#000",background:"#fff",cursor:"#616161",cursorAccent:"#F5F5F5",selectionBackground:"rgba(97, 97, 97, 0.3)",selectionInactiveBackground:"rgba(189, 189, 189, 0.3)",activeMatchBackground:"#ffee58"},s.darkTheme={foreground:"#fff",background:"#000",cursor:"#fff",cursorAccent:"#000",selectionBackground:"rgba(255, 255, 255, 0.3)",selectionInactiveBackground:"rgba(238, 238, 238, 0.3)",activeMatchBackground:"#F57F17"},s.inheritTheme=()=>{const t=getComputedStyle(document.body),n=t.getPropertyValue("--jp-layout-color0").trim();let i="#ffee58";try{ge(n).isDark()&&(i="#F57F17")}catch{}return{foreground:t.getPropertyValue("--jp-ui-font-color0").trim(),background:n,cursor:t.getPropertyValue("--jp-ui-font-color1").trim(),cursorAccent:t.getPropertyValue("--jp-ui-inverse-font-color0").trim(),selectionBackground:t.getPropertyValue("--jp-layout-color3").trim(),selectionInactiveBackground:t.getPropertyValue("--jp-layout-color2").trim(),activeMatchBackground:i}};function e(t){switch(t){case"light":return s.lightTheme;case"dark":return s.darkTheme;default:return s.inheritTheme()}}s.getXTermTheme=e})(nt||(nt={}));(function(s){let e=!1,t,n,i,r,o;function a(){const d=document.createElement("canvas"),u=d.getContext("webgl")||d.getContext("experimental-webgl");try{return u instanceof WebGLRenderingContext}catch{return!1}}function l(d){let u=new o;d.loadAddon(u),e&&u.onContextLoss(h=>{console.debug("WebGL context lost - reinitialize Xtermjs renderer."),u.dispose(),l(d)})}async function c(d){var u;if(!t){e=a();const[b,g,p,w,v]=await Promise.all([V(()=>import("./xterm-Becc8UVi.js").then(y=>y.x),[],import.meta.url),V(()=>import("./addon-fit-DLc9BYJR.js").then(y=>y.a),[],import.meta.url),e?V(()=>import("./addon-webgl-CRb6jnth.js").then(y=>y.a),[],import.meta.url):V(()=>import("./addon-canvas-CMfwSln2.js").then(y=>y.a),[],import.meta.url),V(()=>import("./addon-web-links-DObrvfhk.js").then(y=>y.a),[],import.meta.url),V(()=>import("./addon-search-vS17rSFH.js").then(y=>y.a),[],import.meta.url)]);t=b.Terminal,n=g.FitAddon,o=(u=p.WebglAddon)!==null&&u!==void 0?u:p.CanvasAddon,i=w.WebLinksAddon,r=v.SearchAddon}const h=new t(d);l(h);const m=new n;h.loadAddon(m);const _=new r;return h.loadAddon(new i),h.loadAddon(_),[h,m,_]}s.createTerminal=c})(nt||(nt={}));class Ca{terminal;terminalPanel;constructor(e){const{serverSettings:t,colormode:n,initCode:i}=e;this.terminalPanel=new we,this.terminalPanel.widgets||console.error("BoxPanel not properly initialized"),this.terminalPanel.direction="top-to-bottom",this.terminalPanel.spacing=0,this.terminalPanel.addClass("dla-JupyterLab-Terminal-id"),new Be.TerminalManager({serverSettings:t}).startNew().then(async o=>{o.connectionStatusChanged.connect((a,l)=>{console.log("Jupyter Terminal status",l)}),this.terminal=new Jy(o,{theme:n}),i&&(await this.terminal.ready,this.terminal.session.send({type:"stdin",content:[i]})),this.terminal.title.closable=!0,setTimeout(()=>{try{this.terminalPanel.addWidget(this.terminal)}catch(a){console.error("Error adding terminal widget:",a)}},100)}).catch(o=>{console.error("Failed to create terminal:",o)})}get panel(){return this.terminalPanel}setTheme(e){this.terminal&&this.terminal.setOption("theme",e)}}const Yy=({height:s="100%",colormode:e="dark",serverSettings:t,...n})=>{const i=Qr(),{serverSettings:r}=Je({terminals:!0}),o=t??r,[a,l]=R.useState();return R.useEffect(()=>{if(o){const c=new Ca({serverSettings:o,height:s,colormode:e,...n});i.setAdapter(c),l(c)}},[o]),R.useEffect(()=>{a&&a.setTheme(e)},[a,e]),a?f.jsx(ee,{sx:{"& .lm-BoxPanel":{height:`${s} !important`}},children:f.jsx(na,{children:a.panel})}):f.jsx(f.Fragment,{})},Xy=s=>{const e={border:"none",":focus-within":{borderColor:"inherit",outline:"none",boxShadow:"inset 0 0 0 var(--jp-border-width) var(--jp-input-active-box-shadow-color), inset 0 0 0 3px var(--jp-input-active-box-shadow-color)"}};return f.jsx(mc,{sx:e,...s})};function Zy(s){const{message:e}=s;return f.jsx(ee,{sx:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"40px",zIndex:10999},children:e?f.jsxs(f.Fragment,{children:[f.jsx(ee,{mr:3,children:f.jsx(sn,{size:"large"})}),f.jsx(ee,{children:f.jsx(Er,{sx:{fontSize:5,color:"white"},children:e})})]}):f.jsx(sn,{size:"large"})})}function Qy(){return f.jsx(ee,{sx:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"40px"},children:f.jsx(sn,{})})}const Ea=s=>{const{nbformat:e,nbformatUrl:t}=s,[n,i]=R.useState();return R.useEffect(()=>{e&&i(e),t&&fetch(t).then(r=>r.text()).then(r=>{i(JSON.parse(r))})},[e,t]),f.jsx(f.Fragment,{children:n?.cells.map(r=>(r.metadata.editable=!1,f.jsx("div",{children:f.jsx(cu,{cell:r,languageInfo:n.metadata.language_info})},r.id?.toString()||Kn())))})};function eb({doc:s,parent:e}){const t=[du,pc(),ts.allowMultipleSelections.of(!0),ts.readOnly.of(!0),_c(),gc(),yc(),bc(),vc.of([...wc,...Cc]),Mi.updateListener.of(i=>{})],n=ts.create({doc:s,extensions:t});return new Mi({state:n,parent:e})}const tb=[{cell_type:"code",execution_count:1,metadata:{},outputs:[{data:{"text/plain":["2"]},execution_count:1,metadata:{},output_type:"execute_result"}],source:["1+1"]},{cell_type:"markdown",metadata:{},source:[`$$ \\frac{a}{b} $$
441
+ `);break}}_resizeTerminal(){this._options.autoFit&&this._fitAddon.fit(),this._offsetWidth===-1&&(this._offsetWidth=this.node.offsetWidth),this._offsetHeight===-1&&(this._offsetHeight=this.node.offsetHeight),this._setSessionSize(),this._needsResize=!1}_setSessionSize(){const e=[this._term.rows,this._term.cols,this._offsetHeight,this._offsetWidth];this.isDisposed||this.session.send({type:"set_size",content:e})}_setThemeAttribute(e){this.isDisposed||this.node.setAttribute("data-term-theme",e?e.toLowerCase():"inherit")}_evtKeyDown(e){var t;const n=(t=this._term.element)===null||t===void 0?void 0:t.querySelector(".xterm-viewport"),i=this._term.textarea,r=document.activeElement,o=!!r&&!!n&&(r===n||n.contains(r)),a=!!i&&r===i;if(e.key==="Escape"){if(!a){this._clearEscapeResetTimer(),this._escapePressedOnce=!1;return}if(!this._escapePressedOnce){this._escapePressedOnce=!0,this._scheduleEscapeReset();return}e.preventDefault(),e.stopPropagation(),this._clearEscapeResetTimer(),this._escapePressedOnce=!1,i&&(i.tabIndex=-1),n?.setAttribute("tabindex","0"),n?.focus();return}if(this._clearEscapeResetTimer(),this._escapePressedOnce=!1,o&&e.key==="Enter"){e.preventDefault(),e.stopPropagation(),i&&(i.tabIndex=0,i.focus());return}o&&e.key==="Tab"&&i&&(i.tabIndex=-1)}_scheduleEscapeReset(){this._clearEscapeResetTimer(),this._escapeResetTimer=window.setTimeout(()=>{this._escapePressedOnce=!1,this._escapeHintRequested.emit(),this._escapeResetTimer=null},Gy)}_clearEscapeResetTimer(){this._escapeResetTimer!==null&&(window.clearTimeout(this._escapeResetTimer),this._escapeResetTimer=null)}handleEvent(e){e.type==="keydown"&&this._evtKeyDown(e)}};var nt;(function(s){s.id=0,s.lightTheme={foreground:"#000",background:"#fff",cursor:"#616161",cursorAccent:"#F5F5F5",selectionBackground:"rgba(97, 97, 97, 0.3)",selectionInactiveBackground:"rgba(189, 189, 189, 0.3)",activeMatchBackground:"#ffee58"},s.darkTheme={foreground:"#fff",background:"#000",cursor:"#fff",cursorAccent:"#000",selectionBackground:"rgba(255, 255, 255, 0.3)",selectionInactiveBackground:"rgba(238, 238, 238, 0.3)",activeMatchBackground:"#F57F17"},s.inheritTheme=()=>{const t=getComputedStyle(document.body),n=t.getPropertyValue("--jp-layout-color0").trim();let i="#ffee58";try{ge(n).isDark()&&(i="#F57F17")}catch{}return{foreground:t.getPropertyValue("--jp-ui-font-color0").trim(),background:n,cursor:t.getPropertyValue("--jp-ui-font-color1").trim(),cursorAccent:t.getPropertyValue("--jp-ui-inverse-font-color0").trim(),selectionBackground:t.getPropertyValue("--jp-layout-color3").trim(),selectionInactiveBackground:t.getPropertyValue("--jp-layout-color2").trim(),activeMatchBackground:i}};function e(t){switch(t){case"light":return s.lightTheme;case"dark":return s.darkTheme;default:return s.inheritTheme()}}s.getXTermTheme=e})(nt||(nt={}));(function(s){let e=!1,t,n,i,r,o;function a(){const d=document.createElement("canvas"),u=d.getContext("webgl")||d.getContext("experimental-webgl");try{return u instanceof WebGLRenderingContext}catch{return!1}}function l(d){let u=new o;d.loadAddon(u),e&&u.onContextLoss(h=>{console.debug("WebGL context lost - reinitialize Xtermjs renderer."),u.dispose(),l(d)})}async function c(d){var u;if(!t){e=a();const[b,g,p,w,v]=await Promise.all([V(()=>import("./xterm-Becc8UVi.js").then(y=>y.x),[],import.meta.url),V(()=>import("./addon-fit-DLc9BYJR.js").then(y=>y.a),[],import.meta.url),e?V(()=>import("./addon-webgl-CRb6jnth.js").then(y=>y.a),[],import.meta.url):V(()=>import("./addon-canvas-CMfwSln2.js").then(y=>y.a),[],import.meta.url),V(()=>import("./addon-web-links-DObrvfhk.js").then(y=>y.a),[],import.meta.url),V(()=>import("./addon-search-vS17rSFH.js").then(y=>y.a),[],import.meta.url)]);t=b.Terminal,n=g.FitAddon,o=(u=p.WebglAddon)!==null&&u!==void 0?u:p.CanvasAddon,i=w.WebLinksAddon,r=v.SearchAddon}const h=new t(d);l(h);const m=new n;h.loadAddon(m);const _=new r;return h.loadAddon(new i),h.loadAddon(_),[h,m,_]}s.createTerminal=c})(nt||(nt={}));class Ca{terminal;terminalPanel;constructor(e){const{serverSettings:t,colormode:n,initCode:i}=e;this.terminalPanel=new we,this.terminalPanel.widgets||console.error("BoxPanel not properly initialized"),this.terminalPanel.direction="top-to-bottom",this.terminalPanel.spacing=0,this.terminalPanel.addClass("dla-JupyterLab-Terminal-id"),new Be.TerminalManager({serverSettings:t}).startNew().then(async o=>{o.connectionStatusChanged.connect((a,l)=>{console.log("Jupyter Terminal status",l)}),this.terminal=new Jy(o,{theme:n}),i&&(await this.terminal.ready,this.terminal.session.send({type:"stdin",content:[i]})),this.terminal.title.closable=!0,setTimeout(()=>{try{this.terminalPanel.addWidget(this.terminal)}catch(a){console.error("Error adding terminal widget:",a)}},100)}).catch(o=>{console.error("Failed to create terminal:",o)})}get panel(){return this.terminalPanel}setTheme(e){this.terminal&&this.terminal.setOption("theme",e)}}const Yy=({height:s="100%",colormode:e="dark",serverSettings:t,...n})=>{const i=Qr(),{serverSettings:r}=Je({terminals:!0}),o=t??r,[a,l]=R.useState();return R.useEffect(()=>{if(o){const c=new Ca({serverSettings:o,height:s,colormode:e,...n});i.setAdapter(c),l(c)}},[o]),R.useEffect(()=>{a&&a.setTheme(e)},[a,e]),a?f.jsx(ee,{sx:{"& .lm-BoxPanel":{height:`${s} !important`}},children:f.jsx(na,{children:a.panel})}):f.jsx(f.Fragment,{})},Xy=s=>{const e={border:"none",":focus-within":{borderColor:"inherit",outline:"none",boxShadow:"inset 0 0 0 var(--jp-border-width) var(--jp-input-active-box-shadow-color), inset 0 0 0 3px var(--jp-input-active-box-shadow-color)"}};return f.jsx(mc,{sx:e,...s})};function Zy(s){const{message:e}=s;return f.jsx(ee,{sx:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"40px",zIndex:10999},children:e?f.jsxs(f.Fragment,{children:[f.jsx(ee,{mr:3,children:f.jsx(sn,{size:"large"})}),f.jsx(ee,{children:f.jsx(Er,{sx:{fontSize:5,color:"white"},children:e})})]}):f.jsx(sn,{size:"large"})})}function Qy(){return f.jsx(ee,{sx:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"40px"},children:f.jsx(sn,{})})}const Ea=s=>{const{nbformat:e,nbformatUrl:t}=s,[n,i]=R.useState();return R.useEffect(()=>{e&&i(e),t&&fetch(t).then(r=>r.text()).then(r=>{i(JSON.parse(r))})},[e,t]),f.jsx(f.Fragment,{children:n?.cells.map(r=>(r.metadata.editable=!1,f.jsx("div",{children:f.jsx(cu,{cell:r,languageInfo:n.metadata.language_info})},r.id?.toString()||Kn())))})};function eb({doc:s,parent:e}){const t=[du,pc(),ts.allowMultipleSelections.of(!0),ts.readOnly.of(!0),_c(),gc(),yc(),bc(),vc.of([...wc,...Cc]),Di.updateListener.of(i=>{})],n=ts.create({doc:s,extensions:t});return new Di({state:n,parent:e})}const tb=[{cell_type:"code",execution_count:1,metadata:{},outputs:[{data:{"text/plain":["2"]},execution_count:1,metadata:{},output_type:"execute_result"}],source:["1+1"]},{cell_type:"markdown",metadata:{},source:[`$$ \\frac{a}{b} $$
442
442
  `,`
443
443
  `,"$$ \\underbrace{a+b}_{\\text{TEST}} $$"]},{cell_type:"code",execution_count:1,metadata:{datalayer:{_about:"AI Platform for Data Analysis"}},outputs:[{data:{"text/plain":["4"]},execution_count:1,metadata:{},output_type:"execute_result"}],source:[`# I am a Python cell.
444
444
  `,"print('2+2')"]},{cell_type:"code",execution_count:1,metadata:{},outputs:[{data:{"text/plain":[]},execution_count:1,metadata:{},output_type:"execute_result"}],source:[`# import micropip
@@ -447,4 +447,4 @@ Writable: %1`,i.writable),n.title=$,n.setAttribute("data-file-type",b),i.name.st
447
447
  `,`w = IntSlider()
448
448
  `,"w"]},{cell_type:"code",execution_count:1,metadata:{},outputs:[{data:{"text/plain":[]},execution_count:1,metadata:{},output_type:"execute_result"}],source:["w"]},{cell_type:"code",execution_count:1,metadata:{datalayer:{sql:!0}},outputs:[{data:{"text/plain":[""]},execution_count:1,metadata:{},output_type:"execute_result"}],source:[`-- I am a SQL cell.
449
449
  `,"SELECT * FROM LOGS"]},{cell_type:"code",execution_count:null,metadata:{},outputs:[],source:[]}],nb={kernelspec:{display_name:"Python (ipykernel)",language:"python",name:"python"},language_info:{codemirror_mode:{name:"ipython",version:3},file_extension:".py",mimetype:"text/x-python",name:"python",nbconvert_exporter:"python",pygments_lexer:"ipython3",version:"3.10.4"}},sb=4,ib=4,rb={cells:tb,metadata:nb,nbformat:sb,nbformat_minor:ib},ob=()=>{const{serviceManager:s,defaultKernel:e}=Je({startDefaultKernel:!0}),t=R.useMemo(()=>[new io({factory:ro})],[]);return f.jsx(f.Fragment,{children:s&&e&&f.jsx(oo,{kernel:e,serviceManager:s,nbformat:rb,id:"notebook-id",cellSidebarMargin:60,height:"calc(100vh - 2.6rem)",extensions:t})})},ab={version_major:2,version_minor:0,model_id:"8621699ecc804983a612f09b7dfe806b"},lb={version_major:2,version_minor:0,state:{"8621699ecc804983a612f09b7dfe806b":{model_name:"VBoxModel",model_module:"@jupyter-widgets/controls",model_module_version:"1.0.0",state:{_view_module_version:"1.0.0",children:["IPY_MODEL_a8b1ae50aada4d929397b907115bfc2c","IPY_MODEL_289e54d14b7c4c6d8ac18b4c86ab514c","IPY_MODEL_965bbfeaddd74b9baa488c7f6ac13027"],_model_module_version:"1.0.0",layout:"IPY_MODEL_d7d14e74f61f4b3bb5f53a713bcadced",_view_count:1}},"961d612211fe4c64a70f48942d885c14":{model_name:"LayoutModel",model_module:"@jupyter-widgets/base",model_module_version:"1.0.0",state:{_model_module_version:"1.0.0",_view_module_version:"1.0.0",_view_count:1}},"564e75ddea4c4ea0a32c4bd39ed0ed6d":{model_name:"SliderStyleModel",model_module:"@jupyter-widgets/controls",model_module_version:"1.0.0",state:{_model_module_version:"1.0.0",_view_module_version:"1.0.0",_view_count:1}},a8b1ae50aada4d929397b907115bfc2c:{model_name:"IntSliderModel",model_module:"@jupyter-widgets/controls",model_module_version:"1.0.0",state:{style:"IPY_MODEL_564e75ddea4c4ea0a32c4bd39ed0ed6d",_view_module_version:"1.0.0",max:200,value:100,_model_module_version:"1.0.0",layout:"IPY_MODEL_961d612211fe4c64a70f48942d885c14",_view_count:1}},b63481ca8b7943aa85d097a114a931f5:{model_name:"LayoutModel",model_module:"@jupyter-widgets/base",model_module_version:"1.0.0",state:{_model_module_version:"1.0.0",_view_module_version:"1.0.0",_view_count:1}},d86e0cb348eb48bf97f14906a9406731:{model_name:"SliderStyleModel",model_module:"@jupyter-widgets/controls",model_module_version:"1.0.0",state:{_model_module_version:"1.0.0",_view_module_version:"1.0.0",_view_count:1}},"289e54d14b7c4c6d8ac18b4c86ab514c":{model_name:"IntSliderModel",model_module:"@jupyter-widgets/controls",model_module_version:"1.0.0",state:{style:"IPY_MODEL_d86e0cb348eb48bf97f14906a9406731",_view_module_version:"1.0.0",value:40,_model_module_version:"1.0.0",layout:"IPY_MODEL_b63481ca8b7943aa85d097a114a931f5",_view_count:1}},bb589d8dc365404b94e73a153407128f:{model_name:"LayoutModel",model_module:"@jupyter-widgets/base",model_module_version:"1.0.0",state:{_model_module_version:"1.0.0",_view_module_version:"1.0.0",_view_count:1}},"19a24d8ea5a248be8db79790290ae2a1":{model_name:"ButtonStyleModel",model_module:"@jupyter-widgets/controls",model_module_version:"1.0.0",state:{_model_module_version:"1.0.0",_view_module_version:"1.0.0",_view_count:1}},"965bbfeaddd74b9baa488c7f6ac13027":{model_name:"ButtonModel",model_module:"@jupyter-widgets/controls",model_module_version:"1.0.0",state:{style:"IPY_MODEL_19a24d8ea5a248be8db79790290ae2a1",_view_module_version:"1.0.0",icon:"legal",_model_module_version:"1.0.0",layout:"IPY_MODEL_bb589d8dc365404b94e73a153407128f",_view_count:1}},"6edd9d3360cc47c8aceff0ba11edeca9":{model_name:"DirectionalLinkModel",model_module:"@jupyter-widgets/controls",model_module_version:"1.0.0",state:{_model_module_version:"1.0.0",target:["IPY_MODEL_289e54d14b7c4c6d8ac18b4c86ab514c","max"],source:["IPY_MODEL_a8b1ae50aada4d929397b907115bfc2c","value"],_view_module_version:"1.0.0",_view_name:""}},d7d14e74f61f4b3bb5f53a713bcadced:{model_name:"LayoutModel",model_module:"@jupyter-widgets/base",model_module_version:"1.0.0",state:{_model_module_version:"1.0.0",_view_module_version:"1.0.0",_view_count:1}}}},cb=()=>f.jsx(f.Fragment,{children:f.jsx(ya,{view:ab,state:lb})}),db=()=>f.jsx(f.Fragment,{children:f.jsx(Ea,{nbformatUrl:"https://raw.githubusercontent.com/anissa111/matplotlib-tutorial/main/notebooks/01-basic-matplotlib-tutorial.ipynb",outputs:!0})}),ub=s=>{const[e,t]=R.useState(1);return f.jsx(f.Fragment,{children:f.jsxs(ee,{sx:{display:"flex"},children:[f.jsx(ee,{children:f.jsxs(Pt,{sx:{"> *":{paddingTop:"0px"}},children:[f.jsx(Pt.Item,{"aria-current":e===1?"page":void 0,onClick:n=>t(1),children:"File Browser"}),f.jsx(Pt.Item,{"aria-current":e===2?"page":void 0,onClick:n=>t(2),children:"Cell"}),f.jsx(Pt.Item,{"aria-current":e===3?"page":void 0,onClick:n=>t(3),children:"Notebook"}),f.jsx(Pt.Item,{"aria-current":e===4?"page":void 0,onClick:n=>t(4),children:"IPyWidgets"}),f.jsx(Pt.Item,{"aria-current":e===5?"page":void 0,onClick:n=>t(5),children:"Viewer"})]})}),f.jsxs(ee,{ml:3,sx:{width:"100%"},children:[e===1&&f.jsx(F_,{}),e===2&&f.jsx(J_,{}),e===3&&f.jsx(ob,{}),e===4&&f.jsx(cb,{}),e===5&&f.jsx(db,{})]})]})})},hb=s=>{const{app:e}=s,[t,n]=R.useState(1),[i,r]=R.useState("");return R.useEffect(()=>{eo(Be.ServerConnection.makeSettings(),"jupyter_react","config").then(o=>{r(o.version)}).catch(o=>{console.error(`Error while accessing the jupyter server jupyter_react extension.
450
- ${o}`)})}),f.jsx(f.Fragment,{children:f.jsxs(to,{loadJupyterLabCss:!1,children:[f.jsx(ee,{mb:3,style:{minWidth:200},children:f.jsxs(ns,{"aria-label":"jupyter-react",children:[f.jsx(ns.Item,{"aria-current":t===1?"page":void 0,icon:xh,onSelect:o=>{o.preventDefault(),n(1)},children:"Components"}),f.jsx(ns.Item,{"aria-current":t===2?"page":void 0,icon:Th,onSelect:o=>{o.preventDefault(),n(2)},children:"About"})]})}),f.jsxs(ee,{m:3,children:[t===1&&f.jsx(ub,{app:e}),t===2&&f.jsx(k_,{version:i})]})]})})};function xa(s,e){return e==="json"?s:Ec(s)}class fb{documentId;store;constructor(e,t){this.documentId=e,this.store=t}async execute(e,t){const n=this.store[e];if(typeof n!="function")throw new Error(`Store method '${e}' not found or not a function`);const i=typeof t=="object"&&t!==null?{id:this.documentId,...t}:{id:this.documentId};return await n.call(this.store,i)}}class mb{async execute(e,t,n){const i=await e.execute(t,n);return xa(i,n.format)}}const lv=Object.freeze(Object.defineProperty({__proto__:null,ANSWER_MARKER:Pc,BuilderManagerLess:Ac,Button:Y_,COLLABORATION_ROOM_URL_PATH:Uo,COLLABORATION_SESSION_URL_PATH:$o,Cell:no,CellAdapter:uu,CellCommands:hu,CellMetadataEditor:ku,CellRowSkeleton:Uu,CellSidebar:Fu,CellSidebarButton:ro,CellSidebarExtension:io,CellSidebarRun:xy,ClassicWidgetManager:fu,CodeMirrorDatalayerEditor:mu,CodeMirrorEditor:pu,CodeMirrorOutputToolbar:_u,CollaborationProvider:b_,CollaborationProviderBase:vi,get CollaborationStatus(){return Ce},Commands:Z_,Console:fg,ConsoleAdapter:ra,ContentsManagerLess:Rc,Countdown:Ei,CountdownInputPrompt:wy,CountdownOutputPrompt:Ey,DATALAYER_CELL_SIDEBAR_CLASS_NAME:so,DEFAULT_API_KERNEL_PREFIX_URL:Ic,DEFAULT_JUPYTER_SERVER_TOKEN:Lc,DEFAULT_JUPYTER_SERVER_URL:Oc,DEFAULT_KERNEL_NAME:kc,DEFAULT_VARIANT:Fc,DefaultExecutor:fb,Dialog:mg,DialogAdapter:oa,EditorHeaderSkeleton:$u,EventsManagerLess:Dc,get ExecutionPhase(){return Mc},FileBrowser:ta,FileManagerJupyterLab:sy,HELPER_NAME:Nc,HTMLManager:gu,JupyterCollaborationProvider:L_,JupyterLabApp:by,JupyterLabAppAdapter:Zn,JupyterLabAppCorePlugins:Ws,JupyterLabAppMinimumPlugins:iy,JupyterLabCss:jc,JupyterReact:hb,JupyterReactContentFactory:Py,JupyterReactNotebookModelFactory:Ay,JupyterReactTheme:to,JupyterServices:ko,KERNEL_HELPER_SOURCE:Bc,KERNEL_STATES:Wc,KERNEL_STATE_LABELS:Hc,KERNEL_STATE_VISUALS:Vc,KERNEL_VARIABLES_MARKER:Ph,KERNEL_VARIABLE_REPR_LIMIT:Ah,Kernel:zc,KernelActionMenu:yu,KernelDetective:Rp,KernelExecutor:Uc,KernelIndicator:$c,KernelInspector:r_,KernelLauncher:a_,KernelLogs:o_,KernelManagerLess:Kc,KernelProgressBar:bu,KernelSelector:c_,KernelSpyModel:Ho,KernelSpyView:zo,KernelUsage:p_,KernelVariableRenderers:Rh,KernelVariableRepr:Ih,KernelVariableTableView:Lh,KernelVariables:Oh,KernelVariablesError:kh,KernelWidgetManager:Zh,Kernels:l_,KernelspecManagerLess:qc,LabWidgetManager:Qh,Loader:Zy,Lumino:Vt,LuminoBox:na,LuminoDetached:sa,MIME_TYPE:vu,MarimoReactive:Gc,MessageLogView:Vo,NOTEBOOK_TOOLBAR_ITEM_KEYS:rf,NOTEBOOK_TOOLBAR_ITEM_ORDERS:of,NbConvertManagerLess:Jc,get NbGraderType(){return Du},NoOpCollaborationProvider:O_,Notebook:oo,NotebookAdapter:Mu,NotebookBase:Nu,NotebookCommandIds:Zr,NotebookPanelProvider:Yc,NotebookSkeleton:Ku,NotebookToolbar:af,OperationRunner:mb,Output:wu,OutputAdapter:Cu,OutputIPyWidgets:ya,OutputRenderer:Eu,OutputViewer:xu,OutputViewerAdapter:Tu,PYTHON_CELL_MIMETYPE:Ty,PYTHON_KERNEL_VARIABLES_SNIPPET:Fh,ReactPortalWidget:Xn,RenderedPlotly:Su,SKELETON_COLOR_VARIABLE:qu,SQL_CELL_MIMETYPE:_a,SemVerCache:eh,ServiceManagerLess:Xc,SessionManagerLess:Zc,SettingManagerLess:Qc,Settings:Oy,SkeletonRegion:Gu,SpinnerCentered:Qy,Terminal:Yy,TerminalAdapter:Ca,TerminalManagerLess:ed,TextInput:Xy,ThreadIterator:Ft,UseSignal:q_,UserManagerLess:td,VDomModel:G_,VDomRenderer:K_,Viewer:Ea,WIDGET_MIMETYPE:rh,WIDGET_STATE_MIMETYPE:th,WIDGET_VIEW_MIMETYPE:nh,WidgetLabRenderer:ef,WidgetManager:tf,WidgetRenderer:oh,WorkspaceManagerLess:nd,addNotebookCommands:sd,asObservable:$_,cellSourceAsString:id,cellsStore:rd,codeMirrorTheme:Pu,consoleStore:od,createLiteServer:ad,createLiteServiceManager:Tc,createServerSettings:ld,createView:eb,deleteCellsOperation:cd,deleteCellsTool:dd,disableKernelReconnect:ud,disposeKernelConnections:hd,disposeServiceManager:fd,ensureJupyterAuth:md,ensureJupyterConfig:pd,execute:Au,executeCodeOperation:_d,executeCodeTool:gd,executeSilently:Dh,fallbackKernelVariableRenderer:Mh,formatBytes:Nh,formatResponse:xa,getCookie:yd,getJupyterServerToken:bd,getJupyterServerUrl:vd,getKernelIndicatorMeta:wd,getMarked:ah,getNbGraderType:ju,insertCellOperation:Cd,insertCellTool:Ed,inspectKernelVariable:jh,isAnyCellRunning:xd,isReactiveVariant:Td,isSQLCell:ga,isServedByJupyterLab:Sd,isVariableName:Bh,jpCssToColor:sp,jupyterLabTheme:Pd,jupyterReactStore:Sc,kernelConnectionExecutor:Wh,kernelVariableExtent:Hh,kernelVariableRenderers:Vh,kernelVariablesLanguage:zh,kernelVariablesPayload:Uh,kernelsStore:Ad,listKernelVariables:$h,liteContents:rp,liteKernel:op,liteLocalforage:ap,liteServer:ip,liteSession:lp,loadJupyterConfig:xc,loadJupyterLabCss:Rd,newUlid:Id,newUuid:Kn,notebookStore:Ld,notebookToolDefinitions:Od,notebookToolOperations:kd,notebookTools:Fd,outputsAsString:Dd,outputsStore:Md,parseKernelVariableDetails:Kh,parseKernelVariables:qh,pythonKernelVariablesCode:Gh,readAllCellsOperation:Nd,readAllCellsTool:jd,readCellOperation:Bd,readCellTool:Wd,refreshJupyterLabPortalTheme:Hd,registerKernelVariablesLanguage:Jh,remoteUserCursors:Bu,renderKernelStateGlyph:Vd,renderWidgets:sh,rendererFactory:Ru,requestAPI:eo,requestJupyterCollaborationSession:Ko,requireLoader:ih,resetJupyterConfig:zd,runCellOperation:Ud,runCellTool:$d,setJupyterServerToken:Kd,setJupyterServerUrl:qd,skeletonColor:Ju,sleep:Gd,supportsKernelVariables:Yh,syncJupyterLabPortalTheme:Jd,terminalStore:Yd,toKernelState:Xd,toKernelVariable:Xh,updateCellOperation:Zd,updateCellTool:Qd,useCellsStore:eu,useCollaboration:wi,useCollaborationStatus:v_,useConsoleStore:Jr,useIsCollaborationConnected:w_,useJupyter:Je,useJupyterLabCssLoaded:tu,useJupyterReactColormode:nu,useJupyterReactStore:Xr,useJupyterReactStoreFromProps:su,useKernelId:Wu,useKernelsStore:iu,useNotebookModel:Hu,useNotebookStore:ru,useNotebookToolbarItems:lf,useOutputsStore:ou,usePrimerThemeBridge:Sh,useTerminalStore:Qr,validateWithZod:au,watchFirstPaint:Vu,withAlpha:Yu,zodToToolParameters:lu},Symbol.toStringTag,{value:"Module"}));export{aa as D,Xg as F,Ap as I,Hs as J,Us as L,Wt as M,Pp as S,ev as a,tv as b,iv as c,rv as d,py as e,ma as f,ov as g,$e as h,zs as i,sv as j,dr as k,qg as l,nv as m,wg as n,xp as o,Ht as p,ty as q,lv as r};
450
+ ${o}`)})}),f.jsx(f.Fragment,{children:f.jsxs(to,{loadJupyterLabCss:!1,children:[f.jsx(ee,{mb:3,style:{minWidth:200},children:f.jsxs(ns,{"aria-label":"jupyter-react",children:[f.jsx(ns.Item,{"aria-current":t===1?"page":void 0,icon:xh,onSelect:o=>{o.preventDefault(),n(1)},children:"Components"}),f.jsx(ns.Item,{"aria-current":t===2?"page":void 0,icon:Th,onSelect:o=>{o.preventDefault(),n(2)},children:"About"})]})}),f.jsxs(ee,{m:3,children:[t===1&&f.jsx(ub,{app:e}),t===2&&f.jsx(k_,{version:i})]})]})})};function xa(s,e){return e==="json"?s:Ec(s)}class fb{documentId;store;constructor(e,t){this.documentId=e,this.store=t}async execute(e,t){const n=this.store[e];if(typeof n!="function")throw new Error(`Store method '${e}' not found or not a function`);const i=typeof t=="object"&&t!==null?{id:this.documentId,...t}:{id:this.documentId};return await n.call(this.store,i)}}class mb{async execute(e,t,n){const i=await e.execute(t,n);return xa(i,n.format)}}const lv=Object.freeze(Object.defineProperty({__proto__:null,ANSWER_MARKER:Pc,BuilderManagerLess:Ac,Button:Y_,COLLABORATION_ROOM_URL_PATH:Uo,COLLABORATION_SESSION_URL_PATH:$o,Cell:no,CellAdapter:uu,CellCommands:hu,CellMetadataEditor:ku,CellRowSkeleton:Uu,CellSidebar:Fu,CellSidebarButton:ro,CellSidebarExtension:io,CellSidebarRun:xy,ClassicWidgetManager:fu,CodeMirrorDatalayerEditor:mu,CodeMirrorEditor:pu,CodeMirrorOutputToolbar:_u,CollaborationProvider:b_,CollaborationProviderBase:vi,get CollaborationStatus(){return Ce},Commands:Z_,Console:fg,ConsoleAdapter:ra,ContentsManagerLess:Rc,Countdown:Ei,CountdownInputPrompt:wy,CountdownOutputPrompt:Ey,DATALAYER_CELL_SIDEBAR_CLASS_NAME:so,DEFAULT_API_KERNEL_PREFIX_URL:Ic,DEFAULT_JUPYTER_SERVER_TOKEN:Lc,DEFAULT_JUPYTER_SERVER_URL:Oc,DEFAULT_KERNEL_NAME:kc,DEFAULT_VARIANT:Fc,DefaultExecutor:fb,Dialog:mg,DialogAdapter:oa,EditorHeaderSkeleton:$u,EventsManagerLess:Mc,get ExecutionPhase(){return Dc},FileBrowser:ta,FileManagerJupyterLab:sy,HELPER_NAME:Nc,HTMLManager:gu,JupyterCollaborationProvider:L_,JupyterLabApp:by,JupyterLabAppAdapter:Zn,JupyterLabAppCorePlugins:Ws,JupyterLabAppMinimumPlugins:iy,JupyterLabCss:jc,JupyterReact:hb,JupyterReactContentFactory:Py,JupyterReactNotebookModelFactory:Ay,JupyterReactTheme:to,JupyterServices:ko,KERNEL_HELPER_SOURCE:Bc,KERNEL_STATES:Wc,KERNEL_STATE_LABELS:Hc,KERNEL_STATE_VISUALS:Vc,KERNEL_VARIABLES_MARKER:Ph,KERNEL_VARIABLE_REPR_LIMIT:Ah,Kernel:zc,KernelActionMenu:yu,KernelDetective:Rp,KernelExecutor:Uc,KernelIndicator:$c,KernelInspector:r_,KernelLauncher:a_,KernelLogs:o_,KernelManagerLess:Kc,KernelProgressBar:bu,KernelSelector:c_,KernelSpyModel:Ho,KernelSpyView:zo,KernelUsage:p_,KernelVariableRenderers:Rh,KernelVariableRepr:Ih,KernelVariableTableView:Lh,KernelVariables:Oh,KernelVariablesError:kh,KernelWidgetManager:Zh,Kernels:l_,KernelspecManagerLess:qc,LabWidgetManager:Qh,Loader:Zy,Lumino:Vt,LuminoBox:na,LuminoDetached:sa,MIME_TYPE:vu,MarimoReactive:Gc,MessageLogView:Vo,NOTEBOOK_TOOLBAR_ITEM_KEYS:rf,NOTEBOOK_TOOLBAR_ITEM_ORDERS:of,NbConvertManagerLess:Jc,get NbGraderType(){return Mu},NoOpCollaborationProvider:O_,Notebook:oo,NotebookAdapter:Du,NotebookBase:Nu,NotebookCommandIds:Zr,NotebookPanelProvider:Yc,NotebookSkeleton:Ku,NotebookToolbar:af,OperationRunner:mb,Output:wu,OutputAdapter:Cu,OutputIPyWidgets:ya,OutputRenderer:Eu,OutputViewer:xu,OutputViewerAdapter:Tu,PYTHON_CELL_MIMETYPE:Ty,PYTHON_KERNEL_VARIABLES_SNIPPET:Fh,ReactPortalWidget:Xn,RenderedPlotly:Su,SKELETON_COLOR_VARIABLE:qu,SQL_CELL_MIMETYPE:_a,SemVerCache:eh,ServiceManagerLess:Xc,SessionManagerLess:Zc,SettingManagerLess:Qc,Settings:Oy,SkeletonRegion:Gu,SpinnerCentered:Qy,Terminal:Yy,TerminalAdapter:Ca,TerminalManagerLess:ed,TextInput:Xy,ThreadIterator:Ft,UseSignal:q_,UserManagerLess:td,VDomModel:G_,VDomRenderer:K_,Viewer:Ea,WIDGET_MIMETYPE:rh,WIDGET_STATE_MIMETYPE:th,WIDGET_VIEW_MIMETYPE:nh,WidgetLabRenderer:ef,WidgetManager:tf,WidgetRenderer:oh,WorkspaceManagerLess:nd,addNotebookCommands:sd,asObservable:$_,cellSourceAsString:id,cellsStore:rd,codeMirrorTheme:Pu,consoleStore:od,createLiteServer:ad,createLiteServiceManager:Tc,createServerSettings:ld,createView:eb,deleteCellsOperation:cd,deleteCellsTool:dd,disableKernelReconnect:ud,disposeKernelConnections:hd,disposeServiceManager:fd,ensureJupyterAuth:md,ensureJupyterConfig:pd,execute:Au,executeCodeOperation:_d,executeCodeTool:gd,executeSilently:Mh,fallbackKernelVariableRenderer:Dh,formatBytes:Nh,formatResponse:xa,getCookie:yd,getJupyterServerToken:bd,getJupyterServerUrl:vd,getKernelIndicatorMeta:wd,getMarked:ah,getNbGraderType:ju,insertCellOperation:Cd,insertCellTool:Ed,inspectKernelVariable:jh,isAnyCellRunning:xd,isReactiveVariant:Td,isSQLCell:ga,isServedByJupyterLab:Sd,isVariableName:Bh,jpCssToColor:sp,jupyterLabTheme:Pd,jupyterReactStore:Sc,kernelConnectionExecutor:Wh,kernelVariableExtent:Hh,kernelVariableRenderers:Vh,kernelVariablesLanguage:zh,kernelVariablesPayload:Uh,kernelsStore:Ad,listKernelVariables:$h,liteContents:rp,liteKernel:op,liteLocalforage:ap,liteServer:ip,liteSession:lp,loadJupyterConfig:xc,loadJupyterLabCss:Rd,newUlid:Id,newUuid:Kn,notebookStore:Ld,notebookToolDefinitions:Od,notebookToolOperations:kd,notebookTools:Fd,outputsAsString:Md,outputsStore:Dd,parseKernelVariableDetails:Kh,parseKernelVariables:qh,pythonKernelVariablesCode:Gh,readAllCellsOperation:Nd,readAllCellsTool:jd,readCellOperation:Bd,readCellTool:Wd,refreshJupyterLabPortalTheme:Hd,registerKernelVariablesLanguage:Jh,remoteUserCursors:Bu,renderKernelStateGlyph:Vd,renderWidgets:sh,rendererFactory:Ru,requestAPI:eo,requestJupyterCollaborationSession:Ko,requireLoader:ih,resetJupyterConfig:zd,runCellOperation:Ud,runCellTool:$d,setJupyterServerToken:Kd,setJupyterServerUrl:qd,skeletonColor:Ju,sleep:Gd,supportsKernelVariables:Yh,syncJupyterLabPortalTheme:Jd,terminalStore:Yd,toKernelState:Xd,toKernelVariable:Xh,updateCellOperation:Zd,updateCellTool:Qd,useCellsStore:eu,useCollaboration:wi,useCollaborationStatus:v_,useConsoleStore:Jr,useIsCollaborationConnected:w_,useJupyter:Je,useJupyterLabCssLoaded:tu,useJupyterReactColormode:nu,useJupyterReactStore:Xr,useJupyterReactStoreFromProps:su,useKernelId:Wu,useKernelsStore:iu,useNotebookModel:Hu,useNotebookStore:ru,useNotebookToolbarItems:lf,useOutputsStore:ou,usePrimerThemeBridge:Sh,useTerminalStore:Qr,validateWithZod:au,watchFirstPaint:Vu,withAlpha:Yu,zodToToolParameters:lu},Symbol.toStringTag,{value:"Module"}));export{aa as D,Xg as F,Ap as I,Hs as J,Us as L,Wt as M,Pp as S,ev as a,tv as b,iv as c,rv as d,py as e,ma as f,ov as g,$e as h,zs as i,sv as j,dr as k,qg as l,nv as m,wg as n,xp as o,Ht as p,ty as q,lv as r};