@marimo-team/frontend 0.23.7-dev15 → 0.23.7-dev17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/dist/assets/{CellStatus-CN4mKUXv.js → CellStatus-Cb08qBNj.js} +1 -1
  2. package/dist/assets/{ConnectedDataExplorerComponent-DeBM0cl9.js → ConnectedDataExplorerComponent-BEDxXsa0.js} +1 -1
  3. package/dist/assets/{ErrorBoundary-DzYV_VeY.js → ErrorBoundary-DyYDV0HI.js} +1 -1
  4. package/dist/assets/{ImperativeModal-D7lQ0Q7_.js → ImperativeModal-CvOOClOZ.js} +1 -1
  5. package/dist/assets/{JsonOutput-B0sjIMBK.js → JsonOutput-BqavrgK2.js} +11 -11
  6. package/dist/assets/{LazyAnyLanguageCodeMirror-pAFdCqyC.js → LazyAnyLanguageCodeMirror-CXbgDeVw.js} +2 -2
  7. package/dist/assets/{MarimoErrorOutput-ClA7EZGX.js → MarimoErrorOutput-DyaTrW3L.js} +2 -2
  8. package/dist/assets/{RSPContexts-CINae4Gg.js → RSPContexts-eRifaAal.js} +1 -1
  9. package/dist/assets/{RenderHTML-CruxVneu.js → RenderHTML-CvnUbELu.js} +1 -1
  10. package/dist/assets/{RunButton-CJsJsGj-.js → RunButton-Cw4OpYze.js} +1 -1
  11. package/dist/assets/{add-cell-with-ai-C7f_bUyB.js → add-cell-with-ai-CsUwlDQR.js} +16 -16
  12. package/dist/assets/{add-connection-dialog-DSOgwTlO.js → add-connection-dialog-B00bTtAj.js} +1 -1
  13. package/dist/assets/{agent-panel-CeDyKw1_.js → agent-panel-vnhI1dDS.js} +3 -3
  14. package/dist/assets/{ai-model-dropdown-kQdQhWyz.js → ai-model-dropdown-E3o7Xd1q.js} +4 -4
  15. package/dist/assets/{alert-dialog-BGBdrcqJ.js → alert-dialog-BqFLkbUc.js} +1 -1
  16. package/dist/assets/{any-language-editor-CwwS-naY.js → any-language-editor-Bu4hSl-d.js} +1 -1
  17. package/dist/assets/{app-config-button-dnmk7p6n.js → app-config-button-DTjn2zGb.js} +1 -1
  18. package/dist/assets/{button-D9nb17Rw.js → button-BbCh-29a.js} +1 -1
  19. package/dist/assets/{cache-panel-DDJqyuAl.js → cache-panel-VFeeaT52.js} +1 -1
  20. package/dist/assets/{capabilities-C_FLIcjP.js → capabilities-A_KhFcGV.js} +1 -1
  21. package/dist/assets/cell-editor-C41pv5M8.js +20 -0
  22. package/dist/assets/cell-link-sLKimSIQ.js +1 -0
  23. package/dist/assets/{cells-BBDzmUIS.js → cells-Vnv1zw09.js} +71 -71
  24. package/dist/assets/{chat-display-Ct3Me0kL.js → chat-display-sbJsmezM.js} +1 -1
  25. package/dist/assets/{chat-panel-CXvtUFUU.js → chat-panel-DFLJ558d.js} +1 -1
  26. package/dist/assets/{chat-ui-UFERs8Gx.js → chat-ui-BWV8p_Y-.js} +1 -1
  27. package/dist/assets/{column-preview-Xuel1zsI.js → column-preview-DYtdLerF.js} +1 -1
  28. package/dist/assets/{command-CBCkexpx.js → command-OHlV5HHD.js} +1 -1
  29. package/dist/assets/{command-palette-DuPUk7of.js → command-palette-CvoYeZJD.js} +1 -1
  30. package/dist/assets/{common-Dk5VdfJt.js → common-BhQv6499.js} +1 -1
  31. package/dist/assets/{components-CTKNCmC_.js → components-BA-LgiMU.js} +1 -1
  32. package/dist/assets/{components-DsoH1pO3.js → components-c7ywwQgj.js} +1 -1
  33. package/dist/assets/{config-CPqw1wUv.js → config-CeTe6Mau.js} +1 -1
  34. package/dist/assets/{copy-BCF-tANo.js → copy-DqHGjTAN.js} +1 -1
  35. package/dist/assets/{copy-icon-BYNydU7b.js → copy-icon-8abB4Lgh.js} +1 -1
  36. package/dist/assets/{createReducer-1ePoj7v6.js → createReducer-CI9qeK_X.js} +1 -1
  37. package/dist/assets/{datasource-CmTCEk66.js → datasource-BGeucDqU.js} +2 -2
  38. package/dist/assets/{dates-CAlnO9QB.js → dates-orWokFRU.js} +1 -1
  39. package/dist/assets/{dependency-graph-panel-0u1-ZaOT.js → dependency-graph-panel-Dm8aJtqe.js} +4 -4
  40. package/dist/assets/{dialog-Dj0qTFnG.js → dialog-DBzaWZPw.js} +1 -1
  41. package/dist/assets/{dist-BoOh2kN5.js → dist-BdyjRhEt.js} +1 -1
  42. package/dist/assets/documentation-panel-BmTIHvGw.js +1 -0
  43. package/dist/assets/{download-QGh9oR1D.js → download-CHV3J2Ib.js} +4 -4
  44. package/dist/assets/{dropdown-menu-D1A3cFC8.js → dropdown-menu-CR7cnzLX.js} +1 -1
  45. package/dist/assets/{edit-page-hJAbnd__.js → edit-page-Dvj9-hG8.js} +6 -6
  46. package/dist/assets/{error-banner-C10O4l3y.js → error-banner-JKAA0BVv.js} +1 -1
  47. package/dist/assets/{error-panel-ChlzbfWg.js → error-panel-yG2LOaXm.js} +1 -1
  48. package/dist/assets/{es-DaYh1PsD.js → es-CaLpD1T5.js} +1 -1
  49. package/dist/assets/{field-BrLPDxsA.js → field-CD7Io4xo.js} +1 -1
  50. package/dist/assets/{file-explorer-panel-8dWLD2PY.js → file-explorer-panel-Bsp9TexR.js} +3 -3
  51. package/dist/assets/{file-icons-Cs4oXsAy.js → file-icons-Cisq31t9.js} +1 -1
  52. package/dist/assets/{file-name-input-g7pBBCjk.js → file-name-input-Dti85i-l.js} +1 -1
  53. package/dist/assets/{floating-outline-CFUSr2du.js → floating-outline-CnVsBFJf.js} +1 -1
  54. package/dist/assets/{focus-J47a1GCq.js → focus-bWAnl_NC.js} +1 -1
  55. package/dist/assets/{form-CdFqEqTA.js → form-iTIO7T75.js} +2 -2
  56. package/dist/assets/{formats-Dsc8AdCp.js → formats-D4Sso5bX.js} +1 -1
  57. package/dist/assets/{formatting-Chn6WhRe.js → formatting-BDxRugYY.js} +1 -1
  58. package/dist/assets/{fullscreen-BDxedMYP.js → fullscreen-eipL3i3Y.js} +1 -1
  59. package/dist/assets/{gallery-page-TIWZFnOT.js → gallery-page-DDCU0YEU.js} +1 -1
  60. package/dist/assets/{glide-data-editor-ChlIFl33.js → glide-data-editor-BELaKoS9.js} +1 -1
  61. package/dist/assets/{globals-DUw71mRV.js → globals-B64vMQ0L.js} +1 -1
  62. package/dist/assets/{home-page-HhJfA35e.js → home-page-CSSZCATB.js} +1 -1
  63. package/dist/assets/{hooks-DbPDczTe.js → hooks-CxyxjDM-.js} +1 -1
  64. package/dist/assets/{html-to-image-CAiN3VHj.js → html-to-image-WbbYaIba.js} +2 -2
  65. package/dist/assets/{index-BbBhLC0d.css → index-BcFmKehD.css} +1 -1
  66. package/dist/assets/{index-CH2ZE_q-.js → index-BmG6rFrZ.js} +7 -7
  67. package/dist/assets/{input-BX98vgAu.js → input-DW6LU13i.js} +1 -1
  68. package/dist/assets/kiosk-mode-DPxzN-M0.js +1 -0
  69. package/dist/assets/{label-DTR8T0AE.js → label-xHqFtfdz.js} +1 -1
  70. package/dist/assets/{layout-C1dvirgi.js → layout-B3ilKFRj.js} +5 -5
  71. package/dist/assets/{links-BhX7oUFH.js → links-Bi_gi3iZ.js} +1 -1
  72. package/dist/assets/{logs-panel-B2tW94um.js → logs-panel-7jkC5Vwq.js} +1 -1
  73. package/dist/assets/{maps-C48Oksn0.js → maps-BS8Ra-JU.js} +1 -1
  74. package/dist/assets/{markdown-renderer-CVd_mMPt.js → markdown-renderer-CXVa5ubo.js} +2 -2
  75. package/dist/assets/{menu-items-CwUpDHG7.js → menu-items-DcP01QzW.js} +1 -1
  76. package/dist/assets/{mermaid-ByDNZESx.js → mermaid-B6II7_1_.js} +1 -1
  77. package/dist/assets/{multi-map-rafH3cg3.js → multi-map-CUuNtzHt.js} +1 -1
  78. package/dist/assets/{name-cell-input-DDQOQSsh.js → name-cell-input-DP5q5hou.js} +1 -1
  79. package/dist/assets/{numbers-CAW8yjzj.js → numbers-etj36G80.js} +1 -1
  80. package/dist/assets/{outline-panel-BuTQis3o.js → outline-panel-CAMKZApa.js} +1 -1
  81. package/dist/assets/{packages-panel-CVu8Cpkz.js → packages-panel-BqWdwyLN.js} +1 -1
  82. package/dist/assets/{panels-Z5fVmDRY.js → panels-BaOloRiT.js} +1 -1
  83. package/dist/assets/{popover-UExmgBsf.js → popover-Bz_0Vkyf.js} +1 -1
  84. package/dist/assets/process-output-3R47GJ28.js +1 -0
  85. package/dist/assets/{radio-group-CpHTexlq.js → radio-group-BdIsm_qJ.js} +1 -1
  86. package/dist/assets/{readonly-python-code-DOXF2p8K.js → readonly-python-code-Dz8x4isw.js} +1 -1
  87. package/dist/assets/{renderShortcut-Bfk4NjRL.js → renderShortcut-D_8sQXCD.js} +1 -1
  88. package/dist/assets/{reveal-component-DLRiYfBj.js → reveal-component-BomJwrt3.js} +2 -2
  89. package/dist/assets/{run-page-DDMPBh9O.js → run-page-DOVpxgC2.js} +1 -1
  90. package/dist/assets/{runs-DRld30N_.js → runs-D87fZMlB.js} +1 -1
  91. package/dist/assets/scratchpad-panel-CK721GBB.js +1 -0
  92. package/dist/assets/{secrets-panel-B8CbRNMo.js → secrets-panel-DgXG36fa.js} +1 -1
  93. package/dist/assets/{select-5i7URBEn.js → select-DZcFyKFQ.js} +1 -1
  94. package/dist/assets/{session-VtovaFBS.js → session-gB-8RZAq.js} +1 -1
  95. package/dist/assets/{session-panel-DHfR6tDv.js → session-panel-_DOPOxmi.js} +1 -1
  96. package/dist/assets/{share-CqnSBwZy.js → share-DdpVbvDN.js} +1 -1
  97. package/dist/assets/{snippets-panel-CGs_ME5h.js → snippets-panel-CtEyZp6T.js} +1 -1
  98. package/dist/assets/{spec-Cq8FVoTf.js → spec-ByOlaO3e.js} +1 -1
  99. package/dist/assets/{state-B34hXjp9.js → state-BNbY1nER.js} +1 -1
  100. package/dist/assets/{state-BV_qjCwT.js → state-BmNumiqM.js} +1 -1
  101. package/dist/assets/{state-xEqF8Q3P.js → state-CZ60VH86.js} +3 -3
  102. package/dist/assets/{state-DzJiyfWW.js → state-DujssAPg.js} +1 -1
  103. package/dist/assets/{strings-md4mFbOQ.js → strings-wdPMRf6Z.js} +1 -1
  104. package/dist/assets/{swiper-component-CBSZ9l9W.js → swiper-component-B1e0X8Wt.js} +1 -1
  105. package/dist/assets/{switch-BvybnC9P.js → switch-BT9Ki10B.js} +1 -1
  106. package/dist/assets/{terminal-bb566dQu.js → terminal-G4Y2HQik.js} +1 -1
  107. package/dist/assets/{textarea-bAp21zYj.js → textarea-CUCKX5FP.js} +1 -1
  108. package/dist/assets/{tooltip-Gcwqb_SK.js → tooltip-DTV9tlSr.js} +1 -1
  109. package/dist/assets/{tracing-HakOQiQR.js → tracing-B84tRfOs.js} +1 -1
  110. package/dist/assets/{tracing-panel-eas_Nc-b.js → tracing-panel-Cv--myyS.js} +2 -2
  111. package/dist/assets/{tree-actions-Ci3CV3hN.js → tree-actions-Bzr5XDGx.js} +1 -1
  112. package/dist/assets/{useBoolean-xXcxYCaI.js → useBoolean-BYUGB06y.js} +1 -1
  113. package/dist/assets/useCellActionButton-Mkc0xJ7L.js +1 -0
  114. package/dist/assets/{useDeleteCell-GFhvGBJ7.js → useDeleteCell-C67FKMcv.js} +1 -1
  115. package/dist/assets/{useDependencyPanelTab-DHd7_0b9.js → useDependencyPanelTab-BdgKnqQ5.js} +1 -1
  116. package/dist/assets/{useEventListener-BR0C1MaI.js → useEventListener-DvoEXWke.js} +1 -1
  117. package/dist/assets/{useHotkey-DccKPSPx.js → useHotkey-3DXVR1KZ.js} +1 -1
  118. package/dist/assets/{useIframeCapabilities-BvE4n6hj.js → useIframeCapabilities-BfimgBBe.js} +1 -1
  119. package/dist/assets/{useInstallPackage-D0NLybAx.js → useInstallPackage-CScpUItd.js} +1 -1
  120. package/dist/assets/{useInterval-CvFz96h2.js → useInterval-CAy_JAzY.js} +1 -1
  121. package/dist/assets/useNotebookActions-C_PqW3GC.js +1 -0
  122. package/dist/assets/useRunCells-C991pS4a.js +1 -0
  123. package/dist/assets/useSplitCell-FJGXiUyn.js +1 -0
  124. package/dist/assets/{useTheme-DFXuDFj9.js → useTheme-DyLIIrGi.js} +1 -1
  125. package/dist/assets/{utils-CGtUbqcR.js → utils-441jgnV8.js} +1 -1
  126. package/dist/assets/{utils-BrXijSdZ.js → utils-Wvjk_Y4h.js} +1 -1
  127. package/dist/assets/{vega-component-Bq0lrkG7.js → vega-component-2S2ePGs4.js} +1 -1
  128. package/dist/assets/{write-secret-modal-D8Sww7eA.js → write-secret-modal-BcEaI0rD.js} +1 -1
  129. package/dist/index.html +68 -68
  130. package/package.json +1 -1
  131. package/src/components/editor/actions/useNotebookActions.tsx +3 -1
  132. package/src/components/editor/controls/Controls.tsx +3 -1
  133. package/src/components/editor/navigation/__tests__/clipboard.test.ts +107 -0
  134. package/src/components/editor/navigation/__tests__/navigation.test.ts +70 -0
  135. package/src/components/editor/navigation/clipboard.ts +101 -23
  136. package/src/components/editor/navigation/navigation.ts +15 -1
  137. package/src/components/editor/notebook-cell.tsx +3 -0
  138. package/src/components/pages/run-page.tsx +4 -1
  139. package/src/core/cells/__tests__/cells.test.ts +187 -0
  140. package/src/core/cells/__tests__/pending-cut-service.test.tsx +145 -0
  141. package/src/core/cells/cells.ts +102 -17
  142. package/src/core/cells/document-changes.ts +6 -1
  143. package/src/core/cells/pending-cut-service.ts +64 -0
  144. package/src/core/cells/utils.ts +11 -0
  145. package/src/core/codemirror/cells/extensions.ts +10 -0
  146. package/src/core/hotkeys/hotkeys.ts +5 -0
  147. package/src/css/app/Cell.css +13 -0
  148. package/src/utils/__tests__/id-tree.test.ts +71 -0
  149. package/src/utils/id-tree.tsx +89 -0
  150. package/dist/assets/cell-editor-BN3D1_w1.js +0 -22
  151. package/dist/assets/cell-link-DqiCeeeS.js +0 -1
  152. package/dist/assets/documentation-panel-CcE7aGO9.js +0 -1
  153. package/dist/assets/kiosk-mode-Cr9yyT7A.js +0 -1
  154. package/dist/assets/process-output-DSqjZYr-.js +0 -1
  155. package/dist/assets/scratchpad-panel-CUMSD7sH.js +0 -1
  156. package/dist/assets/useCellActionButton-CHLJURZ7.js +0 -1
  157. package/dist/assets/useNotebookActions-CZ7s2FNR.js +0 -1
  158. package/dist/assets/useRunCells-RJeImyCn.js +0 -1
  159. package/dist/assets/useSplitCell-BRZ3fmLD.js +0 -1
@@ -1,4 +1,4 @@
1
- var Ge=Object.defineProperty;var Ve=(t,e,s)=>e in t?Ge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var z=(t,e,s)=>Ve(t,typeof e!="symbol"?e+"":e,s);import{s as oe}from"./chunk-LvLJmgfZ.js";import{t as Ze}from"./react-Bj1aDYRI.js";import{E as Qe,Gn as g,kt as ce}from"./cells-BBDzmUIS.js";import{D as M,P as y,R as u,T as D,_ as ae,i as Je,k as _,m as Ye}from"./zod-H_cgTO0M.js";import{t as B}from"./compiler-runtime-B3qBwwSJ.js";import{v as Xe}from"./useEventListener-BR0C1MaI.js";import{t as G}from"./cn-DCUzRj2J.js";import{t as et}from"./jsx-runtime-BqBOg78p.js";import{a as tt,c as ie,o as le,s as st}from"./popover-UExmgBsf.js";import{c as rt,i as nt,n as ot,r as ct,s as at,t as it}from"./select-5i7URBEn.js";import{a as J,c as de,o as lt,p as dt,r as pt,t as ht}from"./dropdown-menu-D1A3cFC8.js";import{t as Y}from"./button-D9nb17Rw.js";import{l as mt}from"./arrays-DYDL-3-i.js";import{r as U}from"./strings-md4mFbOQ.js";import{t as ut}from"./createLucideIcon-D5guW7EU.js";import{t as bt}from"./circle-plus-BdiiIXu5.js";import{t as ft}from"./database-zap-kIkTfzTX.js";import{t as gt}from"./github-BKS_2Qwn.js";import{c as a,o as yt,t as _t,u as St}from"./form-CdFqEqTA.js";import{n as wt}from"./DeferredRequestRegistry-CUzZ0y7K.js";import{o as xt,r as kt}from"./input-BX98vgAu.js";import{a as vt,c as $t,d as jt,g as At,l as Ct,o as Rt,p as Tt,s as Lt,u as Dt}from"./textarea-bAp21zYj.js";import{r as It}from"./useTheme-DFXuDFj9.js";import{a as Pt,c as qt,l as Nt,n as Ft,r as Et,t as Bt}from"./dialog-Dj0qTFnG.js";import{n as Ot}from"./ImperativeModal-D7lQ0Q7_.js";import{t as V}from"./links-Dpap8NI2.js";import{n as Mt}from"./useAsyncData-BFC6lWG9.js";import{o as Ut}from"./focus-J47a1GCq.js";import{n as Kt,t as Ht}from"./azure-C2Di2emT.js";import{t as Wt}from"./request-registry-5ELz5pd2.js";import{n as zt,t as Gt}from"./write-secret-modal-D8Sww7eA.js";var X=ut("hard-drive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]),ee="env:";function Ir(t){return t}function K(t){return typeof t=="string"?t.startsWith(ee):!1}function te(t){return`${ee}${t}`}function pe(t){return t.replace(ee,"")}var Vt=B(),N=oe(Ze(),1),o=oe(et(),1),he=(0,N.createContext)({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:Xe.NOOP});const Zt=()=>(0,N.use)(he),Qt=t=>{let e=(0,Vt.c)(14),{children:s}=t,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=[],e[0]=n):n=e[0];let{data:r,isPending:d,error:i,refetch:c}=Mt(ts,n),l;e[1]===(r==null?void 0:r.secretKeys)?l=e[2]:(l=(r==null?void 0:r.secretKeys)||[],e[1]=r==null?void 0:r.secretKeys,e[2]=l);let h;e[3]===(r==null?void 0:r.providerNames)?h=e[4]:(h=(r==null?void 0:r.providerNames)||[],e[3]=r==null?void 0:r.providerNames,e[4]=h);let p;e[5]!==i||e[6]!==d||e[7]!==c||e[8]!==l||e[9]!==h?(p={secretKeys:l,providerNames:h,loading:d,error:i,refreshSecrets:c},e[5]=i,e[6]=d,e[7]=c,e[8]=l,e[9]=h,e[10]=p):p=e[10];let f;return e[11]!==s||e[12]!==p?(f=(0,o.jsx)(he,{value:p,children:s}),e[11]=s,e[12]=p,e[13]=f):f=e[13],f},Jt={isMatch:t=>{if(t instanceof ae||t instanceof Ye){let{optionRegex:e}=a.parse(t.description||"");return!!e}return!1},Component:({schema:t,form:e,path:s})=>{let{secretKeys:n,providerNames:r,refreshSecrets:d}=Zt(),{openModal:i,closeModal:c}=Ot(),{label:l,description:h,optionRegex:p=""}=a.parse(t.description||""),[f,b]=mt(n,m=>new RegExp(p,"i").test(m));return(0,o.jsx)($t,{control:e.control,name:s,render:({field:m})=>(0,o.jsxs)(Ct,{children:[(0,o.jsx)(Dt,{children:l}),(0,o.jsx)(Rt,{children:h}),(0,o.jsx)(vt,{children:(0,o.jsxs)("div",{className:"flex gap-2",children:[t instanceof ae?(0,o.jsx)(kt,{...m,value:m.value,onChange:m.onChange,className:G("flex-1")}):(0,o.jsx)(xt,{...m,value:m.value,onChange:m.onChange,className:"flex-1"}),(0,o.jsxs)(ht,{children:[(0,o.jsx)(dt,{asChild:!0,children:(0,o.jsx)(Y,{variant:"outline",size:"icon",className:G(K(m.value)&&"bg-accent"),children:(0,o.jsx)(wt,{className:"h-3 w-3"})})}),(0,o.jsxs)(pt,{align:"end",className:"max-h-60 overflow-y-auto",children:[(0,o.jsxs)(J,{onSelect:()=>{i((0,o.jsx)(Gt,{providerNames:r,onSuccess:S=>{d(),m.onChange(te(S)),c()},onClose:c}))},children:[(0,o.jsx)(bt,{className:"mr-2 h-3.5 w-3.5"}),"Create a new secret"]}),f.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(de,{}),(0,o.jsx)(lt,{children:"Recommended"})]}),f.map(S=>(0,o.jsx)(J,{onSelect:()=>m.onChange(te(S)),children:S},S)),b.length>0&&(0,o.jsx)(de,{}),b.map(S=>(0,o.jsx)(J,{onSelect:()=>m.onChange(te(S)),children:S},S))]})]})]})}),(0,o.jsx)(jt,{})]})})}};function Yt(t){return t.provider!=="env"}function Xt(t){return t.name}function es(t){return t.keys}async function ts(){let t=await Wt.request({}),e=zt(t.secrets).filter(Yt).map(Xt);return{secretKeys:t.secrets.flatMap(es).toSorted(),providerNames:e}}var H=B(),ss=[Jt];const se=t=>{let e=(0,H.c)(2),{children:s}=t,n;return e[0]===s?n=e[1]:(n=(0,o.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:s}),e[0]=s,e[1]=n),n},re=t=>{let e=(0,H.c)(9),{name:s,color:n,icon:r,onSelect:d}=t,i;e[0]===n?i=e[1]:(i={backgroundColor:n},e[0]=n,e[1]=i);let c;e[2]===s?c=e[3]:(c=(0,o.jsx)("span",{className:"text-white font-medium text-lg",children:s}),e[2]=s,e[3]=c);let l;return e[4]!==r||e[5]!==d||e[6]!==i||e[7]!==c?(l=(0,o.jsxs)("button",{type:"button",className:"py-3 flex flex-col items-center justify-center gap-1 transition-all hover:scale-105 hover:brightness-110 rounded shadow-sm-solid hover:shadow-md-solid",style:i,onClick:d,children:[r,c]}),e[4]=r,e[5]=d,e[6]=i,e[7]=c,e[8]=l):l=e[8],l},rs=t=>{let e=(0,H.c)(25),{onBack:s,isValid:n,libraries:r,preferredLibrary:d,onLibraryChange:i,displayNames:c,libraryLabel:l}=t,h=l===void 0?"Preferred library":l,p;e[0]===s?p=e[1]:(p=(0,o.jsx)(Y,{type:"button",variant:"outline",onClick:s,children:"Back"}),e[0]=s,e[1]=p);let f=!n,b;e[2]===f?b=e[3]:(b=(0,o.jsx)(Y,{type:"submit",disabled:f,children:"Add"}),e[2]=f,e[3]=b);let m;e[4]!==p||e[5]!==b?(m=(0,o.jsxs)("div",{className:"flex gap-2",children:[p,b]}),e[4]=p,e[5]=b,e[6]=m):m=e[6];let S;e[7]===Symbol.for("react.memo_cache_sentinel")?(S=(0,o.jsx)(at,{children:(0,o.jsx)(rt,{placeholder:"Select a library"})}),e[7]=S):S=e[7];let w;e[8]===h?w=e[9]:(w=(0,o.jsxs)("div",{className:"flex flex-col gap-1 items-end",children:[S,(0,o.jsx)("span",{className:"text-xs text-muted-foreground",children:h})]}),e[8]=h,e[9]=w);let $;if(e[10]!==c||e[11]!==r){let j;e[13]===c?j=e[14]:(j=T=>(0,o.jsx)(nt,{value:T,children:c[T]??T},T),e[13]=c,e[14]=j),$=r.map(j),e[10]=c,e[11]=r,e[12]=$}else $=e[12];let x;e[15]===$?x=e[16]:(x=(0,o.jsx)(ot,{children:(0,o.jsx)(ct,{children:$})}),e[15]=$,e[16]=x);let v;e[17]!==i||e[18]!==d||e[19]!==w||e[20]!==x?(v=(0,o.jsx)("div",{children:(0,o.jsxs)(it,{value:d,onValueChange:i,children:[w,x]})}),e[17]=i,e[18]=d,e[19]=w,e[20]=x,e[21]=v):v=e[21];let A;return e[22]!==v||e[23]!==m?(A=(0,o.jsxs)("div",{className:"flex gap-2 justify-between",children:[m,v]}),e[22]=v,e[23]=m,e[24]=A):A=e[24],A};function ns(){let t=(0,H.c)(3),{createNewCell:e}=Qe(),s=Ut(),n;return t[0]!==e||t[1]!==s?(n=r=>{e({code:r,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},t[0]=e,t[1]=s,t[2]=n):n=t[2],n}const me=t=>{let e=(0,H.c)(30),{schema:s,libraries:n,preferredLibrary:r,displayNames:d,libraryLabel:i,generateCode:c,onSubmit:l,onBack:h}=t,p;e[0]===s?p=e[1]:(p=yt(s),e[0]=s,e[1]=p);let f=p,b;e[2]===s?b=e[3]:(b=Tt(s),e[2]=s,e[3]=b);let m;e[4]!==f||e[5]!==b?(m={defaultValues:f,resolver:b,reValidateMode:"onChange"},e[4]=f,e[5]=b,e[6]=m):m=e[6];let S=At(m),[w,$]=N.useState(r),x=ns(),v;e[7]!==c||e[8]!==x||e[9]!==l||e[10]!==w?(v=ze=>{x(c(ze,w)),l()},e[7]=c,e[8]=x,e[9]=l,e[10]=w,e[11]=v):v=e[11];let A=v,j;e[12]!==S||e[13]!==A?(j=S.handleSubmit(A),e[12]=S,e[13]=A,e[14]=j):j=e[14];let T;e[15]===Symbol.for("react.memo_cache_sentinel")?(T=(0,o.jsx)(Lt,{}),e[15]=T):T=e[15];let F;e[16]!==S||e[17]!==s?(F=(0,o.jsx)(Qt,{children:(0,o.jsx)(_t,{schema:s,form:S,renderers:ss,children:T})}),e[16]=S,e[17]=s,e[18]=F):F=e[18];let E;e[19]!==d||e[20]!==S.formState.isValid||e[21]!==n||e[22]!==i||e[23]!==h||e[24]!==w?(E=(0,o.jsx)(rs,{onBack:h,isValid:S.formState.isValid,libraries:n,preferredLibrary:w,onLibraryChange:$,displayNames:d,libraryLabel:i}),e[19]=d,e[20]=S.formState.isValid,e[21]=n,e[22]=i,e[23]=h,e[24]=w,e[25]=E):E=e[25];let W;return e[26]!==j||e[27]!==F||e[28]!==E?(W=(0,o.jsxs)("form",{onSubmit:j,className:"space-y-4",children:[F,E]}),e[26]=j,e[27]=F,e[28]=E,e[29]=W):W=e[29],W};function I(){return u().optional().describe(a.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function Z(t,e){let s=u();return s=e?s.nonempty():s.optional(),s=s.describe(a.of({label:t||"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"})),s}function Q(){return u().optional().describe(a.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function ne(t,e){let s=u();return s=e?s.nonempty():s.optional(),s.describe(a.of({label:t||"URI",optionRegex:".*uri.*"}))}function L(t){return u().nonempty().describe(a.of({label:t||"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function C(){return u().describe(a.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function os(){return u().describe(a.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"}))}function R(){return u().nonempty().describe(a.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function P(t){let e=Je().describe(a.of({label:"Port",inputType:"number",placeholder:t==null?void 0:t.toString()})).transform(Number).refine(s=>s>=0&&s<=65535,{message:"Port must be between 0 and 65535"});return t===void 0?e:e.default(t)}function ue(){return D().default(!1).describe(a.of({label:"Read Only"}))}const be=y({type:_("postgres"),host:L(),port:P(5432).optional(),database:C(),username:R(),password:I(),ssl:D().default(!1).describe(a.of({label:"Use SSL"}))}).describe(a.of({direction:"two-columns"})),fe=y({type:_("mysql"),host:L(),port:P(3306),database:C(),username:R(),password:I(),ssl:D().default(!1).describe(a.of({label:"Use SSL"}))}).describe(a.of({direction:"two-columns"})),ge=y({type:_("sqlite"),database:C().describe(a.of({label:"Database Path"}))}).describe(a.of({direction:"two-columns"})),ye=y({type:_("duckdb"),database:C().describe(a.of({label:"Database Path"})),read_only:ue()}).describe(a.of({direction:"two-columns"})),_e=y({type:_("motherduck"),database:C().default("my_db").describe(a.of({label:"Database Name"})),token:Z()}).describe(a.of({direction:"two-columns"})),Se=y({type:_("snowflake"),account:u().nonempty().describe(a.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:u().optional().describe(a.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:C(),schema:u().optional().describe(a.of({label:"Schema",optionRegex:".*snowflake.*"})),role:u().optional().describe(a.of({label:"Role"})),authType:M("type",[y({type:_("Password"),username:R(),password:I(),enable_mfa:D().default(!1).describe(a.of({label:"Enable MFA (Duo Push)"}))}),y({type:_("SSO (Browser)"),username:R()}),y({type:_("Key Pair"),username:R(),private_key_path:u().nonempty().describe(a.of({label:"Private Key Path",placeholder:"/path/to/rsa_key.p8"})),private_key_passphrase:u().optional().describe(a.of({label:"Private Key Passphrase",inputType:"password",optionRegex:".*passphrase.*"}))}),y({type:_("OAuth / PAT"),token:Z("Token",!0)})]).default({type:"Password",username:"username",enable_mfa:!1}).describe(a.of({special:"tabs"}))}).describe(a.of({direction:"two-columns"})),we=y({type:_("bigquery"),project:u().nonempty().describe(a.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:u().nonempty().describe(a.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:u().describe(a.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(a.of({direction:"two-columns"})),xe=y({type:_("clickhouse_connect"),host:L(),port:P(8123).optional(),username:R(),password:I(),secure:D().default(!1).describe(a.of({label:"Use HTTPs"})),proxy_path:u().optional().describe(a.of({label:"Proxy Path",placeholder:"/clickhouse"}))}).describe(a.of({direction:"two-columns"})),ke=y({type:_("timeplus"),host:L().default("localhost"),port:P(8123).optional(),username:R().default("default"),password:I().default("")}).describe(a.of({direction:"two-columns"})),ve=y({type:_("chdb"),database:C().describe(a.of({label:"Database Path"})),read_only:ue()}).describe(a.of({direction:"two-columns"})),$e=y({type:_("trino"),host:L(),port:P(8080),database:C(),schema:os().optional(),username:R(),password:I(),async_support:D().default(!1).describe(a.of({label:"Async Support"}))}).describe(a.of({direction:"two-columns"})),je=y({type:_("iceberg"),name:u().describe(a.of({label:"Catalog Name"})),catalog:M("type",[y({type:_("REST"),warehouse:Q(),uri:u().optional().describe(a.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:Z()}),y({type:_("SQL"),warehouse:Q(),uri:u().optional().describe(a.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),y({type:_("Hive"),warehouse:Q(),uri:ne()}),y({type:_("Glue"),warehouse:Q(),uri:ne()}),y({type:_("DynamoDB"),"dynamodb.profile-name":u().optional().describe(a.of({label:"Profile Name"})),"dynamodb.region":u().optional().describe(a.of({label:"Region"})),"dynamodb.access-key-id":u().optional().describe(a.of({label:"Access Key ID"})),"dynamodb.secret-access-key":u().optional().describe(a.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":u().optional().describe(a.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST",token:void 0}).describe(a.of({special:"tabs"}))}),Ae=y({type:_("datafusion"),sessionContext:D().optional().describe(a.of({label:"Use Session Context"}))}),Ce=y({type:_("pyspark"),host:L().optional(),port:P().optional()}),Re=y({type:_("redshift"),host:L(),port:P(5439),connectionType:M("type",[y({type:_("IAM credentials"),region:u().describe(a.of({label:"Region"})),aws_access_key_id:u().nonempty().describe(a.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:u().nonempty().describe(a.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:u().optional().describe(a.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),y({type:_("DB credentials"),user:R(),password:I()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:C()}).describe(a.of({direction:"two-columns"})),Te=y({type:_("databricks"),access_token:Z("Access Token",!0),server_hostname:L("Server Hostname"),http_path:ne("HTTP Path",!0),catalog:u().optional().describe(a.of({label:"Catalog"})),schema:u().optional().describe(a.of({label:"Schema"}))}).describe(a.of({direction:"two-columns"})),Le=y({type:_("supabase"),host:L(),port:P(5432).optional(),database:C(),username:R(),password:I(),disable_client_pooling:D().default(!1).describe(a.of({label:"Disable Client-Side Pooling"}))}).describe(a.of({direction:"two-columns"})),cs=M("type",[be,fe,ge,ye,_e,Se,we,xe,ke,ve,$e,je,Ae,Ce,Re,Te,Le]),De={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift",databricks:"Databricks"};var k=class{constructor(t,e,s){this.connection=t,this.orm=e,this.secrets=s}get imports(){let t=new Set(this.generateImports());switch(this.orm){case"sqlalchemy":t.add("import sqlalchemy");break;case"sqlmodel":t.add("import sqlmodel");break;case"duckdb":t.add("import duckdb");break;case"ibis":t.add("import ibis");break}return t}},as=t=>`_${t}`,is=class{constructor(){z(this,"secrets",{})}get imports(){return Object.keys(this.secrets).length===0?new Set:new Set(["import os"])}print(t,e,s){if(t=as(t),K(e)){let n=pe(e),r=s?`os.environ.get("${n}", "${s}")`:`os.environ.get("${n}")`;return this.secrets[t]=r,t}if(s!=null){let n=`os.environ.get("${e}", "${s}")`;return this.secrets[t]=n,t}return typeof e=="number"||typeof e=="number"?`${e}`:typeof e=="boolean"?O(e):e?`"${e}"`:""}printInFString(t,e,s){if(e===void 0)return"";if(typeof e=="number")return`${e}`;if(typeof e=="boolean")return O(e);let n=this.print(t,e,s);return n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1):`{${n}}`}printPassword(t,e,s,n){let r=s?this.printInFString.bind(this):this.print.bind(this);return K(t)?r(n||"password",t):r(n||"password",e,t)}getSecrets(){return this.secrets}formatSecrets(){return Object.keys(this.secrets).length===0?"":Object.entries(this.secrets).map(([t,e])=>`${t} = ${e}`).join(`
1
+ var Ge=Object.defineProperty;var Ve=(t,e,s)=>e in t?Ge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var z=(t,e,s)=>Ve(t,typeof e!="symbol"?e+"":e,s);import{s as oe}from"./chunk-LvLJmgfZ.js";import{t as Ze}from"./react-Bj1aDYRI.js";import{At as ce,D as Qe,Zn as g}from"./cells-Vnv1zw09.js";import{D as M,P as y,R as u,T as D,_ as ae,i as Je,k as _,m as Ye}from"./zod-H_cgTO0M.js";import{t as B}from"./compiler-runtime-B3qBwwSJ.js";import{v as Xe}from"./useEventListener-DvoEXWke.js";import{t as G}from"./cn-DCUzRj2J.js";import{t as et}from"./jsx-runtime-BqBOg78p.js";import{a as tt,c as ie,o as le,s as st}from"./popover-Bz_0Vkyf.js";import{c as rt,i as nt,n as ot,r as ct,s as at,t as it}from"./select-DZcFyKFQ.js";import{a as J,c as de,o as lt,p as dt,r as pt,t as ht}from"./dropdown-menu-CR7cnzLX.js";import{t as Y}from"./button-BbCh-29a.js";import{l as mt}from"./arrays-DYDL-3-i.js";import{r as U}from"./strings-wdPMRf6Z.js";import{t as ut}from"./createLucideIcon-D5guW7EU.js";import{t as bt}from"./circle-plus-BdiiIXu5.js";import{t as ft}from"./database-zap-kIkTfzTX.js";import{t as gt}from"./github-BKS_2Qwn.js";import{c as a,o as yt,t as _t,u as St}from"./form-iTIO7T75.js";import{n as wt}from"./DeferredRequestRegistry-CUzZ0y7K.js";import{o as xt,r as kt}from"./input-DW6LU13i.js";import{a as vt,c as $t,d as jt,g as At,l as Ct,o as Rt,p as Tt,s as Lt,u as Dt}from"./textarea-CUCKX5FP.js";import{r as It}from"./useTheme-DyLIIrGi.js";import{a as Pt,c as qt,l as Nt,n as Ft,r as Et,t as Bt}from"./dialog-DBzaWZPw.js";import{n as Ot}from"./ImperativeModal-CvOOClOZ.js";import{t as V}from"./links-Dpap8NI2.js";import{n as Mt}from"./useAsyncData-BFC6lWG9.js";import{o as Ut}from"./focus-bWAnl_NC.js";import{n as Kt,t as Ht}from"./azure-C2Di2emT.js";import{t as Wt}from"./request-registry-5ELz5pd2.js";import{n as zt,t as Gt}from"./write-secret-modal-BcEaI0rD.js";var X=ut("hard-drive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]),ee="env:";function Ir(t){return t}function K(t){return typeof t=="string"?t.startsWith(ee):!1}function te(t){return`${ee}${t}`}function pe(t){return t.replace(ee,"")}var Vt=B(),N=oe(Ze(),1),o=oe(et(),1),he=(0,N.createContext)({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:Xe.NOOP});const Zt=()=>(0,N.use)(he),Qt=t=>{let e=(0,Vt.c)(14),{children:s}=t,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=[],e[0]=n):n=e[0];let{data:r,isPending:d,error:i,refetch:c}=Mt(ts,n),l;e[1]===(r==null?void 0:r.secretKeys)?l=e[2]:(l=(r==null?void 0:r.secretKeys)||[],e[1]=r==null?void 0:r.secretKeys,e[2]=l);let h;e[3]===(r==null?void 0:r.providerNames)?h=e[4]:(h=(r==null?void 0:r.providerNames)||[],e[3]=r==null?void 0:r.providerNames,e[4]=h);let p;e[5]!==i||e[6]!==d||e[7]!==c||e[8]!==l||e[9]!==h?(p={secretKeys:l,providerNames:h,loading:d,error:i,refreshSecrets:c},e[5]=i,e[6]=d,e[7]=c,e[8]=l,e[9]=h,e[10]=p):p=e[10];let f;return e[11]!==s||e[12]!==p?(f=(0,o.jsx)(he,{value:p,children:s}),e[11]=s,e[12]=p,e[13]=f):f=e[13],f},Jt={isMatch:t=>{if(t instanceof ae||t instanceof Ye){let{optionRegex:e}=a.parse(t.description||"");return!!e}return!1},Component:({schema:t,form:e,path:s})=>{let{secretKeys:n,providerNames:r,refreshSecrets:d}=Zt(),{openModal:i,closeModal:c}=Ot(),{label:l,description:h,optionRegex:p=""}=a.parse(t.description||""),[f,b]=mt(n,m=>new RegExp(p,"i").test(m));return(0,o.jsx)($t,{control:e.control,name:s,render:({field:m})=>(0,o.jsxs)(Ct,{children:[(0,o.jsx)(Dt,{children:l}),(0,o.jsx)(Rt,{children:h}),(0,o.jsx)(vt,{children:(0,o.jsxs)("div",{className:"flex gap-2",children:[t instanceof ae?(0,o.jsx)(kt,{...m,value:m.value,onChange:m.onChange,className:G("flex-1")}):(0,o.jsx)(xt,{...m,value:m.value,onChange:m.onChange,className:"flex-1"}),(0,o.jsxs)(ht,{children:[(0,o.jsx)(dt,{asChild:!0,children:(0,o.jsx)(Y,{variant:"outline",size:"icon",className:G(K(m.value)&&"bg-accent"),children:(0,o.jsx)(wt,{className:"h-3 w-3"})})}),(0,o.jsxs)(pt,{align:"end",className:"max-h-60 overflow-y-auto",children:[(0,o.jsxs)(J,{onSelect:()=>{i((0,o.jsx)(Gt,{providerNames:r,onSuccess:S=>{d(),m.onChange(te(S)),c()},onClose:c}))},children:[(0,o.jsx)(bt,{className:"mr-2 h-3.5 w-3.5"}),"Create a new secret"]}),f.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(de,{}),(0,o.jsx)(lt,{children:"Recommended"})]}),f.map(S=>(0,o.jsx)(J,{onSelect:()=>m.onChange(te(S)),children:S},S)),b.length>0&&(0,o.jsx)(de,{}),b.map(S=>(0,o.jsx)(J,{onSelect:()=>m.onChange(te(S)),children:S},S))]})]})]})}),(0,o.jsx)(jt,{})]})})}};function Yt(t){return t.provider!=="env"}function Xt(t){return t.name}function es(t){return t.keys}async function ts(){let t=await Wt.request({}),e=zt(t.secrets).filter(Yt).map(Xt);return{secretKeys:t.secrets.flatMap(es).toSorted(),providerNames:e}}var H=B(),ss=[Jt];const se=t=>{let e=(0,H.c)(2),{children:s}=t,n;return e[0]===s?n=e[1]:(n=(0,o.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:s}),e[0]=s,e[1]=n),n},re=t=>{let e=(0,H.c)(9),{name:s,color:n,icon:r,onSelect:d}=t,i;e[0]===n?i=e[1]:(i={backgroundColor:n},e[0]=n,e[1]=i);let c;e[2]===s?c=e[3]:(c=(0,o.jsx)("span",{className:"text-white font-medium text-lg",children:s}),e[2]=s,e[3]=c);let l;return e[4]!==r||e[5]!==d||e[6]!==i||e[7]!==c?(l=(0,o.jsxs)("button",{type:"button",className:"py-3 flex flex-col items-center justify-center gap-1 transition-all hover:scale-105 hover:brightness-110 rounded shadow-sm-solid hover:shadow-md-solid",style:i,onClick:d,children:[r,c]}),e[4]=r,e[5]=d,e[6]=i,e[7]=c,e[8]=l):l=e[8],l},rs=t=>{let e=(0,H.c)(25),{onBack:s,isValid:n,libraries:r,preferredLibrary:d,onLibraryChange:i,displayNames:c,libraryLabel:l}=t,h=l===void 0?"Preferred library":l,p;e[0]===s?p=e[1]:(p=(0,o.jsx)(Y,{type:"button",variant:"outline",onClick:s,children:"Back"}),e[0]=s,e[1]=p);let f=!n,b;e[2]===f?b=e[3]:(b=(0,o.jsx)(Y,{type:"submit",disabled:f,children:"Add"}),e[2]=f,e[3]=b);let m;e[4]!==p||e[5]!==b?(m=(0,o.jsxs)("div",{className:"flex gap-2",children:[p,b]}),e[4]=p,e[5]=b,e[6]=m):m=e[6];let S;e[7]===Symbol.for("react.memo_cache_sentinel")?(S=(0,o.jsx)(at,{children:(0,o.jsx)(rt,{placeholder:"Select a library"})}),e[7]=S):S=e[7];let w;e[8]===h?w=e[9]:(w=(0,o.jsxs)("div",{className:"flex flex-col gap-1 items-end",children:[S,(0,o.jsx)("span",{className:"text-xs text-muted-foreground",children:h})]}),e[8]=h,e[9]=w);let $;if(e[10]!==c||e[11]!==r){let j;e[13]===c?j=e[14]:(j=T=>(0,o.jsx)(nt,{value:T,children:c[T]??T},T),e[13]=c,e[14]=j),$=r.map(j),e[10]=c,e[11]=r,e[12]=$}else $=e[12];let x;e[15]===$?x=e[16]:(x=(0,o.jsx)(ot,{children:(0,o.jsx)(ct,{children:$})}),e[15]=$,e[16]=x);let v;e[17]!==i||e[18]!==d||e[19]!==w||e[20]!==x?(v=(0,o.jsx)("div",{children:(0,o.jsxs)(it,{value:d,onValueChange:i,children:[w,x]})}),e[17]=i,e[18]=d,e[19]=w,e[20]=x,e[21]=v):v=e[21];let A;return e[22]!==v||e[23]!==m?(A=(0,o.jsxs)("div",{className:"flex gap-2 justify-between",children:[m,v]}),e[22]=v,e[23]=m,e[24]=A):A=e[24],A};function ns(){let t=(0,H.c)(3),{createNewCell:e}=Qe(),s=Ut(),n;return t[0]!==e||t[1]!==s?(n=r=>{e({code:r,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},t[0]=e,t[1]=s,t[2]=n):n=t[2],n}const me=t=>{let e=(0,H.c)(30),{schema:s,libraries:n,preferredLibrary:r,displayNames:d,libraryLabel:i,generateCode:c,onSubmit:l,onBack:h}=t,p;e[0]===s?p=e[1]:(p=yt(s),e[0]=s,e[1]=p);let f=p,b;e[2]===s?b=e[3]:(b=Tt(s),e[2]=s,e[3]=b);let m;e[4]!==f||e[5]!==b?(m={defaultValues:f,resolver:b,reValidateMode:"onChange"},e[4]=f,e[5]=b,e[6]=m):m=e[6];let S=At(m),[w,$]=N.useState(r),x=ns(),v;e[7]!==c||e[8]!==x||e[9]!==l||e[10]!==w?(v=ze=>{x(c(ze,w)),l()},e[7]=c,e[8]=x,e[9]=l,e[10]=w,e[11]=v):v=e[11];let A=v,j;e[12]!==S||e[13]!==A?(j=S.handleSubmit(A),e[12]=S,e[13]=A,e[14]=j):j=e[14];let T;e[15]===Symbol.for("react.memo_cache_sentinel")?(T=(0,o.jsx)(Lt,{}),e[15]=T):T=e[15];let F;e[16]!==S||e[17]!==s?(F=(0,o.jsx)(Qt,{children:(0,o.jsx)(_t,{schema:s,form:S,renderers:ss,children:T})}),e[16]=S,e[17]=s,e[18]=F):F=e[18];let E;e[19]!==d||e[20]!==S.formState.isValid||e[21]!==n||e[22]!==i||e[23]!==h||e[24]!==w?(E=(0,o.jsx)(rs,{onBack:h,isValid:S.formState.isValid,libraries:n,preferredLibrary:w,onLibraryChange:$,displayNames:d,libraryLabel:i}),e[19]=d,e[20]=S.formState.isValid,e[21]=n,e[22]=i,e[23]=h,e[24]=w,e[25]=E):E=e[25];let W;return e[26]!==j||e[27]!==F||e[28]!==E?(W=(0,o.jsxs)("form",{onSubmit:j,className:"space-y-4",children:[F,E]}),e[26]=j,e[27]=F,e[28]=E,e[29]=W):W=e[29],W};function I(){return u().optional().describe(a.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function Z(t,e){let s=u();return s=e?s.nonempty():s.optional(),s=s.describe(a.of({label:t||"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"})),s}function Q(){return u().optional().describe(a.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function ne(t,e){let s=u();return s=e?s.nonempty():s.optional(),s.describe(a.of({label:t||"URI",optionRegex:".*uri.*"}))}function L(t){return u().nonempty().describe(a.of({label:t||"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function C(){return u().describe(a.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function os(){return u().describe(a.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"}))}function R(){return u().nonempty().describe(a.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function P(t){let e=Je().describe(a.of({label:"Port",inputType:"number",placeholder:t==null?void 0:t.toString()})).transform(Number).refine(s=>s>=0&&s<=65535,{message:"Port must be between 0 and 65535"});return t===void 0?e:e.default(t)}function ue(){return D().default(!1).describe(a.of({label:"Read Only"}))}const be=y({type:_("postgres"),host:L(),port:P(5432).optional(),database:C(),username:R(),password:I(),ssl:D().default(!1).describe(a.of({label:"Use SSL"}))}).describe(a.of({direction:"two-columns"})),fe=y({type:_("mysql"),host:L(),port:P(3306),database:C(),username:R(),password:I(),ssl:D().default(!1).describe(a.of({label:"Use SSL"}))}).describe(a.of({direction:"two-columns"})),ge=y({type:_("sqlite"),database:C().describe(a.of({label:"Database Path"}))}).describe(a.of({direction:"two-columns"})),ye=y({type:_("duckdb"),database:C().describe(a.of({label:"Database Path"})),read_only:ue()}).describe(a.of({direction:"two-columns"})),_e=y({type:_("motherduck"),database:C().default("my_db").describe(a.of({label:"Database Name"})),token:Z()}).describe(a.of({direction:"two-columns"})),Se=y({type:_("snowflake"),account:u().nonempty().describe(a.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:u().optional().describe(a.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:C(),schema:u().optional().describe(a.of({label:"Schema",optionRegex:".*snowflake.*"})),role:u().optional().describe(a.of({label:"Role"})),authType:M("type",[y({type:_("Password"),username:R(),password:I(),enable_mfa:D().default(!1).describe(a.of({label:"Enable MFA (Duo Push)"}))}),y({type:_("SSO (Browser)"),username:R()}),y({type:_("Key Pair"),username:R(),private_key_path:u().nonempty().describe(a.of({label:"Private Key Path",placeholder:"/path/to/rsa_key.p8"})),private_key_passphrase:u().optional().describe(a.of({label:"Private Key Passphrase",inputType:"password",optionRegex:".*passphrase.*"}))}),y({type:_("OAuth / PAT"),token:Z("Token",!0)})]).default({type:"Password",username:"username",enable_mfa:!1}).describe(a.of({special:"tabs"}))}).describe(a.of({direction:"two-columns"})),we=y({type:_("bigquery"),project:u().nonempty().describe(a.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:u().nonempty().describe(a.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:u().describe(a.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(a.of({direction:"two-columns"})),xe=y({type:_("clickhouse_connect"),host:L(),port:P(8123).optional(),username:R(),password:I(),secure:D().default(!1).describe(a.of({label:"Use HTTPs"})),proxy_path:u().optional().describe(a.of({label:"Proxy Path",placeholder:"/clickhouse"}))}).describe(a.of({direction:"two-columns"})),ke=y({type:_("timeplus"),host:L().default("localhost"),port:P(8123).optional(),username:R().default("default"),password:I().default("")}).describe(a.of({direction:"two-columns"})),ve=y({type:_("chdb"),database:C().describe(a.of({label:"Database Path"})),read_only:ue()}).describe(a.of({direction:"two-columns"})),$e=y({type:_("trino"),host:L(),port:P(8080),database:C(),schema:os().optional(),username:R(),password:I(),async_support:D().default(!1).describe(a.of({label:"Async Support"}))}).describe(a.of({direction:"two-columns"})),je=y({type:_("iceberg"),name:u().describe(a.of({label:"Catalog Name"})),catalog:M("type",[y({type:_("REST"),warehouse:Q(),uri:u().optional().describe(a.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:Z()}),y({type:_("SQL"),warehouse:Q(),uri:u().optional().describe(a.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),y({type:_("Hive"),warehouse:Q(),uri:ne()}),y({type:_("Glue"),warehouse:Q(),uri:ne()}),y({type:_("DynamoDB"),"dynamodb.profile-name":u().optional().describe(a.of({label:"Profile Name"})),"dynamodb.region":u().optional().describe(a.of({label:"Region"})),"dynamodb.access-key-id":u().optional().describe(a.of({label:"Access Key ID"})),"dynamodb.secret-access-key":u().optional().describe(a.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":u().optional().describe(a.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST",token:void 0}).describe(a.of({special:"tabs"}))}),Ae=y({type:_("datafusion"),sessionContext:D().optional().describe(a.of({label:"Use Session Context"}))}),Ce=y({type:_("pyspark"),host:L().optional(),port:P().optional()}),Re=y({type:_("redshift"),host:L(),port:P(5439),connectionType:M("type",[y({type:_("IAM credentials"),region:u().describe(a.of({label:"Region"})),aws_access_key_id:u().nonempty().describe(a.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:u().nonempty().describe(a.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:u().optional().describe(a.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),y({type:_("DB credentials"),user:R(),password:I()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:C()}).describe(a.of({direction:"two-columns"})),Te=y({type:_("databricks"),access_token:Z("Access Token",!0),server_hostname:L("Server Hostname"),http_path:ne("HTTP Path",!0),catalog:u().optional().describe(a.of({label:"Catalog"})),schema:u().optional().describe(a.of({label:"Schema"}))}).describe(a.of({direction:"two-columns"})),Le=y({type:_("supabase"),host:L(),port:P(5432).optional(),database:C(),username:R(),password:I(),disable_client_pooling:D().default(!1).describe(a.of({label:"Disable Client-Side Pooling"}))}).describe(a.of({direction:"two-columns"})),cs=M("type",[be,fe,ge,ye,_e,Se,we,xe,ke,ve,$e,je,Ae,Ce,Re,Te,Le]),De={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift",databricks:"Databricks"};var k=class{constructor(t,e,s){this.connection=t,this.orm=e,this.secrets=s}get imports(){let t=new Set(this.generateImports());switch(this.orm){case"sqlalchemy":t.add("import sqlalchemy");break;case"sqlmodel":t.add("import sqlmodel");break;case"duckdb":t.add("import duckdb");break;case"ibis":t.add("import ibis");break}return t}},as=t=>`_${t}`,is=class{constructor(){z(this,"secrets",{})}get imports(){return Object.keys(this.secrets).length===0?new Set:new Set(["import os"])}print(t,e,s){if(t=as(t),K(e)){let n=pe(e),r=s?`os.environ.get("${n}", "${s}")`:`os.environ.get("${n}")`;return this.secrets[t]=r,t}if(s!=null){let n=`os.environ.get("${e}", "${s}")`;return this.secrets[t]=n,t}return typeof e=="number"||typeof e=="number"?`${e}`:typeof e=="boolean"?O(e):e?`"${e}"`:""}printInFString(t,e,s){if(e===void 0)return"";if(typeof e=="number")return`${e}`;if(typeof e=="boolean")return O(e);let n=this.print(t,e,s);return n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1):`{${n}}`}printPassword(t,e,s,n){let r=s?this.printInFString.bind(this):this.print.bind(this);return K(t)?r(n||"password",t):r(n||"password",e,t)}getSecrets(){return this.secrets}formatSecrets(){return Object.keys(this.secrets).length===0?"":Object.entries(this.secrets).map(([t,e])=>`${t} = ${e}`).join(`
2
2
  `)}},ls=class extends k{generateImports(){return[]}generateConnectionCode(){let t=this.connection.ssl?", connect_args={'sslmode': 'require'}":"",e=this.secrets.printPassword(this.connection.password,"POSTGRES_PASSWORD",!0);return g(`
3
3
  DATABASE_URL = f"postgresql://${this.secrets.printInFString("username",this.connection.username)}:${e}@${this.secrets.printInFString("host",this.connection.host)}:${this.secrets.printInFString("port",this.connection.port)}/${this.secrets.printInFString("database",this.connection.database)}"
4
4
  engine = ${this.orm}.create_engine(DATABASE_URL${t})