@marimo-team/frontend 0.21.1-dev12 → 0.21.1-dev14
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/{CellStatus-CFRv4Tvd.js → CellStatus-CoejXnCc.js} +1 -1
- package/dist/assets/ConnectedDataExplorerComponent-DsPvYWwS.js +1 -0
- package/dist/assets/{JsonOutput-DJukuY6Z.js → JsonOutput-CBK4dhVh.js} +10 -10
- package/dist/assets/{MarimoErrorOutput-zVM0B_Vj.js → MarimoErrorOutput-B0nc63rx.js} +1 -1
- package/dist/assets/{RenderHTML-BuMvdWQd.js → RenderHTML-Bp9XY06U.js} +1 -1
- package/dist/assets/{add-cell-with-ai-BtzUxApq.js → add-cell-with-ai-CrnYAxuA.js} +1 -1
- package/dist/assets/{add-connection-dialog-BSsacvzU.js → add-connection-dialog-I31C6j-5.js} +1 -1
- package/dist/assets/{agent-panel-a_m3dm9Y.js → agent-panel-ufAvSbof.js} +1 -1
- package/dist/assets/{ai-model-dropdown-CcIreMqb.js → ai-model-dropdown-BYDC_z7s.js} +1 -1
- package/dist/assets/{app-config-button-D-mROEVq.js → app-config-button-CRfW3S6Z.js} +1 -1
- package/dist/assets/{azure-FFoHMnHA.js → azure-q5TZ9bt0.js} +1 -1
- package/dist/assets/{cell-editor-D_RsnX0J.js → cell-editor-eZKo6fP_.js} +1 -1
- package/dist/assets/{cell-link-BjgRgErj.js → cell-link-DWQZUFhO.js} +1 -1
- package/dist/assets/{cells-CAHXVi26.js → cells-Dqou-uie.js} +32 -32
- package/dist/assets/{chat-display-rX-JkJEO.js → chat-display-Vedn01P6.js} +1 -1
- package/dist/assets/{chat-panel-BudFFybg.js → chat-panel-udyCNql9.js} +1 -1
- package/dist/assets/{column-preview-Dk_9z2Mw.js → column-preview-DPhs4evg.js} +1 -1
- package/dist/assets/{command-_14PjWun.js → command-Ckfx4w5C.js} +1 -1
- package/dist/assets/command-palette-D51FjW1l.js +1 -0
- package/dist/assets/{common-D2sp4A8j.js → common-DMx0N5jj.js} +1 -1
- package/dist/assets/{components-BP1LfBLA.js → components-Bgj5U8rZ.js} +1 -1
- package/dist/assets/{components-Wzn4JDkV.js → components-CHO2M34L.js} +1 -1
- package/dist/assets/context-aware-panel-TU7i7Ais.js +3 -0
- package/dist/assets/{datasource-BNXHfowL.js → datasource-Cn-Wy4lo.js} +1 -1
- package/dist/assets/{dependency-graph-panel-B5Eq3e0f.js → dependency-graph-panel-Dd_ypMAw.js} +1 -1
- package/dist/assets/{documentation-panel-DLE-AkPt.js → documentation-panel-C1QC0dL_.js} +1 -1
- package/dist/assets/{download-SQhwj_Eq.js → download-D6Fv1GMQ.js} +1 -1
- package/dist/assets/{edit-page-qWzJGYd0.js → edit-page-DGpjBH-k.js} +7 -7
- package/dist/assets/{error-panel-DmmjuXRp.js → error-panel-BfF_Pl3q.js} +1 -1
- package/dist/assets/{file-explorer-panel-DW3BdMFp.js → file-explorer-panel-C6RCpRgm.js} +1 -1
- package/dist/assets/{file-icons-xucuZauP.js → file-icons-0zZkfGbI.js} +1 -1
- package/dist/assets/{floating-outline-2X-MQKSU.js → floating-outline-CNejeNGC.js} +1 -1
- package/dist/assets/{focus-DaKeoSx6.js → focus-CQRBseis.js} +1 -1
- package/dist/assets/{form-C5vg9S9o.js → form-B9Fj5Rl-.js} +1 -1
- package/dist/assets/formats-DzzQnJYt.js +1 -0
- package/dist/assets/{globals-DCdvUAk2.js → globals-DE7Q2ffe.js} +1 -1
- package/dist/assets/{home-page-4oOWwdL4.js → home-page-C8mwmLAs.js} +1 -1
- package/dist/assets/{hooks-CZT_TWa2.js → hooks-C8aiyK69.js} +1 -1
- package/dist/assets/{html-to-image-BgHw831z.js → html-to-image-BFwmkFZ4.js} +1 -1
- package/dist/assets/{index-CVpJvEAO.css → index-Bgbe24O9.css} +1 -1
- package/dist/assets/{index-CPEieVCj.js → index-bt3OH-Pk.js} +17 -17
- package/dist/assets/{kiosk-mode-BNqp-cFU.js → kiosk-mode-BO-KqM9l.js} +1 -1
- package/dist/assets/{layout-52MeytEk.js → layout-BEA77UDX.js} +1 -1
- package/dist/assets/{logs-panel-dWMS7IIv.js → logs-panel-BebwAaGv.js} +1 -1
- package/dist/assets/{markdown-renderer-MyhTrUey.js → markdown-renderer-CdEqa6lQ.js} +1 -1
- package/dist/assets/{mode-D_HXqDHH.js → mode-DSINUCzY.js} +1 -1
- package/dist/assets/{name-cell-input-CAAR5C2m.js → name-cell-input-DaDgZhjE.js} +1 -1
- package/dist/assets/{outline-panel-Bmfna9YR.js → outline-panel-DCpOiLnR.js} +1 -1
- package/dist/assets/{packages-panel-DKH34NxN.js → packages-panel-kOdMspq6.js} +1 -1
- package/dist/assets/{panels-jo8u0sPM.js → panels-BSQT0nmq.js} +1 -1
- package/dist/assets/{process-output-B2kGZ_VU.js → process-output-4ypD4fg7.js} +1 -1
- package/dist/assets/{readonly-python-code-Dz4GjF9D.js → readonly-python-code-CysvH2Zj.js} +1 -1
- package/dist/assets/run-page-BRdwXGaf.js +1 -0
- package/dist/assets/scratchpad-panel-DQQ_wRz5.js +1 -0
- package/dist/assets/session-panel-BACIy3wf.js +1 -0
- package/dist/assets/{snippets-panel-C0yfvEEg.js → snippets-panel-BjUFMiXc.js} +1 -1
- package/dist/assets/{state-CGu0LFDk.js → state-BqEQgvo3.js} +1 -1
- package/dist/assets/{switch-krcK9lRK.js → switch-JycgoJcn.js} +1 -1
- package/dist/assets/{tracing-3veLCmCp.js → tracing-1AoHNFA-.js} +1 -1
- package/dist/assets/{tracing-panel-KUJifV3W.js → tracing-panel-CrlCrmHo.js} +2 -2
- package/dist/assets/{useAddCell-_oR2xY1x.js → useAddCell-BSbQWv3q.js} +1 -1
- package/dist/assets/{useBoolean-D8-4no-l.js → useBoolean-Cm61eWz0.js} +1 -1
- package/dist/assets/{useCellActionButton-DNIW0rqj.js → useCellActionButton-DpdThmJR.js} +1 -1
- package/dist/assets/{useDeleteCell-BAuuakkK.js → useDeleteCell-DSpj4wDu.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-ClmZIdnO.js → useDependencyPanelTab-1iAP2AMB.js} +1 -1
- package/dist/assets/{useNotebookActions-DhmD75et.js → useNotebookActions-CU14FoaT.js} +1 -1
- package/dist/assets/{useRunCells-BOsp_Hau.js → useRunCells-BSsgvk4y.js} +1 -1
- package/dist/assets/{useSplitCell-DfYEUeyE.js → useSplitCell-Ct7RykE3.js} +1 -1
- package/dist/assets/{tooltip-DLsts-7g.js → utils-BuPoTKhl.js} +3 -3
- package/dist/assets/vega-component-S1h0g70Q.js +1 -0
- package/dist/index.html +35 -35
- package/package.json +1 -1
- package/src/components/data-table/charts/lazy-chart.tsx +2 -0
- package/src/components/data-table/column-summary/column-summary.tsx +1 -0
- package/src/components/datasources/column-preview.tsx +1 -0
- package/src/components/editor/Output.tsx +2 -0
- package/src/components/editor/chrome/panels/context-aware-panel/context-aware-panel.tsx +6 -0
- package/src/components/editor/chrome/wrapper/__tests__/utils.test.ts +35 -0
- package/src/components/editor/chrome/wrapper/app-chrome.tsx +12 -14
- package/src/components/editor/chrome/wrapper/utils.ts +5 -1
- package/src/core/codemirror/reactive-references/__tests__/analyzer.test.ts +54 -0
- package/src/core/codemirror/reactive-references/analyzer.ts +14 -0
- package/src/plugins/impl/data-explorer/ConnectedDataExplorerComponent.tsx +6 -3
- package/src/plugins/impl/vega/__tests__/utils.test.ts +36 -0
- package/src/plugins/impl/vega/utils.ts +14 -0
- package/src/plugins/impl/vega/vega-component.tsx +6 -7
- package/src/plugins/impl/vega/vega.css +1 -1
- package/dist/assets/ConnectedDataExplorerComponent-BrZvYzEX.js +0 -1
- package/dist/assets/command-palette-NBOgLsWz.js +0 -1
- package/dist/assets/context-aware-panel--8JnQtYo.js +0 -3
- package/dist/assets/formats-CmvHepzl.js +0 -1
- package/dist/assets/run-page-DQIGlYAL.js +0 -1
- package/dist/assets/scratchpad-panel-ClYOgTQp.js +0 -1
- package/dist/assets/session-panel-BYjloSxn.js +0 -1
- package/dist/assets/vega-component-D3vsTtly.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as G}from"./chunk-LvLJmgfZ.js";import{d as ye,f as ve,l as Ne,u as be}from"./useEvent-O0nX5vok.js";import{t as we}from"./react-Bj1aDYRI.js";import{Hn as ke,Hr as J,T as Ie,Vr as $e,Y as _e,b as Fe,ei as Ae,un as Te,vn as Ce}from"./cells-
|
|
1
|
+
import{s as G}from"./chunk-LvLJmgfZ.js";import{d as ye,f as ve,l as Ne,u as be}from"./useEvent-O0nX5vok.js";import{t as we}from"./react-Bj1aDYRI.js";import{Hn as ke,Hr as J,T as Ie,Vr as $e,Y as _e,b as Fe,ei as Ae,un as Te,vn as Ce}from"./cells-Dqou-uie.js";import{t as E}from"./compiler-runtime-B3qBwwSJ.js";import{t as Se}from"./invariant-CQUIhlu2.js";import{r as Me}from"./utils-BvPM6Bro.js";import{t as ze}from"./jsx-runtime-icT_Ltz2.js";import{r as K,t as $}from"./button-BZAv3veu.js";import{t as X}from"./cn-BoaCR37F.js";import{t as O}from"./createLucideIcon-Cm-Z7dYr.js";import{r as qe}from"./x-BI1M8X_v.js";import{a as Ee,p as Pe,r as Le,t as We}from"./dropdown-menu-CJ-Wwa2I.js";import{a as Ve,n as Be}from"./state-BqEQgvo3.js";import{c as Z,n as He}from"./datasource-Cn-Wy4lo.js";import{a as Qe}from"./dist-apDpadc4.js";import{t as ee}from"./tooltip-CNmaER6z.js";import{a as De,i as Oe,n as Ue,r as Re}from"./multi-map-CJMleYLX.js";import{t as te}from"./kbd-DvKpAc6K.js";import{t as A}from"./links-DzgPOFJ-.js";import{r as Ye,t as Ge}from"./alert-OQZHipbB.js";import{o as Je,t as Ke}from"./useInstallPackage-CIJ1-EHx.js";import{n as b}from"./cell-link-DWQZUFhO.js";var Xe=O("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"}]]),T=O("square-arrow-out-up-right",[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]]),re=O("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);function Ze(r){let e=null,s=r.cursor();do s.name==="ExpressionStatement"&&(e=s.node);while(s.next());return e}function et(r){let e=r.split(`
|
|
2
2
|
`),s=" ",n=Ze(Qe.parse(r));if(!n)return["def _():",...U(e,s),`${s}return`,"","","_()"].join(`
|
|
3
3
|
`);let i=r.slice(0,n.from).trim(),l=r.slice(n.from).trim(),a=i.split(`
|
|
4
4
|
`),c=l.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as v}from"./chunk-LvLJmgfZ.js";import{i as y,p as j,u as w}from"./useEvent-O0nX5vok.js";import{t as R}from"./react-Bj1aDYRI.js";import{Hr as m,Vr as S,at as H,m as _,nn as I,on as M}from"./cells-
|
|
1
|
+
import{s as v}from"./chunk-LvLJmgfZ.js";import{i as y,p as j,u as w}from"./useEvent-O0nX5vok.js";import{t as R}from"./react-Bj1aDYRI.js";import{Hr as m,Vr as S,at as H,m as _,nn as I,on as M}from"./cells-Dqou-uie.js";import{t as E}from"./compiler-runtime-B3qBwwSJ.js";import{m as N}from"./useEventListener-BGihH8bs.js";import{o as T}from"./utils-BvPM6Bro.js";import{t as V}from"./jsx-runtime-icT_Ltz2.js";import{t as z}from"./mode-DSINUCzY.js";import{t as C}from"./usePress-BHGkpw8X.js";import{n as F}from"./useDebounce-B0dx2Gp0.js";import{t as L}from"./copy-icon-Ditn6lfU.js";import{t as k}from"./useRunCells-BSsgvk4y.js";var q=E(),c=v(R(),1),o=v(V(),1);const W=r=>{let t=(0,q.c)(16),e,n,i;t[0]===r?(e=t[1],n=t[2],i=t[3]):({href:n,children:e,...i}=r,t[0]=r,t[1]=e,t[2]=n,t[3]=i);let a=(0,c.useRef)(null),s;t[4]===n?s=t[5]:(s=()=>{let u=new URL(globalThis.location.href);u.hash=n,globalThis.history.pushState({},"",u.toString()),globalThis.dispatchEvent(new HashChangeEvent("hashchange"));let x=n.slice(1),g=document.getElementById(x);g&&g.scrollIntoView({behavior:"smooth",block:"start"})},t[4]=n,t[5]=s);let l=s,f;t[6]===l?f=t[7]:(f={onPress:()=>{l()}},t[6]=l,t[7]=f);let{pressProps:h}=C(f),d;t[8]===l?d=t[9]:(d=u=>{u.preventDefault(),l()},t[8]=l,t[9]=d);let b=d,p;return t[10]!==e||t[11]!==b||t[12]!==n||t[13]!==h||t[14]!==i?(p=(0,o.jsx)("a",{ref:a,href:n,...h,onClick:b,...i,children:e}),t[10]=e,t[11]=b,t[12]=n,t[13]=h,t[14]=i,t[15]=p):p=t[15],p};async function A(r){let t=_().inOrderIds.at(0);if(t)try{let e=await I.request({document:r,cellId:t});if(!e||e.options.length===0)return;let n=r.split(".").pop()??r,i=e.options[0],a=e.options.find(s=>s.name===n)??i;a!=null&&a.completion_info&&y.set(M,{documentation:a.completion_info})}catch(e){N.debug(`Doc lookup failed for "${r}"`,e)}}var D=E();const O=r=>{let t=(0,D.c)(8),{qualifiedName:e,children:n}=r,i;t[0]===e?i=t[1]:(i=()=>{A(e)},t[0]=e,t[1]=i);let a=F(i,100),s;t[2]===a?s=t[3]:(s=()=>a.cancel(),t[2]=a,t[3]=s);let l;return t[4]!==n||t[5]!==a||t[6]!==s?(l=(0,o.jsx)("span",{onMouseEnter:a,onMouseLeave:s,children:n}),t[4]=n,t[5]=a,t[6]=s,t[7]=l):l=t[7],l};var P=j(r=>{let t=r(k),e=r(T);if(t||e)return!1;let n=!0;try{n=z()==="read"}catch{return!0}return!n});function $(){return w(P)}var B=E(),U=r=>{if(r instanceof m.Element&&!/^[A-Za-z][\w-]*$/.test(r.name))return c.createElement(c.Fragment)},Z=(r,t)=>{if(t instanceof m.Element&&t.name==="body"){if((0,c.isValidElement)(r)&&"props"in r){let e=r.props.children;return(0,o.jsx)(o.Fragment,{children:e})}return}},G=(r,t)=>{if(t instanceof m.Element&&t.name==="html"){if((0,c.isValidElement)(r)&&"props"in r){let e=r.props.children;return(0,o.jsx)(o.Fragment,{children:e})}return}},J=r=>{if(r instanceof m.Element&&r.attribs&&r.name==="iframe"){let t=document.createElement("iframe");return Object.entries(r.attribs).forEach(([e,n])=>{e.startsWith('"')&&e.endsWith('"')&&(e=e.slice(1,-1)),t.setAttribute(e,n)}),(0,o.jsx)("div",{dangerouslySetInnerHTML:{__html:t.outerHTML}})}},K=r=>{if(r instanceof m.Element&&r.name==="script"){let t=r.attribs.src;if(!t)return;if(!document.querySelector(`script[src="${t}"]`)){let e=document.createElement("script");e.src=t,document.head.append(e)}return(0,o.jsx)(o.Fragment,{})}},Q=(r,t)=>{if(t instanceof m.Element&&t.name==="a"){let e=t.attribs.href;if(e!=null&&e.startsWith("#")&&!e.startsWith("#code/")){let n=null;return(0,c.isValidElement)(r)&&"props"in r&&(n=r.props.children),(0,o.jsx)(W,{href:e,...t.attribs,children:n})}}},X=(r,t,e)=>{var n,i;if(t instanceof m.Element&&t.name==="div"&&((i=(n=t.attribs)==null?void 0:n.class)!=null&&i.includes("codehilite")))return(0,o.jsx)(tt,{children:r},e)},Y=(r,t)=>{var e;if(t instanceof m.Element&&((e=t.attribs)!=null&&e["data-marimo-doc"])){let n=t.attribs["data-marimo-doc"];return(0,o.jsx)(O,{qualifiedName:n,children:r})}},tt=r=>{let t=(0,B.c)(3),{children:e}=r,n=(0,c.useRef)(null),i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,o.jsx)("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,o.jsx)(L,{tooltip:!1,className:"p-1",value:()=>{var l;let s=(l=n.current)==null?void 0:l.firstChild;return s&&s.textContent||""}})}),t[0]=i):i=t[0];let a;return t[1]===e?a=t[2]:(a=(0,o.jsxs)("div",{className:"relative group codehilite-wrapper",ref:n,children:[e,i]}),t[1]=e,t[2]=a),a};const et=({html:r,additionalReplacements:t=[],alwaysSanitizeHtml:e=!0})=>(0,o.jsx)(rt,{html:r,alwaysSanitizeHtml:e,additionalReplacements:t});var rt=({html:r,additionalReplacements:t=[],alwaysSanitizeHtml:e})=>{let n=$();return nt({html:(0,c.useMemo)(()=>e||n?H(r):r,[r,e,n]),additionalReplacements:t})};function nt({html:r,additionalReplacements:t=[]}){let e=[U,J,K,...t],n=[X,Q,Y,Z,G];return S(r,{replace:(i,a)=>{for(let s of e){let l=s(i,a);if(l)return l}return i},transform:(i,a,s)=>{for(let l of n){let f=l(i,a,s);if(f)return f}return i}})}export{et as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _i=Object.defineProperty;var bi=(t,e,a)=>e in t?_i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var L=(t,e,a)=>bi(t,typeof e!="symbol"?e+"":e,a);import{s as Za,t as xi}from"./chunk-LvLJmgfZ.js";import{f as Kr,i as Yr,l as wi,n as Hr,o as ki,u as Gr}from"./useEvent-O0nX5vok.js";import{t as Ci}from"./react-Bj1aDYRI.js";import{Ar as Ei,Dr as Ti,Jn as Ii,Kn as Si,Mt as Qr,Qr as Ai,Rt as Oi,T as Xr,b as Ge,bt as Ri,ei as Ni,f as ji,i as Mi,ir as Pi,jn as Li,oi as es,or as $i,qr as Di,si as Zi,sr as ts,st as Fa,vn as Fi,xn as zi}from"./cells-
|
|
1
|
+
var _i=Object.defineProperty;var bi=(t,e,a)=>e in t?_i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var L=(t,e,a)=>bi(t,typeof e!="symbol"?e+"":e,a);import{s as Za,t as xi}from"./chunk-LvLJmgfZ.js";import{f as Kr,i as Yr,l as wi,n as Hr,o as ki,u as Gr}from"./useEvent-O0nX5vok.js";import{t as Ci}from"./react-Bj1aDYRI.js";import{Ar as Ei,Dr as Ti,Jn as Ii,Kn as Si,Mt as Qr,Qr as Ai,Rt as Oi,T as Xr,b as Ge,bt as Ri,ei as Ni,f as ji,i as Mi,ir as Pi,jn as Li,oi as es,or as $i,qr as Di,si as Zi,sr as ts,st as Fa,vn as Fi,xn as zi}from"./cells-Dqou-uie.js";import{B as Ce,D as Ui,E as as,H as Vi,I as Nt,J as rs,L as Q,N as ss,O as qi,P as H,R as E,S as Bi,T as ce,V as Fe,W as ns,b as aa,k as M,w as ze,x as ra}from"./zod-H_cgTO0M.js";import{t as jt}from"./compiler-runtime-B3qBwwSJ.js";import{n as is}from"./assertNever-CTRGz-ul.js";import{t as Wi,w as Ji}from"./ai-model-dropdown-BYDC_z7s.js";import{m as ie,u as Ki}from"./useEventListener-BGihH8bs.js";import{n as Yi}from"./utils-BvPM6Bro.js";import{o as Hi}from"./config-DeEqZTX7.js";import{t as Gi}from"./jsx-runtime-icT_Ltz2.js";import{t as Qe}from"./button-BZAv3veu.js";import{t as za}from"./cn-BoaCR37F.js";import{Ht as Qi,Jt as sa,St as na,Vt as Xi,Wt as os,Yt as ia,Zt as eo,at as ls,ct as to,lt as ds,rt as Ua,xt as ao}from"./dist-B_cxg-E4.js";import{t as ro}from"./createReducer-DgaMD0B6.js";import{h as so,n as no,o as io,r as oo}from"./dist-D0Vj4Kqc.js";import{r as lo,t as uo}from"./requests-Bgjtqo_1.js";import{t as oa}from"./createLucideIcon-Cm-Z7dYr.js";import{t as us}from"./x-BI1M8X_v.js";import{l as cs,n as co,p as po}from"./markdown-renderer-CdEqa6lQ.js";import{a as ps,c as mo,p as ho,r as fo,t as go}from"./dropdown-menu-CJ-Wwa2I.js";import{t as ms}from"./file-DzHkbIdO.js";import{t as yo}from"./image-DXfkah9d.js";import{t as vo}from"./spinner-C5JoisA7.js";import{t as _o}from"./play-DKSqmedg.js";import{r as bo}from"./input-BRZ8bt6P.js";import{a as xo}from"./state-BqEQgvo3.js";import{a as Mt,i as wt,o as Pt,r as kt,s as wo,t as ko}from"./datasource-Cn-Wy4lo.js";import{a as Co}from"./dist-BNC_tnlW.js";import{t as Va}from"./use-toast-Hc8CXlvz.js";import{r as Eo}from"./useTheme-CM9j8dgy.js";import{t as la}from"./tooltip-CNmaER6z.js";import{d as To}from"./popover-Du6bDNYH.js";import{r as Io}from"./errors-Bfogio62.js";import{t as So}from"./blob-CObhN-9g.js";import{n as Ao}from"./useRunCells-BSsgvk4y.js";import{i as qa}from"./cell-link-DWQZUFhO.js";import{r as Oo,t as Ro}from"./html-to-image-BFwmkFZ4.js";import{n as Ba}from"./renderShortcut-Bgu3XVfT.js";import{t as No}from"./process-output-4ypD4fg7.js";import{t as jo}from"./useDeleteCell-DSpj4wDu.js";import{r as Mo,t as Po}from"./esm-CBkHtTOV.js";import{n as Lo}from"./icons-CrUXojcA.js";var hs=oa("at-sign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]),fs=oa("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]),gs=oa("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),ys=oa("send-horizontal",[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]),vs="vercel.ai.error",$o=Symbol.for(vs),_s,bs,Xe=class ci extends(bs=Error,_s=$o,bs){constructor({name:e,message:a,cause:r}){super(a),this[_s]=!0,this.name=e,this.cause=r}static isInstance(e){return ci.hasMarker(e,vs)}static hasMarker(e,a){let r=Symbol.for(a);return typeof e=="object"&&!!e&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function xs(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var ws="AI_InvalidArgumentError",ks=`vercel.ai.error.${ws}`,Do=Symbol.for(ks),Cs,Es,Zo=class extends(Es=Xe,Cs=Do,Es){constructor({message:t,cause:e,argument:a}){super({name:ws,message:t,cause:e}),this[Cs]=!0,this.argument=a}static isInstance(t){return Xe.hasMarker(t,ks)}},Ts="AI_JSONParseError",Is=`vercel.ai.error.${Ts}`,Fo=Symbol.for(Is),Ss,As,Os=class extends(As=Xe,Ss=Fo,As){constructor({text:t,cause:e}){super({name:Ts,message:`JSON parsing failed: Text: ${t}.
|
|
2
2
|
Error message: ${xs(e)}`,cause:e}),this[Ss]=!0,this.text=t}static isInstance(t){return Xe.hasMarker(t,Is)}},Rs="AI_TypeValidationError",Ns=`vercel.ai.error.${Rs}`,zo=Symbol.for(Ns),js,Ms,da=class zr extends(Ms=Xe,js=zo,Ms){constructor({value:e,cause:a}){super({name:Rs,message:`Type validation failed: Value: ${JSON.stringify(e)}.
|
|
3
3
|
Error message: ${xs(a)}`,cause:a}),this[js]=!0,this.value=e}static isInstance(e){return Xe.hasMarker(e,Ns)}static wrap({value:e,cause:a}){return zr.isInstance(a)&&a.value===e?a:new zr({value:e,cause:a})}},Ps=class extends Error{constructor(t,e){super(t),this.name="ParseError",this.type=e.type,this.field=e.field,this.value=e.value,this.line=e.line}};function Wa(t){}function Uo(t){if(typeof t=="function")throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Wa,onError:a=Wa,onRetry:r=Wa,onComment:s}=t,n="",o=!0,i,l="",d="";function u(f){let p=o?f.replace(/^\xEF\xBB\xBF/,""):f,[h,v]=Vo(`${n}${p}`);for(let T of h)c(T);n=v,o=!1}function c(f){if(f===""){m();return}if(f.startsWith(":")){s&&s(f.slice(f.startsWith(": ")?2:1));return}let p=f.indexOf(":");if(p!==-1){let h=f.slice(0,p),v=f[p+1]===" "?2:1;g(h,f.slice(p+v),f);return}g(f,"",f)}function g(f,p,h){switch(f){case"event":d=p;break;case"data":l=`${l}${p}
|
|
4
4
|
`;break;case"id":i=p.includes("\0")?void 0:p;break;case"retry":/^\d+$/.test(p)?r(parseInt(p,10)):a(new Ps(`Invalid \`retry\` value: "${p}"`,{type:"invalid-retry",value:p,line:h}));break;default:a(new Ps(`Unknown field "${f.length>20?`${f.slice(0,20)}\u2026`:f}"`,{type:"unknown-field",field:f,value:p,line:h}));break}}function m(){l.length>0&&e({id:i,event:d||void 0,data:l.endsWith(`
|
|
@@ -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 ne}from"./chunk-LvLJmgfZ.js";import{t as Ze}from"./react-Bj1aDYRI.js";import{Dn as g,T as Qe,mt as ce}from"./cells-CAHXVi26.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{t as U}from"./assertNever-CTRGz-ul.js";import{t as Xe}from"./_createAggregator-zT4tQxzT.js";import{h as et}from"./useEventListener-BGihH8bs.js";import{t as tt}from"./jsx-runtime-icT_Ltz2.js";import{t as J}from"./button-BZAv3veu.js";import{t as G}from"./cn-BoaCR37F.js";import{t as st}from"./createLucideIcon-Cm-Z7dYr.js";import{t as rt}from"./circle-plus-CGG-gArM.js";import{a as Y,c as ie,o as ot,p as nt,r as ct,t as at}from"./dropdown-menu-CJ-Wwa2I.js";import{t as it}from"./database-zap-DTWCDKdn.js";import{t as lt}from"./github-BVtI-3F1.js";import{m as dt,o as pt,t as ht,u as a}from"./form-C5vg9S9o.js";import{n as mt}from"./DeferredRequestRegistry-O6RDJKs0.js";import{o as ut,r as bt}from"./input-BRZ8bt6P.js";import{c as ft,d as gt,f as yt,h as _t,l as wt,n as St,p as xt,s as kt,t as vt,u as $t,v as jt}from"./azure-FFoHMnHA.js";import{r as At}from"./useTheme-CM9j8dgy.js";import{c as Ct,i as Rt,n as Tt,r as Lt,s as Dt,t as It}from"./select-Ch6m1k2G.js";import{a as Pt,c as qt,l as Nt,n as Ft,r as Et,t as Bt}from"./dialog-CyL4o0mA.js";import{c as le,l as Ot,s as Mt,u as de}from"./popover-Du6bDNYH.js";import{n as Ut}from"./ImperativeModal-CDxa8mJa.js";import{t as V}from"./links-DzgPOFJ-.js";import{n as Kt}from"./useAsyncData-D-4ifFXh.js";import{o as Ht}from"./focus-DaKeoSx6.js";import{t as Wt}from"./request-registry-B-7cIM_I.js";import{n as zt,t as Gt}from"./write-secret-modal-VGPgwkTg.js";var Vt=Xe(function(t,e,s){t[s?0:1].push(e)},function(){return[[],[]]}),X=st("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 Zt=B(),N=ne(Ze(),1),n=ne(tt(),1),he=(0,N.createContext)({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:et.NOOP});const Qt=()=>(0,N.use)(he),Jt=t=>{let e=(0,Zt.c)(14),{children:s}=t,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0];let{data:r,isPending:d,error:i,refetch:c}=Kt(ss,o),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,n.jsx)(he,{value:p,children:s}),e[11]=s,e[12]=p,e[13]=f):f=e[13],f},Yt={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:o,providerNames:r,refreshSecrets:d}=Qt(),{openModal:i,closeModal:c}=Ut(),{label:l,description:h,optionRegex:p=""}=a.parse(t.description||""),[f,b]=Vt(o,m=>new RegExp(p,"i").test(m));return(0,n.jsx)($t,{control:e.control,name:s,render:({field:m})=>(0,n.jsxs)(gt,{children:[(0,n.jsx)(yt,{children:l}),(0,n.jsx)(ft,{children:h}),(0,n.jsx)(kt,{children:(0,n.jsxs)("div",{className:"flex gap-2",children:[t instanceof ae?(0,n.jsx)(bt,{...m,value:m.value,onChange:m.onChange,className:G("flex-1")}):(0,n.jsx)(ut,{...m,value:m.value,onChange:m.onChange,className:"flex-1"}),(0,n.jsxs)(at,{children:[(0,n.jsx)(nt,{asChild:!0,children:(0,n.jsx)(J,{variant:"outline",size:"icon",className:G(K(m.value)&&"bg-accent"),children:(0,n.jsx)(mt,{className:"h-3 w-3"})})}),(0,n.jsxs)(ct,{align:"end",className:"max-h-60 overflow-y-auto",children:[(0,n.jsxs)(Y,{onSelect:()=>{i((0,n.jsx)(Gt,{providerNames:r,onSuccess:w=>{d(),m.onChange(te(w)),c()},onClose:c}))},children:[(0,n.jsx)(rt,{className:"mr-2 h-3.5 w-3.5"}),"Create a new secret"]}),f.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ie,{}),(0,n.jsx)(ot,{children:"Recommended"})]}),f.map(w=>(0,n.jsx)(Y,{onSelect:()=>m.onChange(te(w)),children:w},w)),b.length>0&&(0,n.jsx)(ie,{}),b.map(w=>(0,n.jsx)(Y,{onSelect:()=>m.onChange(te(w)),children:w},w))]})]})]})}),(0,n.jsx)(xt,{})]})})}};function Xt(t){return t.provider!=="env"}function es(t){return t.name}function ts(t){return t.keys}async function ss(){let t=await Wt.request({}),e=zt(t.secrets).filter(Xt).map(es);return{secretKeys:t.secrets.flatMap(ts).sort(),providerNames:e}}var H=B(),rs=[Yt];const se=t=>{let e=(0,H.c)(2),{children:s}=t,o;return e[0]===s?o=e[1]:(o=(0,n.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:s}),e[0]=s,e[1]=o),o},re=t=>{let e=(0,H.c)(9),{name:s,color:o,icon:r,onSelect:d}=t,i;e[0]===o?i=e[1]:(i={backgroundColor:o},e[0]=o,e[1]=i);let c;e[2]===s?c=e[3]:(c=(0,n.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,n.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},os=t=>{let e=(0,H.c)(25),{onBack:s,isValid:o,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,n.jsx)(J,{type:"button",variant:"outline",onClick:s,children:"Back"}),e[0]=s,e[1]=p);let f=!o,b;e[2]===f?b=e[3]:(b=(0,n.jsx)(J,{type:"submit",disabled:f,children:"Add"}),e[2]=f,e[3]=b);let m;e[4]!==p||e[5]!==b?(m=(0,n.jsxs)("div",{className:"flex gap-2",children:[p,b]}),e[4]=p,e[5]=b,e[6]=m):m=e[6];let w;e[7]===Symbol.for("react.memo_cache_sentinel")?(w=(0,n.jsx)(Dt,{children:(0,n.jsx)(Ct,{placeholder:"Select a library"})}),e[7]=w):w=e[7];let S;e[8]===h?S=e[9]:(S=(0,n.jsxs)("div",{className:"flex flex-col gap-1 items-end",children:[w,(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:h})]}),e[8]=h,e[9]=S);let $;if(e[10]!==c||e[11]!==r){let j;e[13]===c?j=e[14]:(j=T=>(0,n.jsx)(Rt,{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,n.jsx)(Tt,{children:(0,n.jsx)(Lt,{children:$})}),e[15]=$,e[16]=x);let v;e[17]!==i||e[18]!==d||e[19]!==S||e[20]!==x?(v=(0,n.jsx)("div",{children:(0,n.jsxs)(It,{value:d,onValueChange:i,children:[S,x]})}),e[17]=i,e[18]=d,e[19]=S,e[20]=x,e[21]=v):v=e[21];let A;return e[22]!==v||e[23]!==m?(A=(0,n.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=Ht(),o;return t[0]!==e||t[1]!==s?(o=r=>{e({code:r,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},t[0]=e,t[1]=s,t[2]=o):o=t[2],o}const me=t=>{let e=(0,H.c)(30),{schema:s,libraries:o,preferredLibrary:r,displayNames:d,libraryLabel:i,generateCode:c,onSubmit:l,onBack:h}=t,p;e[0]===s?p=e[1]:(p=pt(s),e[0]=s,e[1]=p);let f=p,b;e[2]===s?b=e[3]:(b=_t(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 w=jt(m),[S,$]=N.useState(r),x=ns(),v;e[7]!==c||e[8]!==x||e[9]!==l||e[10]!==S?(v=ze=>{x(c(ze,S)),l()},e[7]=c,e[8]=x,e[9]=l,e[10]=S,e[11]=v):v=e[11];let A=v,j;e[12]!==w||e[13]!==A?(j=w.handleSubmit(A),e[12]=w,e[13]=A,e[14]=j):j=e[14];let T;e[15]===Symbol.for("react.memo_cache_sentinel")?(T=(0,n.jsx)(wt,{}),e[15]=T):T=e[15];let F;e[16]!==w||e[17]!==s?(F=(0,n.jsx)(Jt,{children:(0,n.jsx)(ht,{schema:s,form:w,renderers:rs,children:T})}),e[16]=w,e[17]=s,e[18]=F):F=e[18];let E;e[19]!==d||e[20]!==w.formState.isValid||e[21]!==o||e[22]!==i||e[23]!==h||e[24]!==S?(E=(0,n.jsx)(os,{onBack:h,isValid:w.formState.isValid,libraries:o,preferredLibrary:S,onLibraryChange:$,displayNames:d,libraryLabel:i}),e[19]=d,e[20]=w.formState.isValid,e[21]=o,e[22]=i,e[23]=h,e[24]=S,e[25]=E):E=e[25];let W;return e[26]!==j||e[27]!==F||e[28]!==E?(W=(0,n.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 oe(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 cs(){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"})),we=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"})),Se=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:cs().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:oe()}),y({type:_("Glue"),warehouse:Q(),uri:oe()}),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:oe("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"})),as=M("type",[be,fe,ge,ye,_e,we,Se,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}},is=t=>`_${t}`,ls=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=is(t),K(e)){let o=pe(e),r=s?`os.environ.get("${o}", "${s}")`:`os.environ.get("${o}")`;return this.secrets[t]=r,t}if(s!=null){let o=`os.environ.get("${e}", "${s}")`;return this.secrets[t]=o,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 o=this.print(t,e,s);return o.startsWith('"')&&o.endsWith('"')?o.slice(1,-1):`{${o}}`}printPassword(t,e,s,o){let r=s?this.printInFString.bind(this):this.print.bind(this);return K(t)?r(o||"password",t):r(o||"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 ne}from"./chunk-LvLJmgfZ.js";import{t as Ze}from"./react-Bj1aDYRI.js";import{Dn as g,T as Qe,mt as ce}from"./cells-Dqou-uie.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{t as U}from"./assertNever-CTRGz-ul.js";import{t as Xe}from"./_createAggregator-zT4tQxzT.js";import{h as et}from"./useEventListener-BGihH8bs.js";import{t as tt}from"./jsx-runtime-icT_Ltz2.js";import{t as J}from"./button-BZAv3veu.js";import{t as G}from"./cn-BoaCR37F.js";import{t as st}from"./createLucideIcon-Cm-Z7dYr.js";import{t as rt}from"./circle-plus-CGG-gArM.js";import{a as Y,c as ie,o as ot,p as nt,r as ct,t as at}from"./dropdown-menu-CJ-Wwa2I.js";import{t as it}from"./database-zap-DTWCDKdn.js";import{t as lt}from"./github-BVtI-3F1.js";import{m as dt,o as pt,t as ht,u as a}from"./form-B9Fj5Rl-.js";import{n as mt}from"./DeferredRequestRegistry-O6RDJKs0.js";import{o as ut,r as bt}from"./input-BRZ8bt6P.js";import{c as ft,d as gt,f as yt,h as _t,l as wt,n as St,p as xt,s as kt,t as vt,u as $t,v as jt}from"./azure-q5TZ9bt0.js";import{r as At}from"./useTheme-CM9j8dgy.js";import{c as Ct,i as Rt,n as Tt,r as Lt,s as Dt,t as It}from"./select-Ch6m1k2G.js";import{a as Pt,c as qt,l as Nt,n as Ft,r as Et,t as Bt}from"./dialog-CyL4o0mA.js";import{c as le,l as Ot,s as Mt,u as de}from"./popover-Du6bDNYH.js";import{n as Ut}from"./ImperativeModal-CDxa8mJa.js";import{t as V}from"./links-DzgPOFJ-.js";import{n as Kt}from"./useAsyncData-D-4ifFXh.js";import{o as Ht}from"./focus-CQRBseis.js";import{t as Wt}from"./request-registry-B-7cIM_I.js";import{n as zt,t as Gt}from"./write-secret-modal-VGPgwkTg.js";var Vt=Xe(function(t,e,s){t[s?0:1].push(e)},function(){return[[],[]]}),X=st("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 Zt=B(),N=ne(Ze(),1),n=ne(tt(),1),he=(0,N.createContext)({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:et.NOOP});const Qt=()=>(0,N.use)(he),Jt=t=>{let e=(0,Zt.c)(14),{children:s}=t,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0];let{data:r,isPending:d,error:i,refetch:c}=Kt(ss,o),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,n.jsx)(he,{value:p,children:s}),e[11]=s,e[12]=p,e[13]=f):f=e[13],f},Yt={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:o,providerNames:r,refreshSecrets:d}=Qt(),{openModal:i,closeModal:c}=Ut(),{label:l,description:h,optionRegex:p=""}=a.parse(t.description||""),[f,b]=Vt(o,m=>new RegExp(p,"i").test(m));return(0,n.jsx)($t,{control:e.control,name:s,render:({field:m})=>(0,n.jsxs)(gt,{children:[(0,n.jsx)(yt,{children:l}),(0,n.jsx)(ft,{children:h}),(0,n.jsx)(kt,{children:(0,n.jsxs)("div",{className:"flex gap-2",children:[t instanceof ae?(0,n.jsx)(bt,{...m,value:m.value,onChange:m.onChange,className:G("flex-1")}):(0,n.jsx)(ut,{...m,value:m.value,onChange:m.onChange,className:"flex-1"}),(0,n.jsxs)(at,{children:[(0,n.jsx)(nt,{asChild:!0,children:(0,n.jsx)(J,{variant:"outline",size:"icon",className:G(K(m.value)&&"bg-accent"),children:(0,n.jsx)(mt,{className:"h-3 w-3"})})}),(0,n.jsxs)(ct,{align:"end",className:"max-h-60 overflow-y-auto",children:[(0,n.jsxs)(Y,{onSelect:()=>{i((0,n.jsx)(Gt,{providerNames:r,onSuccess:w=>{d(),m.onChange(te(w)),c()},onClose:c}))},children:[(0,n.jsx)(rt,{className:"mr-2 h-3.5 w-3.5"}),"Create a new secret"]}),f.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ie,{}),(0,n.jsx)(ot,{children:"Recommended"})]}),f.map(w=>(0,n.jsx)(Y,{onSelect:()=>m.onChange(te(w)),children:w},w)),b.length>0&&(0,n.jsx)(ie,{}),b.map(w=>(0,n.jsx)(Y,{onSelect:()=>m.onChange(te(w)),children:w},w))]})]})]})}),(0,n.jsx)(xt,{})]})})}};function Xt(t){return t.provider!=="env"}function es(t){return t.name}function ts(t){return t.keys}async function ss(){let t=await Wt.request({}),e=zt(t.secrets).filter(Xt).map(es);return{secretKeys:t.secrets.flatMap(ts).sort(),providerNames:e}}var H=B(),rs=[Yt];const se=t=>{let e=(0,H.c)(2),{children:s}=t,o;return e[0]===s?o=e[1]:(o=(0,n.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:s}),e[0]=s,e[1]=o),o},re=t=>{let e=(0,H.c)(9),{name:s,color:o,icon:r,onSelect:d}=t,i;e[0]===o?i=e[1]:(i={backgroundColor:o},e[0]=o,e[1]=i);let c;e[2]===s?c=e[3]:(c=(0,n.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,n.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},os=t=>{let e=(0,H.c)(25),{onBack:s,isValid:o,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,n.jsx)(J,{type:"button",variant:"outline",onClick:s,children:"Back"}),e[0]=s,e[1]=p);let f=!o,b;e[2]===f?b=e[3]:(b=(0,n.jsx)(J,{type:"submit",disabled:f,children:"Add"}),e[2]=f,e[3]=b);let m;e[4]!==p||e[5]!==b?(m=(0,n.jsxs)("div",{className:"flex gap-2",children:[p,b]}),e[4]=p,e[5]=b,e[6]=m):m=e[6];let w;e[7]===Symbol.for("react.memo_cache_sentinel")?(w=(0,n.jsx)(Dt,{children:(0,n.jsx)(Ct,{placeholder:"Select a library"})}),e[7]=w):w=e[7];let S;e[8]===h?S=e[9]:(S=(0,n.jsxs)("div",{className:"flex flex-col gap-1 items-end",children:[w,(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:h})]}),e[8]=h,e[9]=S);let $;if(e[10]!==c||e[11]!==r){let j;e[13]===c?j=e[14]:(j=T=>(0,n.jsx)(Rt,{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,n.jsx)(Tt,{children:(0,n.jsx)(Lt,{children:$})}),e[15]=$,e[16]=x);let v;e[17]!==i||e[18]!==d||e[19]!==S||e[20]!==x?(v=(0,n.jsx)("div",{children:(0,n.jsxs)(It,{value:d,onValueChange:i,children:[S,x]})}),e[17]=i,e[18]=d,e[19]=S,e[20]=x,e[21]=v):v=e[21];let A;return e[22]!==v||e[23]!==m?(A=(0,n.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=Ht(),o;return t[0]!==e||t[1]!==s?(o=r=>{e({code:r,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},t[0]=e,t[1]=s,t[2]=o):o=t[2],o}const me=t=>{let e=(0,H.c)(30),{schema:s,libraries:o,preferredLibrary:r,displayNames:d,libraryLabel:i,generateCode:c,onSubmit:l,onBack:h}=t,p;e[0]===s?p=e[1]:(p=pt(s),e[0]=s,e[1]=p);let f=p,b;e[2]===s?b=e[3]:(b=_t(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 w=jt(m),[S,$]=N.useState(r),x=ns(),v;e[7]!==c||e[8]!==x||e[9]!==l||e[10]!==S?(v=ze=>{x(c(ze,S)),l()},e[7]=c,e[8]=x,e[9]=l,e[10]=S,e[11]=v):v=e[11];let A=v,j;e[12]!==w||e[13]!==A?(j=w.handleSubmit(A),e[12]=w,e[13]=A,e[14]=j):j=e[14];let T;e[15]===Symbol.for("react.memo_cache_sentinel")?(T=(0,n.jsx)(wt,{}),e[15]=T):T=e[15];let F;e[16]!==w||e[17]!==s?(F=(0,n.jsx)(Jt,{children:(0,n.jsx)(ht,{schema:s,form:w,renderers:rs,children:T})}),e[16]=w,e[17]=s,e[18]=F):F=e[18];let E;e[19]!==d||e[20]!==w.formState.isValid||e[21]!==o||e[22]!==i||e[23]!==h||e[24]!==S?(E=(0,n.jsx)(os,{onBack:h,isValid:w.formState.isValid,libraries:o,preferredLibrary:S,onLibraryChange:$,displayNames:d,libraryLabel:i}),e[19]=d,e[20]=w.formState.isValid,e[21]=o,e[22]=i,e[23]=h,e[24]=S,e[25]=E):E=e[25];let W;return e[26]!==j||e[27]!==F||e[28]!==E?(W=(0,n.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 oe(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 cs(){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"})),we=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"})),Se=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:cs().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:oe()}),y({type:_("Glue"),warehouse:Q(),uri:oe()}),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:oe("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"})),as=M("type",[be,fe,ge,ye,_e,we,Se,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}},is=t=>`_${t}`,ls=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=is(t),K(e)){let o=pe(e),r=s?`os.environ.get("${o}", "${s}")`:`os.environ.get("${o}")`;return this.secrets[t]=r,t}if(s!=null){let o=`os.environ.get("${e}", "${s}")`;return this.secrets[t]=o,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 o=this.print(t,e,s);return o.startsWith('"')&&o.endsWith('"')?o.slice(1,-1):`{${o}}`}printPassword(t,e,s,o){let r=s?this.printInFString.bind(this):this.print.bind(this);return K(t)?r(o||"password",t):r(o||"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
|
`)}},ds=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})
|