@marimo-team/frontend 0.22.5-dev4 → 0.22.5-dev7
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
|
@@ -34,6 +34,7 @@ import { getRequestClient } from "@/core/network/requests";
|
|
|
34
34
|
import { isStaticNotebook } from "@/core/static/static-state";
|
|
35
35
|
import { isWasm } from "@/core/wasm/utils";
|
|
36
36
|
import { renderHTML } from "@/plugins/core/RenderHTML";
|
|
37
|
+
import { sanitizeHtml } from "@/plugins/core/sanitize-html";
|
|
37
38
|
import { copyToClipboard } from "@/utils/copy";
|
|
38
39
|
import {
|
|
39
40
|
elementContainsMarimoCellFile,
|
|
@@ -173,9 +174,9 @@ export const MarimoTracebackOutput = ({
|
|
|
173
174
|
</DropdownMenuItem>
|
|
174
175
|
<DropdownMenuItem
|
|
175
176
|
onClick={() => {
|
|
176
|
-
// Strip HTML from the traceback
|
|
177
|
+
// Strip HTML from the traceback (sanitize first to prevent XSS)
|
|
177
178
|
const div = document.createElement("div");
|
|
178
|
-
div.innerHTML = traceback;
|
|
179
|
+
div.innerHTML = sanitizeHtml(traceback);
|
|
179
180
|
const textContent = div.textContent || "";
|
|
180
181
|
copyToClipboard(textContent);
|
|
181
182
|
}}
|
|
@@ -193,7 +194,7 @@ export const MarimoTracebackOutput = ({
|
|
|
193
194
|
|
|
194
195
|
function lastLine(text: string): string {
|
|
195
196
|
const el = document.createElement("div");
|
|
196
|
-
el.innerHTML = text;
|
|
197
|
+
el.innerHTML = sanitizeHtml(text);
|
|
197
198
|
const lines = el.textContent?.split("\n").filter(Boolean);
|
|
198
199
|
return lines?.at(-1) || "";
|
|
199
200
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{s as J}from"./chunk-LvLJmgfZ.js";import{d as ye,f as ve,l as Ne,u as be}from"./useEvent-D91BmmQi.js";import{t as ke}from"./react-Bj1aDYRI.js";import{E as we,Mn as Ie,b as _e,gi as $e,ii as K,ir as Fe,nt as Te,ri as Ae,wn as Ce}from"./cells-CuaAKcwV.js";import{t as q}from"./compiler-runtime-B3qBwwSJ.js";import{t as Me}from"./invariant-CkiqGLcK.js";import{r as Se}from"./utils-8btzWeZg.js";import{t as X}from"./cn-DYvqRARy.js";import{t as ze}from"./jsx-runtime-Blw4afVn.js";import{a as Ee,i as qe,n as Le,r as Pe}from"./multi-map-MSuUqmbC.js";import{a as We,p as Ve,r as Be,t as He}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 O}from"./createLucideIcon-w-Qo9n0R.js";import{r as Qe}from"./x-Bv2rCglF.js";import{t as De}from"./sparkles-B79Qf6ma.js";import{c as ee,n as Oe}from"./datasource-DwmhT5-D.js";import{a as Ue}from"./dist-CgYlATe-.js";import{t as te}from"./kbd-BUtlbGdu.js";import{t as T}from"./links-DOybeRem.js";import{r as Re,t as Ge}from"./alert-DF3HbVtk.js";import{o as Je,t as Ke}from"./useInstallPackage-CeM6oPsT.js";import{n as Xe}from"./state-DuVk71Dw.js";import{n as b}from"./cell-link-CY7i_e4O.js";var Ye=O("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]),A=O("square-arrow-out-up-right",[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]]),re=O("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);function Ze(t){let e=null,s=t.cursor();do s.name==="ExpressionStatement"&&(e=s.node);while(s.next());return e}function et(t){let e=t.split(`
|
|
2
|
-
`),s=" ",n=Ze(Ue.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 tt(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=>{Me(n.editor,"Editor is null");let i=et(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 se))return[];let i=rt(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=Oe(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 rt(t){let e=se[t];return e===t?`import ${e}`:`import ${e} as ${t}`}var se={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"},st=q(),nt=$e("marimo:ai-autofix-mode","autofix",Ie);function lt(){let t=(0,st.c)(3),[e,s]=Ne(nt),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(ze(),1);const N=t=>{let e=(0,R.c)(21),{errors:s,cellId:n,className:i}=t,l=ve(),{createNewCell:a}=we(),c=be(Se),o;if(e[0]!==c||e[1]!==s){let h;e[3]===c?h=e[4]:(h=y=>tt(y,{aiEnabled:c}),e[3]=c,e[4]=h),o=s.flatMap(h),e[0]=c,e[1]=s,e[2]=o}else o=e[2];let m=o,p=ye(Xe);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=h=>{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:h}}),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 x;e[13]!==d.description||e[14]!==d.fixType||e[15]!==d.title||e[16]!==u?(x=d.fixType==="ai"?(0,r.jsx)(oe,{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]=x):x=e[17];let g;return e[18]!==j||e[19]!==x?(g=(0,r.jsx)("div",{className:j,children:x}),e[18]=j,e[19]=x,e[20]=g):g=e[20],g};var ne=De,le=ee,ie="Suggest a prompt",ae="Fix with AI";const oe=t=>{let e=(0,R.c)(21),{tooltip:s,openPrompt:n,applyAutofix:i}=t,{fixMode:l,setFixMode:a}=lt(),c=l==="prompt"?n:i,o;e[0]===l?o=e[1]:(o=l==="prompt"?(0,r.jsx)(ne,{className:"h-3 w-3 mr-2 mb-0.5"}):(0,r.jsx)(le,{className:"h-3 w-3 mr-2 mb-0.5"}),e[0]=l,e[1]=o);let m=l==="prompt"?ie:ae,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)(Ve,{asChild:!0,children:(0,r.jsx)(_,{size:"xs",variant:"outline",className:"rounded-l-none px-2","aria-label":"Fix options",children:(0,r.jsx)(Qe,{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",x;e[13]===j?x=e[14]:(x=(0,r.jsx)(it,{mode:j}),e[13]=j,e[14]=x);let g;e[15]!==u||e[16]!==x?(g=(0,r.jsxs)(He,{children:[f,(0,r.jsx)(Be,{align:"end",className:"w-56",children:(0,r.jsx)(We,{className:"flex items-center gap-2",onClick:u,children:x})})]}),e[15]=u,e[16]=x,e[17]=g):g=e[17];let h;return e[18]!==g||e[19]!==d?(h=(0,r.jsxs)("div",{className:"flex",children:[d,g]}),e[18]=g,e[19]=d,e[20]=h):h=e[20],h};var it=t=>{let e=(0,R.c)(12),{mode:s}=t,n;e[0]===s?n=e[1]:(n=s==="prompt"?(0,r.jsx)(ne,{className:"h-4 w-4"}):(0,r.jsx)(le,{className:"h-4 w-4"}),e[0]=s,e[1]=n);let i=n,l=s==="prompt"?ie:ae,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},ce=/(https?:\/\/\S+)/,at=/\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i,de=/^data:image\//i,ot=["avatars.githubusercontent.com"];function me(t){return de.test(t)?[{type:"image",url:t}]:t.split(ce).filter(e=>e!=="").map(e=>ce.test(e)?at.test(e)||de.test(e)||ot.some(s=>e.includes(s))?{type:"image",url:e}:{type:"url",url:e}:{type:"text",value:e})}var pe=q(),L=J(ke(),1),ct=new Te;const G=t=>{let e=RegExp("\x1B\\[[0-9;]*m","g");return t.replaceAll(e,"")};var ue=/(pip\s+install|uv\s+add|uv\s+pip\s+install)\s+/gi;function dt(t){ue.lastIndex=0;let e=ue.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=me(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)(L.Fragment,{children:n.value},l)})})}var mt=t=>{let e=(0,pe.c)(6),{packages:s,children:n}=t,{handleInstallPackages:i}=Ke(),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 pt=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=dt(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)(L.Fragment,{children:w(j,`before-${o}`)},`before-${o}`))}let u=e.slice(d,f);l.push((0,r.jsx)(mt,{packages:[p.package],children:u},`install-${o}`)),a=f}),a<e.length){let c=e.slice(a);l.push((0,r.jsx)(L.Fragment,{children:w(c,"after")},"after"))}return(0,r.jsx)(r.Fragment,{children:l})},ut=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}},ht=(t,e)=>(0,r.jsx)("span",{children:Ae(ct.ansi_to_html(t),{replace:s=>e(s)})}),ft=t=>{let e=(0,pe.c)(4),{text:s}=t,n;e[0]===s?n=e[1]:(n=ht(s,xt(pt,ut)),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)(Ee,{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)(Pe,{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)(qe,{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 jt=t=>{let e=(0,xe.c)(31),{errors:s,cellId:n,className:i}=t,l=Ce(),a="This cell wasn't run because it has errors",c="destructive",o="text-error";if(s.some(gt))a="Interrupted";else if(s.some(yt))a="An internal error occurred";else if(s.some(vt))a="Ancestor prevented from running",c="default",o="text-secondary-foreground";else if(s.some(Nt))a="Ancestor stopped",c="default",o="text-secondary-foreground";else if(s.some(bt))a="SQL error";else{let h;e[0]===s?h=e[1]:(h=s.find(kt),e[0]=s,e[1]=h);let y=h;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 h=s.filter(wt),y=s.filter(It),k=s.filter(_t),$=s.filter($t),P=s.filter(Ft),C=s.filter(Tt),M=s.filter(At),W=s.filter(Ct),V=s.filter(Mt),B=s.filter(St),F=s.filter(zt),H=s.filter(Et),Q=s.filter(qt),S;e[15]===l?S=e[16]:(S=()=>{l.openApplication("scratchpad")},e[15]=l,e[16]=S);let he=S,fe=()=>{let v=[];if(F.length>0||H.length>0){let E=F.some(Lt),ge=!E&&F.some(Pt);v.push((0,r.jsxs)("div",{children:[F.map(Wt),H.map(Vt),E&&(0,r.jsxs)(_,{size:"xs",variant:"outline",className:"mt-2 font-normal",onClick:()=>Je(l),children:[(0,r.jsx)(Ye,{className:"h-3.5 w-3.5 mr-1.5 mb-0.5"}),(0,r.jsx)("span",{children:"Open package manager"})]}),ge&&(0,r.jsxs)(_,{size:"xs",variant:"outline",className:"mt-2 font-normal",onClick:()=>l.openApplication("terminal"),children:[(0,r.jsx)(re,{className:"h-3.5 w-3.5 mr-1.5"}),(0,r.jsx)("span",{children:"Open terminal"})]}),n&&(0,r.jsx)(N,{errors:[...F,...H],cellId:n})]},"syntax-unknown"))}if(h.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:h.flatMap(Bt)}),n&&(0,r.jsx)(N,{errors:h,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)(T,{href:"https://links.marimo.app/errors-setup",children:["Learn more at our docs"," ",(0,r.jsx)(A,{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(Ht)}),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)(T,{href:"https://links.marimo.app/errors-cycles",children:["Learn more at our docs"," ",(0,r.jsx)(A,{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(Dt),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)(te,{className:"inline",children:["_",E]}),"). to make them private to this cell."]}),(0,r.jsxs)("p",{className:"py-2",children:[(0,r.jsxs)(T,{href:"https://links.marimo.app/errors-multiple-definitions",children:["Learn more at our docs"," ",(0,r.jsx)(A,{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:he,children:[(0,r.jsx)(Fe,{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(Ot),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)(T,{href:"https://links.marimo.app/errors-import-star",children:["Learn more at our docs"," ",(0,r.jsx)(A,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"import-star")),P.length>0&&v.push((0,r.jsxs)("div",{children:[P.map(Ut),n&&(0,r.jsx)(N,{errors:P,cellId:n})]},"interruption")),C.length>0&&v.push((0,r.jsxs)("ul",{children:[C.map(Rt),C.some(Gt)&&(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(Jt),n&&(0,r.jsx)(N,{errors:M,cellId:n}),(0,r.jsx)(I,{children:M.some(Kt)?"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(Xt),n&&(0,r.jsx)(N,{errors:W,cellId:n})]},"internal")),V.length>0&&v.push((0,r.jsxs)("div",{children:[V.map(Yt),n&&(0,r.jsx)(N,{errors:V,cellId:n})]},"ancestor-prevented")),B.length>0&&v.push((0,r.jsxs)("div",{children:[B.map(Zt),n&&(0,r.jsx)(N,{errors:B,cellId:n})]},"ancestor-stopped")),Q.length>0&&v.push((0,r.jsxs)("div",{children:[Q.map(er),n&&(0,r.jsx)(N,{errors:Q,cellId:n,className:"mt-2.5"})]},"sql-errors")),v},D=`font-code font-medium tracking-wide ${o}`,z;e[17]!==D||e[18]!==a?(z=(0,r.jsx)(Re,{className:D,children:a}),e[17]=D,e[18]=a,e[19]=z):z=e[19];let je=z;m=Ge,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=je,p="flex flex-col gap-8",d=fe(),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 x;e[22]!==p||e[23]!==d?(x=(0,r.jsx)("div",{children:(0,r.jsx)("div",{className:p,children:d})}),e[22]=p,e[23]=d,e[24]=x):x=e[24];let g;return e[25]!==m||e[26]!==f||e[27]!==u||e[28]!==j||e[29]!==x?(g=(0,r.jsxs)(m,{variant:f,className:u,children:[j,x]}),e[25]=m,e[26]=f,e[27]=u,e[28]=j,e[29]=x,e[30]=g):g=e[30],g};function gt(t){return t.type==="interruption"}function yt(t){return t.type==="internal"}function vt(t){return t.type==="ancestor-prevented"}function Nt(t){return t.type==="ancestor-stopped"}function bt(t){return t.type==="sql-error"}function kt(t){return t.type==="exception"}function wt(t){return t.type==="setup-refs"}function It(t){return t.type==="cycle"}function _t(t){return t.type==="multiple-defs"}function $t(t){return t.type==="import-star"}function Ft(t){return t.type==="interruption"}function Tt(t){return t.type==="exception"}function At(t){return t.type==="strict-exception"}function Ct(t){return t.type==="internal"}function Mt(t){return t.type==="ancestor-prevented"}function St(t){return t.type==="ancestor-stopped"}function zt(t){return t.type==="syntax"}function Et(t){return t.type==="unknown"}function qt(t){return t.type==="sql-error"}function Lt(t){return t.msg.includes("!pip")}function Pt(t){return t.msg.includes("use os.subprocess")}function Wt(t,e){return(0,r.jsx)("pre",{children:w(t.msg,`syntax-${e}`)},`syntax-${e}`)}function Vt(t,e){return(0,r.jsx)("pre",{children:w(t.msg,`unknown-${e}`)},`unknown-${e}`)}function Bt(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 Ht(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 Qt(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 Dt(t,e){return(0,r.jsxs)(L.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(Qt)})]},`multiple-defs-${e}`)}function Ot(t,e){return(0,r.jsx)("p",{className:"text-muted-foreground",children:t.msg},`import-star-${e}`)}function Ut(t,e){return(0,r.jsx)("p",{children:"This cell was interrupted and needs to be re-run."},`interruption-${e}`)}function Rt(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)(te,{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)(T,{href:"https://links.marimo.app/local-variables",children:["docs"," ",(0,r.jsx)(A,{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",dangerouslySetInnerHTML:{__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",dangerouslySetInnerHTML:{__html:t.traceback}})]})},`exception-${e}`)}function Gt(t){return t.raising_cell!=null}function Jt(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 Kt(t){return t.blamed_cell!=null}function Xt(t,e){return(0,r.jsx)("p",{children:t.msg},`internal-${e}`)}function Yt(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 Zt(t,e){return(0,r.jsxs)("div",{children:[t.msg,(0,r.jsx)(b,{cellId:t.raising_cell})]},`ancestor-stopped-${e}`)}function er(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{re as a,oe as i,ft as n,me as r,jt as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as Ce}from"./chunk-LvLJmgfZ.js";import{t as ye}from"./react-Bj1aDYRI.js";import{P as Se,R as ke,z as _e}from"./input-DfDSaPYh.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-CLNv4Iws.js";import{t as He}from"./context-BoP98Msj.js";var h=Ce(ye(),1),Be=(0,h.createContext)(null);(0,h.createContext)(null),(0,h.createContext)(null),(0,h.createContext)(null),(0,h.createContext)(null);var De=(0,h.createContext)({}),Oe=(0,h.createContext)(null);(0,h.createContext)(null);var je=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 je(e,t,r,n):e.createTreeWalker(t,r,n)}function ze(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 Ve(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 qe(e){return Ke()?e.metaKey:e.ctrlKey}var Ue=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function $e(e){return e instanceof HTMLInputElement&&!Ue.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}var Ge=0,q=new Map;function Je(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-${Ge++}`;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 Xe(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),G="react-aria-focus-scope-restore",p=null;function Qe(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 Y({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(G,b),u=u.nextSibling;return a.current=N,()=>{for(let _ of N)_.removeEventListener(G,b)}},[t]),it(a,n,r),rt(a,r),lt(a,n,r),ot(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)(()=>Ze(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 Ze(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 et(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 tt(e){if(e.checked)return!0;let t=et(e);return t.length>0&&!t.some(r=>r.checked)}function rt(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&&J(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&&J(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 nt(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{ke(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 J(e,t=!0){E(se(e,t))}function ot(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&&J(e.current)),r.current=!1},[e])}function it(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 lt(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(G,{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"&&(!tt(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 ct(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=X(c);return f&&E(f,!0),f??null}let s=c.previousNode();if(!s&&l){c.currentNode=n;let f=X(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=X(g(n,{tabbable:o,accept:i}));return l&&E(l,!0),l??null}}}function X(e){let t,r;do r=e.lastChild(),r&&(t=r);while(r);return t}var st=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 Y({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 Y({scopeRef:null}),this.fastMap.set(null,this.root)}},Y=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 st,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}=Se({isDisabled:!r,onFocusWithinChange:a=>o(a)}),l=(0,h.useMemo)(()=>n?t:t?{...de,...t}:de,[n]);return{visuallyHiddenProps:{...i,style:l}}}function at(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)}export{Be as _,g as a,U as c,qe as d,$e as f,oe as g,ze as h,Qe as i,Xe as l,z as m,fe as n,ct as o,Ve as p,nt as r,Ye as s,at as t,Je as u,Oe as v,De as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as z}from"./chunk-LvLJmgfZ.js";import{l as X}from"./useEvent-D91BmmQi.js";import{t as Z}from"./react-Bj1aDYRI.js";import{Lt as I}from"./cells-CuaAKcwV.js";import{t as H}from"./compiler-runtime-B3qBwwSJ.js";import{S as $,c as ee,i as te,l as se,n as le,u as ae}from"./ai-model-dropdown-CS5ryevV.js";import{C as oe,v as ne,w as Q}from"./utils-8btzWeZg.js";import{S as re}from"./config-Cgj0Ahvb.js";import{t as ie}from"./jsx-runtime-Blw4afVn.js";import{o as ce}from"./alert-dialog-CXspBRlP.js";import{i as de,r as he,t as me}from"./popover-AtoFZ7i4.js";import{l as R}from"./select--zcABebs.js";import{t as U}from"./tooltip-DmqhBBs6.js";import{t as xe}from"./button-BKVLeSTX.js";import{s as B}from"./arrays-DAC2orgH.js";import{r as Y}from"./requests-9-v2bhoi.js";import{t as pe}from"./createLucideIcon-w-Qo9n0R.js";import{t as fe}from"./x-Bv2rCglF.js";import{r as D}from"./input-DfDSaPYh.js";import{t as K}from"./settings-C1bg8A2T.js";import{a as M,c as L,d as A,g as ue,i as je,l as P,o as q,p as ve,u as S}from"./textarea-CI3yaazO.js";import{t as ge}from"./use-toast-BDYuj3zG.js";import{c as be,l as we,n as ye,t as V}from"./dialog-Do1NuJPs.js";import{t as Ne}from"./VisuallyHidden-CuyBIaeU.js";import{n as Ce}from"./useDebounce-LVL1r3-M.js";import{n as ke}from"./ImperativeModal-Ka_MU6gk.js";import{t as O}from"./kbd-BUtlbGdu.js";import{t as _e}from"./links-DOybeRem.js";import{t as G}from"./Inputs-6ni2iCdV.js";var Se=pe("power-off",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),Te=H(),s=z(ie(),1);const Me=t=>{let e=(0,Te.c)(15),{description:a,disabled:f,tooltip:r}=t,i=f===void 0?!1:f,u=r===void 0?"Shutdown":r,{openConfirm:b,closeModal:l}=ke(),{sendShutdown:o}=Y(),w;e[0]===o?w=e[1]:(w=()=>{o(),setTimeout(Le,200)},e[0]=o,e[1]=w);let j=w;if(re())return null;let m=i?"disabled":"red",c;e[2]!==l||e[3]!==a||e[4]!==j||e[5]!==b?(c=h=>{h.stopPropagation(),b({title:"Shutdown",description:a,variant:"destructive",confirmAction:(0,s.jsx)(ce,{onClick:()=>{j(),l()},"aria-label":"Confirm Shutdown",children:"Shutdown"})})},e[2]=l,e[3]=a,e[4]=j,e[5]=b,e[6]=c):c=e[6];let n;e[7]===Symbol.for("react.memo_cache_sentinel")?(n=(0,s.jsx)(fe,{strokeWidth:1}),e[7]=n):n=e[7];let d;e[8]!==i||e[9]!==m||e[10]!==c?(d=(0,s.jsx)(G,{"aria-label":"Shutdown","data-testid":"shutdown-button",shape:"circle",size:"small",color:m,className:"h-[27px] w-[27px]",disabled:i,onClick:c,children:n}),e[8]=i,e[9]=m,e[10]=c,e[11]=d):d=e[11];let x;return e[12]!==d||e[13]!==u?(x=(0,s.jsx)(U,{content:u,children:d}),e[12]=d,e[13]=u,e[14]=x):x=e[14],x};function Le(){window.close()}var J=H(),W=z(Z(),1),Ae=100;const Pe=()=>{let t=(0,J.c)(37),[e,a]=ne(),{saveAppConfig:f}=Y(),r=(0,W.useId)(),i=(0,W.useId)(),u;t[0]===Symbol.for("react.memo_cache_sentinel")?(u=ve(oe),t[0]=u):u=t[0];let b;t[1]===e?b=t[2]:(b={resolver:u,defaultValues:e},t[1]=e,t[2]=b);let l=ue(b),o;t[3]!==f||t[4]!==a?(o=async p=>{await f({config:p}).then(()=>{a(p)}).catch(()=>{a(p)})},t[3]=f,t[4]=a,t[5]=o):o=t[5];let w=o,j;t[6]===w?j=t[7]:(j=p=>{w(p)},t[6]=w,t[7]=j);let m=Ce(j,Ae),c;t[8]===e.width?c=t[9]:(c=[e.width],t[8]=e.width,t[9]=c),(0,W.useEffect)(qe,c);let n;t[10]!==m||t[11]!==l?(n=l.handleSubmit(m),t[10]=m,t[11]=l,t[12]=n):n=t[12];let d;t[13]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsxs)("div",{children:[(0,s.jsx)(ae,{children:"Notebook Settings"}),(0,s.jsx)(se,{children:"Configure how your notebook or application looks and behaves."})]}),t[13]=d):d=t[13];let x;t[14]===l.control?x=t[15]:(x=(0,s.jsxs)(F,{title:"Display",children:[(0,s.jsx)(L,{control:l.control,name:"width",render:Fe}),(0,s.jsx)(L,{control:l.control,name:"app_title",render:He})]}),t[14]=l.control,t[15]=x);let h;t[16]===l.control?h=t[17]:(h=(0,s.jsxs)(F,{title:"Custom Files",children:[(0,s.jsx)(L,{control:l.control,name:"css_file",render:De}),(0,s.jsx)(L,{control:l.control,name:"html_head_file",render:Oe})]}),t[16]=l.control,t[17]=h);let y;t[18]===l.control?y=t[19]:(y=(0,s.jsx)(F,{title:"Data",children:(0,s.jsx)(L,{control:l.control,name:"sql_output",render:ze})}),t[18]=l.control,t[19]=y);let N;t[20]!==r||t[21]!==i?(N=p=>{let{field:_}=p;return(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(P,{className:"flex flex-col gap-2",children:[(0,s.jsx)(M,{children:(0,s.jsxs)("div",{className:"flex gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(I,{id:r,"data-testid":"html-checkbox",checked:_.value.includes("html"),onCheckedChange:()=>{_.onChange(B(_.value,"html"))}}),(0,s.jsx)(S,{htmlFor:r,children:"HTML"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(I,{id:i,"data-testid":"ipynb-checkbox",checked:_.value.includes("ipynb"),onCheckedChange:()=>{_.onChange(B(_.value,"ipynb"))}}),(0,s.jsx)(S,{htmlFor:i,children:"IPYNB"})]})]})}),(0,s.jsx)(A,{})]}),(0,s.jsxs)(q,{children:["When enabled, marimo will periodically save this notebook in your selected formats (HTML, IPYNB) to a folder named"," ",(0,s.jsx)(O,{className:"inline",children:"__marimo__"})," next to your notebook file."]})]})},t[20]=r,t[21]=i,t[22]=N):N=t[22];let v;t[23]!==l.control||t[24]!==N?(v=(0,s.jsx)(F,{title:"Exporting outputs",children:(0,s.jsx)(L,{control:l.control,name:"auto_download",render:N})}),t[23]=l.control,t[24]=N,t[25]=v):v=t[25];let C;t[26]!==v||t[27]!==x||t[28]!==h||t[29]!==y?(C=(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-x-8 gap-y-4",children:[x,h,y,v]}),t[26]=v,t[27]=x,t[28]=h,t[29]=y,t[30]=C):C=t[30];let g;t[31]!==C||t[32]!==n?(g=(0,s.jsxs)("form",{onChange:n,className:"flex flex-col gap-6",children:[d,C]}),t[31]=C,t[32]=n,t[33]=g):g=t[33];let k;return t[34]!==l||t[35]!==g?(k=(0,s.jsx)(je,{...l,children:g}),t[34]=l,t[35]=g,t[36]=k):k=t[36],k};var F=t=>{let e=(0,J.c)(5),{title:a,children:f}=t,r;e[0]===a?r=e[1]:(r=(0,s.jsx)("h3",{className:"text-base font-semibold mb-1",children:a}),e[0]=a,e[1]=r);let i;return e[2]!==f||e[3]!==r?(i=(0,s.jsxs)("div",{className:"flex flex-col gap-y-2",children:[r,f]}),e[2]=f,e[3]=r,e[4]=i):i=e[4],i};function qe(){window.dispatchEvent(new Event("resize"))}function Ee(t){return(0,s.jsx)("option",{value:t,children:t},t)}function Fe(t){let{field:e}=t;return(0,s.jsxs)(P,{className:"flex flex-row items-center space-x-1 space-y-0",children:[(0,s.jsx)(S,{children:"Width"}),(0,s.jsx)(M,{children:(0,s.jsx)(R,{"data-testid":"app-width-select",onChange:a=>e.onChange(a.target.value),value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:$().map(Ee)})}),(0,s.jsx)(A,{})]})}function He(t){let{field:e}=t;return(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(P,{className:"flex flex-row items-center space-x-1 space-y-0",children:[(0,s.jsx)(S,{children:"App title"}),(0,s.jsx)(M,{children:(0,s.jsx)(D,{...e,value:e.value??"",onChange:a=>{e.onChange(a.target.value),Q.safeParse(a.target.value).success&&(document.title=a.target.value)}})}),(0,s.jsx)(A,{})]}),(0,s.jsx)(q,{children:"The application title is put in the title tag in the HTML code and typically displayed in the title bar of the browser window."})]})}function De(t){let{field:e}=t;return(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(P,{className:"flex flex-row items-center space-x-1 space-y-0",children:[(0,s.jsx)(S,{className:"shrink-0",children:"Custom CSS"}),(0,s.jsx)(M,{children:(0,s.jsx)(D,{...e,value:e.value??"",placeholder:"custom.css",onChange:a=>{e.onChange(a.target.value),Q.safeParse(a.target.value).success&&(document.title=a.target.value)}})}),(0,s.jsx)(A,{})]}),(0,s.jsx)(q,{children:"A filepath to a custom css file to be injected into the notebook."})]})}function Oe(t){let{field:e}=t;return(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(P,{className:"flex flex-row items-center space-x-1 space-y-0",children:[(0,s.jsx)(S,{className:"shrink-0",children:"HTML Head"}),(0,s.jsx)(M,{children:(0,s.jsx)(D,{...e,value:e.value??"",placeholder:"head.html",onChange:a=>{e.onChange(a.target.value)}})}),(0,s.jsx)(A,{})]}),(0,s.jsxs)(q,{children:["A filepath to an HTML file to be injected into the"," ",(0,s.jsx)(O,{className:"inline",children:"<head/>"})," section of the notebook. Use this to add analytics, custom fonts, meta tags, or external scripts."]})]})}function We(t){return(0,s.jsx)("option",{value:t.value,children:t.label},t.value)}function ze(t){let{field:e}=t;return(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(P,{className:"flex flex-row items-center space-x-1 space-y-0",children:[(0,s.jsx)(S,{children:"SQL Output Type"}),(0,s.jsx)(M,{children:(0,s.jsx)(R,{"data-testid":"sql-output-select",onChange:a=>{e.onChange(a.target.value),ge({title:"Kernel Restart Required",description:"This change requires a kernel restart to take effect."})},value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:ee.map(We)})}),(0,s.jsx)(A,{})]}),(0,s.jsxs)(q,{children:["The Python type returned by a SQL cell. For best performance with large datasets, we recommend using"," ",(0,s.jsx)(O,{className:"inline",children:"native"}),". See the"," ",(0,s.jsx)(_e,{href:"https://docs.marimo.io/guides/working_with_data/sql",children:"SQL guide"})," ","for more information."]})]})}var Ie=H();const Qe=t=>{let e=(0,Ie.c)(32),{showAppConfig:a,disabled:f,tooltip:r}=t,i=a===void 0?!0:a,u=f===void 0?!1:f,b=r===void 0?"Settings":r,[l,o]=X(le),w=u?"disabled":"hint-green",j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j=(0,s.jsx)(K,{strokeWidth:1.8}),e[0]=j):j=e[0];let m;e[1]===b?m=e[2]:(m=(0,s.jsx)(U,{content:b,children:j}),e[1]=b,e[2]=m);let c;e[3]!==u||e[4]!==w||e[5]!==m?(c=(0,s.jsx)(G,{"aria-label":"Config","data-testid":"app-config-button",shape:"circle",size:"small",className:"h-[27px] w-[27px]",disabled:u,color:w,children:m}),e[3]=u,e[4]=w,e[5]=m,e[6]=c):c=e[6];let n=c,d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsxs)(ye,{className:"w-[90vw] h-[90vh] overflow-hidden sm:max-w-5xl top-[5vh] p-0",children:[(0,s.jsx)(Ne,{children:(0,s.jsx)(be,{children:"User settings"})}),(0,s.jsx)(te,{})]}),e[7]=d):d=e[7];let x=d;if(!i){let T;e[8]===n?T=e[9]:(T=(0,s.jsx)(we,{children:n}),e[8]=n,e[9]=T);let E;return e[10]!==o||e[11]!==l||e[12]!==T?(E=(0,s.jsxs)(V,{open:l,onOpenChange:o,children:[T,x]}),e[10]=o,e[11]=l,e[12]=T,e[13]=E):E=e[13],E}let h;e[14]===n?h=e[15]:(h=(0,s.jsx)(de,{asChild:!0,children:n}),e[14]=n,e[15]=h);let y,N;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=(0,s.jsx)(Pe,{}),N=(0,s.jsx)("div",{className:"h-px bg-border my-2"}),e[16]=y,e[17]=N):(y=e[16],N=e[17]);let v;e[18]===o?v=e[19]:(v=()=>o(!0),e[18]=o,e[19]=v);let C;e[20]===Symbol.for("react.memo_cache_sentinel")?(C=(0,s.jsx)(K,{strokeWidth:1.8,className:"w-4 h-4 mr-2"}),e[20]=C):C=e[20];let g;e[21]===v?g=e[22]:(g=(0,s.jsxs)(he,{className:"w-[650px] overflow-auto max-h-[80vh] max-w-[80vw]",align:"end",side:"bottom",onFocusOutside:Re,children:[y,N,(0,s.jsxs)(xe,{onClick:v,variant:"link",className:"px-0",children:[C,"User settings"]})]}),e[21]=v,e[22]=g);let k;e[23]!==g||e[24]!==h?(k=(0,s.jsxs)(me,{children:[h,g]}),e[23]=g,e[24]=h,e[25]=k):k=e[25];let p;e[26]!==o||e[27]!==l?(p=(0,s.jsx)(V,{open:l,onOpenChange:o,children:x}),e[26]=o,e[27]=l,e[28]=p):p=e[28];let _;return e[29]!==k||e[30]!==p?(_=(0,s.jsxs)(s.Fragment,{children:[k,p]}),e[29]=k,e[30]=p,e[31]=_):_=e[31],_};function Re(t){return t.preventDefault()}export{Me as n,Se as r,Qe as t};
|