@marimo-team/frontend 0.22.5-dev6 → 0.22.5-dev8
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-HZQ0Twqj.js → CellStatus-vLQ0PRhL.js} +1 -1
- package/dist/assets/{ConnectedDataExplorerComponent-C9jSHm_Y.js → ConnectedDataExplorerComponent-CAllw3YA.js} +1 -1
- package/dist/assets/{ImperativeModal-Ka_MU6gk.js → ImperativeModal-DoGv2BXV.js} +1 -1
- package/dist/assets/{JsonOutput-C0_rp6zm.js → JsonOutput-Dl2dfhmz.js} +12 -12
- package/dist/assets/{LazyAnyLanguageCodeMirror-Bb2dITRz.js → LazyAnyLanguageCodeMirror-CoYqQxHb.js} +2 -2
- package/dist/assets/MarimoErrorOutput-CbOtWgTE.js +7 -0
- package/dist/assets/RSPContexts-LWFBF00h.js +1 -0
- package/dist/assets/{RenderHTML-Cyj8OBbz.js → RenderHTML-HmYLAtrW.js} +1 -1
- package/dist/assets/{add-cell-with-ai-BccDsMLb.js → add-cell-with-ai-DVz3Rqa3.js} +4 -4
- package/dist/assets/{add-connection-dialog-BO_nxLQi.js → add-connection-dialog-Bu5E77IS.js} +1 -1
- package/dist/assets/{agent-panel-BMTl3Cgd.js → agent-panel-HMju_soU.js} +1 -1
- package/dist/assets/{ai-model-dropdown-CS5ryevV.js → ai-model-dropdown-DUK_vWZh.js} +4 -4
- package/dist/assets/{any-language-editor-BKxF_o5k.js → any-language-editor-DYgTL8eG.js} +1 -1
- package/dist/assets/app-config-button-CVraCieA.js +1 -0
- package/dist/assets/{cache-panel-PA0cVzei.js → cache-panel-5QBCQUqv.js} +1 -1
- package/dist/assets/{cell-editor-qLPKK49y.js → cell-editor-CEok7I_G.js} +9 -9
- package/dist/assets/{cell-link-CY7i_e4O.js → cell-link-D5GhiNrn.js} +1 -1
- package/dist/assets/{chat-display-BLYrUQhO.js → chat-display-ktpBhrn7.js} +1 -1
- package/dist/assets/{chat-panel-w9jaKRAD.js → chat-panel-BzN2cf87.js} +2 -2
- package/dist/assets/{chat-ui-BqpUGrwS.js → chat-ui-Da4qjTuA.js} +4 -4
- package/dist/assets/{column-preview-Dk6-wUK-.js → column-preview-BLzfoQuq.js} +1 -1
- package/dist/assets/{command-DkwDd6Ey.js → command-DvF_4mQa.js} +1 -1
- package/dist/assets/{command-palette-C0hZrhup.js → command-palette-DNvYHUpi.js} +1 -1
- package/dist/assets/{common-CL1iSwod.js → common-BKyn8lE1.js} +1 -1
- package/dist/assets/{copy-icon-n6r2uyq3.js → copy-icon-BGs1Pbai.js} +1 -1
- package/dist/assets/{dependency-graph-panel-3AdEtWPZ.js → dependency-graph-panel-Cq1gKP3a.js} +1 -1
- package/dist/assets/{diagram-PSM6KHXK-D6nw8Fvd.js → diagram-PSM6KHXK-UdiW7QQb.js} +1 -1
- package/dist/assets/{documentation-panel-CVIUk8ga.js → documentation-panel-Dd6ys__C.js} +1 -1
- package/dist/assets/{download-pkTDt-sj.js → download-CxGVI9eo.js} +1 -1
- package/dist/assets/{edit-page-6Fpl3Fez.js → edit-page-DJprVtJ6.js} +7 -7
- package/dist/assets/{error-banner-Bfe6BopK.js → error-banner-bXc_9BBZ.js} +1 -1
- package/dist/assets/{error-panel-Cy3_isDL.js → error-panel-BiGfbiiW.js} +1 -1
- package/dist/assets/{field-CXDGiU3T.js → field-DTzXkFLZ.js} +1 -1
- package/dist/assets/{file-explorer-panel-qM-Iflzm.js → file-explorer-panel-DiNhLdAc.js} +3 -3
- package/dist/assets/{form-IHIhviLb.js → form-BV-yji2Y.js} +1 -1
- package/dist/assets/{formats-DC_7w22O.js → formats-BQHP_yQk.js} +1 -1
- package/dist/assets/{formatting-Dw_0ktP1.js → formatting-BCAZDWQ0.js} +1 -1
- package/dist/assets/{gallery-page-DCkpFwYi.js → gallery-page-CI72Q71Y.js} +1 -1
- package/dist/assets/{ganttDiagram-JELNMOA3-BC4H0xrj.js → ganttDiagram-JELNMOA3-KWj06bYC.js} +1 -1
- package/dist/assets/{glide-data-editor-BkvzN8Tk.js → glide-data-editor-Bd4FOxvW.js} +1 -1
- package/dist/assets/{home-page-bB7oHRxE.js → home-page-kYSYG7Zh.js} +1 -1
- package/dist/assets/{hooks-DmeHnl8J.js → hooks-SmuOPKfj.js} +1 -1
- package/dist/assets/index-By2ge4IZ.js +42 -0
- package/dist/assets/input-Bg12i6qY.js +1 -0
- package/dist/assets/{layout-Ce-vzLs_.js → layout-BxUONa-J.js} +3 -3
- package/dist/assets/{linear-bY7qDnP9.js → linear-BICTUQLW.js} +1 -1
- package/dist/assets/{logs-panel-CzlMq5La.js → logs-panel-BH5Q_Nct.js} +1 -1
- package/dist/assets/{markdown-renderer-B4-BiMy9.js → markdown-renderer-2XpTunxF.js} +1 -1
- package/dist/assets/{mermaid-DDNZ06H7.js → mermaid-KL-Hgqp7.js} +3 -3
- package/dist/assets/{name-cell-input-CUG9-cgv.js → name-cell-input-CIZAWlBG.js} +1 -1
- package/dist/assets/{packages-panel-Bc42thuF.js → packages-panel-De0Fg43N.js} +1 -1
- package/dist/assets/{panels-xqtEg2DV.js → panels-DuR2pNy9.js} +1 -1
- package/dist/assets/{pieDiagram-ADFJNKIX-BeLuFsHa.js → pieDiagram-ADFJNKIX-ixj1Ihpk.js} +1 -1
- package/dist/assets/{precisionRound-D8yxZYIF.js → precisionRound-CU2C3Vxx.js} +1 -1
- package/dist/assets/{quadrantDiagram-AYHSOK5B-7-MiutmN.js → quadrantDiagram-AYHSOK5B-DAgQxEHI.js} +1 -1
- package/dist/assets/{react-vega-LNfJwi6n.js → react-vega-BVBnH7ue.js} +1 -1
- package/dist/assets/react-vega-BfEZWy9T.js +1 -0
- package/dist/assets/{readonly-python-code-DinZuT8P.js → readonly-python-code-BhME4c6A.js} +1 -1
- package/dist/assets/{run-page-GmVLTzzU.js → run-page-BDV1C8Oi.js} +1 -1
- package/dist/assets/{sankeyDiagram-TZEHDZUN-DuPJkvrj.js → sankeyDiagram-TZEHDZUN-DAWWzAvZ.js} +1 -1
- package/dist/assets/{scratchpad-panel-CnzHN40A.js → scratchpad-panel-CWU7CyZh.js} +1 -1
- package/dist/assets/{secrets-panel-DxBoNgTM.js → secrets-panel-CyJ4KdCC.js} +1 -1
- package/dist/assets/{session-panel-CpeJADG_.js → session-panel-B8t0Xymv.js} +1 -1
- package/dist/assets/snippets-panel-BaV08Ib1.js +1 -0
- package/dist/assets/{state-oW8A8maF.js → state-WTTs5oP6.js} +1 -1
- package/dist/assets/{terminal-bXHNLBHU.js → terminal-BBTjIXBz.js} +3 -3
- package/dist/assets/{time-BdrzW2P6.js → time-DLcLlk0u.js} +1 -1
- package/dist/assets/{tracing-BRo4IXxX.js → tracing-ChWqFQa-.js} +1 -1
- package/dist/assets/{tracing-panel-7QrwywKQ.js → tracing-panel-B46P3LAM.js} +2 -2
- package/dist/assets/useBoolean-ugd5JdXd.js +1 -0
- package/dist/assets/{useCellActionButton-DMySRby1.js → useCellActionButton-BKZyr81R.js} +1 -1
- package/dist/assets/{useDateFormatter-BBQkEV05.js → useDateFormatter-BEz9SEXo.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-DRoK7Mvg.js → useDependencyPanelTab-JOuBqQ1y.js} +1 -1
- package/dist/assets/{useNotebookActions-SGiWvk1I.js → useNotebookActions-D2fp_HNm.js} +1 -1
- package/dist/assets/{useNumberFormatter-DIM21HH4.js → useNumberFormatter-wQU1z0W_.js} +1 -1
- package/dist/assets/{usePress-CLNv4Iws.js → usePress-BXMIcLWP.js} +3 -3
- package/dist/assets/{utils-BaSt_0sN.js → utils-BZwMGX81.js} +1 -1
- package/dist/assets/{vega-component-B_GT243z.js → vega-component-D_AgSSfE.js} +1 -1
- package/dist/assets/{vega-loader.browser-DLukqq1q.js → vega-loader.browser-DXARUlxo.js} +1 -1
- package/dist/assets/{write-secret-modal-C87c9nwO.js → write-secret-modal-CHfFN0H8.js} +1 -1
- package/dist/assets/{xychartDiagram-PRI3JC2R-BRVF_pwk.js → xychartDiagram-PRI3JC2R-DgjhbmH4.js} +1 -1
- package/dist/index.html +39 -39
- package/package.json +1 -1
- package/src/components/editor/errors/traceback-modal.tsx +6 -5
- package/src/components/editor/output/MarimoErrorOutput.tsx +7 -14
- package/src/components/editor/output/MarimoTracebackOutput.tsx +4 -3
- package/dist/assets/MarimoErrorOutput-C3-dwG-M.js +0 -7
- package/dist/assets/VisuallyHidden-CuyBIaeU.js +0 -1
- package/dist/assets/app-config-button-2bbgrHC2.js +0 -1
- package/dist/assets/index-B2hkIK4p.js +0 -42
- package/dist/assets/input-DfDSaPYh.js +0 -1
- package/dist/assets/react-vega-Bpff0f7C.js +0 -1
- package/dist/assets/snippets-panel-Z3fr4trp.js +0 -1
- package/dist/assets/useBoolean-Dsw5twOt.js +0 -1
- /package/dist/assets/{blob-Brr8JjWU.js → blob-CTort_or.js} +0 -0
- /package/dist/assets/{context-BoP98Msj.js → context-DGqo1TbK.js} +0 -0
- /package/dist/assets/{copy-Acb9G8ns.js → copy-Bizk-4hH.js} +0 -0
- /package/dist/assets/{defaultLocale-B8Omxjnr.js → defaultLocale-BLne0bXb.js} +0 -0
- /package/dist/assets/{defaultLocale-Cyhs3Xd2.js → defaultLocale-JieDVWC_.js} +0 -0
- /package/dist/assets/{dialog-Do1NuJPs.js → dialog-BYjetQgE.js} +0 -0
- /package/dist/assets/{errors-Dn17Z1-5.js → errors-CZb6hI2x.js} +0 -0
- /package/dist/assets/{numbers--q6KLqqK.js → numbers--nDjbAPa.js} +0 -0
- /package/dist/assets/{ordinal-CN_bk_zt.js → ordinal-DuTuuUgV.js} +0 -0
- /package/dist/assets/{range-BmYMHsC2.js → range-1DwpgXvM.js} +0 -0
- /package/dist/assets/{react-icons.esm-3sYgjjif.js → react-icons.esm-BUYTQ32a.js} +0 -0
- /package/dist/assets/{share-CkOka71S.js → share-0LPgOyiW.js} +0 -0
- /package/dist/assets/{useHotkey-CX3-tpiy.js → useHotkey-DALUNe8I.js} +0 -0
- /package/dist/assets/{useRunCells-a5YC9YVQ.js → useRunCells-B5o8P7HV.js} +0 -0
package/dist/assets/{LazyAnyLanguageCodeMirror-Bb2dITRz.js → LazyAnyLanguageCodeMirror-CoYqQxHb.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./any-language-editor-
|
|
2
|
-
import{s as e}from"./chunk-LvLJmgfZ.js";import{t as i}from"./react-Bj1aDYRI.js";import{t as o}from"./createLucideIcon-w-Qo9n0R.js";import{t as m}from"./preload-helper-D2MJg03u.js";let r,a,s=(async()=>{r=o("between-horizontal-start",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]),a=(0,e(i(),1).lazy)(()=>m(()=>import("./any-language-editor-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./any-language-editor-DYgTL8eG.js","./copy-icon-BGs1Pbai.js","./button-BKVLeSTX.js","./useEventListener-DGjKht0c.js","./compiler-runtime-B3qBwwSJ.js","./react-Bj1aDYRI.js","./chunk-LvLJmgfZ.js","./jsx-runtime-Blw4afVn.js","./cn-DYvqRARy.js","./clsx-XrBBnd7s.js","./tooltip-DmqhBBs6.js","./fullscreen-k58KVlT-.js","./react-dom-CSu739Rf.js","./dist-sZgjGm4S.js","./use-toast-BDYuj3zG.js","./copy-Bizk-4hH.js","./check-B-sKate2.js","./createLucideIcon-w-Qo9n0R.js","./copy-DFMsQ6MJ.js","./error-banner-bXc_9BBZ.js","./alert-dialog-CXspBRlP.js","./errors-CZb6hI2x.js","./zod-H_cgTO0M.js","./dist-DDiNOVwA.js","./dist-VwkX7yeV.js","./dist-CxquLoAZ.js","./dist-ByWFdhfz.js","./dist-BNTOYRCs.js","./dist-4lB-oR9j.js","./dist-Dnlw22ji.js","./dist-CHgkfE72.js","./dist-BYHplnRv.js","./dist-BvlMLwcr.js","./dist-04hxiWlB.js","./dist-CgYlATe-.js","./dist-B1XdVflW.js","./dist-Gx6Yy96j.js","./dist-Yk16cgLk.js","./dist-umvL589W.js","./esm-BqofWdD5.js","./extends-Co37_JfG.js","./objectWithoutPropertiesLoose-smPWkHxB.js","./dist-DZJfxwLb.js","./esm-D1fwWXHg.js","./dist-D281cBMB.js","./dist-CaQ_ONVt.js","./dist-BrR2nUId.js","./dist-BPkOpnKv.js","./dist-Dl90TzK0.js","./dist-bOlBcn5A.js","./apl-CArdF_Ee.js","./asciiarmor-rf6n_8YZ.js","./asn1-Bl4vlAxN.js","./brainfuck-CWRjg_-2.js","./clike-B4xEkWXN.js","./clojure-04C6o-hL.js","./cmake-Dh64a3j4.js","./cobol-B24ofC4q.js","./coffeescript-B0i0O-b-.js","./commonlisp-NXg-Bye5.js","./crystal-BOjNTZjx.js","./css-C_vknI7E.js","./cypher-DwQoZmH9.js","./d-xedQGhmO.js","./diff-ChFnp8JW.js","./dtd-KbDPyUs4.js","./dylan-0KH4Nowk.js","./ecl-B5iM_b7s.js","./eiffel-sVM1STl5.js","./elm-BlNENVB6.js","./erlang-C0uOSFok.js","./factor-B-0VZGQP.js","./simple-mode-DxeVZov3.js","./forth-Dkvgp5v0.js","./fortran-DWGt9NN5.js","./gas-ucVnXY28.js","./gherkin-BRjIORXo.js","./groovy-BwyAyRPC.js","./haskell-Cs-Andhs.js","./haxe-BW46cyaq.js","./idl-BGiQ18ct.js","./javascript-I9_Q-6Fg.js","./julia-Wfay9brY.js","./livescript-J6EnSQWw.js","./lua-BO_knq_Q.js","./mathematica-DU8ikXHk.js","./mbox-Dzzw6MxI.js","./mirc-82uLLidC.js","./mllike-WTbu2PGL.js","./modelica-w4uKZrXu.js","./mscgen-Bf7m7BDT.js","./mumps-Bicgf-gh.js","./nsis-DGDbP9K4.js","./ntriples-CyotCBD4.js","./octave-BP7UuRZ-.js","./oz-C9dsRBsA.js","./pascal-Do-HizJs.js","./perl-DkWjygEp.js","./pig-C5cO5Lzu.js","./powershell-B7iMkhi7.js","./properties-BojS2wNP.js","./protobuf-C3jQLUT4.js","./pug-5wW7Sn9S.js","./puppet-BIu7yw7Q.js","./python-BvK-LeGt.js","./q-DxTFD_3l.js","./r-D9kMb9Pl.js","./rpm-DMBmptJ_.js","./ruby-Bi66LQBu.js","./sas-DDMCLlZz.js","./scheme-MngEI34z.js","./shell-BSVgrHzY.js","./sieve-DvUWNrPv.js","./smalltalk-CeZ66qpG.js","./sparql-oFx_t7AO.js","./stex-jWatZkll.js","./stylus-KE-9LQSK.js","./swift-A-ZhZWU8.js","./tcl-CREXWwrr.js","./textile-Cj8L4qVJ.js","./toml-BwSlV2Pt.js","./troff-DWonWT6V.js","./ttcn-cfg-Cei3Mnk3.js","./ttcn--CHQduBW.js","./turtle-BaGuNPTf.js","./vb-DQgwufRi.js","./vbscript-B66XhQhu.js","./velocity-D7CxwqhZ.js","./verilog-SCT9zECa.js","./vhdl-Bz6d75os.js","./webidl-B7LbwCfy.js","./xquery-BOMK2ySj.js","./yacas-Yk74VuuD.js","./z80-BQKQ7DhX.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{s as e}from"./chunk-LvLJmgfZ.js";import{t as i}from"./react-Bj1aDYRI.js";import{t as o}from"./createLucideIcon-w-Qo9n0R.js";import{t as m}from"./preload-helper-D2MJg03u.js";let r,a,s=(async()=>{r=o("between-horizontal-start",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]),a=(0,e(i(),1).lazy)(()=>m(()=>import("./any-language-editor-DYgTL8eG.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133]),import.meta.url))})();export{s as __tla,r as n,a as t};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{s as J}from"./chunk-LvLJmgfZ.js";import{d as ve,f as Ne,l as be,u as ke}from"./useEvent-D91BmmQi.js";import{t as we}from"./react-Bj1aDYRI.js";import{E as Ie,Mn as $e,b as _e,gi as Fe,ii as K,ir as Ae,nt as Te,ri as Ce,wn as Me}from"./cells-CuaAKcwV.js";import{t as q}from"./compiler-runtime-B3qBwwSJ.js";import{t as Se}from"./invariant-CkiqGLcK.js";import{r as ze}from"./utils-8btzWeZg.js";import{t as X}from"./cn-DYvqRARy.js";import{t as Ee}from"./jsx-runtime-Blw4afVn.js";import{a as qe,i as Pe,n as Le,r as We}from"./multi-map-MSuUqmbC.js";import{a as Ve,p as Be,r as Qe,t as De}from"./dropdown-menu-DrHAuMTb.js";import{t as Y}from"./tooltip-DmqhBBs6.js";import{r as Z,t as $}from"./button-BKVLeSTX.js";import{t as H}from"./createLucideIcon-w-Qo9n0R.js";import{r as Oe}from"./x-Bv2rCglF.js";import{t as He}from"./sparkles-B79Qf6ma.js";import{c as ee,n as Ue}from"./datasource-DwmhT5-D.js";import{a as Re}from"./dist-CgYlATe-.js";import{t as te}from"./RenderHTML-HmYLAtrW.js";import{t as re}from"./kbd-BUtlbGdu.js";import{t as A}from"./links-DOybeRem.js";import{r as Ge,t as Je}from"./alert-DF3HbVtk.js";import{o as Ke,t as Xe}from"./useInstallPackage-CeM6oPsT.js";import{n as Ye}from"./state-DuVk71Dw.js";import{n as b}from"./cell-link-D5GhiNrn.js";var Ze=H("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=H("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"}]]),se=H("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);function et(t){let e=null,s=t.cursor();do s.name==="ExpressionStatement"&&(e=s.node);while(s.next());return e}function tt(t){let e=t.split(`
|
|
2
|
+
`),s=" ",n=et(Re.parse(t));if(!n)return["def _():",...U(e,s),`${s}return`,"","","_()"].join(`
|
|
3
|
+
`);let i=t.slice(0,n.from).trim(),l=t.slice(n.from).trim(),a=i.split(`
|
|
4
|
+
`),c=l.split(`
|
|
5
|
+
`);return["def _():",...U(a,s),`${s}return ${c[0]}`,...U(c.slice(1),s),"","","_()"].join(`
|
|
6
|
+
`)}function U(t,e){if(t.length===1&&t[0]==="")return[];let s=[];for(let n of t)n===""?s.push(""):s.push(e+n);return s}function rt(t,e){var s;if(t.type==="multiple-defs")return[{title:"Fix: Wrap in a function",description:"Make this cell's variables local by wrapping the cell in a function.",fixType:"manual",onFix:async n=>{Se(n.editor,"Editor is null");let i=tt(n.editor.state.doc.toString());n.editor.dispatch({changes:{from:0,to:n.editor.state.doc.length,insert:i}})}}];if(t.type==="exception"&&t.exception_type==="NameError"){let n=(s=t.msg.match(/name '(.+)' is not defined/))==null?void 0:s[1];if(!n||!(n in ne))return[];let i=st(n);return[{title:`Fix: Add '${i}'`,description:"Add a new cell for the missing import",fixType:"manual",onFix:async l=>{l.addCodeBelow(i)}}]}return t.type==="sql-error"&&e.aiEnabled?[{title:"Fix with AI",description:"Fix the SQL statement",fixType:"ai",onFix:async n=>{var a;let i=Ue(n.cellId),l=`Fix the SQL statement: ${t.msg}.`;i&&(l+=`
|
|
7
|
+
Database schema: ${i}`),(a=n.aiFix)==null||a.setAiCompletionCell({cellId:n.cellId,initialPrompt:l,triggerImmediately:n.aiFix.triggerFix})}}]:[]}function st(t){let e=ne[t];return e===t?`import ${e}`:`import ${e} as ${t}`}var ne={mo:"marimo",alt:"altair",bokeh:"bokeh",dask:"dask",np:"numpy",pd:"pandas",pl:"polars",plotly:"plotly",plt:"matplotlib.pyplot",px:"plotly.express",scipy:"scipy",sk:"sklearn",sns:"seaborn",stats:"scipy.stats",tf:"tensorflow",torch:"torch",xr:"xarray",dt:"datetime",json:"json",math:"math",os:"os",re:"re",sys:"sys"},nt=q(),lt=Fe("marimo:ai-autofix-mode","autofix",$e);function it(){let t=(0,nt.c)(3),[e,s]=be(lt),n;return t[0]!==e||t[1]!==s?(n={fixMode:e,setFixMode:s},t[0]=e,t[1]=s,t[2]=n):n=t[2],n}var R=q(),r=J(Ee(),1);const N=t=>{let e=(0,R.c)(21),{errors:s,cellId:n,className:i}=t,l=Ne(),{createNewCell:a}=Ie(),c=ke(ze),o;if(e[0]!==c||e[1]!==s){let x;e[3]===c?x=e[4]:(x=y=>rt(y,{aiEnabled:c}),e[3]=c,e[4]=x),o=s.flatMap(x),e[0]=c,e[1]=s,e[2]=o}else o=e[2];let m=o,p=ve(Ye);if(m.length===0)return null;let d=m[0],f;e[5]!==n||e[6]!==a||e[7]!==d||e[8]!==p||e[9]!==l?(f=x=>{var k;let y=(k=l.get(_e).cellHandles[n].current)==null?void 0:k.editorView;d.onFix({addCodeBelow:_=>{a({cellId:n,autoFocus:!1,before:!1,code:_})},editor:y,cellId:n,aiFix:{setAiCompletionCell:p,triggerFix:x}}),y==null||y.focus()},e[5]=n,e[6]=a,e[7]=d,e[8]=p,e[9]=l,e[10]=f):f=e[10];let u=f,j;e[11]===i?j=e[12]:(j=X("my-2",i),e[11]=i,e[12]=j);let h;e[13]!==d.description||e[14]!==d.fixType||e[15]!==d.title||e[16]!==u?(h=d.fixType==="ai"?(0,r.jsx)(ce,{tooltip:d.description,openPrompt:()=>u(!1),applyAutofix:()=>u(!0)}):(0,r.jsx)(Y,{content:d.description,align:"start",children:(0,r.jsxs)($,{size:"xs",variant:"outline",className:"font-normal",onClick:()=>u(!1),children:[(0,r.jsx)(ee,{className:"h-3 w-3 mr-2"}),d.title]})}),e[13]=d.description,e[14]=d.fixType,e[15]=d.title,e[16]=u,e[17]=h):h=e[17];let g;return e[18]!==j||e[19]!==h?(g=(0,r.jsx)("div",{className:j,children:h}),e[18]=j,e[19]=h,e[20]=g):g=e[20],g};var le=He,ie=ee,ae="Suggest a prompt",oe="Fix with AI";const ce=t=>{let e=(0,R.c)(21),{tooltip:s,openPrompt:n,applyAutofix:i}=t,{fixMode:l,setFixMode:a}=it(),c=l==="prompt"?n:i,o;e[0]===l?o=e[1]:(o=l==="prompt"?(0,r.jsx)(le,{className:"h-3 w-3 mr-2 mb-0.5"}):(0,r.jsx)(ie,{className:"h-3 w-3 mr-2 mb-0.5"}),e[0]=l,e[1]=o);let m=l==="prompt"?ae:oe,p;e[2]!==c||e[3]!==o||e[4]!==m?(p=(0,r.jsxs)($,{size:"xs",variant:"outline",className:"font-normal rounded-r-none border-r-0",onClick:c,children:[o,m]}),e[2]=c,e[3]=o,e[4]=m,e[5]=p):p=e[5];let d;e[6]!==p||e[7]!==s?(d=(0,r.jsx)(Y,{content:s,align:"start",children:p}),e[6]=p,e[7]=s,e[8]=d):d=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=(0,r.jsx)(Be,{asChild:!0,children:(0,r.jsx)($,{size:"xs",variant:"outline",className:"rounded-l-none px-2","aria-label":"Fix options",children:(0,r.jsx)(Oe,{className:"h-3 w-3"})})}),e[9]=f):f=e[9];let u;e[10]!==l||e[11]!==a?(u=()=>{a(l==="prompt"?"autofix":"prompt")},e[10]=l,e[11]=a,e[12]=u):u=e[12];let j=l==="prompt"?"autofix":"prompt",h;e[13]===j?h=e[14]:(h=(0,r.jsx)(at,{mode:j}),e[13]=j,e[14]=h);let g;e[15]!==u||e[16]!==h?(g=(0,r.jsxs)(De,{children:[f,(0,r.jsx)(Qe,{align:"end",className:"w-56",children:(0,r.jsx)(Ve,{className:"flex items-center gap-2",onClick:u,children:h})})]}),e[15]=u,e[16]=h,e[17]=g):g=e[17];let x;return e[18]!==g||e[19]!==d?(x=(0,r.jsxs)("div",{className:"flex",children:[d,g]}),e[18]=g,e[19]=d,e[20]=x):x=e[20],x};var at=t=>{let e=(0,R.c)(12),{mode:s}=t,n;e[0]===s?n=e[1]:(n=s==="prompt"?(0,r.jsx)(le,{className:"h-4 w-4"}):(0,r.jsx)(ie,{className:"h-4 w-4"}),e[0]=s,e[1]=n);let i=n,l=s==="prompt"?ae:oe,a=s==="prompt"?"Edit the prompt before applying":"Apply AI fixes automatically",c;e[2]===l?c=e[3]:(c=(0,r.jsx)("span",{className:"font-medium",children:l}),e[2]=l,e[3]=c);let o;e[4]===a?o=e[5]:(o=(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:a}),e[4]=a,e[5]=o);let m;e[6]!==c||e[7]!==o?(m=(0,r.jsxs)("div",{className:"flex flex-col",children:[c,o]}),e[6]=c,e[7]=o,e[8]=m):m=e[8];let p;return e[9]!==i||e[10]!==m?(p=(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[i,m]}),e[9]=i,e[10]=m,e[11]=p):p=e[11],p},de=/(https?:\/\/\S+)/,ot=/\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i,me=/^data:image\//i,ct=["avatars.githubusercontent.com"];function pe(t){return me.test(t)?[{type:"image",url:t}]:t.split(de).filter(e=>e!=="").map(e=>de.test(e)?ot.test(e)||me.test(e)||ct.some(s=>e.includes(s))?{type:"image",url:e}:{type:"url",url:e}:{type:"text",value:e})}var ue=q(),P=J(we(),1),dt=new Te;const G=t=>{let e=RegExp("\x1B\\[[0-9;]*m","g");return t.replaceAll(e,"")};var he=/(pip\s+install|uv\s+add|uv\s+pip\s+install)\s+/gi;function mt(t){he.lastIndex=0;let e=he.exec(t);if(!e)return null;let s=e.index+e[0].length,n=t.slice(s).split(/\s+/),i="",l=0;for(let c of n){let o=c.trim();if(!o)continue;if(o.startsWith("-")){l+=o.length+1;continue}let m=o.match(/^[\w,.[\]-]+/);if(m){i=m[0];break}break}if(!i)return null;let a=s+l+i.length;return{package:i,endIndex:a}}function w(t,e=""){if(!t)return null;if(!/https?:\/\//.test(t))return t;let s=pe(t);return s.length===1&&s[0].type==="text"?t:(0,r.jsx)(r.Fragment,{children:s.map((n,i)=>{let l=e?`${e}-${i}`:i;if(n.type==="url"){let a=G(n.url);return(0,r.jsx)("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:Z.stopPropagation(),className:"text-link hover:underline",children:a},l)}if(n.type==="image"){let a=G(n.url);return(0,r.jsx)("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:Z.stopPropagation(),className:"text-link hover:underline",children:a},l)}return(0,r.jsx)(P.Fragment,{children:n.value},l)})})}var pt=t=>{let e=(0,ue.c)(6),{packages:s,children:n}=t,{handleInstallPackages:i}=Xe(),l;e[0]!==i||e[1]!==s?(l=c=>{i(s),c.preventDefault()},e[0]=i,e[1]=s,e[2]=l):l=e[2];let a;return e[3]!==n||e[4]!==l?(a=(0,r.jsx)("button",{onClick:l,className:"text-link hover:underline",type:"button",children:n}),e[3]=n,e[4]=l,e[5]=a):a=e[5],a};const ut=t=>{if(!(t instanceof K.Text))return;let e=G(t.data);if(!/(pip\s+install|uv\s+add|uv\s+pip\s+install)/i.test(e))return;let s=[],n=/(pip\s+install|uv\s+add|uv\s+pip\s+install)\s+/gi,i;for(;(i=n.exec(e))!==null;){let c=i.index,o=mt(e.slice(c));o&&s.push({match:i,result:o})}if(s.length===0)return;let l=[],a=0;if(s.forEach((c,o)=>{let{match:m,result:p}=c,d=m.index,f=d+p.endIndex;if(a<d){let j=e.slice(a,d);l.push((0,r.jsx)(P.Fragment,{children:w(j,`before-${o}`)},`before-${o}`))}let u=e.slice(d,f);l.push((0,r.jsx)(pt,{packages:[p.package],children:u},`install-${o}`)),a=f}),a<e.length){let c=e.slice(a);l.push((0,r.jsx)(P.Fragment,{children:w(c,"after")},"after"))}return(0,r.jsx)(r.Fragment,{children:l})},ht=t=>{if(!(t instanceof K.Text))return;let e=t.data;if(!/https?:\/\//.test(e))return;let s=w(e);if(typeof s!="string")return(0,r.jsx)(r.Fragment,{children:s})},xt=(...t)=>e=>{for(let s of t){let n=s(e);if(n!==void 0)return n}},ft=(t,e)=>(0,r.jsx)("span",{children:Ce(dt.ansi_to_html(t),{replace:s=>e(s)})}),jt=t=>{let e=(0,ue.c)(4),{text:s}=t,n;e[0]===s?n=e[1]:(n=ft(s,xt(ut,ht)),e[0]=s,e[1]=n);let i=n,l;return e[2]===i?l=e[3]:(l=(0,r.jsx)(r.Fragment,{children:i}),e[2]=i,e[3]=l),l};var xe=q(),I=t=>{let e=(0,xe.c)(10),s=t.title??"Tip",n;e[0]===s?n=e[1]:(n=(0,r.jsx)(qe,{className:"pt-2 pb-2 font-normal",children:s}),e[0]=s,e[1]=n);let i;e[2]===t.children?i=e[3]:(i=(0,r.jsx)(We,{className:"mr-24 text-[0.84375rem]",children:t.children}),e[2]=t.children,e[3]=i);let l;e[4]!==n||e[5]!==i?(l=(0,r.jsxs)(Pe,{value:"item-1",className:"text-muted-foreground",children:[n,i]}),e[4]=n,e[5]=i,e[6]=l):l=e[6];let a;return e[7]!==t.className||e[8]!==l?(a=(0,r.jsx)(Le,{type:"single",collapsible:!0,className:t.className,children:l}),e[7]=t.className,e[8]=l,e[9]=a):a=e[9],a};const gt=t=>{let e=(0,xe.c)(31),{errors:s,cellId:n,className:i}=t,l=Me(),a="This cell wasn't run because it has errors",c="destructive",o="text-error";if(s.some(yt))a="Interrupted";else if(s.some(vt))a="An internal error occurred";else if(s.some(Nt))a="Ancestor prevented from running",c="default",o="text-secondary-foreground";else if(s.some(bt))a="Ancestor stopped",c="default",o="text-secondary-foreground";else if(s.some(kt))a="SQL error";else{let x;e[0]===s?x=e[1]:(x=s.find(wt),e[0]=s,e[1]=x);let y=x;y&&"exception_type"in y&&(a=y.exception_type)}let m,p,d,f,u,j;if(e[2]!==c||e[3]!==n||e[4]!==l||e[5]!==i||e[6]!==s||e[7]!==o||e[8]!==a){let x=s.filter(It),y=s.filter($t),k=s.filter(_t),_=s.filter(Ft),L=s.filter(At),C=s.filter(Tt),M=s.filter(Ct),W=s.filter(Mt),V=s.filter(St),B=s.filter(zt),F=s.filter(Et),Q=s.filter(qt),D=s.filter(Pt),S;e[15]===l?S=e[16]:(S=()=>{l.openApplication("scratchpad")},e[15]=l,e[16]=S);let fe=S,je=()=>{let v=[];if(F.length>0||Q.length>0){let E=F.some(Lt),ye=!E&&F.some(Wt);v.push((0,r.jsxs)("div",{children:[F.map(Vt),Q.map(Bt),E&&(0,r.jsxs)($,{size:"xs",variant:"outline",className:"mt-2 font-normal",onClick:()=>Ke(l),children:[(0,r.jsx)(Ze,{className:"h-3.5 w-3.5 mr-1.5 mb-0.5"}),(0,r.jsx)("span",{children:"Open package manager"})]}),ye&&(0,r.jsxs)($,{size:"xs",variant:"outline",className:"mt-2 font-normal",onClick:()=>l.openApplication("terminal"),children:[(0,r.jsx)(se,{className:"h-3.5 w-3.5 mr-1.5"}),(0,r.jsx)("span",{children:"Open terminal"})]}),n&&(0,r.jsx)(N,{errors:[...F,...Q],cellId:n})]},"syntax-unknown"))}if(x.length>0&&v.push((0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-muted-foreground font-medium",children:"The setup cell cannot be run because it has references."}),(0,r.jsx)("ul",{className:"list-disc",children:x.flatMap(Qt)}),n&&(0,r.jsx)(N,{errors:x,cellId:n}),(0,r.jsxs)(I,{title:"Why can't the setup cell have references?",className:"mb-2",children:[(0,r.jsx)("p",{className:"pb-2",children:"The setup cell contains logic that must be run before any other cell runs, including top-level imports used by top-level functions. For this reason, it can't refer to other cells' variables."}),(0,r.jsx)("p",{className:"py-2",children:"Try simplifying the setup cell to only contain only necessary variables."}),(0,r.jsxs)("p",{className:"py-2",children:[(0,r.jsxs)(A,{href:"https://links.marimo.app/errors-setup",children:["Learn more at our docs"," ",(0,r.jsx)(T,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"setup-refs")),y.length>0&&v.push((0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-muted-foreground font-medium",children:"This cell is in a cycle."}),(0,r.jsx)("ul",{className:"list-disc",children:y.flatMap(Dt)}),n&&(0,r.jsx)(N,{errors:y,cellId:n}),(0,r.jsxs)(I,{title:"What are cycles and how do I resolve them?",className:"mb-2",children:[(0,r.jsx)("p",{className:"pb-2",children:"An example of a cycle is if one cell declares a variable 'a' and reads 'b', and another cell declares 'b' and and reads 'a'. Cycles like this make it impossible for marimo to know how to run your cells, and generally suggest that your code has a bug."}),(0,r.jsx)("p",{className:"py-2",children:"Try merging these cells into a single cell to eliminate the cycle."}),(0,r.jsxs)("p",{className:"py-2",children:[(0,r.jsxs)(A,{href:"https://links.marimo.app/errors-cycles",children:["Learn more at our docs"," ",(0,r.jsx)(T,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"cycle")),k.length>0){let E=k[0].name;v.push((0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-muted-foreground font-medium",children:"This cell redefines variables from other cells."}),k.map(Ht),n&&(0,r.jsx)(N,{errors:k,cellId:n}),(0,r.jsxs)(I,{title:"Why can't I redefine variables?",children:[(0,r.jsx)("p",{className:"pb-2",children:"marimo requires that each variable is defined in just one cell. This constraint enables reactive and reproducible execution, arbitrary cell reordering, seamless UI elements, execution as a script, and more."}),(0,r.jsxs)("p",{className:"py-2",children:["Try merging this cell with the mentioned cells or wrapping it in a function. Alternatively, prefix variables with an underscore (e.g., ",(0,r.jsxs)(re,{className:"inline",children:["_",E]}),"). to make them private to this cell."]}),(0,r.jsxs)("p",{className:"py-2",children:[(0,r.jsxs)(A,{href:"https://links.marimo.app/errors-multiple-definitions",children:["Learn more at our docs"," ",(0,r.jsx)(T,{size:"0.75rem",className:"inline"})]}),"."]})]}),(0,r.jsx)(I,{title:"Need a scratchpad?",children:(0,r.jsxs)("div",{className:"flex flex-row gap-2 items-center",children:[(0,r.jsxs)($,{size:"xs",variant:"link",className:"my-2 font-normal mx-0 px-0",onClick:fe,children:[(0,r.jsx)(Ae,{className:"h-3"}),(0,r.jsx)("span",{children:"Try the scratchpad"})]}),(0,r.jsx)("span",{children:"to experiment without restrictions on variable names."})]})})]},"multiple-defs"))}return _.length>0&&v.push((0,r.jsxs)("div",{children:[_.map(Ut),n&&(0,r.jsx)(N,{errors:_,cellId:n}),(0,r.jsxs)(I,{title:"Why can't I use `import *`?",children:[(0,r.jsx)("p",{className:"pb-2",children:"Star imports are incompatible with marimo's git-friendly file format and reproducible reactive execution."}),(0,r.jsx)("p",{className:"py-2",children:"marimo's Python file format stores code in functions, so notebooks can be imported as regular Python modules without executing all their code. But Python disallows `import *` everywhere except at the top-level of a module."}),(0,r.jsx)("p",{className:"py-2",children:"Star imports would also silently add names to globals, which would be incompatible with reactive execution."}),(0,r.jsxs)("p",{className:"py-2",children:[(0,r.jsxs)(A,{href:"https://links.marimo.app/errors-import-star",children:["Learn more at our docs"," ",(0,r.jsx)(T,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"import-star")),L.length>0&&v.push((0,r.jsxs)("div",{children:[L.map(Rt),n&&(0,r.jsx)(N,{errors:L,cellId:n})]},"interruption")),C.length>0&&v.push((0,r.jsxs)("ul",{children:[C.map(Gt),C.some(Jt)&&(0,r.jsx)(I,{children:"Fix the error in the mentioned cells, or handle the exceptions with try/except blocks."}),n&&(0,r.jsx)(N,{errors:C,cellId:n})]},"exception")),M.length>0&&v.push((0,r.jsxs)("ul",{children:[M.map(Kt),n&&(0,r.jsx)(N,{errors:M,cellId:n}),(0,r.jsx)(I,{children:M.some(Xt)?"Ensure that the referenced cells define the required variables, or turn off strict execution.":"Something is wrong with your declarations. Fix any discrepancies, or turn off strict execution."})]},"strict-exception")),W.length>0&&v.push((0,r.jsxs)("div",{children:[W.map(Yt),n&&(0,r.jsx)(N,{errors:W,cellId:n})]},"internal")),V.length>0&&v.push((0,r.jsxs)("div",{children:[V.map(Zt),n&&(0,r.jsx)(N,{errors:V,cellId:n})]},"ancestor-prevented")),B.length>0&&v.push((0,r.jsxs)("div",{children:[B.map(er),n&&(0,r.jsx)(N,{errors:B,cellId:n})]},"ancestor-stopped")),D.length>0&&v.push((0,r.jsxs)("div",{children:[D.map(tr),n&&(0,r.jsx)(N,{errors:D,cellId:n,className:"mt-2.5"})]},"sql-errors")),v},O=`font-code font-medium tracking-wide ${o}`,z;e[17]!==O||e[18]!==a?(z=(0,r.jsx)(Ge,{className:O,children:a}),e[17]=O,e[18]=a,e[19]=z):z=e[19];let ge=z;m=Je,f=c,e[20]===i?u=e[21]:(u=X("border-none font-code text-sm text-[0.84375rem] px-0 text-muted-foreground normal [&:has(svg)]:pl-0 space-y-4",i),e[20]=i,e[21]=u),j=ge,p="flex flex-col gap-8",d=je(),e[2]=c,e[3]=n,e[4]=l,e[5]=i,e[6]=s,e[7]=o,e[8]=a,e[9]=m,e[10]=p,e[11]=d,e[12]=f,e[13]=u,e[14]=j}else m=e[9],p=e[10],d=e[11],f=e[12],u=e[13],j=e[14];let h;e[22]!==p||e[23]!==d?(h=(0,r.jsx)("div",{children:(0,r.jsx)("div",{className:p,children:d})}),e[22]=p,e[23]=d,e[24]=h):h=e[24];let g;return e[25]!==m||e[26]!==f||e[27]!==u||e[28]!==j||e[29]!==h?(g=(0,r.jsxs)(m,{variant:f,className:u,children:[j,h]}),e[25]=m,e[26]=f,e[27]=u,e[28]=j,e[29]=h,e[30]=g):g=e[30],g};function yt(t){return t.type==="interruption"}function vt(t){return t.type==="internal"}function Nt(t){return t.type==="ancestor-prevented"}function bt(t){return t.type==="ancestor-stopped"}function kt(t){return t.type==="sql-error"}function wt(t){return t.type==="exception"}function It(t){return t.type==="setup-refs"}function $t(t){return t.type==="cycle"}function _t(t){return t.type==="multiple-defs"}function Ft(t){return t.type==="import-star"}function At(t){return t.type==="interruption"}function Tt(t){return t.type==="exception"}function Ct(t){return t.type==="strict-exception"}function Mt(t){return t.type==="internal"}function St(t){return t.type==="ancestor-prevented"}function zt(t){return t.type==="ancestor-stopped"}function Et(t){return t.type==="syntax"}function qt(t){return t.type==="unknown"}function Pt(t){return t.type==="sql-error"}function Lt(t){return t.msg.includes("!pip")}function Wt(t){return t.msg.includes("use os.subprocess")}function Vt(t,e){return(0,r.jsx)("pre",{children:w(t.msg,`syntax-${e}`)},`syntax-${e}`)}function Bt(t,e){return(0,r.jsx)("pre",{children:w(t.msg,`unknown-${e}`)},`unknown-${e}`)}function Qt(t,e){return t.edges_with_vars.map((s,n)=>(0,r.jsxs)("li",{className:"my-0.5 ml-8 text-muted-foreground/40",children:[(0,r.jsx)(b,{cellId:s[0]}),(0,r.jsxs)("span",{className:"text-muted-foreground",children:[": "," ",s[1].length===1?s[1][0]:s[1].join(", ")]})]},`setup-refs-${e}-${n}`))}function Dt(t,e){return t.edges_with_vars.map((s,n)=>(0,r.jsxs)("li",{className:"my-0.5 ml-8 text-muted-foreground/40",children:[(0,r.jsx)(b,{cellId:s[0]}),(0,r.jsxs)("span",{className:"text-muted-foreground",children:[" -> ",s[1].length===1?s[1][0]:s[1].join(", ")," -> "]}),(0,r.jsx)(b,{cellId:s[2]})]},`cycle-${e}-${n}`))}function Ot(t,e){return(0,r.jsx)("li",{className:"my-0.5 ml-8 text-muted-foreground/40",children:(0,r.jsx)(b,{cellId:t})},`cell-${e}`)}function Ht(t,e){return(0,r.jsxs)(P.Fragment,{children:[(0,r.jsx)("p",{className:"text-muted-foreground mt-2",children:`'${t.name}' was also defined by:`}),(0,r.jsx)("ul",{className:"list-disc",children:t.cells.map(Ot)})]},`multiple-defs-${e}`)}function Ut(t,e){return(0,r.jsx)("p",{className:"text-muted-foreground",children:t.msg},`import-star-${e}`)}function Rt(t,e){return(0,r.jsx)("p",{children:"This cell was interrupted and needs to be re-run."},`interruption-${e}`)}function Gt(t,e){return t.exception_type==="NameError"&&t.msg.startsWith("name 'mo'")?(0,r.jsx)("li",{className:"my-2",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-muted-foreground",children:"name 'mo' is not defined."}),(0,r.jsxs)("p",{className:"text-muted-foreground mt-2",children:["The marimo module (imported as"," ",(0,r.jsx)(re,{className:"inline",children:"mo"}),") is required for Markdown, SQL, and UI elements."]})]})},`exception-${e}`):t.exception_type==="NameError"&&t.msg.startsWith("name '_")?(0,r.jsx)("li",{className:"my-2",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-muted-foreground",children:t.msg}),(0,r.jsxs)("p",{className:"text-muted-foreground mt-2",children:["Variables prefixed with an underscore are local to a cell"," ","(",(0,r.jsxs)(A,{href:"https://links.marimo.app/local-variables",children:["docs"," ",(0,r.jsx)(T,{size:"0.75rem",className:"inline"})]}),")."]}),(0,r.jsx)("div",{className:"text-muted-foreground mt-2",children:"See the console area for a traceback."})]})},`exception-${e}`):(0,r.jsx)("li",{className:"my-2",children:t.raising_cell==null?(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-muted-foreground",children:w(t.msg,`exception-${e}`)}),"traceback"in t&&t.traceback?(0,r.jsx)("div",{className:"font-code text-sm mt-2 p-3 bg-muted rounded border overflow-auto max-h-[50vh] cursor-text select-text",children:te({html:t.traceback})}):(0,r.jsx)("div",{className:"text-muted-foreground mt-2",children:"See the console area for a traceback."})]}):(0,r.jsxs)("div",{children:[w(t.msg,`exception-${e}`),(0,r.jsx)(b,{cellId:t.raising_cell}),"traceback"in t&&t.traceback&&(0,r.jsx)("div",{className:"font-code text-sm mt-2 p-3 bg-muted rounded border overflow-auto max-h-[50vh] cursor-text select-text",children:te({html:t.traceback})})]})},`exception-${e}`)}function Jt(t){return t.raising_cell!=null}function Kt(t,e){return(0,r.jsx)("li",{className:"my-2",children:t.blamed_cell==null?(0,r.jsx)("p",{children:t.msg}):(0,r.jsxs)("div",{children:[t.msg,(0,r.jsx)(b,{cellId:t.blamed_cell})]})},`strict-exception-${e}`)}function Xt(t){return t.blamed_cell!=null}function Yt(t,e){return(0,r.jsx)("p",{children:t.msg},`internal-${e}`)}function Zt(t,e){return(0,r.jsxs)("div",{children:[t.msg,t.blamed_cell==null?(0,r.jsxs)("span",{children:["(",(0,r.jsx)(b,{cellId:t.raising_cell}),")"]}):(0,r.jsxs)("span",{children:["(",(0,r.jsx)(b,{cellId:t.raising_cell}),"\xA0blames\xA0",(0,r.jsx)(b,{cellId:t.blamed_cell}),")"]})]},`ancestor-prevented-${e}`)}function er(t,e){return(0,r.jsxs)("div",{children:[t.msg,(0,r.jsx)(b,{cellId:t.raising_cell})]},`ancestor-stopped-${e}`)}function tr(t,e){return(0,r.jsx)("div",{className:"space-y-2 mt-2",children:(0,r.jsx)("p",{className:"text-muted-foreground whitespace-pre-wrap",children:t.msg})},`sql-error-${e}`)}export{se as a,ce as i,jt as n,pe as r,gt as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as Ce}from"./chunk-LvLJmgfZ.js";import{t as ye}from"./react-Bj1aDYRI.js";import{$ as Se,Y as ke,et as _e}from"./input-Bg12i6qY.js";import{D as Le,F as xe,I as v,L as Me,N as w,P as S,T as Fe,V as R,c as Ie,j as k,k as Pe,l as We,p as Ae,w as Ke,x as ne}from"./usePress-BXMIcLWP.js";import{t as He}from"./context-DGqo1TbK.js";var Be=class{get currentNode(){return this._currentNode}set currentNode(e){if(!k(this.root,e))throw Error("Cannot set currentNode to a node that is not contained by the root node.");let t=[],r=e,n=e;for(this._currentNode=e;r&&r!==this.root;)if(r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let i=r,l=this._doc.createTreeWalker(i,this.whatToShow,{acceptNode:this._acceptNode});t.push(l),l.currentNode=n,this._currentSetFor.add(l),r=n=i.host}else r=r.parentNode;let o=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});t.push(o),o.currentNode=n,this._currentSetFor.add(o),this._walkerStack=t}get doc(){return this._doc}firstChild(){let e=this.currentNode,t=this.nextNode();return k(e,t)?(t&&(this.currentNode=t),t):(this.currentNode=e,null)}lastChild(){let e=this._walkerStack[0].lastChild();return e&&(this.currentNode=e),e}nextNode(){var t;let e=this._walkerStack[0].nextNode();if(e){if(e.shadowRoot){let r;if(typeof this.filter=="function"?r=this.filter(e):(t=this.filter)!=null&&t.acceptNode&&(r=this.filter.acceptNode(e)),r===NodeFilter.FILTER_ACCEPT)return this.currentNode=e,e;let n=this.nextNode();return n&&(this.currentNode=n),n}return e&&(this.currentNode=e),e}else if(this._walkerStack.length>1){this._walkerStack.shift();let r=this.nextNode();return r&&(this.currentNode=r),r}else return null}previousNode(){var r;let e=this._walkerStack[0];if(e.currentNode===e.root){if(this._currentSetFor.has(e))if(this._currentSetFor.delete(e),this._walkerStack.length>1){this._walkerStack.shift();let n=this.previousNode();return n&&(this.currentNode=n),n}else return null;return null}let t=e.previousNode();if(t){if(t.shadowRoot){let n;if(typeof this.filter=="function"?n=this.filter(t):(r=this.filter)!=null&&r.acceptNode&&(n=this.filter.acceptNode(t)),n===NodeFilter.FILTER_ACCEPT)return t&&(this.currentNode=t),t;let o=this.lastChild();return o&&(this.currentNode=o),o}return t&&(this.currentNode=t),t}else if(this._walkerStack.length>1){this._walkerStack.shift();let n=this.previousNode();return n&&(this.currentNode=n),n}else return null}nextSibling(){return null}previousSibling(){return null}parentNode(){return null}constructor(e,t,r,n){this._walkerStack=[],this._currentSetFor=new Set,this._acceptNode=i=>{var l;if(i.nodeType===Node.ELEMENT_NODE){let a=i.shadowRoot;if(a){let d=this._doc.createTreeWalker(a,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(d),NodeFilter.FILTER_ACCEPT}else{if(typeof this.filter=="function")return this.filter(i);if((l=this.filter)!=null&&l.acceptNode)return this.filter.acceptNode(i);if(this.filter===null)return NodeFilter.FILTER_ACCEPT}}return NodeFilter.FILTER_SKIP},this._doc=e,this.root=t,this.filter=n??null,this.whatToShow=r??NodeFilter.SHOW_ALL,this._currentNode=t,this._walkerStack.unshift(e.createTreeWalker(t,r,this._acceptNode));let o=t.shadowRoot;if(o){let i=this._doc.createTreeWalker(o,this.whatToShow,{acceptNode:this._acceptNode});this._walkerStack.unshift(i)}}};function oe(e,t,r,n){return xe()?new Be(e,t,r,n):e.createTreeWalker(t,r,n)}var h=Ce(ye(),1);function De(e,t){let r=(0,h.useRef)(!0),n=(0,h.useRef)(null),o=Ae(e);(0,h.useEffect)(()=>(r.current=!0,()=>{r.current=!1}),[]),(0,h.useEffect)(()=>{let i=n.current;r.current?r.current=!1:(!i||t.some((l,a)=>!Object.is(l,i[a])))&&o(),n.current=t},t)}function z(e,t){if(!e)return!1;let r=window.getComputedStyle(e),n=document.scrollingElement||document.documentElement,o=/(auto|scroll)/.test(r.overflow+r.overflowX+r.overflowY);return e===n&&r.overflow!=="hidden"&&(o=!0),o&&t&&(o=e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth),o}function Oe(e,t){let r=e;for(z(r,t)&&(r=r.parentElement);r&&!z(r,t);)r=r.parentElement;return r||document.scrollingElement||document.documentElement}function ie(e,t){let r=[],n=document.scrollingElement||document.documentElement;do z(e,t)&&r.push(e),e=e.parentElement;while(e&&e!==n);return r}function je(e){return Ke()?e.metaKey:e.ctrlKey}var ze=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Ve(e){return e instanceof HTMLInputElement&&!ze.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}var qe=0,q=new Map;function Ue(e){let[t,r]=(0,h.useState)();return R(()=>{if(!e)return;let n=q.get(e);if(n)r(n.element.id);else{let o=`react-aria-description-${qe++}`;r(o);let i=document.createElement("div");i.id=o,i.style.display="none",i.textContent=e,document.body.appendChild(i),n={refCount:0,element:i},q.set(e,n)}return n.refCount++,()=>{n&&--n.refCount===0&&(n.element.remove(),q.delete(e))}},[e]),{"aria-describedby":e?t:void 0}}function U(e,t,r={}){let{block:n="nearest",inline:o="nearest"}=r;if(e===t)return;let i=e.scrollTop,l=e.scrollLeft,a=t.getBoundingClientRect(),d=e.getBoundingClientRect(),c=window.getComputedStyle(t),s=window.getComputedStyle(e),f=document.scrollingElement||document.documentElement,u=e===f?0:d.top,N=e===f?e.clientHeight:d.bottom,b=e===f?0:d.left,P=e===f?e.clientWidth:d.right,_=parseInt(c.scrollMarginTop,10)||0,pe=parseInt(c.scrollMarginBottom,10)||0,Ne=parseInt(c.scrollMarginLeft,10)||0,me=parseInt(c.scrollMarginRight,10)||0,be=parseInt(s.scrollPaddingTop,10)||0,ve=parseInt(s.scrollPaddingBottom,10)||0,Ee=parseInt(s.scrollPaddingLeft,10)||0,ge=parseInt(s.scrollPaddingRight,10)||0,Q=parseInt(s.borderTopWidth,10)||0,Z=parseInt(s.borderBottomWidth,10)||0,ee=parseInt(s.borderLeftWidth,10)||0,te=parseInt(s.borderRightWidth,10)||0,W=a.top-_,A=a.bottom+pe,K=a.left-Ne,H=a.right+me,Te=e===f?0:ee+te,we=e===f?0:Q+Z,re=e.offsetWidth-e.clientWidth-Te,Re=e.offsetHeight-e.clientHeight-we,B=u+Q+be,D=N-Z-ve-Re,L=b+ee+Ee,x=P-te-ge;s.direction==="rtl"&&!Le()?L+=re:x-=re;let O=W<B||A>D,j=K<L||H>x;if(O&&n==="start")i+=W-B;else if(O&&n==="center")i+=(W+A)/2-(B+D)/2;else if(O&&n==="end")i+=A-D;else if(O&&n==="nearest"){let M=W-B,F=A-D;i+=Math.abs(M)<=Math.abs(F)?M:F}if(j&&o==="start")l+=K-L;else if(j&&o==="center")l+=(K+H)/2-(L+x)/2;else if(j&&o==="end")l+=H-x;else if(j&&o==="nearest"){let M=K-L,F=H-x;l+=Math.abs(M)<=Math.abs(F)?M:F}e.scrollTo({left:l,top:i})}function $e(e,t={}){let{containingElement:r}=t;if(e&&e.isConnected){let l=document.scrollingElement||document.documentElement;if(window.getComputedStyle(l).overflow!=="hidden"&&!ne()){var n;let{left:a,top:d}=e.getBoundingClientRect();e==null||(n=e.scrollIntoView)==null||n.call(e,{block:"nearest"});let{left:c,top:s}=e.getBoundingClientRect();if(Math.abs(a-c)>1||Math.abs(d-s)>1){var o,i;r==null||(o=r.scrollIntoView)==null||o.call(r,{block:"center",inline:"center"}),(i=e.scrollIntoView)==null||i.call(e,{block:"nearest"})}}else{let{left:a,top:d}=e.getBoundingClientRect(),c=ie(e,!0);for(let u of c)U(u,e);let{left:s,top:f}=e.getBoundingClientRect();if(Math.abs(a-s)>1||Math.abs(d-f)>1){c=r?ie(r,!0):[];for(let u of c)U(u,r,{block:"center",inline:"center"})}}}}var $=new Map;function Ye(e){let{locale:t}=He(),r=t+(e?Object.entries(e).sort((o,i)=>o[0]<i[0]?-1:1).join():"");if($.has(r))return $.get(r);let n=new Intl.Collator(t,e);return $.set(r,n),n}var le=h.createContext(null),Y="react-aria-focus-scope-restore",p=null;function Ge(e){let{children:t,contain:r,restoreFocus:n,autoFocus:o}=e,i=(0,h.useRef)(null),l=(0,h.useRef)(null),a=(0,h.useRef)([]),{parentNode:d}=(0,h.useContext)(le)||{},c=(0,h.useMemo)(()=>new X({scopeRef:a}),[a]);R(()=>{let u=d||m.root;if(m.getTreeNode(u.scopeRef)&&p&&!V(p,u.scopeRef)){let N=m.getTreeNode(p);N&&(u=N)}u.addChild(c),m.addNode(c)},[c,d]),R(()=>{let u=m.getTreeNode(a);u&&(u.contain=!!r)},[r]),R(()=>{var P;let u=(P=i.current)==null?void 0:P.nextSibling,N=[],b=_=>_.stopPropagation();for(;u&&u!==l.current;)N.push(u),u.addEventListener(Y,b),u=u.nextSibling;return a.current=N,()=>{for(let _ of N)_.removeEventListener(Y,b)}},[t]),rt(a,n,r),Ze(a,r),nt(a,n,r),tt(a,o),(0,h.useEffect)(()=>{let u=w(v(a.current?a.current[0]:void 0)),N=null;if(T(u,a.current)){for(let b of m.traverse())b.scopeRef&&T(u,b.scopeRef.current)&&(N=b);N===m.getTreeNode(a)&&(p=N.scopeRef)}},[a]),R(()=>()=>{var N,b;let u=((b=(N=m.getTreeNode(a))==null?void 0:N.parent)==null?void 0:b.scopeRef)??null;(a===p||V(a,p))&&(!u||m.getTreeNode(u))&&(p=u),m.removeTreeNode(a)},[a]);let s=(0,h.useMemo)(()=>Je(a),[]),f=(0,h.useMemo)(()=>({focusManager:s,parentNode:c}),[c,s]);return h.createElement(le.Provider,{value:f},h.createElement("span",{"data-focus-scope-start":!0,hidden:!0,ref:i}),t,h.createElement("span",{"data-focus-scope-end":!0,hidden:!0,ref:l}))}function Je(e){return{focusNext(t={}){let r=e.current,{from:n,tabbable:o,wrap:i,accept:l}=t,a=n||w(v(r[0]??void 0)),d=r[0].previousElementSibling,c=g(y(r),{tabbable:o,accept:l},r);c.currentNode=T(a,r)?a:d;let s=c.nextNode();return!s&&i&&(c.currentNode=d,s=c.nextNode()),s&&E(s,!0),s},focusPrevious(t={}){let r=e.current,{from:n,tabbable:o,wrap:i,accept:l}=t,a=n||w(v(r[0]??void 0)),d=r[r.length-1].nextElementSibling,c=g(y(r),{tabbable:o,accept:l},r);c.currentNode=T(a,r)?a:d;let s=c.previousNode();return!s&&i&&(c.currentNode=d,s=c.previousNode()),s&&E(s,!0),s},focusFirst(t={}){let r=e.current,{tabbable:n,accept:o}=t,i=g(y(r),{tabbable:n,accept:o},r);i.currentNode=r[0].previousElementSibling;let l=i.nextNode();return l&&E(l,!0),l},focusLast(t={}){let r=e.current,{tabbable:n,accept:o}=t,i=g(y(r),{tabbable:n,accept:o},r);i.currentNode=r[r.length-1].nextElementSibling;let l=i.previousNode();return l&&E(l,!0),l}}}function y(e){return e[0].parentElement}function I(e){let t=m.getTreeNode(p);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function Xe(e){if(!e.form)return Array.from(v(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter(n=>!n.form);let t=e.form.elements.namedItem(e.name),r=Me(e);return t instanceof r.RadioNodeList?Array.from(t).filter(n=>n instanceof r.HTMLInputElement):t instanceof r.HTMLInputElement?[t]:[]}function Qe(e){if(e.checked)return!0;let t=Xe(e);return t.length>0&&!t.some(r=>r.checked)}function Ze(e,t){let r=(0,h.useRef)(void 0),n=(0,h.useRef)(void 0);R(()=>{let o=e.current;if(!t){n.current&&(n.current=(cancelAnimationFrame(n.current),void 0));return}let i=v(o?o[0]:void 0),l=c=>{if(c.key!=="Tab"||c.altKey||c.ctrlKey||c.metaKey||!I(e)||c.isComposing)return;let s=w(i),f=e.current;if(!f||!T(s,f))return;let u=g(y(f),{tabbable:!0},f);if(!s)return;u.currentNode=s;let N=c.shiftKey?u.previousNode():u.nextNode();N||(N=(u.currentNode=c.shiftKey?f[f.length-1].nextElementSibling:f[0].previousElementSibling,c.shiftKey?u.previousNode():u.nextNode())),c.preventDefault(),N&&E(N,!0)},a=c=>{(!p||V(p,e))&&T(S(c),e.current)?(p=e,r.current=S(c)):I(e)&&!C(S(c),e)?r.current?r.current.focus():p&&p.current&&G(p.current):I(e)&&(r.current=S(c))},d=c=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>{let s=_e(),f=(s==="virtual"||s===null)&&Fe()&&ne(),u=w(i);if(!f&&u&&I(e)&&!C(u,e)){p=e;let b=S(c);if(b&&b.isConnected){var N;r.current=b,(N=r.current)==null||N.focus()}else p.current&&G(p.current)}})};return i.addEventListener("keydown",l,!1),i.addEventListener("focusin",a,!1),o==null||o.forEach(c=>c.addEventListener("focusin",a,!1)),o==null||o.forEach(c=>c.addEventListener("focusout",d,!1)),()=>{i.removeEventListener("keydown",l,!1),i.removeEventListener("focusin",a,!1),o==null||o.forEach(c=>c.removeEventListener("focusin",a,!1)),o==null||o.forEach(c=>c.removeEventListener("focusout",d,!1))}},[e,t]),R(()=>()=>{n.current&&cancelAnimationFrame(n.current)},[n])}function ce(e){return C(e)}function T(e,t){return!e||!t?!1:t.some(r=>k(r,e))}function C(e,t=null){if(e instanceof Element&&e.closest("[data-react-aria-top-layer]"))return!0;for(let{scopeRef:r}of m.traverse(m.getTreeNode(t)))if(r&&T(e,r.current))return!0;return!1}function et(e){return C(e,p)}function V(e,t){var n;let r=(n=m.getTreeNode(t))==null?void 0:n.parent;for(;r;){if(r.scopeRef===e)return!0;r=r.parent}return!1}function E(e,t=!1){if(e!=null&&!t)try{Se(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function se(e,t=!0){let r=e[0].previousElementSibling,n=y(e),o=g(n,{tabbable:t},e);o.currentNode=r;let i=o.nextNode();return t&&!i&&(n=y(e),o=g(n,{tabbable:!1},e),o.currentNode=r,i=o.nextNode()),i}function G(e,t=!0){E(se(e,t))}function tt(e,t){let r=h.useRef(t);(0,h.useEffect)(()=>{r.current&&(p=e,!T(w(v(e.current?e.current[0]:void 0)),p.current)&&e.current&&G(e.current)),r.current=!1},[e])}function rt(e,t,r){R(()=>{if(t||r)return;let n=e.current,o=v(n?n[0]:void 0),i=l=>{let a=S(l);T(a,e.current)?p=e:ce(a)||(p=null)};return o.addEventListener("focusin",i,!1),n==null||n.forEach(l=>l.addEventListener("focusin",i,!1)),()=>{o.removeEventListener("focusin",i,!1),n==null||n.forEach(l=>l.removeEventListener("focusin",i,!1))}},[e,t,r])}function ae(e){let t=m.getTreeNode(p);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return(t==null?void 0:t.scopeRef)===e}function nt(e,t,r){let n=(0,h.useRef)(typeof document<"u"?w(v(e.current?e.current[0]:void 0)):null);R(()=>{let o=e.current,i=v(o?o[0]:void 0);if(!t||r)return;let l=()=>{(!p||V(p,e))&&T(w(i),e.current)&&(p=e)};return i.addEventListener("focusin",l,!1),o==null||o.forEach(a=>a.addEventListener("focusin",l,!1)),()=>{i.removeEventListener("focusin",l,!1),o==null||o.forEach(a=>a.removeEventListener("focusin",l,!1))}},[e,r]),R(()=>{let o=v(e.current?e.current[0]:void 0);if(!t)return;let i=l=>{if(l.key!=="Tab"||l.altKey||l.ctrlKey||l.metaKey||!I(e)||l.isComposing)return;let a=o.activeElement;if(!C(a,e)||!ae(e))return;let d=m.getTreeNode(e);if(!d)return;let c=d.nodeToRestore,s=g(o.body,{tabbable:!0});s.currentNode=a;let f=l.shiftKey?s.previousNode():s.nextNode();if((!c||!c.isConnected||c===o.body)&&(c=void 0,d.nodeToRestore=void 0),(!f||!C(f,e))&&c){s.currentNode=c;do f=l.shiftKey?s.previousNode():s.nextNode();while(C(f,e));l.preventDefault(),l.stopPropagation(),f?E(f,!0):ce(c)?E(c,!0):a.blur()}};return r||o.addEventListener("keydown",i,!0),()=>{r||o.removeEventListener("keydown",i,!0)}},[e,t,r]),R(()=>{let o=v(e.current?e.current[0]:void 0);if(!t)return;let i=m.getTreeNode(e);if(i)return i.nodeToRestore=n.current??void 0,()=>{let l=m.getTreeNode(e);if(!l)return;let a=l.nodeToRestore,d=w(o);if(t&&a&&(d&&C(d,e)||d===o.body&&ae(e))){let c=m.clone();requestAnimationFrame(()=>{if(o.activeElement===o.body){let s=c.getTreeNode(e);for(;s;){if(s.nodeToRestore&&s.nodeToRestore.isConnected){ue(s.nodeToRestore);return}s=s.parent}for(s=c.getTreeNode(e);s;){if(s.scopeRef&&s.scopeRef.current&&m.getTreeNode(s.scopeRef)){ue(se(s.scopeRef.current,!0));return}s=s.parent}}})}}},[e,t])}function ue(e){e.dispatchEvent(new CustomEvent(Y,{bubbles:!0,cancelable:!0}))&&E(e)}function g(e,t,r){let n=t!=null&&t.tabbable?We:Ie,o=v((e==null?void 0:e.nodeType)===Node.ELEMENT_NODE?e:null),i=oe(o,e||o,NodeFilter.SHOW_ELEMENT,{acceptNode(l){return k(t==null?void 0:t.from,l)||t!=null&&t.tabbable&&l.tagName==="INPUT"&&l.getAttribute("type")==="radio"&&(!Qe(l)||i.currentNode.tagName==="INPUT"&&i.currentNode.type==="radio"&&i.currentNode.name===l.name)?NodeFilter.FILTER_REJECT:n(l)&&(!r||T(l,r))&&(!(t!=null&&t.accept)||t.accept(l))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t!=null&&t.from&&(i.currentNode=t.from),i}function ot(e,t={}){return{focusNext(r={}){let n=e.current;if(!n)return null;let{from:o,tabbable:i=t.tabbable,wrap:l=t.wrap,accept:a=t.accept}=r,d=o||w(v(n)),c=g(n,{tabbable:i,accept:a});k(n,d)&&(c.currentNode=d);let s=c.nextNode();return!s&&l&&(c.currentNode=n,s=c.nextNode()),s&&E(s,!0),s},focusPrevious(r=t){let n=e.current;if(!n)return null;let{from:o,tabbable:i=t.tabbable,wrap:l=t.wrap,accept:a=t.accept}=r,d=o||w(v(n)),c=g(n,{tabbable:i,accept:a});if(k(n,d))c.currentNode=d;else{let f=J(c);return f&&E(f,!0),f??null}let s=c.previousNode();if(!s&&l){c.currentNode=n;let f=J(c);if(!f)return null;s=f}return s&&E(s,!0),s??null},focusFirst(r=t){let n=e.current;if(!n)return null;let{tabbable:o=t.tabbable,accept:i=t.accept}=r,l=g(n,{tabbable:o,accept:i}).nextNode();return l&&E(l,!0),l},focusLast(r=t){let n=e.current;if(!n)return null;let{tabbable:o=t.tabbable,accept:i=t.accept}=r,l=J(g(n,{tabbable:o,accept:i}));return l&&E(l,!0),l??null}}}function J(e){let t,r;do r=e.lastChild(),r&&(t=r);while(r);return t}var it=class he{get size(){return this.fastMap.size}getTreeNode(t){return this.fastMap.get(t)}addTreeNode(t,r,n){let o=this.fastMap.get(r??null);if(!o)return;let i=new X({scopeRef:t});o.addChild(i),i.parent=o,this.fastMap.set(t,i),n&&(i.nodeToRestore=n)}addNode(t){this.fastMap.set(t.scopeRef,t)}removeTreeNode(t){if(t===null)return;let r=this.fastMap.get(t);if(!r)return;let n=r.parent;for(let i of this.traverse())i!==r&&r.nodeToRestore&&i.nodeToRestore&&r.scopeRef&&r.scopeRef.current&&T(i.nodeToRestore,r.scopeRef.current)&&(i.nodeToRestore=r.nodeToRestore);let o=r.children;n&&(n.removeChild(r),o.size>0&&o.forEach(i=>n&&n.addChild(i))),this.fastMap.delete(r.scopeRef)}*traverse(t=this.root){if(t.scopeRef!=null&&(yield t),t.children.size>0)for(let r of t.children)yield*this.traverse(r)}clone(){var r;let t=new he;for(let n of this.traverse())t.addTreeNode(n.scopeRef,((r=n.parent)==null?void 0:r.scopeRef)??null,n.nodeToRestore);return t}constructor(){this.fastMap=new Map,this.root=new X({scopeRef:null}),this.fastMap.set(null,this.root)}},X=class{addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}},m=new it,de={border:0,clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"};function fe(e={}){let{style:t,isFocusable:r}=e,[n,o]=(0,h.useState)(!1),{focusWithinProps:i}=ke({isDisabled:!r,onFocusWithinChange:a=>o(a)}),l=(0,h.useMemo)(()=>n?t:t?{...de,...t}:de,[n]);return{visuallyHiddenProps:{...i,style:l}}}function lt(e){let{children:t,elementType:r="div",isFocusable:n,style:o,...i}=e,{visuallyHiddenProps:l}=fe(e);return h.createElement(r,Pe(i,l),t)}var ct=(0,h.createContext)(null);(0,h.createContext)(null),(0,h.createContext)(null),(0,h.createContext)(null),(0,h.createContext)(null);var st=(0,h.createContext)({}),at=(0,h.createContext)(null);(0,h.createContext)(null);export{z as _,fe as a,g as c,U as d,$e as f,Oe as g,Ve as h,lt as i,ot as l,je as m,at as n,et as o,Ue as p,st as r,Ge as s,ct as t,Ye as u,De as v,oe as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as v}from"./chunk-LvLJmgfZ.js";import{i as j,p as y,u as w}from"./useEvent-D91BmmQi.js";import{t as R}from"./react-Bj1aDYRI.js";import{bn as S,gn as _,ii as c,it as H,m as I,ri as M,vt as N}from"./cells-CuaAKcwV.js";import{t as E}from"./compiler-runtime-B3qBwwSJ.js";import{_ as T}from"./useEventListener-DGjKht0c.js";import{o as z}from"./utils-8btzWeZg.js";import{t as C}from"./jsx-runtime-Blw4afVn.js";import{t as F}from"./tooltip-DmqhBBs6.js";import{t as L}from"./
|
|
1
|
+
import{s as v}from"./chunk-LvLJmgfZ.js";import{i as j,p as y,u as w}from"./useEvent-D91BmmQi.js";import{t as R}from"./react-Bj1aDYRI.js";import{bn as S,gn as _,ii as c,it as H,m as I,ri as M,vt as N}from"./cells-CuaAKcwV.js";import{t as E}from"./compiler-runtime-B3qBwwSJ.js";import{_ as T}from"./useEventListener-DGjKht0c.js";import{o as z}from"./utils-8btzWeZg.js";import{t as C}from"./jsx-runtime-Blw4afVn.js";import{t as F}from"./tooltip-DmqhBBs6.js";import{t as L}from"./copy-icon-BGs1Pbai.js";import{t as V}from"./usePress-BXMIcLWP.js";import{n as k}from"./useDebounce-LVL1r3-M.js";import{t as q}from"./useRunCells-B5o8P7HV.js";var W=E(),m=v(R(),1),o=v(C(),1);const A=r=>{let t=(0,W.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,m.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}=V(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 D(r){let t=I().inOrderIds.at(0);if(t)try{let e=await _.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&&j.set(S,{documentation:a.completion_info})}catch(e){T.debug(`Doc lookup failed for "${r}"`,e)}}var O=E();const P=r=>{let t=(0,O.c)(8),{qualifiedName:e,children:n}=r,i;t[0]===e?i=t[1]:(i=()=>{D(e)},t[0]=e,t[1]=i);let a=k(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 $=y(r=>{let t=r(q),e=r(z);if(t||e)return!1;let n=!0;try{n=H()==="read"}catch{return!0}return!n});function B(){return w($)}var U=E(),Z=r=>{if(r instanceof c.Element&&!/^[A-Za-z][\w-]*$/.test(r.name))return m.createElement(m.Fragment)},G=(r,t)=>{if(t instanceof c.Element&&t.name==="body"){if((0,m.isValidElement)(r)&&"props"in r){let e=r.props.children;return(0,o.jsx)(o.Fragment,{children:e})}return}},J=(r,t)=>{if(t instanceof c.Element&&t.name==="html"){if((0,m.isValidElement)(r)&&"props"in r){let e=r.props.children;return(0,o.jsx)(o.Fragment,{children:e})}return}},K=r=>{if(r instanceof c.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}})}},Q=r=>{if(r instanceof c.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,{})}},X=(r,t)=>{if(t instanceof c.Element&&t.name==="a"){let e=t.attribs.href;if(e!=null&&e.startsWith("#")&&!e.startsWith("#code/")){let n=null;return(0,m.isValidElement)(r)&&"props"in r&&(n=r.props.children),(0,o.jsx)(A,{href:e,...t.attribs,children:n})}}},Y=(r,t,e)=>{var n,i;if(t instanceof c.Element&&t.name==="div"&&((i=(n=t.attribs)==null?void 0:n.class)!=null&&i.includes("codehilite")))return(0,o.jsx)(rt,{children:r},e)},tt=(r,t)=>{var e;if(t instanceof c.Element&&((e=t.attribs)!=null&&e["data-marimo-doc"])){let n=t.attribs["data-marimo-doc"];return(0,o.jsx)(P,{qualifiedName:n,children:r})}},et=(r,t)=>{var e;if(t instanceof c.Element&&((e=t.attribs)!=null&&e["data-tooltip"])){let n=t.attribs["data-tooltip"];return(0,o.jsx)(F,{content:n,children:r})}},rt=r=>{let t=(0,U.c)(3),{children:e}=r,n=(0,m.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 nt=({html:r,additionalReplacements:t=[],alwaysSanitizeHtml:e=!0})=>(0,o.jsx)(it,{html:r,alwaysSanitizeHtml:e,additionalReplacements:t});var it=({html:r,additionalReplacements:t=[],alwaysSanitizeHtml:e})=>{let n=B();return at({html:(0,m.useMemo)(()=>e||n?N(r):r,[r,e,n]),additionalReplacements:t})};function at({html:r,additionalReplacements:t=[]}){let e=[Z,K,Q,...t],n=[Y,X,tt,et,G,J];return M(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{nt as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var xi=Object.defineProperty;var wi=(t,e,a)=>e in t?xi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var $=(t,e,a)=>wi(t,typeof e!="symbol"?e+"":e,a);import{s as qa,t as ki}from"./chunk-LvLJmgfZ.js";import{f as Hr,i as Gr,l as Ci,n as Qr,o as Ei,u as Xr}from"./useEvent-D91BmmQi.js";import{t as Ii}from"./react-Bj1aDYRI.js";import{Ci as Ti,Cr as es,E as ts,Fn as Si,Kr as Oi,Kt as as,Mn as Ai,Nt as Ri,Qt as Ni,Si as rs,Sr as ji,Ur as Mi,b as Qe,br as Pi,bt as Va,cr as $i,f as Li,gi as Di,i as Zi,li as Fi,mi as zi,qn as Ui,ur as qi}from"./cells-CuaAKcwV.js";import{B as fe,D as Vi,E as ss,H as Wi,I as ut,J as ns,L as Y,N as is,O as Bi,P as z,R as v,S as Ji,T as ue,V as ze,W as os,b as ua,k as O,w as Ue,x as ca}from"./zod-H_cgTO0M.js";import{t as Dt}from"./compiler-runtime-B3qBwwSJ.js";import{t as Ki,w as Yi}from"./ai-model-dropdown-
|
|
1
|
+
var xi=Object.defineProperty;var wi=(t,e,a)=>e in t?xi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var $=(t,e,a)=>wi(t,typeof e!="symbol"?e+"":e,a);import{s as qa,t as ki}from"./chunk-LvLJmgfZ.js";import{f as Hr,i as Gr,l as Ci,n as Qr,o as Ei,u as Xr}from"./useEvent-D91BmmQi.js";import{t as Ii}from"./react-Bj1aDYRI.js";import{Ci as Ti,Cr as es,E as ts,Fn as Si,Kr as Oi,Kt as as,Mn as Ai,Nt as Ri,Qt as Ni,Si as rs,Sr as ji,Ur as Mi,b as Qe,br as Pi,bt as Va,cr as $i,f as Li,gi as Di,i as Zi,li as Fi,mi as zi,qn as Ui,ur as qi}from"./cells-CuaAKcwV.js";import{B as fe,D as Vi,E as ss,H as Wi,I as ut,J as ns,L as Y,N as is,O as Bi,P as z,R as v,S as Ji,T as ue,V as ze,W as os,b as ua,k as O,w as Ue,x as ca}from"./zod-H_cgTO0M.js";import{t as Dt}from"./compiler-runtime-B3qBwwSJ.js";import{t as Ki,w as Yi}from"./ai-model-dropdown-DUK_vWZh.js";import{_ as se,p as Hi}from"./useEventListener-DGjKht0c.js";import{n as Gi}from"./utils-8btzWeZg.js";import{o as Qi}from"./config-Cgj0Ahvb.js";import{t as Wa}from"./cn-DYvqRARy.js";import{t as Xi}from"./jsx-runtime-Blw4afVn.js";import{d as eo}from"./popover-AtoFZ7i4.js";import{a as ls,c as to,p as ao,r as ro,t as so}from"./dropdown-menu-DrHAuMTb.js";import{t as pa}from"./tooltip-DmqhBBs6.js";import{t as Xe}from"./button-BKVLeSTX.js";import{Ht as no,Jt as ma,St as ha,Vt as io,Wt as ds,Yt as fa,Zt as oo,at as us,ct as lo,lt as cs,rt as Ba,xt as uo}from"./dist-VwkX7yeV.js";import{t as co}from"./createReducer-CYlwteGD.js";import{h as po,n as mo,o as ho,r as fo}from"./dist-BNTOYRCs.js";import{i as ps}from"./strings-pfr2N700.js";import{r as go,t as yo}from"./requests-9-v2bhoi.js";import{t as Ja}from"./createLucideIcon-w-Qo9n0R.js";import{r as vo,t as bo}from"./fileToBase64-D7Ur9Qxq.js";import{t as ms}from"./x-Bv2rCglF.js";import{f as _o,l as hs,n as xo}from"./markdown-renderer-2XpTunxF.js";import{t as fs}from"./file-l37OnSN4.js";import{t as wo}from"./image-BgkzrnsX.js";import{t as ko}from"./spinner-C5wIpWgQ.js";import{t as Co}from"./play-BdC4C3dp.js";import{r as Eo}from"./input-Bg12i6qY.js";import{t as Io}from"./sparkles-B79Qf6ma.js";import{a as Zt,i as Tt,o as Ft,r as St,s as To,t as So}from"./datasource-DwmhT5-D.js";import{a as Oo}from"./dist-BvlMLwcr.js";import{t as Ka}from"./use-toast-BDYuj3zG.js";import{r as Ao}from"./useTheme-DCDmxPD0.js";import{n as Ro}from"./useRunCells-B5o8P7HV.js";import{r as No}from"./errors-CZb6hI2x.js";import{t as jo}from"./blob-CTort_or.js";import{i as Ya}from"./cell-link-D5GhiNrn.js";import{r as Mo,t as Po}from"./html-to-image-C-c-Hfuw.js";import{n as Ha}from"./renderShortcut-DrDh2657.js";import{n as $o}from"./icons-DlzgV4KY.js";import{r as Lo,t as Do}from"./esm-BqofWdD5.js";import{t as Zo}from"./process-output-C-VBRULx.js";import{t as Fo}from"./useDeleteCell-6SLN_jZa.js";var gs=Ja("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]),ys=Ja("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"}]]),vs=Ja("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"}]]),bs="vercel.ai.error",zo=Symbol.for(bs),_s,xs,je=class pi extends(xs=Error,_s=zo,xs){constructor({name:e,message:a,cause:r}){super(a),this[_s]=!0,this.name=e,this.cause=r}static isInstance(e){return pi.hasMarker(e,bs)}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 ws(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var ks="AI_InvalidArgumentError",Cs=`vercel.ai.error.${ks}`,Uo=Symbol.for(Cs),Es,Is,qo=class extends(Is=je,Es=Uo,Is){constructor({message:t,cause:e,argument:a}){super({name:ks,message:t,cause:e}),this[Es]=!0,this.argument=a}static isInstance(t){return je.hasMarker(t,Cs)}},Ts="AI_JSONParseError",Ss=`vercel.ai.error.${Ts}`,Vo=Symbol.for(Ss),Os,As,Rs=class extends(As=je,Os=Vo,As){constructor({text:t,cause:e}){super({name:Ts,message:`JSON parsing failed: Text: ${t}.
|
|
2
2
|
Error message: ${ws(e)}`,cause:e}),this[Os]=!0,this.text=t}static isInstance(t){return je.hasMarker(t,Ss)}},Ns="AI_TypeValidationError",js=`vercel.ai.error.${Ns}`,Wo=Symbol.for(js),Ms,Ps,Ot=class qr extends(Ps=je,Ms=Wo,Ps){constructor({value:e,cause:a,context:r}){let s="Type validation failed";if(r!=null&&r.field&&(s+=` for ${r.field}`),(r==null?void 0:r.entityName)||(r==null?void 0:r.entityId)){s+=" (";let n=[];r.entityName&&n.push(r.entityName),r.entityId&&n.push(`id: "${r.entityId}"`),s+=n.join(", "),s+=")"}super({name:Ns,message:`${s}: Value: ${JSON.stringify(e)}.
|
|
3
3
|
Error message: ${ws(a)}`,cause:a}),this[Ms]=!0,this.value=e,this.context=r}static isInstance(e){return je.hasMarker(e,js)}static wrap({value:e,cause:a,context:r}){var s,n,o;return qr.isInstance(a)&&a.value===e&&((s=a.context)==null?void 0:s.field)===(r==null?void 0:r.field)&&((n=a.context)==null?void 0:n.entityName)===(r==null?void 0:r.entityName)&&((o=a.context)==null?void 0:o.entityId)===(r==null?void 0:r.entityId)?a:new qr({value:e,cause:a,context:r})}},q;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function a(s){throw Error()}t.assertNever=a,t.arrayToEnum=s=>{let n={};for(let o of s)n[o]=o;return n},t.getValidEnumValues=s=>{let n=t.objectKeys(s).filter(i=>typeof s[s[i]]!="number"),o={};for(let i of n)o[i]=s[i];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(n){return s[n]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let n=[];for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&n.push(o);return n},t.find=(s,n)=>{for(let o of s)if(n(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,n=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}t.joinValues=r,t.jsonStringifyReplacer=(s,n)=>typeof n=="bigint"?n.toString():n})(q||(q={}));var Bo;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(Bo||(Bo={}));const C=q.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),et=t=>{switch(typeof t){case"undefined":return C.undefined;case"string":return C.string;case"number":return Number.isNaN(t)?C.nan:C.number;case"boolean":return C.boolean;case"function":return C.function;case"bigint":return C.bigint;case"symbol":return C.symbol;case"object":return Array.isArray(t)?C.array:t===null?C.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?C.promise:typeof Map<"u"&&t instanceof Map?C.map:typeof Set<"u"&&t instanceof Set?C.set:typeof Date<"u"&&t instanceof Date?C.date:C.object;default:return C.unknown}},y=q.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var Me=class mi extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){let a=e||function(n){return n.message},r={_errors:[]},s=n=>{for(let o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(a(o));else{let i=r,l=0;for(;l<o.path.length;){let d=o.path[l];l===o.path.length-1?(i[d]=i[d]||{_errors:[]},i[d]._errors.push(a(o))):i[d]=i[d]||{_errors:[]},i=i[d],l++}}};return s(this),r}static assert(e){if(!(e instanceof mi))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,q.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){let a=Object.create(null),r=[];for(let s of this.issues)if(s.path.length>0){let n=s.path[0];a[n]=a[n]||[],a[n].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:a}}get formErrors(){return this.flatten()}};Me.create=t=>new Me(t);var zt=(t,e)=>{let a;switch(t.code){case y.invalid_type:a=t.received===C.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case y.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,q.jsonStringifyReplacer)}`;break;case y.unrecognized_keys:a=`Unrecognized key(s) in object: ${q.joinValues(t.keys,", ")}`;break;case y.invalid_union:a="Invalid input";break;case y.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${q.joinValues(t.options)}`;break;case y.invalid_enum_value:a=`Invalid enum value. Expected ${q.joinValues(t.options)}, received '${t.received}'`;break;case y.invalid_arguments:a="Invalid function arguments";break;case y.invalid_return_type:a="Invalid function return type";break;case y.invalid_date:a="Invalid date";break;case y.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:q.assertNever(t.validation):a=t.validation==="regex"?"Invalid":`Invalid ${t.validation}`;break;case y.too_small:a=t.type==="array"?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"||t.type==="bigint"?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case y.too_big:a=t.type==="array"?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case y.custom:a="Invalid input";break;case y.invalid_intersection_types:a="Intersection results could not be merged";break;case y.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case y.not_finite:a="Number must be finite";break;default:a=e.defaultError,q.assertNever(t)}return{message:a}},Jo=zt;function Ga(){return Jo}const Qa=t=>{let{data:e,path:a,errorMaps:r,issueData:s}=t,n=[...a,...s.path||[]],o={...s,path:n};if(s.message!==void 0)return{...s,path:n,message:s.message};let i="",l=r.filter(d=>!!d).slice().reverse();for(let d of l)i=d(o,{data:e,defaultError:i}).message;return{...s,path:n,message:i}};function k(t,e){let a=Ga(),r=Qa({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,a,a===zt?void 0:zt].filter(s=>!!s)});t.common.issues.push(r)}var ye=class hi{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,a){let r=[];for(let s of a){if(s.status==="aborted")return R;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,a){let r=[];for(let s of a){let n=await s.key,o=await s.value;r.push({key:n,value:o})}return hi.mergeObjectSync(e,r)}static mergeObjectSync(e,a){let r={};for(let s of a){let{key:n,value:o}=s;if(n.status==="aborted"||o.status==="aborted")return R;n.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(o.value!==void 0||s.alwaysSet)&&(r[n.value]=o.value)}return{status:e.value,value:r}}};const R=Object.freeze({status:"aborted"}),Xa=t=>({status:"dirty",value:t}),ge=t=>({status:"valid",value:t}),$s=t=>t.status==="aborted",Ls=t=>t.status==="dirty",At=t=>t.status==="valid",ga=t=>typeof Promise<"u"&&t instanceof Promise;var T;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(T||(T={}));var Pe=class{constructor(t,e,a,r){this._cachedPath=[],this.parent=t,this.data=e,this._path=a,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Ds=(t,e)=>{if(At(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){return this._error||(this._error=new Me(t.common.issues)),this._error}}};function N(t){if(!t)return{};let{errorMap:e,invalid_type_error:a,required_error:r,description:s}=t;if(e&&(a||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(n,o)=>{let{message:i}=t;return n.code==="invalid_enum_value"?{message:i??o.defaultError}:o.data===void 0?{message:i??r??o.defaultError}:n.code==="invalid_type"?{message:i??a??o.defaultError}:{message:o.defaultError}},description:s}}var L=class{get description(){return this._def.description}_getType(t){return et(t.data)}_getOrReturnCtx(t,e){return e||{common:t.parent.common,data:t.data,parsedType:et(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ye,ctx:{common:t.parent.common,data:t.data,parsedType:et(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let e=this._parse(t);if(ga(e))throw Error("Synchronous parse encountered promise.");return e}_parseAsync(t){let e=this._parse(t);return Promise.resolve(e)}parse(t,e){let a=this.safeParse(t,e);if(a.success)return a.data;throw a.error}safeParse(t,e){let a={common:{issues:[],async:(e==null?void 0:e.async)??!1,contextualErrorMap:e==null?void 0:e.errorMap},path:(e==null?void 0:e.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:et(t)};return Ds(a,this._parseSync({data:t,path:a.path,parent:a}))}"~validate"(t){var a,r;let e={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:et(t)};if(!this["~standard"].async)try{let s=this._parseSync({data:t,path:[],parent:e});return At(s)?{value:s.value}:{issues:e.common.issues}}catch(s){(r=(a=s==null?void 0:s.message)==null?void 0:a.toLowerCase())!=null&&r.includes("encountered")&&(this["~standard"].async=!0),e.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:e}).then(s=>At(s)?{value:s.value}:{issues:e.common.issues})}async parseAsync(t,e){let a=await this.safeParseAsync(t,e);if(a.success)return a.data;throw a.error}async safeParseAsync(t,e){let a={common:{issues:[],contextualErrorMap:e==null?void 0:e.errorMap,async:!0},path:(e==null?void 0:e.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:et(t)},r=this._parse({data:t,path:a.path,parent:a});return Ds(a,await(ga(r)?r:Promise.resolve(r)))}refine(t,e){let a=r=>typeof e=="string"||e===void 0?{message:e}:typeof e=="function"?e(r):e;return this._refinement((r,s)=>{let n=t(r),o=()=>s.addIssue({code:y.custom,...a(r)});return typeof Promise<"u"&&n instanceof Promise?n.then(i=>i?!0:(o(),!1)):n?!0:(o(),!1)})}refinement(t,e){return this._refinement((a,r)=>t(a)?!0:(r.addIssue(typeof e=="function"?e(a,r):e),!1))}_refinement(t){return new qe({schema:this,typeName:b.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Ve.create(this,this._def)}nullable(){return pt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Nt.create(this)}promise(){return Ut.create(this,this._def)}or(t){return _a.create([this,t],this._def)}and(t){return xa.create(this,t,this._def)}transform(t){return new qe({...N(this._def),schema:this,typeName:b.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let e=typeof t=="function"?t:()=>t;return new Ia({...N(this._def),innerType:this,defaultValue:e,typeName:b.ZodDefault})}brand(){return new qs({typeName:b.ZodBranded,type:this,...N(this._def)})}catch(t){let e=typeof t=="function"?t:()=>t;return new Ta({...N(this._def),innerType:this,catchValue:e,typeName:b.ZodCatch})}describe(t){let e=this.constructor;return new e({...this._def,description:t})}pipe(t){return Vs.create(this,t)}readonly(){return Sa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Ko=/^c[^\s-]{8,}$/i,Yo=/^[0-9a-z]+$/,Ho=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Go=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Qo=/^[a-z0-9_-]{21}$/i,Xo=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,el=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,tl=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,al="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Zs,rl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,sl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,nl=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,il=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ol=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ll=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Fs="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dl=RegExp(`^${Fs}$`);function zs(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision??(e=`${e}(\\.\\d+)?`);let a=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${a}`}function ul(t){return RegExp(`^${zs(t)}$`)}function cl(t){let e=`${Fs}T${zs(t)}`,a=[];return a.push(t.local?"Z?":"Z"),t.offset&&a.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${a.join("|")})`,RegExp(`^${e}$`)}function pl(t,e){return!!((e==="v4"||!e)&&rl.test(t)||(e==="v6"||!e)&&nl.test(t))}function ml(t,e){if(!Xo.test(t))return!1;try{let[a]=t.split(".");if(!a)return!1;let r=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||!s||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function hl(t,e){return!!((e==="v4"||!e)&&sl.test(t)||(e==="v6"||!e)&&il.test(t))}var ya=class aa extends L{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==C.string){let s=this._getOrReturnCtx(e);return k(s,{code:y.invalid_type,expected:C.string,received:s.parsedType}),R}let a=new ye,r;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(r=this._getOrReturnCtx(e,r),k(r,{code:y.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if(s.kind==="max")e.data.length>s.value&&(r=this._getOrReturnCtx(e,r),k(r,{code:y.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if(s.kind==="length"){let n=e.data.length>s.value,o=e.data.length<s.value;(n||o)&&(r=this._getOrReturnCtx(e,r),n?k(r,{code:y.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&k(r,{code:y.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),a.dirty())}else if(s.kind==="email")tl.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"email",code:y.invalid_string,message:s.message}),a.dirty());else if(s.kind==="emoji")Zs||(Zs=new RegExp(al,"u")),Zs.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"emoji",code:y.invalid_string,message:s.message}),a.dirty());else if(s.kind==="uuid")Go.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"uuid",code:y.invalid_string,message:s.message}),a.dirty());else if(s.kind==="nanoid")Qo.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"nanoid",code:y.invalid_string,message:s.message}),a.dirty());else if(s.kind==="cuid")Ko.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"cuid",code:y.invalid_string,message:s.message}),a.dirty());else if(s.kind==="cuid2")Yo.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"cuid2",code:y.invalid_string,message:s.message}),a.dirty());else if(s.kind==="ulid")Ho.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"ulid",code:y.invalid_string,message:s.message}),a.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),k(r,{validation:"url",code:y.invalid_string,message:s.message}),a.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"regex",code:y.invalid_string,message:s.message}),a.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(e,r),k(r,{code:y.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),a.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(r=this._getOrReturnCtx(e,r),k(r,{code:y.invalid_string,validation:{startsWith:s.value},message:s.message}),a.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(r=this._getOrReturnCtx(e,r),k(r,{code:y.invalid_string,validation:{endsWith:s.value},message:s.message}),a.dirty()):s.kind==="datetime"?cl(s).test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:y.invalid_string,validation:"datetime",message:s.message}),a.dirty()):s.kind==="date"?dl.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:y.invalid_string,validation:"date",message:s.message}),a.dirty()):s.kind==="time"?ul(s).test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:y.invalid_string,validation:"time",message:s.message}),a.dirty()):s.kind==="duration"?el.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"duration",code:y.invalid_string,message:s.message}),a.dirty()):s.kind==="ip"?pl(e.data,s.version)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"ip",code:y.invalid_string,message:s.message}),a.dirty()):s.kind==="jwt"?ml(e.data,s.alg)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"jwt",code:y.invalid_string,message:s.message}),a.dirty()):s.kind==="cidr"?hl(e.data,s.version)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"cidr",code:y.invalid_string,message:s.message}),a.dirty()):s.kind==="base64"?ol.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"base64",code:y.invalid_string,message:s.message}),a.dirty()):s.kind==="base64url"?ll.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"base64url",code:y.invalid_string,message:s.message}),a.dirty()):q.assertNever(s);return{status:a.value,value:e.data}}_regex(e,a,r){return this.refinement(s=>e.test(s),{validation:a,code:y.invalid_string,...T.errToObj(r)})}_addCheck(e){return new aa({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...T.errToObj(e)})}url(e){return this._addCheck({kind:"url",...T.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...T.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...T.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...T.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...T.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...T.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...T.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...T.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...T.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...T.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...T.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...T.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:(e==null?void 0:e.precision)===void 0?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...T.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:(e==null?void 0:e.precision)===void 0?null:e==null?void 0:e.precision,...T.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...T.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...T.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:a==null?void 0:a.position,...T.errToObj(a==null?void 0:a.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...T.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...T.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...T.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...T.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...T.errToObj(a)})}nonempty(e){return this.min(1,T.errToObj(e))}trim(){return new aa({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new aa({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new aa({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxLength(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}};ya.create=t=>new ya({checks:[],typeName:b.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...N(t)});function fl(t,e){let a=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=a>r?a:r;return Number.parseInt(t.toFixed(s).replace(".",""))%Number.parseInt(e.toFixed(s).replace(".",""))/10**s}var er=class Vr extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==C.number){let s=this._getOrReturnCtx(e);return k(s,{code:y.invalid_type,expected:C.number,received:s.parsedType}),R}let a,r=new ye;for(let s of this._def.checks)s.kind==="int"?q.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{code:y.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(a=this._getOrReturnCtx(e,a),k(a,{code:y.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(a=this._getOrReturnCtx(e,a),k(a,{code:y.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?fl(e.data,s.value)!==0&&(a=this._getOrReturnCtx(e,a),k(a,{code:y.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{code:y.not_finite,message:s.message}),r.dirty()):q.assertNever(s);return{status:r.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,T.toString(a))}gt(e,a){return this.setLimit("min",e,!1,T.toString(a))}lte(e,a){return this.setLimit("max",e,!0,T.toString(a))}lt(e,a){return this.setLimit("max",e,!1,T.toString(a))}setLimit(e,a,r,s){return new Vr({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:r,message:T.toString(s)}]})}_addCheck(e){return new Vr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:T.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:T.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:-(2**53-1),message:T.toString(e)})._addCheck({kind:"max",inclusive:!0,value:2**53-1,message:T.toString(e)})}get minValue(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&q.isInteger(e.value))}get isFinite(){let e=null,a=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(a===null||r.value>a)&&(a=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(a)&&Number.isFinite(e)}};er.create=t=>new er({checks:[],typeName:b.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...N(t)});var tr=class Wr extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==C.bigint)return this._getInvalidInput(e);let a,r=new ye;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(a=this._getOrReturnCtx(e,a),k(a,{code:y.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(a=this._getOrReturnCtx(e,a),k(a,{code:y.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),k(a,{code:y.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):q.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){let a=this._getOrReturnCtx(e);return k(a,{code:y.invalid_type,expected:C.bigint,received:a.parsedType}),R}gte(e,a){return this.setLimit("min",e,!0,T.toString(a))}gt(e,a){return this.setLimit("min",e,!1,T.toString(a))}lte(e,a){return this.setLimit("max",e,!0,T.toString(a))}lt(e,a){return this.setLimit("max",e,!1,T.toString(a))}setLimit(e,a,r,s){return new Wr({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:r,message:T.toString(s)}]})}_addCheck(e){return new Wr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(a)})}get minValue(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}};tr.create=t=>new tr({checks:[],typeName:b.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...N(t)});var ar=class extends L{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==C.boolean){let e=this._getOrReturnCtx(t);return k(e,{code:y.invalid_type,expected:C.boolean,received:e.parsedType}),R}return ge(t.data)}};ar.create=t=>new ar({typeName:b.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...N(t)});var rr=class fi extends L{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==C.date){let s=this._getOrReturnCtx(e);return k(s,{code:y.invalid_type,expected:C.date,received:s.parsedType}),R}if(Number.isNaN(e.data.getTime()))return k(this._getOrReturnCtx(e),{code:y.invalid_date}),R;let a=new ye,r;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(r=this._getOrReturnCtx(e,r),k(r,{code:y.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),a.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(r=this._getOrReturnCtx(e,r),k(r,{code:y.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),a.dirty()):q.assertNever(s);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new fi({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:T.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:T.toString(a)})}get minDate(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e==null?null:new Date(e)}};rr.create=t=>new rr({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:b.ZodDate,...N(t)});var sr=class extends L{_parse(t){if(this._getType(t)!==C.symbol){let e=this._getOrReturnCtx(t);return k(e,{code:y.invalid_type,expected:C.symbol,received:e.parsedType}),R}return ge(t.data)}};sr.create=t=>new sr({typeName:b.ZodSymbol,...N(t)});var va=class extends L{_parse(t){if(this._getType(t)!==C.undefined){let e=this._getOrReturnCtx(t);return k(e,{code:y.invalid_type,expected:C.undefined,received:e.parsedType}),R}return ge(t.data)}};va.create=t=>new va({typeName:b.ZodUndefined,...N(t)});var ba=class extends L{_parse(t){if(this._getType(t)!==C.null){let e=this._getOrReturnCtx(t);return k(e,{code:y.invalid_type,expected:C.null,received:e.parsedType}),R}return ge(t.data)}};ba.create=t=>new ba({typeName:b.ZodNull,...N(t)});var nr=class extends L{constructor(){super(...arguments),this._any=!0}_parse(t){return ge(t.data)}};nr.create=t=>new nr({typeName:b.ZodAny,...N(t)});var Rt=class extends L{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ge(t.data)}};Rt.create=t=>new Rt({typeName:b.ZodUnknown,...N(t)});var tt=class extends L{_parse(t){let e=this._getOrReturnCtx(t);return k(e,{code:y.invalid_type,expected:C.never,received:e.parsedType}),R}};tt.create=t=>new tt({typeName:b.ZodNever,...N(t)});var ir=class extends L{_parse(t){if(this._getType(t)!==C.undefined){let e=this._getOrReturnCtx(t);return k(e,{code:y.invalid_type,expected:C.void,received:e.parsedType}),R}return ge(t.data)}};ir.create=t=>new ir({typeName:b.ZodVoid,...N(t)});var Nt=class Da extends L{_parse(e){let{ctx:a,status:r}=this._processInputParams(e),s=this._def;if(a.parsedType!==C.array)return k(a,{code:y.invalid_type,expected:C.array,received:a.parsedType}),R;if(s.exactLength!==null){let o=a.data.length>s.exactLength.value,i=a.data.length<s.exactLength.value;(o||i)&&(k(a,{code:o?y.too_big:y.too_small,minimum:i?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&a.data.length<s.minLength.value&&(k(a,{code:y.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&a.data.length>s.maxLength.value&&(k(a,{code:y.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),a.common.async)return Promise.all([...a.data].map((o,i)=>s.type._parseAsync(new Pe(a,o,a.path,i)))).then(o=>ye.mergeArray(r,o));let n=[...a.data].map((o,i)=>s.type._parseSync(new Pe(a,o,a.path,i)));return ye.mergeArray(r,n)}get element(){return this._def.type}min(e,a){return new Da({...this._def,minLength:{value:e,message:T.toString(a)}})}max(e,a){return new Da({...this._def,maxLength:{value:e,message:T.toString(a)}})}length(e,a){return new Da({...this._def,exactLength:{value:e,message:T.toString(a)}})}nonempty(e){return this.min(1,e)}};Nt.create=(t,e)=>new Nt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:b.ZodArray,...N(e)});function jt(t){if(t instanceof Ee){let e={};for(let a in t.shape){let r=t.shape[a];e[a]=Ve.create(jt(r))}return new Ee({...t._def,shape:()=>e})}else return t instanceof Nt?new Nt({...t._def,type:jt(t.element)}):t instanceof Ve?Ve.create(jt(t.unwrap())):t instanceof pt?pt.create(jt(t.unwrap())):t instanceof ct?ct.create(t.items.map(e=>jt(e))):t}var Ee=class Oe extends L{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape();return this._cached={shape:e,keys:q.objectKeys(e)},this._cached}_parse(e){if(this._getType(e)!==C.object){let l=this._getOrReturnCtx(e);return k(l,{code:y.invalid_type,expected:C.object,received:l.parsedType}),R}let{status:a,ctx:r}=this._processInputParams(e),{shape:s,keys:n}=this._getCached(),o=[];if(!(this._def.catchall instanceof tt&&this._def.unknownKeys==="strip"))for(let l in r.data)n.includes(l)||o.push(l);let i=[];for(let l of n){let d=s[l],u=r.data[l];i.push({key:{status:"valid",value:l},value:d._parse(new Pe(r,u,r.path,l)),alwaysSet:l in r.data})}if(this._def.catchall instanceof tt){let l=this._def.unknownKeys;if(l==="passthrough")for(let d of o)i.push({key:{status:"valid",value:d},value:{status:"valid",value:r.data[d]}});else if(l==="strict")o.length>0&&(k(r,{code:y.unrecognized_keys,keys:o}),a.dirty());else if(l!=="strip")throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let d of o){let u=r.data[d];i.push({key:{status:"valid",value:d},value:l._parse(new Pe(r,u,r.path,d)),alwaysSet:d in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let l=[];for(let d of i){let u=await d.key,p=await d.value;l.push({key:u,value:p,alwaysSet:d.alwaysSet})}return l}).then(l=>ye.mergeObjectSync(a,l)):ye.mergeObjectSync(a,i)}get shape(){return this._def.shape()}strict(e){return T.errToObj,new Oe({...this._def,unknownKeys:"strict",...e===void 0?{}:{errorMap:(a,r)=>{var n,o;let s=((o=(n=this._def).errorMap)==null?void 0:o.call(n,a,r).message)??r.defaultError;return a.code==="unrecognized_keys"?{message:T.errToObj(e).message??s}:{message:s}}}})}strip(){return new Oe({...this._def,unknownKeys:"strip"})}passthrough(){return new Oe({...this._def,unknownKeys:"passthrough"})}extend(e){return new Oe({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Oe({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:b.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new Oe({...this._def,catchall:e})}pick(e){let a={};for(let r of q.objectKeys(e))e[r]&&this.shape[r]&&(a[r]=this.shape[r]);return new Oe({...this._def,shape:()=>a})}omit(e){let a={};for(let r of q.objectKeys(this.shape))e[r]||(a[r]=this.shape[r]);return new Oe({...this._def,shape:()=>a})}deepPartial(){return jt(this)}partial(e){let a={};for(let r of q.objectKeys(this.shape)){let s=this.shape[r];e&&!e[r]?a[r]=s:a[r]=s.optional()}return new Oe({...this._def,shape:()=>a})}required(e){let a={};for(let r of q.objectKeys(this.shape))if(e&&!e[r])a[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Ve;)s=s._def.innerType;a[r]=s}return new Oe({...this._def,shape:()=>a})}keyof(){return Us(q.objectKeys(this.shape))}};Ee.create=(t,e)=>new Ee({shape:()=>t,unknownKeys:"strip",catchall:tt.create(),typeName:b.ZodObject,...N(e)}),Ee.strictCreate=(t,e)=>new Ee({shape:()=>t,unknownKeys:"strict",catchall:tt.create(),typeName:b.ZodObject,...N(e)}),Ee.lazycreate=(t,e)=>new Ee({shape:t,unknownKeys:"strip",catchall:tt.create(),typeName:b.ZodObject,...N(e)});var _a=class extends L{_parse(t){let{ctx:e}=this._processInputParams(t),a=this._def.options;function r(s){for(let o of s)if(o.result.status==="valid")return o.result;for(let o of s)if(o.result.status==="dirty")return e.common.issues.push(...o.ctx.common.issues),o.result;let n=s.map(o=>new Me(o.ctx.common.issues));return k(e,{code:y.invalid_union,unionErrors:n}),R}if(e.common.async)return Promise.all(a.map(async s=>{let n={...e,common:{...e.common,issues:[]},parent:null};return{result:await s._parseAsync({data:e.data,path:e.path,parent:n}),ctx:n}})).then(r);{let s,n=[];for(let i of a){let l={...e,common:{...e.common,issues:[]},parent:null},d=i._parseSync({data:e.data,path:e.path,parent:l});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:l}),l.common.issues.length&&n.push(l.common.issues)}if(s)return e.common.issues.push(...s.ctx.common.issues),s.result;let o=n.map(i=>new Me(i));return k(e,{code:y.invalid_union,unionErrors:o}),R}}get options(){return this._def.options}};_a.create=(t,e)=>new _a({options:t,typeName:b.ZodUnion,...N(e)});var at=t=>t instanceof wa?at(t.schema):t instanceof qe?at(t.innerType()):t instanceof ka?[t.value]:t instanceof Ca?t.options:t instanceof Ea?q.objectValues(t.enum):t instanceof Ia?at(t._def.innerType):t instanceof va?[void 0]:t instanceof ba?[null]:t instanceof Ve?[void 0,...at(t.unwrap())]:t instanceof pt?[null,...at(t.unwrap())]:t instanceof qs||t instanceof Sa?at(t.unwrap()):t instanceof Ta?at(t._def.innerType):[],gl=class gi extends L{_parse(e){let{ctx:a}=this._processInputParams(e);if(a.parsedType!==C.object)return k(a,{code:y.invalid_type,expected:C.object,received:a.parsedType}),R;let r=this.discriminator,s=a.data[r],n=this.optionsMap.get(s);return n?a.common.async?n._parseAsync({data:a.data,path:a.path,parent:a}):n._parseSync({data:a.data,path:a.path,parent:a}):(k(a,{code:y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),R)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,a,r){let s=new Map;for(let n of a){let o=at(n.shape[e]);if(!o.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(s.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);s.set(i,n)}}return new gi({typeName:b.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:s,...N(r)})}};function or(t,e){let a=et(t),r=et(e);if(t===e)return{valid:!0,data:t};if(a===C.object&&r===C.object){let s=q.objectKeys(e),n=q.objectKeys(t).filter(i=>s.indexOf(i)!==-1),o={...t,...e};for(let i of n){let l=or(t[i],e[i]);if(!l.valid)return{valid:!1};o[i]=l.data}return{valid:!0,data:o}}else if(a===C.array&&r===C.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let n=0;n<t.length;n++){let o=t[n],i=e[n],l=or(o,i);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return a===C.date&&r===C.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var xa=class extends L{_parse(t){let{status:e,ctx:a}=this._processInputParams(t),r=(s,n)=>{if($s(s)||$s(n))return R;let o=or(s.value,n.value);return o.valid?((Ls(s)||Ls(n))&&e.dirty(),{status:e.value,value:o.data}):(k(a,{code:y.invalid_intersection_types}),R)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([s,n])=>r(s,n)):r(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};xa.create=(t,e,a)=>new xa({left:t,right:e,typeName:b.ZodIntersection,...N(a)});var ct=class yi extends L{_parse(e){let{status:a,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.array)return k(r,{code:y.invalid_type,expected:C.array,received:r.parsedType}),R;if(r.data.length<this._def.items.length)return k(r,{code:y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),R;!this._def.rest&&r.data.length>this._def.items.length&&(k(r,{code:y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());let s=[...r.data].map((n,o)=>{let i=this._def.items[o]||this._def.rest;return i?i._parse(new Pe(r,n,r.path,o)):null}).filter(n=>!!n);return r.common.async?Promise.all(s).then(n=>ye.mergeArray(a,n)):ye.mergeArray(a,s)}get items(){return this._def.items}rest(e){return new yi({...this._def,rest:e})}};ct.create=(t,e)=>{if(!Array.isArray(t))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new ct({items:t,typeName:b.ZodTuple,rest:null,...N(e)})};var yl=class Br extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:a,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.object)return k(r,{code:y.invalid_type,expected:C.object,received:r.parsedType}),R;let s=[],n=this._def.keyType,o=this._def.valueType;for(let i in r.data)s.push({key:n._parse(new Pe(r,i,r.path,i)),value:o._parse(new Pe(r,r.data[i],r.path,i)),alwaysSet:i in r.data});return r.common.async?ye.mergeObjectAsync(a,s):ye.mergeObjectSync(a,s)}get element(){return this._def.valueType}static create(e,a,r){return a instanceof L?new Br({keyType:e,valueType:a,typeName:b.ZodRecord,...N(r)}):new Br({keyType:ya.create(),valueType:e,typeName:b.ZodRecord,...N(a)})}},lr=class extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:e,ctx:a}=this._processInputParams(t);if(a.parsedType!==C.map)return k(a,{code:y.invalid_type,expected:C.map,received:a.parsedType}),R;let r=this._def.keyType,s=this._def.valueType,n=[...a.data.entries()].map(([o,i],l)=>({key:r._parse(new Pe(a,o,a.path,[l,"key"])),value:s._parse(new Pe(a,i,a.path,[l,"value"]))}));if(a.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let i of n){let l=await i.key,d=await i.value;if(l.status==="aborted"||d.status==="aborted")return R;(l.status==="dirty"||d.status==="dirty")&&e.dirty(),o.set(l.value,d.value)}return{status:e.value,value:o}})}else{let o=new Map;for(let i of n){let l=i.key,d=i.value;if(l.status==="aborted"||d.status==="aborted")return R;(l.status==="dirty"||d.status==="dirty")&&e.dirty(),o.set(l.value,d.value)}return{status:e.value,value:o}}}};lr.create=(t,e,a)=>new lr({valueType:e,keyType:t,typeName:b.ZodMap,...N(a)});var dr=class Jr extends L{_parse(e){let{status:a,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.set)return k(r,{code:y.invalid_type,expected:C.set,received:r.parsedType}),R;let s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(k(r,{code:y.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),a.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(k(r,{code:y.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),a.dirty());let n=this._def.valueType;function o(l){let d=new Set;for(let u of l){if(u.status==="aborted")return R;u.status==="dirty"&&a.dirty(),d.add(u.value)}return{status:a.value,value:d}}let i=[...r.data.values()].map((l,d)=>n._parse(new Pe(r,l,r.path,d)));return r.common.async?Promise.all(i).then(l=>o(l)):o(i)}min(e,a){return new Jr({...this._def,minSize:{value:e,message:T.toString(a)}})}max(e,a){return new Jr({...this._def,maxSize:{value:e,message:T.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}};dr.create=(t,e)=>new dr({valueType:t,minSize:null,maxSize:null,typeName:b.ZodSet,...N(e)});var vl=class Za extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:a}=this._processInputParams(e);if(a.parsedType!==C.function)return k(a,{code:y.invalid_type,expected:C.function,received:a.parsedType}),R;function r(i,l){return Qa({data:i,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,Ga(),zt].filter(d=>!!d),issueData:{code:y.invalid_arguments,argumentsError:l}})}function s(i,l){return Qa({data:i,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,Ga(),zt].filter(d=>!!d),issueData:{code:y.invalid_return_type,returnTypeError:l}})}let n={errorMap:a.common.contextualErrorMap},o=a.data;if(this._def.returns instanceof Ut){let i=this;return ge(async function(...l){let d=new Me([]),u=await i._def.args.parseAsync(l,n).catch(m=>{throw d.addIssue(r(l,m)),d}),p=await Reflect.apply(o,this,u);return await i._def.returns._def.type.parseAsync(p,n).catch(m=>{throw d.addIssue(s(p,m)),d})})}else{let i=this;return ge(function(...l){let d=i._def.args.safeParse(l,n);if(!d.success)throw new Me([r(l,d.error)]);let u=Reflect.apply(o,this,d.data),p=i._def.returns.safeParse(u,n);if(!p.success)throw new Me([s(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Za({...this._def,args:ct.create(e).rest(Rt.create())})}returns(e){return new Za({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,a,r){return new Za({args:e||ct.create([]).rest(Rt.create()),returns:a||Rt.create(),typeName:b.ZodFunction,...N(r)})}},wa=class extends L{get schema(){return this._def.getter()}_parse(t){let{ctx:e}=this._processInputParams(t);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}};wa.create=(t,e)=>new wa({getter:t,typeName:b.ZodLazy,...N(e)});var ka=class extends L{_parse(t){if(t.data!==this._def.value){let e=this._getOrReturnCtx(t);return k(e,{received:e.data,code:y.invalid_literal,expected:this._def.value}),R}return{status:"valid",value:t.data}}get value(){return this._def.value}};ka.create=(t,e)=>new ka({value:t,typeName:b.ZodLiteral,...N(e)});function Us(t,e){return new Ca({values:t,typeName:b.ZodEnum,...N(e)})}var Ca=class Kr extends L{_parse(e){if(typeof e.data!="string"){let a=this._getOrReturnCtx(e),r=this._def.values;return k(a,{expected:q.joinValues(r),received:a.parsedType,code:y.invalid_type}),R}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let a=this._getOrReturnCtx(e),r=this._def.values;return k(a,{received:a.data,code:y.invalid_enum_value,options:r}),R}return ge(e.data)}get options(){return this._def.values}get enum(){let e={};for(let a of this._def.values)e[a]=a;return e}get Values(){let e={};for(let a of this._def.values)e[a]=a;return e}get Enum(){let e={};for(let a of this._def.values)e[a]=a;return e}extract(e,a=this._def){return Kr.create(e,{...this._def,...a})}exclude(e,a=this._def){return Kr.create(this.options.filter(r=>!e.includes(r)),{...this._def,...a})}};Ca.create=Us;var Ea=class extends L{_parse(t){let e=q.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==C.string&&a.parsedType!==C.number){let r=q.objectValues(e);return k(a,{expected:q.joinValues(r),received:a.parsedType,code:y.invalid_type}),R}if(this._cache||(this._cache=new Set(q.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let r=q.objectValues(e);return k(a,{received:a.data,code:y.invalid_enum_value,options:r}),R}return ge(t.data)}get enum(){return this._def.values}};Ea.create=(t,e)=>new Ea({values:t,typeName:b.ZodNativeEnum,...N(e)});var Ut=class extends L{unwrap(){return this._def.type}_parse(t){let{ctx:e}=this._processInputParams(t);return e.parsedType!==C.promise&&e.common.async===!1?(k(e,{code:y.invalid_type,expected:C.promise,received:e.parsedType}),R):ge((e.parsedType===C.promise?e.data:Promise.resolve(e.data)).then(a=>this._def.type.parseAsync(a,{path:e.path,errorMap:e.common.contextualErrorMap})))}};Ut.create=(t,e)=>new Ut({type:t,typeName:b.ZodPromise,...N(e)});var qe=class extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===b.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:e,ctx:a}=this._processInputParams(t),r=this._def.effect||null,s={addIssue:n=>{k(a,n),n.fatal?e.abort():e.dirty()},get path(){return a.path}};if(s.addIssue=s.addIssue.bind(s),r.type==="preprocess"){let n=r.transform(a.data,s);if(a.common.async)return Promise.resolve(n).then(async o=>{if(e.value==="aborted")return R;let i=await this._def.schema._parseAsync({data:o,path:a.path,parent:a});return i.status==="aborted"?R:i.status==="dirty"||e.value==="dirty"?Xa(i.value):i});{if(e.value==="aborted")return R;let o=this._def.schema._parseSync({data:n,path:a.path,parent:a});return o.status==="aborted"?R:o.status==="dirty"||e.value==="dirty"?Xa(o.value):o}}if(r.type==="refinement"){let n=o=>{let i=r.refinement(o,s);if(a.common.async)return Promise.resolve(i);if(i instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(a.common.async===!1){let o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return o.status==="aborted"?R:(o.status==="dirty"&&e.dirty(),n(o.value),{status:e.value,value:o.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(o=>o.status==="aborted"?R:(o.status==="dirty"&&e.dirty(),n(o.value).then(()=>({status:e.value,value:o.value}))))}if(r.type==="transform")if(a.common.async===!1){let n=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!At(n))return R;let o=r.transform(n.value,s);if(o instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:e.value,value:o}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(n=>At(n)?Promise.resolve(r.transform(n.value,s)).then(o=>({status:e.value,value:o})):R);q.assertNever(r)}};qe.create=(t,e,a)=>new qe({schema:t,typeName:b.ZodEffects,effect:e,...N(a)}),qe.createWithPreprocess=(t,e,a)=>new qe({schema:e,effect:{type:"preprocess",transform:t},typeName:b.ZodEffects,...N(a)});var Ve=class extends L{_parse(t){return this._getType(t)===C.undefined?ge(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ve.create=(t,e)=>new Ve({innerType:t,typeName:b.ZodOptional,...N(e)});var pt=class extends L{_parse(t){return this._getType(t)===C.null?ge(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};pt.create=(t,e)=>new pt({innerType:t,typeName:b.ZodNullable,...N(e)});var Ia=class extends L{_parse(t){let{ctx:e}=this._processInputParams(t),a=e.data;return e.parsedType===C.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:e.path,parent:e})}removeDefault(){return this._def.innerType}};Ia.create=(t,e)=>new Ia({innerType:t,typeName:b.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...N(e)});var Ta=class extends L{_parse(t){let{ctx:e}=this._processInputParams(t),a={...e,common:{...e.common,issues:[]}},r=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return ga(r)?r.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Me(a.common.issues)},input:a.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Me(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};Ta.create=(t,e)=>new Ta({innerType:t,typeName:b.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...N(e)});var ur=class extends L{_parse(t){if(this._getType(t)!==C.nan){let e=this._getOrReturnCtx(t);return k(e,{code:y.invalid_type,expected:C.nan,received:e.parsedType}),R}return{status:"valid",value:t.data}}};ur.create=t=>new ur({typeName:b.ZodNaN,...N(t)});var qs=class extends L{_parse(t){let{ctx:e}=this._processInputParams(t),a=e.data;return this._def.type._parse({data:a,path:e.path,parent:e})}unwrap(){return this._def.type}},Vs=class vi extends L{_parse(e){let{status:a,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?R:s.status==="dirty"?(a.dirty(),Xa(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{let s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?R:s.status==="dirty"?(a.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,a){return new vi({in:e,out:a,typeName:b.ZodPipeline})}},Sa=class extends L{_parse(t){let e=this._def.innerType._parse(t),a=r=>(At(r)&&(r.value=Object.freeze(r.value)),r);return ga(e)?e.then(r=>a(r)):a(e)}unwrap(){return this._def.innerType}};Sa.create=(t,e)=>new Sa({innerType:t,typeName:b.ZodReadonly,...N(e)}),Ee.lazycreate;var b;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(b||(b={})),ya.create,er.create,ur.create,tr.create,ar.create,rr.create,sr.create,va.create,ba.create,nr.create,Rt.create,tt.create,ir.create,Nt.create,Ee.create,Ee.strictCreate,_a.create,gl.create,xa.create,ct.create,yl.create,lr.create,dr.create,vl.create,wa.create,ka.create,Ca.create,Ea.create,Ut.create,qe.create,Ve.create,pt.create,qe.createWithPreprocess,Vs.create;var Ws=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 cr(t){}function bl(t){if(typeof t=="function")throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=cr,onError:a=cr,onRetry:r=cr,onComment:s}=t,n="",o=!0,i,l="",d="";function u(c){let g=o?c.replace(/^\xEF\xBB\xBF/,""):c,[h,x]=_l(`${n}${g}`);for(let w of h)p(w);n=x,o=!1}function p(c){if(c===""){f();return}if(c.startsWith(":")){s&&s(c.slice(c.startsWith(": ")?2:1));return}let g=c.indexOf(":");if(g!==-1){let h=c.slice(0,g),x=c[g+1]===" "?2:1;m(h,c.slice(g+x),c);return}m(c,"",c)}function m(c,g,h){switch(c){case"event":d=g;break;case"data":l=`${l}${g}
|
|
4
4
|
`;break;case"id":i=g.includes("\0")?void 0:g;break;case"retry":/^\d+$/.test(g)?r(parseInt(g,10)):a(new Ws(`Invalid \`retry\` value: "${g}"`,{type:"invalid-retry",value:g,line:h}));break;default:a(new Ws(`Unknown field "${c.length>20?`${c.slice(0,20)}\u2026`:c}"`,{type:"unknown-field",field:c,value:g,line:h}));break}}function f(){l.length>0&&e({id:i,event:d||void 0,data:l.endsWith(`
|
|
@@ -20,7 +20,7 @@ ${a.processedContent}`:a.outputType==="media"&&(i+=`Media Output: Contains ${a.o
|
|
|
20
20
|
Image URL: ${a.imageUrl}`)),Zt({type:this.contextType,data:o,details:i})}async getAttachments(e){let a=e[0].data.cellId,r=e[0].data.cellName;return Pu(e.map(s=>s.data.cellOutput),a,r)}};async function Pu(t,e,a){let r=t.filter(n=>n.shouldDownloadImage&&n.outputType==="media");if(r.length===0)return[];let s=r.flatMap(n=>{let o=document.getElementById(Ti.create(e));return o?{cellId:e,cellName:a,mimetype:n.output.mimetype,element:o}:(se.warn(`Output element not found for cell ${e}`),[])});try{return await Promise.all(s.map(async n=>({type:"file",filename:`${a}-output-screenshot`,mediaType:"image/png",url:await Po(n.element)})))}catch(n){return se.error("Error downloading cell output images:",n),[]}}function $n(t){if(hs(t))return null;let e=t.mimetype,a=ju(e,String(t.data))?"media":"text",r=Zo(t),s,n=!1;return a==="media"&&(typeof t.data=="string"&&t.data.startsWith("data:")||typeof t.data=="string"&&t.data.startsWith("http")?s=t.data:n=!0),{processedContent:r,imageUrl:s,shouldDownloadImage:n,outputType:a,output:t}}function Ln(t,e,a){let{includeConsoleOutput:r=!1}=a||{},s=e.cellRuntime[t],n=e.cellData[t],o=e.cellIds.inOrderIds.indexOf(t),i=Ri(n.name,o),l;r&&(l=s.consoleOutputs.map(p=>$n(p)).filter(p=>p!==null));let d,u=s.output;return u&&!hs(u)&&(d=$n(u)??void 0),{cellId:t,cellName:i,cellCode:n.code,cellOutput:d,consoleOutputs:l}}function $u(t){return t.type==="setup-refs"?"The setup cell cannot have references":t.type==="cycle"?"This cell is in a cycle":t.type==="multiple-defs"?`The variable '${t.name}' was defined by another cell`:t.type==="import-star"||t.type==="ancestor-stopped"||t.type==="ancestor-prevented"||t.type==="exception"||t.type==="strict-exception"?t.msg:t.type==="interruption"?"This cell was interrupted and needs to be re-run":t.type==="syntax"||t.type==="unknown"||t.type==="sql-error"?t.msg:t.type==="internal"?t.msg||"An internal error occurred":(ps(t),"Unknown error")}var Dn=new Ui("error","errors"),Lu=class extends Ft{constructor(e){super();$(this,"title","Errors");$(this,"mentionPrefix","@");$(this,"contextType","error");this.store=e}getItems(){let e=this.store.get(Zi);return e.length===0?[]:[{uri:this.asURI("all"),name:"Errors",type:this.contextType,data:{type:"all-errors",errors:e.map(a=>({cellId:a.cellId,cellName:a.cellName,errorData:a.output.data}))},description:"All errors in the notebook"}]}formatCompletion(e){return e.data.type==="all-errors"?{label:"@Errors",displayLabel:"Errors",detail:`${e.data.errors.length} ${Dn.pluralize(e.data.errors.length)}`,type:"error",apply:"@Errors",section:Tt.ERROR,info:()=>{let a=document.createElement("div");a.classList.add("mo-cm-tooltip","docs-documentation","min-w-[200px]","flex","flex-col","gap-1","p-2");let r=document.createElement("div");r.classList.add("flex","flex-col","gap-1");let s=document.createElement("div");s.classList.add("font-bold","text-base"),s.textContent="Errors",r.append(s);let n=document.createElement("div");return n.classList.add("text-sm","text-muted-foreground"),n.textContent=`${e.data.errors.length} ${Dn.pluralize(e.data.errors.length)}`,r.append(n),a.append(r),a}}:{label:"Error",displayLabel:"Error",section:Tt.ERROR}}formatContext(e){let{data:a}=e;return a.errors.map(r=>Zt({type:this.contextType,data:{name:r.cellName||`Cell ${r.cellId}`,description:r.errorData.map(s=>$u(s)).join(`
|
|
21
21
|
`)}})).join(`
|
|
22
22
|
|
|
23
|
-
`)}};const Zn=Oi();var Du={maxDepth:3,maxResults:20,defaultResultsLimit:5,includeDirectories:!1},Zu=class extends Ft{constructor(e,a=Du){super();$(this,"title","Files");$(this,"mentionPrefix","#");$(this,"contextType","file");$(this,"searchFiles",async(e,a={})=>{let{maxDepth:r,maxResults:s,includeDirectories:n}={...this.config,...a};return(await this.apiRequests.sendSearchFiles({query:e,includeFiles:!0,includeDirectories:n,depth:r,limit:s})).files});this.apiRequests=e,this.config=a}createCompletionSource(){return async e=>{let a=e.matchBefore(/#[^\s#]*/);if(!a)return null;let r=a.text;if(!r.startsWith("#"))return null;let s=r.slice(1);if(s.length===0)return this.getDefaultCompletions(a);try{let n=(await this.searchFiles(s)||[]).map(o=>{let i={uri:this.asURI(o.path),name:o.name,type:this.contextType,description:o.isDirectory?"Directory":"File",data:{path:o.path,isDirectory:o.isDirectory}};return this.formatCompletion(i)});return{from:a.from,options:n}}catch(n){return se.error("Failed to search files:",n),null}}}async getDefaultCompletions(e){try{for(let a of["py","md","csv"])try{let r=await this.searchFiles(a,{maxDepth:1,maxResults:5});if(r&&r.length>0){let s=r.map(n=>{let o={uri:this.asURI(n.path),name:n.name,type:this.contextType,description:n.isDirectory?"Directory":"File",data:{path:n.path,isDirectory:n.isDirectory}};return this.formatCompletion(o)});return{from:e.from,options:s}}}catch(r){se.error("Failed to get default file completions:",r)}return{from:e.from,options:[]}}catch(a){return se.error("Failed to get default file completions:",a),null}}getItems(){return[]}formatCompletion(e){let{data:a,name:r}=e,s=a.isDirectory?"\u{1F4C1}":"\u{1F4C4}";return{...this.createBasicCompletion(e),type:"file",section:Tt.FILE,boost:a.isDirectory?St.MEDIUM:St.LOW,detail:a.path,displayLabel:`${s} ${r}`,apply:async(n,o,i,l)=>{var f;let d=(f=n.state.facet(Zn))==null?void 0:f.addAttachment;if(!d){se.warn("No addAttachment callback provided");return}let u=await this.apiRequests.sendFileDetails({path:a.path}).catch(_=>(Ka({title:"Failed to get file details",description:_.message}),null));if(!u)return;let p=u.mimeType||"text/plain",m;if(p.startsWith("text/")||p.includes("json")||p.includes("xml"))m=new Blob([u.contents||""],{type:p});else if(u.contents)try{m=
|
|
23
|
+
`)}};const Zn=Oi();var Du={maxDepth:3,maxResults:20,defaultResultsLimit:5,includeDirectories:!1},Zu=class extends Ft{constructor(e,a=Du){super();$(this,"title","Files");$(this,"mentionPrefix","#");$(this,"contextType","file");$(this,"searchFiles",async(e,a={})=>{let{maxDepth:r,maxResults:s,includeDirectories:n}={...this.config,...a};return(await this.apiRequests.sendSearchFiles({query:e,includeFiles:!0,includeDirectories:n,depth:r,limit:s})).files});this.apiRequests=e,this.config=a}createCompletionSource(){return async e=>{let a=e.matchBefore(/#[^\s#]*/);if(!a)return null;let r=a.text;if(!r.startsWith("#"))return null;let s=r.slice(1);if(s.length===0)return this.getDefaultCompletions(a);try{let n=(await this.searchFiles(s)||[]).map(o=>{let i={uri:this.asURI(o.path),name:o.name,type:this.contextType,description:o.isDirectory?"Directory":"File",data:{path:o.path,isDirectory:o.isDirectory}};return this.formatCompletion(i)});return{from:a.from,options:n}}catch(n){return se.error("Failed to search files:",n),null}}}async getDefaultCompletions(e){try{for(let a of["py","md","csv"])try{let r=await this.searchFiles(a,{maxDepth:1,maxResults:5});if(r&&r.length>0){let s=r.map(n=>{let o={uri:this.asURI(n.path),name:n.name,type:this.contextType,description:n.isDirectory?"Directory":"File",data:{path:n.path,isDirectory:n.isDirectory}};return this.formatCompletion(o)});return{from:e.from,options:s}}}catch(r){se.error("Failed to get default file completions:",r)}return{from:e.from,options:[]}}catch(a){return se.error("Failed to get default file completions:",a),null}}getItems(){return[]}formatCompletion(e){let{data:a,name:r}=e,s=a.isDirectory?"\u{1F4C1}":"\u{1F4C4}";return{...this.createBasicCompletion(e),type:"file",section:Tt.FILE,boost:a.isDirectory?St.MEDIUM:St.LOW,detail:a.path,displayLabel:`${s} ${r}`,apply:async(n,o,i,l)=>{var f;let d=(f=n.state.facet(Zn))==null?void 0:f.addAttachment;if(!d){se.warn("No addAttachment callback provided");return}let u=await this.apiRequests.sendFileDetails({path:a.path}).catch(_=>(Ka({title:"Failed to get file details",description:_.message}),null));if(!u)return;let p=u.mimeType||"text/plain",m;if(p.startsWith("text/")||p.includes("json")||p.includes("xml"))m=new Blob([u.contents||""],{type:p});else if(u.contents)try{m=jo(xo(u.contents,p))}catch{m=new Blob([u.contents],{type:p})}else m=new Blob([""],{type:p});d(new File([m],r,{type:p})),n.dispatch({changes:{from:i,to:l,insert:""}}),ho(n)},info:()=>{let n=document.createElement("div");n.classList.add("flex","flex-col","gap-1","p-2");let o=document.createElement("div");o.classList.add("font-bold"),o.textContent=r,n.append(o);let i=document.createElement("div");return i.classList.add("text-xs","text-muted-foreground"),i.textContent=a.path,n.append(i),n}}}formatContext(e){let{data:a,name:r}=e;return Zt({type:this.contextType,data:{name:r,path:a.path,isDirectory:a.isDirectory},details:a.isDirectory?"Directory containing files and subdirectories":"File"})}},Fu=class extends Ft{constructor(e){super();$(this,"title","Tables");$(this,"mentionPrefix","@");$(this,"contextType","data");this.tablesMap=e}getItems(){return[...this.tablesMap.entries()].map(([e,a])=>({uri:this.asURI(e),name:e,type:this.contextType,description:a.source==="memory"?"in-memory":a.source,data:a}))}formatContext(e){let{data:a}=e,{columns:r,source:s,num_rows:n,num_columns:o,name:i,variable_name:l}=a,d=[n==null?void 0:`${n} rows`,o==null?void 0:`${o} columns`].filter(Boolean).join(", "),u="";if(d&&(u+=`Shape: ${d}
|
|
24
24
|
`),l&&(u+=`Variable: ${l}
|
|
25
25
|
`),r&&r.length>0){u+=`Columns:
|
|
26
26
|
`;for(let p of r){let m=` ${p.name} (${p.type})`;if(p.sample_values&&p.sample_values.length>0){let f=p.sample_values.slice(0,3).map(_=>_===null?"null":String(_)).join(", ");m+=` - samples: [${f}]`}u+=`${m}
|
|
@@ -49,7 +49,7 @@ Image URL: ${a.imageUrl}`)),Zt({type:this.contextType,data:o,details:i})}async g
|
|
|
49
49
|
- SQL cells: use mo.sql(f"""{content}""") function to insert content. If a database engine is specified, use mo.sql(f"""{content}""", engine=engine) instead.
|
|
50
50
|
|
|
51
51
|
Returns:
|
|
52
|
-
- A result object containing standard tool metadata.`},Xu=z({edit:z({type:ua(["update_cell","add_cell","delete_cell"]),code:v().optional(),position:z({type:ua(["relative","column_end","notebook_end"]).optional(),cellId:v().optional(),columnIndex:is().optional(),before:ue().optional()})})}),ec=class{constructor(){$(this,"name","edit_notebook_tool");$(this,"description",Qu);$(this,"schema",Xu);$(this,"outputSchema",Pn);$(this,"mode",["agent"]);$(this,"handler",async({edit:t},e)=>{let{addStagedCell:a,createNewCell:r,store:s}=e;switch(t.type){case"update_cell":{let{position:n,code:o}=t,i=n.cellId;if(i){if(!o)throw new we("Code is required for update_cell","CODE_REQUIRED_FOR_UPDATE_CELL",!0,"Provide the new code to update the cell")}else throw new we("Cell ID is required for update_cell","CELL_ID_REQUIRED_FOR_UPDATE_CELL",!0,"Provide a cell ID to update");let l=s.get(Qe);this.validateCellIdExists(i,l);let d=this.getCellEditorView(i,l);Ya(i);let u=s.get(Qt).get(i);if((u==null?void 0:u.type)==="add_cell"){Va(d,o);break}let p=d.state.doc.toString(),m=(u==null?void 0:u.previousCode)??p;if(o===m)break;a({cellId:i,edit:{type:"update_cell",previousCode:m}}),Va(d,o);break}case"add_cell":{let{position:n,code:o}=t,i="__end__",l=!1,d=rs.create(),u=s.get(Qe);switch(n.type){case"relative":{let p=n.cellId;if(!p)throw new we("Cell ID is required for add_cell with relative position","TOOL_ERROR",!0,"Provide a cell ID to add the cell before");if(n.before===void 0)throw new we("Before is required for add_cell with relative position","TOOL_ERROR",!0,`Provide a boolean value for before, true to add before cell ${p}, false to add after the cell`);this.validateCellIdExists(p,u),i=p,l=n.before;break}case"column_end":if(!n.columnIndex)throw new we("Column index is required for add_cell with column_end position","TOOL_ERROR",!0,"Provide a column index to add the cell at the end of");i={type:"__end__",columnId:this.getColumnId(n.columnIndex,u)};break;case"notebook_end":break}r({cellId:i,before:l,code:o,newCellId:d}),a({cellId:d,edit:{type:"add_cell"}}),Ya(d);break}case"delete_cell":{let{position:n}=t,o=n.cellId;if(!o)throw new we("Cell ID is required for delete_cell","CELL_ID_REQUIRED_FOR_DELETE_CELL",!0,"Provide a cell ID to delete");let i=s.get(Qe);this.validateCellIdExists(o,i),a({cellId:o,edit:{type:"delete_cell",previousCode:this.getCellEditorView(o,i).state.doc.toString()}}),Ya(o);break}}return{status:"success",next_steps:["If you need to perform more edits, call this tool again.","You should use the lint notebook tool to check for errors and lint issues. Fix them by editing the notebook.","You should use the run stale cells tool to run the cells that have been edited or newly added. This allows you to see the output of the cells and fix any errors."]}})}validateCellIdExists(t,e){if(!e.cellIds.getColumns().some(a=>a.idSet.has(t)))throw new we("Cell not found","CELL_NOT_FOUND",!1,"Check which cells exist in the notebook")}getColumnId(t,e){let a=e.cellIds.getColumns();if(t<0||t>=a.length)throw new we("Column index is out of range","COLUMN_INDEX_OUT_OF_RANGE",!0,"Choose a column index between 0 and the number of columns in the notebook (0-based)");return a[t].id}getCellEditorView(t,e){let a=e.cellHandles[t].current;if(!(a!=null&&a.editorView))throw new we("Cell editor not found","CELL_EDITOR_NOT_FOUND",!1,"Internal error, ask the user to report this error");return a.editorView}},tc=200,ac=3e4,Vn=2e3,rc=3e3,sc=4e4,nc={baseDescription:"Run cells in the current notebook that are stale. Stale cells are cells that have been edited or newly added. You can run this tool after editing the notebook or when requested. The output of the ran cells will be returned alongside metadata."},Wn=z({type:O("file"),url:v(),mediaType:v()}),ic=class{constructor(t){$(this,"name","run_stale_cells_tool");$(this,"description",nc);$(this,"schema",z({}));$(this,"outputSchema",Pn.extend({cellsToOutput:ut(v(),z({consoleOutput:v().optional(),cellOutput:v().optional(),consoleAttachments:Ue(Wn).optional(),cellAttachments:Ue(Wn).optional()}).nullable()).optional()}));$(this,"mode",["agent"]);$(this,"handler",async(t,e)=>{let{prepareForRun:a,sendRun:r,store:s}=e,n=s.get(Qe),o=Mi(n);if(o.length===0)return{status:"success",message:"No stale cells found."};if(await
|
|
52
|
+
- A result object containing standard tool metadata.`},Xu=z({edit:z({type:ua(["update_cell","add_cell","delete_cell"]),code:v().optional(),position:z({type:ua(["relative","column_end","notebook_end"]).optional(),cellId:v().optional(),columnIndex:is().optional(),before:ue().optional()})})}),ec=class{constructor(){$(this,"name","edit_notebook_tool");$(this,"description",Qu);$(this,"schema",Xu);$(this,"outputSchema",Pn);$(this,"mode",["agent"]);$(this,"handler",async({edit:t},e)=>{let{addStagedCell:a,createNewCell:r,store:s}=e;switch(t.type){case"update_cell":{let{position:n,code:o}=t,i=n.cellId;if(i){if(!o)throw new we("Code is required for update_cell","CODE_REQUIRED_FOR_UPDATE_CELL",!0,"Provide the new code to update the cell")}else throw new we("Cell ID is required for update_cell","CELL_ID_REQUIRED_FOR_UPDATE_CELL",!0,"Provide a cell ID to update");let l=s.get(Qe);this.validateCellIdExists(i,l);let d=this.getCellEditorView(i,l);Ya(i);let u=s.get(Qt).get(i);if((u==null?void 0:u.type)==="add_cell"){Va(d,o);break}let p=d.state.doc.toString(),m=(u==null?void 0:u.previousCode)??p;if(o===m)break;a({cellId:i,edit:{type:"update_cell",previousCode:m}}),Va(d,o);break}case"add_cell":{let{position:n,code:o}=t,i="__end__",l=!1,d=rs.create(),u=s.get(Qe);switch(n.type){case"relative":{let p=n.cellId;if(!p)throw new we("Cell ID is required for add_cell with relative position","TOOL_ERROR",!0,"Provide a cell ID to add the cell before");if(n.before===void 0)throw new we("Before is required for add_cell with relative position","TOOL_ERROR",!0,`Provide a boolean value for before, true to add before cell ${p}, false to add after the cell`);this.validateCellIdExists(p,u),i=p,l=n.before;break}case"column_end":if(!n.columnIndex)throw new we("Column index is required for add_cell with column_end position","TOOL_ERROR",!0,"Provide a column index to add the cell at the end of");i={type:"__end__",columnId:this.getColumnId(n.columnIndex,u)};break;case"notebook_end":break}r({cellId:i,before:l,code:o,newCellId:d}),a({cellId:d,edit:{type:"add_cell"}}),Ya(d);break}case"delete_cell":{let{position:n}=t,o=n.cellId;if(!o)throw new we("Cell ID is required for delete_cell","CELL_ID_REQUIRED_FOR_DELETE_CELL",!0,"Provide a cell ID to delete");let i=s.get(Qe);this.validateCellIdExists(o,i),a({cellId:o,edit:{type:"delete_cell",previousCode:this.getCellEditorView(o,i).state.doc.toString()}}),Ya(o);break}}return{status:"success",next_steps:["If you need to perform more edits, call this tool again.","You should use the lint notebook tool to check for errors and lint issues. Fix them by editing the notebook.","You should use the run stale cells tool to run the cells that have been edited or newly added. This allows you to see the output of the cells and fix any errors."]}})}validateCellIdExists(t,e){if(!e.cellIds.getColumns().some(a=>a.idSet.has(t)))throw new we("Cell not found","CELL_NOT_FOUND",!1,"Check which cells exist in the notebook")}getColumnId(t,e){let a=e.cellIds.getColumns();if(t<0||t>=a.length)throw new we("Column index is out of range","COLUMN_INDEX_OUT_OF_RANGE",!0,"Choose a column index between 0 and the number of columns in the notebook (0-based)");return a[t].id}getCellEditorView(t,e){let a=e.cellHandles[t].current;if(!(a!=null&&a.editorView))throw new we("Cell editor not found","CELL_EDITOR_NOT_FOUND",!1,"Internal error, ask the user to report this error");return a.editorView}},tc=200,ac=3e4,Vn=2e3,rc=3e3,sc=4e4,nc={baseDescription:"Run cells in the current notebook that are stale. Stale cells are cells that have been edited or newly added. You can run this tool after editing the notebook or when requested. The output of the ran cells will be returned alongside metadata."},Wn=z({type:O("file"),url:v(),mediaType:v()}),ic=class{constructor(t){$(this,"name","run_stale_cells_tool");$(this,"description",nc);$(this,"schema",z({}));$(this,"outputSchema",Pn.extend({cellsToOutput:ut(v(),z({consoleOutput:v().optional(),cellOutput:v().optional(),consoleAttachments:Ue(Wn).optional(),cellAttachments:Ue(Wn).optional()}).nullable()).optional()}));$(this,"mode",["agent"]);$(this,"handler",async(t,e)=>{let{prepareForRun:a,sendRun:r,store:s}=e,n=s.get(Qe),o=Mi(n);if(o.length===0)return{status:"success",message:"No stale cells found."};if(await Ro({cellIds:o,sendRun:r,prepareForRun:a,notebook:n}),!await this.waitForCellsToFinish(s,o,ac,this.postExecutionDelay))return{status:"success",message:"No output was returned because some cells have not finished executing"};let i=s.get(Qe),l=new Map,d=!1,u=!1,p=0;for(let f of o){let _=Ln(f,i,{includeConsoleOutput:!0}),c=_.cellOutput,g=_.consoleOutputs,h=g&&g.length>0;if((c&&this.outputHasErrors(c)||h&&g.some(I=>this.outputHasErrors(I)))&&(d=!0),!c&&!h){l.set(f,null);continue}if(p>=sc){l.set(f,{cellOutput:"Cell executed (output omitted due to context limits)."});continue}let x,w;c&&(x=this.formatOutputString(c),p+=x.length),h&&(u=!0,w=g.map(I=>this.formatOutputString(I)).join(`
|
|
53
53
|
`),w=this.truncateString(w,Vn),p+=w.length),l.set(f,{cellOutput:x,consoleOutput:w})}if(l.size===0)return{status:"success",message:"Stale cells have been run. No output was returned."};let m=["Review the output of the cells. The CellId is the key of the result object.",d?"There are errors in the cells. Please fix them by using the edit notebook tool and the given CellIds.":"You may edit the notebook further with the given CellIds."];return{status:"success",cellsToOutput:Object.fromEntries(l),message:u?"Console output represents the stdout or stderr of the cell (eg. print statements).":void 0,next_steps:m}});this.postExecutionDelay=(t==null?void 0:t.postExecutionDelay)??tc}outputHasErrors(t){return t.output.mimetype==="application/vnd.marimo+error"||t.output.mimetype==="application/vnd.marimo+traceback"}formatOutputString(t){let{outputType:e,processedContent:a,imageUrl:r,output:s}=t;if(e==="media"){let i=`Media Output: Contains ${s.mimetype} content`;return r?`${i}
|
|
54
54
|
Image URL: ${r}`:i}if(s.mimetype==="text/html")return`HTML Output: text/html content (${(typeof s.data=="string"?s.data.length:JSON.stringify(s.data).length).toLocaleString()} chars). Full output visible in notebook UI.`;let n=this.outputHasErrors(t)?rc:Vn,o=a;return o||(o=typeof s.data=="string"?s.data:JSON.stringify(s.data)),`Output:
|
|
55
55
|
${this.truncateString(o,n)}`}truncateString(t,e){return t.length<=e?t:`${t.slice(0,e)}
|
|
@@ -89,4 +89,4 @@ ${this.truncateString(o,n)}`}truncateString(t,e){return t.length<=e?t:`${t.slice
|
|
|
89
89
|
dark:bg-(--red-4)/80 dark:hover:bg-(--red-3) rounded px-3 font-semibold
|
|
90
90
|
active:bg-(--red-5) dark:active:bg-(--red-4)
|
|
91
91
|
border-(--red-6) border hover:shadow-xs ${(i===void 0?!1:i)&&"border-none rounded-md"} ${n}`,p=l&&" all",m;e[0]===o?m=e[1]:(m=o&&(0,E.jsx)(Ha,{className:"ml-1 inline",shortcut:o}),e[0]=o,e[1]=m);let f;return e[2]!==a||e[3]!==d||e[4]!==u||e[5]!==p||e[6]!==m?(f=(0,E.jsxs)(Xe,{variant:"text",size:d,onClick:a,className:u,children:["Reject",p,m]}),e[2]=a,e[3]=d,e[4]=u,e[5]=p,e[6]=m,e[7]=f):f=e[7],f};var Zc=class extends br{constructor(t,e){super(t),this.onChunkReceived=e}processResponseStream(t){let e=this.onChunkReceived;return super.processResponseStream(t).pipeThrough(new TransformStream({async transform(a,r){e(a),r.enqueue(a)}}))}},li=Dt(),Fc=Di("marimo:ai-language","python",Ai),di="marimo:ai-prompt-history",ui=new Fi(Ue(v()),()=>[]);const zc=t=>{var Yr;let e=(0,li.c)(98),{onClose:a}=t,r=Hr(),[s,n]=(0,A.useState)(""),{deleteAllStagedCells:o,clearStagedCells:i,onStream:l,addStagedCell:d}=qn(r),[u,p]=Ci(Fc),m=Qi(),{invokeAiTool:f,sendRun:_}=go(),c=Xr(Qt),g=(0,A.useRef)(null),h=(0,A.useRef)(null),{files:x,addFiles:w,removeFile:I}=Gn(),S=Xr(Gi),{createNewCell:P,prepareForRun:Z}=ts(),j;e[0]!==d||e[1]!==P||e[2]!==Z||e[3]!==_||e[4]!==r?(j={store:r,addStagedCell:d,createNewCell:P,prepareForRun:Z,sendRun:_},e[0]=d,e[1]=P,e[2]=Z,e[3]=_,e[4]=r,e[5]=j):j=e[5];let G=j,M;if(e[6]!==u||e[7]!==l||e[8]!==m){let de;e[10]===m?de=e[11]:(de=()=>m.headers(),e[10]=m,e[11]=de);let Ne;e[12]!==u||e[13]!==m?(Ne=async da=>{let bi=await Yn(da.messages),_i={...da,...bi,code:"",prompt:"",language:u};return{api:m.getAiURL("completion").toString(),body:_i}},e[12]=u,e[13]=m,e[14]=Ne):Ne=e[14];let la;e[15]===l?la=e[16]:(la=da=>{l(da)},e[15]=l,e[16]=la),M=new Zc({api:m.getAiURL("completion").toString(),headers:de,prepareSendMessagesRequest:Ne},la),e[6]=u,e[7]=l,e[8]=m,e[9]=M}else M=e[9];let{sendMessage:K,stop:ee,status:ae,addToolOutput:re}=Nn({experimental_throttle:100,transport:M,onToolCall:async de=>{let{toolCall:Ne}=de;await Hn({invokeAiTool:f,addToolOutput:X,toolCall:{toolName:Ne.toolName,toolCallId:Ne.toolCallId,input:Ne.input},toolContext:G})},onError:Uc}),X=re,F=ae==="streaming"||ae==="submitted",oe=c.size>0,te=((Yr=S==null?void 0:S.models)==null?void 0:Yr.edit_model)||"openai/gpt-4o",Le;if(e[17]!==te){let de=Yi.parse(te).providerId;Le=Jn.has(de),e[17]=te,e[18]=Le}else Le=e[18];let Ae=Le,ke;e[19]!==o||e[20]!==x||e[21]!==s||e[22]!==F||e[23]!==K?(ke=async()=>{var de;F||((de=g.current)!=null&&de.view&&Mn(g.current.view),o(),K({text:s,files:x?await Kn(x):void 0}))},e[19]=o,e[20]=x,e[21]=s,e[22]=F,e[23]=K,e[24]=ke):ke=e[24];let he=ke,De;e[25]===Symbol.for("react.memo_cache_sentinel")?(De=(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)($o,{className:"size-4 mr-2"}),"Python"]}),e[25]=De):De=e[25];let vt=De,Ze;e[26]===Symbol.for("react.memo_cache_sentinel")?(Ze=(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(qi,{className:"size-4 mr-2"}),"SQL"]}),e[26]=Ze):Ze=e[26];let Lt=Ze,bt=u==="python"?vt:Lt,_t;e[27]===Symbol.for("react.memo_cache_sentinel")?(_t=(0,E.jsx)(_o,{className:"ml-1 h-3.5 w-3.5 text-muted-foreground/70"}),e[27]=_t):_t=e[27];let Ke;e[28]===bt?Ke=e[29]:(Ke=(0,E.jsxs)(ao,{className:"flex items-center justify-between h-7 text-xs px-2 py-0.5 border rounded-md hover:text-accent-foreground","data-testid":"language-button",children:[bt,_t]}),e[28]=bt,e[29]=Ke);let Re,ot;e[30]===Symbol.for("react.memo_cache_sentinel")?(Re=(0,E.jsx)("div",{className:"px-2 py-1 text-sm text-muted-foreground",children:"Select language"}),ot=(0,E.jsx)(to,{}),e[30]=Re,e[31]=ot):(Re=e[30],ot=e[31]);let V;e[32]===p?V=e[33]:(V=(0,E.jsx)(ls,{onClick:()=>p("python"),children:vt}),e[32]=p,e[33]=V);let W;e[34]===p?W=e[35]:(W=(0,E.jsx)(ls,{onClick:()=>p("sql"),children:Lt}),e[34]=p,e[35]=W);let Q;e[36]!==V||e[37]!==W?(Q=(0,E.jsxs)(ro,{align:"center",children:[Re,ot,V,W]}),e[36]=V,e[37]=W,e[38]=Q):Q=e[38];let B;e[39]!==Ke||e[40]!==Q?(B=(0,E.jsxs)(so,{modal:!1,children:[Ke,Q]}),e[39]=Ke,e[40]=Q,e[41]=B):B=e[41];let Ce=B,be;e[42]!==i||e[43]!==a?(be=()=>{i(),a()},e[42]=i,e[43]=a,e[44]=be):be=e[44];let le=be,ne;e[45]===o?ne=e[46]:(ne=()=>{o()},e[45]=o,e[46]=ne);let _e=ne,lt;e[47]===Symbol.for("react.memo_cache_sentinel")?(lt=(0,E.jsx)(Io,{className:"size-4 text-(--blue-11) mr-2"}),e[47]=lt):lt=e[47];let Fe;e[48]!==o||e[49]!==a?(Fe=()=>{o(),a()},e[48]=o,e[49]=a,e[50]=Fe):Fe=e[50];let dt;e[51]===Symbol.for("react.memo_cache_sentinel")?(dt=de=>{n(de)},e[51]=dt):dt=e[51];let ie;e[52]!==le||e[53]!==_e||e[54]!==oe||e[55]!==F?(ie=ni({handleAcceptCompletion:le,handleDeclineCompletion:_e,isLoading:F,hasCompletion:oe}),e[52]=le,e[53]=_e,e[54]=oe,e[55]=F,e[56]=ie):ie=e[56];let ce;e[57]!==s||e[58]!==he||e[59]!==Fe||e[60]!==ie?(ce=(0,E.jsx)(ci,{inputRef:g,onClose:Fe,value:s,onChange:dt,onSubmit:he,onKeyDown:ie}),e[57]=s,e[58]=he,e[59]=Fe,e[60]=ie,e[61]=ce):ce=e[61];let Ye;e[62]===Symbol.for("react.memo_cache_sentinel")?(Ye=(0,E.jsx)(ms,{className:"size-4"}),e[62]=Ye):Ye=e[62];let He;e[63]===a?He=e[64]:(He=(0,E.jsx)(Xe,{variant:"text",size:"sm",className:"mb-0 px-1",onClick:a,children:Ye}),e[63]=a,e[64]=He);let Ge;e[65]!==ce||e[66]!==He?(Ge=(0,E.jsxs)("div",{className:"flex items-center px-3",children:[lt,ce,He]}),e[65]=ce,e[66]=He,e[67]=Ge):Ge=e[67];let Fa=Ge,ra;e[68]===Symbol.for("react.memo_cache_sentinel")?(ra=(0,E.jsx)(Ki,{triggerClassName:"h-7 text-xs max-w-64",iconSize:"small",forRole:"edit",showAddCustomModelDocs:!0}),e[68]=ra):ra=e[68];let xt;e[69]===Ce?xt=e[70]:(xt=(0,E.jsxs)("div",{className:"flex items-center gap-2",children:[ra,Ce]}),e[69]=Ce,e[70]=xt);let wt;e[71]!==x||e[72]!==I?(wt=x.length>0&&(0,E.jsx)("div",{className:"flex flex-row gap-1 flex-wrap pr-1",children:x==null?void 0:x.map((de,Ne)=>(0,E.jsx)(Qn,{file:de,onRemove:()=>I(de)},`${de.name}-${Ne}`))}),e[71]=x,e[72]=I,e[73]=wt):wt=e[73];let sa;e[74]===Symbol.for("react.memo_cache_sentinel")?(sa=()=>Fn(g),e[74]=sa):sa=e[74];let kt;e[75]===F?kt=e[76]:(kt=(0,E.jsx)(ei,{handleAddContext:sa,isLoading:F}),e[75]=F,e[76]=kt);let Ct;e[77]!==w||e[78]!==Ae||e[79]!==F?(Ct=Ae&&(0,E.jsx)(ti,{fileInputRef:h,isLoading:F,onAddFiles:w}),e[77]=w,e[78]=Ae,e[79]=F,e[80]=Ct):Ct=e[80];let za=!s.trim(),Et;e[81]!==F||e[82]!==ee||e[83]!==he||e[84]!==za?(Et=(0,E.jsx)(Xn,{isLoading:F,onStop:ee,onSendClick:he,isEmpty:za,showStopLabel:!0}),e[81]=F,e[82]=ee,e[83]=he,e[84]=za,e[85]=Et):Et=e[85];let It;e[86]!==wt||e[87]!==kt||e[88]!==Ct||e[89]!==Et?(It=(0,E.jsxs)("div",{className:"flex flex-row items-center",children:[wt,kt,Ct,Et]}),e[86]=wt,e[87]=kt,e[88]=Ct,e[89]=Et,e[90]=It):It=e[90];let na;e[91]!==xt||e[92]!==It?(na=(0,E.jsxs)("div",{className:"px-3 pt-1 flex flex-row items-center justify-between",children:[xt,It]}),e[91]=xt,e[92]=It,e[93]=na):na=e[93];let Ua=na,ia;e[94]===Symbol.for("react.memo_cache_sentinel")?(ia=Wa("flex flex-col w-full py-2"),e[94]=ia):ia=e[94];let oa;return e[95]!==Ua||e[96]!==Fa?(oa=(0,E.jsxs)("div",{className:ia,children:[Fa,Ua]}),e[95]=Ua,e[96]=Fa,e[97]=oa):oa=e[97],oa},ci=t=>{let e=(0,li.c)(35),{value:a,placeholder:r,inputRef:s,className:n,onChange:o,onSubmit:i,onKeyDown:l,onClose:d,onAddFiles:u,additionalCompletions:p,maxHeight:m}=t,f=i,_=d,c=Hr(),{theme:g}=Ao(),h;e[0]===p?h=e[1]:(h=oe=>p?Ju([p.triggerCompletionRegex],p.completions)(oe):null,e[0]=p,e[1]=h);let x=Qr(h),w,I,S,P;if(e[2]!==x||e[3]!==u||e[4]!==c){let oe=Oo();e[9]===Symbol.for("react.memo_cache_sentinel")?(w=fo({}),e[9]=w):w=e[9],I=oe,S=Lc({language:oe.language,store:c,onAddFiles:u}),P=oe.language.data.of({autocomplete:x}),e[2]=x,e[3]=u,e[4]=c,e[5]=w,e[6]=I,e[7]=S,e[8]=P}else w=e[5],I=e[6],S=e[7],P=e[8];let Z;e[10]===Symbol.for("react.memo_cache_sentinel")?(Z=Nu({storage:{load:qc,save:Vc}}),e[10]=Z):Z=e[10];let j;e[11]===Symbol.for("react.memo_cache_sentinel")?(j=Lo(),e[11]=j):j=e[11];let G;e[12]===f?G=e[13]:(G=ds.highest(ha.of([{preventDefault:!0,stopPropagation:!0,any:(oe,te)=>{let Le=te.metaKey||te.ctrlKey||te.shiftKey;if(te.key==="Enter"&&!Le)return f(te,oe.state.doc.toString()),te.preventDefault(),te.stopPropagation(),!0;if(te.key==="Enter"&&te.shiftKey){let Ae=oe.state.selection.main.from;return oe.dispatch({changes:{from:Ae,to:Ae,insert:`
|
|
92
|
-
`},selection:{anchor:Ae+1,head:Ae+1}}),te.preventDefault(),te.stopPropagation(),!0}return!1}}])),e[12]=f,e[13]=G);let M;e[14]===_?M=e[15]:(M=ha.of([{key:"Escape",preventDefault:!0,stopPropagation:!0,run:()=>(_(),!0)}]),e[14]=_,e[15]=M);let K;e[16]!==w||e[17]!==I||e[18]!==S||e[19]!==P||e[20]!==G||e[21]!==M?(K=[w,I,S,P,Z,us.lineWrapping,j,G,M],e[16]=w,e[17]=I,e[18]=S,e[19]=P,e[20]=G,e[21]=M,e[22]=K):K=e[22];let ee=K,ae;e[23]===n?ae=e[24]:(ae=Wa("flex-1 font-sans overflow-auto my-1",n),e[23]=n,e[24]=ae);let re=g==="dark"?"dark":"light",X=r||"Generate with AI, @ to include context",F;return e[25]!==ee||e[26]!==s||e[27]!==m||e[28]!==o||e[29]!==l||e[30]!==ae||e[31]!==re||e[32]!==X||e[33]!==a?(F=(0,E.jsx)(Do,{ref:s,className:ae,width:"100%",maxHeight:m,value:a,basicSetup:!1,extensions:ee,onChange:o,onKeyDown:l,theme:re,placeholder:X}),e[25]=ee,e[26]=s,e[27]=m,e[28]=o,e[29]=l,e[30]=ae,e[31]=re,e[32]=X,e[33]=a,e[34]=F):F=e[34],F};function Uc(t){Ka({title:"Generate with AI failed",description:
|
|
92
|
+
`},selection:{anchor:Ae+1,head:Ae+1}}),te.preventDefault(),te.stopPropagation(),!0}return!1}}])),e[12]=f,e[13]=G);let M;e[14]===_?M=e[15]:(M=ha.of([{key:"Escape",preventDefault:!0,stopPropagation:!0,run:()=>(_(),!0)}]),e[14]=_,e[15]=M);let K;e[16]!==w||e[17]!==I||e[18]!==S||e[19]!==P||e[20]!==G||e[21]!==M?(K=[w,I,S,P,Z,us.lineWrapping,j,G,M],e[16]=w,e[17]=I,e[18]=S,e[19]=P,e[20]=G,e[21]=M,e[22]=K):K=e[22];let ee=K,ae;e[23]===n?ae=e[24]:(ae=Wa("flex-1 font-sans overflow-auto my-1",n),e[23]=n,e[24]=ae);let re=g==="dark"?"dark":"light",X=r||"Generate with AI, @ to include context",F;return e[25]!==ee||e[26]!==s||e[27]!==m||e[28]!==o||e[29]!==l||e[30]!==ae||e[31]!==re||e[32]!==X||e[33]!==a?(F=(0,E.jsx)(Do,{ref:s,className:ae,width:"100%",maxHeight:m,value:a,basicSetup:!1,extensions:ee,onChange:o,onKeyDown:l,theme:re,placeholder:X}),e[25]=ee,e[26]=s,e[27]=m,e[28]=o,e[29]=l,e[30]=ae,e[31]=re,e[32]=X,e[33]=a,e[34]=F):F=e[34],F};function Uc(t){Ka({title:"Generate with AI failed",description:No(t)})}function qc(){return ui.get(di)}function Vc(t){return ui.set(di,t)}export{Tu as A,qn as C,yt as D,Vu as E,gs as F,zd as M,vs as N,Mn as O,ys as P,Un as S,Fn as T,fc as _,oi as a,Fr as b,ti as c,Xn as d,Jn as f,Hn as g,pc as h,Dc as i,br as j,Nn as k,yc as l,Kn as m,ci as n,ni as o,Yn as p,ii as r,ei as s,zc as t,Qn as u,mc as v,qu as w,Qt as x,Gn as y};
|
|
@@ -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{Dt as ce,E as Qe,Un as g}from"./cells-CuaAKcwV.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-DGjKht0c.js";import{t as G}from"./cn-DYvqRARy.js";import{t as et}from"./jsx-runtime-Blw4afVn.js";import{a as tt,c as ie,o as le,s as st}from"./popover-AtoFZ7i4.js";import{c as rt,i as nt,n as ot,r as ct,s as at,t as it}from"./select--zcABebs.js";import{a as J,c as de,o as lt,p as dt,r as pt,t as ht}from"./dropdown-menu-DrHAuMTb.js";import{m as mt,o as ut,t as bt,u as a}from"./form-IHIhviLb.js";import{t as Y}from"./button-BKVLeSTX.js";import{l as ft}from"./arrays-DAC2orgH.js";import{r as U}from"./strings-pfr2N700.js";import{t as gt}from"./createLucideIcon-w-Qo9n0R.js";import{t as yt}from"./circle-plus-ifSmVHqa.js";import{t as _t}from"./database-zap-BxfYZ6ML.js";import{t as St}from"./github-C3N4cuN4.js";import{n as wt}from"./DeferredRequestRegistry-BLWK1eKa.js";import{o as xt,r as kt}from"./input-DfDSaPYh.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-CI3yaazO.js";import{r as It}from"./useTheme-DCDmxPD0.js";import{a as Pt,c as qt,l as Nt,n as Ft,r as Et,t as Bt}from"./dialog-Do1NuJPs.js";import{n as Ot}from"./ImperativeModal-Ka_MU6gk.js";import{t as V}from"./links-DOybeRem.js";import{n as Mt}from"./useAsyncData-CaAFMbY9.js";import{o as Ut}from"./focus-B524Cy57.js";import{n as Kt,t as Ht}from"./azure-C2phEgLq.js";import{t as Wt}from"./request-registry-1QRLEb_0.js";import{n as zt,t as Gt}from"./write-secret-modal-C87c9nwO.js";var X=gt("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]=ft(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)(yt,{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=ut(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)(bt,{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{Dt as ce,E as Qe,Un as g}from"./cells-CuaAKcwV.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-DGjKht0c.js";import{t as G}from"./cn-DYvqRARy.js";import{t as et}from"./jsx-runtime-Blw4afVn.js";import{a as tt,c as ie,o as le,s as st}from"./popover-AtoFZ7i4.js";import{c as rt,i as nt,n as ot,r as ct,s as at,t as it}from"./select--zcABebs.js";import{a as J,c as de,o as lt,p as dt,r as pt,t as ht}from"./dropdown-menu-DrHAuMTb.js";import{m as mt,o as ut,t as bt,u as a}from"./form-BV-yji2Y.js";import{t as Y}from"./button-BKVLeSTX.js";import{l as ft}from"./arrays-DAC2orgH.js";import{r as U}from"./strings-pfr2N700.js";import{t as gt}from"./createLucideIcon-w-Qo9n0R.js";import{t as yt}from"./circle-plus-ifSmVHqa.js";import{t as _t}from"./database-zap-BxfYZ6ML.js";import{t as St}from"./github-C3N4cuN4.js";import{n as wt}from"./DeferredRequestRegistry-BLWK1eKa.js";import{o as xt,r as kt}from"./input-Bg12i6qY.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-CI3yaazO.js";import{r as It}from"./useTheme-DCDmxPD0.js";import{a as Pt,c as qt,l as Nt,n as Ft,r as Et,t as Bt}from"./dialog-BYjetQgE.js";import{n as Ot}from"./ImperativeModal-DoGv2BXV.js";import{t as V}from"./links-DOybeRem.js";import{n as Mt}from"./useAsyncData-CaAFMbY9.js";import{o as Ut}from"./focus-B524Cy57.js";import{n as Kt,t as Ht}from"./azure-C2phEgLq.js";import{t as Wt}from"./request-registry-1QRLEb_0.js";import{n as zt,t as Gt}from"./write-secret-modal-CHfFN0H8.js";var X=gt("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]=ft(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)(yt,{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=ut(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)(bt,{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})
|