@datalayer/agent-runtimes 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-embed/chunks/{AgentDetails-Bo0dD1KS.js → AgentDetails-KezohVQI.js} +1 -1
- package/dist-embed/chunks/{AgentDetailsDialog-JjCHYxMG.js → AgentDetailsDialog-CklhMnk7.js} +1 -1
- package/dist-embed/chunks/{AgentInspector-37Onz4of.js → AgentInspector-CtCaRc1L.js} +1 -1
- package/dist-embed/chunks/{AgentInspectorDialog-CCzGVAtX.js → AgentInspectorDialog-DB9cx3Gd.js} +1 -1
- package/dist-embed/chunks/Avatar-9MpXENSs.js +1 -0
- package/dist-embed/chunks/{CellSidebarExtension-CQlXdanG.js → CellSidebarExtension-CfaJL6DQ.js} +6 -6
- package/dist-embed/chunks/ChatView-Dc1x4aBR.js +32 -0
- package/dist-embed/chunks/{ContextPie-DBIUoPrq.js → ContextPie-1vP4f-3N.js} +1 -1
- package/dist-embed/chunks/DatalayerAgentBridge-D54Z9BZ3.js +1 -0
- package/dist-embed/chunks/{DeckComponent-CuRWiARr.js → DeckComponent-82GVdsoi.js} +2 -2
- package/dist-embed/chunks/{DocumentView-BYU2HREd.js → DocumentView-SrJloJDo.js} +2 -2
- package/dist-embed/chunks/{EphemeralDocument-BjFSuQKH.js → EphemeralDocument-t1KulOH8.js} +1 -1
- package/dist-embed/chunks/{EphemeralNotebook-DbS4f6yr.js → EphemeralNotebook-Co-WQWCc.js} +2 -2
- package/dist-embed/chunks/{ExcalidrawComponent-CFLnMPnf.js → ExcalidrawComponent-5NeLUYVB.js} +1 -1
- package/dist-embed/chunks/{ExcalidrawModal-CB9d5Vpk.js → ExcalidrawModal-9ZnOB03n.js} +1 -1
- package/dist-embed/chunks/{JupyterLexicalExtension-CYnZrelh.js → JupyterLexicalExtension-Cize8RXy.js} +29 -29
- package/dist-embed/chunks/{KernelVariables-KCUfxhF4.js → KernelVariables-Cl57Zze1.js} +2 -2
- package/dist-embed/chunks/{LexicalToolRegistry-CXLITkMD.js → LexicalToolRegistry-CoM9ROsx.js} +3 -3
- package/dist-embed/chunks/{NotebookSkeleton-HdM76lOj.js → NotebookSkeleton-CI7ovjNW.js} +1 -1
- package/dist-embed/chunks/{NotebookToolSurfaces-D62q-lbb.js → NotebookToolSurfaces-CWfppxBN.js} +1 -1
- package/dist-embed/chunks/{NotebookToolbar-DMKCe3c2.js → NotebookToolbar-rtMQZWHQ.js} +1 -1
- package/dist-embed/chunks/{NotebookView-Pps9dPZ7.js → NotebookView-DOf_K74b.js} +1 -1
- package/dist-embed/chunks/{Output-2KxoKu5F.js → Output-9DKTscSv.js} +10 -10
- package/dist-embed/chunks/{SandboxDetailsDialog-pkvlbdM2.js → SandboxDetailsDialog-BCfDm6MB.js} +1 -1
- package/dist-embed/chunks/{SchemaForm-Bqor7hh8.js → SchemaForm-BOYPrvf8.js} +1 -1
- package/dist-embed/chunks/{Toolbar-6Hdi_m3T.js → Toolbar-CGQDY041.js} +1 -1
- package/dist-embed/chunks/{WidgetVariableView-CJTAKqh1.js → WidgetVariableView-BTOwHP78.js} +1 -1
- package/dist-embed/chunks/YouTubePlugin-Bs4zZIB1.js +1 -0
- package/dist-embed/chunks/{abnfDiagram-VCTEODGH-CWj4pFxo.js → abnfDiagram-VCTEODGH-D5p59vS_.js} +1 -1
- package/dist-embed/chunks/{abnfDiagram-VCTEODGH-B4x7mfou.js → abnfDiagram-VCTEODGH-DRYbUvhc.js} +1 -1
- package/dist-embed/chunks/{ar-SA-G6X2FPQ2-C-zAYgA-.js → ar-SA-G6X2FPQ2-D6XRzkBS.js} +1 -1
- package/dist-embed/chunks/{architectureDiagram-5GKGNRK7-CRIN999O.js → architectureDiagram-5GKGNRK7-B7ITKDup.js} +1 -1
- package/dist-embed/chunks/{architectureDiagram-5GKGNRK7-B2D6lZbf.js → architectureDiagram-5GKGNRK7-DQGv0imf.js} +1 -1
- package/dist-embed/chunks/{az-AZ-76LH7QW2-BHq5js6U.js → az-AZ-76LH7QW2-DBTdUiqp.js} +1 -1
- package/dist-embed/chunks/{bg-BG-XCXSNQG7-BTcNNcTc.js → bg-BG-XCXSNQG7-DuhcsaSL.js} +1 -1
- package/dist-embed/chunks/{blockDiagram-868be97b-bBp9uGVj.js → blockDiagram-868be97b-DYe-XTjy.js} +1 -1
- package/dist-embed/chunks/{blockDiagram-I7D4REHJ-DNdo_mUi.js → blockDiagram-I7D4REHJ-IltJXCd6.js} +1 -1
- package/dist-embed/chunks/{blockDiagram-I7D4REHJ-CPHEppLa.js → blockDiagram-I7D4REHJ-y7tEFo3j.js} +1 -1
- package/dist-embed/chunks/{bn-BD-2XOGV67Q-DXRk27u1.js → bn-BD-2XOGV67Q-CPFeLVSN.js} +1 -1
- package/dist-embed/chunks/{c4Diagram-3f4bdde3-cYZlcE7E.js → c4Diagram-3f4bdde3-Bybp0wky.js} +1 -1
- package/dist-embed/chunks/{c4Diagram-7LVT6UL2-DTmVwmmb.js → c4Diagram-7LVT6UL2-CizxVqqX.js} +1 -1
- package/dist-embed/chunks/{c4Diagram-7LVT6UL2-BM2g5U7R.js → c4Diagram-7LVT6UL2-DpaHndz8.js} +1 -1
- package/dist-embed/chunks/{ca-ES-6MX7JW3Y-D-0J9rqp.js → ca-ES-6MX7JW3Y-gDR_kEC6.js} +1 -1
- package/dist-embed/chunks/{celltoolbartracker-D67W4XWx.js → celltoolbartracker-DLF4PWyW.js} +1 -1
- package/dist-embed/chunks/{chunk-2Q5K7J3B-CsB-r261.js → chunk-2Q5K7J3B-BI6lURun.js} +1 -1
- package/dist-embed/chunks/{chunk-2Q5K7J3B-CuegvedF.js → chunk-2Q5K7J3B-DWoLSrj9.js} +1 -1
- package/dist-embed/chunks/{chunk-5VM5RSS4-D4Ed2_vW.js → chunk-5VM5RSS4-CDh4wYym.js} +1 -1
- package/dist-embed/chunks/{chunk-5VM5RSS4-MJQ9uhYe.js → chunk-5VM5RSS4-SleuNqDC.js} +1 -1
- package/dist-embed/chunks/{chunk-F27PBJKO-DnjXjdOV.js → chunk-F27PBJKO-AvWsNGYY.js} +1 -1
- package/dist-embed/chunks/{chunk-F27PBJKO-BKTrewOm.js → chunk-F27PBJKO-h_FwJMTr.js} +1 -1
- package/dist-embed/chunks/{chunk-IMKFNOWR-Bf7PlvQM.js → chunk-IMKFNOWR-DGRceKiU.js} +1 -1
- package/dist-embed/chunks/{chunk-IMKFNOWR-BiXdYxxk.js → chunk-IMKFNOWR-Hx4a5yny.js} +1 -1
- package/dist-embed/chunks/{chunk-JWPE2WC7-DcVyhh3j.js → chunk-JWPE2WC7-A4gy2qc4.js} +1 -1
- package/dist-embed/chunks/{chunk-JWPE2WC7-DmWR08qa.js → chunk-JWPE2WC7-BuJactJo.js} +1 -1
- package/dist-embed/chunks/{chunk-POPQ4Y6H-Bw6JH9TT.js → chunk-POPQ4Y6H-CFM-817s.js} +1 -1
- package/dist-embed/chunks/{chunk-POPQ4Y6H-snvBGTqY.js → chunk-POPQ4Y6H-CmRF80iG.js} +1 -1
- package/dist-embed/chunks/{chunk-SVP7TREG-DLZdx--b.js → chunk-SVP7TREG-CryZx9JE.js} +1 -1
- package/dist-embed/chunks/{chunk-SVP7TREG-dE58fUkJ.js → chunk-SVP7TREG-DSNzmytH.js} +1 -1
- package/dist-embed/chunks/{chunk-TICWLB2K-DNXzQOV5.js → chunk-TICWLB2K-CEaDF8ZJ.js} +1 -1
- package/dist-embed/chunks/{chunk-TICWLB2K-4NdGhPfF.js → chunk-TICWLB2K-DyGS3fIj.js} +1 -1
- package/dist-embed/chunks/{chunk-XXDRQBXY-OKsVfhjO.js → chunk-XXDRQBXY-8Cnzpdjz.js} +1 -1
- package/dist-embed/chunks/{chunk-XXDRQBXY-D57w8SHP.js → chunk-XXDRQBXY-DxQBcVOz.js} +1 -1
- package/dist-embed/chunks/{classDiagram-ZZMXUADV-oYXGLbJe.js → classDiagram-ZZMXUADV-BQkO1UYr.js} +1 -1
- package/dist-embed/chunks/{classDiagram-ZZMXUADV-D35oEC_r.js → classDiagram-ZZMXUADV-yvP3zMO3.js} +1 -1
- package/dist-embed/chunks/{classDiagram-f62afe4f-DWY2Ws4r.js → classDiagram-f62afe4f-AYfpYKtp.js} +1 -1
- package/dist-embed/chunks/{classDiagram-v2-604399ef-By5ijR28.js → classDiagram-v2-604399ef-BWyNcT_y.js} +1 -1
- package/dist-embed/chunks/{classDiagram-v2-VYDZK3BY-oYXGLbJe.js → classDiagram-v2-VYDZK3BY-BQkO1UYr.js} +1 -1
- package/dist-embed/chunks/{classDiagram-v2-VYDZK3BY-D35oEC_r.js → classDiagram-v2-VYDZK3BY-yvP3zMO3.js} +1 -1
- package/dist-embed/chunks/{code-block-IT6T5CEO-DvUhQbDq.js → code-block-IT6T5CEO-F4BSIGY6.js} +1 -1
- package/dist-embed/chunks/{component-DquJEKgN.js → component-DMQ8W8n1.js} +3 -3
- package/dist-embed/chunks/{cose-bilkent-JH36ORCC-j33onHvG.js → cose-bilkent-JH36ORCC-C3HC0XIY.js} +1 -1
- package/dist-embed/chunks/{cose-bilkent-JH36ORCC-CfuJvtzg.js → cose-bilkent-JH36ORCC-MVxlcfpd.js} +1 -1
- package/dist-embed/chunks/{createText-aed3d8b3-DvlG46OI.js → createText-aed3d8b3-CEJODAXJ.js} +1 -1
- package/dist-embed/chunks/{cs-CZ-2BRQDIVT-CgN3I-57.js → cs-CZ-2BRQDIVT-BXQxcYp6.js} +1 -1
- package/dist-embed/chunks/{cynefinDiagram-5FMLGOSQ-YhGHtmc4.js → cynefinDiagram-5FMLGOSQ-D87ENxS0.js} +1 -1
- package/dist-embed/chunks/{cynefinDiagram-5FMLGOSQ-CPb2yRsU.js → cynefinDiagram-5FMLGOSQ-DNRKTIHx.js} +1 -1
- package/dist-embed/chunks/{da-DK-5WZEPLOC-CHQloSoX.js → da-DK-5WZEPLOC-Ck3vidj3.js} +1 -1
- package/dist-embed/chunks/{dagre-GXQ25YYZ-CSSSVwOB.js → dagre-GXQ25YYZ-BOhThFKd.js} +1 -1
- package/dist-embed/chunks/{dagre-GXQ25YYZ-bjTeZGWE.js → dagre-GXQ25YYZ-DscCD5Uq.js} +1 -1
- package/dist-embed/chunks/{de-DE-XR44H4JA-C-Hq84pe.js → de-DE-XR44H4JA-CPZgrOuc.js} +1 -1
- package/dist-embed/chunks/{diagram-S7CK7UJ4-CFdSwdyc.js → diagram-S7CK7UJ4-CUhme3Bl.js} +1 -1
- package/dist-embed/chunks/{diagram-S7CK7UJ4-CFDVHfda.js → diagram-S7CK7UJ4-zDQduoQy.js} +1 -1
- package/dist-embed/chunks/{diagram-UQ7AKVKN-DDaeau23.js → diagram-UQ7AKVKN-BxhQPjAM.js} +1 -1
- package/dist-embed/chunks/{diagram-UQ7AKVKN-GZbDy6ob.js → diagram-UQ7AKVKN-Byi-v8UN.js} +1 -1
- package/dist-embed/chunks/{diagram-VSXAHHWV-nXDiS81a.js → diagram-VSXAHHWV-CqihYkDH.js} +1 -1
- package/dist-embed/chunks/{diagram-VSXAHHWV-C6q67wko.js → diagram-VSXAHHWV-au-v2v9D.js} +1 -1
- package/dist-embed/chunks/{diagram-VX7I27RA-DQUkfMrD.js → diagram-VX7I27RA-Cd5PaF_n.js} +1 -1
- package/dist-embed/chunks/{diagram-VX7I27RA-CYLfpYa4.js → diagram-VX7I27RA-ETzwrw79.js} +1 -1
- package/dist-embed/chunks/{diagram-Z3DM3KII-DZziYptV.js → diagram-Z3DM3KII-AcMuRFo5.js} +1 -1
- package/dist-embed/chunks/{diagram-Z3DM3KII-v-9naUk_.js → diagram-Z3DM3KII-DkbsvY2A.js} +1 -1
- package/dist-embed/chunks/{document-BpXPH_dr.js → document-Dluvp7zl.js} +1 -1
- package/dist-embed/chunks/{drivecontents-Bg9_6Kmo.js → drivecontents-CxwZz_5W.js} +1 -1
- package/dist-embed/chunks/{ebnfDiagram-PWID7BFC-EvDUmZgJ.js → ebnfDiagram-PWID7BFC-BrEs-SB2.js} +1 -1
- package/dist-embed/chunks/{ebnfDiagram-PWID7BFC-CDmryeYY.js → ebnfDiagram-PWID7BFC-DuWfMZcD.js} +1 -1
- package/dist-embed/chunks/{edges-b2856ca0-CTakYT6h.js → edges-b2856ca0-Czd3-xvj.js} +1 -1
- package/dist-embed/chunks/{el-GR-BZB4AONW-MTzGcSsP.js → el-GR-BZB4AONW-CjQSkw0P.js} +1 -1
- package/dist-embed/chunks/{erDiagram-5d81789a-CpiBBm7t.js → erDiagram-5d81789a-JegaF4gy.js} +1 -1
- package/dist-embed/chunks/{erDiagram-RLTQ6QDP-B2QZDDaO.js → erDiagram-RLTQ6QDP-Cpn6_cd1.js} +1 -1
- package/dist-embed/chunks/{erDiagram-RLTQ6QDP-hsnql-YF.js → erDiagram-RLTQ6QDP-xubaXuKR.js} +1 -1
- package/dist-embed/chunks/{es-ES-U4NZUMDT-Thj-4Rwn.js → es-ES-U4NZUMDT-CQz3Tsxk.js} +1 -1
- package/dist-embed/chunks/{eu-ES-A7QVB2H4-BEEyNQo-.js → eu-ES-A7QVB2H4-DPwxHXvP.js} +1 -1
- package/dist-embed/chunks/{fa-IR-HGAKTJCU-CtUGmNBZ.js → fa-IR-HGAKTJCU-DlQyRFJP.js} +1 -1
- package/dist-embed/chunks/{fi-FI-Z5N7JZ37-6GMgpkSu.js → fi-FI-Z5N7JZ37-BL9Dv0rT.js} +1 -1
- package/dist-embed/chunks/{flowDb-185abca5-D4uRRPhl.js → flowDb-185abca5-BN_8lgCO.js} +1 -1
- package/dist-embed/chunks/{flowDiagram-1629c991-B999anFV.js → flowDiagram-1629c991-YRlRqB59.js} +1 -1
- package/dist-embed/chunks/{flowDiagram-HODETNUW-DY4I6lzA.js → flowDiagram-HODETNUW-CzRvxVGK.js} +1 -1
- package/dist-embed/chunks/{flowDiagram-HODETNUW-D4E8W9uH.js → flowDiagram-HODETNUW-lW-icIxi.js} +1 -1
- package/dist-embed/chunks/{flowDiagram-v2-1d953310-2W9bzV_S.js → flowDiagram-v2-1d953310-DBFSFroi.js} +1 -1
- package/dist-embed/chunks/{flowchart-elk-definition-6df44142-Cz-ICcxz.js → flowchart-elk-definition-6df44142-RjL83g27.js} +1 -1
- package/dist-embed/chunks/{fr-FR-RHASNOE6-BakNCbxj.js → fr-FR-RHASNOE6-xB7HyFVv.js} +1 -1
- package/dist-embed/chunks/{ganttDiagram-3b0b3873-CR9gwUWB.js → ganttDiagram-3b0b3873-Dowe9cKl.js} +1 -1
- package/dist-embed/chunks/{ganttDiagram-EL5Y4UJY-CoCfE73i.js → ganttDiagram-EL5Y4UJY-CLaynGwe.js} +1 -1
- package/dist-embed/chunks/{ganttDiagram-EL5Y4UJY-cZgkz4jA.js → ganttDiagram-EL5Y4UJY-CNQPBdAP.js} +1 -1
- package/dist-embed/chunks/{gitGraphDiagram-WWUBYQGX-CZEgVaQ_.js → gitGraphDiagram-WWUBYQGX-CDuBbPX3.js} +1 -1
- package/dist-embed/chunks/{gitGraphDiagram-WWUBYQGX-xXoxdFf9.js → gitGraphDiagram-WWUBYQGX-CupHqYWl.js} +1 -1
- package/dist-embed/chunks/{gitGraphDiagram-f01e8bc2-NdofvPL5.js → gitGraphDiagram-f01e8bc2-C06Sje1n.js} +1 -1
- package/dist-embed/chunks/{gl-ES-HMX3MZ6V-Cwkb9OPk.js → gl-ES-HMX3MZ6V-BX50ltap.js} +1 -1
- package/dist-embed/chunks/{he-IL-6SHJWFNN-BaMmvCkr.js → he-IL-6SHJWFNN-DR3hLzYG.js} +1 -1
- package/dist-embed/chunks/{hi-IN-IWLTKZ5I-1aWewhep.js → hi-IN-IWLTKZ5I-C3bSDqVc.js} +1 -1
- package/dist-embed/chunks/{hu-HU-A5ZG7DT2-BIHI23BQ.js → hu-HU-A5ZG7DT2--mRUDQG6.js} +1 -1
- package/dist-embed/chunks/{id-ID-SAP4L64H-CYpgmx8X.js → id-ID-SAP4L64H-D6psdwdp.js} +1 -1
- package/dist-embed/chunks/{index-W7TVoWP5.js → index-3O3ob63z.js} +15 -15
- package/dist-embed/chunks/{index-KgE-JGae.js → index-7F_pA42X.js} +4 -4
- package/dist-embed/chunks/{index-9bae90f3-D4JbZiwv.js → index-9bae90f3-BY7E8HZU.js} +1 -1
- package/dist-embed/chunks/{index-CMYyiALV.js → index-Azo_wV3K.js} +1 -1
- package/dist-embed/chunks/{index-BFPUYxvD.js → index-B063q-PC.js} +4 -4
- package/dist-embed/chunks/index-B0KVfQGJ.js +1 -0
- package/dist-embed/chunks/{index-BRBFWMMG.js → index-B2He8CnP.js} +1 -1
- package/dist-embed/chunks/{index-BAr0Q6NS.js → index-BExwmtFS.js} +1 -1
- package/dist-embed/chunks/{index-B3WvcNQa.js → index-BJhxZF_K.js} +1 -1
- package/dist-embed/chunks/{index-CXL3UCHy.js → index-BYMZi_1t.js} +1 -1
- package/dist-embed/chunks/{index-wovGU2zp.js → index-BblwlEJB.js} +1 -1
- package/dist-embed/chunks/{index-Fzz2KjFM.js → index-BdvS7Q4t.js} +1 -1
- package/dist-embed/chunks/{index-BbucLMre.js → index-BhU2ra4k.js} +3 -3
- package/dist-embed/chunks/{index-j-oeqTuo.js → index-BipXK1tF.js} +1 -1
- package/dist-embed/chunks/{index-1wTrAXI1.js → index-BlWZloLe.js} +3 -3
- package/dist-embed/chunks/{index-b1yzCiTq.js → index-BzXMsI1v.js} +1 -1
- package/dist-embed/chunks/{index-CPY91aGL.js → index-BzxtV5-v.js} +1 -1
- package/dist-embed/chunks/{index-C17RrmNV.js → index-C01nR1dW.js} +1 -1
- package/dist-embed/chunks/{index-t_gNTVoL.js → index-C643Hfu1.js} +1 -1
- package/dist-embed/chunks/{index-DMKsCn-y.js → index-C6wF35Kk.js} +10 -10
- package/dist-embed/chunks/{index-BhSMzuKq.js → index-C8IekrmL.js} +1 -1
- package/dist-embed/chunks/{index-BxjlpSy4.js → index-C9CpG6Nf.js} +1 -1
- package/dist-embed/chunks/{index-BUhqZVtg.js → index-CA8D7U2s.js} +2 -2
- package/dist-embed/chunks/{index-EmZm7_bH.js → index-CUL9WiLS.js} +5 -5
- package/dist-embed/chunks/{index-DeVZ-nmF.js → index-Cknn3VQD.js} +1 -1
- package/dist-embed/chunks/{index-BJ7Yskx5.js → index-CpcHHQd7.js} +1 -1
- package/dist-embed/chunks/{index-wzK_9qZx.js → index-CvBxCcaE.js} +1 -1
- package/dist-embed/chunks/{index-DkUimZI8.js → index-CzXnKkqM.js} +1 -1
- package/dist-embed/chunks/{index-Ck-wonpc.js → index-D0DBuFMt.js} +1 -1
- package/dist-embed/chunks/{index-CC-Ht79i.js → index-D1lY79hS.js} +4 -4
- package/dist-embed/chunks/{index-BFLtEBuP.js → index-DB46n9Tf.js} +2 -2
- package/dist-embed/chunks/{index-B7nmHsEo.js → index-DToDguC3.js} +1 -1
- package/dist-embed/chunks/{index-Bi5hexj-.js → index-DVDREi21.js} +1 -1
- package/dist-embed/chunks/{index-D18sf241.js → index-DVUMPcVw.js} +1 -1
- package/dist-embed/chunks/{index-ZZnjmFwm.js → index-DcZQ2Oqj.js} +1 -1
- package/dist-embed/chunks/{index-bRwN_nxZ.js → index-DvWWLOj6.js} +1 -1
- package/dist-embed/chunks/{index-Clp8quV1.js → index-Dv_XGY6Q.js} +1 -1
- package/dist-embed/chunks/{index-C3oDHYfa.js → index-DxsDy6PY.js} +1 -1
- package/dist-embed/chunks/{index-en9Yf1Yz.js → index-EpYurdzk.js} +6 -6
- package/dist-embed/chunks/{index-DIOcQUrz.js → index-MTdX216X.js} +1 -1
- package/dist-embed/chunks/{index-B2OWWcCj.js → index-YqGHzM2S.js} +1 -1
- package/dist-embed/chunks/{index-BvvaLLhn.js → index-a51XM5L8.js} +3 -3
- package/dist-embed/chunks/{index-CsZ2HycN.js → index-jy9kOmqu.js} +1 -1
- package/dist-embed/chunks/{index-e5PkgYFg.js → index-kpqZuE4J.js} +1 -1
- package/dist-embed/chunks/{index-DtlUttQj.js → index-qsUgit40.js} +1 -1
- package/dist-embed/chunks/{index-Cq19rGjf.js → index-rfsiH_M6.js} +1 -1
- package/dist-embed/chunks/{index-BYQwy0Zx.js → index-s3hayhRS.js} +2 -2
- package/dist-embed/chunks/{index.esm-RCuogyl2.js → index.esm-CWygaJYM.js} +1 -1
- package/dist-embed/chunks/{index.esm-CVNfNVDy.js → index.esm-DYeUXS4c.js} +1 -1
- package/dist-embed/chunks/{infoDiagram-27XIBGKW-DpFWmHEH.js → infoDiagram-27XIBGKW-Ctm-zk09.js} +1 -1
- package/dist-embed/chunks/{infoDiagram-27XIBGKW-DRf2y76w.js → infoDiagram-27XIBGKW-DRzH33_4.js} +1 -1
- package/dist-embed/chunks/{infoDiagram-a29d40f1-CehVkLUM.js → infoDiagram-a29d40f1-c78-ZMuT.js} +1 -1
- package/dist-embed/chunks/{isEqual-BybBNsZK.js → isEqual-niFNV5MZ.js} +1 -1
- package/dist-embed/chunks/{ishikawaDiagram-5VMMS53U-C_d1mmp3.js → ishikawaDiagram-5VMMS53U-CILSTTqm.js} +1 -1
- package/dist-embed/chunks/{ishikawaDiagram-5VMMS53U-B534qRQJ.js → ishikawaDiagram-5VMMS53U-DKv5KL85.js} +1 -1
- package/dist-embed/chunks/{it-IT-JPQ66NNP-CLcqplyX.js → it-IT-JPQ66NNP-BfrG_atL.js} +1 -1
- package/dist-embed/chunks/{ja-JP-DBVTYXUO-u8Qe6tR7.js → ja-JP-DBVTYXUO-sahpmNGY.js} +1 -1
- package/dist-embed/chunks/{journeyDiagram-3NMN7TZE-DEeA8WJr.js → journeyDiagram-3NMN7TZE-CSMQRlsr.js} +1 -1
- package/dist-embed/chunks/{journeyDiagram-3NMN7TZE-C0GQLJYz.js → journeyDiagram-3NMN7TZE-DlMPiHSP.js} +1 -1
- package/dist-embed/chunks/{journeyDiagram-95396277-Cwx_BI95.js → journeyDiagram-95396277-VzHClVrX.js} +1 -1
- package/dist-embed/chunks/{kaa-6HZHGXH3-BG2kx50I.js → kaa-6HZHGXH3-BrkhtXQj.js} +1 -1
- package/dist-embed/chunks/{kab-KAB-ZGHBKWFO-CSYUpRxd.js → kab-KAB-ZGHBKWFO-DwtFIV_I.js} +1 -1
- package/dist-embed/chunks/{kanban-definition-UXKFOSKX-DucvIyR1.js → kanban-definition-UXKFOSKX-BkxvAXq2.js} +1 -1
- package/dist-embed/chunks/{kanban-definition-UXKFOSKX-Dww2l0wQ.js → kanban-definition-UXKFOSKX-esf1amn7.js} +1 -1
- package/dist-embed/chunks/{kk-KZ-P5N5QNE5-CpBMgHAz.js → kk-KZ-P5N5QNE5-UxN1LGH5.js} +1 -1
- package/dist-embed/chunks/{km-KH-HSX4SM5Z-CoMUUQMb.js → km-KH-HSX4SM5Z-B7lolfpy.js} +1 -1
- package/dist-embed/chunks/{ko-KR-MTYHY66A-DwxY8CGI.js → ko-KR-MTYHY66A-CnxefCaN.js} +1 -1
- package/dist-embed/chunks/{ku-TR-6OUDTVRD-UoNYUfm0.js → ku-TR-6OUDTVRD-Bt7bmFnv.js} +1 -1
- package/dist-embed/chunks/{layout-DiAMrtPi.js → layout-D7Mk1riq.js} +1 -1
- package/dist-embed/chunks/{layout-LNJhMVxV.js → layout-Sl9Lf6Ae.js} +1 -1
- package/dist-embed/chunks/{lexicalHooks-DEzWXVZY.js → lexicalHooks-DKF-DsxG.js} +1 -1
- package/dist-embed/chunks/{lt-LT-XHIRWOB4-Dr4uXaEj.js → lt-LT-XHIRWOB4-D6qkXs9m.js} +1 -1
- package/dist-embed/chunks/{lv-LV-5QDEKY6T-CNC56J-_.js → lv-LV-5QDEKY6T-D8g27j86.js} +1 -1
- package/dist-embed/chunks/{mermaid.core-huvnfV8t.js → mermaid.core-BhiOhb5K.js} +3 -3
- package/dist-embed/chunks/{mermaid.core-Dw1n-Hii.js → mermaid.core-CRlujv29.js} +5 -5
- package/dist-embed/chunks/{mindmap-definition-YA3MSWOX-DWUezf-k.js → mindmap-definition-YA3MSWOX-BJQsz4H1.js} +1 -1
- package/dist-embed/chunks/{mindmap-definition-YA3MSWOX-DKQu2lXp.js → mindmap-definition-YA3MSWOX-eCxs0BsL.js} +1 -1
- package/dist-embed/chunks/{mindmap-definition-e4c1d938-DSDPusnk.js → mindmap-definition-e4c1d938-DoGG9eDO.js} +1 -1
- package/dist-embed/chunks/{model-BHONoBA6.js → model-BziAhKNp.js} +1 -1
- package/dist-embed/chunks/{mr-IN-CRQNXWMA-BKWa9nzZ.js → mr-IN-CRQNXWMA-CMbVGyJm.js} +1 -1
- package/dist-embed/chunks/{my-MM-5M5IBNSE-bwAzOWhV.js → my-MM-5M5IBNSE-B-KPsx1j.js} +1 -1
- package/dist-embed/chunks/{nb-NO-T6EIAALU-CkpsChor.js → nb-NO-T6EIAALU-Cl7QLAt7.js} +1 -1
- package/dist-embed/chunks/{nl-NL-IS3SIHDZ-COVk4rlb.js → nl-NL-IS3SIHDZ-Brzte_o2.js} +1 -1
- package/dist-embed/chunks/{nn-NO-6E72VCQL-DlyFF-C1.js → nn-NO-6E72VCQL-CzCKEx02.js} +1 -1
- package/dist-embed/chunks/{oc-FR-POXYY2M6-CFDosV2C.js → oc-FR-POXYY2M6-DA72PkVY.js} +1 -1
- package/dist-embed/chunks/{pa-IN-N4M65BXN-BKRB3O0U.js → pa-IN-N4M65BXN-CzkFYtL0.js} +1 -1
- package/dist-embed/chunks/{pegDiagram-XKGWAZYB-ChXFZFas.js → pegDiagram-XKGWAZYB-CD3xZvKE.js} +1 -1
- package/dist-embed/chunks/{pegDiagram-XKGWAZYB-BUPTGFu3.js → pegDiagram-XKGWAZYB-CV-d6HkK.js} +1 -1
- package/dist-embed/chunks/{percentages-BXMCSKIN-D7pnqUsZ.js → percentages-BXMCSKIN-mjCCp4uI.js} +6 -6
- package/dist-embed/chunks/{pica-BQREYloS.js → pica-5TeyVfIV.js} +1 -1
- package/dist-embed/chunks/{pieDiagram-E7YTZNPT-DAuVz3z-.js → pieDiagram-E7YTZNPT-DipS--g7.js} +1 -1
- package/dist-embed/chunks/{pieDiagram-E7YTZNPT-BORvsKK0.js → pieDiagram-E7YTZNPT-toANOh_O.js} +1 -1
- package/dist-embed/chunks/{pieDiagram-c941bede-FM1PHjj3.js → pieDiagram-c941bede-DytniBrW.js} +1 -1
- package/dist-embed/chunks/{pl-PL-T2D74RX3-C5r2Tds7.js → pl-PL-T2D74RX3-F4ebFTYK.js} +1 -1
- package/dist-embed/chunks/{plugin-BoxsYxwM.js → plugin-Cf3g-jak.js} +1 -1
- package/dist-embed/chunks/plugin-DA_NCYQX.js +1 -0
- package/dist-embed/chunks/{pt-BR-5N22H2LF-CDnT98bW.js → pt-BR-5N22H2LF-B5i8LuE4.js} +1 -1
- package/dist-embed/chunks/{pt-PT-UZXXM6DQ-C6c4SPk1.js → pt-PT-UZXXM6DQ-BQ7hfRRg.js} +1 -1
- package/dist-embed/chunks/{quadrantDiagram-AXDQQJYC-DpGcSrR9.js → quadrantDiagram-AXDQQJYC-D_j5dzK-.js} +1 -1
- package/dist-embed/chunks/{quadrantDiagram-AXDQQJYC-CZe_C7e2.js → quadrantDiagram-AXDQQJYC-DlhtjZ-k.js} +1 -1
- package/dist-embed/chunks/{quadrantDiagram-cf8b8fe0-DZNznYqD.js → quadrantDiagram-cf8b8fe0-BQ2yjLYu.js} +1 -1
- package/dist-embed/chunks/{railroadDiagram-O6MQD6OU-CuL_zbZ8.js → railroadDiagram-O6MQD6OU-CZFkdwSz.js} +1 -1
- package/dist-embed/chunks/{railroadDiagram-O6MQD6OU-BnCn-tIV.js → railroadDiagram-O6MQD6OU-aWlxxhLc.js} +1 -1
- package/dist-embed/chunks/{renderer-lVFw9lw7.js → renderer-2D5v6hpK.js} +1 -1
- package/dist-embed/chunks/{requirementDiagram-53bda41b-BLToEv8I.js → requirementDiagram-53bda41b-CWV_b9FE.js} +1 -1
- package/dist-embed/chunks/{requirementDiagram-BXWQKSXE-KU7DW76t.js → requirementDiagram-BXWQKSXE-BSF51uZZ.js} +1 -1
- package/dist-embed/chunks/{requirementDiagram-BXWQKSXE-W6Oaw9v0.js → requirementDiagram-BXWQKSXE-EVwiX2gg.js} +1 -1
- package/dist-embed/chunks/{ro-RO-JPDTUUEW-CW6pbzEZ.js → ro-RO-JPDTUUEW-BdcZRS6h.js} +1 -1
- package/dist-embed/chunks/{ru-RU-B4JR7IUQ-CbaAJG0w.js → ru-RU-B4JR7IUQ-Cta1z8f6.js} +1 -1
- package/dist-embed/chunks/{sankeyDiagram-P5KCCOFB-y5tPDHfE.js → sankeyDiagram-P5KCCOFB-BqD6w06O.js} +1 -1
- package/dist-embed/chunks/{sankeyDiagram-P5KCCOFB-1UXJ4wHP.js → sankeyDiagram-P5KCCOFB-t6rHaBZJ.js} +1 -1
- package/dist-embed/chunks/{sankeyDiagram-c3ef121a-6gF3bcjb.js → sankeyDiagram-c3ef121a-C9O52Zx9.js} +1 -1
- package/dist-embed/chunks/{sequenceDiagram-82a5b84f-CglVrG1T.js → sequenceDiagram-82a5b84f-Dga-BwWi.js} +1 -1
- package/dist-embed/chunks/{sequenceDiagram-WJ2MYXX4-CG-4aOyN.js → sequenceDiagram-WJ2MYXX4-DphVeQVS.js} +1 -1
- package/dist-embed/chunks/{sequenceDiagram-WJ2MYXX4-DVcXqRnq.js → sequenceDiagram-WJ2MYXX4-ih6W0378.js} +1 -1
- package/dist-embed/chunks/{sessions-3PQsLINe.js → sessions-APuuDN3K.js} +2 -2
- package/dist-embed/chunks/{si-LK-N5RQ5JYF-BZkUjpXF.js → si-LK-N5RQ5JYF-DYy_OKHx.js} +1 -1
- package/dist-embed/chunks/{sizeCapture-INFHLROL-e294GOp7.js → sizeCapture-INFHLROL-CxIMCruL.js} +1 -1
- package/dist-embed/chunks/{sizeCapture-INFHLROL-CCZ7JXfm.js → sizeCapture-INFHLROL-o0dzt8-T.js} +1 -1
- package/dist-embed/chunks/{sk-SK-C5VTKIMK-DsfWgpPU.js → sk-SK-C5VTKIMK-B4A8rgzq.js} +1 -1
- package/dist-embed/chunks/{sl-SI-NN7IZMDC-Kx0FqxKU.js → sl-SI-NN7IZMDC-Dn2yU1RA.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-43e79a5f-DktiQR1L.js → stateDiagram-43e79a5f-RBFnM6HD.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-D77RDMKH-Czz7slb9.js → stateDiagram-D77RDMKH-DUbaZs3a.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-D77RDMKH-DvgDxPXs.js → stateDiagram-D77RDMKH-R5RRRvFY.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-v2-2041ed4f-CGEkaZYz.js → stateDiagram-v2-2041ed4f-O5FpnsEz.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-v2-MP3YSRHH-CbzbC1qh.js → stateDiagram-v2-MP3YSRHH-CxTXB7mT.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-v2-MP3YSRHH-DGG9ROyK.js → stateDiagram-v2-MP3YSRHH-xKTLvXGN.js} +1 -1
- package/dist-embed/chunks/{styles-455b33cd-BpfBULhz.js → styles-455b33cd-D4Xv2qYx.js} +1 -1
- package/dist-embed/chunks/{styles-f932cba9-DsM5quNh.js → styles-f932cba9-BRIqeB8k.js} +1 -1
- package/dist-embed/chunks/{styles-fcc2142b-bC7I59Fx.js → styles-fcc2142b-CSNd2DtU.js} +1 -1
- package/dist-embed/chunks/{subset-shared.chunk-DM3l9OuH.js → subset-shared.chunk-SugOGKH0.js} +1 -1
- package/dist-embed/chunks/{subset-worker.chunk-4w4yibm3.js → subset-worker.chunk-CHn-RJwQ.js} +1 -1
- package/dist-embed/chunks/{sv-SE-XGPEYMSR-DY0ryO-L.js → sv-SE-XGPEYMSR-DIGNKjA1.js} +1 -1
- package/dist-embed/chunks/{svgDrawCommon-148a3cd9-OC_CIhNw.js → svgDrawCommon-148a3cd9-ioBjWI45.js} +1 -1
- package/dist-embed/chunks/{swimlanes-42K2YHIH-DLiqjxvc.js → swimlanes-42K2YHIH-BPXSOfWl.js} +1 -1
- package/dist-embed/chunks/{swimlanes-42K2YHIH-nfpJsGfW.js → swimlanes-42K2YHIH-DID4P1mJ.js} +1 -1
- package/dist-embed/chunks/{swimlanesDiagram-VR7AAH4N-DVkRheaE.js → swimlanesDiagram-VR7AAH4N-B216TpFb.js} +1 -1
- package/dist-embed/chunks/{swimlanesDiagram-VR7AAH4N-DjeQ0TlI.js → swimlanesDiagram-VR7AAH4N-C5LAWW5q.js} +1 -1
- package/dist-embed/chunks/{ta-IN-2NMHFXQM-CWpIs0i0.js → ta-IN-2NMHFXQM-h5n2V9ms.js} +1 -1
- package/dist-embed/chunks/{th-TH-HPSO5L25-Cwkcfb3u.js → th-TH-HPSO5L25-DPUFV7b6.js} +1 -1
- package/dist-embed/chunks/{timeline-definition-24CTP7MA-CapVlXMl.js → timeline-definition-24CTP7MA-CsrTDzso.js} +1 -1
- package/dist-embed/chunks/{timeline-definition-24CTP7MA-eOK0mNc7.js → timeline-definition-24CTP7MA-Y3tUsmSp.js} +1 -1
- package/dist-embed/chunks/{timeline-definition-7545f45a-afx9iuZR.js → timeline-definition-7545f45a-Dwe7O50H.js} +1 -1
- package/dist-embed/chunks/{tokens-BfuLIPUq.js → tokens-DTIgYcNS.js} +1 -1
- package/dist-embed/chunks/{tr-TR-DEFEU3FU-BqJZZl-Y.js → tr-TR-DEFEU3FU-BezJkdMx.js} +1 -1
- package/dist-embed/chunks/{uk-UA-QMV73CPH-Dg213mG4.js → uk-UA-QMV73CPH-CqILlosm.js} +1 -1
- package/dist-embed/chunks/{usePrimerThemeBridge-D_1NuGKb.js → usePrimerThemeBridge-CoHussa9.js} +1 -1
- package/dist-embed/chunks/{vennDiagram-4TSXK5OY-D12hHdDQ.js → vennDiagram-4TSXK5OY-BhVdyHxt.js} +1 -1
- package/dist-embed/chunks/{vennDiagram-4TSXK5OY-CJ0VIZqI.js → vennDiagram-4TSXK5OY-ClTlC2ql.js} +1 -1
- package/dist-embed/chunks/{vi-VN-M7AON7JQ-DY94NKxF.js → vi-VN-M7AON7JQ-CnkPVQ0a.js} +1 -1
- package/dist-embed/chunks/{wardleyDiagram-VM6X3IG4-B1FfO2GD.js → wardleyDiagram-VM6X3IG4-DbWIMpvU.js} +1 -1
- package/dist-embed/chunks/{wardleyDiagram-VM6X3IG4-BfuBJbTV.js → wardleyDiagram-VM6X3IG4-kS16z5iB.js} +1 -1
- package/dist-embed/chunks/{xychartDiagram-3f383b91-BMDhPCCG.js → xychartDiagram-3f383b91-DYoT_EjG.js} +1 -1
- package/dist-embed/chunks/{xychartDiagram-S5SC5T6Z-xLO3w9Bz.js → xychartDiagram-S5SC5T6Z-CdwuwQAF.js} +1 -1
- package/dist-embed/chunks/{xychartDiagram-S5SC5T6Z-DZ-XUHKl.js → xychartDiagram-S5SC5T6Z-KeQp-cQ1.js} +1 -1
- package/dist-embed/chunks/{zh-CN-LNUGB5OW-B6I9A7sA.js → zh-CN-LNUGB5OW-CNdfctAT.js} +1 -1
- package/dist-embed/chunks/{zh-HK-E62DVLB3-D3oqgDOt.js → zh-HK-E62DVLB3-DEXwa5-T.js} +1 -1
- package/dist-embed/chunks/{zh-TW-RAJ6MFWO-CYwgY0Jo.js → zh-TW-RAJ6MFWO-BF7cCYAK.js} +1 -1
- package/dist-embed/datalayer-app-main.js +49 -49
- package/lib/apps/apps/appspec.js +22 -0
- package/lib/apps/core/index.d.ts +8 -0
- package/lib/apps/embed/AppEmbed.js +10 -13
- package/lib/apps/embed/hostBridge.d.ts +47 -13
- package/lib/apps/embed/hostBridge.js +135 -18
- package/lib/apps/index.d.ts +2 -2
- package/lib/apps/index.js +2 -2
- package/lib/apps/plugins/agents/DatalayerAgentBridge.js +9 -14
- package/lib/apps/plugins/agents/index.d.ts +1 -1
- package/lib/apps/plugins/agents/index.js +1 -1
- package/lib/apps/plugins/agents/plugin.d.ts +10 -0
- package/lib/apps/plugins/agents/plugin.js +10 -0
- package/lib/apps/plugins/app-elements/QuestionView.d.ts +5 -3
- package/lib/apps/plugins/app-elements/QuestionView.js +15 -2
- package/lib/apps/plugins/app-page/appPageModel.d.ts +6 -8
- package/lib/apps/plugins/app-page/appPageModel.js +0 -2
- package/lib/apps/plugins/app-page/pageRun.d.ts +2 -2
- package/lib/apps/plugins/app-page/pageRun.js +3 -3
- package/lib/apps/plugins/chat/ChatView.js +22 -3
- package/lib/chat/base/ChatBase.js +33 -3
- package/lib/chat/base/uiFiles.d.ts +29 -0
- package/lib/chat/base/uiFiles.js +69 -0
- package/lib/chat/messages/ChatMessageList.d.ts +7 -2
- package/lib/chat/messages/ChatMessageList.js +2 -2
- package/lib/examples/ProtocolSignedRequestsExample.d.ts +10 -0
- package/lib/examples/ProtocolSignedRequestsExample.js +41 -0
- package/lib/examples/ProtocolUcpCheckoutExample.d.ts +10 -0
- package/lib/examples/ProtocolUcpCheckoutExample.js +59 -0
- package/lib/examples/example-selector.js +2 -0
- package/lib/examples/exampleGroups.d.ts +1 -1
- package/lib/examples/exampleGroups.js +4 -0
- package/lib/examples/index.d.ts +2 -0
- package/lib/examples/index.js +2 -0
- package/lib/examples/protocols/signedRequestsDemo.d.ts +27 -0
- package/lib/examples/protocols/signedRequestsDemo.js +59 -0
- package/lib/examples/protocols/ucpCheckoutDemo.d.ts +36 -0
- package/lib/examples/protocols/ucpCheckoutDemo.js +68 -0
- package/lib/protocols/a2a/index.js +1 -0
- package/lib/protocols/agentic-commerce/index.js +1 -0
- package/lib/protocols/core.d.ts +6 -0
- package/lib/protocols/mcp/index.js +1 -0
- package/lib/protocols/pact/index.js +1 -0
- package/lib/protocols/ucp/index.js +1 -0
- package/lib/protocols/ucp/merchant.d.ts +15 -0
- package/lib/protocols/ucp/merchant.js +257 -0
- package/lib/protocols/web-bot-auth/index.js +1 -0
- package/lib/specs/apps.js +87 -6
- package/lib/specs/appspecSchema.js +43 -0
- package/lib/types/agentspecs.d.ts +18 -0
- package/lib/types/protocol.d.ts +7 -0
- package/package.json +2 -2
- package/dist-embed/chunks/Avatar-DbU3YP4x.js +0 -1
- package/dist-embed/chunks/ChatView-BpKZPdcp.js +0 -32
- package/dist-embed/chunks/DatalayerAgentBridge-Bz2KWRXK.js +0 -1
- package/dist-embed/chunks/YouTubePlugin-CjODyxZ2.js +0 -1
- package/dist-embed/chunks/index-DlK9qLPz.js +0 -1
- package/dist-embed/chunks/plugin-Dz5L6Xn8.js +0 -1
package/dist-embed/chunks/{CellSidebarExtension-CQlXdanG.js → CellSidebarExtension-CfaJL6DQ.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as _,v as Ue,j as u,iF as Pt,I as q,e3 as Ge,cl as pe,b6 as ge,c as J,ey as Tt,es as qe,eJ as Dt,iG as At,iH as jt,iI as Je,iJ as Ye,c0 as W,iK as It,iL as Nt,iM as Lt,bw as De,iN as ct,iO as ht,iP as Rt,iQ as fe,ar as Ot,bx as ut,iR as ft,iS as Ft,iT as Xe,J as j,iU as Ze,iV as me,iW as Bt,iX as Wt,iY as Vt,ak as _e,iZ as Ie,i_ as Qe,ch as ke,cg as ee,aW as $t,dJ as Gt,bZ as z,iB as Ht,ae as zt,c5 as Kt,ag as Z,cx as Ut,cY as qt,hj as Fe,hh as mt,i$ as xe,j0 as de,j1 as Jt,am as Yt,ah as Xt,iz as Zt,j2 as pt,h4 as H,j3 as Qt,j4 as R,j5 as en,cR as tn,j6 as gt,j7 as nn,j8 as sn,j9 as on,o as ne,B as ue,cF as rn,du as et,_ as an,aa as ln,dy as tt,dz as ce,dA as dn,ca as cn,l as hn,ja as un,jb as _t,eS as fn,jc as ae,b5 as D,C as le,cn as nt,bh as vt,d5 as mn,cs as pn,be as Se,i as gn,P as _n,an as vn,au as yn}from"../datalayer-app-main.js";import{b as Cn,c as bn,f as he,P as Ne,d as wn,W as kn,r as xn,g as Sn,h as Mn,i as En,C as Pn,a as Tn}from"./index-BYQwy0Zx.js";import{c as Dn,N as Be}from"./NotebookSkeleton-HdM76lOj.js";import{H as An}from"./hoverbox-CStlKQWE.js";import{R as yt,L as jn}from"./index-BJ7Yskx5.js";import{a as In,W as st}from"./renderer-lVFw9lw7.js";import{C as Me,S as Ee}from"./SquareIcon-e3ygcjpv.js";function Nn(...r){return _.useCallback(e=>{for(const t of r)typeof t=="function"?t(e):t&&(t.current=e)},r)}var Q={Banner:"prc-Banner-Banner-IR8eJ",BannerContainer:"prc-Banner-BannerContainer-lbx3d",BannerContent:"prc-Banner-BannerContent-zTITK",BannerActions:"prc-Banner-BannerActions-XCfHL",BannerTitle:"prc-Banner-BannerTitle-TcuJl",BannerIcon:"prc-Banner-BannerIcon-WuOyf",BannerDismiss:"prc-Banner-BannerDismiss-uBZVm",BannerActionsContainer:"prc-Banner-BannerActionsContainer-ukGMH"};const Ln={critical:u.jsx(At,{}),info:u.jsx(qe,{}),success:u.jsx(Dt,{}),upsell:u.jsx(qe,{}),warning:u.jsx(Tt,{})},Rn={critical:"Critical",info:"Information",success:"Success",upsell:"Recommendation",warning:"Warning"},On=Ue.forwardRef(function({"aria-label":e,children:t,className:n,description:s,hideTitle:o,icon:i,onDismiss:a,primaryAction:l,secondaryAction:d,title:c,variant:h="info",...f},m){const C=!!a,x=l||d,I=Ue.useRef(null),L=Nn(m,I),g=h==="info"||h==="upsell";return u.jsxs("section",{...f,"aria-label":e??Rn[h],className:pe(n,Q.Banner),"data-dismissible":a?"":void 0,"data-title-hidden":o?"":void 0,"data-variant":h,tabIndex:-1,ref:L,children:[u.jsx("div",{className:Q.BannerIcon,children:i&&g?i:Ln[h]}),u.jsxs("div",{className:Q.BannerContainer,children:[u.jsxs("div",{className:Q.BannerContent,children:[c?o?u.jsx(Pt,{children:u.jsx(We,{children:c})}):u.jsx(We,{children:c}):null,s?u.jsx(Ct,{children:s}):null,t]}),x?u.jsx(Fn,{primaryAction:l,secondaryAction:d}):null]}),C?u.jsx(q,{"aria-label":"Dismiss banner",onClick:a,className:Q.BannerDismiss,icon:Ge,variant:"invisible"}):null]})});function We(r){const e=ge.c(12);let t,n,s,o;e[0]!==r?({as:o,className:n,children:t,...s}=r,e[0]=r,e[1]=t,e[2]=n,e[3]=s,e[4]=o):(t=e[1],n=e[2],s=e[3],o=e[4]);const i=o===void 0?"h2":o;let a;e[5]!==n?(a=pe(n,Q.BannerTitle),e[5]=n,e[6]=a):a=e[6];let l;return e[7]!==i||e[8]!==t||e[9]!==s||e[10]!==a?(l=u.jsx(i,{...s,className:a,"data-banner-title":"",children:t}),e[7]=i,e[8]=t,e[9]=s,e[10]=a,e[11]=l):l=e[11],l}function Ct(r){const e=ge.c(10);let t,n,s;e[0]!==r?({children:t,className:n,...s}=r,e[0]=r,e[1]=t,e[2]=n,e[3]=s):(t=e[1],n=e[2],s=e[3]);let o;e[4]!==n?(o=pe("BannerDescription",n),e[4]=n,e[5]=o):o=e[5];let i;return e[6]!==t||e[7]!==s||e[8]!==o?(i=u.jsx("div",{...s,className:o,children:t}),e[6]=t,e[7]=s,e[8]=o,e[9]=i):i=e[9],i}function Fn(r){const e=ge.c(9),{primaryAction:t,secondaryAction:n}=r,s=n??null,o=t??null;let i;e[0]!==s||e[1]!==o?(i=u.jsxs("div",{className:Q.BannerActionsContainer,"data-primary-action":"trailing",children:[s,o]}),e[0]=s,e[1]=o,e[2]=i):i=e[2];const a=t??null,l=n??null;let d;e[3]!==a||e[4]!==l?(d=u.jsxs("div",{className:Q.BannerActionsContainer,"data-primary-action":"leading",children:[a,l]}),e[3]=a,e[4]=l,e[5]=d):d=e[5];let c;return e[6]!==i||e[7]!==d?(c=u.jsxs("div",{className:Q.BannerActions,children:[i,d]}),e[6]=i,e[7]=d,e[8]=c):c=e[8],c}const bt=_.forwardRef((r,e)=>{const t=ge.c(11);let n,s,o;t[0]!==r?({children:n,className:s,...o}=r,t[0]=r,t[1]=n,t[2]=s,t[3]=o):(n=t[1],s=t[2],o=t[3]);let i;t[4]!==s?(i=pe("BannerPrimaryAction",s),t[4]=s,t[5]=i):i=t[5];let a;return t[6]!==n||t[7]!==e||t[8]!==o||t[9]!==i?(a=u.jsx(J,{ref:e,className:i,variant:"default",...o,children:n}),t[6]=n,t[7]=e,t[8]=o,t[9]=i,t[10]=a):a=t[10],a});bt.displayName="BannerPrimaryAction";const wt=_.forwardRef((r,e)=>{const t=ge.c(11);let n,s,o;t[0]!==r?({children:n,className:s,...o}=r,t[0]=r,t[1]=n,t[2]=s,t[3]=o):(n=t[1],s=t[2],o=t[3]);let i;t[4]!==s?(i=pe("BannerPrimaryAction",s),t[4]=s,t[5]=i):i=t[5];let a;return t[6]!==n||t[7]!==e||t[8]!==o||t[9]!==i?(a=u.jsx(J,{ref:e,className:i,variant:"link",...o,children:n}),t[6]=n,t[7]=e,t[8]=o,t[9]=i,t[10]=a):a=t[10],a});wt.displayName="BannerSecondaryAction";const Bn=Object.assign(On,{Title:We,Description:Ct,PrimaryAction:bt,SecondaryAction:wt}),ve=Nt.define({combine(r){return r[r.length-1]}}),Wn=De.baseTheme({".jp-remote-cursor":{borderLeft:"1px solid black",marginLeft:"-1px"},".jp-remote-cursor.jp-mod-primary":{borderLeftWidth:"2px"},".jp-remote-selection":{opacity:.5},".cm-tooltip":{border:"none"},".cm-tooltip.jp-remote-userInfo":{color:"var(--fgColor-onEmphasis, #ffffff)",padding:"0px 2px"}});function He(r,e){const t=r?.username||r?.display_name||r?.name||String(e),{theme:n,colorMode:s}=Ot.getState(),o=s==="auto"?typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light":s;return Dn(t,n,o)}const Ae=Lt.define();class kt{style;marker;constructor(e,t){this.style=e,this.marker=t}draw(){const e=this.marker.draw();for(const[t,n]of Object.entries(this.style))e.style[t]=n;return e}eq(e){return this.marker.eq(e.marker)&&W.deepEqual(this.style,e.style)}update(e,t){for(const[n,s]of Object.entries(this.style))e.style[n]=s;return this.marker.update(e,t.marker)}}const Vn=ct({above:!0,markers(r){const{awareness:e,ytext:t}=r.state.facet(ve),n=t.doc,s=[];return e.getStates().forEach((o,i)=>{if(i===e.doc.clientID)return;const a=o.cursors;for(const l of a??[]){if(!l?.anchor||!l?.head)return;const d=fe(l.anchor,n),c=fe(l.head,n);if(d?.type!==t||c?.type!==t)return;const h=l.primary??!0?"jp-remote-cursor jp-mod-primary":"jp-remote-cursor",f=ut.cursor(c.index,c.index>d.index?-1:1);for(const m of ft.forRange(r,h,f))s.push(new kt({borderLeftColor:He(o.user,i)},m))}}),s},update(r,e){return!!r.transactions.find(t=>t.annotation(Ae))},class:"jp-remote-cursors"});function ot(r){const e=new Array,{awareness:t,ytext:n}=r.facet(ve),s=n.doc;for(const[o,i]of t.getStates())if(o!==t.doc.clientID)for(const a of i.cursors??[]){if(!a?.head)continue;const l=fe(a.head,s);l?.type===n&&e.push({pos:l.index,above:!0,create:()=>{const d=document.createElement("div");return d.classList.add("jp-remote-userInfo"),d.style.backgroundColor=He(i.user,o),d.textContent=i.user?.display_name??"Anonymous",{dom:d}}})}return e}const $n=ht.define({create:ot,update(r,e){return e.annotation(Ae)?ot(e.state):r},provide(r){return Rt.computeN([r],e=>e.field(r))}}),Gn=ct({above:!1,markers(r){const{awareness:e,ytext:t}=r.state.facet(ve),n=t.doc,s=[];return e.getStates().forEach((o,i)=>{if(i===e.doc.clientID)return;const a=o.cursors;for(const l of a??[]){if((l.empty??!0)||!l?.anchor||!l?.head)return;const d=fe(l.anchor,n),c=fe(l.head,n);if(d?.type!==t||c?.type!==t)return;const h="jp-remote-selection";for(const f of ft.forRange(r,h,ut.range(d.index,c.index)))s.push(new kt({backgroundColor:He(o.user,i)},f))}}),s},update(r,e){return!!r.transactions.find(t=>t.annotation(Ae))},class:"jp-remote-selections"}),Hn=jt.fromClass(class{editorAwareness;_listener;constructor(r){this.editorAwareness=r.state.facet(ve),this._listener=({added:e,updated:t,removed:n})=>{e.concat(t).concat(n).findIndex(o=>o!==this.editorAwareness.awareness.doc.clientID)>=0&&r.dispatch({annotations:[Ae.of([])]})},this.editorAwareness.awareness.on("change",this._listener)}destroy(){this.editorAwareness.awareness.off("change",this._listener)}update(r){if(!r.docChanged&&!r.selectionSet)return;const{awareness:e,ytext:t}=this.editorAwareness,n=e.getLocalState();if(n){const s=r.view.hasFocus&&r.view.dom.ownerDocument.hasFocus(),o=r.state.selection,i=new Array;if(s&&o){for(const a of o.ranges){const l=a===o.main,d=Je(t,a.anchor),c=Je(t,a.head);i.push({anchor:d,head:c,primary:l,empty:a.empty})}if(!n.cursors||i.length>0){const a=n.cursors?.map(l=>({...l,anchor:l?.anchor?Ye(l.anchor):null,head:l?.head?Ye(l.head):null}));W.deepEqual(i,a)||e.setLocalStateField("cursors",i)}}}}},{provide:()=>[Wn,Vn,Gn,$n,It({position:"absolute",parent:document.body})]});function zn(r){return[ve.of(r),Hn]}class je extends Ft{constructor(e={}){var t;super(),this.version="2.0.0",this.ymeta=this.ydoc.getMap("meta"),this._onMetaChanged=n=>{const s=n.find(i=>i.target===this.ymeta.get("metadata"));if(s){const i=s.changes.keys,a=this.ymeta.get("metadata");s.changes.keys.forEach((l,d)=>{switch(l.action){case"add":this._metadataChanged.emit({key:d,type:"add",newValue:a.get(d)});break;case"delete":this._metadataChanged.emit({key:d,type:"remove",oldValue:l.oldValue});break;case"update":{const c=a.get(d),h=l.oldValue;let f=!0;typeof h=="object"&&typeof c=="object"?f=W.deepEqual(h,c):f=h===c,f||this._metadataChanged.emit({key:d,type:"change",oldValue:h,newValue:c})}break}}),this._changed.emit({metadataChange:i})}const o=n.find(i=>i.target===this.ymeta);if(o){if(o.keysChanged.has("metadata")){const i=o.changes.keys.get("metadata");if(i?.action==="add"&&!i.oldValue){const a=new Map;for(const l of Object.keys(this.metadata))a.set(l,{action:"add",oldValue:void 0}),this._metadataChanged.emit({key:l,type:"add",newValue:this.getMetadata(l)});this._changed.emit({metadataChange:a})}}if(o.keysChanged.has("nbformat")){const i=o.changes.keys.get("nbformat"),a={key:"nbformat",oldValue:i?.oldValue?i.oldValue:void 0,newValue:this.nbformat};this._changed.emit({nbformatChanged:a})}if(o.keysChanged.has("nbformat_minor")){const i=o.changes.keys.get("nbformat_minor"),a={key:"nbformat_minor",oldValue:i?.oldValue?i.oldValue:void 0,newValue:this.nbformat_minor};this._changed.emit({nbformatChanged:a})}}},this._onYCellsChanged=n=>{n.changes.added.forEach(i=>{const a=i.content.type;if(!this._ycellMapping.has(a)){const l=Xe(a,{notebook:this});this._ycellMapping.set(a,l)}}),n.changes.deleted.forEach(i=>{const a=i.content.type,l=this._ycellMapping.get(a);l&&(l.dispose(),this._ycellMapping.delete(a))});let s=0;const o=[];n.changes.delta.forEach(i=>{if(i.insert!=null){const a=i.insert.map(l=>this._ycellMapping.get(l));o.push({insert:a}),this.cells.splice(s,0,...a),s+=i.insert.length}else i.delete!=null?(o.push(i),this.cells.splice(s,i.delete)):i.retain!=null&&(o.push(i),s+=i.retain)}),this._changed.emit({cellsChange:o})},this._metadataChanged=new j(this),this._ycells=this.ydoc.getArray("cells"),this._ycellMapping=new WeakMap,this._disableDocumentWideUndoRedo=(t=e.disableDocumentWideUndoRedo)!==null&&t!==void 0?t:!1,this.cells=this._ycells.toArray().map(n=>(this._ycellMapping.has(n)||this._ycellMapping.set(n,Xe(n,{notebook:this})),this._ycellMapping.get(n))),this.undoManager.addToScope(this._ycells),this._ycells.observe(this._onYCellsChanged),this.ymeta.observeDeep(this._onMetaChanged)}static create(e={}){var t,n,s,o,i,a,l,d,c;const h=new je({disableDocumentWideUndoRedo:(t=e.disableDocumentWideUndoRedo)!==null&&t!==void 0?t:!1}),f={cells:(s=(n=e.data)===null||n===void 0?void 0:n.cells)!==null&&s!==void 0?s:[],nbformat:(i=(o=e.data)===null||o===void 0?void 0:o.nbformat)!==null&&i!==void 0?i:4,nbformat_minor:(l=(a=e.data)===null||a===void 0?void 0:a.nbformat_minor)!==null&&l!==void 0?l:5,metadata:(c=(d=e.data)===null||d===void 0?void 0:d.metadata)!==null&&c!==void 0?c:{}};return h.setSource(f),h}get disableDocumentWideUndoRedo(){return this._disableDocumentWideUndoRedo}get metadata(){return this.getMetadata()}set metadata(e){this.setMetadata(e)}get metadataChanged(){return this._metadataChanged}get nbformat(){return this.ymeta.get("nbformat")}set nbformat(e){this.transact(()=>{this.ymeta.set("nbformat",e)},!1)}get nbformat_minor(){return this.ymeta.get("nbformat_minor")}set nbformat_minor(e){this.transact(()=>{this.ymeta.set("nbformat_minor",e)},!1)}dispose(){this.isDisposed||(this._ycells.unobserve(this._onYCellsChanged),this.ymeta.unobserveDeep(this._onMetaChanged),super.dispose())}getCell(e){return this.cells[e]}addCell(e){return this.insertCell(this._ycells.length,e)}insertCell(e,t){return this.insertCells(e,[t])[0]}insertCells(e,t){const n=t.map(s=>{const o=Ze(s,this);return this._ycellMapping.set(o.ymodel,o),o});return this.transact(()=>{this._ycells.insert(e,n.map(s=>s.ymodel))}),this.dirty=!0,n}moveCell(e,t){this.moveCells(e,t)}moveCells(e,t,n=1){const s=new Array(n).fill(!0).map((o,i)=>this.getCell(e+i).toJSON());this.transact(()=>{this._ycells.delete(e,n),this._ycells.insert(e>t?t:t-n+1,s.map(o=>Ze(o,this).ymodel))}),this.dirty=!0}deleteCell(e){this.deleteCellRange(e,e+1)}deleteCellRange(e,t){this.transact(()=>{this._ycells.delete(e,t-e)}),this.dirty=!0}deleteMetadata(e){if(typeof this.getMetadata(e)>"u")return;const t=this.metadata;delete t[e],this.setMetadata(t)}getMetadata(e){const t=this.ymeta.get("metadata");if(t!==void 0)if(typeof e=="string"){const n=t.get(e);return typeof n>"u"?void 0:W.deepCopy(n)}else return W.deepCopy(t.toJSON())}setMetadata(e,t){var n;if(typeof e=="string"){if(typeof t>"u")throw new TypeError(`Metadata value for ${e} cannot be 'undefined'; use deleteMetadata.`);if(W.deepEqual((n=this.getMetadata(e))!==null&&n!==void 0?n:null,t))return;const s={};s[e]=t,this.updateMetadata(s)}else if(!this.metadata||!W.deepEqual(this.metadata,e)){const s=W.deepCopy(e),o=this.ymeta.get("metadata");if(o===void 0)return;this.transact(()=>{o.clear();for(const[i,a]of Object.entries(s))o.set(i,a)}),this.dirty=!0}}updateMetadata(e){const t=W.deepCopy(e),n=this.ymeta.get("metadata");n!==void 0&&(this.transact(()=>{for(const[s,o]of Object.entries(t))n.set(s,o)}),this.dirty=!0)}getSource(){return this.toJSON()}setSource(e){this.fromJSON(e),this.dirty=!1}fromJSON(e){this.transact(()=>{this.nbformat=e.nbformat,this.nbformat_minor=e.nbformat_minor;const t=e.metadata;if(t.orig_nbformat!==void 0&&delete t.orig_nbformat,this.metadata)this.metadata=t;else{const o=new me;for(const[i,a]of Object.entries(t))o.set(i,a);this.ymeta.set("metadata",o)}const n=e.nbformat===4&&e.nbformat_minor>=5,s=e.cells.map(o=>(n||delete o.id,o));this.insertCells(this.cells.length,s),this.deleteCellRange(0,this.cells.length)})}toJSON(){const e=this.nbformat===4&&this.nbformat_minor<=4;return{metadata:this.metadata,nbformat_minor:this.nbformat_minor,nbformat:this.nbformat,cells:this.cells.map(t=>{const n=t.toJSON();return e&&delete n.id,n})}}}class Kn{constructor(e){this.model=e,this._cellMap=new WeakMap,this._changed=new j(this),this._isDisposed=!1,this._insertCells(0,this.model.cells),this.model.changed.connect(this._onSharedModelChanged,this)}get changed(){return this._changed}get isDisposed(){return this._isDisposed}get length(){return this.model.cells.length}*[Symbol.iterator](){for(const e of this.model.cells)yield this._cellMap.get(e)}dispose(){var e;if(!this._isDisposed){this._isDisposed=!0;for(const t of this.model.cells)(e=this._cellMap.get(t))===null||e===void 0||e.dispose();j.clearData(this)}}get(e){return this._cellMap.get(this.model.cells[e])}_insertCells(e,t){return t.forEach(n=>{let s;switch(n.cell_type){case"code":{s=new Vt({sharedModel:n});break}case"markdown":{s=new Wt({sharedModel:n});break}default:s=new Bt({sharedModel:n})}this._cellMap.set(n,s),n.disposed.connect(()=>{s.dispose(),this._cellMap.delete(n)})}),this.length}_onSharedModelChanged(e,t){var n;let s=0;const o=new Array;(n=t.cellsChange)===null||n===void 0||n.forEach(i=>{i.insert!=null?(this._insertCells(s,i.insert),o.push({type:"add",newIndex:s,newValues:i.insert.map(a=>this._cellMap.get(a)),oldIndex:-2,oldValues:[]}),s+=i.insert.length):i.delete!=null?o.push({type:"remove",newIndex:-1,newValues:[],oldIndex:s,oldValues:new Array(i.delete).fill(void 0)}):i.retain!=null&&(s+=i.retain)}),o.forEach(i=>this._changed.emit(i))}}class Un{constructor(e){this._requestBatchSize=10,this._cursor=0,this._hasSession=!1,this._history=[],this._placeholder="",this._kernelSession="",this._setByHistory=!1,this._isDisposed=!1,this._editor=null,this._filtered=[],this._kernel=null,this._sessionContext=e.sessionContext,this._trans=(e.translator||_e).load("jupyterlab"),this._handleKernel().then(()=>{this._sessionContext.kernelChanged.connect(this._handleKernel,this)}),this._toRequest=this._requestBatchSize}get editor(){return this._editor}set editor(e){if(this._editor===e)return;const t=this._editor;t&&t.model.sharedModel.changed.disconnect(this.onTextChange,this),this._editor=e,e&&e.model.sharedModel.changed.connect(this.onTextChange,this)}get placeholder(){return this._placeholder}get kernelSession(){return this._kernelSession}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed=!0,this._history.length=0,j.clearData(this)}async checkSession(e){var t;this._hasSession||(await this._retrieveHistory(),this._hasSession=!0,this.editor=e.editor,this._placeholder=((t=this._editor)===null||t===void 0?void 0:t.model.sharedModel.getSource())||"",this.setFilter(this._placeholder),this._cursor=this._filtered.length-1)}async back(e){return await this.checkSession(e),--this._cursor,this._cursor<0&&await this.fetchBatch(),this._cursor=Math.max(0,this._cursor),this._filtered[this._cursor]}async forward(e){return await this.checkSession(e),++this._cursor,this._cursor=Math.min(this._filtered.length-1,this._cursor),this._filtered[this._cursor]}updateEditor(e,t){var n,s;if(e){const o=(n=e.editor)===null||n===void 0?void 0:n.model,i=o?.sharedModel.getSource();if(this.isDisposed||!t||i===t)return;this._setByHistory=!0,o?.sharedModel.setSource(t);let a=0;a=t.indexOf(`
|
|
1
|
+
import{r as _,v as Ue,j as u,iG as Pt,I as q,e4 as $e,cm as pe,b7 as ge,c as J,ez as Tt,et as qe,eK as Dt,iH as At,iI as jt,iJ as Je,iK as Ye,c1 as W,iL as It,iM as Nt,iN as Lt,bx as De,iO as ct,iP as ht,iQ as Rt,iR as fe,ar as Ot,by as ut,iS as ft,iT as Ft,iU as Xe,J as j,iV as Ze,iW as me,iX as Bt,iY as Wt,iZ as Vt,ak as _e,i_ as Ie,i$ as Qe,ci as ke,ch as ee,aW as Gt,dK as $t,b_ as z,iC as Ht,ae as zt,c6 as Kt,ag as Z,cy as Ut,cZ as qt,hk as Fe,hi as mt,j0 as xe,j1 as de,j2 as Jt,am as Yt,ah as Xt,iA as Zt,j3 as pt,h5 as H,j4 as Qt,j5 as R,j6 as en,cS as tn,j7 as gt,j8 as nn,j9 as sn,ja as on,o as ne,B as ue,cG as rn,dv as et,_ as an,aa as ln,dz as tt,dA as ce,dB as dn,cb as cn,l as hn,jb as un,jc as _t,eT as fn,jd as ae,b6 as D,C as le,co as nt,bi as vt,d6 as mn,ct as pn,bf as Se,i as gn,P as _n,an as vn,au as yn}from"../datalayer-app-main.js";import{b as Cn,c as bn,f as he,P as Ne,d as wn,W as kn,r as xn,g as Sn,h as Mn,i as En,C as Pn,a as Tn}from"./index-s3hayhRS.js";import{c as Dn,N as Be}from"./NotebookSkeleton-CI7ovjNW.js";import{H as An}from"./hoverbox-CStlKQWE.js";import{R as yt,L as jn}from"./index-CpcHHQd7.js";import{a as In,W as st}from"./renderer-2D5v6hpK.js";import{C as Me,S as Ee}from"./SquareIcon-e3ygcjpv.js";function Nn(...r){return _.useCallback(e=>{for(const t of r)typeof t=="function"?t(e):t&&(t.current=e)},r)}var Q={Banner:"prc-Banner-Banner-IR8eJ",BannerContainer:"prc-Banner-BannerContainer-lbx3d",BannerContent:"prc-Banner-BannerContent-zTITK",BannerActions:"prc-Banner-BannerActions-XCfHL",BannerTitle:"prc-Banner-BannerTitle-TcuJl",BannerIcon:"prc-Banner-BannerIcon-WuOyf",BannerDismiss:"prc-Banner-BannerDismiss-uBZVm",BannerActionsContainer:"prc-Banner-BannerActionsContainer-ukGMH"};const Ln={critical:u.jsx(At,{}),info:u.jsx(qe,{}),success:u.jsx(Dt,{}),upsell:u.jsx(qe,{}),warning:u.jsx(Tt,{})},Rn={critical:"Critical",info:"Information",success:"Success",upsell:"Recommendation",warning:"Warning"},On=Ue.forwardRef(function({"aria-label":e,children:t,className:n,description:s,hideTitle:o,icon:i,onDismiss:a,primaryAction:l,secondaryAction:d,title:c,variant:h="info",...f},m){const C=!!a,x=l||d,I=Ue.useRef(null),L=Nn(m,I),g=h==="info"||h==="upsell";return u.jsxs("section",{...f,"aria-label":e??Rn[h],className:pe(n,Q.Banner),"data-dismissible":a?"":void 0,"data-title-hidden":o?"":void 0,"data-variant":h,tabIndex:-1,ref:L,children:[u.jsx("div",{className:Q.BannerIcon,children:i&&g?i:Ln[h]}),u.jsxs("div",{className:Q.BannerContainer,children:[u.jsxs("div",{className:Q.BannerContent,children:[c?o?u.jsx(Pt,{children:u.jsx(We,{children:c})}):u.jsx(We,{children:c}):null,s?u.jsx(Ct,{children:s}):null,t]}),x?u.jsx(Fn,{primaryAction:l,secondaryAction:d}):null]}),C?u.jsx(q,{"aria-label":"Dismiss banner",onClick:a,className:Q.BannerDismiss,icon:$e,variant:"invisible"}):null]})});function We(r){const e=ge.c(12);let t,n,s,o;e[0]!==r?({as:o,className:n,children:t,...s}=r,e[0]=r,e[1]=t,e[2]=n,e[3]=s,e[4]=o):(t=e[1],n=e[2],s=e[3],o=e[4]);const i=o===void 0?"h2":o;let a;e[5]!==n?(a=pe(n,Q.BannerTitle),e[5]=n,e[6]=a):a=e[6];let l;return e[7]!==i||e[8]!==t||e[9]!==s||e[10]!==a?(l=u.jsx(i,{...s,className:a,"data-banner-title":"",children:t}),e[7]=i,e[8]=t,e[9]=s,e[10]=a,e[11]=l):l=e[11],l}function Ct(r){const e=ge.c(10);let t,n,s;e[0]!==r?({children:t,className:n,...s}=r,e[0]=r,e[1]=t,e[2]=n,e[3]=s):(t=e[1],n=e[2],s=e[3]);let o;e[4]!==n?(o=pe("BannerDescription",n),e[4]=n,e[5]=o):o=e[5];let i;return e[6]!==t||e[7]!==s||e[8]!==o?(i=u.jsx("div",{...s,className:o,children:t}),e[6]=t,e[7]=s,e[8]=o,e[9]=i):i=e[9],i}function Fn(r){const e=ge.c(9),{primaryAction:t,secondaryAction:n}=r,s=n??null,o=t??null;let i;e[0]!==s||e[1]!==o?(i=u.jsxs("div",{className:Q.BannerActionsContainer,"data-primary-action":"trailing",children:[s,o]}),e[0]=s,e[1]=o,e[2]=i):i=e[2];const a=t??null,l=n??null;let d;e[3]!==a||e[4]!==l?(d=u.jsxs("div",{className:Q.BannerActionsContainer,"data-primary-action":"leading",children:[a,l]}),e[3]=a,e[4]=l,e[5]=d):d=e[5];let c;return e[6]!==i||e[7]!==d?(c=u.jsxs("div",{className:Q.BannerActions,children:[i,d]}),e[6]=i,e[7]=d,e[8]=c):c=e[8],c}const bt=_.forwardRef((r,e)=>{const t=ge.c(11);let n,s,o;t[0]!==r?({children:n,className:s,...o}=r,t[0]=r,t[1]=n,t[2]=s,t[3]=o):(n=t[1],s=t[2],o=t[3]);let i;t[4]!==s?(i=pe("BannerPrimaryAction",s),t[4]=s,t[5]=i):i=t[5];let a;return t[6]!==n||t[7]!==e||t[8]!==o||t[9]!==i?(a=u.jsx(J,{ref:e,className:i,variant:"default",...o,children:n}),t[6]=n,t[7]=e,t[8]=o,t[9]=i,t[10]=a):a=t[10],a});bt.displayName="BannerPrimaryAction";const wt=_.forwardRef((r,e)=>{const t=ge.c(11);let n,s,o;t[0]!==r?({children:n,className:s,...o}=r,t[0]=r,t[1]=n,t[2]=s,t[3]=o):(n=t[1],s=t[2],o=t[3]);let i;t[4]!==s?(i=pe("BannerPrimaryAction",s),t[4]=s,t[5]=i):i=t[5];let a;return t[6]!==n||t[7]!==e||t[8]!==o||t[9]!==i?(a=u.jsx(J,{ref:e,className:i,variant:"link",...o,children:n}),t[6]=n,t[7]=e,t[8]=o,t[9]=i,t[10]=a):a=t[10],a});wt.displayName="BannerSecondaryAction";const Bn=Object.assign(On,{Title:We,Description:Ct,PrimaryAction:bt,SecondaryAction:wt}),ve=Nt.define({combine(r){return r[r.length-1]}}),Wn=De.baseTheme({".jp-remote-cursor":{borderLeft:"1px solid black",marginLeft:"-1px"},".jp-remote-cursor.jp-mod-primary":{borderLeftWidth:"2px"},".jp-remote-selection":{opacity:.5},".cm-tooltip":{border:"none"},".cm-tooltip.jp-remote-userInfo":{color:"var(--fgColor-onEmphasis, #ffffff)",padding:"0px 2px"}});function He(r,e){const t=r?.username||r?.display_name||r?.name||String(e),{theme:n,colorMode:s}=Ot.getState(),o=s==="auto"?typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light":s;return Dn(t,n,o)}const Ae=Lt.define();class kt{style;marker;constructor(e,t){this.style=e,this.marker=t}draw(){const e=this.marker.draw();for(const[t,n]of Object.entries(this.style))e.style[t]=n;return e}eq(e){return this.marker.eq(e.marker)&&W.deepEqual(this.style,e.style)}update(e,t){for(const[n,s]of Object.entries(this.style))e.style[n]=s;return this.marker.update(e,t.marker)}}const Vn=ct({above:!0,markers(r){const{awareness:e,ytext:t}=r.state.facet(ve),n=t.doc,s=[];return e.getStates().forEach((o,i)=>{if(i===e.doc.clientID)return;const a=o.cursors;for(const l of a??[]){if(!l?.anchor||!l?.head)return;const d=fe(l.anchor,n),c=fe(l.head,n);if(d?.type!==t||c?.type!==t)return;const h=l.primary??!0?"jp-remote-cursor jp-mod-primary":"jp-remote-cursor",f=ut.cursor(c.index,c.index>d.index?-1:1);for(const m of ft.forRange(r,h,f))s.push(new kt({borderLeftColor:He(o.user,i)},m))}}),s},update(r,e){return!!r.transactions.find(t=>t.annotation(Ae))},class:"jp-remote-cursors"});function ot(r){const e=new Array,{awareness:t,ytext:n}=r.facet(ve),s=n.doc;for(const[o,i]of t.getStates())if(o!==t.doc.clientID)for(const a of i.cursors??[]){if(!a?.head)continue;const l=fe(a.head,s);l?.type===n&&e.push({pos:l.index,above:!0,create:()=>{const d=document.createElement("div");return d.classList.add("jp-remote-userInfo"),d.style.backgroundColor=He(i.user,o),d.textContent=i.user?.display_name??"Anonymous",{dom:d}}})}return e}const Gn=ht.define({create:ot,update(r,e){return e.annotation(Ae)?ot(e.state):r},provide(r){return Rt.computeN([r],e=>e.field(r))}}),$n=ct({above:!1,markers(r){const{awareness:e,ytext:t}=r.state.facet(ve),n=t.doc,s=[];return e.getStates().forEach((o,i)=>{if(i===e.doc.clientID)return;const a=o.cursors;for(const l of a??[]){if((l.empty??!0)||!l?.anchor||!l?.head)return;const d=fe(l.anchor,n),c=fe(l.head,n);if(d?.type!==t||c?.type!==t)return;const h="jp-remote-selection";for(const f of ft.forRange(r,h,ut.range(d.index,c.index)))s.push(new kt({backgroundColor:He(o.user,i)},f))}}),s},update(r,e){return!!r.transactions.find(t=>t.annotation(Ae))},class:"jp-remote-selections"}),Hn=jt.fromClass(class{editorAwareness;_listener;constructor(r){this.editorAwareness=r.state.facet(ve),this._listener=({added:e,updated:t,removed:n})=>{e.concat(t).concat(n).findIndex(o=>o!==this.editorAwareness.awareness.doc.clientID)>=0&&r.dispatch({annotations:[Ae.of([])]})},this.editorAwareness.awareness.on("change",this._listener)}destroy(){this.editorAwareness.awareness.off("change",this._listener)}update(r){if(!r.docChanged&&!r.selectionSet)return;const{awareness:e,ytext:t}=this.editorAwareness,n=e.getLocalState();if(n){const s=r.view.hasFocus&&r.view.dom.ownerDocument.hasFocus(),o=r.state.selection,i=new Array;if(s&&o){for(const a of o.ranges){const l=a===o.main,d=Je(t,a.anchor),c=Je(t,a.head);i.push({anchor:d,head:c,primary:l,empty:a.empty})}if(!n.cursors||i.length>0){const a=n.cursors?.map(l=>({...l,anchor:l?.anchor?Ye(l.anchor):null,head:l?.head?Ye(l.head):null}));W.deepEqual(i,a)||e.setLocalStateField("cursors",i)}}}}},{provide:()=>[Wn,Vn,$n,Gn,It({position:"absolute",parent:document.body})]});function zn(r){return[ve.of(r),Hn]}class je extends Ft{constructor(e={}){var t;super(),this.version="2.0.0",this.ymeta=this.ydoc.getMap("meta"),this._onMetaChanged=n=>{const s=n.find(i=>i.target===this.ymeta.get("metadata"));if(s){const i=s.changes.keys,a=this.ymeta.get("metadata");s.changes.keys.forEach((l,d)=>{switch(l.action){case"add":this._metadataChanged.emit({key:d,type:"add",newValue:a.get(d)});break;case"delete":this._metadataChanged.emit({key:d,type:"remove",oldValue:l.oldValue});break;case"update":{const c=a.get(d),h=l.oldValue;let f=!0;typeof h=="object"&&typeof c=="object"?f=W.deepEqual(h,c):f=h===c,f||this._metadataChanged.emit({key:d,type:"change",oldValue:h,newValue:c})}break}}),this._changed.emit({metadataChange:i})}const o=n.find(i=>i.target===this.ymeta);if(o){if(o.keysChanged.has("metadata")){const i=o.changes.keys.get("metadata");if(i?.action==="add"&&!i.oldValue){const a=new Map;for(const l of Object.keys(this.metadata))a.set(l,{action:"add",oldValue:void 0}),this._metadataChanged.emit({key:l,type:"add",newValue:this.getMetadata(l)});this._changed.emit({metadataChange:a})}}if(o.keysChanged.has("nbformat")){const i=o.changes.keys.get("nbformat"),a={key:"nbformat",oldValue:i?.oldValue?i.oldValue:void 0,newValue:this.nbformat};this._changed.emit({nbformatChanged:a})}if(o.keysChanged.has("nbformat_minor")){const i=o.changes.keys.get("nbformat_minor"),a={key:"nbformat_minor",oldValue:i?.oldValue?i.oldValue:void 0,newValue:this.nbformat_minor};this._changed.emit({nbformatChanged:a})}}},this._onYCellsChanged=n=>{n.changes.added.forEach(i=>{const a=i.content.type;if(!this._ycellMapping.has(a)){const l=Xe(a,{notebook:this});this._ycellMapping.set(a,l)}}),n.changes.deleted.forEach(i=>{const a=i.content.type,l=this._ycellMapping.get(a);l&&(l.dispose(),this._ycellMapping.delete(a))});let s=0;const o=[];n.changes.delta.forEach(i=>{if(i.insert!=null){const a=i.insert.map(l=>this._ycellMapping.get(l));o.push({insert:a}),this.cells.splice(s,0,...a),s+=i.insert.length}else i.delete!=null?(o.push(i),this.cells.splice(s,i.delete)):i.retain!=null&&(o.push(i),s+=i.retain)}),this._changed.emit({cellsChange:o})},this._metadataChanged=new j(this),this._ycells=this.ydoc.getArray("cells"),this._ycellMapping=new WeakMap,this._disableDocumentWideUndoRedo=(t=e.disableDocumentWideUndoRedo)!==null&&t!==void 0?t:!1,this.cells=this._ycells.toArray().map(n=>(this._ycellMapping.has(n)||this._ycellMapping.set(n,Xe(n,{notebook:this})),this._ycellMapping.get(n))),this.undoManager.addToScope(this._ycells),this._ycells.observe(this._onYCellsChanged),this.ymeta.observeDeep(this._onMetaChanged)}static create(e={}){var t,n,s,o,i,a,l,d,c;const h=new je({disableDocumentWideUndoRedo:(t=e.disableDocumentWideUndoRedo)!==null&&t!==void 0?t:!1}),f={cells:(s=(n=e.data)===null||n===void 0?void 0:n.cells)!==null&&s!==void 0?s:[],nbformat:(i=(o=e.data)===null||o===void 0?void 0:o.nbformat)!==null&&i!==void 0?i:4,nbformat_minor:(l=(a=e.data)===null||a===void 0?void 0:a.nbformat_minor)!==null&&l!==void 0?l:5,metadata:(c=(d=e.data)===null||d===void 0?void 0:d.metadata)!==null&&c!==void 0?c:{}};return h.setSource(f),h}get disableDocumentWideUndoRedo(){return this._disableDocumentWideUndoRedo}get metadata(){return this.getMetadata()}set metadata(e){this.setMetadata(e)}get metadataChanged(){return this._metadataChanged}get nbformat(){return this.ymeta.get("nbformat")}set nbformat(e){this.transact(()=>{this.ymeta.set("nbformat",e)},!1)}get nbformat_minor(){return this.ymeta.get("nbformat_minor")}set nbformat_minor(e){this.transact(()=>{this.ymeta.set("nbformat_minor",e)},!1)}dispose(){this.isDisposed||(this._ycells.unobserve(this._onYCellsChanged),this.ymeta.unobserveDeep(this._onMetaChanged),super.dispose())}getCell(e){return this.cells[e]}addCell(e){return this.insertCell(this._ycells.length,e)}insertCell(e,t){return this.insertCells(e,[t])[0]}insertCells(e,t){const n=t.map(s=>{const o=Ze(s,this);return this._ycellMapping.set(o.ymodel,o),o});return this.transact(()=>{this._ycells.insert(e,n.map(s=>s.ymodel))}),this.dirty=!0,n}moveCell(e,t){this.moveCells(e,t)}moveCells(e,t,n=1){const s=new Array(n).fill(!0).map((o,i)=>this.getCell(e+i).toJSON());this.transact(()=>{this._ycells.delete(e,n),this._ycells.insert(e>t?t:t-n+1,s.map(o=>Ze(o,this).ymodel))}),this.dirty=!0}deleteCell(e){this.deleteCellRange(e,e+1)}deleteCellRange(e,t){this.transact(()=>{this._ycells.delete(e,t-e)}),this.dirty=!0}deleteMetadata(e){if(typeof this.getMetadata(e)>"u")return;const t=this.metadata;delete t[e],this.setMetadata(t)}getMetadata(e){const t=this.ymeta.get("metadata");if(t!==void 0)if(typeof e=="string"){const n=t.get(e);return typeof n>"u"?void 0:W.deepCopy(n)}else return W.deepCopy(t.toJSON())}setMetadata(e,t){var n;if(typeof e=="string"){if(typeof t>"u")throw new TypeError(`Metadata value for ${e} cannot be 'undefined'; use deleteMetadata.`);if(W.deepEqual((n=this.getMetadata(e))!==null&&n!==void 0?n:null,t))return;const s={};s[e]=t,this.updateMetadata(s)}else if(!this.metadata||!W.deepEqual(this.metadata,e)){const s=W.deepCopy(e),o=this.ymeta.get("metadata");if(o===void 0)return;this.transact(()=>{o.clear();for(const[i,a]of Object.entries(s))o.set(i,a)}),this.dirty=!0}}updateMetadata(e){const t=W.deepCopy(e),n=this.ymeta.get("metadata");n!==void 0&&(this.transact(()=>{for(const[s,o]of Object.entries(t))n.set(s,o)}),this.dirty=!0)}getSource(){return this.toJSON()}setSource(e){this.fromJSON(e),this.dirty=!1}fromJSON(e){this.transact(()=>{this.nbformat=e.nbformat,this.nbformat_minor=e.nbformat_minor;const t=e.metadata;if(t.orig_nbformat!==void 0&&delete t.orig_nbformat,this.metadata)this.metadata=t;else{const o=new me;for(const[i,a]of Object.entries(t))o.set(i,a);this.ymeta.set("metadata",o)}const n=e.nbformat===4&&e.nbformat_minor>=5,s=e.cells.map(o=>(n||delete o.id,o));this.insertCells(this.cells.length,s),this.deleteCellRange(0,this.cells.length)})}toJSON(){const e=this.nbformat===4&&this.nbformat_minor<=4;return{metadata:this.metadata,nbformat_minor:this.nbformat_minor,nbformat:this.nbformat,cells:this.cells.map(t=>{const n=t.toJSON();return e&&delete n.id,n})}}}class Kn{constructor(e){this.model=e,this._cellMap=new WeakMap,this._changed=new j(this),this._isDisposed=!1,this._insertCells(0,this.model.cells),this.model.changed.connect(this._onSharedModelChanged,this)}get changed(){return this._changed}get isDisposed(){return this._isDisposed}get length(){return this.model.cells.length}*[Symbol.iterator](){for(const e of this.model.cells)yield this._cellMap.get(e)}dispose(){var e;if(!this._isDisposed){this._isDisposed=!0;for(const t of this.model.cells)(e=this._cellMap.get(t))===null||e===void 0||e.dispose();j.clearData(this)}}get(e){return this._cellMap.get(this.model.cells[e])}_insertCells(e,t){return t.forEach(n=>{let s;switch(n.cell_type){case"code":{s=new Vt({sharedModel:n});break}case"markdown":{s=new Wt({sharedModel:n});break}default:s=new Bt({sharedModel:n})}this._cellMap.set(n,s),n.disposed.connect(()=>{s.dispose(),this._cellMap.delete(n)})}),this.length}_onSharedModelChanged(e,t){var n;let s=0;const o=new Array;(n=t.cellsChange)===null||n===void 0||n.forEach(i=>{i.insert!=null?(this._insertCells(s,i.insert),o.push({type:"add",newIndex:s,newValues:i.insert.map(a=>this._cellMap.get(a)),oldIndex:-2,oldValues:[]}),s+=i.insert.length):i.delete!=null?o.push({type:"remove",newIndex:-1,newValues:[],oldIndex:s,oldValues:new Array(i.delete).fill(void 0)}):i.retain!=null&&(s+=i.retain)}),o.forEach(i=>this._changed.emit(i))}}class Un{constructor(e){this._requestBatchSize=10,this._cursor=0,this._hasSession=!1,this._history=[],this._placeholder="",this._kernelSession="",this._setByHistory=!1,this._isDisposed=!1,this._editor=null,this._filtered=[],this._kernel=null,this._sessionContext=e.sessionContext,this._trans=(e.translator||_e).load("jupyterlab"),this._handleKernel().then(()=>{this._sessionContext.kernelChanged.connect(this._handleKernel,this)}),this._toRequest=this._requestBatchSize}get editor(){return this._editor}set editor(e){if(this._editor===e)return;const t=this._editor;t&&t.model.sharedModel.changed.disconnect(this.onTextChange,this),this._editor=e,e&&e.model.sharedModel.changed.connect(this.onTextChange,this)}get placeholder(){return this._placeholder}get kernelSession(){return this._kernelSession}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed=!0,this._history.length=0,j.clearData(this)}async checkSession(e){var t;this._hasSession||(await this._retrieveHistory(),this._hasSession=!0,this.editor=e.editor,this._placeholder=((t=this._editor)===null||t===void 0?void 0:t.model.sharedModel.getSource())||"",this.setFilter(this._placeholder),this._cursor=this._filtered.length-1)}async back(e){return await this.checkSession(e),--this._cursor,this._cursor<0&&await this.fetchBatch(),this._cursor=Math.max(0,this._cursor),this._filtered[this._cursor]}async forward(e){return await this.checkSession(e),++this._cursor,this._cursor=Math.min(this._filtered.length-1,this._cursor),this._filtered[this._cursor]}updateEditor(e,t){var n,s;if(e){const o=(n=e.editor)===null||n===void 0?void 0:n.model,i=o?.sharedModel.getSource();if(this.isDisposed||!t||i===t)return;this._setByHistory=!0,o?.sharedModel.setSource(t);let a=0;a=t.indexOf(`
|
|
2
2
|
`),a<0&&(a=t.length),(s=e.editor)===null||s===void 0||s.setCursorPosition({line:0,column:a})}}reset(){this._hasSession=!1,this._placeholder="",this._toRequest=this._requestBatchSize}async fetchBatch(){this._toRequest+=this._requestBatchSize;let e=this._filtered.slice().reverse(),t=this._history.slice();await this._retrieveHistory().then(()=>{this.setFilter(this._placeholder);let n=0,s=this._filtered.slice().reverse();for(let o=0;o<e.length;o++){let i=e[o];for(let a=o+n;a<s.length&&i!==s[a];a++)n+=1}this._cursor=this._filtered.length-(e.length+1)-n}),this._cursor<0&&this._history.length>t.length&&await this.fetchBatch()}onHistory(e,t){this._history.length=0;let n=["","",""],s=["","",""],o="";if(e.content.status==="ok"){for(let i=0;i<e.content.history.length;i++)s=e.content.history[i],s!==n&&(o=e.content.history[i][0],this._history.push(n=s));this.kernelSession||s[2]==t?.model.sharedModel.getSource()&&(this._kernelSession=o)}}onTextChange(){if(this._setByHistory){this._setByHistory=!1;return}this.reset()}async _handleKernel(){var e;if(this._kernel=(e=this._sessionContext.session)===null||e===void 0?void 0:e.kernel,!this._kernel){this._history.length=0;return}await this._retrieveHistory().catch()}async _retrieveHistory(e){var t;return await((t=this._kernel)===null||t===void 0?void 0:t.requestHistory(qn(this._toRequest)).then(n=>{this.onHistory(n,e)}).catch(()=>{console.warn(this._trans.__("History was unable to be retrieved"))}))}setFilter(e=""){this._filtered.length=0;let t="",n="";for(let s=0;s<this._history.length;s++)n=this._history[s][2],n!==t&&e!==n&&this._filtered.push(t=n);this._filtered.push(e)}}function qn(r){return{output:!1,raw:!0,hist_access_type:"tail",n:r}}class Ve{constructor(e={}){var t,n;this.standaloneModel=!1,this._readOnly=!1,this._contentChanged=new j(this),this._stateChanged=new j(this),this._isDisposed=!1,this._metadataChanged=new j(this),this.standaloneModel=typeof e.sharedModel>"u",e.sharedModel?this.sharedModel=e.sharedModel:this.sharedModel=je.create({disableDocumentWideUndoRedo:(t=e.disableDocumentWideUndoRedo)!==null&&t!==void 0?t:!0,data:{nbformat:Qe,nbformat_minor:Ie,metadata:{kernelspec:{name:"",display_name:""},language_info:{name:(n=e.languagePreference)!==null&&n!==void 0?n:""}}}}),this._cells=new Kn(this.sharedModel),this._trans=(e.translator||_e).load("jupyterlab"),this._deletedCells=[],this._collaborationEnabled=!!e?.collaborationEnabled,this._cells.changed.connect(this._onCellsChanged,this),this.sharedModel.changed.connect(this._onStateChanged,this),this.sharedModel.metadataChanged.connect(this._onMetadataChanged,this)}get contentChanged(){return this._contentChanged}get metadataChanged(){return this._metadataChanged}get stateChanged(){return this._stateChanged}get cells(){return this._cells}get dirty(){return this.sharedModel.dirty}set dirty(e){const t=this.dirty;e!==t&&(this.sharedModel.dirty=e)}get readOnly(){return this._readOnly}set readOnly(e){if(e===this._readOnly)return;const t=this._readOnly;this._readOnly=e,this.triggerStateChange({name:"readOnly",oldValue:t,newValue:e})}get metadata(){return this.sharedModel.metadata}get nbformat(){return this.sharedModel.nbformat}get nbformatMinor(){return this.sharedModel.nbformat_minor}get defaultKernelName(){var e;const t=this.getMetadata("kernelspec");return(e=t?.name)!==null&&e!==void 0?e:""}get deletedCells(){return this._deletedCells}get defaultKernelLanguage(){var e;const t=this.getMetadata("language_info");return(e=t?.name)!==null&&e!==void 0?e:""}get collaborative(){return this._collaborationEnabled}dispose(){if(this.isDisposed)return;this._isDisposed=!0;const e=this.cells;this._cells=null,e.dispose(),this.standaloneModel&&this.sharedModel.dispose(),j.clearData(this)}deleteMetadata(e){return this.sharedModel.deleteMetadata(e)}getMetadata(e){return this.sharedModel.getMetadata(e)}setMetadata(e,t){typeof t>"u"?this.sharedModel.deleteMetadata(e):this.sharedModel.setMetadata(e,t)}toString(){return JSON.stringify(this.toJSON())}fromString(e){this.fromJSON(JSON.parse(e))}toJSON(){return this._ensureMetadata(),this.sharedModel.toJSON()}fromJSON(e){var t,n;const s=W.deepCopy(e),o=e.metadata.orig_nbformat;if(s.nbformat=Math.max(e.nbformat,Qe),(s.nbformat!==e.nbformat||s.nbformat_minor<Ie)&&(s.nbformat_minor=Ie),o!==void 0&&s.nbformat!==o){const i=s.nbformat>o;let a;i?a=this._trans.__(`This notebook has been converted from an older notebook format (v%1)
|
|
3
3
|
to the current notebook format (v%2).
|
|
4
4
|
The next time you save this notebook, the current notebook format (v%2) will be used.
|
|
@@ -7,7 +7,7 @@ close the notebook without saving it.`,o,s.nbformat):a=this._trans.__(`This note
|
|
|
7
7
|
to the current notebook format (v%2).
|
|
8
8
|
The next time you save this notebook, the current notebook format (v%2) will be used.
|
|
9
9
|
Some features of the original notebook may not be available.' To preserve the original format version,
|
|
10
|
-
close the notebook without saving it.`,o,s.nbformat),ke({title:this._trans.__("Notebook converted"),body:a,buttons:[ee.okButton({label:this._trans.__("Ok")})]})}((n=(t=s.cells)===null||t===void 0?void 0:t.length)!==null&&n!==void 0?n:0)===0&&(s.cells=[{cell_type:"code",source:"",metadata:{trusted:!0}}]),this.sharedModel.setSource(s),this._ensureMetadata()}_onCellsChanged(e,t){switch(t.type){case"add":t.newValues.forEach(n=>{n.contentChanged.connect(this.triggerContentChange,this)});break;case"remove":break;case"clear":break;case"set":t.newValues.forEach(n=>{n.contentChanged.connect(this.triggerContentChange,this)});break}this.triggerContentChange()}_onMetadataChanged(e,t){this._metadataChanged.emit(t),this.triggerContentChange()}_onStateChanged(e,t){t.stateChange&&t.stateChange.forEach(n=>{n.oldValue!==n.newValue&&this.triggerStateChange({newValue:void 0,oldValue:void 0,...n})})}_ensureMetadata(e=""){this.getMetadata("language_info")||this.sharedModel.setMetadata("language_info",{name:e}),this.getMetadata("kernelspec")||this.sharedModel.setMetadata("kernelspec",{name:"",display_name:""})}triggerStateChange(e){this._stateChanged.emit(e)}triggerContentChange(){this._contentChanged.emit(void 0)}get isDisposed(){return this._isDisposed}}class Jn{constructor(e={}){var t,n;this._disposed=!1,this._disableDocumentWideUndoRedo=(t=e.disableDocumentWideUndoRedo)!==null&&t!==void 0?t:!0,this._collaborative=(n=e.collaborative)!==null&&n!==void 0?n:!0}get disableDocumentWideUndoRedo(){return this._disableDocumentWideUndoRedo}set disableDocumentWideUndoRedo(e){this._disableDocumentWideUndoRedo=e}get name(){return"notebook"}get contentType(){return"notebook"}get fileFormat(){return"json"}get collaborative(){return this._collaborative}get isDisposed(){return this._disposed}dispose(){this._disposed=!0}createNew(e={}){return new Ve({languagePreference:e.languagePreference,sharedModel:e.sharedModel,collaborationEnabled:e.collaborationEnabled&&this.collaborative,disableDocumentWideUndoRedo:this._disableDocumentWideUndoRedo})}preferredLanguage(e){return""}}class Yn{constructor(e){var t,n;this._isReady=!1,this._isDisposed=!1,this._isPopulated=!1,this._path="",this._lineEnding=null,this._contentsModel=null,this._populatedPromise=new $t,this._pathChanged=new j(this),this._fileChanged=new j(this),this._saveState=new j(this),this._disposed=new j(this),this._lastModifiedCheckMargin=500,this._conflictModalIsOpen=!1;const s=this._manager=e.manager;this.translator=e.translator||_e,this._contentProviderId=e.contentProviderId,this._trans=this.translator.load("jupyterlab"),this._factory=e.factory,this._dialogs=(t=e.sessionDialogs)!==null&&t!==void 0?t:new Gt({translator:e.translator}),this._opener=e.opener||Pe.noOp,this._path=this._manager.contents.normalize(e.path),this._lastModifiedCheckMargin=e.lastModifiedCheckMargin||500;const o=this._manager.contents.localPath(this._path),i=this._factory.preferredLanguage(z.PathExt.basename(o)),a=this._manager.contents.getSharedModelFactory(this._path,{contentProviderId:e.contentProviderId}),l=a?.createNew({path:this._path,format:this._factory.fileFormat,contentType:this._factory.contentType,collaborative:this._factory.collaborative});this._model=this._factory.createNew({languagePreference:i,sharedModel:l,collaborationEnabled:(n=a?.collaborative)!==null&&n!==void 0?n:!1}),this._readyPromise=s.ready.then(()=>this._populatedPromise.promise);const d=z.PathExt.extname(this._path);this.sessionContext=new Ht({kernelManager:s.kernels,sessionManager:s.sessions,specsManager:s.kernelspecs,path:this._path,type:d===".ipynb"?"notebook":"file",name:z.PathExt.basename(o),kernelPreference:e.kernelPreference||{shouldStart:!1},setBusy:e.setBusy}),this.sessionContext.propertyChanged.connect(this._onSessionChanged,this),s.contents.fileChanged.connect(this._onFileChanged,this);const c=e.urlResolverFactory?e.urlResolverFactory:{createResolver:h=>new yt.UrlResolver(h)};this._urlResolver=c.createResolver({path:this._path,contents:s.contents,getKernelId:()=>{var h,f;return(f=(h=this.sessionContext.session)===null||h===void 0?void 0:h.kernel)===null||f===void 0?void 0:f.id}})}get pathChanged(){return this._pathChanged}get fileChanged(){return this._fileChanged}get saveState(){return this._saveState}get disposed(){return this._disposed}get lastModifiedCheckMargin(){return this._lastModifiedCheckMargin}set lastModifiedCheckMargin(e){this._lastModifiedCheckMargin=e}get model(){return this._model}get path(){return this._path}get localPath(){return this._manager.contents.localPath(this._path)}get contentsModel(){return this._contentsModel?{...this._contentsModel}:null}get factoryName(){return this.isDisposed?"":this._factory.name}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,this.sessionContext.dispose(),this._model.dispose(),this._model.sharedModel.dispose(),this._disposed.emit(void 0),j.clearData(this))}get isReady(){return this._isReady}get ready(){return this._readyPromise}get canSave(){var e;return!!(!((e=this._contentsModel)===null||e===void 0)&&e.writable&&!this._model.collaborative)}get urlResolver(){return this._urlResolver}async initialize(e){e?await this._save():await this._revert(),this.model.sharedModel.clearUndoHistory()}rename(e){return this.ready.then(()=>this._manager.ready.then(()=>this._rename(e)))}async save(){await this.ready,await this._save()}async saveAs(){await this.ready;const e=this._manager.contents.localPath(this.path),t=await Pe.getSavePath(e);if(this.isDisposed||!t)return!1;const n=this._manager.contents.driveName(this.path),s=n==""?t:`${n}:${t}`;if(s===this._path)return await this.save(),!0;try{await this._manager.ready,await this._manager.contents.get(s,{contentProviderId:this._contentProviderId,content:!1}),await this._maybeOverWrite(s)}catch(o){if(!o.response||o.response.status!==404){if(!o.response)return!1;throw o}}return await this._finishSaveAs(s),!0}async download(){const e=await this._manager.contents.getDownloadUrl(this._path),t=document.createElement("a");t.href=e,t.download="",document.body.appendChild(t),t.click(),document.body.removeChild(t)}async revert(){await this.ready,await this._revert()}createCheckpoint(){const e=this._manager.contents;return this._manager.ready.then(()=>e.createCheckpoint(this._path))}deleteCheckpoint(e){const t=this._manager.contents;return this._manager.ready.then(()=>t.deleteCheckpoint(this._path,e))}restoreCheckpoint(e){const t=this._manager.contents,n=this._path;return this._manager.ready.then(()=>e?t.restoreCheckpoint(n,e):this.listCheckpoints().then(s=>{if(!(this.isDisposed||!s.length))return e=s[s.length-1].id,t.restoreCheckpoint(n,e)}))}listCheckpoints(){const e=this._manager.contents;return this._manager.ready.then(()=>e.listCheckpoints(this._path))}addSibling(e,t={}){const n=this._opener;return n&&n(e,t),new zt(()=>{e.close()})}_onFileChanged(e,t){var n,s,o;if(t.type==="save"&&this._model.collaborative){if(((n=this._contentsModel)===null||n===void 0?void 0:n.path)!==((s=t.newValue)===null||s===void 0?void 0:s.path))return;this._updateContentsModel({...this._contentsModel,...t.newValue});return}if(t.type!=="rename")return;let i=t.oldValue&&t.oldValue.path,a=t.newValue&&t.newValue.path;if(a&&this._path.indexOf(i||"")===0){let l=t.newValue;i!==this._path&&(a=this._path.replace(new RegExp(`^${i}/`),`${a}/`),l={last_modified:(o=t.newValue)===null||o===void 0?void 0:o.created,path:a}),this._updateContentsModel({...this._contentsModel,...l}),this._updatePath(a)}}_onSessionChanged(e,t){if(t!=="path")return;const n=this._manager.contents.driveName(this.path);let s=this._manager.contents.localPath(this.sessionContext.session.path);n&&(s=`${n}:${s}`),this._updatePath(s)}_updateContentsModel(e){var t,n,s,o;const i={path:e.path,name:e.name,type:e.type,writable:e.writable,created:e.created,last_modified:e.last_modified,mimetype:e.mimetype,format:e.format,hash:e.hash,hash_algorithm:e.hash_algorithm},a=(n=(t=this._contentsModel)===null||t===void 0?void 0:t.last_modified)!==null&&n!==void 0?n:null,l=(o=(s=this._contentsModel)===null||s===void 0?void 0:s.hash)!==null&&o!==void 0?o:null;this._contentsModel=i,(!a&&!l||!l&&i.last_modified!==a||l&&i.hash!==l)&&this._fileChanged.emit(i)}_updatePath(e){var t,n,s,o;if(this._path===e)return;this._path=e;const i=this._manager.contents.localPath(e),a=z.PathExt.basename(i);if(((t=this.sessionContext.session)===null||t===void 0?void 0:t.path)!==e&&((n=this.sessionContext.session)===null||n===void 0||n.setPath(e)),((s=this.sessionContext.session)===null||s===void 0?void 0:s.name)!==a&&((o=this.sessionContext.session)===null||o===void 0||o.setName(a)),this._urlResolver.path!==e&&(this._urlResolver.path=e),this._contentsModel&&(this._contentsModel.path!==e||this._contentsModel.name!==a)){const l={...this._contentsModel,name:a,path:e};this._updateContentsModel(l)}this._pathChanged.emit(e)}async _populate(){if(this._isPopulated=!0,this._isReady=!0,this._populatedPromise.resolve(void 0),await this._maybeCheckpoint(!1),this.isDisposed)return;const e=this._model.defaultKernelName||this.sessionContext.kernelPreference.name;this.sessionContext.kernelPreference={...this.sessionContext.kernelPreference,name:e,language:this._model.defaultKernelLanguage},this.sessionContext.initialize().then(t=>{t&&this._dialogs.selectKernel(this.sessionContext)})}async _rename(e){const t=this.localPath.split("/");t[t.length-1]=e;let n=z.PathExt.join(...t);const s=this._manager.contents.driveName(this.path);s&&(n=`${s}:${n}`),await this._manager.contents.rename(this.path,n)}async _save(){this._saveState.emit("started");const e=this._createSaveOptions();try{await this._manager.ready;const t=await this._maybeSave(e);if(this.isDisposed)return;this._model.dirty=!1,this._updateContentsModel(t),this._isPopulated||await this._populate(),this._saveState.emit("completed")}catch(t){const{name:n}=t;if(n==="ModalCancelError"||n==="ModalDuplicateError")throw t;const s=this._manager.contents.localPath(this._path),o=z.PathExt.basename(s);throw this._handleError(t,this._trans.__("File Save Error for %1",o)),this._saveState.emit("failed"),t}}_revert(e=!1){const t={type:this._factory.contentType,content:this._factory.fileFormat!==null,hash:this._factory.fileFormat!==null,...this._factory.fileFormat!==null?{format:this._factory.fileFormat}:{},contentProviderId:this._contentProviderId},n=this._path,s=this._model;return this._manager.ready.then(()=>this._manager.contents.get(n,t)).then(o=>{if(!this.isDisposed){if(n!==this._path)return this._revert(e);if(o.content)if(o.format==="json")s.fromJSON(o.content);else{let i=o.content;i.indexOf(`\r
|
|
10
|
+
close the notebook without saving it.`,o,s.nbformat),ke({title:this._trans.__("Notebook converted"),body:a,buttons:[ee.okButton({label:this._trans.__("Ok")})]})}((n=(t=s.cells)===null||t===void 0?void 0:t.length)!==null&&n!==void 0?n:0)===0&&(s.cells=[{cell_type:"code",source:"",metadata:{trusted:!0}}]),this.sharedModel.setSource(s),this._ensureMetadata()}_onCellsChanged(e,t){switch(t.type){case"add":t.newValues.forEach(n=>{n.contentChanged.connect(this.triggerContentChange,this)});break;case"remove":break;case"clear":break;case"set":t.newValues.forEach(n=>{n.contentChanged.connect(this.triggerContentChange,this)});break}this.triggerContentChange()}_onMetadataChanged(e,t){this._metadataChanged.emit(t),this.triggerContentChange()}_onStateChanged(e,t){t.stateChange&&t.stateChange.forEach(n=>{n.oldValue!==n.newValue&&this.triggerStateChange({newValue:void 0,oldValue:void 0,...n})})}_ensureMetadata(e=""){this.getMetadata("language_info")||this.sharedModel.setMetadata("language_info",{name:e}),this.getMetadata("kernelspec")||this.sharedModel.setMetadata("kernelspec",{name:"",display_name:""})}triggerStateChange(e){this._stateChanged.emit(e)}triggerContentChange(){this._contentChanged.emit(void 0)}get isDisposed(){return this._isDisposed}}class Jn{constructor(e={}){var t,n;this._disposed=!1,this._disableDocumentWideUndoRedo=(t=e.disableDocumentWideUndoRedo)!==null&&t!==void 0?t:!0,this._collaborative=(n=e.collaborative)!==null&&n!==void 0?n:!0}get disableDocumentWideUndoRedo(){return this._disableDocumentWideUndoRedo}set disableDocumentWideUndoRedo(e){this._disableDocumentWideUndoRedo=e}get name(){return"notebook"}get contentType(){return"notebook"}get fileFormat(){return"json"}get collaborative(){return this._collaborative}get isDisposed(){return this._disposed}dispose(){this._disposed=!0}createNew(e={}){return new Ve({languagePreference:e.languagePreference,sharedModel:e.sharedModel,collaborationEnabled:e.collaborationEnabled&&this.collaborative,disableDocumentWideUndoRedo:this._disableDocumentWideUndoRedo})}preferredLanguage(e){return""}}class Yn{constructor(e){var t,n;this._isReady=!1,this._isDisposed=!1,this._isPopulated=!1,this._path="",this._lineEnding=null,this._contentsModel=null,this._populatedPromise=new Gt,this._pathChanged=new j(this),this._fileChanged=new j(this),this._saveState=new j(this),this._disposed=new j(this),this._lastModifiedCheckMargin=500,this._conflictModalIsOpen=!1;const s=this._manager=e.manager;this.translator=e.translator||_e,this._contentProviderId=e.contentProviderId,this._trans=this.translator.load("jupyterlab"),this._factory=e.factory,this._dialogs=(t=e.sessionDialogs)!==null&&t!==void 0?t:new $t({translator:e.translator}),this._opener=e.opener||Pe.noOp,this._path=this._manager.contents.normalize(e.path),this._lastModifiedCheckMargin=e.lastModifiedCheckMargin||500;const o=this._manager.contents.localPath(this._path),i=this._factory.preferredLanguage(z.PathExt.basename(o)),a=this._manager.contents.getSharedModelFactory(this._path,{contentProviderId:e.contentProviderId}),l=a?.createNew({path:this._path,format:this._factory.fileFormat,contentType:this._factory.contentType,collaborative:this._factory.collaborative});this._model=this._factory.createNew({languagePreference:i,sharedModel:l,collaborationEnabled:(n=a?.collaborative)!==null&&n!==void 0?n:!1}),this._readyPromise=s.ready.then(()=>this._populatedPromise.promise);const d=z.PathExt.extname(this._path);this.sessionContext=new Ht({kernelManager:s.kernels,sessionManager:s.sessions,specsManager:s.kernelspecs,path:this._path,type:d===".ipynb"?"notebook":"file",name:z.PathExt.basename(o),kernelPreference:e.kernelPreference||{shouldStart:!1},setBusy:e.setBusy}),this.sessionContext.propertyChanged.connect(this._onSessionChanged,this),s.contents.fileChanged.connect(this._onFileChanged,this);const c=e.urlResolverFactory?e.urlResolverFactory:{createResolver:h=>new yt.UrlResolver(h)};this._urlResolver=c.createResolver({path:this._path,contents:s.contents,getKernelId:()=>{var h,f;return(f=(h=this.sessionContext.session)===null||h===void 0?void 0:h.kernel)===null||f===void 0?void 0:f.id}})}get pathChanged(){return this._pathChanged}get fileChanged(){return this._fileChanged}get saveState(){return this._saveState}get disposed(){return this._disposed}get lastModifiedCheckMargin(){return this._lastModifiedCheckMargin}set lastModifiedCheckMargin(e){this._lastModifiedCheckMargin=e}get model(){return this._model}get path(){return this._path}get localPath(){return this._manager.contents.localPath(this._path)}get contentsModel(){return this._contentsModel?{...this._contentsModel}:null}get factoryName(){return this.isDisposed?"":this._factory.name}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,this.sessionContext.dispose(),this._model.dispose(),this._model.sharedModel.dispose(),this._disposed.emit(void 0),j.clearData(this))}get isReady(){return this._isReady}get ready(){return this._readyPromise}get canSave(){var e;return!!(!((e=this._contentsModel)===null||e===void 0)&&e.writable&&!this._model.collaborative)}get urlResolver(){return this._urlResolver}async initialize(e){e?await this._save():await this._revert(),this.model.sharedModel.clearUndoHistory()}rename(e){return this.ready.then(()=>this._manager.ready.then(()=>this._rename(e)))}async save(){await this.ready,await this._save()}async saveAs(){await this.ready;const e=this._manager.contents.localPath(this.path),t=await Pe.getSavePath(e);if(this.isDisposed||!t)return!1;const n=this._manager.contents.driveName(this.path),s=n==""?t:`${n}:${t}`;if(s===this._path)return await this.save(),!0;try{await this._manager.ready,await this._manager.contents.get(s,{contentProviderId:this._contentProviderId,content:!1}),await this._maybeOverWrite(s)}catch(o){if(!o.response||o.response.status!==404){if(!o.response)return!1;throw o}}return await this._finishSaveAs(s),!0}async download(){const e=await this._manager.contents.getDownloadUrl(this._path),t=document.createElement("a");t.href=e,t.download="",document.body.appendChild(t),t.click(),document.body.removeChild(t)}async revert(){await this.ready,await this._revert()}createCheckpoint(){const e=this._manager.contents;return this._manager.ready.then(()=>e.createCheckpoint(this._path))}deleteCheckpoint(e){const t=this._manager.contents;return this._manager.ready.then(()=>t.deleteCheckpoint(this._path,e))}restoreCheckpoint(e){const t=this._manager.contents,n=this._path;return this._manager.ready.then(()=>e?t.restoreCheckpoint(n,e):this.listCheckpoints().then(s=>{if(!(this.isDisposed||!s.length))return e=s[s.length-1].id,t.restoreCheckpoint(n,e)}))}listCheckpoints(){const e=this._manager.contents;return this._manager.ready.then(()=>e.listCheckpoints(this._path))}addSibling(e,t={}){const n=this._opener;return n&&n(e,t),new zt(()=>{e.close()})}_onFileChanged(e,t){var n,s,o;if(t.type==="save"&&this._model.collaborative){if(((n=this._contentsModel)===null||n===void 0?void 0:n.path)!==((s=t.newValue)===null||s===void 0?void 0:s.path))return;this._updateContentsModel({...this._contentsModel,...t.newValue});return}if(t.type!=="rename")return;let i=t.oldValue&&t.oldValue.path,a=t.newValue&&t.newValue.path;if(a&&this._path.indexOf(i||"")===0){let l=t.newValue;i!==this._path&&(a=this._path.replace(new RegExp(`^${i}/`),`${a}/`),l={last_modified:(o=t.newValue)===null||o===void 0?void 0:o.created,path:a}),this._updateContentsModel({...this._contentsModel,...l}),this._updatePath(a)}}_onSessionChanged(e,t){if(t!=="path")return;const n=this._manager.contents.driveName(this.path);let s=this._manager.contents.localPath(this.sessionContext.session.path);n&&(s=`${n}:${s}`),this._updatePath(s)}_updateContentsModel(e){var t,n,s,o;const i={path:e.path,name:e.name,type:e.type,writable:e.writable,created:e.created,last_modified:e.last_modified,mimetype:e.mimetype,format:e.format,hash:e.hash,hash_algorithm:e.hash_algorithm},a=(n=(t=this._contentsModel)===null||t===void 0?void 0:t.last_modified)!==null&&n!==void 0?n:null,l=(o=(s=this._contentsModel)===null||s===void 0?void 0:s.hash)!==null&&o!==void 0?o:null;this._contentsModel=i,(!a&&!l||!l&&i.last_modified!==a||l&&i.hash!==l)&&this._fileChanged.emit(i)}_updatePath(e){var t,n,s,o;if(this._path===e)return;this._path=e;const i=this._manager.contents.localPath(e),a=z.PathExt.basename(i);if(((t=this.sessionContext.session)===null||t===void 0?void 0:t.path)!==e&&((n=this.sessionContext.session)===null||n===void 0||n.setPath(e)),((s=this.sessionContext.session)===null||s===void 0?void 0:s.name)!==a&&((o=this.sessionContext.session)===null||o===void 0||o.setName(a)),this._urlResolver.path!==e&&(this._urlResolver.path=e),this._contentsModel&&(this._contentsModel.path!==e||this._contentsModel.name!==a)){const l={...this._contentsModel,name:a,path:e};this._updateContentsModel(l)}this._pathChanged.emit(e)}async _populate(){if(this._isPopulated=!0,this._isReady=!0,this._populatedPromise.resolve(void 0),await this._maybeCheckpoint(!1),this.isDisposed)return;const e=this._model.defaultKernelName||this.sessionContext.kernelPreference.name;this.sessionContext.kernelPreference={...this.sessionContext.kernelPreference,name:e,language:this._model.defaultKernelLanguage},this.sessionContext.initialize().then(t=>{t&&this._dialogs.selectKernel(this.sessionContext)})}async _rename(e){const t=this.localPath.split("/");t[t.length-1]=e;let n=z.PathExt.join(...t);const s=this._manager.contents.driveName(this.path);s&&(n=`${s}:${n}`),await this._manager.contents.rename(this.path,n)}async _save(){this._saveState.emit("started");const e=this._createSaveOptions();try{await this._manager.ready;const t=await this._maybeSave(e);if(this.isDisposed)return;this._model.dirty=!1,this._updateContentsModel(t),this._isPopulated||await this._populate(),this._saveState.emit("completed")}catch(t){const{name:n}=t;if(n==="ModalCancelError"||n==="ModalDuplicateError")throw t;const s=this._manager.contents.localPath(this._path),o=z.PathExt.basename(s);throw this._handleError(t,this._trans.__("File Save Error for %1",o)),this._saveState.emit("failed"),t}}_revert(e=!1){const t={type:this._factory.contentType,content:this._factory.fileFormat!==null,hash:this._factory.fileFormat!==null,...this._factory.fileFormat!==null?{format:this._factory.fileFormat}:{},contentProviderId:this._contentProviderId},n=this._path,s=this._model;return this._manager.ready.then(()=>this._manager.contents.get(n,t)).then(o=>{if(!this.isDisposed){if(n!==this._path)return this._revert(e);if(o.content)if(o.format==="json")s.fromJSON(o.content);else{let i=o.content;i.indexOf(`\r
|
|
11
11
|
`)!==-1?(this._lineEnding=`\r
|
|
12
12
|
`,i=i.replace(/\r\n/g,`
|
|
13
13
|
`)):i.indexOf("\r")!==-1?(this._lineEnding="\r",i=i.replace(/\r/g,`
|
|
@@ -28,19 +28,19 @@ or load the version on disk (revert)?`,this.path),s=ee.okButton({label:this._tra
|
|
|
28
28
|
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
|
29
29
|
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}}const fs=new us;function at(r,e,t){return fs.diff(r,e,t)}function ms(r,e){e.stripTrailingCr&&(r=r.replace(/\r\n/g,`
|
|
30
30
|
`));const t=[],n=r.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(let s=0;s<n.length;s++){const o=n[s];s%2&&!e.newlineIsToken?t[t.length-1]+=o:t.push(o)}return t}const ps={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function lt(r,e,t,n,s,o,i){let a;i?typeof i=="function"?a={callback:i}:a=i:a={},typeof a.context>"u"&&(a.context=4);const l=a.context;if(a.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(a.callback){const{callback:c}=a;at(t,n,Object.assign(Object.assign({},a),{callback:h=>{const f=d(h);c(f)}}))}else return d(at(t,n,a));function d(c){if(!c)return;c.push({value:"",lines:[]});function h(g){return g.map(function(y){return" "+y})}const f=[];let m=0,C=0,x=[],I=1,L=1;for(let g=0;g<c.length;g++){const y=c[g],S=y.lines||vs(y.value);if(y.lines=S,y.added||y.removed){if(!m){const M=c[g-1];m=I,C=L,M&&(x=l>0?h(M.lines.slice(-l)):[],m-=x.length,C-=x.length)}for(const M of S)x.push((y.added?"+":"-")+M);y.added?L+=S.length:I+=S.length}else{if(m)if(S.length<=l*2&&g<c.length-2)for(const M of h(S))x.push(M);else{const M=Math.min(S.length,l);for(const K of h(S.slice(0,M)))x.push(K);const E={oldStart:m,oldLines:I-m+M,newStart:C,newLines:L-C+M,lines:x};f.push(E),m=0,C=0,x=[]}I+=S.length,L+=S.length}}for(const g of f)for(let y=0;y<g.lines.length;y++)g.lines[y].endsWith(`
|
|
31
|
-
`)?g.lines[y]=g.lines[y].slice(0,-1):(g.lines.splice(y+1,0,"\"),y++);return{oldFileName:r,newFileName:e,oldHeader:s,newHeader:o,hunks:f}}}function
|
|
31
|
+
`)?g.lines[y]=g.lines[y].slice(0,-1):(g.lines.splice(y+1,0,"\"),y++);return{oldFileName:r,newFileName:e,oldHeader:s,newHeader:o,hunks:f}}}function Ge(r,e){if(e||(e=ps),Array.isArray(r)){if(r.length>1&&!e.includeFileHeaders)throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return r.map(n=>Ge(n,e)).join(`
|
|
32
32
|
`)}const t=[];e.includeIndex&&r.oldFileName==r.newFileName&&t.push("Index: "+r.oldFileName),e.includeUnderline&&t.push("==================================================================="),e.includeFileHeaders&&(t.push("--- "+r.oldFileName+(typeof r.oldHeader>"u"?"":" "+r.oldHeader)),t.push("+++ "+r.newFileName+(typeof r.newHeader>"u"?"":" "+r.newHeader)));for(let n=0;n<r.hunks.length;n++){const s=r.hunks[n];s.oldLines===0&&(s.oldStart-=1),s.newLines===0&&(s.newStart-=1),t.push("@@ -"+s.oldStart+","+s.oldLines+" +"+s.newStart+","+s.newLines+" @@");for(const o of s.lines)t.push(o)}return t.join(`
|
|
33
33
|
`)+`
|
|
34
|
-
`}function gs(r,e,t,n,s,o,i){if(typeof i=="function"&&(i={callback:i}),i?.callback){const{callback:a}=i;lt(r,e,t,n,s,o,Object.assign(Object.assign({},i),{callback:l=>{a(l
|
|
34
|
+
`}function gs(r,e,t,n,s,o,i){if(typeof i=="function"&&(i={callback:i}),i?.callback){const{callback:a}=i;lt(r,e,t,n,s,o,Object.assign(Object.assign({},i),{callback:l=>{a(l?Ge(l,i.headerOptions):void 0)}}))}else{const a=lt(r,e,t,n,s,o,i);return a?Ge(a,i?.headerOptions):void 0}}function _s(r,e,t,n,s,o){return gs(r,r,e,t,n,s,o)}function vs(r){const e=r.endsWith(`
|
|
35
35
|
`),t=r.split(`
|
|
36
36
|
`).map(n=>n+`
|
|
37
37
|
`);return e?t.pop():t.push(t.pop().slice(0,-1)),t}class ys{_commands;_panel;_notebook;_context;_defaultCellType="code";_kernelInfo=null;_variant;_registered=new Map;constructor(e,t,n,s=pt){this._commands=e,this._panel=t,this._notebook=t.content,this._context=n,this._variant=s,s==="marimo"&&H.executed.connect(this.onExecuted,this)}get variant(){return this._variant}onExecuted(e,t){const{notebook:n,cell:s,success:o}=t;if(n!==this._notebook||!o||s.model.type!=="code")return;const i=this._context.sessionContext.session?.kernel;if(!i)return;const a=Qt.for(i);a.reacting||this.react(a,s.model.sharedModel.getId())}async react(e,t){const n=new Set;for(const s of this._notebook.widgets){if(s.model.type!=="code")continue;const o=s.model.sharedModel.getId(),i=s.model.sharedModel.getSource();n.add(o),e.bindRunner(o,()=>this.runOne(o)),this._registered.get(o)!==i&&((await e.register(o,i)).error?this._registered.delete(o):this._registered.set(o,i))}for(const s of Array.from(this._registered.keys()))n.has(s)||(this._registered.delete(s),await e.remove(s));await e.react(t)}async runOne(e){const t=this._notebook.widgets.findIndex(n=>n.model.sharedModel.getId()===e);t<0||(this._notebook.deselectAll(),this._notebook.activeCellIndex=t,await H.run(this._notebook,this._context.sessionContext))}get commands(){return this._commands}get panel(){return this._panel}get notebook(){return this._notebook}get context(){return this._context}get sessionContext(){return this._panel.sessionContext}get kernel(){return this._panel.sessionContext?.session?.kernel??null}get kernelInfo(){return this._kernelInfo}async fetchKernelInfo(){if(this._kernelInfo)return this._kernelInfo;const e=this.kernel;return e?(this._kernelInfo=await e.info,this._kernelInfo):null}assignKernel(e){this._kernelInfo=null,this._context?.sessionContext.changeKernel({id:e.id})}setDefaultCellType(e){this._defaultCellType=e}get defaultCellType(){return this._defaultCellType}insertAbove(e){const t=this._notebook;H.insertAbove(t),H.changeCellType(t,this._defaultCellType),e&&t.activeCell&&t.activeCell.model.sharedModel.setSource(e),t.mode="edit"}insertBelow(e){const t=this._notebook;H.insertBelow(t),H.changeCellType(t,this._defaultCellType),e&&t.activeCell&&t.activeCell.model.sharedModel.setSource(e),t.mode="edit"}changeCellType(e){const t=this._notebook;t.activeCell&&t.activeCell.model.type!==e&&H.changeCellType(t,e)}deleteCells(){const e=this._notebook;H.deleteCells(e)}get model(){return this._context.model}undo(){const e=this._notebook;if(e.mode==="edit"&&e.activeCell?.editor){const t=e.activeCell.editor;if(t&&typeof t.undo=="function"){t.undo();return}}H.undo(e)}redo(){const e=this._notebook;if(e.mode==="edit"&&e.activeCell?.editor){const t=e.activeCell.editor;if(t&&typeof t.redo=="function"){t.redo();return}}H.redo(e)}setActiveCell(e){const t=this._notebook,n=t.model?.cells.length??0;e>=0&&e<n&&(t.activeCellIndex=e)}getCells(){const e=this._notebook.model?.cells;if(!e)return[];const t=[];for(let n=0;n<e.length;n++){const s=e.get(n);if(s){const o={index:n,type:s.type,source:s.sharedModel.getSource(),outputs:s.type==="code"?s.outputs?.toJSON():void 0};t.push(o)}}return t}readAllCells(e="brief"){return this.getCells().map((n,s)=>{const o=this._notebook.model?.cells.get(s),i=o?.type==="code"?o.executionCount??null:null;return e==="brief"?{index:s,type:n.type,preview:n.source.substring(0,40)}:{index:s,type:n.type,source:n.source,execution_count:i,outputs:n.outputs}})}getCellCount(){return this._notebook.model?.cells.length??0}insertAt(e,t){const n=this.getCellCount();if(e<-1||e>n)throw new Error(`Index ${e} is outside valid range [-1, ${n}]. Use -1 to append at end.`);const s=e===-1?n:e;s>=n?(n>0&&this.setActiveCell(n-1),this.insertBelow(t)):(this.setActiveCell(s),this.insertAbove(t))}insertCell(e,t,n){const s=this.getCellCount();this.setDefaultCellType(e);const o=t??s;try{this.insertAt(o,n)}catch(a){throw console.error(`[NotebookAdapter] insertCell failed at index ${o}:`,a),a}const i=this.getCellCount();i<=s&&console.warn(`[NotebookAdapter] insertCell at index ${o}: cell count did not increase (before=${s}, after=${i}). The Yjs shared model may not be properly initialised.`)}insertCells(e,t){let n=t;for(const s of e)this.setDefaultCellType(s.type),this.insertAt(n,s.source),n++}deleteCell(e){const n=this._notebook.model?.cells?.length??0;for(const o of e)if(o<0||o>=n)throw new Error(`Cell index ${o} is out of range. Notebook has ${n} cells.`);const s=[...e].sort((o,i)=>i-o);for(const o of s)this.setActiveCell(o),this.deleteCells()}updateCell(e,t){const n=this._notebook.model?.sharedModel.cells.length??0;if(e<0||e>=n)throw new Error(`Cell index ${e} is out of range. Notebook has ${n} cells.`);const s=this._notebook.model?.cells.get(e);if(!s)throw new Error(`Cell at index ${e} not found.`);const o=s.sharedModel.getSource();return s.sharedModel.setSource(t),_s(`cell_${e}`,o,t,"before","after",{context:3})}getCell(e,t=!0){if(e!==void 0){const s=this.getCells()[e];if(!s)return;const o=this._notebook.model?.cells.get(e),i=o?.type==="code"?o.executionCount??null:null;return{type:s.type,source:s.source,execution_count:i,outputs:t?s.outputs:void 0}}else{const n=this._notebook.activeCell;if(!n)return;const s=n.model.type==="code"?n.model.executionCount??null:null;return{type:n.model.type,source:n.model.sharedModel.getSource(),execution_count:s,outputs:t&&n.model.type==="code"?n.model.outputs?.toJSON():void 0}}}async runCell(e){const{index:t}=e||{};t!==void 0&&this.setActiveCell(t);const n=t??this._notebook.activeCellIndex;if(n===-1)throw new Error("No active cell to execute");await H.run(this._notebook,this._context.sessionContext),await new Promise(i=>setTimeout(i,100));const s=this.getCell(n,!0);if(!s)return{execution_count:null,outputs:[]};const o=[];if(s.outputs&&Array.isArray(s.outputs)){for(const i of s.outputs)if(typeof i=="string")o.push(i);else if(i&&typeof i=="object"){const a=i;if(a.output_type==="stream"){const l=a.text;typeof l=="string"?o.push(l):Array.isArray(l)&&o.push(l.join(""))}else if(a.output_type==="execute_result"||a.output_type==="display_data"){const l=a.data;if(l&&l["text/plain"]){const d=l["text/plain"];typeof d=="string"?o.push(d):Array.isArray(d)&&o.push(d.join(""))}}else if(a.output_type==="error"){const l=a.ename??"Error",d=a.evalue??"",c=a.traceback;Array.isArray(c)&&c.length>0?o.push(`[ERROR: ${l}: ${d}]
|
|
38
38
|
${c.join(`
|
|
39
|
-
`)}`):o.push(`[ERROR: ${l}: ${d}]`)}}}return{execution_count:s.execution_count,outputs:o}}runAllCells(){this._commands.execute(R.runAll)}clearAllOutputs(){H.clearAllOutputs(this._notebook)}_lastExecuteOutputs=null;get lastExecuteOutputs(){return this._lastExecuteOutputs}async executeCode(e,t={}){const n=this._panel.sessionContext;if(!n||!n.session?.kernel)return{success:!1,error:"No active kernel session"};const s=n.session.kernel;try{const o=s.requestExecute({code:e,stop_on_error:!0,store_history:!1,silent:!1,allow_stdin:!1}),i=[];let a;const l=new en({trusted:!0});this._lastExecuteOutputs=l,o.onIOPub=f=>{const m=f.header.msg_type;m==="stream"?(i.push({type:"stream",content:f.content}),l.add({output_type:"stream",...f.content})):m==="execute_result"?(i.push({type:"execute_result",content:f.content}),a=f.content.execution_count,l.add({output_type:"execute_result",...f.content})):m==="display_data"?(i.push({type:"display_data",content:f.content}),l.add({output_type:"display_data",...f.content})):m==="error"&&(i.push({type:"error",content:f.content}),l.add({output_type:"error",...f.content}))};const d=(t.timeout??30)*1e3,c=o.done,h=new Promise((f,m)=>{setTimeout(()=>{m(new Error(`Execution timeout after ${t.timeout??30} seconds`))},d)});try{await Promise.race([c,h])}catch(f){console.warn(`Cell execution timed out after ${t.timeout??30} seconds:`,f);try{await s.interrupt()}catch(m){console.warn("Failed to interrupt kernel after execution timeout:",m)}return{success:!1,error:`Execution exceeded ${t.timeout??30} seconds and was interrupted`,outputs:i}}return{success:!0,outputs:i,executionCount:a}}catch(o){return{success:!1,error:o instanceof Error?o.message:String(o)}}}dispose(){}}const Re=1e3,Cs=new Array,St=".datalayer/";function bs(r){const e=r.replace(/[/\\]/g," ").replace(/\s+/g," ").trim()||"notebook",t=e.endsWith(".ipynb")?e:`${e}.ipynb`;return`${St}${t}`}function ws(r){return r.startsWith(St)}function ks(r){const e=new _t;return r&&e.insert(0,r),e}function dt(r){return new me(Object.entries(r))}function xs(r){const e=W.deepCopy(r);if(e.output_type==="stream"&&e.text!==void 0){const{text:t,...n}=e,s=new _t,o=t instanceof Array?t.join(""):t;return o&&s.insert(0,o),new me([...Object.entries(n),["text",s]])}return new me(Object.entries(e))}function Ss(r){return r==null?"":typeof r=="string"?r:r.join("")}function Ms(r,e){const t=new me;if(t.set("cell_type",r.cell_type),t.set("source",ks(Ss(r.source))),t.set("metadata",dt(W.deepCopy(r.metadata??{}))),e&&r.id&&t.set("id",r.id),r.cell_type==="code"){const n=r,s=new un,o=(n.outputs??[]).map(i=>xs(i));o.length>0&&s.insert(0,o),t.set("outputs",s),t.set("execution_count",n.execution_count??null)}if(r.cell_type==="markdown"||r.cell_type==="raw"){const n=r.attachments;n&&t.set("attachments",dt(W.deepCopy(n)))}return t}function Es(r,e,t){const n=r.sharedModel,s=e.nbformat??4,o=e.nbformat_minor??5,i=s===4&&o>=5,a=W.deepCopy(e.metadata??{});delete a.orig_nbformat;const l=e.cells.map(d=>({...d,metadata:{...d.metadata??{},editable:!t}}));n.transact(()=>{n.nbformat=s,n.nbformat_minor=o,n.metadata=a;const d=n._ycells;d.delete(0,d.length);const c=l.map(h=>Ms(h,i));c.length>0&&d.insert(0,c)})}function Oe(r){const e={};return r&&r.forEach(t=>{const n=t.schema?.default;e[t.identifier]={enabled:!0,debouncerDelay:n?.debouncerDelay??200,timeout:n?.timeout??15e3,autoFillInMiddle:!0}}),e}function Ps(r){const{commands:e,extensions:t=Cs,kernelId:n,sessionOnly:s,renderers:o,serviceManager:i,model:a,onSessionConnection:l,synced:d=!0,variant:c=pt}=r,[h,f]=_.useState(!0),[m,C]=_.useState(!1),x=gt(p=>p.backgroundColor),[I,L]=_.useState(new Array),[g,y]=_.useState(null),[S,M]=_.useState(null),E=_.useMemo(()=>r.id||nn(),[r.id]),K=_.useMemo(()=>r.path||bs(E),[E,r.path]),O=_.useMemo(()=>new js({commands:e,renderers:o}),[e,o]),ye=_.useMemo(()=>new mt.ContentFactory({editorFactory:O.editorServices.factoryService.newInlineEditor}),[O.editorServices.factoryService.newInlineEditor]);_.useEffect(()=>{const p=new Cn({model:new bn}),v=new Z,P=Oe(r.inlineProviders),A=r.providers&&r.providers.length>0?[new he,...r.providers]:[new he],k=new Ne({context:{widget:v},providers:A,inlineProviders:r.inlineProviders,inlineProvidersSettings:P,timeout:Re});let w;if(r.inlineProviders&&r.inlineProviders.length>0){const ie=_e.load("jupyterlab");w=new te({model:new te.Model,trans:ie});const N={};r.inlineProviders?.forEach(G=>{N[G.identifier]={enabled:!0}}),w.configure({...te.defaultSettings,showWidget:"always",showShortcuts:!0,streamingAnimation:"none",suppressIfTabCompleterActive:!1,minLines:1,maxLines:10,editorResizeDelay:250,reserveSpaceForLongest:!1,providers:N}),Z.attach(w,document.body);const U=G=>{if(G.key==="Tab"&&!G.shiftKey&&!G.ctrlKey&&!G.metaKey&&!G.altKey){if(w&&w.model&&w.current)return G.preventDefault(),G.stopPropagation(),w.accept(),!1;w&&w.model&&w.model.reset()}if(G.key==="Escape"&&w&&w.model&&w.current)return G.preventDefault(),G.stopPropagation(),w.model.reset(),!1};document.addEventListener("keydown",U,!0);const re=()=>{document.removeEventListener("keydown",U,!0)};w._keyboardCleanup=re}const $=new wn({completer:p,reconciliator:k,inlineCompleter:w});return p.hide(),Z.attach(p,document.body),y($),()=>{queueMicrotask(()=>{$.dispose(),p.dispose(),w&&(w._keyboardCleanup&&w._keyboardCleanup(),w.dispose()),v.dispose()})}},[r.inlineProviders]);const[oe,Ce]=_.useState(null);_.useEffect(()=>{const p=new Zn({name:"Notebook",label:"Notebook",modelName:"notebook",fileTypes:["notebook"],defaultFor:["notebook"],preferKernel:!0,autoStartDefault:!1,canStartKernel:!1,shutdownOnClose:!1,rendermime:O.rendermime,contentFactory:ye,mimeTypeService:O.editorServices.mimeTypeService,notebookConfig:{...Fe.defaultNotebookConfig,windowingMode:"none",recordTiming:!0}});return Ce(p),()=>{p.dispose(),Ce(v=>v===p?null:v)}},[ye,O]);const B=_.useMemo(()=>new sn,[]),[V,X]=_.useState(null);_.useEffect(()=>{const p=g?new Xn({namespace:E}):null,v=g?on(O.commands,g,p,B,r.path):null;return X(p),()=>{v?.dispose(),p?.dispose(),X(P=>P===p?null:P)}},[g,E,O.commands,r.path,B]);const[F,be]=_.useState(null),ze=_.useRef(n);_.useEffect(()=>{const p=new Is(a),v=new Yn({factory:p,manager:i??new Ls,path:K,kernelPreference:ze.current?{id:ze.current,shouldStart:!1,canStart:!1,autoStartDefault:!1,shutdownOnDispose:!1}:{shouldStart:!1,canStart:!1,autoStartDefault:!1,shutdownOnDispose:!1}});return Ns(v,E,!s&&!ws(K)?K:void 0,l,!i),be(v),()=>{v.dispose(),p.dispose(),be(P=>P===v?null:P)}},[E,i,a,K]),_.useEffect(()=>{if(!F||!n||F.sessionContext.isDisposed)return;(async()=>{try{if(F.sessionContext.session||await F.sessionContext.initialize(),F.sessionContext.isDisposed)return;await F.sessionContext.changeKernel({id:n})}catch(v){console.error("Failed to change kernel model.",v)}})()},[F,n]);const[T,Ke]=_.useState(null);return _.useEffect(()=>{let p=null,v=null,P=null;if(F&&(p=oe?.createNew(F)??null,p)){B.setPanel(p,F),v=new ys(O.commands,p,F,c),M(v),L(t.map(k=>(k.init({notebookId:E,commands:O.commands,panel:p}),k.createNew(p,F),k.component??u.jsx(u.Fragment,{}))));const A=p.content.rendermime;P=new In(F,A,{saveState:!1}),A.addFactory({safe:!0,mimeTypes:[kn],defaultRank:1,createRenderer:k=>new st(k,P)},1);for(const k of p.content.widgets)if(k.model.type==="code")for(const w of k.outputArea.widgets)for(const $ of Array.from(w.children()))$ instanceof st&&($.manager=P);f(!1)}return Ke(p),p||(L([]),M(null)),()=>{B.setPanel(null,null),queueMicrotask(()=>{if(P?.dispose(),v&&v.dispose(),p&&!p.isDisposed){p.content&&j.clearData(p.content);try{p.isAttached&&Z.detach(p),p.dispose()}catch{}}}),Ke(A=>A===p?null:A),M(A=>A===v?null:A)}},[F,t,O.commands,oe,B]),_.useEffect(()=>{if(C(!1),!!T)return cs(T,{synced:d,onPainted:()=>C(!0)})},[T,d]),_.useEffect(()=>{if(S){const p=ne.getState().notebooks,v=new Map(p);v.set(E,{adapter:S,model:S.model??void 0,portals:[]}),ne.getState().setNotebooks(v)}else{const p=ne.getState().notebooks;if(p.has(E)){const v=new Map(p);v.delete(E),ne.getState().setNotebooks(v)}}},[S,E]),_.useEffect(()=>{if(!T)return;const p=T.context.sessionContext,v=[],P=N=>{N&&ne.getState().changeKernelStatus({id:E,kernelStatus:N})},A=(N,U)=>{P(U)};p.statusChanged.connect(A);let k=null;const w=(N,U)=>{P(U)},$=()=>{const N=p.session?.kernel??null;if(N!==k&&(k?.statusChanged.disconnect(w),k=N,k?.statusChanged.connect(w),P(k?.status),N)){const U=()=>{k!==N||N.status!=="unknown"||hn.KernelAPI.getKernelModel(N.id,N.serverSettings).then(re=>{re?.execution_state&&k===N&&N.status==="unknown"&&(P(re.execution_state),v.push(setTimeout(U,5e3)))}).catch(()=>{})};U(),N.status==="unknown"&&Promise.resolve(N.requestKernelInfo?.()).catch(()=>{})}},ie=()=>$();return p.kernelChanged.connect(ie),$(),p.ready.then($),()=>{v.forEach(clearTimeout),p.statusChanged.disconnect(A),p.kernelChanged.disconnect(ie),k?.statusChanged.disconnect(w)}},[T,E]),_.useEffect(()=>{let p=!0,v=null,P=null;return T&&(V&&!T.isDisposed&&!V.has(T)&&V.add(T).catch(A=>{console.error(`Failed to track the notebook panel '${E}'.`)}),g&&(v=(A,k)=>{k&&k.ready.then(()=>{g.editor=k?.editor})},P=(A,k)=>{if(!p)return;const w=T.content.activeCell?.editor,$=new he,ie=Oe(r.inlineProviders),N=k.newValue||{},U=r.providers&&r.providers.length>0?[$,...r.providers]:[$],re=new Ne({context:{widget:T,editor:w,session:N},providers:U,inlineProviders:r.inlineProviders,inlineProvidersSettings:ie,timeout:Re});g.inlineCompleter&&(g.inlineCompleter.editor=w),g.editor=w,g.reconciliator=re},T.context.sessionContext.sessionChanged.connect(P),T.context.sessionContext.ready.then(()=>{P?.(T.context.sessionContext,{name:"session",oldValue:null,newValue:T.context.sessionContext.session})}),T.content.activeCellChanged.connect(v))),()=>{if(p=!1,g){v&&T?.content.activeCellChanged.disconnect(v),P&&T?.context.sessionContext.sessionChanged.disconnect(P),g.editor=null;const A=Oe(r.inlineProviders),k=r.providers&&r.providers.length>0?[new he,...r.providers]:[new he];g.reconciliator=new Ne({context:{widget:new Z},providers:k,inlineProviders:r.inlineProviders,inlineProvidersSettings:A,timeout:Re})}}},[g,T,V]),_.useEffect(()=>{const p=T?.node;if(!p)return;const v=P=>{const A=P.target;!A||!p.contains(A)||O.commands.processKeydownEvent(P)};return window.addEventListener("keydown",v,!0),()=>{window.removeEventListener("keydown",v,!0)}},[O.commands,T]),_.useEffect(()=>()=>{const p=ne.getState().notebooks;if(p.has(E)){const v=new Map(p);v.delete(E),ne.getState().setNotebooks(v)}},[E]),u.jsxs(u.Fragment,{children:[I.map((p,v)=>u.jsx(ue,{children:p},`${p}-${v}`)),h?u.jsx(Be,{},"notebook-loader"):T?u.jsxs(ue,{sx:{height:"100%",position:"relative"},children:[u.jsx(jn,{id:E,children:T},"notebook-container"),m?null:u.jsx(ue,{sx:{position:"absolute",inset:0,zIndex:1,overflow:"hidden",bg:x??"var(--bgColor-default)"},children:u.jsx(Be,{})},"notebook-first-paint")]}):u.jsx(Bn,{variant:"critical",description:"Unable to create the notebook view.",hideTitle:!0,title:"Error"},"notebook-error")]})}function Ts(r={}){const{kernel:e,kernels:t,requestedKernelId:n,startDefaultKernel:s=!1}=r,o=e?.id,[i,a]=_.useState(o),[l,d]=_.useState(void 0);return _.useEffect(()=>{let c=!0;if(o){a(h=>h!==o?o:h);return}return t&&(async()=>{let h;if(await t.ready,n){const f=()=>{for(const m of t.running())if(m.id===n)return!0;return!1};if(!f())try{await t.refreshRunning()}catch(m){console.warn("Failed to list the running kernels.",m)}f()&&(h=n)}if(!h&&s&&c){await t.refreshRunning();const f=[...t.running()];if(f.length>0){const m=t.connectTo({model:f[0]});c?(h=m.id,a(h)):m.dispose()}else{const m=await t.startNew();c?(h=m.id,a(h),d(m)):m.dispose()}}c&&a(f=>f!==h?h:f)})(),()=>{c=!1}},[t,o,n,s]),_.useEffect(()=>()=>{l&&l.shutdown().catch(c=>{console.warn(`Failed to shutdown kernel '${l?.id}'.`,c)}).finally(()=>{l?.dispose()})},[l]),i}function Ds(r){const{collaborationProvider:e,nbformat:t,readonly:n=!1,url:s,path:o,serviceManager:i,id:a}=r,[l,d]=_.useState(null);return _.useEffect(()=>{let c=!0;const h=new tn;if(e&&i&&a)(async()=>{try{const m=new je;if(await e.connect(m,a,{serviceManager:i,path:o}),c){const C=new Ve({collaborationEnabled:!0,disableDocumentWideUndoRedo:!0,sharedModel:m});C.readOnly=n,d(C),h.add({dispose:()=>{e.disconnect()},get isDisposed(){return!1}})}}catch(m){console.error("Failed to setup collaboration:",m)}})();else{const f=m=>{const C=new Ve;m&&Es(C,m,n),C.readOnly=n,d(C)};!t&&s?As(s).then(m=>{c&&f(m)}):f(t)}return()=>{c=!1,h.dispose()}},[e,t,n,s,o,i,a]),l}async function As(r){return fetch(r).then(e=>e.text()).then(e=>JSON.parse(e))}class js{_commands;_editorServices;_rendermime;constructor(e={}){this._commands=e.commands??new rn;const t=new et;for(const d of et.getDefaultLanguages())t.addLanguage(d);t.addLanguage({name:"ipythongfm",mime:"text/x-ipythongfm",load:async()=>(await an(()=>import("./index-KgE-JGae.js"),[],import.meta.url)).markdown({codeLanguages:c=>t.findBest(c)})});const n=ln.filter(d=>d.mimeTypes[0]!=="text/javascript").concat([xn,Sn]).concat(e.renderers??[]);this._rendermime=new yt({initialFactories:n,latexTypesetter:En(),markdownParser:Mn(t)});const s=new Tn(t),o=new tt;for(const d of tt.getDefaultThemes())o.addTheme(d);const i=new ce;for(const d of ce.getDefaultExtensions({themes:o}))i.addExtension(d);i.addExtension({name:"shared-model-binding",factory:d=>{const c=d.model.sharedModel;return ce.createImmutableExtension(dn({ytext:c.ysource,undoManager:c.undoManager??void 0}))}}),i.addExtension({name:"remote-user-cursors",factory(d){const{awareness:c,ysource:h}=d.model.sharedModel;return ce.createImmutableExtension(zn({awareness:c,ytext:h}))}});const a=Rs();a&&i.addExtension({name:"csp-nonce",factory(){return ce.createImmutableExtension(De.cspNonce.of(a))}});const l=new Pn({extensions:i,languages:t});this._editorServices={factoryService:l,mimeTypeService:s}}get commands(){return this._commands}get editorServices(){return this._editorServices}get rendermime(){return this._rendermime}}class Is extends Jn{model;constructor(e){super(),this.model=e}get collaborative(){return!1}createNew(e){return this.model}}function Ns(r,e,t,n,s=!1){const o=!t;r.sessionContext._initialize=async()=>{const i=r.sessionContext.sessionManager;await i.ready,await i.refreshRunning();const a=cn(i.running(),l=>l.kernel?.id===(r.sessionContext.kernelPreference.id??""));if(a)try{const l=i.connectTo({model:{...a,path:t??a.path,name:t??a.name},kernelConnectionOptions:{handleComms:!0}});r.sessionContext._handleNewSession(l)}catch(l){return r.sessionContext._handleSessionError(l),Promise.reject(l)}return await r.sessionContext._startIfNecessary()},r.dispose=()=>{r.isDisposed||(r._isDisposed=!0,r.sessionContext.dispose(),r._disposed.emit(void 0),j.clearData(r))},o&&(r._populate=async()=>{if(r._isPopulated=!0,r._isReady=!0,r._populatedPromise.resolve(void 0),r.isDisposed)return;const i=r._model.defaultKernelName||r.sessionContext.kernelPreference.name;r.sessionContext.kernelPreference={...r.sessionContext.kernelPreference,name:i,language:r._model.defaultKernelLanguage},s||r.sessionContext.initialize().then(a=>{a&&r._dialogs.selectKernel(r.sessionContext.sessionContext)})},r.initialize=async i=>{r.model.dirty=!1;const a=new Date().toISOString(),l={path:e,name:e,type:"notebook",content:void 0,writable:!0,created:a,last_modified:a,mimetype:"application/x-ipynb+json",format:"json"};r._updateContentsModel(l),await r._populate(),r.model.sharedModel.clearUndoHistory()}),r.sessionContext.sessionChanged.connect((i,a)=>{const l=a.newValue;n?.(l??void 0)}),r.sessionContext.kernelChanged.connect((i,a)=>{const l=a.newValue;l&&!l.handleComms&&(l.handleComms=!0)}),r.sessionContext.ready.then(()=>{n?.(r?.sessionContext.session??void 0)}),r.initialize(!t)}class Ls{_additionalDrives=new Set;contents=Object.freeze({fileChanged:{connect:()=>{}},getSharedModelFactory(e){return null},localPath:e=>{const t=e.split("/"),n=t[0].split(":");return n.length===1||!this._additionalDrives.has(n[0])?z.PathExt.removeSlash(e):z.PathExt.join(n.slice(1).join(":"),...t.slice(1))},normalize(e){const t=e.split(":");return t.length===1?z.PathExt.normalize(e):`${t[0]}:${z.PathExt.normalize(t.slice(1).join(":"))}`}});kernelspecs=Object.freeze({ready:new Promise(()=>{})});sessions=Object.freeze({ready:new Promise(()=>{})});ready=Promise.resolve()}function Rs(){const r=document.querySelector('meta[property="csp-nonce"]');return r?r.getAttribute("content"):null}const Os=fn`
|
|
39
|
+
`)}`):o.push(`[ERROR: ${l}: ${d}]`)}}}return{execution_count:s.execution_count,outputs:o}}runAllCells(){this._commands.execute(R.runAll)}clearAllOutputs(){H.clearAllOutputs(this._notebook)}_lastExecuteOutputs=null;get lastExecuteOutputs(){return this._lastExecuteOutputs}async executeCode(e,t={}){const n=this._panel.sessionContext;if(!n||!n.session?.kernel)return{success:!1,error:"No active kernel session"};const s=n.session.kernel;try{const o=s.requestExecute({code:e,stop_on_error:!0,store_history:!1,silent:!1,allow_stdin:!1}),i=[];let a;const l=new en({trusted:!0});this._lastExecuteOutputs=l,o.onIOPub=f=>{const m=f.header.msg_type;m==="stream"?(i.push({type:"stream",content:f.content}),l.add({output_type:"stream",...f.content})):m==="execute_result"?(i.push({type:"execute_result",content:f.content}),a=f.content.execution_count,l.add({output_type:"execute_result",...f.content})):m==="display_data"?(i.push({type:"display_data",content:f.content}),l.add({output_type:"display_data",...f.content})):m==="error"&&(i.push({type:"error",content:f.content}),l.add({output_type:"error",...f.content}))};const d=(t.timeout??30)*1e3,c=o.done,h=new Promise((f,m)=>{setTimeout(()=>{m(new Error(`Execution timeout after ${t.timeout??30} seconds`))},d)});try{await Promise.race([c,h])}catch(f){console.warn(`Cell execution timed out after ${t.timeout??30} seconds:`,f);try{await s.interrupt()}catch(m){console.warn("Failed to interrupt kernel after execution timeout:",m)}return{success:!1,error:`Execution exceeded ${t.timeout??30} seconds and was interrupted`,outputs:i}}return{success:!0,outputs:i,executionCount:a}}catch(o){return{success:!1,error:o instanceof Error?o.message:String(o)}}}dispose(){}}const Re=1e3,Cs=new Array,St=".datalayer/";function bs(r){const e=r.replace(/[/\\]/g," ").replace(/\s+/g," ").trim()||"notebook",t=e.endsWith(".ipynb")?e:`${e}.ipynb`;return`${St}${t}`}function ws(r){return r.startsWith(St)}function ks(r){const e=new _t;return r&&e.insert(0,r),e}function dt(r){return new me(Object.entries(r))}function xs(r){const e=W.deepCopy(r);if(e.output_type==="stream"&&e.text!==void 0){const{text:t,...n}=e,s=new _t,o=t instanceof Array?t.join(""):t;return o&&s.insert(0,o),new me([...Object.entries(n),["text",s]])}return new me(Object.entries(e))}function Ss(r){return r==null?"":typeof r=="string"?r:r.join("")}function Ms(r,e){const t=new me;if(t.set("cell_type",r.cell_type),t.set("source",ks(Ss(r.source))),t.set("metadata",dt(W.deepCopy(r.metadata??{}))),e&&r.id&&t.set("id",r.id),r.cell_type==="code"){const n=r,s=new un,o=(n.outputs??[]).map(i=>xs(i));o.length>0&&s.insert(0,o),t.set("outputs",s),t.set("execution_count",n.execution_count??null)}if(r.cell_type==="markdown"||r.cell_type==="raw"){const n=r.attachments;n&&t.set("attachments",dt(W.deepCopy(n)))}return t}function Es(r,e,t){const n=r.sharedModel,s=e.nbformat??4,o=e.nbformat_minor??5,i=s===4&&o>=5,a=W.deepCopy(e.metadata??{});delete a.orig_nbformat;const l=e.cells.map(d=>({...d,metadata:{...d.metadata??{},editable:!t}}));n.transact(()=>{n.nbformat=s,n.nbformat_minor=o,n.metadata=a;const d=n._ycells;d.delete(0,d.length);const c=l.map(h=>Ms(h,i));c.length>0&&d.insert(0,c)})}function Oe(r){const e={};return r&&r.forEach(t=>{const n=t.schema?.default;e[t.identifier]={enabled:!0,debouncerDelay:n?.debouncerDelay??200,timeout:n?.timeout??15e3,autoFillInMiddle:!0}}),e}function Ps(r){const{commands:e,extensions:t=Cs,kernelId:n,sessionOnly:s,renderers:o,serviceManager:i,model:a,onSessionConnection:l,synced:d=!0,variant:c=pt}=r,[h,f]=_.useState(!0),[m,C]=_.useState(!1),x=gt(p=>p.backgroundColor),[I,L]=_.useState(new Array),[g,y]=_.useState(null),[S,M]=_.useState(null),E=_.useMemo(()=>r.id||nn(),[r.id]),K=_.useMemo(()=>r.path||bs(E),[E,r.path]),O=_.useMemo(()=>new js({commands:e,renderers:o}),[e,o]),ye=_.useMemo(()=>new mt.ContentFactory({editorFactory:O.editorServices.factoryService.newInlineEditor}),[O.editorServices.factoryService.newInlineEditor]);_.useEffect(()=>{const p=new Cn({model:new bn}),v=new Z,P=Oe(r.inlineProviders),A=r.providers&&r.providers.length>0?[new he,...r.providers]:[new he],k=new Ne({context:{widget:v},providers:A,inlineProviders:r.inlineProviders,inlineProvidersSettings:P,timeout:Re});let w;if(r.inlineProviders&&r.inlineProviders.length>0){const ie=_e.load("jupyterlab");w=new te({model:new te.Model,trans:ie});const N={};r.inlineProviders?.forEach($=>{N[$.identifier]={enabled:!0}}),w.configure({...te.defaultSettings,showWidget:"always",showShortcuts:!0,streamingAnimation:"none",suppressIfTabCompleterActive:!1,minLines:1,maxLines:10,editorResizeDelay:250,reserveSpaceForLongest:!1,providers:N}),Z.attach(w,document.body);const U=$=>{if($.key==="Tab"&&!$.shiftKey&&!$.ctrlKey&&!$.metaKey&&!$.altKey){if(w&&w.model&&w.current)return $.preventDefault(),$.stopPropagation(),w.accept(),!1;w&&w.model&&w.model.reset()}if($.key==="Escape"&&w&&w.model&&w.current)return $.preventDefault(),$.stopPropagation(),w.model.reset(),!1};document.addEventListener("keydown",U,!0);const re=()=>{document.removeEventListener("keydown",U,!0)};w._keyboardCleanup=re}const G=new wn({completer:p,reconciliator:k,inlineCompleter:w});return p.hide(),Z.attach(p,document.body),y(G),()=>{queueMicrotask(()=>{G.dispose(),p.dispose(),w&&(w._keyboardCleanup&&w._keyboardCleanup(),w.dispose()),v.dispose()})}},[r.inlineProviders]);const[oe,Ce]=_.useState(null);_.useEffect(()=>{const p=new Zn({name:"Notebook",label:"Notebook",modelName:"notebook",fileTypes:["notebook"],defaultFor:["notebook"],preferKernel:!0,autoStartDefault:!1,canStartKernel:!1,shutdownOnClose:!1,rendermime:O.rendermime,contentFactory:ye,mimeTypeService:O.editorServices.mimeTypeService,notebookConfig:{...Fe.defaultNotebookConfig,windowingMode:"none",recordTiming:!0}});return Ce(p),()=>{p.dispose(),Ce(v=>v===p?null:v)}},[ye,O]);const B=_.useMemo(()=>new sn,[]),[V,X]=_.useState(null);_.useEffect(()=>{const p=g?new Xn({namespace:E}):null,v=g?on(O.commands,g,p,B,r.path):null;return X(p),()=>{v?.dispose(),p?.dispose(),X(P=>P===p?null:P)}},[g,E,O.commands,r.path,B]);const[F,be]=_.useState(null),ze=_.useRef(n);_.useEffect(()=>{const p=new Is(a),v=new Yn({factory:p,manager:i??new Ls,path:K,kernelPreference:ze.current?{id:ze.current,shouldStart:!1,canStart:!1,autoStartDefault:!1,shutdownOnDispose:!1}:{shouldStart:!1,canStart:!1,autoStartDefault:!1,shutdownOnDispose:!1}});return Ns(v,E,!s&&!ws(K)?K:void 0,l,!i),be(v),()=>{v.dispose(),p.dispose(),be(P=>P===v?null:P)}},[E,i,a,K]),_.useEffect(()=>{if(!F||!n||F.sessionContext.isDisposed)return;(async()=>{try{if(F.sessionContext.session||await F.sessionContext.initialize(),F.sessionContext.isDisposed)return;await F.sessionContext.changeKernel({id:n})}catch(v){console.error("Failed to change kernel model.",v)}})()},[F,n]);const[T,Ke]=_.useState(null);return _.useEffect(()=>{let p=null,v=null,P=null;if(F&&(p=oe?.createNew(F)??null,p)){B.setPanel(p,F),v=new ys(O.commands,p,F,c),M(v),L(t.map(k=>(k.init({notebookId:E,commands:O.commands,panel:p}),k.createNew(p,F),k.component??u.jsx(u.Fragment,{}))));const A=p.content.rendermime;P=new In(F,A,{saveState:!1}),A.addFactory({safe:!0,mimeTypes:[kn],defaultRank:1,createRenderer:k=>new st(k,P)},1);for(const k of p.content.widgets)if(k.model.type==="code")for(const w of k.outputArea.widgets)for(const G of Array.from(w.children()))G instanceof st&&(G.manager=P);f(!1)}return Ke(p),p||(L([]),M(null)),()=>{B.setPanel(null,null),queueMicrotask(()=>{if(P?.dispose(),v&&v.dispose(),p&&!p.isDisposed){p.content&&j.clearData(p.content);try{p.isAttached&&Z.detach(p),p.dispose()}catch{}}}),Ke(A=>A===p?null:A),M(A=>A===v?null:A)}},[F,t,O.commands,oe,B]),_.useEffect(()=>{if(C(!1),!!T)return cs(T,{synced:d,onPainted:()=>C(!0)})},[T,d]),_.useEffect(()=>{if(S){const p=ne.getState().notebooks,v=new Map(p);v.set(E,{adapter:S,model:S.model??void 0,portals:[]}),ne.getState().setNotebooks(v)}else{const p=ne.getState().notebooks;if(p.has(E)){const v=new Map(p);v.delete(E),ne.getState().setNotebooks(v)}}},[S,E]),_.useEffect(()=>{if(!T)return;const p=T.context.sessionContext,v=[],P=N=>{N&&ne.getState().changeKernelStatus({id:E,kernelStatus:N})},A=(N,U)=>{P(U)};p.statusChanged.connect(A);let k=null;const w=(N,U)=>{P(U)},G=()=>{const N=p.session?.kernel??null;if(N!==k&&(k?.statusChanged.disconnect(w),k=N,k?.statusChanged.connect(w),P(k?.status),N)){const U=()=>{k!==N||N.status!=="unknown"||hn.KernelAPI.getKernelModel(N.id,N.serverSettings).then(re=>{re?.execution_state&&k===N&&N.status==="unknown"&&(P(re.execution_state),v.push(setTimeout(U,5e3)))}).catch(()=>{})};U(),N.status==="unknown"&&Promise.resolve(N.requestKernelInfo?.()).catch(()=>{})}},ie=()=>G();return p.kernelChanged.connect(ie),G(),p.ready.then(G),()=>{v.forEach(clearTimeout),p.statusChanged.disconnect(A),p.kernelChanged.disconnect(ie),k?.statusChanged.disconnect(w)}},[T,E]),_.useEffect(()=>{let p=!0,v=null,P=null;return T&&(V&&!T.isDisposed&&!V.has(T)&&V.add(T).catch(A=>{console.error(`Failed to track the notebook panel '${E}'.`)}),g&&(v=(A,k)=>{k&&k.ready.then(()=>{g.editor=k?.editor})},P=(A,k)=>{if(!p)return;const w=T.content.activeCell?.editor,G=new he,ie=Oe(r.inlineProviders),N=k.newValue||{},U=r.providers&&r.providers.length>0?[G,...r.providers]:[G],re=new Ne({context:{widget:T,editor:w,session:N},providers:U,inlineProviders:r.inlineProviders,inlineProvidersSettings:ie,timeout:Re});g.inlineCompleter&&(g.inlineCompleter.editor=w),g.editor=w,g.reconciliator=re},T.context.sessionContext.sessionChanged.connect(P),T.context.sessionContext.ready.then(()=>{P?.(T.context.sessionContext,{name:"session",oldValue:null,newValue:T.context.sessionContext.session})}),T.content.activeCellChanged.connect(v))),()=>{if(p=!1,g){v&&T?.content.activeCellChanged.disconnect(v),P&&T?.context.sessionContext.sessionChanged.disconnect(P),g.editor=null;const A=Oe(r.inlineProviders),k=r.providers&&r.providers.length>0?[new he,...r.providers]:[new he];g.reconciliator=new Ne({context:{widget:new Z},providers:k,inlineProviders:r.inlineProviders,inlineProvidersSettings:A,timeout:Re})}}},[g,T,V]),_.useEffect(()=>{const p=T?.node;if(!p)return;const v=P=>{const A=P.target;!A||!p.contains(A)||O.commands.processKeydownEvent(P)};return window.addEventListener("keydown",v,!0),()=>{window.removeEventListener("keydown",v,!0)}},[O.commands,T]),_.useEffect(()=>()=>{const p=ne.getState().notebooks;if(p.has(E)){const v=new Map(p);v.delete(E),ne.getState().setNotebooks(v)}},[E]),u.jsxs(u.Fragment,{children:[I.map((p,v)=>u.jsx(ue,{children:p},`${p}-${v}`)),h?u.jsx(Be,{},"notebook-loader"):T?u.jsxs(ue,{sx:{height:"100%",position:"relative"},children:[u.jsx(jn,{id:E,children:T},"notebook-container"),m?null:u.jsx(ue,{sx:{position:"absolute",inset:0,zIndex:1,overflow:"hidden",bg:x??"var(--bgColor-default)"},children:u.jsx(Be,{})},"notebook-first-paint")]}):u.jsx(Bn,{variant:"critical",description:"Unable to create the notebook view.",hideTitle:!0,title:"Error"},"notebook-error")]})}function Ts(r={}){const{kernel:e,kernels:t,requestedKernelId:n,startDefaultKernel:s=!1}=r,o=e?.id,[i,a]=_.useState(o),[l,d]=_.useState(void 0);return _.useEffect(()=>{let c=!0;if(o){a(h=>h!==o?o:h);return}return t&&(async()=>{let h;if(await t.ready,n){const f=()=>{for(const m of t.running())if(m.id===n)return!0;return!1};if(!f())try{await t.refreshRunning()}catch(m){console.warn("Failed to list the running kernels.",m)}f()&&(h=n)}if(!h&&s&&c){await t.refreshRunning();const f=[...t.running()];if(f.length>0){const m=t.connectTo({model:f[0]});c?(h=m.id,a(h)):m.dispose()}else{const m=await t.startNew();c?(h=m.id,a(h),d(m)):m.dispose()}}c&&a(f=>f!==h?h:f)})(),()=>{c=!1}},[t,o,n,s]),_.useEffect(()=>()=>{l&&l.shutdown().catch(c=>{console.warn(`Failed to shutdown kernel '${l?.id}'.`,c)}).finally(()=>{l?.dispose()})},[l]),i}function Ds(r){const{collaborationProvider:e,nbformat:t,readonly:n=!1,url:s,path:o,serviceManager:i,id:a}=r,[l,d]=_.useState(null);return _.useEffect(()=>{let c=!0;const h=new tn;if(e&&i&&a)(async()=>{try{const m=new je;if(await e.connect(m,a,{serviceManager:i,path:o}),c){const C=new Ve({collaborationEnabled:!0,disableDocumentWideUndoRedo:!0,sharedModel:m});C.readOnly=n,d(C),h.add({dispose:()=>{e.disconnect()},get isDisposed(){return!1}})}}catch(m){console.error("Failed to setup collaboration:",m)}})();else{const f=m=>{const C=new Ve;m&&Es(C,m,n),C.readOnly=n,d(C)};!t&&s?As(s).then(m=>{c&&f(m)}):f(t)}return()=>{c=!1,h.dispose()}},[e,t,n,s,o,i,a]),l}async function As(r){return fetch(r).then(e=>e.text()).then(e=>JSON.parse(e))}class js{_commands;_editorServices;_rendermime;constructor(e={}){this._commands=e.commands??new rn;const t=new et;for(const d of et.getDefaultLanguages())t.addLanguage(d);t.addLanguage({name:"ipythongfm",mime:"text/x-ipythongfm",load:async()=>(await an(()=>import("./index-7F_pA42X.js"),[],import.meta.url)).markdown({codeLanguages:c=>t.findBest(c)})});const n=ln.filter(d=>d.mimeTypes[0]!=="text/javascript").concat([xn,Sn]).concat(e.renderers??[]);this._rendermime=new yt({initialFactories:n,latexTypesetter:En(),markdownParser:Mn(t)});const s=new Tn(t),o=new tt;for(const d of tt.getDefaultThemes())o.addTheme(d);const i=new ce;for(const d of ce.getDefaultExtensions({themes:o}))i.addExtension(d);i.addExtension({name:"shared-model-binding",factory:d=>{const c=d.model.sharedModel;return ce.createImmutableExtension(dn({ytext:c.ysource,undoManager:c.undoManager??void 0}))}}),i.addExtension({name:"remote-user-cursors",factory(d){const{awareness:c,ysource:h}=d.model.sharedModel;return ce.createImmutableExtension(zn({awareness:c,ytext:h}))}});const a=Rs();a&&i.addExtension({name:"csp-nonce",factory(){return ce.createImmutableExtension(De.cspNonce.of(a))}});const l=new Pn({extensions:i,languages:t});this._editorServices={factoryService:l,mimeTypeService:s}}get commands(){return this._commands}get editorServices(){return this._editorServices}get rendermime(){return this._rendermime}}class Is extends Jn{model;constructor(e){super(),this.model=e}get collaborative(){return!1}createNew(e){return this.model}}function Ns(r,e,t,n,s=!1){const o=!t;r.sessionContext._initialize=async()=>{const i=r.sessionContext.sessionManager;await i.ready,await i.refreshRunning();const a=cn(i.running(),l=>l.kernel?.id===(r.sessionContext.kernelPreference.id??""));if(a)try{const l=i.connectTo({model:{...a,path:t??a.path,name:t??a.name},kernelConnectionOptions:{handleComms:!0}});r.sessionContext._handleNewSession(l)}catch(l){return r.sessionContext._handleSessionError(l),Promise.reject(l)}return await r.sessionContext._startIfNecessary()},r.dispose=()=>{r.isDisposed||(r._isDisposed=!0,r.sessionContext.dispose(),r._disposed.emit(void 0),j.clearData(r))},o&&(r._populate=async()=>{if(r._isPopulated=!0,r._isReady=!0,r._populatedPromise.resolve(void 0),r.isDisposed)return;const i=r._model.defaultKernelName||r.sessionContext.kernelPreference.name;r.sessionContext.kernelPreference={...r.sessionContext.kernelPreference,name:i,language:r._model.defaultKernelLanguage},s||r.sessionContext.initialize().then(a=>{a&&r._dialogs.selectKernel(r.sessionContext.sessionContext)})},r.initialize=async i=>{r.model.dirty=!1;const a=new Date().toISOString(),l={path:e,name:e,type:"notebook",content:void 0,writable:!0,created:a,last_modified:a,mimetype:"application/x-ipynb+json",format:"json"};r._updateContentsModel(l),await r._populate(),r.model.sharedModel.clearUndoHistory()}),r.sessionContext.sessionChanged.connect((i,a)=>{const l=a.newValue;n?.(l??void 0)}),r.sessionContext.kernelChanged.connect((i,a)=>{const l=a.newValue;l&&!l.handleComms&&(l.handleComms=!0)}),r.sessionContext.ready.then(()=>{n?.(r?.sessionContext.session??void 0)}),r.initialize(!t)}class Ls{_additionalDrives=new Set;contents=Object.freeze({fileChanged:{connect:()=>{}},getSharedModelFactory(e){return null},localPath:e=>{const t=e.split("/"),n=t[0].split(":");return n.length===1||!this._additionalDrives.has(n[0])?z.PathExt.removeSlash(e):z.PathExt.join(n.slice(1).join(":"),...t.slice(1))},normalize(e){const t=e.split(":");return t.length===1?z.PathExt.normalize(e):`${t[0]}:${z.PathExt.normalize(t.slice(1).join(":"))}`}});kernelspecs=Object.freeze({ready:new Promise(()=>{})});sessions=Object.freeze({ready:new Promise(()=>{})});ready=Promise.resolve()}function Rs(){const r=document.querySelector('meta[property="csp-nonce"]');return r?r.getAttribute("content"):null}const Os=fn`
|
|
40
40
|
.dla-Box-Notebook .jp-Cell .dla-CellSidebar-Container {
|
|
41
41
|
display: none;
|
|
42
42
|
}
|
|
43
43
|
.dla-Box-Notebook .jp-Cell.jp-mod-active .dla-CellSidebar-Container {
|
|
44
44
|
display: block;
|
|
45
45
|
}
|
|
46
|
-
`;function Js(r){const{Toolbar:e,cellSidebarMargin:t=120,children:n,collaborationProvider:s,commands:o,extensions:i,height:a="100vh",id:l,inlineProviders:d,kernel:c,maxHeight:h="100vh",nbformat:f,onNotebookModelChanged:m,onSessionConnection:C,path:x,providers:I,readonly:L=!1,renderers:g,serviceManager:y,startDefaultKernel:S=!1,url:M,variant:E}=r,[K,O]=_.useState(!0),[ye,oe]=_.useState(()=>!s||s.isConnected);_.useEffect(()=>{if(!s){oe(!0);return}oe(s.isConnected);const V=(F,be)=>{be&&oe(!0)},{syncStateChanged:X}=s.events;return X.connect(V),()=>{X.disconnect(V)}},[s]);const Ce=Ts({kernel:c,kernels:y.kernels,requestedKernelId:r.kernelId,startDefaultKernel:S}),B=Ds({collaborationProvider:s,nbformat:f,readonly:L,url:M,path:x,serviceManager:y,id:l});return _.useEffect(()=>{B&&O(!1),m?.(B)},[B,m]),_.useEffect(()=>{const V=y.user;if(!V)return;const X=()=>{s&&B&&B.sharedModel.awareness.setLocalStateField("user",V.identity)};return X(),V.userChanged.connect(X),()=>{V.userChanged.disconnect(X)}},[s,B,y]),K?u.jsx(Be,{},"notebook-loader"):u.jsxs(ue,{style:{height:a,width:"100%",position:"relative"},id:"dla-Jupyter-Notebook",children:[e&&u.jsx(e,{notebookId:l}),u.jsxs(ue,{className:"dla-Box-Notebook",sx:{height:a,maxHeight:h,width:"100%",overflowY:"hidden","& .datalayer-NotebookPanel-header":{minHeight:"50px"},"& .jp-Notebook":{flex:"1 1 auto !important",height:"100%",overflowY:"hidden"},"& .jp-NotebookPanel":{},"& .jp-Toolbar":{display:"none",zIndex:0},"& .jp-Toolbar .jp-HTMLSelect.jp-DefaultStyle select":{fontSize:"14px"},"& .jp-Toolbar > .jp-Toolbar-responsive-opener":{display:"none"},"& .jp-Toolbar-kernelName":{display:"none"},"& .jp-Cell":{width:`calc(100% - ${t}px)`},"& .jp-Notebook-footer":{width:`calc(100% - ${t+82}px)`},"& .jp-CodeMirrorEditor":{cursor:"text !important"},".dla-Box-Notebook":{position:"relative"}},children:[n,u.jsx(Os,{}),B&&y&&u.jsx(Ps,{commands:o,id:l,extensions:i,inlineProviders:d,providers:I,kernelId:Ce,model:B,synced:ye,path:x,sessionOnly:r.sessionOnly,renderers:g,serviceManager:y,onSessionConnection:C,variant:E})]})]})}var b;(function(r){r[r.NotGraded=0]="NotGraded",r[r.AutogradedAnswer=1]="AutogradedAnswer",r[r.AutogradedTest=2]="AutogradedTest",r[r.ManuallyGradedTask=3]="ManuallyGradedTask",r[r.ManuallyGradedAnswer=4]="ManuallyGradedAnswer",r[r.ReadonlyGraded=5]="ReadonlyGraded"})(b||(b={}));const Fs=r=>{const e=r.getMetadata("nbgrader");if(!e)return b.NotGraded;const t=e.grade,n=e.solution,s=e.locked,o=e.task;return!t&&n&&!s?b.AutogradedAnswer:!t&&!n&&s&&o?b.ManuallyGradedTask:t&&!n&&s?b.AutogradedTest:t&&n&&!s?b.ManuallyGradedAnswer:!t&&!n&&s&&!o?b.ReadonlyGraded:b.NotGraded};function Bs(r){const{cellModel:e}=r,[t,n]=_.useState(Fs(e)),[s,o]=_.useState(e.getMetadata("nbgrader")??{grade_id:ae(),points:1});_.useEffect(()=>{(s.grade_id===void 0||s.points===void 0)&&o(d=>({grade_id:d.grade_id??ae(),points:d.points??1}))},[s]);const i=_.useCallback((d,c)=>{const h=d.getMetadata("nbgrader");d.setMetadata("nbgrader",{...h,grade_id:c}),o({...s,grade_id:c})},[]),a=_.useCallback((d,c)=>{const h=+c;if(!isNaN(h)){const f=d.getMetadata("nbgrader");d.setMetadata("nbgrader",{...f,points:h}),o({...s,points:h})}},[]),l=_.useCallback((d,c)=>{switch(c){case b.NotGraded:{d.deleteMetadata("nbgrader"),n(b.NotGraded);break}case b.AutogradedAnswer:{const h=d.getMetadata("nbgrader");d.setMetadata("nbgrader",{...h,grade:!1,solution:!0,locked:!1,task:!1,grade_id:ae(),points:1}),n(b.AutogradedAnswer);break}case b.AutogradedTest:{const h=d.getMetadata("nbgrader");d.setMetadata("nbgrader",{...h,grade:!0,solution:!1,locked:!1,task:!1,grade_id:ae(),points:1}),n(b.AutogradedTest);break}case b.ManuallyGradedAnswer:{const h=d.getMetadata("nbgrader");d.setMetadata("nbgrader",{...h,grade:!0,solution:!0,locked:!1,task:!1,grade_id:ae(),points:1}),n(b.ManuallyGradedAnswer);break}case b.ManuallyGradedTask:{const h=d.getMetadata("nbgrader");d.setMetadata("nbgrader",{...h,grade:!1,solution:!1,locked:!0,task:!0,grade_id:ae(),points:1}),n(b.ManuallyGradedTask);break}case b.ReadonlyGraded:{const h=d.getMetadata("nbgrader");d.setMetadata("nbgrader",{...h,grade:!1,solution:!1,locked:!0,task:!1}),n(b.ReadonlyGraded);break}}},[]);return u.jsxs(D,{showDividers:!0,children:[u.jsx(D.Divider,{}),u.jsxs(D.Group,{title:"NbGrader Cell Type",variant:"subtle",children:[u.jsxs(D.Item,{onSelect:d=>l(e,b.NotGraded),children:[t===b.NotGraded&&u.jsx(D.LeadingVisual,{children:u.jsx(le,{})}),"None",u.jsx(D.Description,{variant:"block",children:"Not a grader cell."})]}),u.jsxs(D.Item,{onSelect:d=>l(e,b.AutogradedAnswer),children:[t===b.AutogradedAnswer&&u.jsx(D.LeadingVisual,{children:u.jsx(le,{})}),"Autograded answer",u.jsx(D.Description,{variant:"block",children:"An autograded answer cell."})]}),u.jsxs(D.Item,{role:"listitem",onClick:d=>l(e,b.AutogradedTest),children:[t===b.AutogradedTest&&u.jsx(D.LeadingVisual,{children:u.jsx(le,{})}),"Autograded test",u.jsx(D.Description,{variant:"block",children:"An autograded test cell."})]}),u.jsxs(D.Item,{onSelect:d=>l(e,b.ManuallyGradedTask),children:[t===b.ManuallyGradedTask&&u.jsx(D.LeadingVisual,{children:u.jsx(le,{})}),"Manually graded task",u.jsx(D.Description,{variant:"block",children:"A manually graded task cell."})]}),u.jsxs(D.Item,{onSelect:d=>l(e,b.ManuallyGradedAnswer),children:[t===b.ManuallyGradedAnswer&&u.jsx(D.LeadingVisual,{children:u.jsx(le,{})}),"Manually graded answer",u.jsx(D.Description,{variant:"block",children:"A manually graded answer cell."})]}),u.jsxs(D.Item,{onSelect:d=>l(e,b.ReadonlyGraded),children:[t===b.ReadonlyGraded&&u.jsx(D.LeadingVisual,{children:u.jsx(le,{})}),"Readonly",u.jsx(D.Description,{variant:"block",children:"A readonly grader cell."})]})]}),(()=>{const d=t===b.NotGraded;return u.jsxs(D.Group,{title:"NbGrader Metadata",variant:"subtle",children:[u.jsxs(D.Item,{disabled:d,onSelect:c=>c.preventDefault(),children:["Grade ID"," ",u.jsx(nt,{block:!0,disabled:d,value:s.grade_id,onChange:c=>{c.preventDefault(),i(e,c.target.value)}})]}),u.jsxs(D.Item,{disabled:d,children:["Points"," ",u.jsx(nt,{block:!0,disabled:d,value:s.points,onChange:c=>{c.preventDefault(),a(e,c.target.value)}})]})]})})()]})}const Mt="dla-CellSidebar-Container";function Et(r){const{commands:e,model:t,nbgrader:n}=r;return u.jsxs(vt,{className:Mt,sx:{"& p":{marginBottom:"0 !important"}},children:[n&&u.jsx(mn,{children:u.jsx(Bs,{cellModel:t})}),u.jsx(J,{title:"Run cell",leadingVisual:pn,variant:"invisible",size:"small",onClick:s=>{s.preventDefault(),e.execute(R.run).catch(o=>{console.error("Failed to run cell.",o)})},children:"Run"}),u.jsx(J,{title:"Insert code cell above",leadingVisual:Me,variant:"invisible",size:"small",onClick:s=>{s.preventDefault(),e.execute(R.insertAbove).catch(o=>{console.error("Failed to insert code cell above.",o)})},children:"Code"}),u.jsx(J,{title:"Insert markdown cell above",leadingVisual:Me,variant:"invisible",size:"small",onClick:s=>{s.preventDefault(),e.execute(R.insertAbove,{cellType:"markdown"}).catch(o=>{console.error("Failed to insert markdown cell above.",o)})},children:"Markdown"}),t.type==="code"?u.jsx(J,{title:"Convert to markdow cell",leadingVisual:Ee,variant:"invisible",size:"small",onClick:s=>{s.preventDefault(),e.execute(R.changeCellTypeToMarkdown).catch(o=>{console.error("Failed to change cell type to markdown.",o)})},children:"To Markdown"}):u.jsx(J,{title:"Convert to code cell",leadingVisual:Ee,variant:"invisible",size:"small",onClick:s=>{s.preventDefault(),e.execute(R.changeCellTypeToCode).catch(o=>{console.error("Failed to change cell type to code.",o)})},children:"To Code"}),u.jsx(J,{title:"Insert markdown cell below",leadingVisual:Se,variant:"invisible",size:"small",onClick:s=>{s.preventDefault(),e.execute(R.insertBelow,{cellType:"markdown"}).catch(o=>{console.error("Failed to insert markdown cell below.",o)})},children:"Markdown"}),u.jsx(J,{title:"Insert code cell below",leadingVisual:Se,variant:"invisible",size:"small",onClick:s=>{s.preventDefault(),e.execute(R.insertBelow).catch(o=>{console.error("Failed to insert code cell below.",o)})},children:"Code"}),u.jsx(J,{title:"Delete cell",leadingVisual:Ge,variant:"invisible",size:"small",onClick:s=>{s.preventDefault(),e.execute(R.deleteCells).catch(o=>{console.error("Failed to delete cells.",o)})},children:"Delete"})]})}function Ys(r){const{commands:e,model:t}=r,n=t.type==="code"?t:null,[s,o]=_.useState(n?.executionState==="running");return _.useEffect(()=>{if(!n)return;const i=(a,l)=>{l.name==="executionState"&&o(l.newValue==="running")};return n.stateChanged.connect(i),o(n.executionState==="running"),()=>{n.stateChanged.disconnect(i)}},[n]),u.jsxs(vt,{className:Mt,sx:{width:16,position:"relative",marginTop:4,marginLeft:"16px !important","& p":{marginBottom:"0 !important"}},children:[s?u.jsx(q,{size:"small",color:"danger","aria-label":"Interrupt kernel",title:"Interrupt kernel",onClick:i=>{i.preventDefault(),e.execute(R.interrupt).catch(a=>{console.error("Failed to interrupt the kernel.",a)})},icon:gn,variant:"invisible"}):u.jsx(q,{size:"small",color:"secondary","aria-label":"Run cell",title:"Run cell",onClick:i=>{i.preventDefault(),e.execute(R.run).catch(a=>{console.error("Failed to run cell.",a)})},icon:_n,variant:"invisible"}),u.jsx(q,{size:"small",color:"secondary","aria-label":"Add code cell above",title:"Add code cell above",onClick:i=>{i.preventDefault(),e.execute(R.insertAbove).catch(a=>{console.error("Failed to insert code cell above.",a)})},icon:Me,variant:"invisible"}),u.jsx(q,{size:"small",color:"secondary","aria-label":"Add markdown cell above",title:"Add markdown cell above",onClick:i=>{i.preventDefault(),e.execute(R.insertAbove,{cellType:"markdown"}).catch(a=>{console.error("Failed to insert markdown cell above.",a)})},icon:Me,variant:"invisible"}),t.type==="code"?u.jsx(q,{"aria-label":"Convert to markdow cell",title:"Convert to markdow cell",icon:Ee,size:"small",variant:"invisible",onClick:i=>{i.preventDefault(),e.execute(R.changeCellTypeToMarkdown).catch(a=>{console.error("Failed to change cell type to markdown.",a)})}}):u.jsx(q,{"aria-label":"Convert to code cell",title:"Convert to code cell",icon:Ee,variant:"invisible",size:"small",onClick:i=>{i.preventDefault(),e.execute(R.changeCellTypeToCode).catch(a=>{console.error("Failed to change cell type to code.",a)})}}),u.jsx(q,{size:"small",color:"secondary","aria-label":"Add markdown cell below",title:"Add markdown cell below",onClick:i=>{i.preventDefault(),e.execute(R.insertBelow,{cellType:"markdown"}).catch(a=>{console.error("Failed to insert markdown cell below.",a)})},icon:Se,variant:"invisible"}),u.jsx(q,{size:"small",color:"secondary","aria-label":"Add code cell below",title:"Add code cell below",onClick:i=>{i.preventDefault(),e.execute(R.insertBelow).catch(a=>{console.error("Failed to insert code cell below.",a)})},icon:Se,variant:"invisible"}),u.jsx(q,{size:"small",color:"error","aria-label":"Delete cell",title:"Delete cell",onClick:i=>{i.preventDefault(),e.execute(R.deleteCells).catch(a=>{console.error("Failed to delete cells.",a)})},icon:Ge,variant:"invisible"})]})}function Ws({children:r}){const e=gt(t=>t.backgroundColor);return u.jsx(yn,{backgroundColor:e,loadJupyterLabCss:!1,children:r})}class Vs{panel;commands;nbgrader;sidebarWidth;factory;_isDisposed=!1;_sidebars=new WeakMap;constructor(e,t,n=!1,s=120,o=Et){this.panel=e,this.commands=t,this.nbgrader=n,this.sidebarWidth=s,this.factory=o,this._onModelChanged(e.content),e.content.modelChanged.connect(this._onModelChanged,this)}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this.panel.content.model?.cells.changed.disconnect(this._onCellsChanged,this),this.panel.content.modelChanged.disconnect(this._onModelChanged,this),j.clearData(this))}_addSidebar(e){const t=this._getCell(e);if(t){const n=this.factory,s=vn.create(u.jsx(Ws,{children:u.jsx(n,{commands:this.commands,model:e,nbgrader:this.nbgrader})}));s.node.style.width=`${this.sidebarWidth}px`,s.node.style.position="absolute",s.node.style.right=`-${this.sidebarWidth}px`,s.node.style.top="0",t.layout.insertWidget(0,s),this._sidebars.set(e,s);const o=()=>{this._sidebars.delete(e),s.dispose()};t.disposed.connect(o)}}_getCell(e){return this.panel?.content.widgets.find(t=>t.model===e)}_removeSidebar(e){this._sidebars.get(e)?.dispose(),this._sidebars.delete(e)}_onCellsChanged(e,t){t.oldValues.forEach(n=>this._removeSidebar(n)),t.newValues.forEach(n=>this._addSidebar(n))}_onModelChanged(e){const t=e.model?.cells;t&&this._onCellsChanged(t,{type:"add",newIndex:0,newValues:Array.from(t),oldIndex:-1,oldValues:[]}),t?.changed.connect(this._onCellsChanged,this)}}class Xs{factory;commands;nbgrader;sidebarWidth;colormode;component;constructor(e={}){this.factory=e.factory??Et,this.commands=e.commands,this.nbgrader=e.nbgrader,this.sidebarWidth=e.sidebarWidth,this.colormode=e.colormode??"light"}createNew(e){return new Vs(e,this.commands,this.nbgrader,this.sidebarWidth,this.factory)}init(e){this.commands=e.commands}}export{Xs as C,Mt as D,te as I,Js as N,Ys as a,Xn as b,Jn as c,Zn as d,Yn as e,Ve as f,Bs as g,Et as h,b as i,ys as j,Ps as k,Fs as l,Ds as m,zn as r,Ts as u,cs as w};
|
|
46
|
+
`;function Js(r){const{Toolbar:e,cellSidebarMargin:t=120,children:n,collaborationProvider:s,commands:o,extensions:i,height:a="100vh",id:l,inlineProviders:d,kernel:c,maxHeight:h="100vh",nbformat:f,onNotebookModelChanged:m,onSessionConnection:C,path:x,providers:I,readonly:L=!1,renderers:g,serviceManager:y,startDefaultKernel:S=!1,url:M,variant:E}=r,[K,O]=_.useState(!0),[ye,oe]=_.useState(()=>!s||s.isConnected);_.useEffect(()=>{if(!s){oe(!0);return}oe(s.isConnected);const V=(F,be)=>{be&&oe(!0)},{syncStateChanged:X}=s.events;return X.connect(V),()=>{X.disconnect(V)}},[s]);const Ce=Ts({kernel:c,kernels:y.kernels,requestedKernelId:r.kernelId,startDefaultKernel:S}),B=Ds({collaborationProvider:s,nbformat:f,readonly:L,url:M,path:x,serviceManager:y,id:l});return _.useEffect(()=>{B&&O(!1),m?.(B)},[B,m]),_.useEffect(()=>{const V=y.user;if(!V)return;const X=()=>{s&&B&&B.sharedModel.awareness.setLocalStateField("user",V.identity)};return X(),V.userChanged.connect(X),()=>{V.userChanged.disconnect(X)}},[s,B,y]),K?u.jsx(Be,{},"notebook-loader"):u.jsxs(ue,{style:{height:a,width:"100%",position:"relative"},id:"dla-Jupyter-Notebook",children:[e&&u.jsx(e,{notebookId:l}),u.jsxs(ue,{className:"dla-Box-Notebook",sx:{height:a,maxHeight:h,width:"100%",overflowY:"hidden","& .datalayer-NotebookPanel-header":{minHeight:"50px"},"& .jp-Notebook":{flex:"1 1 auto !important",height:"100%",overflowY:"hidden"},"& .jp-NotebookPanel":{},"& .jp-Toolbar":{display:"none",zIndex:0},"& .jp-Toolbar .jp-HTMLSelect.jp-DefaultStyle select":{fontSize:"14px"},"& .jp-Toolbar > .jp-Toolbar-responsive-opener":{display:"none"},"& .jp-Toolbar-kernelName":{display:"none"},"& .jp-Cell":{width:`calc(100% - ${t}px)`},"& .jp-Notebook-footer":{width:`calc(100% - ${t+82}px)`},"& .jp-CodeMirrorEditor":{cursor:"text !important"},".dla-Box-Notebook":{position:"relative"}},children:[n,u.jsx(Os,{}),B&&y&&u.jsx(Ps,{commands:o,id:l,extensions:i,inlineProviders:d,providers:I,kernelId:Ce,model:B,synced:ye,path:x,sessionOnly:r.sessionOnly,renderers:g,serviceManager:y,onSessionConnection:C,variant:E})]})]})}var b;(function(r){r[r.NotGraded=0]="NotGraded",r[r.AutogradedAnswer=1]="AutogradedAnswer",r[r.AutogradedTest=2]="AutogradedTest",r[r.ManuallyGradedTask=3]="ManuallyGradedTask",r[r.ManuallyGradedAnswer=4]="ManuallyGradedAnswer",r[r.ReadonlyGraded=5]="ReadonlyGraded"})(b||(b={}));const Fs=r=>{const e=r.getMetadata("nbgrader");if(!e)return b.NotGraded;const t=e.grade,n=e.solution,s=e.locked,o=e.task;return!t&&n&&!s?b.AutogradedAnswer:!t&&!n&&s&&o?b.ManuallyGradedTask:t&&!n&&s?b.AutogradedTest:t&&n&&!s?b.ManuallyGradedAnswer:!t&&!n&&s&&!o?b.ReadonlyGraded:b.NotGraded};function Bs(r){const{cellModel:e}=r,[t,n]=_.useState(Fs(e)),[s,o]=_.useState(e.getMetadata("nbgrader")??{grade_id:ae(),points:1});_.useEffect(()=>{(s.grade_id===void 0||s.points===void 0)&&o(d=>({grade_id:d.grade_id??ae(),points:d.points??1}))},[s]);const i=_.useCallback((d,c)=>{const h=d.getMetadata("nbgrader");d.setMetadata("nbgrader",{...h,grade_id:c}),o({...s,grade_id:c})},[]),a=_.useCallback((d,c)=>{const h=+c;if(!isNaN(h)){const f=d.getMetadata("nbgrader");d.setMetadata("nbgrader",{...f,points:h}),o({...s,points:h})}},[]),l=_.useCallback((d,c)=>{switch(c){case b.NotGraded:{d.deleteMetadata("nbgrader"),n(b.NotGraded);break}case b.AutogradedAnswer:{const h=d.getMetadata("nbgrader");d.setMetadata("nbgrader",{...h,grade:!1,solution:!0,locked:!1,task:!1,grade_id:ae(),points:1}),n(b.AutogradedAnswer);break}case b.AutogradedTest:{const h=d.getMetadata("nbgrader");d.setMetadata("nbgrader",{...h,grade:!0,solution:!1,locked:!1,task:!1,grade_id:ae(),points:1}),n(b.AutogradedTest);break}case b.ManuallyGradedAnswer:{const h=d.getMetadata("nbgrader");d.setMetadata("nbgrader",{...h,grade:!0,solution:!0,locked:!1,task:!1,grade_id:ae(),points:1}),n(b.ManuallyGradedAnswer);break}case b.ManuallyGradedTask:{const h=d.getMetadata("nbgrader");d.setMetadata("nbgrader",{...h,grade:!1,solution:!1,locked:!0,task:!0,grade_id:ae(),points:1}),n(b.ManuallyGradedTask);break}case b.ReadonlyGraded:{const h=d.getMetadata("nbgrader");d.setMetadata("nbgrader",{...h,grade:!1,solution:!1,locked:!0,task:!1}),n(b.ReadonlyGraded);break}}},[]);return u.jsxs(D,{showDividers:!0,children:[u.jsx(D.Divider,{}),u.jsxs(D.Group,{title:"NbGrader Cell Type",variant:"subtle",children:[u.jsxs(D.Item,{onSelect:d=>l(e,b.NotGraded),children:[t===b.NotGraded&&u.jsx(D.LeadingVisual,{children:u.jsx(le,{})}),"None",u.jsx(D.Description,{variant:"block",children:"Not a grader cell."})]}),u.jsxs(D.Item,{onSelect:d=>l(e,b.AutogradedAnswer),children:[t===b.AutogradedAnswer&&u.jsx(D.LeadingVisual,{children:u.jsx(le,{})}),"Autograded answer",u.jsx(D.Description,{variant:"block",children:"An autograded answer cell."})]}),u.jsxs(D.Item,{role:"listitem",onClick:d=>l(e,b.AutogradedTest),children:[t===b.AutogradedTest&&u.jsx(D.LeadingVisual,{children:u.jsx(le,{})}),"Autograded test",u.jsx(D.Description,{variant:"block",children:"An autograded test cell."})]}),u.jsxs(D.Item,{onSelect:d=>l(e,b.ManuallyGradedTask),children:[t===b.ManuallyGradedTask&&u.jsx(D.LeadingVisual,{children:u.jsx(le,{})}),"Manually graded task",u.jsx(D.Description,{variant:"block",children:"A manually graded task cell."})]}),u.jsxs(D.Item,{onSelect:d=>l(e,b.ManuallyGradedAnswer),children:[t===b.ManuallyGradedAnswer&&u.jsx(D.LeadingVisual,{children:u.jsx(le,{})}),"Manually graded answer",u.jsx(D.Description,{variant:"block",children:"A manually graded answer cell."})]}),u.jsxs(D.Item,{onSelect:d=>l(e,b.ReadonlyGraded),children:[t===b.ReadonlyGraded&&u.jsx(D.LeadingVisual,{children:u.jsx(le,{})}),"Readonly",u.jsx(D.Description,{variant:"block",children:"A readonly grader cell."})]})]}),(()=>{const d=t===b.NotGraded;return u.jsxs(D.Group,{title:"NbGrader Metadata",variant:"subtle",children:[u.jsxs(D.Item,{disabled:d,onSelect:c=>c.preventDefault(),children:["Grade ID"," ",u.jsx(nt,{block:!0,disabled:d,value:s.grade_id,onChange:c=>{c.preventDefault(),i(e,c.target.value)}})]}),u.jsxs(D.Item,{disabled:d,children:["Points"," ",u.jsx(nt,{block:!0,disabled:d,value:s.points,onChange:c=>{c.preventDefault(),a(e,c.target.value)}})]})]})})()]})}const Mt="dla-CellSidebar-Container";function Et(r){const{commands:e,model:t,nbgrader:n}=r;return u.jsxs(vt,{className:Mt,sx:{"& p":{marginBottom:"0 !important"}},children:[n&&u.jsx(mn,{children:u.jsx(Bs,{cellModel:t})}),u.jsx(J,{title:"Run cell",leadingVisual:pn,variant:"invisible",size:"small",onClick:s=>{s.preventDefault(),e.execute(R.run).catch(o=>{console.error("Failed to run cell.",o)})},children:"Run"}),u.jsx(J,{title:"Insert code cell above",leadingVisual:Me,variant:"invisible",size:"small",onClick:s=>{s.preventDefault(),e.execute(R.insertAbove).catch(o=>{console.error("Failed to insert code cell above.",o)})},children:"Code"}),u.jsx(J,{title:"Insert markdown cell above",leadingVisual:Me,variant:"invisible",size:"small",onClick:s=>{s.preventDefault(),e.execute(R.insertAbove,{cellType:"markdown"}).catch(o=>{console.error("Failed to insert markdown cell above.",o)})},children:"Markdown"}),t.type==="code"?u.jsx(J,{title:"Convert to markdow cell",leadingVisual:Ee,variant:"invisible",size:"small",onClick:s=>{s.preventDefault(),e.execute(R.changeCellTypeToMarkdown).catch(o=>{console.error("Failed to change cell type to markdown.",o)})},children:"To Markdown"}):u.jsx(J,{title:"Convert to code cell",leadingVisual:Ee,variant:"invisible",size:"small",onClick:s=>{s.preventDefault(),e.execute(R.changeCellTypeToCode).catch(o=>{console.error("Failed to change cell type to code.",o)})},children:"To Code"}),u.jsx(J,{title:"Insert markdown cell below",leadingVisual:Se,variant:"invisible",size:"small",onClick:s=>{s.preventDefault(),e.execute(R.insertBelow,{cellType:"markdown"}).catch(o=>{console.error("Failed to insert markdown cell below.",o)})},children:"Markdown"}),u.jsx(J,{title:"Insert code cell below",leadingVisual:Se,variant:"invisible",size:"small",onClick:s=>{s.preventDefault(),e.execute(R.insertBelow).catch(o=>{console.error("Failed to insert code cell below.",o)})},children:"Code"}),u.jsx(J,{title:"Delete cell",leadingVisual:$e,variant:"invisible",size:"small",onClick:s=>{s.preventDefault(),e.execute(R.deleteCells).catch(o=>{console.error("Failed to delete cells.",o)})},children:"Delete"})]})}function Ys(r){const{commands:e,model:t}=r,n=t.type==="code"?t:null,[s,o]=_.useState(n?.executionState==="running");return _.useEffect(()=>{if(!n)return;const i=(a,l)=>{l.name==="executionState"&&o(l.newValue==="running")};return n.stateChanged.connect(i),o(n.executionState==="running"),()=>{n.stateChanged.disconnect(i)}},[n]),u.jsxs(vt,{className:Mt,sx:{width:16,position:"relative",marginTop:4,marginLeft:"16px !important","& p":{marginBottom:"0 !important"}},children:[s?u.jsx(q,{size:"small",color:"danger","aria-label":"Interrupt kernel",title:"Interrupt kernel",onClick:i=>{i.preventDefault(),e.execute(R.interrupt).catch(a=>{console.error("Failed to interrupt the kernel.",a)})},icon:gn,variant:"invisible"}):u.jsx(q,{size:"small",color:"secondary","aria-label":"Run cell",title:"Run cell",onClick:i=>{i.preventDefault(),e.execute(R.run).catch(a=>{console.error("Failed to run cell.",a)})},icon:_n,variant:"invisible"}),u.jsx(q,{size:"small",color:"secondary","aria-label":"Add code cell above",title:"Add code cell above",onClick:i=>{i.preventDefault(),e.execute(R.insertAbove).catch(a=>{console.error("Failed to insert code cell above.",a)})},icon:Me,variant:"invisible"}),u.jsx(q,{size:"small",color:"secondary","aria-label":"Add markdown cell above",title:"Add markdown cell above",onClick:i=>{i.preventDefault(),e.execute(R.insertAbove,{cellType:"markdown"}).catch(a=>{console.error("Failed to insert markdown cell above.",a)})},icon:Me,variant:"invisible"}),t.type==="code"?u.jsx(q,{"aria-label":"Convert to markdow cell",title:"Convert to markdow cell",icon:Ee,size:"small",variant:"invisible",onClick:i=>{i.preventDefault(),e.execute(R.changeCellTypeToMarkdown).catch(a=>{console.error("Failed to change cell type to markdown.",a)})}}):u.jsx(q,{"aria-label":"Convert to code cell",title:"Convert to code cell",icon:Ee,variant:"invisible",size:"small",onClick:i=>{i.preventDefault(),e.execute(R.changeCellTypeToCode).catch(a=>{console.error("Failed to change cell type to code.",a)})}}),u.jsx(q,{size:"small",color:"secondary","aria-label":"Add markdown cell below",title:"Add markdown cell below",onClick:i=>{i.preventDefault(),e.execute(R.insertBelow,{cellType:"markdown"}).catch(a=>{console.error("Failed to insert markdown cell below.",a)})},icon:Se,variant:"invisible"}),u.jsx(q,{size:"small",color:"secondary","aria-label":"Add code cell below",title:"Add code cell below",onClick:i=>{i.preventDefault(),e.execute(R.insertBelow).catch(a=>{console.error("Failed to insert code cell below.",a)})},icon:Se,variant:"invisible"}),u.jsx(q,{size:"small",color:"error","aria-label":"Delete cell",title:"Delete cell",onClick:i=>{i.preventDefault(),e.execute(R.deleteCells).catch(a=>{console.error("Failed to delete cells.",a)})},icon:$e,variant:"invisible"})]})}function Ws({children:r}){const e=gt(t=>t.backgroundColor);return u.jsx(yn,{backgroundColor:e,loadJupyterLabCss:!1,children:r})}class Vs{panel;commands;nbgrader;sidebarWidth;factory;_isDisposed=!1;_sidebars=new WeakMap;constructor(e,t,n=!1,s=120,o=Et){this.panel=e,this.commands=t,this.nbgrader=n,this.sidebarWidth=s,this.factory=o,this._onModelChanged(e.content),e.content.modelChanged.connect(this._onModelChanged,this)}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this.panel.content.model?.cells.changed.disconnect(this._onCellsChanged,this),this.panel.content.modelChanged.disconnect(this._onModelChanged,this),j.clearData(this))}_addSidebar(e){const t=this._getCell(e);if(t){const n=this.factory,s=vn.create(u.jsx(Ws,{children:u.jsx(n,{commands:this.commands,model:e,nbgrader:this.nbgrader})}));s.node.style.width=`${this.sidebarWidth}px`,s.node.style.position="absolute",s.node.style.right=`-${this.sidebarWidth}px`,s.node.style.top="0",t.layout.insertWidget(0,s),this._sidebars.set(e,s);const o=()=>{this._sidebars.delete(e),s.dispose()};t.disposed.connect(o)}}_getCell(e){return this.panel?.content.widgets.find(t=>t.model===e)}_removeSidebar(e){this._sidebars.get(e)?.dispose(),this._sidebars.delete(e)}_onCellsChanged(e,t){t.oldValues.forEach(n=>this._removeSidebar(n)),t.newValues.forEach(n=>this._addSidebar(n))}_onModelChanged(e){const t=e.model?.cells;t&&this._onCellsChanged(t,{type:"add",newIndex:0,newValues:Array.from(t),oldIndex:-1,oldValues:[]}),t?.changed.connect(this._onCellsChanged,this)}}class Xs{factory;commands;nbgrader;sidebarWidth;colormode;component;constructor(e={}){this.factory=e.factory??Et,this.commands=e.commands,this.nbgrader=e.nbgrader,this.sidebarWidth=e.sidebarWidth,this.colormode=e.colormode??"light"}createNew(e){return new Vs(e,this.commands,this.nbgrader,this.sidebarWidth,this.factory)}init(e){this.commands=e.commands}}export{Xs as C,Mt as D,te as I,Js as N,Ys as a,Xn as b,Jn as c,Zn as d,Yn as e,Ve as f,Bs as g,Et as h,b as i,ys as j,Ps as k,Fs as l,Ds as m,zn as r,Ts as u,cs as w};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import{E as N,eN as ao,r as o,j as t,eO as io,eP as ro,b_ as bn,B as f,H as lt,T as W,c as G,cu as At,eu as Lt,eQ as ae,co as ct,e as lo,eR as co,eS as uo,e3 as fo,eT as po,aH as mo,dX as Tn,dV as go,dY as zt,eU as ho,eV as bo,eW as xo,eX as So,eY as xn,eZ as vo,e_ as yo,e$ as Co,d3 as wo,a_ as ko,f0 as jo,f1 as Eo,f2 as Io,f3 as To,f4 as Ro,f5 as Ao,x as Pt,f6 as Po,f7 as Mo,f8 as $o,f9 as Uo,fa as Oo,fb as Fo,fc as Lo,fd as zo,fe as _o,ff as No,fg as Bo,fh as Ho,fi as Wo,fj as Vo,fk as Do,fl as Go,fm as Ko,fn as Yo,fo as qo,fp as De,fq as Jo,fr as Qo,fs as Xo,ft as Zo,fu as Sn,fv as es,fw as Te,fx as ts,fy as ns,a$ as dt,fz as os,fA as ss,fB as vn,fC as as,fD as is,eC as rs,fE as Mt,fF as Re,fG as ls,fH as cs,fI as ds,fJ as us,fK as fs,fL as ps,fM as ms,fN as gs,fO as hs,fP as bs,fQ as xs,fR as Ss,fS as $t,fT as vs,fU as ys,I as Cs,fV as ws,fW as ks,fX as yn,fY as js,fZ as Es,f_ as Is,f$ as _t,g0 as Ts,g1 as Rs,ek as Ut,g2 as As,g3 as Ps}from"../datalayer-app-main.js";import{S as Ms,E as $s,a as Us}from"./SignInIcon-4HkE48mS.js";import{F as Os,a as Fs,b as Ls}from"./LinkedInGreyIcon-BoWXE-HS.js";function Rn(){const n=N(ao);return o.useMemo(()=>n.map(s=>s.value),[n])}const Ot={github:{name:"github",oauth2CallbackServerRoute:"jupyter_iam/oauth2/callback",oauth2CallbackUIRoute:"/iam/oauth2/github/callback"},google:{name:"google",oauth2CallbackServerRoute:"jupyter_iam/oauth2/callback",oauth2CallbackUIRoute:"/iam/oauth2/google/callback"},linkedin:{name:"linkedin",oauth2CallbackServerRoute:"jupyter_iam/oauth2/callback",oauth2CallbackUIRoute:"/iam/oauth2/linkedin/callback"}},Cn=()=>{if(typeof document>"u")return"";const n=document.getElementById("datalayer-config-data");if(!n?.textContent)return"";try{const s=JSON.parse(n.textContent);return String(s?.iamUrl||"").replace(/\/$/,"")}catch{return""}},zs=(n,s="Unable to start social sign-in.")=>{if(n instanceof Error&&n.message)return n.message;if(typeof n=="string"&&n.trim())return n;if(n&&typeof n=="object"&&"message"in n){const c=n.message;if(typeof c=="string"&&c.trim())return c}return s},_s=po`
|
|
2
|
+
.signin-input-theme-scope input:-webkit-autofill,
|
|
3
|
+
.signin-input-theme-scope input:-webkit-autofill:hover,
|
|
4
|
+
.signin-input-theme-scope input:-webkit-autofill:focus,
|
|
5
|
+
.signin-input-theme-scope input:-webkit-autofill:active,
|
|
6
|
+
.signin-input-theme-scope input:-webkit-autofill:disabled,
|
|
7
|
+
.signin-input-theme-scope textarea:-webkit-autofill,
|
|
8
|
+
.signin-input-theme-scope textarea:-webkit-autofill:hover,
|
|
9
|
+
.signin-input-theme-scope textarea:-webkit-autofill:focus,
|
|
10
|
+
.signin-input-theme-scope textarea:-webkit-autofill:active,
|
|
11
|
+
.signin-input-theme-scope textarea:-webkit-autofill:disabled {
|
|
12
|
+
-webkit-text-fill-color: var(--fgColor-default) !important;
|
|
13
|
+
caret-color: var(--fgColor-default) !important;
|
|
14
|
+
-webkit-box-shadow: 0 0 0 1000px var(--bgColor-default) inset !important;
|
|
15
|
+
box-shadow: 0 0 0 1000px var(--bgColor-default) inset !important;
|
|
16
|
+
background-color: var(--bgColor-default) !important;
|
|
17
|
+
transition: background-color 9999s ease-in-out 0s !important;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.signin-input-theme-scope input:disabled,
|
|
21
|
+
.signin-input-theme-scope textarea:disabled {
|
|
22
|
+
-webkit-text-fill-color: var(--fgColor-muted) !important;
|
|
23
|
+
-webkit-box-shadow: 0 0 0 1000px var(--bgColor-default) inset !important;
|
|
24
|
+
box-shadow: 0 0 0 1000px var(--bgColor-default) inset !important;
|
|
25
|
+
background-color: var(--bgColor-default) !important;
|
|
26
|
+
opacity: 1 !important;
|
|
27
|
+
}
|
|
28
|
+
`,Ns=({onSignIn:n,onApiKeySignIn:s,loginUrl:c,name:a,title:d="Datalayer OTEL",description:b="Sign in to access the observability dashboard.",icon:S,leadingIcon:C=t.jsx(fo,{size:24}),github:p=!1,google:K=!1,linkedin:B=!1,apiKey:Ge=!1,signUp:F=!0,socialSignInNavigationTarget:Z,asDoc:v=!1,fillHeight:I=!0,hideHero:ee=!1,calloutTitle:Ae,calloutDescription:Ke,passwordToggleLabel:ie="Sign in with a password",signUpTitle:Nt="Don't have an account?",signUpDescription:Y="Create a free Datalayer account with your email address.",signUpLabel:ut="Sign up with email",signUpHref:Pe="https://datalayer.ai/signup",onSignUp:H,forgotPasswordHref:q="/password",forgotPasswordLabel:Me="Forgot password?",showForgotPassword:ft=!0,socialButtonMarginTop:x=3,actionButtonMaxWidth:J=320})=>{const te=v&&!ee,Ye=a??(v&&d==="Datalayer OTEL"?"Datalayer Sign In":d),pt=S??(v?t.jsx(Ms,{size:24}):C),L=o.useMemo(()=>{if(c)return c;const i=Cn();return i?`${i}/api/iam/v1/login`:"/api/iam/v1/login"},[c]),[V,Se]=o.useState(""),[re,mt]=o.useState(""),[qe,le]=o.useState(!1),[ce,Je]=o.useState(!1),[k,ve]=o.useState(!1),[de,$e]=o.useState(!1),[Ue,Qe]=o.useState(null),[z,ye]=o.useState(null),[ne,Xe]=o.useState(""),[ue,Ze]=o.useState(null),[Oe,M]=o.useState(null),{enqueueToast:fe}=io(),[pe,E]=o.useState(!1),[Q,oe]=o.useState(""),D=o.useRef(null),Fe=o.useCallback(i=>ro()?bn.URLExt.join(bn.PageConfig.getBaseUrl(),i.oauth2CallbackServerRoute):`${window.location.protocol}//${window.location.hostname}${window.location.port?`:${window.location.port}`:""}${i.oauth2CallbackUIRoute}`,[]),me=o.useMemo(()=>{if(typeof window>"u")return"/";const i=`${window.location.pathname}${window.location.search}${window.location.hash}`;return i.startsWith("/")?i:"/"},[]),Ce=o.useCallback(async i=>{if(!de){M(null),Qe(i.name),$e(!0);try{const g=Cn(),m=new URLSearchParams({provider:i.name,callback_uri:Fe(i)}),R=Z===void 0?void 0:String(Z||"").trim(),y=R===void 0?me&&me!=="/"?me:void 0:R&&R.startsWith("/")&&!R.startsWith("//")?R:void 0;y&&m.set("post_auth_redirect",y);const ze=`${g||""}/api/iam/v1/oauth2/authz/url?${m.toString()}`,j=await fetch(ze),se=await j.json(),_e=se?.autorization_url;if(!j.ok||!_e)throw new Error(se?.message||"Unable to start social sign-in.");window.location.assign(_e)}catch(g){const m=zs(g);M(m),fe(m,{variant:"error"}),Qe(null),$e(!1)}}},[Fe,me,fe,de,Z]);o.useEffect(()=>{pe&&D.current?.focus()},[pe]);const $=o.useCallback(()=>{E(!1),oe("")},[]),gt=o.useCallback(()=>{!Q.trim()||!s||(s(Q.trim()),$())},[Q,s,$]),ht=o.useCallback(()=>{if(H){H();return}window.location.assign(Pe)},[H,Pe]),bt=o.useCallback(()=>{if(q){if(q.startsWith("http://")||q.startsWith("https://")){window.open(q,"_blank","noopener,noreferrer");return}window.location.assign(q)}},[q]),Le=o.useCallback(async()=>{if(!(v||!V||!re||k)){ve(!0),M(null);try{const i=await fetch(L,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({handle:V,password:re})});if(!i.ok)throw new Error(`HTTP ${i.status}`);const g=await i.json();if(g.success&&g.token){const m=String(g?.user?.id||g?.user?.uid||"").trim();if(!!g?.user?.mfaUrl&&m){ye(m),Ze(g.token),M(null);return}n&&n(g.token,V)}else M(g.message||"Invalid username or password.")}catch(i){M(i instanceof Error?i.message:String(i))}finally{ve(!1)}}},[v,V,re,k,L,n]),ge=o.useCallback(async()=>{if(!(v||k||!z||!ne.trim()||!ue)){ve(!0),M(null);try{const i=new URL(L,window.location.origin),g=i.pathname.endsWith("/api/iam/v1/login")?i.href.replace(/\/api\/iam\/v1\/login$/,""):`${i.origin}`,m=await fetch(`${g}/api/iam/v1/users/${z}/mfa/validate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userUid:z,code:ne.trim()})}),R=await m.json();if(!m.ok||!R?.success)throw new Error(R?.message||"Failed to validate your MFA code.");n&&n(ue,V)}catch(i){const g=i instanceof Error?i.message:String(i);M(g),fe(g,{variant:"error"})}finally{ve(!1)}}},[v,fe,V,k,L,ne,ue,z,n]),we=o.useCallback(i=>{i.key==="Enter"&&(z?ge():Le())},[z,Le,ge]),he=de||k||v;return t.jsxs(f,{className:"signin-input-theme-scope",display:"flex",alignItems:ee||te||!I?"flex-start":"center",justifyContent:"center",minHeight:ee||te||!I?"auto":"100vh",bg:ee?"transparent":"canvas.default",color:"fg.default",py:ee?0:te?2:4,children:[t.jsx(_s,{}),t.jsxs(f,{width:"100%",maxWidth:440,p:0,children:[!ee&&t.jsxs(t.Fragment,{children:[t.jsxs(f,{display:"flex",alignItems:"center",gap:2,mb:te?2:3,justifyContent:"center",children:[pt,t.jsx(lt,{sx:{fontSize:3},children:Ye})]}),t.jsx(W,{as:"p",sx:{fontSize:1,color:"fg.muted",mb:te?2:3,textAlign:"center"},children:b})]}),(Ae||Ke)&&t.jsxs(f,{mb:3,textAlign:"center",children:[Ae&&t.jsx(lt,{as:"h3",sx:{fontSize:2,mb:1},children:Ae}),Ke&&t.jsx(W,{sx:{color:"fg.muted",fontSize:1},children:Ke})]}),!z&&(p||K||B)&&t.jsxs(t.Fragment,{children:[p&&t.jsx(G,{block:!0,size:"large",leadingVisual:Ue==="github"?()=>t.jsx(At,{size:"small"}):Os,disabled:he,onClick:()=>Ce(Ot.github),sx:{mt:x,maxWidth:J,mx:"auto"},children:"Sign in with GitHub"}),K&&t.jsx(G,{block:!0,size:"large",leadingVisual:Ue==="google"?()=>t.jsx(At,{size:"small"}):Fs,disabled:he,onClick:()=>Ce(Ot.google),sx:{mt:x,maxWidth:J,mx:"auto"},children:"Sign in with Google"}),B&&t.jsx(G,{block:!0,size:"large",leadingVisual:Ue==="linkedin"?()=>t.jsx(At,{size:"small"}):Ls,disabled:he,onClick:()=>Ce(Ot.linkedin),sx:{mt:x,maxWidth:J,mx:"auto"},children:"Sign in with LinkedIn"})]}),!z&&!qe&&t.jsx(f,{mt:3,display:"flex",justifyContent:"center",children:t.jsx(G,{leadingVisual:Lt,size:"large",block:!0,disabled:v||k||de,onClick:()=>le(!0),sx:{maxWidth:J,mx:"auto"},children:ie})}),!z&&qe&&t.jsxs(f,{mt:4,children:[t.jsxs(ae,{required:!0,sx:{mb:3},children:[t.jsx(ae.Label,{children:"Username"}),t.jsx(ct,{autoFocus:!0,block:!0,placeholder:"Your username",value:V,disabled:k||v,onChange:i=>Se(i.target.value),onKeyDown:we})]}),t.jsxs(ae,{required:!0,sx:{mb:3},children:[t.jsx(ae.Label,{children:"Password"}),t.jsx(ct,{block:!0,placeholder:"Your password",type:ce?"text":"password",value:re,disabled:k||v,onChange:i=>mt(i.target.value),onKeyDown:we,trailingAction:t.jsx(ct.Action,{onClick:()=>Je(!ce),disabled:k||v,icon:ce?$s:Us,"aria-label":ce?"Hide password":"Show password",sx:{color:"var(--fgColor-muted)"}})})]}),t.jsxs(f,{display:"flex",alignItems:"center",justifyContent:"space-between",mt:3,children:[t.jsx(G,{variant:"primary",disabled:k||v||!V||!re,onClick:Le,children:k?"Signing in…":"Sign In"}),ft&&t.jsx(lo,{as:"button",sx:{fontSize:1,cursor:v?"not-allowed":"pointer",background:"none",border:"none",opacity:v?.6:1},onClick:()=>{v||k||bt()},children:Me})]})]}),z&&t.jsxs(t.Fragment,{children:[t.jsxs(ae,{required:!0,sx:{mb:3,mt:2},children:[t.jsx(ae.Label,{children:"MFA Code"}),t.jsx(ct,{autoFocus:!0,block:!0,placeholder:"Your MFA code",value:ne,disabled:k||v,onChange:i=>Xe(i.target.value),onKeyDown:we})]}),t.jsx(G,{variant:"primary",block:!0,disabled:k||v||!ne.trim(),onClick:ge,sx:{maxWidth:J,mx:"auto"},children:k?"Validating…":"Validate MFA Code"})]}),Oe&&t.jsx(W,{sx:{color:"danger.fg",fontSize:1,mt:3,display:"block"},children:Oe}),F&&t.jsxs(f,{mt:4,pt:4,textAlign:"center",borderTop:"1px solid",borderColor:"border.muted",children:[t.jsx(lt,{as:"h3",sx:{fontSize:2,mb:2},children:Nt}),t.jsx(W,{as:"p",sx:{color:"fg.muted",fontSize:1,mb:3},children:Y}),t.jsx(f,{display:"flex",justifyContent:"center",children:t.jsx(G,{variant:"primary",size:"large",leadingVisual:co,disabled:v||k,onClick:ht,children:ut})})]}),Ge&&s&&t.jsxs(t.Fragment,{children:[t.jsxs(f,{display:"flex",alignItems:"center",gap:2,my:3,children:[t.jsx(f,{flex:1,height:"1px",bg:"border.default"}),t.jsx(W,{sx:{fontSize:0,color:"fg.muted"},children:"or"}),t.jsx(f,{flex:1,height:"1px",bg:"border.default"})]}),t.jsx(G,{block:!0,leadingVisual:Lt,disabled:v||k||de,onClick:()=>E(!0),sx:{maxWidth:J,mx:"auto"},children:"Sign in with an API Key"}),pe&&t.jsx(f,{role:"dialog","aria-modal":"true","aria-labelledby":"signin-api-key-title",onKeyDown:i=>{i.key==="Escape"&&$()},onClick:$,position:"fixed",inset:0,zIndex:200,p:3,bg:"canvas.backdrop",display:"flex",alignItems:"center",justifyContent:"center",children:t.jsxs(f,{as:"form",onClick:i=>i.stopPropagation(),onSubmit:i=>{i.preventDefault(),gt()},width:"min(560px, 100%)",p:3,borderRadius:2,border:"1px solid",borderColor:"border.default",bg:"canvas.overlay",color:"fg.default",boxShadow:"shadow.large",children:[t.jsx(lt,{id:"signin-api-key-title",sx:{fontSize:2,mb:2},children:"Enter your API Key"}),t.jsxs(ae,{required:!0,children:[t.jsx(ae.Label,{children:"API Key"}),t.jsx(uo,{block:!0,required:!0,autoFocus:!0,placeholder:"Paste your API key here",value:Q,onInput:i=>oe(i.currentTarget.value),ref:D})]}),t.jsxs(f,{mt:3,display:"flex",justifyContent:"flex-end",gap:2,children:[t.jsx(G,{type:"button",onClick:$,children:"Cancel"}),t.jsx(G,{type:"submit",variant:"primary",disabled:!Q.trim(),children:"Authenticate"})]})]})})]})]})]})};function Bs(n){const{agentId:s,instructions:c,model:a,frontendTools:d,inference:b,subagents:S,sharing:C,onSubagentEvent:p,modeEffect:K}=n;return{type:"browser-vercel-ai",endpoint:"",agentId:s,enableConfigQuery:!1,options:{instructions:c,model:a,frontendTools:d,inference:b,subagents:S,sharing:C,onSubagentEvent:p,modeEffect:K}}}const wn=mo((n,s)=>({pending:void 0,suggest:(c,a)=>{const d=c.trim();d&&n({pending:{text:d,submit:a?.submit??!1,nonce:(s().pending?.nonce??0)+1}})},consume:()=>n({pending:void 0})}));function Hs({agentName:n,sandboxStillRuns:s=!1,temporary:c=!0,onSignedIn:a,onSignUp:d}){const{configuration:b}=Tn(),S=o.useCallback(C=>{go.getState().checkIAMToken(C),a?.()},[a]);return t.jsx(f,{height:"100%",minHeight:0,overflowY:"auto",bg:"canvas.default",px:4,py:4,children:t.jsxs(f,{maxWidth:440,mx:"auto",children:[t.jsxs(f,{display:"flex",alignItems:"center",justifyContent:"center",gap:2,color:"attention.fg",mb:2,children:[t.jsx(Lt,{size:20}),t.jsx(W,{sx:{fontSize:2,fontWeight:"semibold",color:"fg.default"},children:c?"This demo runs on a shared key":"Your key has expired"})]}),t.jsxs(W,{as:"p",sx:{fontSize:1,color:"fg.muted",textAlign:"center",mb:3},children:[c?`${n??"The agent"} has used the time this key allows. Sign in to point your own agent at it, use your own data, and drop the time limit.`:`${n??"The agent"} stopped because your session ran out.`,s?" Your notebook is still running in this page.":""]}),t.jsx(Ns,{hideHero:!0,fillHeight:!1,calloutTitle:"Sign in to keep going",github:!0,google:!0,linkedin:!0,socialSignInNavigationTarget:typeof window>"u"?void 0:`${window.location.pathname}${window.location.search}`,loginUrl:b?.iamUrl?`${b.iamUrl}/api/iam/v1/login`:void 0,onSignIn:S,onSignUp:d})]})})}const Ws="https://r1.datalayer.run";function Vs(n=!0){const{configuration:s}=Tn(),c=zt(C=>C.token),a=s?.aiInferenceUrl||Ws,d=ho(a,n&&!c),b=c||d.token,S=o.useMemo(()=>({inferenceUrl:a,token:b||void 0}),[a,b]);return{inference:S,needsSignIn:bo(S),anonymous:d,inferenceUrl:a}}const Ds={name:"general-purpose",description:"A capable generalist for a task none of the specialists covers: research, reasoning, drafting, checking.",instructions:"You are a capable general-purpose assistant. Carry out the task you are given completely and report the result plainly, saying what you could not do."};function kn(n){const s=n?.subagents;if(!s)return[];const c=(s.subagents??[]).map(a=>{const d=a.ref?xo(a.ref):void 0;return{name:a.name,description:a.description||d?.description||a.name,instructions:a.instructions??d?.systemPrompt,model:a.model??d?.model??s.defaultModel,icon:d?.icon}});return s.includeGeneralPurpose?[...c,Ds]:c}function Gs(n){return n.replace(/^datalayer_/,"").replace(/_lexical$/,"")}function Ks(n){const s=Gs(n);return/^executeCodeIn(Notebook|Document)$/.test(s)||/^(read|list)[A-Z]/.test(s)}function Ys(n,s){return n.filter(c=>s?.has(c.name)||Ks(c.name))}function qs(n,s){const c=a=>s&&a.value.id===`${s}-tools`?0:a.value.id==="notebook-tools"?1:2;return n.map((a,d)=>({entry:a,index:d,rank:c(a)})).sort((a,d)=>a.rank-d.rank||a.index-d.index).map(a=>a.entry)}function Js(n,s,c){if(!c||!n.endsWith("-tools"))return!1;const a=n.slice(0,-6);return s.has(a)&&a!==c}const Qs={type:"object",properties:{}};function Xs(n,s){const c=new Set(n.toolset);return n.commands.filter(a=>c.has(a.name)).map(a=>({name:a.name,description:a.description,parameters:a.parameters??Qs,location:"frontend",handler:async d=>{if(!s)throw new Error(`${a.name}: the ${n.plugin??n.id} plugin is not mounted on this page.`);const b=Object.keys(d??{}).length>0?d:void 0,S=await s.executeCommand(a.command,b);return S===void 0?{ok:!0,command:a.command,argument:b}:S}}))}function An(n,s){return n.flatMap(c=>Xs(c,s))}function Zs(){const n=So(),s=Rn();return o.useMemo(()=>An(s,n),[s,n])}const jn={opening:"Opening your conversation…",notOpened:n=>`Your conversation could not be opened, so this is a new one: ${n}`};function ea(n){let s;for(const c of n.split(/\r?\n\r?\n/)){const a=c.split(/\r?\n/).filter(d=>d.startsWith("data:")).map(d=>d.slice(5).trim()).join("");if(a)try{const d=JSON.parse(a);d.type==="MESSAGES_SNAPSHOT"&&Array.isArray(d.messages)&&(s=d.messages)}catch{}}return s}async function En(n){try{const s=await n.json();if(typeof s.detail=="string"&&s.detail)return s.detail}catch{}return`${n.status}`}async function ta({agentBaseUrl:n,agentId:s,uid:c,token:a,fetcher:d=fetch}){const b=`${n.replace(/\/+$/,"")}/api/v1/apps/sessions/${encodeURIComponent(c)}`,S=a?{Authorization:`Bearer ${a}`}:{},C=await d(`${b}/messages`,{headers:S});if(C.ok){const B=await C.json();return xn(B.messages)}if(C.status!==404)throw new Error(await En(C));const p=await d(`${b}/resume`,{method:"POST",headers:{"Content-Type":"application/json",...S},body:JSON.stringify({agent:s})});if(!p.ok)throw new Error(await En(p));const K=ea(await p.text());if(!K)throw new Error(`The runtime said nothing of session ${c}.`);return xn(K)}const na="var(--theme-accent)";function Pn({face:n,size:s}){return typeof n=="string"?t.jsx(vo,{emoji:n,size:s,label:""}):t.jsx(t.Fragment,{children:n})}function oa({face:n,size:s,state:c}){const a=c==="thinking"||c==="working",d=c==="paused";return t.jsxs(f,{as:"span","aria-hidden":!0,"data-presence":c,position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:s+8,height:s+8,flexShrink:0,fontSize:s,lineHeight:1,children:[t.jsx(f,{as:"span",position:"absolute",inset:0,borderRadius:"50%",boxShadow:d?"none":`0 0 0 2px ${na}`,border:d?"2px dashed":"none",borderColor:"border.default",opacity:a||c==="waiting"||d?.9:0,transition:"opacity var(--theme-motion-status, 0ms) var(--theme-motion-easing, ease)",animation:a?"loopPresenceBreath 1.8s ease-in-out infinite":"none",reducedMotion:{animation:"none"},sx:{"@keyframes loopPresenceBreath":{"0%, 100%":{transform:"scale(0.92)",opacity:.35},"50%":{transform:"scale(1.06)",opacity:.9}}}}),t.jsx(f,{as:"span",display:"inline-flex",opacity:d?.55:1,filter:d?"grayscale(0.6)":"none",transition:"opacity var(--theme-motion-status, 0ms) var(--theme-motion-easing, ease)",children:t.jsx(Pn,{face:n,size:s})})]})}function sa({state:n}){return t.jsx(W,{role:"status","aria-live":"polite","data-presence-line":n,sx:{fontSize:0,color:n==="waiting"?"fg.default":"fg.muted",fontWeight:n==="waiting"?"semibold":"normal",whiteSpace:"nowrap",flexShrink:0},children:yo[n]})}const aa=_t(void 0),ia=_t(""),ra=_t({}),X="",la=1400,In=parseInt(As["--loop-face-large"],10);function pa({workspace:n}){const s=Co(),c=wo(),a=o.useRef(null),{setViewControls:d}=n,[b,S]=o.useState(null),C=ko(),p=C.getConfig(jo),K=p?.placeholder||s.placeholder,B=p?.defaultSurface??"notebook",Ge=C.getConfig(Eo),[F,Z]=o.useState(X),v=o.useRef(!1),I=N(Io),ee=N(To),Ae=N(Ro),ie=N(Ao)[0]?.value,Y=Pt(ie?.promptStance??aa)??ie?.prompt,ut=N(Po),Pe=Mo(ut[0]?.value),H=o.useRef(Pe);H.current=Pe;const q=o.useRef(""),Me=N($o),ft=o.useMemo(()=>Uo(()=>Me.reduce((e,r)=>({...e,...r.value.extras.value}),{})),[Me]),x=Pt(Me.length>0?ft:ra),J=o.useRef(new Set),te=Oo(Ts,n),Ye=!te.allowed,pt=Ye?te.reason??"Chat is unavailable for this sandbox":void 0,[L,V]=o.useState(!1),[Se,re]=o.useState(!1),[mt,qe]=o.useState({open:!1,pendingApproval:!1}),le=Fo(L,mt,p?.presence?.paused===!0),ce=p?.presence?.onPresence;o.useEffect(()=>{ce?.(le),H.current?.setPresence(le)},[ce,le]);const Je=o.useRef(p?.presence?.onSaying);Je.current=p?.presence?.onSaying;const k=o.useRef({answering:!1}),ve=o.useCallback(e=>{a.current=e,re(!!e)},[]),de=o.useCallback(e=>{const{open:r,pendingApproval:l}=Lo(e);qe(xe=>xe.open===r&&xe.pendingApproval===l?xe:{open:r,pendingApproval:l});const h={saying:_o(e),answering:zo(e)},u=k.current;(u.saying?.id!==h.saying?.id||u.saying?.text!==h.saying?.text||u.answering!==h.answering)&&(k.current=h,Je.current?.(h));const O=H.current;if(!O)return;O.items(e);const P=new Set(["complete","completed","done","error","failed","cancelled","canceled","rejected","denied","stopped"]),A={insertcell:"adding a cell",updatecell:"editing a cell",runcell:"running a cell",deletecells:"removing cells",readallcells:"reading the notebook",readcell:"reading a cell",executecode:"running code",insertblock:"adding a block",updateblock:"editing a block",runblock:"running a block",readdocument:"reading the document"};let w;for(let xe=e.length-1;xe>=0;xe-=1){const rt=e[xe];if(typeof rt.toolName=="string"&&rt.toolCallId){P.has(String(rt.status).toLowerCase())||(w=rt);break}}if(!w){O.activity(void 0);return}const Rt=w.toolName.toLowerCase().replace(/^datalayer_/,"").replace(/_lexical$/,"").replace(/[^a-z]/g,""),so=A[Rt]??`using ${w.toolName}`;O.activity(`${q.current||"The agent"} is ${so}…`)},[]),$e=o.useRef(x);$e.current=x;const Ue=o.useCallback(e=>{Bn(e),H.current?.usage(e),$e.current.onUsage?.(e)},[]),Qe=o.useCallback(e=>{V(e),e||H.current?.end("done")},[]),z=o.useCallback(e=>{const r=H.current;if(!r)return;let l=-1;for(let u=e.length-1;u>=0;u-=1)if(e[u].role==="user"){l=u;break}const h=e.slice(l+1).filter(u=>u.role==="assistant").map(No).filter(u=>u.trim().length>0).join(`
|
|
29
|
+
|
|
30
|
+
`);r.assistant(h)},[]),ye=o.useRef([]),ne=o.useRef(!1),Xe=o.useRef(void 0),ue=o.useRef(void 0),Ze=N(Bo),Oe=o.useRef(Ze);Oe.current=Ze;const M=o.useCallback((e,r)=>{if(ue.current)return ue.current;const l=Ho(Oe.current.map(O=>O.value),r),h=l?.loop;if(ne.current&&h?.files&&h.files.length>0){const O=Xe.current;if(!O)return"A file is given to an application running on a runtime: run it on Datalayer or on your machine to give it one.";let P;try{P=h.files.map(A=>({file:Vo(String(A.name??"")),base64:Wo(String(A.data_url??""))}))}catch(A){return A instanceof Error?A.message:String(A)}O.execute(Do(P)).then(A=>{if(!A.success){S(`The files could not be put in the sandbox: ${A.error??"it failed"}.`);return}M(`${e}
|
|
31
|
+
|
|
32
|
+
${Go(P.map(w=>w.file))}`,{...l,loop:Object.fromEntries(Object.entries(h).filter(([w])=>w!=="files"))})});return}H.current?.begin(e,a.current?.thread());const u=a.current?.send;if(!u){ye.current.push([e,l]);return}u(e,l)},[]);o.useEffect(()=>{d(Se?{busy:L,stop:a.current?.stop,newChat:a.current?.newChat,send:M}:null)},[L,Se,d,M]),o.useEffect(()=>()=>d(null),[d]),o.useEffect(()=>n.prompts.subscribe(M),[n.prompts,M]),o.useEffect(()=>{if(!Se||ye.current.length===0)return;const e=ye.current.splice(0,ye.current.length);for(const[r,l]of e)a.current?.send(r,l)},[Se]);const fe=o.useRef(!1),pe=o.useCallback(async e=>{fe.current||(fe.current=!0,Ge?.firstPromptHook?.()),S(null);const r=await n.submit(e);if(!r.handled){S(r.reason??null);return}Et(""),r.result?.content&&S(r.result.content)},[n,Ge?.firstPromptHook]),E=o.useMemo(()=>I.find(e=>e.value.surfaceId===F)?.value,[I,F]),Q=o.useCallback(e=>{v.current=!0,Z(e)},[]);o.useEffect(()=>Ko(Q),[Q]),o.useEffect(()=>{Yo(I.map(e=>e.value.surfaceId))},[I]),o.useEffect(()=>{qo(F&&F!==X?F:Ps)},[F]);const oe=o.useMemo(()=>B===X||B==="none"?void 0:I.find(e=>e.value.surfaceId===B),[I,B]);o.useEffect(()=>{v.current||!oe||De(oe.value,n)&&Z(B)},[oe,n,B]);const[D,Fe]=o.useState(null),me=o.useRef(null),Ce=p?.fullScreenTopOffset??0,{fullScreen:$,usingApi:gt,toggle:ht,topOffsetPx:bt}=Jo(me,{forceOverlay:!!Ce,topOffset:Ce}),[Le,ge]=o.useState(!1),we=o.useRef(!1);o.useEffect(()=>{!L||we.current||$||(we.current=!0,ge(!0))},[L,$]),o.useEffect(()=>{$&&ge(!1)},[$]),o.useEffect(()=>{E&&!De(E,n)&&(Fe(E.surfaceId),Z(X))},[E,n]);const he=o.useMemo(()=>{if(D)return I.find(e=>e.value.surfaceId===D)?.value;if(!v.current&&F===X)return oe?.value},[I,D,F,oe]);o.useEffect(()=>{if(!D||F!==X)return;const e=I.find(r=>r.value.surfaceId===D);e&&De(e.value,n)&&(Fe(null),Z(D))},[I,F,D,n]);const i=n.agentId?.trim()||"default",g=Qo(n.sandbox.target??"local");ne.current=g;const m=Xo(),R=Pt(m?.selected??ia),y=m?.members.find(e=>e.id===R),xt=N(Zo)[0]?.value,ze=xt?.specId,j=Sn(y?.specId??i)??(ze?Sn(ze):void 0),se=y?void 0:xt,_e=g&&!y?Is(ze,j):void 0;q.current=y?.name??j?.name??i;const Bt=N(es),Ht=x.hiddenOpeners,Wt=x.hideOpeners,St=x.openers,vt=o.useMemo(()=>{if(Wt)return[];const e=new Set(Ht??[]),r=w=>e.size===0?w:w.filter(Rt=>!e.has(Rt.text));if(St)return r(St);const l=Bt.flatMap(w=>w.value.suggestions);if(l.length>0)return r(l);const h=r(j?.suggestions??[]),u=r(m?.team.suggestions??[]);if(u.length===0)return h;const O=new Set(u.map(w=>w.text)),P=m?.team.name??"Team",A=y?.name??j?.name??i;return[...u.map(w=>({...w,group:P})),...h.filter(w=>!O.has(w.text)).map(w=>({...w,group:A}))]},[Bt,m,j,y,i,Ht,Wt,St]),et=o.useMemo(()=>vt.map(e=>({title:e.summary??e.text,message:e.message??e.text,group:e.group})),[vt]),yt=Te(j?.icon),_=p?.presence,Mn=Te(m?.team.icon),Vt=N(ts),tt=o.useMemo(()=>{const e=[],r=new Map,l=new Set,h=new Set(I.map(u=>u.value.surfaceId));for(const u of qs(Vt,E?.surfaceId)){if(Js(u.value.id,h,E?.surfaceId))continue;let O;try{O=u.value.tools(n)}catch(P){console.warn(`[loop] frontend tools from '${u.plugin}' failed:`,P);continue}for(const P of O){const A=r.get(P.name);if(A){console.warn(`[loop] frontend tool '${P.name}' from '${u.plugin}' is shadowed by the one from '${A}'.`);continue}r.set(P.name,u.plugin),e.push(P),u.value.chatView&&l.add(P.name)}}for(const u of x.frontendTools??[])r.has(u.name)||(r.set(u.name,"chat-extras"),e.push(u),l.add(u.name));return E?e:Ys(e,l)},[Vt,n.surfaceId,n.agentId,x.frontendTools,E?.surfaceId,I]),Ct=Zs(),Ne=o.useMemo(()=>{if(Ct.length===0)return tt;const e=new Set(tt.map(r=>r.name));return[...tt,...Ct.filter(r=>!e.has(r.name))]},[tt,Ct]),Dt=Rn(),wt=x.agentToolBundles,$n=o.useMemo(()=>{const e=x.frontendTools??[];if(!wt?.length)return x.frontendTools;const r=An(Dt.filter(h=>wt.includes(h.id)),C),l=new Set(e.map(h=>h.name));return[...e,...r.filter(h=>!l.has(h.name))]},[x.frontendTools,wt,Dt,C]);Xe.current=g&&Ne.some(e=>e.name===ns)?C.getOutput(dt)?.sandbox:void 0;const T=os(n.sandbox,n.serverUrl),Gt=N(ss),Un=o.useMemo(()=>Gt.filter(e=>e.value.composer).map(e=>({name:e.value.name,description:e.value.description})),[Gt]),On=o.useMemo(()=>{if(!m||!y)return kn(j).map(l=>({name:l.name,description:l.description,icon:Te(l.icon)}));const e=m.members.map(l=>({name:l.name,description:l.description,emoji:l.emoji,icon:Te(l.icon),disabled:l.id===y.id,disabledReason:l.id===y.id?`You are already talking to ${l.name}`:void 0})),r=vn(m.team,y.id).filter(l=>!m.members.some(h=>h.name===l.name)).map(l=>({name:l.name,description:l.description,icon:Te(l.icon)}));return[...e,...r]},[m,y,j]),{inference:Kt,anonymous:Fn}=Vs(g),Ln=zt(e=>e.user),kt=g&&Fn.status==="expired",Yt=!Ln,Be=as();ue.current=Be.disabled?Be.disableReason||"This conversation is closed here.":void 0;const jt=T===void 0?is(n.sandbox,s):void 0,nt=Ye||kt||!!_e||!!jt||Be.disabled,qt=kt?Yt?s.demoKeyExpired:s.keyExpired:_e??jt??pt??(Be.disabled?Be.disableReason:void 0),[Jt,Et]=o.useState(""),[zn,Qt]=o.useState(),ot=zn??se?.model??j?.model??n.model??"",ke=rs(),Xt=o.useRef(ke),Zt=o.useRef(R),en=o.useRef(ke);en.current=ke,o.useEffect(()=>{Zt.current!==R&&(Zt.current=R,Xt.current=en.current,Qt(void 0))},[R]);const _n=ke&&ke!==Xt.current?ke:null,[Nn,Bn]=o.useState(),Hn=_n??Nn??null,Wn=Mt(Re.inpromptMenu),Vn=Mt(Re.promptAction),Dn=Mt(Re.chatHeader),Gn=o.useMemo(()=>m?.members.map(e=>({id:e.id,name:e.name,description:e.description,icon:Te(e.icon)}))??[],[m]),be=wn(e=>e.pending),[tn,Kn]=o.useState(0);o.useEffect(()=>ls(()=>Kn(e=>e+1)),[]),o.useEffect(()=>{be&&(Et(be.text),wn.getState().consume(),be.submit&&pe(be.text))},[be]);const je=!!(se?.createPayload?.app_spec||C.getConfig(dt)?.datalayerCreatePayload?.app_spec),Yn=zt(e=>e.token),nn=C.getConfig(dt)?.datalayerVisitors,qn=cs(nn),Jn=C.getConfig(dt)?.embedToken,He=nn?qn.token:Jn||Yn,U=p?.thread,[Ee,on]=o.useState(null),Qn=!!(U?.fromRuntime&&Ee?.given!==U.id);o.useEffect(()=>{if(!U?.fromRuntime||!je||!T)return;let e=!0;return(async()=>{let r="";for(let l=0;l<4&&e;l+=1)try{const h=await ta({agentBaseUrl:T,agentId:i,uid:U.id,token:He});e&&on({given:U.id,thread:{...U,fromRuntime:!1,messages:h}});return}catch(h){r=h instanceof Error?h.message:String(h),await new Promise(u=>setTimeout(u,1500))}e&&on({given:U.id,thread:{id:ds(),messages:[],onStarted:U.onStarted},said:jn.notOpened(r)})})(),()=>{e=!1}},[U?.id,U?.fromRuntime,je,T,i,He]);const sn=U?.fromRuntime?Ee?.given===U.id?Ee.thread:void 0:U,It=o.useMemo(()=>g?Bs({agentId:y?.specId??i,instructions:us(j,se?.instructions),model:ot||void 0,inference:Kt,frontendTools:Ne,subagents:m&&y?vn(m.team,y.id):kn(j),sharing:m?.sharing,onSubagentEvent:e=>Rs.getState().appendSubagentEvent(e),modeEffect:se?.modeEffect}):T!==void 0?{type:"ag-ui",endpoint:je?`${T}/api/v1/apps/agents/${encodeURIComponent(i)}/ag-ui/`:`${T}/api/v1/ag-ui/${i}/`,...je&&He?{authToken:He}:{},...je?{uiSocket:`${T.replace(/^http/,"ws")}/api/v1/apps/ui`,uiFiles:`${T}/api/v1/apps/agents/${encodeURIComponent(i)}/files`}:{},agentId:i,configEndpoint:`${T}/api/v1/configure`,enableConfigQuery:!0}:void 0,[i,g,Kt,y,Ne,m,j,se,ot,T,je,He]),st=fs(!g,It?.type==="ag-ui"?It.configEndpoint:void 0,void 0,i),We=ps(),at=ms(i),[an,rn]=o.useState(void 0),[Xn,Zn]=o.useState(void 0);o.useEffect(()=>{if(g||T===void 0)return;let e=!1;return fetch(`${T}/api/v1/configure/models?agent_id=${encodeURIComponent(i)}`).then(r=>r.ok?r.json():null).then(r=>{e||(rn(r?gs(r):[]),Zn(r?hs(r):void 0))}).catch(()=>{e||rn([])}),()=>{e=!0}},[T,i,g]);const eo=o.useMemo(()=>bs(an,()=>Object.values(xs).filter(e=>e.available&&Ss(e)).map(e=>({id:e.id,name:e.name,provider:e.provider}))),[an]),ln=o.useMemo(()=>{const e=st.data?.builtinTools??[],r=new Set(e.map(l=>l.name));return{runtime:e,frontend:Ne.filter(l=>!r.has(l.name)).map(l=>({id:l.name,name:l.name}))}},[st.data?.builtinTools,Ne]),cn=o.useMemo(()=>new Set((We.data?.skills??[]).filter(e=>e.status==="enabled"||e.status==="loaded").map(e=>e.id)),[We.data]),to=o.useCallback(async e=>{Qt(e),!(g||T===void 0)&&await fetch(`${T}/api/v1/configure/inference/provider`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({model:e})}).catch(()=>{})},[T,g]),dn=p?.promptPlacement==="bottom-chat",no=p?.promptPlacement==="floating",Ie=p?.promptPlacement==="top",Ve=p?.hidePrompt===!0||x.hidePrompt===!0,oo={onSend:()=>{pe(Jt)},input:Jt,setInput:Et,focusTrigger:be||tn?(be?.nonce??0)+tn:void 0,placement:no||Y==="floating"||Y==="floating-top"||Y==="floating-bottom"?"floating":"docked",floatingAnchor:Y==="floating-top"?"top":"bottom",isLoading:L,onStop:()=>n.viewControls.stop?.(),placeholder:qt??K,typingSuggestions:vt.map(e=>e.text),suggestions:et,disableInputPrompt:nt,connectionConfirmed:!nt,padding:Ie||Y==="floating-top"||Y==="floating-bottom"||Y==="docked-top"?2:3,promptVariant:"lexical",autoFocus:p?.autoFocusPrompt??!0,mentionableAgents:On,promptCommands:Un,headerContent:Wn.length>0?t.jsx($t,{slot:Re.inpromptMenu,props:{workspace:n}}):void 0,footerExtras:Vn.length>0?t.jsx($t,{slot:Re.promptAction,props:{workspace:n}}):void 0,showAgentsMenu:!_,showInlineAgentsMenu:!1,agents:Gn,selectedAgentId:R,onSelectAgent:e=>m?.select(e),showTokenUsage:x.showTokenUsage??p?.showTokenUsage??!0,showContextRing:!0,agentUsage:Hn??void 0,showModelSelector:!_,models:eo,decisions:Xn,selectedModel:ot,onModelSelect:e=>{to(e)},showToolsMenu:!_,availableTools:ln.runtime,availableFrontendTools:ln.frontend,mcpServers:st.data?.mcpServers??[],mcpStatusData:x.mcpStatusData??void 0,showSkillsMenu:!_,skills:We.data?.skills??[],skillsLoading:We.isLoading,enabledSkills:cn,onToggleSkill:e=>cn.has(e)?at.disableSkill(e):at.enableSkill(e),onToggleAllSkills:(e,r)=>e.forEach(l=>r?at.enableSkill(l):at.disableSkill(l)),codemodeEnabled:x.codemodeEnabled??!1,onToggleCodemode:x.onToggleCodemode,isA2AProtocol:!1,hasConfigData:!!st.data,hasSkillsData:!!We.data},un=ee[0]?.value.Component,Tt=Ae[0]?.value.Component,it=un?t.jsx(un,{workspace:n,composer:oo}):null,fn=I.length>0&&p?.showSurfaceSelector!==!1?t.jsx(ca,{surfaces:I.map(e=>e.value),active:E?.surfaceId??he?.surfaceId??X,onChange:Q,workspace:n}):null,pn=t.jsxs(t.Fragment,{children:[I.map(e=>{const r=e.value,l=E?.surfaceId===r.surfaceId;return l||J.current.has(r.surfaceId)||De(r,n)?(J.current.add(r.surfaceId),t.jsx(f,{sx:l?{flex:"1 1 0",minWidth:0,minHeight:0}:{position:"absolute",inset:0,visibility:"hidden",pointerEvents:"none",zIndex:-1},children:t.jsx(vs,{load:r.load,props:{surfaceId:r.surfaceId,workspace:n},fallback:t.jsxs(Ft,{children:["Loading ",r.title,"…"]}),errorFallback:u=>t.jsxs(Ft,{children:[r.title," failed to load: ",u.message]})})},r.surfaceId)):null}),!E&&he?t.jsx(f,{flex:"1 1 0",minWidth:0,minHeight:0,children:t.jsxs(Ft,{children:["Starting ",he.title,"…"]})}):null]}),mn=t.jsx(t.Fragment,{children:t.jsxs(f,{flex:Ie&&E?"0 0 34%":"1 1 0",maxWidth:Ie&&E?460:void 0,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",borderLeft:E?"1px solid":void 0,borderColor:"border.default",position:"relative",children:[x.errorBanner?t.jsx(f,{flexShrink:0,px:3,py:2,fontSize:1,borderBottom:"1px solid",bg:x.errorBanner.variant==="warning"?"attention.subtle":"danger.subtle",color:x.errorBanner.variant==="warning"?"attention.fg":"danger.fg",borderColor:x.errorBanner.variant==="warning"?"attention.muted":"danger.muted",children:x.errorBanner.message}):null,Ee?.said&&Ee.given===U?.id?t.jsx(W,{as:"p",role:"status",sx:{m:0,px:3,py:2,fontSize:1,color:"fg.muted"},children:Ee.said}):null,t.jsx(f,{flex:"1 1 auto",minHeight:0,display:"flex",children:Qn?t.jsx(W,{as:"p",role:"status",sx:{m:0,p:3,fontSize:1,color:"fg.muted"},children:jn.opening}):t.jsx(ys,{themeVariant:p?.themeVariant,themeOverrides:p?.themeOverrides,colorMode:p?.colorMode,thread:sn,disabled:nt,disableReason:qt,protocol:It,frontendTools:g?void 0:$n,initialModel:ot||void 0,title:_?.name??y?.name??j?.name??i,description:_?.welcome??j?.description,brandIcon:_?.face?t.jsx(oa,{face:_.face,size:20,state:le}):t.jsx(yt,{size:20}),headerContent:_&&!jt?t.jsx(sa,{state:le}):void 0,emptyState:{icon:_?.face?t.jsx("span",{"aria-hidden":!0,style:{fontSize:In,lineHeight:1},children:t.jsx(Pn,{face:_.face,size:In})}):t.jsx(yt,{size:48}),title:_?.name??y?.name??j?.name??i,...m&&y?{sections:[{group:m.team.name,icon:t.jsx(Mn,{size:48}),title:m.team.name,subtitle:m.team.description},{group:y.name,icon:t.jsx(yt,{size:32}),title:y.name,subtitle:j?.description}]}:null},suggestions:Ie||ie||p?.suggestionLabels===!1?[]:et,showHeader:!p?.hideHeader&&!!Tt,headerButtons:{showNewChat:p?.headerButtons?.newChat??!1,showClear:p?.headerButtons?.clear??!1},renderHeader:Tt?e=>t.jsx(Tt,{workspace:n,header:e}):void 0,showInformation:!0,headerActions:t.jsxs(f,{display:"inline-flex",alignItems:"center",gap:2,children:[n.chatHeaderActions,Dn.length>0?t.jsx($t,{slot:Re.chatHeader,props:{workspace:n}}):null,t.jsx(Cs,{icon:$?ws:ks,"aria-label":$?"Exit full screen":"Enter full screen",variant:"invisible",size:"small",onClick:()=>{ge(!1),ht()},sx:Le?{"@keyframes dla-fullscreen-hint":{"0%, 100%":{opacity:1},"50%":{opacity:.4}},"&&":{bg:`color-mix(in srgb, ${c.primary} 16%, transparent)`,boxShadow:`inset 0 0 0 1.5px ${c.primary}`,animation:`dla-fullscreen-hint ${la}ms ease-in-out infinite`},"@media (prefers-reduced-motion: reduce)":{"&&":{animation:"none"}}}:void 0})]}),showInput:!1,onSendReady:ve,notebookToolSurfacesId:E?void 0:n.surfaceId,showTurnFooter:x.showTokenUsage??p?.showTokenUsage??!0,onContextSnapshot:Ue,onLoadingChange:Qe,onItemsChange:z,onDisplayItemsChange:de,enableStreaming:!0},sn?.id)}),dn&&!Ve?it:null]})}),gn=p?.suggestionLabels!==!1&&et.length>0?t.jsx(f,{"aria-label":s.suggestedPrompts,display:"flex",flexWrap:"wrap",gap:2,px:2,pb:"6px",children:et.map(e=>t.jsx(f,{as:"button",type:"button",title:e.message,disabled:L||nt,onClick:()=>{pe(e.message)},appearance:"none",font:"inherit",fontSize:0,fontWeight:"semibold",lineHeight:1.25,px:"10px",py:"5px",width:yn,flex:`0 0 ${yn}px`,borderRadius:"999px",border:"1px solid",bg:"canvas.subtle",whiteSpace:"nowrap",sx:{borderColor:"border.default",color:"fg.default",cursor:"pointer","&:hover:not(:disabled)":{borderColor:"accent.fg",color:"accent.fg"},"&:disabled":{opacity:.5,cursor:"default"}},children:t.jsx(js,{title:e.title,maxWidth:"100%",sx:{minWidth:0},children:e.title})},e.title))}):null,hn=b?t.jsx(f,{flex:"0 0 auto",px:3,py:2,borderTop:"1px solid",borderColor:"border.default",bg:"canvas.subtle",fontSize:1,maxHeight:"40%",overflowY:"auto",children:b}):null;return t.jsxs(f,{ref:me,sx:{height:"100%",minHeight:0,display:"flex",flexDirection:"column",position:"relative",...$?{bg:"canvas.default"}:null,...$&&!gt.current?{position:"fixed",top:bt,right:0,bottom:0,left:0,height:"auto",zIndex:1e3}:null},children:[ie?t.jsx(ie.Component,{workspace:n,editors:pn,hasEditor:!!E,transcript:mn,prompt:Ve?null:it,chips:Ve?null:gn,picker:fn,transient:hn}):t.jsxs(t.Fragment,{children:[Ie&&!Ve?t.jsxs(f,{flex:"0 0 auto",borderBottom:"1px solid",borderColor:"border.default",children:[it,gn]}):null,fn,t.jsxs(f,{flex:"1 1 auto",minHeight:0,display:"flex",position:"relative",children:[pn,mn]}),hn,dn||Ve||Ie?null:it]}),kt?t.jsx(f,{position:"absolute",inset:0,zIndex:5,bg:"canvas.default",display:"flex",flexDirection:"column",minHeight:0,children:t.jsx(Hs,{agentName:y?.name??j?.name,sandboxStillRuns:g,temporary:Yt,onSignedIn:()=>Es.getState().clear()})}):null]})}function ca({surfaces:n,active:s,onChange:c,workspace:a}){const d=[...n].sort((b,S)=>(b.order??100)-(S.order??100));return t.jsxs(f,{flex:"0 0 auto",display:"flex",alignItems:"center",gap:2,px:3,py:2,borderBottom:"1px solid",borderColor:"border.default",children:[t.jsx(W,{sx:{fontSize:0,color:"fg.muted"},children:"Beside the chat"}),t.jsxs(Ut,{"aria-label":"Editor beside the chat",size:"small",children:[t.jsx(Ut.Button,{selected:s===X,onClick:()=>c(X),children:"Chat"}),d.map(b=>{const S=De(b,a),C=S?void 0:b.unavailableReason?.(a)??"Not available right now";return t.jsx(Ut.Button,{selected:s===b.surfaceId,"aria-disabled":!S,title:C??b.title,leadingIcon:b.icon,onClick:()=>{S&&c(b.surfaceId)},children:b.title},b.surfaceId)})]})]})}function Ft({children:n}){return t.jsx(f,{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"fg.muted",fontSize:1,px:3,textAlign:"center",children:n})}export{pa as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as x,j as e,B as n,T as s,q as i}from"../datalayer-app-main.js";import j from"./index-
|
|
1
|
+
import{r as x,j as e,B as n,T as s,q as i}from"../datalayer-app-main.js";import j from"./index-D0DBuFMt.js";function A({agentUsage:o,padding:y,showContextRing:T=!1}){const[k,h]=x.useState(!1),v=x.useRef(null),c=x.useRef(null),g=!!o.turnUsage,C=!!o.sessionUsage,w=!!o.costUsage&&(o.costUsage.cumulativeCostUsd>0||o.costUsage.lastTurnCostUsd>0),m=o.sessionUsage,p=o.turnUsage,b=o.costUsage,d=t=>t<.01?`$${t.toFixed(4)}`:t<1?`$${t.toFixed(3)}`:`$${t.toFixed(2)}`,f=o.totalTokens,u=o.contextWindow,S=Math.max(0,u-f),a=u>0?f/u*100:0,r=[];if(o.distribution?.children?.length){const t={"System Prompts":"#8250df","Tool Definitions":"#bf8700","User Messages":"#16A085","Assistant Messages":"#1a7f37","Tool Usage":"#cf222e"};for(const l of o.distribution.children)r.push({name:l.name,value:l.value,color:t[l.name]||"#6e7781"})}else{o.systemPromptTokens>0&&r.push({name:"System Prompts",value:o.systemPromptTokens,color:"#8250df"}),o.toolTokens>0&&r.push({name:"Tool Definitions",value:o.toolTokens,color:"#bf8700"});const t=(o.userMessageTokens||0)+(o.assistantMessageTokens||0);t>0&&r.push({name:"Messages",value:t,color:"#16A085"});const l=(o.toolCallTokens||0)+(o.toolReturnTokens||0);l>0&&r.push({name:"Tool Results",value:l,color:"#cf222e"})}const z=a>90?"#cf222e":a>70?"#bf8700":"#16A085",W="var(--bgColor-muted, #f6f8fa)",R="var(--borderColor-default, #d1d9e0)",M={animation:!1,series:[{type:"pie",radius:[0,"90%"],center:["50%","50%"],silent:!0,label:{show:!1},labelLine:{show:!1},data:[{value:f,itemStyle:{color:z}},{value:S,itemStyle:{color:W}}]}]},P={animation:!1,series:[{type:"pie",radius:["45%","80%"],center:["50%","50%"],silent:!0,label:{show:!1},labelLine:{show:!1},itemStyle:{borderColor:"var(--bgColor-default, #ffffff)",borderWidth:1},data:[...r.map(t=>({value:t.value,itemStyle:{color:t.color}})),{value:S,itemStyle:{color:R}}]}]};return e.jsxs(n,{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2,py:1,px:y,bg:"canvas.subtle",flexWrap:"nowrap",overflow:"visible",whiteSpace:"nowrap",minWidth:0,children:[T&&e.jsxs(n,{position:"relative",flexShrink:0,onMouseEnter:()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>h(!0),150)},onMouseLeave:()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>h(!1),250)},children:[e.jsx(n,{ref:v,cursor:"pointer",width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid",borderColor:"border.default",borderRadius:"50%",children:e.jsx(j,{option:M,style:{width:18,height:18},opts:{renderer:"svg"}})}),k&&e.jsxs(n,{position:"absolute",bottom:"100%",left:0,mb:1,p:3,width:260,bg:"canvas.overlay",borderRadius:2,boxShadow:"shadow.large",border:"1px solid",borderColor:"border.default",zIndex:100,children:[e.jsx(s,{sx:{fontWeight:"bold",fontSize:1,color:"fg.default",display:"block",mb:2},children:"Context"}),e.jsxs(s,{sx:{fontSize:0,color:"fg.muted",display:"block",mb:1},children:[e.jsx(s,{as:"span",sx:{fontWeight:"semibold",color:"fg.default"},children:i(f)})," / ",i(u)," tokens"]}),o.costUsage&&e.jsxs(s,{sx:{fontSize:0,color:"fg.muted",display:"block",mb:2},children:["cost ",e.jsx(s,{as:"span",sx:{fontWeight:"semibold",color:"fg.default"},children:d(o.costUsage.lastTurnCostUsd)})," turn · ",e.jsx(s,{as:"span",sx:{fontWeight:"semibold",color:"fg.default"},children:d(o.costUsage.cumulativeCostUsd)})," total"]}),e.jsxs(s,{sx:{fontSize:0,color:a>90?"danger.fg":a>70?"attention.fg":"fg.muted",fontWeight:"semibold",display:"block",mb:2},children:["• ",a.toFixed(0),"%"]}),e.jsx(n,{display:"flex",justifyContent:"center",mb:2,children:e.jsx(j,{option:P,style:{width:80,height:80},opts:{renderer:"svg"}})}),e.jsx(n,{display:"flex",flexDirection:"column",gap:1,children:r.map(t=>{const l=f>0?t.value/f*100:0;return e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(n,{width:8,height:8,borderRadius:"50%",bg:t.color,flexShrink:0}),e.jsx(s,{sx:{fontSize:0,color:"fg.muted",flex:1},children:t.name}),e.jsxs(s,{sx:{fontSize:0,color:"fg.default",fontWeight:"semibold"},children:[l.toFixed(1),"%"]})]},t.name)})}),a>70&&e.jsx(s,{sx:{fontSize:0,color:"attention.fg",display:"block",mt:2,fontStyle:"italic"},children:"Quality may decline as limit nears."})]})]}),e.jsxs(s,{sx:{fontSize:0,color:"fg.muted",flexShrink:0},children:[e.jsx(s,{as:"span",sx:{fontWeight:"semibold",color:"fg.default",fontSize:0},children:i(o.totalTokens)})," / ",i(o.contextWindow)," ctx"]}),w&&e.jsxs(s,{sx:{fontSize:0,color:"fg.muted",flexShrink:0},children:["· cost ",e.jsx(s,{as:"span",sx:{fontWeight:"semibold",color:"fg.default",fontSize:0},children:d(b?.lastTurnCostUsd??0)})," turn / ",e.jsx(s,{as:"span",sx:{fontWeight:"semibold",color:"fg.default",fontSize:0},children:d(b?.cumulativeCostUsd??0)})]}),C&&e.jsxs(s,{sx:{fontSize:0,color:"fg.muted",flexShrink:0},children:["· session ",i(m?.inputTokens??0),e.jsx(s,{as:"span",sx:{color:"success.fg",fontSize:0},children:"▲"})," ",i(m?.outputTokens??0),e.jsx(s,{as:"span",sx:{color:"attention.fg",fontSize:0},children:"▼"})]}),g&&e.jsxs(s,{sx:{fontSize:0,color:"fg.muted",flexShrink:0},children:["· turn ",i(p?.inputTokens??0),e.jsx(s,{as:"span",sx:{color:"success.fg",fontSize:0},children:"▲"})," ",i(p?.outputTokens??0),e.jsx(s,{as:"span",sx:{color:"attention.fg",fontSize:0},children:"▼"})]})]})}export{A as ContextPie};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a_ as N,a$ as U,b0 as C,b1 as I,x as L,b2 as T,r as u,b3 as x,b4 as v,b5 as B}from"../datalayer-app-main.js";function D(d){const n=d?.app_spec;if(!n||typeof n!="object")return;const e=d?.app_instance??{},t=typeof e.app_uid=="string"&&e.app_uid?e.app_uid:void 0,r=typeof e.deployment_uid=="string"&&e.deployment_uid?e.deployment_uid:void 0;return{appSpec:n,...t?{appUid:t}:{},...r?{deploymentUid:r}:{}}}function j(){const n=N().getConfig(U),e=n?.datalayerAgentSpecId??C,t=n?.datalayerCreatePayload,r=n?.datalayerVisitors,E=n?.datalayerKept,i=r?.url??E?.url,a=I(),s=L(a?.target??T)==="datalayer",c=t?.app_spec?.id,[p,l]=u.useState({});u.useEffect(()=>{if(l({}),!r||!s)return;if(typeof c!="string"||!c){l({error:"A conversation without an account runs an application: none was given."});return}let f=!0;return x(r,c).then(()=>{f&&l({ready:!0})}).catch(y=>{f&&l({error:y instanceof Error?y.message:String(y)})}),()=>{f=!1}},[r?.url,r?.app,r?.inferenceUrl,c,s]);const _=typeof t?.name=="string"?t.name:e,A=t?.transport==="vercel-ai"?"vercel-ai":"ag-ui",b=u.useMemo(()=>({name:_,protocol:A,agentSpecId:e,model:v[e]?.model,description:v[e]?.description,...t?{createPayload:t}:{}}),[e,_,A,t]),S=u.useMemo(()=>D(t),[t]),{runtime:o,status:m,error:g}=B({agentSpecId:e,agentConfig:b,...S?{appLaunch:S}:{},variant:"cloud-pydanticai",autoStart:s&&!i,autoCreateAgent:s&&!i});return u.useEffect(()=>{if(!(!a||!s)){if(r){if(p.error){a.setState("error",p.error);return}if(!p.ready){a.setState("starting");return}}if(i){a.report({variant:"datalayer",sandbox_running:!1,agent_base_url:i});return}if(g){a.setState("error",g);return}if(!o?.jupyterBaseUrl){a.setState(m==="error"?"error":"starting");return}a.report({variant:"datalayer",sandbox_running:!!o.serviceManager,jupyter_url:o.jupyterBaseUrl,jupyter_token:o.serviceManager?.serverSettings?.token,kernel_id:o.kernelId,agent_base_url:o.agentBaseUrl})}},[a,s,o,m,g,i,r,p]),null}export{j as DatalayerAgentBridge,j as default};
|