@marimo-team/frontend 0.25.1-dev90 → 0.25.2-dev0
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/assets/{ConnectedDataExplorerComponent-Bdak5-o8.js → ConnectedDataExplorerComponent-DJ5jwKfp.js} +1 -1
- package/dist/assets/{ErrorBoundary-DrliQ_7g.js → ErrorBoundary-BeE1cdgM.js} +2 -2
- package/dist/assets/{ImageComparisonComponent-DLxkuRy3.js → ImageComparisonComponent-pCLPT6RA.js} +1 -1
- package/dist/assets/LazyAnyLanguageCodeMirror-B_IYTCX5.js +2 -0
- package/dist/assets/{RunButton-qknEPbRR.js → RunButton-C2kFUhyO.js} +10 -10
- package/dist/assets/{abnfDiagram-VCTEODGH-dm832Yw9.js → abnfDiagram-VCTEODGH-CSPJSGaM.js} +1 -1
- package/dist/assets/add-cell-with-ai-BFgdVPaN.js +76 -0
- package/dist/assets/{agent-panel-CJva58SL.js → agent-panel-Dh7yWh9P.js} +5 -5
- package/dist/assets/ai-model-dropdown-DJ2elMLM.js +5 -0
- package/dist/assets/{any-language-editor-B7QvjaYO.js → any-language-editor-Cj_HzlZY.js} +1 -1
- package/dist/assets/app-config-button-DBCTefOX.js +1 -0
- package/dist/assets/{architectureDiagram-5GKGNRK7-CiRaYU5G.js → architectureDiagram-5GKGNRK7-7iukRoC9.js} +1 -1
- package/dist/assets/{blockDiagram-I7D4REHJ-BK3JcsXA.js → blockDiagram-I7D4REHJ-cuhpQB60.js} +1 -1
- package/dist/assets/{c4Diagram-7LVT6UL2-BbMz-zwF.js → c4Diagram-7LVT6UL2-CMQEYn6T.js} +1 -1
- package/dist/assets/{cache-panel-DxdmvFwH.js → cache-panel-C0oB1kE2.js} +1 -1
- package/dist/assets/{cells-BcQ8Tm3j.js → cells-CzugpTQu.js} +33 -33
- package/dist/assets/channel-CGdeorQk.js +1 -0
- package/dist/assets/{chat-display-TI342pMF.js → chat-display-DevO4F8W.js} +1 -1
- package/dist/assets/chat-panel-BGw0bqDk.js +4 -0
- package/dist/assets/{chat-ui-B1aeiWdr.js → chat-ui-CZZFGlZi.js} +4 -4
- package/dist/assets/{chunk-4HAMMTFA-F3WVmmmo.js → chunk-4HAMMTFA-C6Tl7kEY.js} +1 -1
- package/dist/assets/{chunk-75Z2AOVW-DA_lihEi.js → chunk-75Z2AOVW-BzzYECN7.js} +1 -1
- package/dist/assets/{chunk-DU6HZSFF-J-califE.js → chunk-DU6HZSFF-BlpgvKzl.js} +2 -2
- package/dist/assets/{chunk-F27PBJKO-BzJrz4xx.js → chunk-F27PBJKO-BVIgLGPF.js} +1 -1
- package/dist/assets/{chunk-GMAD6QVW-mXoq4V-T.js → chunk-GMAD6QVW-hv6IsAru.js} +1 -1
- package/dist/assets/{chunk-GVQU2GXP-B-87l3Xt.js → chunk-GVQU2GXP-Duv4ZYb-.js} +1 -1
- package/dist/assets/{chunk-IMKFNOWR-yy9Ec7ZM.js → chunk-IMKFNOWR-BIILwBhp.js} +1 -1
- package/dist/assets/{chunk-L3NEJ4N5-DLeZO9l0.js → chunk-L3NEJ4N5-B2hafvRU.js} +1 -1
- package/dist/assets/{chunk-OSK3NFVY-PWoOtECb.js → chunk-OSK3NFVY-SNGRdtNA.js} +1 -1
- package/dist/assets/{chunk-P2QGCYS3-DsJshZeL.js → chunk-P2QGCYS3-_SeE0QXb.js} +1 -1
- package/dist/assets/{chunk-POPQ4Y6H-CCg5TpSp.js → chunk-POPQ4Y6H-BB5NNJFE.js} +1 -1
- package/dist/assets/{chunk-PWAF6VOD-CrFPAGFi.js → chunk-PWAF6VOD-BZoBqp8x.js} +1 -1
- package/dist/assets/{chunk-SHT3W25Y-lri4OQTX.js → chunk-SHT3W25Y-BtLGdeDB.js} +1 -1
- package/dist/assets/{chunk-SVP7TREG-B3ISFgJc.js → chunk-SVP7TREG-B0UfxhUP.js} +1 -1
- package/dist/assets/{chunk-TICWLB2K-CJ7ETjY3.js → chunk-TICWLB2K-BP7vel_P.js} +1 -1
- package/dist/assets/classDiagram-ZZMXUADV-CoNXKNMZ.js +1 -0
- package/dist/assets/classDiagram-v2-VYDZK3BY-CoNXKNMZ.js +1 -0
- package/dist/assets/code-visibility-BFNYI7hr.js +1 -0
- package/dist/assets/command-palette-DN4JoOLD.js +1 -0
- package/dist/assets/{common-cDzShymV.js → common-DUCPhoyP.js} +1 -1
- package/dist/assets/{components-B3KlHXnD.js → components-CK7CeYlo.js} +1 -1
- package/dist/assets/components-DAmFBASm.js +1 -0
- package/dist/assets/config-B4VJJibu.js +1 -0
- package/dist/assets/{utils-B3E7otfg.js → config-BxZgoFvi.js} +1 -1
- package/dist/assets/config-DpGPGznL.js +1 -0
- package/dist/assets/{cynefinDiagram-5FMLGOSQ-1zl1wSTB.js → cynefinDiagram-5FMLGOSQ-BARZRQBb.js} +1 -1
- package/dist/assets/{dagre-DM-Ch8wC.js → dagre-DVyyr7Cb.js} +1 -1
- package/dist/assets/{dagre-GXQ25YYZ-BqoUeivc.js → dagre-GXQ25YYZ-79s0lOP0.js} +1 -1
- package/dist/assets/data-grid-overlay-editor-DPfnIudL.js +1 -0
- package/dist/assets/{dependency-graph-panel-C-SFFOPF.js → dependency-graph-panel-BN4CLayU.js} +3 -3
- package/dist/assets/{diagram-S7CK7UJ4-CF90sb1m.js → diagram-S7CK7UJ4-BCviGhvd.js} +1 -1
- package/dist/assets/{diagram-UQ7AKVKN-DgbZAUCH.js → diagram-UQ7AKVKN-Ds-BT46T.js} +1 -1
- package/dist/assets/{diagram-VSXAHHWV-DOQllF_r.js → diagram-VSXAHHWV-CK4GkM-q.js} +1 -1
- package/dist/assets/{diagram-VX7I27RA-6dC0a_-i.js → diagram-VX7I27RA-BtL2eh0t.js} +1 -1
- package/dist/assets/{diagram-Z3DM3KII-C1OXYmlB.js → diagram-Z3DM3KII-C6SmbLBS.js} +1 -1
- package/dist/assets/{dist-0HQ0BMF5.js → dist-CQvJDryh.js} +1 -1
- package/dist/assets/{documentation-panel-idK3s0j3.js → documentation-panel-CzRbXV5u.js} +1 -1
- package/dist/assets/{ebnfDiagram-PWID7BFC-7gC3cuC7.js → ebnfDiagram-PWID7BFC-D_JU4cMQ.js} +1 -1
- package/dist/assets/edit-page-jGNYBqQo.js +174 -0
- package/dist/assets/{erDiagram-RLTQ6QDP-BsE87b_i.js → erDiagram-RLTQ6QDP-Z9MJ6X-r.js} +1 -1
- package/dist/assets/{error-entries-C-LFkdXb.js → error-entries-CDSsy76p.js} +1 -1
- package/dist/assets/{error-panel-YAFgCest.js → error-panel-ABvjFG3p.js} +1 -1
- package/dist/assets/{feedback-button-sRQQL2TH.js → feedback-button-CZhLiwkO.js} +2 -2
- package/dist/assets/file-explorer-panel-DTiEpmVE.js +1 -0
- package/dist/assets/file-name-input-C1C8xrjA.js +3 -0
- package/dist/assets/filename-fxG7K_MU.js +1 -0
- package/dist/assets/flowDiagram-HODETNUW-ncLciK2K.js +1 -0
- package/dist/assets/{gallery-page-CH8TM7bV.js → gallery-page-Moi4ZdJ0.js} +1 -1
- package/dist/assets/{ganttDiagram-EL5Y4UJY-d9Qqbnau.js → ganttDiagram-EL5Y4UJY-Cgy11k0G.js} +1 -1
- package/dist/assets/{gitGraphDiagram-WWUBYQGX-DBunV_fz.js → gitGraphDiagram-WWUBYQGX-CVH8fay_.js} +1 -1
- package/dist/assets/glide-data-editor-CbsCWu-K.js +131 -0
- package/dist/assets/{graphlib-DDJ8O6ZH.js → graphlib-3maKwbRO.js} +1 -1
- package/dist/assets/has-cJsIKK9t.js +1 -0
- package/dist/assets/home-page-UAgVOkCZ.js +4 -0
- package/dist/assets/index--sT8xf-8.css +2 -0
- package/dist/assets/index-DafnX1Xx.js +62 -0
- package/dist/assets/{infoDiagram-27XIBGKW-FE7De1I6.js → infoDiagram-27XIBGKW-Dk8U81nJ.js} +1 -1
- package/dist/assets/{ishikawaDiagram-5VMMS53U-CSEGYrJ-.js → ishikawaDiagram-5VMMS53U-CzHQlMUQ.js} +1 -1
- package/dist/assets/{journeyDiagram-3NMN7TZE-Cp4mxQrE.js → journeyDiagram-3NMN7TZE-DRc8ACzh.js} +1 -1
- package/dist/assets/{kanban-definition-UXKFOSKX-d7iAZsOb.js → kanban-definition-UXKFOSKX-CVyVYiI6.js} +1 -1
- package/dist/assets/katex-DkE0ukCy.js +257 -0
- package/dist/assets/{logs-panel-xMj01DRN.js → logs-panel-Bz5ysVX4.js} +1 -1
- package/dist/assets/{mermaid-CNjXdDrA.js → mermaid-D_jPUVqz.js} +4 -4
- package/dist/assets/mhchem-CmzEtQj8.js +1 -0
- package/dist/assets/{mindmap-definition-YA3MSWOX-CddM9_uP.js → mindmap-definition-YA3MSWOX-D5t6Aq5Z.js} +1 -1
- package/dist/assets/{number-overlay-editor-N57if5NT.js → number-overlay-editor-FAD8sjFU.js} +1 -1
- package/dist/assets/{outline-panel-Garp-f5k.js → outline-panel-85oiQ0XX.js} +1 -1
- package/dist/assets/packages-panel-ClKIaP5S.js +1 -0
- package/dist/assets/{panels-CnbmgzkS.js → panels-B48zp96D.js} +9 -9
- package/dist/assets/{pegDiagram-XKGWAZYB-CEns8d-M.js → pegDiagram-XKGWAZYB-BTkTm4ej.js} +1 -1
- package/dist/assets/{pieDiagram-E7YTZNPT-wyb0xQ0R.js → pieDiagram-E7YTZNPT-Bq6X88M1.js} +1 -1
- package/dist/assets/{process-output-ObDfw1uu.js → process-output-Cg2ta3vY.js} +1 -1
- package/dist/assets/{quadrantDiagram-AXDQQJYC-BE-xlTLH.js → quadrantDiagram-AXDQQJYC-D_wrOwLk.js} +1 -1
- package/dist/assets/{railroadDiagram-O6MQD6OU-DZZVHmr2.js → railroadDiagram-O6MQD6OU-fv8HXW_g.js} +1 -1
- package/dist/assets/{requirementDiagram-BXWQKSXE-C3Bf4dd5.js → requirementDiagram-BXWQKSXE-DDOOMUfC.js} +1 -1
- package/dist/assets/{reveal-component-DgrXq3Kv.js → reveal-component-CR43gpTZ.js} +3 -3
- package/dist/assets/run-page-NR_KFWk8.js +1 -0
- package/dist/assets/{sankeyDiagram-P5KCCOFB-BWLQCyjK.js → sankeyDiagram-P5KCCOFB-CvvUY6tS.js} +1 -1
- package/dist/assets/scratchpad-panel-DHc-oVb1.js +1 -0
- package/dist/assets/{secrets-panel-4dRIaZfY.js → secrets-panel-C-65ZjnM.js} +1 -1
- package/dist/assets/{sequenceDiagram-WJ2MYXX4-BIY0mgX7.js → sequenceDiagram-WJ2MYXX4-DdpBhQaS.js} +1 -1
- package/dist/assets/session-DXKMv4Bs.js +1 -0
- package/dist/assets/session-panel-DiwQqIbt.js +1 -0
- package/dist/assets/{SelectionIndicator-DLJBcP4e.js → shell-BSnvn9t7.js} +1 -1
- package/dist/assets/snippets-panel-BLmXrneD.js +1 -0
- package/dist/assets/{stateDiagram-D77RDMKH-D_xRHRLf.js → stateDiagram-D77RDMKH-D3p19fac.js} +1 -1
- package/dist/assets/stateDiagram-v2-MP3YSRHH-CplsDaDl.js +1 -0
- package/dist/assets/{swimlanes-42K2YHIH-CDQzpfz0.js → swimlanes-42K2YHIH-CLxCSvU4.js} +1 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-DPoIFx8T.js +8 -0
- package/dist/assets/{swiper-component-j-Lk25wW.js → swiper-component-rqJChT_P.js} +1 -1
- package/dist/assets/{terminal-BToH-U1t.js → terminal-CY4h1UmO.js} +1 -1
- package/dist/assets/{timeline-definition-24CTP7MA-D5Jgj1fz.js → timeline-definition-24CTP7MA-Cw2PY--x.js} +1 -1
- package/dist/assets/tooltip-PLkI_UfK.js +61 -0
- package/dist/assets/{tracing-DtKLmNHj.js → tracing-Q8NAdlrA.js} +1 -1
- package/dist/assets/tracing-panel-Ci4kY4dr.js +2 -0
- package/dist/assets/useCellActionButton-DpYtVfFe.js +1 -0
- package/dist/assets/useTheme-DcnXlv0_.js +1 -0
- package/dist/assets/{constants-BDbGiS7O.js → utils-B4K466FK.js} +1 -1
- package/dist/assets/{vega-component-DVSvu4vP.js → vega-component-BpoSew4K.js} +1 -1
- package/dist/assets/{vega-embed-container-QM1zZmYi.js → vega-embed-container-BOJG8mCA.js} +1 -1
- package/dist/assets/{vennDiagram-4TSXK5OY-Cv6jxbpX.js → vennDiagram-4TSXK5OY-D8bN6lVl.js} +1 -1
- package/dist/assets/{wardleyDiagram-VM6X3IG4-lwv-YoWo.js → wardleyDiagram-VM6X3IG4-CbZdo0SA.js} +1 -1
- package/dist/assets/{write-secret-modal-CBUZw27N.js → write-secret-modal-BiG2tahJ.js} +1 -1
- package/dist/assets/{xychartDiagram-S5SC5T6Z-CGM4LlFN.js → xychartDiagram-S5SC5T6Z-DUUQ9tau.js} +1 -1
- package/dist/assets/youtube-A9VT7NHb.js +1 -0
- package/dist/index.html +14 -13
- package/package.json +1 -2
- package/src/__mocks__/common.ts +3 -3
- package/src/__tests__/CellStatus.test.tsx +1 -1
- package/src/__tests__/setup.ts +7 -7
- package/src/components/app-config/ai-config.tsx +2 -0
- package/src/components/app-config/optional-features.tsx +1 -1
- package/src/components/chat/chat-panel.tsx +19 -8
- package/src/components/data-table/TableTopBar.tsx +2 -2
- package/src/components/data-table/__tests__/export-actions.test.tsx +662 -0
- package/src/components/data-table/charts/__tests__/chart-panel.test.tsx +286 -0
- package/src/components/data-table/charts/charts.tsx +26 -13
- package/src/components/data-table/column-summary/chart-spec-model.tsx +4 -4
- package/src/components/data-table/data-table.tsx +1 -1
- package/src/components/data-table/export-actions.tsx +642 -176
- package/src/components/data-table/schemas.ts +25 -3
- package/src/components/dependency-graph/elements.ts +2 -2
- package/src/components/editor/__tests__/package-alert.test.tsx +140 -0
- package/src/components/editor/actions/__tests__/pair-with-agent.test.tsx +107 -0
- package/src/components/editor/actions/pair-with-agent.tsx +119 -0
- package/src/components/editor/actions/useNotebookActions.tsx +2 -1
- package/src/components/editor/ai/add-cell-with-ai.tsx +2 -0
- package/src/components/editor/ai/staged-cell-submission.ts +2 -2
- package/src/components/editor/ai/transport/chat-transport.tsx +1 -1
- package/src/components/editor/chrome/components/contribute-snippet-button.tsx +6 -1
- package/src/components/editor/connections/database/as-code.ts +44 -44
- package/src/components/editor/connections/storage/as-code.ts +3 -3
- package/src/components/editor/file-tree/requesting-tree.tsx +16 -13
- package/src/components/editor/navigation/clipboard.ts +2 -2
- package/src/components/editor/notebook-cell.tsx +2 -2
- package/src/components/editor/output/MarimoTracebackOutput.tsx +1 -1
- package/src/components/editor/output/VideoOutput.tsx +1 -1
- package/src/components/editor/output/ansi-reduce.ts +21 -17
- package/src/components/editor/output/console/ConsoleOutput.tsx +3 -3
- package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +59 -0
- package/src/components/editor/output/console/text-rendering.tsx +3 -1
- package/src/components/editor/package-alert.tsx +20 -7
- package/src/components/home/components.tsx +1 -0
- package/src/components/markdown/markdown-renderer.css +1 -1
- package/src/components/pages/run-page.tsx +1 -0
- package/src/components/slides/__tests__/minimap-actions.test.tsx +7 -7
- package/src/components/slides/__tests__/minimap.test.ts +12 -12
- package/src/components/slides/__tests__/slide-scroll-hint.test.tsx +8 -8
- package/src/components/static-html/__tests__/share-modal.test.tsx +154 -0
- package/src/components/static-html/__tests__/stage-for-publish.test.ts +111 -0
- package/src/components/static-html/share-modal.tsx +114 -144
- package/src/components/static-html/stage-for-publish.ts +56 -0
- package/src/components/static-html/static-banner.tsx +2 -2
- package/src/components/ui/links.tsx +6 -1
- package/src/components/ui/typography.tsx +16 -8
- package/src/core/ai/context/__tests__/registry.test.ts +31 -28
- package/src/core/ai/context/providers/cell-output.ts +8 -8
- package/src/core/ai/context/providers/datasource.ts +10 -7
- package/src/core/ai/context/providers/error.ts +7 -7
- package/src/core/ai/context/providers/file.ts +8 -8
- package/src/core/ai/context/providers/tables.ts +7 -7
- package/src/core/ai/context/providers/variable.ts +7 -7
- package/src/core/ai/context/registry.ts +18 -18
- package/src/core/ai/ids/ids.ts +5 -5
- package/src/core/ai/model-registry.ts +12 -9
- package/src/core/ai/staged-cells.ts +6 -6
- package/src/core/ai/tools/base.ts +6 -6
- package/src/core/ai/tools/edit-notebook-tool.ts +6 -6
- package/src/core/ai/tools/registry.ts +4 -4
- package/src/core/ai/tools/run-cells-tool.ts +7 -7
- package/src/core/ai/tools/sample-tool.ts +6 -6
- package/src/core/cells/__tests__/cells.test.ts +27 -0
- package/src/core/cells/cells.ts +2 -1
- package/src/core/codemirror/cells/debugger-decorations.ts +13 -7
- package/src/core/codemirror/cells/line-timing-decorations.ts +9 -9
- package/src/core/codemirror/cells/traceback-decorations.ts +7 -4
- package/src/core/codemirror/code-lens/extension.ts +13 -13
- package/src/core/codemirror/copilot/__tests__/language-server.test.ts +6 -6
- package/src/core/codemirror/copilot/__tests__/transport.test.ts +12 -12
- package/src/core/codemirror/copilot/language-server.ts +13 -13
- package/src/core/codemirror/copilot/transport.ts +1 -1
- package/src/core/codemirror/find-replace/search-highlight.ts +5 -5
- package/src/core/codemirror/go-to-definition/underline.ts +3 -3
- package/src/core/codemirror/keymaps/vim.ts +3 -3
- package/src/core/codemirror/language/languages/markdown.ts +8 -8
- package/src/core/codemirror/language/languages/python.ts +7 -7
- package/src/core/codemirror/language/languages/sql/completion-builder.ts +5 -5
- package/src/core/codemirror/language/languages/sql/completion-store.ts +4 -4
- package/src/core/codemirror/language/languages/sql/sql.ts +21 -21
- package/src/core/codemirror/lsp/__tests__/transports.test.ts +10 -10
- package/src/core/codemirror/lsp/federated-lsp.ts +29 -27
- package/src/core/codemirror/lsp/notebook-lsp.ts +21 -21
- package/src/core/codemirror/misc/__tests__/dnd.test.ts +10 -10
- package/src/core/codemirror/misc/__tests__/paste.test.ts +7 -4
- package/src/core/codemirror/reactive-references/extension.ts +3 -3
- package/src/core/codemirror/rtc/loro/awareness.ts +12 -12
- package/src/core/codemirror/rtc/loro/sync.ts +5 -5
- package/src/core/codemirror/vim/cursor-visibility.ts +3 -3
- package/src/core/dom/ui-element.ts +5 -5
- package/src/core/dom/uiregistry.ts +10 -10
- package/src/core/hotkeys/hotkeys.ts +9 -9
- package/src/core/islands/__tests__/bridge.test.ts +4 -4
- package/src/core/islands/__tests__/test-utils.tsx +4 -4
- package/src/core/islands/bridge.ts +85 -82
- package/src/core/islands/components/web-components.tsx +7 -7
- package/src/core/islands/worker/__tests__/controller.test.ts +1 -1
- package/src/core/islands/worker/controller.ts +6 -3
- package/src/core/islands/worker-factory.ts +2 -2
- package/src/core/kernel/RuntimeState.ts +4 -4
- package/src/core/kernel/__tests__/session.test.ts +110 -1
- package/src/core/kernel/session.ts +46 -15
- package/src/core/lsp/__tests__/transport.test.ts +19 -19
- package/src/core/lsp/transport.ts +5 -5
- package/src/core/network/CachingRequestRegistry.ts +2 -2
- package/src/core/network/DeferredRequestRegistry.ts +4 -4
- package/src/core/network/__tests__/export-asset-url.test.ts +45 -0
- package/src/core/network/export-asset-url.ts +19 -0
- package/src/core/network/requests-network.ts +2 -7
- package/src/core/runtime/runtime.ts +25 -20
- package/src/core/static/virtual-file-tracker.ts +5 -5
- package/src/core/wasm/__tests__/bridge.test.ts +2 -2
- package/src/core/wasm/bridge.ts +132 -133
- package/src/core/wasm/router.ts +5 -5
- package/src/core/wasm/store.ts +4 -4
- package/src/core/wasm/worker/bootstrap.ts +8 -5
- package/src/core/wasm/worker/message-buffer.ts +3 -3
- package/src/core/websocket/transports/__tests__/ws.test.ts +8 -8
- package/src/core/websocket/transports/basic.ts +15 -8
- package/src/core/websocket/transports/sse.ts +7 -7
- package/src/core/websocket/transports/transport.ts +3 -3
- package/src/core/websocket/transports/ws.ts +9 -7
- package/src/css/globals.css +18 -21
- package/src/css/katex.min.css +260 -241
- package/src/hooks/__tests__/useOverflowDetection.test.tsx +5 -5
- package/src/hooks/__tests__/useResizeObserver.test.tsx +12 -12
- package/src/plugins/core/registerReactComponent.tsx +5 -5
- package/src/plugins/core/sidebar-element.tsx +2 -2
- package/src/plugins/impl/ButtonPlugin.tsx +3 -3
- package/src/plugins/impl/CheckboxPlugin.tsx +3 -3
- package/src/plugins/impl/CodeEditorPlugin.tsx +3 -3
- package/src/plugins/impl/DatePickerPlugin.tsx +3 -3
- package/src/plugins/impl/DateRangePlugin.tsx +3 -3
- package/src/plugins/impl/DateTimePickerPlugin.tsx +3 -3
- package/src/plugins/impl/DictPlugin.tsx +3 -3
- package/src/plugins/impl/DropdownPlugin.tsx +3 -3
- package/src/plugins/impl/FileUploadPlugin.tsx +3 -3
- package/src/plugins/impl/MatrixPlugin.tsx +4 -4
- package/src/plugins/impl/MicrophonePlugin.tsx +3 -3
- package/src/plugins/impl/MultiselectPlugin.tsx +3 -3
- package/src/plugins/impl/NumberPlugin.tsx +3 -3
- package/src/plugins/impl/RadioPlugin.tsx +9 -5
- package/src/plugins/impl/RangeSliderPlugin.tsx +3 -3
- package/src/plugins/impl/RefreshPlugin.tsx +3 -3
- package/src/plugins/impl/SliderPlugin.tsx +3 -3
- package/src/plugins/impl/SwitchPlugin.tsx +3 -3
- package/src/plugins/impl/TabsPlugin.tsx +3 -3
- package/src/plugins/impl/TextAreaPlugin.tsx +3 -3
- package/src/plugins/impl/TextInputPlugin.tsx +3 -3
- package/src/plugins/impl/__tests__/MatrixPlugin.test.tsx +2 -2
- package/src/plugins/impl/anywidget/model.ts +10 -10
- package/src/plugins/impl/anywidget/registry.ts +12 -9
- package/src/plugins/impl/anywidget/runtime.ts +11 -9
- package/src/plugins/impl/anywidget/widget-binding.ts +6 -6
- package/src/plugins/impl/image-comparison/ImageComparisonComponent.tsx +7 -6
- package/src/plugins/impl/matplotlib/MatplotlibPlugin.tsx +3 -3
- package/src/plugins/impl/matplotlib/__tests__/matplotlib-renderer.test.ts +2 -2
- package/src/plugins/impl/matplotlib/matplotlib-renderer.ts +2 -2
- package/src/plugins/impl/mpl-interactive/mpl-websocket-shim.ts +10 -10
- package/src/plugins/impl/panel/utils.ts +5 -5
- package/src/plugins/impl/plotly/PlotlyPlugin.tsx +3 -3
- package/src/plugins/impl/vega/VegaPlugin.tsx +3 -3
- package/src/plugins/impl/vega/__tests__/use-vega-container-remeasure.test.ts +7 -7
- package/src/plugins/impl/vega/__tests__/utils.test.ts +16 -1
- package/src/plugins/impl/vega/__tests__/vega.test.ts +37 -0
- package/src/plugins/impl/vega/loader.ts +23 -1
- package/src/plugins/impl/vega/utils.ts +5 -4
- package/src/plugins/layout/AccordionPlugin.tsx +3 -3
- package/src/plugins/layout/CalloutPlugin.tsx +3 -3
- package/src/plugins/layout/ImageComparisonPlugin.tsx +5 -3
- package/src/plugins/layout/JsonOutputPlugin.tsx +3 -3
- package/src/plugins/layout/MimeRenderPlugin.tsx +3 -3
- package/src/plugins/layout/NavigationMenuPlugin.tsx +3 -3
- package/src/plugins/layout/OutlinePlugin.tsx +3 -3
- package/src/plugins/layout/ProgressPlugin.tsx +3 -3
- package/src/plugins/layout/RoutesPlugin.tsx +6 -8
- package/src/plugins/layout/StatPlugin.tsx +3 -3
- package/src/plugins/layout/TexPlugin.tsx +3 -3
- package/src/plugins/layout/carousel/CarouselPlugin.tsx +4 -4
- package/src/plugins/layout/mermaid/MermaidPlugin.tsx +3 -3
- package/src/utils/Deferred.ts +6 -6
- package/src/utils/async-capture-tracker.ts +10 -7
- package/src/utils/errors.ts +5 -5
- package/src/utils/id-tree.tsx +83 -80
- package/src/utils/lru.ts +1 -1
- package/src/utils/multi-map.ts +14 -12
- package/src/utils/paths.ts +6 -6
- package/src/utils/pluralize.ts +3 -3
- package/src/utils/progress.ts +6 -6
- package/src/utils/python-poet/poet.ts +14 -14
- package/src/utils/routes.ts +4 -2
- package/src/utils/semaphore.ts +6 -6
- package/src/utils/storage/storage.ts +6 -6
- package/src/utils/storage/typed.ts +16 -12
- package/src/utils/time.ts +9 -9
- package/src/utils/timed-cache.ts +4 -4
- package/src/utils/tracer.ts +9 -6
- package/dist/assets/LazyAnyLanguageCodeMirror-EBegnOE0.js +0 -2
- package/dist/assets/add-cell-with-ai-Ovbsj95O.js +0 -76
- package/dist/assets/ai-model-dropdown-1t7m1iFc.js +0 -3
- package/dist/assets/app-config-button-vCxNGhe2.js +0 -1
- package/dist/assets/channel-ni7ei-yz.js +0 -1
- package/dist/assets/chat-panel-CzdR8RG_.js +0 -4
- package/dist/assets/classDiagram-ZZMXUADV-CIEFh40S.js +0 -1
- package/dist/assets/classDiagram-v2-VYDZK3BY-CIEFh40S.js +0 -1
- package/dist/assets/code-visibility-G0W4ym3Y.js +0 -1
- package/dist/assets/command-palette-DhdK67bL.js +0 -1
- package/dist/assets/components-CQVZgYvR.js +0 -1
- package/dist/assets/config-CMqNngzA.js +0 -1
- package/dist/assets/config-CmBpjGXk.js +0 -1
- package/dist/assets/data-grid-overlay-editor-DbqMOWZn.js +0 -1
- package/dist/assets/edit-page-_D_Nv3dJ.js +0 -176
- package/dist/assets/file-explorer-panel-LAa-LxTN.js +0 -1
- package/dist/assets/file-name-input-BXq6eIDs.js +0 -3
- package/dist/assets/flowDiagram-HODETNUW-B4xRBXB1.js +0 -1
- package/dist/assets/glide-data-editor-DPMjaN4R.js +0 -131
- package/dist/assets/has-CanCEarv.js +0 -1
- package/dist/assets/home-page-vDWLpS4F.js +0 -4
- package/dist/assets/index-2TQenOiQ.css +0 -2
- package/dist/assets/index-CgQsZfww.js +0 -62
- package/dist/assets/katex-mNPPSsir.js +0 -257
- package/dist/assets/katex-ukvJUC1e.js +0 -257
- package/dist/assets/mhchem-DcHTrqjv.js +0 -1
- package/dist/assets/packages-panel-B8HU9FAM.js +0 -1
- package/dist/assets/run-page-E0qMru0p.js +0 -1
- package/dist/assets/scratchpad-panel-CCFyaegO.js +0 -1
- package/dist/assets/session-C8nQMsOE.js +0 -1
- package/dist/assets/session-panel-CR3BHLhQ.js +0 -1
- package/dist/assets/snippets-panel-Dn22yTr_.js +0 -1
- package/dist/assets/stateDiagram-v2-MP3YSRHH-BQvYFx_a.js +0 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-BAn2JKhB.js +0 -8
- package/dist/assets/tooltip-B1vGi-z4.js +0 -61
- package/dist/assets/tracing-panel-C5ybTQyJ.js +0 -2
- package/dist/assets/useCellActionButton-Bm9OZdcq.js +0 -1
- package/dist/assets/useTheme-Ho3YdAx3.js +0 -1
- package/dist/assets/youtube-ELpGJEdR.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,t as i}from"./useEvent-Dc9HkKI2.js";import{t as a}from"./react-CUdNIagt.js";import{Cn as o,Ct as s,D as c,Et as l,Qr as u,Rt as d,St as f,Tt as p,_n as m,bt as h,fn as g,gn as _,lo as v,wt as y,xt as b,yt as x,za as S}from"./cells-BcQ8Tm3j.js";import{t as C}from"./react-dom-CKsE8sC1.js";import{t as w}from"./compiler-runtime-BQ9S8nyo.js";import{g as T,p as E}from"./utils-B3E7otfg.js";import{g as D}from"./useEventListener-BdZUApHd.js";import{t as O}from"./invariant-Ci2dTZ72.js";import{F as k,r as A,z as j}from"./config-CmBpjGXk.js";import{t as M}from"./cn-ldLVeaqm.js";import{t as N}from"./jsx-runtime-B74pBk57.js";import{r as P}from"./config-CMqNngzA.js";import{o as F}from"./alert-dialog-CeE3i3Qa.js";import{a as I,c as L,p as R,r as z,t as B}from"./dropdown-menu-VuyoeQOD.js";import{t as V}from"./tooltip-DR2Z2N4w.js";import{t as H}from"./button-BoklZTGL.js";import{t as U}from"./createLucideIcon-rHn2EdoM.js";import{n as W,t as G}from"./paths-CzfpItSz.js";import{st as K}from"./panels-CnbmgzkS.js";import{n as ee}from"./LazyAnyLanguageCodeMirror-EBegnOE0.js";import{r as te}from"./useNumberFormatter-C4-_TnkF.js";import{A as ne,B as re,F as ie,M as q,z as ae}from"./RunButton-qknEPbRR.js";import{u as J}from"./toDate-BbJ1_N2T.js";import{t as oe}from"./copy-RyCOE8jo.js";import{n as Y}from"./youtube-ELpGJEdR.js";import{b as se}from"./write-secret-modal-CBUZw27N.js";import{a as ce,c as le,d as ue,f as de,i as fe,l as pe,m as X,n as me,p as he,r as ge,t as _e,u as ve}from"./file-name-input-BXq6eIDs.js";import{a as ye}from"./input-BDakodZ2.js";import{n as be}from"./copy-BhJktFeI.js";import{t as xe}from"./use-toast-CC89xOwH.js";import{t as Se}from"./copy-icon-DFhUGBjO.js";import{Tt as Ce}from"./dist-BczecT6V.js";import{n as we,r as Te,t as Ee}from"./requests-yTHMxhVa.js";import{t as De}from"./context-BFOBKCJB.js";import{t as Oe}from"./useDebounce-DMbg9X18.js";import{n as ke}from"./useAsyncData-DucTwMkf.js";import{a as Ae}from"./errors-D9vyuMar.js";import{A as je,Bt as Me,Ca as Ne,Da as Pe,Et as Fe,Ft as Ie,Gt as Le,Hn as Re,Ir as ze,It as Be,Lr as Ve,Lt as He,Pt as Ue,S as We,Sa as Ge,Zt as Ke,_a as qe,_i as Je,c as Ye,ei as Xe,en as Ze,g as Qe,h as $e,hi as et,in as tt,ja as nt,l as rt,m as it,nn as at,oa as ot,p as st,pa as ct,rn as lt,sa as ut,tn as dt,u as ft,zt as pt}from"./index-CgQsZfww.js";import{t as mt}from"./empty-state-CzxjZqGW.js";import{a as ht,i as gt,n as _t,o as vt,r as yt,s as bt,t as xt}from"./components-B3KlHXnD.js";import{n as St,t as Ct}from"./marimo-icons-B_1oPpIE.js";var wt=U(`book-plus`,[[`path`,{d:`M12 7v6`,key:`lw1j43`}],[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}]]),Tt=U(`copy-minus`,[[`line`,{x1:`12`,x2:`18`,y1:`15`,y2:`15`,key:`1nscbv`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Et=U(`file-plus-corner`,[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]]),Dt=U(`file-symlink`,[[`path`,{d:`M4 11V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7`,key:`huwfnr`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m10 18 3-3-3-3`,key:`18f6ys`}]]),Ot=U(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),kt=U(`folder-root`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`circle`,{cx:`12`,cy:`13`,r:`2`,key:`1c1ljs`}],[`path`,{d:`M12 15v5`,key:`11xva1`}]]),At=U(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),jt=U(`square-play`,[[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}]]),Mt=U(`view`,[[`path`,{d:`M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2`,key:`mrq65r`}],[`path`,{d:`M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2`,key:`be3xqs`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`path`,{d:`M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0`,key:`11ak4c`}]]),Z=e(a(),1),Q=w(),$=N(),Nt=e=>{let t=(0,Q.c)(17),{filename:n,filenameIcon:r,onBack:i,onRefresh:a,onDownload:o,actions:s}=e,c;t[0]===i?c=t[1]:(c=i&&(0,$.jsx)(V,{content:`Back to file list`,children:(0,$.jsx)(H,{variant:`text`,size:`xs`,onClick:i,children:(0,$.jsx)(K,{className:`h-4 w-4`})})}),t[0]=i,t[1]=c);let l;t[2]!==n||t[3]!==r?(l=n?(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 flex-1 min-w-0 text-xs font-semibold truncate`,children:[r,n]}):(0,$.jsx)(`span`,{className:`flex-1`}),t[2]=n,t[3]=r,t[4]=l):l=t[4];let u;t[5]===a?u=t[6]:(u=a&&(0,$.jsx)(V,{content:`Refresh`,children:(0,$.jsx)(H,{variant:`text`,size:`xs`,onClick:a,children:(0,$.jsx)(ct,{className:`h-3.5 w-3.5`})})}),t[5]=a,t[6]=u);let d;t[7]===o?d=t[8]:(d=o&&(0,$.jsx)(V,{content:`Download`,children:(0,$.jsx)(H,{variant:`text`,size:`xs`,onClick:o,children:(0,$.jsx)(nt,{className:`h-3.5 w-3.5`})})}),t[7]=o,t[8]=d);let f;t[9]!==s||t[10]!==u||t[11]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-center gap-0.5 shrink-0`,children:[u,s,d]}),t[9]=s,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==c||t[14]!==l||t[15]!==f?(p=(0,$.jsxs)(`div`,{className:`flex items-center shrink-0 border-b px-1 gap-1`,children:[c,l,f]}),t[13]=c,t[14]=l,t[15]=f,t[16]=p):p=t[16],p},Pt=new Set([`http`,`file`,`in-memory`]);function Ft(e){return JSON.stringify(e).slice(1,-1)}var It=new Set([`datasets`,`spaces`,`buckets`]);function Lt(e){let t=e.split(`/`).filter(Boolean);return t[0]===`datasets`&&t.length>=4?{repoType:`dataset`,repoId:`${t[1]}/${t[2]}`,filename:t.slice(3).join(`/`)}:t[0]===`spaces`&&t.length>=4?{repoType:`space`,repoId:`${t[1]}/${t[2]}`,filename:t.slice(3).join(`/`)}:t.length>=3&&!It.has(t[0])?{repoType:`model`,repoId:`${t[0]}/${t[1]}`,filename:t.slice(2).join(`/`)}:null}function Rt(e){return`from huggingface_hub import hf_hub_download\n\nlocal_path = hf_hub_download(\n repo_id="${Ft(e.repoId)}",\n filename="${Ft(e.filename)}",\n repo_type="${Ft(e.repoType)}",\n)`}var zt=[{id:`read-file`,label:`Insert read snippet`,icon:wt,getCode:e=>{if(e.entry.kind===`directory`)return null;let t=Ft(e.entry.path);if(e.backendType===`huggingface`){let t=Lt(e.entry.path);return t?`${Rt(t)}\n\nwith open(local_path, "rb") as f:\n _data = f.read()\n_data`:null}return e.backendType===`obstore`?`_data = ${e.variableName}.get("${t}").bytes()\n_data`:`_data = ${e.variableName}.cat_file("${t}")\n_data`}},{id:`download-file`,label:`Insert download snippet`,icon:Dt,getCode:e=>{if(e.entry.kind===`directory`)return null;let t=Ft(e.entry.path);if(e.backendType===`huggingface`){let t=Lt(e.entry.path);return t?`${Rt(t)}\nlocal_path`:null}if(e.backendType===`obstore`)return Pt.has(e.protocol)?null:`from datetime import timedelta\nfrom obstore import sign\n\nsigned_url = sign(\n ${e.variableName}, "GET", "${t}",\n expires_in=timedelta(hours=1),\n)\nsigned_url`;let n=Ft(e.entry.path.split(`/`).pop()||`download`);return`${e.variableName}.get("${t}", "${n}")`}}],Bt=104857600;function Vt(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.split(`/`);return n[n.length-1]||t}var Ht=e=>{let t=(0,Q.c)(83),{entry:n,namespace:r,protocol:i,backendType:a,onBack:o}=e,{locale:s}=De(),c=We(),u;t[0]===n.path?u=t[1]:(u=Vt(n.path),t[0]=n.path,t[1]=u);let d=u,f=n.mimeType||`text/plain`,p;t[2]===f?p=t[3]:(p=He(f),t[2]=f,t[3]=p);let m=p,h=m&&n.size>Bt&&n.size>0,g,_;t[4]!==n.path||t[5]!==m||t[6]!==r||t[7]!==h?(g=async()=>{if(h)return null;let e=await l.request({namespace:r,path:n.path,preview:!m});if(e.error)throw Error(e.error);if(!e.url)throw Error(`No URL returned`);if(m)return{type:`media`,url:e.url};let t=await fetch(e.url);if(!t.ok)throw Error(`Failed to fetch preview: ${t.statusText}`);return{type:`text`,content:await t.text()}},_=[r,n.path,m,h],t[4]=n.path,t[5]=m,t[6]=r,t[7]=h,t[8]=g,t[9]=_):(g=t[8],_=t[9]);let{data:v,isPending:y,error:b,refetch:x}=ke(g,_),S;t[10]!==n.path||t[11]!==d||t[12]!==r?(S=async()=>{try{let e=await l.request({namespace:r,path:n.path});if(e.error){xe({title:`Download failed`,description:e.error,variant:`danger`});return}e.url&&Me(e.url,e.filename??d)}catch(e){let t=e;D.error(`Failed to download storage entry`,t),xe({title:`Download failed`,description:String(t),variant:`danger`})}},t[10]=n.path,t[11]=d,t[12]=r,t[13]=S):S=t[13];let C=S,w;t[14]!==c||t[15]!==a||t[16]!==n||t[17]!==r||t[18]!==i?(w=zt.map(e=>{let t=e.getCode({variableName:r,protocol:i,entry:n,backendType:a});if(t===null)return null;let o=e.icon;return(0,$.jsx)(V,{content:e.label,children:(0,$.jsx)(H,{variant:`text`,size:`xs`,onClick:()=>c(t),"aria-label":e.label,children:(0,$.jsx)(o,{className:`h-3.5 w-3.5`})})},e.id)}),t[14]=c,t[15]=a,t[16]=n,t[17]=r,t[18]=i,t[19]=w):w=t[19];let T=w,E;t[20]===d?E=t[21]:(E=Qe(d),t[20]=d,t[21]=E);let O;t[22]!==C||t[23]!==d||t[24]!==o||t[25]!==T||t[26]!==E?(O=(0,$.jsx)(Nt,{filename:d,filenameIcon:E,onBack:o,onDownload:C,actions:T}),t[22]=C,t[23]=d,t[24]=o,t[25]=T,t[26]=E,t[27]=O):O=t[27];let k=O,A;t[28]!==n.lastModified||t[29]!==n.path||t[30]!==n.size||t[31]!==s||t[32]!==f?(A=e=>{let{includeMime:t}=e,r=t!==void 0&&t;return(0,$.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 p-4 text-xs`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Path`}),(0,$.jsxs)(`div`,{className:`truncate flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`font-mono text-[11px]`,children:n.path}),(0,$.jsx)(Se,{value:n.path,className:`h-3 w-3`})]}),r&&(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Type`}),r&&(0,$.jsx)(`span`,{children:f}),n.size>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Size`}),(0,$.jsx)(`span`,{children:ie(n.size,s)})]}),n.lastModified!=null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Modified`}),(0,$.jsx)(`span`,{children:new Date(n.lastModified*1e3).toLocaleString()})]})]})},t[28]=n.lastModified,t[29]=n.path,t[30]=n.size,t[31]=s,t[32]=f,t[33]=A):A=t[33];let j=A;if(h){let e;t[34]===j?e=t[35]:(e=j({includeMime:!0}),t[34]=j,t[35]=e);let r;t[36]!==n.size||t[37]!==s?(r=ie(n.size,s),t[36]=n.size,t[37]=s,t[38]=r):r=t[38];let i;t[39]===r?i=t[40]:(i=(0,$.jsxs)(`div`,{className:`px-4 pb-4 text-xs text-muted-foreground italic`,children:[`File is too large to preview (`,r,`).`]}),t[39]=r,t[40]=i);let a;return t[41]!==k||t[42]!==e||t[43]!==i?(a=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,i]}),t[41]=k,t[42]=e,t[43]=i,t[44]=a):a=t[44],a}if(y){let e;t[45]===j?e=t[46]:(e=j({}),t[45]=j,t[46]=e);let n;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`flex-1 flex items-center justify-center gap-2 text-xs text-muted-foreground min-h-24`,children:[(0,$.jsx)(qe,{className:`h-4 w-4 animate-spin`}),`Loading preview...`]}),t[47]=n):n=t[47];let r;return t[48]!==k||t[49]!==e?(r=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,n]}),t[48]=k,t[49]=e,t[50]=r):r=t[50],r}if(b){let e;t[51]===j?e=t[52]:(e=j({includeMime:!0}),t[51]=j,t[52]=e);let n;t[53]===b.message?n=t[54]:(n=(0,$.jsxs)(`div`,{className:`px-4 pb-4 text-xs text-destructive`,children:[`Failed to load preview: `,b.message]}),t[53]=b.message,t[54]=n);let r;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(ct,{className:`h-3 w-3 mr-1`}),t[55]=r):r=t[55];let i;t[56]===x?i=t[57]:(i=(0,$.jsx)(`div`,{className:`px-4 pb-4`,children:(0,$.jsxs)(H,{variant:`secondary`,size:`xs`,onClick:x,children:[r,`Retry`]})}),t[56]=x,t[57]=i);let a;return t[58]!==k||t[59]!==e||t[60]!==n||t[61]!==i?(a=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,n,i]}),t[58]=k,t[59]=e,t[60]=n,t[61]=i,t[62]=a):a=t[62],a}if(v){let e;t[63]===j?e=t[64]:(e=j({}),t[63]=j,t[64]=e);let n=v.type===`text`?v.content:void 0,r;t[65]!==v.type||t[66]!==v.url?(r=v.type===`media`?{url:v.url}:void 0,t[65]=v.type,t[66]=v.url,t[67]=r):r=t[67];let i;t[68]!==f||t[69]!==d||t[70]!==n||t[71]!==r?(i=(0,$.jsx)(Ue,{mimeType:f,filename:d,contents:n,mediaSource:r}),t[68]=f,t[69]=d,t[70]=n,t[71]=r,t[72]=i):i=t[72];let a;return t[73]!==k||t[74]!==e||t[75]!==i?(a=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,i]}),t[73]=k,t[74]=e,t[75]=i,t[76]=a):a=t[76],a}let M;t[77]===j?M=t[78]:(M=j({includeMime:!0}),t[77]=j,t[78]=M);let N;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsxs)(`div`,{className:`p-4 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(Ne,{className:`h-4 w-4`}),`Preview not available for this file type.`]}),t[79]=N):N=t[79];let P;return t[80]!==k||t[81]!==M?(P=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,M,N]}),t[80]=k,t[81]=M,t[82]=P):P=t[82],P},Ut=16;function Wt(e){return{paddingLeft:e*Ut}}function Gt(e,t){return new Date(e*1e3).toLocaleDateString(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Kt(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.split(`/`);return n[n.length-1]||t}function qt(e){return e.endsWith(`/`)?e:`${e}/`}function Jt(e,t){let n=e.metadata?.id;return typeof n==`string`&&n.length>0?n:`${e.path}::${t}`}function Yt(e,{namespace:t,searchValue:n,entriesByPath:r}){let i=n.trim().toLowerCase(),a=e.path.toLowerCase();if(Kt(e.path).toLowerCase().includes(i)||a.includes(i))return!0;if(e.kind===`directory`){let i=r.get(p(t,qt(e.path)));if(i)return i.some(e=>Yt(e,{namespace:t,searchValue:n,entriesByPath:r}))}return!1}function Xt(e,t){return t.searchValue.trim()?e.filter(e=>Yt(e,t)):e}var Zt=5;function Qt(e){return{query:e,status:`idle`}}function $t(e){return e.status===`idle`||e.status===`error`||e.status===`capped`}function en(e,t,n){return t.get(e)===void 0||n.get(e)?.nextPageToken!=null}function tn({hasSearch:e,hasLoadedMatches:t,isPending:n,remoteSearch:r,searchKey:i,entriesByPath:a,pageMetadataByPath:o}){return!e||t||n||!$t(r)?!1:en(i,a,o)}function nn(e){let t=e.trim(),n=t.lastIndexOf(`/`);return n===-1?``:t.slice(0,n+1)}function rn(e,t){let n=t.trim().toLowerCase();return!n||e.path.toLowerCase().includes(n)||Kt(e.path).toLowerCase().includes(n)}var an=e=>{let t=(0,Q.c)(15),{depth:n,isLoading:r,error:i,onLoadMore:a}=e,o;t[0]===n?o=t[1]:(o=Wt(n),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=r&&(0,$.jsx)(qe,{className:`h-3 w-3 mr-1 animate-spin`}),t[2]=r,t[3]=s);let c=r?`Loading...`:`Load more`,l;t[4]!==r||t[5]!==a||t[6]!==s||t[7]!==c?(l=(0,$.jsxs)(H,{variant:`text`,size:`xs`,className:`h-6 px-0 hover:text-blue-600`,disabled:r,onClick:a,children:[s,c]}),t[4]=r,t[5]=a,t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=i&&(0,$.jsxs)(`span`,{className:`ml-2 text-destructive`,children:[`Failed to load: `,i.message]}),t[9]=i,t[10]=u);let d;return t[11]!==o||t[12]!==l||t[13]!==u?(d=(0,$.jsxs)(`div`,{className:`py-px text-xs`,style:o,children:[l,u]}),t[11]=o,t[12]=l,t[13]=u,t[14]=d):d=t[14],d},on=e=>{let t=(0,Q.c)(44),{namespace:n,protocol:r,rootPath:i,backendType:a,prefix:o,depth:c,locale:l,searchValue:u,onOpenFile:d}=e,{entriesByPath:f}=b(),{entries:p,isPending:m,error:h,hasMore:g,loadMore:_,isLoadingMore:v,loadMoreError:y}=s(n,o);if(m){let e;t[0]===c?e=t[1]:(e=Wt(c),t[0]=c,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(qe,{className:`h-3 w-3 animate-spin`}),t[2]=n):n=t[2];let r;return t[3]===e?r=t[4]:(r=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 py-1 text-xs text-muted-foreground`,style:e,children:[n,`Loading...`]}),t[3]=e,t[4]=r),r}if(h){let e;t[5]===c?e=t[6]:(e=Wt(c),t[5]=c,t[6]=e);let n;return t[7]!==h.message||t[8]!==e?(n=(0,$.jsxs)(`div`,{className:`py-1 text-xs text-destructive`,style:e,children:[`Failed to load: `,h.message]}),t[7]=h.message,t[8]=e,t[9]=n):n=t[9],n}if(p.length===0){let e;t[10]===c?e=t[11]:(e=Wt(c),t[10]=c,t[11]=e);let n;return t[12]===e?n=t[13]:(n=(0,$.jsx)(`div`,{className:`py-1 text-xs text-muted-foreground italic`,style:e,children:`Empty`}),t[12]=e,t[13]=n),n}let x;if(t[14]!==a||t[15]!==p||t[16]!==c||t[17]!==f||t[18]!==l||t[19]!==n||t[20]!==d||t[21]!==r||t[22]!==i||t[23]!==u){let e=Xt(p,{namespace:n,searchValue:u,entriesByPath:f}),o;t[25]!==a||t[26]!==p||t[27]!==c||t[28]!==l||t[29]!==n||t[30]!==d||t[31]!==r||t[32]!==i||t[33]!==u?(o=e=>{let t=Jt(e,p.indexOf(e));return(0,$.jsx)(sn,{rowKey:t,entry:e,namespace:n,protocol:r,rootPath:i,backendType:a,depth:c,locale:l,searchValue:u,onOpenFile:d},t)},t[25]=a,t[26]=p,t[27]=c,t[28]=l,t[29]=n,t[30]=d,t[31]=r,t[32]=i,t[33]=u,t[34]=o):o=t[34],x=e.map(o),t[14]=a,t[15]=p,t[16]=c,t[17]=f,t[18]=l,t[19]=n,t[20]=d,t[21]=r,t[22]=i,t[23]=u,t[24]=x}else x=t[24];let S;t[35]!==c||t[36]!==g||t[37]!==v||t[38]!==_||t[39]!==y?(S=g&&(0,$.jsx)(an,{depth:c,isLoading:v,error:y,onLoadMore:_}),t[35]=c,t[36]=g,t[37]=v,t[38]=_,t[39]=y,t[40]=S):S=t[40];let C;return t[41]!==x||t[42]!==S?(C=(0,$.jsxs)($.Fragment,{children:[x,S]}),t[41]=x,t[42]=S,t[43]=C):C=t[43],C},sn=e=>{let t=(0,Q.c)(115),{entry:n,rowKey:r,namespace:i,protocol:a,rootPath:o,backendType:s,depth:c,locale:u,searchValue:d,onOpenFile:f}=e,[h,g]=(0,Z.useState)(!1),{entriesByPath:_}=b(),v=We(),y=n.kind===`directory`,x,S,C,w,T,E,O,k,A,j,N;if(t[0]!==s||t[1]!==c||t[2]!==_||t[3]!==n||t[4]!==y||t[5]!==h||t[6]!==i||t[7]!==f||t[8]!==a||t[9]!==r||t[10]!==d){w=Kt(n.path);let e;t[22]===d?e=t[23]:(e=d.trim(),t[22]=d,t[23]=e);let o=!!e;T=y&&o&&w.toLowerCase().includes(d.trim().toLowerCase());let u;t[24]!==_||t[25]!==n.path||t[26]!==o||t[27]!==y||t[28]!==i||t[29]!==d?(u=y&&o&&!!_.get(p(i,qt(n.path)))?.some(e=>Yt(e,{namespace:i,searchValue:d,entriesByPath:_})),t[24]=_,t[25]=n.path,t[26]=o,t[27]=y,t[28]=i,t[29]=d,t[30]=u):u=t[30],S=h||u;let v;t[31]!==n.path||t[32]!==i?(v=async()=>{try{let e=await l.request({namespace:i,path:n.path});if(e.error){xe({title:`Download failed`,description:e.error,variant:`danger`});return}e.url&&Me(e.url,e.filename??`download`)}catch(e){let t=e;D.error(`Failed to download storage entry`,t),xe({title:`Download failed`,description:String(t),variant:`danger`})}},t[31]=n.path,t[32]=i,t[33]=v):v=t[33],C=v,x=m;let b=y&&`font-medium`;t[34]===b?E=t[35]:(E=M(`text-xs flex items-center gap-1.5 cursor-pointer rounded-none group h-6.5`,b),t[34]=b,t[35]=E),t[36]===c?O=t[37]:(O=Wt(c),t[36]=c,t[37]=O),k=`${i}:${r}`,t[38]!==s||t[39]!==S||t[40]!==n||t[41]!==y||t[42]!==i||t[43]!==f||t[44]!==a?(A=()=>{y?g(!S):f({entry:n,namespace:i,protocol:a,backendType:s})},t[38]=s,t[39]=S,t[40]=n,t[41]=y,t[42]=i,t[43]=f,t[44]=a,t[45]=A):A=t[45],t[46]!==S||t[47]!==y?(j=y?(0,$.jsx)(lt,{isExpanded:S,className:`h-3 w-3`}):(0,$.jsx)(`span`,{className:`w-3 shrink-0`}),t[46]=S,t[47]=y,t[48]=j):j=t[48],N=y?(0,$.jsx)(Ge,{className:M(`h-3.5 w-3.5 shrink-0`,it.directory)}):Qe(w),t[0]=s,t[1]=c,t[2]=_,t[3]=n,t[4]=y,t[5]=h,t[6]=i,t[7]=f,t[8]=a,t[9]=r,t[10]=d,t[11]=x,t[12]=S,t[13]=C,t[14]=w,t[15]=T,t[16]=E,t[17]=O,t[18]=k,t[19]=A,t[20]=j,t[21]=N}else x=t[11],S=t[12],C=t[13],w=t[14],T=t[15],E=t[16],O=t[17],k=t[18],A=t[19],j=t[20],N=t[21];let P;t[49]===w?P=t[50]:(P=(0,$.jsx)(`span`,{className:`truncate flex-1 text-left`,children:w}),t[49]=w,t[50]=P);let F;t[51]!==n.size||t[52]!==u?(F=n.size>0&&(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground pr-2 tabular-nums`,children:ie(n.size,u)}),t[51]=n.size,t[52]=u,t[53]=F):F=t[53];let H;t[54]!==n.lastModified||t[55]!==u?(H=n.lastModified!=null&&(0,$.jsx)(V,{content:`Last modified: ${new Date(n.lastModified*1e3).toLocaleString()}`,children:(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground pr-1 whitespace-nowrap`,children:Gt(n.lastModified,u)})}),t[54]=n.lastModified,t[55]=u,t[56]=H):H=t[56];let U;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(R,{asChild:!0,children:(0,$.jsx)(dt,{iconClassName:`h-3 w-3`,onClick:un})}),t[57]=U):U=t[57];let W;t[58]!==s||t[59]!==n||t[60]!==y||t[61]!==i||t[62]!==f||t[63]!==a?(W=!y&&(0,$.jsxs)(I,{onSelect:()=>f({entry:n,namespace:i,protocol:a,backendType:s}),children:[(0,$.jsx)(Mt,{className:`h-3.5 w-3.5 mr-2`}),`View`]}),t[58]=s,t[59]=n,t[60]=y,t[61]=i,t[62]=f,t[63]=a,t[64]=W):W=t[64];let G;t[65]===n.path?G=t[66]:(G=async()=>{await be(n.path),xe({title:`Copied to clipboard`})},t[65]=n.path,t[66]=G);let K;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(oe,{className:Ze}),t[67]=K):K=t[67];let ee;t[68]===G?ee=t[69]:(ee=(0,$.jsxs)(I,{onSelect:G,children:[K,`Copy path`]}),t[68]=G,t[69]=ee);let te;t[70]!==C||t[71]!==y?(te=!y&&(0,$.jsxs)(I,{onSelect:()=>C(),children:[(0,$.jsx)(nt,{className:`h-3.5 w-3.5 mr-2`}),`Download`]}),t[70]=C,t[71]=y,t[72]=te):te=t[72];let ne;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(L,{}),t[73]=ne):ne=t[73];let re;t[74]!==v||t[75]!==s||t[76]!==n||t[77]!==i||t[78]!==a?(re=zt.map(e=>{let t=e.getCode({variableName:i,protocol:a,entry:n,backendType:s});if(t===null)return null;let r=e.icon;return(0,$.jsxs)(I,{onSelect:()=>v(t),children:[(0,$.jsx)(r,{className:Ze}),e.label]},e.id)}),t[74]=v,t[75]=s,t[76]=n,t[77]=i,t[78]=a,t[79]=re):re=t[79];let q;t[80]!==W||t[81]!==ee||t[82]!==te||t[83]!==re?(q=(0,$.jsxs)(B,{children:[U,(0,$.jsxs)(z,{align:`end`,onClick:dn,onCloseAutoFocus:fn,children:[W,ee,te,ne,re]})]}),t[80]=W,t[81]=ee,t[82]=te,t[83]=re,t[84]=q):q=t[84];let ae;t[85]!==q||t[86]!==F||t[87]!==H?(ae=(0,$.jsxs)(`div`,{className:`flex items-center`,children:[F,H,q]}),t[85]=q,t[86]=F,t[87]=H,t[88]=ae):ae=t[88];let J;t[89]!==x||t[90]!==E||t[91]!==ae||t[92]!==O||t[93]!==k||t[94]!==A||t[95]!==j||t[96]!==N||t[97]!==P?(J=(0,$.jsxs)(x,{className:E,style:O,value:k,onSelect:A,children:[j,N,P,ae]}),t[89]=x,t[90]=E,t[91]=ae,t[92]=O,t[93]=k,t[94]=A,t[95]=j,t[96]=N,t[97]=P,t[98]=J):J=t[98];let Y;t[99]!==s||t[100]!==c||t[101]!==S||t[102]!==n.path||t[103]!==y||t[104]!==u||t[105]!==i||t[106]!==f||t[107]!==a||t[108]!==o||t[109]!==d||t[110]!==T?(Y=y&&S&&(0,$.jsx)(on,{namespace:i,protocol:a,rootPath:o,backendType:s,prefix:qt(n.path),depth:c+1,locale:u,searchValue:T?``:d,onOpenFile:f}),t[99]=s,t[100]=c,t[101]=S,t[102]=n.path,t[103]=y,t[104]=u,t[105]=i,t[106]=f,t[107]=a,t[108]=o,t[109]=d,t[110]=T,t[111]=Y):Y=t[111];let se;return t[112]!==J||t[113]!==Y?(se=(0,$.jsxs)($.Fragment,{children:[J,Y]}),t[112]=J,t[113]=Y,t[114]=se):se=t[114],se},cn=e=>{let t=(0,Q.c)(66),{namespace:n,locale:r,searchValue:i,remoteSearch:a,onContinueRemoteSearch:o,onOpenFile:c}=e,[l,u]=(0,Z.useState)(!0),{entriesByPath:d,pageMetadataByPath:h}=b(),{clearNamespaceCache:g}=f(),_=n.name??n.displayName,{entries:v,isPending:y,error:x,hasMore:S,loadMore:C,isLoadingMore:w,loadMoreError:T,refetch:E}=s(_),D;t[0]!==g||t[1]!==_||t[2]!==E?(D=e=>{e.stopPropagation(),g(_),E()},t[0]=g,t[1]=_,t[2]=E,t[3]=D):D=t[3];let O=D,k=y?n.storageEntries:v,A;if(t[4]!==k||t[5]!==d||t[6]!==x||t[7]!==O||t[8]!==S||t[9]!==l||t[10]!==w||t[11]!==y||t[12]!==C||t[13]!==T||t[14]!==r||t[15]!==n.backendType||t[16]!==n.displayName||t[17]!==n.name||t[18]!==n.protocol||t[19]!==n.rootPath||t[20]!==_||t[21]!==o||t[22]!==c||t[23]!==h||t[24]!==a||t[25]!==i){let e=Xt(k,{namespace:_,searchValue:i,entriesByPath:d}),s=nn(i),f=p(_,s),g=s===``?[]:d.get(f)??[],v=Xt(g,{namespace:_,searchValue:i,entriesByPath:d}),b;t[27]===i?b=t[28]:(b=i.trim(),t[27]=i,t[28]=b);let E=!!b,D=e.length>0||v.length>0,j=s!==``&&tn({hasSearch:E,hasLoadedMatches:D,isPending:y,remoteSearch:a,searchKey:f,entriesByPath:d,pageMetadataByPath:h}),M=E&&e.length===0,N;bb0:{if(y&&k.length===0){let e;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(qe,{className:`h-3 w-3 animate-spin`}),`Loading...`]}),t[29]=e):e=t[29],N=e;break bb0}if(a.status===`searching`){let e;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(qe,{className:`h-3 w-3 animate-spin`}),`Searching more entries...`]}),t[30]=e):e=t[30],N=e;break bb0}if(a.status===`error`){let e;t[31]===a.error.message?e=t[32]:(e=(0,$.jsxs)(`span`,{className:`text-destructive`,children:[`Search failed: `,a.error.message]}),t[31]=a.error.message,t[32]=e),N=e;break bb0}if(a.status===`capped`){let e;t[33]===o?e=t[34]:(e=(0,$.jsx)(H,{variant:`text`,size:`xs`,className:`h-5 px-0 text-xs hover:text-blue-600`,onClick:o,children:`Continue searching`}),t[33]=o,t[34]=e);let n;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`span`,{className:`text-[10px]`,children:`(or press Enter)`}),t[35]=n):n=t[35];let r;t[36]===e?r=t[37]:(r=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`Searched more entries.`,e,n]}),t[36]=e,t[37]=r),N=r;break bb0}if(a.status===`exhausted`&&!D){N=`No matches`;break bb0}if(!E&&!y&&k.length===0){N=`No entries`;break bb0}if(j){let e;t[38]===o?e=t[39]:(e=(0,$.jsx)(H,{variant:`text`,size:`xs`,className:`h-5 px-0 text-xs hover:text-blue-600`,onClick:o,children:`Search more entries`}),t[38]=o,t[39]=e);let n;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`span`,{className:`text-[10px]`,children:`(or press Enter)`}),t[40]=n):n=t[40];let r;t[41]===e?r=t[42]:(r=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`No loaded matches.`,e,n]}),t[41]=e,t[42]=r),N=r;break bb0}if(E&&!D&&k.length>0){N=`No matches`;break bb0}N=null}let P=N,F;t[43]===l?F=t[44]:(F=()=>u(!l),t[43]=l,t[44]=F);let I;t[45]===l?I=t[46]:(I=(0,$.jsx)(lt,{isExpanded:l,className:`h-3 w-3`}),t[45]=l,t[46]=I);let L;t[47]===n.protocol?L=t[48]:(L=(0,$.jsx)(q,{protocol:n.protocol}),t[47]=n.protocol,t[48]=L);let R;t[49]===n.displayName?R=t[50]:(R=(0,$.jsx)(`span`,{children:n.displayName}),t[49]=n.displayName,t[50]=R);let z;t[51]===n.name?z=t[52]:(z=n.name&&(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground font-normal`,children:[`(`,(0,$.jsx)(bt,{variableName:n.name}),`)`]}),t[51]=n.name,t[52]=z);let B;t[53]===O?B=t[54]:(B=(0,$.jsx)(at,{onClick:O,tooltip:`Refresh storage connection`,className:`p-0`,iconClassName:`h-3 w-3`}),t[53]=O,t[54]=B);let V=n.rootPath||`(root)`,U;t[55]===V?U=t[56]:(U=(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground font-normal tabular-nums ml-auto`,children:V}),t[55]=V,t[56]=U);let W;t[57]!==n.name||t[58]!==B||t[59]!==U||t[60]!==F||t[61]!==I||t[62]!==L||t[63]!==R||t[64]!==z?(W=(0,$.jsxs)(m,{value:n.name,onSelect:F,className:`flex flex-row font-semibold h-7 text-xs gap-1.5 bg-(--slate-2) text-muted-foreground rounded-none`,children:[I,L,R,z,B,U]}),t[57]=n.name,t[58]=B,t[59]=U,t[60]=F,t[61]=I,t[62]=L,t[63]=R,t[64]=z,t[65]=W):W=t[65],A=(0,$.jsxs)($.Fragment,{children:[W,l&&(0,$.jsxs)($.Fragment,{children:[x&&k.length===0&&(0,$.jsx)(Ke,{error:x,style:Wt(1),className:`py-1 text-xs h-auto overflow-auto max-h-32 items-start`,showIcon:!1}),!x&&P&&(0,$.jsx)(`div`,{className:`py-1 text-xs text-muted-foreground italic`,style:Wt(1),children:P}),e.map(e=>{let t=Jt(e,k.indexOf(e));return(0,$.jsx)(sn,{rowKey:t,entry:e,namespace:_,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:r,searchValue:i,onOpenFile:c},t)}),M&&v.map(e=>{let t=Jt(e,g.indexOf(e));return(0,$.jsx)(sn,{rowKey:`remote-search:${t}`,entry:e,namespace:_,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:r,searchValue:i,onOpenFile:c},`remote-search:${t}`)}),S&&!j&&(0,$.jsx)(an,{depth:1,isLoading:w,error:T,onLoadMore:C})]})]}),t[4]=k,t[5]=d,t[6]=x,t[7]=O,t[8]=S,t[9]=l,t[10]=w,t[11]=y,t[12]=C,t[13]=T,t[14]=r,t[15]=n.backendType,t[16]=n.displayName,t[17]=n.name,t[18]=n.protocol,t[19]=n.rootPath,t[20]=_,t[21]=o,t[22]=c,t[23]=h,t[24]=a,t[25]=i,t[26]=A}else A=t[26];return A},ln=()=>{let e=(0,Q.c)(63),{namespaces:t,entriesByPath:n,pageMetadataByPath:r}=b(),{locale:i}=De(),[a,s]=(0,Z.useState)(``),c;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={},e[0]=c):c=e[0];let[l,u]=(0,Z.useState)(c),[d,f]=(0,Z.useState)(null),m=y(),h;e[1]===a?h=e[2]:(h=a.trim(),e[1]=a,e[2]=h);let v=!!h,x;e[3]===a?x=e[4]:(x=a.trim(),e[3]=a,e[4]=x);let S=x,C;e[5]!==S||e[6]!==l?(C=e=>{let t=l[e];return t?.query===S?t:Qt(S)},e[5]=S,e[6]=l,e[7]=C):C=e[7];let w=C,T;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(e,t)=>{u(n=>({...n,[e]:t}))},e[8]=T):T=e[8];let E=T,D;e[9]!==S||e[10]!==n||e[11]!==r||e[12]!==w?(D=e=>{if(!S)return!1;let t=e.name??e.displayName,i=nn(S);if(i===``||!$t(w(t))||Xt(n.get(p(t,``))??e.storageEntries,{namespace:t,searchValue:S,entriesByPath:n}).length>0)return!1;let a=p(t,i);return Xt(n.get(a)??[],{namespace:t,searchValue:S,entriesByPath:n}).length>0?!1:en(a,n,r)},e[9]=S,e[10]=n,e[11]=r,e[12]=w,e[13]=D):D=e[13];let O=D,k;e[14]!==O||e[15]!==S||e[16]!==n||e[17]!==m||e[18]!==r?(k=async e=>{if(!O(e))return;let t=S,i=e.name??e.displayName,a=nn(t),o=p(i,a),s=n.get(o),c=r.get(o)?.nextPageToken??null,l=s!==void 0;E(i,{query:t,status:`searching`});try{for(let e=0;e<Zt;e++){let e=!l||c!==null,n=[];if(e){let e=await m({namespace:i,prefix:a,pageToken:c,append:l});n=e.entries,c=e.next_page_token??null,l=!0}if((e?n:s??[]).some(e=>rn(e,t))){E(i,{query:t,status:`found`});return}if(c===null){E(i,{query:t,status:`exhausted`});return}}E(i,{query:t,status:`capped`})}catch(e){let n=e;E(i,{query:t,status:`error`,error:n instanceof Error?n:Error(String(n))})}},e[14]=O,e[15]=S,e[16]=n,e[17]=m,e[18]=r,e[19]=k):k=e[19];let A=k,j;e[20]!==O||e[21]!==A||e[22]!==t?(j=()=>{let e=t.filter(O);for(let t of e)A(t)},e[20]=O,e[21]=A,e[22]=t,e[23]=j):j=e[23];let N=j;if(t.length===0){let t;return e[24]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(mt,{title:`No storage connected`,description:(0,$.jsxs)(`span`,{children:[`Create an obstore or fsspec connection in your notebook. See the`,` `,(0,$.jsx)(`a`,{className:`text-link`,href:`https://docs.marimo.io/guides/working_with_data/remote_storage/#quick-start`,target:`_blank`,rel:`noopener noreferrer`,children:`docs`}),`.`]}),action:(0,$.jsx)(vt,{group:`storage`,label:`Add remote storage`,variant:`outline`,size:`sm`}),icon:(0,$.jsx)(re,{className:`h-8 w-8`})}),e[24]=t):t=e[24],t}let P;e[25]===d?P=e[26]:(P=d&&(0,$.jsx)(Ht,{entry:d.entry,namespace:d.namespace,protocol:d.protocol,backendType:d.backendType,onBack:()=>f(null)}),e[25]=d,e[26]=P);let F=d&&`hidden`,I;e[27]===F?I=e[28]:(I=M(`border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden scrollbar-thin`,F),e[27]=F,e[28]=I);let L;e[29]!==O||e[30]!==N||e[31]!==t?(L=e=>{e.key===`Enter`&&t.some(O)&&(e.preventDefault(),N())},e[29]=O,e[30]=N,e[31]=t,e[32]=L):L=e[32];let R;e[33]!==a||e[34]!==L?(R=(0,$.jsx)(_,{placeholder:`Search entries...`,className:`h-6 m-1`,value:a,onValueChange:s,onKeyDown:L,rootClassName:`flex-1 border-b-0`}),e[33]=a,e[34]=L,e[35]=R):R=e[35];let z;e[36]===v?z=e[37]:(z=v&&(0,$.jsx)(H,{variant:`text`,size:`xs`,className:`float-right border-none px-2 m-0 h-full`,onClick:()=>s(``),children:(0,$.jsx)(te,{className:`h-4 w-4`})}),e[36]=v,e[37]=z);let B,U;e[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(V,{content:`Search by file name within loaded entries, or by prefix (e.g. 'folder/x') for backend search. Press Enter to fetch more results.`,delayDuration:200,children:(0,$.jsx)(J,{className:`h-3.5 w-3.5 shrink-0 cursor-help text-muted-foreground hover:text-foreground mr-2`})}),U=(0,$.jsx)(vt,{group:`storage`,label:`Add remote storage`,compact:!0,variant:`ghost`,size:`sm`,className:`px-2 border-0 border-l border-muted-background rounded-none focus-visible:ring-0 focus-visible:ring-offset-0`}),e[38]=B,e[39]=U):(B=e[38],U=e[39]);let W;e[40]!==R||e[41]!==z?(W=(0,$.jsxs)(`div`,{className:`flex items-center w-full border-b`,children:[R,z,B,U]}),e[40]=R,e[41]=z,e[42]=W):W=e[42];let G;if(e[43]!==A||e[44]!==i||e[45]!==t||e[46]!==w||e[47]!==a){let n;e[49]!==A||e[50]!==i||e[51]!==w||e[52]!==a?(n=e=>{let t=e.name??e.displayName;return(0,$.jsx)(cn,{namespace:e,locale:i,searchValue:a,remoteSearch:w(t),onContinueRemoteSearch:()=>void A(e),onOpenFile:f},t)},e[49]=A,e[50]=i,e[51]=w,e[52]=a,e[53]=n):n=e[53],G=t.map(n),e[43]=A,e[44]=i,e[45]=t,e[46]=w,e[47]=a,e[48]=G}else G=e[48];let K;e[54]===G?K=e[55]:(K=(0,$.jsx)(o,{className:`flex flex-col`,children:G}),e[54]=G,e[55]=K);let ee;e[56]!==I||e[57]!==W||e[58]!==K?(ee=(0,$.jsxs)(g,{className:I,shouldFilter:!1,children:[W,K]}),e[56]=I,e[57]=W,e[58]=K,e[59]=ee):ee=e[59];let ne;return e[60]!==ee||e[61]!==P?(ne=(0,$.jsxs)(`div`,{className:`h-full flex flex-col`,children:[P,ee]}),e[60]=ee,e[61]=P,e[62]=ne):ne=e[62],ne};function un(e){return e.stopPropagation()}function dn(e){return e.stopPropagation()}function fn(e){return e.preventDefault()}var pn=(0,Z.createContext)(null);function mn(){return(0,Z.useContext)(pn)??void 0}var hn=e=>{let t=(0,Q.c)(3),{children:n}=e,r=he(),i;return t[0]!==n||t[1]!==r?(i=(0,$.jsx)(pn.Provider,{value:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i},gn=e=>{let t=(0,Q.c)(5),{children:n}=e,[r,i]=(0,Z.useState)(null),a;t[0]!==n||t[1]!==r?(a=r&&(0,$.jsx)(X,{backend:ue,options:{rootElement:r},children:(0,$.jsx)(hn,{children:n})}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;return t[3]===a?o=t[4]:(o=(0,$.jsx)(`div`,{ref:i,className:`contents`,children:a}),t[3]=a,t[4]=o),o},_n=e(C(),1),vn=200;function yn({query:e,tree:t,showHiddenFiles:n}){let{sendSearchFiles:r}=Te(),i=Oe(e,300),a=(0,Z.useRef)(Promise.resolve()),[o,s]=(0,Z.useState)(0),c=(0,Z.useCallback)(()=>s(e=>e+1),[]),[l,u]=(0,Z.useState)({status:`idle`});return(0,Z.useEffect)(()=>{let o=!1;if(!e||e!==i)return;u({status:`loading`,query:e});let s=a.current.then(async()=>{let i=new Map,a=!1,s=0,c=t.getRoots();for(let t of c){if(o)return;try{let o=await r({query:e,path:t.path,includeFiles:!0,includeDirectories:!0,includeHidden:n,depth:20,limit:vn});a||=o.files.length>=vn;for(let e of o.files){let n=i.get(e.path);n&&(!t.isPrimary||n.isPrimaryRoot)||i.set(e.path,{...e,id:pe(t.path,e.path),children:[],isRoot:!1,rootPath:t.path,isPrimaryRoot:t.isPrimary})}}catch{s+=1}}if(!o){if(c.length>0&&s===c.length){u({status:`error`,query:e,error:Error(`Could not search any root`)});return}let t=t=>{let n=t.name.toLowerCase(),r=e.toLowerCase();return n===r?0:n.startsWith(r)?1:2},n=[...i.values()].toSorted((e,n)=>t(e)-t(n)||e.name.localeCompare(n.name));u({status:`success`,isPartial:s>0,query:e,files:n.slice(0,vn),hasMore:a||n.length>vn})}});return a.current=s.catch(t=>{o||u({status:`error`,query:e,error:t})}),()=>{o=!0}},[e,i,t,n,o,r]),e?e!==i||l.status===`idle`||l.query!==e?{state:{status:`loading`,query:e},refetch:c}:{state:l,refetch:c}:{state:{status:`idle`},refetch:c}}function bn(e,t){let n=(0,Q.c)(7),r=e.tree,i=(0,Z.useRef)(null),a,o;n[0]!==t||n[1]!==e.data.isDirectory||n[2]!==e.id||n[3]!==e.isOpen||n[4]!==r?(a=()=>{if(!t){i.current=null;return}if(!e.data.isDirectory||e.isOpen||i.current===e.id)return;let n=window.setTimeout(()=>{i.current=e.id,r.open(e.id)},600);return()=>window.clearTimeout(n)},o=[t,e.data.isDirectory,e.isOpen,e.id,r],n[0]=t,n[1]=e.data.isDirectory,n[2]=e.id,n[3]=e.isOpen,n[4]=r,n[5]=a,n[6]=o):(a=n[5],o=n[6]),(0,Z.useEffect)(a,o)}async function xn(e,t){if(!j()){let n=A().formatNavigableHttpURL(`api/files/download`,new URLSearchParams({path:e}));Me(n.toString(),t);return}let n=await Ee().sendFileDetails({path:e});if(n.isBase64&&n.contents){let e=et(Je(n.contents,n.mimeType||`application/octet-stream`));pt(e,t)}else pt(new Blob([n.contents||``],{type:n.mimeType||`application/octet-stream`}),t)}var Sn=e=>{let t=(0,Q.c)(21),{file:n,mimeType:r,message:i,onDownload:a}=e,{locale:o}=De(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Path`}),t[0]=s):s=t[0];let c;t[1]===n.path?c=t[2]:(c=(0,$.jsx)(`span`,{className:`font-mono text-xs break-all`,children:n.path}),t[1]=n.path,t[2]=c);let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Type`}),t[3]=l):l=t[3];let u;t[4]===r?u=t[5]:(u=(0,$.jsx)(`span`,{children:r}),t[4]=r,t[5]=u);let d;t[6]!==n.size||t[7]!==o?(d=n.size!=null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Size`}),(0,$.jsx)(`span`,{children:ie(n.size,o)})]}),t[6]=n.size,t[7]=o,t[8]=d):d=t[8];let f;t[9]!==c||t[10]!==u||t[11]!==d?(f=(0,$.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-2`,children:[s,c,l,u,d]}),t[9]=c,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;t[13]===i?p=t[14]:(p=(0,$.jsx)(`div`,{className:`mt-4 text-muted-foreground italic`,children:i}),t[13]=i,t[14]=p);let m;t[15]===a?m=t[16]:(m=a&&(0,$.jsxs)(H,{variant:`outline`,size:`sm`,className:`mt-4`,onClick:a,children:[(0,$.jsx)(nt,{className:`h-3.5 w-3.5 mr-2`}),`Download`]}),t[15]=a,t[16]=m);let h;return t[17]!==f||t[18]!==p||t[19]!==m?(h=(0,$.jsxs)(`div`,{className:`p-4 text-sm`,children:[f,p,m]}),t[17]=f,t[18]=p,t[19]=m,t[20]=h):h=t[20],h};function Cn(e,t){let n=e||`text/plain`;return He(n)?`media`:t?`unsupported`:n===`text/csv`?`csv`:n.startsWith(`text/`)||n!=="default"&&n in Ie||e==null?`text`:`unsupported`}var wn=10485760,Tn=new Map,En=({file:e,onOpenNotebook:t})=>{let{sendFileDetails:n,sendUpdateFile:i}=Te(),a=r(T),o=r(E),s=r(S),[c,l]=(0,Z.useState)(``),{data:u,isPending:d,error:f,setData:p,refetch:m}=ke(async()=>{let t=await n({path:e.path,maxBytes:wn}),r=Cn(t.mimeType,t.isBase64);if(!t.isTooLarge&&r===`text`){let n=t.contents||``;l(Tn.get(e.path)??n)}return t},[e.path]),h=async()=>{c!==u?.contents&&await i({path:e.path,contents:c}).then(e=>{e.success&&(p(e=>({...e,contents:c})),l(c))})},g=(0,Z.useRef)(c);if(g.current=c,(0,Z.useEffect)(()=>()=>{if(u?.contents==null||u.isTooLarge||Cn(u.mimeType,u.isBase64)!==`text`)return;let t=g.current;t===u.contents?Tn.delete(e.path):Tn.set(e.path,t)},[e.path,u?.contents,u?.isTooLarge,u?.mimeType,u?.isBase64]),f)return(0,$.jsx)(Re,{error:f});if(d||!u)return null;let _=u.mimeType||`text/plain`,v=Cn(u.mimeType,u.isBase64),y=v===`text`,b=v===`csv`,x=v===`media`,C=s&&u.file.isMarimoFile&&(e.path===s||e.path.endsWith(`/${s}`)),w=async()=>{await xn(e.path,u.file.name)},D=Ce.of([{key:a.getHotkey(`global.save`).key,stopPropagation:!0,run:()=>c!==u.contents&&(h(),!0)}]),O=(0,$.jsx)(Nt,{filename:u.file.name,onRefresh:m,onDownload:o?void 0:w,actions:(0,$.jsxs)($.Fragment,{children:[u.file.isMarimoFile&&t&&!j()&&(0,$.jsx)(V,{content:`Open notebook`,children:(0,$.jsx)(H,{variant:`text`,size:`xs`,"aria-label":`Open notebook`,onClick:e=>t(e),children:(0,$.jsx)(Pe,{className:`h-3.5 w-3.5`})})}),y&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(V,{content:`Copy contents to clipboard`,children:(0,$.jsx)(H,{variant:`text`,size:`xs`,onClick:async()=>{await be(c)},children:(0,$.jsx)(oe,{className:`h-3.5 w-3.5`})})}),(0,$.jsx)(V,{content:Fe(`global.save`),children:(0,$.jsx)(H,{variant:`text`,size:`xs`,onClick:h,disabled:c===u.contents,children:(0,$.jsx)(ae,{className:`h-3.5 w-3.5`})})})]})]})});if(u.isTooLarge||v===`unsupported`)return(0,$.jsxs)($.Fragment,{children:[O,(0,$.jsx)(Sn,{file:u.file,mimeType:_,message:u.isTooLarge?`File is too large to preview.`:`This file type cannot be previewed.`,onDownload:o?void 0:w})]});let k=y&&C&&(0,$.jsxs)(ze,{variant:`warning`,className:`rounded-none`,children:[(0,$.jsx)(ut,{className:`h-4 w-4`}),(0,$.jsx)(Ve,{children:`Editing the notebook file directly while running in marimo's editor may cause unintended changes. Please use with caution.`})]}),A=x&&u.contents?Be({contents:u.contents,mimeType:_,isBase64:u.isBase64??!1}):void 0;return(0,$.jsxs)($.Fragment,{children:[O,k,(0,$.jsx)(Ue,{mimeType:_,filename:u.file.name,contents:y?c:b?u.contents??void 0:void 0,mediaSource:A,readOnly:!y,onChange:y?l:void 0,extensions:y?[D]:[]})]})};function Dn({node:e,attrs:t,innerRef:n,children:r,ariaLabel:i=e.data.name}){return(0,$.jsx)(`div`,{...t,ref:n,"aria-label":i,"aria-expanded":e.isInternal?e.isOpen:void 0,onFocus:n=>{n.stopPropagation(),t.onFocus?.(n),n.target===n.currentTarget&&!e.isFocused&&e.focus()},onClick:n=>{t.onClick?t.onClick(n):e.select(),n.defaultPrevented||n.currentTarget.focus({preventScroll:!0})},children:r})}function On(e){let t=(0,Q.c)(25),{treeRef:n,search:r,height:i,onReveal:a}=e,o=mn(),{state:s,refetch:c}=r;if(s.status===`idle`)return null;if(s.status===`error`){let e;return t[0]===c?e=t[1]:(e=(0,$.jsxs)(`div`,{role:`alert`,className:`px-3 py-2 text-sm`,children:[`Could not search files.`,` `,(0,$.jsx)(`button`,{type:`button`,className:`underline`,onClick:c,children:`Retry`})]}),t[0]=c,t[1]=e),e}if(s.status===`loading`){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 px-3 py-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(Xe,{size:`small`}),`Searching files…`]}),t[2]=e):e=t[2],e}let{files:l,hasMore:u,isPartial:d}=s,f=l.length,p;t[3]===n?p=t[4]:(p=e=>{e.key===`Enter`&&e.target instanceof HTMLElement&&e.target.closest(`[role="tree"]`)&&(e.preventDefault(),e.stopPropagation(),n.current?.focusedNode?.activate())},t[3]=n,t[4]=p);let m;t[5]!==d||t[6]!==c?(m=d&&(0,$.jsxs)(`div`,{role:`alert`,className:`px-3 py-2 text-xs text-muted-foreground`,children:[`Some locations could not be searched.`,` `,(0,$.jsx)(`button`,{type:`button`,className:`underline`,onClick:c,children:`Retry`})]}),t[5]=d,t[6]=c,t[7]=m):m=t[7];let h=l.length?`${f} ${f===1?`match`:`matches`}`:`No matching files or folders.`,g=u&&` · Refine your search for more results.`,_;t[8]!==h||t[9]!==g?(_=(0,$.jsxs)(`p`,{role:`status`,className:`px-3 py-2 text-xs text-muted-foreground`,children:[h,g]}),t[8]=h,t[9]=g,t[10]=_):_=t[10];let v=Math.max(0,i-48-(d?48:0)),y;t[11]===a?y=t[12]:(y=e=>{a(e.data)},t[11]=a,t[12]=y);let b;t[13]!==o||t[14]!==l||t[15]!==v||t[16]!==y||t[17]!==n?(b=(0,$.jsx)(ve,{ref:n,data:l,childrenAccessor:kn,width:`100%`,height:v,rowHeight:48,overscanCount:8,dndManager:o,disableDrag:!0,disableDrop:!0,disableEdit:!0,disableMultiSelection:!0,selectionFollowsFocus:!0,rowClassName:`outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring`,renderRow:An,onActivate:y,children:jn}),t[13]=o,t[14]=l,t[15]=v,t[16]=y,t[17]=n,t[18]=b):b=t[18];let x;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(`p`,{className:`px-3 text-xs text-muted-foreground`,children:`Enter or double-click to open · Esc to clear`}),t[19]=x):x=t[19];let S;return t[20]!==p||t[21]!==m||t[22]!==_||t[23]!==b?(S=(0,$.jsxs)(`div`,{onKeyDownCapture:p,children:[m,_,b,x]}),t[20]=p,t[21]=m,t[22]=_,t[23]=b,t[24]=S):S=t[24],S}function kn(){return null}function An(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(Dn,{...e,ariaLabel:e.node.data.path}),t[0]=e,t[1]=n),n}function jn(e){let t=(0,Q.c)(19),{node:n}=e,r=n.data.isDirectory?Ge:Ne,i=n.isSelected&&`bg-accent/60`,a;t[0]===i?a=t[1]:(a=M(`flex h-full items-start gap-2.5 px-3 py-1 cursor-pointer hover:bg-accent/50`,i),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=e=>{e.stopPropagation(),n.activate()},t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=(0,$.jsx)(r,{className:`mt-0.5 h-4 w-4 shrink-0 text-muted-foreground`}),t[4]=r,t[5]=s);let c;t[6]===n.data.name?c=t[7]:(c=(0,$.jsx)(`div`,{className:`truncate text-sm leading-5`,children:n.data.name}),t[6]=n.data.name,t[7]=c);let l;t[8]===n.data.path?l=t[9]:(l=(0,$.jsx)(`div`,{className:`truncate text-xs leading-4 text-muted-foreground`,children:n.data.path}),t[8]=n.data.path,t[9]=l);let u;t[10]!==c||t[11]!==l?(u=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[c,l]}),t[10]=c,t[11]=l,t[12]=u):u=t[12];let d;return t[13]!==n.data.path||t[14]!==a||t[15]!==o||t[16]!==s||t[17]!==u?(d=(0,$.jsxs)(`div`,{className:a,onDoubleClick:o,title:n.data.path,children:[s,u]}),t[13]=n.data.path,t[14]=a,t[15]=o,t[16]=s,t[17]=u,t[18]=d):d=t[18],d}function Mn(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=e.node.data.isDirectory?(0,$.jsx)(Nn,{...e}):(0,$.jsx)(Dn,{...e}),t[0]=e,t[1]=n),n}function Nn(e){let t=(0,Q.c)(15),{node:n}=e,r=n.tree,i=(0,Z.useRef)(null),a;t[0]!==n||t[1]!==r?(a=()=>({accept:`NODE`,canDrop:()=>r.canDrop(),collect:Pn,hover:()=>{(r.state.dnd.parentId!==n.id||r.state.dnd.index!==null)&&r.dispatch({type:`DND_HOVERING`,parentId:n.id,index:null}),r.canDrop()||r.hideCursor()},drop:()=>{r.canDrop()&&(r.props.onMove?.({dragIds:r.state.dnd.dragIds,dragNodes:r.dragNodes,parentId:n.id,parentNode:n,index:0}),r.open(n.id))}}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;t[3]!==n.id||t[4]!==r?(o=[r,n.id],t[3]=n.id,t[4]=r,t[5]=o):o=t[5];let[s,c]=de(a,o),{isHovering:l}=s;bn(n,l);let u,d;t[6]!==n.isEditing||t[7]!==n.isFocused?(u=()=>{n.isFocused&&!n.isEditing&&i.current?.focus({preventScroll:!0})},d=[n.isFocused,n.isEditing],t[6]=n.isEditing,t[7]=n.isFocused,t[8]=u,t[9]=d):(u=t[8],d=t[9]),(0,Z.useEffect)(u,d);let f;t[10]===c?f=t[11]:(f=e=>{i.current=e,c(e)},t[10]=c,t[11]=f);let p;return t[12]!==e||t[13]!==f?(p=(0,$.jsx)(Dn,{...e,innerRef:f}),t[12]=e,t[13]=f,t[14]=p):p=t[14],p}function Pn(e){return{isHovering:e.isOver({shallow:!0})&&e.canDrop()}}var Fn=n(e=>{let t=e(we);return O(t,`no requestClientAtom set`),new le({getRoots:t.getFileRoots,listFiles:t.sendListFiles,createFileOrFolder:t.sendCreateFileOrFolder,deleteFileOrFolder:t.sendDeleteFileOrFolder,copyFileOrFolder:t.sendCopyFileOrFolder,renameFileOrFolder:t.sendRenameFileOrFolder})}),In=n({}),Ln=` `,Rn={directory:e=>`os.listdir("${e}")`,python:e=>`with open("${e}", "r") as _f:\n${Ln}...\n`,json:e=>`with open("${e}", "r") as _f:\n${Ln}_data = json.load(_f)\n`,code:e=>`with open("${e}", "r") as _f:\n${Ln}...\n`,text:e=>`with open("${e}", "r") as _f:\n${Ln}...\n`,image:e=>`mo.image("${e}")`,audio:e=>`mo.audio("${e}")`,video:e=>`mo.video("${e}")`,pdf:e=>`with open("${e}", "rb") as _f:\n${Ln}...\n`,zip:e=>`with open("${e}", "rb") as _f:\n${Ln}...\n`,data:e=>`with open("${e}", "r") as _f:\n${Ln}...\n`,unknown:e=>`with open("${e}", "r") as _f:\n${Ln}...\n`},zn=104857600,Bn=5,Vn=`data-file-explorer-directory-path`;function Hn(e){let{destinationPath:t,getDestinationLabel:n=e=>e,onUploadStart:r,refreshDestination:i,...a}=e,{sendCreateFileOrFolder:o}=Te();return rt({multiple:!0,maxSize:zn,...a,onError:e=>{D.error(e),xe({title:`File upload failed`,description:e.message,variant:`danger`})},onDropRejected:e=>{xe({title:`File upload failed`,description:(0,$.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.map(e=>(0,$.jsxs)(`div`,{children:[e.file.name,` (`,e.errors.map(e=>e.message).join(`, `),`)`]},e.file.name))}),variant:`danger`})},onDrop:async(e,a,s)=>{if(e.length===0)return;let c=typeof t==`function`?t(s):t,l=n(c),u=e.length===1?`Uploading file to ${l}...`:`Uploading files to ${l}...`;r?.(c,e);let d;try{d=await Le(u,async t=>(t.addTotal(e.length),Un({files:e,destinationPath:c,createFile:o,onFileProcessed:()=>t.increment(1)})))}catch{await i(c);return}await i(c),Kn(d,l)}})}async function Un({files:e,destinationPath:t,createFile:n,onFileProcessed:r}){let i=await Ye(e,Bn,async e=>{try{return{file:e,response:await n({path:Wn({destinationPath:t,filePath:Jn(qn(e))}),type:`file`,name:e.name,file:e})}}catch(t){return{file:e,response:{success:!1,message:Ae(t)}}}finally{r?.()}});return{successful:i.filter(({response:e})=>e.success),failed:i.filter(({response:e})=>!e.success)}}function Wn({destinationPath:e,filePath:t}){if(!t)return e;if(W.isAbsolute(t))throw Error(`Upload path must be relative: ${t}`);let n=t.split(/[\\/]+/).slice(0,-1).filter(Boolean);if(n.includes(`..`))throw Error(`Upload path cannot contain parent traversal: ${t}`);let r=n.filter(e=>e!==`.`);if(r.length===0)return e;let i=G.guessDeliminator(e),a=r.join(i.deliminator);return i.join(e,a)}function Gn(e,t){return e instanceof Element&&e.closest(`[${Vn}]`)?.getAttribute(Vn)||t}function Kn(e,t){let n=e.successful.length+e.failed.length;if(e.failed.length>0){let r;r=e.successful.length===0?n===1?`File upload failed`:`Files failed to upload`:`${e.successful.length} of ${n} files uploaded`,xe({title:r,description:(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{children:[`Destination: `,t,`.`]}),e.failed.map(({file:e,response:t},n)=>(0,$.jsxs)(`div`,{children:[e.name,`:`,` `,t.message||`The server rejected the upload.`]},`${e.name}-${n}`))]}),variant:`danger`});return}let r=e.successful.filter(({file:e,response:t})=>t.info?.name&&t.info.name!==e.name);xe({title:n===1?`File uploaded`:`${n} files uploaded`,description:r.length===0?`Uploaded to ${t}.`:(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{children:[`Uploaded to `,t,`.`]}),r.map(({file:e,response:t},n)=>(0,$.jsxs)(`div`,{children:[e.name,` was saved as `,t.info?.name,`.`]},`${e.name}-${n}`))]})})}function qn(e){if(e.webkitRelativePath)return e.webkitRelativePath;if(`path`in e&&typeof e.path==`string`)return e.path;if(`relativePath`in e&&typeof e.relativePath==`string`)return e.relativePath}function Jn(e){if(e)return e.replace(/^\/+/,``)}var Yn=k(`marimo:showHiddenFiles`,!0,u,{getOnInit:!0}),Xn=Z.createContext(null),Zn=e=>{let n=(0,Q.c)(161),{height:r,externalDropDestinationPath:a}=e,o=a===void 0?null:a,s=(0,Z.useRef)(null),c=(0,Z.useRef)(null),l=(0,Z.useRef)(null),[u,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(null),m=mn(),[h]=t(Fn),g;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],n[0]=g):g=n[0];let[_,v]=(0,Z.useState)(g),[y,b]=(0,Z.useState)(null),[x,S]=(0,Z.useState)(null),[C,w]=t(Yn),T;n[1]===u?T=n[2]:(T=u.trim(),n[1]=u,n[2]=T);let E;n[3]!==C||n[4]!==T||n[5]!==h?(E={query:T,tree:h,showHiddenFiles:C},n[3]=C,n[4]=T,n[5]=h,n[6]=E):E=n[6];let D=yn(E),[O,k]=t(In),A;n[7]===h?A=n[8]:(A=e=>h.refreshPath(e),n[7]=h,n[8]=A);let j=i(A),M=(0,Z.useRef)(``),N;n[9]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>M.current,n[9]=N):N=n[9];let P;n[10]===h?P=n[11]:(P=e=>ir(h,e),n[10]=h,n[11]=P);let I;n[12]!==j||n[13]!==P?(I={noClick:!0,noDrag:!0,noKeyboard:!0,destinationPath:N,getDestinationLabel:P,refreshDestination:j},n[12]=j,n[13]=P,n[14]=I):I=n[14];let{getInputProps:L,open:R}=Hn(I),z;n[15]===R?z=n[16]:(z=e=>{M.current=e,R()},n[15]=R,n[16]=z);let B=i(z),{openPrompt:V,openConfirm:U}=se(),W;n[17]===h?W=n[18]:(W=()=>h.initialize(v),n[17]=h,n[18]=W);let G;n[19]===Symbol.for(`react.memo_cache_sentinel`)?(G=[],n[19]=G):G=n[19];let{isPending:ee,error:ne}=ke(W,G),re;n[20]!==O||n[21]!==D||n[22]!==h?(re=async()=>{await h.refreshAll(Object.keys(O).filter(e=>O[e])),D.refetch()},n[20]=O,n[21]=D,n[22]=h,n[23]=re):re=n[23];let ie=i(re),q;n[24]!==w||n[25]!==C?(q=()=>{w(!C)},n[24]=w,n[25]=C,n[26]=q):q=n[26];let ae=i(q),J;n[27]!==V||n[28]!==x?.id||n[29]!==h?(J=async()=>{V({title:`Folder name`,onConfirm:async e=>{h.createFolder(e,x?.id??null)}})},n[27]=V,n[28]=x?.id,n[29]=h,n[30]=J):J=n[30];let oe=i(J),Y;n[31]!==V||n[32]!==x?.id||n[33]!==h?(Y=async()=>{V({title:`File name`,onConfirm:async e=>{h.createFile({name:e,parentId:x?.id??null})}})},n[31]=V,n[32]=x?.id,n[33]=h,n[34]=Y):Y=n[34];let ce=i(Y),le;n[35]!==V||n[36]!==x?.id||n[37]!==h?(le=async()=>{V({title:`Notebook name`,onConfirm:async e=>{h.createFile({name:e,parentId:x?.id??null,type:`notebook`})}})},n[35]=V,n[36]=x?.id,n[37]=h,n[38]=le):le=n[38];let ue=i(le),de;n[39]===k?de=n[40]:(de=()=>{s.current?.closeAll(),k({})},n[39]=k,n[40]=de);let fe=i(de),pe;n[41]!==_||n[42]!==C?(pe=ar(_,C),n[41]=_,n[42]=C,n[43]=pe):pe=n[43];let X=pe,me,he;n[44]!==x||n[45]!==X?(me=()=>{x&&!sr(X,x.id)&&S(null)},he=[x,X],n[44]=x,n[45]=X,n[46]=me,n[47]=he):(me=n[46],he=n[47]),Z.useEffect(me,he);let ge;n[48]!==o||n[49]!==B||n[50]!==h?(ge={tree:h,uploadFiles:B,externalDropDestinationPath:o},n[48]=o,n[49]=B,n[50]=h,n[51]=ge):ge=n[51];let _e=ge,be;n[52]!==y||n[53]!==u||n[54]!==f?(be=()=>{if(f&&!y){let e=u.trim()?c.current:s.current;e?.openParents(f),e?.select(f);let t=e?.get(f);t?.data.isDirectory&&t.open(),p(null)}},n[52]=y,n[53]=u,n[54]=f,n[55]=be):be=n[55];let xe;n[56]!==_||n[57]!==y||n[58]!==u||n[59]!==f?(xe=[f,u,y,_],n[56]=_,n[57]=y,n[58]=u,n[59]=f,n[60]=xe):xe=n[60],Z.useEffect(be,xe);let Se;n[61]===h?Se=n[62]:(Se=async e=>{if(!e.isDirectory){b(e);return}await h.reveal(e)&&(d(``),p(e.id))},n[61]=h,n[62]=Se);let Ce=Se,we;n[63]===u?we=n[64]:(we=e=>{if((e.ctrlKey||e.metaKey)&&e.key===`f`){e.preventDefault(),e.stopPropagation(),l.current?.focus(),l.current?.select();return}if(e.key===`Escape`&&u){e.preventDefault(),e.stopPropagation(),d(``),l.current?.focus();return}let t=e.target instanceof Element?e.target.getAttribute(`role`):null;if(u.trim()||t!==`treeitem`&&t!==`tree`)return;let n=s.current?.focusedNode;!n||s.current?.isEditing||(e.key===`Enter`?(e.preventDefault(),e.stopPropagation(),n.data.isDirectory?n.toggle():n.activate()):e.key===`F2`&&!n.data.isRoot?(e.preventDefault(),e.stopPropagation(),n.edit()):(e.key===`Delete`||e.key===`Backspace`)&&(e.preventDefault(),e.stopPropagation(),n.data.isRoot||n.tree.delete(n.id)))},n[63]=u,n[64]=we);let Te=we;if(ee){let e;return n[65]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Xe,{size:`medium`,centered:!0}),n[65]=e):e=n[65],e}if(ne){let e;return n[66]===ne?e=n[67]:(e=(0,$.jsx)(Re,{error:ne}),n[66]=ne,n[67]=e),e}let Ee;n[68]!==y||n[69]!==h?(Ee=y?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center pl-1 pr-3 shrink-0 border-b justify-between`,children:[(0,$.jsx)(H,{autoFocus:!0,"aria-label":`Back to files`,onClick:()=>{p(y.id),b(null)},"data-testid":`file-explorer-back-button`,variant:`text`,size:`xs`,className:`mb-0`,children:(0,$.jsx)(K,{size:16})}),(0,$.jsx)(`span`,{className:`font-bold`,children:y.name})]}),(0,$.jsx)(Z.Suspense,{children:(0,$.jsx)(En,{onOpenNotebook:h.isPrimaryNode(y)?e=>{let t=h.getPrimaryRelativePath(y.path);t!==null&&rr(e,t)}:void 0,file:y})})]}):null,n[68]=y,n[69]=h,n[70]=Ee):Ee=n[70];let De=Ee,Oe=!!y,Ae;n[71]===L?Ae=n[72]:(Ae=L(),n[71]=L,n[72]=Ae);let je;n[73]===Ae?je=n[74]:(je=(0,$.jsx)(`input`,{"data-testid":`file-explorer-upload-input`,...Ae}),n[73]=Ae,n[74]=je);let Me;n[75]!==x?.path||n[76]!==h?(Me=x?.path??h.getPrimaryRootPath(),n[75]=x?.path,n[76]=h,n[77]=Me):Me=n[77];let Ne;n[78]!==x?.path||n[79]!==h?(Ne=x?.path??h.getPrimaryRootPath(),n[78]=x?.path,n[79]=h,n[80]=Ne):Ne=n[80];let Pe;n[81]!==Ne||n[82]!==h?(Pe=ir(h,Ne),n[81]=Ne,n[82]=h,n[83]=Pe):Pe=n[83];let Fe;n[84]!==fe||n[85]!==ce||n[86]!==oe||n[87]!==ue||n[88]!==ae||n[89]!==ie||n[90]!==B||n[91]!==C||n[92]!==Me||n[93]!==Pe?(Fe=(0,$.jsx)($n,{onRefresh:ie,onHidden:ae,showHiddenFiles:C,onCreateFile:ce,onCreateNotebook:ue,onCreateFolder:oe,onCollapseAll:fe,uploadDestinationPath:Me,uploadDestinationLabel:Pe,onUpload:B}),n[84]=fe,n[85]=ce,n[86]=oe,n[87]=ue,n[88]=ae,n[89]=ie,n[90]=B,n[91]=C,n[92]=Me,n[93]=Pe,n[94]=Fe):Fe=n[94];let Ie;n[95]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=e=>d(e.target.value),n[95]=Ie):Ie=n[95];let Le;n[96]===u?Le=n[97]:(Le=e=>{let t=u.trim()?c.current:s.current;e.key===`ArrowDown`?(e.preventDefault(),t?.focus(t.firstNode)):e.key===`Enter`&&u.trim()&&(e.preventDefault(),t?.firstNode?.activate())},n[96]=u,n[97]=Le);let ze;n[98]!==u||n[99]!==Le?(ze=(0,$.jsx)(ye,{ref:l,className:`rounded-none pr-6 focus-visible:outline-1 focus-visible:outline-ring/50`,clearable:!1,"aria-label":`Search files and folders`,placeholder:`Search`,title:`Search names in all configured roots, up to 20 folders deep. Generated directories such as node_modules and .git are excluded.`,value:u,onChange:Ie,onKeyDown:Le}),n[98]=u,n[99]=Le,n[100]=ze):ze=n[100];let Be;n[101]===u?Be=n[102]:(Be=u&&(0,$.jsx)(H,{variant:`text`,size:`icon`,className:`absolute right-3 top-1/2 h-5 w-5 -translate-y-1/2`,"aria-label":`Clear search`,onClick:()=>{d(``),l.current?.focus()},children:(0,$.jsx)(te,{className:`h-3 w-3`})}),n[101]=u,n[102]=Be);let Ve;n[103]!==ze||n[104]!==Be?(Ve=(0,$.jsxs)(`div`,{className:`relative -mt-1`,children:[ze,Be]}),n[103]=ze,n[104]=Be,n[105]=Ve):Ve=n[105];let He;n[106]!==Fe||n[107]!==Ve?(He=(0,$.jsxs)(`div`,{children:[Fe,Ve]}),n[106]=Fe,n[107]=Ve,n[108]=He):He=n[108];let Ue;n[109]===u?Ue=n[110]:(Ue=u.trim(),n[109]=u,n[110]=Ue);let We=!Ue,Ge=Math.max(0,r-63),Ke;n[111]!==Ce||n[112]!==D||n[113]!==Ge?(Ke=(0,$.jsx)(On,{treeRef:c,search:D,height:Ge,onReveal:Ce}),n[111]=Ce,n[112]=D,n[113]=Ge,n[114]=Ke):Ke=n[114];let qe;n[115]!==We||n[116]!==Ke?(qe=(0,$.jsx)(`div`,{hidden:We,children:Ke}),n[115]=We,n[116]=Ke,n[117]=qe):qe=n[117];let Je;n[118]===u?Je=n[119]:(Je=u.trim(),n[118]=u,n[119]=Je);let Ye=!!Je,Ze=Math.max(0,r-63),Qe;n[120]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=e=>(0,$.jsx)(cr,{...e,tree:s.current}),n[120]=Qe):Qe=n[120];let $e;n[121]!==U||n[122]!==h?($e=async e=>{let{ids:t}=e;U({title:`Delete file`,description:`Are you sure you want to delete the selected file or folder?`,confirmAction:(0,$.jsx)(F,{onClick:async()=>{for(let e of t)await h.delete(e)},children:`Delete`})})},n[121]=U,n[122]=h,n[123]=$e):$e=n[123];let et,tt;n[124]===h?(et=n[125],tt=n[126]):(et=async e=>{let{id:t,name:n}=e;await h.rename(t,n)},tt=async e=>{let{dragIds:t,parentId:n}=e;await h.move(t,n)},n[124]=h,n[125]=et,n[126]=tt);let nt,rt;n[127]===Symbol.for(`react.memo_cache_sentinel`)?(nt=e=>{let t=e[0];if(!t){S(null);return}if(t.data.isDirectory){S({id:t.id,path:t.data.path});return}S(null)},rt=e=>{e.data.isDirectory||b(e.data)},n[127]=nt,n[128]=rt):(nt=n[127],rt=n[128]);let it;n[129]!==O||n[130]!==k||n[131]!==h?(it=async e=>{if(!(s.current?.isOpen(e)??!(O[e]??!1))){k(t=>({...t,[e]:!1}));return}let t=await h.expand(e);t||s.current?.close(e);let n=t&&(s.current?.isOpen(e)??!1);k(t=>({...t,[e]:n}))},n[129]=O,n[130]=k,n[131]=h,n[132]=it):it=n[132];let at;n[133]!==m||n[134]!==O||n[135]!==Ze||n[136]!==$e||n[137]!==et||n[138]!==tt||n[139]!==it||n[140]!==X?(at=(0,$.jsx)(ve,{width:`100%`,ref:s,height:Ze,className:`h-full`,data:X,childrenAccessor:lr,selectionFollowsFocus:!0,rowClassName:`outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring`,renderRow:Mn,renderDragPreview:Qe,disableEdit:ur,initialOpenState:O,openByDefault:!1,dndManager:m,renderCursor:dr,disableDrag:fr,disableDrop:mr,onDelete:$e,onRename:et,onMove:tt,onSelect:nt,onActivate:rt,onToggle:it,padding:15,rowHeight:30,indent:Qn,overscanCount:8,disableMultiSelection:!0,children:tr}),n[133]=m,n[134]=O,n[135]=Ze,n[136]=$e,n[137]=et,n[138]=tt,n[139]=it,n[140]=X,n[141]=at):at=n[141];let ot;n[142]!==_e||n[143]!==at?(ot=(0,$.jsx)(Xn,{value:_e,children:at}),n[142]=_e,n[143]=at,n[144]=ot):ot=n[144];let st;n[145]===X.length?st=n[146]:(st=!X.length&&(0,$.jsx)(`p`,{role:`status`,className:`absolute top-2 left-3 text-sm text-muted-foreground`,children:`No visible files.`}),n[145]=X.length,n[146]=st);let ct;n[147]!==Ye||n[148]!==ot||n[149]!==st?(ct=(0,$.jsxs)(`div`,{hidden:Ye,className:`relative`,children:[ot,st]}),n[147]=Ye,n[148]=ot,n[149]=st,n[150]=ct):ct=n[150];let lt;n[151]!==Te||n[152]!==Oe||n[153]!==je||n[154]!==He||n[155]!==qe||n[156]!==ct?(lt=(0,$.jsxs)(`div`,{hidden:Oe,onKeyDownCapture:Te,children:[je,He,qe,ct]}),n[151]=Te,n[152]=Oe,n[153]=je,n[154]=He,n[155]=qe,n[156]=ct,n[157]=lt):lt=n[157];let ut;return n[158]!==De||n[159]!==lt?(ut=(0,$.jsxs)($.Fragment,{children:[De,lt]}),n[158]=De,n[159]=lt,n[160]=ut):ut=n[160],ut},Qn=15,$n=e=>{let t=(0,Q.c)(35),{onRefresh:n,onHidden:r,showHiddenFiles:i,onCreateFile:a,onCreateNotebook:o,onCreateFolder:s,onCollapseAll:c,uploadDestinationPath:l,uploadDestinationLabel:u,onUpload:d}=e,f=`Upload files to ${u}`,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(St,{size:16}),t[0]=p):p=t[0];let m;t[1]===o?m=t[2]:(m=(0,$.jsx)(V,{content:`Add notebook`,children:(0,$.jsx)(H,{"data-testid":`file-explorer-add-notebook-button`,onClick:o,variant:`text`,size:`xs`,children:p})}),t[1]=o,t[2]=m);let h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(Et,{size:16}),t[3]=h):h=t[3];let g;t[4]===a?g=t[5]:(g=(0,$.jsx)(V,{content:`Add file`,children:(0,$.jsx)(H,{"data-testid":`file-explorer-add-file-button`,onClick:a,variant:`text`,size:`xs`,children:h})}),t[4]=a,t[5]=g);let _;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(Ot,{size:16}),t[6]=_):_=t[6];let v;t[7]===s?v=t[8]:(v=(0,$.jsx)(V,{content:`Add folder`,children:(0,$.jsx)(H,{"data-testid":`file-explorer-add-folder-button`,onClick:s,variant:`text`,size:`xs`,children:_})}),t[7]=s,t[8]=v);let y;t[9]!==d||t[10]!==l?(y=()=>d(l),t[9]=d,t[10]=l,t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(ot,{size:16}),t[12]=b):b=t[12];let x;t[13]!==y||t[14]!==f?(x=(0,$.jsx)(H,{"data-testid":`file-explorer-upload-button`,"aria-label":f,onClick:y,variant:`text`,size:`xs`,children:b}),t[13]=y,t[14]=f,t[15]=x):x=t[15];let S;t[16]!==x||t[17]!==f?(S=(0,$.jsx)(V,{content:f,children:x}),t[16]=x,t[17]=f,t[18]=S):S=t[18];let C;t[19]===n?C=t[20]:(C=(0,$.jsx)(at,{"data-testid":`file-explorer-refresh-button`,onClick:n}),t[19]=n,t[20]=C);let w;t[21]!==r||t[22]!==i?(w=(0,$.jsx)(tt,{"data-testid":`file-explorer-hidden-files-button`,isVisible:i,onToggle:r,showTooltip:`Show hidden files`,hideTooltip:`Hide hidden files`}),t[21]=r,t[22]=i,t[23]=w):w=t[23];let T;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(Tt,{size:16}),t[24]=T):T=t[24];let E;t[25]===c?E=t[26]:(E=(0,$.jsx)(V,{content:`Collapse all folders`,children:(0,$.jsx)(H,{"data-testid":`file-explorer-collapse-button`,onClick:c,variant:`text`,size:`xs`,children:T})}),t[25]=c,t[26]=E);let D;return t[27]!==S||t[28]!==C||t[29]!==w||t[30]!==E||t[31]!==m||t[32]!==g||t[33]!==v?(D=(0,$.jsxs)(`div`,{className:`flex items-center justify-end px-2 shrink-0`,children:[m,g,v,S,C,w,E]}),t[27]=S,t[28]=C,t[29]=w,t[30]=E,t[31]=m,t[32]=g,t[33]=v,t[34]=D):D=t[34],D},er=e=>{let t=(0,Q.c)(11),{node:n,onOpenMarimoFile:r}=e,i;t[0]!==n.data.isMarimoFile||t[1]!==n.data.isPrimaryRoot||t[2]!==r?(i=n.data.isMarimoFile&&n.data.isPrimaryRoot&&!j()&&(0,$.jsxs)(`span`,{"data-testid":`file-explorer-open-marimo-button`,className:`shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline`,onClick:r,children:[`open `,(0,$.jsx)(Pe,{className:`inline ml-1`,size:12})]}),t[0]=n.data.isMarimoFile,t[1]=n.data.isPrimaryRoot,t[2]=r,t[3]=i):i=t[3];let a;t[4]!==n.data.name||t[5]!==i?(a=(0,$.jsxs)(`span`,{className:`flex-1 overflow-hidden text-ellipsis`,children:[n.data.name,i]}),t[4]=n.data.name,t[5]=i,t[6]=a):a=t[6];let o=a,s;return t[7]!==o||t[8]!==n.data.isRoot||t[9]!==n.data.path?(s=n.data.isRoot?(0,$.jsx)(V,{content:n.data.path,children:o}):o,t[7]=o,t[8]=n.data.isRoot,t[9]=n.data.path,t[10]=s):s=t[10],s},tr=e=>{let t=(0,Q.c)(123),{node:n,style:a,dragHandle:o}=e,{openFile:s}=Te(),l=r(E),u;t[0]!==n.data.isDirectory||t[1]!==n.data.name?(u=n.data.isDirectory?`directory`:$e(n.data.name),t[0]=n.data.isDirectory,t[1]=n.data.name,t[2]=u):u=t[2];let f=u,p=st[f],{openPrompt:m}=se(),{createNewCell:h}=c(),g=d(),_;t[3]!==h||t[4]!==g?(_=e=>{h({code:e,before:!1,cellId:g??`__end__`})},t[3]=h,t[4]=g,t[5]=_):_=t[5];let y=_,b=(0,Z.use)(Xn),x=b?.tree,S=n.data.isDirectory&&b?.externalDropDestinationPath===n.data.path;bn(n,S);let C;t[6]!==n.data.path||t[7]!==x?(C=async e=>{let t=x?.getPrimaryRelativePath(n.data.path);t!=null&&rr(e,t)},t[6]=n.data.path,t[7]=x,t[8]=C):C=t[8];let w=C,T;t[9]!==n.id||t[10]!==n.tree?(T=async e=>{e.stopPropagation(),e.preventDefault(),await n.tree.delete(n.id)},t[9]=n.id,t[10]=n.tree,t[11]=T):T=t[11];let D=T,O;t[12]!==n||t[13]!==m||t[14]!==x?(O=async()=>{n.open(),m({title:`Folder name`,onConfirm:async e=>{x?.createFolder(e,n.id)}})},t[12]=n,t[13]=m,t[14]=x,t[15]=O):O=t[15];let k=i(O),A;t[16]!==n||t[17]!==m||t[18]!==x?(A=async()=>{n.open(),m({title:`File name`,onConfirm:async e=>{x?.createFile({name:e,parentId:n.id})}})},t[16]=n,t[17]=m,t[18]=x,t[19]=A):A=t[19];let N=i(A),P;t[20]!==n||t[21]!==m||t[22]!==x?(P=async()=>{n.open(),m({title:`Notebook name`,onConfirm:async e=>{x?.createFile({name:e,parentId:n.id,type:`notebook`})}})},t[20]=n,t[21]=m,t[22]=x,t[23]=P):P=t[23];let F=i(P),R;t[24]!==n.data.name||t[25]!==n.id||t[26]!==x?(R=async()=>{x&&await x.copy(n.id,ft(n.data.name))},t[24]=n.data.name,t[25]=n.id,t[26]=x,t[27]=R):R=t[27];let z=i(R),B;t[28]!==n.data.isDirectory||t[29]!==n.data.path?(B=n.data.isDirectory?{[Vn]:n.data.path}:{},t[28]=n.data.isDirectory,t[29]=n.data.path,t[30]=B):B=t[30];let V;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(V=M(`relative flex h-full items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group`),t[31]=V):V=t[31];let H=!n.data.isRoot,U,W;t[32]===n?(U=t[33],W=t[34]):(U=()=>{n.data.isDirectory&&n.toggle()},W=e=>{e.stopPropagation(),n.data.isDirectory||n.activate()},t[32]=n,t[33]=U,t[34]=W);let G;t[35]===n.level?G=t[36]:(G=Array.from({length:n.level},hr),t[35]=n.level,t[36]=G);let K;t[37]===n?K=t[38]:(K=(0,$.jsx)(nr,{node:n}),t[37]=n,t[38]=K);let te;t[39]!==n.data.isDirectory||t[40]!==n.tree||t[41]!==n.willReceiveDrop?(te=n.willReceiveDrop&&n.tree.canDrop()&&n.data.isDirectory&&`bg-primary/15 hover:bg-primary/15 text-accent-foreground`,t[39]=n.data.isDirectory,t[40]=n.tree,t[41]=n.willReceiveDrop,t[42]=te):te=t[42];let ne=n.isSelected&&`bg-accent/60 hover:bg-accent/60 text-accent-foreground`,re=S&&`bg-primary/15 hover:bg-primary/15 text-accent-foreground`,ie;t[43]!==te||t[44]!==ne||t[45]!==re?(ie=M(`flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group`,te,ne,re),t[43]=te,t[44]=ne,t[45]=re,t[46]=ie):ie=t[46];let q;t[47]!==p||t[48]!==f||t[49]!==n.data.isMarimoFile||t[50]!==n.data.isRoot?(q=n.data.isRoot?(0,$.jsx)(kt,{className:`w-4 h-4 shrink-0 mr-2 text-primary`,strokeWidth:1.5}):n.data.isMarimoFile?(0,$.jsx)(Ct,{className:`w-4 h-4 shrink-0 mr-2`,strokeWidth:1.5}):(0,$.jsx)(p,{className:M(`w-4 h-4 shrink-0 mr-2`,it[f]),strokeWidth:1.5}),t[47]=p,t[48]=f,t[49]=n.data.isMarimoFile,t[50]=n.data.isRoot,t[51]=q):q=t[51];let ae;t[52]!==w||t[53]!==n?(ae=n.isEditing?(0,$.jsx)(_e,{node:n}):(0,$.jsx)(er,{node:n,onOpenMarimoFile:w}),t[52]=w,t[53]=n,t[54]=ae):ae=t[54];let J;t[55]===n?J=t[56]:(J=!n.data.isDirectory&&(0,$.jsxs)(I,{onSelect:()=>n.activate(),"data-testid":`file-explorer-open-file-menu-item`,children:[(0,$.jsx)(Mt,{className:`h-3.5 w-3.5 mr-2`}),`Open file`]}),t[55]=n,t[56]=J);let oe;t[57]!==n.data.isDirectory||t[58]!==n.data.path||t[59]!==s?(oe=!n.data.isDirectory&&!j()&&(0,$.jsxs)(I,{onSelect:()=>{s({path:n.data.path})},"data-testid":`file-explorer-open-external-menu-item`,children:[(0,$.jsx)(Pe,{className:`h-3.5 w-3.5 mr-2`}),`Open file in external editor`]}),t[57]=n.data.isDirectory,t[58]=n.data.path,t[59]=s,t[60]=oe):oe=t[60];let Y;t[61]!==b||t[62]!==N||t[63]!==k||t[64]!==F||t[65]!==n.data.isDirectory||t[66]!==n.data.path?(Y=n.data.isDirectory&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(I,{onSelect:()=>F(),"data-testid":`file-explorer-create-notebook-menu-item`,children:[(0,$.jsx)(St,{className:`h-3.5 w-3.5 mr-2`}),`Create notebook`]}),(0,$.jsxs)(I,{onSelect:()=>N(),"data-testid":`file-explorer-create-file-menu-item`,children:[(0,$.jsx)(Et,{className:`h-3.5 w-3.5 mr-2`}),`Create file`]}),(0,$.jsxs)(I,{onSelect:()=>k(),"data-testid":`file-explorer-create-folder-menu-item`,children:[(0,$.jsx)(Ot,{className:`h-3.5 w-3.5 mr-2`}),`Create folder`]}),(0,$.jsxs)(I,{onSelect:()=>b?.uploadFiles(n.data.path),"data-testid":`file-explorer-upload-files-menu-item`,children:[(0,$.jsx)(ot,{className:`h-3.5 w-3.5 mr-2`}),`Upload files here`]}),(0,$.jsx)(L,{})]}),t[61]=b,t[62]=N,t[63]=k,t[64]=F,t[65]=n.data.isDirectory,t[66]=n.data.path,t[67]=Y):Y=t[67];let le;t[68]!==z||t[69]!==n?(le=!n.data.isRoot&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ce,{onSelect:()=>n.edit(),testId:`file-explorer-rename-menu-item`}),(0,$.jsx)(ge,{onSelect:z,testId:`file-explorer-duplicate-menu-item`})]}),t[68]=z,t[69]=n,t[70]=le):le=t[70];let ue;t[71]===n.data.path?ue=t[72]:(ue=async()=>{await be(n.data.path),xe({title:`Copied to clipboard`})},t[71]=n.data.path,t[72]=ue);let de;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(At,{className:Ze}),t[73]=de):de=t[73];let pe;t[74]===ue?pe=t[75]:(pe=(0,$.jsxs)(I,{onSelect:ue,"data-testid":`file-explorer-copy-path-menu-item`,children:[de,`Copy path`]}),t[74]=ue,t[75]=pe);let X;t[76]!==n.data.isPrimaryRoot||t[77]!==n.data.isRoot||t[78]!==n.data.path||t[79]!==x?(X=x&&n.data.isPrimaryRoot&&!n.data.isRoot&&(0,$.jsxs)(I,{onSelect:async()=>{let e=x.getPrimaryRelativePath(n.data.path);e!==null&&(await be(e),xe({title:`Copied to clipboard`}))},"data-testid":`file-explorer-copy-relative-path-menu-item`,children:[(0,$.jsx)(At,{className:`h-3.5 w-3.5 mr-2`}),`Copy relative path`]}),t[76]=n.data.isPrimaryRoot,t[77]=n.data.isRoot,t[78]=n.data.path,t[79]=x,t[80]=X):X=t[80];let he;t[81]!==f||t[82]!==y||t[83]!==n.data?(he=!n.data.isRoot&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(L,{}),(0,$.jsxs)(I,{onSelect:()=>{let{path:e}=n.data,t=Rn[f](e);y(t)},"data-testid":`file-explorer-insert-snippet-menu-item`,children:[(0,$.jsx)(ee,{className:`h-3.5 w-3.5 mr-2`}),`Insert snippet for reading file`]}),(0,$.jsxs)(I,{onSelect:async()=>{xe({title:`Copied to clipboard`,description:`Code to open the file has been copied to your clipboard. You can also drag and drop this file into the editor`});let{path:e}=n.data,t=Rn[f](e);await be(t)},"data-testid":`file-explorer-copy-snippet-menu-item`,children:[(0,$.jsx)(v,{className:`h-3.5 w-3.5 mr-2`}),`Copy snippet for reading file`]})]}),t[81]=f,t[82]=y,t[83]=n.data,t[84]=he):he=t[84];let ve;t[85]!==w||t[86]!==n.data.isMarimoFile||t[87]!==n.data.isPrimaryRoot?(ve=n.data.isMarimoFile&&n.data.isPrimaryRoot&&!j()&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(L,{}),(0,$.jsxs)(I,{onSelect:w,"data-testid":`file-explorer-open-notebook-menu-item`,children:[(0,$.jsx)(jt,{className:`h-3.5 w-3.5 mr-2`}),`Open notebook`]})]}),t[85]=w,t[86]=n.data.isMarimoFile,t[87]=n.data.isPrimaryRoot,t[88]=ve):ve=t[88];let ye;t[89]!==l||t[90]!==n.data.isDirectory||t[91]!==n.data.name||t[92]!==n.data.path?(ye=!n.data.isDirectory&&!l&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(L,{}),(0,$.jsxs)(I,{onSelect:async()=>{await xn(n.data.path,n.data.name)},"data-testid":`file-explorer-download-menu-item`,children:[(0,$.jsx)(nt,{className:`h-3.5 w-3.5 mr-2`}),`Download`]})]}),t[89]=l,t[90]=n.data.isDirectory,t[91]=n.data.name,t[92]=n.data.path,t[93]=ye):ye=t[93];let Se;t[94]!==D||t[95]!==n.data.isRoot?(Se=!n.data.isRoot&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(L,{}),(0,$.jsx)(me,{onSelect:D,testId:`file-explorer-delete-menu-item`})]}),t[94]=D,t[95]=n.data.isRoot,t[96]=Se):Se=t[96];let Ce;t[97]!==J||t[98]!==oe||t[99]!==Y||t[100]!==le||t[101]!==pe||t[102]!==X||t[103]!==he||t[104]!==ve||t[105]!==ye||t[106]!==Se?(Ce=(0,$.jsxs)(fe,{testId:`file-explorer-more-button`,iconClassName:`w-5 h-5`,children:[J,oe,Y,le,pe,X,he,ve,ye,Se]}),t[97]=J,t[98]=oe,t[99]=Y,t[100]=le,t[101]=pe,t[102]=X,t[103]=he,t[104]=ve,t[105]=ye,t[106]=Se,t[107]=Ce):Ce=t[107];let we;t[108]!==ie||t[109]!==q||t[110]!==ae||t[111]!==Ce?(we=(0,$.jsxs)(`span`,{className:ie,children:[q,ae,Ce]}),t[108]=ie,t[109]=q,t[110]=ae,t[111]=Ce,t[112]=we):we=t[112];let Ee;return t[113]!==o||t[114]!==a||t[115]!==H||t[116]!==U||t[117]!==W||t[118]!==G||t[119]!==K||t[120]!==we||t[121]!==B?(Ee=(0,$.jsxs)(`div`,{style:a,ref:o,...B,className:V,draggable:H,onClick:U,onDoubleClick:W,children:[G,K,we]}),t[113]=o,t[114]=a,t[115]=H,t[116]=U,t[117]=W,t[118]=G,t[119]=K,t[120]=we,t[121]=B,t[122]=Ee):Ee=t[122],Ee},nr=e=>{let t=(0,Q.c)(6),{node:n}=e;if(!n.data.isDirectory){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{className:`w-4 h-4 shrink-0`}),t[0]=e):e=t[0],e}if(n.data.loadState===`loading`){let e=`Loading ${n.data.name}`,r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(Xe,{size:`small`}),t[1]=r):r=t[1];let i;return t[2]===e?i=t[3]:(i=(0,$.jsx)(`span`,{role:`status`,"aria-label":e,className:`w-4 h-4 shrink-0`,children:r}),t[2]=e,t[3]=i),i}let r;return t[4]===n.isOpen?r=t[5]:(r=(0,$.jsx)(lt,{isExpanded:n.isOpen,className:`w-4 h-4`}),t[4]=n.isOpen,t[5]=r),r};function rr(e,t){e.stopPropagation(),e.preventDefault(),Y(t)}function ir(e,t){return e.getDisplayPath(t)}function ar(e,t){if(t)return e;let n=[];for(let r of e){if(!r.isRoot&&or(r.name))continue;let e=r;if(r.children){let n=ar(r.children,t);n!==r.children&&(e={...r,children:n})}n.push(e)}return n}function or(e){return!!e.startsWith(`.`)}function sr(e,t){return e.some(e=>e.id===t||(e.children?sr(e.children,t):!1))}function cr(e){let t=(0,Q.c)(22),{mouse:n,id:r,isDragging:i,tree:a}=e,o,s,c;if(t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==a){c=Symbol.for(`react.early_return_sentinel`);bb0:{if(o=a?.get(r),!i||!n||!o){c=null;break bb0}s=o.data.isDirectory?`directory`:$e(o.data.name)}t[0]=r,t[1]=i,t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=c}else o=t[4],s=t[5],c=t[6];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l=s,u=st[l],d=`translate3d(${n.x+12}px, ${n.y+12}px, 0)`,f;t[7]===d?f=t[8]:(f={transform:d},t[7]=d,t[8]=f);let p=it[l],m;t[9]===p?m=t[10]:(m=M(`h-4 w-4 shrink-0`,p),t[9]=p,t[10]=m);let h;t[11]!==u||t[12]!==m?(h=(0,$.jsx)(u,{className:m}),t[11]=u,t[12]=m,t[13]=h):h=t[13];let g;t[14]===o.data.name?g=t[15]:(g=(0,$.jsx)(`span`,{className:`truncate`,children:o.data.name}),t[14]=o.data.name,t[15]=g);let _;t[16]!==h||t[17]!==g?(_=(0,$.jsxs)(`div`,{className:`flex max-w-72 items-center gap-2 rounded-md border border-border bg-popover px-3 py-2 text-sm text-popover-foreground shadow-md`,children:[h,g]}),t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;return t[19]!==f||t[20]!==_?(v=(0,_n.createPortal)((0,$.jsx)(`div`,{className:`pointer-events-none fixed left-0 top-0 z-[1000] opacity-[0.85]`,style:f,children:_}),document.body),t[19]=f,t[20]=_,t[21]=v):v=t[21],v}function lr(e){return e.isDirectory?e.children:null}function ur(e){return e.isRoot}function dr(){return null}function fr(e){return e.isRoot}function pr(e){return e.data.isRoot}function mr(e){let{parentNode:t,dragNodes:n}=e;return n.some(pr)||(t?!t.data.isDirectory:!1)}function hr(e,t){return(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-y-0 border-l border-border`,style:{left:t*Qn+8}},t)}var gr=e=>{let t=(0,Q.c)(44),{height:n}=e,i=r(Fn),[a,o]=(0,Z.useState)(null),s;t[0]===i?s=t[1]:(s=e=>_r(e,i.getPrimaryRootPath()),t[0]=i,t[1]=s);let c=s,l;t[2]===i?l=t[3]:(l=e=>i.refreshPath(e),t[2]=i,t[3]=l);let u=l,d;t[4]===i?d=t[5]:(d=e=>ir(i,e),t[4]=i,t[5]=d);let f,p;t[6]===c?(f=t[7],p=t[8]):(f=e=>o(c(e)),p=e=>o(c(e)),t[6]=c,t[7]=f,t[8]=p);let m,h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>o(null),h=()=>o(null),t[9]=m,t[10]=h):(m=t[9],h=t[10]);let g;t[11]!==c||t[12]!==u||t[13]!==d||t[14]!==f||t[15]!==p?(g={noClick:!0,noKeyboard:!0,destinationPath:c,getDestinationLabel:d,refreshDestination:u,onDragEnter:f,onDragOver:p,onDragLeave:m,onUploadStart:h},t[11]=c,t[12]=u,t[13]=d,t[14]=f,t[15]=p,t[16]=g):g=t[16];let{getRootProps:_,getInputProps:v,isDragActive:y}=Hn(g),b;t[17]!==a||t[18]!==i?(b=a??i.getPrimaryRootPath(),t[17]=a,t[18]=i,t[19]=b):b=t[19];let x=b,S;t[20]!==x||t[21]!==i?(S=ir(i,x),t[20]=x,t[21]=i,t[22]=S):S=t[22];let C=S,w;t[23]===_?w=t[24]:(w=_(),t[23]=_,t[24]=w);let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=M(`flex flex-col overflow-hidden relative`),t[25]=T):T=t[25];let E;t[26]===n?E=t[27]:(E={height:n},t[26]=n,t[27]=E);let D;t[28]===v?D=t[29]:(D=v(),t[28]=v,t[29]=D);let O;t[30]===D?O=t[31]:(O=(0,$.jsx)(`input`,{...D}),t[30]=D,t[31]=O);let k;t[32]!==C||t[33]!==y?(k=y&&(0,$.jsx)(`div`,{className:`absolute inset-0 flex items-start justify-center pt-3 bg-accent/20 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none`,children:(0,$.jsxs)(`span`,{className:`px-3 py-1.5 rounded-md bg-background/95 border shadow-sm text-sm font-semibold text-primary`,children:[`Drop files into `,C]})}),t[32]=C,t[33]=y,t[34]=k):k=t[34];let A=y?x:null,j;t[35]!==n||t[36]!==A?(j=(0,$.jsx)(Zn,{height:n,externalDropDestinationPath:A}),t[35]=n,t[36]=A,t[37]=j):j=t[37];let N;return t[38]!==w||t[39]!==E||t[40]!==O||t[41]!==k||t[42]!==j?(N=(0,$.jsx)(gn,{children:(0,$.jsxs)(`div`,{...w,className:T,style:E,children:[O,k,j]})}),t[38]=w,t[39]=E,t[40]=O,t[41]=k,t[42]=j,t[43]=N):N=t[43],N};function _r(e,t){return Array.isArray(e)?t:Gn(e.target,t)}var vr=()=>{let e=(0,Q.c)(40),{ref:n,height:i}=je(),a=i===void 0?500:i,[o,s]=t(ne),c=r(h).length,l=x(`storage`),u;bb0:{if(!o.hasUserInteracted&&c>0){if(o.openSections.includes(`remote-storage`)){u=o.openSections;break bb0}let t;e[0]===o.openSections?t=e[1]:(t=[...o.openSections,`remote-storage`],e[0]=o.openSections,e[1]=t),u=t;break bb0}u=o.openSections}let d=u,f;e[2]===s?f=e[3]:(f=e=>{s({openSections:e,hasUserInteracted:!0})},e[2]=s,e[3]=f);let p=f,m=a-66,g;e[4]===d?g=e[5]:(g=d.includes(`remote-storage`),e[4]=d,e[5]=g);let _=g,v=l.length>0,y;e[6]!==d||e[7]!==_?(y=_&&d.includes(`files`),e[6]=d,e[7]=_,e[8]=y):y=e[8];let b=y,S;e[9]!==m||e[10]!==b?(S=b?Math.round(m*.4):m,e[9]=m,e[10]=b,e[11]=S):S=e[11];let C=S,w=Math.max(200,b?m-C:m),T;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(re,{className:`w-4 h-4`}),e[12]=T):T=e[12];let E;e[13]===c?E=e[14]:(E=c>0&&(0,$.jsx)(ht,{children:c}),e[13]=c,e[14]=E);let D;e[15]!==l.length||e[16]!==v?(D=v&&(0,$.jsx)(xt,{count:l.length,type:`storage`}),e[15]=l.length,e[16]=v,e[17]=D):D=e[17];let O;e[18]!==E||e[19]!==D?(O=(0,$.jsxs)(gt,{children:[T,` Remote storage`,E,D]}),e[18]=E,e[19]=D,e[20]=O):O=e[20];let k;e[21]===C?k=e[22]:(k={maxHeight:C},e[21]=C,e[22]=k);let A;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(ln,{}),e[23]=A):A=e[23];let j;e[24]===k?j=e[25]:(j=(0,$.jsx)(_t,{className:`overflow-auto`,style:k,children:A}),e[24]=k,e[25]=j);let M;e[26]!==j||e[27]!==O?(M=(0,$.jsxs)(yt,{value:`remote-storage`,children:[O,j]}),e[26]=j,e[27]=O,e[28]=M):M=e[28];let N;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsxs)(gt,{children:[(0,$.jsx)(Ne,{className:`w-4 h-4`}),`Files`]}),e[29]=N):N=e[29];let F;e[30]===w?F=e[31]:(F=(0,$.jsxs)(yt,{value:`files`,children:[N,(0,$.jsx)(_t,{children:(0,$.jsx)(gr,{height:w})})]}),e[30]=w,e[31]=F);let I;e[32]!==p||e[33]!==d||e[34]!==M||e[35]!==F?(I=(0,$.jsxs)(P,{type:`multiple`,value:d,onValueChange:p,children:[M,F]}),e[32]=p,e[33]=d,e[34]=M,e[35]=F,e[36]=I):I=e[36];let L;return e[37]!==n||e[38]!==I?(L=(0,$.jsx)(`div`,{ref:n,className:`h-full overflow-auto`,children:I}),e[37]=n,e[38]=I,e[39]=L):L=e[39],L};export{vr as default,_r as getUploadDestinationForEvent};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e,r as t,t as n}from"./rolldown-runtime-B0Z9INg1.js";import{t as r}from"./useEvent-Dc9HkKI2.js";import{t as i}from"./react-CUdNIagt.js";import{t as a}from"./compiler-runtime-BQ9S8nyo.js";import{rt as o}from"./ai-model-dropdown-1t7m1iFc.js";import{_ as s}from"./useEventListener-BdZUApHd.js";import{t as c}from"./jsx-runtime-B74pBk57.js";import{o as l}from"./alert-dialog-CeE3i3Qa.js";import{a as u,p as d,r as f,t as p}from"./dropdown-menu-VuyoeQOD.js";import{t as m}from"./createLucideIcon-rHn2EdoM.js";import{t as h}from"./paths-CzfpItSz.js";import{t as g}from"./copy-RyCOE8jo.js";import{b as _}from"./write-secret-modal-CBUZw27N.js";import{t as ee}from"./trash-2-BJG-7Qob.js";import{t as v}from"./use-toast-CC89xOwH.js";import{r as y}from"./requests-yTHMxhVa.js";import{a as te}from"./errors-D9vyuMar.js";import{Vr as ne,c as re,d as ie,en as b,f as ae,tn as x,u as oe}from"./index-CgQsZfww.js";var se=m(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),ce=n(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}})),S=c(),C=e(i(),1),le=(0,C.createContext)({dragDropManager:void 0});function w(e){return`Minified Redux error #`+e+`; visit https://redux.js.org/Errors?code=`+e+` for the full message or use the non-minified dev environment for full errors. `}var ue=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})(),de=function(){return Math.random().toString(36).substring(7).split(``).join(`.`)},fe={INIT:`@@redux/INIT`+de(),REPLACE:`@@redux/REPLACE`+de(),PROBE_UNKNOWN_ACTION:function(){return`@@redux/PROBE_UNKNOWN_ACTION`+de()}};function pe(e){if(typeof e!=`object`||!e)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function me(e,t,n){var r;if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(w(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(w(1));return n(me)(e,t)}if(typeof e!=`function`)throw Error(w(2));var i=e,a=t,o=[],s=o,c=!1;function l(){s===o&&(s=o.slice())}function u(){if(c)throw Error(w(3));return a}function d(e){if(typeof e!=`function`)throw Error(w(4));if(c)throw Error(w(5));var t=!0;return l(),s.push(e),function(){if(t){if(c)throw Error(w(6));t=!1,l();var n=s.indexOf(e);s.splice(n,1),o=null}}}function f(e){if(!pe(e))throw Error(w(7));if(e.type===void 0)throw Error(w(8));if(c)throw Error(w(9));try{c=!0,a=i(a,e)}finally{c=!1}for(var t=o=s,n=0;n<t.length;n++){var r=t[n];r()}return e}function p(e){if(typeof e!=`function`)throw Error(w(10));i=e,f({type:fe.REPLACE})}function m(){var e,t=d;return e={subscribe:function(e){if(typeof e!=`object`||!e)throw Error(w(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}},e[ue]=function(){return this},e}return f({type:fe.INIT}),r={dispatch:f,subscribe:d,getState:u,replaceReducer:p},r[ue]=m,r}function T(e,t,...n){if(he()&&t===void 0)throw Error(`invariant requires an error message argument`);if(!e){let e;if(t===void 0)e=Error(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{let r=0;e=Error(t.replace(/%s/g,function(){return n[r++]})),e.name=`Invariant Violation`}throw e.framesToPop=1,e}}function he(){return typeof process<`u`&&!0}function ge(e,t,n){return t.split(`.`).reduce((e,t)=>e&&e[t]?e[t]:n||null,e)}function _e(e,t){return e.filter(e=>e!==t)}function ve(e){return typeof e==`object`}function ye(e,t){let n=new Map,r=e=>{n.set(e,n.has(e)?n.get(e)+1:1)};e.forEach(r),t.forEach(r);let i=[];return n.forEach((e,t)=>{e===1&&i.push(t)}),i}function be(e,t){return e.filter(e=>t.indexOf(e)>-1)}var xe=`dnd-core/INIT_COORDS`,E=`dnd-core/BEGIN_DRAG`,Se=`dnd-core/PUBLISH_DRAG_SOURCE`,D=`dnd-core/HOVER`,O=`dnd-core/DROP`,Ce=`dnd-core/END_DRAG`;function we(e,t){return{type:xe,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}var Te={type:xe,payload:{clientOffset:null,sourceClientOffset:null}};function Ee(e){return function(t=[],n={publishSource:!0}){let{publishSource:r=!0,clientOffset:i,getSourceClientOffset:a}=n,o=e.getMonitor(),s=e.getRegistry();e.dispatch(we(i)),De(t,o,s);let c=Ae(t,o);if(c==null){e.dispatch(Te);return}let l=null;if(i){if(!a)throw Error(`getSourceClientOffset must be defined`);Oe(a),l=a(c)}e.dispatch(we(i,l));let u=s.getSource(c).beginDrag(o,c);return u==null?void 0:(ke(u),s.pinSource(c),{type:E,payload:{itemType:s.getSourceType(c),item:u,sourceId:c,clientOffset:i||null,sourceClientOffset:l||null,isSourcePublic:!!r}})}}function De(e,t,n){T(!t.isDragging(),`Cannot call beginDrag while dragging.`),e.forEach(function(e){T(n.getSource(e),`Expected sourceIds to be registered.`)})}function Oe(e){T(typeof e==`function`,`When clientOffset is provided, getSourceClientOffset must be a function.`)}function ke(e){T(ve(e),`Item must be an object.`)}function Ae(e,t){let n=null;for(let r=e.length-1;r>=0;r--)if(t.canDragSource(e[r])){n=e[r];break}return n}function je(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Me(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){je(e,t,n[t])})}return e}function Ne(e){return function(t={}){let n=e.getMonitor(),r=e.getRegistry();Pe(n),Le(n).forEach((i,a)=>{let o={type:O,payload:{dropResult:Me({},t,Fe(i,a,r,n))}};e.dispatch(o)})}}function Pe(e){T(e.isDragging(),`Cannot call drop while not dragging.`),T(!e.didDrop(),`Cannot call drop twice during one drag operation.`)}function Fe(e,t,n,r){let i=n.getTarget(e),a=i?i.drop(r,e):void 0;return Ie(a),a===void 0&&(a=t===0?{}:r.getDropResult()),a}function Ie(e){T(e===void 0||ve(e),`Drop result must either be an object or undefined.`)}function Le(e){let t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Re(e){return function(){let t=e.getMonitor(),n=e.getRegistry();ze(t);let r=t.getSourceId();return r!=null&&(n.getSource(r,!0).endDrag(t,r),n.unpinSource()),{type:Ce}}}function ze(e){T(e.isDragging(),`Cannot call endDrag while not dragging.`)}function Be(e,t){return t===null?e===null:Array.isArray(e)?e.some(e=>e===t):e===t}function Ve(e){return function(t,{clientOffset:n}={}){He(t);let r=t.slice(0),i=e.getMonitor(),a=e.getRegistry();return We(r,a,i.getItemType()),Ue(r,i,a),Ge(r,i,a),{type:D,payload:{targetIds:r,clientOffset:n||null}}}}function He(e){T(Array.isArray(e),`Expected targetIds to be an array.`)}function Ue(e,t,n){T(t.isDragging(),`Cannot call hover while not dragging.`),T(!t.didDrop(),`Cannot call hover after drop.`);for(let t=0;t<e.length;t++){let r=e[t];T(e.lastIndexOf(r)===t,`Expected targetIds to be unique in the passed array.`),T(n.getTarget(r),`Expected targetIds to be registered.`)}}function We(e,t,n){for(let r=e.length-1;r>=0;r--){let i=e[r];Be(t.getTargetType(i),n)||e.splice(r,1)}}function Ge(e,t,n){e.forEach(function(e){n.getTarget(e).hover(t,e)})}function Ke(e){return function(){if(e.getMonitor().isDragging())return{type:Se}}}function qe(e){return{beginDrag:Ee(e),publishDragSource:Ke(e),hover:Ve(e),drop:Ne(e),endDrag:Re(e)}}var Je=class{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){let e=this,{dispatch:t}=this.store;function n(n){return(...r)=>{let i=n.apply(e,r);i!==void 0&&t(i)}}let r=qe(this);return Object.keys(r).reduce((e,t)=>{let i=r[t];return e[t]=n(i),e},{})}dispatch(e){this.store.dispatch(e)}constructor(e,t){this.isSetUp=!1,this.handleRefCountChange=()=>{let e=this.store.getState().refCount>0;this.backend&&(e&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!e&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=t,e.subscribe(this.handleRefCountChange)}};function Ye(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Xe(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ze(e){let{clientOffset:t,initialClientOffset:n,initialSourceClientOffset:r}=e;return!t||!n||!r?null:Xe(Ye(t,r),n)}function Qe(e){let{clientOffset:t,initialClientOffset:n}=e;return!t||!n?null:Xe(t,n)}var k=[],$e=[];k.__IS_NONE__=!0,$e.__IS_ALL__=!0;function et(e,t){return e===k?!1:e===$e||t===void 0||be(t,e).length>0}var tt=class{subscribeToStateChange(e,t={}){let{handlerIds:n}=t;T(typeof e==`function`,`listener must be a function.`),T(n===void 0||Array.isArray(n),`handlerIds, when specified, must be an array of strings.`);let r=this.store.getState().stateId;return this.store.subscribe(()=>{let t=this.store.getState(),i=t.stateId;try{i===r||i===r+1&&!et(t.dirtyHandlerIds,n)||e()}finally{r=i}})}subscribeToOffsetChange(e){T(typeof e==`function`,`listener must be a function.`);let t=this.store.getState().dragOffset;return this.store.subscribe(()=>{let n=this.store.getState().dragOffset;n!==t&&(t=n,e())})}canDragSource(e){if(!e)return!1;let t=this.registry.getSource(e);return T(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()&&t.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;let t=this.registry.getTarget(e);return T(t,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop()?!1:Be(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e)}isDragging(){return!!this.getItemType()}isDraggingSource(e){if(!e)return!1;let t=this.registry.getSource(e,!0);return T(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()||!this.isSourcePublic()||this.registry.getSourceType(e)!==this.getItemType()?!1:t.isDragging(this,e)}isOverTarget(e,t={shallow:!1}){if(!e)return!1;let{shallow:n}=t;if(!this.isDragging())return!1;let r=this.registry.getTargetType(e),i=this.getItemType();if(i&&!Be(r,i))return!1;let a=this.getTargetIds();if(!a.length)return!1;let o=a.indexOf(e);return n?o===a.length-1:o>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return Ze(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return Qe(this.store.getState().dragOffset)}constructor(e,t){this.store=e,this.registry=t}},nt=typeof global<`u`?global:self,rt=nt.MutationObserver||nt.WebKitMutationObserver;function it(e){return function(){let t=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(t),clearInterval(n),e()}}}function at(e){let t=1,n=new rt(e),r=document.createTextNode(``);return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}var ot=typeof rt==`function`?at:it,st=class{enqueueTask(e){let{queue:t,requestFlush:n}=this;t.length||(n(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{let{queue:e}=this;for(;this.index<e.length;){let t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,n=e.length-this.index;t<n;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=ot(this.flush),this.requestErrorThrow=it(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},ct=class{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}},lt=class{create(e){let t=this.freeTasks,n=t.length?t.pop():new ct(this.onError,e=>t[t.length]=e);return n.task=e,n}constructor(e){this.onError=e,this.freeTasks=[]}},ut=new st,dt=new lt(ut.registerPendingError);function ft(e){ut.enqueueTask(dt.create(e))}var pt=`dnd-core/ADD_SOURCE`,mt=`dnd-core/ADD_TARGET`,ht=`dnd-core/REMOVE_SOURCE`,gt=`dnd-core/REMOVE_TARGET`;function _t(e){return{type:pt,payload:{sourceId:e}}}function vt(e){return{type:mt,payload:{targetId:e}}}function yt(e){return{type:ht,payload:{sourceId:e}}}function bt(e){return{type:gt,payload:{targetId:e}}}function xt(e){T(typeof e.canDrag==`function`,`Expected canDrag to be a function.`),T(typeof e.beginDrag==`function`,`Expected beginDrag to be a function.`),T(typeof e.endDrag==`function`,`Expected endDrag to be a function.`)}function St(e){T(typeof e.canDrop==`function`,`Expected canDrop to be a function.`),T(typeof e.hover==`function`,`Expected hover to be a function.`),T(typeof e.drop==`function`,`Expected beginDrag to be a function.`)}function Ct(e,t){if(t&&Array.isArray(e)){e.forEach(e=>Ct(e,!1));return}T(typeof e==`string`||typeof e==`symbol`,t?`Type can only be a string, a symbol, or an array of either.`:`Type can only be a string or a symbol.`)}var A;(function(e){e.SOURCE=`SOURCE`,e.TARGET=`TARGET`})(A||={});var wt=0;function Tt(){return wt++}function Et(e){let t=Tt().toString();switch(e){case A.SOURCE:return`S${t}`;case A.TARGET:return`T${t}`;default:throw Error(`Unknown Handler Role: ${e}`)}}function Dt(e){switch(e[0]){case`S`:return A.SOURCE;case`T`:return A.TARGET;default:throw Error(`Cannot parse handler ID: ${e}`)}}function Ot(e,t){let n=e.entries(),r=!1;do{let{done:e,value:[,i]}=n.next();if(i===t)return!0;r=!!e}while(!r);return!1}var kt=class{addSource(e,t){Ct(e),xt(t);let n=this.addHandler(A.SOURCE,e,t);return this.store.dispatch(_t(n)),n}addTarget(e,t){Ct(e,!0),St(t);let n=this.addHandler(A.TARGET,e,t);return this.store.dispatch(vt(n)),n}containsHandler(e){return Ot(this.dragSources,e)||Ot(this.dropTargets,e)}getSource(e,t=!1){return T(this.isSourceId(e),`Expected a valid source ID.`),t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return T(this.isTargetId(e),`Expected a valid target ID.`),this.dropTargets.get(e)}getSourceType(e){return T(this.isSourceId(e),`Expected a valid source ID.`),this.types.get(e)}getTargetType(e){return T(this.isTargetId(e),`Expected a valid target ID.`),this.types.get(e)}isSourceId(e){return Dt(e)===A.SOURCE}isTargetId(e){return Dt(e)===A.TARGET}removeSource(e){T(this.getSource(e),`Expected an existing source.`),this.store.dispatch(yt(e)),ft(()=>{this.dragSources.delete(e),this.types.delete(e)})}removeTarget(e){T(this.getTarget(e),`Expected an existing target.`),this.store.dispatch(bt(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){let t=this.getSource(e);T(t,`Expected an existing source.`),this.pinnedSourceId=e,this.pinnedSource=t}unpinSource(){T(this.pinnedSource,`No source is pinned at the time.`),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,t,n){let r=Et(e);return this.types.set(r,t),e===A.SOURCE?this.dragSources.set(r,n):e===A.TARGET&&this.dropTargets.set(r,n),r}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}},At=(e,t)=>e===t;function jt(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Mt(e,t,n=At){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(!n(e[r],t[r]))return!1;return!0}function Nt(e=k,t){switch(t.type){case D:break;case pt:case mt:case gt:case ht:return k;case E:case Se:case Ce:case O:default:return $e}let{targetIds:n=[],prevTargetIds:r=[]}=t.payload,i=ye(n,r);if(!(i.length>0||!Mt(n,r)))return k;let a=r[r.length-1],o=n[n.length-1];return a!==o&&(a&&i.push(a),o&&i.push(o)),i}function Pt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ft(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Pt(e,t,n[t])})}return e}var It={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Lt(e=It,t){let{payload:n}=t;switch(t.type){case xe:case E:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case D:return jt(e.clientOffset,n.clientOffset)?e:Ft({},e,{clientOffset:n.clientOffset});case Ce:case O:return It;default:return e}}function Rt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Rt(e,t,n[t])})}return e}var zt={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Bt(e=zt,t){let{payload:n}=t;switch(t.type){case E:return j({},e,{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case Se:return j({},e,{isSourcePublic:!0});case D:return j({},e,{targetIds:n.targetIds});case gt:return e.targetIds.indexOf(n.targetId)===-1?e:j({},e,{targetIds:_e(e.targetIds,n.targetId)});case O:return j({},e,{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case Ce:return j({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function Vt(e=0,t){switch(t.type){case pt:case mt:return e+1;case ht:case gt:return e-1;default:return e}}function Ht(e=0){return e+1}function Ut(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Ut(e,t,n[t])})}return e}function Gt(e={},t){return{dirtyHandlerIds:Nt(e.dirtyHandlerIds,{type:t.type,payload:Wt({},t.payload,{prevTargetIds:ge(e,`dragOperation.targetIds`,[])})}),dragOffset:Lt(e.dragOffset,t),refCount:Vt(e.refCount,t),dragOperation:Bt(e.dragOperation,t),stateId:Ht(e.stateId)}}function Kt(e,t=void 0,n={},r=!1){let i=qt(r),a=new Je(i,new tt(i,new kt(i))),o=e(a,t,n);return a.receiveBackend(o),a}function qt(e){let t=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__;return me(Gt,e&&t&&t({name:`dnd-core`,instanceId:`dnd-core`}))}function Jt(e,t){if(e==null)return{};var n=Yt(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Yt(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Xt=0,M=Symbol.for(`__REACT_DND_CONTEXT_INSTANCE__`),Zt=(0,C.memo)(function(e){var{children:t}=e;let[n,r]=Qt(Jt(e,[`children`]));return(0,C.useEffect)(()=>{if(r){let e=en();return++Xt,()=>{--Xt===0&&(e[M]=null)}}},[]),(0,S.jsx)(le.Provider,{value:n,children:t})});function Qt(e){return`manager`in e?[{dragDropManager:e.manager},!1]:[$t(e.backend,e.context,e.options,e.debugMode),!e.context]}function $t(e,t=en(),n,r){let i=t;return i[M]||(i[M]={dragDropManager:Kt(e,t,n,r)}),i[M]}function en(){return typeof global<`u`?global:window}var tn=e(ce(),1),N=typeof window<`u`?C.useLayoutEffect:C.useEffect;function nn(e,t,n){let[r,i]=(0,C.useState)(()=>t(e)),a=(0,C.useCallback)(()=>{let a=t(e);(0,tn.default)(r,a)||(i(a),n&&n())},[r,e,n]);return N(a),[r,a]}function rn(e,t,n){let[r,i]=nn(e,t,n);return N(function(){let t=e.getHandlerId();if(t!=null)return e.subscribeToStateChange(i,{handlerIds:[t]})},[e,i]),r}function an(e,t,n){return rn(t,e||(()=>({})),()=>n.reconnect())}function on(e,t){let n=[...t||[]];return t==null&&typeof e!=`function`&&n.push(e),(0,C.useMemo)(()=>typeof e==`function`?e():e,n)}function sn(e){return(0,C.useMemo)(()=>e.hooks.dragSource(),[e])}function cn(e){return(0,C.useMemo)(()=>e.hooks.dragPreview(),[e])}var ln=!1,un=!1,dn=class{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){T(!ln,`You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor`);try{return ln=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{ln=!1}}isDragging(){if(!this.sourceId)return!1;T(!un,`You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor`);try{return un=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{un=!1}}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,t){return this.internalMonitor.isOverTarget(e,t)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}},fn=!1,pn=class{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;T(!fn,`You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor`);try{return fn=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{fn=!1}}isOver(e){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,e):!1}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.targetId=null,this.internalMonitor=e.getMonitor()}};function mn(e,t,n){let r=n.getRegistry(),i=r.addTarget(e,t);return[i,()=>r.removeTarget(i)]}function hn(e,t,n){let r=n.getRegistry(),i=r.addSource(e,t);return[i,()=>r.removeSource(i)]}function gn(e,t,n,r){let i=n?n.call(r,e,t):void 0;if(i!==void 0)return!!i;if(e===t)return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let a=Object.keys(e),o=Object.keys(t);if(a.length!==o.length)return!1;let s=Object.prototype.hasOwnProperty.bind(t);for(let o=0;o<a.length;o++){let c=a[o];if(!s(c))return!1;let l=e[c],u=t[c];if(i=n?n.call(r,l,u,c):void 0,i===!1||i===void 0&&l!==u)return!1}return!0}function _n(e){return typeof e==`object`&&!!e&&Object.prototype.hasOwnProperty.call(e,`current`)}function vn(e){if(typeof e.type==`string`)return;let t=e.type.displayName||e.type.name||`the component`;throw Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}function yn(e){return(t=null,n=null)=>{if(!(0,C.isValidElement)(t)){let r=t;return e(r,n),r}let r=t;return vn(r),Sn(r,n?t=>e(t,n):e)}}function bn(e){let t={};return Object.keys(e).forEach(n=>{let r=e[n];if(n.endsWith(`Ref`))t[n]=e[n];else{let e=yn(r);t[n]=()=>e}}),t}function xn(e,t){typeof e==`function`?e(t):e.current=t}function Sn(e,t){let n=e.ref;return T(typeof n!=`string`,`Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs`),n?(0,C.cloneElement)(e,{ref:e=>{xn(n,e),xn(t,e)}}):(0,C.cloneElement)(e,{ref:t})}var Cn=class{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){let e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){let e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return t&&this.disconnectDragSource(),this.handlerId?e?(t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)),t):(this.lastConnectedDragSource=e,t):t}reconnectDragPreview(e=!1){let t=this.dragPreview,n=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(n&&this.disconnectDragPreview(),this.handlerId){if(!t){this.lastConnectedDragPreview=t;return}n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=t,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,t,this.dragPreviewOptions))}}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!gn(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!gn(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&=(this.dragSourceUnsubscribe(),void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(e){this.hooks=bn({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,_n(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,_n(e)?this.dragPreviewRef=e:this.dragPreviewNode=e,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=e}},wn=class{get connectTarget(){return this.dropTarget}reconnect(){let e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();let t=this.dropTarget;if(this.handlerId){if(!t){this.lastConnectedDropTarget=t;return}e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions))}}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!gn(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&=(this.unsubscribeDropTarget(),void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=bn({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,_n(e)?this.dropTargetRef=e:this.dropTargetNode=e,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}};function P(){let{dragDropManager:e}=(0,C.useContext)(le);return T(e!=null,`Expected drag drop context`),e}function Tn(e,t){let n=P(),r=(0,C.useMemo)(()=>new Cn(n.getBackend()),[n]);return N(()=>(r.dragSourceOptions=e||null,r.reconnect(),()=>r.disconnectDragSource()),[r,e]),N(()=>(r.dragPreviewOptions=t||null,r.reconnect(),()=>r.disconnectDragPreview()),[r,t]),r}function En(){let e=P();return(0,C.useMemo)(()=>new dn(e),[e])}var Dn=class{beginDrag(){let e=this.spec,t=this.monitor,n=null;return n=typeof e.item==`object`?e.item:typeof e.item==`function`?e.item(t):{},n??null}canDrag(){let e=this.spec,t=this.monitor;return typeof e.canDrag==`boolean`?e.canDrag:typeof e.canDrag!=`function`||e.canDrag(t)}isDragging(e,t){let n=this.spec,r=this.monitor,{isDragging:i}=n;return i?i(r):t===e.getSourceId()}endDrag(){let e=this.spec,t=this.monitor,n=this.connector,{end:r}=e;r&&r(t.getItem(),t),n.reconnect()}constructor(e,t,n){this.spec=e,this.monitor=t,this.connector=n}};function On(e,t,n){let r=(0,C.useMemo)(()=>new Dn(e,t,n),[t,n]);return(0,C.useEffect)(()=>{r.spec=e},[e]),r}function kn(e){return(0,C.useMemo)(()=>{let t=e.type;return T(t!=null,`spec.type must be defined`),t},[e])}function An(e,t,n){let r=P(),i=On(e,t,n),a=kn(e);N(function(){if(a!=null){let[e,o]=hn(a,i,r);return t.receiveHandlerId(e),n.receiveHandlerId(e),o}},[r,t,n,i,a])}function jn(e,t){let n=on(e,t);T(!n.begin,`useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)`);let r=En(),i=Tn(n.options,n.previewOptions);return An(n,r,i),[an(n.collect,r,i),sn(i),cn(i)]}function Mn(e){let t=P().getMonitor(),[n,r]=nn(t,e);return(0,C.useEffect)(()=>t.subscribeToOffsetChange(r)),(0,C.useEffect)(()=>t.subscribeToStateChange(r)),n}function Nn(e){return(0,C.useMemo)(()=>e.hooks.dropTarget(),[e])}function Pn(e){let t=P(),n=(0,C.useMemo)(()=>new wn(t.getBackend()),[t]);return N(()=>(n.dropTargetOptions=e||null,n.reconnect(),()=>n.disconnectDropTarget()),[e]),n}function Fn(){let e=P();return(0,C.useMemo)(()=>new pn(e),[e])}function In(e){let{accept:t}=e;return(0,C.useMemo)(()=>(T(e.accept!=null,`accept must be defined`),Array.isArray(t)?t:[t]),[t])}var Ln=class{canDrop(){let e=this.spec,t=this.monitor;return!e.canDrop||e.canDrop(t.getItem(),t)}hover(){let e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}drop(){let e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}constructor(e,t){this.spec=e,this.monitor=t}};function Rn(e,t){let n=(0,C.useMemo)(()=>new Ln(e,t),[t]);return(0,C.useEffect)(()=>{n.spec=e},[e]),n}function zn(e,t,n){let r=P(),i=Rn(e,t),a=In(e);N(function(){let[e,o]=mn(a,i,r);return t.receiveHandlerId(e),n.receiveHandlerId(e),o},[r,t,i,n,a.map(e=>e.toString()).join(`|`)])}function Bn(e,t){let n=on(e,t),r=Fn(),i=Pn(n.options);return zn(n,r,i),[an(n.collect,r,i),Nn(i)]}var Vn=o();function Hn(e){let t=null;return()=>(t??=e(),t)}function Un(e,t){return e.filter(e=>e!==t)}function Wn(e,t){let n=new Set,r=e=>n.add(e);e.forEach(r),t.forEach(r);let i=[];return n.forEach(e=>i.push(e)),i}var Gn=class{enter(e){let t=this.entered.length,n=t=>this.isNodeInDocument(t)&&(!t.contains||t.contains(e));return this.entered=Wn(this.entered.filter(n),[e]),t===0&&this.entered.length>0}leave(e){let t=this.entered.length;return this.entered=Un(this.entered.filter(this.isNodeInDocument),e),t>0&&this.entered.length===0}reset(){this.entered=[]}constructor(e){this.entered=[],this.isNodeInDocument=e}},Kn=class{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(e=>{Object.defineProperty(this.item,e,{configurable:!0,enumerable:!0,get(){return console.warn(`Browser doesn't allow reading "${e}" until the drop event.`),null}})})}loadDataTransfer(e){if(e){let t={};Object.keys(this.config.exposeProperties).forEach(n=>{let r=this.config.exposeProperties[n];r!=null&&(t[n]={value:r(e,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,t)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(e,t){return t===e.getSourceId()}endDrag(){}constructor(e){this.config=e,this.item={},this.initializeExposedProperties()}},qn=t({FILE:()=>Jn,HTML:()=>Zn,TEXT:()=>Xn,URL:()=>Yn}),Jn=`__NATIVE_FILE__`,Yn=`__NATIVE_URL__`,Xn=`__NATIVE_TEXT__`,Zn=`__NATIVE_HTML__`;function Qn(e,t,n){return t.reduce((t,n)=>t||e.getData(n),``)??n}var $n={[Jn]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:[`Files`]},[Zn]:{exposeProperties:{html:(e,t)=>Qn(e,t,``),dataTransfer:e=>e},matchesTypes:[`Html`,`text/html`]},[Yn]:{exposeProperties:{urls:(e,t)=>Qn(e,t,``).split(`
|
|
2
|
-
`),dataTransfer:e=>e},matchesTypes:[`Url`,`text/uri-list`]},[Xn]:{exposeProperties:{text:(e,t)=>Qn(e,t,``),dataTransfer:e=>e},matchesTypes:[`Text`,`text/plain`]}};function er(e,t){let n=$n[e];if(!n)throw Error(`native type ${e} has no configuration`);let r=new Kn(n);return r.loadDataTransfer(t),r}function tr(e){if(!e)return null;let t=Array.prototype.slice.call(e.types||[]);return Object.keys($n).filter(e=>{let n=$n[e];return n?.matchesTypes?n.matchesTypes.some(e=>t.indexOf(e)>-1):!1})[0]||null}var nr=Hn(()=>/firefox/i.test(navigator.userAgent)),rr=Hn(()=>!!window.safari),ir=class{interpolate(e){let{xs:t,ys:n,c1s:r,c2s:i,c3s:a}=this,o=t.length-1;if(e===t[o])return n[o];let s=0,c=a.length-1,l;for(;s<=c;){l=Math.floor(.5*(s+c));let r=t[l];if(r<e)s=l+1;else if(r>e)c=l-1;else return n[l]}o=Math.max(0,c);let u=e-t[o],d=u*u;return n[o]+r[o]*u+i[o]*d+a[o]*u*d}constructor(e,t){let{length:n}=e,r=[];for(let e=0;e<n;e++)r.push(e);r.sort((t,n)=>e[t]<e[n]?-1:1);let i=[],a=[],o=[],s,c;for(let r=0;r<n-1;r++)s=e[r+1]-e[r],c=t[r+1]-t[r],a.push(s),i.push(c),o.push(c/s);let l=[o[0]];for(let e=0;e<a.length-1;e++){let t=o[e],n=o[e+1];if(t*n<=0)l.push(0);else{s=a[e];let r=a[e+1],i=s+r;l.push(3*i/((i+r)/t+(i+s)/n))}}l.push(o[o.length-1]);let u=[],d=[],f;for(let e=0;e<l.length-1;e++){f=o[e];let t=l[e],n=1/a[e],r=t+l[e+1]-f-f;u.push((f-t-r)*n),d.push(r*n*n)}this.xs=e,this.ys=t,this.c1s=l,this.c2s=u,this.c3s=d}},ar=1;function or(e){let t=e.nodeType===ar?e:e.parentElement;if(!t)return null;let{top:n,left:r}=t.getBoundingClientRect();return{x:r,y:n}}function F(e){return{x:e.clientX,y:e.clientY}}function sr(e){return e.nodeName===`IMG`&&(nr()||!document.documentElement?.contains(e))}function cr(e,t,n,r){let i=e?t.width:n,a=e?t.height:r;return rr()&&e&&(a/=window.devicePixelRatio,i/=window.devicePixelRatio),{dragPreviewWidth:i,dragPreviewHeight:a}}function lr(e,t,n,r,i){let a=sr(t),o=or(a?e:t),s={x:n.x-o.x,y:n.y-o.y},{offsetWidth:c,offsetHeight:l}=e,{anchorX:u,anchorY:d}=r,{dragPreviewWidth:f,dragPreviewHeight:p}=cr(a,t,c,l),m=()=>{let e=new ir([0,.5,1],[s.y,s.y/l*p,s.y+p-l]).interpolate(d);return rr()&&a&&(e+=(window.devicePixelRatio-1)*p),e},h=()=>new ir([0,.5,1],[s.x,s.x/c*f,s.x+f-c]).interpolate(u),{offsetX:g,offsetY:_}=i,ee=g===0||g,v=_===0||_;return{x:ee?g:h(),y:v?_:m()}}var ur=class{get window(){if(this.globalContext)return this.globalContext;if(typeof window<`u`)return window}get document(){if(this.globalContext?.document)return this.globalContext.document;if(this.window)return this.window.document}get rootElement(){return this.optionsArgs?.rootElement||this.window}constructor(e,t){this.ownerDocument=null,this.globalContext=e,this.optionsArgs=t}};function dr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){dr(e,t,n[t])})}return e}var pr=class{profile(){return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:this.dragStartSourceIds?.length||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:this.dragOverTargetIds?.length||0}}get window(){return this.options.window}get document(){return this.options.document}get rootElement(){return this.options.rootElement}setup(){let e=this.rootElement;if(e!==void 0){if(e.__isReactDndBackendSetUp)throw Error(`Cannot have two HTML5 backends at the same time.`);e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}teardown(){let e=this.rootElement;if(e!==void 0&&(e.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var t;(t=this.window)==null||t.cancelAnimationFrame(this.asyncEndDragFrameId)}}connectDragPreview(e,t,n){return this.sourcePreviewNodeOptions.set(e,n),this.sourcePreviewNodes.set(e,t),()=>{this.sourcePreviewNodes.delete(e),this.sourcePreviewNodeOptions.delete(e)}}connectDragSource(e,t,n){this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,n);let r=t=>this.handleDragStart(t,e),i=e=>this.handleSelectStart(e);return t.setAttribute(`draggable`,`true`),t.addEventListener(`dragstart`,r),t.addEventListener(`selectstart`,i),()=>{this.sourceNodes.delete(e),this.sourceNodeOptions.delete(e),t.removeEventListener(`dragstart`,r),t.removeEventListener(`selectstart`,i),t.setAttribute(`draggable`,`false`)}}connectDropTarget(e,t){let n=t=>this.handleDragEnter(t,e),r=t=>this.handleDragOver(t,e),i=t=>this.handleDrop(t,e);return t.addEventListener(`dragenter`,n),t.addEventListener(`dragover`,r),t.addEventListener(`drop`,i),()=>{t.removeEventListener(`dragenter`,n),t.removeEventListener(`dragover`,r),t.removeEventListener(`drop`,i)}}addEventListeners(e){e.addEventListener&&(e.addEventListener(`dragstart`,this.handleTopDragStart),e.addEventListener(`dragstart`,this.handleTopDragStartCapture,!0),e.addEventListener(`dragend`,this.handleTopDragEndCapture,!0),e.addEventListener(`dragenter`,this.handleTopDragEnter),e.addEventListener(`dragenter`,this.handleTopDragEnterCapture,!0),e.addEventListener(`dragleave`,this.handleTopDragLeaveCapture,!0),e.addEventListener(`dragover`,this.handleTopDragOver),e.addEventListener(`dragover`,this.handleTopDragOverCapture,!0),e.addEventListener(`drop`,this.handleTopDrop),e.addEventListener(`drop`,this.handleTopDropCapture,!0))}removeEventListeners(e){e.removeEventListener&&(e.removeEventListener(`dragstart`,this.handleTopDragStart),e.removeEventListener(`dragstart`,this.handleTopDragStartCapture,!0),e.removeEventListener(`dragend`,this.handleTopDragEndCapture,!0),e.removeEventListener(`dragenter`,this.handleTopDragEnter),e.removeEventListener(`dragenter`,this.handleTopDragEnterCapture,!0),e.removeEventListener(`dragleave`,this.handleTopDragLeaveCapture,!0),e.removeEventListener(`dragover`,this.handleTopDragOver),e.removeEventListener(`dragover`,this.handleTopDragOverCapture,!0),e.removeEventListener(`drop`,this.handleTopDrop),e.removeEventListener(`drop`,this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){let e=this.monitor.getSourceId(),t=this.sourceNodeOptions.get(e);return fr({dropEffect:this.altKeyPressed?`copy`:`move`},t||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?`copy`:this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){let e=this.monitor.getSourceId();return fr({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}isDraggingNativeItem(){let e=this.monitor.getItemType();return Object.keys(qn).some(t=>qn[t]===e)}beginDragNativeItem(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=er(e,t),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(e){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout(()=>this.rootElement?.addEventListener(`mousemove`,this.endDragIfSourceWasRemovedFromDOM,!0),1e3)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var e;(e=this.window)==null||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener(`mousemove`,this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(e,t){e.defaultPrevented||(this.dragStartSourceIds||=[],this.dragStartSourceIds.unshift(t))}handleDragEnter(e,t){this.dragEnterTargetIds.unshift(t)}handleDragOver(e,t){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}handleDrop(e,t){this.dropTargetIds.unshift(t)}constructor(e,t,n){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=e=>{let t=this.sourceNodes.get(e);return t&&or(t)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=e=>!!(e&&this.document&&this.document.body&&this.document.body.contains(e)),this.endDragIfSourceWasRemovedFromDOM=()=>{let e=this.currentDragSourceNode;e==null||this.isNodeInDocument(e)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=e=>{this.hoverRafId===null&&typeof requestAnimationFrame<`u`&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(e||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{this.hoverRafId!==null&&typeof cancelAnimationFrame<`u`&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=e=>{if(e.defaultPrevented)return;let{dragStartSourceIds:t}=this;this.dragStartSourceIds=null;let n=F(e);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:n});let{dataTransfer:r}=e,i=tr(r);if(this.monitor.isDragging()){if(r&&typeof r.setDragImage==`function`){let e=this.monitor.getSourceId(),t=this.sourceNodes.get(e),i=this.sourcePreviewNodes.get(e)||t;if(i){let{anchorX:e,anchorY:a,offsetX:o,offsetY:s}=this.getCurrentSourcePreviewNodeOptions(),c=lr(t,i,n,{anchorX:e,anchorY:a},{offsetX:o,offsetY:s});r.setDragImage(i,c.x,c.y)}}try{r?.setData(`application/json`,{})}catch{}this.setCurrentDragSourceNode(e.target);let{captureDraggingState:t}=this.getCurrentSourcePreviewNodeOptions();t?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(i)this.beginDragNativeItem(i);else if(r&&!r.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute(`draggable`)))return;else e.preventDefault()},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=e=>{if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()){var t;(t=this.currentNativeSource)==null||t.loadDataTransfer(e.dataTransfer)}if(!this.enterLeaveCounter.enter(e.target)||this.monitor.isDragging())return;let{dataTransfer:n}=e,r=tr(n);r&&this.beginDragNativeItem(r,n)},this.handleTopDragEnter=e=>{let{dragEnterTargetIds:t}=this;this.dragEnterTargetIds=[],this.monitor.isDragging()&&(this.altKeyPressed=e.altKey,t.length>0&&this.actions.hover(t,{clientOffset:F(e)}),t.some(e=>this.monitor.canDropOnTarget(e))&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())))},this.handleTopDragOverCapture=e=>{if(this.dragOverTargetIds=[],this.isDraggingNativeItem()){var t;(t=this.currentNativeSource)==null||t.loadDataTransfer(e.dataTransfer)}},this.handleTopDragOver=e=>{let{dragOverTargetIds:t}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging()){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`none`);return}this.altKeyPressed=e.altKey,this.lastClientOffset=F(e),this.scheduleHover(t),(t||[]).some(e=>this.monitor.canDropOnTarget(e))?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`none`))},this.handleTopDragLeaveCapture=e=>{this.isDraggingNativeItem()&&e.preventDefault(),this.enterLeaveCounter.leave(e.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=e=>{if(this.dropTargetIds=[],this.isDraggingNativeItem()){var t;e.preventDefault(),(t=this.currentNativeSource)==null||t.loadDataTransfer(e.dataTransfer)}else tr(e.dataTransfer)&&e.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=e=>{let{dropTargetIds:t}=this;this.dropTargetIds=[],this.actions.hover(t,{clientOffset:F(e)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=e=>{let t=e.target;typeof t.dragDrop==`function`&&(t.tagName===`INPUT`||t.tagName===`SELECT`||t.tagName===`TEXTAREA`||t.isContentEditable||(e.preventDefault(),t.dragDrop()))},this.options=new ur(t,n),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new Gn(this.isNodeInDocument)}},I;function mr(){return I||(I=new Image,I.src=`data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==`),I}var hr=function(e,t,n){return new pr(e,t,n)},gr=(0,C.createContext)(null);function L(){let e=(0,C.useContext)(gr);if(e===null)throw Error(`No Tree Api Provided`);return e}var _r=(0,C.createContext)(null);function vr(){let e=(0,C.useContext)(_r);if(e===null)throw Error(`Provide a NodesContext`);return e}var yr=(0,C.createContext)(null);function br(){let e=(0,C.useContext)(yr);if(e===null)throw Error(`Provide a DnDContext`);return e}var xr=(0,C.createContext)(0);function Sr(){(0,C.useContext)(xr)}var Cr=t({access:()=>B,bound:()=>R,dfs:()=>Ar,focusNextElement:()=>jr,focusPrevElement:()=>Mr,getInsertIndex:()=>zr,getInsertParentId:()=>Hr,getTreeLinePrefix:()=>Vr,indexOf:()=>Or,isClosed:()=>Tr,isDescendant:()=>Dr,isItem:()=>wr,isOpenWithEmptyChildren:()=>Er,mergeRefs:()=>Ir,noop:()=>kr,safeRun:()=>Lr,waitFor:()=>Rr,walk:()=>z});function R(e,t,n){return Math.max(Math.min(e,n),t)}function wr(e){return e&&e.isLeaf}function Tr(e){return e&&e.isInternal&&!e.isOpen}function Er(e){return e&&e.isOpen&&!e.children?.length}var Dr=(e,t)=>{let n=e;for(;n;){if(n.id===t.id)return!0;n=n.parent}return!1},Or=e=>{if(!e.parent)throw Error(`Node does not have a parent`);return e.parent.children.findIndex(t=>t.id===e.id)};function kr(){}function Ar(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let n of e.children){let e=Ar(n,t);if(e)return e}return null}function z(e,t){if(t(e),e.children)for(let n of e.children)z(n,t)}function jr(e){let t=Fr(e),n;for(let r=0;r<t.length;++r)if(t[r]===e){n=Nr(t,r);break}n?.focus()}function Mr(e){let t=Fr(e),n;for(let r=0;r<t.length;++r)if(t[r]===e){n=Pr(t,r);break}n?.focus()}function Nr(e,t){return t+1<e.length?e[t+1]:e[0]}function Pr(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function Fr(e){return Array.from(document.querySelectorAll(`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)`)).filter(t=>t===e||!e.contains(t))}function B(e,t){return typeof t==`boolean`?t:typeof t==`string`?e[t]:t(e)}function Ir(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}function Lr(e,...t){if(e)return e(...t)}function Rr(e){return new Promise((t,n)=>{let r=0;function i(){r+=1,r===100&&n(),e()?t():setTimeout(i,10)}i()})}function zr(e){let t=e.focusedNode;return t?t.isOpen?0:t.parent?t.childIndex+1:0:e.root.children?.length??0}var Br={last:`└ `,middle:`├ `,pipe:`│ `,blank:` `};function Vr(e,t={}){let n=Object.assign(Object.assign({},Br),t);if(e.level===0)return``;let r=e.nextSibling===null?n.last:n.middle,i=e.parent;for(;i&&i.level>0;)r=(i.nextSibling===null?n.blank:n.pipe)+r,i=i.parent;return r}function Hr(e){let t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}var Ur={display:`flex`,alignItems:`center`,zIndex:1},Wr={flex:1,height:`2px`,background:`#4B91E2`,borderRadius:`1px`},Gr={width:`4px`,height:`4px`,boxShadow:`0 0 0 3px #4B91E2`,borderRadius:`50%`},Kr=C.memo(function({top:e,left:t,indent:n}){let r={position:`absolute`,pointerEvents:`none`,top:e-2+`px`,left:t+`px`,right:n+`px`};return(0,S.jsxs)(`div`,{style:Object.assign(Object.assign({},Ur),r),children:[(0,S.jsx)(`div`,{style:Object.assign({},Gr)}),(0,S.jsx)(`div`,{style:Object.assign({},Wr)})]})});function qr({node:e,attrs:t,innerRef:n,children:r}){return(0,S.jsx)(`div`,Object.assign({},t,{ref:n,onFocus:e=>e.stopPropagation(),onClick:e.handleClick,children:r}))}function Jr(e){return(0,S.jsxs)(`div`,{ref:e.dragHandle,style:e.style,children:[(0,S.jsx)(`span`,{onClick:t=>{t.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?`🌳`:e.node.isOpen?`🗁`:`🗀`}),` `,e.node.isEditing?(0,S.jsx)(Xr,Object.assign({},e)):(0,S.jsx)(Yr,Object.assign({},e))]})}function Yr(e){return(0,S.jsx)(S.Fragment,{children:(0,S.jsx)(`span`,{children:e.node.data.name})})}function Xr({node:e}){let t=(0,C.useRef)();return(0,C.useEffect)(()=>{var e,n;(e=t.current)==null||e.focus(),(n=t.current)==null||n.select()},[]),(0,S.jsx)(`input`,{ref:t,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:n=>{n.key===`Escape`&&e.reset(),n.key===`Enter`&&e.submit(t.current?.value||``)}})}var Zr=`__REACT_ARBORIST_INTERNAL_ROOT__`;function Qr(e){function t(n,r,i){let a=new $r({tree:e,data:n,level:r,parent:i,id:e.accessId(n),children:null,isDraggable:e.isDraggable(n),rowIndex:null}),o=e.accessChildren(n);return o&&(a.children=o.map(e=>t(e,r+1,a))),a}let n=new $r({tree:e,id:Zr,data:{id:Zr},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null});return n.children=(e.props.data??[]).map(e=>t(e,0,n)),n}var $r=class e{constructor(e){this.handleClick=e=>{(e.metaKey||e.ctrlKey)&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():e.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=e.tree,this.id=e.id,this.data=e.data,this.level=e.level,this.children=e.children,this.parent=e.parent,this.isDraggable=e.isDraggable,this.rowIndex=e.rowIndex,this.select=this.select.bind(this),this.deselect=this.deselect.bind(this),this.selectMulti=this.selectMulti.bind(this),this.selectContiguous=this.selectContiguous.bind(this),this.activate=this.activate.bind(this),this.focus=this.focus.bind(this),this.toggle=this.toggle.bind(this),this.open=this.open.bind(this),this.openParents=this.openParents.bind(this),this.close=this.close.bind(this),this.submit=this.submit.bind(this),this.reset=this.reset.bind(this),this.edit=this.edit.bind(this)}get isRoot(){return this.id===Zr}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return!this.isLeaf&&this.tree.isOpen(this.id)}get isClosed(){return!this.isLeaf&&!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isSelectable(){return this.tree.isSelectable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){return this.isSelected&&!this.prev?.isSelected}get isSelectedEnd(){return this.isSelected&&!this.next?.isSelected}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(e=>e.id===this.id):-1}get next(){return this.rowIndex===null?null:this.tree.at(this.rowIndex+1)}get prev(){return this.rowIndex===null?null:this.tree.at(this.rowIndex-1)}get nextSibling(){let e=this.childIndex;return this.parent?.children[e+1]??null}isAncestorOf(e){if(!e)return!1;let t=e;for(;t;){if(t.id===this.id)return!0;t=t.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(e){this.tree.submit(this,e)}reset(){this.tree.reset()}clone(){return new e(Object.assign({},this))}edit(){return this.tree.edit(this)}};function ei(e){return{type:`EDIT`,id:e}}function ti(e={id:null},t){return t.type===`EDIT`?Object.assign(Object.assign({},e),{id:t.id}):e}function V(e){return{type:`FOCUS`,id:e}}function ni(){return{type:`TREE_BLUR`}}function ri(e={id:null,treeFocused:!1},t){return t.type===`FOCUS`?Object.assign(Object.assign({},e),{id:t.id,treeFocused:!0}):t.type===`TREE_BLUR`?Object.assign(Object.assign({},e),{treeFocused:!1}):e}var ii={open(e,t){return{type:`VISIBILITY_OPEN`,id:e,filtered:t}},close(e,t){return{type:`VISIBILITY_CLOSE`,id:e,filtered:t}},toggle(e,t){return{type:`VISIBILITY_TOGGLE`,id:e,filtered:t}},clear(e){return{type:`VISIBILITY_CLEAR`,filtered:e}}};function ai(e={},t){if(t.type===`VISIBILITY_OPEN`)return Object.assign(Object.assign({},e),{[t.id]:!0});if(t.type===`VISIBILITY_CLOSE`)return Object.assign(Object.assign({},e),{[t.id]:!1});if(t.type===`VISIBILITY_TOGGLE`){let n=e[t.id];return Object.assign(Object.assign({},e),{[t.id]:!n})}return t.type===`VISIBILITY_CLEAR`?{}:e}function oi(e={filtered:{},unfiltered:{}},t){return t.type.startsWith(`VISIBILITY`)?t.filtered?Object.assign(Object.assign({},e),{filtered:ai(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:ai(e.unfiltered,t)}):e}var H=e=>({nodes:{open:{filtered:{},unfiltered:e?.initialOpenState??{}},focus:{id:null,treeFocused:!1},edit:{id:null},drag:{id:null,selectedIds:[],destinationParentId:null,destinationIndex:null},selection:{ids:new Set,anchor:null,mostRecent:null}},dnd:{cursor:{type:`none`},dragId:null,dragIds:[],parentId:null,index:-1}}),U={clear:()=>({type:`SELECTION_CLEAR`}),only:e=>({type:`SELECTION_ONLY`,id:e}),add:e=>({type:`SELECTION_ADD`,ids:Array.isArray(e)?e:[e]}),remove:e=>({type:`SELECTION_REMOVE`,ids:Array.isArray(e)?e:[e]}),set:e=>Object.assign({type:`SELECTION_SET`},e),mostRecent:e=>({type:`SELECTION_MOST_RECENT`,id:e}),anchor:e=>({type:`SELECTION_ANCHOR`,id:e})};function si(e=H().nodes.selection,t){let n=e.ids;switch(t.type){case`SELECTION_CLEAR`:return Object.assign(Object.assign({},e),{ids:new Set});case`SELECTION_ONLY`:return Object.assign(Object.assign({},e),{ids:new Set([t.id])});case`SELECTION_ADD`:return t.ids.length===0?e:(t.ids.forEach(e=>n.add(e)),Object.assign(Object.assign({},e),{ids:new Set(n)}));case`SELECTION_REMOVE`:return t.ids.length===0?e:(t.ids.forEach(e=>n.delete(e)),Object.assign(Object.assign({},e),{ids:new Set(n)}));case`SELECTION_SET`:return Object.assign(Object.assign({},e),{ids:t.ids,mostRecent:t.mostRecent,anchor:t.anchor});case`SELECTION_MOST_RECENT`:return Object.assign(Object.assign({},e),{mostRecent:t.id});case`SELECTION_ANCHOR`:return Object.assign(Object.assign({},e),{anchor:t.id});default:return e}}var W={cursor(e){return{type:`DND_CURSOR`,cursor:e}},dragStart(e,t){return{type:`DND_DRAG_START`,id:e,dragIds:t}},dragEnd(){return{type:`DND_DRAG_END`}},hovering(e,t){return{type:`DND_HOVERING`,parentId:e,index:t}},setDestination(e,t){return{type:`DND_DESTINATION`,parentId:e,index:t}}};function ci(e=H().dnd,t){switch(t.type){case`DND_CURSOR`:return Object.assign(Object.assign({},e),{cursor:t.cursor});case`DND_DRAG_START`:return Object.assign(Object.assign({},e),{dragId:t.id,dragIds:t.dragIds});case`DND_DRAG_END`:return H().dnd;case`DND_HOVERING`:return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}var li={position:`fixed`,pointerEvents:`none`,zIndex:100,left:0,top:0,width:`100%`,height:`100%`},ui=e=>{if(!e)return{display:`none`};let{x:t,y:n}=e;return{transform:`translate(${t}px, ${n}px)`}},di=e=>{if(!e)return{display:`none`};let{x:t,y:n}=e;return{transform:`translate(${t+10}px, ${n+10}px)`}};function fi({offset:e,mouse:t,id:n,dragIds:r,isDragging:i}){return(0,S.jsxs)(pi,{isDragging:i,children:[(0,S.jsx)(mi,{offset:e,children:(0,S.jsx)(gi,{id:n,dragIds:r})}),(0,S.jsx)(hi,{mouse:t,count:r.length})]})}var pi=(0,C.memo)(function(e){return e.isDragging?(0,S.jsx)(`div`,{style:li,children:e.children}):null});function mi(e){return(0,S.jsx)(`div`,{className:`row preview`,style:ui(e.offset),children:e.children})}function hi(e){let{count:t,mouse:n}=e;return t>1?(0,S.jsx)(`div`,{className:`selected-count`,style:di(n),children:t}):null}var gi=(0,C.memo)(function(e){let t=L(),n=t.get(e.id);return n?(0,S.jsx)(t.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*t.indent,opacity:.2,background:`transparent`},tree:t}):null});function _i(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function vi(e,t){return vi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},vi(e,t)}function yi(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,vi(e,t)}var bi=Number.isNaN||function(e){return typeof e==`number`&&e!==e};function xi(e,t){return!!(e===t||bi(e)&&bi(t))}function Si(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!xi(e[n],t[n]))return!1;return!0}function Ci(e,t){t===void 0&&(t=Si);var n,r=[],i,a=!1;function o(){var o=[...arguments];return a&&n===this&&t(o,r)?i:(i=e.apply(this,o),a=!0,n=this,r=o,i)}return o}var wi=typeof performance==`object`&&typeof performance.now==`function`?function(){return performance.now()}:function(){return Date.now()};function Ti(e){cancelAnimationFrame(e.id)}function Ei(e,t){var n=wi();function r(){wi()-n>=t?e.call(null):i.id=requestAnimationFrame(r)}var i={id:requestAnimationFrame(r)};return i}var Di=-1;function Oi(e){if(e===void 0&&(e=!1),Di===-1||e){var t=document.createElement(`div`),n=t.style;n.width=`50px`,n.height=`50px`,n.overflow=`scroll`,document.body.appendChild(t),Di=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Di}var G=null;function ki(e){if(e===void 0&&(e=!1),G===null||e){var t=document.createElement(`div`),n=t.style;n.width=`50px`,n.height=`50px`,n.overflow=`scroll`,n.direction=`rtl`;var r=document.createElement(`div`),i=r.style;return i.width=`100px`,i.height=`100px`,t.appendChild(r),document.body.appendChild(t),t.scrollLeft>0?G=`positive-descending`:(t.scrollLeft=1,G=t.scrollLeft===0?`negative`:`positive-ascending`),document.body.removeChild(t),G}return G}var Ai=150,ji=function(e,t){return e};function Mi(e){var t,n=e.getItemOffset,r=e.getEstimatedTotalSize,i=e.getItemSize,a=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,s=e.getStopIndexForStartIndex,c=e.initInstanceProps,l=e.shouldResetStyleCacheOnItemSizeChange,u=e.validateProps;return t=function(e){yi(t,e);function t(t){var r=e.call(this,t)||this;return r._instanceProps=c(r.props,_i(r)),r._outerRef=void 0,r._resetIsScrollingTimeoutId=null,r.state={instance:_i(r),isScrolling:!1,scrollDirection:`forward`,scrollOffset:typeof r.props.initialScrollOffset==`number`?r.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},r._callOnItemsRendered=void 0,r._callOnItemsRendered=Ci(function(e,t,n,i){return r.props.onItemsRendered({overscanStartIndex:e,overscanStopIndex:t,visibleStartIndex:n,visibleStopIndex:i})}),r._callOnScroll=void 0,r._callOnScroll=Ci(function(e,t,n){return r.props.onScroll({scrollDirection:e,scrollOffset:t,scrollUpdateWasRequested:n})}),r._getItemStyle=void 0,r._getItemStyle=function(e){var t=r.props,a=t.direction,o=t.itemSize,s=t.layout,c=r._getItemStyleCache(l&&o,l&&s,l&&a),u;if(c.hasOwnProperty(e))u=c[e];else{var d=n(r.props,e,r._instanceProps),f=i(r.props,e,r._instanceProps),p=a===`horizontal`||s===`horizontal`,m=a===`rtl`,h=p?d:0;c[e]=u={position:`absolute`,left:m?void 0:h,right:m?h:void 0,top:p?0:d,height:p?`100%`:f,width:p?f:`100%`}}return u},r._getItemStyleCache=void 0,r._getItemStyleCache=Ci(function(e,t,n){return{}}),r._onScrollHorizontal=function(e){var t=e.currentTarget,n=t.clientWidth,i=t.scrollLeft,a=t.scrollWidth;r.setState(function(e){if(e.scrollOffset===i)return null;var t=r.props.direction,o=i;if(t===`rtl`)switch(ki()){case`negative`:o=-i;break;case`positive-descending`:o=a-n-i}return o=Math.max(0,Math.min(o,a-n)),{isScrolling:!0,scrollDirection:e.scrollOffset<o?`forward`:`backward`,scrollOffset:o,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._onScrollVertical=function(e){var t=e.currentTarget,n=t.clientHeight,i=t.scrollHeight,a=t.scrollTop;r.setState(function(e){if(e.scrollOffset===a)return null;var t=Math.max(0,Math.min(a,i-n));return{isScrolling:!0,scrollDirection:e.scrollOffset<t?`forward`:`backward`,scrollOffset:t,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._outerRefSetter=function(e){var t=r.props.outerRef;r._outerRef=e,typeof t==`function`?t(e):typeof t==`object`&&t&&t.hasOwnProperty(`current`)&&(t.current=e)},r._resetIsScrollingDebounced=function(){r._resetIsScrollingTimeoutId!==null&&Ti(r._resetIsScrollingTimeoutId),r._resetIsScrollingTimeoutId=Ei(r._resetIsScrolling,Ai)},r._resetIsScrolling=function(){r._resetIsScrollingTimeoutId=null,r.setState({isScrolling:!1},function(){r._getItemStyleCache(-1,null)})},r}t.getDerivedStateFromProps=function(e,t){return Ni(e,t),u(e),null};var d=t.prototype;return d.scrollTo=function(e){e=Math.max(0,e),this.setState(function(t){return t.scrollOffset===e?null:{scrollDirection:t.scrollOffset<e?`forward`:`backward`,scrollOffset:e,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},d.scrollToItem=function(e,t){t===void 0&&(t=`auto`);var n=this.props,r=n.itemCount,i=n.layout,o=this.state.scrollOffset;e=Math.max(0,Math.min(e,r-1));var s=0;if(this._outerRef){var c=this._outerRef;s=i===`vertical`?c.scrollWidth>c.clientWidth?Oi():0:c.scrollHeight>c.clientHeight?Oi():0}this.scrollTo(a(this.props,e,t,o,this._instanceProps,s))},d.componentDidMount=function(){var e=this.props,t=e.direction,n=e.initialScrollOffset,r=e.layout;if(typeof n==`number`&&this._outerRef!=null){var i=this._outerRef;t===`horizontal`||r===`horizontal`?i.scrollLeft=n:i.scrollTop=n}this._callPropsCallbacks()},d.componentDidUpdate=function(){var e=this.props,t=e.direction,n=e.layout,r=this.state,i=r.scrollOffset;if(r.scrollUpdateWasRequested&&this._outerRef!=null){var a=this._outerRef;if(t===`horizontal`||n===`horizontal`){if(t===`rtl`)switch(ki()){case`negative`:a.scrollLeft=-i;break;case`positive-ascending`:a.scrollLeft=i;break;default:var o=a.clientWidth;a.scrollLeft=a.scrollWidth-o-i}else a.scrollLeft=i}else a.scrollTop=i}this._callPropsCallbacks()},d.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Ti(this._resetIsScrollingTimeoutId)},d.render=function(){var e=this.props,t=e.children,n=e.className,i=e.direction,a=e.height,o=e.innerRef,s=e.innerElementType,c=e.innerTagName,l=e.itemCount,u=e.itemData,d=e.itemKey,f=d===void 0?ji:d,p=e.layout,m=e.outerElementType,h=e.outerTagName,g=e.style,_=e.useIsScrolling,ee=e.width,v=this.state.isScrolling,y=i===`horizontal`||p===`horizontal`,te=y?this._onScrollHorizontal:this._onScrollVertical,re=this._getRangeToRender(),ie=re[0],b=re[1],ae=[];if(l>0)for(var x=ie;x<=b;x++)ae.push((0,C.createElement)(t,{data:u,key:f(x,u),index:x,isScrolling:_?v:void 0,style:this._getItemStyle(x)}));var oe=r(this.props,this._instanceProps);return(0,C.createElement)(m||h||`div`,{className:n,onScroll:te,ref:this._outerRefSetter,style:ne({position:`relative`,height:a,width:ee,overflow:`auto`,WebkitOverflowScrolling:`touch`,willChange:`transform`,direction:i},g)},(0,C.createElement)(s||c||`div`,{children:ae,ref:o,style:{height:y?`100%`:oe,pointerEvents:v?`none`:void 0,width:y?oe:`100%`}}))},d._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered==`function`&&this.props.itemCount>0){var e=this._getRangeToRender(),t=e[0],n=e[1],r=e[2],i=e[3];this._callOnItemsRendered(t,n,r,i)}if(typeof this.props.onScroll==`function`){var a=this.state,o=a.scrollDirection,s=a.scrollOffset,c=a.scrollUpdateWasRequested;this._callOnScroll(o,s,c)}},d._getRangeToRender=function(){var e=this.props,t=e.itemCount,n=e.overscanCount,r=this.state,i=r.isScrolling,a=r.scrollDirection,c=r.scrollOffset;if(t===0)return[0,0,0,0];var l=o(this.props,c,this._instanceProps),u=s(this.props,l,c,this._instanceProps),d=!i||a===`backward`?Math.max(1,n):1,f=!i||a===`forward`?Math.max(1,n):1;return[Math.max(0,l-d),Math.max(0,Math.min(t-1,u+f)),l,u]},t}(C.PureComponent),t.defaultProps={direction:`ltr`,itemData:void 0,layout:`vertical`,overscanCount:2,useIsScrolling:!1},t}var Ni=function(e,t){e.children,e.direction,e.height,e.layout,e.innerTagName,e.outerTagName,e.width,t.instance},Pi=50,K=function(e,t,n){var r=e.itemSize,i=n.itemMetadataMap,a=n.lastMeasuredIndex;if(t>a){var o=0;if(a>=0){var s=i[a];o=s.offset+s.size}for(var c=a+1;c<=t;c++){var l=r(c);i[c]={offset:o,size:l},o+=l}n.lastMeasuredIndex=t}return i[t]},Fi=function(e,t,n){var r=t.itemMetadataMap,i=t.lastMeasuredIndex;return(i>0?r[i].offset:0)>=n?Ii(e,t,i,0,n):Li(e,t,Math.max(0,i),n)},Ii=function(e,t,n,r,i){for(;r<=n;){var a=r+Math.floor((n-r)/2),o=K(e,a,t).offset;if(o===i)return a;o<i?r=a+1:o>i&&(n=a-1)}return r>0?r-1:0},Li=function(e,t,n,r){for(var i=e.itemCount,a=1;n<i&&K(e,n,t).offset<r;)n+=a,a*=2;return Ii(e,t,Math.min(n,i-1),Math.floor(n/2),r)},Ri=function(e,t){var n=e.itemCount,r=t.itemMetadataMap,i=t.estimatedItemSize,a=t.lastMeasuredIndex,o=0;if(a>=n&&(a=n-1),a>=0){var s=r[a];o=s.offset+s.size}var c=(n-a-1)*i;return o+c},zi=Mi({getItemOffset:function(e,t,n){return K(e,t,n).offset},getItemSize:function(e,t,n){return n.itemMetadataMap[t].size},getEstimatedTotalSize:Ri,getOffsetForIndexAndAlignment:function(e,t,n,r,i,a){var o=e.direction,s=e.height,c=e.layout,l=e.width,u=o===`horizontal`||c===`horizontal`?l:s,d=K(e,t,i),f=Ri(e,i),p=Math.max(0,Math.min(f-u,d.offset)),m=Math.max(0,d.offset-u+d.size+a);switch(n===`smart`&&(n=r>=m-u&&r<=p+u?`auto`:`center`),n){case`start`:return p;case`end`:return m;case`center`:return Math.round(m+(p-m)/2);default:return r>=m&&r<=p?r:r<m?m:p}},getStartIndexForOffset:function(e,t,n){return Fi(e,n,t)},getStopIndexForStartIndex:function(e,t,n,r){for(var i=e.direction,a=e.height,o=e.itemCount,s=e.layout,c=e.width,l=i===`horizontal`||s===`horizontal`?c:a,u=K(e,t,r),d=n+l,f=u.offset+u.size,p=t;p<o-1&&f<d;)p++,f+=K(e,p,r).size;return p},initInstanceProps:function(e,t){var n={itemMetadataMap:{},estimatedItemSize:e.estimatedItemSize||Pi,lastMeasuredIndex:-1};return t.resetAfterIndex=function(e,r){r===void 0&&(r=!0),n.lastMeasuredIndex=Math.min(n.lastMeasuredIndex,e-1),t._getItemStyleCache(-1),r&&t.forceUpdate()},n},shouldResetStyleCacheOnItemSizeChange:!1,validateProps:function(e){e.itemSize}}),Bi=Mi({getItemOffset:function(e,t){return t*e.itemSize},getItemSize:function(e,t){return e.itemSize},getEstimatedTotalSize:function(e){var t=e.itemCount;return e.itemSize*t},getOffsetForIndexAndAlignment:function(e,t,n,r,i,a){var o=e.direction,s=e.height,c=e.itemCount,l=e.itemSize,u=e.layout,d=e.width,f=o===`horizontal`||u===`horizontal`?d:s,p=Math.max(0,c*l-f),m=Math.min(p,t*l),h=Math.max(0,t*l-f+l+a);switch(n===`smart`&&(n=r>=h-f&&r<=m+f?`auto`:`center`),n){case`start`:return m;case`end`:return h;case`center`:var g=Math.round(h+(m-h)/2);return g<Math.ceil(f/2)?0:g>p+Math.floor(f/2)?p:g;default:return r>=h&&r<=m?r:r<h?h:m}},getStartIndexForOffset:function(e,t){var n=e.itemCount,r=e.itemSize;return Math.max(0,Math.min(n-1,Math.floor(t/r)))},getStopIndexForStartIndex:function(e,t,n){var r=e.direction,i=e.height,a=e.itemCount,o=e.itemSize,s=e.layout,c=e.width,l=r===`horizontal`||s===`horizontal`,u=t*o,d=Math.ceil(((l?c:i)+n-u)/o);return Math.max(0,Math.min(a-1,t+d-1))},initInstanceProps:function(e){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(e){e.itemSize}});function Vi(){let e=L(),t=br().cursor;if(!t||t.type!==`line`)return null;let n=e.indent,r=e.rowTopPosition(t.index)+(e.props.padding??e.props.paddingTop??0),i=n*t.level,a=e.renderCursor;return(0,S.jsx)(a,{top:r,left:i,indent:n})}var Hi=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Ui=(0,C.forwardRef)(function(e,t){let{children:n}=e,r=Hi(e,[`children`]),i=L();return(0,S.jsxs)(`div`,Object.assign({ref:t},r,{onClick:e=>{i.props.disableDeselectOnClick||e.currentTarget===e.target&&i.deselectAll()},children:[(0,S.jsx)(Wi,{}),n]}))}),Wi=()=>{let e=L();return(0,S.jsx)(`div`,{style:{height:e.rowTopPosition(e.visibleNodes.length),width:`100%`,position:`absolute`,left:`0`,right:`0`},children:(0,S.jsx)(Vi,{})})},Gi=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Ki=(0,C.forwardRef)(function(e,t){var{style:n}=e,r=Gi(e,[`style`]);let i=L(),a=i.props.padding??i.props.paddingTop??0,o=i.props.padding??i.props.paddingBottom??0;return(0,S.jsx)(`div`,Object.assign({ref:t,style:Object.assign(Object.assign({},n),{height:`${parseFloat(n.height)+a+o}px`})},r))});function qi(e,t){return typeof e==`function`?e(t):e??`NODE`}function Ji(e){return e.isDraggable&&!e.isEditing}function Yi(e){let t=L(),n=t.selectedIds,[r,i,a]=jn(()=>({canDrag:()=>Ji(e),type:qi(t.props.dragType,e),item:()=>{let r=t.isSelected(e.id)?Array.from(n):[e.id];return t.dispatch(W.dragStart(e.id,r)),{id:e.id,dragIds:r,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(W.dragEnd())}}),[n,e,t.props.dragType]);return(0,C.useEffect)(()=>{a(mr())},[a]),i}function Xi(e,t){let n=e.getBoundingClientRect(),r=t.x-Math.round(n.x),i=t.y-Math.round(n.y),a=n.height,o=i<a/2,s=!o,c=a/4,l=i>c&&i<a-c;return{x:r,inTopHalf:o,inBottomHalf:s,inMiddle:l,atTop:!l&&o,atBottom:!l&&s}}function Zi(e,t,n,r){return e?e.isInternal?r.atTop?[t,e]:r.inMiddle?[e,e]:[e,n]:r.inTopHalf?[t,e]:[e,n]:[t,null]}function Qi(e,t){return{parentId:e||null,index:t}}function q(e,t){return{type:`line`,index:e,level:t}}function $i(e){return{type:`highlight`,id:e}}function ea(e,t){let n=e;for(;n.parent&&n.level>t;)n=n.parent;return{parentId:n.parent?.id||null,index:Or(n)+1}}function ta(e){let t=Xi(e.element,e.offset),n=e.indent,r=Math.round(Math.max(0,t.x-n)/n),{node:i,nextNode:a,prevNode:o}=e,[s,c]=Zi(i,o,a,t);if(i&&i.isInternal&&t.inMiddle)return{drop:Qi(i.id,null),cursor:$i(i.id)};if(!s)return{drop:Qi(c?.parent?.id,0),cursor:q(0,0)};if(wr(s)){let e=R(r,c?.level||0,s.level);return{drop:ea(s,e),cursor:q(s.rowIndex+1,e)}}if(Tr(s)){let e=R(r,c?.level||0,s.level);return{drop:ea(s,e),cursor:q(s.rowIndex+1,e)}}let l=R(r,0,s.level+1);return l>s.level?{drop:Qi(s.id,0),cursor:q(s.rowIndex+1,l)}:{drop:ea(s,l),cursor:q(s.rowIndex+1,l)}}function na(e,t){let n=L(),[r,i]=Bn(()=>({accept:`NODE`,canDrop:()=>n.canDrop(),hover:(r,i)=>{let a=i.getClientOffset();if(!e.current||!a)return;let{cursor:o,drop:s}=ta({element:e.current,offset:a,indent:n.indent,node:t,prevNode:t.prev,nextNode:t.next});n.hover(s,o)},drop:(e,t)=>{if(!t.canDrop())return null;n.drop()}}),[t,e.current,n.props]);return i}function ra(e){let t=L(),n=t.at(e);if(!n)throw Error(`Could not find node for index: ${e}`);return(0,C.useMemo)(()=>{let r=n.clone();return t.visibleNodes[e]=r,r},[...Object.values(n.state),n])}var ia=C.memo(function({index:e,style:t}){Sr(),vr();let n=L(),r=ra(e),i=(0,C.useRef)(null),a=Yi(r),o=na(i,r),s=(0,C.useCallback)(e=>{i.current=e,o(e)},[o]),c=n.indent*r.level,l=(0,C.useMemo)(()=>({paddingLeft:c}),[c]),u=(0,C.useMemo)(()=>Object.assign(Object.assign({},t),{top:parseFloat(t.top)+(n.props.padding??n.props.paddingTop??0),minWidth:`max-content`}),[t,n.props.padding,n.props.paddingTop]),d={role:`treeitem`,"aria-level":r.level+1,"aria-selected":r.isSelected,"aria-expanded":r.isOpen,style:u,tabIndex:-1,className:n.props.rowClassName};(0,C.useEffect)(()=>{var e;!r.isEditing&&r.isFocused&&((e=i.current)==null||e.focus({preventScroll:!0}))},[r.isEditing,r.isFocused,i.current]);let f=n.renderNode,p=n.renderRow;return(0,S.jsx)(p,{node:r,innerRef:s,attrs:d,children:(0,S.jsx)(f,{node:r,tree:n,style:l,dragHandle:a})})}),aa=``,oa=null;function sa(){Sr();let e=L();return(0,S.jsx)(`div`,{role:`tree`,"aria-label":e.props[`aria-label`],"aria-labelledby":e.props[`aria-labelledby`],"aria-multiselectable":!e.props.disableMultiSelection||void 0,style:{height:e.height,width:e.width,minHeight:0,minWidth:0},onContextMenu:e.props.onContextMenu,onClick:e.props.onClick,tabIndex:0,onFocus:t=>{t.currentTarget.contains(t.relatedTarget)||e.onFocus()},onBlur:t=>{t.currentTarget.contains(t.relatedTarget)||e.onBlur()},onKeyDown:t=>{if(e.isEditing)return;let n=t.target;if(n instanceof Element&&n!==t.currentTarget&&n.closest(`input, textarea, select, [contenteditable]:not([contenteditable='false'])`))return;if(t.key===`Backspace`){if(!e.props.onDelete)return;let t=Array.from(e.selectedIds);if(t.length>1){let n=e.mostRecentNode;for(;n&&n.isSelected;)n=n.nextSibling;n||=e.lastNode,e.focus(n,{scroll:!1}),e.delete(Array.from(t))}else{let t=e.focusedNode;if(t){let n=t.nextSibling,r=t.parent;e.focus(n||r,{scroll:!1}),e.delete(t)}}return}if(t.key===`Tab`&&!t.shiftKey){t.preventDefault(),jr(t.currentTarget);return}if(t.key===`Tab`&&t.shiftKey){t.preventDefault(),Mr(t.currentTarget);return}if(t.key===`ArrowDown`){t.preventDefault();let n=e.nextNode;if(t.metaKey){e.select(e.focusedNode),e.activate(e.focusedNode);return}if(!t.shiftKey||e.props.disableMultiSelection){e.focus(n);return}{if(!n)return;let t=e.focusedNode;t?t.isSelected?e.selectContiguous(n):e.selectMulti(n):e.focus(e.firstNode);return}}if(t.key===`ArrowUp`){t.preventDefault();let n=e.prevNode;if(!t.shiftKey||e.props.disableMultiSelection){e.focus(n);return}{if(!n)return;let t=e.focusedNode;t?t.isSelected?e.selectContiguous(n):e.selectMulti(n):e.focus(e.lastNode);return}}if(t.key===`ArrowRight`){let t=e.focusedNode;if(!t)return;t.isInternal&&t.isOpen?e.focus(e.nextNode):t.isInternal&&e.open(t.id);return}if(t.key===`ArrowLeft`){let t=e.focusedNode;if(!t||t.isRoot)return;t.isInternal&&t.isOpen?e.close(t.id):t.parent?.isRoot||e.focus(t.parent);return}if(t.key===`a`&&(t.metaKey||t.ctrlKey)&&!e.props.disableMultiSelection){t.preventDefault(),e.selectAll();return}if(t.key===`a`&&!t.metaKey&&!t.ctrlKey&&e.props.onCreate){e.createLeaf();return}if(t.key===`A`&&!t.metaKey&&!t.ctrlKey){if(!e.props.onCreate)return;e.createInternal();return}if(t.key===`Home`){t.preventDefault(),e.focus(e.firstNode);return}if(t.key===`End`){t.preventDefault(),e.focus(e.lastNode);return}if(t.key===`Enter`){let t=e.focusedNode;if(!t||!t.isEditable||!e.props.onRename)return;setTimeout(()=>{t&&e.edit(t)});return}if(t.key===` `){t.preventDefault();let n=e.focusedNode;if(!n)return;n.isLeaf?(n.select(),n.activate()):n.toggle();return}if(t.key===`*`){let t=e.focusedNode;if(!t)return;e.openSiblings(t);return}if(t.key===`PageUp`){t.preventDefault(),e.pageUp();return}t.key===`PageDown`&&(t.preventDefault(),e.pageDown()),clearTimeout(oa),aa+=t.key,oa=setTimeout(()=>{aa=``},600);let r=e.visibleNodes.find(e=>{let t=e.data.name;return typeof t==`string`&&t.toLowerCase().startsWith(aa)});r&&e.focus(r.id)},children:(0,S.jsx)(ca,{})})}function ca(){let e=L(),t={className:e.props.className,outerRef:e.listEl,itemCount:e.visibleNodes.length,height:e.height,width:e.width,overscanCount:e.overscanCount,itemKey:t=>e.visibleNodes[t]?.id||t,outerElementType:e.props.outerElementType??Ui,innerElementType:e.props.innerElementType??Ki,onScroll:e.props.onScroll,onItemsRendered:e.onItemsRendered.bind(e)};return typeof e.props.rowHeight==`function`?(0,S.jsx)(zi,Object.assign({},t,{itemSize:e.rowHeightAt,ref:e.list,children:ia})):(0,S.jsx)(Bi,Object.assign({},t,{itemSize:e.rowHeight,ref:e.list,children:ia}))}function la(e){return e.isFiltered?da(e.root,e.isMatch.bind(e)):{list:ua(e.root),matchCount:0}}function ua(e){let t=[];function n(e){var r;e.level>=0&&t.push(e),e.isOpen&&((r=e.children)==null||r.forEach(n))}return n(e),t.forEach(fa),t}function da(e,t){let n={},r=[],i=0;function a(e){if(!e.isRoot&&t(e)){i++,n[e.id]=!0;let t=e.parent;for(;t;)n[t.id]=!0,t=t.parent}if(e.children)for(let t of e.children)a(t)}function o(e){var t;e.level>=0&&n[e.id]&&r.push(e),e.isOpen&&((t=e.children)==null||t.forEach(o))}return a(e),o(e),r.forEach(fa),{list:r,matchCount:i}}function fa(e,t){e.rowIndex=t}var pa=e=>e.reduce((e,t,n)=>(e[t.id]=n,e),{}),ma=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},{safeRun:J}=Cr,ha=class e{constructor(e,t,n,r){this.store=e,this.props=t,this.list=n,this.listEl=r,this.matchCount=0,this.visibleStartIndex=0,this.visibleStopIndex=0,this.rowOffsets=null,this.rowHeightAt=e=>{let t=this.props.rowHeight;if(typeof t==`function`){let n=this.at(e);return n?t(n):this.rowHeight}return t??24},this.rowTopPosition=e=>{if(typeof this.props.rowHeight!=`function`)return e*this.rowHeight;let t=this.getRowOffsets();return t[Math.max(0,Math.min(e,t.length-1))]},this.redrawList=(e=0)=>{this.rowOffsets=null;let t=this.list.current;t&&`resetAfterIndex`in t&&t.resetAfterIndex(Math.max(0,e))},this.root=Qr(this);let{list:i,matchCount:a}=la(this);this.visibleNodes=i,this.matchCount=a,this.idToIndex=pa(this.visibleNodes)}update(e){this.props=e,this.root=Qr(this);let{list:t,matchCount:n}=la(this);this.visibleNodes=t,this.matchCount=n,this.idToIndex=pa(this.visibleNodes),this.rowOffsets=null;let r=this.list.current;r&&`resetAfterIndex`in r&&r.resetAfterIndex(0,!1)}dispatch(e){return this.store.dispatch(e)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){return this.props.width??300}get height(){return this.props.height??500}get indent(){return this.props.indent??24}get rowHeight(){return typeof this.props.rowHeight==`number`?this.props.rowHeight:24}getRowOffsets(){if(this.rowOffsets)return this.rowOffsets;let e=[0];for(let t=0;t<this.visibleNodes.length;t++)e.push(e[t]+this.rowHeightAt(t));return this.rowOffsets=e,e}get overscanCount(){return this.props.overscanCount??1}get searchTerm(){return(this.props.searchTerm||``).trim()}get matchFn(){let e=this.props.searchMatch??((e,t)=>{let n=this.accessChildren(e.data),r=Object.values(e.data).filter(e=>n===null||e!==n);return JSON.stringify(r).toLocaleLowerCase().includes(t.toLocaleLowerCase())});return t=>e(t,this.searchTerm)}accessChildren(e){return B(e,this.props.childrenAccessor||`children`)??null}accessId(e){let t=B(e,this.props.idAccessor||`id`);if(!t)throw Error(`Data must contain an 'id' property or props.idAccessor must return a string`);return t}identify(e){return typeof e==`string`?e:e instanceof $r?e.id:B(e,this.props.idAccessor||`id`)}identifyNull(e){return e==null?null:this.identify(e)}get firstNode(){return this.visibleNodes[0]??null}get lastNode(){return this.visibleNodes[this.visibleNodes.length-1]??null}get focusedNode(){return this.get(this.state.nodes.focus.id)??null}get mostRecentNode(){return this.get(this.state.nodes.selection.mostRecent)??null}get nextNode(){let e=this.indexOf(this.focusedNode);return e===null?null:this.at(e+1)}get prevNode(){let e=this.indexOf(this.focusedNode);return e===null?null:this.at(e-1)}get(e){return e&&e in this.idToIndex&&this.visibleNodes[this.idToIndex[e]]||null}at(e){return this.visibleNodes[e]||null}nodesBetween(e,t){if(e===null||t===null)return[];let n=this.indexOf(e)??0,r=this.indexOf(t);if(r===null)return[];let i=Math.min(n,r),a=Math.max(n,r);return this.visibleNodes.slice(i,a+1)}indexOf(e){let t=this.identifyNull(e);return t?this.idToIndex[t]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:`internal`})}createLeaf(){return this.create({type:`leaf`})}create(){return ma(this,arguments,void 0,function*(e={}){let t=e.parentId===void 0?Hr(this):e.parentId,n=e.index??zr(this),r=e.type??`leaf`,i=yield J(this.props.onCreate,{type:r,parentId:t,index:n,parentNode:this.get(t)});i&&(this.focus(i),setTimeout(()=>{this.edit(i).then(()=>{this.select(i),this.activate(i)})}))})}delete(e){return ma(this,void 0,void 0,function*(){if(!e)return;let t=(Array.isArray(e)?e:[e]).map(e=>this.identify(e)),n=t.map(e=>this.get(e)).filter(e=>!!e),r=n.length?Math.min(...n.map(e=>e.rowIndex??0)):0;yield J(this.props.onDelete,{nodes:n,ids:t}),this.redrawList(r)})}edit(t){let n=this.identify(t);return this.resolveEdit({cancelled:!0}),this.scrollTo(n),this.dispatch(ei(n)),this.redrawList(this.get(n)?.rowIndex??0),new Promise(t=>{e.editPromise=t})}submit(e,t){return ma(this,void 0,void 0,function*(){if(!e)return;let n=this.identify(e);yield J(this.props.onRename,{id:n,name:t,node:this.get(n)}),this.dispatch(ei(null)),this.resolveEdit({cancelled:!1,value:t}),this.redrawList(this.get(n)?.rowIndex??0),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(ei(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(e){let t=this.get(this.identifyNull(e));t&&J(this.props.onActivate,t)}resolveEdit(t){let n=e.editPromise;n&&n(t),e.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let e=[];for(let t of Array.from(this.selectedIds)){let n=this.get(t);n&&e.push(n)}return e}focus(e,t={}){e&&(this.props.selectionFollowsFocus?this.select(e):(this.dispatch(V(this.identify(e))),t.scroll!==!1&&this.scrollTo(e),this.focusedNode&&J(this.props.onFocus,this.focusedNode)))}pageUp(){let e=this.visibleStartIndex,t=this.visibleStopIndex-e,n=this.focusedNode?.rowIndex??0;n=n>e?e:Math.max(e-t,0),this.focus(this.at(n))}pageDown(){let e=this.visibleStartIndex,t=this.visibleStopIndex,n=t-e,r=this.focusedNode?.rowIndex??0;r=r<t?t:Math.min(r+n,this.visibleNodes.length-1),this.focus(this.at(r))}select(e,t={}){if(!e)return;let n=t.focus!==!1,r=this.identify(e);n&&this.dispatch(V(r)),this.get(r)?.isSelectable&&this.setSelection({ids:[r],anchor:r,mostRecent:r}),this.scrollTo(r,t.align),this.focusedNode&&n&&J(this.props.onFocus,this.focusedNode)}deselect(e){if(!e)return;let t=this.identify(e);this.dispatch(U.remove(t)),J(this.props.onSelect,this.selectedNodes)}selectMulti(e,t={}){let n=this.get(this.identifyNull(e));if(!n)return;let r=t.focus!==!1;r&&this.dispatch(V(n.id)),n.isSelectable&&(this.dispatch(U.add(n.id)),this.dispatch(U.anchor(n.id)),this.dispatch(U.mostRecent(n.id))),this.scrollTo(n,t.align),this.focusedNode&&r&&J(this.props.onFocus,this.focusedNode),J(this.props.onSelect,this.selectedNodes)}selectContiguous(e){if(!e)return;let t=this.identify(e);if(this.dispatch(V(t)),this.get(t)?.isSelectable){let{anchor:e,mostRecent:n}=this.state.nodes.selection,r=this.filterSelectableNodes(this.nodesBetween(e,this.identifyNull(t)));this.dispatch(U.remove(this.nodesBetween(e,n).map(e=>e.id))),this.dispatch(U.add(r.map(e=>e.id))),this.dispatch(U.mostRecent(t))}this.scrollTo(t),this.focusedNode&&J(this.props.onFocus,this.focusedNode),J(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null})}selectAll(){let e=this.filterSelectableNodes(Object.keys(this.idToIndex));this.setSelection({ids:e,anchor:e[0]??null,mostRecent:e[e.length-1]??null}),this.dispatch(V(this.lastNode?.id)),this.focusedNode&&J(this.props.onFocus,this.focusedNode)}filterSelectableNodes(e){return e.map(e=>this.get(this.identify(e))).filter(e=>!!e&&e.isSelectable)}setSelection(e){let t=new Set(e.ids?.map(e=>this.identify(e))),n=this.identifyNull(e.anchor),r=this.identifyNull(e.mostRecent);this.dispatch(U.set({ids:t,anchor:n,mostRecent:r})),J(this.props.onSelect,this.selectedNodes)}get cursorParentId(){let{cursor:e}=this.state.dnd;switch(e.type){case`highlight`:return e.id;default:return null}}get cursorOverFolder(){return this.state.dnd.cursor.type===`highlight`}get dragNodes(){return this.state.dnd.dragIds.map(e=>this.get(e)).filter(e=>!!e)}get dragNode(){return this.get(this.state.nodes.drag.id)}get dragDestinationParent(){return this.get(this.state.nodes.drag.destinationParentId)}get dragDestinationIndex(){return this.state.nodes.drag.destinationIndex}canDrop(){if(this.isFiltered)return!1;let e=this.get(this.state.dnd.parentId)??this.root,t=this.dragNodes,n=this.props.disableDrop;for(let n of t)if(!n||!e||n.isInternal&&Dr(e,n))return!1;return typeof n==`function`?!n({parentNode:e,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof n==`string`?!e.data[n]:typeof n!=`boolean`||!n}hover(e,t){e&&this.dispatch(W.hovering(e.parentId,e.index)),e&&this.canDrop()?(this.dispatch(W.setDestination(e.parentId,e.index)),t&&this.showCursor(t)):(this.dispatch(W.setDestination(null,null)),this.hideCursor())}drop(){let{parentId:e,index:t,dragIds:n}=this.state.dnd;J(this.props.onMove,{dragIds:n,parentId:e===`__REACT_ARBORIST_INTERNAL_ROOT__`?null:e,index:t===null?0:t,dragNodes:this.dragNodes,parentNode:this.get(e)}),this.open(e)}hideCursor(){this.dispatch(W.cursor({type:`none`}))}showCursor(e){this.dispatch(W.cursor(e))}open(e,t=!0){let n=this.identifyNull(e);n&&(this.isOpen(n)||(this.dispatch(ii.open(n,this.isFiltered)),t&&this.redrawList(this.get(n)?.rowIndex??0),J(this.props.onToggle,n)))}close(e,t=!0){let n=this.identifyNull(e);n&&this.isOpen(n)&&(this.dispatch(ii.close(n,this.isFiltered)),t&&this.redrawList(this.get(n)?.rowIndex??0),J(this.props.onToggle,n))}toggle(e){let t=this.identifyNull(e);if(t)return this.isOpen(t)?this.close(t):this.open(t)}openParents(e){let t=this.identifyNull(e);if(!t)return;let n=Ar(this.root,t)?.parent;for(;n;)this.open(n.id,!1),n=n.parent;this.redrawList()}openSiblings(e){let t=e.parent;if(!t)this.toggle(e.id);else if(t.children){let n=e.isOpen;for(let e of t.children)e.isInternal&&(n?this.close(e.id,!1):this.open(e.id,!1));this.redrawList(),this.scrollTo(this.focusedNode)}}openAll(){z(this.root,e=>{e.isInternal&&this.open(e.id,!1)}),this.redrawList()}closeAll(){z(this.root,e=>{e.isInternal&&this.close(e.id,!1)}),this.redrawList()}scrollTo(e,t=`smart`){if(!e)return;let n=this.identify(e);return this.openParents(n),Rr(()=>n in this.idToIndex).then(()=>{var e;let r=this.idToIndex[n];r!==void 0&&((e=this.list.current)==null||e.scrollToItem(r,t),this.scrollToNodeHorizontally(this.get(n)))}).catch(()=>{})}scrollToNodeHorizontally(e){let t=this.listEl.current;if(!e||!t)return;let n=t.scrollWidth-t.clientWidth;if(n<=0)return;let r=e.level*this.indent,i=t.scrollLeft,a=t.scrollLeft+t.clientWidth;(r<i||r>=a)&&(t.scrollLeft=Math.max(0,Math.min(r,n)))}scrollToOffset(e){var t;let n=Number.isFinite(e)?Math.max(0,e):0;(t=this.list.current)==null||t.scrollTo(n)}get scrollOffset(){return this.listEl.current?.scrollTop??0}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){return!!this.props.searchTerm?.trim()}get filteredCount(){return this.matchCount}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return this.state.nodes.selection.ids.size===0}get hasOneSelection(){return this.state.nodes.selection.ids.size===1}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(e){return e?this.state.nodes.selection.ids.has(e):!1}isOpen(e){if(!e)return!1;if(e===`__REACT_ARBORIST_INTERNAL_ROOT__`)return!0;let t=this.props.openByDefault??!0;return this.isFiltered?this.state.nodes.open.filtered[e]??!0:this.state.nodes.open.unfiltered[e]??t}isEditable(e){return this.isActionPossible(e,this.props.disableEdit)}isDraggable(e){return this.isActionPossible(e,this.props.disableDrag)}isSelectable(e){return this.isActionPossible(e,this.props.disableSelect)}isActionPossible(e,t=()=>!1){return!B(e,t)}isDragging(e){let t=this.identifyNull(e);return t?this.state.nodes.drag.id===t:!1}isFocused(e){return this.hasFocus&&this.state.nodes.focus.id===e}isMatch(e){return this.matchFn(e)}willReceiveDrop(e){let t=this.identifyNull(e);if(!t)return!1;let{destinationParentId:n,destinationIndex:r}=this.state.nodes.drag;return t===n&&r===null}onFocus(){let e=this.focusedNode||this.firstNode;e&&this.dispatch(V(e.id))}onBlur(){this.dispatch(ni())}onItemsRendered(e){this.visibleStartIndex=e.visibleStartIndex,this.visibleStopIndex=e.visibleStopIndex}get renderContainer(){return this.props.renderContainer||sa}get renderRow(){return this.props.renderRow||qr}get renderNode(){return this.props.children||Jr}get renderDragPreview(){return this.props.renderDragPreview||fi}get renderCursor(){return this.props.renderCursor||Kr}};function Y(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var ga=typeof Symbol==`function`&&Symbol.observable||`@@observable`,_a=()=>Math.random().toString(36).substring(7).split(``).join(`.`),va={INIT:`@@redux/INIT${_a()}`,REPLACE:`@@redux/REPLACE${_a()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${_a()}`};function ya(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function ba(e,t,n){if(typeof e!=`function`)throw Error(Y(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(Y(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(Y(1));return n(ba)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(Y(3));return i}function d(e){if(typeof e!=`function`)throw Error(Y(4));if(c)throw Error(Y(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(Y(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!ya(e))throw Error(Y(7));if(e.type===void 0)throw Error(Y(8));if(typeof e.type!=`string`)throw Error(Y(17));if(c)throw Error(Y(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(Y(10));r=e,f({type:va.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(Y(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[ga](){return this}}}return f({type:va.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[ga]:m}}function xa(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:va.INIT})===void 0)throw Error(Y(12));if(n(void 0,{type:va.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(Y(13))})}function Sa(e){let t=Object.keys(e),n={};for(let r=0;r<t.length;r++){let i=t[r];typeof e[i]==`function`&&(n[i]=e[i])}let r=Object.keys(n),i;try{xa(n)}catch(e){i=e}return function(e={},t){if(i)throw i;let a=!1,o={};for(let i=0;i<r.length;i++){let s=r[i],c=n[s],l=e[s],u=c(l,t);if(u===void 0)throw t&&t.type,Error(Y(14));o[s]=u,a||=u!==l}return a||=r.length!==Object.keys(e).length,a?o:e}}function Ca(e=H().nodes.drag,t){switch(t.type){case`DND_DRAG_START`:return Object.assign(Object.assign({},e),{id:t.id,selectedIds:t.dragIds});case`DND_DRAG_END`:return Object.assign(Object.assign({},e),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case`DND_DESTINATION`:return t.parentId!==e.destinationParentId||t.index!=e.destinationIndex?Object.assign(Object.assign({},e),{destinationParentId:t.parentId,destinationIndex:t.index}):e;default:return e}}var wa=Sa({nodes:Sa({focus:ri,edit:ti,open:oi,selection:si,drag:Ca}),dnd:ci}),Ta=H();function Ea({treeProps:e,imperativeHandle:t,children:n}){let r=(0,C.useRef)(null),i=(0,C.useRef)(null),a=(0,C.useRef)(ba(wa,H(e))),o=(0,Vn.useSyncExternalStore)(a.current.subscribe,a.current.getState,()=>Ta),s=(0,C.useMemo)(()=>new ha(a.current,e,r,i),[]),c=(0,C.useRef)(0);return(0,C.useMemo)(()=>{c.current+=1,s.update(e)},Object.values(e)),(0,C.useMemo)(()=>{c.current+=1,s.update(s.props)},[o.nodes.open]),(0,C.useImperativeHandle)(t,()=>s),(0,C.useEffect)(()=>{s.props.selection?s.select(s.props.selection,{focus:!1}):s.deselectAll()},[s.props.selection]),(0,C.useEffect)(()=>{s.props.searchTerm||a.current.dispatch(ii.clear(!0))},[s.props.searchTerm]),(0,S.jsx)(gr.Provider,{value:s,children:(0,S.jsx)(xr.Provider,{value:c.current,children:(0,S.jsx)(_r.Provider,{value:o.nodes,children:(0,S.jsx)(yr.Provider,{value:o.dnd,children:(0,S.jsx)(Zt,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||hr,options:{rootElement:s.props.dndRootElement||void 0}},{children:n}))})})})})}function Da(){let e=L(),[,t]=Bn(()=>({accept:`NODE`,canDrop:(t,n)=>n.isOver({shallow:!0})?e.canDrop():!1,hover:(t,n)=>{if(!n.isOver({shallow:!0}))return;let r=n.getClientOffset();if(!e.listEl.current||!r)return;let{cursor:i,drop:a}=ta({element:e.listEl.current,offset:r,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});e.hover(a,i)},drop:(t,n)=>{if(!n.isOver({shallow:!0})||!n.canDrop())return null;e.drop()}}),[e]);t(e.listEl)}function Oa(e){return Da(),e.children}function ka(){let e=L().props.renderContainer||sa;return(0,S.jsx)(S.Fragment,{children:(0,S.jsx)(e,{})})}function Aa(){let e=L(),{offset:t,mouse:n,item:r,isDragging:i}=Mn(e=>({offset:e.getSourceClientOffset(),mouse:e.getClientOffset(),item:e.getItem(),isDragging:e.isDragging()})),a=e.props.renderDragPreview||fi;return(0,S.jsx)(a,{offset:t,mouse:n,id:r?.id||null,dragIds:r?.dragIds||[],isDragging:i})}function ja(e={}){let t=e.idAccessor??`id`,n=e.childrenAccessor??`children`;return{getId:typeof t==`function`?t:e=>e[t],getChildren:typeof n==`function`?n:e=>e[n],childrenKey:typeof n==`string`?n:`children`}}var Ma=class{constructor(e,t={}){this.accessors=ja(t),this.root=Na(e,this.accessors)}get data(){return this.root.children?.map(e=>e.data)??[]}create(e){let t=e.parentId?this.find(e.parentId):this.root;if(!t)return null;t.addChild(e.data,e.index)}move(e){let t=this.find(e.id),n=e.parentId?this.find(e.parentId):this.root;!t||!n||(n.addChild(t.data,e.index),t.drop())}update(e){let t=this.find(e.id);t&&t.update(e.changes)}drop(e){let t=this.find(e.id);t&&t.drop()}find(e,t=this.root){if(!t)return null;if(t.id===e)return t;if(t.children){for(let n of t.children){let t=this.find(e,n);if(t)return t}return null}return null}};function Na(e,t){let n=new Fa({},null,t,`ROOT`);return n.children=e.map(e=>Pa(e,n,t)),n}function Pa(e,t,n){let r=new Fa(e,t,n),i=n.getChildren(e);return i&&(r.children=i.map(e=>Pa(e,r,n))),r}var Fa=class{constructor(e,t,n,r){this.data=e,this.parent=t,this.accessors=n,this.id=r??n.getId(e)}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(e,t){let n=Pa(e,this,this.accessors);this.children=this.children??[],this.children.splice(t,0,n);let r=this.accessors.childrenKey,i=this.data;i[r]=i[r]??[],i[r].splice(t,0,e)}removeChild(e){var t,n;(t=this.children)==null||t.splice(e,1),(n=this.data[this.accessors.childrenKey])==null||n.splice(e,1)}update(e){if(this.hasParent()){let t=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),e),t),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}},Ia=0;function La(e,t={}){let[n,r]=(0,C.useState)(e),i=t.idAccessor,a=t.childrenAccessor,o=t.onChange,s=(0,C.useMemo)(()=>new Ma(n,{idAccessor:i,childrenAccessor:a}),[n,i,a]),c=()=>{let e=s.data;r(e),o?.(e)},l=e=>{for(let t of e.dragIds)s.move({id:t,parentId:e.parentId,index:e.index});c()},u=({name:e,id:t})=>{s.update({id:t,changes:{name:e}}),c()},d=typeof i==`string`?i:`id`,f=typeof a==`string`?a:`children`;return[n,{onMove:l,onRename:u,onCreate:({parentId:e,index:t,type:n})=>{if(typeof i==`function`)throw Error("React Arborist => initialData can't create nodes when idAccessor is a function: the generated id can't be written under a key the accessor reads. Use a string idAccessor, or the controlled `data` prop with your own onCreate.");if(n===`internal`&&typeof a==`function`)throw Error("React Arborist => initialData can't create folder nodes when childrenAccessor is a function: the new children array can't be written under a key the accessor reads. Use a string childrenAccessor, or the controlled `data` prop with your own onCreate.");let r={[d]:`simple-tree-id-${Ia++}`,name:``};return n===`internal`&&(r[f]=[]),s.create({parentId:e,index:t,data:r}),c(),r},onDelete:e=>{e.ids.forEach(e=>s.drop({id:e})),c()}}]}function Ra(e){if(e.initialData&&e.data)throw Error(`React Arborist Tree => Provide either a data or initialData prop, but not both.`);if(e.initialData&&(e.onCreate||e.onDelete||e.onMove||e.onRename))throw Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
|
|
3
|
-
Use the data prop if you want to provide your own handlers.`);if(e.initialData){let[t,n]=La(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),n),{data:t})}return e}function za(e,t){let n=Ra(e);return(0,S.jsxs)(Ea,{treeProps:n,imperativeHandle:t,children:[(0,S.jsx)(Oa,{children:(0,S.jsx)(ka,{})}),(0,S.jsx)(Aa,{})]})}var Ba=(0,C.forwardRef)(za),X=a(),Va=5,Ha=/^[A-Za-z]:[/\\]/,Ua=/^\\\\/;function Z(e){return e.success?e:(v({title:`Failed`,description:e.message}),null)}var Wa=class{delegate=new Ma([]);callbacks;constructor(e){this.callbacks=e}roots=[];pendingExpansions=new Map;onChange=s.NOOP;path=new h(`/`);initialize=async e=>{if(this.onChange=e,this.delegate.data.length===0)try{let{roots:e}=await this.callbacks.getRoots(),t=e.find(e=>e.isPrimary);if(!t)throw Error(`File browser response is missing a primary root`);if(this.roots=e,this.path=h.guessDeliminator(t.path),this.delegate=new Ma(e.map(qa)),e.length===1){let e=await this.callbacks.listFiles({path:t.path});this.updateDirectory(this.getPrimaryRootId(),e.files)}}catch(e){v({title:`Failed`,description:te(e)})}this.emitChange()};expand(e){return this.requestDirectory(e)}requestDirectory(e,t=!1){let n=this.pendingExpansions.get(e);if(n)return n;let r=this.delegate.find(e);if(!r?.data.isDirectory)return Promise.resolve(!1);if(!t&&r.data.loadState===`loaded`)return Promise.resolve(!0);let i=this.loadDirectory(e,r.data).finally(()=>{this.pendingExpansions.delete(e)});return this.pendingExpansions.set(e,i),i}async loadDirectory(e,t){this.delegate.update({id:e,changes:{loadState:`loading`}}),this.emitChange();try{let n=await this.callbacks.listFiles({path:t.path});return this.updateDirectory(e,n.files),!0}catch(n){return this.delegate.update({id:e,changes:{loadState:`error`}}),v({title:`Could not load ${t.name}`,description:te(n)}),!1}finally{this.emitChange()}}getRoots(){return this.roots}async reveal(e){let t=$(e.path,e.rootPath);if(t===null)return!1;let n=e.rootPath,r=t.split(Qa(e.rootPath)).filter(Boolean);e.isDirectory||r.pop();for(let t of[null,...r]){if(t!==null){let r=Q(e.rootPath,n);if(n=Xa(n,t),!this.delegate.find(Q(e.rootPath,n))&&!await this.requestDirectory(r,!0))return!1}let r=Q(e.rootPath,n);if(!this.delegate.find(r))return v({title:`Could not reveal folder`,description:`The folder may have moved or been deleted: ${n}`}),!1;if(!await this.expand(r))return!1}return!0}async copy(e,t){let n=this.getMutableNode(e);if(!n)return;let r=n.data.path,i=this.getParentPath(n.data),a=Xa(i,t);await this.callbacks.copyFileOrFolder({path:r,newPath:a}).then(Z)&&await this.refreshPath(i)}async rename(e,t){let n=this.getMutableNode(e);if(!n)return;let r=n.data.path,i=this.getParentPath(n.data),a=Xa(i,t);await this.callbacks.renameFileOrFolder({path:r,newPath:a}).then(Z)&&await this.refreshPath(i)}async move(e,t){let n=t??this.getPrimaryRootId(),r=this.delegate.find(n);if(!r?.data.isDirectory)return;let i=new Set;await re(e,Va,async e=>{let t=this.getMutableNode(e,!1);if(!t)return;let n=t.data.path,a=this.getParentPath(t.data),o=Xa(r.data.path,this.path.basename(n));await this.callbacks.renameFileOrFolder({path:n,newPath:o}).then(Z)&&(i.add(r.data.path),i.add(a))}),await this.refreshPaths([...i])}async createFile({name:e,parentId:t,type:n=`file`}){let r=this.getParentNode(t);r&&await this.callbacks.createFileOrFolder({path:r.data.path,type:n,name:e}).then(Z)&&await this.refreshPath(r.data.path)}async createFolder(e,t){let n=this.getParentNode(t);n&&await this.callbacks.createFileOrFolder({path:n.data.path,type:`directory`,name:e}).then(Z)&&await this.refreshPath(n.data.path)}async delete(e){let t=this.getMutableNode(e);if(!t)return;let n=this.getParentPath(t.data);await this.callbacks.deleteFileOrFolder({path:t.data.path}).then(Z)&&await this.refreshPath(n)}refreshAll=async e=>{let t=[...this.roots.map(e=>e.path),...e.map(e=>this.delegate.find(e)?.data.path).filter(e=>!!e)];await this.refreshPaths(t,new Set([...this.roots.map(e=>Q(e.path,e.path)),...e]))};refreshPath=async e=>{await this.refreshPaths([e])};getPrimaryRelativePath=e=>{let t=this.getPrimaryRoot();return t?$(e,t.path):null};getPrimaryRootPath=()=>this.getPrimaryRoot()?.path??``;getPrimaryRootId=()=>{let e=this.getPrimaryRoot()?.path??``;return Q(e,e)};isPrimaryNode=e=>e.isPrimaryRoot;getDisplayPath=e=>{let t=this.getRootForPath(e);if(!t)return e;let n=$(e,t.path);return n?t.isPrimary?n:`${t.name}/${n}`:t.name};isRootPath=e=>this.roots.some(t=>Ya(e,t.path));getPrimaryRoot(){return this.roots.find(e=>e.isPrimary)}getRootForNode(e){return this.roots.find(t=>Ya(t.path,e.rootPath))??this.getPrimaryRoot()??{path:e.rootPath,name:e.rootPath,isPrimary:e.isPrimaryRoot}}getRootForPath(e){return this.roots.filter(t=>$(e,t.path)!==null).toSorted((e,t)=>t.path.length-e.path.length)[0]}getParentNode(e){let t=e??this.getPrimaryRootId(),n=this.delegate.find(t);return n?.data.isDirectory?n:null}getParentPath(e){return(this.delegate.find(e.id)?.parent)?.data.path??e.rootPath}getMutableNode(e,t=!0){let n=this.delegate.find(e);return!n||n.data.isRoot?(t&&v({title:`Failed`,description:n?`File browser roots cannot be modified`:`Node with id ${e} not found in the tree`}),null):n}refreshPaths=async(e,t)=>{let n=[...new Set(e)].toSorted((e,t)=>e.length-t.length);if(n.length===0)return;let r=await re(n,Va,e=>this.callbacks.listFiles({path:e}).catch(()=>null));for(let[e,i]of n.entries()){let n=r[e];if(n)for(let e of this.roots){let r=Q(e.path,i);(!t||t.has(r))&&this.updateDirectory(r,n.files,t)}}this.emitChange()};updateDirectory(e,t,n){let r=this.delegate.find(e)?.data;if(!r?.isDirectory)return;let i=Ga(Ja(t,this.getRootForNode(r)),r.children);this.delegate.update({id:e,changes:{children:n?Ka(i,n):i,loadState:`loaded`}})}emitChange(){let e=this.delegate.data;this.onChange(this.roots.length===1?[...e[0]?.children??[]]:e)}};function Ga(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.id);return!e.isDirectory||!t?.isDirectory?e:{...e,children:t.children,loadState:t.loadState}})}function Ka(e,t){return e.map(e=>e.isDirectory?t.has(e.id)?{...e,children:Ka(e.children,t)}:{...e,children:[],loadState:`unloaded`}:e)}function qa(e){return{id:Q(e.path,e.path),path:e.path,name:e.name,isDirectory:!0,isMarimoFile:!1,children:[],isRoot:!0,rootPath:e.path,isPrimaryRoot:e.isPrimary,loadState:`unloaded`}}function Ja(e,t){return e.map(e=>({...e,id:Q(t.path,e.path),children:Ja(e.children??[],t),loadState:e.children?.length?`loaded`:`unloaded`,isRoot:!1,rootPath:t.path,isPrimaryRoot:t.isPrimary}))}function Q(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function $(e,t){let n=Za(t),r=e=>n?e.toLowerCase():e,i=r(e);if(i===r(t))return``;let a=Qa(t),o=t.endsWith(a)?t:`${t}${a}`,s=r(o);return i.startsWith(s)?e.slice(o.length):null}function Ya(e,t){return $(e,t)===``}function Xa(e,t){let n=Qa(e);return`${e}${e.endsWith(n)?``:n}${t}`}function Za(e){return Ha.test(e)||Ua.test(e)}function Qa(e){return Ua.test(e)||/^[A-Za-z]:\\/.test(e)?`\\`:`/`}function $a(e){let t=(0,X.c)(13),{root:n}=e,{sendRenameFileOrFolder:r,sendCopyFileOrFolder:i,sendDeleteFileOrFolder:a}=y(),o;t[0]!==n||t[1]!==r?(o=async(e,t)=>{let{path:i,newPath:a}=ie({path:e.path,name:t,root:n});return Z(await r({path:i,newPath:a}))},t[0]=n,t[1]=r,t[2]=o):o=t[2];let s=o,c;t[3]!==n||t[4]!==i?(c=async e=>{let{path:t,newPath:r}=ie({path:e.path,name:oe(e.name),root:n});return Z(await i({path:t,newPath:r}))},t[3]=n,t[4]=i,t[5]=c):c=t[5];let l=c,u;t[6]!==n||t[7]!==a?(u=async e=>Z(await a({path:ae(e.path,n)})),t[6]=n,t[7]=a,t[8]=u):u=t[8];let d=u,f;return t[9]!==d||t[10]!==l||t[11]!==s?(f={renameFile:s,duplicateFile:l,deleteFile:d},t[9]=d,t[10]=l,t[11]=s,t[12]=f):f=t[12],f}var eo={file:`Delete file`,folder:`Delete folder`,notebook:`Delete notebook`};function to(){let e=(0,X.c)(2),{openConfirm:t}=_(),n;return e[0]===t?n=e[1]:(n=(e,n)=>{let r=e.kind??`file`;t({title:eo[r],description:`Are you sure you want to delete ${e.name}?`,confirmAction:(0,S.jsx)(l,{onClick:async()=>{await n()},"aria-label":`Confirm`,children:`Delete`})})},e[0]=t,e[1]=n),n}function no(e){let t=(0,X.c)(17),{node:n,root:i,onAfterChange:a}=e,o;t[0]===i?o=t[1]:(o={root:i},t[0]=i,t[1]=o);let{duplicateFile:s,deleteFile:c}=$a(o),l=to(),u;t[2]===n?u=t[3]:(u=()=>{n.edit()},t[2]=n,t[3]=u);let d=r(u),f;t[4]!==s||t[5]!==n.data||t[6]!==a?(f=async()=>{await s(n.data)&&a?.()},t[4]=s,t[5]=n.data,t[6]=a,t[7]=f):f=t[7];let p=r(f),m;t[8]!==l||t[9]!==c||t[10]!==n.data||t[11]!==a?(m=()=>{let e=n.data.isDirectory?`folder`:n.data.isMarimoFile?`notebook`:`file`;l({name:n.data.name,kind:e},async()=>{await c(n.data)&&a?.()})},t[8]=l,t[9]=c,t[10]=n.data,t[11]=a,t[12]=m):m=t[12];let h=r(m),g;return t[13]!==h||t[14]!==p||t[15]!==d?(g={handleRename:d,handleDuplicate:p,handleDelete:h},t[13]=h,t[14]=p,t[15]=d,t[16]=g):g=t[16],g}var ro=e=>{let t=(0,X.c)(15),{testId:n,buttonClassName:r,iconClassName:i,contentClassName:a,preventDefaultOnTrigger:o,children:s}=e,c=o!==void 0&&o,l;t[0]===c?l=t[1]:(l=e=>{e.stopPropagation(),c&&e.preventDefault()},t[0]=c,t[1]=l);let u;t[2]!==r||t[3]!==i||t[4]!==n?(u=(0,S.jsx)(x,{"data-testid":n,className:r,iconClassName:i}),t[2]=r,t[3]=i,t[4]=n,t[5]=u):u=t[5];let m;t[6]!==l||t[7]!==u?(m=(0,S.jsx)(d,{asChild:!0,tabIndex:-1,onClick:l,children:u}),t[6]=l,t[7]=u,t[8]=m):m=t[8];let h=a??`print:hidden w-[240px]`,g;t[9]!==s||t[10]!==h?(g=(0,S.jsx)(f,{align:`end`,className:h,onClick:so,onCloseAutoFocus:co,children:s}),t[9]=s,t[10]=h,t[11]=g):g=t[11];let _;return t[12]!==m||t[13]!==g?(_=(0,S.jsxs)(p,{modal:!1,children:[m,g]}),t[12]=m,t[13]=g,t[14]=_):_=t[14],_},io=e=>{let t=(0,X.c)(6),{onSelect:n,disabled:r,title:i,testId:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,S.jsx)(se,{className:b}),t[0]=o):o=t[0];let s;return t[1]!==r||t[2]!==n||t[3]!==a||t[4]!==i?(s=(0,S.jsxs)(u,{onSelect:n,disabled:r,title:i,"data-testid":a,children:[o,`Rename`]}),t[1]=r,t[2]=n,t[3]=a,t[4]=i,t[5]=s):s=t[5],s},ao=e=>{let t=(0,X.c)(6),{onSelect:n,disabled:r,title:i,testId:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,S.jsx)(g,{className:b}),t[0]=o):o=t[0];let s;return t[1]!==r||t[2]!==n||t[3]!==a||t[4]!==i?(s=(0,S.jsxs)(u,{onSelect:n,disabled:r,title:i,"data-testid":a,children:[o,`Duplicate`]}),t[1]=r,t[2]=n,t[3]=a,t[4]=i,t[5]=s):s=t[5],s},oo=e=>{let t=(0,X.c)(6),{onSelect:n,disabled:r,title:i,testId:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,S.jsx)(ee,{className:b}),t[0]=o):o=t[0];let s;return t[1]!==r||t[2]!==n||t[3]!==a||t[4]!==i?(s=(0,S.jsxs)(u,{onSelect:n,variant:`danger`,disabled:r,title:i,"data-testid":a,children:[o,`Delete`]}),t[1]=r,t[2]=n,t[3]=a,t[4]=i,t[5]=s):s=t[5],s};function so(e){return e.stopPropagation()}function co(e){return e.preventDefault()}var lo=e=>{let t=(0,X.c)(10),{node:n}=e,r=(0,C.useRef)(null),i,a;t[0]===n.data.name?(i=t[1],a=t[2]):(i=()=>{r.current?.focus();let e=n.data.name,t=e.lastIndexOf(`.`),i=t>0?t:e.length;r.current?.setSelectionRange(0,i)},a=[n.data.name],t[0]=n.data.name,t[1]=i,t[2]=a),(0,C.useEffect)(i,a);let o,s;t[3]===n?(o=t[4],s=t[5]):(o=()=>n.reset(),s=e=>{e.key===`Escape`&&n.reset(),e.key===`Enter`&&n.submit(e.currentTarget.value)},t[3]=n,t[4]=o,t[5]=s);let c;return t[6]!==n.data.name||t[7]!==o||t[8]!==s?(c=(0,S.jsx)(`input`,{ref:r,className:`flex-1 bg-transparent border border-border text-muted-foreground`,defaultValue:n.data.name,onClick:uo,onBlur:o,onKeyDown:s}),t[6]=n.data.name,t[7]=o,t[8]=s,t[9]=c):c=t[9],c};function uo(e){return e.stopPropagation()}export{io as a,Wa as c,hr as d,Bn as f,ro as i,Q as l,Zt as m,oo as n,$a as o,P as p,ao as r,no as s,lo as t,Ba as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./chunk-75Z2AOVW-DA_lihEi.js";import"./src-Cyu5G-Tr.js";import"./chunk-DU6HZSFF-J-califE.js";import"./chunk-P2QGCYS3-DsJshZeL.js";import"./chunk-PWAF6VOD-CrFPAGFi.js";import"./chunk-GMAD6QVW-mXoq4V-T.js";import"./chunk-4HAMMTFA-F3WVmmmo.js";import"./chunk-GVQU2GXP-B-87l3Xt.js";import"./chunk-L3NEJ4N5-DLeZO9l0.js";import"./chunk-OSK3NFVY-PWoOtECb.js";import"./mermaid-CNjXdDrA.js";import"./chunk-F27PBJKO-BzJrz4xx.js";import"./chunk-XXDRQBXY-BwqwIlJV.js";import"./chunk-POPQ4Y6H-CCg5TpSp.js";import{n as e}from"./chunk-SHT3W25Y-lri4OQTX.js";export{e as diagram};
|