@marimo-team/frontend 0.14.18-dev37 → 0.14.18-dev39
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-C3k5hPLu.js → ConnectedDataExplorerComponent-Dluf8clT.js} +1 -1
- package/dist/assets/{ImageComparisonComponent-BjOFN8jM.js → ImageComparisonComponent-CK_fmBK6.js} +1 -1
- package/dist/assets/{VegaLite-DgJ7jnLw.js → VegaLite-GAUrkYuV.js} +1 -1
- package/dist/assets/{_baseEach-pzHGHEY4.js → _baseEach-C0Sqwj1Y.js} +1 -1
- package/dist/assets/_baseMap-wbAXOiz5.js +1 -0
- package/dist/assets/{_baseUniq-CQItUkLS.js → _baseUniq-C6CtZ9jJ.js} +1 -1
- package/dist/assets/{_createAggregator-D-uitHtz.js → _createAggregator-DCg3aG5g.js} +1 -1
- package/dist/assets/{any-language-editor-Cmq3ciWC.js → any-language-editor-C1hAvQU_.js} +1 -1
- package/dist/assets/{architectureDiagram-SUXI7LT5-BO-3YmEX.js → architectureDiagram-SUXI7LT5-CY6ZXfK5.js} +1 -1
- package/dist/assets/{blockDiagram-6J76NXCF-Dt5N8bX3.js → blockDiagram-6J76NXCF-BfT_qzzN.js} +1 -1
- package/dist/assets/{c4Diagram-6F6E4RAY-zW8gkeE8.js → c4Diagram-6F6E4RAY-BNmm8mbN.js} +1 -1
- package/dist/assets/channel-p2n1Ehs7.js +1 -0
- package/dist/assets/{chunk-353BL4L5-DTHrwX0H.js → chunk-353BL4L5-BD1eYYEv.js} +1 -1
- package/dist/assets/{chunk-67H74DCK-BLaovY1-.js → chunk-67H74DCK-D32ZcVIe.js} +1 -1
- package/dist/assets/{chunk-AACKK3MU-DJFY0X5n.js → chunk-AACKK3MU-VRjqE2eS.js} +1 -1
- package/dist/assets/{chunk-BFAMUDN2-LzixKanE.js → chunk-BFAMUDN2-C-cJmQLf.js} +1 -1
- package/dist/assets/{chunk-E2GYISFI-B-672zyq.js → chunk-E2GYISFI-BVyg2Fo6.js} +1 -1
- package/dist/assets/{chunk-OW32GOEJ-CJecFYpV.js → chunk-OW32GOEJ-CJAy1Ibj.js} +1 -1
- package/dist/assets/{chunk-SKB7J2MH-CD0WbCzI.js → chunk-SKB7J2MH-CNnoGuDT.js} +1 -1
- package/dist/assets/{chunk-SZ463SBG-pTDg_1jk.js → chunk-SZ463SBG-B-DyRJ-t.js} +1 -1
- package/dist/assets/{circle-play-D6EUBkp5.js → circle-play-DlcQmjy-.js} +1 -1
- package/dist/assets/classDiagram-M3E45YP4-CvCuraNp.js +1 -0
- package/dist/assets/classDiagram-v2-YAWTLIQI-CvCuraNp.js +1 -0
- package/dist/assets/clone-CglRxjPg.js +1 -0
- package/dist/assets/{compile-naE2cSaS.js → compile-Da_Fjkgs.js} +1 -1
- package/dist/assets/{dagre-JOIXM2OF-BGYi4rRz.js → dagre-JOIXM2OF-B6XR4pJX.js} +1 -1
- package/dist/assets/{data-grid-overlay-editor-C03UhjBo.js → data-grid-overlay-editor-v4eNCtyj.js} +1 -1
- package/dist/assets/{diagram-5UYTHUR4-DfPUdpUn.js → diagram-5UYTHUR4-fJ5HfR4m.js} +1 -1
- package/dist/assets/{diagram-VMROVX33-DIE6r0im.js → diagram-VMROVX33-j3xejCo0.js} +1 -1
- package/dist/assets/{diagram-ZTM2IBQH-CEBREHFr.js → diagram-ZTM2IBQH-dkgnTPsZ.js} +1 -1
- package/dist/assets/{edit-page-DJJejvk6.js → edit-page-CmCSSEmo.js} +38 -38
- package/dist/assets/{erDiagram-3M52JZNH-B4NhsuE8.js → erDiagram-3M52JZNH-pjMXU-CR.js} +1 -1
- package/dist/assets/{flowDiagram-KYDEHFYC-jZGD-hHQ.js → flowDiagram-KYDEHFYC-RFXKcK0k.js} +1 -1
- package/dist/assets/{ganttDiagram-EK5VF46D-ByS2LJXk.js → ganttDiagram-EK5VF46D-BgmOCQC2.js} +1 -1
- package/dist/assets/{gitGraphDiagram-GW3U2K7C-DPpl9bW7.js → gitGraphDiagram-GW3U2K7C-DQPA3IzE.js} +1 -1
- package/dist/assets/{glide-data-editor-Ctp5cb01.js → glide-data-editor-DWBodoS3.js} +4 -4
- package/dist/assets/{graph-D8hCRiO-.js → graph-DacIO-UV.js} +1 -1
- package/dist/assets/{home-page-BOha11wZ.js → home-page-CRXrPrxk.js} +1 -1
- package/dist/assets/{index-DkT396dR.js → index-8RrfVV3p.js} +1 -1
- package/dist/assets/{index-DvLglJGf.js → index-BC3mHcN4.js} +1 -1
- package/dist/assets/{index-B-V9jaSp.js → index-BDUp_sLz.js} +1 -1
- package/dist/assets/{index-CC2E3f4Q.js → index-BHV0wUT7.js} +181 -180
- package/dist/assets/{index-BoHmD2lN.js → index-BQF1L3gh.js} +1 -1
- package/dist/assets/{index-hx9zD-F8.js → index-BRCKCYPN.js} +1 -1
- package/dist/assets/{index-P2Xevp4g.js → index-BXCylVut.js} +1 -1
- package/dist/assets/{index-F8A7jFRS.js → index-Bg24ojRl.js} +1 -1
- package/dist/assets/{index-B0m8evbg.js → index-BoaOUG3q.js} +1 -1
- package/dist/assets/{index-LNINpf1O.js → index-BxSZURSP.js} +1 -1
- package/dist/assets/{index-CXYh_vqL.js → index-BxjU6sz1.js} +1 -1
- package/dist/assets/{index-CAHCwUFF.js → index-C8_gM-Yh.js} +1 -1
- package/dist/assets/{index-B0uP21nC.js → index-CRoIS0e_.js} +1 -1
- package/dist/assets/index-CrH6PPjG.css +1 -0
- package/dist/assets/{index-Cb7ino3i.js → index-D-j7DlKu.js} +1 -1
- package/dist/assets/{index-BeH3WPTC.js → index-D6Npa4_9.js} +1 -1
- package/dist/assets/{index-ChLKVpQ4.js → index-M577h3xO.js} +1 -1
- package/dist/assets/{index-Cw8iULrO.js → index-PXlQy2IY.js} +1 -1
- package/dist/assets/{index-CmCTzIMP.js → index-dlPsVpRk.js} +1 -1
- package/dist/assets/{index-BNAVkiFE.js → index-i68zQEWD.js} +1 -1
- package/dist/assets/{index-oUdxu43b.js → index-txOE5caF.js} +1 -1
- package/dist/assets/infoDiagram-LHK5PUON-BQo83J9q.js +2 -0
- package/dist/assets/{journeyDiagram-EWQZEKCU-CUqNznku.js → journeyDiagram-EWQZEKCU--vn5uP9G.js} +1 -1
- package/dist/assets/{kanban-definition-ZSS6B67P-wAX5kOcc.js → kanban-definition-ZSS6B67P-BsAtaVBp.js} +1 -1
- package/dist/assets/{layout-DHNLnBrk.js → layout-D89ZmFuH.js} +1 -1
- package/dist/assets/{linear-C4cm1cyD.js → linear--2JfAOS_.js} +1 -1
- package/dist/assets/links-DHuoq13s.js +17 -0
- package/dist/assets/{mermaid-Cyy1SuLp.js → mermaid-BbIb2iAQ.js} +4 -4
- package/dist/assets/{min-DEKMoQKx.js → min-B719_H4j.js} +1 -1
- package/dist/assets/{mindmap-definition-6CBA2TL7-BuKaCMZv.js → mindmap-definition-6CBA2TL7-DbrwDtvS.js} +1 -1
- package/dist/assets/{number-overlay-editor-D6ItVsoK.js → number-overlay-editor-VjmSOKWj.js} +1 -1
- package/dist/assets/{pieDiagram-NIOCPIFQ-CiiLyBIl.js → pieDiagram-NIOCPIFQ-DDr_8e6N.js} +1 -1
- package/dist/assets/{quadrantDiagram-2OG54O6I-C4fysEbE.js → quadrantDiagram-2OG54O6I-TFsW3qDt.js} +1 -1
- package/dist/assets/{react-plotly-xELLTGMb.js → react-plotly-BJBcptDR.js} +1 -1
- package/dist/assets/{requirementDiagram-QOLK2EJ7-BRxJBhke.js → requirementDiagram-QOLK2EJ7-D5BaSClp.js} +1 -1
- package/dist/assets/{run-page-BvmAfKi3.js → run-page-D1TeIIYq.js} +1 -1
- package/dist/assets/{sankeyDiagram-4UZDY2LN-7LEwluDj.js → sankeyDiagram-4UZDY2LN-B-zmPQdl.js} +1 -1
- package/dist/assets/{sequenceDiagram-SKLFT4DO-C0tnmVO0.js → sequenceDiagram-SKLFT4DO-Dw--eukV.js} +1 -1
- package/dist/assets/{slides-component-Bk9mtZB_.js → slides-component-CUV-ryNw.js} +1 -1
- package/dist/assets/{sortBy-Dfn-YbfY.js → sortBy-C9K5SL89.js} +1 -1
- package/dist/assets/{stateDiagram-MI5ZYTHO-CErzlFMf.js → stateDiagram-MI5ZYTHO-WTQoQzCe.js} +1 -1
- package/dist/assets/stateDiagram-v2-5AN5P6BG-CoRRGWzU.js +1 -0
- package/dist/assets/{storage-COfGEwjy.js → storage-BgxGjrlK.js} +3 -3
- package/dist/assets/{terminal-BBfg98Ck.js → terminal-BRsJ5bg0.js} +1 -1
- package/dist/assets/{time-mJaqTj1J.js → time-Wo8mRr4h.js} +1 -1
- package/dist/assets/{timeline-definition-MYPXXCX6-Adnqmrjd.js → timeline-definition-MYPXXCX6-DUiBvKXW.js} +1 -1
- package/dist/assets/{tracing-CRHBCgSH.js → tracing-DkTh5bjk.js} +2 -2
- package/dist/assets/{trash-Bzd1HHgn.js → trash-_cwoDPy1.js} +1 -1
- package/dist/assets/{treemap-75Q7IDZK-CpWfdhdZ.js → treemap-75Q7IDZK-DndwJIAY.js} +1 -1
- package/dist/assets/{vega-component-D5DIeDhI.js → vega-component-BQrEMxr7.js} +1 -1
- package/dist/assets/{xychartDiagram-H2YORKM3-BOCS9pT9.js → xychartDiagram-H2YORKM3-Cn7nHPc6.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/src/components/ai/ai-model-dropdown.tsx +1 -1
- package/src/components/chat/chat-panel.tsx +8 -51
- package/src/components/editor/ai/add-cell-with-ai.tsx +114 -60
- package/src/components/editor/ai/ai-completion-editor.tsx +27 -15
- package/src/core/ai/config.ts +76 -0
- package/src/core/config/config-schema.ts +18 -12
- package/src/core/static/__tests__/files.test.ts +311 -0
- package/src/core/static/files.ts +35 -33
- package/src/plugins/impl/chat/chat-ui.tsx +0 -3
- package/dist/assets/_baseMap-D7704cQJ.js +0 -1
- package/dist/assets/channel-DIKq6rH6.js +0 -1
- package/dist/assets/classDiagram-M3E45YP4-ND3H63mC.js +0 -1
- package/dist/assets/classDiagram-v2-YAWTLIQI-ND3H63mC.js +0 -1
- package/dist/assets/clone-DTqdNqdv.js +0 -1
- package/dist/assets/index-BH8vrBOf.css +0 -1
- package/dist/assets/infoDiagram-LHK5PUON-BvsMfL6R.js +0 -2
- package/dist/assets/links-BqhBJqXV.js +0 -18
- package/dist/assets/stateDiagram-v2-5AN5P6BG-B5oy_bi9.js +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import{ce as js,aP as ws,c as ce,U as S,b as Xe,j as s,ft as Ss,fu as Is,a as U,cB as Cs,ar as Lt,fv as Os,T as He,fw as Pn,fa as ks,fx as An,fy as T,fz as Mn,fA as E,fB as D,fC as _,fD as me,fE as M,bo as Pe,fF as Rn,fG as F,fH as te,ac as Ue,fI as de,bp as re,fJ as dt,e4 as Ln,fK as Fn,fL as Ns,fM as qe,fN as Ee,fO as zn,fP as Ds,fQ as Hn,fR as ut,fS as Un,fT as Ts,fU as ht,L as Q,fV as oe,fW as Es,dR as ft,fX as qn,eK as _s,dt as Ft,fj as Ps,fY as Vn,fZ as As,f_ as Ms,f$ as Bn,g0 as Wn,g1 as Rs,al as Qe,be as Je,eS as Gn,V as pt,g2 as Ls,g3 as Fs,g4 as Kn,g5 as Yn,g6 as zs,a6 as ye,ev as gt,g7 as $n,a4 as zt,g8 as Hs,g9 as Us,a7 as Xn,a8 as qs,a9 as Qn,ga as Vs,gb as Bs,gc as Ws,b5 as Gs,gd as Ks,ge as Ys,gf as $s,gg as Xs,gh as Qs,gi as Js,cm as Zs,bq as mt,es as eo,dN as Jn,ad as to,ab as no,gj as ro,gk as io,bm as vt,ch as Zn,gl as so,gm as er,at as Ve,gn as tr,go as Ht,gp as nr,gq as rr,ag as Me,gr as oo,gs as ao,gt as ir,gu as lo,gv as co,e_ as uo,gw as ho,aT as fo,gx as po,gy as go,gz as mo,gA as vo,aK as yo,gB as sr,gC as Ut,aw as xo,_ as or,E as bo,gD as jo,gE as yt,gF as wo,gG as So,ao as qt,fh as Io,gH as Co,gI as Oo,gJ as ko,gK as No,eq as Ze,dD as xt,gL as Do,gM as ar,gN as To,a5 as Eo,gO as _o,gP as Po,gQ as Ao,ba as Mo,bj as Ro,b8 as Lo}from"./index-BHV0wUT7.js";import{e as Fo}from"./index-PXlQy2IY.js";/**
|
|
2
|
+
* @license lucide-react v0.525.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const zo=ce("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]),Ho=ce("book-marked",[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["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"}]]),lr=ce("box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]),Uo=ce("brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]),cr=ce("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),dr=ce("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]),qo=ce("flask-conical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]),ur=ce("folder-cog",[["path",{d:"M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.98a2 2 0 0 1 1.69.9l.66 1.2A2 2 0 0 0 12 6h8a2 2 0 0 1 2 2v3.3",key:"128dxu"}],["path",{d:"m14.305 19.53.923-.382",key:"3m78fa"}],["path",{d:"m15.228 16.852-.923-.383",key:"npixar"}],["path",{d:"m16.852 15.228-.383-.923",key:"5xggr7"}],["path",{d:"m16.852 20.772-.383.924",key:"dpfhf9"}],["path",{d:"m19.148 15.228.383-.923",key:"1reyyz"}],["path",{d:"m19.53 21.696-.382-.924",key:"1goivc"}],["path",{d:"m20.772 16.852.924-.383",key:"htqkph"}],["path",{d:"m20.772 19.148.924.383",key:"9w9pjp"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]),Vo=ce("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]),Bo=ce("grid-3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),Wo=ce("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),Go=ce("messages-square",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]),Ko=ce("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),Yo=ce("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]),$o=ce("power-off",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),Xo=ce("youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]);function Vt(t,e){return Vt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Vt(t,e)}function hr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}const fr=S.createContext(null);function ve(){const t=S.useContext(fr);if(t===null)throw new Error("No Tree Api Provided");return t}const pr=S.createContext(null),gr=S.createContext(null),mr=S.createContext(0);function vr(){S.useContext(mr)}function bt(t,e,n){return Math.max(Math.min(t,n),e)}function yr(t){return t&&t.isLeaf}function xr(t){return t&&t.isInternal&&!t.isOpen}function br(t){var e;return t&&t.isOpen&&!(!((e=t.children)===null||e===void 0)&&e.length)}const jr=(t,e)=>{let n=t;for(;n;){if(n.id===e.id)return!0;n=n.parent}return!1},wr=t=>{if(!t.parent)throw Error("Node does not have a parent");return t.parent.children.findIndex(e=>e.id===t.id)};function Bt(t,e){if(!t)return null;if(t.id===e)return t;if(t.children)for(let n of t.children){const r=Bt(n,e);if(r)return r}return null}function jt(t,e){if(e(t),t.children)for(let n of t.children)jt(n,e)}function Sr(t){const e=Cr(t);let n;for(let r=0;r<e.length;++r)if(e[r]===t){n=Qo(e,r);break}n==null||n.focus()}function Ir(t){const e=Cr(t);let n;for(let r=0;r<e.length;++r)if(e[r]===t){n=Jo(e,r);break}n==null||n.focus()}function Qo(t,e){return e+1<t.length?t[e+1]:t[0]}function Jo(t,e){return e-1>=0?t[e-1]:t[t.length-1]}function Cr(t){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(e=>e===t||!t.contains(e))}function et(t,e){return typeof e=="boolean"?e:typeof e=="string"?t[e]:e(t)}function Or(t){return t===null?null:Re(t)}function Re(t){return typeof t=="string"?t:t.id}function kr(t,...e){if(t)return t(...e)}function Nr(t){return new Promise((e,n)=>{let r=0;(function i(){r+=1,r===100&&n(),t()?e():setTimeout(i,10)})()})}function Dr(t){var e,n;const r=t.focusedNode;return r?r.isOpen?0:r.parent?r.childIndex+1:0:(n=(e=t.root.children)===null||e===void 0?void 0:e.length)!==null&&n!==void 0?n:0}function Tr(t){const e=t.focusedNode;return e?e.isOpen?e.id:e.parent&&!e.parent.isRoot?e.parent.id:null:null}const Zo=Object.freeze(Object.defineProperty({__proto__:null,access:et,bound:bt,dfs:Bt,focusNextElement:Sr,focusPrevElement:Ir,getInsertIndex:Dr,getInsertParentId:Tr,identify:Re,identifyNull:Or,indexOf:wr,isClosed:xr,isDescendant:jr,isItem:yr,isOpenWithEmptyChildren:br,mergeRefs:function(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}},noop:function(){},safeRun:kr,waitFor:Nr,walk:jt},Symbol.toStringTag,{value:"Module"})),ea={display:"flex",alignItems:"center",zIndex:1},ta={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},na={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},ra=Xe.memo(function({top:t,left:e,indent:n}){const r={position:"absolute",pointerEvents:"none",top:t-2+"px",left:e+"px",right:n+"px"};return s.jsxs("div",{style:Object.assign(Object.assign({},ea),r),children:[s.jsx("div",{style:Object.assign({},na)}),s.jsx("div",{style:Object.assign({},ta)})]})});function ia({node:t,attrs:e,innerRef:n,children:r}){return s.jsx("div",Object.assign({},e,{ref:n,onFocus:i=>i.stopPropagation(),onClick:t.handleClick,children:r}))}function sa(t){return s.jsxs("div",{ref:t.dragHandle,style:t.style,children:[s.jsx("span",{onClick:e=>{e.stopPropagation(),t.node.toggle()},children:t.node.isLeaf?"\u{1F333}":t.node.isOpen?"\u{1F5C1}":"\u{1F5C0}"})," ",t.node.isEditing?s.jsx(aa,Object.assign({},t)):s.jsx(oa,Object.assign({},t))]})}function oa(t){return s.jsx(s.Fragment,{children:s.jsx("span",{children:t.node.data.name})})}function aa({node:t}){const e=S.useRef();return S.useEffect(()=>{var n,r;(n=e.current)===null||n===void 0||n.focus(),(r=e.current)===null||r===void 0||r.select()},[]),s.jsx("input",{ref:e,defaultValue:t.data.name,onBlur:()=>t.reset(),onKeyDown:n=>{var r;n.key==="Escape"&&t.reset(),n.key==="Enter"&&t.submit(((r=e.current)===null||r===void 0?void 0:r.value)||"")}})}function Wt(t){return{type:"EDIT",id:t}}function Be(t){return{type:"FOCUS",id:t}}class Rt{constructor(e){this.handleClick=n=>{n.metaKey&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():n.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}get isRoot(){return this.id===tt}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 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(){var e;return this.isSelected&&!(!((e=this.prev)===null||e===void 0)&&e.isSelected)}get isSelectedEnd(){var e;return this.isSelected&&!(!((e=this.next)===null||e===void 0)&&e.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(){var e,n;const r=this.childIndex;return(n=(e=this.parent)===null||e===void 0?void 0:e.children[r+1])!==null&&n!==void 0?n:null}isAncestorOf(e){if(!e)return!1;let n=e;for(;n;){if(n.id===this.id)return!0;n=n.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 Rt(Object.assign({},this))}edit(){return this.tree.edit(this)}}const tt="__REACT_ARBORIST_INTERNAL_ROOT__";function Er(t){var e;function n(o,a,l){const c=t.accessId(o),d=new Rt({tree:t,data:o,level:a,parent:l,id:c,children:null,isDraggable:t.isDraggable(o),rowIndex:null}),u=t.accessChildren(o);return u&&(d.children=u.map(g=>n(g,a+1,d))),d}const r=new Rt({tree:t,id:tt,data:{id:tt},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null}),i=(e=t.props.data)!==null&&e!==void 0?e:[];return r.children=i.map(o=>n(o,0,r)),r}const Gt={open:(t,e)=>({type:"VISIBILITY_OPEN",id:t,filtered:e}),close:(t,e)=>({type:"VISIBILITY_CLOSE",id:t,filtered:e}),toggle:(t,e)=>({type:"VISIBILITY_TOGGLE",id:t,filtered:e}),clear:t=>({type:"VISIBILITY_CLEAR",filtered:t})};function _r(t={},e){if(e.type==="VISIBILITY_OPEN")return Object.assign(Object.assign({},t),{[e.id]:!0});if(e.type==="VISIBILITY_CLOSE")return Object.assign(Object.assign({},t),{[e.id]:!1});if(e.type==="VISIBILITY_TOGGLE"){const n=t[e.id];return Object.assign(Object.assign({},t),{[e.id]:!n})}return e.type==="VISIBILITY_CLEAR"?{}:t}const We=t=>{var e;return{nodes:{open:{filtered:{},unfiltered:(e=t==null?void 0:t.initialOpenState)!==null&&e!==void 0?e:{}},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}}},la=t=>({type:"SELECTION_ONLY",id:Re(t)}),Pr=t=>({type:"SELECTION_ADD",ids:(Array.isArray(t)?t:[t]).map(Re)}),Ar=t=>({type:"SELECTION_REMOVE",ids:(Array.isArray(t)?t:[t]).map(Re)}),ca=t=>Object.assign({type:"SELECTION_SET"},t),Kt=t=>({type:"SELECTION_MOST_RECENT",id:t===null?null:Re(t)}),Mr=t=>({type:"SELECTION_ANCHOR",id:t===null?null:Re(t)}),Ge={cursor:t=>({type:"DND_CURSOR",cursor:t}),dragStart:(t,e)=>({type:"DND_DRAG_START",id:t,dragIds:e}),dragEnd:()=>({type:"DND_DRAG_END"}),hovering:(t,e)=>({type:"DND_HOVERING",parentId:t,index:e})},da={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},ua=t=>{if(!t)return{display:"none"};const{x:e,y:n}=t;return{transform:`translate(${e}px, ${n}px)`}},ha=t=>{if(!t)return{display:"none"};const{x:e,y:n}=t;return{transform:`translate(${e+10}px, ${n+10}px)`}};function Rr({offset:t,mouse:e,id:n,dragIds:r,isDragging:i}){return s.jsxs(fa,{isDragging:i,children:[s.jsx(pa,{offset:t,children:s.jsx(ma,{id:n,dragIds:r})}),s.jsx(ga,{mouse:e,count:r.length})]})}const fa=S.memo(function(t){return t.isDragging?s.jsx("div",{style:da,children:t.children}):null});function pa(t){return s.jsx("div",{className:"row preview",style:ua(t.offset),children:t.children})}function ga(t){const{count:e,mouse:n}=t;return e>1?s.jsx("div",{className:"selected-count",style:ha(n),children:e}):null}const ma=S.memo(function(t){const e=ve(),n=e.get(t.id);return n?s.jsx(e.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*e.indent,opacity:.2,background:"transparent"},tree:e}):null});var Lr=Number.isNaN||function(t){return typeof t=="number"&&t!=t};function va(t,e){return t===e||!(!Lr(t)||!Lr(e))}function ya(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!va(t[n],e[n]))return!1;return!0}function Yt(t,e){var n;e===void 0&&(e=ya);var r,i=[],o=!1;return function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];return o&&n===this&&e(a,i)||(r=t.apply(this,a),o=!0,n=this,i=a),r}}var Fr=typeof performance=="object"&&typeof performance.now=="function"?function(){return performance.now()}:function(){return Date.now()};function zr(t){cancelAnimationFrame(t.id)}var $t=-1;function Hr(t){if(t===void 0&&(t=!1),$t===-1||t){var e=document.createElement("div"),n=e.style;n.width="50px",n.height="50px",n.overflow="scroll",document.body.appendChild(e),$t=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return $t}var nt=null;function Ur(t){if(t===void 0&&(t=!1),nt===null||t){var e=document.createElement("div"),n=e.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",e.appendChild(r),document.body.appendChild(e),e.scrollLeft>0?nt="positive-descending":(e.scrollLeft=1,nt=e.scrollLeft===0?"negative":"positive-ascending"),document.body.removeChild(e),nt}return nt}var xa=function(t,e){return t};function ba(t){var e,n=t.getItemOffset,r=t.getEstimatedTotalSize,i=t.getItemSize,o=t.getOffsetForIndexAndAlignment,a=t.getStartIndexForOffset,l=t.getStopIndexForStartIndex,c=t.initInstanceProps,d=t.shouldResetStyleCacheOnItemSizeChange,u=t.validateProps;return e=function(g){function f(h){var p;return(p=g.call(this,h)||this)._instanceProps=c(p.props,hr(p)),p._outerRef=void 0,p._resetIsScrollingTimeoutId=null,p.state={instance:hr(p),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof p.props.initialScrollOffset=="number"?p.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},p._callOnItemsRendered=void 0,p._callOnItemsRendered=Yt(function(v,x,b,j){return p.props.onItemsRendered({overscanStartIndex:v,overscanStopIndex:x,visibleStartIndex:b,visibleStopIndex:j})}),p._callOnScroll=void 0,p._callOnScroll=Yt(function(v,x,b){return p.props.onScroll({scrollDirection:v,scrollOffset:x,scrollUpdateWasRequested:b})}),p._getItemStyle=void 0,p._getItemStyle=function(v){var x,b=p.props,j=b.direction,O=b.itemSize,w=b.layout,k=p._getItemStyleCache(d&&O,d&&w,d&&j);if(k.hasOwnProperty(v))x=k[v];else{var N=n(p.props,v,p._instanceProps),R=i(p.props,v,p._instanceProps),A=j==="horizontal"||w==="horizontal",H=j==="rtl",V=A?N:0;k[v]=x={position:"absolute",left:H?void 0:V,right:H?V:void 0,top:A?0:N,height:A?"100%":R,width:A?R:"100%"}}return x},p._getItemStyleCache=void 0,p._getItemStyleCache=Yt(function(v,x,b){return{}}),p._onScrollHorizontal=function(v){var x=v.currentTarget,b=x.clientWidth,j=x.scrollLeft,O=x.scrollWidth;p.setState(function(w){if(w.scrollOffset===j)return null;var k=p.props.direction,N=j;if(k==="rtl")switch(Ur()){case"negative":N=-j;break;case"positive-descending":N=O-b-j}return N=Math.max(0,Math.min(N,O-b)),{isScrolling:!0,scrollDirection:w.scrollOffset<N?"forward":"backward",scrollOffset:N,scrollUpdateWasRequested:!1}},p._resetIsScrollingDebounced)},p._onScrollVertical=function(v){var x=v.currentTarget,b=x.clientHeight,j=x.scrollHeight,O=x.scrollTop;p.setState(function(w){if(w.scrollOffset===O)return null;var k=Math.max(0,Math.min(O,j-b));return{isScrolling:!0,scrollDirection:w.scrollOffset<k?"forward":"backward",scrollOffset:k,scrollUpdateWasRequested:!1}},p._resetIsScrollingDebounced)},p._outerRefSetter=function(v){var x=p.props.outerRef;p._outerRef=v,typeof x=="function"?x(v):x!=null&&typeof x=="object"&&x.hasOwnProperty("current")&&(x.current=v)},p._resetIsScrollingDebounced=function(){var v,x,b,j;p._resetIsScrollingTimeoutId!==null&&zr(p._resetIsScrollingTimeoutId),p._resetIsScrollingTimeoutId=(v=p._resetIsScrolling,x=150,b=Fr(),j={id:requestAnimationFrame(function O(){Fr()-b>=x?v.call(null):j.id=requestAnimationFrame(O)})})},p._resetIsScrolling=function(){p._resetIsScrollingTimeoutId=null,p.setState({isScrolling:!1},function(){p._getItemStyleCache(-1,null)})},p}(function(h,p){h.prototype=Object.create(p.prototype),h.prototype.constructor=h,Vt(h,p)})(f,g),f.getDerivedStateFromProps=function(h,p){return ja(h,p),u(h),null};var m=f.prototype;return m.scrollTo=function(h){h=Math.max(0,h),this.setState(function(p){return p.scrollOffset===h?null:{scrollDirection:p.scrollOffset<h?"forward":"backward",scrollOffset:h,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},m.scrollToItem=function(h,p){p===void 0&&(p="auto");var v=this.props,x=v.itemCount,b=v.layout,j=this.state.scrollOffset;h=Math.max(0,Math.min(h,x-1));var O=0;if(this._outerRef){var w=this._outerRef;O=b==="vertical"?w.scrollWidth>w.clientWidth?Hr():0:w.scrollHeight>w.clientHeight?Hr():0}this.scrollTo(o(this.props,h,p,j,this._instanceProps,O))},m.componentDidMount=function(){var h=this.props,p=h.direction,v=h.initialScrollOffset,x=h.layout;if(typeof v=="number"&&this._outerRef!=null){var b=this._outerRef;p==="horizontal"||x==="horizontal"?b.scrollLeft=v:b.scrollTop=v}this._callPropsCallbacks()},m.componentDidUpdate=function(){var h=this.props,p=h.direction,v=h.layout,x=this.state,b=x.scrollOffset;if(x.scrollUpdateWasRequested&&this._outerRef!=null){var j=this._outerRef;if(p==="horizontal"||v==="horizontal")if(p==="rtl")switch(Ur()){case"negative":j.scrollLeft=-b;break;case"positive-ascending":j.scrollLeft=b;break;default:var O=j.clientWidth,w=j.scrollWidth;j.scrollLeft=w-O-b}else j.scrollLeft=b;else j.scrollTop=b}this._callPropsCallbacks()},m.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&zr(this._resetIsScrollingTimeoutId)},m.render=function(){var h=this.props,p=h.children,v=h.className,x=h.direction,b=h.height,j=h.innerRef,O=h.innerElementType,w=h.innerTagName,k=h.itemCount,N=h.itemData,R=h.itemKey,A=R===void 0?xa:R,H=h.layout,V=h.outerElementType,J=h.outerTagName,ee=h.style,Z=h.useIsScrolling,ne=h.width,K=this.state.isScrolling,W=x==="horizontal"||H==="horizontal",G=W?this._onScrollHorizontal:this._onScrollVertical,Y=this._getRangeToRender(),se=Y[0],C=Y[1],y=[];if(k>0)for(var I=se;I<=C;I++)y.push(S.createElement(p,{data:N,key:A(I,N),index:I,isScrolling:Z?K:void 0,style:this._getItemStyle(I)}));var ae=r(this.props,this._instanceProps);return S.createElement(V||J||"div",{className:v,onScroll:G,ref:this._outerRefSetter,style:Ss({position:"relative",height:b,width:ne,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:x},ee)},S.createElement(O||w||"div",{children:y,ref:j,style:{height:W?"100%":ae,pointerEvents:K?"none":void 0,width:W?ae:"100%"}}))},m._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"&&this.props.itemCount>0){var h=this._getRangeToRender(),p=h[0],v=h[1],x=h[2],b=h[3];this._callOnItemsRendered(p,v,x,b)}if(typeof this.props.onScroll=="function"){var j=this.state,O=j.scrollDirection,w=j.scrollOffset,k=j.scrollUpdateWasRequested;this._callOnScroll(O,w,k)}},m._getRangeToRender=function(){var h=this.props,p=h.itemCount,v=h.overscanCount,x=this.state,b=x.isScrolling,j=x.scrollDirection,O=x.scrollOffset;if(p===0)return[0,0,0,0];var w=a(this.props,O,this._instanceProps),k=l(this.props,w,O,this._instanceProps),N=b&&j!=="backward"?1:Math.max(1,v),R=b&&j!=="forward"?1:Math.max(1,v);return[Math.max(0,w-N),Math.max(0,Math.min(p-1,k+R)),w,k]},f}(S.PureComponent),e.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},e}var ja=function(t,e){t.children,t.direction,t.height,t.layout,t.innerTagName,t.outerTagName,t.width,e.instance},wa=ba({getItemOffset:function(t,e){return e*t.itemSize},getItemSize:function(t,e){return t.itemSize},getEstimatedTotalSize:function(t){var e=t.itemCount;return t.itemSize*e},getOffsetForIndexAndAlignment:function(t,e,n,r,i,o){var a=t.direction,l=t.height,c=t.itemCount,d=t.itemSize,u=t.layout,g=t.width,f=a==="horizontal"||u==="horizontal"?g:l,m=Math.max(0,c*d-f),h=Math.min(m,e*d),p=Math.max(0,e*d-f+d+o);switch(n==="smart"&&(n=r>=p-f&&r<=h+f?"auto":"center"),n){case"start":return h;case"end":return p;case"center":var v=Math.round(p+(h-p)/2);return v<Math.ceil(f/2)?0:v>m+Math.floor(f/2)?m:v;default:return r>=p&&r<=h?r:r<p?p:h}},getStartIndexForOffset:function(t,e){var n=t.itemCount,r=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(e/r)))},getStopIndexForStartIndex:function(t,e,n){var r=t.direction,i=t.height,o=t.itemCount,a=t.itemSize,l=t.layout,c=t.width,d=e*a,u=r==="horizontal"||l==="horizontal"?c:i,g=Math.ceil((u+n-d)/a);return Math.max(0,Math.min(o-1,e+g-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){t.itemSize}});function Sa(){var t,e;const n=ve(),r=function(){const c=S.useContext(gr);if(c===null)throw new Error("Provide a DnDContext");return c}().cursor;if(!r||r.type!=="line")return null;const i=n.indent,o=n.rowHeight*r.index+((e=(t=n.props.padding)!==null&&t!==void 0?t:n.props.paddingTop)!==null&&e!==void 0?e:0),a=i*r.level,l=n.renderCursor;return s.jsx(l,{top:o,left:a,indent:i})}var Ia=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n};const Ca=S.forwardRef(function(t,e){const{children:n}=t,r=Ia(t,["children"]),i=ve();return s.jsxs("div",Object.assign({ref:e},r,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[s.jsx(Oa,{}),n]}))}),Oa=()=>{const t=ve();return s.jsx("div",{style:{height:t.visibleNodes.length*t.rowHeight,width:"100%",position:"absolute",left:"0",right:"0"},children:s.jsx(Sa,{})})};var ka=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n};const Na=S.forwardRef(function(t,e){var n,r,i,o,{style:a}=t,l=ka(t,["style"]);const c=ve(),d=(r=(n=c.props.padding)!==null&&n!==void 0?n:c.props.paddingTop)!==null&&r!==void 0?r:0,u=(o=(i=c.props.padding)!==null&&i!==void 0?i:c.props.paddingBottom)!==null&&o!==void 0?o:0;return s.jsx("div",Object.assign({ref:e,style:Object.assign(Object.assign({},a),{height:`${parseFloat(a.height)+d+u}px`})},l))});var xe,qr=S.createContext({dragDropManager:void 0});function P(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];if(!t){var o;if(e===void 0)o=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;(o=new Error(e.replace(/%s/g,function(){return r[a++]}))).name="Invariant Violation"}throw o.framesToPop=1,o}}(function(t){t.SOURCE="SOURCE",t.TARGET="TARGET"})(xe||(xe={}));var Xt="dnd-core/INIT_COORDS",Qt="dnd-core/BEGIN_DRAG",Vr="dnd-core/PUBLISH_DRAG_SOURCE",wt="dnd-core/HOVER",Jt="dnd-core/DROP",Zt="dnd-core/END_DRAG";function Br(t,e){return{type:Xt,payload:{sourceClientOffset:e||null,clientOffset:t||null}}}function en(t){return en=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},en(t)}function Wr(t){return en(t)==="object"}var Da={type:Xt,payload:{clientOffset:null,sourceClientOffset:null}};function Ta(t){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{publishSource:!0},r=n.publishSource,i=r===void 0||r,o=n.clientOffset,a=n.getSourceClientOffset,l=t.getMonitor(),c=t.getRegistry();t.dispatch(Br(o)),function(m,h,p){P(!h.isDragging(),"Cannot call beginDrag while dragging."),m.forEach(function(v){P(p.getSource(v),"Expected sourceIds to be registered.")})}(e,l,c);var d=function(m,h){for(var p=null,v=m.length-1;v>=0;v--)if(h.canDragSource(m[v])){p=m[v];break}return p}(e,l);if(d!==null){var u=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");(function(m){P(typeof m=="function","When clientOffset is provided, getSourceClientOffset must be a function.")})(a),u=a(d)}t.dispatch(Br(o,u));var g=c.getSource(d).beginDrag(l,d);if(g!=null){(function(m){P(Wr(m),"Item must be an object.")})(g),c.pinSource(d);var f=c.getSourceType(d);return{type:Qt,payload:{itemType:f,item:g,sourceId:d,clientOffset:o||null,sourceClientOffset:u||null,isSourcePublic:!!i}}}}else t.dispatch(Da)}}function Ea(t){return function(){if(t.getMonitor().isDragging())return{type:Vr}}}function tn(t,e){return e===null?t===null:Array.isArray(t)?t.some(function(n){return n===e}):t===e}function _a(t){return function(e){var n=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).clientOffset;(function(a){P(Array.isArray(a),"Expected targetIds to be an array.")})(e);var r=e.slice(0),i=t.getMonitor(),o=t.getRegistry();return function(a,l,c){P(l.isDragging(),"Cannot call hover while not dragging."),P(!l.didDrop(),"Cannot call hover after drop.");for(var d=0;d<a.length;d++){var u=a[d];P(a.lastIndexOf(u)===d,"Expected targetIds to be unique in the passed array."),P(c.getTarget(u),"Expected targetIds to be registered.")}}(r,i,o),function(a,l,c){for(var d=a.length-1;d>=0;d--){var u=a[d];tn(l.getTargetType(u),c)||a.splice(d,1)}}(r,o,i.getItemType()),function(a,l,c){a.forEach(function(d){c.getTarget(d).hover(l,d)})}(r,i,o),{type:wt,payload:{targetIds:r,clientOffset:n||null}}}}function Gr(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Kr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Gr(Object(n),!0).forEach(function(r){Pa(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Gr(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Pa(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Aa(t){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.getMonitor(),r=t.getRegistry();(function(o){P(o.isDragging(),"Cannot call drop while not dragging."),P(!o.didDrop(),"Cannot call drop twice during one drag operation.")})(n);var i=function(o){var a=o.getTargetIds().filter(o.canDropOnTarget,o);return a.reverse(),a}(n);i.forEach(function(o,a){var l=function(d,u,g,f){var m=g.getTarget(d),h=m?m.drop(f,d):void 0;return function(p){P(p===void 0||Wr(p),"Drop result must either be an object or undefined.")}(h),h===void 0&&(h=u===0?{}:f.getDropResult()),h}(o,a,r,n),c={type:Jt,payload:{dropResult:Kr(Kr({},e),l)}};t.dispatch(c)})}}function Ma(t){return function(){var e=t.getMonitor(),n=t.getRegistry();(function(i){P(i.isDragging(),"Cannot call endDrag while not dragging.")})(e);var r=e.getSourceId();return r!=null&&(n.getSource(r,!0).endDrag(e,r),n.unpinSource()),{type:Zt}}}function Ra(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function rt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var La=function(){function t(e,n){var r=this;(function(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")})(this,t),rt(this,"store",void 0),rt(this,"monitor",void 0),rt(this,"backend",void 0),rt(this,"isSetUp",!1),rt(this,"handleRefCountChange",function(){var i=r.store.getState().refCount>0;r.backend&&(i&&!r.isSetUp?(r.backend.setup(),r.isSetUp=!0):!i&&r.isSetUp&&(r.backend.teardown(),r.isSetUp=!1))}),this.store=e,this.monitor=n,e.subscribe(this.handleRefCountChange)}return Ra(t,[{key:"receiveBackend",value:function(e){this.backend=e}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var e=this,n=this.store.dispatch,r=function(i){return{beginDrag:Ta(i),publishDragSource:Ea(i),hover:_a(i),drop:Aa(i),endDrag:Ma(i)}}(this);return Object.keys(r).reduce(function(i,o){var a,l=r[o];return i[o]=(a=l,function(){for(var c=arguments.length,d=new Array(c),u=0;u<c;u++)d[u]=arguments[u];var g=a.apply(e,d);g!==void 0&&n(g)}),i},{})}},{key:"dispatch",value:function(e){this.store.dispatch(e)}}]),t}();function be(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var Yr=typeof Symbol=="function"&&Symbol.observable||"@@observable",$r=function(){return Math.random().toString(36).substring(7).split("").join(".")},Xr={INIT:"@@redux/INIT"+$r(),REPLACE:"@@redux/REPLACE"+$r()};function Qr(t,e,n){var r;if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(be(0));if(typeof e=="function"&&n===void 0&&(n=e,e=void 0),n!==void 0){if(typeof n!="function")throw new Error(be(1));return n(Qr)(t,e)}if(typeof t!="function")throw new Error(be(2));var i=t,o=e,a=[],l=a,c=!1;function d(){l===a&&(l=a.slice())}function u(){if(c)throw new Error(be(3));return o}function g(m){if(typeof m!="function")throw new Error(be(4));if(c)throw new Error(be(5));var h=!0;return d(),l.push(m),function(){if(h){if(c)throw new Error(be(6));h=!1,d();var p=l.indexOf(m);l.splice(p,1),a=null}}}function f(m){if(!function(v){if(typeof v!="object"||v===null)return!1;for(var x=v;Object.getPrototypeOf(x)!==null;)x=Object.getPrototypeOf(x);return Object.getPrototypeOf(v)===x}(m))throw new Error(be(7));if(m.type===void 0)throw new Error(be(8));if(c)throw new Error(be(9));try{c=!0,o=i(o,m)}finally{c=!1}for(var h=a=l,p=0;p<h.length;p++)(0,h[p])();return m}return f({type:Xr.INIT}),(r={dispatch:f,subscribe:g,getState:u,replaceReducer:function(m){if(typeof m!="function")throw new Error(be(10));i=m,f({type:Xr.REPLACE})}})[Yr]=function(){var m,h=g;return(m={subscribe:function(p){if(typeof p!="object"||p===null)throw new Error(be(11));function v(){p.next&&p.next(u())}return v(),{unsubscribe:h(v)}}})[Yr]=function(){return this},m},r}var Fa=function(t,e){return t===e};function Jr(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Zr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Jr(Object(n),!0).forEach(function(r){za(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Jr(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function za(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var ei={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Ha(){var t,e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ei,r=arguments.length>1?arguments[1]:void 0,i=r.payload;switch(r.type){case Xt:case Qt:return{initialSourceClientOffset:i.sourceClientOffset,initialClientOffset:i.clientOffset,clientOffset:i.clientOffset};case wt:return t=n.clientOffset,e=i.clientOffset,!t&&!e||t&&e&&t.x===e.x&&t.y===e.y?n:Zr(Zr({},n),{},{clientOffset:i.clientOffset});case Zt:case Jt:return ei;default:return n}}var nn="dnd-core/ADD_SOURCE",rn="dnd-core/ADD_TARGET",sn="dnd-core/REMOVE_SOURCE",St="dnd-core/REMOVE_TARGET";function ti(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function je(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ti(Object(n),!0).forEach(function(r){Ua(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ti(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ua(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var qa={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Va(){var t,e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:qa,r=arguments.length>1?arguments[1]:void 0,i=r.payload;switch(r.type){case Qt:return je(je({},n),{},{itemType:i.itemType,item:i.item,sourceId:i.sourceId,isSourcePublic:i.isSourcePublic,dropResult:null,didDrop:!1});case Vr:return je(je({},n),{},{isSourcePublic:!0});case wt:return je(je({},n),{},{targetIds:i.targetIds});case St:return n.targetIds.indexOf(i.targetId)===-1?n:je(je({},n),{},{targetIds:(t=n.targetIds,e=i.targetId,t.filter(function(o){return o!==e}))});case Jt:return je(je({},n),{},{dropResult:i.dropResult,didDrop:!0,targetIds:[]});case Zt:return je(je({},n),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return n}}function Ba(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;switch((arguments.length>1?arguments[1]:void 0).type){case nn:case rn:return t+1;case sn:case St:return t-1;default:return t}}var It=[],on=[];function Wa(){var t=arguments.length>1?arguments[1]:void 0;switch(t.type){case wt:break;case nn:case rn:case St:case sn:return It;default:return on}var e=t.payload,n=e.targetIds,r=n===void 0?[]:n,i=e.prevTargetIds,o=i===void 0?[]:i,a=function(u,g){var f=new Map,m=function(p){f.set(p,f.has(p)?f.get(p)+1:1)};u.forEach(m),g.forEach(m);var h=[];return f.forEach(function(p,v){p===1&&h.push(v)}),h}(r,o),l=a.length>0||!function(u,g){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Fa;if(u.length!==g.length)return!1;for(var m=0;m<u.length;++m)if(!f(u[m],g[m]))return!1;return!0}(r,o);if(!l)return It;var c=o[o.length-1],d=r[r.length-1];return c!==d&&(c&&a.push(c),d&&a.push(d)),a}function Ga(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:0)+1}function ni(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ri(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ni(Object(n),!0).forEach(function(r){Ka(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ni(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ka(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ya(){var t,e,n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:Wa(r.dirtyHandlerIds,{type:i.type,payload:ri(ri({},i.payload),{},{prevTargetIds:(t=r,e="dragOperation.targetIds",n=[],e.split(".").reduce(function(o,a){return o&&o[a]?o[a]:n||null},t))})}),dragOffset:Ha(r.dragOffset,i),refCount:Ba(r.refCount,i),dragOperation:Va(r.dragOperation,i),stateId:Ga(r.stateId)}}function ii(t,e){return{x:t.x-e.x,y:t.y-e.y}}function $a(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function si(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}It.__IS_NONE__=!0,on.__IS_ALL__=!0;var Xa=function(){function t(e,n){(function(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")})(this,t),si(this,"store",void 0),si(this,"registry",void 0),this.store=e,this.registry=n}return $a(t,[{key:"subscribeToStateChange",value:function(e){var n=this,r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{handlerIds:void 0}).handlerIds;P(typeof e=="function","listener must be a function."),P(r===void 0||Array.isArray(r),"handlerIds, when specified, must be an array of strings.");var i=this.store.getState().stateId;return this.store.subscribe(function(){var o=n.store.getState(),a=o.stateId;try{var l=a===i||a===i+1&&!function(c,d){if(c===It)return!1;if(c===on||d===void 0)return!0;var u,g=(u=c,d.filter(function(f){return u.indexOf(f)>-1}));return g.length>0}(o.dirtyHandlerIds,r);l||e()}finally{i=a}})}},{key:"subscribeToOffsetChange",value:function(e){var n=this;P(typeof e=="function","listener must be a function.");var r=this.store.getState().dragOffset;return this.store.subscribe(function(){var i=n.store.getState().dragOffset;i!==r&&(r=i,e())})}},{key:"canDragSource",value:function(e){if(!e)return!1;var n=this.registry.getSource(e);return P(n,"Expected to find a valid source. sourceId=".concat(e)),!this.isDragging()&&n.canDrag(this,e)}},{key:"canDropOnTarget",value:function(e){if(!e)return!1;var n=this.registry.getTarget(e);return P(n,"Expected to find a valid target. targetId=".concat(e)),!(!this.isDragging()||this.didDrop())&&tn(this.registry.getTargetType(e),this.getItemType())&&n.canDrop(this,e)}},{key:"isDragging",value:function(){return!!this.getItemType()}},{key:"isDraggingSource",value:function(e){if(!e)return!1;var n=this.registry.getSource(e,!0);return P(n,"Expected to find a valid source. sourceId=".concat(e)),!(!this.isDragging()||!this.isSourcePublic())&&this.registry.getSourceType(e)===this.getItemType()&&n.isDragging(this,e)}},{key:"isOverTarget",value:function(e){if(!e)return!1;var n=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shallow:!1}).shallow;if(!this.isDragging())return!1;var r=this.registry.getTargetType(e),i=this.getItemType();if(i&&!tn(r,i))return!1;var o=this.getTargetIds();if(!o.length)return!1;var a=o.indexOf(e);return n?a===o.length-1:a>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return!!this.store.getState().dragOperation.isSourcePublic}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return e=this.store.getState().dragOffset,i=e.clientOffset,o=e.initialClientOffset,a=e.initialSourceClientOffset,i&&o&&a?ii((r=a,{x:(n=i).x+r.x,y:n.y+r.y}),o):null;var e,n,r,i,o,a}},{key:"getDifferenceFromInitialOffset",value:function(){return e=this.store.getState().dragOffset,n=e.clientOffset,r=e.initialClientOffset,n&&r?ii(n,r):null;var e,n,r}}]),t}(),Qa=0;function an(t){return an=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},an(t)}function ln(t,e){e&&Array.isArray(t)?t.forEach(function(n){return ln(n,!1)}):P(typeof t=="string"||an(t)==="symbol",e?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}const oi=typeof global<"u"?global:self,ai=oi.MutationObserver||oi.WebKitMutationObserver;function li(t){return function(){const e=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(e),clearInterval(n),t()}}}const Ja=typeof ai=="function"?function(t){let e=1;const n=new ai(t),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){e=-e,r.data=e}}:li;class Za{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,n){this.onError=e,this.release=n,this.task=null}}const ci=new class{enqueueTask(t){const{queue:e,requestFlush:n}=this;e.length||(n(),this.flushing=!0),e[e.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.index<t.length;){const e=this.index;if(this.index++,t[e].call(),this.index>this.capacity){for(let n=0,r=t.length-this.index;n<r;n++)t[n]=t[n+this.index];t.length-=this.index,this.index=0}}t.length=0,this.index=0,this.flushing=!1},this.registerPendingError=t=>{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=Ja(this.flush),this.requestErrorThrow=li(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},el=new class{create(t){const e=this.freeTasks,n=e.length?e.pop():new Za(this.onError,r=>e[e.length]=r);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}(ci.registerPendingError);function tl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function Ke(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function nl(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,a,l=[],c=!0,d=!1;try{for(i=i.call(n);!(c=(o=i.next()).done)&&(l.push(o.value),!r||l.length!==r);c=!0);}catch(u){d=!0,a=u}finally{try{c||i.return==null||i.return()}finally{if(d)throw a}}return l}}(t,e)||function(n,r){if(n){if(typeof n=="string")return di(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return di(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
7
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function di(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function rl(t){var e=(Qa++).toString();switch(t){case xe.SOURCE:return"S".concat(e);case xe.TARGET:return"T".concat(e);default:throw new Error("Unknown Handler Role: ".concat(t))}}function ui(t){switch(t[0]){case"S":return xe.SOURCE;case"T":return xe.TARGET;default:P(!1,"Cannot parse handler ID: ".concat(t))}}function hi(t,e){var n=t.entries(),r=!1;do{var i=n.next(),o=i.done;if(nl(i.value,2)[1]===e)return!0;r=!!o}while(!r);return!1}var il=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),Ke(this,"types",new Map),Ke(this,"dragSources",new Map),Ke(this,"dropTargets",new Map),Ke(this,"pinnedSourceId",null),Ke(this,"pinnedSource",null),Ke(this,"store",void 0),this.store=e}return tl(t,[{key:"addSource",value:function(e,n){ln(e),function(i){P(typeof i.canDrag=="function","Expected canDrag to be a function."),P(typeof i.beginDrag=="function","Expected beginDrag to be a function."),P(typeof i.endDrag=="function","Expected endDrag to be a function.")}(n);var r=this.addHandler(xe.SOURCE,e,n);return this.store.dispatch(function(i){return{type:nn,payload:{sourceId:i}}}(r)),r}},{key:"addTarget",value:function(e,n){ln(e,!0),function(i){P(typeof i.canDrop=="function","Expected canDrop to be a function."),P(typeof i.hover=="function","Expected hover to be a function."),P(typeof i.drop=="function","Expected beginDrag to be a function.")}(n);var r=this.addHandler(xe.TARGET,e,n);return this.store.dispatch(function(i){return{type:rn,payload:{targetId:i}}}(r)),r}},{key:"containsHandler",value:function(e){return hi(this.dragSources,e)||hi(this.dropTargets,e)}},{key:"getSource",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return P(this.isSourceId(e),"Expected a valid source ID."),n&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}},{key:"getTarget",value:function(e){return P(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}},{key:"getSourceType",value:function(e){return P(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}},{key:"getTargetType",value:function(e){return P(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}},{key:"isSourceId",value:function(e){return ui(e)===xe.SOURCE}},{key:"isTargetId",value:function(e){return ui(e)===xe.TARGET}},{key:"removeSource",value:function(e){var n,r=this;P(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(i){return{type:sn,payload:{sourceId:i}}}(e)),n=function(){r.dragSources.delete(e),r.types.delete(e)},ci.enqueueTask(el.create(n))}},{key:"removeTarget",value:function(e){P(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(n){return{type:St,payload:{targetId:n}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}},{key:"pinSource",value:function(e){var n=this.getSource(e);P(n,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=n}},{key:"unpinSource",value:function(){P(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(e,n,r){var i=rl(e);return this.types.set(i,n),e===xe.SOURCE?this.dragSources.set(i,r):e===xe.TARGET&&this.dropTargets.set(i,r),i}}]),t}();function sl(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=function(l){var c=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Qr(Ya,l&&c&&c({name:"dnd-core",instanceId:"dnd-core"}))}(arguments.length>3&&arguments[3]!==void 0&&arguments[3]),i=new Xa(r,new il(r)),o=new La(r,i),a=t(o,e,n);return o.receiveBackend(a),o}var ol=["children"];function al(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,a,l=[],c=!0,d=!1;try{for(i=i.call(n);!(c=(o=i.next()).done)&&(l.push(o.value),!r||l.length!==r);c=!0);}catch(u){d=!0,a=u}finally{try{c||i.return==null||i.return()}finally{if(d)throw a}}return l}}(t,e)||function(n,r){if(n){if(typeof n=="string")return fi(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return fi(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
8
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function fi(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ll(t,e){if(t==null)return{};var n,r,i=function(a,l){if(a==null)return{};var c,d,u={},g=Object.keys(a);for(d=0;d<g.length;d++)c=g[d],l.indexOf(c)>=0||(u[c]=a[c]);return u}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}var pi=0,Ct=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),cl=S.memo(function(t){var e=t.children,n=function(a){if("manager"in a)return[{dragDropManager:a.manager},!1];var l=function(d){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gi(),g=arguments.length>2?arguments[2]:void 0,f=arguments.length>3?arguments[3]:void 0,m=u;return m[Ct]||(m[Ct]={dragDropManager:sl(d,u,g,f)}),m[Ct]}(a.backend,a.context,a.options,a.debugMode),c=!a.context;return[l,c]}(ll(t,ol)),r=al(n,2),i=r[0],o=r[1];return S.useEffect(function(){if(o){var a=gi();return++pi,function(){--pi===0&&(a[Ct]=null)}}},[]),s.jsx(qr.Provider,Object.assign({value:i},{children:e}),void 0)});function gi(){return typeof global<"u"?global:window}function dl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function mi(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var cn=!1,dn=!1,ul=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),mi(this,"internalMonitor",void 0),mi(this,"sourceId",null),this.internalMonitor=e.getMonitor()}return dl(t,[{key:"receiveHandlerId",value:function(e){this.sourceId=e}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){P(!cn,"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 cn=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{cn=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;P(!dn,"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 dn=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{dn=!1}}},{key:"subscribeToStateChange",value:function(e,n){return this.internalMonitor.subscribeToStateChange(e,n)}},{key:"isDraggingSource",value:function(e){return this.internalMonitor.isDraggingSource(e)}},{key:"isOverTarget",value:function(e,n){return this.internalMonitor.isOverTarget(e,n)}},{key:"getTargetIds",value:function(){return this.internalMonitor.getTargetIds()}},{key:"isSourcePublic",value:function(){return this.internalMonitor.isSourcePublic()}},{key:"getSourceId",value:function(){return this.internalMonitor.getSourceId()}},{key:"subscribeToOffsetChange",value:function(e){return this.internalMonitor.subscribeToOffsetChange(e)}},{key:"canDragSource",value:function(e){return this.internalMonitor.canDragSource(e)}},{key:"canDropOnTarget",value:function(e){return this.internalMonitor.canDropOnTarget(e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),t}();function hl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function vi(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var un=!1,fl=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),vi(this,"internalMonitor",void 0),vi(this,"targetId",null),this.internalMonitor=e.getMonitor()}return hl(t,[{key:"receiveHandlerId",value:function(e){this.targetId=e}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(e,n){return this.internalMonitor.subscribeToStateChange(e,n)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;P(!un,"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 un=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{un=!1}}},{key:"isOver",value:function(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),t}();function pl(t){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!S.isValidElement(e)){var r=e;return t(r,n),r}var i=e;(function(a){if(typeof a.type!="string"){var l=a.type.displayName||a.type.name||"the component";throw new Error("Only native element nodes can now be passed to React DnD connectors."+"You can either wrap ".concat(l," into a <div>, or turn it into a ")+"drag source or a drop target itself.")}})(i);var o=n?function(a){return t(a,n)}:t;return function(a,l){var c=a.ref;return P(typeof c!="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"),c?S.cloneElement(a,{ref:function(d){xi(c,d),xi(l,d)}}):S.cloneElement(a,{ref:l})}(i,o)}}function yi(t){var e={};return Object.keys(t).forEach(function(n){var r=t[n];if(n.endsWith("Ref"))e[n]=t[n];else{var i=pl(r);e[n]=function(){return i}}}),e}function xi(t,e){typeof t=="function"?t(e):t.current=e}function hn(t){return hn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hn(t)}function fn(t){return t!==null&&hn(t)==="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function pn(t,e,n,r){var i=void 0;if(i!==void 0)return!!i;if(t===e)return!0;if(typeof t!="object"||!t||typeof e!="object"||!e)return!1;var o=Object.keys(t),a=Object.keys(e);if(o.length!==a.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(e),c=0;c<o.length;c++){var d=o[c];if(!l(d))return!1;var u=t[d],g=e[d];if((i=void 0)===!1||i===void 0&&u!==g)return!1}return!0}function gl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function ue(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var ml=function(){function t(e){var n=this;(function(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")})(this,t),ue(this,"hooks",yi({dragSource:function(r,i){n.clearDragSource(),n.dragSourceOptions=i||null,fn(r)?n.dragSourceRef=r:n.dragSourceNode=r,n.reconnectDragSource()},dragPreview:function(r,i){n.clearDragPreview(),n.dragPreviewOptions=i||null,fn(r)?n.dragPreviewRef=r:n.dragPreviewNode=r,n.reconnectDragPreview()}})),ue(this,"handlerId",null),ue(this,"dragSourceRef",null),ue(this,"dragSourceNode",void 0),ue(this,"dragSourceOptionsInternal",null),ue(this,"dragSourceUnsubscribe",void 0),ue(this,"dragPreviewRef",null),ue(this,"dragPreviewNode",void 0),ue(this,"dragPreviewOptionsInternal",null),ue(this,"dragPreviewUnsubscribe",void 0),ue(this,"lastConnectedHandlerId",null),ue(this,"lastConnectedDragSource",null),ue(this,"lastConnectedDragSourceOptions",null),ue(this,"lastConnectedDragPreview",null),ue(this,"lastConnectedDragPreviewOptions",null),ue(this,"backend",void 0),this.backend=e}return gl(t,[{key:"receiveHandlerId",value:function(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}},{key:"connectTarget",get:function(){return this.dragSource}},{key:"dragSourceOptions",get:function(){return this.dragSourceOptionsInternal},set:function(e){this.dragSourceOptionsInternal=e}},{key:"dragPreviewOptions",get:function(){return this.dragPreviewOptionsInternal},set:function(e){this.dragPreviewOptionsInternal=e}},{key:"reconnect",value:function(){this.reconnectDragSource(),this.reconnectDragPreview()}},{key:"reconnectDragSource",value:function(){var e=this.dragSource,n=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();n&&this.disconnectDragSource(),this.handlerId&&(e?n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)):this.lastConnectedDragSource=e)}},{key:"reconnectDragPreview",value:function(){var e=this.dragPreview,n=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();n&&this.disconnectDragPreview(),this.handlerId&&(e?n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=e,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,e,this.dragPreviewOptions)):this.lastConnectedDragPreview=e)}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didConnectedDragSourceChange",value:function(){return this.lastConnectedDragSource!==this.dragSource}},{key:"didConnectedDragPreviewChange",value:function(){return this.lastConnectedDragPreview!==this.dragPreview}},{key:"didDragSourceOptionsChange",value:function(){return!pn(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!pn(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}},{key:"disconnectDragSource",value:function(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}},{key:"disconnectDragPreview",value:function(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}},{key:"dragSource",get:function(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}},{key:"dragPreview",get:function(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}},{key:"clearDragSource",value:function(){this.dragSourceNode=null,this.dragSourceRef=null}},{key:"clearDragPreview",value:function(){this.dragPreviewNode=null,this.dragPreviewRef=null}}]),t}();function vl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function Ne(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var yl=function(){function t(e){var n=this;(function(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")})(this,t),Ne(this,"hooks",yi({dropTarget:function(r,i){n.clearDropTarget(),n.dropTargetOptions=i,fn(r)?n.dropTargetRef=r:n.dropTargetNode=r,n.reconnect()}})),Ne(this,"handlerId",null),Ne(this,"dropTargetRef",null),Ne(this,"dropTargetNode",void 0),Ne(this,"dropTargetOptionsInternal",null),Ne(this,"unsubscribeDropTarget",void 0),Ne(this,"lastConnectedHandlerId",null),Ne(this,"lastConnectedDropTarget",null),Ne(this,"lastConnectedDropTargetOptions",null),Ne(this,"backend",void 0),this.backend=e}return vl(t,[{key:"connectTarget",get:function(){return this.dropTarget}},{key:"reconnect",value:function(){var e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();var n=this.dropTarget;this.handlerId&&(n?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=n,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,n,this.dropTargetOptions)):this.lastConnectedDropTarget=n)}},{key:"receiveHandlerId",value:function(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}},{key:"dropTargetOptions",get:function(){return this.dropTargetOptionsInternal},set:function(e){this.dropTargetOptionsInternal=e}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didDropTargetChange",value:function(){return this.lastConnectedDropTarget!==this.dropTarget}},{key:"didOptionsChange",value:function(){return!pn(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}},{key:"disconnectDropTarget",value:function(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}},{key:"dropTarget",get:function(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}},{key:"clearDropTarget",value:function(){this.dropTargetRef=null,this.dropTargetNode=null}}]),t}(),Le=typeof window<"u"?S.useLayoutEffect:S.useEffect;function gn(t){return gn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gn(t)}function xl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function mn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var bl=function(){function t(e,n,r){(function(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")})(this,t),mn(this,"spec",void 0),mn(this,"monitor",void 0),mn(this,"connector",void 0),this.spec=e,this.monitor=n,this.connector=r}return xl(t,[{key:"beginDrag",value:function(){var e,n=this.spec,r=this.monitor;return(e=gn(n.item)==="object"?n.item:typeof n.item=="function"?n.item(r):{})!==null&&e!==void 0?e:null}},{key:"canDrag",value:function(){var e=this.spec,n=this.monitor;return typeof e.canDrag=="boolean"?e.canDrag:typeof e.canDrag!="function"||e.canDrag(n)}},{key:"isDragging",value:function(e,n){var r=this.spec,i=this.monitor,o=r.isDragging;return o?o(i):n===e.getSourceId()}},{key:"endDrag",value:function(){var e=this.spec,n=this.monitor,r=this.connector,i=e.end;i&&i(n.getItem(),n),r.reconnect()}}]),t}();function Fe(){var t=S.useContext(qr).dragDropManager;return P(t!=null,"Expected drag drop context"),t}function jl(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,a,l=[],c=!0,d=!1;try{for(i=i.call(n);!(c=(o=i.next()).done)&&(l.push(o.value),!r||l.length!==r);c=!0);}catch(u){d=!0,a=u}finally{try{c||i.return==null||i.return()}finally{if(d)throw a}}return l}}(t,e)||function(n,r){if(n){if(typeof n=="string")return bi(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return bi(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
9
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function bi(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function wl(t,e,n){var r=Fe(),i=function(a,l,c){var d=S.useMemo(function(){return new bl(a,l,c)},[l,c]);return S.useEffect(function(){d.spec=a},[a]),d}(t,e,n),o=function(a){return S.useMemo(function(){var l=a.type;return P(l!=null,"spec.type must be defined"),l},[a])}(t);Le(function(){if(o!=null){var a=function(u,g,f){var m=f.getRegistry(),h=m.addSource(u,g);return[h,function(){return m.removeSource(h)}]}(o,i,r),l=jl(a,2),c=l[0],d=l[1];return e.receiveHandlerId(c),n.receiveHandlerId(c),d}},[r,e,n,i,o])}function Sl(t){return function(e){if(Array.isArray(e))return vn(e)}(t)||function(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}(t)||function(e,n){if(e){if(typeof e=="string")return vn(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return vn(e,n)}}(t)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
10
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function vn(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ji(t,e){var n=Sl(e||[]);return e==null&&typeof t!="function"&&n.push(t),S.useMemo(function(){return typeof t=="function"?t():t},n)}function Il(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,a,l=[],c=!0,d=!1;try{for(i=i.call(n);!(c=(o=i.next()).done)&&(l.push(o.value),!r||l.length!==r);c=!0);}catch(u){d=!0,a=u}finally{try{c||i.return==null||i.return()}finally{if(d)throw a}}return l}}(t,e)||function(n,r){if(n){if(typeof n=="string")return wi(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return wi(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
11
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function wi(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Si(t,e,n){var r=Il(S.useState(function(){return e(t)}),2),i=r[0],o=r[1],a=S.useCallback(function(){var l=e(t);Fo(i,l)||(o(l),n&&n())},[i,t,n]);return Le(a),[i,a]}function Cl(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,a,l=[],c=!0,d=!1;try{for(i=i.call(n);!(c=(o=i.next()).done)&&(l.push(o.value),!r||l.length!==r);c=!0);}catch(u){d=!0,a=u}finally{try{c||i.return==null||i.return()}finally{if(d)throw a}}return l}}(t,e)||function(n,r){if(n){if(typeof n=="string")return Ii(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Ii(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
12
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Ii(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Ci(t,e,n){return function(r,i,o){var a=Cl(Si(r,i,o),2),l=a[0],c=a[1];return Le(function(){var d=r.getHandlerId();if(d!=null)return r.subscribeToStateChange(c,{handlerIds:[d]})},[r,c]),l}(e,t||function(){return{}},function(){return n.reconnect()})}function Ol(t){return S.useMemo(function(){return t.hooks.dragSource()},[t])}function kl(t){return S.useMemo(function(){return t.hooks.dragPreview()},[t])}function Nl(t,e){var n=ji(t,e);P(!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)");var r,i=(r=Fe(),S.useMemo(function(){return new ul(r)},[r])),o=function(a,l){var c=Fe(),d=S.useMemo(function(){return new ml(c.getBackend())},[c]);return Le(function(){return d.dragSourceOptions=a||null,d.reconnect(),function(){return d.disconnectDragSource()}},[d,a]),Le(function(){return d.dragPreviewOptions=l||null,d.reconnect(),function(){return d.disconnectDragPreview()}},[d,l]),d}(n.options,n.previewOptions);return wl(n,i,o),[Ci(n.collect,i,o),Ol(o),kl(o)]}function Dl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function Oi(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Tl=function(){function t(e,n){(function(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")})(this,t),Oi(this,"spec",void 0),Oi(this,"monitor",void 0),this.spec=e,this.monitor=n}return Dl(t,[{key:"canDrop",value:function(){var e=this.spec,n=this.monitor;return!e.canDrop||e.canDrop(n.getItem(),n)}},{key:"hover",value:function(){var e=this.spec,n=this.monitor;e.hover&&e.hover(n.getItem(),n)}},{key:"drop",value:function(){var e=this.spec,n=this.monitor;if(e.drop)return e.drop(n.getItem(),n)}}]),t}();function El(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,a,l=[],c=!0,d=!1;try{for(i=i.call(n);!(c=(o=i.next()).done)&&(l.push(o.value),!r||l.length!==r);c=!0);}catch(u){d=!0,a=u}finally{try{c||i.return==null||i.return()}finally{if(d)throw a}}return l}}(t,e)||function(n,r){if(n){if(typeof n=="string")return ki(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return ki(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
13
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function ki(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function _l(t,e,n){var r=Fe(),i=function(a,l){var c=S.useMemo(function(){return new Tl(a,l)},[l]);return S.useEffect(function(){c.spec=a},[a]),c}(t,e),o=function(a){var l=a.accept;return S.useMemo(function(){return P(a.accept!=null,"accept must be defined"),Array.isArray(l)?l:[l]},[l])}(t);Le(function(){var a=function(u,g,f){var m=f.getRegistry(),h=m.addTarget(u,g);return[h,function(){return m.removeTarget(h)}]}(o,i,r),l=El(a,2),c=l[0],d=l[1];return e.receiveHandlerId(c),n.receiveHandlerId(c),d},[r,e,i,n,o.map(function(a){return a.toString()}).join("|")])}function Pl(t){return S.useMemo(function(){return t.hooks.dropTarget()},[t])}function Ni(t,e){var n,r=ji(t,e),i=(n=Fe(),S.useMemo(function(){return new fl(n)},[n])),o=function(a){var l=Fe(),c=S.useMemo(function(){return new yl(l.getBackend())},[l]);return Le(function(){return c.dropTargetOptions=a||null,c.reconnect(),function(){return c.disconnectDropTarget()}},[a]),c}(r.options);return _l(r,i,o),[Ci(r.collect,i,o),Pl(o)]}function Al(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,a,l=[],c=!0,d=!1;try{for(i=i.call(n);!(c=(o=i.next()).done)&&(l.push(o.value),!r||l.length!==r);c=!0);}catch(u){d=!0,a=u}finally{try{c||i.return==null||i.return()}finally{if(d)throw a}}return l}}(t,e)||function(n,r){if(n){if(typeof n=="string")return Di(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Di(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
14
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Di(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Ti(t){var e=null;return function(){return e==null&&(e=t()),e}}function Ml(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function Ei(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Rl=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),Ei(this,"entered",[]),Ei(this,"isNodeInDocument",void 0),this.isNodeInDocument=e}return Ml(t,[{key:"enter",value:function(e){var n=this,r=this.entered.length;return this.entered=function(i,o){var a=new Set,l=function(d){return a.add(d)};i.forEach(l),o.forEach(l);var c=[];return a.forEach(function(d){return c.push(d)}),c}(this.entered.filter(function(i){return n.isNodeInDocument(i)&&(!i.contains||i.contains(e))}),[e]),r===0&&this.entered.length>0}},{key:"leave",value:function(e){var n,r,i=this.entered.length;return this.entered=(n=this.entered.filter(this.isNodeInDocument),r=e,n.filter(function(o){return o!==r})),i>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),t}(),Ll=Ti(function(){return/firefox/i.test(navigator.userAgent)}),_i=Ti(function(){return!!window.safari});function Fl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function it(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Pi=function(){function t(e,n){(function(R,A){if(!(R instanceof A))throw new TypeError("Cannot call a class as a function")})(this,t),it(this,"xs",void 0),it(this,"ys",void 0),it(this,"c1s",void 0),it(this,"c2s",void 0),it(this,"c3s",void 0);for(var r=e.length,i=[],o=0;o<r;o++)i.push(o);i.sort(function(R,A){return e[R]<e[A]?-1:1});for(var a,l,c=[],d=[],u=0;u<r-1;u++)a=e[u+1]-e[u],l=n[u+1]-n[u],c.push(a),d.push(l/a);for(var g=[d[0]],f=0;f<c.length-1;f++){var m=d[f],h=d[f+1];if(m*h<=0)g.push(0);else{a=c[f];var p=c[f+1],v=a+p;g.push(3*v/((v+p)/m+(v+a)/h))}}g.push(d[d.length-1]);for(var x,b=[],j=[],O=0;O<g.length-1;O++){x=d[O];var w=g[O],k=1/c[O],N=w+g[O+1]-x-x;b.push((x-w-N)*k),j.push(N*k*k)}this.xs=e,this.ys=n,this.c1s=g,this.c2s=b,this.c3s=j}return Fl(t,[{key:"interpolate",value:function(e){var n=this.xs,r=this.ys,i=this.c1s,o=this.c2s,a=this.c3s,l=n.length-1;if(e===n[l])return r[l];for(var c,d=0,u=a.length-1;d<=u;){var g=n[c=Math.floor(.5*(d+u))];if(g<e)d=c+1;else{if(!(g>e))return r[c];u=c-1}}var f=e-n[l=Math.max(0,u)],m=f*f;return r[l]+i[l]*f+o[l]*m+a[l]*f*m}}]),t}();function Ai(t){var e=t.nodeType===1?t:t.parentElement;if(!e)return null;var n=e.getBoundingClientRect(),r=n.top;return{x:n.left,y:r}}function Ot(t){return{x:t.clientX,y:t.clientY}}function zl(t,e,n,r,i){var o,a,l,c=(o=e).nodeName==="IMG"&&(Ll()||!((a=document.documentElement)!==null&&a!==void 0&&a.contains(o))),d=Ai(c?t:e),u={x:n.x-d.x,y:n.y-d.y},g=t.offsetWidth,f=t.offsetHeight,m=r.anchorX,h=r.anchorY,p=function(w,k,N,R){var A=w?k.width:N,H=w?k.height:R;return _i()&&w&&(H/=window.devicePixelRatio,A/=window.devicePixelRatio),{dragPreviewWidth:A,dragPreviewHeight:H}}(c,e,g,f),v=p.dragPreviewWidth,x=p.dragPreviewHeight,b=i.offsetX,j=i.offsetY,O=j===0||j;return{x:b===0||b?b:new Pi([0,.5,1],[u.x,u.x/g*v,u.x+v-g]).interpolate(m),y:O?j:(l=new Pi([0,.5,1],[u.y,u.y/f*x,u.y+x-f]).interpolate(h),_i()&&c&&(l+=(window.devicePixelRatio-1)*x),l)}}var Mi="__NATIVE_FILE__",Ri="__NATIVE_URL__",Li="__NATIVE_TEXT__",Fi="__NATIVE_HTML__";const zi=Object.freeze(Object.defineProperty({__proto__:null,FILE:Mi,HTML:Fi,TEXT:Li,URL:Ri},Symbol.toStringTag,{value:"Module"}));function yn(t,e,n){var r=e.reduce(function(i,o){return i||t.getData(o)},"");return r??n}var st;function kt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var xn=(kt(st={},Mi,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),kt(st,Fi,{exposeProperties:{html:function(t,e){return yn(t,e,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),kt(st,Ri,{exposeProperties:{urls:function(t,e){return yn(t,e,"").split(`
|
|
15
|
+
`)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),kt(st,Li,{exposeProperties:{text:function(t,e){return yn(t,e,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),st);function Hl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function Hi(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Ul=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),Hi(this,"item",void 0),Hi(this,"config",void 0),this.config=e,this.item={},this.initializeExposedProperties()}return Hl(t,[{key:"initializeExposedProperties",value:function(){var e=this;Object.keys(this.config.exposeProperties).forEach(function(n){Object.defineProperty(e.item,n,{configurable:!0,enumerable:!0,get:function(){return console.warn(`Browser doesn't allow reading "`.concat(n,'" until the drop event.')),null}})})}},{key:"loadDataTransfer",value:function(e){var n=this;if(e){var r={};Object.keys(this.config.exposeProperties).forEach(function(i){r[i]={value:n.config.exposeProperties[i](e,n.config.matchesTypes),configurable:!0,enumerable:!0}}),Object.defineProperties(this.item,r)}}},{key:"canDrag",value:function(){return!0}},{key:"beginDrag",value:function(){return this.item}},{key:"isDragging",value:function(e,n){return n===e.getSourceId()}},{key:"endDrag",value:function(){}}]),t}();function bn(t){if(!t)return null;var e=Array.prototype.slice.call(t.types||[]);return Object.keys(xn).filter(function(n){return xn[n].matchesTypes.some(function(r){return e.indexOf(r)>-1})})[0]||null}function ql(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function jn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Vl=function(){function t(e,n){(function(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")})(this,t),jn(this,"ownerDocument",null),jn(this,"globalContext",void 0),jn(this,"optionsArgs",void 0),this.globalContext=e,this.optionsArgs=n}return ql(t,[{key:"window",get:function(){return this.globalContext?this.globalContext:typeof window<"u"?window:void 0}},{key:"document",get:function(){var e;return(e=this.globalContext)!==null&&e!==void 0&&e.document?this.globalContext.document:this.window?this.window.document:void 0}},{key:"rootElement",get:function(){var e;return((e=this.optionsArgs)===null||e===void 0?void 0:e.rootElement)||this.window}}]),t}();function Ui(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function qi(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ui(Object(n),!0).forEach(function(r){L(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ui(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Bl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function L(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var wn,Wl=function(){function t(e,n,r){var i=this;(function(o,a){if(!(o instanceof a))throw new TypeError("Cannot call a class as a function")})(this,t),L(this,"options",void 0),L(this,"actions",void 0),L(this,"monitor",void 0),L(this,"registry",void 0),L(this,"enterLeaveCounter",void 0),L(this,"sourcePreviewNodes",new Map),L(this,"sourcePreviewNodeOptions",new Map),L(this,"sourceNodes",new Map),L(this,"sourceNodeOptions",new Map),L(this,"dragStartSourceIds",null),L(this,"dropTargetIds",[]),L(this,"dragEnterTargetIds",[]),L(this,"currentNativeSource",null),L(this,"currentNativeHandle",null),L(this,"currentDragSourceNode",null),L(this,"altKeyPressed",!1),L(this,"mouseMoveTimeoutTimer",null),L(this,"asyncEndDragFrameId",null),L(this,"dragOverTargetIds",null),L(this,"lastClientOffset",null),L(this,"hoverRafId",null),L(this,"getSourceClientOffset",function(o){var a=i.sourceNodes.get(o);return a&&Ai(a)||null}),L(this,"endDragNativeItem",function(){i.isDraggingNativeItem()&&(i.actions.endDrag(),i.currentNativeHandle&&i.registry.removeSource(i.currentNativeHandle),i.currentNativeHandle=null,i.currentNativeSource=null)}),L(this,"isNodeInDocument",function(o){return!!(o&&i.document&&i.document.body&&i.document.body.contains(o))}),L(this,"endDragIfSourceWasRemovedFromDOM",function(){var o=i.currentDragSourceNode;o==null||i.isNodeInDocument(o)||i.clearCurrentDragSourceNode()&&i.monitor.isDragging()&&i.actions.endDrag()}),L(this,"handleTopDragStartCapture",function(){i.clearCurrentDragSourceNode(),i.dragStartSourceIds=[]}),L(this,"handleTopDragStart",function(o){if(!o.defaultPrevented){var a=i.dragStartSourceIds;i.dragStartSourceIds=null;var l=Ot(o);i.monitor.isDragging()&&i.actions.endDrag(),i.actions.beginDrag(a||[],{publishSource:!1,getSourceClientOffset:i.getSourceClientOffset,clientOffset:l});var c=o.dataTransfer,d=bn(c);if(i.monitor.isDragging()){if(c&&typeof c.setDragImage=="function"){var u=i.monitor.getSourceId(),g=i.sourceNodes.get(u),f=i.sourcePreviewNodes.get(u)||g;if(f){var m=i.getCurrentSourcePreviewNodeOptions(),h=zl(g,f,l,{anchorX:m.anchorX,anchorY:m.anchorY},{offsetX:m.offsetX,offsetY:m.offsetY});c.setDragImage(f,h.x,h.y)}}try{c==null||c.setData("application/json",{})}catch{}i.setCurrentDragSourceNode(o.target),i.getCurrentSourcePreviewNodeOptions().captureDraggingState?i.actions.publishDragSource():setTimeout(function(){return i.actions.publishDragSource()},0)}else if(d)i.beginDragNativeItem(d);else{if(c&&!c.types&&(o.target&&!o.target.hasAttribute||!o.target.hasAttribute("draggable")))return;o.preventDefault()}}}),L(this,"handleTopDragEndCapture",function(){i.clearCurrentDragSourceNode()&&i.monitor.isDragging()&&i.actions.endDrag()}),L(this,"handleTopDragEnterCapture",function(o){if(i.dragEnterTargetIds=[],i.enterLeaveCounter.enter(o.target)&&!i.monitor.isDragging()){var a=o.dataTransfer,l=bn(a);l&&i.beginDragNativeItem(l,a)}}),L(this,"handleTopDragEnter",function(o){var a=i.dragEnterTargetIds;i.dragEnterTargetIds=[],i.monitor.isDragging()&&(i.altKeyPressed=o.altKey,a.length>0&&i.actions.hover(a,{clientOffset:Ot(o)}),a.some(function(l){return i.monitor.canDropOnTarget(l)})&&(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect=i.getCurrentDropEffect())))}),L(this,"handleTopDragOverCapture",function(){i.dragOverTargetIds=[]}),L(this,"handleTopDragOver",function(o){var a=i.dragOverTargetIds;if(i.dragOverTargetIds=[],!i.monitor.isDragging())return o.preventDefault(),void(o.dataTransfer&&(o.dataTransfer.dropEffect="none"));i.altKeyPressed=o.altKey,i.lastClientOffset=Ot(o),i.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(i.hoverRafId=requestAnimationFrame(function(){i.monitor.isDragging()&&i.actions.hover(a||[],{clientOffset:i.lastClientOffset}),i.hoverRafId=null})),(a||[]).some(function(l){return i.monitor.canDropOnTarget(l)})?(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect=i.getCurrentDropEffect())):i.isDraggingNativeItem()?o.preventDefault():(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect="none"))}),L(this,"handleTopDragLeaveCapture",function(o){i.isDraggingNativeItem()&&o.preventDefault(),i.enterLeaveCounter.leave(o.target)&&i.isDraggingNativeItem()&&setTimeout(function(){return i.endDragNativeItem()},0)}),L(this,"handleTopDropCapture",function(o){var a;i.dropTargetIds=[],i.isDraggingNativeItem()?(o.preventDefault(),(a=i.currentNativeSource)===null||a===void 0||a.loadDataTransfer(o.dataTransfer)):bn(o.dataTransfer)&&o.preventDefault(),i.enterLeaveCounter.reset()}),L(this,"handleTopDrop",function(o){var a=i.dropTargetIds;i.dropTargetIds=[],i.actions.hover(a,{clientOffset:Ot(o)}),i.actions.drop({dropEffect:i.getCurrentDropEffect()}),i.isDraggingNativeItem()?i.endDragNativeItem():i.monitor.isDragging()&&i.actions.endDrag()}),L(this,"handleSelectStart",function(o){var a=o.target;typeof a.dragDrop=="function"&&(a.tagName==="INPUT"||a.tagName==="SELECT"||a.tagName==="TEXTAREA"||a.isContentEditable||(o.preventDefault(),a.dragDrop()))}),this.options=new Vl(n,r),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new Rl(this.isNodeInDocument)}return Bl(t,[{key:"profile",value:function(){var e,n;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((e=this.dragStartSourceIds)===null||e===void 0?void 0:e.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((n=this.dragOverTargetIds)===null||n===void 0?void 0:n.length)||0}}},{key:"window",get:function(){return this.options.window}},{key:"document",get:function(){return this.options.document}},{key:"rootElement",get:function(){return this.options.rootElement}},{key:"setup",value:function(){var e=this.rootElement;if(e!==void 0){if(e.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}},{key:"teardown",value:function(){var e,n=this.rootElement;n!==void 0&&(n.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&((e=this.window)===null||e===void 0||e.cancelAnimationFrame(this.asyncEndDragFrameId)))}},{key:"connectDragPreview",value:function(e,n,r){var i=this;return this.sourcePreviewNodeOptions.set(e,r),this.sourcePreviewNodes.set(e,n),function(){i.sourcePreviewNodes.delete(e),i.sourcePreviewNodeOptions.delete(e)}}},{key:"connectDragSource",value:function(e,n,r){var i=this;this.sourceNodes.set(e,n),this.sourceNodeOptions.set(e,r);var o=function(l){return i.handleDragStart(l,e)},a=function(l){return i.handleSelectStart(l)};return n.setAttribute("draggable","true"),n.addEventListener("dragstart",o),n.addEventListener("selectstart",a),function(){i.sourceNodes.delete(e),i.sourceNodeOptions.delete(e),n.removeEventListener("dragstart",o),n.removeEventListener("selectstart",a),n.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(e,n){var r=this,i=function(l){return r.handleDragEnter(l,e)},o=function(l){return r.handleDragOver(l,e)},a=function(l){return r.handleDrop(l,e)};return n.addEventListener("dragenter",i),n.addEventListener("dragover",o),n.addEventListener("drop",a),function(){n.removeEventListener("dragenter",i),n.removeEventListener("dragover",o),n.removeEventListener("drop",a)}}},{key:"addEventListeners",value:function(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))}},{key:"removeEventListeners",value:function(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))}},{key:"getCurrentSourceNodeOptions",value:function(){var e=this.monitor.getSourceId(),n=this.sourceNodeOptions.get(e);return qi({dropEffect:this.altKeyPressed?"copy":"move"},n||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var e=this.monitor.getSourceId();return qi({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}},{key:"isDraggingNativeItem",value:function(){var e=this.monitor.getItemType();return Object.keys(zi).some(function(n){return zi[n]===e})}},{key:"beginDragNativeItem",value:function(e,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(r,i){var o=new Ul(xn[r]);return o.loadDataTransfer(i),o}(e,n),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(e){var n=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout(function(){var r;return(r=n.rootElement)===null||r===void 0?void 0:r.addEventListener("mousemove",n.endDragIfSourceWasRemovedFromDOM,!0)},1e3)}},{key:"clearCurrentDragSourceNode",value:function(){if(this.currentDragSourceNode){var e;return this.currentDragSourceNode=null,this.rootElement&&((e=this.window)===null||e===void 0||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)),this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:"handleDragStart",value:function(e,n){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(n))}},{key:"handleDragEnter",value:function(e,n){this.dragEnterTargetIds.unshift(n)}},{key:"handleDragOver",value:function(e,n){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(n)}},{key:"handleDrop",value:function(e,n){this.dropTargetIds.unshift(n)}}]),t}(),Gl=function(t,e,n){return new Wl(t,e,n)};function Kl(t){const e=ve(),n=e.selectedIds,[r,i,o]=Nl(()=>({canDrag:()=>t.isDraggable,type:"NODE",item:()=>{const a=e.isSelected(t.id)?Array.from(n):[t.id];return e.dispatch(Ge.dragStart(t.id,a)),{id:t.id,dragIds:a}},end:()=>{e.hideCursor(),e.dispatch(Ge.dragEnd())}}),[n,t]);return S.useEffect(()=>{o((wn||((wn=new Image).src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),wn))},[o]),i}function Nt(t,e){return{parentId:t||null,index:e}}function Ye(t,e){return{type:"line",index:t,level:e}}function Sn(t,e){var n;let r=t;for(;r.parent&&r.level>e;)r=r.parent;return{parentId:((n=r.parent)===null||n===void 0?void 0:n.id)||null,index:wr(r)+1}}function Vi(t){var e;const n=function(g,f){const m=g.getBoundingClientRect(),h=f.x-Math.round(m.x),p=f.y-Math.round(m.y),v=m.height,x=p<v/2,b=!x,j=v/4,O=p>j&&p<v-j;return{x:h,inTopHalf:x,inBottomHalf:b,inMiddle:O,atTop:!O&&x,atBottom:!O&&b}}(t.element,t.offset),r=t.indent,i=Math.round(Math.max(0,n.x-r)/r),{node:o,nextNode:a,prevNode:l}=t,[c,d]=function(g,f,m,h){return g?g.isInternal?h.atTop?[f,g]:h.inMiddle?[g,g]:[g,m]:h.inTopHalf?[f,g]:[g,m]:[f,null]}(o,l,a,n);if(o&&o.isInternal&&n.inMiddle)return{drop:Nt(o.id,null),cursor:(u=o.id,{type:"highlight",id:u})};var u;if(!c)return{drop:Nt((e=d==null?void 0:d.parent)===null||e===void 0?void 0:e.id,0),cursor:Ye(0,0)};if(yr(c)){const g=bt(i,(d==null?void 0:d.level)||0,c.level);return{drop:Sn(c,g),cursor:Ye(c.rowIndex+1,g)}}if(xr(c)){const g=bt(i,(d==null?void 0:d.level)||0,c.level);return{drop:Sn(c,g),cursor:Ye(c.rowIndex+1,g)}}if(br(c)){const g=bt(i,0,c.level+1);return g>c.level?{drop:Nt(c.id,0),cursor:Ye(c.rowIndex+1,g)}:{drop:Sn(c,g),cursor:Ye(c.rowIndex+1,g)}}return{drop:Nt(c==null?void 0:c.id,0),cursor:Ye(c.rowIndex+1,c.level+1)}}const Yl=Xe.memo(function({index:t,style:e}){vr(),function(){if(S.useContext(pr)===null)throw new Error("Provide a NodesContext")}();const n=ve(),r=function(h){const p=ve(),v=p.at(h);if(!v)throw new Error(`Could not find node for index: ${h}`);return S.useMemo(()=>{const x=v.clone();return p.visibleNodes[h]=x,x},[...Object.values(v.state),v])}(t),i=S.useRef(null),o=Kl(r),a=function(h,p){const v=ve(),[x,b]=Ni(()=>({accept:"NODE",canDrop:()=>v.canDrop(),hover:(j,O)=>{const w=O.getClientOffset();if(!h.current||!w)return;const{cursor:k,drop:N}=Vi({element:h.current,offset:w,indent:v.indent,node:p,prevNode:p.prev,nextNode:p.next});N&&v.dispatch(Ge.hovering(N.parentId,N.index)),O.canDrop()?k&&v.showCursor(k):v.hideCursor()},drop:(j,O)=>{if(!O.canDrop())return null;let{parentId:w,index:k,dragIds:N}=v.state.dnd;kr(v.props.onMove,{dragIds:N,parentId:w===tt?null:w,index:k===null?0:k,dragNodes:v.dragNodes,parentNode:v.get(w)}),v.open(w)}}),[p,h.current,v.props]);return b}(i,r),l=S.useCallback(h=>{i.current=h,a(h)},[a]),c=n.indent*r.level,d=S.useMemo(()=>({paddingLeft:c}),[c]),u=S.useMemo(()=>{var h,p;return Object.assign(Object.assign({},e),{top:parseFloat(e.top)+((p=(h=n.props.padding)!==null&&h!==void 0?h:n.props.paddingTop)!==null&&p!==void 0?p:0)})},[e,n.props.padding,n.props.paddingTop]),g={role:"treeitem","aria-level":r.level+1,"aria-selected":r.isSelected,"aria-expanded":r.isOpen,style:u,tabIndex:-1,className:n.props.rowClassName};S.useEffect(()=>{var h;!r.isEditing&&r.isFocused&&((h=i.current)===null||h===void 0||h.focus({preventScroll:!0}))},[r.isEditing,r.isFocused,i.current]);const f=n.renderNode,m=n.renderRow;return s.jsx(m,{node:r,innerRef:l,attrs:g,children:s.jsx(f,{node:r,tree:n,style:d,dragHandle:o})})});let In="",Bi=null;function Wi(){vr();const t=ve();return s.jsx("div",{role:"tree",style:{height:t.height,width:t.width,minHeight:0,minWidth:0},onContextMenu:t.props.onContextMenu,onClick:t.props.onClick,tabIndex:0,onFocus:e=>{e.currentTarget.contains(e.relatedTarget)||t.onFocus()},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||t.onBlur()},onKeyDown:e=>{var n;if(t.isEditing)return;if(e.key==="Backspace"){if(!t.props.onDelete)return;const i=Array.from(t.selectedIds);if(i.length>1){let o=t.mostRecentNode;for(;o&&o.isSelected;)o=o.nextSibling;o||(o=t.lastNode),t.focus(o,{scroll:!1}),t.delete(Array.from(i))}else{const o=t.focusedNode;if(o){const a=o.nextSibling,l=o.parent;t.focus(a||l,{scroll:!1}),t.delete(o)}}return}if(e.key==="Tab"&&!e.shiftKey)return e.preventDefault(),void Sr(e.currentTarget);if(e.key==="Tab"&&e.shiftKey)return e.preventDefault(),void Ir(e.currentTarget);if(e.key==="ArrowDown"){e.preventDefault();const i=t.nextNode;if(e.metaKey)return t.select(t.focusedNode),void t.activate(t.focusedNode);if(!e.shiftKey||t.props.disableMultiSelection)return void t.focus(i);{if(!i)return;const o=t.focusedNode;return void(o?o.isSelected?t.selectContiguous(i):t.selectMulti(i):t.focus(t.firstNode))}}if(e.key==="ArrowUp"){e.preventDefault();const i=t.prevNode;if(!e.shiftKey||t.props.disableMultiSelection)return void t.focus(i);{if(!i)return;const o=t.focusedNode;return void(o?o.isSelected?t.selectContiguous(i):t.selectMulti(i):t.focus(t.lastNode))}}if(e.key==="ArrowRight"){const i=t.focusedNode;return i?void(i.isInternal&&i.isOpen?t.focus(t.nextNode):i.isInternal&&t.open(i.id)):void 0}if(e.key==="ArrowLeft"){const i=t.focusedNode;return!i||i.isRoot?void 0:void(i.isInternal&&i.isOpen?t.close(i.id):((n=i.parent)===null||n===void 0?void 0:n.isRoot)||t.focus(i.parent))}if(e.key==="a"&&e.metaKey&&!t.props.disableMultiSelection)return e.preventDefault(),void t.selectAll();if(e.key==="a"&&!e.metaKey&&t.props.onCreate)return void t.createLeaf();if(e.key==="A"&&!e.metaKey)return t.props.onCreate?void t.createInternal():void 0;if(e.key==="Home")return e.preventDefault(),void t.focus(t.firstNode);if(e.key==="End")return e.preventDefault(),void t.focus(t.lastNode);if(e.key==="Enter"){const i=t.focusedNode;return!i||!i.isEditable||!t.props.onRename?void 0:void setTimeout(()=>{i&&t.edit(i)})}if(e.key===" "){e.preventDefault();const i=t.focusedNode;return i?void(i.isLeaf?(i.select(),i.activate()):i.toggle()):void 0}if(e.key==="*"){const i=t.focusedNode;return i?void t.openSiblings(i):void 0}if(e.key==="PageUp")return e.preventDefault(),void t.pageUp();e.key==="PageDown"&&(e.preventDefault(),t.pageDown()),clearTimeout(Bi),In+=e.key,Bi=setTimeout(()=>{In=""},600);const r=t.visibleNodes.find(i=>{const o=i.data.name;return typeof o=="string"&&o.toLowerCase().startsWith(In)});r&&t.focus(r.id)},children:s.jsx(wa,{className:t.props.className,outerRef:t.listEl,itemCount:t.visibleNodes.length,height:t.height,width:t.width,itemSize:t.rowHeight,overscanCount:t.overscanCount,itemKey:e=>{var n;return((n=t.visibleNodes[e])===null||n===void 0?void 0:n.id)||e},outerElementType:Ca,innerElementType:Na,onScroll:t.props.onScroll,onItemsRendered:t.onItemsRendered.bind(t),ref:t.list,children:Yl})})}function Gi(t){return t.isFiltered?function(e,n){const r={},i=[];function o(l){if(!l.isRoot&&n(l)){r[l.id]=!0;let c=l.parent;for(;c;)r[c.id]=!0,c=c.parent}if(l.children)for(let c of l.children)o(c)}function a(l){var c;l.level>=0&&r[l.id]&&i.push(l),l.isOpen&&((c=l.children)===null||c===void 0||c.forEach(a))}return o(e),a(e),i.forEach(Ki),i}(t.root,t.isMatch.bind(t)):function(e){const n=[];function r(i){var o;i.level>=0&&n.push(i),i.isOpen&&((o=i.children)===null||o===void 0||o.forEach(r))}return r(e),n.forEach(Ki),n}(t.root)}function Ki(t,e){t.rowIndex=e}const Yi=t=>t.reduce((e,n,r)=>(e[n.id]=r,e),{});var Cn=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(d){try{c(r.next(d))}catch(u){o(u)}}function l(d){try{c(r.throw(d))}catch(u){o(u)}}function c(d){var u;d.done?i(d.value):(u=d.value,u instanceof n?u:new n(function(g){g(u)})).then(a,l)}c((r=r.apply(t,e||[])).next())})};const{safeRun:ie,identify:_e,identifyNull:Ce}=Zo;class ct{constructor(e,n,r,i){this.store=e,this.props=n,this.list=r,this.listEl=i,this.visibleStartIndex=0,this.visibleStopIndex=0,this.root=Er(this),this.visibleNodes=Gi(this),this.idToIndex=Yi(this.visibleNodes)}update(e){this.props=e,this.root=Er(this),this.visibleNodes=Gi(this),this.idToIndex=Yi(this.visibleNodes)}dispatch(e){return this.store.dispatch(e)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){var e;return(e=this.props.width)!==null&&e!==void 0?e:300}get height(){var e;return(e=this.props.height)!==null&&e!==void 0?e:500}get indent(){var e;return(e=this.props.indent)!==null&&e!==void 0?e:24}get rowHeight(){var e;return(e=this.props.rowHeight)!==null&&e!==void 0?e:24}get overscanCount(){var e;return(e=this.props.overscanCount)!==null&&e!==void 0?e:1}get searchTerm(){return(this.props.searchTerm||"").trim()}get matchFn(){var e;const n=(e=this.props.searchMatch)!==null&&e!==void 0?e:(r,i)=>JSON.stringify(Object.values(r.data)).toLocaleLowerCase().includes(i.toLocaleLowerCase());return r=>n(r,this.searchTerm)}accessChildren(e){var n;return(n=et(e,this.props.childrenAccessor||"children"))!==null&&n!==void 0?n:null}accessId(e){const n=et(e,this.props.idAccessor||"id");if(!n)throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");return n}get firstNode(){var e;return(e=this.visibleNodes[0])!==null&&e!==void 0?e:null}get lastNode(){var e;return(e=this.visibleNodes[this.visibleNodes.length-1])!==null&&e!==void 0?e:null}get focusedNode(){var e;return(e=this.get(this.state.nodes.focus.id))!==null&&e!==void 0?e:null}get mostRecentNode(){var e;return(e=this.get(this.state.nodes.selection.mostRecent))!==null&&e!==void 0?e:null}get nextNode(){const e=this.indexOf(this.focusedNode);return e===null?null:this.at(e+1)}get prevNode(){const 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,n){var r;if(e===null||n===null)return[];const i=(r=this.indexOf(e))!==null&&r!==void 0?r:0,o=this.indexOf(n);if(o===null)return[];const a=Math.min(i,o),l=Math.max(i,o);return this.visibleNodes.slice(a,l+1)}indexOf(e){const n=Or(e);return n?this.idToIndex[n]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:"internal"})}createLeaf(){return this.create({type:"leaf"})}create(){return Cn(this,arguments,void 0,function*(e={}){var n,r;const i=e.parentId===void 0?Tr(this):e.parentId,o=(n=e.index)!==null&&n!==void 0?n:Dr(this),a=(r=e.type)!==null&&r!==void 0?r:"leaf",l=yield ie(this.props.onCreate,{type:a,parentId:i,index:o,parentNode:this.get(i)});l&&(this.focus(l),setTimeout(()=>{this.edit(l).then(()=>{this.select(l),this.activate(l)})}))})}delete(e){return Cn(this,void 0,void 0,function*(){if(!e)return;const n=(Array.isArray(e)?e:[e]).map(_e),r=n.map(i=>this.get(i)).filter(i=>!!i);yield ie(this.props.onDelete,{nodes:r,ids:n})})}edit(e){const n=_e(e);return this.resolveEdit({cancelled:!0}),this.scrollTo(n),this.dispatch(Wt(n)),new Promise(r=>{ct.editPromise=r})}submit(e,n){return Cn(this,void 0,void 0,function*(){if(!e)return;const r=_e(e);yield ie(this.props.onRename,{id:r,name:n,node:this.get(r)}),this.dispatch(Wt(null)),this.resolveEdit({cancelled:!1,value:n}),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(Wt(null)),this.resolveEdit({cancelled:!0}),setTimeout(()=>this.onFocus())}activate(e){const n=this.get(Ce(e));n&&ie(this.props.onActivate,n)}resolveEdit(e){const n=ct.editPromise;n&&n(e),ct.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let e=[];for(let n of Array.from(this.selectedIds)){const r=this.get(n);r&&e.push(r)}return e}focus(e,n={}){e&&(this.props.selectionFollowsFocus?this.select(e):(this.dispatch(Be(_e(e))),n.scroll!==!1&&this.scrollTo(e),this.focusedNode&&ie(this.props.onFocus,this.focusedNode)))}pageUp(){var e,n;const r=this.visibleStartIndex,i=this.visibleStopIndex-r;let o=(n=(e=this.focusedNode)===null||e===void 0?void 0:e.rowIndex)!==null&&n!==void 0?n:0;o=o>r?r:Math.max(r-i,0),this.focus(this.at(o))}pageDown(){var e,n;const r=this.visibleStartIndex,i=this.visibleStopIndex,o=i-r;let a=(n=(e=this.focusedNode)===null||e===void 0?void 0:e.rowIndex)!==null&&n!==void 0?n:0;a=a<i?i:Math.min(a+o,this.visibleNodes.length-1),this.focus(this.at(a))}select(e,n={}){if(!e)return;const r=n.focus!==!1,i=_e(e);r&&this.dispatch(Be(i)),this.dispatch(la(i)),this.dispatch(Mr(i)),this.dispatch(Kt(i)),this.scrollTo(i,n.align),this.focusedNode&&r&&ie(this.props.onFocus,this.focusedNode),ie(this.props.onSelect,this.selectedNodes)}deselect(e){if(!e)return;const n=_e(e);this.dispatch(Ar(n)),ie(this.props.onSelect,this.selectedNodes)}selectMulti(e){const n=this.get(Ce(e));n&&(this.dispatch(Be(n.id)),this.dispatch(Pr(n.id)),this.dispatch(Mr(n.id)),this.dispatch(Kt(n.id)),this.scrollTo(n),this.focusedNode&&ie(this.props.onFocus,this.focusedNode),ie(this.props.onSelect,this.selectedNodes))}selectContiguous(e){if(!e)return;const n=_e(e),{anchor:r,mostRecent:i}=this.state.nodes.selection;this.dispatch(Be(n)),this.dispatch(Ar(this.nodesBetween(r,i))),this.dispatch(Pr(this.nodesBetween(r,Ce(n)))),this.dispatch(Kt(n)),this.scrollTo(n),this.focusedNode&&ie(this.props.onFocus,this.focusedNode),ie(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null}),ie(this.props.onSelect,this.selectedNodes)}selectAll(){var e;this.setSelection({ids:Object.keys(this.idToIndex),anchor:this.firstNode,mostRecent:this.lastNode}),this.dispatch(Be((e=this.lastNode)===null||e===void 0?void 0:e.id)),this.focusedNode&&ie(this.props.onFocus,this.focusedNode),ie(this.props.onSelect,this.selectedNodes)}setSelection(e){var n;const r=new Set((n=e.ids)===null||n===void 0?void 0:n.map(_e)),i=Ce(e.anchor),o=Ce(e.mostRecent);this.dispatch(ca({ids:r,anchor:i,mostRecent:o})),ie(this.props.onSelect,this.selectedNodes)}get cursorParentId(){const{cursor:e}=this.state.dnd;return e.type==="highlight"?e.id: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(){var e;if(this.isFiltered)return!1;const n=(e=this.get(this.state.dnd.parentId))!==null&&e!==void 0?e:this.root,r=this.dragNodes,i=this.props.disableDrop;for(const o of r)if(!o||!n||o.isInternal&&jr(n,o))return!1;return typeof i=="function"?!i({parentNode:n,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof i=="string"?!n.data[i]:typeof i!="boolean"||!i}hideCursor(){this.dispatch(Ge.cursor({type:"none"}))}showCursor(e){this.dispatch(Ge.cursor(e))}open(e){const n=Ce(e);n&&(this.isOpen(n)||(this.dispatch(Gt.open(n,this.isFiltered)),ie(this.props.onToggle,n)))}close(e){const n=Ce(e);n&&this.isOpen(n)&&(this.dispatch(Gt.close(n,this.isFiltered)),ie(this.props.onToggle,n))}toggle(e){const n=Ce(e);if(n)return this.isOpen(n)?this.close(n):this.open(n)}openParents(e){const n=Ce(e);if(!n)return;const r=Bt(this.root,n);let i=r==null?void 0:r.parent;for(;i;)this.open(i.id),i=i.parent}openSiblings(e){const n=e.parent;if(n){if(n.children){const r=e.isOpen;for(let i of n.children)i.isInternal&&(r?this.close(i.id):this.open(i.id));this.scrollTo(this.focusedNode)}}else this.toggle(e.id)}openAll(){jt(this.root,e=>{e.isInternal&&e.open()})}closeAll(){jt(this.root,e=>{e.isInternal&&e.close()})}scrollTo(e,n="smart"){if(!e)return;const r=_e(e);return this.openParents(r),Nr(()=>r in this.idToIndex).then(()=>{var i;const o=this.idToIndex[r];o!==void 0&&((i=this.list.current)===null||i===void 0||i.scrollToItem(o,n))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){var e;return!!(!((e=this.props.searchTerm)===null||e===void 0)&&e.trim())}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)}isOpen(e){var n,r,i;if(!e)return!1;if(e===tt)return!0;const o=(n=this.props.openByDefault)===null||n===void 0||n;return this.isFiltered?(r=this.state.nodes.open.filtered[e])===null||r===void 0||r:(i=this.state.nodes.open.unfiltered[e])!==null&&i!==void 0?i:o}isEditable(e){return!et(e,this.props.disableEdit||(()=>!1))}isDraggable(e){return!et(e,this.props.disableDrag||(()=>!1))}isDragging(e){const n=Ce(e);return!!n&&this.state.nodes.drag.id===n}isFocused(e){return this.hasFocus&&this.state.nodes.focus.id===e}isMatch(e){return this.matchFn(e)}willReceiveDrop(e){const n=Ce(e);if(!n)return!1;const{destinationParentId:r,destinationIndex:i}=this.state.nodes.drag;return n===r&&i===null}onFocus(){const e=this.focusedNode||this.firstNode;e&&this.dispatch(Be(e.id))}onBlur(){this.dispatch({type:"TREE_BLUR"})}onItemsRendered(e){this.visibleStartIndex=e.visibleStartIndex,this.visibleStopIndex=e.visibleStopIndex}get renderContainer(){return this.props.renderContainer||Wi}get renderRow(){return this.props.renderRow||ia}get renderNode(){return this.props.children||sa}get renderDragPreview(){return this.props.renderDragPreview||Rr}get renderCursor(){return this.props.renderCursor||ra}}function he(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var $i=typeof Symbol=="function"&&Symbol.observable||"@@observable",On=()=>Math.random().toString(36).substring(7).split("").join("."),Dt={INIT:`@@redux/INIT${On()}`,REPLACE:`@@redux/REPLACE${On()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${On()}`};function Xi(t,e,n){if(typeof t!="function")throw new Error(he(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(he(0));if(typeof e=="function"&&n===void 0&&(n=e,e=void 0),n!==void 0){if(typeof n!="function")throw new Error(he(1));return n(Xi)(t,e)}let r=t,i=e,o=new Map,a=o,l=0,c=!1;function d(){a===o&&(a=new Map,o.forEach((m,h)=>{a.set(h,m)}))}function u(){if(c)throw new Error(he(3));return i}function g(m){if(typeof m!="function")throw new Error(he(4));if(c)throw new Error(he(5));let h=!0;d();const p=l++;return a.set(p,m),function(){if(h){if(c)throw new Error(he(6));h=!1,d(),a.delete(p),o=null}}}function f(m){if(!function(h){if(typeof h!="object"||h===null)return!1;let p=h;for(;Object.getPrototypeOf(p)!==null;)p=Object.getPrototypeOf(p);return Object.getPrototypeOf(h)===p||Object.getPrototypeOf(h)===null}(m))throw new Error(he(7));if(m.type===void 0)throw new Error(he(8));if(typeof m.type!="string")throw new Error(he(17));if(c)throw new Error(he(9));try{c=!0,i=r(i,m)}finally{c=!1}return(o=a).forEach(h=>{h()}),m}return f({type:Dt.INIT}),{dispatch:f,subscribe:g,getState:u,replaceReducer:function(m){if(typeof m!="function")throw new Error(he(10));r=m,f({type:Dt.REPLACE})},[$i]:function(){const m=g;return{subscribe(h){if(typeof h!="object"||h===null)throw new Error(he(11));function p(){const v=h;v.next&&v.next(u())}return p(),{unsubscribe:m(p)}},[$i](){return this}}}}}function Qi(t){const e=Object.keys(t),n={};for(let o=0;o<e.length;o++){const a=e[o];typeof t[a]=="function"&&(n[a]=t[a])}const r=Object.keys(n);let i;try{(function(o){Object.keys(o).forEach(a=>{const l=o[a];if(l(void 0,{type:Dt.INIT})===void 0)throw new Error(he(12));if(l(void 0,{type:Dt.PROBE_UNKNOWN_ACTION()})===void 0)throw new Error(he(13))})})(n)}catch(o){i=o}return function(o={},a){if(i)throw i;let l=!1;const c={};for(let d=0;d<r.length;d++){const u=r[d],g=n[u],f=o[u],m=g(f,a);if(m===void 0)throw a&&a.type,new Error(he(14));c[u]=m,l=l||m!==f}return l=l||r.length!==Object.keys(o).length,l?c:o}}const $l=Qi({nodes:Qi({focus:function(t={id:null,treeFocused:!1},e){return e.type==="FOCUS"?Object.assign(Object.assign({},t),{id:e.id,treeFocused:!0}):e.type==="TREE_BLUR"?Object.assign(Object.assign({},t),{treeFocused:!1}):t},edit:function(t={id:null},e){return e.type==="EDIT"?Object.assign(Object.assign({},t),{id:e.id}):t},open:function(t={filtered:{},unfiltered:{}},e){return e.type.startsWith("VISIBILITY")?e.filtered?Object.assign(Object.assign({},t),{filtered:_r(t.filtered,e)}):Object.assign(Object.assign({},t),{unfiltered:_r(t.unfiltered,e)}):t},selection:function(t=We().nodes.selection,e){const n=t.ids;switch(e.type){case"SELECTION_CLEAR":return Object.assign(Object.assign({},t),{ids:new Set});case"SELECTION_ONLY":return Object.assign(Object.assign({},t),{ids:new Set([e.id])});case"SELECTION_ADD":return e.ids.length===0?t:(e.ids.forEach(r=>n.add(r)),Object.assign(Object.assign({},t),{ids:new Set(n)}));case"SELECTION_REMOVE":return e.ids.length===0?t:(e.ids.forEach(r=>n.delete(r)),Object.assign(Object.assign({},t),{ids:new Set(n)}));case"SELECTION_SET":return Object.assign(Object.assign({},t),{ids:e.ids,mostRecent:e.mostRecent,anchor:e.anchor});case"SELECTION_MOST_RECENT":return Object.assign(Object.assign({},t),{mostRecent:e.id});case"SELECTION_ANCHOR":return Object.assign(Object.assign({},t),{anchor:e.id});default:return t}},drag:function(t=We().nodes.drag,e){switch(e.type){case"DND_DRAG_START":return Object.assign(Object.assign({},t),{id:e.id,selectedIds:e.dragIds});case"DND_DRAG_END":return Object.assign(Object.assign({},t),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case"DND_HOVERING":return e.parentId!==t.destinationParentId||e.index!=t.destinationIndex?Object.assign(Object.assign({},t),{destinationParentId:e.parentId,destinationIndex:e.index}):t;default:return t}}}),dnd:function(t=We().dnd,e){switch(e.type){case"DND_CURSOR":return Object.assign(Object.assign({},t),{cursor:e.cursor});case"DND_DRAG_START":return Object.assign(Object.assign({},t),{dragId:e.id,dragIds:e.dragIds});case"DND_DRAG_END":return We().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},t),{parentId:e.parentId,index:e.index});default:return t}}}),Xl=We();function Ql({treeProps:t,imperativeHandle:e,children:n}){const r=S.useRef(null),i=S.useRef(null),o=S.useRef(Xi($l,We(t))),a=Is.useSyncExternalStore(o.current.subscribe,o.current.getState,()=>Xl),l=S.useMemo(()=>new ct(o.current,t,r,i),[]),c=S.useRef(0);return S.useMemo(()=>{c.current+=1,l.update(t)},[...Object.values(t),a.nodes.open]),S.useImperativeHandle(e,()=>l),S.useEffect(()=>{l.props.selection?l.select(l.props.selection,{focus:!1}):l.deselectAll()},[l.props.selection]),S.useEffect(()=>{l.props.searchTerm||o.current.dispatch(Gt.clear(!0))},[l.props.searchTerm]),s.jsx(fr.Provider,{value:l,children:s.jsx(mr.Provider,{value:c.current,children:s.jsx(pr.Provider,{value:a.nodes,children:s.jsx(gr.Provider,{value:a.dnd,children:s.jsx(cl,Object.assign({backend:Gl,options:{rootElement:l.props.dndRootElement||void 0}},t.dndManager&&{manager:t.dndManager},{children:n}))})})})})}function Jl(t){return function(){const e=ve(),[,n]=Ni(()=>({accept:"NODE",canDrop:(r,i)=>!!i.isOver({shallow:!0})&&e.canDrop(),hover:(r,i)=>{if(!i.isOver({shallow:!0}))return;const o=i.getClientOffset();if(!e.listEl.current||!o)return;const{cursor:a,drop:l}=Vi({element:e.listEl.current,offset:o,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});l&&e.dispatch(Ge.hovering(l.parentId,l.index)),i.canDrop()?a&&e.showCursor(a):e.hideCursor()}}),[e]);n(e.listEl)}(),t.children}function Zl(){const t=ve().props.renderContainer||Wi;return s.jsx(s.Fragment,{children:s.jsx(t,{})})}function ec(){const t=ve(),{offset:e,mouse:n,item:r,isDragging:i}=(o=g=>({offset:g.getSourceClientOffset(),mouse:g.getClientOffset(),item:g.getItem(),isDragging:g.isDragging()}),a=Fe().getMonitor(),l=Al(Si(a,o),2),c=l[0],d=l[1],S.useEffect(function(){return a.subscribeToOffsetChange(d)}),S.useEffect(function(){return a.subscribeToStateChange(d)}),c);var o,a,l,c,d;const u=t.props.renderDragPreview||Rr;return s.jsx(u,{offset:e,mouse:n,id:(r==null?void 0:r.id)||null,dragIds:(r==null?void 0:r.dragIds)||[],isDragging:i})}class Ji{constructor(e){this.root=function(n){const r=new Zi({id:"ROOT"},null);return r.children=n.map(i=>kn(i,r)),r}(e)}get data(){var e,n;return(n=(e=this.root.children)===null||e===void 0?void 0:e.map(r=>r.data))!==null&&n!==void 0?n:[]}create(e){const n=e.parentId?this.find(e.parentId):this.root;if(!n)return null;n.addChild(e.data,e.index)}move(e){const n=this.find(e.id),r=e.parentId?this.find(e.parentId):this.root;n&&r&&(r.addChild(n.data,e.index),n.drop())}update(e){const n=this.find(e.id);n&&n.update(e.changes)}drop(e){const n=this.find(e.id);n&&n.drop()}find(e,n=this.root){if(!n)return null;if(n.id===e)return n;if(n.children){for(let r of n.children){const i=this.find(e,r);if(i)return i}return null}return null}}function kn(t,e){const n=new Zi(t,e);return t.children&&(n.children=t.children.map(r=>kn(r,n))),n}class Zi{constructor(e,n){this.data=e,this.parent=n,this.id=e.id}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(e,n){var r,i;const o=kn(e,this);this.children=(r=this.children)!==null&&r!==void 0?r:[],this.children.splice(n,0,o),this.data.children=(i=this.data.children)!==null&&i!==void 0?i:[],this.data.children.splice(n,0,e)}removeChild(e){var n,r;(n=this.children)===null||n===void 0||n.splice(e,1),(r=this.data.children)===null||r===void 0||r.splice(e,1)}update(e){if(this.hasParent()){const n=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),e),n),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let tc=0;function nc(t){if(t.initialData&&t.data)throw new Error("React Arborist Tree => Provide either a data or initialData prop, but not both.");if(t.initialData&&(t.onCreate||t.onDelete||t.onMove||t.onRename))throw new Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
|
|
16
|
+
Use the data prop if you want to provide your own handlers.`);if(t.initialData){const[e,n]=function(r){const[i,o]=S.useState(r),a=S.useMemo(()=>new Ji(i),[i]);return[i,{onMove:c=>{for(const d of c.dragIds)a.move({id:d,parentId:c.parentId,index:c.index});o(a.data)},onRename:({name:c,id:d})=>{a.update({id:d,changes:{name:c}}),o(a.data)},onCreate:({parentId:c,index:d,type:u})=>{const g={id:"simple-tree-id-"+tc++,name:""};return u==="internal"&&(g.children=[]),a.create({parentId:c,index:d,data:g}),o(a.data),g},onDelete:c=>{c.ids.forEach(d=>a.drop({id:d})),o(a.data)}}]}(t.initialData);return Object.assign(Object.assign(Object.assign({},t),n),{data:e})}return t}const rc=S.forwardRef(function(t,e){const n=nc(t);return s.jsxs(Ql,{treeProps:n,imperativeHandle:e,children:[s.jsx(Jl,{children:s.jsx(Zl,{})}),s.jsx(ec,{})]})});function ic(t,e){const n=U.c(11),{delayMs:r,whenVisible:i,disabled:o}=e,a=o!==void 0&&o,l=S.useRef(void 0);let c,d,u,g,f;return n[0]!==t?(c=()=>{l.current=t},d=[t],n[0]=t,n[1]=c,n[2]=d):(c=n[1],d=n[2]),S.useEffect(c,d),n[3]!==r||n[4]!==a||n[5]!==i?(u=()=>{if(r===null||a)return;const m=setInterval(()=>{var h;i&&document.visibilityState!=="visible"||((h=l.current)==null||h.call(l))},r);return()=>clearInterval(m)},g=[r,i,a],n[3]=r,n[4]=a,n[5]=i,n[6]=u,n[7]=g):(u=n[6],g=n[7]),S.useEffect(u,g),n[8]!==a||n[9]!==i?(f=()=>{var m;document.visibilityState==="visible"&&i&&!a&&((m=l.current)==null||m.call(l))},n[8]=a,n[9]=i,n[10]=f):f=n[10],Cs(document,"visibilitychange",f),null}function sc(){return["compact","medium","full","columns"]}const oc=t=>{const e=U.c(2),{children:n}=t;let r;return e[0]!==n?(r=s.jsx("div",{className:"text-md font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:n}),e[0]=n,e[1]=r):r=e[1],r},Tt=t=>{const e=U.c(10);let n,r,i,o,a;return e[0]!==t?({children:n,className:r,...i}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]),e[4]!==r?(o=Lt("text-base font-semibold underline-offset-2 text-accent-foreground uppercase tracking-wide",r),e[4]=r,e[5]=o):o=e[5],e[6]!==n||e[7]!==i||e[8]!==o?(a=s.jsx("div",{...i,className:o,children:n}),e[6]=n,e[7]=i,e[8]=o,e[9]=a):a=e[9],a},ac=t=>{const e=U.c(2),{children:n}=t;let r;return e[0]!==n?(r=s.jsx("p",{className:"text-sm text-muted-foreground",children:n}),e[0]=n,e[1]=r):r=e[1],r},es=[{label:"Auto (Default)",value:"auto"},{label:"Native",value:"native"},{label:"Polars",value:"polars"},{label:"Lazy Polars",value:"lazy-polars"},{label:"Pandas",value:"pandas"}],lc=()=>{const t=U.c(31),[e,n]=Os(),{saveAppConfig:r}=He();let i,o;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=Pn(ks),t[0]=i):i=t[0],t[1]!==e?(o={resolver:i,defaultValues:e},t[1]=e,t[2]=o):o=t[2];const a=An(o);let l;t[3]!==r||t[4]!==n?(l=async j=>{await r({config:j}).then(()=>{n(j)}).catch(()=>{n(j)})},t[3]=r,t[4]=n,t[5]=l):l=t[5];const c=l;let d,u,g,f,m,h,p,v,x,b;return t[6]!==e.width?(d=[e.width],t[6]=e.width,t[7]=d):d=t[7],S.useEffect(cc,d),t[8]!==a||t[9]!==c?(u=a.handleSubmit(c),t[8]=a,t[9]=c,t[10]=u):u=t[10],t[11]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsxs("div",{children:[s.jsx(oc,{children:"Notebook Settings"}),s.jsx(ac,{children:"Configure how your notebook or application looks and behaves."})]}),t[11]=g):g=t[11],t[12]!==a.control?(f=s.jsxs(Et,{title:"Display",children:[s.jsx(T,{control:a.control,name:"width",render:uc}),s.jsx(T,{control:a.control,name:"app_title",render:hc})]}),t[12]=a.control,t[13]=f):f=t[13],t[14]!==a.control?(m=s.jsxs(Et,{title:"Custom Files",children:[s.jsx(T,{control:a.control,name:"css_file",render:fc}),s.jsx(T,{control:a.control,name:"html_head_file",render:pc})]}),t[14]=a.control,t[15]=m):m=t[15],t[16]!==a.control?(h=s.jsx(Et,{title:"Data",children:s.jsx(T,{control:a.control,name:"sql_output",render:mc})}),t[16]=a.control,t[17]=h):h=t[17],t[18]!==a.control?(p=s.jsx(Et,{title:"Exporting outputs",children:s.jsx(T,{control:a.control,name:"auto_download",render:vc})}),t[18]=a.control,t[19]=p):p=t[19],t[20]!==f||t[21]!==m||t[22]!==h||t[23]!==p?(v=s.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-4",children:[f,m,h,p]}),t[20]=f,t[21]=m,t[22]=h,t[23]=p,t[24]=v):v=t[24],t[25]!==v||t[26]!==u?(x=s.jsxs("form",{onChange:u,className:"flex flex-col gap-6",children:[g,v]}),t[25]=v,t[26]=u,t[27]=x):x=t[27],t[28]!==a||t[29]!==x?(b=s.jsx(Mn,{...a,children:x}),t[28]=a,t[29]=x,t[30]=b):b=t[30],b},Et=t=>{const e=U.c(5),{title:n,children:r}=t;let i,o;return e[0]!==n?(i=s.jsx("h3",{className:"text-base font-semibold mb-1",children:n}),e[0]=n,e[1]=i):i=e[1],e[2]!==r||e[3]!==i?(o=s.jsxs("div",{className:"flex flex-col gap-y-2",children:[i,r]}),e[2]=r,e[3]=i,e[4]=o):o=e[4],o};function cc(){window.dispatchEvent(new Event("resize"))}function dc(t){return s.jsx("option",{value:t,children:t},t)}function uc(t){const{field:e}=t;return s.jsxs(E,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(D,{children:"Width"}),s.jsx(_,{children:s.jsx(me,{"data-testid":"app-width-select",onChange:n=>e.onChange(n.target.value),value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:["compact","medium","full","columns"].map(dc)})}),s.jsx(M,{})]})}function hc(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(D,{children:"App title"}),s.jsx(_,{children:s.jsx(Pe,{...e,value:e.value??"",onChange:n=>{e.onChange(n.target.value),Rn.safeParse(n.target.value).success&&(document.title=n.target.value)}})}),s.jsx(M,{})]}),s.jsx(F,{children:"The application title is put in the title tag in the HTML code and typically displayed in the title bar of the browser window."})]})}function fc(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(D,{className:"shrink-0",children:"Custom CSS"}),s.jsx(_,{children:s.jsx(Pe,{...e,value:e.value??"",placeholder:"custom.css",onChange:n=>{e.onChange(n.target.value),Rn.safeParse(n.target.value).success&&(document.title=n.target.value)}})}),s.jsx(M,{})]}),s.jsx(F,{children:"A filepath to a custom css file to be injected into the notebook."})]})}function pc(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(D,{className:"shrink-0",children:"HTML Head"}),s.jsx(_,{children:s.jsx(Pe,{...e,value:e.value??"",placeholder:"head.html",onChange:n=>{e.onChange(n.target.value)}})}),s.jsx(M,{})]}),s.jsxs(F,{children:["A filepath to an HTML file to be injected into the"," ",s.jsx(te,{className:"inline",children:"<head/>"})," section of the notebook. Use this to add analytics, custom fonts, meta tags, or external scripts."]})]})}function gc(t){return s.jsx("option",{value:t.value,children:t.label},t.value)}function mc(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(D,{children:"SQL Output Type"}),s.jsx(_,{children:s.jsx(me,{"data-testid":"sql-output-select",onChange:n=>{e.onChange(n.target.value),Ue({title:"Kernel Restart Required",description:"This change requires a kernel restart to take effect."})},value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:es.map(gc)})}),s.jsx(M,{})]}),s.jsxs(F,{children:["The Python type returned by a SQL cell. For best performance with large datasets, we recommend using"," ",s.jsx(te,{className:"inline",children:"native"}),". See the"," ",s.jsx(de,{href:"https://docs.marimo.io/guides/working_with_data/sql",children:"SQL guide"})," ","for more information."]})]})}function vc(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:"flex flex-col gap-2",children:[s.jsx(_,{children:s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(re,{id:"html-checkbox",checked:e.value.includes("html"),onCheckedChange:()=>{e.onChange(dt(e.value,"html"))}}),s.jsx(D,{htmlFor:"html-checkbox",children:"HTML"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(re,{id:"ipynb-checkbox",checked:e.value.includes("ipynb"),onCheckedChange:()=>{e.onChange(dt(e.value,"ipynb"))}}),s.jsx(D,{htmlFor:"ipynb-checkbox",children:"IPYNB"})]})]})}),s.jsx(M,{})]}),s.jsxs(F,{children:["When enabled, marimo will periodically save this notebook in your selected formats (HTML, IPYNB) to a folder named"," ",s.jsx(te,{className:"inline",children:"__marimo__"})," next to your notebook file."]})]})}const yc=Ln("flex items-center justify-center m-0 leading-none font-medium border border-foreground/10 shadow-xs-solid hover:cursor-pointer active:shadow-none dark:border-border text-sm",{variants:{color:{gray:"mo-button gray",white:"mo-button white",green:"mo-button green",red:"mo-button red",yellow:"mo-button yellow","hint-green":"mo-button hint-green",disabled:"mo-button disabled active:shadow-xs-solid"},shape:{rectangle:"rounded",circle:"rounded-full"},size:{small:"",medium:""}},compoundVariants:[{size:"small",shape:"circle",class:"h-[24px] w-[24px] px-[5.5px] py-[5.5px]"},{size:"medium",shape:"circle",class:"px-2 py-2"},{size:"small",shape:"rectangle",class:"px-1 py-1 h-[24px] w-[24px]"},{size:"medium",shape:"rectangle",class:"px-3 py-2"}],defaultVariants:{color:"gray",size:"medium",shape:"rectangle"}}),xc=Ln("font-mono w-full flex-1 inline-flex items-center justify-center rounded px-2.5 text-foreground/60 h-[36px] hover:shadow-md hover:cursor-pointer focus:shadow-md focus:outline-hidden text-[hsl(0, 0%, 43.5%)] bg-transparent hover:bg-background focus:bg-background"),_t=Xe.forwardRef((t,e)=>{const n=U.c(15);let r,i,o,a,l,c,d;return n[0]!==t?({color:i,shape:a,size:l,className:r,...o}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=a,n[5]=l):(r=n[1],i=n[2],o=n[3],a=n[4],l=n[5]),n[6]!==r||n[7]!==i||n[8]!==a||n[9]!==l?(c=Fn(yc({color:i,shape:a,size:l}),r),n[6]=r,n[7]=i,n[8]=a,n[9]=l,n[10]=c):c=n[10],n[11]!==o||n[12]!==e||n[13]!==c?(d=s.jsx("button",{ref:e,className:c,...o,children:o.children}),n[11]=o,n[12]=e,n[13]=c,n[14]=d):d=n[14],d});_t.displayName="Button",Xe.forwardRef((t,e)=>{const n=U.c(9);let r,i,o,a;return n[0]!==t?({className:r,...i}=t,n[0]=t,n[1]=r,n[2]=i):(r=n[1],i=n[2]),n[3]!==r?(o=Fn(xc(),r),n[3]=r,n[4]=o):o=n[4],n[5]!==i||n[6]!==e||n[7]!==o?(a=s.jsx("input",{ref:e,className:o,...i}),n[5]=i,n[6]=e,n[7]=o,n[8]=a):a=n[8],a}).displayName="Input";let Pt=null;class bc{constructor(e){this.view=void 0,this.abortController=new AbortController,this.view=e.view,this.view.dom.addEventListener("focus",()=>{Pt=new WeakRef(this.view)},{signal:this.abortController.signal,capture:!0}),this.update()}update(){const e=this.view.dom.querySelector(".cm-vimCursorLayer");if(e instanceof HTMLElement)if(Ns())e.style.display="none";else{const n=(Pt==null?void 0:Pt.deref())===this.view;e.style.display=n?"":"none"}}destroy(){this.abortController.abort()}}const ts={map:{args:["lhs","rhs"]},nmap:{mode:"normal",args:["lhs","rhs"]},vmap:{mode:"visual",args:["lhs","rhs"]},imap:{mode:"insert",args:["lhs","rhs"]},noremap:{args:["lhs","rhs"]},nnoremap:{mode:"normal",args:["lhs","rhs"]},vnoremap:{mode:"visual",args:["lhs","rhs"]},inoremap:{mode:"insert",args:["lhs","rhs"]},unmap:{args:["lhs"]},nunmap:{mode:"normal",args:["lhs"]},vunmap:{mode:"visual",args:["lhs"]},iunmap:{mode:"insert",args:["lhs"]},mapclear:{},nmapclear:{mode:"normal"},vmapclear:{mode:"visual"},imapclear:{mode:"insert"}};function jc(t,e){const n=t.split(/\s+/),r=n[0];let i=0;if(r in ts){const o=ts[r],a={};for(const c of o.args||[]){if(i+=1,!(i<n.length))return void(e&&e(`Not enough arguments for "${r}" command: "${t}"`));a[c]=n[i]}const l={name:r};return"args"in o&&(l.args=a),"mode"in o&&(l.mode=o.mode),l}e&&e(`Unknown vimrc command: "${t}"`)}var ns;const wc=qe(()=>{oe.defineAction("goToDefinition",t=>{const e=t.cm6;return Es(e)}),oe.mapCommand("gd","action","goToDefinition",{},{context:"normal"}),oe.defineEx("write","w",t=>{const e=t.cm6;e&&e.state.facet(ut).saveNotebook()})}),Sc=qe(async()=>{var n;const t=ft.get(qn),e=(n=t.keymap)==null?void 0:n.vimrc;if(e)try{Q.log(`Loading vimrc from ${e}`);const r=(await _s().sendFileDetails({path:e})).contents;if(!r)return void Q.error(`Failed to load vimrc from ${e}`);const i=function(o,a){const l=[];for(const c of o.split(`
|
|
17
|
+
`)){if(c.startsWith('"')||c.trim()==="")continue;const d=jc(c,a);d&&l.push(d)}return l}(r,Q.warn);(function(o){function a(u){u.args&&u.args.lhs&&u.args.rhs?u.mode?oe.map(u.args.lhs,u.args.rhs,u.mode):oe.map(u.args.lhs,u.args.rhs):Q.warn(`Could not execute vimrc command "${u.name}: expected arguments"`)}function l(u){u.args&&u.args.lhs&&u.args.rhs?u.mode?oe.noremap(u.args.lhs,u.args.rhs,u.mode):oe.noremap(u.args.lhs,u.args.rhs):Q.warn(`Could not execute vimrc command "${u.name}: expected arguments"`)}function c(u){u.args&&u.args.lhs?u.mode?oe.unmap(u.args.lhs,u.mode):oe.unmap(u.args.lhs):Q.warn(`Could not execute vimrc command "${u.name}: expected arguments"`)}function d(u){u.mode?oe.mapclear(u.mode):oe.mapclear()}for(const u of o)"map|nmap|vmap|imap".split("|").includes(u.name)?a(u):"noremap|nnoremap|vnoremap|inoremap".split("|").includes(u.name)?l(u):"unmap|nunmap|vunmap|iunmap".split("|").includes(u.name)?c(u):"mapclear|nmapclear|vmapclear|imapclear".split("|").includes(u.name)?d(u):Q.warn(`Could not execute vimrc command "${u.name}: unknown command"`)})(i)}catch(r){Q.error("Failed to load vimrc:",r)}});class At{constructor(){this.instances=new Set,this.isBroadcasting=!1}addInstance(e){this.instances.add(e);const n=ht(e);n?n.on("vim-mode-change",r=>{var i;this.isBroadcasting||(Ft("mode"in r,'Expected event to have a "mode" property'),this.isBroadcasting=!0,i=()=>{this.broadcastModeChange(e,r.mode,r.subMode),this.isBroadcasting=!1},"scheduler"in window?window.scheduler.postTask(i,{priority:"background"}):"requestIdleCallback"in window?requestIdleCallback(i):setTimeout(i,0))}):Q.warn("Expected CodeMirror instance to have CodeMirror instance state")}removeInstance(e){this.instances.delete(e)}broadcastModeChange(e,n,r){Ft("exitInsertMode"in oe,"Vim does not have an exitInsertMode method"),Ft("exitVisualMode"in oe,"Vim does not have an exitVisualMode method");for(const i of this.instances)if(i!==e){const o=ht(i);if(!o){Q.warn("Expected CodeMirror instance to have CodeMirror instance state");continue}const a=o.setSelections.bind(o);if(o.setSelections=()=>[],!rs(o)){Q.warn("Expected CodeMirror instance to have Vim state");continue}const l=o.state.vim;switch(n){case"normal":l.insertMode&&oe.exitInsertMode(o,!0),l.visualMode&&oe.exitVisualMode(o,!0);break;case"insert":l.insertMode||oe.handleKey(o,"i","")}o.setSelections=a}}}function rs(t){return t.state.vim!==void 0}ns=At,At.INSTANCES=new ns;const Ic=["default","vim"];function Cc(t,e){switch(t.preset){case"default":return[Ee.of(is()),Ee.of(ss(e))];case"vim":return[Ee.of(kc()),Ee.of(ss(e)),Ee.of([{key:"Enter",run:n=>{var i;const r=ht(n);return!!((i=r==null?void 0:r.state.vim)!=null&&i.insertMode)&&Ms(n)}}]),Vn.high(Nc("d",n=>n.state.doc.toString()==="",n=>n.state.doc.toString()===""?(n.state.facet(ut).deleteCell(),!0):!1)),As({status:!1}),Vn.high((wc(),Sc(),[Ee.of([{key:"j",run:n=>{if(Ds(n,!0)&&Hn(n)){const r=n.state.facet(ut),i=n.state.facet(Un);return r.moveToNextCell({cellId:i,before:!1,noCreate:!0}),!0}return!1}}]),Ee.of([{key:"k",run:n=>{if(Ts(n)&&Hn(n)){const r=n.state.facet(ut),i=n.state.facet(Un);return r.moveToNextCell({cellId:i,before:!0,noCreate:!0}),!0}return!1}}]),Ee.of([{linux:"Ctrl-[",win:"Ctrl-[",run:n=>{const r=ht(n);return r?rs(r)?!!r.state.vim.insertMode&&(oe.exitInsertMode(r,!0),!0):(Q.warn("Expected CodeMirror instance to have Vim state"),!1):(Q.warn("Expected CodeMirror instance to have CodeMirror instance state"),!1)}}]),zn.define(n=>(requestAnimationFrame(()=>{At.INSTANCES.addInstance(n)}),{destroy(){At.INSTANCES.removeInstance(n)}})),zn.define(n=>new bc({view:n}))]))];default:return Ps(t.preset),[]}}const Oc=new Set([Bn,Wn]),is=qe(()=>Rs.filter(t=>!Oc.has(t.run))),ss=t=>[{key:t.getHotkey("cell.toggleComment").key,run:Bn},{key:t.getHotkey("cell.toggleBlockComment").key,run:Wn}],kc=qe(()=>{const t=new Set(["Enter","Ctrl-v"]);return is().filter(e=>!t.has(e.key||e.mac||e.linux||e.win||""))});function Nc(t,e,n){let r="",i=0;return Ee.of([{any:(o,a)=>{const l=a.key,c=a.timeStamp;return l!==t||!e(o)?(r="",i=0,!1):r===t&&c-i<500&&n(o)?(r="",i=0,!0):(r=l,i=c,!1)}}])}const Nn=Qe(!1),Dc=()=>{const t=U.c(82),[e,n]=Je(Nn),[r,i]=S.useState(null);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const[a,l]=S.useState(o),[c,d]=Gn(),u=pt(Ls),{saveUserConfig:g}=He();let f,m;t[1]!==n?(f=()=>n(Tc),t[1]=n,t[2]=f):f=t[2],Fs("global.showHelp",f),t[3]!==c||t[4]!==g||t[5]!==d?(m=async ge=>{const $={...c};d(ge),await g({config:ge}).catch(B=>{throw d($),B})},t[3]=c,t[4]=g,t[5]=d,t[6]=m):m=t[6];const h=m;let p;t[7]!==c||t[8]!==r||t[9]!==h?(p=async ge=>{if(!r)return;const $=ge.join("-"),B={...c,keymap:{...c.keymap,overrides:{...c.keymap.overrides,[r]:$}}};i(null),l([]),await h(B)},t[7]=c,t[8]=r,t[9]=h,t[10]=p):p=t[10];const v=p;let x,b,j;if(t[11]!==c||t[12]!==r||t[13]!==v||t[14]!==u||t[15]!==e||t[16]!==a||t[17]!==h){j=Symbol.for("react.early_return_sentinel");{const ge=async()=>{if(!r)return;const B={...c,keymap:{...c.keymap,overrides:{...c.keymap.overrides}}};delete B.keymap.overrides[r],i(null),l([]),await h(B)};let $;t[21]!==c||t[22]!==h?($=async()=>{if(!window.confirm("Are you sure you want to reset all shortcuts to their default values?"))return;const B={...c,keymap:{...c.keymap,overrides:{}}};i(null),l([]),await h(B)},t[21]=c,t[22]=h,t[23]=$):$=t[23],x=$,e?b=B=>{const le=u.getHotkey(B);if(r===B){const ke=zs(B);return s.jsxs("div",{children:[s.jsx(Pe,{defaultValue:a.join("+"),placeholder:le.name,onKeyDown:X=>{X.preventDefault();const Te=[];if(X.key==="Meta"||X.key==="Control"||X.key==="Alt"||X.key==="Shift"||(X.metaKey&&Te.push(Yn()?"Cmd":"Meta"),X.ctrlKey&&Te.push("Ctrl"),X.altKey&&Te.push("Alt"),X.shiftKey&&Te.push("Shift"),X.key==="-"))return;if(X.key==="Escape"&&Te.length===0)return i(null),void l([]);let _n=X.key.toLowerCase();X.key===" "&&(_n="Space"),Te.push(_n),v(Te)},autoFocus:!0,endAdornment:s.jsx(ye,{variant:"text",size:"xs",className:"mb-0",onClick:()=>{i(null),l([])},children:s.jsx(gt,{className:"w-4 h-4"})})}),s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:"Press a key combination"}),ke.key!==le.key&&s.jsxs("span",{className:"text-xs cursor-pointer text-primary",onClick:ge,children:["Reset to default:"," ",s.jsx("span",{className:"font-mono",children:ke.key})]})]})]},B)}return s.jsxs("div",{className:"grid grid-cols-[auto_2fr_3fr] gap-2 items-center",children:[u.isEditable(B)?s.jsx($n,{className:"cursor-pointer opacity-60 hover:opacity-100 text-muted-foreground w-3 h-3",onClick:()=>{l([]),i(B)}}):s.jsx("div",{className:"w-3 h-3"}),s.jsx(Kn,{className:"justify-end",shortcut:le.key}),s.jsx("span",{children:le.name.toLowerCase()})]},B)}:j=null}t[11]=c,t[12]=r,t[13]=v,t[14]=u,t[15]=e,t[16]=a,t[17]=h,t[18]=x,t[19]=b,t[20]=j}else x=t[18],b=t[19],j=t[20];if(j!==Symbol.for("react.early_return_sentinel"))return j;const O=b;let w,k,N,R,A,H,V,J,ee,Z,ne,K,W,G,Y,se,C,y,I,ae,fe,pe,Oe,Se,Ie;if(t[24]!==c.keymap.preset||t[25]!==u||t[26]!==e||t[27]!==O||t[28]!==n){const ge=u.getHotkeyGroups(),$=(le,ke)=>{const X=ge[le];return s.jsxs("div",{className:"mb-[40px] gap-2 flex flex-col",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-medium",children:le}),ke]}),X.map(O)]})},B=le=>$(le,s.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:["Press"," ",c.keymap.preset==="vim"?s.jsxs(s.Fragment,{children:[s.jsx(Kn,{shortcut:Yn()?"Cmd":"Ctrl"}),s.jsx(te,{children:"Esc"})]}):s.jsx(te,{children:"Esc"})," ","in a cell to enter command mode"]}));N=zt,W=e,t[47]!==n?(G=le=>n(le),t[47]=n,t[48]=G):G=t[48],k=Hs,ne="sm:items-center sm:top-0",t[49]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(Us,{}),t[49]=K):K=t[49],w=Xn,J=!1,ee="max-h-screen sm:max-h-[90vh] overflow-y-auto sm:max-w-[850px]",t[50]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsx(qs,{children:s.jsx(Qn,{children:"Shortcuts"})}),t[50]=Z):Z=t[50],H="flex flex-row gap-3",V=s.jsxs("div",{className:"w-1/2",children:[$("Editing"),$("Markdown")]}),Y="w-1/2",se=$("Navigation"),C=$("Running Cells"),y=$("Creation and Ordering"),R=B("Command"),A=$("Other"),t[24]=c.keymap.preset,t[25]=u,t[26]=e,t[27]=O,t[28]=n,t[29]=w,t[30]=k,t[31]=N,t[32]=R,t[33]=A,t[34]=H,t[35]=V,t[36]=J,t[37]=ee,t[38]=Z,t[39]=ne,t[40]=K,t[41]=W,t[42]=G,t[43]=Y,t[44]=se,t[45]=C,t[46]=y}else w=t[29],k=t[30],N=t[31],R=t[32],A=t[33],H=t[34],V=t[35],J=t[36],ee=t[37],Z=t[38],ne=t[39],K=t[40],W=t[41],G=t[42],Y=t[43],se=t[44],C=t[45],y=t[46];return t[51]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx("span",{className:"text-destructive",children:"Reset all to default"}),t[51]=I):I=t[51],t[52]!==x?(ae=s.jsx(ye,{className:"mt-4 hover:bg-destructive/10 border-destructive hover:border-destructive",variant:"outline",size:"xs",onClick:x,tabIndex:-1,children:I}),t[52]=x,t[53]=ae):ae=t[53],t[54]!==R||t[55]!==A||t[56]!==ae||t[57]!==Y||t[58]!==se||t[59]!==C||t[60]!==y?(fe=s.jsxs("div",{className:Y,children:[se,C,y,R,A,ae]}),t[54]=R,t[55]=A,t[56]=ae,t[57]=Y,t[58]=se,t[59]=C,t[60]=y,t[61]=fe):fe=t[61],t[62]!==H||t[63]!==V||t[64]!==fe?(pe=s.jsxs("div",{className:H,children:[V,fe]}),t[62]=H,t[63]=V,t[64]=fe,t[65]=pe):pe=t[65],t[66]!==w||t[67]!==J||t[68]!==ee||t[69]!==Z||t[70]!==pe?(Oe=s.jsxs(w,{usePortal:J,className:ee,children:[Z,pe]}),t[66]=w,t[67]=J,t[68]=ee,t[69]=Z,t[70]=pe,t[71]=Oe):Oe=t[71],t[72]!==k||t[73]!==ne||t[74]!==K||t[75]!==Oe?(Se=s.jsxs(k,{className:ne,children:[K,Oe]}),t[72]=k,t[73]=ne,t[74]=K,t[75]=Oe,t[76]=Se):Se=t[76],t[77]!==N||t[78]!==W||t[79]!==G||t[80]!==Se?(Ie=s.jsx(N,{open:W,onOpenChange:G,children:Se}),t[77]=N,t[78]=W,t[79]=G,t[80]=Se,t[81]=Ie):Ie=t[81],Ie};function Tc(t){return!t}var Ec=Vs();const os="marimo:copilot:signedIn",as=Gs(os,null,void 0,{getOnInit:!0}),ls=Qe(null),Mt=Qe(null);function cs(){const t=localStorage.getItem(os)==="true",e=Bs();return t&&e.completion.copilot==="github"}const we=Q.get("@github/copilot-language-server");class _c extends Ks{constructor(...e){super(...e),this.documentVersion=0,this.hasOpenedDocument=!1,this.getCompletionInternal=async(n,r)=>await this._request("textDocument/inlineCompletion",{...n,textDocument:{...n.textDocument,version:r}}),this.throttledGetCompletionInternal=function(n,r,i){var o=!0,a=!0;if(typeof n!="function")throw new TypeError("Expected a function");return js(i)&&(o="leading"in i?!!i.leading:o,a="trailing"in i?!!i.trailing:a),ws(n,r,{leading:o,maxWait:r,trailing:a})}(this.getCompletionInternal,200)}async _request(e,n){try{return await this.request(e,n)}catch(r){throw we.error("#request: Error",r),r}}async notify(e,n){return we.debug("#notify",e,n),super.notify(e,n)}getInitializationOptions(){const e={name:"marimo",version:"0.1.0"};return{...super.getInitializationOptions(),workspaceFolders:[],capabilities:{workspace:{workspaceFolders:!1}},initializationOptions:{editorInfo:e,editorPluginInfo:e}}}isDisabled(){return!cs()}async textDocumentDidOpen(e){return this.isDisabled()?e:(this.hasOpenedDocument=!0,super.textDocumentDidOpen(e))}async textDocumentCompletion(e){return[]}async textDocumentDidChange(e){if(this.isDisabled())return e;this.hasOpenedDocument||await this.textDocumentDidOpen({textDocument:{uri:e.textDocument.uri,languageId:"python",version:e.textDocument.version,text:e.contentChanges[0].text}});const n=e.contentChanges;n.length!==1&&we.warn("#textDocumentDidChange: Multiple changes detected. This is not supported.",n);const r=n[0];"range"in r&&we.warn("#textDocumentDidChange: Copilot doesn't support range changes.",r);const i=Ys(r.text);return super.textDocumentDidChange({...e,contentChanges:[{text:i}],textDocument:$s.VersionedTextDocumentIdentifier.create(e.textDocument.uri,++this.documentVersion)})}textDocumentHover(e){return Promise.resolve({contents:[]})}signOut(){return this._request("signOut",{})}async signInInitiate(){we.log("#signInInitiate: Starting sign-in flow");try{const e=await this._request("signIn",{});return we.log("#signInInitiate: Sign-in flow started successfully"),e}catch(e){throw we.warn("#signInInitiate: Failed to start sign-in flow",e),e}}async signInConfirm(e){we.log("#signInConfirm: Confirming sign-in");try{const n=await this._request("signInConfirm",e);return we.log("#signInConfirm: Sign-in confirmed successfully"),n}catch(n){throw we.warn("#signInConfirm: Failed to confirm sign-in",n),n}}async signedIn(){try{const{status:e}=await this._request("checkStatus",{});return we.log("#checkStatus: Status check completed",{status:e}),e==="SignedIn"||e==="AlreadySignedIn"||e==="OK"}catch(e){throw we.warn("#signedIn: Failed to check sign-in status",e),e}}async getCompletion(e){if(this.isDisabled())return null;const n=this.documentVersion;if(e.textDocument.version=n,n===0)return null;var r;r=n,ft.set(Mt,r);const i=await this.throttledGetCompletionInternal(e,n);var o;return o=n,ft.get(Mt)===o&&ft.set(Mt,null),n!==this.documentVersion?null:i??null}}const ds="/__marimo_copilot__.py",us=`file://${ds}`,Pc=qe(()=>new Ac);class Ac extends Ec.Transport{constructor(){super(),this.delegate=void 0,this.delegate=void 0}getWsUrl(){return Qs().getLSPURL("copilot").toString()}async tryConnect(e=3,n=1e3){for(let r=1;r<=e;r++)try{return this.delegate||(this.delegate=new Js.WebSocketTransport(this.getWsUrl())),await this.delegate.connect(),void Q.log("Copilot#connect: Connected successfully")}catch(i){if(Q.warn(`Copilot#connect: Connection attempt ${r}/${e} failed`,i),r===e)throw this.delegate=void 0,Ue({variant:"danger",title:"GitHub Copilot Connection Error",description:"Failed to connect to GitHub Copilot. Please check settings and try again."}),i;await new Promise(o=>setTimeout(o,n))}}async connect(){return await Ws(qn,e=>e.completion.copilot==="github"),await Zs(),this.tryConnect()}close(){var e;(e=this.delegate)==null||e.close(),this.delegate=void 0}async sendData(e,n){var r;return n=Math.min(n??5e3,5e3),(r=this.delegate)==null?void 0:r.sendData(e,n)}}const ot=qe(()=>new _c({rootUri:us,workspaceFolders:null,transport:Pc()}));function Mc(){return Xs({documentUri:us,client:ot(),languageId:"copilot",hoverEnabled:!1,completionEnabled:!1,definitionEnabled:!1,renameEnabled:!1,codeActionsEnabled:!1,signatureHelpEnabled:!1,diagnosticsEnabled:!1,sendIncrementalChanges:!1})}const hs=S.memo(()=>{const[t,e]=Je(as),[n,r]=Je(ls),[i,o]=S.useState(),[a,l]=S.useState(!1),c=async g=>{g.preventDefault(),l(!0);try{const{verificationUri:f,status:m,userCode:h}=await async function(){return await ot().signInInitiate()}();gs(m)?e(!0):(r("signingIn"),o({url:f,code:h}))}finally{l(!1)}},d=async g=>{if(g.preventDefault(),i){l(!0);try{const f=await async function(m){const h=ot();try{Q.log("Copilot#tryFinishSignIn: Attempting to confirm sign-in");const{status:p}=await h.signInConfirm({userCode:m});return gs(p)?(Q.log("Copilot#tryFinishSignIn: Sign-in confirmed successfully"),{success:!0}):(Q.warn("Copilot#tryFinishSignIn: Sign-in confirmation returned unexpected status",{status:p}),{success:!1})}catch(p){return ps(p)?(Q.error("Copilot#tryFinishSignIn: Connection error during sign-in",p),{success:!1,error:"connection"}):await async function(v){for(let x=0;x<fs;x++)try{if(await new Promise(b=>setTimeout(b,Rc)),await v.signedIn())return Q.log("Copilot#tryFinishSignIn: Successfully signed in after retry"),{success:!0}}catch(b){if(Q.warn("Copilot#tryFinishSignIn: Retry attempt failed",{attempt:x+1,maxRetries:fs}),ps(b))return{success:!1,error:"connection"}}return Q.error("Copilot#tryFinishSignIn: All sign-in attempts failed"),{success:!1}}(h)}}(i.code);f.success?(e(!0),r("signedIn")):f.error==="connection"?(r("connectionError"),Ue({title:"GitHub Copilot Connection Error",description:"Lost connection during sign-in. Please try again.",variant:"danger",action:s.jsx(ye,{onClick:c,children:"Retry"})})):r("signInFailed")}finally{l(!1)}}},u=async g=>{g.preventDefault(),await async function(){await ot().signOut()}(),e(!1),r("signedOut")};return(()=>{switch(n??(t?"signedIn":"connecting")){case"connecting":return s.jsx(mt,{className:"font-normal flex",children:"Connecting..."});case"signedOut":return s.jsx(ye,{onClick:c,size:"xs",variant:"link",children:"Sign in to GitHub Copilot"});case"signingIn":return s.jsxs("ol",{className:"ml-4 text-sm list-decimal [&>li]:mt-2",children:[s.jsx("li",{children:s.jsxs("div",{className:"flex items-center",children:["Copy this code:",s.jsx("strong",{className:"ml-2",children:i==null?void 0:i.code}),s.jsx(to,{className:"ml-2 cursor-pointer opacity-60 hover:opacity-100 h-3 w-3",onClick:async()=>{i&&(await no(i.code),Ue({description:"Copied to clipboard"}))}})]})}),s.jsxs("li",{children:["Enter the code at this link:",s.jsx("a",{href:i==null?void 0:i.url,target:"_blank",rel:"noreferrer",className:ro({variant:"link",size:"xs"}),children:i==null?void 0:i.url})]}),s.jsxs("li",{children:["Click here when done:",s.jsxs(ye,{size:"xs",onClick:d,className:"ml-1",children:[a&&s.jsx(Jn,{className:"h-3 w-3 mr-1 animate-spin"}),"Done"]})]})]});case"signInFailed":return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("div",{className:"text-destructive text-sm",children:"Sign in failed. Please try again."}),a?s.jsx(Jn,{className:"h-3 w-3 mr-1 animate-spin"}):s.jsx(ye,{onClick:c,size:"xs",variant:"link",children:"Connect to GitHub Copilot"})]});case"signedIn":return s.jsxs("div",{className:"flex items-center gap-5",children:[s.jsxs(mt,{className:"font-normal flex items-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center bg-(--grass-7) rounded-full p-1 mr-2",children:s.jsx(eo,{className:"h-3 w-3 text-white"})}),"Connected"]}),s.jsx(ye,{onClick:u,size:"xs",variant:"text",children:"Disconnect"})]});case"connectionError":return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(mt,{className:"font-normal flex",children:[s.jsx(gt,{className:"h-4 w-4 mr-1"}),"Connection Error"]}),s.jsx("div",{className:"text-sm",children:"Unable to connect to GitHub Copilot."}),s.jsx(ye,{onClick:c,size:"xs",variant:"link",children:"Retry Connection"})]});case"notConnected":return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(mt,{className:"font-normal flex",children:[s.jsx(gt,{className:"h-4 w-4 mr-1"}),"Unable to connect"]}),s.jsxs("div",{className:"text-sm",children:["For troubleshooting, see the"," ",s.jsx(de,{href:"https://docs.marimo.io/getting_started/index.html#github-copilot",children:"docs"}),"."]})]})}})()});hs.displayName="CopilotConfig";const fs=5,Rc=3e3;function ps(t){return t instanceof Error&&(t.message.includes("ECONNREFUSED")||t.message.includes("WebSocket")||t.message.includes("network"))}function gs(t){return t==="SignedIn"||t==="AlreadySignedIn"||t==="OK"}const Lc=["us-east-1","us-east-2","us-west-2","eu-central-1","ap-northeast-1","ap-southeast-1"],ms=t=>{const e=U.c(12),{value:n,includeSuggestion:r}=t,i=r===void 0||r;if(!n||n.includes("/"))return null;let o;e[0]!==n?(o=io.parse(n),e[0]=n,e[1]=o):o=e[1];const a=o.id;let l,c,d,u,g;return e[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("code",{className:"font-bold",children:"provider/model"}),e[2]=l):l=e[2],e[3]!==n?(c=s.jsxs("span",{children:["Model id should be in the form"," ",l,". ",n," is missing a provider."]}),e[3]=n,e[4]=c):c=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("br",{}),e[5]=d):d=e[5],e[6]!==i||e[7]!==a?(u=i&&a&&s.jsxs("span",{children:["Did you mean ",s.jsx("code",{className:"font-bold",children:a}),"?"]}),e[6]=i,e[7]=a,e[8]=u):u=e[8],e[9]!==c||e[10]!==u?(g=s.jsxs(vt,{kind:"danger",className:"mt-1",children:[c,d,u]}),e[9]=c,e[10]=u,e[11]=g):g=e[11],g};function vs(t,e){const n=U.c(10);let r;n[0]!==e||n[1]!==t?(r=Zn(t,e),n[0]=e,n[1]=t,n[2]=r):r=n[2];const i=r,o=pt(so);let a;n[3]!==e||n[4]!==o?(a=Zn(o,e),n[3]=e,n[4]=o,n[5]=a):a=n[5];const l=a,c=l!=null&&i!==l;let d;return n[6]!==i||n[7]!==c||n[8]!==l?(d={isOverridden:c,currentValue:i,overriddenValue:l},n[6]=i,n[7]=c,n[8]=l,n[9]=d):d=n[9],d}const Fc=t=>{const e=U.c(3),{name:n,children:r}=t,[i]=er(),{isOverridden:o}=vs(i,n);let a;return e[0]!==r||e[1]!==o?(a=o?s.jsx(Ve,{delayDuration:200,content:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("p",{children:["This setting is overridden by the"," ",s.jsx(te,{className:"inline mx-px",children:"pyproject.toml"})," config."]}),s.jsxs("p",{children:["To change it, edit the project config"," ",s.jsx(te,{className:"inline mx-px",children:"pyproject.toml"}),"directly."]})]}),children:s.jsx("div",{className:"text-muted-foreground opacity-80 cursor-not-allowed *:pointer-events-none",children:r})}):r,e[0]=r,e[1]=o,e[2]=a):a=e[2],a},z=t=>{const e=U.c(18),{userConfig:n,name:r}=t,{isOverridden:i,currentValue:o,overriddenValue:a}=vs(n,r);if(!i)return null;let l,c,d,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("span",{children:["This setting is overridden by"," ",s.jsx(te,{className:"inline",children:"pyproject.toml"}),"."]}),c=s.jsx("br",{}),e[0]=l,e[1]=c):(l=e[0],c=e[1]),e[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsxs("span",{children:["Edit the ",s.jsx(te,{className:"inline",children:"pyproject.toml"})," file directly to change this setting."]}),u=s.jsx("br",{}),e[2]=d,e[3]=u):(d=e[2],u=e[3]);const g=String(o);let f,m;e[4]!==g?(f=s.jsxs("span",{children:["User value: ",s.jsx("strong",{children:g})]}),e[4]=g,e[5]=f):f=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("br",{}),e[6]=m):m=e[6];const h=String(a);let p,v,x;e[7]!==h?(p=s.jsxs("span",{children:["Project value: ",s.jsx("strong",{children:h})]}),e[7]=h,e[8]=p):p=e[8],e[9]!==f||e[10]!==p?(v=s.jsxs(s.Fragment,{children:[l,c,d,u,f,m,p]}),e[9]=f,e[10]=p,e[11]=v):v=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(ur,{className:"w-3 h-3"}),e[12]=x):x=e[12];const b=String(a);let j,O;return e[13]!==b?(j=s.jsxs("span",{className:"text-(--amber-12) text-xs flex items-center gap-1 border rounded px-2 py-1 bg-(--amber-2) border-(--amber-6) ml-1",children:[x,"Overridden by pyproject.toml [",b,"]"]}),e[13]=b,e[14]=j):j=e[14],e[15]!==v||e[16]!==j?(O=s.jsx(Ve,{content:v,children:j}),e[15]=v,e[16]=j,e[17]=O):O=e[17],O},$e="flex flex-row items-center space-x-1 space-y-0",zc=t=>{const e=U.c(5),{provider:n,children:r}=t;let i,o;return e[0]!==n?(i=n&&s.jsx(vo,{provider:n,className:"mr-2"}),e[0]=n,e[1]=i):i=e[1],e[2]!==r||e[3]!==i?(o=s.jsxs("div",{className:"flex items-center text-base font-semibold",children:[i,r]}),e[2]=r,e[3]=i,e[4]=o):o=e[4],o},ze=t=>{const e=U.c(10),{form:n,config:r,name:i,placeholder:o,testId:a,description:l}=t;let c,d;return e[0]!==r||e[1]!==l||e[2]!==i||e[3]!==o||e[4]!==a?(c=u=>{const{field:g}=u;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:$e,children:[s.jsx(D,{children:"API Key"}),s.jsx(_,{children:s.jsx(Pe,{"data-testid":a,rootClassName:"flex-1",className:"m-0 inline-flex h-7",placeholder:o,...g,value:at(g.value),onChange:f=>{const m=f.target.value;m.includes("*")||g.onChange(m)}})}),s.jsx(M,{}),s.jsx(z,{userConfig:r,name:i})]}),l&&s.jsx(F,{children:l})]})},e[0]=r,e[1]=l,e[2]=i,e[3]=o,e[4]=a,e[5]=c):c=e[5],e[6]!==n.control||e[7]!==i||e[8]!==c?(d=s.jsx(T,{control:n.control,name:i,render:c}),e[6]=n.control,e[7]=i,e[8]=c,e[9]=d):d=e[9],d};function at(t){if(t!=null)return typeof t=="string"?t:String(t)}const lt=t=>{const e=U.c(12),{form:n,config:r,name:i,placeholder:o,testId:a,description:l,disabled:c,defaultValue:d}=t,u=c!==void 0&&c;let g,f;return e[0]!==r||e[1]!==d||e[2]!==l||e[3]!==i||e[4]!==o||e[5]!==a?(g=m=>{const{field:h}=m;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:$e,children:[s.jsx(D,{children:"Base URL"}),s.jsx(_,{children:s.jsx(Pe,{"data-testid":a,rootClassName:"flex-1",className:"m-0 inline-flex h-7",placeholder:o,defaultValue:d,...h,value:at(h.value)})}),s.jsx(M,{}),s.jsx(z,{userConfig:r,name:i})]}),l&&s.jsx(F,{children:l})]})},e[0]=r,e[1]=d,e[2]=l,e[3]=i,e[4]=o,e[5]=a,e[6]=g):g=e[6],e[7]!==u||e[8]!==n.control||e[9]!==i||e[10]!==g?(f=s.jsx(T,{control:n.control,name:i,disabled:u,render:g}),e[7]=u,e[8]=n.control,e[9]=i,e[10]=g,e[11]=f):f=e[11],f},Dn=t=>{const e=U.c(14),{form:n,config:r,name:i,placeholder:o,testId:a,description:l,disabled:c,label:d,onSubmit:u}=t,g=c!==void 0&&c;let f,m;return e[0]!==r||e[1]!==l||e[2]!==n||e[3]!==d||e[4]!==i||e[5]!==u||e[6]!==o||e[7]!==a?(f=h=>{const{field:p}=h,v=at(p.value),x=b=>{p.onChange(b),u(n.getValues())};return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:$e,children:[s.jsx(D,{children:d}),s.jsx(_,{children:s.jsx(co,{value:v,placeholder:o,onSelect:x,triggerClassName:"text-sm",customDropdownContent:s.jsxs(s.Fragment,{children:[s.jsx(uo,{}),s.jsxs("p",{className:"px-2 py-1.5 text-sm text-muted-secondary flex items-center gap-1",children:["Enter a custom model",s.jsx(Ve,{content:"Models should include the provider prefix, e.g. 'openai/gpt-4o'",children:s.jsx(ho,{className:"h-3 w-3"})})]}),s.jsxs("div",{className:"px-2 py-1",children:[s.jsx(Pe,{"data-testid":a,className:"w-full border-border shadow-none focus-visible:shadow-xs",placeholder:o,...p,value:at(p.value),onKeyDown:fo.stopPropagation()}),v&&s.jsx(ms,{value:v,includeSuggestion:!1})]})]})})}),s.jsx(M,{})]}),s.jsx(z,{userConfig:r,name:i}),s.jsx(ms,{value:v}),l&&s.jsx(F,{children:l})]})},e[0]=r,e[1]=l,e[2]=n,e[3]=d,e[4]=i,e[5]=u,e[6]=o,e[7]=a,e[8]=f):f=e[8],e[9]!==g||e[10]!==n.control||e[11]!==i||e[12]!==f?(m=s.jsx(T,{control:n.control,name:i,disabled:g,render:f}),e[9]=g,e[10]=n.control,e[11]=i,e[12]=f,e[13]=m):m=e[13],m},Hc=t=>{const e=U.c(10),{form:n,config:r,name:i,options:o,testId:a,disabled:l}=t,c=l!==void 0&&l;let d,u;return e[0]!==r||e[1]!==i||e[2]!==o||e[3]!==a?(d=g=>{const{field:f}=g;return s.jsx("div",{className:"flex flex-col space-y-1",children:s.jsxs(E,{className:$e,children:[s.jsx(D,{children:"Provider"}),s.jsx(_,{children:s.jsx(me,{"data-testid":a,onChange:m=>{m.target.value==="none"?f.onChange(!1):f.onChange(m.target.value)},value:at(f.value===!0?"github":f.value===!1?"none":f.value),disabled:f.disabled,className:"inline-flex mr-2",children:o.map(Wc)})}),s.jsx(M,{}),s.jsx(z,{userConfig:r,name:i})]})})},e[0]=r,e[1]=i,e[2]=o,e[3]=a,e[4]=d):d=e[4],e[5]!==c||e[6]!==n.control||e[7]!==i||e[8]!==d?(u=s.jsx(T,{control:n.control,name:i,disabled:c,render:d}),e[5]=c,e[6]=n.control,e[7]=i,e[8]=d,e[9]=u):u=e[9],u},Tn=t=>{const e=U.c(2),{children:n}=t;let r;return e[0]!==n?(r=s.jsx("div",{className:"flex flex-col gap-4 pb-4",children:n}),e[0]=n,e[1]=r):r=e[1],r},Uc=t=>{const e=U.c(13),{form:n,config:r,onSubmit:i}=t;let o,a,l,c,d,u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(Tt,{children:"Code Completion"}),a=s.jsx("p",{className:"text-sm text-muted-secondary",children:"Choose GitHub Copilot, Codeium, or a custom provider (such as Ollama) to enable AI-powered code completion."}),e[0]=o,e[1]=a):(o=e[0],a=e[1]),e[2]===Symbol.for("react.memo_cache_sentinel")?(l=["none","github","codeium","custom"],e[2]=l):l=e[2],e[3]!==r||e[4]!==n?(c=s.jsx(Hc,{form:n,config:r,name:"completion.copilot",options:l,testId:"copilot-select"}),e[3]=r,e[4]=n,e[5]=c):c=e[5],e[6]!==r||e[7]!==n||e[8]!==i?(d=(({form:g,config:f,onSubmit:m})=>{const h=g.getValues("completion.copilot");return h===!1?null:h==="codeium"?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-sm text-muted-secondary",children:["To get a Windsurf API key, follow"," ",s.jsx(de,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html#windsurf-copilot",children:"these instructions"}),"."]}),s.jsx(ze,{form:g,config:f,name:"completion.codeium_api_key",placeholder:"key",testId:"codeium-api-key-input"})]}):h==="github"?s.jsx(hs,{}):h==="custom"?s.jsx(Dn,{label:"Autocomplete Model",form:g,config:f,name:"ai.models.autocomplete_model",placeholder:"ollama/qwen2.5-coder:1.5b",testId:"custom-model-input",description:"Model to use for code completion when using a custom provider.",onSubmit:m}):void 0})({form:n,config:r,onSubmit:i}),e[6]=r,e[7]=n,e[8]=i,e[9]=d):d=e[9],e[10]!==c||e[11]!==d?(u=s.jsxs(Tn,{children:[o,a,c,d]}),e[10]=c,e[11]=d,e[12]=u):u=e[12],u},Ae=t=>{const e=U.c(15),{title:n,triggerClassName:r,provider:i,children:o,isConfigured:a}=t;let l,c,d,u,g;return e[0]!==a?(l=a&&s.jsx("span",{className:"ml-2 px-1 rounded bg-muted text-xs font-medium border",children:"Configured"}),e[0]=a,e[1]=l):l=e[1],e[2]!==i||e[3]!==l||e[4]!==n?(c=s.jsxs(zc,{provider:i,children:[n,l]}),e[2]=i,e[3]=l,e[4]=n,e[5]=c):c=e[5],e[6]!==c||e[7]!==r?(d=s.jsx(po,{className:r,children:c}),e[6]=c,e[7]=r,e[8]=d):d=e[8],e[9]!==o?(u=s.jsx(go,{wrapperClassName:"flex flex-col gap-4",children:o}),e[9]=o,e[10]=u):u=e[10],e[11]!==i||e[12]!==d||e[13]!==u?(g=s.jsxs(mo,{value:i,children:[d,u]}),e[11]=i,e[12]=d,e[13]=u,e[14]=g):g=e[14],g},qc=t=>{const e=U.c(88),{form:n,config:r}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Me(),e[0]=i):i=e[0];const o=i;let a;e[1]!==n?(a=ke=>!!n.getValues(ke),e[1]=n,e[2]=a):a=e[2];const l=a;let c,d;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(te,{className:"inline",children:"marimo.toml"}),e[3]=c):c=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsxs("p",{className:"text-sm text-muted-secondary",children:["Add your API keys below or to ",c," ","to set up a provider for the Code Completion and Assistant features; see"," ",s.jsx(de,{href:"https://docs.marimo.io/guides/editor_features/ai_completion/#connecting-to-an-llm",children:"docs"})," ","for more info."]}),e[4]=d):d=e[4];const u=l("ai.open_ai.api_key");let g,f,m,h;e[5]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsxs(s.Fragment,{children:["Your OpenAI API key from"," ",s.jsx(de,{href:"https://platform.openai.com/account/api-keys",children:"platform.openai.com"}),"."]}),e[5]=g):g=e[5],e[6]!==r||e[7]!==n?(f=s.jsx(ze,{form:n,config:r,name:"ai.open_ai.api_key",placeholder:"sk-proj...",testId:"ai-openai-api-key-input",description:g}),m=s.jsx(lt,{form:n,config:r,name:"ai.open_ai.base_url",placeholder:"https://api.openai.com/v1",testId:"ai-base-url-input",disabled:o}),e[6]=r,e[7]=n,e[8]=f,e[9]=m):(f=e[8],m=e[9]),e[10]!==u||e[11]!==f||e[12]!==m?(h=s.jsxs(Ae,{title:"OpenAI",provider:"openai",triggerClassName:"pt-0",isConfigured:u,children:[f,m]}),e[10]=u,e[11]=f,e[12]=m,e[13]=h):h=e[13];const p=l("ai.anthropic.api_key");let v,x,b;e[14]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsxs(s.Fragment,{children:["Your Anthropic API key from"," ",s.jsx(de,{href:"https://console.anthropic.com/settings/keys",children:"console.anthropic.com"}),"."]}),e[14]=v):v=e[14],e[15]!==r||e[16]!==n?(x=s.jsx(ze,{form:n,config:r,name:"ai.anthropic.api_key",placeholder:"sk-ant...",testId:"ai-anthropic-api-key-input",description:v}),e[15]=r,e[16]=n,e[17]=x):x=e[17],e[18]!==p||e[19]!==x?(b=s.jsx(Ae,{title:"Anthropic",provider:"anthropic",isConfigured:p,children:x}),e[18]=p,e[19]=x,e[20]=b):b=e[20];const j=l("ai.google.api_key");let O,w,k;e[21]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsxs(s.Fragment,{children:["Your Google AI API key from"," ",s.jsx(de,{href:"https://aistudio.google.com/app/apikey",children:"aistudio.google.com"}),"."]}),e[21]=O):O=e[21],e[22]!==r||e[23]!==n?(w=s.jsx(ze,{form:n,config:r,name:"ai.google.api_key",placeholder:"AI...",testId:"ai-google-api-key-input",description:O}),e[22]=r,e[23]=n,e[24]=w):w=e[24],e[25]!==j||e[26]!==w?(k=s.jsx(Ae,{title:"Google",provider:"google",isConfigured:j,children:w}),e[25]=j,e[26]=w,e[27]=k):k=e[27];const N=l("ai.ollama.base_url");let R,A;e[28]!==r||e[29]!==n?(R=s.jsx(lt,{form:n,config:r,name:"ai.ollama.base_url",placeholder:"http://localhost:11434/v1",defaultValue:"http://localhost:11434/v1",testId:"ollama-base-url-input"}),e[28]=r,e[29]=n,e[30]=R):R=e[30],e[31]!==N||e[32]!==R?(A=s.jsx(Ae,{title:"Ollama",provider:"ollama",isConfigured:N,children:R}),e[31]=N,e[32]=R,e[33]=A):A=e[33];const H=l("ai.github.api_key");let V,J,ee,Z;e[34]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsxs(s.Fragment,{children:["Your GitHub API token from"," ",s.jsx(te,{className:"inline",children:"gh auth token"}),"."]}),e[34]=V):V=e[34],e[35]!==r||e[36]!==n?(J=s.jsx(ze,{form:n,config:r,name:"ai.github.api_key",placeholder:"ghp_...",testId:"ai-github-api-key-input",description:V}),ee=s.jsx(lt,{form:n,config:r,name:"ai.github.base_url",placeholder:"https://api.githubcopilot.com/",testId:"ai-github-base-url-input"}),e[35]=r,e[36]=n,e[37]=J,e[38]=ee):(J=e[37],ee=e[38]),e[39]!==H||e[40]!==J||e[41]!==ee?(Z=s.jsxs(Ae,{title:"GitHub",provider:"github",isConfigured:H,children:[J,ee]}),e[39]=H,e[40]=J,e[41]=ee,e[42]=Z):Z=e[42];const ne=l("ai.azure.api_key")&&l("ai.azure.base_url");let K,W,G,Y;e[43]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsxs(s.Fragment,{children:["Your Azure API key from"," ",s.jsx(de,{href:"https://portal.azure.com/",children:"portal.azure.com"}),"."]}),e[43]=K):K=e[43],e[44]!==r||e[45]!==n?(W=s.jsx(ze,{form:n,config:r,name:"ai.azure.api_key",placeholder:"sk-proj...",testId:"ai-azure-api-key-input",description:K}),G=s.jsx(lt,{form:n,config:r,name:"ai.azure.base_url",placeholder:"https://<your-resource-name>.openai.azure.com",testId:"ai-azure-base-url-input"}),e[44]=r,e[45]=n,e[46]=W,e[47]=G):(W=e[46],G=e[47]),e[48]!==ne||e[49]!==W||e[50]!==G?(Y=s.jsxs(Ae,{title:"Azure",provider:"azure",isConfigured:ne,children:[W,G]}),e[48]=ne,e[49]=W,e[50]=G,e[51]=Y):Y=e[51];const se=l("ai.bedrock.region_name");let C,y,I,ae,fe,pe;e[52]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsxs("p",{className:"text-sm text-muted-secondary mb-2",children:["To use AWS Bedrock, you need to configure AWS credentials and region. See the"," ",s.jsx(de,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html#aws-bedrock",children:"documentation"})," ","for more details."]}),e[52]=C):C=e[52],e[53]!==r?(y=ke=>{const{field:X}=ke;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:$e,children:[s.jsx(D,{children:"AWS Region"}),s.jsx(_,{children:s.jsx(me,{"data-testid":"bedrock-region-select",onChange:Te=>X.onChange(Te.target.value),value:typeof X.value=="string"?X.value:"us-east-1",disabled:X.disabled,className:"inline-flex mr-2",children:Lc.map(Gc)})}),s.jsx(M,{}),s.jsx(z,{userConfig:r,name:"ai.bedrock.region_name"})]}),s.jsx(F,{children:"The AWS region where Bedrock service is available."})]})},e[53]=r,e[54]=y):y=e[54],e[55]!==n.control||e[56]!==y?(I=s.jsx(T,{control:n.control,disabled:o,name:"ai.bedrock.region_name",render:y}),e[55]=n.control,e[56]=y,e[57]=I):I=e[57],e[58]!==r?(ae=ke=>{const{field:X}=ke;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:$e,children:[s.jsx(D,{children:"AWS Profile Name (Optional)"}),s.jsx(_,{children:s.jsx(Pe,{"data-testid":"bedrock-profile-input",rootClassName:"flex-1",className:"m-0 inline-flex h-7",placeholder:"default",...X,value:X.value||""})}),s.jsx(M,{}),s.jsx(z,{userConfig:r,name:"ai.bedrock.profile_name"})]}),s.jsx(F,{children:"The AWS profile name from your ~/.aws/credentials file. Leave blank to use your default AWS credentials."})]})},e[58]=r,e[59]=ae):ae=e[59],e[60]!==n.control||e[61]!==ae?(fe=s.jsx(T,{control:n.control,disabled:o,name:"ai.bedrock.profile_name",render:ae}),e[60]=n.control,e[61]=ae,e[62]=fe):fe=e[62],e[63]!==se||e[64]!==I||e[65]!==fe?(pe=s.jsxs(Ae,{title:"AWS Bedrock",provider:"bedrock",isConfigured:se,children:[C,I,fe]}),e[63]=se,e[64]=I,e[65]=fe,e[66]=pe):pe=e[66];const Oe=l("ai.open_ai_compatible.api_key")&&l("ai.open_ai_compatible.base_url");let Se,Ie,ge,$,B,le;return e[67]===Symbol.for("react.memo_cache_sentinel")?(Se=s.jsx(s.Fragment,{children:"API key for any OpenAI-compatible provider (e.g., Together, Groq, Mistral, Perplexity, etc)."}),e[67]=Se):Se=e[67],e[68]!==r||e[69]!==n?(Ie=s.jsx(ze,{form:n,config:r,name:"ai.open_ai_compatible.api_key",placeholder:"sk-...",testId:"ai-openai-compatible-api-key-input",description:Se}),e[68]=r,e[69]=n,e[70]=Ie):Ie=e[70],e[71]===Symbol.for("react.memo_cache_sentinel")?(ge=s.jsx(s.Fragment,{children:"Base URL for your OpenAI-compatible provider."}),e[71]=ge):ge=e[71],e[72]!==r||e[73]!==n?($=s.jsx(lt,{form:n,config:r,name:"ai.open_ai_compatible.base_url",placeholder:"https://api.together.xyz/v1",testId:"ai-openai-compatible-base-url-input",description:ge}),e[72]=r,e[73]=n,e[74]=$):$=e[74],e[75]!==Oe||e[76]!==Ie||e[77]!==$?(B=s.jsxs(Ae,{title:"OpenAI-Compatible",provider:"openai-compatible",isConfigured:Oe,children:[Ie,$]}),e[75]=Oe,e[76]=Ie,e[77]=$,e[78]=B):B=e[78],e[79]!==b||e[80]!==k||e[81]!==A||e[82]!==Z||e[83]!==Y||e[84]!==pe||e[85]!==B||e[86]!==h?(le=s.jsxs(Tn,{children:[d,s.jsxs(oo,{type:"multiple",children:[h,b,k,A,Z,Y,pe,B]})]}),e[79]=b,e[80]=k,e[81]=A,e[82]=Z,e[83]=Y,e[84]=pe,e[85]=B,e[86]=h,e[87]=le):le=e[87],le},Vc=t=>{const e=U.c(23),{form:n,config:r,onSubmit:i}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=Me(),e[0]=o):o=e[0];const a=o;let l,c,d,u,g,f,m,h,p,v;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Tt,{children:"AI Assistant"}),c=s.jsx(ao,{}),e[1]=l,e[2]=c):(l=e[1],c=e[2]),e[3]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("span",{children:"Model to use for chat conversations in the Chat panel."}),e[3]=d):d=e[3],e[4]!==r||e[5]!==n||e[6]!==i?(u=s.jsx(Dn,{label:"Chat Model",form:n,config:r,name:"ai.models.chat_model",placeholder:ir,testId:"ai-chat-model-input",disabled:a,description:d,onSubmit:i}),e[4]=r,e[5]=n,e[6]=i,e[7]=u):u=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsxs("span",{children:["Model to use for code editing with the"," ",s.jsx(te,{className:"inline",children:"Generate with AI"})," button."]}),e[8]=g):g=e[8],e[9]!==r||e[10]!==n||e[11]!==i?(f=s.jsx(Dn,{label:"Edit Model",form:n,config:r,name:"ai.models.edit_model",placeholder:ir,testId:"ai-edit-model-input",disabled:a,description:g,onSubmit:i}),e[9]=r,e[10]=n,e[11]=i,e[12]=f):f=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsxs("ul",{className:"bg-muted p-2 rounded-md list-disc space-y-1 pl-6",children:[s.jsx("li",{className:"text-xs text-muted-secondary",children:'Models should include the provider name and model name separated by a slash. For example, "anthropic/claude-3-5-sonnet-latest" or "google/gemini-2.0-flash-exp"'}),s.jsx("li",{className:"text-xs text-muted-secondary",children:"Depending on the provider, we will use the respective API key and additional configuration."})]}),e[13]=m):m=e[13],e[14]!==r?(h=x=>{const{field:b}=x;return s.jsxs("div",{className:"flex flex-col",children:[s.jsxs(E,{children:[s.jsx(D,{children:"Custom Rules"}),s.jsx(_,{children:s.jsx(lo,{"data-testid":"ai-rules-input",className:"m-0 inline-flex w-full h-32 p-2 text-sm",placeholder:"e.g. Always use type hints; prefer polars over pandas",...b,value:b.value})}),s.jsx(M,{}),s.jsx(z,{userConfig:r,name:"ai.rules"})]}),s.jsx(F,{children:"Custom rules to include in all AI completion prompts."})]})},e[14]=r,e[15]=h):h=e[15],e[16]!==n.control||e[17]!==h?(p=s.jsx(T,{control:n.control,name:"ai.rules",render:h}),e[16]=n.control,e[17]=h,e[18]=p):p=e[18],e[19]!==p||e[20]!==u||e[21]!==f?(v=s.jsxs(Tn,{children:[l,c,u,f,m,p]}),e[19]=p,e[20]=u,e[21]=f,e[22]=v):v=e[22],v},Bc=t=>{const e=U.c(12),{form:n,config:r,onSubmit:i}=t;let o,a,l,c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs(tr,{className:"mb-2",children:[s.jsx(Ht,{value:"ai-features",children:"AI Features"}),s.jsx(Ht,{value:"ai-providers",children:"AI Providers"})]}),e[0]=o):o=e[0],e[1]!==r||e[2]!==n||e[3]!==i?(a=s.jsxs(nr,{value:"ai-features",children:[s.jsx(Uc,{form:n,config:r,onSubmit:i}),s.jsx(Vc,{form:n,config:r,onSubmit:i})]}),e[1]=r,e[2]=n,e[3]=i,e[4]=a):a=e[4],e[5]!==r||e[6]!==n||e[7]!==i?(l=s.jsx(nr,{value:"ai-providers",children:s.jsx(qc,{form:n,config:r,onSubmit:i})}),e[5]=r,e[6]=n,e[7]=i,e[8]=l):l=e[8],e[9]!==a||e[10]!==l?(c=s.jsxs(rr,{defaultValue:"ai-features",children:[o,a,l]}),e[9]=a,e[10]=l,e[11]=c):c=e[11],c};function Wc(t){return s.jsx("option",{value:t,children:t},t)}function Gc(t){return s.jsx("option",{value:t,children:t},t)}const ys=[{id:"sql",packagesRequired:[{name:"duckdb"},{name:"sqlglot"}],additionalPackageInstalls:[{name:"polars[pyarrow]"}],description:"SQL cells"},{id:"charts",packagesRequired:[{name:"altair"}],additionalPackageInstalls:[],description:"Charts in datasource viewer"},{id:"fast-charts",packagesRequired:[{name:"vegafusion"},{name:"vl-convert-python"}],additionalPackageInstalls:[],description:"Fast server-side charts"},{id:"formatting",packagesRequired:[Me()?{name:"black"}:{name:"ruff"}],additionalPackageInstalls:[],description:"Formatting"},{id:"ai",packagesRequired:[{name:"openai"}],additionalPackageInstalls:[],description:"AI features"},{id:"ipy-export",packagesRequired:[{name:"nbformat"}],additionalPackageInstalls:[],description:"Export as IPYNB"},{id:"testing",packagesRequired:[{name:"pytest"}],additionalPackageInstalls:[],description:"Autorun unit tests"}];Me()||ys.push({id:"lsp",packagesRequired:[{name:"python-lsp-server"},{name:"websockets"}],additionalPackageInstalls:[{name:"python-lsp-ruff"}],description:"Language Server Protocol*"});const Kc=()=>{const t=U.c(23),[e]=Gn(),n=e.package_management.manager,{getPackageList:r}=He();let i,o;t[0]!==r?(i=()=>r(),t[0]=r,t[1]=i):i=t[1],t[2]!==n?(o=[n],t[2]=n,t[3]=o):o=t[3];const{data:a,error:l,refetch:c,isPending:d}=yo(i,o);if(d){let w;return t[4]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(or,{size:"medium",centered:!0}),t[4]=w):w=t[4],w}if(l){let w;return t[5]!==l?(w=s.jsx(bo,{error:l}),t[5]=l,t[6]=w):w=t[6],w}let u;t[7]!==(a==null?void 0:a.packages)?(u=(a==null?void 0:a.packages)||[],t[7]=a==null?void 0:a.packages,t[8]=u):u=t[8];const g=u;let f;t[9]!==g?(f=new Set(g.map($c)),t[9]=g,t[10]=f):f=t[10];const m=f;let h,p,v,x,b,j,O;return t[11]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Tt,{children:"Optional Features"}),t[11]=h):h=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsxs("p",{className:"text-sm text-muted-foreground",children:["marimo is lightweight, with few dependencies, to maximize compatibility with your own environments.",s.jsx("br",{}),"To unlock additional features in the marimo editor, you can install these optional dependencies:"]}),t[12]=p):p=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(jo,{children:s.jsxs(sr,{children:[s.jsx(yt,{children:"Dependency"}),s.jsx(yt,{children:"Feature"}),s.jsx(yt,{children:"Status"}),s.jsx(yt,{})]})}),t[13]=v):v=t[13],t[14]!==m||t[15]!==n||t[16]!==c?(x=ys.map(w=>{const k=w.packagesRequired.every(R=>m.has(R.name.split("[")[0])),N=w.packagesRequired.map(Xc).join(", ");return s.jsxs(sr,{className:"text-sm",children:[s.jsx(Ut,{children:w.description}),s.jsx(Ut,{className:"font-mono text-xs",children:N}),s.jsx(Ut,{children:k?s.jsxs("div",{className:"flex items-center",children:[s.jsx(cr,{className:"h-4 w-4 text-(--grass-10) mr-2"}),s.jsx("span",{children:"Installed"})]}):s.jsxs("div",{className:"flex items-center",children:[s.jsx(xo,{className:"h-4 w-4 text-(--red-10) mr-2"}),s.jsx(Yc,{packageSpecs:[...w.packagesRequired,...w.additionalPackageInstalls],packageManager:n,onSuccess:c})]})})]},w.id)}),t[14]=m,t[15]=n,t[16]=c,t[17]=x):x=t[17],t[18]!==x?(b=s.jsxs(wo,{children:[v,s.jsx(So,{children:x})]}),t[18]=x,t[19]=b):b=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("p",{className:"text-muted-foreground mt-2",children:"*Requires server restart"}),t[20]=j):j=t[20],t[21]!==b?(O=s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden gap-2",children:[h,p,b,j]}),t[21]=b,t[22]=O):O=t[22],O},Yc=({packageSpecs:t,packageManager:e,onSuccess:n})=>{const[r,i]=Xe.useState(!1),{addPackage:o}=He();return s.jsxs(ye,{size:"xs",variant:"outline",className:Lt("text-xs",r&&"opacity-50 cursor-not-allowed"),onClick:async()=>{try{i(!0);const a=t.map(c=>c.minVersion?`${c.name}>=${c.minVersion}`:c.name).join(" "),l=await o({package:a});l.success?(n(),Ue({title:"Package installed",description:s.jsxs("span",{children:["The packages"," ",s.jsx(te,{className:"inline",children:t.map(c=>c.name).join(", ")})," ","have been added to your environment."]})})):Ue({title:"Failed to install package",description:l.error,variant:"danger"})}finally{i(!1)}},disabled:r,children:[r?s.jsx(or,{size:"small",className:"mr-2 h-3 w-3"}):s.jsx(lr,{className:"mr-2 h-3 w-3"}),"Install with ",e]})};function $c(t){return t.name}function Xc(t){return t.name}const q="flex flex-row items-center space-x-1 space-y-0",xs=[{id:"editor",label:"Editor",Icon:$n,className:"bg-(--blue-4)"},{id:"display",label:"Display",Icon:Ko,className:"bg-(--grass-4)"},{id:"packageManagement",label:"Package Management",Icon:Yo,className:"bg-(--red-4)"},{id:"runtime",label:"Runtime",Icon:dr,className:"bg-(--amber-4)"},{id:"ai",label:"AI",Icon:Uo,className:"bg-[linear-gradient(45deg,var(--purple-5),var(--cyan-5))]"},{id:"optionalDeps",label:"Optional Dependencies",Icon:ur,className:"bg-(--orange-4)"},{id:"labs",label:"Labs",Icon:qo,className:"bg-(--slate-4)"}],bs=Qe(xs[0].id),Qc=()=>{const t=U.c(47),[e,n]=er(),r=S.useRef(null),i=qt(Nn),[o,a]=Je(bs),l=pt(Io),c=pt(Co),{saveUserConfig:d}=He();let u,g;t[0]===Symbol.for("react.memo_cache_sentinel")?(u=Pn(Oo),t[0]=u):u=t[0],t[1]!==e?(g={resolver:u,defaultValues:e},t[1]=e,t[2]=g):g=t[2];const f=An(g);let m;t[3]!==d||t[4]!==n?(m=async C=>{await d({config:C}).then(()=>{n(C)})},t[3]=d,t[4]=n,t[5]=m):m=t[5];const h=m;let p;t[6]===Symbol.for("react.memo_cache_sentinel")?(p=Me(),t[6]=p):p=t[6];const v=p,x=S.useId(),b=S.useId();let j;t[7]!==o||t[8]!==l||t[9]!==e||t[10]!==f||t[11]!==x||t[12]!==b||t[13]!==h||t[14]!==a||t[15]!==i?(j=()=>{switch(o){case"editor":return s.jsxs(s.Fragment,{children:[s.jsxs(De,{title:"Autosave",children:[s.jsx(T,{control:f.control,name:"save.autosave",render:C=>{const{field:y}=C;return s.jsxs(E,{className:q,children:[s.jsx(D,{className:"font-normal",children:"Autosave enabled"}),s.jsx(_,{children:s.jsx(re,{"data-testid":"autosave-checkbox",checked:y.value==="after_delay",disabled:y.disabled,onCheckedChange:I=>{y.onChange(I?"after_delay":"off")}})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"save.autosave"})]})}}),s.jsx(T,{control:f.control,name:"save.autosave_delay",render:C=>{const{field:y}=C;return s.jsxs(E,{className:q,children:[s.jsx(D,{children:"Autosave delay (seconds)"}),s.jsx(_,{children:s.jsx(Ze,{"aria-label":"Autosave delay","data-testid":"autosave-delay-input",className:"m-0 w-24",isDisabled:f.getValues("save.autosave")!=="after_delay",...y,value:y.value/1e3,minValue:1,onChange:I=>{y.onChange(1e3*I),Number.isNaN(I)||h(f.getValues())}})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"save.autosave_delay"})]})}}),s.jsx(T,{control:f.control,name:"runtime.default_auto_download",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:q,children:[s.jsx(D,{children:"Save cell outputs as"}),s.jsx(_,{children:s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(re,{id:x,checked:Array.isArray(y.value)&&y.value.includes("html"),onCheckedChange:()=>{const I=Array.isArray(y.value)?y.value:[];y.onChange(dt(I,"html"))}}),s.jsx(D,{htmlFor:x,children:"HTML"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(re,{id:b,checked:Array.isArray(y.value)&&y.value.includes("ipynb"),onCheckedChange:()=>{const I=Array.isArray(y.value)?y.value:[];y.onChange(dt(I,"ipynb"))}}),s.jsx(D,{htmlFor:b,children:"IPYNB"})]})]})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"runtime.default_auto_download"})]}),s.jsxs(F,{children:["When enabled, marimo will periodically save notebooks in your selected formats (HTML, IPYNB) to a folder named"," ",s.jsx(te,{className:"inline",children:"__marimo__"})," next to your notebook file."]})]})}})]}),s.jsxs(De,{title:"Formatting",children:[s.jsx(T,{control:f.control,name:"save.format_on_save",render:C=>{const{field:y}=C;return s.jsxs(E,{className:q,children:[s.jsx(D,{className:"font-normal",children:"Format on save"}),s.jsx(_,{children:s.jsx(re,{"data-testid":"format-on-save-checkbox",checked:y.value,disabled:y.disabled,onCheckedChange:I=>{y.onChange(I)}})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"save.format_on_save"})]})}}),s.jsx(T,{control:f.control,name:"formatting.line_length",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:q,children:[s.jsx(D,{children:"Line length"}),s.jsx(_,{children:s.jsx(Ze,{"aria-label":"Line length","data-testid":"line-length-input",className:"m-0 w-24",...y,value:y.value,minValue:1,maxValue:1e3,onChange:I=>{y.onChange(I),Number.isNaN(I)||h(f.getValues())}})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"formatting.line_length"})]}),s.jsx(F,{children:"Maximum line length when formatting code."})]})}})]}),s.jsx(De,{title:"Autocomplete",children:s.jsx(T,{control:f.control,name:"completion.activate_on_typing",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:q,children:[s.jsx(D,{className:"font-normal",children:"Autocomplete"}),s.jsx(_,{children:s.jsx(re,{"data-testid":"autocomplete-checkbox",checked:y.value,disabled:y.disabled,onCheckedChange:I=>{y.onChange(!!I)}})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"completion.activate_on_typing"})]}),s.jsx(F,{children:"When unchecked, code completion is still available through a hotkey."}),s.jsx("div",{children:s.jsx(ye,{variant:"link",className:"mb-0 px-0",type:"button",onClick:I=>{I.preventDefault(),I.stopPropagation(),a("ai")},children:"Edit AI autocomplete"})})]})}})}),s.jsxs(De,{title:"Language Servers",children:[s.jsxs(F,{children:["See the"," ",s.jsx(de,{href:"https://docs.marimo.io/guides/editor_features/language_server/",children:"docs"})," ","for more information about language server support."]}),s.jsxs(F,{children:[s.jsx("strong",{children:"Note:"})," When using multiple language servers, different features may conflict."]}),s.jsx(T,{control:f.control,name:"language_servers.pylsp.enabled",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(E,{className:q,children:[s.jsxs(D,{children:[s.jsx(xt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"Python Language Server (",s.jsx(de,{href:"https://github.com/python-lsp/python-lsp-server",children:"docs"}),")"]}),s.jsx(_,{children:s.jsx(re,{"data-testid":"pylsp-checkbox",checked:y.value,disabled:y.disabled,onCheckedChange:I=>{y.onChange(!!I)}})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"language_servers.pylsp.enabled"})]}),y.value&&!l.pylsp&&s.jsxs(vt,{kind:"danger",children:["The Python Language Server is not available in your current environment. Please install"," ",s.jsx(te,{className:"inline",children:"python-lsp-server"})," in your environment."]})]})}}),s.jsx(T,{control:f.control,name:"language_servers.basedpyright.enabled",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(E,{className:q,children:[s.jsxs(D,{children:[s.jsx(xt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"basedpyright (",s.jsx(de,{href:"https://github.com/DetachHead/basedpyright",children:"docs"}),")"]}),s.jsx(_,{children:s.jsx(re,{"data-testid":"basedpyright-checkbox",checked:y.value,disabled:y.disabled,onCheckedChange:I=>{y.onChange(!!I)}})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"language_servers.basedpyright.enabled"})]}),y.value&&!l.basedpyright&&s.jsxs(vt,{kind:"danger",children:["basedpyright is not available in your current environment. Please install"," ",s.jsx(te,{className:"inline",children:"basedpyright"})," in your environment."]})]})}}),s.jsx(T,{control:f.control,name:"language_servers.ty.enabled",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(E,{className:q,children:[s.jsxs(D,{children:[s.jsx(xt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"ty (",s.jsx(de,{href:"https://github.com/astral-sh/ty",children:"docs"}),")"]}),s.jsx(_,{children:s.jsx(re,{"data-testid":"ty-checkbox",checked:y.value,disabled:y.disabled,onCheckedChange:I=>{y.onChange(!!I)}})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"language_servers.ty.enabled"})]}),y.value&&!l.ty&&s.jsxs(vt,{kind:"danger",children:["ty is not available in your current environment. Please install ",s.jsx(te,{className:"inline",children:"ty"})," in your environment."]})]})}}),s.jsx(T,{control:f.control,name:"diagnostics.enabled",render:C=>{const{field:y}=C;return s.jsxs(E,{className:q,children:[s.jsxs(D,{children:[s.jsx(xt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"Diagnostics"]}),s.jsx(_,{children:s.jsx(re,{"data-testid":"diagnostics-checkbox",checked:y.value,disabled:y.disabled,onCheckedChange:I=>{y.onChange(!!I)}})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"diagnostics.enabled"})]})}})]}),s.jsxs(De,{title:"Keymap",children:[s.jsx(T,{control:f.control,name:"keymap.preset",render:C=>{const{field:y}=C;return s.jsx("div",{className:"flex flex-col space-y-1",children:s.jsxs(E,{className:q,children:[s.jsx(D,{children:"Keymap"}),s.jsx(_,{children:s.jsx(me,{"data-testid":"keymap-select",onChange:I=>y.onChange(I.target.value),value:y.value,disabled:y.disabled,className:"inline-flex mr-2",children:Ic.map(Jc)})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"keymap.preset"})]})})}}),s.jsx(T,{control:f.control,name:"keymap.destructive_delete",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:q,children:[s.jsx(D,{className:"font-normal",children:"Destructive delete"}),s.jsx(_,{children:s.jsx(re,{"data-testid":"destructive-delete-checkbox",checked:y.value,disabled:y.disabled,onCheckedChange:I=>{y.onChange(!!I)}})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"keymap.destructive_delete"})]}),s.jsxs(F,{className:"flex items-center gap-1",children:["Allow deleting non-empty cells",s.jsx(Ve,{content:s.jsxs("div",{className:"max-w-xs",children:[s.jsx("strong",{children:"Use with caution:"})," Deleting cells with code can lose work and computed results since variables are removed from memory."]}),children:s.jsx(Do,{className:"w-3 h-3 text-(--amber-11)"})})]}),s.jsx("div",{children:s.jsx(ye,{variant:"link",className:"mb-0 px-0",type:"button",onClick:I=>{I.preventDefault(),I.stopPropagation(),i(!0)},children:"Edit Keyboard Shortcuts"})})]})}})]})]});case"display":return s.jsxs(s.Fragment,{children:[s.jsxs(De,{title:"Display",children:[s.jsx(T,{control:f.control,name:"display.default_width",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:q,children:[s.jsx(D,{children:"Default width"}),s.jsx(_,{children:s.jsx(me,{"data-testid":"user-config-width-select",onChange:I=>y.onChange(I.target.value),value:y.value,disabled:y.disabled,className:"inline-flex mr-2",children:["compact","medium","full","columns"].map(Zc)})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"display.default_width"})]}),s.jsx(F,{children:'The default app width for new notebooks; overridden by "width" in the application config.'})]})}}),s.jsx(T,{control:f.control,name:"display.theme",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:q,children:[s.jsx(D,{children:"Theme"}),s.jsx(_,{children:s.jsx(me,{"data-testid":"theme-select",onChange:I=>y.onChange(I.target.value),value:y.value,disabled:y.disabled,className:"inline-flex mr-2",children:No.map(ed)})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"display.theme"})]}),s.jsx(F,{children:"This theme will be applied to the user's configuration; it does not affect theme when sharing the notebook."})]})}}),s.jsx(T,{control:f.control,name:"display.code_editor_font_size",render:C=>{const{field:y}=C;return s.jsxs(E,{className:q,children:[s.jsx(D,{children:"Code editor font size (px)"}),s.jsx(_,{children:s.jsx("span",{className:"inline-flex mr-2",children:s.jsx(Ze,{"aria-label":"Code editor font size","data-testid":"code-editor-font-size-input",className:"m-0 w-24",...y,value:y.value,minValue:8,maxValue:32,onChange:I=>{y.onChange(I),h(f.getValues())}})})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"display.code_editor_font_size"})]})}}),s.jsx(T,{control:f.control,name:"display.reference_highlighting",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:q,children:[s.jsx(D,{children:"Reference highlighting"}),s.jsx(_,{children:s.jsx(re,{"data-testid":"reference-highlighting-checkbox",checked:y.value,onCheckedChange:y.onChange})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"display.reference_highlighting"})]}),s.jsx(F,{children:"Visually emphasizes variables in a cell that are defined elsewhere in the notebook."})]})}})]}),s.jsxs(De,{title:"Outputs",children:[s.jsx(T,{control:f.control,name:"display.cell_output",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:q,children:[s.jsx(D,{children:"Cell output area"}),s.jsx(_,{children:s.jsx(me,{"data-testid":"cell-output-select",onChange:I=>y.onChange(I.target.value),value:y.value,disabled:y.disabled,className:"inline-flex mr-2",children:["above","below"].map(td)})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"display.cell_output"})]}),s.jsx(F,{children:"Where to display cell's output."})]})}}),s.jsx(T,{control:f.control,name:"display.dataframes",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:q,children:[s.jsx(D,{children:"Dataframe viewer"}),s.jsx(_,{children:s.jsx(me,{"data-testid":"display-dataframes-select",onChange:I=>y.onChange(I.target.value),value:y.value,disabled:y.disabled,className:"inline-flex mr-2",children:["rich","plain"].map(nd)})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"display.dataframes"})]}),s.jsx(F,{children:"Whether to use marimo's rich dataframe viewer or a plain HTML table. This requires restarting your notebook to take effect."})]})}}),s.jsx(T,{control:f.control,name:"display.default_table_page_size",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:q,children:[s.jsx(D,{children:"Default table page size"}),s.jsx(_,{children:s.jsx(Ze,{"aria-label":"Default table page size","data-testid":"default-table-page-size-input",className:"m-0 w-24",...y,value:y.value,minValue:1,step:1,onChange:I=>{y.onChange(I),Number.isNaN(I)||h(f.getValues())}})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"display.default_table_page_size"})]}),s.jsx(F,{children:"The default number of rows displayed in dataframes and SQL results."})]})}}),s.jsx(T,{control:f.control,name:"display.default_table_max_columns",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:q,children:[s.jsx(D,{children:"Default table max columns"}),s.jsx(_,{children:s.jsx(Ze,{"aria-label":"Default table max columns","data-testid":"default-table-max-columns-input",className:"m-0 w-24",...y,value:y.value,minValue:1,step:1,onChange:I=>{y.onChange(I),Number.isNaN(I)||h(f.getValues())}})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"display.default_table_max_columns"})]}),s.jsx(F,{children:"The default maximum number of columns displayed in dataframes and SQL results."})]})}})]})]});case"packageManagement":return s.jsx(De,{title:"Package Management",children:s.jsx(T,{control:f.control,disabled:v,name:"package_management.manager",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:q,children:[s.jsx(D,{children:"Manager"}),s.jsx(_,{children:s.jsx(me,{"data-testid":"package-manager-select",onChange:I=>y.onChange(I.target.value),value:y.value,disabled:y.disabled,className:"inline-flex mr-2",children:ko.map(rd)})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"package_management.manager"})]}),s.jsxs(F,{children:["When marimo comes across a module that is not installed, you will be prompted to install it using your preferred package manager. Learn more in the"," ",s.jsx(de,{href:"https://docs.marimo.io/guides/editor_features/package_management.html",children:"docs"}),".",s.jsx("br",{}),s.jsx("br",{}),"Running marimo in a"," ",s.jsx(de,{href:"https://docs.marimo.io/guides/editor_features/package_management.html#running-marimo-in-a-sandbox-environment-uv-only",children:"sandboxed environment"})," ","is only supported by ",s.jsx(te,{className:"inline",children:"uv"})]})]})}})});case"runtime":return s.jsxs(De,{title:"Runtime configuration",children:[s.jsx(T,{control:f.control,name:"runtime.auto_instantiate",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:q,children:[s.jsx(D,{className:"font-normal",children:"Autorun on startup"}),s.jsx(_,{children:s.jsx(re,{"data-testid":"auto-instantiate-checkbox",disabled:y.disabled,checked:y.value,onCheckedChange:y.onChange})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"runtime.auto_instantiate"})]}),s.jsx(F,{children:"Whether to automatically run all cells on startup."})]})}}),s.jsx(T,{control:f.control,name:"runtime.on_cell_change",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:q,children:[s.jsx(D,{className:"font-normal",children:"On cell change"}),s.jsx(_,{children:s.jsx(me,{"data-testid":"on-cell-change-select",onChange:I=>y.onChange(I.target.value),value:y.value,className:"inline-flex mr-2",children:["lazy","autorun"].map(id)})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"runtime.on_cell_change"})]}),s.jsx(F,{children:`Whether marimo should automatically run cells or just mark them as stale. If "autorun", marimo will automatically run affected cells when a cell is run or a UI element is interacted with; if "lazy", marimo will mark affected cells as stale but won't re-run them.`})]})}}),s.jsx(T,{control:f.control,name:"runtime.auto_reload",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:q,children:[s.jsx(D,{className:"font-normal",children:"On module change"}),s.jsx(_,{children:s.jsx(me,{"data-testid":"auto-reload-select",onChange:I=>y.onChange(I.target.value),value:y.value,disabled:v,className:"inline-flex mr-2",children:["off","lazy","autorun"].map(sd)})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"runtime.auto_reload"})]}),s.jsx(F,{children:'Whether marimo should automatically reload modules before executing cells. If "lazy", marimo will mark cells affected by module modifications as stale; if "autorun", affected cells will be automatically re-run.'})]})}}),s.jsx(T,{control:f.control,name:"runtime.default_sql_output",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:q,children:[s.jsx(D,{children:"Default SQL output"}),s.jsx(_,{children:s.jsx(me,{"data-testid":"user-config-sql-output-select",onChange:I=>y.onChange(I.target.value),value:y.value,disabled:y.disabled,className:"inline-flex mr-2",children:es.map(od)})}),s.jsx(M,{}),s.jsx(z,{userConfig:e,name:"runtime.default_sql_output"})]}),s.jsx(F,{children:'The default SQL output type for new notebooks; overridden by "sql_output" in the application config.'})]})}}),s.jsx(T,{control:f.control,name:"runtime.reactive_tests",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:q,children:[s.jsx(D,{className:"font-normal",children:"Autorun Unit Tests"}),s.jsx(_,{children:s.jsx(re,{"data-testid":"reactive-test-checkbox",checked:y.value,onCheckedChange:y.onChange})})]}),s.jsx(z,{userConfig:e,name:"runtime.reactive_tests"}),s.jsx(M,{}),s.jsx(F,{children:"Enable reactive pytest tests in notebook. When a cell contains only test functions (test_*) and classes (Test_*), marimo will automatically run them with pytest (requires notebook restart)."})," "]})}}),s.jsxs(F,{children:["Learn more in the"," ",s.jsx(de,{href:"https://docs.marimo.io/guides/reactivity/#configuring-how-marimo-runs-cells",children:"docs"}),"."]})]});case"ai":return s.jsx(Bc,{form:f,config:e,onSubmit:h});case"optionalDeps":return s.jsx(Kc,{});case"labs":return s.jsxs(De,{title:"Experimental Features",children:[s.jsx("p",{className:"text-sm text-muted-secondary mb-4",children:"\u26A0\uFE0F These features are experimental and may require restarting your notebook to take effect."}),s.jsx(T,{control:f.control,name:"experimental.inline_ai_tooltip",render:ad}),s.jsx(T,{control:f.control,name:"experimental.rtc_v2",render:ld}),s.jsx(T,{control:f.control,name:"experimental.performant_table_charts",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:q,children:[s.jsx(D,{className:"font-normal",children:"Performant Table Charts"}),s.jsx(_,{children:s.jsx(re,{"data-testid":"performant-table-charts-checkbox",checked:y.value===!0,onCheckedChange:y.onChange})})]}),s.jsx(z,{userConfig:e,name:"experimental.performant_table_charts"}),s.jsx(F,{children:"Enable experimental table charts which are computed on the backend."})]})}}),s.jsx(T,{control:f.control,name:"experimental.sql_linter",render:C=>{const{field:y}=C;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:q,children:[s.jsx(D,{className:"font-normal",children:"SQL Linter"}),s.jsx(_,{children:s.jsx(re,{"data-testid":"sql-linter-checkbox",checked:y.value===!0,onCheckedChange:y.onChange})})]}),s.jsx(z,{userConfig:e,name:"experimental.sql_linter"}),s.jsx(F,{children:"Enable experimental SQL linting and autocompletion."})]})}})]})}},t[7]=o,t[8]=l,t[9]=e,t[10]=f,t[11]=x,t[12]=b,t[13]=h,t[14]=a,t[15]=i,t[16]=j):j=t[16];const O=j;let w,k,N;t[17]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(te,{className:"inline",children:"marimo.toml"}),k=s.jsx("br",{}),t[17]=w,t[18]=k):(w=t[17],k=t[18]),t[19]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsxs("p",{className:"text-muted-secondary",children:["User configuration is stored in ",w,k,"Run ",s.jsx(te,{className:"inline",children:"marimo config show"})," in your terminal to show your current configuration and file location."]}),t[19]=N):N=t[19];const R=N;let A,H,V,J,ee,Z,ne,K,W,G,Y,se;return t[20]!==f||t[21]!==h?(A=f.handleSubmit(h),t[20]=f,t[21]=h,t[22]=A):A=t[22],t[23]!==a?(H=C=>a(C),t[23]=a,t[24]=H):H=t[24],t[25]===Symbol.for("react.memo_cache_sentinel")?(V=xs.map(cd),t[25]=V):V=t[25],t[26]!==c?(J=s.jsx("div",{className:"p-2 text-xs text-muted-foreground self-start",children:s.jsxs("span",{children:["Version: ",c]})}),t[26]=c,t[27]=J):J=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx("div",{className:"flex-1"}),Z=!Me()&&R,t[28]=ee,t[29]=Z):(ee=t[28],Z=t[29]),t[30]!==J?(ne=s.jsxs(tr,{className:"self-start max-h-none flex flex-col gap-2 shrink-0 bg-background flex-1 min-h-full",children:[V,J,ee,Z]}),t[30]=J,t[31]=ne):ne=t[31],t[32]!==o||t[33]!==ne||t[34]!==H?(K=s.jsx(rr,{value:o,onValueChange:H,orientation:"vertical",className:"w-1/3 border-r h-full overflow-auto p-3",children:ne}),t[32]=o,t[33]=ne,t[34]=H,t[35]=K):K=t[35],t[36]!==O?(W=O(),t[36]=O,t[37]=W):W=t[37],t[38]!==W?(G=s.jsx("div",{className:"w-2/3 pl-6 gap-2 flex flex-col overflow-auto p-6",children:W}),t[38]=W,t[39]=G):G=t[39],t[40]!==K||t[41]!==G||t[42]!==A?(Y=s.jsxs("form",{ref:r,onChange:A,className:"flex text-pretty overflow-hidden",children:[K,G]}),t[40]=K,t[41]=G,t[42]=A,t[43]=Y):Y=t[43],t[44]!==f||t[45]!==Y?(se=s.jsx(Mn,{...f,children:Y}),t[44]=f,t[45]=Y,t[46]=se):se=t[46],se},De=t=>{const e=U.c(5),{title:n,children:r}=t;let i,o;return e[0]!==n?(i=s.jsx(Tt,{children:n}),e[0]=n,e[1]=i):i=e[1],e[2]!==r||e[3]!==i?(o=s.jsxs("div",{className:"flex flex-col gap-4 pb-4",children:[i,r]}),e[2]=r,e[3]=i,e[4]=o):o=e[4],o};function Jc(t){return s.jsx("option",{value:t,children:t},t)}function Zc(t){return s.jsx("option",{value:t,children:t},t)}function ed(t){return s.jsx("option",{value:t,children:t},t)}function td(t){return s.jsx("option",{value:t,children:t},t)}function nd(t){return s.jsx("option",{value:t,children:t},t)}function rd(t){return s.jsx("option",{value:t,children:t},t)}function id(t){return s.jsx("option",{value:t,children:t},t)}function sd(t){return s.jsx("option",{value:t,children:t},t)}function od(t){return s.jsx("option",{value:t.value,children:t.label},t.value)}function ad(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:q,children:[s.jsx(D,{className:"font-normal",children:"AI Edit Tooltip"}),s.jsx(_,{children:s.jsx(re,{"data-testid":"inline-ai-checkbox",checked:e.value===!0,onCheckedChange:e.onChange})})]}),s.jsx(F,{children:'Enable experimental "Edit with AI" tooltip when selecting code.'})]})}function ld(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:q,children:[s.jsx(D,{className:"font-normal",children:"Real-Time Collaboration"}),s.jsx(_,{children:s.jsx(re,{"data-testid":"rtc-checkbox",checked:e.value===!0,onCheckedChange:e.onChange})})]}),s.jsx(F,{children:"Enable experimental real-time collaboration. This change requires a page refresh to take effect."})]})}function cd(t){return s.jsx(Ht,{value:t.id,className:"w-full text-left p-2 data-[state=active]:bg-primary data-[state=active]:text-primary-foreground justify-start",children:s.jsxs("div",{className:"flex gap-4 items-center text-lg overflow-hidden",children:[s.jsx("span",{className:Lt(t.className,"w-8 h-8 rounded flex items-center justify-center text-muted-foreground shrink-0"),children:s.jsx(t.Icon,{className:"w-4 h-4"})}),s.jsx("span",{className:"truncate",children:t.label})]})},t.id)}const En=Qe(!1);function dd(){const t=U.c(5),e=qt(bs),n=qt(En);let r;t[0]!==e||t[1]!==n?(r=a=>{e(a),n(!0)},t[0]=e,t[1]=n,t[2]=r):r=t[2];const i=r;let o;return t[3]!==i?(o={handleClick:i},t[3]=i,t[4]=o):o=t[4],o}const ud=t=>{const e=U.c(32),{showAppConfig:n,disabled:r,tooltip:i}=t,o=n===void 0||n,a=r!==void 0&&r,l=i===void 0?"Settings":i,[c,d]=Je(En),u=a?"disabled":"hint-green";let g,f,m;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(ar,{strokeWidth:1.8}),e[0]=g):g=e[0],e[1]!==l?(f=s.jsx(Ve,{content:l,children:g}),e[1]=l,e[2]=f):f=e[2],e[3]!==a||e[4]!==u||e[5]!==f?(m=s.jsx(_t,{"aria-label":"Config","data-testid":"app-config-button",shape:"circle",size:"small",className:"h-[27px] w-[27px]",disabled:a,color:u,children:f}),e[3]=a,e[4]=u,e[5]=f,e[6]=m):m=e[6];const h=m;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsxs(Xn,{className:"w-[80vw] h-[70vh] overflow-hidden sm:max-w-5xl top-[15vh] p-0",children:[s.jsx(To,{children:s.jsx(Qn,{children:"User settings"})}),s.jsx(Qc,{})]}),e[7]=p):p=e[7];const v=p;if(!o){let H,V;return e[8]!==h?(H=s.jsx(Eo,{children:h}),e[8]=h,e[9]=H):H=e[9],e[10]!==d||e[11]!==c||e[12]!==H?(V=s.jsxs(zt,{open:c,onOpenChange:d,children:[H,v]}),e[10]=d,e[11]=c,e[12]=H,e[13]=V):V=e[13],V}let x,b,j,O,w,k,N,R,A;return e[14]!==h?(x=s.jsx(_o,{asChild:!0,children:h}),e[14]=h,e[15]=x):x=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(lc,{}),j=s.jsx("div",{className:"h-px bg-border my-2"}),e[16]=b,e[17]=j):(b=e[16],j=e[17]),e[18]!==d?(O=()=>d(!0),e[18]=d,e[19]=O):O=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(ar,{strokeWidth:1.8,className:"w-4 h-4 mr-2"}),e[20]=w):w=e[20],e[21]!==O?(k=s.jsxs(Po,{className:"w-[650px] overflow-auto max-h-[80vh] max-w-[80vw]",align:"end",side:"bottom",onFocusOutside:hd,children:[b,j,s.jsxs(ye,{onClick:O,variant:"link",className:"px-0",children:[w,"User settings"]})]}),e[21]=O,e[22]=k):k=e[22],e[23]!==k||e[24]!==x?(N=s.jsxs(Ao,{children:[x,k]}),e[23]=k,e[24]=x,e[25]=N):N=e[25],e[26]!==d||e[27]!==c?(R=s.jsx(zt,{open:c,onOpenChange:d,children:v}),e[26]=d,e[27]=c,e[28]=R):R=e[28],e[29]!==N||e[30]!==R?(A=s.jsxs(s.Fragment,{children:[N,R]}),e[29]=N,e[30]=R,e[31]=A):A=e[31],A};function hd(t){return t.preventDefault()}const fd=t=>{const e=U.c(15),{description:n,disabled:r,tooltip:i}=t,o=r!==void 0&&r,a=i===void 0?"Shutdown":i,{openConfirm:l,closeModal:c}=Mo(),{sendShutdown:d}=He();let u;e[0]!==d?(u=()=>{d(),setTimeout(pd,200)},e[0]=d,e[1]=u):u=e[1];const g=u;if(Me())return null;const f=o?"disabled":"red";let m,h,p,v;return e[2]!==c||e[3]!==n||e[4]!==g||e[5]!==l?(m=x=>{x.stopPropagation(),l({title:"Shutdown",description:n,variant:"destructive",confirmAction:s.jsx(Ro,{onClick:()=>{g(),c()},"aria-label":"Confirm Shutdown",children:"Shutdown"})})},e[2]=c,e[3]=n,e[4]=g,e[5]=l,e[6]=m):m=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(gt,{strokeWidth:1}),e[7]=h):h=e[7],e[8]!==o||e[9]!==f||e[10]!==m?(p=s.jsx(_t,{"aria-label":"Shutdown","data-testid":"shutdown-button",shape:"circle",size:"small",color:f,className:"h-[27px] w-[27px]",disabled:o,onClick:m,children:h}),e[8]=o,e[9]=f,e[10]=m,e[11]=p):p=e[11],e[12]!==p||e[13]!==a?(v=s.jsx(Ve,{content:a,children:p}),e[12]=p,e[13]=a,e[14]=v):v=e[14],v};function pd(){window.close()}function gd(t){window.open(Lo(`?file=${t}`).toString(),"_blank")}export{zo as A,Ho as B,ud as C,Fc as D,Bo as G,Dc as K,Wo as L,Go as M,$o as P,fd as S,rc as T,Xo as Y,Vo as a,lr as b,_t as c,Mc as d,ot as e,ds as f,sc as g,Cc as h,cs as i,dd as j,Nn as k,as as l,Mt as m,ls as n,gd as o,dr as p,cr as q,Ji as r,En as s,ic as u};
|