@marimo-team/frontend 0.22.5-dev21 → 0.22.5-dev24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/assets/{CellStatus-CP1jrQ3A.js → CellStatus-CNNGwOIK.js} +1 -1
  2. package/dist/assets/{JsonOutput-Bk2by9qo.js → JsonOutput-9XtRRx5l.js} +2 -2
  3. package/dist/assets/{MarimoErrorOutput-Cyd8ikG3.js → MarimoErrorOutput-Bc9JufDr.js} +1 -1
  4. package/dist/assets/{RenderHTML-BOW_1WUn.js → RenderHTML-0dk6-mYI.js} +1 -1
  5. package/dist/assets/{add-cell-with-ai-DUq7Y523.js → add-cell-with-ai-CLklC7KS.js} +1 -1
  6. package/dist/assets/{add-connection-dialog-20N0EHLl.js → add-connection-dialog-ux7eCDRM.js} +1 -1
  7. package/dist/assets/{agent-panel-DEza5aFa.js → agent-panel-CiMrqUfl.js} +1 -1
  8. package/dist/assets/{ai-model-dropdown-B-sbS07W.js → ai-model-dropdown-CRtaHcCu.js} +1 -1
  9. package/dist/assets/{app-config-button-CJFpYJ_2.js → app-config-button-CnX21edo.js} +1 -1
  10. package/dist/assets/{cell-editor-DLL6kX__.js → cell-editor-D7IQ3F4W.js} +1 -1
  11. package/dist/assets/{cell-link-Dtonmtv_.js → cell-link-CcAqXeeg.js} +1 -1
  12. package/dist/assets/{cells-BVG4a-Qn.js → cells-EJo3u4za.js} +3 -3
  13. package/dist/assets/{chat-display-DsIGz-Wy.js → chat-display-BxDRpNsl.js} +1 -1
  14. package/dist/assets/{chat-panel-aXOgktdv.js → chat-panel-dBoLqgjH.js} +1 -1
  15. package/dist/assets/{chat-ui-C--RApyx.js → chat-ui-DdZo1L-v.js} +1 -1
  16. package/dist/assets/{column-preview-CB_HZPdz.js → column-preview-DrU255Z3.js} +1 -1
  17. package/dist/assets/{command-palette-DLKNdcX_.js → command-palette-n6NnK6GP.js} +1 -1
  18. package/dist/assets/{common-CLVI2BhO.js → common-Bty2yo-n.js} +1 -1
  19. package/dist/assets/{components-DiALLQRt.js → components-B8TZ_vT_.js} +1 -1
  20. package/dist/assets/{components-CGwwQ0Y4.js → components-Dh-L-jYg.js} +1 -1
  21. package/dist/assets/config-DoZCLcOb.js +1 -0
  22. package/dist/assets/{datasource-BzTPyEw3.js → datasource-DY0N42ZB.js} +1 -1
  23. package/dist/assets/{dependency-graph-panel-Pxmnzmd4.js → dependency-graph-panel-C23HsAdh.js} +1 -1
  24. package/dist/assets/{documentation-panel-bgaPBvan.js → documentation-panel-okcEKCQM.js} +1 -1
  25. package/dist/assets/{download-QIfZjflb.js → download-TSo32ofd.js} +1 -1
  26. package/dist/assets/{edit-page-DB_go-vo.js → edit-page-RhmoqI7E.js} +3 -3
  27. package/dist/assets/{error-panel-DfHzC7q-.js → error-panel-aq2j0jIa.js} +1 -1
  28. package/dist/assets/{file-explorer-panel-CEd-m832.js → file-explorer-panel-CzYUz358.js} +1 -1
  29. package/dist/assets/{file-icons-ma7AC7Pi.js → file-icons-DBaXCICA.js} +1 -1
  30. package/dist/assets/{floating-outline-BluCz3vD.js → floating-outline-BTmyhMGv.js} +1 -1
  31. package/dist/assets/{focus-BHXzPxK_.js → focus-DXeddo75.js} +1 -1
  32. package/dist/assets/{form-C0W8wa3f.js → form-BiDLPu7R.js} +1 -1
  33. package/dist/assets/{globals-Bh85lAn7.js → globals-DQM2RvzM.js} +1 -1
  34. package/dist/assets/{home-page-nNrKA7jH.js → home-page-BntiR5eS.js} +1 -1
  35. package/dist/assets/{hooks-C7qnb_ft.js → hooks-BgwM3Mb2.js} +1 -1
  36. package/dist/assets/{html-to-image-B3VySJ1_.js → html-to-image-BJiJlwQY.js} +1 -1
  37. package/dist/assets/{index-CLnKZIHZ.js → index-CMEhtk8a.js} +5 -5
  38. package/dist/assets/{kiosk-mode-BSY8y4kL.js → kiosk-mode-JCcLyeoQ.js} +1 -1
  39. package/dist/assets/{layout-V4eTNc4M.js → layout-CF-7BNtf.js} +1 -1
  40. package/dist/assets/{logs-panel-B1AysC8S.js → logs-panel-BzhPrie8.js} +1 -1
  41. package/dist/assets/{markdown-renderer-BiKTlki_.js → markdown-renderer-B9RsGqHb.js} +1 -1
  42. package/dist/assets/{name-cell-input-BA5B0KJl.js → name-cell-input-CYsY4A1G.js} +1 -1
  43. package/dist/assets/{outline-panel-BfGPA_Sj.js → outline-panel-BCAWCKi6.js} +1 -1
  44. package/dist/assets/{packages-panel-BgoT3rrV.js → packages-panel-5axf3DuF.js} +1 -1
  45. package/dist/assets/{panels-BeW4RaML.js → panels-7-kbDRzv.js} +1 -1
  46. package/dist/assets/{process-output-MnxG8jwi.js → process-output-DqiZsqG9.js} +1 -1
  47. package/dist/assets/{readonly-python-code-DuH_nOq_.js → readonly-python-code-D8ITm60r.js} +1 -1
  48. package/dist/assets/{run-page-kI3bwb2R.js → run-page-9OQqe8IY.js} +1 -1
  49. package/dist/assets/{scratchpad-panel-617FvSKA.js → scratchpad-panel-DkqxnSH6.js} +1 -1
  50. package/dist/assets/{session-panel-D6Sf5vhq.js → session-panel-BuzMiMf3.js} +1 -1
  51. package/dist/assets/{snippets-panel-DfWq0wh2.js → snippets-panel--mh2FUXA.js} +1 -1
  52. package/dist/assets/{state-urfwd716.js → state-6D_2UAw3.js} +1 -1
  53. package/dist/assets/{state-Blw6taKi.js → state-BDrig0S2.js} +1 -1
  54. package/dist/assets/{switch-C2idsSNO.js → switch-C6xjg01T.js} +1 -1
  55. package/dist/assets/{terminal-BBTjIXBz.js → terminal-BEaHyVIQ.js} +1 -1
  56. package/dist/assets/{textarea-B5p9_myy.js → textarea-Cfp3upzK.js} +1 -1
  57. package/dist/assets/{tracing-CazNvlp4.js → tracing-BExYhl1z.js} +1 -1
  58. package/dist/assets/{tracing-panel-Bj0Bx8ZJ.js → tracing-panel-Co5DeX-F.js} +2 -2
  59. package/dist/assets/{useAddCell-g3zSMJKs.js → useAddCell-BaTlDxTu.js} +1 -1
  60. package/dist/assets/{useBoolean-ugd5JdXd.js → useBoolean-BvsK1Xcs.js} +1 -1
  61. package/dist/assets/{useCellActionButton-DdsVswP2.js → useCellActionButton-DftkIqUl.js} +1 -1
  62. package/dist/assets/{useDeleteCell-CIdiI4Pk.js → useDeleteCell-d6yWnL3H.js} +1 -1
  63. package/dist/assets/{useDependencyPanelTab-DhXqfAqL.js → useDependencyPanelTab-BaVcOBM4.js} +1 -1
  64. package/dist/assets/{useNotebookActions-ULfiGMMl.js → useNotebookActions-DihtSJ4g.js} +1 -1
  65. package/dist/assets/{useRunCells-q5CA-QoL.js → useRunCells-d2edY6Tu.js} +1 -1
  66. package/dist/assets/{useSplitCell-B0jDwUEM.js → useSplitCell-DOiFyMgH.js} +1 -1
  67. package/dist/assets/{vega-component-B2_J2GQq.js → vega-component-CiVPyAwP.js} +1 -1
  68. package/dist/index.html +26 -26
  69. package/package.json +1 -1
  70. package/src/components/editor/Output.tsx +1 -1
  71. package/src/components/editor/__tests__/Output.test.tsx +36 -1
  72. package/src/core/cells/__tests__/cells.test.ts +41 -0
  73. package/src/core/cells/__tests__/collapseConsoleOutputs.test.ts +38 -0
  74. package/src/core/cells/cells.ts +1 -1
  75. package/src/core/cells/collapseConsoleOutputs.tsx +3 -0
  76. package/src/core/runtime/__tests__/runtime.test.ts +138 -2
  77. package/src/core/runtime/runtime.ts +25 -5
  78. package/dist/assets/config-Cgj0Ahvb.js +0 -1
@@ -1 +1 @@
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-BVG4a-Qn.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-B-sbS07W.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-Bg12i6qY.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-B5p9_myy.js";import{t as ge}from"./use-toast-BDYuj3zG.js";import{i as be}from"./RSPContexts-LWFBF00h.js";import{n as we}from"./useDebounce-LVL1r3-M.js";import{c as ye,l as Ne,n as Ce,t as V}from"./dialog-BYjetQgE.js";import{n as ke}from"./ImperativeModal-DoGv2BXV.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=we(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)(Ce,{className:"w-[90vw] h-[90vh] overflow-hidden sm:max-w-5xl top-[5vh] p-0",children:[(0,s.jsx)(be,{children:(0,s.jsx)(ye,{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)(Ne,{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};
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-EJo3u4za.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-CRtaHcCu.js";import{C as oe,v as ne,w as Q}from"./utils-8btzWeZg.js";import{S as re}from"./config-DoZCLcOb.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-Bg12i6qY.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-Cfp3upzK.js";import{t as ge}from"./use-toast-BDYuj3zG.js";import{i as be}from"./RSPContexts-LWFBF00h.js";import{n as we}from"./useDebounce-LVL1r3-M.js";import{c as ye,l as Ne,n as Ce,t as V}from"./dialog-BYjetQgE.js";import{n as ke}from"./ImperativeModal-DoGv2BXV.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=we(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)(Ce,{className:"w-[90vw] h-[90vh] overflow-hidden sm:max-w-5xl top-[5vh] p-0",children:[(0,s.jsx)(be,{children:(0,s.jsx)(ye,{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)(Ne,{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};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./loro_wasm_bg-BQvuJIS2.js","./loro_wasm_bg-B_AVgvOe.js","./chunk-LvLJmgfZ.js"])))=>i.map(i=>d[i]);
2
- var nd=Object.defineProperty;var Aa=re=>{throw TypeError(re)};var rd=(re,z,pe)=>z in re?nd(re,z,{enumerable:!0,configurable:!0,writable:!0,value:pe}):re[z]=pe;var p=(re,z,pe)=>rd(re,typeof z!="symbol"?z+"":z,pe),od=(re,z,pe)=>z.has(re)||Aa("Cannot "+pe);var Ta=(re,z,pe)=>(od(re,z,"read from private field"),pe?pe.call(re):z.get(re)),Ia=(re,z,pe)=>z.has(re)?Aa("Cannot add the same private member more than once"):z instanceof WeakSet?z.add(re):z.set(re,pe);import{s as Fa}from"./chunk-LvLJmgfZ.js";import{d as La,f as pr,i as Z,l as yn,n as se,p as Lt,s as wn,u as le}from"./useEvent-D91BmmQi.js";import{t as ad}from"./react-Bj1aDYRI.js";import{$t as id,B as Oa,Bn as sd,Ct as vn,E as En,Et as Ot,F as ld,Fn as cd,G as Da,Gr as ud,Gt as dd,H as _a,Hr as gr,In as fd,Ir as md,Kt as hr,Ln as pd,Lt as gd,Rt as Ua,Sn as br,St as yr,Ti as Nn,Tt as hd,U as Ba,V as bd,Wn as yd,Wr as wd,Xr as ja,Xt as Pa,Yr as vd,Yt as wr,Zt as Ma,_n as Ed,a as Ra,b as Ze,d as Ga,en as Nd,fn as kd,ft as vr,gi as Cd,h as Er,hn as Sd,in as kn,it as xd,kn as Ad,kt as Td,ot as Id,pi as Ja,pt as Fd,sn as Ld,tn as Od,u as Wa,ur as Dd,vn as _d,wt as Ud,xt as Bd,yn as jd,zn as Va,__tla as Pd}from"./cells-BVG4a-Qn.js";import{P as $a,R as Md,k as Rd,w as Gd}from"./zod-H_cgTO0M.js";import{t as Re}from"./compiler-runtime-B3qBwwSJ.js";import{C as Jd,f as Wd,m as Vd,p as $d,t as Hd,v as qd}from"./ai-model-dropdown-B-sbS07W.js";import{_ as We,c as Ha,h as Nr,t as zd,v as Kd}from"./useEventListener-DGjKht0c.js";import{t as Dt}from"./invariant-CkiqGLcK.js";import{S as kr,h as qa,m as Yd,o as Xd,p as za,s as Ka}from"./utils-8btzWeZg.js";import{S as Qd,d as Zd,h as pt,o as ef,r as Ya,x as _t,y as Xa}from"./config-Cgj0Ahvb.js";import{n as tf,t as nf}from"./switch-C2idsSNO.js";import{n as rf}from"./globals-Bh85lAn7.js";import{t as of}from"./ErrorBoundary-dxChUL02.js";import{t as at}from"./cn-DYvqRARy.js";import{t as af}from"./jsx-runtime-Blw4afVn.js";import{l as sf,r as lf,t as cf}from"./popover-AtoFZ7i4.js";import{N as uf,__tla as df}from"./JsonOutput-Bk2by9qo.js";import{t as Cr}from"./label-C89F4v17.js";import{r as ff}from"./download-QIfZjflb.js";import{t as Cn}from"./tooltip-DmqhBBs6.js";import{r as Sr,t as it}from"./button-BKVLeSTX.js";import{Bt as gt,Ct as Qa,Dt as mf,E as pf,Ft as xr,H as Za,Ht as Ut,I as gf,J as l,Jt as fe,Kt as hf,Lt as Sn,Mt as bf,P as yf,St as Ge,V as ei,Vt as Ar,Wt as st,Yt as Ve,Zt as Bt,_ as wf,a as vf,at as P,bt as Ef,ct as ze,en as xn,ft as Nf,it as kf,lt as An,m as Cf,pt as Sf,rt as q,st as xf,vt as Af,w as Tf,wt as If,yt as Ff,zt as Lf}from"./dist-VwkX7yeV.js";import{C as Of,D as Df,_ as _f,a as Uf,c as Bf,n as Tr,r as jf,v as Pf,x as Mf,y as Rf}from"./dist-DZJfxwLb.js";import{o as ti}from"./arrays-DAC2orgH.js";import{n as Gf}from"./once-hq2TLzOp.js";import{t as Ir}from"./createReducer-CYlwteGD.js";import{a as Jf,c as Wf,f as Tn,h as Vf,i as $f,l as jt,n as ni,o as Hf,t as qf}from"./dist-BNTOYRCs.js";import{t as zf}from"./main-BNL5rxQw.js";import{r as In,t as Kf}from"./requests-9-v2bhoi.js";import{t as Yf}from"./createLucideIcon-w-Qo9n0R.js";import{r as ri,t as Xf,__tla as Qf}from"./layout-V4eTNc4M.js";import{t as Zf}from"./x-Bv2rCglF.js";import{t as em}from"./circle-check-DlWaawuO.js";import{A as tm,E as oi,O as nm,T as rm,a as ai,d as om,n as am,o as im,r as ii,s as sm,x as lm}from"./add-cell-with-ai-DUq7Y523.js";import{r as cm,t as um}from"./file-icons-ma7AC7Pi.js";import{n as dm}from"./spinner-C5wIpWgQ.js";import{t as si}from"./save-bKSHuTCo.js";import{Y as fm,Z as li}from"./input-Bg12i6qY.js";import{t as mm}from"./sparkles-B79Qf6ma.js";import{t as pm}from"./preload-helper-D2MJg03u.js";import{t as ht}from"./use-toast-BDYuj3zG.js";import{n as Ke}from"./paths-BzSgteR-.js";import{t as gm}from"./session-DdnWW30b.js";import{r as hm}from"./useTheme-DCDmxPD0.js";import{n as bm}from"./copy-Bizk-4hH.js";import{k as ym}from"./usePress-BXMIcLWP.js";import{a as wm}from"./useRunCells-q5CA-QoL.js";import{c as ci,i as ui,n as di,r as vm}from"./dialog-BYjetQgE.js";import{t as fi}from"./useHotkey-DALUNe8I.js";import{n as mi}from"./ImperativeModal-DoGv2BXV.js";import{r as Em}from"./errors-CZb6hI2x.js";import{t as X}from"./extends-Co37_JfG.js";import{t as Pt}from"./objectWithoutPropertiesLoose-smPWkHxB.js";import{t as Nm}from"./kbd-BUtlbGdu.js";import{a as Fr}from"./useInstallPackage-CeM6oPsT.js";import{i as km,n as pi}from"./state-Blw6taKi.js";import{a as Cm,o as Sm}from"./cell-link-Dtonmtv_.js";import{n as xm}from"./useAsyncData-aCoWDe-l.js";import{a as Am,o as gi,r as Tm,s as hi,t as Im}from"./command-DvF_4mQa.js";import{r as bi}from"./html-to-image-B3VySJ1_.js";import{a as Fm}from"./focus-BHXzPxK_.js";import{a as yi}from"./renderShortcut-DrDh2657.js";import{n as Lm,t as Om}from"./icons-DlzgV4KY.js";import{n as bt}from"./esm-BqofWdD5.js";import{t as wi}from"./dist-C80Ed7Y5.js";import{n as Lr,t as vi}from"./useDeleteCell-CIdiI4Pk.js";import{t as Dm}from"./useSplitCell-B0jDwUEM.js";import{co as _m,do as Or,fo as Um,ft as Bm,go as yt,ho as Ei,lo as Dr,mo as Ni,oo as jm,po as Pm,so as ki,uo as Ci,__tla as Mm}from"./loro_wasm_bg-B_AVgvOe.js";import{t as Rm}from"./ws-BApgRfsy.js";import{t as Si}from"./Inputs-6ni2iCdV.js";import{n as Gm}from"./hooks-C7qnb_ft.js";let Fn,_r,xi,Ur,lt,Br,be,Mt,Rt,Ai,Ti,Ii,Fi,Li,Ln,Oi,On,Di,Dn,Jm=Promise.all([(()=>{try{return Pd}catch{}})(),(()=>{try{return df}catch{}})(),(()=>{try{return Qf}catch{}})(),(()=>{try{return Mm}catch{}})()]).then(async()=>{var hn,xa,we,ve,Ee,Ne,ke,Ce,Se,xe,Ae,Te,Ie,Fe,Le,Oe,De,_e,Ue,Be,je;var re=Yf("file-pen",[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]]);const z={showInput:"Mod-l",acceptEdit:"Mod-y",rejectEdit:"Mod-u"};var pe=300;const vt=Ut.define({combine:e=>xn(e,{onError:console.error,inputDebounceTime:pe,keymaps:z},{onError:(t,n)=>t&&n,inputDebounceTime:(t,n)=>t&&n,keymaps:(t,n)=>t&&n})}),et=fe.define(),tt=Ve.define({create(){return{show:!1,lineFrom:0,lineTo:0}},update(e,t){for(let n of t.effects)if(n.is(et))return n.value;return e}}),Et=fe.define(),Nt=fe.define(),Pr=Ve.define({create(){return{shouldFocus:!1,inputValue:""}},update(e,t){let n=e;for(let r of t.effects)r.is(Et)&&(n={...n,inputValue:r.value}),r.is(Nt)&&(n={...n,shouldFocus:r.value});return n}}),Gt=fe.define(),kt=Ve.define({create(){return null},update(e,t){for(let n of t.effects)if(n.is(Gt))return n.value;return e}}),ct=fe.define(),Mr=Ve.define({create(){return!1},update(e,t){for(let n of t.effects)if(n.is(ct))return n.value;return e}});var _i=1;const Rr=e=>{let{state:t}=e,n=t.selection.main;if(n.empty)return!1;let r=t.doc,o=r.lineAt(n.from),a=r.lineAt(n.to);if(t.sliceDoc(o.from,a.to).trim().length<_i)return!1;let i=Math.max(1,Math.min(o.number,r.lines)),s=Math.max(1,Math.min(a.number,r.lines));return e.dispatch({effects:[et.of({show:!0,lineFrom:i,lineTo:s}),Nt.of(!0),Et.of("")],selection:gt.cursor(o.from)}),!0},Gr=e=>e.state.field(kt)?(e.dispatch({effects:[Gt.of(null),et.of({show:!1,lineFrom:0,lineTo:0}),Nt.of(!1),Et.of(""),ct.of(!1)]}),!0):!1,Jr=e=>{let t=e.state.field(kt);return t?(e.dispatch({changes:{from:t.from,to:t.to,insert:t.oldCode},effects:[Gt.of(null),et.of({show:!1,lineFrom:0,lineTo:0}),Nt.of(!1),Et.of(""),ct.of(!1)]}),!0):!1};var _n={mac:"\u2318",windows:"\u229E Win",default:"Ctrl"};function Ui(){return navigator.platform.startsWith("Mac")?_n.mac:navigator.platform.startsWith("Win")?_n.windows:_n.default}function Un(e){return e.replace("Mod",Ui()).replace("-"," ").toUpperCase()}function ue(e,t){let n=document.createElement(e);return n.className=t,n}function Bi(e,t,n=void 0){let r=()=>{};return(...o)=>(r(),new Promise((a,i)=>{let s=setTimeout(()=>a(e(...o)),t);r=()=>{clearTimeout(s),n!==void 0&&i(n)}}))}var Jt=Ve.define({create(){return{suggestion:null}},update(e,t){let n=t.effects.find(r=>r.is(Wt));return!t.docChanged&&!n&&!t.selection?e:n&&t.state.doc===n.value.doc?{suggestion:n.value.text}:{suggestion:null}}}),Wt=fe.define();function ji(e,t){let n=e.state.selection.main.head,r=[],o=q.widget({widget:new Pi(t),side:1});return r.push(o.range(n)),q.set(r)}var Pi=class extends An{constructor(t){super();p(this,"suggestion");this.suggestion=t}toDOM(){let t=document.createElement("span");return t.style.opacity="0.4",t.className="cm-inline-suggestion",t.textContent=this.suggestion,t.setAttribute("role","suggestion"),t.setAttribute("aria-label",`Suggestion: ${this.suggestion}`),t}get lineBreaks(){return this.suggestion.split(`
2
+ var nd=Object.defineProperty;var Aa=re=>{throw TypeError(re)};var rd=(re,z,pe)=>z in re?nd(re,z,{enumerable:!0,configurable:!0,writable:!0,value:pe}):re[z]=pe;var p=(re,z,pe)=>rd(re,typeof z!="symbol"?z+"":z,pe),od=(re,z,pe)=>z.has(re)||Aa("Cannot "+pe);var Ta=(re,z,pe)=>(od(re,z,"read from private field"),pe?pe.call(re):z.get(re)),Ia=(re,z,pe)=>z.has(re)?Aa("Cannot add the same private member more than once"):z instanceof WeakSet?z.add(re):z.set(re,pe);import{s as Fa}from"./chunk-LvLJmgfZ.js";import{d as La,f as pr,i as Z,l as yn,n as se,p as Lt,s as wn,u as le}from"./useEvent-D91BmmQi.js";import{t as ad}from"./react-Bj1aDYRI.js";import{$t as id,B as Oa,Bn as sd,Ct as vn,E as En,Et as Ot,F as ld,Fn as cd,G as Da,Gr as ud,Gt as dd,H as _a,Hr as gr,In as fd,Ir as md,Kt as hr,Ln as pd,Lt as gd,Rt as Ua,Sn as br,St as yr,Ti as Nn,Tt as hd,U as Ba,V as bd,Wn as yd,Wr as wd,Xr as ja,Xt as Pa,Yr as vd,Yt as wr,Zt as Ma,_n as Ed,a as Ra,b as Ze,d as Ga,en as Nd,fn as kd,ft as vr,gi as Cd,h as Er,hn as Sd,in as kn,it as xd,kn as Ad,kt as Td,ot as Id,pi as Ja,pt as Fd,sn as Ld,tn as Od,u as Wa,ur as Dd,vn as _d,wt as Ud,xt as Bd,yn as jd,zn as Va,__tla as Pd}from"./cells-EJo3u4za.js";import{P as $a,R as Md,k as Rd,w as Gd}from"./zod-H_cgTO0M.js";import{t as Re}from"./compiler-runtime-B3qBwwSJ.js";import{C as Jd,f as Wd,m as Vd,p as $d,t as Hd,v as qd}from"./ai-model-dropdown-CRtaHcCu.js";import{_ as We,c as Ha,h as Nr,t as zd,v as Kd}from"./useEventListener-DGjKht0c.js";import{t as Dt}from"./invariant-CkiqGLcK.js";import{S as kr,h as qa,m as Yd,o as Xd,p as za,s as Ka}from"./utils-8btzWeZg.js";import{S as Qd,d as Zd,h as pt,o as ef,r as Ya,x as _t,y as Xa}from"./config-DoZCLcOb.js";import{n as tf,t as nf}from"./switch-C6xjg01T.js";import{n as rf}from"./globals-DQM2RvzM.js";import{t as of}from"./ErrorBoundary-dxChUL02.js";import{t as at}from"./cn-DYvqRARy.js";import{t as af}from"./jsx-runtime-Blw4afVn.js";import{l as sf,r as lf,t as cf}from"./popover-AtoFZ7i4.js";import{N as uf,__tla as df}from"./JsonOutput-9XtRRx5l.js";import{t as Cr}from"./label-C89F4v17.js";import{r as ff}from"./download-TSo32ofd.js";import{t as Cn}from"./tooltip-DmqhBBs6.js";import{r as Sr,t as it}from"./button-BKVLeSTX.js";import{Bt as gt,Ct as Qa,Dt as mf,E as pf,Ft as xr,H as Za,Ht as Ut,I as gf,J as l,Jt as fe,Kt as hf,Lt as Sn,Mt as bf,P as yf,St as Ge,V as ei,Vt as Ar,Wt as st,Yt as Ve,Zt as Bt,_ as wf,a as vf,at as P,bt as Ef,ct as ze,en as xn,ft as Nf,it as kf,lt as An,m as Cf,pt as Sf,rt as q,st as xf,vt as Af,w as Tf,wt as If,yt as Ff,zt as Lf}from"./dist-VwkX7yeV.js";import{C as Of,D as Df,_ as _f,a as Uf,c as Bf,n as Tr,r as jf,v as Pf,x as Mf,y as Rf}from"./dist-DZJfxwLb.js";import{o as ti}from"./arrays-DAC2orgH.js";import{n as Gf}from"./once-hq2TLzOp.js";import{t as Ir}from"./createReducer-CYlwteGD.js";import{a as Jf,c as Wf,f as Tn,h as Vf,i as $f,l as jt,n as ni,o as Hf,t as qf}from"./dist-BNTOYRCs.js";import{t as zf}from"./main-BNL5rxQw.js";import{r as In,t as Kf}from"./requests-9-v2bhoi.js";import{t as Yf}from"./createLucideIcon-w-Qo9n0R.js";import{r as ri,t as Xf,__tla as Qf}from"./layout-CF-7BNtf.js";import{t as Zf}from"./x-Bv2rCglF.js";import{t as em}from"./circle-check-DlWaawuO.js";import{A as tm,E as oi,O as nm,T as rm,a as ai,d as om,n as am,o as im,r as ii,s as sm,x as lm}from"./add-cell-with-ai-CLklC7KS.js";import{r as cm,t as um}from"./file-icons-DBaXCICA.js";import{n as dm}from"./spinner-C5wIpWgQ.js";import{t as si}from"./save-bKSHuTCo.js";import{Y as fm,Z as li}from"./input-Bg12i6qY.js";import{t as mm}from"./sparkles-B79Qf6ma.js";import{t as pm}from"./preload-helper-D2MJg03u.js";import{t as ht}from"./use-toast-BDYuj3zG.js";import{n as Ke}from"./paths-BzSgteR-.js";import{t as gm}from"./session-DdnWW30b.js";import{r as hm}from"./useTheme-DCDmxPD0.js";import{n as bm}from"./copy-Bizk-4hH.js";import{k as ym}from"./usePress-BXMIcLWP.js";import{a as wm}from"./useRunCells-d2edY6Tu.js";import{c as ci,i as ui,n as di,r as vm}from"./dialog-BYjetQgE.js";import{t as fi}from"./useHotkey-DALUNe8I.js";import{n as mi}from"./ImperativeModal-DoGv2BXV.js";import{r as Em}from"./errors-CZb6hI2x.js";import{t as X}from"./extends-Co37_JfG.js";import{t as Pt}from"./objectWithoutPropertiesLoose-smPWkHxB.js";import{t as Nm}from"./kbd-BUtlbGdu.js";import{a as Fr}from"./useInstallPackage-CeM6oPsT.js";import{i as km,n as pi}from"./state-BDrig0S2.js";import{a as Cm,o as Sm}from"./cell-link-CcAqXeeg.js";import{n as xm}from"./useAsyncData-aCoWDe-l.js";import{a as Am,o as gi,r as Tm,s as hi,t as Im}from"./command-DvF_4mQa.js";import{r as bi}from"./html-to-image-BJiJlwQY.js";import{a as Fm}from"./focus-DXeddo75.js";import{a as yi}from"./renderShortcut-DrDh2657.js";import{n as Lm,t as Om}from"./icons-DlzgV4KY.js";import{n as bt}from"./esm-BqofWdD5.js";import{t as wi}from"./dist-C80Ed7Y5.js";import{n as Lr,t as vi}from"./useDeleteCell-d6yWnL3H.js";import{t as Dm}from"./useSplitCell-DOiFyMgH.js";import{co as _m,do as Or,fo as Um,ft as Bm,go as yt,ho as Ei,lo as Dr,mo as Ni,oo as jm,po as Pm,so as ki,uo as Ci,__tla as Mm}from"./loro_wasm_bg-B_AVgvOe.js";import{t as Rm}from"./ws-BApgRfsy.js";import{t as Si}from"./Inputs-6ni2iCdV.js";import{n as Gm}from"./hooks-BgwM3Mb2.js";let Fn,_r,xi,Ur,lt,Br,be,Mt,Rt,Ai,Ti,Ii,Fi,Li,Ln,Oi,On,Di,Dn,Jm=Promise.all([(()=>{try{return Pd}catch{}})(),(()=>{try{return df}catch{}})(),(()=>{try{return Qf}catch{}})(),(()=>{try{return Mm}catch{}})()]).then(async()=>{var hn,xa,we,ve,Ee,Ne,ke,Ce,Se,xe,Ae,Te,Ie,Fe,Le,Oe,De,_e,Ue,Be,je;var re=Yf("file-pen",[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]]);const z={showInput:"Mod-l",acceptEdit:"Mod-y",rejectEdit:"Mod-u"};var pe=300;const vt=Ut.define({combine:e=>xn(e,{onError:console.error,inputDebounceTime:pe,keymaps:z},{onError:(t,n)=>t&&n,inputDebounceTime:(t,n)=>t&&n,keymaps:(t,n)=>t&&n})}),et=fe.define(),tt=Ve.define({create(){return{show:!1,lineFrom:0,lineTo:0}},update(e,t){for(let n of t.effects)if(n.is(et))return n.value;return e}}),Et=fe.define(),Nt=fe.define(),Pr=Ve.define({create(){return{shouldFocus:!1,inputValue:""}},update(e,t){let n=e;for(let r of t.effects)r.is(Et)&&(n={...n,inputValue:r.value}),r.is(Nt)&&(n={...n,shouldFocus:r.value});return n}}),Gt=fe.define(),kt=Ve.define({create(){return null},update(e,t){for(let n of t.effects)if(n.is(Gt))return n.value;return e}}),ct=fe.define(),Mr=Ve.define({create(){return!1},update(e,t){for(let n of t.effects)if(n.is(ct))return n.value;return e}});var _i=1;const Rr=e=>{let{state:t}=e,n=t.selection.main;if(n.empty)return!1;let r=t.doc,o=r.lineAt(n.from),a=r.lineAt(n.to);if(t.sliceDoc(o.from,a.to).trim().length<_i)return!1;let i=Math.max(1,Math.min(o.number,r.lines)),s=Math.max(1,Math.min(a.number,r.lines));return e.dispatch({effects:[et.of({show:!0,lineFrom:i,lineTo:s}),Nt.of(!0),Et.of("")],selection:gt.cursor(o.from)}),!0},Gr=e=>e.state.field(kt)?(e.dispatch({effects:[Gt.of(null),et.of({show:!1,lineFrom:0,lineTo:0}),Nt.of(!1),Et.of(""),ct.of(!1)]}),!0):!1,Jr=e=>{let t=e.state.field(kt);return t?(e.dispatch({changes:{from:t.from,to:t.to,insert:t.oldCode},effects:[Gt.of(null),et.of({show:!1,lineFrom:0,lineTo:0}),Nt.of(!1),Et.of(""),ct.of(!1)]}),!0):!1};var _n={mac:"\u2318",windows:"\u229E Win",default:"Ctrl"};function Ui(){return navigator.platform.startsWith("Mac")?_n.mac:navigator.platform.startsWith("Win")?_n.windows:_n.default}function Un(e){return e.replace("Mod",Ui()).replace("-"," ").toUpperCase()}function ue(e,t){let n=document.createElement(e);return n.className=t,n}function Bi(e,t,n=void 0){let r=()=>{};return(...o)=>(r(),new Promise((a,i)=>{let s=setTimeout(()=>a(e(...o)),t);r=()=>{clearTimeout(s),n!==void 0&&i(n)}}))}var Jt=Ve.define({create(){return{suggestion:null}},update(e,t){let n=t.effects.find(r=>r.is(Wt));return!t.docChanged&&!n&&!t.selection?e:n&&t.state.doc===n.value.doc?{suggestion:n.value.text}:{suggestion:null}}}),Wt=fe.define();function ji(e,t){let n=e.state.selection.main.head,r=[],o=q.widget({widget:new Pi(t),side:1});return r.push(o.range(n)),q.set(r)}var Pi=class extends An{constructor(t){super();p(this,"suggestion");this.suggestion=t}toDOM(){let t=document.createElement("span");return t.style.opacity="0.4",t.className="cm-inline-suggestion",t.textContent=this.suggestion,t.setAttribute("role","suggestion"),t.setAttribute("aria-label",`Suggestion: ${this.suggestion}`),t}get lineBreaks(){return this.suggestion.split(`
3
3
  `).length-1}},Mi=class{constructor(e){p(this,"cache",new Map);p(this,"timeout");this.timeout=e}get(e){let t=this.cache.get(e);return t?Date.now()-t.timestamp>this.timeout?(this.cache.delete(e),null):t.result:null}set(e,t){this.cache.set(e,{result:t,timestamp:Date.now()})}},Ri=(e,t)=>ze.fromClass(class{constructor(){p(this,"abortController",null);p(this,"cache");this.cache=new Mi(t.cacheTimeout??1e3)}async update(n){var i,s,c,u,d;if(!n.docChanged||((s=(i=t.events)==null?void 0:i.beforeSuggestionFetch)==null?void 0:s.call(i,n.view))===!1)return;(c=this.abortController)==null||c.abort(),this.abortController=new AbortController;let r=n.state.doc,o=r.toString(),a=this.cache.get(o);if(a){n.view.dispatch({effects:Wt.of({text:a,doc:r})});return}try{let f=await e(n.state,this.abortController.signal,n.view);if(this.abortController.signal.aborted||((d=(u=t.events)==null?void 0:u.shouldShowSuggestion)==null?void 0:d.call(u,n.view,f))===!1)return;this.cache.set(o,f),n.view.dispatch({effects:Wt.of({text:f,doc:r})})}catch(f){f instanceof Error&&f.name!=="AbortError"&&console.error("Suggestion fetch error:",f)}}destroy(){var n;(n=this.abortController)==null||n.abort()}}),Gi=ze.fromClass(class{constructor(){p(this,"decorations");this.decorations=q.none}update(e){var n;let t=(n=e.state.field(Jt))==null?void 0:n.suggestion;if(!t){this.decorations=q.none;return}this.decorations=ji(e.view,t)}},{decorations:e=>e.decorations});function Ji(e,t,n,r){return{...e.changeByRange(o=>{if(o===e.selection.main)return{changes:{from:n,to:r,insert:t},range:gt.cursor(n+t.length)};let a=r-n;return!o.empty||a&&e.sliceDoc(o.from-a,o.from)!==e.sliceDoc(n,r)?{range:o}:{changes:{from:o.from-a,to:o.from,insert:t},range:gt.cursor(o.from-a+t.length)}}),userEvent:"input.complete"}}var Wi=e=>{var r,o,a;let t=(r=e.state.field(Jt))==null?void 0:r.suggestion;if(!t)return!1;let n=e.state.facet(Bn);return e.dispatch({...Ji(e.state,t,e.state.selection.main.head,e.state.selection.main.head)}),(a=(o=n.events)==null?void 0:o.onSuggestionAccepted)==null||a.call(o,e,t),!0},Wr=e=>{var r,o,a;let t=(r=e.state.field(Jt))==null?void 0:r.suggestion;if(!t)return!1;let n=e.state.facet(Bn);return e.dispatch({effects:Wt.of({text:null,doc:e.state.doc})}),(a=(o=n.events)==null?void 0:o.onSuggestionRejected)==null||a.call(o,e,t),!0},Vi=Ge.of([{key:"Tab",run:Wi},{key:"Escape",run:Wr}]),Bn=Ut.define({combine:e=>e.at(-1)});function Vr(e){let{delay:t=500,includeKeymap:n=!0}=e,r=Bi(e.fetchFn,t);return[Jt,Bn.of(e),Ri(r,e),Gi,n?Vi:[]]}const $i=P.baseTheme({".cm-ai-input-container":{display:"flex",flexDirection:"column",gap:"4px",width:"min(calc(100% + 7px), 500px)",padding:"5px 5px",margin:"0 -6px",backgroundColor:"light-dark(rgb(241, 243, 245), rgb(40, 40, 40))"},".cm-ai-input":{display:"block",width:"100%",padding:"3px 8px",border:"2px solid rgb(51, 154, 240)",borderRadius:"5px",fontSize:"12px"},".cm-ai-help-info-button":{fontSize:"10px",paddingLeft:"10px",height:"18px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",display:"block",marginRight:"auto"},".cm-ai-help-info-button:hover":{color:"light-dark(rgb(89, 97, 105), rgb(190, 190, 190))"},".cm-ai-generate-button":{background:"#0E639C",border:"none",padding:"2px 6px",color:"#ffffff",cursor:"pointer",font:"inherit",borderRadius:"4px","&:hover":{backgroundColor:"#1177bb"}},".cm-line.cm-ai-selection, .cm-line.cm-ai-selection.cm-active-line":{backgroundColor:"light-dark(color-mix(in srgb, rgb(223, 227, 232) 50%, transparent), color-mix(in srgb, rgb(50, 50, 50) 50%, transparent)) !important"},".cm-line:has(.cm-new-code-line)":{backgroundColor:"light-dark(color-mix(in srgb, rgb(183, 235, 143) 50%, transparent), color-mix(in srgb, rgb(40, 100, 40) 50%, transparent)) !important"},".cm-old-code-container":{backgroundColor:"light-dark(rgb(255, 205, 205), rgb(100, 40, 40))",position:"relative",display:"flex",paddingTop:"0",width:"100%",alignItems:"center"},".cm-code-button":{position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",fontSize:"16px"},".cm-floating-buttons":{fontFamily:"sans-serif",position:"absolute",top:"-20px",left:"5px",display:"flex"},".cm-floating-button":{fontFamily:"sans-serif",padding:"2px 5px",fontSize:"10px",cursor:"pointer",fontWeight:"700"},".cm-floating-accept":{backgroundColor:"light-dark(rgb(55, 125, 34), rgb(40, 80, 25))",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px",color:"white",filter:"brightness(90%)","&:hover":{filter:"brightness(100%)"}},".cm-floating-reject":{backgroundColor:"light-dark(rgb(220, 53, 69), rgb(180, 40, 50))",color:"white",borderTopRightRadius:"5px",borderBottomRightRadius:"5px",filter:"brightness(90%)","&:hover":{filter:"brightness(100%)"}},".hotkey":{display:"inline-block",padding:"0 4px",borderRadius:"3px",backgroundColor:"rgba(255, 255, 255, 0.1)",fontSize:"90%"},".cm-ai-loading-indicator":{fontStyle:"italic",fontSize:"10px",paddingLeft:"12px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",opacity:"0",transition:"opacity 0.3s ease-in-out","&::after":{content:'""',display:"inline-block",animation:"ellipsis-pulse 1.5s steps(4, end) infinite"},"&:not(:empty)":{opacity:"1"}},".cm-ai-input:disabled":{opacity:"0.5"},"@keyframes ellipsis-pulse":{"0%":{content:"'.'"},"25%":{content:"'..'"},"50%":{content:"'...'"},"75%":{content:"''"}},".cm-ai-loading-container":{display:"flex",alignItems:"center",padding:"0 8px"},".cm-ai-cancel-button":{padding:"2px 8px",fontSize:"10px",borderRadius:"4px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",cursor:"pointer","&:hover":{background:"light-dark(rgb(223, 227, 232), rgb(50, 50, 50))"}},".hidden":{display:"none"}});function Hi(e){var o,a;let t=e.state.facet(vt),n={...z,...t.keymaps},r=ue("div","cm-ai-tooltip").appendChild(ue("div","cm-ai-tooltip-button"));return r.innerHTML=`<span>Edit <span class="hotkey">${Un(n.showInput)}</span></span>`,(o=r.querySelector("span"))==null||o.addEventListener("mousedown",i=>{i.stopPropagation(),i.button===0&&i.preventDefault()}),(a=r.querySelector("span"))==null||a.addEventListener("click",i=>{i.preventDefault(),Rr(e)}),r}const jn=Ut.define({combine(e){return xn(e,{render:Hi,hideOnBlur:!1})}}),qi=ze.fromClass((xa=class{constructor(e){p(this,"view");p(this,"suppress");p(this,"dom");p(this,"mousedown",()=>{this.suppress=!0});p(this,"mouseup",()=>{this.suppress=!1,this.display(this.view)});p(this,"scroll",()=>{this.display(this.view)});p(this,"windowScroll",()=>{this.display(this.view)});Ia(this,hn,e=>{var n;let t=e.state.selection.ranges.find(r=>!r.empty);if(t&&!this.suppress){let r=e.coordsAtPos(t.from);if(!r)return;let o=e.dom.getBoundingClientRect(),a=(n=e.dom.parentElement)==null?void 0:n.getBoundingClientRect(),i=r.top>=o.top&&r.top<=o.bottom&&r.left>=o.left&&r.left<=o.right,s=!a||r.top>=a.top&&r.top<=a.bottom&&r.left>=a.left&&r.left<=a.right;if(!i||!s){this.dom.style.display="none",this.dom.setAttribute("aria-hidden","true");return}this.dom.style.display="flex",this.dom.setAttribute("aria-hidden","false");let c=this.dom.getBoundingClientRect(),u=o.width-c.width,d=Math.min(r.left,u),f=r.top-c.height;f=a?Math.max(a.y,f):f,this.dom.style.left=`${d}px`,this.dom.style.top=`${f}px`,requestAnimationFrame(()=>{this.dom&&this.dom.setAttribute("aria-hidden","false")})}else this.dom.style.display="none",this.dom.setAttribute("aria-hidden","true")});this.view=e;let t=e.state.facet(jn);this.suppress=!1,document.addEventListener("mousedown",this.mousedown),document.addEventListener("mouseup",this.mouseup),e.scrollDOM.addEventListener("scroll",this.scroll),window.addEventListener("scroll",this.windowScroll,!0);let n=t.render(e);e.dom.appendChild(n),this.dom=n}update(e){this.display(e.view)}docViewUpdate(e){this.display(e)}display(e){if(e.state.field(tt).show){this.dom.style.display="none";return}if(e.state.facet(jn).hideOnBlur&&!e.hasFocus){this.dom.style.display="none",this.dom.setAttribute("aria-hidden","true");return}e.requestMeasure({read:Ta(this,hn)})}destroy(){document.removeEventListener("mousedown",this.mousedown),document.removeEventListener("mouseup",this.mouseup),this.view.scrollDOM.removeEventListener("scroll",this.scroll),window.removeEventListener("scroll",this.windowScroll,!0),this.dom.remove()}},hn=new WeakMap,xa));var zi=P.baseTheme({".cm-ai-tooltip-button":{userSelect:"none",fontFamily:"system-ui, -apple-system, sans-serif",position:"fixed",display:"flex",boxSizing:"border-box",padding:"2px 6px",borderRadius:"4px",fontSize:"12px",backgroundColor:"#0E639C",color:"#ffffff",border:"1px solid transparent",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",zIndex:"999",transition:"opacity 0.5s","&[aria-hidden='true']":{opacity:"0"},"&[aria-hidden='false']":{opacity:"1"},"& > span":{pointerEvents:"auto",cursor:"pointer",display:"inline-block",padding:"2px"},"&:hover":{backgroundColor:"#1177bb"}}});function Ki(){return[qi,zi]}var Yi=class extends An{constructor(t){super();p(this,"oldCode");this.oldCode=t}toDOM(t){let n=ue("div","cm-old-code-container");n.setAttribute("role","region"),n.setAttribute("aria-label","Previous code version");let r=ue("div","cm-old-code cm-line");r.textContent=this.oldCode;let o=ue("div","cm-floating-buttons"),a=t.state.facet(vt),i={...z,...a.keymaps},s=ue("button","cm-floating-button cm-floating-accept");s.innerHTML=`<span class="hotkey">${Un(i.acceptEdit)}</span> Accept`,s.setAttribute("aria-label","Accept changes"),s.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),t.focus(),Gr(t)});let c=ue("button","cm-floating-button cm-floating-reject");return c.innerHTML=`<span class="hotkey">${Un(i.rejectEdit)}</span> Reject`,c.setAttribute("aria-label","Reject changes"),c.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),t.focus(),Jr(t)}),o.append(s,c),n.append(r,o),n}updateDOM(t,n){return!0}},Xi=class extends An{constructor(t){super();p(this,"complete");p(this,"abortController",null);p(this,"dom",null);p(this,"input",null);p(this,"loadingContainer",null);p(this,"helpInfo",null);p(this,"inputContainer",null);p(this,"form",null);p(this,"view",null);p(this,"onKeyDown",async t=>{t.key==="Enter"&&!t.shiftKey?(t.preventDefault(),await this.handleSubmit()):t.key==="Escape"&&this.onCancel()});p(this,"onCancel",()=>{this.cleanup();let t=this.view;t&&(t.dispatch({effects:[et.of({show:!1,lineFrom:0,lineTo:0}),ct.of(!1)]}),t.focus())});p(this,"handleSubmit",async t=>{var h;let n=this.view;if(!n)return;let r=n.state.facet(vt);t==null||t.stopPropagation();let o=n.state.field(tt),{input:a}=this;if(!a)return;let i=a.value.trim();if(!o.show||!i)return;let s=n.state.doc.line(o.lineFrom),c=n.state.doc.line(o.lineTo),u=s.from,d=c.to,f=n.state.sliceDoc(u,d),g=n.state.sliceDoc(0,u),m=n.state.sliceDoc(d);this.abortController=new AbortController,n.dispatch({effects:ct.of(!0)}),this.toggleLoading(!0);try{let w=await this.complete({prompt:i,selection:f,codeBefore:g,codeAfter:m,editorView:n,signal:this.abortController.signal});if(!n.state.field(tt).show)return;if(!w||typeof w!="string")throw Error("Invalid completion result");n.dispatch({changes:{from:u,to:d,insert:w},effects:[et.of({show:!1,lineFrom:0,lineTo:0}),Gt.of({from:u,to:u+w.length,oldCode:f,newCode:w}),ct.of(!1)]})}catch(w){if(w instanceof DOMException&&w.name==="AbortError")return;(h=r.onError)==null||h.call(r,w)}finally{this.cleanup(),this.toggleLoading(!1),n.focus()}});this.complete=t}toDOM(t){if(this.dom)return this.dom;this.view=t;let n=t.state.field(Pr),r=t.state.field(Mr),o=ue("div","cm-ai-input-container");this.inputContainer=o,this.dom=o;let a=ue("form","cm-ai-input-form");this.form=a,a.setAttribute("role","search"),a.setAttribute("aria-label","AI editing instructions"),a.addEventListener("submit",y=>y.preventDefault());let i=ue("input","cm-ai-input");this.input=i,a.append(i),i.placeholder="Editing instructions...",i.setAttribute("aria-label","AI editing instructions"),i.setAttribute("autocomplete","off"),i.setAttribute("spellcheck","true"),i.value=n.inputValue;let s=ue("div","cm-ai-loading-container");this.loadingContainer=s;let c=ue("div","cm-ai-loading-indicator");c.setAttribute("role","status"),c.setAttribute("aria-live","polite"),c.textContent="Generating";let u=ue("button","cm-ai-cancel-button");u.textContent="Cancel",u.setAttribute("aria-label","Cancel code generation"),u.addEventListener("click",this.onCancel),s.append(u,c);let d=ue("div","cm-ai-help-info");this.helpInfo=d;let f=d.appendChild(document.createElement("button"));f.className="cm-ai-help-info-button",f.textContent="Esc to close",f.addEventListener("click",this.onCancel);let g=ue("button","cm-ai-generate-button");g.textContent="\u23CE Generate",g.setAttribute("aria-label","Generate code"),g.addEventListener("click",this.handleSubmit),this.toggleLoading(r),n.shouldFocus&&requestAnimationFrame(()=>{i.value=n.inputValue,i.focus(),t.dispatch({effects:Nt.of(!1)})}),m(i.value),i.addEventListener("input",w),i.addEventListener("keydown",this.onKeyDown);function m(y){d.replaceChildren(y?g:f)}let h="";function w(){t.dispatch({effects:Et.of(i.value)});let y=i.value.trim();y!==h&&(h=y,m(y))}return o}toggleLoading(t){var n;this.inputContainer&&this.form&&this.loadingContainer&&this.helpInfo&&((n=this.inputContainer)==null||n.replaceChildren(this.form,t?this.loadingContainer:this.helpInfo))}updateDOM(t,n){return this.dom=t,this.input=t.querySelector(".cm-ai-input"),!0}cleanup(){var t,n,r;(t=this.abortController)==null||t.abort(),this.abortController=null,(n=this.dom)==null||n.remove(),(r=this.input)==null||r.remove(),this.dom=null,this.input=null}destroy(){this.cleanup()}};function Qi(e){if(!e.prompt)throw Error("prompt function is required");let t={...z,...e.keymaps};return[vt.of(e),tt,Pr,kt,Mr,Ki(),$i,Ge.of([{key:t.showInput,run:Rr}]),st.highest([Ge.of([{key:t.acceptEdit,run:Gr},{key:t.rejectEdit,run:Jr}])]),Zi,es,ts,ns]}const Zi=P.updateListener.of(e=>{let t=e.state.field(tt);if(!t.show||!e.docChanged)return;let{lineFrom:n,lineTo:r}=t,o=!1;e.changes.iterChanges((a,i,s,c)=>{let u=e.state.doc.lineAt(a).number;if(u<n){let d=e.state.doc.lineAt(c).number-e.state.doc.lineAt(s).number;n+=d,r+=d,o=!0}else if(u<=r){let d=e.state.doc.lineAt(c).number-e.state.doc.lineAt(s).number;r+=d,o=!0}}),o&&e.view.dispatch({effects:[et.of({show:!0,lineFrom:n,lineTo:r})]})}),es=P.decorations.of(e=>{let t=e.state.field(kt);return t?q.set([q.mark({class:"cm-new-code-line"}).range(t.from,t.to)]):q.none}),ts=P.decorations.compute([tt],e=>{let t=e.field(tt),n=e.facet(vt),r=[];if(t.show){let o=t.lineFrom,a=t.lineTo;for(let i=o;i<=a;i++){let s=e.doc.line(i).from;r.push(q.line({class:"cm-ai-selection"}).range(s)),i===o&&r.push(q.widget({widget:new Xi(n.prompt),side:-1}).range(s))}}return q.set(r)}),ns=Ve.define({create(e){return q.none},update(e,t){let n=t.state.field(kt);return n?q.set([q.widget({widget:new Yi(n.oldCode),block:!0}).range(n.from)]):q.none},provide:e=>P.decorations.from(e)});var rs=Re(),I=Fa(ad(),1),Pn=()=>({entries:new Map}),{valueAtom:$r,useActions:Hr}=Ir(Pn,{submit:(e,t)=>{let{cellIds:n,deleteCell:r,deleteManyCells:o,store:a}=t,i=a.get(Ze),s=a.get(cd),c=new Set(i.cellIds.inOrderIds.filter(f=>i.cellData[f].code.trim()==="")),u=new Map;for(let f of n){if(c.has(f)){u.set(f,{cellId:f,type:"simple"});continue}let g=i.cellRuntime[f],m=new Map;for(let w of Object.values(s)){let y=w.declaredBy.includes(f),E=w.usedBy.some(C=>!c.has(C));y&&E&&m.set(w.name,w.usedBy)}let h;g!=null&&g.runElapsedTimeMs&&g.runElapsedTimeMs>2e3&&(h=g.runElapsedTimeMs),m.size===0&&h===void 0?u.set(f,{cellId:f,type:"simple"}):u.set(f,{cellId:f,type:"expensive",executionDurationMs:h,defs:m})}let d=[...u.values()].every(f=>f.type==="simple");return u.size>0&&d?(u.size===1?r({cellId:[...u.values()][0].cellId}):o({cellIds:[...u.values()].map(f=>f.cellId)}),Pn()):{...e,entries:u}},clear:()=>Pn()});Dn=function(){let e=pr(),{submit:t,clear:n}=Hr(),{entries:r}=le($r),o=vi(),a=Lr();return(0,I.useMemo)(()=>({submit:i=>{t({cellIds:i,deleteCell:o,deleteManyCells:a,store:e})},clear:n,get idle(){return r.size===0},get shouldConfirmDelete(){return r.size>1}}),[e,t,n,r,o,a])},Di=function(e){let t=(0,rs.c)(16),n=le($r),r=Hr(),o=Lr(),a;t[0]!==e||t[1]!==n.entries?(a=n.entries.get(e),t[0]=e,t[1]=n.entries,t[2]=a):a=t[2];let i=a;if(!i){let d;return t[3]===Symbol.for("react.memo_cache_sentinel")?(d={isPending:!1},t[3]=d):d=t[3],d}if(n.entries.size!==1){let d;return t[4]===i?d=t[5]:(d={isPending:!0,shouldConfirmDelete:!1,...i},t[4]=i,t[5]=d),d}let s;t[6]!==r||t[7]!==o||t[8]!==n.entries?(s=()=>{o({cellIds:[...n.entries.values()].map(os)}),r.clear()},t[6]=r,t[7]=o,t[8]=n.entries,t[9]=s):s=t[9];let c;t[10]===r?c=t[11]:(c=()=>r.clear(),t[10]=r,t[11]=c);let u;return t[12]!==i||t[13]!==s||t[14]!==c?(u={isPending:!0,...i,shouldConfirmDelete:!0,confirm:s,cancel:c},t[12]=i,t[13]=s,t[14]=c,t[15]=u):u=t[15],u};function os(e){return e.cellId}async function as(e){var s,c;let t=`
4
4
  ${e.codeBefore}
5
5
  <rewrite_this>
@@ -1 +1 @@
1
- import{s as j}from"./chunk-LvLJmgfZ.js";import{d as E,l as L,n as P,u as O}from"./useEvent-D91BmmQi.js";import{E as T,N as w,Nt as y,Ti as A,dn as S,j as $,pi as _}from"./cells-BVG4a-Qn.js";import{t as b}from"./compiler-runtime-B3qBwwSJ.js";import{_ as D}from"./useEventListener-DGjKht0c.js";import{d as F}from"./utils-8btzWeZg.js";import{r as N}from"./constants-tOPFFcLZ.js";import{h as q,x as B}from"./config-Cgj0Ahvb.js";import{t as H}from"./cn-DYvqRARy.js";import{t as M}from"./jsx-runtime-Blw4afVn.js";import{r as R}from"./requests-9-v2bhoi.js";import{n as U}from"./paths-BzSgteR-.js";import{s as V}from"./session-DdnWW30b.js";import{n as z}from"./ImperativeModal-DoGv2BXV.js";var G=b();function x(){return O(_)}function J(){let r=(0,G.c)(5),[t]=L(q),e=E(_),{openAlert:s}=z(),{sendRename:o}=R(),a;return r[0]!==t.state||r[1]!==s||r[2]!==o||r[3]!==e?(a=async l=>{let n=F();return t.state===B.OPEN?(V(i=>{l===null?i.delete(N.filePath):i.set(N.filePath,l)}),o({filename:l}).then(()=>(e(l),document.title=n.app_title||U.basename(l)||"Untitled Notebook",l)).catch(i=>(s(i.message),null))):(s("Failed to save notebook: not connected to a kernel."),null)},r[0]=t.state,r[1]=s,r[2]=o,r[3]=e,r[4]=a):a=r[4],P(a)}var p=b(),v=j(M(),1);const h=r=>{let t=(0,p.c)(12),{className:e,cellId:s,variant:o,onClick:a,formatCellName:l,skipScroll:n}=r,i=w()[s]??"",C=$().inOrderIds.indexOf(s),{showCellIfHidden:d}=T(),g=l??W,c;t[0]===e?c=t[1]:(c=H("inline-block cursor-pointer text-link hover:underline",e),t[0]=e,t[1]=c);let m;t[2]!==s||t[3]!==a||t[4]!==d||t[5]!==n||t[6]!==o?(m=k=>{if(s==="__scratch__")return!1;d({cellId:s}),k.stopPropagation(),k.preventDefault(),requestAnimationFrame(()=>{I(s,o,n)&&(a==null||a())})},t[2]=s,t[3]=a,t[4]=d,t[5]=n,t[6]=o,t[7]=m):m=t[7];let f=g(y(i,C)),u;return t[8]!==c||t[9]!==m||t[10]!==f?(u=(0,v.jsx)("div",{className:c,role:"link",tabIndex:-1,onClick:m,children:f}),t[8]=c,t[9]=m,t[10]=f,t[11]=u):u=t[11],u},K=r=>{let t=(0,p.c)(2),e;return t[0]===r?e=t[1]:(e=(0,v.jsx)(h,{...r,variant:"destructive"}),t[0]=r,t[1]=e),e},Q=r=>{let t=(0,p.c)(10),{cellId:e,lineNumber:s}=r,o=x(),a;t[0]!==e||t[1]!==s?(a=()=>S(e,s),t[0]=e,t[1]=s,t[2]=a):a=t[2];let l;t[3]!==e||t[4]!==o?(l=i=>e==="__scratch__"?"scratch":`marimo://${o||"untitled"}#cell=${i}`,t[3]=e,t[4]=o,t[5]=l):l=t[5];let n;return t[6]!==e||t[7]!==a||t[8]!==l?(n=(0,v.jsx)(h,{cellId:e,onClick:a,skipScroll:!0,variant:"destructive",className:"traceback-cell-link",formatCellName:l}),t[6]=e,t[7]=a,t[8]=l,t[9]=n):n=t[9],n};function I(r,t,e){let s=A.create(r),o=document.getElementById(s),a=o==null?void 0:o.classList.contains("has-error");return o===null?(D.error(`Cell ${s} not found on page.`),!1):(e||o.scrollIntoView({behavior:"smooth",block:"center"}),(t==="destructive"||a&&t===void 0)&&(o.classList.add("error-outline"),setTimeout(()=>{o.classList.remove("error-outline")},2e3)),(t==="focus"||!a&&t===void 0)&&(o.classList.add("focus-outline"),setTimeout(()=>{o.classList.remove("focus-outline")},2e3)),!0)}function W(r){return r}export{x as a,I as i,K as n,J as o,Q as r,h as t};
1
+ import{s as j}from"./chunk-LvLJmgfZ.js";import{d as E,l as L,n as P,u as O}from"./useEvent-D91BmmQi.js";import{E as T,N as w,Nt as y,Ti as A,dn as S,j as $,pi as _}from"./cells-EJo3u4za.js";import{t as b}from"./compiler-runtime-B3qBwwSJ.js";import{_ as D}from"./useEventListener-DGjKht0c.js";import{d as F}from"./utils-8btzWeZg.js";import{r as N}from"./constants-tOPFFcLZ.js";import{h as q,x as B}from"./config-DoZCLcOb.js";import{t as H}from"./cn-DYvqRARy.js";import{t as M}from"./jsx-runtime-Blw4afVn.js";import{r as R}from"./requests-9-v2bhoi.js";import{n as U}from"./paths-BzSgteR-.js";import{s as V}from"./session-DdnWW30b.js";import{n as z}from"./ImperativeModal-DoGv2BXV.js";var G=b();function x(){return O(_)}function J(){let r=(0,G.c)(5),[t]=L(q),e=E(_),{openAlert:s}=z(),{sendRename:o}=R(),a;return r[0]!==t.state||r[1]!==s||r[2]!==o||r[3]!==e?(a=async l=>{let n=F();return t.state===B.OPEN?(V(i=>{l===null?i.delete(N.filePath):i.set(N.filePath,l)}),o({filename:l}).then(()=>(e(l),document.title=n.app_title||U.basename(l)||"Untitled Notebook",l)).catch(i=>(s(i.message),null))):(s("Failed to save notebook: not connected to a kernel."),null)},r[0]=t.state,r[1]=s,r[2]=o,r[3]=e,r[4]=a):a=r[4],P(a)}var p=b(),v=j(M(),1);const h=r=>{let t=(0,p.c)(12),{className:e,cellId:s,variant:o,onClick:a,formatCellName:l,skipScroll:n}=r,i=w()[s]??"",C=$().inOrderIds.indexOf(s),{showCellIfHidden:d}=T(),g=l??W,c;t[0]===e?c=t[1]:(c=H("inline-block cursor-pointer text-link hover:underline",e),t[0]=e,t[1]=c);let m;t[2]!==s||t[3]!==a||t[4]!==d||t[5]!==n||t[6]!==o?(m=k=>{if(s==="__scratch__")return!1;d({cellId:s}),k.stopPropagation(),k.preventDefault(),requestAnimationFrame(()=>{I(s,o,n)&&(a==null||a())})},t[2]=s,t[3]=a,t[4]=d,t[5]=n,t[6]=o,t[7]=m):m=t[7];let f=g(y(i,C)),u;return t[8]!==c||t[9]!==m||t[10]!==f?(u=(0,v.jsx)("div",{className:c,role:"link",tabIndex:-1,onClick:m,children:f}),t[8]=c,t[9]=m,t[10]=f,t[11]=u):u=t[11],u},K=r=>{let t=(0,p.c)(2),e;return t[0]===r?e=t[1]:(e=(0,v.jsx)(h,{...r,variant:"destructive"}),t[0]=r,t[1]=e),e},Q=r=>{let t=(0,p.c)(10),{cellId:e,lineNumber:s}=r,o=x(),a;t[0]!==e||t[1]!==s?(a=()=>S(e,s),t[0]=e,t[1]=s,t[2]=a):a=t[2];let l;t[3]!==e||t[4]!==o?(l=i=>e==="__scratch__"?"scratch":`marimo://${o||"untitled"}#cell=${i}`,t[3]=e,t[4]=o,t[5]=l):l=t[5];let n;return t[6]!==e||t[7]!==a||t[8]!==l?(n=(0,v.jsx)(h,{cellId:e,onClick:a,skipScroll:!0,variant:"destructive",className:"traceback-cell-link",formatCellName:l}),t[6]=e,t[7]=a,t[8]=l,t[9]=n):n=t[9],n};function I(r,t,e){let s=A.create(r),o=document.getElementById(s),a=o==null?void 0:o.classList.contains("has-error");return o===null?(D.error(`Cell ${s} not found on page.`),!1):(e||o.scrollIntoView({behavior:"smooth",block:"center"}),(t==="destructive"||a&&t===void 0)&&(o.classList.add("error-outline"),setTimeout(()=>{o.classList.remove("error-outline")},2e3)),(t==="focus"||!a&&t===void 0)&&(o.classList.add("focus-outline"),setTimeout(()=>{o.classList.remove("focus-outline")},2e3)),!0)}function W(r){return r}export{x as a,I as i,K as n,J as o,Q as r,h as t};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./esm-vpVfqVb3.js","./chunk-LvLJmgfZ.js","./dist-Hgde9xRP.js","./dist-BPkOpnKv.js","./dist-BNTOYRCs.js","./dist-VwkX7yeV.js","./dist-DlC_MlJ3.js","./dist-DDiNOVwA.js","./dist-C0ZJnmgG.js","./dist-CxquLoAZ.js","./dist-BZIkwcpM.js","./dist-ByWFdhfz.js","./dist-fPjTlo0F.js","./dist-4lB-oR9j.js","./dist-Dnlw22ji.js","./dist-DjS0QmS_.js","./dist-CHgkfE72.js","./dist-CJDjz8TY.js","./dist-CWLNI6B7.js","./dist-D281cBMB.js","./dist-Dz1-lL07.js","./dist-BYHplnRv.js","./dist-BaQhtL0H.js","./dist-CaQ_ONVt.js","./dist-DW-_Bd4t.js","./dist-BrR2nUId.js","./dist-IBCCX0qd.js","./dist-BvlMLwcr.js","./dist-D797J-u_.js","./dist-04hxiWlB.js","./dist-eH2iPs-V.js","./dist-CgYlATe-.js","./dist-BrK3C3Mc.js","./dist-B1XdVflW.js","./dist-BQuOw7vA.js","./dist-Gx6Yy96j.js","./dist-B6i4q8vX.js","./dist-bOlBcn5A.js","./dist-CQvRfEJt.js","./dist-Yk16cgLk.js","./dist-D_Lhmjyi.js","./dist-umvL589W.js","./apl-CuOurP-c.js","./apl-CArdF_Ee.js","./asciiarmor-C4q0KAuh.js","./asciiarmor-rf6n_8YZ.js","./asn1-gmsDz0li.js","./asn1-Bl4vlAxN.js","./brainfuck-RlYwG6Xx.js","./brainfuck-CWRjg_-2.js","./cobol--NmnvDWE.js","./cobol-B24ofC4q.js","./clike-0Uxq7Mmj.js","./clike-B4xEkWXN.js","./clojure-DaWCBM5I.js","./clojure-04C6o-hL.js","./css-vLkD8PfS.js","./css-C_vknI7E.js","./cmake-Nobmxv0n.js","./cmake-Dh64a3j4.js","./coffeescript-Cv1Wf46X.js","./coffeescript-B0i0O-b-.js","./commonlisp-8PbUodZQ.js","./commonlisp-NXg-Bye5.js","./cypher-Aazxis5r.js","./cypher-DwQoZmH9.js","./python-D-LGD-zO.js","./python-BvK-LeGt.js","./crystal-DOOJCjhq.js","./crystal-BOjNTZjx.js","./d-B-5Jnu40.js","./d-xedQGhmO.js","./diff-8GFZiZ2V.js","./diff-ChFnp8JW.js","./dockerfile-CmMwYXtW.js","./simple-mode-DxeVZov3.js","./dtd-DbhDFQ4b.js","./dtd-KbDPyUs4.js","./dylan-4K5wZgOx.js","./dylan-0KH4Nowk.js","./ecl-BCQ-LzuG.js","./ecl-B5iM_b7s.js","./eiffel-DjgNAio4.js","./eiffel-sVM1STl5.js","./elm-BJzUTgDF.js","./elm-BlNENVB6.js","./erlang-BMwCh1Tz.js","./erlang-C0uOSFok.js","./factor-DuQK79vi.js","./factor-B-0VZGQP.js","./forth-CN0H2hBb.js","./forth-Dkvgp5v0.js","./fortran-D-JaE1fl.js","./fortran-DWGt9NN5.js","./mllike-bIsNpdn1.js","./mllike-WTbu2PGL.js","./gas-B-bID6UX.js","./gas-ucVnXY28.js","./gherkin-JGxOpXhU.js","./gherkin-BRjIORXo.js","./groovy-BHPB9Hfx.js","./groovy-BwyAyRPC.js","./haskell-By6RbCCv.js","./haskell-Cs-Andhs.js","./haxe-HQiVsOCF.js","./haxe-BW46cyaq.js","./idl-B2iocbwq.js","./idl-BGiQ18ct.js","./javascript-CTjlnOSz.js","./javascript-I9_Q-6Fg.js","./julia-BiUkdI9P.js","./julia-Wfay9brY.js","./livescript-uNIpKRlq.js","./livescript-J6EnSQWw.js","./lua-CMIwWFMm.js","./lua-BO_knq_Q.js","./mirc-DA5aApOX.js","./mirc-82uLLidC.js","./mathematica-eDJrChdG.js","./mathematica-DU8ikXHk.js","./modelica-0mx6heI0.js","./modelica-w4uKZrXu.js","./mumps-5_kXgafg.js","./mumps-Bicgf-gh.js","./mbox-zqvBlhy3.js","./mbox-Dzzw6MxI.js","./nsis-DOhuqhNG.js","./nsis-DGDbP9K4.js","./ntriples-BWf6tqTo.js","./ntriples-CyotCBD4.js","./octave-DmFvn7Va.js","./octave-BP7UuRZ-.js","./oz-TIwA1cRs.js","./oz-C9dsRBsA.js","./pascal-BFfHjByI.js","./pascal-Do-HizJs.js","./perl-iyEBGoKl.js","./perl-DkWjygEp.js","./pig-Du8JEd9u.js","./pig-C5cO5Lzu.js","./powershell-rJPOSwVp.js","./powershell-B7iMkhi7.js","./properties-B7p1o35g.js","./properties-BojS2wNP.js","./protobuf-DSVPm4uR.js","./protobuf-C3jQLUT4.js","./pug-BBnJinJ-.js","./pug-5wW7Sn9S.js","./puppet-CvB_7oA0.js","./puppet-BIu7yw7Q.js","./q-s96Dgstm.js","./q-DxTFD_3l.js","./r-DCKN0Q_M.js","./r-D9kMb9Pl.js","./rpm-DKF6hj80.js","./rpm-DMBmptJ_.js","./ruby-DrHWYpO-.js","./ruby-Bi66LQBu.js","./sas-Bf--oEyw.js","./sas-DDMCLlZz.js","./scheme-BZSq5_CL.js","./scheme-MngEI34z.js","./shell-C5LsobAY.js","./shell-BSVgrHzY.js","./sieve-B6cTRfjv.js","./sieve-DvUWNrPv.js","./smalltalk-B-ZeF8oP.js","./smalltalk-CeZ66qpG.js","./sparql-hKgXdTt3.js","./sparql-oFx_t7AO.js","./stylus-MJ5VouuS.js","./stylus-KE-9LQSK.js","./swift-jqL65uqK.js","./swift-A-ZhZWU8.js","./stex-Dn4qnyVB.js","./stex-jWatZkll.js","./verilog-DuexQCyX.js","./verilog-SCT9zECa.js","./tcl-D9FDKTky.js","./tcl-CREXWwrr.js","./textile-Ne1MkNjB.js","./textile-Cj8L4qVJ.js","./toml-Ba1TjbvG.js","./toml-BwSlV2Pt.js","./troff-ClRZFpM8.js","./troff-DWonWT6V.js","./ttcn-JOxk9-wl.js","./ttcn--CHQduBW.js","./ttcn-cfg-D-oWP0t7.js","./ttcn-cfg-Cei3Mnk3.js","./turtle-CfJStbTs.js","./turtle-BaGuNPTf.js","./webidl-DZaOA0mR.js","./webidl-B7LbwCfy.js","./vb-DtMAcbIy.js","./vb-DQgwufRi.js","./vbscript-CUB17r-X.js","./vbscript-B66XhQhu.js","./velocity-Dwo66olV.js","./velocity-D7CxwqhZ.js","./vhdl-Mgyyw75F.js","./vhdl-Bz6d75os.js","./xquery-DpQixCSm.js","./xquery-BOMK2ySj.js","./yacas-B1gHpHXz.js","./yacas-Yk74VuuD.js","./z80-IF9HkI5m.js","./z80-BQKQ7DhX.js","./mscgen-BKLWiiDn.js","./mscgen-Bf7m7BDT.js","./dist-ZzjYvfSN.js","./dist-Dl90TzK0.js","./dist-CsTHFGvB.js","./node-sql-parser-UQ9Ur_LP.js"])))=>i.map(i=>d[i]);
2
- var l6=Object.defineProperty;var c6=(pa,_r,ri)=>_r in pa?l6(pa,_r,{enumerable:!0,configurable:!0,writable:!0,value:ri}):pa[_r]=ri;var ve=(pa,_r,ri)=>c6(pa,typeof _r!="symbol"?_r+"":_r,ri);import{a as u6,n as uw,o as d6,r as f6,s as Ru,t as rt}from"./chunk-LvLJmgfZ.js";import{c as dw,i as Be,l as fw,p as Te,r as p6,s as h6,u as Sn}from"./useEvent-D91BmmQi.js";import{t as Pu}from"./react-Bj1aDYRI.js";import{t as pw}from"./react-dom-CSu739Rf.js";import{B as m6,N as g6,P as hw,R as mw,T as gw,k as y6,w as v6}from"./zod-H_cgTO0M.js";import{t as er}from"./compiler-runtime-B3qBwwSJ.js";import{t as Nh}from"./debounce-BbSyBDA8.js";import{_ as be,d as Rr,f as yw,o as Nu,p as b6}from"./useEventListener-DGjKht0c.js";import{t as rn}from"./invariant-CkiqGLcK.js";import{f as vw,t as bw}from"./utils-8btzWeZg.js";import{S as Mh,r as w6,y as _6}from"./config-Cgj0Ahvb.js";import{n as x6,t as Pr}from"./cn-DYvqRARy.js";import{t as k6}from"./jsx-runtime-Blw4afVn.js";import{C as sa,S as ww,_ as _w,b as tr,f as C6,h as Mu,m as S6,u as E6,v as xw,w as T6,y as I6}from"./fullscreen-k58KVlT-.js";import{l as kw,o as L6}from"./dist-sZgjGm4S.js";import{d as O6}from"./menu-items-Dtw5N98_.js";import{a as A6,c as R6,i as Dh,m as P6,n as N6,o as Cw,r as M6,s as D6,t as j6}from"./select--zcABebs.js";import{i as z6,t as jh}from"./tooltip-DmqhBBs6.js";import{t as Sw}from"./button-BKVLeSTX.js";import{A as q6,At as zh,Bt as $t,C as F6,D as B6,Et as Ew,Ft as Tw,Gt as V6,H as Iw,Ht as xl,I as Lw,J as Du,Jt as la,Kt as Ow,Ot as as,S as H6,St as Ja,T as Aw,U as $6,Ut as Rw,Vt as W6,W as U6,Wt as ju,Xt as Wi,Yt as is,Zt as os,_t as K6,at as Et,b as Pw,ct as Ui,f as Nw,it as Q6,jt as G6,k as J6,l as ne,mt as X6,nt as Mw,ot as Y6,p as Z6,rt as ca,u as Dw,ut as e8,xt as qh,z as jw,zt as zu}from"./dist-VwkX7yeV.js";import{A as t8,E as n8,S as r8,T as a8,_ as i8,b as o8,d as zw,f as s8,h as l8,m as c8,n as u8,o as Fh,p as d8,s as f8,t as p8,u as h8,v as m8,w as g8,x as y8}from"./dist-DZJfxwLb.js";import{a as kl,i as qw,m as Bh,n as v8,r as Fw}from"./arrays-DAC2orgH.js";import{n as nr}from"./once-hq2TLzOp.js";import{t as b8}from"./capabilities-BmGdj50E.js";import{t as w8}from"./cjs-D5tzp-Y6.js";import{t as Cl}from"./createReducer-CYlwteGD.js";import{d as Bw,l as Vw,n as _8,o as Hw,p as x8,r as qu}from"./dist-BNTOYRCs.js";import{t as $w}from"./main-BNL5rxQw.js";import{n as Ww,t as k8}from"./useNonce-CbdaHKzX.js";import{i as ss,r as C8,t as S8}from"./strings-pfr2N700.js";import{t as br}from"./requests-9-v2bhoi.js";import{a as E8,c as T8,d as I8,f as Uw,i as L8,l as O8,n as A8,o as Vh,r as R8,s as Hh,t as P8,u as N8}from"./dist-BPkOpnKv.js";import{t as ut}from"./createLucideIcon-w-Qo9n0R.js";import{a as $h,i as M8,o as D8,r as j8,t as z8}from"./useLifecycle-N3bfh_O1.js";import{t as q8}from"./check-B-sKate2.js";import{t as F8}from"./x-Bv2rCglF.js";import{t as B8,u as V8}from"./toDate-BGIVWsZ9.js";import{t as Wh}from"./database-zap-BxfYZ6ML.js";import{n as H8,t as Sl}from"./DeferredRequestRegistry-BLWK1eKa.js";import{t as Fn}from"./badge-CwbVR_sO.js";import{t as re}from"./preload-helper-D2MJg03u.js";import{a as Kw,s as $8}from"./dist-BvlMLwcr.js";import{a as W8,i as Uh,n as U8,r as Qw,t as K8}from"./dist-CgYlATe-.js";import{n as Q8}from"./stex-jWatZkll.js";import{t as El}from"./use-toast-BDYuj3zG.js";import{n as Kh}from"./paths-BzSgteR-.js";import{n as G8}from"./useTheme-DCDmxPD0.js";import{t as Qh}from"./purify.es-BFDc-_i_.js";let Gh,Jh,Xa,Xh,Gw,Yh,Zh,Jw,Xw,Yw,Zw,e_,t_,n_,Ya,em,r_,Bn,a_,Vn,i_,o_,tm,s_,ls,Tl,Fu,Bu,l_,Vu,Za,Ki,nm,c_,Hu,u_,rm,d_,$u,f_,p_,h_,Wu,m_,ot,am,im,g_,om,Uu,sm,y_,Qi,v_,rr,Il,ua,Ll,b_,lm,Ku,w_,__,x_,k_,C_,S_,E_,T_,Qu,I_,L_,cm,O_,A_,R_,da,P_,um,dm,Ol,fm,ar,Gu,pm,Hn,N_,hm,Ju,Gi,M_,D_,En,j_,z_,Xu,q_,Al,mm,F_,gm,Yu,ym,B_,vm,V_,Zu,bm,H_,$_,Rl,ed,wm,td,Pl,Nr,_m,Nl,cs,nd,W_,Ml,U_,xm,km,rd,Dl,K_,Cm,Sm,Ye,Q_,ad,G_,Ji,J_,X_,fa,Em,Y_,Z_,ex,tx,Tm,Im,nx,Lm,Xi,rx,id,ax,Om,Am,Rm,ix,ox,od,Pm,Nm,sd,mn,sx,Mm,lx,ld,ei,cx,Dm,ux,dx,fx,jm,jl,cd,px,hx,ud,mx,zm,gx,dd,zl,fd,qm,yx,vx,pd,Fm,hd,md,Bm,Vm,Hm,$m,bx,wx,_x,Yi,Wm,xx,us,Um,Km,kx,Qm,ti,gd,Cx,Sx,Gm,Jm,Xm,Ex,Tx,Ym,Ix,yd,Lx,Ox,Zm,Ax,e0,vd,t0,ds,Rx,fs,Px,Nx,ql,Mx,n0,r0,Dx,jx,zx,qx,Fx,Bx,Vx,a0,bd,Hx,$x,wd,_d,i0,wr,Wx,ni,o0,xd,J8=(async()=>{var ur,Of,pi;let pa,_r,ri;pa=rt((e=>{function n(ie,ee){var W=ie.length;ie.push(ee);e:for(;0<W;){var Ie=W-1>>>1,He=ie[Ie];if(0<s(He,ee))ie[Ie]=ee,ie[W]=He,W=Ie;else break e}}function a(ie){return ie.length===0?null:ie[0]}function o(ie){if(ie.length===0)return null;var ee=ie[0],W=ie.pop();if(W!==ee){ie[0]=W;e:for(var Ie=0,He=ie.length,et=He>>>1;Ie<et;){var qe=2*(Ie+1)-1,Ne=ie[qe],Le=qe+1,Me=ie[Le];if(0>s(Ne,W))Le<He&&0>s(Me,Ne)?(ie[Ie]=Me,ie[Le]=W,Ie=Le):(ie[Ie]=Ne,ie[qe]=W,Ie=qe);else if(Le<He&&0>s(Me,W))ie[Ie]=Me,ie[Le]=W,Ie=Le;else break e}}return ee}function s(ie,ee){var W=ie.sortIndex-ee.sortIndex;return W===0?ie.id-ee.id:W}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var p=Date,d=p.now();e.unstable_now=function(){return p.now()-d}}var m=[],b=[],_=1,k=null,S=3,E=!1,L=!1,P=!1,q=!1,V=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function J(ie){for(var ee=a(b);ee!==null;){if(ee.callback===null)o(b);else if(ee.startTime<=ie)o(b),ee.sortIndex=ee.expirationTime,n(m,ee);else break;ee=a(b)}}function le(ie){if(P=!1,J(ie),!L)if(a(m)!==null)L=!0,A||(A=!0,ye());else{var ee=a(b);ee!==null&&ue(le,ee.startTime-ie)}}var A=!1,j=-1,$=5,oe=-1;function de(){return q?!0:!(e.unstable_now()-oe<$)}function he(){if(q=!1,A){var ie=e.unstable_now();oe=ie;var ee=!0;try{e:{L=!1,P&&(P=!1,B(j),j=-1),E=!0;var W=S;try{t:{for(J(ie),k=a(m);k!==null&&!(k.expirationTime>ie&&de());){var Ie=k.callback;if(typeof Ie=="function"){k.callback=null,S=k.priorityLevel;var He=Ie(k.expirationTime<=ie);if(ie=e.unstable_now(),typeof He=="function"){k.callback=He,J(ie),ee=!0;break t}k===a(m)&&o(m),J(ie)}else o(m);k=a(m)}if(k!==null)ee=!0;else{var et=a(b);et!==null&&ue(le,et.startTime-ie),ee=!1}}break e}finally{k=null,S=W,E=!1}ee=void 0}}finally{ee?ye():A=!1}}}var ye;if(typeof M=="function")ye=function(){M(he)};else if(typeof MessageChannel<"u"){var ke=new MessageChannel,we=ke.port2;ke.port1.onmessage=he,ye=function(){we.postMessage(null)}}else ye=function(){V(he,0)};function ue(ie,ee){j=V(function(){ie(e.unstable_now())},ee)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(ie){ie.callback=null},e.unstable_forceFrameRate=function(ie){0>ie||125<ie?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<ie?Math.floor(1e3/ie):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(ie){switch(S){case 1:case 2:case 3:var ee=3;break;default:ee=S}var W=S;S=ee;try{return ie()}finally{S=W}},e.unstable_requestPaint=function(){q=!0},e.unstable_runWithPriority=function(ie,ee){switch(ie){case 1:case 2:case 3:case 4:case 5:break;default:ie=3}var W=S;S=ie;try{return ee()}finally{S=W}},e.unstable_scheduleCallback=function(ie,ee,W){var Ie=e.unstable_now();switch(typeof W=="object"&&W?(W=W.delay,W=typeof W=="number"&&0<W?Ie+W:Ie):W=Ie,ie){case 1:var He=-1;break;case 2:He=250;break;case 5:He=1073741823;break;case 4:He=1e4;break;default:He=5e3}return He=W+He,ie={id:_++,callback:ee,priorityLevel:ie,startTime:W,expirationTime:He,sortIndex:-1},W>Ie?(ie.sortIndex=W,n(b,ie),a(m)===null&&ie===a(b)&&(P?(B(j),j=-1):P=!0,ue(le,W-Ie))):(ie.sortIndex=He,n(m,ie),L||E||(L=!0,A||(A=!0,ye()))),ie},e.unstable_shouldYield=de,e.unstable_wrapCallback=function(ie){var ee=S;return function(){var W=S;S=ee;try{return ie.apply(this,arguments)}finally{S=W}}}})),_r=rt(((e,n)=>{n.exports=pa()})),ri=rt((e=>{var n=_r(),a=Pu(),o=pw();function s(t){var r="https://react.dev/errors/"+t;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)r+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+t+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function p(t){var r=t,i=t;if(t.alternate)for(;r.return;)r=r.return;else{t=r;do r=t,r.flags&4098&&(i=r.return),t=r.return;while(t)}return r.tag===3?i:null}function d(t){if(t.tag===13){var r=t.memoizedState;if(r===null&&(t=t.alternate,t!==null&&(r=t.memoizedState)),r!==null)return r.dehydrated}return null}function m(t){if(t.tag===31){var r=t.memoizedState;if(r===null&&(t=t.alternate,t!==null&&(r=t.memoizedState)),r!==null)return r.dehydrated}return null}function b(t){if(p(t)!==t)throw Error(s(188))}function _(t){var r=t.alternate;if(!r){if(r=p(t),r===null)throw Error(s(188));return r===t?t:null}for(var i=t,l=r;;){var f=i.return;if(f===null)break;var g=f.alternate;if(g===null){if(l=f.return,l!==null){i=l;continue}break}if(f.child===g.child){for(g=f.child;g;){if(g===i)return b(f),t;if(g===l)return b(f),r;g=g.sibling}throw Error(s(188))}if(i.return!==l.return)i=f,l=g;else{for(var C=!1,I=f.child;I;){if(I===i){C=!0,i=f,l=g;break}if(I===l){C=!0,l=f,i=g;break}I=I.sibling}if(!C){for(I=g.child;I;){if(I===i){C=!0,i=g,l=f;break}if(I===l){C=!0,l=g,i=f;break}I=I.sibling}if(!C)throw Error(s(189))}}if(i.alternate!==l)throw Error(s(190))}if(i.tag!==3)throw Error(s(188));return i.stateNode.current===i?t:r}function k(t){var r=t.tag;if(r===5||r===26||r===27||r===6)return t;for(t=t.child;t!==null;){if(r=k(t),r!==null)return r;t=t.sibling}return null}var S=Object.assign,E=Symbol.for("react.element"),L=Symbol.for("react.transitional.element"),P=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),V=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),J=Symbol.for("react.context"),le=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),oe=Symbol.for("react.lazy"),de=Symbol.for("react.activity"),he=Symbol.for("react.memo_cache_sentinel"),ye=Symbol.iterator;function ke(t){return typeof t!="object"||!t?null:(t=ye&&t[ye]||t["@@iterator"],typeof t=="function"?t:null)}var we=Symbol.for("react.client.reference");function ue(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===we?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case q:return"Fragment";case B:return"Profiler";case V:return"StrictMode";case A:return"Suspense";case j:return"SuspenseList";case de:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case P:return"Portal";case J:return t.displayName||"Context";case M:return(t._context.displayName||"Context")+".Consumer";case le:var r=t.render;return t=t.displayName,t||(t=(t=r.displayName||r.name||"",t===""?"ForwardRef":"ForwardRef("+t+")")),t;case $:return r=t.displayName||null,r===null?ue(t.type)||"Memo":r;case oe:r=t._payload,t=t._init;try{return ue(t(r))}catch{}}return null}var ie=Array.isArray,ee=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ie={pending:!1,data:null,method:null,action:null},He=[],et=-1;function qe(t){return{current:t}}function Ne(t){0>et||(t.current=He[et],He[et]=null,et--)}function Le(t,r){et++,He[et]=t.current,t.current=r}var Me=qe(null),Tt=qe(null),Pt=qe(null),wa=qe(null);function yo(t,r){switch(Le(Pt,r),Le(Tt,t),Le(Me,null),r.nodeType){case 9:case 11:t=(t=r.documentElement)&&(t=t.namespaceURI)?D2(t):0;break;default:if(t=r.tagName,r=r.namespaceURI)r=D2(r),t=j2(r,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Ne(Me),Le(Me,t)}function On(){Ne(Me),Ne(Tt),Ne(Pt)}function jr(t){t.memoizedState!==null&&Le(wa,t);var r=Me.current,i=j2(r,t.type);r!==i&&(Le(Tt,t),Le(Me,i))}function hi(t){Tt.current===t&&(Ne(Me),Ne(Tt)),wa.current===t&&(Ne(wa),vl._currentValue=Ie)}var vo,Es;function mt(t){if(vo===void 0)try{throw Error()}catch(i){var r=i.stack.trim().match(/\n( *(at )?)/);vo=r&&r[1]||"",Es=-1<i.stack.indexOf(`
2
+ var l6=Object.defineProperty;var c6=(pa,_r,ri)=>_r in pa?l6(pa,_r,{enumerable:!0,configurable:!0,writable:!0,value:ri}):pa[_r]=ri;var ve=(pa,_r,ri)=>c6(pa,typeof _r!="symbol"?_r+"":_r,ri);import{a as u6,n as uw,o as d6,r as f6,s as Ru,t as rt}from"./chunk-LvLJmgfZ.js";import{c as dw,i as Be,l as fw,p as Te,r as p6,s as h6,u as Sn}from"./useEvent-D91BmmQi.js";import{t as Pu}from"./react-Bj1aDYRI.js";import{t as pw}from"./react-dom-CSu739Rf.js";import{B as m6,N as g6,P as hw,R as mw,T as gw,k as y6,w as v6}from"./zod-H_cgTO0M.js";import{t as er}from"./compiler-runtime-B3qBwwSJ.js";import{t as Nh}from"./debounce-BbSyBDA8.js";import{_ as be,d as Rr,f as yw,o as Nu,p as b6}from"./useEventListener-DGjKht0c.js";import{t as rn}from"./invariant-CkiqGLcK.js";import{f as vw,t as bw}from"./utils-8btzWeZg.js";import{S as Mh,r as w6,y as _6}from"./config-DoZCLcOb.js";import{n as x6,t as Pr}from"./cn-DYvqRARy.js";import{t as k6}from"./jsx-runtime-Blw4afVn.js";import{C as sa,S as ww,_ as _w,b as tr,f as C6,h as Mu,m as S6,u as E6,v as xw,w as T6,y as I6}from"./fullscreen-k58KVlT-.js";import{l as kw,o as L6}from"./dist-sZgjGm4S.js";import{d as O6}from"./menu-items-Dtw5N98_.js";import{a as A6,c as R6,i as Dh,m as P6,n as N6,o as Cw,r as M6,s as D6,t as j6}from"./select--zcABebs.js";import{i as z6,t as jh}from"./tooltip-DmqhBBs6.js";import{t as Sw}from"./button-BKVLeSTX.js";import{A as q6,At as zh,Bt as $t,C as F6,D as B6,Et as Ew,Ft as Tw,Gt as V6,H as Iw,Ht as xl,I as Lw,J as Du,Jt as la,Kt as Ow,Ot as as,S as H6,St as Ja,T as Aw,U as $6,Ut as Rw,Vt as W6,W as U6,Wt as ju,Xt as Wi,Yt as is,Zt as os,_t as K6,at as Et,b as Pw,ct as Ui,f as Nw,it as Q6,jt as G6,k as J6,l as ne,mt as X6,nt as Mw,ot as Y6,p as Z6,rt as ca,u as Dw,ut as e8,xt as qh,z as jw,zt as zu}from"./dist-VwkX7yeV.js";import{A as t8,E as n8,S as r8,T as a8,_ as i8,b as o8,d as zw,f as s8,h as l8,m as c8,n as u8,o as Fh,p as d8,s as f8,t as p8,u as h8,v as m8,w as g8,x as y8}from"./dist-DZJfxwLb.js";import{a as kl,i as qw,m as Bh,n as v8,r as Fw}from"./arrays-DAC2orgH.js";import{n as nr}from"./once-hq2TLzOp.js";import{t as b8}from"./capabilities-BmGdj50E.js";import{t as w8}from"./cjs-D5tzp-Y6.js";import{t as Cl}from"./createReducer-CYlwteGD.js";import{d as Bw,l as Vw,n as _8,o as Hw,p as x8,r as qu}from"./dist-BNTOYRCs.js";import{t as $w}from"./main-BNL5rxQw.js";import{n as Ww,t as k8}from"./useNonce-CbdaHKzX.js";import{i as ss,r as C8,t as S8}from"./strings-pfr2N700.js";import{t as br}from"./requests-9-v2bhoi.js";import{a as E8,c as T8,d as I8,f as Uw,i as L8,l as O8,n as A8,o as Vh,r as R8,s as Hh,t as P8,u as N8}from"./dist-BPkOpnKv.js";import{t as ut}from"./createLucideIcon-w-Qo9n0R.js";import{a as $h,i as M8,o as D8,r as j8,t as z8}from"./useLifecycle-N3bfh_O1.js";import{t as q8}from"./check-B-sKate2.js";import{t as F8}from"./x-Bv2rCglF.js";import{t as B8,u as V8}from"./toDate-BGIVWsZ9.js";import{t as Wh}from"./database-zap-BxfYZ6ML.js";import{n as H8,t as Sl}from"./DeferredRequestRegistry-BLWK1eKa.js";import{t as Fn}from"./badge-CwbVR_sO.js";import{t as re}from"./preload-helper-D2MJg03u.js";import{a as Kw,s as $8}from"./dist-BvlMLwcr.js";import{a as W8,i as Uh,n as U8,r as Qw,t as K8}from"./dist-CgYlATe-.js";import{n as Q8}from"./stex-jWatZkll.js";import{t as El}from"./use-toast-BDYuj3zG.js";import{n as Kh}from"./paths-BzSgteR-.js";import{n as G8}from"./useTheme-DCDmxPD0.js";import{t as Qh}from"./purify.es-BFDc-_i_.js";let Gh,Jh,Xa,Xh,Gw,Yh,Zh,Jw,Xw,Yw,Zw,e_,t_,n_,Ya,em,r_,Bn,a_,Vn,i_,o_,tm,s_,ls,Tl,Fu,Bu,l_,Vu,Za,Ki,nm,c_,Hu,u_,rm,d_,$u,f_,p_,h_,Wu,m_,ot,am,im,g_,om,Uu,sm,y_,Qi,v_,rr,Il,ua,Ll,b_,lm,Ku,w_,__,x_,k_,C_,S_,E_,T_,Qu,I_,L_,cm,O_,A_,R_,da,P_,um,dm,Ol,fm,ar,Gu,pm,Hn,N_,hm,Ju,Gi,M_,D_,En,j_,z_,Xu,q_,Al,mm,F_,gm,Yu,ym,B_,vm,V_,Zu,bm,H_,$_,Rl,ed,wm,td,Pl,Nr,_m,Nl,cs,nd,W_,Ml,U_,xm,km,rd,Dl,K_,Cm,Sm,Ye,Q_,ad,G_,Ji,J_,X_,fa,Em,Y_,Z_,ex,tx,Tm,Im,nx,Lm,Xi,rx,id,ax,Om,Am,Rm,ix,ox,od,Pm,Nm,sd,mn,sx,Mm,lx,ld,ei,cx,Dm,ux,dx,fx,jm,jl,cd,px,hx,ud,mx,zm,gx,dd,zl,fd,qm,yx,vx,pd,Fm,hd,md,Bm,Vm,Hm,$m,bx,wx,_x,Yi,Wm,xx,us,Um,Km,kx,Qm,ti,gd,Cx,Sx,Gm,Jm,Xm,Ex,Tx,Ym,Ix,yd,Lx,Ox,Zm,Ax,e0,vd,t0,ds,Rx,fs,Px,Nx,ql,Mx,n0,r0,Dx,jx,zx,qx,Fx,Bx,Vx,a0,bd,Hx,$x,wd,_d,i0,wr,Wx,ni,o0,xd,J8=(async()=>{var ur,Of,pi;let pa,_r,ri;pa=rt((e=>{function n(ie,ee){var W=ie.length;ie.push(ee);e:for(;0<W;){var Ie=W-1>>>1,He=ie[Ie];if(0<s(He,ee))ie[Ie]=ee,ie[W]=He,W=Ie;else break e}}function a(ie){return ie.length===0?null:ie[0]}function o(ie){if(ie.length===0)return null;var ee=ie[0],W=ie.pop();if(W!==ee){ie[0]=W;e:for(var Ie=0,He=ie.length,et=He>>>1;Ie<et;){var qe=2*(Ie+1)-1,Ne=ie[qe],Le=qe+1,Me=ie[Le];if(0>s(Ne,W))Le<He&&0>s(Me,Ne)?(ie[Ie]=Me,ie[Le]=W,Ie=Le):(ie[Ie]=Ne,ie[qe]=W,Ie=qe);else if(Le<He&&0>s(Me,W))ie[Ie]=Me,ie[Le]=W,Ie=Le;else break e}}return ee}function s(ie,ee){var W=ie.sortIndex-ee.sortIndex;return W===0?ie.id-ee.id:W}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var p=Date,d=p.now();e.unstable_now=function(){return p.now()-d}}var m=[],b=[],_=1,k=null,S=3,E=!1,L=!1,P=!1,q=!1,V=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function J(ie){for(var ee=a(b);ee!==null;){if(ee.callback===null)o(b);else if(ee.startTime<=ie)o(b),ee.sortIndex=ee.expirationTime,n(m,ee);else break;ee=a(b)}}function le(ie){if(P=!1,J(ie),!L)if(a(m)!==null)L=!0,A||(A=!0,ye());else{var ee=a(b);ee!==null&&ue(le,ee.startTime-ie)}}var A=!1,j=-1,$=5,oe=-1;function de(){return q?!0:!(e.unstable_now()-oe<$)}function he(){if(q=!1,A){var ie=e.unstable_now();oe=ie;var ee=!0;try{e:{L=!1,P&&(P=!1,B(j),j=-1),E=!0;var W=S;try{t:{for(J(ie),k=a(m);k!==null&&!(k.expirationTime>ie&&de());){var Ie=k.callback;if(typeof Ie=="function"){k.callback=null,S=k.priorityLevel;var He=Ie(k.expirationTime<=ie);if(ie=e.unstable_now(),typeof He=="function"){k.callback=He,J(ie),ee=!0;break t}k===a(m)&&o(m),J(ie)}else o(m);k=a(m)}if(k!==null)ee=!0;else{var et=a(b);et!==null&&ue(le,et.startTime-ie),ee=!1}}break e}finally{k=null,S=W,E=!1}ee=void 0}}finally{ee?ye():A=!1}}}var ye;if(typeof M=="function")ye=function(){M(he)};else if(typeof MessageChannel<"u"){var ke=new MessageChannel,we=ke.port2;ke.port1.onmessage=he,ye=function(){we.postMessage(null)}}else ye=function(){V(he,0)};function ue(ie,ee){j=V(function(){ie(e.unstable_now())},ee)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(ie){ie.callback=null},e.unstable_forceFrameRate=function(ie){0>ie||125<ie?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<ie?Math.floor(1e3/ie):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(ie){switch(S){case 1:case 2:case 3:var ee=3;break;default:ee=S}var W=S;S=ee;try{return ie()}finally{S=W}},e.unstable_requestPaint=function(){q=!0},e.unstable_runWithPriority=function(ie,ee){switch(ie){case 1:case 2:case 3:case 4:case 5:break;default:ie=3}var W=S;S=ie;try{return ee()}finally{S=W}},e.unstable_scheduleCallback=function(ie,ee,W){var Ie=e.unstable_now();switch(typeof W=="object"&&W?(W=W.delay,W=typeof W=="number"&&0<W?Ie+W:Ie):W=Ie,ie){case 1:var He=-1;break;case 2:He=250;break;case 5:He=1073741823;break;case 4:He=1e4;break;default:He=5e3}return He=W+He,ie={id:_++,callback:ee,priorityLevel:ie,startTime:W,expirationTime:He,sortIndex:-1},W>Ie?(ie.sortIndex=W,n(b,ie),a(m)===null&&ie===a(b)&&(P?(B(j),j=-1):P=!0,ue(le,W-Ie))):(ie.sortIndex=He,n(m,ie),L||E||(L=!0,A||(A=!0,ye()))),ie},e.unstable_shouldYield=de,e.unstable_wrapCallback=function(ie){var ee=S;return function(){var W=S;S=ee;try{return ie.apply(this,arguments)}finally{S=W}}}})),_r=rt(((e,n)=>{n.exports=pa()})),ri=rt((e=>{var n=_r(),a=Pu(),o=pw();function s(t){var r="https://react.dev/errors/"+t;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)r+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+t+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function p(t){var r=t,i=t;if(t.alternate)for(;r.return;)r=r.return;else{t=r;do r=t,r.flags&4098&&(i=r.return),t=r.return;while(t)}return r.tag===3?i:null}function d(t){if(t.tag===13){var r=t.memoizedState;if(r===null&&(t=t.alternate,t!==null&&(r=t.memoizedState)),r!==null)return r.dehydrated}return null}function m(t){if(t.tag===31){var r=t.memoizedState;if(r===null&&(t=t.alternate,t!==null&&(r=t.memoizedState)),r!==null)return r.dehydrated}return null}function b(t){if(p(t)!==t)throw Error(s(188))}function _(t){var r=t.alternate;if(!r){if(r=p(t),r===null)throw Error(s(188));return r===t?t:null}for(var i=t,l=r;;){var f=i.return;if(f===null)break;var g=f.alternate;if(g===null){if(l=f.return,l!==null){i=l;continue}break}if(f.child===g.child){for(g=f.child;g;){if(g===i)return b(f),t;if(g===l)return b(f),r;g=g.sibling}throw Error(s(188))}if(i.return!==l.return)i=f,l=g;else{for(var C=!1,I=f.child;I;){if(I===i){C=!0,i=f,l=g;break}if(I===l){C=!0,l=f,i=g;break}I=I.sibling}if(!C){for(I=g.child;I;){if(I===i){C=!0,i=g,l=f;break}if(I===l){C=!0,l=g,i=f;break}I=I.sibling}if(!C)throw Error(s(189))}}if(i.alternate!==l)throw Error(s(190))}if(i.tag!==3)throw Error(s(188));return i.stateNode.current===i?t:r}function k(t){var r=t.tag;if(r===5||r===26||r===27||r===6)return t;for(t=t.child;t!==null;){if(r=k(t),r!==null)return r;t=t.sibling}return null}var S=Object.assign,E=Symbol.for("react.element"),L=Symbol.for("react.transitional.element"),P=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),V=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),J=Symbol.for("react.context"),le=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),oe=Symbol.for("react.lazy"),de=Symbol.for("react.activity"),he=Symbol.for("react.memo_cache_sentinel"),ye=Symbol.iterator;function ke(t){return typeof t!="object"||!t?null:(t=ye&&t[ye]||t["@@iterator"],typeof t=="function"?t:null)}var we=Symbol.for("react.client.reference");function ue(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===we?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case q:return"Fragment";case B:return"Profiler";case V:return"StrictMode";case A:return"Suspense";case j:return"SuspenseList";case de:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case P:return"Portal";case J:return t.displayName||"Context";case M:return(t._context.displayName||"Context")+".Consumer";case le:var r=t.render;return t=t.displayName,t||(t=(t=r.displayName||r.name||"",t===""?"ForwardRef":"ForwardRef("+t+")")),t;case $:return r=t.displayName||null,r===null?ue(t.type)||"Memo":r;case oe:r=t._payload,t=t._init;try{return ue(t(r))}catch{}}return null}var ie=Array.isArray,ee=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ie={pending:!1,data:null,method:null,action:null},He=[],et=-1;function qe(t){return{current:t}}function Ne(t){0>et||(t.current=He[et],He[et]=null,et--)}function Le(t,r){et++,He[et]=t.current,t.current=r}var Me=qe(null),Tt=qe(null),Pt=qe(null),wa=qe(null);function yo(t,r){switch(Le(Pt,r),Le(Tt,t),Le(Me,null),r.nodeType){case 9:case 11:t=(t=r.documentElement)&&(t=t.namespaceURI)?D2(t):0;break;default:if(t=r.tagName,r=r.namespaceURI)r=D2(r),t=j2(r,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Ne(Me),Le(Me,t)}function On(){Ne(Me),Ne(Tt),Ne(Pt)}function jr(t){t.memoizedState!==null&&Le(wa,t);var r=Me.current,i=j2(r,t.type);r!==i&&(Le(Tt,t),Le(Me,i))}function hi(t){Tt.current===t&&(Ne(Me),Ne(Tt)),wa.current===t&&(Ne(wa),vl._currentValue=Ie)}var vo,Es;function mt(t){if(vo===void 0)try{throw Error()}catch(i){var r=i.stack.trim().match(/\n( *(at )?)/);vo=r&&r[1]||"",Es=-1<i.stack.indexOf(`
3
3
  at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
4
4
  `+vo+t+Es}var Ts=!1;function yn(t,r){if(!t||Ts)return"";Ts=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(r){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(ae){var Z=ae}Reflect.construct(t,[],fe)}else{try{fe.call()}catch(ae){Z=ae}t.call(fe.prototype)}}else{try{throw Error()}catch(ae){Z=ae}(fe=t())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(ae){if(ae&&Z&&typeof ae.stack=="string")return[ae.stack,Z.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=l.DetermineComponentFrameRoot(),C=g[0],I=g[1];if(C&&I){var F=C.split(`
5
5
  `),X=I.split(`
@@ -125,7 +125,7 @@ mark line col
125
125
  `)}},ve(pi,"ESCAPE_REGEX",/\u001B\[([0-9;]*)([A-DJKH])/u),pi),N1=class{constructor(){ve(this,"ESC_REGEX",/\u001B(?:\[[0-9;]*[A-Za-z]|\([0-9A-Za-z])/gu)}parse(e){let n=[],a=0;for(let o of e.matchAll(this.ESC_REGEX)){let s=o.index??0;s>a&&n.push({type:"text",value:e.slice(a,s)}),n.push({type:"escape",value:o[0]}),a=s+o[0].length}return a<e.length&&n.push({type:"text",value:e.slice(a)}),n}},Ef=class{constructor(){ve(this,"parser",new N1);ve(this,"buffer",new Sf)}reduce(e){return this.reset(),this.append(e),this.render()}append(e){let n=this.parser.parse(e);if(n.length===1&&n[0].type==="text"){let a=n[0].value;if(!this.hasControlChars(a)){this.buffer.writeString(a);return}}for(let a of n)a.type==="text"?this.processText(a.value):this.buffer.handleEscape(a.value)}reset(){this.buffer=new Sf}render(){return this.buffer.render()}hasControlChars(e){for(let n of e)if(n<" ")return!0;return!1}processText(e){let n=0,a=e.length;for(let o=0;o<a;o++){let s=e[o];if(s===`
126
126
  `||s==="\r"||s===" "||s==="\b"||s==="\v"){if(o>n){let c=e.slice(n,o),p=this.filterControlChars(c);p.length>0&&this.buffer.writeString(p)}this.buffer.control(s),n=o+1}else if(s<" "){if(o>n){let c=e.slice(n,o);c.length>0&&this.buffer.writeString(c)}n=o+1}}if(n<a){let o=e.slice(n),s=this.filterControlChars(o);s.length>0&&this.buffer.writeString(s)}}filterControlChars(e){let n=!1;for(let o of e)if(o<" "){n=!0;break}if(!n)return e;let a="";for(let o of e)o>=" "&&(a+=o);return a}},_s=class s0{constructor(n,a,o,s){ve(this,"ansiReducer",new Ef);this.mimetype=n,this.channel=a,this.timestamp=o,this.ansiReducer=s,this._data=this.ansiReducer.render()}get data(){return this._data}static create(n){let a=new Ef;return a.append(n.data),new s0(n.mimetype,n.channel,n.timestamp,a)}appendData(n){return this.ansiReducer.append(n),new s0(this.mimetype,this.channel,this.timestamp,this.ansiReducer)}toJSON(){return{mimetype:this.mimetype,channel:this.channel,timestamp:this.timestamp,data:this.data}}};function X4(e,n=5e3){let a=[...e];if(a.length<2)return D1(a.map(Z4),n);let o=a[a.length-1],s=a[a.length-2];return Y4(o,s)&&(M1(o),M1(s),a[a.length-2]=eT(s,o),a.pop()),D1(a,n)}function Y4(e,n){let a=e.mimetype==="text/plain"&&n.mimetype==="text/plain";if(!a)return!1;let o=e.channel===n.channel,s=e.channel!=="stdin";return a&&o&&s}function Z4(e){return e instanceof _s?e:typeof e.data=="string"?_s.create(e):e}function eT(e,n){return e instanceof _s?e.appendData(n.data):_s.create(e).appendData(n.data)}function M1(e){rn(typeof e.data=="string","expected string output")}function D1(e,n){let a=0,o;for(o=e.length-1;o>=0&&a<n;o--){let d=e[o];d.mimetype==="text/plain"?(rn(typeof d.data=="string","expected string"),a+=d.data.split(`
127
127
  `).length):a++}if(a<n)return e;let s=o+1,c={channel:"stderr",mimetype:"text/html",data:`<pre>Streaming output truncated to last ${n} lines.
128
- </pre>`,timestamp:-1},p=e[s];if(p.mimetype==="text/plain"){rn(typeof p.data=="string","expected string");let d=p.data.split(`
128
+ </pre>`,timestamp:-1},p=e[s];if(p==null)return[c,...e.slice(s+1)];if(p.mimetype==="text/plain"){rn(typeof p.data=="string","expected string");let d=p.data.split(`
129
129
  `),m=n-(a-d.length);return[c,{...p,data:d.slice(-m).join(`
130
130
  `)},...e.slice(s+1)]}return[c,...e.slice(s+1)]}function tT(e,n){let a={...e};switch(n.status){case"queued":a.interrupted=!1,a.errored=!1,a.runElapsedTimeMs=null,a.debuggerActive=!1;break;case"running":a.interrupted=!1,e.stopped&&(a.output=null),a.status==="queued"&&(a.consoleOutputs=[]),a.stopped=!1,a.runStartTimestamp=n.timestamp,a.lastRunStartTimestamp=n.timestamp;break;case"idle":e.runStartTimestamp&&(a.runElapsedTimeMs=Im.fromSeconds((n.timestamp??0)-e.runStartTimestamp).toMilliseconds(),a.runStartTimestamp=null,a.staleInputs=!1),!e.lastRunStartTimestamp&&n.timestamp&&(a.lastRunStartTimestamp=n.timestamp),a.debuggerActive=!1;break;case null:break;case"disabled-transitively":break;case void 0:break;default:ss(n.status)}a.output=n.output??a.output,a.staleInputs=n.stale_inputs??a.staleInputs,a.status=n.status??a.status,a.serialization=n.serialization;let o=!1;n.output!=null&&n.output.mimetype==="application/vnd.marimo+error"&&((a.status==="queued"||a.status==="running")&&(a.status="idle"),rn(Array.isArray(n.output.data),"Expected error output data to be an array"),n.output.data.some(d=>d.type==="interruption")?(a.interrupted=!0,o=!0):n.output.data.some(d=>d.type.includes("ancestor"))?a.stopped=!0:a.errored=!0);let s=e.consoleOutputs;o&&(a.debuggerActive=!1,s=s.map(d=>d.channel==="stdin"?{...d,response:d.response??""}:d));let c=n.console;c!=null&&(s=X4(Array.isArray(c)?c:[...s,c])),a.consoleOutputs=s,a.outline=km(a.output);let p=[n.console].flat().filter(Boolean).filter(d=>d.channel==="pdb");return p.length>0&&p.some(d=>d.data==="start")&&(a.debuggerActive=!0),a}function nT(e){let n={...e};return e.status!=="disabled-transitively"&&(n.status="queued"),n.interrupted=!1,n.errored=!1,n.runElapsedTimeMs=null,n.debuggerActive=!1,n}qm=function(e){return e==="running"||e==="queued"},Px=function(e,n){let{status:a,output:o,runStartTimestamp:s,interrupted:c,staleInputs:p}=e;if(c)return!1;if(n)return!0;let d=qm(a),m=a==="running"&&o!==null&&s!==null&&(o.timestamp??0)>s;return d&&!m?!0:p},ux=function(){let e=Be.get(Sm);return Vu(e,"internal-error: initial mode not found"),rn(e!=="present","internal-error: initial mode cannot be 'present'"),e},Lx=function(e){return e==="read"||e==="home"||e==="gallery"?e:e==="edit"?"present":"edit"},Y_=Te({mode:bw()?"read":"not-set",cellAnchor:null}),Sm=Te(void 0),Wm=Te(!1);function xs(e,n){if(!e){be.warn("getCell: cellId is undefined");return}let a=n.cellData[e];if(!a){be.warn(`getCell: cell ${e} not found in state`);return}return a}function j1(e,n){let a=n.cellIds.inOrderIds,o=a.indexOf(e);if(o>0)return{after:a[o-1]};if(o===0&&a.length>1)return{before:a[1]}}function z1(e){let n=new Map,a=e.cellIds.getColumns();for(let[o,s]of a.entries())for(let c of s.inOrderIds)n.set(c,o);return n}function mo(e,n){let a=new Set(e.cellIds.inOrderIds),o=[];for(let s of n.cellIds.inOrderIds)if(!a.has(s)){let c=xs(s,n);c&&o.push({type:"create-cell",cellId:c.id,code:c.code,name:c.name,config:c.config,...j1(c.id,n)})}return o}function rT(e,n){let a=new Set(n.cellIds.inOrderIds),o=[];for(let s of e.cellIds.inOrderIds)a.has(s)||o.push({type:"delete-cell",cellId:s});return o}function lc(e,n){let a=z1(e),o=z1(n),s=[];for(let[c,p]of o)a.get(c)!==p&&s.push({type:"set-config",cellId:c,column:p});return s.push({type:"reorder-cells",cellIds:n.cellIds.inOrderIds}),s}function aT(e,n,a){switch(a.type){case"createNewCell":return mo(e,n);case"deleteCell":return[{type:"delete-cell",cellId:a.payload.cellId}];case"moveCell":case"sendToTop":case"sendToBottom":{let{cellId:o}=a.payload;return[{type:"move-cell",cellId:o,...j1(o,n)}]}case"dropCellOverCell":case"dropCellOverColumn":return lc(e,n);case"updateCellCode":{let o=xs(a.payload.cellId,n);return o?[{type:"set-code",cellId:o.id,code:o.code}]:[]}case"updateCellName":{let o=xs(a.payload.cellId,n);return o?[{type:"set-name",cellId:o.id,name:o.name}]:[]}case"updateCellConfig":{let{cellId:o,config:s}=a.payload;return[{type:"set-config",cellId:o,...s.hide_code!=null&&{hideCode:s.hide_code},...s.disabled!=null&&{disabled:s.disabled},...s.column!=null&&{column:s.column}}]}case"dropOverNewColumn":case"moveColumn":case"addColumnBreakpoint":case"deleteColumn":case"mergeAllColumns":case"compactColumns":return lc(e,n);case"addColumn":return[...mo(e,n),...lc(e,n)];case"undoDeleteCell":{let o=mo(e,n),s=lc(e,n);return s.length>1?[...o,...s]:o}case"splitCell":{let{cellId:o}=a.payload,s=xs(o,n);return s?[{type:"set-code",cellId:o,code:s.code},...mo(e,n)]:[]}case"undoSplitCell":{let{cellId:o}=a.payload,s=xs(o,n);return s?[{type:"set-code",cellId:o,code:s.code},...rT(e,n)]:[]}case"moveToNextCell":return mo(e,n);case"addSetupCellIfDoesntExist":return mo(e,n);case"focusCell":case"focusTopCell":case"focusBottomCell":case"scrollToTarget":case"showCellIfHidden":case"markTouched":case"markUntouched":return[];case"prepareForRun":case"handleCellMessage":case"setCellIds":case"setCellCodes":case"setCells":case"setStdinResponse":case"clearSerializedEditorState":case"clearCellOutput":case"clearCellConsoleOutput":case"clearAllCellOutputs":case"clearLogs":return[];case"foldAll":case"unfoldAll":case"collapseCell":case"expandCell":case"collapseAllCells":case"expandAllCells":return[];default:C8(a)}}function iT(e){let n=new Set,a=new Set;for(let o of e)o.type==="create-cell"?n.add(o.cellId):o.type==="delete-cell"&&a.add(o.cellId);return n.intersection(a)}function oT(e,n){var o,s,c;let a=[];for(let p of e)switch(p.type){case"create-cell":{let d="__end__",m=!1;p.after?(d=p.after,m=!1):p.before&&(d=p.before,m=!0),a.push({type:"createNewCell",payload:{cellId:d,before:m,code:p.code,newCellId:p.cellId,autoFocus:!1,hideCode:((o=p.config)==null?void 0:o.hide_code)??!1}}),p.name&&a.push({type:"updateCellName",payload:{cellId:p.cellId,name:p.name}}),(((s=p.config)==null?void 0:s.disabled)!=null||((c=p.config)==null?void 0:c.column)!=null)&&a.push({type:"updateCellConfig",payload:{cellId:p.cellId,config:{...p.config.disabled!=null&&{disabled:p.config.disabled},...p.config.column!=null&&{column:p.config.column}}}});break}case"delete-cell":a.push({type:"deleteCell",payload:{cellId:p.cellId}});break;case"move-cell":{let d=[...n()],m=p.cellId,b=d.indexOf(m);if(b<0)break;if(d.splice(b,1),p.after){let _=d.indexOf(p.after);_>=0?d.splice(_+1,0,m):d.push(m)}else if(p.before){let _=d.indexOf(p.before);_>=0?d.splice(_,0,m):d.unshift(m)}else d.push(m);a.push({type:"setCellIds",payload:{cellIds:d}});break}case"reorder-cells":a.push({type:"setCellIds",payload:{cellIds:p.cellIds}});break;case"set-code":a.push({type:"setCellCodes",payload:{ids:[p.cellId],codes:[p.code],codeIsStale:!0}});break;case"set-name":a.push({type:"updateCellName",payload:{cellId:p.cellId,name:p.name}});break;case"set-config":a.push({type:"updateCellConfig",payload:{cellId:p.cellId,config:{...p.hideCode!=null&&{hide_code:p.hideCode},...p.disabled!=null&&{disabled:p.disabled},...p.column!=null&&{column:p.column}}}});break}return a}var cc=[],sT=Nh(()=>{if(cc.length===0)return;let e=cc;cc=[],br().sendDocumentTransaction({changes:e})},400);function lT(e){return"cellId"in e&&e.cellId==="__scratch__"}function cT(e){Be.get(Wm)||lT(e)||(cc.push(e),sT())}function uT(e,n,a){for(let o of aT(e,n,a))cT(o)}Ex=function(e,n,a){let o=iT(e);for(let s of e)if(!(o.size>0&&"cellId"in s&&o.has(s.cellId)))for(let c of oT([s],a))n[c.type](c.payload)};function dT(e,n){return B8(e*1e3,n==null?void 0:n.in)}var Tf=function(e,n){return Object.defineProperty?Object.defineProperty(e,"raw",{value:n}):e.raw=n,e},ht;(function(e){e[e.EOS=0]="EOS",e[e.Text=1]="Text",e[e.Incomplete=2]="Incomplete",e[e.ESC=3]="ESC",e[e.Unknown=4]="Unknown",e[e.SGR=5]="SGR",e[e.OSCURL=6]="OSCURL"})(ht||(ht={})),$m=class{constructor(){this.VERSION="6.0.6",this.setup_palettes(),this._use_classes=!1,this.bold=!1,this.faint=!1,this.italic=!1,this.underline=!1,this.fg=this.bg=null,this._buffer="",this._url_allowlist={http:1,https:1},this._escape_html=!0,this.boldStyle="font-weight:bold",this.faintStyle="opacity:0.7",this.italicStyle="font-style:italic",this.underlineStyle="text-decoration:underline"}set use_classes(e){this._use_classes=e}get use_classes(){return this._use_classes}set url_allowlist(e){this._url_allowlist=e}get url_allowlist(){return this._url_allowlist}set escape_html(e){this._escape_html=e}get escape_html(){return this._escape_html}set boldStyle(e){this._boldStyle=e}get boldStyle(){return this._boldStyle}set faintStyle(e){this._faintStyle=e}get faintStyle(){return this._faintStyle}set italicStyle(e){this._italicStyle=e}get italicStyle(){return this._italicStyle}set underlineStyle(e){this._underlineStyle=e}get underlineStyle(){return this._underlineStyle}setup_palettes(){this.ansi_colors=[[{rgb:[0,0,0],class_name:"ansi-black"},{rgb:[187,0,0],class_name:"ansi-red"},{rgb:[0,187,0],class_name:"ansi-green"},{rgb:[187,187,0],class_name:"ansi-yellow"},{rgb:[0,0,187],class_name:"ansi-blue"},{rgb:[187,0,187],class_name:"ansi-magenta"},{rgb:[0,187,187],class_name:"ansi-cyan"},{rgb:[255,255,255],class_name:"ansi-white"}],[{rgb:[85,85,85],class_name:"ansi-bright-black"},{rgb:[255,85,85],class_name:"ansi-bright-red"},{rgb:[0,255,0],class_name:"ansi-bright-green"},{rgb:[255,255,85],class_name:"ansi-bright-yellow"},{rgb:[85,85,255],class_name:"ansi-bright-blue"},{rgb:[255,85,255],class_name:"ansi-bright-magenta"},{rgb:[85,255,255],class_name:"ansi-bright-cyan"},{rgb:[255,255,255],class_name:"ansi-bright-white"}]],this.palette_256=[],this.ansi_colors.forEach(a=>{a.forEach(o=>{this.palette_256.push(o)})});let e=[0,95,135,175,215,255];for(let a=0;a<6;++a)for(let o=0;o<6;++o)for(let s=0;s<6;++s){let c={rgb:[e[a],e[o],e[s]],class_name:"truecolor"};this.palette_256.push(c)}let n=8;for(let a=0;a<24;++a,n+=10){let o={rgb:[n,n,n],class_name:"truecolor"};this.palette_256.push(o)}}escape_txt_for_html(e){return this._escape_html?e.replace(/[&<>"']/gm,n=>{if(n==="&")return"&amp;";if(n==="<")return"&lt;";if(n===">")return"&gt;";if(n==='"')return"&quot;";if(n==="'")return"&#x27;"}):e}append_buffer(e){this._buffer+=e}get_next_packet(){var e={kind:ht.EOS,text:"",url:""},n=this._buffer.length;if(n==0)return e;var a=this._buffer.indexOf("\x1B");if(a==-1)return e.kind=ht.Text,e.text=this._buffer,this._buffer="",e;if(a>0)return e.kind=ht.Text,e.text=this._buffer.slice(0,a),this._buffer=this._buffer.slice(a),e;if(a==0){if(n<3)return e.kind=ht.Incomplete,e;var o=this._buffer.charAt(1);if(o!="["&&o!="]"&&o!="(")return e.kind=ht.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;if(o=="["){this._csi_regex||(this._csi_regex=q1(pT||(pT=Tf([`
131
131
  ^ # beginning of line
@@ -226,4 +226,4 @@ mark line col
226
226
  )
227
227
  `]))));let c=this._buffer.match(this._osc_regex);if(c===null)return e.kind=ht.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;e.kind=ht.OSCURL,e.url=c[1],e.text=c[2];var s=c[0].length;return this._buffer=this._buffer.slice(s),e}else if(o=="(")return e.kind=ht.Unknown,this._buffer=this._buffer.slice(3),e}}ansi_to_html(e){this.append_buffer(e);for(var n=[];;){var a=this.get_next_packet();if(a.kind==ht.EOS||a.kind==ht.Incomplete)break;a.kind==ht.ESC||a.kind==ht.Unknown||(a.kind==ht.Text?n.push(this.transform_to_html(this.with_state(a))):a.kind==ht.SGR?this.process_ansi(a):a.kind==ht.OSCURL&&n.push(this.process_hyperlink(a)))}return n.join("")}with_state(e){return{bold:this.bold,faint:this.faint,italic:this.italic,underline:this.underline,fg:this.fg,bg:this.bg,text:e.text}}process_ansi(e){let n=e.text.split(";");for(;n.length>0;){let a=n.shift(),o=parseInt(a,10);if(isNaN(o)||o===0)this.fg=null,this.bg=null,this.bold=!1,this.faint=!1,this.italic=!1,this.underline=!1;else if(o===1)this.bold=!0;else if(o===2)this.faint=!0;else if(o===3)this.italic=!0;else if(o===4)this.underline=!0;else if(o===21)this.bold=!1;else if(o===22)this.faint=!1,this.bold=!1;else if(o===23)this.italic=!1;else if(o===24)this.underline=!1;else if(o===39)this.fg=null;else if(o===49)this.bg=null;else if(o>=30&&o<38)this.fg=this.ansi_colors[0][o-30];else if(o>=40&&o<48)this.bg=this.ansi_colors[0][o-40];else if(o>=90&&o<98)this.fg=this.ansi_colors[1][o-90];else if(o>=100&&o<108)this.bg=this.ansi_colors[1][o-100];else if((o===38||o===48)&&n.length>0){let s=o===38,c=n.shift();if(c==="5"&&n.length>0){let p=parseInt(n.shift(),10);p>=0&&p<=255&&(s?this.fg=this.palette_256[p]:this.bg=this.palette_256[p])}if(c==="2"&&n.length>2){let p=parseInt(n.shift(),10),d=parseInt(n.shift(),10),m=parseInt(n.shift(),10);if(p>=0&&p<=255&&d>=0&&d<=255&&m>=0&&m<=255){let b={rgb:[p,d,m],class_name:"truecolor"};s?this.fg=b:this.bg=b}}}}}transform_to_html(e){let n=e.text;if(n.length===0||(n=this.escape_txt_for_html(n),!e.bold&&!e.italic&&!e.faint&&!e.underline&&e.fg===null&&e.bg===null))return n;let a=[],o=[],s=e.fg,c=e.bg;e.bold&&a.push(this._boldStyle),e.faint&&a.push(this._faintStyle),e.italic&&a.push(this._italicStyle),e.underline&&a.push(this._underlineStyle),this._use_classes?(s&&(s.class_name==="truecolor"?a.push(`color:rgb(${s.rgb.join(",")})`):o.push(`${s.class_name}-fg`)),c&&(c.class_name==="truecolor"?a.push(`background-color:rgb(${c.rgb.join(",")})`):o.push(`${c.class_name}-bg`))):(s&&a.push(`color:rgb(${s.rgb.join(",")})`),c&&a.push(`background-color:rgb(${c.rgb})`));let p="",d="";return o.length&&(p=` class="${o.join(" ")}"`),a.length&&(d=` style="${a.join(";")}"`),`<span${d}${p}>${n}</span>`}process_hyperlink(e){let n=e.url.split(":");return n.length<1||!this._url_allowlist[n[0]]?"":`<a href="${this.escape_txt_for_html(e.url)}">${this.escape_txt_for_html(e.text)}</a>`}};function q1(e,...n){let a=e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm,"");return new RegExp(a)}function fT(e,...n){let a=e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm,"");return new RegExp(a,"g")}var pT,hT,mT,gT=new $m;vd=function(e){try{let n=document.createElement("div");return n.innerHTML=e,(n.textContent||n.innerText||"").split(`
228
228
  `).map(a=>a.trimEnd()).join(`
229
- `)}catch(n){return be.error("Error parsing HTML content:",n),e}},rx=function(e){if(!e)return"";try{return vd(gT.ansi_to_html(e))}catch(n){return be.error("Error converting ANSI to plain text:",n),e}},Gh=Te(null);let fi;fi=er(),H_=bk,um=_e.forwardRef((e,n)=>{let a=(0,fi.c)(9),o,s;a[0]===e?(o=a[1],s=a[2]):({className:o,...s}=e,a[0]=e,a[1]=o,a[2]=s);let c;a[3]===o?c=a[4]:(c=Pr("fixed top-0 z-100 flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:w-fit md:max-w-[420px]",o),a[3]=o,a[4]=c);let p;return a[5]!==s||a[6]!==n||a[7]!==c?(p=(0,N.jsx)(P0,{ref:n,className:c,...s}),a[5]=s,a[6]=n,a[7]=c,a[8]=p):p=a[8],p}),um.displayName=P0.displayName;let F1;F1=x6("data-[swipe=move]:transition-none group relative pointer-events-auto flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=move]:translate-x-(--radix-toast-swipe-move-x) data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-(--radix-toast-swipe-end-x) data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=open]:slide-in-from-top-full sm:data-[state=open]:slide-in-from-bottom-full data-[state=closed]:slide-out-to-right-full",{variants:{variant:{default:"bg-background border",danger:"group destructive text-error border-destructive bg-(--red-1) shadow-md-solid shadow-error"}},defaultVariants:{variant:"default"}}),Qm=_e.forwardRef((e,n)=>{let a=(0,fi.c)(11),o,s,c;a[0]===e?(o=a[1],s=a[2],c=a[3]):({className:o,variant:c,...s}=e,a[0]=e,a[1]=o,a[2]=s,a[3]=c);let p=c||"default",d;a[4]!==o||a[5]!==p?(d=Pr(F1({variant:p}),"print:hidden",o),a[4]=o,a[5]=p,a[6]=d):d=a[6];let m;return a[7]!==s||a[8]!==n||a[9]!==d?(m=(0,N.jsx)(N0,{ref:n,className:d,...s}),a[7]=s,a[8]=n,a[9]=d,a[10]=m):m=a[10],m}),Qm.displayName=N0.displayName;var B1=_e.forwardRef((e,n)=>{let a=(0,fi.c)(9),o,s;a[0]===e?(o=a[1],s=a[2]):({className:o,...s}=e,a[0]=e,a[1]=o,a[2]=s);let c;a[3]===o?c=a[4]:(c=Pr("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-destructive/30 hover:group-[.destructive]:border-destructive/30 hover:group-[.destructive]:bg-destructive hover:group-[.destructive]:text-destructive-foreground focus:group-[.destructive]:ring-destructive",o),a[3]=o,a[4]=c);let p;return a[5]!==s||a[6]!==n||a[7]!==c?(p=(0,N.jsx)(j0,{ref:n,className:c,...s}),a[5]=s,a[6]=n,a[7]=c,a[8]=p):p=a[8],p});B1.displayName=j0.displayName,im=_e.forwardRef((e,n)=>{let a=(0,fi.c)(10),o,s;a[0]===e?(o=a[1],s=a[2]):({className:o,...s}=e,a[0]=e,a[1]=o,a[2]=s);let c;a[3]===o?c=a[4]:(c=Pr("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-hidden focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 hover:group-[.destructive]:text-red-500 focus:group-[.destructive]:ring-red-400 focus:group-[.destructive]:ring-offset-red-600",o),a[3]=o,a[4]=c);let p;a[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,N.jsx)(F8,{className:"h-4 w-4"}),a[5]=p):p=a[5];let d;return a[6]!==s||a[7]!==n||a[8]!==c?(d=(0,N.jsx)(z0,{ref:n,className:c,"toast-close":"",...s,children:p}),a[6]=s,a[7]=n,a[8]=c,a[9]=d):d=a[9],d}),im.displayName=z0.displayName,_m=_e.forwardRef((e,n)=>{let a=(0,fi.c)(9),o,s;a[0]===e?(o=a[1],s=a[2]):({className:o,...s}=e,a[0]=e,a[1]=o,a[2]=s);let c;a[3]===o?c=a[4]:(c=Pr("text-sm font-semibold",o),a[3]=o,a[4]=c);let p;return a[5]!==s||a[6]!==n||a[7]!==c?(p=(0,N.jsx)(M0,{ref:n,className:c,...s}),a[5]=s,a[6]=n,a[7]=c,a[8]=p):p=a[8],p}),_m.displayName=M0.displayName,wm=_e.forwardRef((e,n)=>{let a=(0,fi.c)(9),o,s;a[0]===e?(o=a[1],s=a[2]):({className:o,...s}=e,a[0]=e,a[1]=o,a[2]=s);let c;a[3]===o?c=a[4]:(c=Pr("text-sm opacity-90",o),a[3]=o,a[4]=c);let p;return a[5]!==s||a[6]!==n||a[7]!==c?(p=(0,N.jsx)(D0,{ref:n,className:c,...s}),a[5]=s,a[6]=n,a[7]=c,a[8]=p):p=a[8],p}),wm.displayName=D0.displayName;var V1=!1;function yT(e){var o;let n=[],a=[e.console].filter(Boolean).flat();for(let s of a){let c=s.mimetype==="text/plain",p=s.mimetype==="text/html"||s.mimetype==="application/vnd.marimo+traceback";if(c||p){let d=s.channel==="stderr"||s.channel==="marimo-error";switch(s.channel){case"stdout":case"stderr":case"marimo-error":{let m=S8.asString(s.data),b=p?vd(m):m;n.push({timestamp:s.timestamp||Date.now(),level:d?"stderr":"stdout",message:b,cellId:e.cell_id});break}default:break}}}if(n.forEach(H1.log),a.length===0&&hd((o=e.output)==null?void 0:o.mimetype)&&Array.isArray(e.output.data)){e.output.data.forEach(c=>{H1.log({level:"stderr",cellId:e.cell_id,timestamp:e.timestamp??0,message:JSON.stringify(c)})});let s=e.output.data.filter(c=>"type"in c&&c.type==="exception"||c.type==="internal");if(s.length>0&&!V1){V1=!0;let c=s.find(p=>p.traceback);El(c?{title:"An internal error occurred",description:c.msg||"Click 'View' to see traceback",variant:"danger",action:_e.createElement(B1,{altText:"View traceback",onClick:()=>{Be.set(Gh,{traceback:c.traceback,errorMessage:c.msg||"An internal error occurred"})}},"View")}:{title:"An internal error occurred",description:"See console for details.",variant:"danger"})}}return n}var H1={log:e=>{let n=e.level==="stdout"?"gray":e.level==="stderr"?"red":"orange",a=e.level.toUpperCase();console.log(`%c[${a}]`,`color:${n}; padding:2px 0; border-radius:2px; font-weight:bold`,`[${sm(e.timestamp)}]`,`(${e.cellId}) ${e.message}`)}};sm=function(e){try{return dT(e).toLocaleTimeString(void 0,{hour12:!0,hour:"numeric",minute:"numeric",second:"numeric"})}catch{return""}},q_=function(e,n){let a=id(n);a?a.focus():be.warn(`[CellFocusManager] focusCellEditor: element not found: ${n}`)},d_=function(e){let n=document.getElementById(En.create(e));n?If(n):be.warn(`[CellFocusManager] focusCell: element not found: ${e}`)},c_=function(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})},vm=function(){return document.activeElement instanceof HTMLElement&&document.activeElement.classList.contains("marimo-cell")};function If(e){try{e.focus()}catch{be.warn("[CellFocusManager] element may not be focusable",e)}}gm=function(e,n){let{retries:a,delay:o,initialDelay:s=0}=n,c=0,p=()=>{if(c<a){try{if(e())return}catch(d){be.error(`Error executing function on attempt ${c+1}, retrying`,{error:d})}c++,setTimeout(p,o)}};s>0?setTimeout(p,s):p()};function ks({cellId:e,cell:n,isCodeHidden:a,codeFocus:o,variableName:s}){var p;if(!n)return;let c=document.getElementById(En.create(e));if(!c){be.warn("scrollCellIntoView: element not found");return}if(vm()){If(c);return}if(a)If(c);else{let d=(p=n.current)==null?void 0:p.editorView;if(!d){be.warn("scrollCellIntoView: editor not found",e);return}if(d.hasFocus||!document.hasFocus())return;if(gm(()=>(d.focus(),d.hasFocus),{retries:5,delay:20}),o==="top")d.dispatch({selection:{anchor:0,head:0}});else if(o==="bottom"){let m=d.state.doc.line(d.state.doc.lines);d.dispatch({selection:{anchor:m.from,head:m.from}})}else s&&pd(d,s)}c.scrollIntoView({behavior:"smooth",block:"nearest"})}Wx=function(e){let n=document.getElementById(En.create(e));if(!n){be.warn("scrollCellIntoView: element not found");return}n.classList.add("focus-outline"),setTimeout(()=>{n.classList.remove("focus-outline")},2e3),n.scrollIntoView({behavior:"smooth",block:"center"})};function vT(){let e=document.getElementById("App");e==null||e.scrollTo({top:e.scrollHeight,behavior:"smooth"})}function bT(){var e;(e=document.getElementById("App"))==null||e.scrollTo({top:0,behavior:"smooth"})}Yw=function(e){let n=id(e);if(n!=null&&n.hasFocus){by(n,{behavior:"instant"});return}let a=document.getElementById(En.create(e));a?a.scrollIntoView({behavior:"instant",block:"nearest"}):be.warn(`[CellFocusManager] scrollCellIntoView: element not found: ${e}`)},rr=function({id:e,name:n="_",code:a="",lastCodeRun:o=null,lastExecutionTime:s=null,edited:c=!1,config:p,serializedEditorState:d=null}){return{id:e,config:p||{hide_code:!1,disabled:!1,column:null},name:n,code:a,edited:c,lastCodeRun:o,lastExecutionTime:s,serializedEditorState:d}};function wT(e){return{hide_code:!1,disabled:!1,column:null,...e}}ar=function(e){return{outline:null,output:null,consoleOutputs:[],status:"idle",staleInputs:!1,interrupted:!1,errored:!1,stopped:!1,runElapsedTimeMs:null,runStartTimestamp:null,lastRunStartTimestamp:null,debuggerActive:!1,...e}};var uc=er();function $1(e){let n={column:0,hide_code:!1,disabled:!1};return{...e,cellData:{[ls]:rr({id:ls,config:n}),...e.cellData},cellRuntime:{[ls]:ar(),...e.cellRuntime},cellHandles:{[ls]:(0,_e.createRef)(),...e.cellHandles}}}function _T(){return $1({cellIds:Dl.from([]),cellData:{},cellRuntime:{},cellHandles:{},history:[],scrollKey:null,cellLogs:[],untouchedNewCells:new Set})}let xT,W1,kT,U1;({reducer:xT,addMiddleware:W1,createActions:kT,useActions:U1,valueAtom:Ye}=Cl(_T,{createNewCell:(e,n)=>{var L;let{cellId:a,before:o,code:s,lastCodeRun:c=null,lastExecutionTime:p=null,autoFocus:d=!0,skipIfCodeExists:m=!1,hideCode:b=!1}=n,_,k;if(m){for(let P of e.cellIds.inOrderIds)if(((L=e.cellData[P])==null?void 0:L.code)===s)return e}if(a==="__end__"){let P=e.cellIds.atOrThrow(0);_=P.id,k=P.length}else if(typeof a=="string"){let P=e.cellIds.findWithId(a);_=P.id,k=P.topLevelIds.indexOf(a)}else if(a.type==="__end__"){let P=e.cellIds.get(a.columnId)||e.cellIds.atOrThrow(0);_=P.id,k=P.length}else throw Error("Invalid cellId");let S=n.newCellId||Ya.create(),E=o?k:k+1;return{...e,cellIds:e.cellIds.insertId(S,_,E),cellData:{...e.cellData,[S]:rr({id:S,code:s,lastCodeRun:c,config:wT({hide_code:b}),lastExecutionTime:p,edited:!!s&&s!==c})},cellRuntime:{...e.cellRuntime,[S]:ar()},cellHandles:{...e.cellHandles,[S]:(0,_e.createRef)()},scrollKey:d?S:null,untouchedNewCells:b&&!s?new Set([...e.untouchedNewCells,S]):e.untouchedNewCells}},moveCell:(e,n)=>{let{cellId:a,before:o,direction:s}=n;if(o!==void 0&&s!==void 0&&be.warn("Both before and direction specified for moveCell. Ignoring one."),s){let d=e.cellIds.findWithId(a),m=e.cellIds.indexOf(d),b=s==="left"?m-1:m+1,_=e.cellIds.at(b);return _?{...e,cellIds:e.cellIds.moveAcrossColumns(d.id,a,_.id,void 0),scrollKey:a}:e}let c=e.cellIds.findWithId(a),p=c.indexOfOrThrow(a);return o&&p===0?{...e,cellIds:e.cellIds.moveWithinColumn(c.id,p,0),scrollKey:a}:!o&&p===c.length-1?{...e,cellIds:e.cellIds.moveWithinColumn(c.id,p,c.length-1),scrollKey:a}:o?{...e,cellIds:e.cellIds.moveWithinColumn(c.id,p,p-1),scrollKey:a}:{...e,cellIds:e.cellIds.moveWithinColumn(c.id,p,p+1),scrollKey:a}},dropCellOverCell:(e,n)=>{let{cellId:a,overCellId:o}=n,s=e.cellIds.findWithId(a),c=e.cellIds.findWithId(o),p=s.indexOfOrThrow(a),d=c.indexOfOrThrow(o);return s.id===c.id?p===d?e:{...e,cellIds:e.cellIds.moveWithinColumn(s.id,p,d),scrollKey:null}:{...e,cellIds:e.cellIds.moveAcrossColumns(s.id,a,c.id,o),scrollKey:null}},dropCellOverColumn:(e,n)=>{let{cellId:a,columnId:o}=n,s=e.cellIds.findWithId(a);return{...e,cellIds:e.cellIds.moveAcrossColumns(s.id,a,o,void 0)}},dropOverNewColumn:(e,n)=>{let{cellId:a}=n;return{...e,cellIds:e.cellIds.moveToNewColumn(a)}},moveColumn:(e,n)=>n.column===n.overColumn?e:{...e,cellIds:e.cellIds.moveColumn(n.column,n.overColumn)},focusCell:(e,n)=>{let a=e.cellIds.findWithId(n.cellId);if(a.length===0)return e;let{cellId:o,where:s}=n,c=a.indexOfOrThrow(o),p;p=s==="before"?Bh(c-1,0,a.length-1):s==="after"?Bh(c+1,0,a.length-1):c;let d=a.atOrThrow(p);return ks({cellId:d,cell:e.cellHandles[d],isCodeHidden:Cs(e,d),codeFocus:s==="after"?"top":"bottom",variableName:void 0}),e},focusTopCell:e=>{let n=e.cellIds.getColumns().at(0);if(n===void 0||n.length===0)return e;let a=n.first();return ks({cellId:a,cell:e.cellHandles[a],isCodeHidden:Cs(e,a),codeFocus:void 0,variableName:void 0}),bT(),e},focusBottomCell:e=>{let n=e.cellIds.getColumns().at(-1);if(n===void 0||n.length===0)return e;let a=n.last();return ks({cellId:a,cell:e.cellHandles[a],isCodeHidden:Cs(e,a),codeFocus:void 0,variableName:void 0}),vT(),e},sendToTop:(e,n)=>{let a=e.cellIds.findWithId(n.cellId);if(a.length===0)return e;let{cellId:o,scroll:s=!0}=n,c=a.indexOfOrThrow(o);return c===0?e:{...e,cellIds:e.cellIds.moveWithinColumn(a.id,c,0),scrollKey:s?o:null}},sendToBottom:(e,n)=>{let a=e.cellIds.findWithId(n.cellId);if(a.length===0)return e;let{cellId:o,scroll:s=!0}=n,c=a.indexOfOrThrow(o),p=a.length-1;return c===p?e:{...e,cellIds:e.cellIds.moveWithinColumn(a.id,c,p),scrollKey:s?o:null}},addColumn:(e,n)=>{let a=Ya.create();return{...e,cellIds:e.cellIds.addColumn(n.columnId,[a]),cellData:{...e.cellData,[a]:rr({id:a})},cellRuntime:{...e.cellRuntime,[a]:ar()},cellHandles:{...e.cellHandles,[a]:(0,_e.createRef)()},scrollKey:a}},addColumnBreakpoint:(e,n)=>{let{cellId:a}=n;return e.cellIds.getColumns()[0].inOrderIds[0]===a?e:{...e,cellIds:e.cellIds.insertBreakpoint(a)}},deleteColumn:(e,n)=>{let{columnId:a}=n;return{...e,cellIds:e.cellIds.delete(a)}},mergeAllColumns:e=>({...e,cellIds:e.cellIds.mergeAllColumns()}),compactColumns:e=>({...e,cellIds:e.cellIds.compact()}),deleteCell:(e,n)=>{var b,_;let a=n.cellId;if(e.cellIds.hasOnlyOneId())return e;let o;try{o=e.cellIds.findWithId(a)}catch(k){return be.warn("Skipping delete for missing cellId",{cellId:a,error:k}),e}let s=o.indexOfOrThrow(a),c=s===0?1:s-1,p=null;o.length>1&&(p=o.atOrThrow(c));let d=(_=(b=e.cellHandles[a].current)==null?void 0:b.editorView)==null?void 0:_.state.toJSON({history:m8});d&&(d.doc=e.cellData[a].code),ET(a);let m=e.cellData[a];return{...e,cellIds:e.cellIds.deleteById(a),history:[...e.history,{name:m.name,serializedEditorState:d,column:o.id,index:s,isSetupCell:a===Vn,config:m.config}],scrollKey:p}},undoDeleteCell:e=>{if(e.history.length===0)return e;let{name:n,serializedEditorState:a={doc:""},column:o,index:s,isSetupCell:c,config:p}=e.history[e.history.length-1],d=c?Vn:Ya.create(),m=rr({id:d,name:n,code:a.doc,edited:a.doc.trim().length>0,serializedEditorState:a,config:p});return{...e,cellIds:e.cellIds.insertId(d,o,s),cellData:{...e.cellData,[d]:m},cellRuntime:{...e.cellRuntime,[d]:ar()},cellHandles:{...e.cellHandles,[d]:(0,_e.createRef)()},history:e.history.slice(0,-1),scrollKey:d}},clearSerializedEditorState:(e,n)=>{let{cellId:a}=n;return go({state:e,cellId:a,cellReducer:o=>({...o,serializedEditorState:null})})},updateCellCode:(e,n)=>{let{cellId:a,code:o,formattingChange:s}=n;return e.cellData[a]?go({state:e,cellId:a,cellReducer:c=>s?{...c,code:o,lastCodeRun:c.edited?c.lastCodeRun:o}:{...c,code:o,edited:o.trim()!==c.lastCodeRun}}):e},updateCellName:(e,n)=>{let{cellId:a,name:o}=n;return go({state:e,cellId:a,cellReducer:s=>({...s,name:o})})},updateCellConfig:(e,n)=>{let{cellId:a,config:o}=n;return go({state:e,cellId:a,cellReducer:s=>({...s,config:{...s.config,...o}})})},prepareForRun:(e,n)=>go({state:Ss({state:e,cellId:n.cellId,cellReducer:a=>nT(a)}),cellId:n.cellId,cellReducer:a=>({...a,edited:!1,lastCodeRun:a.code.trim()})}),handleCellMessage:(e,n)=>{let a=n.cell_id,o=Ss({state:e,cellId:a,cellReducer:s=>tT(s,n)});return n.status==="queued"&&(o=go({state:o,cellId:a,cellReducer:s=>({...s,lastCodeRun:s.code.trim(),edited:!1})})),{...o,cellLogs:[...o.cellLogs,...yT(n)]}},setCellIds:(e,n)=>{if(h6(e.cellIds.inOrderIds,n.cellIds))return e;let a={...e.cellData},o={...e.cellRuntime},s={...e.cellHandles};for(let c of n.cellIds)c in e.cellData||(a[c]=rr({id:c})),c in e.cellRuntime||(o[c]=ar()),c in e.cellHandles||(s[c]=(0,_e.createRef)());return{...e,cellIds:Dl.fromWithPreviousShape(n.cellIds,e.cellIds),cellData:a,cellRuntime:o,cellHandles:s}},setCellCodes:(e,n)=>{var s,c;rn(n.codes.length===n.ids.length,"Expected codes and ids to have the same length");let a={...e},o=({cell:p,code:d,cellId:m,name:b,config:_})=>{if(!p)return rr({id:m,code:d,name:b,config:_,lastCodeRun:n.codeIsStale?null:d,edited:n.codeIsStale&&d.trim().length>0});let k=n.codeIsStale?p.lastCodeRun:d,S=k?k.trim()!==d.trim():!!d;if(p.code.trim()===d.trim())return{...p,code:d,edited:S,lastCodeRun:k,...b!==void 0&&{name:b},..._!==void 0&&{config:_}};if(!Rm()){let E=a.cellHandles[m].current;E!=null&&E.editorViewOrNull&&Ji(E.editorViewOrNull,d)}return{...p,code:d,edited:S,lastCodeRun:k,...b!==void 0&&{name:b},..._!==void 0&&{config:_}}};for(let p=0;p<n.ids.length;p++){let d=n.ids[p],m=n.codes[p];if(d===void 0||m===void 0)continue;let b=(s=n.names)==null?void 0:s[p],_=(c=n.configs)==null?void 0:c[p];a={...a,cellData:{...a.cellData,[d]:o({cell:a.cellData[d],code:m,cellId:d,name:b,config:_})}}}return a},setStdinResponse:(e,n)=>{let{cellId:a,response:o,outputIndex:s}=n;return Ss({state:e,cellId:a,cellReducer:c=>{let p=[...c.consoleOutputs],d=p[s];return d.channel==="stdin"?(p[s]={channel:"stdin",mimetype:d.mimetype,data:d.data,timestamp:d.timestamp,response:o},{...c,interrupted:!1,consoleOutputs:p}):(be.warn("Expected stdin output"),c)}})},setCells:(e,n)=>{let a=Object.fromEntries(n.map(s=>[s.id,s])),o=Object.fromEntries(n.map(s=>[s.id,ar()]));return $1({...e,cellIds:Dl.fromIdsAndColumns(n.map(s=>[s.id,s.config.column])),cellData:a,cellRuntime:o,cellHandles:Object.fromEntries(n.map(s=>[s.id,(0,_e.createRef)()]))})},moveToNextCell:(e,n)=>{let{cellId:a,before:o,noCreate:s=!1}=n;if(a==="__scratch__")return e;let c=e.cellIds.findWithId(a),p=c.indexOfOrThrow(a),d=o?p-1:p+1,m=d===c.length,b=d===-1;if(m&&!s){let _=Ya.create();return{...e,cellIds:e.cellIds.insertId(_,c.id,d),cellData:{...e.cellData,[_]:rr({id:_})},cellRuntime:{...e.cellRuntime,[_]:ar()},cellHandles:{...e.cellHandles,[_]:(0,_e.createRef)()},scrollKey:_}}if(b&&!s){let _=Ya.create();return{...e,cellIds:e.cellIds.insertId(_,c.id,0),cellData:{...e.cellData,[_]:rr({id:_})},cellRuntime:{...e.cellRuntime,[_]:ar()},cellHandles:{...e.cellHandles,[_]:(0,_e.createRef)()},scrollKey:_}}if((m||b)&&s)return e;if(d>=0&&d<c.length){let _=c.atOrThrow(d);ks({cellId:_,cell:e.cellHandles[_],isCodeHidden:Cs(e,_),codeFocus:o?"bottom":"top",variableName:void 0})}return e},markTouched:(e,n)=>{let{cellId:a}=n;if(e.untouchedNewCells.has(a)){let o=new Set(e.untouchedNewCells);return o.delete(a),{...e,untouchedNewCells:o}}return e},markUntouched:(e,n)=>{let{cellId:a}=n;if(!e.untouchedNewCells.has(a)){let o=new Set(e.untouchedNewCells);return o.add(a),{...e,untouchedNewCells:o}}return e},scrollToTarget:e=>{let n=e.scrollKey;if(n===null)return e;let a=e.cellIds.findWithId(n),o=a.indexOfOrThrow(n),s=o===a.length-1?a.last():a.atOrThrow(o);return ks({cellId:s,cell:e.cellHandles[s],isCodeHidden:Cs(e,s),codeFocus:void 0,variableName:void 0}),{...e,scrollKey:null}},foldAll:e=>(Mk(Object.values(e.cellHandles).map(n=>{var a;return(a=n.current)==null?void 0:a.editorView})),e),unfoldAll:e=>(Dk(Object.values(e.cellHandles).map(n=>{var a;return(a=n.current)==null?void 0:a.editorView})),e),clearLogs:e=>({...e,cellLogs:[]}),collapseCell:(e,n)=>{let{cellId:a}=n,o=e.cellIds.findWithId(a),s=o.topLevelIds.map(d=>e.cellRuntime[d].outline),c=P1(o.indexOfOrThrow(a),s);if(!c)return e;let p=o.atOrThrow(c[1]);return{...e,cellIds:e.cellIds.transformWithCellId(a,d=>d.collapse(a,p)),scrollKey:a}},expandCell:(e,n)=>{let{cellId:a}=n;return{...e,cellIds:e.cellIds.transformWithCellId(a,o=>o.expand(a)),scrollKey:a}},collapseAllCells:e=>({...e,cellIds:e.cellIds.transformAll(n=>{let a=n.topLevelIds.map(m=>e.cellRuntime[m].outline),o=[...n.nodes],s=[],c=[],p=o.length-1;for(;p>=0;){let m=P1(p,a);if(m){let b=p,_=m[1],k=s.find(L=>L.start<=_&&L.end===_);k&&(_=k.start),s.push({start:b,end:_});let S=n.atOrThrow(b),E=n.atOrThrow(_);c.push({id:S,until:E})}else c.push(null);p--}let d=c.toReversed();return n.collapseAll(d)})}),expandAllCells:e=>({...e,cellIds:e.cellIds.transformAll(n=>n.expandAll())}),showCellIfHidden:(e,n)=>{let{cellId:a}=n,o=e.cellIds.findWithId(a),s=o,c=o.findAndExpandDeep(a);return c.equals(s)?e:{...e,cellIds:e.cellIds.transformWithCellId(a,()=>c)}},splitCell:(e,n)=>{var _;let{cellId:a}=n,o=e.cellIds.findWithId(a),s=o.indexOfOrThrow(a),c=e.cellData[a],p=e.cellHandles[a].current;if((p==null?void 0:p.editorView)==null)return e;let{beforeCursorCode:d,afterCursorCode:m}=U4(p.editorView);Ji(p.editorView,d);let b=Ya.create();return{...e,cellIds:e.cellIds.insertId(b,o.id,s+1),cellData:{...e.cellData,[a]:{...c,code:d,edited:!!d&&d.trim()!==((_=c.lastCodeRun)==null?void 0:_.trim())},[b]:rr({id:b,code:m,edited:!!m})},cellRuntime:{...e.cellRuntime,[a]:{...e.cellRuntime[a],output:null,consoleOutputs:[]},[b]:ar()},cellHandles:{...e.cellHandles,[b]:(0,_e.createRef)()},scrollKey:b}},undoSplitCell:(e,n)=>{var p;let{cellId:a,snapshot:o}=n,s=e.cellData[a],c=e.cellHandles[a].current;return(c==null?void 0:c.editorView)==null?e:(Ji(c.editorView,o),{...e,cellIds:e.cellIds.transformWithCellId(a,d=>{let m=d.indexOfOrThrow(a)+1;return d.deleteAtIndex(m)}),cellData:{...e.cellData,[a]:{...s,code:o,edited:!!o&&(o==null?void 0:o.trim())!==((p=s.lastCodeRun)==null?void 0:p.trim())}},cellRuntime:{...e.cellRuntime,[a]:{...e.cellRuntime[a],output:null,consoleOutputs:[]}},cellHandles:{...e.cellHandles}})},clearCellOutput:(e,n)=>{let{cellId:a}=n;return Ss({state:e,cellId:a,cellReducer:o=>({...o,output:null,consoleOutputs:[]})})},clearCellConsoleOutput:(e,n)=>{let{cellId:a}=n;return Ss({state:e,cellId:a,cellReducer:o=>({...o,consoleOutputs:o.consoleOutputs.filter(s=>s.channel==="stdin"&&s.response==null)})})},clearAllCellOutputs:e=>{let n={...e.cellRuntime};for(let a of e.cellIds.inOrderIds)n[a]={...n[a],output:null,consoleOutputs:[]};return{...e,cellRuntime:n}},addSetupCellIfDoesntExist:(e,n)=>{let{code:a}=n;return e.cellIds.setupCellExists()?{...e,scrollKey:Vn}:{...e,cellIds:e.cellIds.insertId(Vn,e.cellIds.atOrThrow(0).id,0),cellData:{...e.cellData,[Vn]:rr({id:Vn,name:Vn,code:a,edited:!!a})},cellRuntime:{...e.cellRuntime,[Vn]:ar()},cellHandles:{...e.cellHandles,[Vn]:(0,_e.createRef)()},scrollKey:Vn}}})),W1(uT);function Cs(e,n){return!!e.cellData[n].config.hide_code&&!e.untouchedNewCells.has(n)}function Ss({state:e,cellId:n,cellReducer:a}){return n in e.cellRuntime?{...e,cellRuntime:{...e.cellRuntime,[n]:a(e.cellRuntime[n])}}:(be.warn(`Cell ${n} not found in state`),e)}function go({state:e,cellId:n,cellReducer:a}){return n in e.cellData?{...e,cellData:{...e.cellData,[n]:a(e.cellData[n])}}:(be.warn(`Cell ${n} not found in state`),e)}Z_=function(e){let n=e.cellData,a={column:null};return e.cellIds.getColumns().length>1?e.cellIds.getColumns().flatMap((o,s)=>o.inOrderIds.map((c,p)=>{let d={...a};return p===0&&(d.column=s),{...n[c].config,...d}})):e.cellIds.getColumns().flatMap(o=>o.inOrderIds.map(s=>({...n[s].config,...a})))},rd=Te(e=>e(Ye).cellIds),Nx=Te(e=>e(rd).hasOnlyOneId()),W_=Te(e=>pm(e(Ye)).length>0),Te(e=>o0(e(Ye)).length>0);let K1;Ox=Te(e=>gC(e(Ye))),$x=Te(e=>hC(e(Ye))),ld=Te(e=>{let{cellIds:n,cellRuntime:a,cellData:o}=e(Ye);return n.inOrderIds.map(s=>{var d;let c=a[s],{name:p}=o[s];if(hd((d=c.output)==null?void 0:d.mimetype)){rn(Array.isArray(c.output.data),"Expected array data");let m=c.output.data.filter(b=>!b.type.includes("ancestor"));if(m.length>0)return{output:{...c.output,data:m},cellId:s,cellName:p}}return null}).filter(Boolean)}),N_=Te(e=>{let{cellIds:n,cellRuntime:a}=e(Ye);return J4(n.inOrderIds.map(o=>a[o].outline))}),Sx=Te(e=>e(ld).length),K1=p6(Te(e=>{let{cellIds:n,cellData:a}=e(Ye);return Rr.fromEntries(n.inOrderIds.map(o=>{var s;return[o,(s=a[o])==null?void 0:s.name]}))}));var CT=Te(e=>e(Ye).scrollKey);l_=()=>Sn(Ye),dx=()=>Sn(rd),x_=()=>Sn(K1),px=()=>Sn(ld),b_=()=>Sn(Ye).cellLogs,h_=()=>Sn(CT),sd=()=>Be.get(Ye),yx=()=>Be.get(Ye).cellIds,xx=()=>{let{cellIds:e,cellData:n}=Be.get(Ye);return e.inOrderIds.map(a=>{var o;return(o=n[a])==null?void 0:o.name}).filter(Boolean)};var ST=Ik(kk(Ye,e=>e.cellIds.inOrderIds.map(n=>e.cellData[n])));T_=()=>fw(ST),bx=Te(e=>e(Ye).cellRuntime),Bx=Te(e=>fC(e(Ye))),D_=Te(e=>{let{cellRuntime:n}=e(Ye);return Object.entries(n).every(([a,o])=>o.status!=="running"||a==="__scratch__")}),n_=Te(e=>pC(e(Ye))),Dx=Te(e=>e(Ye).cellIds.colLength),ix=Te(e=>e(Ye).cellIds.idLength>0),Tx=Te(e=>e(Ye).cellIds.getColumnIds()),md=Nd(e=>Te(n=>n(Ye).cellData[e]));var Lf=Nd(e=>Te(n=>n(Ye).cellRuntime[e]));const Q1=Nd(e=>Te(n=>n(Ye).cellHandles[e]));function ET(e){md.remove(e),Lf.remove(e),Q1.remove(e)}a_=e=>{let n=(0,uc.c)(2),a;return n[0]===e?a=n[1]:(a=md(e),n[0]=e,n[1]=a),Sn(a)},O_=e=>{let n=(0,uc.c)(2),a;return n[0]===e?a=n[1]:(a=Lf(e),n[0]=e,n[1]=a),Sn(a)},Gw=e=>{let n=(0,uc.c)(2),a;return n[0]===e?a=n[1]:(a=Q1(e),n[0]=e,n[1]=a),Sn(a)},t0=()=>{let{cellIds:e,cellHandles:n}=Be.get(Ye);return e.inOrderIds.map(a=>{var o,s;return(s=(o=n[a])==null?void 0:o.current)==null?void 0:s.editorViewOrNull}).filter(Boolean)},id=e=>{var a;let{cellHandles:n}=Be.get(Ye);return(a=n[e].current)==null?void 0:a.editorView},gx=function(e){let{cellIds:n,cellData:a,cellRuntime:o}=e;return n.getColumns().flatMap(s=>s.topLevelIds.map(c=>({...a[c],...o[c]})))},J_=function(e){return Te(n=>n(Ye).untouchedNewCells.has(e))};function TT(e){let n=Lf(e);return Te(a=>{let o=a(n);if(!o||o.status==="queued"||o.status==="running")return;let s=[],c=o.consoleOutputs;if(c&&c.length>0){let d=c.find(m=>m.mimetype==="application/vnd.marimo+traceback");if(d){let m=d.data;s.push(...Zm(m))}}let p=o.output;if((p==null?void 0:p.mimetype)==="application/vnd.marimo+error"){let d=p.data;if(Array.isArray(d))for(let m of d)m.type==="syntax"&&m.lineno!=null&&s.push({kind:"cell",cellId:e,lineNumber:m.lineno}),m.type==="import-star"&&m.lineno!=null&&s.push({kind:"cell",cellId:e,lineNumber:m.lineno})}return s.length>0?s:void 0})}s_=function(e){let n=(0,uc.c)(2),a;return n[0]===e?a=n[1]:(a=e===void 0?{}:e,n[0]=e,n[1]=a),U1(a)}})();export{Gh as $,Jh as $n,Xa as $r,Xh as $t,Gw as A,Yh as Ai,Zh as An,Jw as Ar,Xw as At,Yw as B,Zw as Bn,e_ as Br,t_ as Bt,n_ as C,Ya as Ci,em as Cn,r_ as Cr,Bn as Ct,a_ as D,Vn as Di,i_ as Dn,o_ as Dr,tm as Dt,s_ as E,ls as Ei,Tl as En,Fu as Er,Bu as Et,l_ as F,Vu as Fi,Za as Fn,Ki as Fr,nm as Ft,c_ as G,Hu as Gn,u_ as Gr,rm as Gt,d_ as H,$u as Hn,f_ as Hr,p_ as Ht,h_ as I,Wu as Ii,m_ as In,ot as Ir,am as It,im as J,g_ as Jn,om as Jr,Uu as Jt,sm as K,y_ as Kn,Qi as Kr,v_ as Kt,rr as L,Il as Ln,ua as Lr,Ll as Lt,b_ as M,lm as Mi,Ku as Mn,w_ as Mr,__ as Mt,x_ as N,k_ as Ni,C_ as Nn,S_ as Nr,E_ as Nt,T_ as O,Qu as Oi,I_ as On,L_ as Or,cm as Ot,O_ as P,A_ as Pi,R_ as Pn,da as Pr,P_ as Pt,um as Q,dm as Qn,Ol as Qr,fm as Qt,ar as R,Gu as Rn,pm as Rr,Hn as Rt,N_ as S,hm as Si,Ju as Sn,Gi as Sr,M_ as St,D_ as T,En as Ti,j_ as Tn,z_ as Tr,Xu as Tt,q_ as U,Al as Un,mm as Ur,F_ as Ut,gm as V,Yu as Vn,ym as Vr,B_ as Vt,vm as W,V_ as Wn,Zu as Wr,bm as Wt,H_ as X,$_ as Xn,Rl as Xr,ed as Xt,wm as Y,td as Yn,Pl as Yr,Nr as Yt,_m as Z,Nl as Zn,cs as Zr,nd as Zt,W_ as _,J8 as __tla,Ml as _i,U_ as _n,xm as _r,km as _t,rd as a,Dl as ai,K_ as an,Cm as ar,Sm as at,Ye as b,Q_ as bi,ad as bn,G_ as br,Ji as bt,J_ as c,X_ as ci,fa as cn,Em as cr,Y_ as ct,Z_ as d,ex as di,tx as dn,Tm as dr,Im as dt,nx as ei,Lm as en,Xi as er,rx as et,id as f,ax as fi,Om as fn,Am as fr,Rm as ft,ix as g,ox as gi,od as gn,Pm as gr,Nm as gt,sd as h,mn as hi,sx as hn,Mm as hr,lx as ht,ld as i,ei as ii,cx as in,Dm as ir,ux as it,dx as j,fx as ji,jm as jn,jl as jr,cd as jt,px as k,hx as ki,ud as kn,mx as kr,zm as kt,gx as l,dd as li,zl as ln,fd as lr,qm as lt,yx as m,vx as mi,pd as mn,Fm as mr,hd as mt,md as n,Bm as ni,Vm as nn,Hm as nr,$m as nt,bx as o,wx as oi,_x as on,Yi as or,Wm as ot,xx as p,us as pi,Um as pn,Km as pr,kx as pt,Qm as q,ti as qn,gd as qr,Cx as qt,Sx as r,Gm as ri,Jm as rn,Xm as rr,Ex as rt,Tx as s,Ym as si,Ix as sn,yd as sr,Lx as st,Ox as t,Zm as ti,Ax as tn,e0 as tr,vd as tt,t0 as u,ds as ui,Rx as un,fs as ur,Px as ut,Nx as v,ql as vi,Mx as vn,n0 as vr,r0 as vt,Dx as w,jx as wi,zx as wn,qx as wr,Fx as wt,Bx as x,Vx as xi,a0 as xn,bd as xr,Hx as xt,$x as y,wd as yi,_d as yn,i0 as yr,wr as yt,Wx as z,ni as zn,o0 as zr,xd as zt};
229
+ `)}catch(n){return be.error("Error parsing HTML content:",n),e}},rx=function(e){if(!e)return"";try{return vd(gT.ansi_to_html(e))}catch(n){return be.error("Error converting ANSI to plain text:",n),e}},Gh=Te(null);let fi;fi=er(),H_=bk,um=_e.forwardRef((e,n)=>{let a=(0,fi.c)(9),o,s;a[0]===e?(o=a[1],s=a[2]):({className:o,...s}=e,a[0]=e,a[1]=o,a[2]=s);let c;a[3]===o?c=a[4]:(c=Pr("fixed top-0 z-100 flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:w-fit md:max-w-[420px]",o),a[3]=o,a[4]=c);let p;return a[5]!==s||a[6]!==n||a[7]!==c?(p=(0,N.jsx)(P0,{ref:n,className:c,...s}),a[5]=s,a[6]=n,a[7]=c,a[8]=p):p=a[8],p}),um.displayName=P0.displayName;let F1;F1=x6("data-[swipe=move]:transition-none group relative pointer-events-auto flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=move]:translate-x-(--radix-toast-swipe-move-x) data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-(--radix-toast-swipe-end-x) data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=open]:slide-in-from-top-full sm:data-[state=open]:slide-in-from-bottom-full data-[state=closed]:slide-out-to-right-full",{variants:{variant:{default:"bg-background border",danger:"group destructive text-error border-destructive bg-(--red-1) shadow-md-solid shadow-error"}},defaultVariants:{variant:"default"}}),Qm=_e.forwardRef((e,n)=>{let a=(0,fi.c)(11),o,s,c;a[0]===e?(o=a[1],s=a[2],c=a[3]):({className:o,variant:c,...s}=e,a[0]=e,a[1]=o,a[2]=s,a[3]=c);let p=c||"default",d;a[4]!==o||a[5]!==p?(d=Pr(F1({variant:p}),"print:hidden",o),a[4]=o,a[5]=p,a[6]=d):d=a[6];let m;return a[7]!==s||a[8]!==n||a[9]!==d?(m=(0,N.jsx)(N0,{ref:n,className:d,...s}),a[7]=s,a[8]=n,a[9]=d,a[10]=m):m=a[10],m}),Qm.displayName=N0.displayName;var B1=_e.forwardRef((e,n)=>{let a=(0,fi.c)(9),o,s;a[0]===e?(o=a[1],s=a[2]):({className:o,...s}=e,a[0]=e,a[1]=o,a[2]=s);let c;a[3]===o?c=a[4]:(c=Pr("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-destructive/30 hover:group-[.destructive]:border-destructive/30 hover:group-[.destructive]:bg-destructive hover:group-[.destructive]:text-destructive-foreground focus:group-[.destructive]:ring-destructive",o),a[3]=o,a[4]=c);let p;return a[5]!==s||a[6]!==n||a[7]!==c?(p=(0,N.jsx)(j0,{ref:n,className:c,...s}),a[5]=s,a[6]=n,a[7]=c,a[8]=p):p=a[8],p});B1.displayName=j0.displayName,im=_e.forwardRef((e,n)=>{let a=(0,fi.c)(10),o,s;a[0]===e?(o=a[1],s=a[2]):({className:o,...s}=e,a[0]=e,a[1]=o,a[2]=s);let c;a[3]===o?c=a[4]:(c=Pr("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-hidden focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 hover:group-[.destructive]:text-red-500 focus:group-[.destructive]:ring-red-400 focus:group-[.destructive]:ring-offset-red-600",o),a[3]=o,a[4]=c);let p;a[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,N.jsx)(F8,{className:"h-4 w-4"}),a[5]=p):p=a[5];let d;return a[6]!==s||a[7]!==n||a[8]!==c?(d=(0,N.jsx)(z0,{ref:n,className:c,"toast-close":"",...s,children:p}),a[6]=s,a[7]=n,a[8]=c,a[9]=d):d=a[9],d}),im.displayName=z0.displayName,_m=_e.forwardRef((e,n)=>{let a=(0,fi.c)(9),o,s;a[0]===e?(o=a[1],s=a[2]):({className:o,...s}=e,a[0]=e,a[1]=o,a[2]=s);let c;a[3]===o?c=a[4]:(c=Pr("text-sm font-semibold",o),a[3]=o,a[4]=c);let p;return a[5]!==s||a[6]!==n||a[7]!==c?(p=(0,N.jsx)(M0,{ref:n,className:c,...s}),a[5]=s,a[6]=n,a[7]=c,a[8]=p):p=a[8],p}),_m.displayName=M0.displayName,wm=_e.forwardRef((e,n)=>{let a=(0,fi.c)(9),o,s;a[0]===e?(o=a[1],s=a[2]):({className:o,...s}=e,a[0]=e,a[1]=o,a[2]=s);let c;a[3]===o?c=a[4]:(c=Pr("text-sm opacity-90",o),a[3]=o,a[4]=c);let p;return a[5]!==s||a[6]!==n||a[7]!==c?(p=(0,N.jsx)(D0,{ref:n,className:c,...s}),a[5]=s,a[6]=n,a[7]=c,a[8]=p):p=a[8],p}),wm.displayName=D0.displayName;var V1=!1;function yT(e){var o;let n=[],a=[e.console].filter(Boolean).flat();for(let s of a){let c=s.mimetype==="text/plain",p=s.mimetype==="text/html"||s.mimetype==="application/vnd.marimo+traceback";if(c||p){let d=s.channel==="stderr"||s.channel==="marimo-error";switch(s.channel){case"stdout":case"stderr":case"marimo-error":{let m=S8.asString(s.data),b=p?vd(m):m;n.push({timestamp:s.timestamp||Date.now(),level:d?"stderr":"stdout",message:b,cellId:e.cell_id});break}default:break}}}if(n.forEach(H1.log),a.length===0&&hd((o=e.output)==null?void 0:o.mimetype)&&Array.isArray(e.output.data)){e.output.data.forEach(c=>{H1.log({level:"stderr",cellId:e.cell_id,timestamp:e.timestamp??0,message:JSON.stringify(c)})});let s=e.output.data.filter(c=>"type"in c&&c.type==="exception"||c.type==="internal");if(s.length>0&&!V1){V1=!0;let c=s.find(p=>p.traceback);El(c?{title:"An internal error occurred",description:c.msg||"Click 'View' to see traceback",variant:"danger",action:_e.createElement(B1,{altText:"View traceback",onClick:()=>{Be.set(Gh,{traceback:c.traceback,errorMessage:c.msg||"An internal error occurred"})}},"View")}:{title:"An internal error occurred",description:"See console for details.",variant:"danger"})}}return n}var H1={log:e=>{let n=e.level==="stdout"?"gray":e.level==="stderr"?"red":"orange",a=e.level.toUpperCase();console.log(`%c[${a}]`,`color:${n}; padding:2px 0; border-radius:2px; font-weight:bold`,`[${sm(e.timestamp)}]`,`(${e.cellId}) ${e.message}`)}};sm=function(e){try{return dT(e).toLocaleTimeString(void 0,{hour12:!0,hour:"numeric",minute:"numeric",second:"numeric"})}catch{return""}},q_=function(e,n){let a=id(n);a?a.focus():be.warn(`[CellFocusManager] focusCellEditor: element not found: ${n}`)},d_=function(e){let n=document.getElementById(En.create(e));n?If(n):be.warn(`[CellFocusManager] focusCell: element not found: ${e}`)},c_=function(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})},vm=function(){return document.activeElement instanceof HTMLElement&&document.activeElement.classList.contains("marimo-cell")};function If(e){try{e.focus()}catch{be.warn("[CellFocusManager] element may not be focusable",e)}}gm=function(e,n){let{retries:a,delay:o,initialDelay:s=0}=n,c=0,p=()=>{if(c<a){try{if(e())return}catch(d){be.error(`Error executing function on attempt ${c+1}, retrying`,{error:d})}c++,setTimeout(p,o)}};s>0?setTimeout(p,s):p()};function ks({cellId:e,cell:n,isCodeHidden:a,codeFocus:o,variableName:s}){var p;if(!n)return;let c=document.getElementById(En.create(e));if(!c){be.warn("scrollCellIntoView: element not found");return}if(vm()){If(c);return}if(a)If(c);else{let d=(p=n.current)==null?void 0:p.editorView;if(!d){be.warn("scrollCellIntoView: editor not found",e);return}if(d.hasFocus||!document.hasFocus())return;if(gm(()=>(d.focus(),d.hasFocus),{retries:5,delay:20}),o==="top")d.dispatch({selection:{anchor:0,head:0}});else if(o==="bottom"){let m=d.state.doc.line(d.state.doc.lines);d.dispatch({selection:{anchor:m.from,head:m.from}})}else s&&pd(d,s)}c.scrollIntoView({behavior:"smooth",block:"nearest"})}Wx=function(e){let n=document.getElementById(En.create(e));if(!n){be.warn("scrollCellIntoView: element not found");return}n.classList.add("focus-outline"),setTimeout(()=>{n.classList.remove("focus-outline")},2e3),n.scrollIntoView({behavior:"smooth",block:"center"})};function vT(){let e=document.getElementById("App");e==null||e.scrollTo({top:e.scrollHeight,behavior:"smooth"})}function bT(){var e;(e=document.getElementById("App"))==null||e.scrollTo({top:0,behavior:"smooth"})}Yw=function(e){let n=id(e);if(n!=null&&n.hasFocus){by(n,{behavior:"instant"});return}let a=document.getElementById(En.create(e));a?a.scrollIntoView({behavior:"instant",block:"nearest"}):be.warn(`[CellFocusManager] scrollCellIntoView: element not found: ${e}`)},rr=function({id:e,name:n="_",code:a="",lastCodeRun:o=null,lastExecutionTime:s=null,edited:c=!1,config:p,serializedEditorState:d=null}){return{id:e,config:p||{hide_code:!1,disabled:!1,column:null},name:n,code:a,edited:c,lastCodeRun:o,lastExecutionTime:s,serializedEditorState:d}};function wT(e){return{hide_code:!1,disabled:!1,column:null,...e}}ar=function(e){return{outline:null,output:null,consoleOutputs:[],status:"idle",staleInputs:!1,interrupted:!1,errored:!1,stopped:!1,runElapsedTimeMs:null,runStartTimestamp:null,lastRunStartTimestamp:null,debuggerActive:!1,...e}};var uc=er();function $1(e){let n={column:0,hide_code:!1,disabled:!1};return{...e,cellData:{[ls]:rr({id:ls,config:n}),...e.cellData},cellRuntime:{[ls]:ar(),...e.cellRuntime},cellHandles:{[ls]:(0,_e.createRef)(),...e.cellHandles}}}function _T(){return $1({cellIds:Dl.from([]),cellData:{},cellRuntime:{},cellHandles:{},history:[],scrollKey:null,cellLogs:[],untouchedNewCells:new Set})}let xT,W1,kT,U1;({reducer:xT,addMiddleware:W1,createActions:kT,useActions:U1,valueAtom:Ye}=Cl(_T,{createNewCell:(e,n)=>{var L;let{cellId:a,before:o,code:s,lastCodeRun:c=null,lastExecutionTime:p=null,autoFocus:d=!0,skipIfCodeExists:m=!1,hideCode:b=!1}=n,_,k;if(m){for(let P of e.cellIds.inOrderIds)if(((L=e.cellData[P])==null?void 0:L.code)===s)return e}if(a==="__end__"){let P=e.cellIds.atOrThrow(0);_=P.id,k=P.length}else if(typeof a=="string"){let P=e.cellIds.findWithId(a);_=P.id,k=P.topLevelIds.indexOf(a)}else if(a.type==="__end__"){let P=e.cellIds.get(a.columnId)||e.cellIds.atOrThrow(0);_=P.id,k=P.length}else throw Error("Invalid cellId");let S=n.newCellId||Ya.create(),E=o?k:k+1;return{...e,cellIds:e.cellIds.insertId(S,_,E),cellData:{...e.cellData,[S]:rr({id:S,code:s,lastCodeRun:c,config:wT({hide_code:b}),lastExecutionTime:p,edited:!!s&&s!==c})},cellRuntime:{...e.cellRuntime,[S]:ar()},cellHandles:{...e.cellHandles,[S]:(0,_e.createRef)()},scrollKey:d?S:null,untouchedNewCells:b&&!s?new Set([...e.untouchedNewCells,S]):e.untouchedNewCells}},moveCell:(e,n)=>{let{cellId:a,before:o,direction:s}=n;if(o!==void 0&&s!==void 0&&be.warn("Both before and direction specified for moveCell. Ignoring one."),s){let d=e.cellIds.findWithId(a),m=e.cellIds.indexOf(d),b=s==="left"?m-1:m+1,_=e.cellIds.at(b);return _?{...e,cellIds:e.cellIds.moveAcrossColumns(d.id,a,_.id,void 0),scrollKey:a}:e}let c=e.cellIds.findWithId(a),p=c.indexOfOrThrow(a);return o&&p===0?{...e,cellIds:e.cellIds.moveWithinColumn(c.id,p,0),scrollKey:a}:!o&&p===c.length-1?{...e,cellIds:e.cellIds.moveWithinColumn(c.id,p,c.length-1),scrollKey:a}:o?{...e,cellIds:e.cellIds.moveWithinColumn(c.id,p,p-1),scrollKey:a}:{...e,cellIds:e.cellIds.moveWithinColumn(c.id,p,p+1),scrollKey:a}},dropCellOverCell:(e,n)=>{let{cellId:a,overCellId:o}=n,s=e.cellIds.findWithId(a),c=e.cellIds.findWithId(o),p=s.indexOfOrThrow(a),d=c.indexOfOrThrow(o);return s.id===c.id?p===d?e:{...e,cellIds:e.cellIds.moveWithinColumn(s.id,p,d),scrollKey:null}:{...e,cellIds:e.cellIds.moveAcrossColumns(s.id,a,c.id,o),scrollKey:null}},dropCellOverColumn:(e,n)=>{let{cellId:a,columnId:o}=n,s=e.cellIds.findWithId(a);return{...e,cellIds:e.cellIds.moveAcrossColumns(s.id,a,o,void 0)}},dropOverNewColumn:(e,n)=>{let{cellId:a}=n;return{...e,cellIds:e.cellIds.moveToNewColumn(a)}},moveColumn:(e,n)=>n.column===n.overColumn?e:{...e,cellIds:e.cellIds.moveColumn(n.column,n.overColumn)},focusCell:(e,n)=>{let a=e.cellIds.findWithId(n.cellId);if(a.length===0)return e;let{cellId:o,where:s}=n,c=a.indexOfOrThrow(o),p;p=s==="before"?Bh(c-1,0,a.length-1):s==="after"?Bh(c+1,0,a.length-1):c;let d=a.atOrThrow(p);return ks({cellId:d,cell:e.cellHandles[d],isCodeHidden:Cs(e,d),codeFocus:s==="after"?"top":"bottom",variableName:void 0}),e},focusTopCell:e=>{let n=e.cellIds.getColumns().at(0);if(n===void 0||n.length===0)return e;let a=n.first();return ks({cellId:a,cell:e.cellHandles[a],isCodeHidden:Cs(e,a),codeFocus:void 0,variableName:void 0}),bT(),e},focusBottomCell:e=>{let n=e.cellIds.getColumns().at(-1);if(n===void 0||n.length===0)return e;let a=n.last();return ks({cellId:a,cell:e.cellHandles[a],isCodeHidden:Cs(e,a),codeFocus:void 0,variableName:void 0}),vT(),e},sendToTop:(e,n)=>{let a=e.cellIds.findWithId(n.cellId);if(a.length===0)return e;let{cellId:o,scroll:s=!0}=n,c=a.indexOfOrThrow(o);return c===0?e:{...e,cellIds:e.cellIds.moveWithinColumn(a.id,c,0),scrollKey:s?o:null}},sendToBottom:(e,n)=>{let a=e.cellIds.findWithId(n.cellId);if(a.length===0)return e;let{cellId:o,scroll:s=!0}=n,c=a.indexOfOrThrow(o),p=a.length-1;return c===p?e:{...e,cellIds:e.cellIds.moveWithinColumn(a.id,c,p),scrollKey:s?o:null}},addColumn:(e,n)=>{let a=Ya.create();return{...e,cellIds:e.cellIds.addColumn(n.columnId,[a]),cellData:{...e.cellData,[a]:rr({id:a})},cellRuntime:{...e.cellRuntime,[a]:ar()},cellHandles:{...e.cellHandles,[a]:(0,_e.createRef)()},scrollKey:a}},addColumnBreakpoint:(e,n)=>{let{cellId:a}=n;return e.cellIds.getColumns()[0].inOrderIds[0]===a?e:{...e,cellIds:e.cellIds.insertBreakpoint(a)}},deleteColumn:(e,n)=>{let{columnId:a}=n;return{...e,cellIds:e.cellIds.delete(a)}},mergeAllColumns:e=>({...e,cellIds:e.cellIds.mergeAllColumns()}),compactColumns:e=>({...e,cellIds:e.cellIds.compact()}),deleteCell:(e,n)=>{var b,_;let a=n.cellId;if(e.cellIds.hasOnlyOneId())return e;let o;try{o=e.cellIds.findWithId(a)}catch(k){return be.warn("Skipping delete for missing cellId",{cellId:a,error:k}),e}let s=o.indexOfOrThrow(a),c=s===0?1:s-1,p=null;o.length>1&&(p=o.atOrThrow(c));let d=(_=(b=e.cellHandles[a].current)==null?void 0:b.editorView)==null?void 0:_.state.toJSON({history:m8});d&&(d.doc=e.cellData[a].code),ET(a);let m=e.cellData[a];return{...e,cellIds:e.cellIds.deleteById(a),history:[...e.history,{name:m.name,serializedEditorState:d,column:o.id,index:s,isSetupCell:a===Vn,config:m.config}],scrollKey:p}},undoDeleteCell:e=>{if(e.history.length===0)return e;let{name:n,serializedEditorState:a={doc:""},column:o,index:s,isSetupCell:c,config:p}=e.history[e.history.length-1],d=c?Vn:Ya.create(),m=rr({id:d,name:n,code:a.doc,edited:a.doc.trim().length>0,serializedEditorState:a,config:p});return{...e,cellIds:e.cellIds.insertId(d,o,s),cellData:{...e.cellData,[d]:m},cellRuntime:{...e.cellRuntime,[d]:ar()},cellHandles:{...e.cellHandles,[d]:(0,_e.createRef)()},history:e.history.slice(0,-1),scrollKey:d}},clearSerializedEditorState:(e,n)=>{let{cellId:a}=n;return go({state:e,cellId:a,cellReducer:o=>({...o,serializedEditorState:null})})},updateCellCode:(e,n)=>{let{cellId:a,code:o,formattingChange:s}=n;return e.cellData[a]?go({state:e,cellId:a,cellReducer:c=>s?{...c,code:o,lastCodeRun:c.edited?c.lastCodeRun:o}:{...c,code:o,edited:o.trim()!==c.lastCodeRun}}):e},updateCellName:(e,n)=>{let{cellId:a,name:o}=n;return go({state:e,cellId:a,cellReducer:s=>({...s,name:o})})},updateCellConfig:(e,n)=>{let{cellId:a,config:o}=n;return go({state:e,cellId:a,cellReducer:s=>({...s,config:{...s.config,...o}})})},prepareForRun:(e,n)=>go({state:Ss({state:e,cellId:n.cellId,cellReducer:a=>nT(a)}),cellId:n.cellId,cellReducer:a=>({...a,edited:!1,lastCodeRun:a.code.trim()})}),handleCellMessage:(e,n)=>{let a=n.cell_id,o=Ss({state:e,cellId:a,cellReducer:s=>tT(s,n)});return n.status==="queued"&&(o=go({state:o,cellId:a,cellReducer:s=>({...s,lastCodeRun:s.code.trim(),edited:!1})})),{...o,cellLogs:[...o.cellLogs,...yT(n)]}},setCellIds:(e,n)=>{if(h6(e.cellIds.inOrderIds,n.cellIds))return e;let a={...e.cellData},o={...e.cellRuntime},s={...e.cellHandles};for(let c of n.cellIds)c in e.cellData||(a[c]=rr({id:c})),c in e.cellRuntime||(o[c]=ar()),c in e.cellHandles||(s[c]=(0,_e.createRef)());return{...e,cellIds:Dl.fromWithPreviousShape(n.cellIds,e.cellIds),cellData:a,cellRuntime:o,cellHandles:s}},setCellCodes:(e,n)=>{var s,c;rn(n.codes.length===n.ids.length,"Expected codes and ids to have the same length");let a={...e},o=({cell:p,code:d,cellId:m,name:b,config:_})=>{if(!p)return rr({id:m,code:d,name:b,config:_,lastCodeRun:n.codeIsStale?null:d,edited:n.codeIsStale&&d.trim().length>0});let k=n.codeIsStale?p.lastCodeRun:d,S=k?k.trim()!==d.trim():!!d;if(p.code.trim()===d.trim())return{...p,code:d,edited:S,lastCodeRun:k,...b!==void 0&&{name:b},..._!==void 0&&{config:_}};if(!Rm()){let E=a.cellHandles[m].current;E!=null&&E.editorViewOrNull&&Ji(E.editorViewOrNull,d)}return{...p,code:d,edited:S,lastCodeRun:k,...b!==void 0&&{name:b},..._!==void 0&&{config:_}}};for(let p=0;p<n.ids.length;p++){let d=n.ids[p],m=n.codes[p];if(d===void 0||m===void 0)continue;let b=(s=n.names)==null?void 0:s[p],_=(c=n.configs)==null?void 0:c[p];a={...a,cellData:{...a.cellData,[d]:o({cell:a.cellData[d],code:m,cellId:d,name:b,config:_})}}}return a},setStdinResponse:(e,n)=>{let{cellId:a,response:o,outputIndex:s}=n;return Ss({state:e,cellId:a,cellReducer:c=>{let p=[...c.consoleOutputs],d=p[s];return d==null||d.channel!=="stdin"?(be.warn("Expected stdin output"),c):(p[s]={channel:"stdin",mimetype:d.mimetype,data:d.data,timestamp:d.timestamp,response:o},{...c,interrupted:!1,consoleOutputs:p})}})},setCells:(e,n)=>{let a=Object.fromEntries(n.map(s=>[s.id,s])),o=Object.fromEntries(n.map(s=>[s.id,ar()]));return $1({...e,cellIds:Dl.fromIdsAndColumns(n.map(s=>[s.id,s.config.column])),cellData:a,cellRuntime:o,cellHandles:Object.fromEntries(n.map(s=>[s.id,(0,_e.createRef)()]))})},moveToNextCell:(e,n)=>{let{cellId:a,before:o,noCreate:s=!1}=n;if(a==="__scratch__")return e;let c=e.cellIds.findWithId(a),p=c.indexOfOrThrow(a),d=o?p-1:p+1,m=d===c.length,b=d===-1;if(m&&!s){let _=Ya.create();return{...e,cellIds:e.cellIds.insertId(_,c.id,d),cellData:{...e.cellData,[_]:rr({id:_})},cellRuntime:{...e.cellRuntime,[_]:ar()},cellHandles:{...e.cellHandles,[_]:(0,_e.createRef)()},scrollKey:_}}if(b&&!s){let _=Ya.create();return{...e,cellIds:e.cellIds.insertId(_,c.id,0),cellData:{...e.cellData,[_]:rr({id:_})},cellRuntime:{...e.cellRuntime,[_]:ar()},cellHandles:{...e.cellHandles,[_]:(0,_e.createRef)()},scrollKey:_}}if((m||b)&&s)return e;if(d>=0&&d<c.length){let _=c.atOrThrow(d);ks({cellId:_,cell:e.cellHandles[_],isCodeHidden:Cs(e,_),codeFocus:o?"bottom":"top",variableName:void 0})}return e},markTouched:(e,n)=>{let{cellId:a}=n;if(e.untouchedNewCells.has(a)){let o=new Set(e.untouchedNewCells);return o.delete(a),{...e,untouchedNewCells:o}}return e},markUntouched:(e,n)=>{let{cellId:a}=n;if(!e.untouchedNewCells.has(a)){let o=new Set(e.untouchedNewCells);return o.add(a),{...e,untouchedNewCells:o}}return e},scrollToTarget:e=>{let n=e.scrollKey;if(n===null)return e;let a=e.cellIds.findWithId(n),o=a.indexOfOrThrow(n),s=o===a.length-1?a.last():a.atOrThrow(o);return ks({cellId:s,cell:e.cellHandles[s],isCodeHidden:Cs(e,s),codeFocus:void 0,variableName:void 0}),{...e,scrollKey:null}},foldAll:e=>(Mk(Object.values(e.cellHandles).map(n=>{var a;return(a=n.current)==null?void 0:a.editorView})),e),unfoldAll:e=>(Dk(Object.values(e.cellHandles).map(n=>{var a;return(a=n.current)==null?void 0:a.editorView})),e),clearLogs:e=>({...e,cellLogs:[]}),collapseCell:(e,n)=>{let{cellId:a}=n,o=e.cellIds.findWithId(a),s=o.topLevelIds.map(d=>e.cellRuntime[d].outline),c=P1(o.indexOfOrThrow(a),s);if(!c)return e;let p=o.atOrThrow(c[1]);return{...e,cellIds:e.cellIds.transformWithCellId(a,d=>d.collapse(a,p)),scrollKey:a}},expandCell:(e,n)=>{let{cellId:a}=n;return{...e,cellIds:e.cellIds.transformWithCellId(a,o=>o.expand(a)),scrollKey:a}},collapseAllCells:e=>({...e,cellIds:e.cellIds.transformAll(n=>{let a=n.topLevelIds.map(m=>e.cellRuntime[m].outline),o=[...n.nodes],s=[],c=[],p=o.length-1;for(;p>=0;){let m=P1(p,a);if(m){let b=p,_=m[1],k=s.find(L=>L.start<=_&&L.end===_);k&&(_=k.start),s.push({start:b,end:_});let S=n.atOrThrow(b),E=n.atOrThrow(_);c.push({id:S,until:E})}else c.push(null);p--}let d=c.toReversed();return n.collapseAll(d)})}),expandAllCells:e=>({...e,cellIds:e.cellIds.transformAll(n=>n.expandAll())}),showCellIfHidden:(e,n)=>{let{cellId:a}=n,o=e.cellIds.findWithId(a),s=o,c=o.findAndExpandDeep(a);return c.equals(s)?e:{...e,cellIds:e.cellIds.transformWithCellId(a,()=>c)}},splitCell:(e,n)=>{var _;let{cellId:a}=n,o=e.cellIds.findWithId(a),s=o.indexOfOrThrow(a),c=e.cellData[a],p=e.cellHandles[a].current;if((p==null?void 0:p.editorView)==null)return e;let{beforeCursorCode:d,afterCursorCode:m}=U4(p.editorView);Ji(p.editorView,d);let b=Ya.create();return{...e,cellIds:e.cellIds.insertId(b,o.id,s+1),cellData:{...e.cellData,[a]:{...c,code:d,edited:!!d&&d.trim()!==((_=c.lastCodeRun)==null?void 0:_.trim())},[b]:rr({id:b,code:m,edited:!!m})},cellRuntime:{...e.cellRuntime,[a]:{...e.cellRuntime[a],output:null,consoleOutputs:[]},[b]:ar()},cellHandles:{...e.cellHandles,[b]:(0,_e.createRef)()},scrollKey:b}},undoSplitCell:(e,n)=>{var p;let{cellId:a,snapshot:o}=n,s=e.cellData[a],c=e.cellHandles[a].current;return(c==null?void 0:c.editorView)==null?e:(Ji(c.editorView,o),{...e,cellIds:e.cellIds.transformWithCellId(a,d=>{let m=d.indexOfOrThrow(a)+1;return d.deleteAtIndex(m)}),cellData:{...e.cellData,[a]:{...s,code:o,edited:!!o&&(o==null?void 0:o.trim())!==((p=s.lastCodeRun)==null?void 0:p.trim())}},cellRuntime:{...e.cellRuntime,[a]:{...e.cellRuntime[a],output:null,consoleOutputs:[]}},cellHandles:{...e.cellHandles}})},clearCellOutput:(e,n)=>{let{cellId:a}=n;return Ss({state:e,cellId:a,cellReducer:o=>({...o,output:null,consoleOutputs:[]})})},clearCellConsoleOutput:(e,n)=>{let{cellId:a}=n;return Ss({state:e,cellId:a,cellReducer:o=>({...o,consoleOutputs:o.consoleOutputs.filter(s=>s.channel==="stdin"&&s.response==null)})})},clearAllCellOutputs:e=>{let n={...e.cellRuntime};for(let a of e.cellIds.inOrderIds)n[a]={...n[a],output:null,consoleOutputs:[]};return{...e,cellRuntime:n}},addSetupCellIfDoesntExist:(e,n)=>{let{code:a}=n;return e.cellIds.setupCellExists()?{...e,scrollKey:Vn}:{...e,cellIds:e.cellIds.insertId(Vn,e.cellIds.atOrThrow(0).id,0),cellData:{...e.cellData,[Vn]:rr({id:Vn,name:Vn,code:a,edited:!!a})},cellRuntime:{...e.cellRuntime,[Vn]:ar()},cellHandles:{...e.cellHandles,[Vn]:(0,_e.createRef)()},scrollKey:Vn}}})),W1(uT);function Cs(e,n){return!!e.cellData[n].config.hide_code&&!e.untouchedNewCells.has(n)}function Ss({state:e,cellId:n,cellReducer:a}){return n in e.cellRuntime?{...e,cellRuntime:{...e.cellRuntime,[n]:a(e.cellRuntime[n])}}:(be.warn(`Cell ${n} not found in state`),e)}function go({state:e,cellId:n,cellReducer:a}){return n in e.cellData?{...e,cellData:{...e.cellData,[n]:a(e.cellData[n])}}:(be.warn(`Cell ${n} not found in state`),e)}Z_=function(e){let n=e.cellData,a={column:null};return e.cellIds.getColumns().length>1?e.cellIds.getColumns().flatMap((o,s)=>o.inOrderIds.map((c,p)=>{let d={...a};return p===0&&(d.column=s),{...n[c].config,...d}})):e.cellIds.getColumns().flatMap(o=>o.inOrderIds.map(s=>({...n[s].config,...a})))},rd=Te(e=>e(Ye).cellIds),Nx=Te(e=>e(rd).hasOnlyOneId()),W_=Te(e=>pm(e(Ye)).length>0),Te(e=>o0(e(Ye)).length>0);let K1;Ox=Te(e=>gC(e(Ye))),$x=Te(e=>hC(e(Ye))),ld=Te(e=>{let{cellIds:n,cellRuntime:a,cellData:o}=e(Ye);return n.inOrderIds.map(s=>{var d;let c=a[s],{name:p}=o[s];if(hd((d=c.output)==null?void 0:d.mimetype)){rn(Array.isArray(c.output.data),"Expected array data");let m=c.output.data.filter(b=>!b.type.includes("ancestor"));if(m.length>0)return{output:{...c.output,data:m},cellId:s,cellName:p}}return null}).filter(Boolean)}),N_=Te(e=>{let{cellIds:n,cellRuntime:a}=e(Ye);return J4(n.inOrderIds.map(o=>a[o].outline))}),Sx=Te(e=>e(ld).length),K1=p6(Te(e=>{let{cellIds:n,cellData:a}=e(Ye);return Rr.fromEntries(n.inOrderIds.map(o=>{var s;return[o,(s=a[o])==null?void 0:s.name]}))}));var CT=Te(e=>e(Ye).scrollKey);l_=()=>Sn(Ye),dx=()=>Sn(rd),x_=()=>Sn(K1),px=()=>Sn(ld),b_=()=>Sn(Ye).cellLogs,h_=()=>Sn(CT),sd=()=>Be.get(Ye),yx=()=>Be.get(Ye).cellIds,xx=()=>{let{cellIds:e,cellData:n}=Be.get(Ye);return e.inOrderIds.map(a=>{var o;return(o=n[a])==null?void 0:o.name}).filter(Boolean)};var ST=Ik(kk(Ye,e=>e.cellIds.inOrderIds.map(n=>e.cellData[n])));T_=()=>fw(ST),bx=Te(e=>e(Ye).cellRuntime),Bx=Te(e=>fC(e(Ye))),D_=Te(e=>{let{cellRuntime:n}=e(Ye);return Object.entries(n).every(([a,o])=>o.status!=="running"||a==="__scratch__")}),n_=Te(e=>pC(e(Ye))),Dx=Te(e=>e(Ye).cellIds.colLength),ix=Te(e=>e(Ye).cellIds.idLength>0),Tx=Te(e=>e(Ye).cellIds.getColumnIds()),md=Nd(e=>Te(n=>n(Ye).cellData[e]));var Lf=Nd(e=>Te(n=>n(Ye).cellRuntime[e]));const Q1=Nd(e=>Te(n=>n(Ye).cellHandles[e]));function ET(e){md.remove(e),Lf.remove(e),Q1.remove(e)}a_=e=>{let n=(0,uc.c)(2),a;return n[0]===e?a=n[1]:(a=md(e),n[0]=e,n[1]=a),Sn(a)},O_=e=>{let n=(0,uc.c)(2),a;return n[0]===e?a=n[1]:(a=Lf(e),n[0]=e,n[1]=a),Sn(a)},Gw=e=>{let n=(0,uc.c)(2),a;return n[0]===e?a=n[1]:(a=Q1(e),n[0]=e,n[1]=a),Sn(a)},t0=()=>{let{cellIds:e,cellHandles:n}=Be.get(Ye);return e.inOrderIds.map(a=>{var o,s;return(s=(o=n[a])==null?void 0:o.current)==null?void 0:s.editorViewOrNull}).filter(Boolean)},id=e=>{var a;let{cellHandles:n}=Be.get(Ye);return(a=n[e].current)==null?void 0:a.editorView},gx=function(e){let{cellIds:n,cellData:a,cellRuntime:o}=e;return n.getColumns().flatMap(s=>s.topLevelIds.map(c=>({...a[c],...o[c]})))},J_=function(e){return Te(n=>n(Ye).untouchedNewCells.has(e))};function TT(e){let n=Lf(e);return Te(a=>{let o=a(n);if(!o||o.status==="queued"||o.status==="running")return;let s=[],c=o.consoleOutputs;if(c&&c.length>0){let d=c.find(m=>m.mimetype==="application/vnd.marimo+traceback");if(d){let m=d.data;s.push(...Zm(m))}}let p=o.output;if((p==null?void 0:p.mimetype)==="application/vnd.marimo+error"){let d=p.data;if(Array.isArray(d))for(let m of d)m.type==="syntax"&&m.lineno!=null&&s.push({kind:"cell",cellId:e,lineNumber:m.lineno}),m.type==="import-star"&&m.lineno!=null&&s.push({kind:"cell",cellId:e,lineNumber:m.lineno})}return s.length>0?s:void 0})}s_=function(e){let n=(0,uc.c)(2),a;return n[0]===e?a=n[1]:(a=e===void 0?{}:e,n[0]=e,n[1]=a),U1(a)}})();export{Gh as $,Jh as $n,Xa as $r,Xh as $t,Gw as A,Yh as Ai,Zh as An,Jw as Ar,Xw as At,Yw as B,Zw as Bn,e_ as Br,t_ as Bt,n_ as C,Ya as Ci,em as Cn,r_ as Cr,Bn as Ct,a_ as D,Vn as Di,i_ as Dn,o_ as Dr,tm as Dt,s_ as E,ls as Ei,Tl as En,Fu as Er,Bu as Et,l_ as F,Vu as Fi,Za as Fn,Ki as Fr,nm as Ft,c_ as G,Hu as Gn,u_ as Gr,rm as Gt,d_ as H,$u as Hn,f_ as Hr,p_ as Ht,h_ as I,Wu as Ii,m_ as In,ot as Ir,am as It,im as J,g_ as Jn,om as Jr,Uu as Jt,sm as K,y_ as Kn,Qi as Kr,v_ as Kt,rr as L,Il as Ln,ua as Lr,Ll as Lt,b_ as M,lm as Mi,Ku as Mn,w_ as Mr,__ as Mt,x_ as N,k_ as Ni,C_ as Nn,S_ as Nr,E_ as Nt,T_ as O,Qu as Oi,I_ as On,L_ as Or,cm as Ot,O_ as P,A_ as Pi,R_ as Pn,da as Pr,P_ as Pt,um as Q,dm as Qn,Ol as Qr,fm as Qt,ar as R,Gu as Rn,pm as Rr,Hn as Rt,N_ as S,hm as Si,Ju as Sn,Gi as Sr,M_ as St,D_ as T,En as Ti,j_ as Tn,z_ as Tr,Xu as Tt,q_ as U,Al as Un,mm as Ur,F_ as Ut,gm as V,Yu as Vn,ym as Vr,B_ as Vt,vm as W,V_ as Wn,Zu as Wr,bm as Wt,H_ as X,$_ as Xn,Rl as Xr,ed as Xt,wm as Y,td as Yn,Pl as Yr,Nr as Yt,_m as Z,Nl as Zn,cs as Zr,nd as Zt,W_ as _,J8 as __tla,Ml as _i,U_ as _n,xm as _r,km as _t,rd as a,Dl as ai,K_ as an,Cm as ar,Sm as at,Ye as b,Q_ as bi,ad as bn,G_ as br,Ji as bt,J_ as c,X_ as ci,fa as cn,Em as cr,Y_ as ct,Z_ as d,ex as di,tx as dn,Tm as dr,Im as dt,nx as ei,Lm as en,Xi as er,rx as et,id as f,ax as fi,Om as fn,Am as fr,Rm as ft,ix as g,ox as gi,od as gn,Pm as gr,Nm as gt,sd as h,mn as hi,sx as hn,Mm as hr,lx as ht,ld as i,ei as ii,cx as in,Dm as ir,ux as it,dx as j,fx as ji,jm as jn,jl as jr,cd as jt,px as k,hx as ki,ud as kn,mx as kr,zm as kt,gx as l,dd as li,zl as ln,fd as lr,qm as lt,yx as m,vx as mi,pd as mn,Fm as mr,hd as mt,md as n,Bm as ni,Vm as nn,Hm as nr,$m as nt,bx as o,wx as oi,_x as on,Yi as or,Wm as ot,xx as p,us as pi,Um as pn,Km as pr,kx as pt,Qm as q,ti as qn,gd as qr,Cx as qt,Sx as r,Gm as ri,Jm as rn,Xm as rr,Ex as rt,Tx as s,Ym as si,Ix as sn,yd as sr,Lx as st,Ox as t,Zm as ti,Ax as tn,e0 as tr,vd as tt,t0 as u,ds as ui,Rx as un,fs as ur,Px as ut,Nx as v,ql as vi,Mx as vn,n0 as vr,r0 as vt,Dx as w,jx as wi,zx as wn,qx as wr,Fx as wt,Bx as x,Vx as xi,a0 as xn,bd as xr,Hx as xt,$x as y,wd as yi,_d as yn,i0 as yr,wr as yt,Wx as z,ni as zn,o0 as zr,xd as zt};
@@ -1 +1 @@
1
- import{s as P}from"./chunk-LvLJmgfZ.js";import{t as U}from"./react-Bj1aDYRI.js";import{pr as Y,sr as $}from"./cells-BVG4a-Qn.js";import{C as z,P as G,R as E,T as K}from"./zod-H_cgTO0M.js";import{t as J}from"./compiler-runtime-B3qBwwSJ.js";import{t as L}from"./isEmpty-Do0cOI51.js";import{Y as Q}from"./ai-model-dropdown-B-sbS07W.js";import{_ as W}from"./useEventListener-DGjKht0c.js";import{t as C}from"./cn-DYvqRARy.js";import{t as X}from"./jsx-runtime-Blw4afVn.js";import{a as D,i as I,n as V,r as B}from"./multi-map-MSuUqmbC.js";import{i as Z}from"./strings-pfr2N700.js";import{t as ee}from"./bot-message-square-BbnE8Q1J.js";import{t as H}from"./markdown-renderer-BiKTlki_.js";import{l as te}from"./add-cell-with-ai-DUq7Y523.js";import{n as se}from"./spinner-C5wIpWgQ.js";import{c as ae}from"./datasource-BzTPyEw3.js";import{t as re}from"./RenderHTML-BOW_1WUn.js";var le=J(),ne=P(U(),1),t=P(X(),1);const oe=n=>{let e=(0,le.c)(13),{reasoning:a,index:l,isStreaming:s}=n,r=l===void 0?0:l,m=s===void 0?!1:s,o=m?"reasoning":void 0,x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=(0,t.jsx)(ee,{className:"h-3 w-3"}),e[0]=x):x=e[0];let p=m?"Thinking":"View reasoning",c;e[1]!==a.length||e[2]!==p?(c=(0,t.jsx)(D,{className:"text-xs text-muted-foreground hover:bg-muted/50 px-2 py-1 h-auto rounded-sm [&[data-state=open]>svg]:rotate-180",children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[x,p," (",a.length," ","chars)"]})}),e[1]=a.length,e[2]=p,e[3]=c):c=e[3];let i;e[4]===a?i=e[5]:(i=(0,t.jsx)(B,{className:"pb-2 px-2",children:(0,t.jsx)("div",{className:"bg-muted/30 border border-muted/50 rounded-md p-3 italic text-muted-foreground/90 relative",children:(0,t.jsx)("div",{className:"pr-6",children:(0,t.jsx)(H,{content:a})})})}),e[4]=a,e[5]=i);let d;e[6]!==c||e[7]!==i?(d=(0,t.jsxs)(I,{value:"reasoning",className:"border-0",children:[c,i]}),e[6]=c,e[7]=i,e[8]=d):d=e[8];let u;return e[9]!==r||e[10]!==o||e[11]!==d?(u=(0,t.jsx)(V,{type:"single",collapsible:!0,className:"w-full mb-2",value:o,children:d},r),e[9]=r,e[10]=o,e[11]=d,e[12]=u):u=e[12],u};var T=J(),ie=G({status:E().default("success"),auth_required:K().default(!1),action_url:z(),next_steps:z(),meta:z(),message:E().nullish()}).passthrough(),de=n=>{let e=(0,T.c)(12),{data:a}=n,l;if(e[0]!==a){let{status:s,auth_required:r,action_url:m,meta:o,next_steps:x,message:p,...c}=a,i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)("h3",{className:"text-xs font-semibold text-muted-foreground",children:"Tool Result"}),e[2]=i):i=e[2];let d;e[3]===s?d=e[4]:(d=(0,t.jsx)("span",{className:"text-xs px-2 py-0.5 bg-[var(--grass-2)] text-[var(--grass-11)] rounded-full font-medium capitalize",children:s}),e[3]=s,e[4]=d);let u;e[5]===r?u=e[6]:(u=r&&(0,t.jsx)("span",{className:"text-xs px-2 py-0.5 bg-[var(--amber-2)] text-[var(--amber-11)] rounded-full",children:"Auth Required"}),e[5]=r,e[6]=u);let h;e[7]!==d||e[8]!==u?(h=(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[i,(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[d,u]})]}),e[7]=d,e[8]=u,e[9]=h):h=e[9];let f;e[10]===p?f=e[11]:(f=p&&(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)($,{className:"h-3 w-3 text-[var(--blue-11)] mt-0.5 flex-shrink-0"}),(0,t.jsx)("div",{className:"text-xs text-foreground",children:p})]}),e[10]=p,e[11]=f),l=(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[h,f,c&&(0,t.jsx)("div",{className:"space-y-3",children:Object.entries(c).map(xe)})]}),e[0]=a,e[1]=l}else l=e[1];return l},ce=n=>{let e=(0,T.c)(8),{result:a}=n,l;e[0]===a?l=e[1]:(l=ie.safeParse(a),e[0]=a,e[1]=l);let s=l;if(s.success){let o;return e[2]===s.data?o=e[3]:(o=(0,t.jsx)(de,{data:s.data}),e[2]=s.data,e[3]=o),o}let r;e[4]===a?r=e[5]:(r=typeof a=="string"?a:JSON.stringify(a,null,2),e[4]=a,e[5]=r);let m;return e[6]===r?m=e[7]:(m=(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground mb-1 max-h-64 overflow-y-auto scrollbar-thin",children:r}),e[6]=r,e[7]=m),m},me=n=>{let e=(0,T.c)(9),{input:a}=n;if(!(a&&a!==null))return null;let l;e[0]===a?l=e[1]:(l=L(a),e[0]=a,e[1]=l);let s=l,r=typeof a=="object"&&!Array.isArray(a)&&Object.keys(a).length>0,m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)("h3",{className:"text-xs font-semibold text-muted-foreground",children:"Tool Request"}),e[2]=m):m=e[2];let o;e[3]!==a||e[4]!==s||e[5]!==r?(o=s?"{}":r?JSON.stringify(a,null,2):String(a),e[3]=a,e[4]=s,e[5]=r,e[6]=o):o=e[6];let x;return e[7]===o?x=e[8]:(x=(0,t.jsxs)("div",{className:"space-y-2",children:[m,(0,t.jsx)("pre",{className:"bg-[var(--slate-2)] p-2 text-muted-foreground border border-[var(--slate-4)] rounded text-xs overflow-auto scrollbar-thin max-h-64",children:o})]}),e[7]=o,e[8]=x),x};const M=n=>{let e=(0,T.c)(38),{toolName:a,result:l,error:s,index:r,state:m,className:o,input:x}=n,p=r===void 0?0:r,c=m==="output-available"&&(l||s),i=s?"error":c?"success":"loading",d;e[0]===i?d=e[1]:(d=()=>{switch(i){case"loading":return(0,t.jsx)(se,{className:"h-3 w-3 animate-spin"});case"error":return(0,t.jsx)(Y,{className:"h-3 w-3 text-[var(--red-11)]"});case"success":return(0,t.jsx)(Q,{className:"h-3 w-3 text-[var(--grass-11)]"});default:return(0,t.jsx)(ae,{className:"h-3 w-3"})}},e[0]=i,e[1]=d);let u=d,h;e[2]!==s||e[3]!==c||e[4]!==i?(h=()=>i==="loading"?"Running":s?"Failed":c?"Done":"Tool call",e[2]=s,e[3]=c,e[4]=i,e[5]=h):h=e[5];let f=h,F=`tool-${p}`,g;e[6]===o?g=e[7]:(g=C("w-full",o),e[6]=o,e[7]=g);let A=i==="error"&&"text-[var(--red-11)]/80",k=i==="success"&&"text-[var(--grass-11)]/80",j;e[8]!==A||e[9]!==k?(j=C("h-6 text-xs border-border shadow-none! ring-0! bg-muted/60 hover:bg-muted py-0 px-2 gap-1 rounded-sm [&[data-state=open]>svg]:rotate-180 hover:no-underline",A,k),e[8]=A,e[9]=k,e[10]=j):j=e[10];let v;e[11]===u?v=e[12]:(v=u(),e[11]=u,e[12]=v);let q=f(),b;e[13]===a?b=e[14]:(b=ue(a),e[13]=a,e[14]=b);let N;e[15]===b?N=e[16]:(N=(0,t.jsx)("code",{className:"font-mono text-xs",children:b}),e[15]=b,e[16]=N);let y;e[17]!==q||e[18]!==N||e[19]!==v?(y=(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[v,q,":",N]}),e[17]=q,e[18]=N,e[19]=v,e[20]=y):y=e[20];let w;e[21]!==y||e[22]!==j?(w=(0,t.jsx)(D,{className:j,children:y}),e[21]=y,e[22]=j,e[23]=w):w=e[23];let _;e[24]!==s||e[25]!==c||e[26]!==x||e[27]!==l?(_=c&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(me,{input:x}),l!=null&&(0,t.jsx)(ce,{result:l}),s&&(0,t.jsxs)("div",{className:"bg-[var(--red-2)] border border-[var(--red-6)] rounded-lg p-3",children:[(0,t.jsxs)("div",{className:"text-xs font-semibold text-[var(--red-11)] mb-2 flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-1.5 h-1.5 bg-[var(--red-9)] rounded-full"}),"Error"]}),(0,t.jsx)("div",{className:"text-sm text-[var(--red-11)] leading-relaxed",children:s})]})]}),e[24]=s,e[25]=c,e[26]=x,e[27]=l,e[28]=_):_=e[28];let S;e[29]===_?S=e[30]:(S=(0,t.jsx)(B,{className:"py-2 px-2",children:_}),e[29]=_,e[30]=S);let R;e[31]!==w||e[32]!==S?(R=(0,t.jsxs)(I,{value:"tool-call",className:"border-0",children:[w,S]}),e[31]=w,e[32]=S,e[33]=R):R=e[33];let O;return e[34]!==R||e[35]!==F||e[36]!==g?(O=(0,t.jsx)(V,{type:"single",collapsible:!0,className:g,children:R},F),e[34]=R,e[35]=F,e[36]=g,e[37]=O):O=e[37],O};function ue(n){return n.replace("tool-","")}function xe(n){let[e,a]=n;return L(a)?null:(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("div",{className:"text-xs font-medium text-muted-foreground capitalize flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-1.5 h-1.5 bg-[var(--blue-9)] rounded-full"}),e]}),(0,t.jsx)("pre",{className:"bg-[var(--slate-2)] p-2 text-muted-foreground border border-[var(--slate-4)] rounded text-xs overflow-auto scrollbar-thin max-h-64",children:JSON.stringify(a,null,2)})]},e)}const pe=({message:n,isStreamingReasoning:e,isLast:a})=>{return(0,t.jsx)(t.Fragment,{children:n.parts.map((s,r)=>l(s,r))});function l(s,r){if(he(s))return(0,t.jsx)(M,{index:r,toolName:s.type,result:s.output,className:"my-2",state:s.state,input:s.input},r);if(fe(s))return W.debug("Found data part",s),null;switch(s.type){case"text":return s.text.includes("<marimo-")?(0,t.jsx)(ne.Fragment,{children:re({html:s.text})},r):(0,t.jsx)(H,{content:s.text},r);case"reasoning":return(0,t.jsx)(oe,{reasoning:s.text,index:r,isStreaming:e&&a&&r===(n.parts.length||0)-1},r);case"file":return(0,t.jsx)(te,{attachment:s},r);case"dynamic-tool":return(0,t.jsx)(M,{toolName:s.toolName,result:s.output,state:s.state,input:s.input},r);case"source-document":case"source-url":case"step-start":return W.debug("Found non-renderable part",s),null;default:return Z(s),null}}};function he(n){return n.type.startsWith("tool-")}function fe(n){return n.type.startsWith("data-")}export{pe as t};
1
+ import{s as P}from"./chunk-LvLJmgfZ.js";import{t as U}from"./react-Bj1aDYRI.js";import{pr as Y,sr as $}from"./cells-EJo3u4za.js";import{C as z,P as G,R as E,T as K}from"./zod-H_cgTO0M.js";import{t as J}from"./compiler-runtime-B3qBwwSJ.js";import{t as L}from"./isEmpty-Do0cOI51.js";import{Y as Q}from"./ai-model-dropdown-CRtaHcCu.js";import{_ as W}from"./useEventListener-DGjKht0c.js";import{t as C}from"./cn-DYvqRARy.js";import{t as X}from"./jsx-runtime-Blw4afVn.js";import{a as D,i as I,n as V,r as B}from"./multi-map-MSuUqmbC.js";import{i as Z}from"./strings-pfr2N700.js";import{t as ee}from"./bot-message-square-BbnE8Q1J.js";import{t as H}from"./markdown-renderer-B9RsGqHb.js";import{l as te}from"./add-cell-with-ai-CLklC7KS.js";import{n as se}from"./spinner-C5wIpWgQ.js";import{c as ae}from"./datasource-DY0N42ZB.js";import{t as re}from"./RenderHTML-0dk6-mYI.js";var le=J(),ne=P(U(),1),t=P(X(),1);const oe=n=>{let e=(0,le.c)(13),{reasoning:a,index:l,isStreaming:s}=n,r=l===void 0?0:l,m=s===void 0?!1:s,o=m?"reasoning":void 0,x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=(0,t.jsx)(ee,{className:"h-3 w-3"}),e[0]=x):x=e[0];let p=m?"Thinking":"View reasoning",c;e[1]!==a.length||e[2]!==p?(c=(0,t.jsx)(D,{className:"text-xs text-muted-foreground hover:bg-muted/50 px-2 py-1 h-auto rounded-sm [&[data-state=open]>svg]:rotate-180",children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[x,p," (",a.length," ","chars)"]})}),e[1]=a.length,e[2]=p,e[3]=c):c=e[3];let i;e[4]===a?i=e[5]:(i=(0,t.jsx)(B,{className:"pb-2 px-2",children:(0,t.jsx)("div",{className:"bg-muted/30 border border-muted/50 rounded-md p-3 italic text-muted-foreground/90 relative",children:(0,t.jsx)("div",{className:"pr-6",children:(0,t.jsx)(H,{content:a})})})}),e[4]=a,e[5]=i);let d;e[6]!==c||e[7]!==i?(d=(0,t.jsxs)(I,{value:"reasoning",className:"border-0",children:[c,i]}),e[6]=c,e[7]=i,e[8]=d):d=e[8];let u;return e[9]!==r||e[10]!==o||e[11]!==d?(u=(0,t.jsx)(V,{type:"single",collapsible:!0,className:"w-full mb-2",value:o,children:d},r),e[9]=r,e[10]=o,e[11]=d,e[12]=u):u=e[12],u};var T=J(),ie=G({status:E().default("success"),auth_required:K().default(!1),action_url:z(),next_steps:z(),meta:z(),message:E().nullish()}).passthrough(),de=n=>{let e=(0,T.c)(12),{data:a}=n,l;if(e[0]!==a){let{status:s,auth_required:r,action_url:m,meta:o,next_steps:x,message:p,...c}=a,i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)("h3",{className:"text-xs font-semibold text-muted-foreground",children:"Tool Result"}),e[2]=i):i=e[2];let d;e[3]===s?d=e[4]:(d=(0,t.jsx)("span",{className:"text-xs px-2 py-0.5 bg-[var(--grass-2)] text-[var(--grass-11)] rounded-full font-medium capitalize",children:s}),e[3]=s,e[4]=d);let u;e[5]===r?u=e[6]:(u=r&&(0,t.jsx)("span",{className:"text-xs px-2 py-0.5 bg-[var(--amber-2)] text-[var(--amber-11)] rounded-full",children:"Auth Required"}),e[5]=r,e[6]=u);let h;e[7]!==d||e[8]!==u?(h=(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[i,(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[d,u]})]}),e[7]=d,e[8]=u,e[9]=h):h=e[9];let f;e[10]===p?f=e[11]:(f=p&&(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)($,{className:"h-3 w-3 text-[var(--blue-11)] mt-0.5 flex-shrink-0"}),(0,t.jsx)("div",{className:"text-xs text-foreground",children:p})]}),e[10]=p,e[11]=f),l=(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[h,f,c&&(0,t.jsx)("div",{className:"space-y-3",children:Object.entries(c).map(xe)})]}),e[0]=a,e[1]=l}else l=e[1];return l},ce=n=>{let e=(0,T.c)(8),{result:a}=n,l;e[0]===a?l=e[1]:(l=ie.safeParse(a),e[0]=a,e[1]=l);let s=l;if(s.success){let o;return e[2]===s.data?o=e[3]:(o=(0,t.jsx)(de,{data:s.data}),e[2]=s.data,e[3]=o),o}let r;e[4]===a?r=e[5]:(r=typeof a=="string"?a:JSON.stringify(a,null,2),e[4]=a,e[5]=r);let m;return e[6]===r?m=e[7]:(m=(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground mb-1 max-h-64 overflow-y-auto scrollbar-thin",children:r}),e[6]=r,e[7]=m),m},me=n=>{let e=(0,T.c)(9),{input:a}=n;if(!(a&&a!==null))return null;let l;e[0]===a?l=e[1]:(l=L(a),e[0]=a,e[1]=l);let s=l,r=typeof a=="object"&&!Array.isArray(a)&&Object.keys(a).length>0,m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)("h3",{className:"text-xs font-semibold text-muted-foreground",children:"Tool Request"}),e[2]=m):m=e[2];let o;e[3]!==a||e[4]!==s||e[5]!==r?(o=s?"{}":r?JSON.stringify(a,null,2):String(a),e[3]=a,e[4]=s,e[5]=r,e[6]=o):o=e[6];let x;return e[7]===o?x=e[8]:(x=(0,t.jsxs)("div",{className:"space-y-2",children:[m,(0,t.jsx)("pre",{className:"bg-[var(--slate-2)] p-2 text-muted-foreground border border-[var(--slate-4)] rounded text-xs overflow-auto scrollbar-thin max-h-64",children:o})]}),e[7]=o,e[8]=x),x};const M=n=>{let e=(0,T.c)(38),{toolName:a,result:l,error:s,index:r,state:m,className:o,input:x}=n,p=r===void 0?0:r,c=m==="output-available"&&(l||s),i=s?"error":c?"success":"loading",d;e[0]===i?d=e[1]:(d=()=>{switch(i){case"loading":return(0,t.jsx)(se,{className:"h-3 w-3 animate-spin"});case"error":return(0,t.jsx)(Y,{className:"h-3 w-3 text-[var(--red-11)]"});case"success":return(0,t.jsx)(Q,{className:"h-3 w-3 text-[var(--grass-11)]"});default:return(0,t.jsx)(ae,{className:"h-3 w-3"})}},e[0]=i,e[1]=d);let u=d,h;e[2]!==s||e[3]!==c||e[4]!==i?(h=()=>i==="loading"?"Running":s?"Failed":c?"Done":"Tool call",e[2]=s,e[3]=c,e[4]=i,e[5]=h):h=e[5];let f=h,F=`tool-${p}`,g;e[6]===o?g=e[7]:(g=C("w-full",o),e[6]=o,e[7]=g);let A=i==="error"&&"text-[var(--red-11)]/80",k=i==="success"&&"text-[var(--grass-11)]/80",j;e[8]!==A||e[9]!==k?(j=C("h-6 text-xs border-border shadow-none! ring-0! bg-muted/60 hover:bg-muted py-0 px-2 gap-1 rounded-sm [&[data-state=open]>svg]:rotate-180 hover:no-underline",A,k),e[8]=A,e[9]=k,e[10]=j):j=e[10];let v;e[11]===u?v=e[12]:(v=u(),e[11]=u,e[12]=v);let q=f(),b;e[13]===a?b=e[14]:(b=ue(a),e[13]=a,e[14]=b);let N;e[15]===b?N=e[16]:(N=(0,t.jsx)("code",{className:"font-mono text-xs",children:b}),e[15]=b,e[16]=N);let y;e[17]!==q||e[18]!==N||e[19]!==v?(y=(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[v,q,":",N]}),e[17]=q,e[18]=N,e[19]=v,e[20]=y):y=e[20];let w;e[21]!==y||e[22]!==j?(w=(0,t.jsx)(D,{className:j,children:y}),e[21]=y,e[22]=j,e[23]=w):w=e[23];let _;e[24]!==s||e[25]!==c||e[26]!==x||e[27]!==l?(_=c&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(me,{input:x}),l!=null&&(0,t.jsx)(ce,{result:l}),s&&(0,t.jsxs)("div",{className:"bg-[var(--red-2)] border border-[var(--red-6)] rounded-lg p-3",children:[(0,t.jsxs)("div",{className:"text-xs font-semibold text-[var(--red-11)] mb-2 flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-1.5 h-1.5 bg-[var(--red-9)] rounded-full"}),"Error"]}),(0,t.jsx)("div",{className:"text-sm text-[var(--red-11)] leading-relaxed",children:s})]})]}),e[24]=s,e[25]=c,e[26]=x,e[27]=l,e[28]=_):_=e[28];let S;e[29]===_?S=e[30]:(S=(0,t.jsx)(B,{className:"py-2 px-2",children:_}),e[29]=_,e[30]=S);let R;e[31]!==w||e[32]!==S?(R=(0,t.jsxs)(I,{value:"tool-call",className:"border-0",children:[w,S]}),e[31]=w,e[32]=S,e[33]=R):R=e[33];let O;return e[34]!==R||e[35]!==F||e[36]!==g?(O=(0,t.jsx)(V,{type:"single",collapsible:!0,className:g,children:R},F),e[34]=R,e[35]=F,e[36]=g,e[37]=O):O=e[37],O};function ue(n){return n.replace("tool-","")}function xe(n){let[e,a]=n;return L(a)?null:(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("div",{className:"text-xs font-medium text-muted-foreground capitalize flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-1.5 h-1.5 bg-[var(--blue-9)] rounded-full"}),e]}),(0,t.jsx)("pre",{className:"bg-[var(--slate-2)] p-2 text-muted-foreground border border-[var(--slate-4)] rounded text-xs overflow-auto scrollbar-thin max-h-64",children:JSON.stringify(a,null,2)})]},e)}const pe=({message:n,isStreamingReasoning:e,isLast:a})=>{return(0,t.jsx)(t.Fragment,{children:n.parts.map((s,r)=>l(s,r))});function l(s,r){if(he(s))return(0,t.jsx)(M,{index:r,toolName:s.type,result:s.output,className:"my-2",state:s.state,input:s.input},r);if(fe(s))return W.debug("Found data part",s),null;switch(s.type){case"text":return s.text.includes("<marimo-")?(0,t.jsx)(ne.Fragment,{children:re({html:s.text})},r):(0,t.jsx)(H,{content:s.text},r);case"reasoning":return(0,t.jsx)(oe,{reasoning:s.text,index:r,isStreaming:e&&a&&r===(n.parts.length||0)-1},r);case"file":return(0,t.jsx)(te,{attachment:s},r);case"dynamic-tool":return(0,t.jsx)(M,{toolName:s.toolName,result:s.output,state:s.state,input:s.input},r);case"source-document":case"source-url":case"step-start":return W.debug("Found non-renderable part",s),null;default:return Z(s),null}}};function he(n){return n.type.startsWith("tool-")}function fe(n){return n.type.startsWith("data-")}export{pe as t};