@marimo-team/frontend 0.19.8-dev37 → 0.19.8-dev39

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 (67) hide show
  1. package/dist/assets/{CellStatus-BjDayMOF.js → CellStatus-D-CCv4h6.js} +1 -1
  2. package/dist/assets/{JsonOutput-BUok9dqY.js → JsonOutput-CU0ad2LH.js} +1 -1
  3. package/dist/assets/{MarimoErrorOutput-Dxf6p5lw.js → MarimoErrorOutput-BydcsyYP.js} +1 -1
  4. package/dist/assets/{RenderHTML-BUCe3qCj.js → RenderHTML-3amWMGgo.js} +1 -1
  5. package/dist/assets/{add-cell-with-ai-J44RQi7o.js → add-cell-with-ai-B07D0AiE.js} +1 -1
  6. package/dist/assets/{add-database-form-mXHOy5uZ.js → add-database-form-BnEY6X5s.js} +1 -1
  7. package/dist/assets/{agent-panel-Cf8Ij8-7.js → agent-panel-C1O0Y8Bi.js} +1 -1
  8. package/dist/assets/{ai-model-dropdown-DC4t5PJE.js → ai-model-dropdown-Cugcw6NV.js} +4 -4
  9. package/dist/assets/{app-config-button-xVJ4tqzu.js → app-config-button-66OSct-U.js} +1 -1
  10. package/dist/assets/{cell-editor-DqRAVfCm.js → cell-editor-DZgQrVMs.js} +1 -1
  11. package/dist/assets/{cell-link-dnd6DfEI.js → cell-link-B37i0WNz.js} +1 -1
  12. package/dist/assets/{cells-CiFhRLUd.js → cells-B0XKj2oa.js} +1 -1
  13. package/dist/assets/{chat-components-C5FA1-Vu.js → chat-components-BNjAKvAv.js} +1 -1
  14. package/dist/assets/{chat-display-ChS1NL3o.js → chat-display-q9RdcWB-.js} +1 -1
  15. package/dist/assets/{chat-panel-Duk4139r.js → chat-panel-viPqlAXC.js} +1 -1
  16. package/dist/assets/{column-preview-BUTci9vI.js → column-preview-DrmYyyvE.js} +1 -1
  17. package/dist/assets/{command-MHa10zT2.js → command-DTFQw11F.js} +1 -1
  18. package/dist/assets/{command-palette-CV-A8WzZ.js → command-palette-CrOe4bpD.js} +1 -1
  19. package/dist/assets/{common-CR6DwVIy.js → common-C0Pspoza.js} +1 -1
  20. package/dist/assets/{datasource-C7Acf9BM.js → datasource-2_-ICoTV.js} +1 -1
  21. package/dist/assets/{dependency-graph-panel-n8clB1B4.js → dependency-graph-panel-z8kf8Tus.js} +1 -1
  22. package/dist/assets/{documentation-panel-B4SYV31-.js → documentation-panel-DIp1L-6Y.js} +1 -1
  23. package/dist/assets/{download-CUgZOA9O.js → download-CxmzcjnR.js} +1 -1
  24. package/dist/assets/{edit-page-DTcdRtOK.js → edit-page-Bo-t07GL.js} +3 -3
  25. package/dist/assets/{error-panel-Dp0gIK8O.js → error-panel-Cz3rrpG9.js} +1 -1
  26. package/dist/assets/{file-explorer-panel-BqVToUzC.js → file-explorer-panel-BJWXa6fg.js} +1 -1
  27. package/dist/assets/{floating-outline-CZzxqWyr.js → floating-outline-BSd7WV6r.js} +1 -1
  28. package/dist/assets/{focus-CtXToHnV.js → focus-CZLCQiuh.js} +1 -1
  29. package/dist/assets/{form-CvVbbh8Y.js → form-BQhIjeKF.js} +1 -1
  30. package/dist/assets/{globals-D1aM0aUX.js → globals-DvWD0xHx.js} +1 -1
  31. package/dist/assets/{home-page-DJMymeT8.js → home-page-BaZhe30b.js} +1 -1
  32. package/dist/assets/{hooks-STSuFYve.js → hooks-B2h7NTXb.js} +1 -1
  33. package/dist/assets/{html-to-image-BKGhRUqR.js → html-to-image-Cc7t14sm.js} +1 -1
  34. package/dist/assets/{index-GARjwpYQ.js → index-BSNJ0Y0E.js} +3 -3
  35. package/dist/assets/{kiosk-mode-B93ch1Yg.js → kiosk-mode-S90PbrZr.js} +1 -1
  36. package/dist/assets/{layout-DWzvYkJc.js → layout-BRVYycwo.js} +1 -1
  37. package/dist/assets/{logs-panel-Cqc-8g3U.js → logs-panel-DU1PTK6I.js} +1 -1
  38. package/dist/assets/{markdown-renderer-Dotqbx_q.js → markdown-renderer-Y3WEBmX7.js} +1 -1
  39. package/dist/assets/{mode-O-1bKZO6.js → mode-CTf4rB7H.js} +1 -1
  40. package/dist/assets/{name-cell-input-Bb4XgE9B.js → name-cell-input-Bmq-KdJ-.js} +1 -1
  41. package/dist/assets/{outline-panel-DvQn81N7.js → outline-panel-Cfpy5BTW.js} +1 -1
  42. package/dist/assets/{packages-panel-CFja8lcb.js → packages-panel-C2SNGD_P.js} +1 -1
  43. package/dist/assets/{panels-DkQNKTXx.js → panels-H6ZOifLe.js} +1 -1
  44. package/dist/assets/{process-output-B1EqjOGn.js → process-output-CdIpMer6.js} +1 -1
  45. package/dist/assets/{readonly-python-code-3nLIGqDx.js → readonly-python-code-o3TsTcFg.js} +1 -1
  46. package/dist/assets/{run-page-CyMNZt0d.js → run-page-C4QFxEzE.js} +1 -1
  47. package/dist/assets/{scratchpad-panel-eznTRPdo.js → scratchpad-panel-9Nh-KCKz.js} +1 -1
  48. package/dist/assets/{session-panel-y6latVrC.js → session-panel-9cibvZIi.js} +1 -1
  49. package/dist/assets/{snippets-panel-Exg8CrcD.js → snippets-panel-BLiaEg0s.js} +1 -1
  50. package/dist/assets/{state-CMAvJZxx.js → state-Q32Iqos3.js} +1 -1
  51. package/dist/assets/{switch-BF1BnESM.js → switch-D5W4wgWK.js} +1 -1
  52. package/dist/assets/{textarea-sdXkC92D.js → textarea-UfsPtSW1.js} +1 -1
  53. package/dist/assets/{tracing-BCW3BhkT.js → tracing-BqFhwuOc.js} +1 -1
  54. package/dist/assets/{tracing-panel-0nE7-znv.js → tracing-panel-R9i0TrmX.js} +2 -2
  55. package/dist/assets/{types-ChPQge47.js → types-DIb0tcCO.js} +1 -1
  56. package/dist/assets/{useAddCell-DQzBfMNz.js → useAddCell-CXRk4Ma4.js} +1 -1
  57. package/dist/assets/{useCellActionButton-ChlSq72t.js → useCellActionButton-Du-bZZ06.js} +1 -1
  58. package/dist/assets/{useDeleteCell-BocCAiDk.js → useDeleteCell-D0DAGwMP.js} +1 -1
  59. package/dist/assets/{useDependencyPanelTab-BUgnrQ1n.js → useDependencyPanelTab-CN5-nxOy.js} +1 -1
  60. package/dist/assets/{useNotebookActions-DuB13MhL.js → useNotebookActions--9xrGXss.js} +1 -1
  61. package/dist/assets/{useRunCells-CNmJhP6h.js → useRunCells-DaW_oMnr.js} +1 -1
  62. package/dist/assets/{useSplitCell-DwvRo6W7.js → useSplitCell-Cjr7nuBc.js} +1 -1
  63. package/dist/assets/{utilities.esm-OH_d3CNC.js → utilities.esm-Bfd1Y8aF.js} +1 -1
  64. package/dist/index.html +31 -31
  65. package/package.json +1 -1
  66. package/src/utils/__tests__/id-tree.test.ts +22 -7
  67. package/src/utils/id-tree.tsx +11 -19
@@ -1 +1 @@
1
- import{s as z}from"./chunk-LvLJmgfZ.js";import{l as X}from"./useEvent-BhXAndur.js";import{t as Z}from"./react-Bj1aDYRI.js";import{St as D}from"./cells-CiFhRLUd.js";import{t as E}from"./compiler-runtime-B3qBwwSJ.js";import{G as $,S as ee,c as te,i as se,l as le,n as ae,u as oe}from"./ai-model-dropdown-DC4t5PJE.js";import{C as ne,v as re,w as Q}from"./utils-YqBXNpsM.js";import{S as ie}from"./config-D2-Bw6QC.js";import{t as ce}from"./jsx-runtime-ZmTK25f3.js";import{t as de}from"./button-CZ3Cs4qb.js";import{l as R}from"./once-Bul8mtFs.js";import{r as U}from"./requests-B4FYHTZl.js";import{t as he}from"./createLucideIcon-BCdY6lG5.js";import{t as me}from"./x-ZP5cObgf.js";import{r as I}from"./input-DHHmNa19.js";import{t as B}from"./settings-OBbrbhij.js";import{a as L,c as M,d as A,g as xe,i as pe,l as F,o as P,p as fe,u as S}from"./textarea-sdXkC92D.js";import{t as ue}from"./use-toast-T0_cQDma.js";import{l as Y}from"./select-B7bfltkI.js";import{t as G}from"./tooltip-C_WgOOcZ.js";import{o as je}from"./alert-dialog-Ctz24SMn.js";import{c as ve,l as ge,n as be,t as K}from"./dialog-tQELcltn.js";import{i as we,r as ye,t as Ne}from"./popover-B-131r4d.js";import{n as Ce}from"./useDebounce-B28kFfrM.js";import{n as ke}from"./ImperativeModal-DZr52ffu.js";import{t as O}from"./kbd-k3Sn_RwW.js";import{t as _e}from"./links-fh_IXIKE.js";import{t as V}from"./Inputs-CbenuziM.js";var Se=he("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=E(),s=z(ce(),1);const Le=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}=U(),w;e[0]===o?w=e[1]:(w=()=>{o(),setTimeout(Me,200)},e[0]=o,e[1]=w);let j=w;if(ie())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)(je,{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)(me,{strokeWidth:1}),e[7]=n):n=e[7];let d;e[8]!==i||e[9]!==m||e[10]!==c?(d=(0,s.jsx)(V,{"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)(G,{content:u,children:d}),e[12]=d,e[13]=u,e[14]=x):x=e[14],x};function Me(){window.close()}var J=E(),W=z(Z(),1),Ae=100;const Fe=()=>{let t=(0,J.c)(37),[e,a]=re(),{saveAppConfig:f}=U(),r=(0,W.useId)(),i=(0,W.useId)(),u;t[0]===Symbol.for("react.memo_cache_sentinel")?(u=fe(ne),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=xe(b),o;t[3]!==f||t[4]!==a?(o=async p=>{await f({config:p}).then(()=>{a(p)}).catch(()=>{a(p)})},t[3]=f,t[4]=a,t[5]=o):o=t[5];let w=o,j;t[6]===w?j=t[7]:(j=p=>{w(p)},t[6]=w,t[7]=j);let m=Ce(j,Ae),c;t[8]===e.width?c=t[9]:(c=[e.width],t[8]=e.width,t[9]=c),(0,W.useEffect)(Pe,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)(oe,{children:"Notebook Settings"}),(0,s.jsx)(le,{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)(H,{title:"Display",children:[(0,s.jsx)(M,{control:l.control,name:"width",render:He}),(0,s.jsx)(M,{control:l.control,name:"app_title",render:Ee})]}),t[14]=l.control,t[15]=x);let h;t[16]===l.control?h=t[17]:(h=(0,s.jsxs)(H,{title:"Custom Files",children:[(0,s.jsx)(M,{control:l.control,name:"css_file",render:Ie}),(0,s.jsx)(M,{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)(H,{title:"Data",children:(0,s.jsx)(M,{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)(F,{className:"flex flex-col gap-2",children:[(0,s.jsx)(L,{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)(D,{id:r,"data-testid":"html-checkbox",checked:_.value.includes("html"),onCheckedChange:()=>{_.onChange(R(_.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)(D,{id:i,"data-testid":"ipynb-checkbox",checked:_.value.includes("ipynb"),onCheckedChange:()=>{_.onChange(R(_.value,"ipynb"))}}),(0,s.jsx)(S,{htmlFor:i,children:"IPYNB"})]})]})}),(0,s.jsx)(A,{})]}),(0,s.jsxs)(P,{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)(H,{title:"Exporting outputs",children:(0,s.jsx)(M,{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)(pe,{...l,children:g}),t[34]=l,t[35]=g,t[36]=k):k=t[36],k};var H=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 Pe(){window.dispatchEvent(new Event("resize"))}function qe(t){return(0,s.jsx)("option",{value:t,children:t},t)}function He(t){let{field:e}=t;return(0,s.jsxs)(F,{className:"flex flex-row items-center space-x-1 space-y-0",children:[(0,s.jsx)(S,{children:"Width"}),(0,s.jsx)(L,{children:(0,s.jsx)(Y,{"data-testid":"app-width-select",onChange:a=>e.onChange(a.target.value),value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:ee().map(qe)})}),(0,s.jsx)(A,{})]})}function Ee(t){let{field:e}=t;return(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(F,{className:"flex flex-row items-center space-x-1 space-y-0",children:[(0,s.jsx)(S,{children:"App title"}),(0,s.jsx)(L,{children:(0,s.jsx)(I,{...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)(P,{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 Ie(t){let{field:e}=t;return(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(F,{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)(L,{children:(0,s.jsx)(I,{...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)(P,{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)(F,{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)(L,{children:(0,s.jsx)(I,{...e,value:e.value??"",placeholder:"head.html",onChange:a=>{e.onChange(a.target.value)}})}),(0,s.jsx)(A,{})]}),(0,s.jsxs)(P,{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)(F,{className:"flex flex-row items-center space-x-1 space-y-0",children:[(0,s.jsx)(S,{children:"SQL Output Type"}),(0,s.jsx)(L,{children:(0,s.jsx)(Y,{"data-testid":"sql-output-select",onChange:a=>{e.onChange(a.target.value),ue({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:te.map(We)})}),(0,s.jsx)(A,{})]}),(0,s.jsxs)(P,{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 De=E();const Qe=t=>{let e=(0,De.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(ae),w=u?"disabled":"hint-green",j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j=(0,s.jsx)(B,{strokeWidth:1.8}),e[0]=j):j=e[0];let m;e[1]===b?m=e[2]:(m=(0,s.jsx)(G,{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)(V,{"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)(be,{className:"w-[90vw] h-[90vh] overflow-hidden sm:max-w-5xl top-[5vh] p-0",children:[(0,s.jsx)($,{children:(0,s.jsx)(ve,{children:"User settings"})}),(0,s.jsx)(se,{})]}),e[7]=d):d=e[7];let x=d;if(!i){let T;e[8]===n?T=e[9]:(T=(0,s.jsx)(ge,{children:n}),e[8]=n,e[9]=T);let q;return e[10]!==o||e[11]!==l||e[12]!==T?(q=(0,s.jsxs)(K,{open:l,onOpenChange:o,children:[T,x]}),e[10]=o,e[11]=l,e[12]=T,e[13]=q):q=e[13],q}let h;e[14]===n?h=e[15]:(h=(0,s.jsx)(we,{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)(Fe,{}),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)(B,{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)(ye,{className:"w-[650px] overflow-auto max-h-[80vh] max-w-[80vw]",align:"end",side:"bottom",onFocusOutside:Re,children:[y,N,(0,s.jsxs)(de,{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)(Ne,{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)(K,{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{Le as n,Se as r,Qe as t};
1
+ import{s as z}from"./chunk-LvLJmgfZ.js";import{l as X}from"./useEvent-BhXAndur.js";import{t as Z}from"./react-Bj1aDYRI.js";import{St as D}from"./cells-B0XKj2oa.js";import{t as E}from"./compiler-runtime-B3qBwwSJ.js";import{G as $,S as ee,c as te,i as se,l as le,n as ae,u as oe}from"./ai-model-dropdown-Cugcw6NV.js";import{C as ne,v as re,w as Q}from"./utils-YqBXNpsM.js";import{S as ie}from"./config-D2-Bw6QC.js";import{t as ce}from"./jsx-runtime-ZmTK25f3.js";import{t as de}from"./button-CZ3Cs4qb.js";import{l as R}from"./once-Bul8mtFs.js";import{r as U}from"./requests-B4FYHTZl.js";import{t as he}from"./createLucideIcon-BCdY6lG5.js";import{t as me}from"./x-ZP5cObgf.js";import{r as I}from"./input-DHHmNa19.js";import{t as B}from"./settings-OBbrbhij.js";import{a as L,c as M,d as A,g as xe,i as pe,l as F,o as P,p as fe,u as S}from"./textarea-UfsPtSW1.js";import{t as ue}from"./use-toast-T0_cQDma.js";import{l as Y}from"./select-B7bfltkI.js";import{t as G}from"./tooltip-C_WgOOcZ.js";import{o as je}from"./alert-dialog-Ctz24SMn.js";import{c as ve,l as ge,n as be,t as K}from"./dialog-tQELcltn.js";import{i as we,r as ye,t as Ne}from"./popover-B-131r4d.js";import{n as Ce}from"./useDebounce-B28kFfrM.js";import{n as ke}from"./ImperativeModal-DZr52ffu.js";import{t as O}from"./kbd-k3Sn_RwW.js";import{t as _e}from"./links-fh_IXIKE.js";import{t as V}from"./Inputs-CbenuziM.js";var Se=he("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=E(),s=z(ce(),1);const Le=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}=U(),w;e[0]===o?w=e[1]:(w=()=>{o(),setTimeout(Me,200)},e[0]=o,e[1]=w);let j=w;if(ie())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)(je,{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)(me,{strokeWidth:1}),e[7]=n):n=e[7];let d;e[8]!==i||e[9]!==m||e[10]!==c?(d=(0,s.jsx)(V,{"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)(G,{content:u,children:d}),e[12]=d,e[13]=u,e[14]=x):x=e[14],x};function Me(){window.close()}var J=E(),W=z(Z(),1),Ae=100;const Fe=()=>{let t=(0,J.c)(37),[e,a]=re(),{saveAppConfig:f}=U(),r=(0,W.useId)(),i=(0,W.useId)(),u;t[0]===Symbol.for("react.memo_cache_sentinel")?(u=fe(ne),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=xe(b),o;t[3]!==f||t[4]!==a?(o=async p=>{await f({config:p}).then(()=>{a(p)}).catch(()=>{a(p)})},t[3]=f,t[4]=a,t[5]=o):o=t[5];let w=o,j;t[6]===w?j=t[7]:(j=p=>{w(p)},t[6]=w,t[7]=j);let m=Ce(j,Ae),c;t[8]===e.width?c=t[9]:(c=[e.width],t[8]=e.width,t[9]=c),(0,W.useEffect)(Pe,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)(oe,{children:"Notebook Settings"}),(0,s.jsx)(le,{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)(H,{title:"Display",children:[(0,s.jsx)(M,{control:l.control,name:"width",render:He}),(0,s.jsx)(M,{control:l.control,name:"app_title",render:Ee})]}),t[14]=l.control,t[15]=x);let h;t[16]===l.control?h=t[17]:(h=(0,s.jsxs)(H,{title:"Custom Files",children:[(0,s.jsx)(M,{control:l.control,name:"css_file",render:Ie}),(0,s.jsx)(M,{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)(H,{title:"Data",children:(0,s.jsx)(M,{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)(F,{className:"flex flex-col gap-2",children:[(0,s.jsx)(L,{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)(D,{id:r,"data-testid":"html-checkbox",checked:_.value.includes("html"),onCheckedChange:()=>{_.onChange(R(_.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)(D,{id:i,"data-testid":"ipynb-checkbox",checked:_.value.includes("ipynb"),onCheckedChange:()=>{_.onChange(R(_.value,"ipynb"))}}),(0,s.jsx)(S,{htmlFor:i,children:"IPYNB"})]})]})}),(0,s.jsx)(A,{})]}),(0,s.jsxs)(P,{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)(H,{title:"Exporting outputs",children:(0,s.jsx)(M,{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)(pe,{...l,children:g}),t[34]=l,t[35]=g,t[36]=k):k=t[36],k};var H=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 Pe(){window.dispatchEvent(new Event("resize"))}function qe(t){return(0,s.jsx)("option",{value:t,children:t},t)}function He(t){let{field:e}=t;return(0,s.jsxs)(F,{className:"flex flex-row items-center space-x-1 space-y-0",children:[(0,s.jsx)(S,{children:"Width"}),(0,s.jsx)(L,{children:(0,s.jsx)(Y,{"data-testid":"app-width-select",onChange:a=>e.onChange(a.target.value),value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:ee().map(qe)})}),(0,s.jsx)(A,{})]})}function Ee(t){let{field:e}=t;return(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(F,{className:"flex flex-row items-center space-x-1 space-y-0",children:[(0,s.jsx)(S,{children:"App title"}),(0,s.jsx)(L,{children:(0,s.jsx)(I,{...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)(P,{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 Ie(t){let{field:e}=t;return(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(F,{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)(L,{children:(0,s.jsx)(I,{...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)(P,{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)(F,{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)(L,{children:(0,s.jsx)(I,{...e,value:e.value??"",placeholder:"head.html",onChange:a=>{e.onChange(a.target.value)}})}),(0,s.jsx)(A,{})]}),(0,s.jsxs)(P,{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)(F,{className:"flex flex-row items-center space-x-1 space-y-0",children:[(0,s.jsx)(S,{children:"SQL Output Type"}),(0,s.jsx)(L,{children:(0,s.jsx)(Y,{"data-testid":"sql-output-select",onChange:a=>{e.onChange(a.target.value),ue({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:te.map(We)})}),(0,s.jsx)(A,{})]}),(0,s.jsxs)(P,{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 De=E();const Qe=t=>{let e=(0,De.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(ae),w=u?"disabled":"hint-green",j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j=(0,s.jsx)(B,{strokeWidth:1.8}),e[0]=j):j=e[0];let m;e[1]===b?m=e[2]:(m=(0,s.jsx)(G,{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)(V,{"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)(be,{className:"w-[90vw] h-[90vh] overflow-hidden sm:max-w-5xl top-[5vh] p-0",children:[(0,s.jsx)($,{children:(0,s.jsx)(ve,{children:"User settings"})}),(0,s.jsx)(se,{})]}),e[7]=d):d=e[7];let x=d;if(!i){let T;e[8]===n?T=e[9]:(T=(0,s.jsx)(ge,{children:n}),e[8]=n,e[9]=T);let q;return e[10]!==o||e[11]!==l||e[12]!==T?(q=(0,s.jsxs)(K,{open:l,onOpenChange:o,children:[T,x]}),e[10]=o,e[11]=l,e[12]=T,e[13]=q):q=e[13],q}let h;e[14]===n?h=e[15]:(h=(0,s.jsx)(we,{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)(Fe,{}),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)(B,{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)(ye,{className:"w-[650px] overflow-auto max-h-[80vh] max-w-[80vw]",align:"end",side:"bottom",onFocusOutside:Re,children:[y,N,(0,s.jsxs)(de,{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)(Ne,{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)(K,{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{Le 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-aCueZs8k.js","./loro_wasm_bg-CdafknAX.js","./chunk-LvLJmgfZ.js"])))=>i.map(i=>d[i]);
2
- var nd=Object.defineProperty;var Ia=re=>{throw TypeError(re)};var rd=(re,q,ge)=>q in re?nd(re,q,{enumerable:!0,configurable:!0,writable:!0,value:ge}):re[q]=ge;var h=(re,q,ge)=>rd(re,typeof q!="symbol"?q+"":q,ge),od=(re,q,ge)=>q.has(re)||Ia("Cannot "+ge);var Fa=(re,q,ge)=>(od(re,q,"read from private field"),ge?ge.call(re):q.get(re)),La=(re,q,ge)=>q.has(re)?Ia("Cannot add the same private member more than once"):q instanceof WeakSet?q.add(re):q.set(re,ge);import{s as Oa}from"./chunk-LvLJmgfZ.js";import{d as Da,f as br,i as Q,l as En,n as ue,p as _t,s as Nn,u as ce}from"./useEvent-BhXAndur.js";import{t as ad}from"./react-Bj1aDYRI.js";import{$ as id,$t as sd,At as yr,B as Ua,Cn as ld,Cr as cd,Ct as _a,Ft as Ba,Gt as ud,Ht as kn,Jr as dd,Kr as ja,Lt as fd,N as md,Nt as wr,Or as hd,Pt as Pa,Q as vr,R as Ma,Rt as pd,St as gd,U as Ra,Un as bd,V as Ga,Xt as yd,a as Ja,bn as wd,ct as Cn,d as Wa,dt as Bt,hr as vd,jr as Ed,kr as Va,kt as Nd,lt as kd,m as Er,mt as Cd,nn as Sd,on as Nr,ot as xd,pn as Td,ri as Sn,rn as Ad,st as kr,tn as Id,u as $a,ut as Fd,vn as Ld,w as xn,wr as Od,xr as Cr,y as nt,yn as Dd,z as Ud,zt as _d,__tla as Bd}from"./cells-CiFhRLUd.js";import{P as Ha,R as jd,k as Pd,w as Md}from"./zod-H_cgTO0M.js";import{t as Ge}from"./compiler-runtime-B3qBwwSJ.js";import{C as Rd,f as Gd,m as Jd,p as Wd,t as Vd,v as $d}from"./ai-model-dropdown-DC4t5PJE.js";import{d as $e,f as Hd,l as Sr,n as qa}from"./hotkeys-BHHWjLlp.js";import{t as jt}from"./invariant-CAG_dYON.js";import{S as xr,h as za,m as qd,o as zd,p as Ka,s as Xa}from"./utils-YqBXNpsM.js";import{S as Kd,d as Xd,h as bt,o as Yd,r as Ya,x as Pt,y as Qa}from"./config-D2-Bw6QC.js";import{a as Qd,n as Za,t as Zd}from"./switch-BF1BnESM.js";import{n as ef}from"./globals-D1aM0aUX.js";import{t as tf}from"./ErrorBoundary-B9Ifj8Jf.js";import{t as nf}from"./useEventListener-Cb-RVVEn.js";import{t as rf}from"./jsx-runtime-ZmTK25f3.js";import{r as Tr,t as He}from"./button-CZ3Cs4qb.js";import{t as lt}from"./cn-BKtXLv3a.js";import{$t as Tn,Bt as Ar,Ct as ei,Dt as of,E as af,Gt as sf,H as ti,I as lf,It as An,J as l,Jt as qe,P as cf,Pt as In,Rt as uf,St as Je,Ut as ct,V as ni,Vt as Mt,Xt as Rt,_ as df,a as ff,at as B,bt as mf,ct as ze,ft as hf,it as pf,jt as gf,lt as Fn,m as bf,pt as yf,qt as he,rt as H,st as wf,vt as vf,w as Ef,wt as Nf,yt as kf,zt as yt}from"./dist-DBwNzi3C.js";import{C as Cf,D as Sf,_ as xf,a as Tf,c as Af,n as Ir,r as If,v as Ff,x as Lf,y as Of}from"./dist-CtsanegT.js";import{E as Df,__tla as Uf}from"./JsonOutput-BUok9dqY.js";import{c as ri,n as _f}from"./once-Bul8mtFs.js";import{t as Fr}from"./createReducer-B3rBsy4P.js";import{a as Bf,c as jf,f as Ln,h as Pf,i as Mf,l as Gt,n as oi,o as Rf,t as Gf}from"./dist-ChS0Dc_R.js";import{r as On,t as Jf}from"./requests-B4FYHTZl.js";import{t as Wf}from"./createLucideIcon-BCdY6lG5.js";import{r as ai,t as Vf,__tla as $f}from"./layout-DWzvYkJc.js";import{O as Hf,S as ii,T as qf,_ as zf,a as si,k as Kf,n as Xf,o as Yf,r as li,s as Qf,x as Zf}from"./add-cell-with-ai-J44RQi7o.js";import{t as em}from"./x-ZP5cObgf.js";import{r as tm}from"./download-CUgZOA9O.js";import{t as nm}from"./circle-check-DquVD4wZ.js";import{r as rm,t as om}from"./types-ChPQge47.js";import{n as ci}from"./spinner-DA8-7wQv.js";import{t as ui}from"./save-DZodxFnE.js";import{I as di,P as am}from"./input-DHHmNa19.js";import{a as im,i as sm,n as fi}from"./state-CMAvJZxx.js";import{t as lm}from"./preload-helper-DItdS47A.js";import{t as wt}from"./use-toast-T0_cQDma.js";import{n as Qe}from"./paths-Dfii2bN8.js";import{t as cm}from"./session-fBtIbMpB.js";import{r as um}from"./useTheme-CTORu22_.js";import{t as vt}from"./tooltip-C_WgOOcZ.js";import{r as dm,t as fm}from"./mode-O-1bKZO6.js";import{c as mi,i as hi,n as pi,r as mm}from"./dialog-tQELcltn.js";import{O as hm}from"./usePress-3CRs0fQg.js";import{a as pm,r as gm,t as bm}from"./popover-B-131r4d.js";import{n as gi}from"./ImperativeModal-DZr52ffu.js";import{r as ym}from"./errors-CPlNr33a.js";import{t as wm}from"./copy-BaRrAFL-.js";import{a as vm}from"./useRunCells-CNmJhP6h.js";import{t as X}from"./extends-Dqvpuc10.js";import{t as Jt}from"./objectWithoutPropertiesLoose-DoKw85w0.js";import{t as Em}from"./kbd-k3Sn_RwW.js";import{a as Lr}from"./useInstallPackage-Co79H1lQ.js";import{a as Nm,o as km}from"./cell-link-dnd6DfEI.js";import{n as Cm}from"./useAsyncData-CgmD3hjw.js";import{a as Sm,o as bi,r as xm,s as yi,t as Tm}from"./command-MHa10zT2.js";import{r as Am}from"./html-to-image-BKGhRUqR.js";import{a as Im}from"./focus-CtXToHnV.js";import{a as wi}from"./renderShortcut-Xr6z-RjZ.js";import{t as Or}from"./label-C--1sWU6.js";import{n as Dr,t as vi}from"./useDeleteCell-BocCAiDk.js";import{n as Et}from"./esm-BK6tLEHQ.js";import{n as Fm,t as Lm}from"./icons-DjR3qLG_.js";import{t as Ei}from"./dist-Dj9zNHXU.js";import{t as Om}from"./useSplitCell-DwvRo6W7.js";import{t as Ni}from"./Inputs-CbenuziM.js";import{co as Dm,do as Ur,fo as Um,ft as _m,go as Nt,ho as ki,lo as _r,mo as Ci,oo as Bm,po as jm,so as Si,uo as xi,__tla as Pm}from"./loro_wasm_bg-CdafknAX.js";import{t as Mm}from"./ws-DQY2KwIl.js";import{n as Rm}from"./hooks-STSuFYve.js";let Dn,Br,Ti,jr,ut,Pr,be,Wt,Vt,Ai,Ii,Fi,Li,Oi,Un,Di,_n,Ui,Bn,Gm=Promise.all([(()=>{try{return Bd}catch{}})(),(()=>{try{return Uf}catch{}})(),(()=>{try{return $f}catch{}})(),(()=>{try{return Pm}catch{}})()]).then(async()=>{var vn,Aa,we,ve,Ee,Ne,ke,Ce,Se,xe,Te,Ae,Ie,Fe,Le,Oe,De,Ue,_e,Be,je;var re=Wf("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 q={showInput:"Mod-l",acceptEdit:"Mod-y",rejectEdit:"Mod-u"};var ge=300;const Ct=Mt.define({combine:e=>Tn(e,{onError:console.error,inputDebounceTime:ge,keymaps:q},{onError:(t,n)=>t&&n,inputDebounceTime:(t,n)=>t&&n,keymaps:(t,n)=>t&&n})}),rt=he.define(),ot=qe.define({create(){return{show:!1,lineFrom:0,lineTo:0}},update(e,t){for(let n of t.effects)if(n.is(rt))return n.value;return e}}),St=he.define(),xt=he.define(),Rr=qe.define({create(){return{shouldFocus:!1,inputValue:""}},update(e,t){let n=e;for(let r of t.effects)r.is(St)&&(n={...n,inputValue:r.value}),r.is(xt)&&(n={...n,shouldFocus:r.value});return n}}),$t=he.define(),Tt=qe.define({create(){return null},update(e,t){for(let n of t.effects)if(n.is($t))return n.value;return e}}),dt=he.define(),Gr=qe.define({create(){return!1},update(e,t){for(let n of t.effects)if(n.is(dt))return n.value;return e}});var _i=1;const Jr=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:[rt.of({show:!0,lineFrom:i,lineTo:s}),xt.of(!0),St.of("")],selection:yt.cursor(o.from)}),!0},Wr=e=>e.state.field(Tt)?(e.dispatch({effects:[$t.of(null),rt.of({show:!1,lineFrom:0,lineTo:0}),xt.of(!1),St.of(""),dt.of(!1)]}),!0):!1,Vr=e=>{let t=e.state.field(Tt);return t?(e.dispatch({changes:{from:t.from,to:t.to,insert:t.oldCode},effects:[$t.of(null),rt.of({show:!1,lineFrom:0,lineTo:0}),xt.of(!1),St.of(""),dt.of(!1)]}),!0):!1};var jn={mac:"\u2318",windows:"\u229E Win",default:"Ctrl"};function Bi(){return navigator.platform.startsWith("Mac")?jn.mac:navigator.platform.startsWith("Win")?jn.windows:jn.default}function Pn(e){return e.replace("Mod",Bi()).replace("-"," ").toUpperCase()}function de(e,t){let n=document.createElement(e);return n.className=t,n}function ji(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 Ht=qe.define({create(){return{suggestion:null}},update(e,t){let n=t.effects.find(r=>r.is(qt));return!t.docChanged&&!n&&!t.selection?e:n&&t.state.doc===n.value.doc?{suggestion:n.value.text}:{suggestion:null}}}),qt=he.define();function Pi(e,t){let n=e.state.selection.main.head,r=[],o=H.widget({widget:new Mi(t),side:1});return r.push(o.range(n)),H.set(r)}var Mi=class extends Fn{constructor(t){super();h(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 Ia=re=>{throw TypeError(re)};var rd=(re,q,ge)=>q in re?nd(re,q,{enumerable:!0,configurable:!0,writable:!0,value:ge}):re[q]=ge;var h=(re,q,ge)=>rd(re,typeof q!="symbol"?q+"":q,ge),od=(re,q,ge)=>q.has(re)||Ia("Cannot "+ge);var Fa=(re,q,ge)=>(od(re,q,"read from private field"),ge?ge.call(re):q.get(re)),La=(re,q,ge)=>q.has(re)?Ia("Cannot add the same private member more than once"):q instanceof WeakSet?q.add(re):q.set(re,ge);import{s as Oa}from"./chunk-LvLJmgfZ.js";import{d as Da,f as br,i as Q,l as En,n as ue,p as _t,s as Nn,u as ce}from"./useEvent-BhXAndur.js";import{t as ad}from"./react-Bj1aDYRI.js";import{$ as id,$t as sd,At as yr,B as Ua,Cn as ld,Cr as cd,Ct as _a,Ft as Ba,Gt as ud,Ht as kn,Jr as dd,Kr as ja,Lt as fd,N as md,Nt as wr,Or as hd,Pt as Pa,Q as vr,R as Ma,Rt as pd,St as gd,U as Ra,Un as bd,V as Ga,Xt as yd,a as Ja,bn as wd,ct as Cn,d as Wa,dt as Bt,hr as vd,jr as Ed,kr as Va,kt as Nd,lt as kd,m as Er,mt as Cd,nn as Sd,on as Nr,ot as xd,pn as Td,ri as Sn,rn as Ad,st as kr,tn as Id,u as $a,ut as Fd,vn as Ld,w as xn,wr as Od,xr as Cr,y as nt,yn as Dd,z as Ud,zt as _d,__tla as Bd}from"./cells-B0XKj2oa.js";import{P as Ha,R as jd,k as Pd,w as Md}from"./zod-H_cgTO0M.js";import{t as Ge}from"./compiler-runtime-B3qBwwSJ.js";import{C as Rd,f as Gd,m as Jd,p as Wd,t as Vd,v as $d}from"./ai-model-dropdown-Cugcw6NV.js";import{d as $e,f as Hd,l as Sr,n as qa}from"./hotkeys-BHHWjLlp.js";import{t as jt}from"./invariant-CAG_dYON.js";import{S as xr,h as za,m as qd,o as zd,p as Ka,s as Xa}from"./utils-YqBXNpsM.js";import{S as Kd,d as Xd,h as bt,o as Yd,r as Ya,x as Pt,y as Qa}from"./config-D2-Bw6QC.js";import{a as Qd,n as Za,t as Zd}from"./switch-D5W4wgWK.js";import{n as ef}from"./globals-DvWD0xHx.js";import{t as tf}from"./ErrorBoundary-B9Ifj8Jf.js";import{t as nf}from"./useEventListener-Cb-RVVEn.js";import{t as rf}from"./jsx-runtime-ZmTK25f3.js";import{r as Tr,t as He}from"./button-CZ3Cs4qb.js";import{t as lt}from"./cn-BKtXLv3a.js";import{$t as Tn,Bt as Ar,Ct as ei,Dt as of,E as af,Gt as sf,H as ti,I as lf,It as An,J as l,Jt as qe,P as cf,Pt as In,Rt as uf,St as Je,Ut as ct,V as ni,Vt as Mt,Xt as Rt,_ as df,a as ff,at as B,bt as mf,ct as ze,ft as hf,it as pf,jt as gf,lt as Fn,m as bf,pt as yf,qt as he,rt as H,st as wf,vt as vf,w as Ef,wt as Nf,yt as kf,zt as yt}from"./dist-DBwNzi3C.js";import{C as Cf,D as Sf,_ as xf,a as Tf,c as Af,n as Ir,r as If,v as Ff,x as Lf,y as Of}from"./dist-CtsanegT.js";import{E as Df,__tla as Uf}from"./JsonOutput-CU0ad2LH.js";import{c as ri,n as _f}from"./once-Bul8mtFs.js";import{t as Fr}from"./createReducer-B3rBsy4P.js";import{a as Bf,c as jf,f as Ln,h as Pf,i as Mf,l as Gt,n as oi,o as Rf,t as Gf}from"./dist-ChS0Dc_R.js";import{r as On,t as Jf}from"./requests-B4FYHTZl.js";import{t as Wf}from"./createLucideIcon-BCdY6lG5.js";import{r as ai,t as Vf,__tla as $f}from"./layout-BRVYycwo.js";import{O as Hf,S as ii,T as qf,_ as zf,a as si,k as Kf,n as Xf,o as Yf,r as li,s as Qf,x as Zf}from"./add-cell-with-ai-B07D0AiE.js";import{t as em}from"./x-ZP5cObgf.js";import{r as tm}from"./download-CxmzcjnR.js";import{t as nm}from"./circle-check-DquVD4wZ.js";import{r as rm,t as om}from"./types-DIb0tcCO.js";import{n as ci}from"./spinner-DA8-7wQv.js";import{t as ui}from"./save-DZodxFnE.js";import{I as di,P as am}from"./input-DHHmNa19.js";import{a as im,i as sm,n as fi}from"./state-Q32Iqos3.js";import{t as lm}from"./preload-helper-DItdS47A.js";import{t as wt}from"./use-toast-T0_cQDma.js";import{n as Qe}from"./paths-Dfii2bN8.js";import{t as cm}from"./session-fBtIbMpB.js";import{r as um}from"./useTheme-CTORu22_.js";import{t as vt}from"./tooltip-C_WgOOcZ.js";import{r as dm,t as fm}from"./mode-CTf4rB7H.js";import{c as mi,i as hi,n as pi,r as mm}from"./dialog-tQELcltn.js";import{O as hm}from"./usePress-3CRs0fQg.js";import{a as pm,r as gm,t as bm}from"./popover-B-131r4d.js";import{n as gi}from"./ImperativeModal-DZr52ffu.js";import{r as ym}from"./errors-CPlNr33a.js";import{t as wm}from"./copy-BaRrAFL-.js";import{a as vm}from"./useRunCells-DaW_oMnr.js";import{t as X}from"./extends-Dqvpuc10.js";import{t as Jt}from"./objectWithoutPropertiesLoose-DoKw85w0.js";import{t as Em}from"./kbd-k3Sn_RwW.js";import{a as Lr}from"./useInstallPackage-Co79H1lQ.js";import{a as Nm,o as km}from"./cell-link-B37i0WNz.js";import{n as Cm}from"./useAsyncData-CgmD3hjw.js";import{a as Sm,o as bi,r as xm,s as yi,t as Tm}from"./command-DTFQw11F.js";import{r as Am}from"./html-to-image-Cc7t14sm.js";import{a as Im}from"./focus-CZLCQiuh.js";import{a as wi}from"./renderShortcut-Xr6z-RjZ.js";import{t as Or}from"./label-C--1sWU6.js";import{n as Dr,t as vi}from"./useDeleteCell-D0DAGwMP.js";import{n as Et}from"./esm-BK6tLEHQ.js";import{n as Fm,t as Lm}from"./icons-DjR3qLG_.js";import{t as Ei}from"./dist-Dj9zNHXU.js";import{t as Om}from"./useSplitCell-Cjr7nuBc.js";import{t as Ni}from"./Inputs-CbenuziM.js";import{co as Dm,do as Ur,fo as Um,ft as _m,go as Nt,ho as ki,lo as _r,mo as Ci,oo as Bm,po as jm,so as Si,uo as xi,__tla as Pm}from"./loro_wasm_bg-CdafknAX.js";import{t as Mm}from"./ws-DQY2KwIl.js";import{n as Rm}from"./hooks-B2h7NTXb.js";let Dn,Br,Ti,jr,ut,Pr,be,Wt,Vt,Ai,Ii,Fi,Li,Oi,Un,Di,_n,Ui,Bn,Gm=Promise.all([(()=>{try{return Bd}catch{}})(),(()=>{try{return Uf}catch{}})(),(()=>{try{return $f}catch{}})(),(()=>{try{return Pm}catch{}})()]).then(async()=>{var vn,Aa,we,ve,Ee,Ne,ke,Ce,Se,xe,Te,Ae,Ie,Fe,Le,Oe,De,Ue,_e,Be,je;var re=Wf("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 q={showInput:"Mod-l",acceptEdit:"Mod-y",rejectEdit:"Mod-u"};var ge=300;const Ct=Mt.define({combine:e=>Tn(e,{onError:console.error,inputDebounceTime:ge,keymaps:q},{onError:(t,n)=>t&&n,inputDebounceTime:(t,n)=>t&&n,keymaps:(t,n)=>t&&n})}),rt=he.define(),ot=qe.define({create(){return{show:!1,lineFrom:0,lineTo:0}},update(e,t){for(let n of t.effects)if(n.is(rt))return n.value;return e}}),St=he.define(),xt=he.define(),Rr=qe.define({create(){return{shouldFocus:!1,inputValue:""}},update(e,t){let n=e;for(let r of t.effects)r.is(St)&&(n={...n,inputValue:r.value}),r.is(xt)&&(n={...n,shouldFocus:r.value});return n}}),$t=he.define(),Tt=qe.define({create(){return null},update(e,t){for(let n of t.effects)if(n.is($t))return n.value;return e}}),dt=he.define(),Gr=qe.define({create(){return!1},update(e,t){for(let n of t.effects)if(n.is(dt))return n.value;return e}});var _i=1;const Jr=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:[rt.of({show:!0,lineFrom:i,lineTo:s}),xt.of(!0),St.of("")],selection:yt.cursor(o.from)}),!0},Wr=e=>e.state.field(Tt)?(e.dispatch({effects:[$t.of(null),rt.of({show:!1,lineFrom:0,lineTo:0}),xt.of(!1),St.of(""),dt.of(!1)]}),!0):!1,Vr=e=>{let t=e.state.field(Tt);return t?(e.dispatch({changes:{from:t.from,to:t.to,insert:t.oldCode},effects:[$t.of(null),rt.of({show:!1,lineFrom:0,lineTo:0}),xt.of(!1),St.of(""),dt.of(!1)]}),!0):!1};var jn={mac:"\u2318",windows:"\u229E Win",default:"Ctrl"};function Bi(){return navigator.platform.startsWith("Mac")?jn.mac:navigator.platform.startsWith("Win")?jn.windows:jn.default}function Pn(e){return e.replace("Mod",Bi()).replace("-"," ").toUpperCase()}function de(e,t){let n=document.createElement(e);return n.className=t,n}function ji(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 Ht=qe.define({create(){return{suggestion:null}},update(e,t){let n=t.effects.find(r=>r.is(qt));return!t.docChanged&&!n&&!t.selection?e:n&&t.state.doc===n.value.doc?{suggestion:n.value.text}:{suggestion:null}}}),qt=he.define();function Pi(e,t){let n=e.state.selection.main.head,r=[],o=H.widget({widget:new Mi(t),side:1});return r.push(o.range(n)),H.set(r)}var Mi=class extends Fn{constructor(t){super();h(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}},Ri=class{constructor(e){h(this,"cache",new Map);h(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()})}},Gi=(e,t)=>ze.fromClass(class{constructor(){h(this,"abortController",null);h(this,"cache");this.cache=new Ri(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:qt.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:qt.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()}}),Ji=ze.fromClass(class{constructor(){h(this,"decorations");this.decorations=H.none}update(e){var n;let t=(n=e.state.field(Ht))==null?void 0:n.suggestion;if(!t){this.decorations=H.none;return}this.decorations=Pi(e.view,t)}},{decorations:e=>e.decorations});function Wi(e,t,n,r){return{...e.changeByRange(o=>{if(o===e.selection.main)return{changes:{from:n,to:r,insert:t},range:yt.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:yt.cursor(o.from-a+t.length)}}),userEvent:"input.complete"}}var Vi=e=>{var r,o,a;let t=(r=e.state.field(Ht))==null?void 0:r.suggestion;if(!t)return!1;let n=e.state.facet(Mn);return e.dispatch({...Wi(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},$r=e=>{var r,o,a;let t=(r=e.state.field(Ht))==null?void 0:r.suggestion;if(!t)return!1;let n=e.state.facet(Mn);return e.dispatch({effects:qt.of({text:null,doc:e.state.doc})}),(a=(o=n.events)==null?void 0:o.onSuggestionRejected)==null||a.call(o,e,t),!0},$i=Je.of([{key:"Tab",run:Vi},{key:"Escape",run:$r}]),Mn=Mt.define({combine:e=>e.at(-1)});function Hr(e){let{delay:t=500,includeKeymap:n=!0}=e,r=ji(e.fetchFn,t);return[Ht,Mn.of(e),Gi(r,e),Ji,n?$i:[]]}const Hi=B.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 qi(e){var o,a;let t=e.state.facet(Ct),n={...q,...t.keymaps},r=de("div","cm-ai-tooltip").appendChild(de("div","cm-ai-tooltip-button"));return r.innerHTML=`<span>Edit <span class="hotkey">${Pn(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(),Jr(e)}),r}const Rn=Mt.define({combine(e){return Tn(e,{render:qi,hideOnBlur:!1})}}),zi=ze.fromClass((Aa=class{constructor(e){h(this,"view");h(this,"suppress");h(this,"dom");h(this,"mousedown",()=>{this.suppress=!0});h(this,"mouseup",()=>{this.suppress=!1,this.display(this.view)});h(this,"scroll",()=>{this.display(this.view)});h(this,"windowScroll",()=>{this.display(this.view)});La(this,vn,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(Rn);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(ot).show){this.dom.style.display="none";return}if(e.state.facet(Rn).hideOnBlur&&!e.hasFocus){this.dom.style.display="none",this.dom.setAttribute("aria-hidden","true");return}e.requestMeasure({read:Fa(this,vn)})}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()}},vn=new WeakMap,Aa));var Ki=B.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 Xi(){return[zi,Ki]}var Yi=class extends Fn{constructor(t){super();h(this,"oldCode");this.oldCode=t}toDOM(t){let n=de("div","cm-old-code-container");n.setAttribute("role","region"),n.setAttribute("aria-label","Previous code version");let r=de("div","cm-old-code cm-line");r.textContent=this.oldCode;let o=de("div","cm-floating-buttons"),a=t.state.facet(Ct),i={...q,...a.keymaps},s=de("button","cm-floating-button cm-floating-accept");s.innerHTML=`<span class="hotkey">${Pn(i.acceptEdit)}</span> Accept`,s.setAttribute("aria-label","Accept changes"),s.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),t.focus(),Wr(t)});let c=de("button","cm-floating-button cm-floating-reject");return c.innerHTML=`<span class="hotkey">${Pn(i.rejectEdit)}</span> Reject`,c.setAttribute("aria-label","Reject changes"),c.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),t.focus(),Vr(t)}),o.append(s,c),n.append(r,o),n}updateDOM(t,n){return!0}},Qi=class extends Fn{constructor(t){super();h(this,"complete");h(this,"abortController",null);h(this,"dom",null);h(this,"input",null);h(this,"loadingContainer",null);h(this,"helpInfo",null);h(this,"inputContainer",null);h(this,"form",null);h(this,"view",null);h(this,"onKeyDown",async t=>{t.key==="Enter"&&!t.shiftKey?(t.preventDefault(),await this.handleSubmit()):t.key==="Escape"&&this.onCancel()});h(this,"onCancel",()=>{this.cleanup();let t=this.view;t&&(t.dispatch({effects:[rt.of({show:!1,lineFrom:0,lineTo:0}),dt.of(!1)]}),t.focus())});h(this,"handleSubmit",async t=>{var g;let n=this.view;if(!n)return;let r=n.state.facet(Ct);t==null||t.stopPropagation();let o=n.state.field(ot),{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),p=n.state.sliceDoc(0,u),m=n.state.sliceDoc(d);this.abortController=new AbortController,n.dispatch({effects:dt.of(!0)}),this.toggleLoading(!0);try{let y=await this.complete({prompt:i,selection:f,codeBefore:p,codeAfter:m,editorView:n,signal:this.abortController.signal});if(!n.state.field(ot).show)return;if(!y||typeof y!="string")throw Error("Invalid completion result");n.dispatch({changes:{from:u,to:d,insert:y},effects:[rt.of({show:!1,lineFrom:0,lineTo:0}),$t.of({from:u,to:u+y.length,oldCode:f,newCode:y}),dt.of(!1)]})}catch(y){if(y instanceof DOMException&&y.name==="AbortError")return;(g=r.onError)==null||g.call(r,y)}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(Rr),r=t.state.field(Gr),o=de("div","cm-ai-input-container");this.inputContainer=o,this.dom=o;let a=de("form","cm-ai-input-form");this.form=a,a.setAttribute("role","search"),a.setAttribute("aria-label","AI editing instructions"),a.addEventListener("submit",w=>w.preventDefault());let i=de("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=de("div","cm-ai-loading-container");this.loadingContainer=s;let c=de("div","cm-ai-loading-indicator");c.setAttribute("role","status"),c.setAttribute("aria-live","polite"),c.textContent="Generating";let u=de("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=de("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 p=de("button","cm-ai-generate-button");p.textContent="\u23CE Generate",p.setAttribute("aria-label","Generate code"),p.addEventListener("click",this.handleSubmit),this.toggleLoading(r),n.shouldFocus&&requestAnimationFrame(()=>{i.value=n.inputValue,i.focus(),t.dispatch({effects:xt.of(!1)})}),m(i.value),i.addEventListener("input",y),i.addEventListener("keydown",this.onKeyDown);function m(w){d.replaceChildren(w?p:f)}let g="";function y(){t.dispatch({effects:St.of(i.value)});let w=i.value.trim();w!==g&&(g=w,m(w))}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 Zi(e){if(!e.prompt)throw Error("prompt function is required");let t={...q,...e.keymaps};return[Ct.of(e),ot,Rr,Tt,Gr,Xi(),Hi,Je.of([{key:t.showInput,run:Jr}]),ct.highest([Je.of([{key:t.acceptEdit,run:Wr},{key:t.rejectEdit,run:Vr}])]),es,ts,ns,rs]}const es=B.updateListener.of(e=>{let t=e.state.field(ot);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:[rt.of({show:!0,lineFrom:n,lineTo:r})]})}),ts=B.decorations.of(e=>{let t=e.state.field(Tt);return t?H.set([H.mark({class:"cm-new-code-line"}).range(t.from,t.to)]):H.none}),ns=B.decorations.compute([ot],e=>{let t=e.field(ot),n=e.facet(Ct),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(H.line({class:"cm-ai-selection"}).range(s)),i===o&&r.push(H.widget({widget:new Qi(n.prompt),side:-1}).range(s))}}return H.set(r)}),rs=qe.define({create(e){return H.none},update(e,t){let n=t.state.field(Tt);return n?H.set([H.widget({widget:new Yi(n.oldCode),block:!0}).range(n.from)]):H.none},provide:e=>B.decorations.from(e)});var os=Ge(),I=Oa(ad(),1),Gn=()=>({entries:new Map}),{valueAtom:qr,useActions:zr}=Fr(Gn,{submit:(e,t)=>{let{cellIds:n,deleteCell:r,deleteManyCells:o,store:a}=t,i=a.get(nt),s=a.get(Ld),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 p=i.cellRuntime[f],m=new Map;for(let y of Object.values(s)){let w=y.declaredBy.includes(f),k=y.usedBy.some(C=>!c.has(C));w&&k&&m.set(y.name,y.usedBy)}let g;p!=null&&p.runElapsedTimeMs&&p.runElapsedTimeMs>2e3&&(g=p.runElapsedTimeMs),m.size===0&&g===void 0?u.set(f,{cellId:f,type:"simple"}):u.set(f,{cellId:f,type:"expensive",executionDurationMs:g,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)}),Gn()):{...e,entries:u}},clear:()=>Gn()});Bn=function(){let e=br(),{submit:t,clear:n}=zr(),{entries:r}=ce(qr),o=vi(),a=Dr();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])},Ui=function(e){let t=(0,os.c)(16),n=ce(qr),r=zr(),o=Dr(),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(as)}),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 as(e){return e.cellId}async function is(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 P,l as w,n as y,u as L}from"./useEvent-BhXAndur.js";import{Kr as _,Yt as O,j as A,k as E,ri as S,vt as T,w as $}from"./cells-CiFhRLUd.js";import{t as b}from"./compiler-runtime-B3qBwwSJ.js";import{d as D}from"./hotkeys-BHHWjLlp.js";import{d as F}from"./utils-YqBXNpsM.js";import{r as x}from"./constants-B6Cb__3x.js";import{h as q,x as B}from"./config-D2-Bw6QC.js";import{t as H}from"./jsx-runtime-ZmTK25f3.js";import{t as K}from"./cn-BKtXLv3a.js";import{r as M}from"./requests-B4FYHTZl.js";import{n as R}from"./paths-Dfii2bN8.js";import{s as U}from"./session-fBtIbMpB.js";import{n as V}from"./ImperativeModal-DZr52ffu.js";var Y=b();function I(){return L(_)}function z(){let r=(0,Y.c)(5),[t]=w(q),e=P(_),{openAlert:o}=V(),{sendRename:s}=M(),a;return r[0]!==t.state||r[1]!==o||r[2]!==s||r[3]!==e?(a=async l=>{let n=F();return t.state===B.OPEN?(U(i=>{l===null?i.delete(x.filePath):i.set(x.filePath,l)}),s({filename:l}).then(()=>(e(l),document.title=n.app_title||R.basename(l)||"Untitled Notebook",l)).catch(i=>(o(i.message),null))):(o("Failed to save notebook: not connected to a kernel."),null)},r[0]=t.state,r[1]=o,r[2]=s,r[3]=e,r[4]=a):a=r[4],y(a)}var p=b(),v=j(H(),1);const k=r=>{let t=(0,p.c)(12),{className:e,cellId:o,variant:s,onClick:a,formatCellName:l,skipScroll:n}=r,i=A()[o]??"",C=E().inOrderIds.indexOf(o),{showCellIfHidden:d}=$(),g=l??Q,c;t[0]===e?c=t[1]:(c=K("inline-block cursor-pointer text-link hover:underline",e),t[0]=e,t[1]=c);let m;t[2]!==o||t[3]!==a||t[4]!==d||t[5]!==n||t[6]!==s?(m=h=>{if(o==="__scratch__")return!1;d({cellId:o}),h.stopPropagation(),h.preventDefault(),requestAnimationFrame(()=>{N(o,s,n)&&(a==null||a())})},t[2]=o,t[3]=a,t[4]=d,t[5]=n,t[6]=s,t[7]=m):m=t[7];let f=g(T(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},G=r=>{let t=(0,p.c)(2),e;return t[0]===r?e=t[1]:(e=(0,v.jsx)(k,{...r,variant:"destructive"}),t[0]=r,t[1]=e),e},J=r=>{let t=(0,p.c)(10),{cellId:e,lineNumber:o}=r,s=I(),a;t[0]!==e||t[1]!==o?(a=()=>O(e,o),t[0]=e,t[1]=o,t[2]=a):a=t[2];let l;t[3]!==e||t[4]!==s?(l=i=>e==="__scratch__"?"scratch":`marimo://${s||"untitled"}#cell=${i}`,t[3]=e,t[4]=s,t[5]=l):l=t[5];let n;return t[6]!==e||t[7]!==a||t[8]!==l?(n=(0,v.jsx)(k,{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 N(r,t,e){let o=S.create(r),s=document.getElementById(o);return s===null?(D.error(`Cell ${o} not found on page.`),!1):(e||s.scrollIntoView({behavior:"smooth",block:"center"}),t==="destructive"&&(s.classList.add("error-outline"),setTimeout(()=>{s.classList.remove("error-outline")},2e3)),t==="focus"&&(s.classList.add("focus-outline"),setTimeout(()=>{s.classList.remove("focus-outline")},2e3)),!0)}function Q(r){return r}export{I as a,N as i,G as n,z as o,J as r,k as t};
1
+ import{s as j}from"./chunk-LvLJmgfZ.js";import{d as P,l as w,n as y,u as L}from"./useEvent-BhXAndur.js";import{Kr as _,Yt as O,j as A,k as E,ri as S,vt as T,w as $}from"./cells-B0XKj2oa.js";import{t as b}from"./compiler-runtime-B3qBwwSJ.js";import{d as D}from"./hotkeys-BHHWjLlp.js";import{d as F}from"./utils-YqBXNpsM.js";import{r as x}from"./constants-B6Cb__3x.js";import{h as q,x as B}from"./config-D2-Bw6QC.js";import{t as H}from"./jsx-runtime-ZmTK25f3.js";import{t as K}from"./cn-BKtXLv3a.js";import{r as M}from"./requests-B4FYHTZl.js";import{n as R}from"./paths-Dfii2bN8.js";import{s as U}from"./session-fBtIbMpB.js";import{n as V}from"./ImperativeModal-DZr52ffu.js";var Y=b();function I(){return L(_)}function z(){let r=(0,Y.c)(5),[t]=w(q),e=P(_),{openAlert:o}=V(),{sendRename:s}=M(),a;return r[0]!==t.state||r[1]!==o||r[2]!==s||r[3]!==e?(a=async l=>{let n=F();return t.state===B.OPEN?(U(i=>{l===null?i.delete(x.filePath):i.set(x.filePath,l)}),s({filename:l}).then(()=>(e(l),document.title=n.app_title||R.basename(l)||"Untitled Notebook",l)).catch(i=>(o(i.message),null))):(o("Failed to save notebook: not connected to a kernel."),null)},r[0]=t.state,r[1]=o,r[2]=s,r[3]=e,r[4]=a):a=r[4],y(a)}var p=b(),v=j(H(),1);const k=r=>{let t=(0,p.c)(12),{className:e,cellId:o,variant:s,onClick:a,formatCellName:l,skipScroll:n}=r,i=A()[o]??"",C=E().inOrderIds.indexOf(o),{showCellIfHidden:d}=$(),g=l??Q,c;t[0]===e?c=t[1]:(c=K("inline-block cursor-pointer text-link hover:underline",e),t[0]=e,t[1]=c);let m;t[2]!==o||t[3]!==a||t[4]!==d||t[5]!==n||t[6]!==s?(m=h=>{if(o==="__scratch__")return!1;d({cellId:o}),h.stopPropagation(),h.preventDefault(),requestAnimationFrame(()=>{N(o,s,n)&&(a==null||a())})},t[2]=o,t[3]=a,t[4]=d,t[5]=n,t[6]=s,t[7]=m):m=t[7];let f=g(T(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},G=r=>{let t=(0,p.c)(2),e;return t[0]===r?e=t[1]:(e=(0,v.jsx)(k,{...r,variant:"destructive"}),t[0]=r,t[1]=e),e},J=r=>{let t=(0,p.c)(10),{cellId:e,lineNumber:o}=r,s=I(),a;t[0]!==e||t[1]!==o?(a=()=>O(e,o),t[0]=e,t[1]=o,t[2]=a):a=t[2];let l;t[3]!==e||t[4]!==s?(l=i=>e==="__scratch__"?"scratch":`marimo://${s||"untitled"}#cell=${i}`,t[3]=e,t[4]=s,t[5]=l):l=t[5];let n;return t[6]!==e||t[7]!==a||t[8]!==l?(n=(0,v.jsx)(k,{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 N(r,t,e){let o=S.create(r),s=document.getElementById(o);return s===null?(D.error(`Cell ${o} not found on page.`),!1):(e||s.scrollIntoView({behavior:"smooth",block:"center"}),t==="destructive"&&(s.classList.add("error-outline"),setTimeout(()=>{s.classList.remove("error-outline")},2e3)),t==="focus"&&(s.classList.add("focus-outline"),setTimeout(()=>{s.classList.remove("focus-outline")},2e3)),!0)}function Q(r){return r}export{I as a,N as i,G as n,z as o,J as r,k as t};
@@ -11,7 +11,7 @@ Error generating stack: `+l.message+`
11
11
  ${o.join(`
12
12
  `)}`},N_=function(e){if(e.length===0)return"";let n=Object.keys(e[0]);return[`| ${n.join(" | ")} |`,`|${n.map(()=>"---").join("|")}|`,...e.map(i=>`| ${n.map(o=>Cx(i[o])).join(" | ")} |`)].join(`
13
13
  `)};function Cx(e){if(e==null)return"";if(Array.isArray(e)||typeof e=="object")return Fm(JSON.stringify(e));let n=String(e),i=/\[([^\]]+)]\((https?:\/\/[^)]+)\)/g,o=new Map,s=0;n=n.replaceAll(i,c=>{let d=`__MDLINK_${s++}__`;return o.set(d,c),d}),n=n.replaceAll(/(https?:\/\/\S+)/g,"[$1]($1)");for(let[c,d]of o)n=n.replace(c,d);return Fm(n)}function Fm(e){return e.replaceAll("\\","\\\\").replaceAll("|","\\|").replaceAll(`
14
- `," ").replaceAll("\r","")}function md(e){return typeof e=="object"&&e&&"$bigint"in e&&typeof e.$bigint=="string"?BigInt(e.$bigint):e}var Bm="abcdefghijklmnopqrstuvwxyz",Hm=Bm+Bm.toUpperCase(),Vm=new Set;Rs="__scratch__",yr="setup",Ma={create(){let e=0,n;do{let i="";for(let o=0;o<4;o++)i+=Hm[Math.floor(Math.random()*Hm.length)];n=i,e++}while(Vm.has(n)&&e<100);if(e>=100)throw Error("Failed to generate unique CellId after 100 attempts");return Vm.add(n),n}},er={create(e){return In(e!=null,"cellId is required"),`cell-${e}`},parse(e){return e.slice(5)},findElement(e){return e.closest('div[id^="cell-"]')},findElementThroughShadowDOMs(e){let n=e;for(;n;){let i=er.findElement(n);if(i)return i;let o=n.getRootNode();if(n=o instanceof ShadowRoot?o.host:n.parentElement,n===o)break}return null}},G_=function(e){let n=null,i=er.findElementThroughShadowDOMs(e);return i&&(n=er.parse(i.id)),n},id={parse(e){return e.getAttribute("object-id")},parseOrThrow(e){let n=id.parse(e);return In(n,"<marimo-ui-element/> missing object-id attribute"),n}},z_={create(e){return`output-${e}`}},_m=new class{getFilename(){return this.getSearchParam("filename")}setFilename(e){this.setSearchParam("filename",e)}getCodeFromSearchParam(){return this.getSearchParam("code")}getCodeFromHash(){let e=window.location.hash;return e.startsWith("#code/")?e.slice(6):null}setCodeForHash(e){window.location.hash=`#code/${e}`}setSearchParam(e,n){let i=new URL(window.location.href);i.searchParams.set(e,n),window.history.replaceState({},"",i.toString())}getSearchParam(e){return new URL(window.location.href).searchParams.get(e)}},$u=function(e){return vm(e??"")},e_=function(e){return ui.mapValues(e.dataset,n=>typeof n=="string"?$u(n):n)},Rw=function(e,n){let i=e.parentElement?id.parse(e.parentElement):void 0;return i&&n.has(i)?n.lookupValue(i):$u(e.dataset.initialValue)},Fl=function(){if(v4())return document.title||null;if(vh()){let i=_m.getFilename();if(i)return i}let e=document.querySelector("marimo-filename");bm(e,"marimo-filename tag not found");let n=e.innerHTML;return n.length===0?null:n};var Ex=Symbol("");Ww=function(e,n){return ze(e,function(i,o,s){o(this,n(i(this),s))})};function gd(e,n){let i=null,o=new Map,s=new Set,c=f=>{let p;if(n===void 0)p=o.get(f);else for(let[w,_]of o)if(n(w,f)){p=_;break}if(p!==void 0)if(i!=null&&i(p[1],f))c.remove(f);else return p[0];let y=e(f);return o.set(f,[y,Date.now()]),d("CREATE",f,y),y},d=(f,p,y)=>{for(let w of s)w({type:f,param:p,atom:y})};return c.unstable_listen=f=>(s.add(f),()=>{s.delete(f)}),c.getParams=()=>o.keys(),c.remove=f=>{if(n===void 0){if(!o.has(f))return;let[p]=o.get(f);o.delete(f),d("REMOVE",f,p)}else for(let[p,[y]]of o)if(n(p,f)){o.delete(p),d("REMOVE",p,y);break}},c.setShouldRemove=f=>{if(i=f,i)for(let[p,[y,w]]of o)i(w,p)&&(o.delete(p),d("REMOVE",p,y))},c}var yd=(e,n,i)=>(n.has(i)?n:n.set(i,e())).get(i),Tx=new WeakMap,Rx=(e,n,i,o)=>yd(e,yd(()=>new WeakMap,yd(()=>new WeakMap,Tx,n),i),o);function Dx(e,n,i=Object.is){return Rx(()=>{let o=Symbol(),s=([d,f])=>{if(f===o)return n(d);let p=n(d,f);return i(f,p)?f:p},c=ze(d=>{let f=d(c);return s([d(e),f])});return c.init=o,c},e,n,i)}var $m=(e,n,i)=>(n.has(i)?n:n.set(i,e())).get(i),Ox=new WeakMap,Px=(e,n,i)=>$m(e,$m(()=>new WeakMap,Ox,n),i),Mx={},Wm=e=>!!e.write,Lx=e=>typeof e=="function";function Nx(e,n){return Px(()=>{let i=new WeakMap,o=(d,f)=>{let p=i.get(d);if(p)return p;let y=f&&i.get(f),w=[],_=[];return d.forEach((C,E)=>{let T=n?n(C):E;_[E]=T;let I=y&&y.atomList[y.keyList.indexOf(T)];if(I){w[E]=I;return}let $=V=>{let F=V(s),N=V(e),K=o(N,F==null?void 0:F.arr).keyList.indexOf(T);if(K<0||K>=N.length){let pe=d[o(d).keyList.indexOf(T)];if(pe)return pe;throw Error("splitAtom: index out of bounds for read")}return N[K]};w[E]=Wm(e)?ze($,(V,F,N)=>{let K=V(s),pe=V(e),P=o(pe,K==null?void 0:K.arr).keyList.indexOf(T);if(P<0||P>=pe.length)throw Error("splitAtom: index out of bounds for write");let A=Lx(N)?N(pe[P]):N;Object.is(pe[P],A)||F(e,[...pe.slice(0,P),A,...pe.slice(P+1)])}):ze($)}),p=y&&y.keyList.length===_.length&&y.keyList.every((C,E)=>C===_[E])?y:{arr:d,atomList:w,keyList:_},i.set(d,p),p},s=ze(d=>{let f=d(s);return o(d(e),f==null?void 0:f.arr)});s.init=void 0;let c=Wm(e)?ze(d=>d(s).atomList,(d,f,p)=>{switch(p.type){case"remove":{let y=d(c).indexOf(p.atom);if(y>=0){let w=d(e);f(e,[...w.slice(0,y),...w.slice(y+1)])}break}case"insert":{let y=p.before?d(c).indexOf(p.before):d(c).length;if(y>=0){let w=d(e);f(e,[...w.slice(0,y),p.value,...w.slice(y)])}break}case"move":{let y=d(c).indexOf(p.atom),w=p.before?d(c).indexOf(p.before):d(c).length;if(y>=0&&w>=0){let _=d(e);y<w?f(e,[..._.slice(0,y),..._.slice(y+1,w),_[y],..._.slice(w)]):f(e,[..._.slice(0,w),_[y],..._.slice(w,y),..._.slice(y+1)])}break}}}):ze(d=>d(s).atomList);return c},e,n||Mx)}var Um=e=>typeof(e==null?void 0:e.then)=="function";function Km(e=()=>{try{return window.localStorage}catch{return}},n){var f;let i,o,s={getItem:(p,y)=>{var C;let w=E=>{if(E||(E=""),i!==E){try{o=JSON.parse(E,n==null?void 0:n.reviver)}catch{return y}i=E}return o},_=((C=e())==null?void 0:C.getItem(p))??null;return Um(_)?_.then(w):w(_)},setItem:(p,y)=>{var w;return(w=e())==null?void 0:w.setItem(p,JSON.stringify(y,n==null?void 0:n.replacer))},removeItem:p=>{var y;return(y=e())==null?void 0:y.removeItem(p)}},c=p=>(y,w,_)=>p(y,C=>{let E;try{E=JSON.parse(C||"")}catch{E=_}w(E)}),d;try{d=(f=e())==null?void 0:f.subscribe}catch{}return!d&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(d=(p,y)=>{if(!(e()instanceof window.Storage))return()=>{};let w=_=>{_.storageArea===e()&&_.key===p&&y(_.newValue)};return window.addEventListener("storage",w),()=>{window.removeEventListener("storage",w)}}),d&&(s.subscribe=c(d)),s}var Ix=Km();Bl=function(e,n,i=Ix,o){let s=ze(o!=null&&o.getOnInit?i.getItem(e,n):n);return s.onMount=c=>{c(i.getItem(e,n));let d;return i.subscribe&&(d=i.subscribe(e,c,n)),d},ze(c=>c(s),(c,d,f)=>{let p=typeof f=="function"?f(c(s)):f;return p===Ex?(d(s,n),i.removeItem(e)):Um(p)?p.then(y=>(d(s,y),i.setItem(e,y))):(d(s,p),i.setItem(e,p))})},Wn=function(e){let n,i,o;return typeof e=="object"?(n=e.hashFunction,i=e.expiring,o=e.tags):n=e,(s,c,d)=>{if(d.value!=null)d.value=Qm(d.value,n,i,o);else if(d.get!=null)d.get=Qm(d.get,n,i,o);else throw"Only put a Memoize() decorator on a method or get accessor."}};var vd=new Map;function Qm(e,n,i=0,o){let s=Symbol("__memoized_map__");return function(...c){let d;this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:new Map});let f=this[s];if(Array.isArray(o))for(let p of o)vd.has(p)?vd.get(p).push(f):vd.set(p,[f]);if(n||c.length>0||i>0){let p;p=n===!0?c.map(_=>_.toString()).join("!"):n?n.apply(this,c):c[0];let y=`${p}__timestamp`,w=!1;if(i>0)if(!f.has(y))w=!0;else{let _=f.get(y);w=Date.now()-_>i}f.has(p)&&!w?d=f.get(p):(d=e.apply(this,c),f.set(p,d),i>0&&f.set(y,Date.now()))}else{let p=this;f.has(p)?d=f.get(p):(d=e.apply(this,c),f.set(p,d))}return d}}Cs=ze(Fl()),Bw=ze(void 0);var Ax=class{constructor(){ke(this,"store",new Map)}get length(){return this.store.size}clear(){this.store.clear()}getItem(e){return this.store.get(e)||null}key(e){return[...this.store.keys()][e]||null}removeItem(e){this.store.delete(e)}setItem(e,n){this.store.set(e,n)}};function qx(){let{hasLocalStorage:e,hasSessionStorage:n}=rD();return e?window.localStorage:n?window.sessionStorage:new Ax}Ts=qx();let Qi;Vw=class{constructor(e,n=Ts){this.defaultValue=e,this.storage=n}get(e){try{let n=this.storage.getItem(e);return n?JSON.parse(n):this.defaultValue}catch{return this.defaultValue}}set(e,n){this.storage.setItem(e,JSON.stringify(n))}remove(e){this.storage.removeItem(e)}},Vu=class{constructor(e,n,i=Ts){this.schema=e,this.getDefaultValue=n,this.storage=i}get(e){try{let n=this.storage.getItem(e);if(n==null)return this.getDefaultValue();let i=this.schema.safeParse(JSON.parse(n));return i.success?i.data:(Se.warn("Error parsing zod local storage",i.error),this.getDefaultValue())}catch(n){return Se.warn("Error getting zod local storage",n),this.getDefaultValue()}}set(e,n){this.storage.setItem(e,JSON.stringify(n))}remove(e){this.storage.removeItem(e)}},rm=class extends Vu{constructor(e,n,i){let o=lt.get(Cs);super(n,i),this.filename=o;try{this.unsubscribeFromFilename=lt.sub(Cs,()=>{let s=lt.get(Cs);this.handleFilenameChange(e,s)})}catch{this.unsubscribeFromFilename=null}}get(e){return super.get(this.createScopedKey(e,this.filename))}set(e,n){super.set(this.createScopedKey(e,this.filename),n)}remove(e){super.remove(this.createScopedKey(e,this.filename))}createScopedKey(e,n){return n?`${e}:${n}`:e}handleFilenameChange(e,n){if(n&&n!==this.filename){let i=this.get(e);this.remove(e),this.filename=n,this.set(e,i)}}dispose(){this.unsubscribeFromFilename&&(this.unsubscribeFromFilename=(this.unsubscribeFromFilename(),null))}},Qi="marimo:notebook-col-sizes";function jx(){return{widths:[]}}var Eo=new rm(Qi,G2({widths:i4(t4([n4(),r4("contentWidth")]).default("contentWidth"))}),jx);Lw={getColumnWidth:e=>Eo.get(Qi).widths[e]??"contentWidth",saveColumnWidth:(e,n)=>{let i=Eo.get(Qi).widths;if(i[e])i[e]=n;else{for(;i.length<=e;)i.push("contentWidth");i[e]=n}Eo.set(Qi,{widths:i})},clearStorage:()=>{Eo.remove(Qi)}};function zx(e,n){let i=Eo.get(Qi).widths,o=Pl(i,e,n);Eo.set(Qi,{widths:o})}var Gm,Jm,Xm,Nr,Ym,Zm,e0,t0,Un,n0,r0,i0,a0,o0,s0,en;function tr(e,n,i,o,s){var c={};return Object.keys(o).forEach(function(d){c[d]=o[d]}),c.enumerable=!!c.enumerable,c.configurable=!!c.configurable,("value"in c||c.initializer)&&(c.writable=!0),c=i.slice().reverse().reduce(function(d,f){return f(e,n,d)||d},c),s&&c.initializer!==void 0&&(c.value=c.initializer?c.initializer.call(s):void 0,c.initializer=void 0),c.initializer===void 0?(Object.defineProperty(e,n,c),null):c}let Ia=(Gm=Wn(),Jm=Wn(),Xm=Wn(),Nr=class{constructor(e,n,i){this.value=e,this.isCollapsed=n,this.children=i}geDescendantCount(){let e=0,n=[...this.children];for(;n.length>0;){let i=n.pop();e++;for(let o=i.children.length-1;o>=0;o--)n.push(i.children[o])}return e}getDescendants(){let e=[],n=[...this.children];for(;n.length>0;){let i=n.pop();e.push(i.value);for(let o=i.children.length-1;o>=0;o--)n.push(i.children[o])}return e}get inOrderIds(){let e=[],n=i=>{e.push(i.value);for(let o of i.children)n(o)};for(let i of this.children)n(i);return e}toString(){return this.isCollapsed?`${this.value} (collapsed)`:String(this.value)}equals(e){return this.value===e.value}},tr(Nr.prototype,"geDescendantCount",[Gm],Object.getOwnPropertyDescriptor(Nr.prototype,"geDescendantCount"),Nr.prototype),tr(Nr.prototype,"getDescendants",[Jm],Object.getOwnPropertyDescriptor(Nr.prototype,"getDescendants"),Nr.prototype),tr(Nr.prototype,"inOrderIds",[Xm],Object.getOwnPropertyDescriptor(Nr.prototype,"inOrderIds"),Nr.prototype),Nr);var Fx=0;let To;To=(Ym=Wn(),Zm=Wn(),e0=Wn(),t0=Wn(),Un=class Co{constructor(n,i){this.nodes=n,this.id=i}static from(n){let i=`tree_${Fx++}`;return new Co(n.map(o=>new Ia(o,!1,[])),i)}static fromWithPreviousShape(n,i){var c;if(!i)return Co.from(n);let o=i.id,s=new Co(n.map(d=>new Ia(d,!1,[])),o);for(let d of n)if(i.isCollapsed(d)){let f=((c=i._nodeMap.get(d))==null?void 0:c.children)??[];for(let p=f.length-1;p>=0;p--){let y=f[p];if(s._nodeMap.has(y.value)){s=s.collapse(d,y.value);break}}}return s}withNodes(n){return new Co(n,this.id)}get topLevelIds(){return this.nodes.map(n=>n.value)}get inOrderIds(){return this.nodes.flatMap(n=>[n.value,...n.inOrderIds])}get idSet(){return new Set(this.inOrderIds)}get length(){return this.nodes.length}get _nodeMap(){let n=new Map;for(let i of this.nodes)n.set(i.value,i);return n}getDescendants(n){let i=this._nodeMap.get(n);return i?i.getDescendants():(Se.warn(`Node ${n} not found in tree. Valid ids: ${this.topLevelIds}`),[])}isCollapsed(n){let i=this._nodeMap.get(n);return i?i.isCollapsed:(Se.warn(`Node ${n} not found in tree. Valid ids: ${this.topLevelIds}`),!1)}indexOfOrThrow(n){let i=this.nodes.findIndex(o=>o.value===n);if(i===-1)throw Error(`Node ${n} not found in tree. Valid ids: ${this.topLevelIds}`);return i}slice(n,i){return this.nodes.slice(n,i).map(o=>o.value)}moveToFront(n){let i=this.indexOfOrThrow(n);return this.withNodes(Pl(this.nodes,i,0))}moveToBack(n){let i=this.indexOfOrThrow(n);return this.withNodes(Pl(this.nodes,i,this.nodes.length-1))}collapse(n,i){let o=this.nodes.findIndex(p=>p.value===n);if(o===-1)throw Error(`Node ${n} not found in tree. Valid ids: ${this.topLevelIds}`);let s=i===void 0?this.nodes.length:this.nodes.findIndex(p=>p.value===i);if(s===-1)throw Error(`Node ${i} not found in tree`);if(s<o)throw Error(`Node ${i} is before node ${n}`);let c=[...this.nodes],d=c[o];if(d.isCollapsed)throw Error(`Node ${n} is already collapsed`);let f=c.splice(o+1,s-o);return c[o]=new Ia(d.value,!0,f),this.withNodes(c)}collapseAll(n){let i=[...this.nodes];if(n.length===0)throw Error("No collapse ranges provided");if(n.length!==i.length)throw Error(`Collapse ranges length ${n.length} does not match tree length ${i.length}`);let o=i.length-1;for(;o>=0;){let s=i[o],c=n[o];if(!s.isCollapsed&&c){let{id:d,until:f}=c;if(d!==s.value)throw Error(`Node ${s.value} does not match collapse range id ${d}`);let p=f===void 0?i.length:i.findIndex(w=>w.value===f);if(p===-1)throw Error(`Node ${f} not found in tree`);if(p<o)throw Error(`Node ${f} is before node ${d}`);let y=i.splice(o+1,p-o);i[o]=new Ia(s.value,!0,y),o--}else o--}return this.withNodes(i)}expand(n){let i=this.nodes.findIndex(c=>c.value===n);if(i===-1)throw Error(`Node ${n} not found in tree. Valid ids: ${this.topLevelIds}`);let o=[...this.nodes],s=o[i];if(!s.isCollapsed)throw Error(`Node ${n} is already expanded`);return o[i]=new Ia(s.value,!1,[]),o=gw(o,i+1,s.children),this.withNodes(o)}expandAll(){let n=[...this.nodes],i=0;for(;i<n.length;){let o=n[i];o.isCollapsed&&(n[i]=new Ia(o.value,!1,[]),n=gw(n,i+1,o.children)),i++}return this.withNodes(n)}move(n,i){return this.withNodes(Pl(this.nodes,n,i))}at(n){var i;return(i=this.nodes.at(n))==null?void 0:i.value}atOrThrow(n){let i=this.nodes.at(n);if(i===void 0)throw Error(`Node at index ${n} not found in tree`);return i.value}first(){return this.atOrThrow(0)}last(){return this.atOrThrow(this.nodes.length-1)}after(n){let i=this.indexOfOrThrow(n);if(i!==this.nodes.length-1)return this.at(i+1)}before(n){let i=this.indexOfOrThrow(n);if(i!==0)return this.at(i-1)}insert(n,i){return this.withNodes(mw(this.nodes,i,new Ia(n,!1,[])))}insertAtEnd(n){return this.insert(n,this.nodes.length)}insertAtStart(n){return this.insert(n,0)}deleteAtIndex(n){let i=this.atOrThrow(n),o=this.withNodes(this.nodes);try{o=o.expand(i)}catch{}return this.withNodes(nD(o.nodes,n))}delete(n){let i=this.indexOfOrThrow(n);return this.deleteAtIndex(i)}getCount(n){var i;return((i=this._nodeMap.get(n))==null?void 0:i.geDescendantCount())??0}findAndExpandDeep(n){let i=this.find(n);if(i.length===0)return this;let o=this.withNodes(this.nodes);for(let s of i)try{o=o.expand(s)}catch{}return o}find(n){function i(o,s){for(let c of o){if(c.value===n)return[...s,n];let d=i(c.children,[...s,c.value]);if(d.length>0)return d}return[]}return i(this.nodes,[])}split(n){let i=this.nodes.findIndex(c=>c.value===n);if(i===-1)throw Error(`Node ${n} not found in tree`);let o=this.nodes.slice(0,i),s=this.nodes.slice(i);return o.length===0?[Co.from([]),this.withNodes(s)]:[this.withNodes(o),Co.from([]).withNodes(s)]}equals(n){return this.nodes.length===n.nodes.length&&this.nodes.every((i,o)=>i.value===n.nodes[o].value)}toString(){let n=0,i="",o=s=>{for(let c of s)i+=`${" ".repeat(n*2)}${c.toString()}
14
+ `," ").replaceAll("\r","")}function md(e){return typeof e=="object"&&e&&"$bigint"in e&&typeof e.$bigint=="string"?BigInt(e.$bigint):e}var Bm="abcdefghijklmnopqrstuvwxyz",Hm=Bm+Bm.toUpperCase(),Vm=new Set;Rs="__scratch__",yr="setup",Ma={create(){let e=0,n;do{let i="";for(let o=0;o<4;o++)i+=Hm[Math.floor(Math.random()*Hm.length)];n=i,e++}while(Vm.has(n)&&e<100);if(e>=100)throw Error("Failed to generate unique CellId after 100 attempts");return Vm.add(n),n}},er={create(e){return In(e!=null,"cellId is required"),`cell-${e}`},parse(e){return e.slice(5)},findElement(e){return e.closest('div[id^="cell-"]')},findElementThroughShadowDOMs(e){let n=e;for(;n;){let i=er.findElement(n);if(i)return i;let o=n.getRootNode();if(n=o instanceof ShadowRoot?o.host:n.parentElement,n===o)break}return null}},G_=function(e){let n=null,i=er.findElementThroughShadowDOMs(e);return i&&(n=er.parse(i.id)),n},id={parse(e){return e.getAttribute("object-id")},parseOrThrow(e){let n=id.parse(e);return In(n,"<marimo-ui-element/> missing object-id attribute"),n}},z_={create(e){return`output-${e}`}},_m=new class{getFilename(){return this.getSearchParam("filename")}setFilename(e){this.setSearchParam("filename",e)}getCodeFromSearchParam(){return this.getSearchParam("code")}getCodeFromHash(){let e=window.location.hash;return e.startsWith("#code/")?e.slice(6):null}setCodeForHash(e){window.location.hash=`#code/${e}`}setSearchParam(e,n){let i=new URL(window.location.href);i.searchParams.set(e,n),window.history.replaceState({},"",i.toString())}getSearchParam(e){return new URL(window.location.href).searchParams.get(e)}},$u=function(e){return vm(e??"")},e_=function(e){return ui.mapValues(e.dataset,n=>typeof n=="string"?$u(n):n)},Rw=function(e,n){let i=e.parentElement?id.parse(e.parentElement):void 0;return i&&n.has(i)?n.lookupValue(i):$u(e.dataset.initialValue)},Fl=function(){if(v4())return document.title||null;if(vh()){let i=_m.getFilename();if(i)return i}let e=document.querySelector("marimo-filename");bm(e,"marimo-filename tag not found");let n=e.innerHTML;return n.length===0?null:n};var Ex=Symbol("");Ww=function(e,n){return ze(e,function(i,o,s){o(this,n(i(this),s))})};function gd(e,n){let i=null,o=new Map,s=new Set,c=f=>{let p;if(n===void 0)p=o.get(f);else for(let[w,_]of o)if(n(w,f)){p=_;break}if(p!==void 0)if(i!=null&&i(p[1],f))c.remove(f);else return p[0];let y=e(f);return o.set(f,[y,Date.now()]),d("CREATE",f,y),y},d=(f,p,y)=>{for(let w of s)w({type:f,param:p,atom:y})};return c.unstable_listen=f=>(s.add(f),()=>{s.delete(f)}),c.getParams=()=>o.keys(),c.remove=f=>{if(n===void 0){if(!o.has(f))return;let[p]=o.get(f);o.delete(f),d("REMOVE",f,p)}else for(let[p,[y]]of o)if(n(p,f)){o.delete(p),d("REMOVE",p,y);break}},c.setShouldRemove=f=>{if(i=f,i)for(let[p,[y,w]]of o)i(w,p)&&(o.delete(p),d("REMOVE",p,y))},c}var yd=(e,n,i)=>(n.has(i)?n:n.set(i,e())).get(i),Tx=new WeakMap,Rx=(e,n,i,o)=>yd(e,yd(()=>new WeakMap,yd(()=>new WeakMap,Tx,n),i),o);function Dx(e,n,i=Object.is){return Rx(()=>{let o=Symbol(),s=([d,f])=>{if(f===o)return n(d);let p=n(d,f);return i(f,p)?f:p},c=ze(d=>{let f=d(c);return s([d(e),f])});return c.init=o,c},e,n,i)}var $m=(e,n,i)=>(n.has(i)?n:n.set(i,e())).get(i),Ox=new WeakMap,Px=(e,n,i)=>$m(e,$m(()=>new WeakMap,Ox,n),i),Mx={},Wm=e=>!!e.write,Lx=e=>typeof e=="function";function Nx(e,n){return Px(()=>{let i=new WeakMap,o=(d,f)=>{let p=i.get(d);if(p)return p;let y=f&&i.get(f),w=[],_=[];return d.forEach((C,E)=>{let T=n?n(C):E;_[E]=T;let I=y&&y.atomList[y.keyList.indexOf(T)];if(I){w[E]=I;return}let $=V=>{let F=V(s),N=V(e),K=o(N,F==null?void 0:F.arr).keyList.indexOf(T);if(K<0||K>=N.length){let pe=d[o(d).keyList.indexOf(T)];if(pe)return pe;throw Error("splitAtom: index out of bounds for read")}return N[K]};w[E]=Wm(e)?ze($,(V,F,N)=>{let K=V(s),pe=V(e),P=o(pe,K==null?void 0:K.arr).keyList.indexOf(T);if(P<0||P>=pe.length)throw Error("splitAtom: index out of bounds for write");let A=Lx(N)?N(pe[P]):N;Object.is(pe[P],A)||F(e,[...pe.slice(0,P),A,...pe.slice(P+1)])}):ze($)}),p=y&&y.keyList.length===_.length&&y.keyList.every((C,E)=>C===_[E])?y:{arr:d,atomList:w,keyList:_},i.set(d,p),p},s=ze(d=>{let f=d(s);return o(d(e),f==null?void 0:f.arr)});s.init=void 0;let c=Wm(e)?ze(d=>d(s).atomList,(d,f,p)=>{switch(p.type){case"remove":{let y=d(c).indexOf(p.atom);if(y>=0){let w=d(e);f(e,[...w.slice(0,y),...w.slice(y+1)])}break}case"insert":{let y=p.before?d(c).indexOf(p.before):d(c).length;if(y>=0){let w=d(e);f(e,[...w.slice(0,y),p.value,...w.slice(y)])}break}case"move":{let y=d(c).indexOf(p.atom),w=p.before?d(c).indexOf(p.before):d(c).length;if(y>=0&&w>=0){let _=d(e);y<w?f(e,[..._.slice(0,y),..._.slice(y+1,w),_[y],..._.slice(w)]):f(e,[..._.slice(0,w),_[y],..._.slice(w,y),..._.slice(y+1)])}break}}}):ze(d=>d(s).atomList);return c},e,n||Mx)}var Um=e=>typeof(e==null?void 0:e.then)=="function";function Km(e=()=>{try{return window.localStorage}catch{return}},n){var f;let i,o,s={getItem:(p,y)=>{var C;let w=E=>{if(E||(E=""),i!==E){try{o=JSON.parse(E,n==null?void 0:n.reviver)}catch{return y}i=E}return o},_=((C=e())==null?void 0:C.getItem(p))??null;return Um(_)?_.then(w):w(_)},setItem:(p,y)=>{var w;return(w=e())==null?void 0:w.setItem(p,JSON.stringify(y,n==null?void 0:n.replacer))},removeItem:p=>{var y;return(y=e())==null?void 0:y.removeItem(p)}},c=p=>(y,w,_)=>p(y,C=>{let E;try{E=JSON.parse(C||"")}catch{E=_}w(E)}),d;try{d=(f=e())==null?void 0:f.subscribe}catch{}return!d&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(d=(p,y)=>{if(!(e()instanceof window.Storage))return()=>{};let w=_=>{_.storageArea===e()&&_.key===p&&y(_.newValue)};return window.addEventListener("storage",w),()=>{window.removeEventListener("storage",w)}}),d&&(s.subscribe=c(d)),s}var Ix=Km();Bl=function(e,n,i=Ix,o){let s=ze(o!=null&&o.getOnInit?i.getItem(e,n):n);return s.onMount=c=>{c(i.getItem(e,n));let d;return i.subscribe&&(d=i.subscribe(e,c,n)),d},ze(c=>c(s),(c,d,f)=>{let p=typeof f=="function"?f(c(s)):f;return p===Ex?(d(s,n),i.removeItem(e)):Um(p)?p.then(y=>(d(s,y),i.setItem(e,y))):(d(s,p),i.setItem(e,p))})},Wn=function(e){let n,i,o;return typeof e=="object"?(n=e.hashFunction,i=e.expiring,o=e.tags):n=e,(s,c,d)=>{if(d.value!=null)d.value=Qm(d.value,n,i,o);else if(d.get!=null)d.get=Qm(d.get,n,i,o);else throw"Only put a Memoize() decorator on a method or get accessor."}};var vd=new Map;function Qm(e,n,i=0,o){let s=Symbol("__memoized_map__");return function(...c){let d;this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:new Map});let f=this[s];if(Array.isArray(o))for(let p of o)vd.has(p)?vd.get(p).push(f):vd.set(p,[f]);if(n||c.length>0||i>0){let p;p=n===!0?c.map(_=>_.toString()).join("!"):n?n.apply(this,c):c[0];let y=`${p}__timestamp`,w=!1;if(i>0)if(!f.has(y))w=!0;else{let _=f.get(y);w=Date.now()-_>i}f.has(p)&&!w?d=f.get(p):(d=e.apply(this,c),f.set(p,d),i>0&&f.set(y,Date.now()))}else{let p=this;f.has(p)?d=f.get(p):(d=e.apply(this,c),f.set(p,d))}return d}}Cs=ze(Fl()),Bw=ze(void 0);var Ax=class{constructor(){ke(this,"store",new Map)}get length(){return this.store.size}clear(){this.store.clear()}getItem(e){return this.store.get(e)||null}key(e){return[...this.store.keys()][e]||null}removeItem(e){this.store.delete(e)}setItem(e,n){this.store.set(e,n)}};function qx(){let{hasLocalStorage:e,hasSessionStorage:n}=rD();return e?window.localStorage:n?window.sessionStorage:new Ax}Ts=qx();let Qi;Vw=class{constructor(e,n=Ts){this.defaultValue=e,this.storage=n}get(e){try{let n=this.storage.getItem(e);return n?JSON.parse(n):this.defaultValue}catch{return this.defaultValue}}set(e,n){this.storage.setItem(e,JSON.stringify(n))}remove(e){this.storage.removeItem(e)}},Vu=class{constructor(e,n,i=Ts){this.schema=e,this.getDefaultValue=n,this.storage=i}get(e){try{let n=this.storage.getItem(e);if(n==null)return this.getDefaultValue();let i=this.schema.safeParse(JSON.parse(n));return i.success?i.data:(Se.warn("Error parsing zod local storage",i.error),this.getDefaultValue())}catch(n){return Se.warn("Error getting zod local storage",n),this.getDefaultValue()}}set(e,n){this.storage.setItem(e,JSON.stringify(n))}remove(e){this.storage.removeItem(e)}},rm=class extends Vu{constructor(e,n,i){let o=lt.get(Cs);super(n,i),this.filename=o;try{this.unsubscribeFromFilename=lt.sub(Cs,()=>{let s=lt.get(Cs);this.handleFilenameChange(e,s)})}catch{this.unsubscribeFromFilename=null}}get(e){return super.get(this.createScopedKey(e,this.filename))}set(e,n){super.set(this.createScopedKey(e,this.filename),n)}remove(e){super.remove(this.createScopedKey(e,this.filename))}createScopedKey(e,n){return n?`${e}:${n}`:e}handleFilenameChange(e,n){if(n&&n!==this.filename){let i=this.get(e);this.remove(e),this.filename=n,this.set(e,i)}}dispose(){this.unsubscribeFromFilename&&(this.unsubscribeFromFilename=(this.unsubscribeFromFilename(),null))}},Qi="marimo:notebook-col-sizes";function jx(){return{widths:[]}}var Eo=new rm(Qi,G2({widths:i4(t4([n4(),r4("contentWidth")]).default("contentWidth"))}),jx);Lw={getColumnWidth:e=>Eo.get(Qi).widths[e]??"contentWidth",saveColumnWidth:(e,n)=>{let i=Eo.get(Qi).widths;if(i[e])i[e]=n;else{for(;i.length<=e;)i.push("contentWidth");i[e]=n}Eo.set(Qi,{widths:i})},clearStorage:()=>{Eo.remove(Qi)}};function zx(e,n){let i=Eo.get(Qi).widths,o=Pl(i,e,n);Eo.set(Qi,{widths:o})}var Gm,Jm,Xm,Nr,Ym,Zm,e0,t0,Un,n0,r0,i0,a0,o0,s0,en;function tr(e,n,i,o,s){var c={};return Object.keys(o).forEach(function(d){c[d]=o[d]}),c.enumerable=!!c.enumerable,c.configurable=!!c.configurable,("value"in c||c.initializer)&&(c.writable=!0),c=i.slice().reverse().reduce(function(d,f){return f(e,n,d)||d},c),s&&c.initializer!==void 0&&(c.value=c.initializer?c.initializer.call(s):void 0,c.initializer=void 0),c.initializer===void 0?(Object.defineProperty(e,n,c),null):c}let Ia=(Gm=Wn(),Jm=Wn(),Xm=Wn(),Nr=class{constructor(e,n,i){this.value=e,this.isCollapsed=n,this.children=i}geDescendantCount(){let e=0,n=[...this.children];for(;n.length>0;){let i=n.pop();e++;for(let o=i.children.length-1;o>=0;o--)n.push(i.children[o])}return e}getDescendants(){let e=[],n=[...this.children];for(;n.length>0;){let i=n.pop();e.push(i.value);for(let o=i.children.length-1;o>=0;o--)n.push(i.children[o])}return e}get inOrderIds(){let e=[],n=i=>{e.push(i.value);for(let o of i.children)n(o)};for(let i of this.children)n(i);return e}toString(){return this.isCollapsed?`${this.value} (collapsed)`:String(this.value)}equals(e){return this.value===e.value}},tr(Nr.prototype,"geDescendantCount",[Gm],Object.getOwnPropertyDescriptor(Nr.prototype,"geDescendantCount"),Nr.prototype),tr(Nr.prototype,"getDescendants",[Jm],Object.getOwnPropertyDescriptor(Nr.prototype,"getDescendants"),Nr.prototype),tr(Nr.prototype,"inOrderIds",[Xm],Object.getOwnPropertyDescriptor(Nr.prototype,"inOrderIds"),Nr.prototype),Nr);var Fx=0;let To;To=(Ym=Wn(),Zm=Wn(),e0=Wn(),t0=Wn(),Un=class Co{constructor(n,i){this.nodes=n,this.id=i}static from(n){let i=`tree_${Fx++}`;return new Co(n.map(o=>new Ia(o,!1,[])),i)}static fromWithPreviousShape(n,i){var c;if(!i)return Co.from(n);let o=i.id,s=new Co(n.map(d=>new Ia(d,!1,[])),o);for(let d of n)if(i.isCollapsed(d)){let f=((c=i._nodeMap.get(d))==null?void 0:c.children)??[];for(let p=f.length-1;p>=0;p--){let y=f[p];if(s._nodeMap.has(y.value)){s=s.collapse(d,y.value);break}}}return s}withNodes(n){return new Co(n,this.id)}get topLevelIds(){return this.nodes.map(n=>n.value)}get inOrderIds(){return this.nodes.flatMap(n=>[n.value,...n.inOrderIds])}get idSet(){return new Set(this.inOrderIds)}get length(){return this.nodes.length}get _nodeMap(){let n=new Map;for(let i of this.nodes)n.set(i.value,i);return n}getDescendants(n){let i=this._nodeMap.get(n);return i?i.getDescendants():(Se.warn(`Node ${n} not found in tree. Valid ids: ${this.topLevelIds}`),[])}isCollapsed(n){let i=this._nodeMap.get(n);return i?i.isCollapsed:(Se.warn(`Node ${n} not found in tree. Valid ids: ${this.topLevelIds}`),!1)}indexOfOrThrow(n){let i=this.nodes.findIndex(o=>o.value===n);if(i===-1)throw Error(`Node ${n} not found in tree. Valid ids: ${this.topLevelIds}`);return i}slice(n,i){return this.nodes.slice(n,i).map(o=>o.value)}moveToFront(n){let i=this.indexOfOrThrow(n);return this.withNodes(Pl(this.nodes,i,0))}moveToBack(n){let i=this.indexOfOrThrow(n);return this.withNodes(Pl(this.nodes,i,this.nodes.length-1))}collapse(n,i){let o=this.nodes.findIndex(p=>p.value===n);if(o===-1)throw Error(`Node ${n} not found in tree. Valid ids: ${this.topLevelIds}`);let s=i===void 0?this.nodes.length:this.nodes.findIndex(p=>p.value===i);if(s===-1)throw Error(`Node ${i} not found in tree`);if(s<o)throw Error(`Node ${i} is before node ${n}`);let c=[...this.nodes],d=c[o];if(d.isCollapsed)throw Error(`Node ${n} is already collapsed`);let f=c.splice(o+1,s-o);return c[o]=new Ia(d.value,!0,f),this.withNodes(c)}collapseAll(n){let i=[...this.nodes];if(n.length===0)throw Error("No collapse ranges provided");if(n.length!==i.length)throw Error(`Collapse ranges length ${n.length} does not match tree length ${i.length}`);let o=i.length-1;for(;o>=0;){let s=i[o],c=n[o];if(!s.isCollapsed&&c){let{id:d,until:f}=c;if(d!==s.value)throw Error(`Node ${s.value} does not match collapse range id ${d}`);let p=f===void 0?i.length:i.findIndex(w=>w.value===f);if(p===-1)throw Error(`Node ${f} not found in tree`);if(p<o)throw Error(`Node ${f} is before node ${d}`);let y=i.splice(o+1,p-o);i[o]=new Ia(s.value,!0,y),o--}else o--}return this.withNodes(i)}expand(n){let i=this.nodes.findIndex(c=>c.value===n);if(i===-1)throw Error(`Node ${n} not found in tree. Valid ids: ${this.topLevelIds}`);let o=[...this.nodes],s=o[i];return s.isCollapsed?(o[i]=new Ia(s.value,!1,[]),o=gw(o,i+1,s.children),this.withNodes(o)):this}expandAll(){let n=[...this.nodes],i=0;for(;i<n.length;){let o=n[i];o.isCollapsed&&(n[i]=new Ia(o.value,!1,[]),n=gw(n,i+1,o.children)),i++}return this.withNodes(n)}move(n,i){return this.withNodes(Pl(this.nodes,n,i))}at(n){var i;return(i=this.nodes.at(n))==null?void 0:i.value}atOrThrow(n){let i=this.nodes.at(n);if(i===void 0)throw Error(`Node at index ${n} not found in tree`);return i.value}first(){return this.atOrThrow(0)}last(){return this.atOrThrow(this.nodes.length-1)}after(n){let i=this.indexOfOrThrow(n);if(i!==this.nodes.length-1)return this.at(i+1)}before(n){let i=this.indexOfOrThrow(n);if(i!==0)return this.at(i-1)}insert(n,i){return this.withNodes(mw(this.nodes,i,new Ia(n,!1,[])))}insertAtEnd(n){return this.insert(n,this.nodes.length)}insertAtStart(n){return this.insert(n,0)}deleteAtIndex(n){let i=this.atOrThrow(n),o=this.expand(i);return o.withNodes(nD(o.nodes,n))}delete(n){let i=this.indexOfOrThrow(n);return this.deleteAtIndex(i)}getCount(n){var i;return((i=this._nodeMap.get(n))==null?void 0:i.geDescendantCount())??0}findAndExpandDeep(n){let i=this.find(n);return i.length===0?this:i.reduce((o,s)=>o.expand(s),this)}find(n){function i(o,s){for(let c of o){if(c.value===n)return[...s,n];let d=i(c.children,[...s,c.value]);if(d.length>0)return d}return[]}return i(this.nodes,[])}split(n){let i=this.nodes.findIndex(c=>c.value===n);if(i===-1)throw Error(`Node ${n} not found in tree`);let o=this.nodes.slice(0,i),s=this.nodes.slice(i);return o.length===0?[Co.from([]),this.withNodes(s)]:[this.withNodes(o),Co.from([]).withNodes(s)]}equals(n){return this.nodes.length===n.nodes.length&&this.nodes.every((i,o)=>i.value===n.nodes[o].value)}toString(){let n=0,i="",o=s=>{for(let c of s)i+=`${" ".repeat(n*2)}${c.toString()}
15
15
  `,n+=1,o(c.children),--n};return o(this.nodes),i}},tr(Un.prototype,"topLevelIds",[Ym],Object.getOwnPropertyDescriptor(Un.prototype,"topLevelIds"),Un.prototype),tr(Un.prototype,"inOrderIds",[Zm],Object.getOwnPropertyDescriptor(Un.prototype,"inOrderIds"),Un.prototype),tr(Un.prototype,"idSet",[e0],Object.getOwnPropertyDescriptor(Un.prototype,"idSet"),Un.prototype),tr(Un.prototype,"_nodeMap",[t0],Object.getOwnPropertyDescriptor(Un.prototype,"_nodeMap"),Un.prototype),Un),Kl=(n0=Wn(),r0=Wn(),i0=Wn(),a0=Wn(),o0=Wn(),s0=Wn(),en=class An{constructor(n){this.columns=n,n.length===0&&(this.columns=[To.from([])])}static from(n){return new An(n.map(i=>To.from(i)))}static fromWithPreviousShape(n,i){if(!i)return An.from([n]);let o=i.getColumns(),s=Array.from({length:o.length},()=>[]),c=0;for(let d of n){let f=o.findIndex(p=>p.idSet.has(d));f===-1?s[c].push(d):(c=f,s[f].push(d))}return new An(s.map((d,f)=>To.fromWithPreviousShape(d,o[f])))}isEmpty(){return this.columns.length===0?!0:this.columns.every(n=>n.nodes.length===0)}static fromIdsAndColumns(n){let i=Math.max(1,...n.map(([,c])=>(c??0)+1)),o=Array.from({length:i},()=>[]),s=0;for(let[c,d]of n)d==null||d<0?o[s].push(c):(o[d].push(c),s=d);return An.from(o)}get topLevelIds(){return this.columns.map(n=>n.topLevelIds)}get iterateTopLevelIds(){let n=this.columns;function*i(){for(let o of n)for(let s of o.topLevelIds)yield s}return i()}get inOrderIds(){return this.columns.flatMap(n=>n.inOrderIds)}get colLength(){return this.columns.length}get idLength(){return this.columns.reduce((n,i)=>n+i.nodes.length,0)}get _columnMap(){return new Map(this.columns.map(n=>[n.id,n]))}at(n){return this.columns[n]}get(n){return this._columnMap.get(n)}atOrThrow(n){let i=this.columns[n];if(!i)throw Error(`Column ${n} not found`);return i}hasOnlyOneColumn(){return this.columns.length===1}getColumns(){return this.columns}hasOnlyOneId(){return this.idLength===1}getColumnIds(){return this.columns.map(n=>n.id)}indexOf(n){return this.columns.indexOf(n)}addColumn(n,i=[]){return new An(this.columns.flatMap(o=>o.id===n?[o,To.from(i)]:[o]))}insertBreakpoint(n){let i=this.findWithId(n),[o,s]=i.split(n);return new An(this.columns.flatMap(c=>c===i?[o,s].filter(Boolean):[c]))}delete(n){if(this.columns.length<=1)return this;let i=this.indexOfOrThrow(n),o=i===0?1:i-1,s=[...this.columns],c=s[i];return s[o]=c.withNodes([...s[o].nodes,...c.nodes]),s.splice(i,1),new An(s)}mergeAllColumns(){if(this.columns.length<=1)return this;let n=this.columns.flatMap(o=>o.nodes),i=this.columns[0];return new An([i.withNodes(n)])}moveWithinColumn(n,i,o){return this.transform(n,s=>s.move(i,o))}moveAcrossColumns(n,i,o,s){let c=this.indexOfOrThrow(n),d=this.indexOfOrThrow(o),f=[...this.columns],p=f[c],y=p.nodes.findIndex(C=>C.value===i);if(y===-1)throw Error(`Node ${i} not found in column ${n}`);let w=p.nodes[y];f[c]=p.withNodes(p.nodes.filter((C,E)=>E!==y));let _=f[d];if(s){let C=_.indexOfOrThrow(s);f[d]=_.withNodes(mw(_.nodes,C,w))}else f[d]=_.withNodes([w,..._.nodes]);return new An(f)}indexOfOrThrow(n){let i=this.columns.findIndex(o=>o.id===n);if(i===-1)throw Error(`Column ${n} not found. Possible values: ${this.getColumnIds().join(", ")}`);return i}moveColumn(n,i){if(n===i)return this;let o=this.indexOfOrThrow(n),s=i==="_left_"?o-1:i==="_right_"?o+1:this.indexOfOrThrow(i);return zx(o,s),new An(Pl([...this.columns],o,s))}moveToNewColumn(n){let i=this.findWithId(n),o=this.columns.map(c=>c.id===i.id?c.delete(n):c),s=To.from([n]);return new An([...o,s])}findWithId(n){let i=this.columns.find(o=>o.inOrderIds.includes(n));if(!i)throw Se.log(`Possible values: ${this.columns.map(o=>o.inOrderIds).join(", ")}`),Error(`Cell ${n} not found in any column`);return i}transformWithCellId(n,i){let o=!1,s=this.columns.map(c=>{if(c.inOrderIds.includes(n)){let d=i(c);return c!==d&&(o=!0),d}return c});return o?new An(s):this}setupCellExists(){return this.columns.some(n=>n.topLevelIds.includes(yr))}insertId(n,i,o){return this.transform(i,s=>s.insert(n,o))}deleteById(n){return this.transformWithCellId(n,i=>i.delete(n))}compact(){return this.columns.length===1||!this.columns.some(n=>n.nodes.length===0)?this:new An(this.columns.filter(n=>n.nodes.length>0))}transform(n,i){let o=this._columnMap.get(n);if(!o)return Se.warn(`Column ${n} not found`),this;let s=i(o);return o===s?this:new An(this.columns.map(c=>c.id===n?s:c))}transformAll(n){let i=!1,o=this.columns.map(s=>{let c=n(s);return s.equals(c)||(i=!0),c});return i?new An(o):this}},tr(en.prototype,"isEmpty",[n0],Object.getOwnPropertyDescriptor(en.prototype,"isEmpty"),en.prototype),tr(en.prototype,"topLevelIds",[r0],Object.getOwnPropertyDescriptor(en.prototype,"topLevelIds"),en.prototype),tr(en.prototype,"inOrderIds",[i0],Object.getOwnPropertyDescriptor(en.prototype,"inOrderIds"),en.prototype),tr(en.prototype,"idLength",[a0],Object.getOwnPropertyDescriptor(en.prototype,"idLength"),en.prototype),tr(en.prototype,"_columnMap",[o0],Object.getOwnPropertyDescriptor(en.prototype,"_columnMap"),en.prototype),tr(en.prototype,"getColumnIds",[s0],Object.getOwnPropertyDescriptor(en.prototype,"getColumnIds"),en.prototype),en);let bd,wd,_d,l0,xd,c0,u0,d0,f0,kd,Sd,p0,Cd,Ed;bd=Ee((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Doctype=e.CDATA=e.Tag=e.Style=e.Script=e.Comment=e.Directive=e.Text=e.Root=e.isTag=e.ElementType=void 0;var n;(function(o){o.Root="root",o.Text="text",o.Directive="directive",o.Comment="comment",o.Script="script",o.Style="style",o.Tag="tag",o.CDATA="cdata",o.Doctype="doctype"})(n=e.ElementType||(e.ElementType={}));function i(o){return o.type===n.Tag||o.type===n.Script||o.type===n.Style}e.isTag=i,e.Root=n.Root,e.Text=n.Text,e.Directive=n.Directive,e.Comment=n.Comment,e.Script=n.Script,e.Style=n.Style,e.Tag=n.Tag,e.CDATA=n.CDATA,e.Doctype=n.Doctype})),wd=Ee((e=>{var n=e&&e.__extends||(function(){var P=function(A,W){return P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(de,fe){de.__proto__=fe}||function(de,fe){for(var we in fe)Object.prototype.hasOwnProperty.call(fe,we)&&(de[we]=fe[we])},P(A,W)};return function(A,W){if(typeof W!="function"&&W!==null)throw TypeError("Class extends value "+String(W)+" is not a constructor or null");P(A,W);function de(){this.constructor=A}A.prototype=W===null?Object.create(W):(de.prototype=W.prototype,new de)}})(),i=e&&e.__assign||function(){return i=Object.assign||function(P){for(var A,W=1,de=arguments.length;W<de;W++)for(var fe in A=arguments[W],A)Object.prototype.hasOwnProperty.call(A,fe)&&(P[fe]=A[fe]);return P},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.cloneNode=e.hasChildren=e.isDocument=e.isDirective=e.isComment=e.isText=e.isCDATA=e.isTag=e.Element=e.Document=e.CDATA=e.NodeWithChildren=e.ProcessingInstruction=e.Comment=e.Text=e.DataNode=e.Node=void 0;var o=bd(),s=(function(){function P(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(P.prototype,"parentNode",{get:function(){return this.parent},set:function(A){this.parent=A},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"previousSibling",{get:function(){return this.prev},set:function(A){this.prev=A},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"nextSibling",{get:function(){return this.next},set:function(A){this.next=A},enumerable:!1,configurable:!0}),P.prototype.cloneNode=function(A){return A===void 0&&(A=!1),K(this,A)},P})();e.Node=s;var c=(function(P){n(A,P);function A(W){var de=P.call(this)||this;return de.data=W,de}return Object.defineProperty(A.prototype,"nodeValue",{get:function(){return this.data},set:function(W){this.data=W},enumerable:!1,configurable:!0}),A})(s);e.DataNode=c;var d=(function(P){n(A,P);function A(){var W=P!==null&&P.apply(this,arguments)||this;return W.type=o.ElementType.Text,W}return Object.defineProperty(A.prototype,"nodeType",{get:function(){return 3},enumerable:!1,configurable:!0}),A})(c);e.Text=d;var f=(function(P){n(A,P);function A(){var W=P!==null&&P.apply(this,arguments)||this;return W.type=o.ElementType.Comment,W}return Object.defineProperty(A.prototype,"nodeType",{get:function(){return 8},enumerable:!1,configurable:!0}),A})(c);e.Comment=f;var p=(function(P){n(A,P);function A(W,de){var fe=P.call(this,de)||this;return fe.name=W,fe.type=o.ElementType.Directive,fe}return Object.defineProperty(A.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),A})(c);e.ProcessingInstruction=p;var y=(function(P){n(A,P);function A(W){var de=P.call(this)||this;return de.children=W,de}return Object.defineProperty(A.prototype,"firstChild",{get:function(){return this.children[0]??null},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"lastChild",{get:function(){return this.children.length>0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"childNodes",{get:function(){return this.children},set:function(W){this.children=W},enumerable:!1,configurable:!0}),A})(s);e.NodeWithChildren=y;var w=(function(P){n(A,P);function A(){var W=P!==null&&P.apply(this,arguments)||this;return W.type=o.ElementType.CDATA,W}return Object.defineProperty(A.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),A})(y);e.CDATA=w;var _=(function(P){n(A,P);function A(){var W=P!==null&&P.apply(this,arguments)||this;return W.type=o.ElementType.Root,W}return Object.defineProperty(A.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),A})(y);e.Document=_;var C=(function(P){n(A,P);function A(W,de,fe,we){fe===void 0&&(fe=[]),we===void 0&&(we=W==="script"?o.ElementType.Script:W==="style"?o.ElementType.Style:o.ElementType.Tag);var J=P.call(this,fe)||this;return J.name=W,J.attribs=de,J.type=we,J}return Object.defineProperty(A.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"tagName",{get:function(){return this.name},set:function(W){this.name=W},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"attributes",{get:function(){var W=this;return Object.keys(this.attribs).map(function(de){var fe,we;return{name:de,value:W.attribs[de],namespace:(fe=W["x-attribsNamespace"])==null?void 0:fe[de],prefix:(we=W["x-attribsPrefix"])==null?void 0:we[de]}})},enumerable:!1,configurable:!0}),A})(y);e.Element=C;function E(P){return(0,o.isTag)(P)}e.isTag=E;function T(P){return P.type===o.ElementType.CDATA}e.isCDATA=T;function I(P){return P.type===o.ElementType.Text}e.isText=I;function $(P){return P.type===o.ElementType.Comment}e.isComment=$;function V(P){return P.type===o.ElementType.Directive}e.isDirective=V;function F(P){return P.type===o.ElementType.Root}e.isDocument=F;function N(P){return Object.prototype.hasOwnProperty.call(P,"children")}e.hasChildren=N;function K(P,A){A===void 0&&(A=!1);var W;if(I(P))W=new d(P.data);else if($(P))W=new f(P.data);else if(E(P)){var de=A?pe(P.children):[],fe=new C(P.name,i({},P.attribs),de);de.forEach(function(Ce){return Ce.parent=fe}),P.namespace!=null&&(fe.namespace=P.namespace),P["x-attribsNamespace"]&&(fe["x-attribsNamespace"]=i({},P["x-attribsNamespace"])),P["x-attribsPrefix"]&&(fe["x-attribsPrefix"]=i({},P["x-attribsPrefix"])),W=fe}else if(T(P)){var de=A?pe(P.children):[],we=new w(de);de.forEach(function(Z){return Z.parent=we}),W=we}else if(F(P)){var de=A?pe(P.children):[],J=new _(de);de.forEach(function(Z){return Z.parent=J}),P["x-mode"]&&(J["x-mode"]=P["x-mode"]),W=J}else if(V(P)){var be=new p(P.name,P.data);P["x-name"]!=null&&(be["x-name"]=P["x-name"],be["x-publicId"]=P["x-publicId"],be["x-systemId"]=P["x-systemId"]),W=be}else throw Error(`Not implemented yet: ${P.type}`);return W.startIndex=P.startIndex,W.endIndex=P.endIndex,P.sourceCodeLocation!=null&&(W.sourceCodeLocation=P.sourceCodeLocation),W}e.cloneNode=K;function pe(P){for(var A=P.map(function(de){return K(de,!0)}),W=1;W<A.length;W++)A[W].prev=A[W-1],A[W-1].next=A[W];return A}})),_d=Ee((e=>{var n=e&&e.__createBinding||(Object.create?(function(f,p,y,w){w===void 0&&(w=y);var _=Object.getOwnPropertyDescriptor(p,y);(!_||("get"in _?!p.__esModule:_.writable||_.configurable))&&(_={enumerable:!0,get:function(){return p[y]}}),Object.defineProperty(f,w,_)}):(function(f,p,y,w){w===void 0&&(w=y),f[w]=p[y]})),i=e&&e.__exportStar||function(f,p){for(var y in f)y!=="default"&&!Object.prototype.hasOwnProperty.call(p,y)&&n(p,f,y)};Object.defineProperty(e,"__esModule",{value:!0}),e.DomHandler=void 0;var o=bd(),s=wd();i(wd(),e);var c={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},d=(function(){function f(p,y,w){this.dom=[],this.root=new s.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof y=="function"&&(w=y,y=c),typeof p=="object"&&(y=p,p=void 0),this.callback=p??null,this.options=y??c,this.elementCB=w??null}return f.prototype.onparserinit=function(p){this.parser=p},f.prototype.onreset=function(){this.dom=[],this.root=new s.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null},f.prototype.onend=function(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))},f.prototype.onerror=function(p){this.handleCallback(p)},f.prototype.onclosetag=function(){this.lastNode=null;var p=this.tagStack.pop();this.options.withEndIndices&&(p.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(p)},f.prototype.onopentag=function(p,y){var w=this.options.xmlMode?o.ElementType.Tag:void 0,_=new s.Element(p,y,void 0,w);this.addNode(_),this.tagStack.push(_)},f.prototype.ontext=function(p){var y=this.lastNode;if(y&&y.type===o.ElementType.Text)y.data+=p,this.options.withEndIndices&&(y.endIndex=this.parser.endIndex);else{var w=new s.Text(p);this.addNode(w),this.lastNode=w}},f.prototype.oncomment=function(p){if(this.lastNode&&this.lastNode.type===o.ElementType.Comment){this.lastNode.data+=p;return}var y=new s.Comment(p);this.addNode(y),this.lastNode=y},f.prototype.oncommentend=function(){this.lastNode=null},f.prototype.oncdatastart=function(){var p=new s.Text(""),y=new s.CDATA([p]);this.addNode(y),p.parent=y,this.lastNode=p},f.prototype.oncdataend=function(){this.lastNode=null},f.prototype.onprocessinginstruction=function(p,y){var w=new s.ProcessingInstruction(p,y);this.addNode(w)},f.prototype.handleCallback=function(p){if(typeof this.callback=="function")this.callback(p,this.dom);else if(p)throw p},f.prototype.addNode=function(p){var y=this.tagStack[this.tagStack.length-1],w=y.children[y.children.length-1];this.options.withStartIndices&&(p.startIndex=this.parser.startIndex),this.options.withEndIndices&&(p.endIndex=this.parser.endIndex),y.children.push(p),w&&(p.prev=w,w.next=p),p.parent=y,this.lastNode=null},f})();e.DomHandler=d,e.default=d})),l0=Ee((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CARRIAGE_RETURN_PLACEHOLDER_REGEX=e.CARRIAGE_RETURN_PLACEHOLDER=e.CARRIAGE_RETURN_REGEX=e.CARRIAGE_RETURN=e.CASE_SENSITIVE_TAG_NAMES_MAP=e.CASE_SENSITIVE_TAG_NAMES=void 0,e.CASE_SENSITIVE_TAG_NAMES="animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.linearGradient.radialGradient.textPath".split("."),e.CASE_SENSITIVE_TAG_NAMES_MAP=e.CASE_SENSITIVE_TAG_NAMES.reduce(function(n,i){return n[i.toLowerCase()]=i,n},{}),e.CARRIAGE_RETURN="\r",e.CARRIAGE_RETURN_REGEX=new RegExp(e.CARRIAGE_RETURN,"g"),e.CARRIAGE_RETURN_PLACEHOLDER=`__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_${Date.now()}__`,e.CARRIAGE_RETURN_PLACEHOLDER_REGEX=new RegExp(e.CARRIAGE_RETURN_PLACEHOLDER,"g")})),xd=Ee((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatAttributes=s,e.escapeSpecialCharacters=d,e.revertEscapedCharacters=f,e.formatDOM=p;var n=_d(),i=l0();function o(y){return i.CASE_SENSITIVE_TAG_NAMES_MAP[y]}function s(y){for(var w={},_=0,C=y.length;_<C;_++){var E=y[_];w[E.name]=E.value}return w}function c(y){return y=y.toLowerCase(),o(y)||y}function d(y){return y.replace(i.CARRIAGE_RETURN_REGEX,i.CARRIAGE_RETURN_PLACEHOLDER)}function f(y){return y.replace(i.CARRIAGE_RETURN_PLACEHOLDER_REGEX,i.CARRIAGE_RETURN)}function p(y,w,_){w===void 0&&(w=null);for(var C=[],E,T=0,I=y.length;T<I;T++){var $=y[T];switch($.nodeType){case 1:var V=c($.nodeName);E=new n.Element(V,s($.attributes)),E.children=p(V==="template"?$.content.childNodes:$.childNodes,E);break;case 3:E=new n.Text(f($.nodeValue));break;case 8:E=new n.Comment($.nodeValue);break;default:continue}var F=C[T-1]||null;F&&(F.next=E),E.parent=w,E.prev=F,E.next=null,C.push(E)}return _&&(E=new n.ProcessingInstruction(_.substring(0,_.indexOf(" ")).toLowerCase(),_),E.next=C[0]||null,E.parent=w,C.unshift(E),C[1]&&(C[1].prev=C[0])),C}})),c0=Ee((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=$;var n=xd(),i="html",o="head",s="body",c=/<([a-zA-Z]+[0-9]?)/,d=/<head[^]*>/i,f=/<body[^]*>/i,p=function(V,F){throw Error("This browser does not support `document.implementation.createHTMLDocument`")},y=function(V,F){throw Error("This browser does not support `DOMParser.prototype.parseFromString`")},w=typeof window=="object"&&window.DOMParser;if(typeof w=="function"){var _=new w,C="text/html";y=function(V,F){return F&&(V=`<${F}>${V}</${F}>`),_.parseFromString(V,C)},p=y}if(typeof document=="object"&&document.implementation){var E=document.implementation.createHTMLDocument();p=function(V,F){if(F){var N=E.documentElement.querySelector(F);return N&&(N.innerHTML=V),E}return E.documentElement.innerHTML=V,E}}var T=typeof document=="object"&&document.createElement("template"),I;T&&T.content&&(I=function(V){return T.innerHTML=V,T.content.childNodes});function $(V){var F,N;V=(0,n.escapeSpecialCharacters)(V);var K=V.match(c),pe=K&&K[1]?K[1].toLowerCase():"";switch(pe){case i:var P=y(V);if(!d.test(V)){var W=P.querySelector(o);(F=W==null?void 0:W.parentNode)==null||F.removeChild(W)}if(!f.test(V)){var W=P.querySelector(s);(N=W==null?void 0:W.parentNode)==null||N.removeChild(W)}return P.querySelectorAll(i);case o:case s:var A=p(V).querySelectorAll(pe);return f.test(V)&&d.test(V)?A[0].parentNode.childNodes:A;default:if(I)return I(V);var W=p(V,s).querySelector(s);return W.childNodes}}})),u0=Ee((e=>{var n=e&&e.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var i=n(c0()),o=xd(),s=/<(![a-zA-Z\s]+)>/;function c(d){if(typeof d!="string")throw TypeError("First argument must be a string");if(!d)return[];var f=d.match(s),p=f?f[1]:void 0;return(0,o.formatDOM)((0,i.default)(d),null,p)}})),d0=Ee((e=>{e.SAME=0,e.CAMELCASE=1,e.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1}})),f0=Ee((e=>{var n=0,i=1,o=2,s=3,c=4,d=5,f=6;function p(N){return w.hasOwnProperty(N)?w[N]:null}function y(N,K,pe,P,A,W,de){this.acceptsBooleans=K===o||K===s||K===c,this.attributeName=P,this.attributeNamespace=A,this.mustUseProperty=pe,this.propertyName=N,this.type=K,this.sanitizeURL=W,this.removeEmptyString=de}var w={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(N=>{w[N]=new y(N,n,!1,N,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([N,K])=>{w[N]=new y(N,i,!1,K,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(N=>{w[N]=new y(N,o,!1,N.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(N=>{w[N]=new y(N,o,!1,N,null,!1,!1)}),["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach(N=>{w[N]=new y(N,s,!1,N.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(N=>{w[N]=new y(N,s,!0,N,null,!1,!1)}),["capture","download"].forEach(N=>{w[N]=new y(N,c,!1,N,null,!1,!1)}),["cols","rows","size","span"].forEach(N=>{w[N]=new y(N,f,!1,N,null,!1,!1)}),["rowSpan","start"].forEach(N=>{w[N]=new y(N,d,!1,N.toLowerCase(),null,!1,!1)});var _=/[\-\:]([a-z])/g,C=N=>N[1].toUpperCase();"accent-height.alignment-baseline.arabic-form.baseline-shift.cap-height.clip-path.clip-rule.color-interpolation.color-interpolation-filters.color-profile.color-rendering.dominant-baseline.enable-background.fill-opacity.fill-rule.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.glyph-name.glyph-orientation-horizontal.glyph-orientation-vertical.horiz-adv-x.horiz-origin-x.image-rendering.letter-spacing.lighting-color.marker-end.marker-mid.marker-start.overline-position.overline-thickness.paint-order.panose-1.pointer-events.rendering-intent.shape-rendering.stop-color.stop-opacity.strikethrough-position.strikethrough-thickness.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.text-anchor.text-decoration.text-rendering.underline-position.underline-thickness.unicode-bidi.unicode-range.units-per-em.v-alphabetic.v-hanging.v-ideographic.v-mathematical.vector-effect.vert-adv-y.vert-origin-x.vert-origin-y.word-spacing.writing-mode.xmlns:xlink.x-height".split(".").forEach(N=>{let K=N.replace(_,C);w[K]=new y(K,i,!1,N,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(N=>{let K=N.replace(_,C);w[K]=new y(K,i,!1,N,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(N=>{let K=N.replace(_,C);w[K]=new y(K,i,!1,N,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(N=>{w[N]=new y(N,i,!1,N.toLowerCase(),null,!1,!1)});var E="xlinkHref";w[E]=new y("xlinkHref",i,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(N=>{w[N]=new y(N,i,!1,N.toLowerCase(),null,!0,!0)});var{CAMELCASE:T,SAME:I,possibleStandardNames:$}=d0(),V=RegExp.prototype.test.bind(RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$")),F=Object.keys($).reduce((N,K)=>{let pe=$[K];return pe===I?N[K]=K:pe===T?N[K.toLowerCase()]=K:N[K]=pe,N},{});e.BOOLEAN=s,e.BOOLEANISH_STRING=o,e.NUMERIC=d,e.OVERLOADED_BOOLEAN=c,e.POSITIVE_NUMERIC=f,e.RESERVED=n,e.STRING=i,e.getPropertyInfo=p,e.isCustomAttribute=V,e.possibleStandardNames=F})),kd=Ee((e=>{var n=e&&e.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(e,"__esModule",{value:!0}),e.returnFirstArg=e.canTextBeChildOfNode=e.ELEMENTS_WITH_NO_TEXT_CHILDREN=e.PRESERVE_CUSTOM_ATTRIBUTES=void 0,e.isCustomComponent=c,e.setStyleProp=f;var i=Tu(),o=n(iD()),s=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function c(p,y){return p.includes("-")?!s.has(p):!!(y&&typeof y.is=="string")}var d={reactCompat:!0};function f(p,y){if(typeof p=="string"){if(!p.trim()){y.style={};return}try{y.style=(0,o.default)(p,d)}catch{y.style={}}}}e.PRESERVE_CUSTOM_ATTRIBUTES=Number(i.version.split(".")[0])>=16,e.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]),e.canTextBeChildOfNode=function(p){return!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(p.name)},e.returnFirstArg=function(p){return p}})),Sd=Ee((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=d;var n=f0(),i=kd(),o=["checked","value"],s=["input","select","textarea"],c={reset:!0,submit:!0};function d(p,y){p===void 0&&(p={});var w={},_=!!(p.type&&c[p.type]);for(var C in p){var E=p[C];if((0,n.isCustomAttribute)(C)){w[C]=E;continue}var T=C.toLowerCase(),I=f(T);if(I){var $=(0,n.getPropertyInfo)(I);switch(o.includes(I)&&s.includes(y)&&!_&&(I=f("default"+T)),w[I]=E,$&&$.type){case n.BOOLEAN:w[I]=!0;break;case n.OVERLOADED_BOOLEAN:E===""&&(w[I]=!0);break}continue}i.PRESERVE_CUSTOM_ATTRIBUTES&&(w[C]=E)}return(0,i.setStyleProp)(p.style,w),w}function f(p){return n.possibleStandardNames[p]}})),p0=Ee((e=>{var n=e&&e.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=d;var i=Tu(),o=n(Sd()),s=kd(),c={cloneElement:i.cloneElement,createElement:i.createElement,isValidElement:i.isValidElement};function d(p,y){y===void 0&&(y={});for(var w=[],_=typeof y.replace=="function",C=y.transform||s.returnFirstArg,E=y.library||c,T=E.cloneElement,I=E.createElement,$=E.isValidElement,V=p.length,F=0;F<V;F++){var N=p[F];if(_){var K=y.replace(N,F);if($(K)){V>1&&(K=T(K,{key:K.key||F})),w.push(C(K,N,F));continue}}if(N.type==="text"){var pe=!N.data.trim().length;if(pe&&N.parent&&!(0,s.canTextBeChildOfNode)(N.parent)||y.trim&&pe)continue;w.push(C(N.data,N,F));continue}var P=N,A={};f(P)?((0,s.setStyleProp)(P.attribs.style,P.attribs),A=P.attribs):P.attribs&&(A=(0,o.default)(P.attribs,P.name));var W=void 0;switch(N.type){case"script":case"style":N.children[0]&&(A.dangerouslySetInnerHTML={__html:N.children[0].data});break;case"tag":N.name==="textarea"&&N.children[0]?A.defaultValue=N.children[0].data:N.children&&N.children.length&&(W=d(N.children,y));break;default:continue}V>1&&(A.key=F),w.push(C(I(N.name,A,W),N,F))}return w.length===1?w[0]:w}function f(p){return s.PRESERVE_CUSTOM_ATTRIBUTES&&p.type==="tag"&&(0,s.isCustomComponent)(p.name,p.attribs)}})),Cd=Ee((e=>{var n=e&&e.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(e,"__esModule",{value:!0}),e.htmlToDOM=e.domToReact=e.attributesToProps=e.Text=e.ProcessingInstruction=e.Element=e.Comment=void 0,e.default=d;var i=n(u0());e.htmlToDOM=i.default,e.attributesToProps=n(Sd()).default;var o=n(p0());e.domToReact=o.default;var s=_d();Object.defineProperty(e,"Comment",{enumerable:!0,get:function(){return s.Comment}}),Object.defineProperty(e,"Element",{enumerable:!0,get:function(){return s.Element}}),Object.defineProperty(e,"ProcessingInstruction",{enumerable:!0,get:function(){return s.ProcessingInstruction}}),Object.defineProperty(e,"Text",{enumerable:!0,get:function(){return s.Text}});var c={lowerCaseAttributeNames:!1};function d(f,p){if(typeof f!="string")throw TypeError("First argument must be a string");return f?(0,o.default)((0,i.default)(f,(p==null?void 0:p.htmlparser2)||c),p):[]}})),Ed=gh(Cd(),1),Pa=Cd(),Uh=Ed.default.default||Ed.default;let Ql;Ql=(e,n)=>{let[i,...o]=n.split("."),s=(e.attribs.class||"").split(" ");return e.tagName===i&&o.every(c=>s.includes(c))},Zw=e=>{var n;return e&&Ql(e,"span.nb")&&e.firstChild instanceof Pa.Text&&((n=e.firstChild.nodeValue)==null?void 0:n.includes("__marimo__"))},Fh=function(e){var n,i,o;if(e instanceof Pa.Element&&e.firstChild instanceof Pa.Text&&Ql(e,"span.nb")){let s=e.next;if(s&&s instanceof Pa.Text){let c=s.next;if(c&&c instanceof Pa.Element&&c.firstChild instanceof Pa.Text&&Ql(c,"span.m")){let d=Number.parseInt(c.firstChild.nodeValue||"0",10);if((n=e.firstChild.nodeValue)!=null&&n.includes("__marimo__")){let f=(i=/__marimo__cell_(\w+)_/.exec(e.firstChild.nodeValue))==null?void 0:i[1];if(f&&d)return{kind:"cell",cellId:f,lineNumber:d}}else{let f=(o=/"(.+?)"/.exec(e.firstChild.nodeValue))==null?void 0:o[1];if(f&&d)return{kind:"file",filePath:f,lineNumber:d}}}}}return null},Ih=function(e){let n=[];return Uh(e,{replace:i=>{let o=Fh(i);if(o)return n.push(o),"dummy"}}),n};function h0(e){return n=>{let i=!1;for(let o of n)o&&(i=e(o)||i);return i}}const Bx=h0(R4),Hx=h0(D4);let Td,m0,Ro,g0,Do,y0;Td=Ee(((e,n)=>{var i=typeof Reflect=="object"?Reflect:null,o=i&&typeof i.apply=="function"?i.apply:function(P,A,W){return Function.prototype.apply.call(P,A,W)},s=i&&typeof i.ownKeys=="function"?i.ownKeys:Object.getOwnPropertySymbols?function(P){return Object.getOwnPropertyNames(P).concat(Object.getOwnPropertySymbols(P))}:function(P){return Object.getOwnPropertyNames(P)};function c(P){console&&console.warn&&console.warn(P)}var d=Number.isNaN||function(P){return P!==P};function f(){f.init.call(this)}n.exports=f,n.exports.once=N,f.EventEmitter=f,f.prototype._events=void 0,f.prototype._eventsCount=0,f.prototype._maxListeners=void 0;var p=10;function y(P){if(typeof P!="function")throw TypeError('The "listener" argument must be of type Function. Received type '+typeof P)}Object.defineProperty(f,"defaultMaxListeners",{enumerable:!0,get:function(){return p},set:function(P){if(typeof P!="number"||P<0||d(P))throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+P+".");p=P}}),f.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},f.prototype.setMaxListeners=function(P){if(typeof P!="number"||P<0||d(P))throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+P+".");return this._maxListeners=P,this};function w(P){return P._maxListeners===void 0?f.defaultMaxListeners:P._maxListeners}f.prototype.getMaxListeners=function(){return w(this)},f.prototype.emit=function(P){for(var A=[],W=1;W<arguments.length;W++)A.push(arguments[W]);var de=P==="error",fe=this._events;if(fe!==void 0)de&&(de=fe.error===void 0);else if(!de)return!1;if(de){var we;if(A.length>0&&(we=A[0]),we instanceof Error)throw we;var J=Error("Unhandled error."+(we?" ("+we.message+")":""));throw J.context=we,J}var be=fe[P];if(be===void 0)return!1;if(typeof be=="function")o(be,this,A);else for(var Ce=be.length,Z=$(be,Ce),W=0;W<Ce;++W)o(Z[W],this,A);return!0};function _(P,A,W,de){var fe,we,J;if(y(W),we=P._events,we===void 0?(we=P._events=Object.create(null),P._eventsCount=0):(we.newListener!==void 0&&(P.emit("newListener",A,W.listener?W.listener:W),we=P._events),J=we[A]),J===void 0)J=we[A]=W,++P._eventsCount;else if(typeof J=="function"?J=we[A]=de?[W,J]:[J,W]:de?J.unshift(W):J.push(W),fe=w(P),fe>0&&J.length>fe&&!J.warned){J.warned=!0;var be=Error("Possible EventEmitter memory leak detected. "+J.length+" "+String(A)+" listeners added. Use emitter.setMaxListeners() to increase limit");be.name="MaxListenersExceededWarning",be.emitter=P,be.type=A,be.count=J.length,c(be)}return P}f.prototype.addListener=function(P,A){return _(this,P,A,!1)},f.prototype.on=f.prototype.addListener,f.prototype.prependListener=function(P,A){return _(this,P,A,!0)};function C(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function E(P,A,W){var de={fired:!1,wrapFn:void 0,target:P,type:A,listener:W},fe=C.bind(de);return fe.listener=W,de.wrapFn=fe,fe}f.prototype.once=function(P,A){return y(A),this.on(P,E(this,P,A)),this},f.prototype.prependOnceListener=function(P,A){return y(A),this.prependListener(P,E(this,P,A)),this},f.prototype.removeListener=function(P,A){var W,de,fe,we,J;if(y(A),de=this._events,de===void 0||(W=de[P],W===void 0))return this;if(W===A||W.listener===A)--this._eventsCount===0?this._events=Object.create(null):(delete de[P],de.removeListener&&this.emit("removeListener",P,W.listener||A));else if(typeof W!="function"){for(fe=-1,we=W.length-1;we>=0;we--)if(W[we]===A||W[we].listener===A){J=W[we].listener,fe=we;break}if(fe<0)return this;fe===0?W.shift():V(W,fe),W.length===1&&(de[P]=W[0]),de.removeListener!==void 0&&this.emit("removeListener",P,J||A)}return this},f.prototype.off=f.prototype.removeListener,f.prototype.removeAllListeners=function(P){var A,W=this._events,de;if(W===void 0)return this;if(W.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):W[P]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete W[P]),this;if(arguments.length===0){var fe=Object.keys(W),we;for(de=0;de<fe.length;++de)we=fe[de],we!=="removeListener"&&this.removeAllListeners(we);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(A=W[P],typeof A=="function")this.removeListener(P,A);else if(A!==void 0)for(de=A.length-1;de>=0;de--)this.removeListener(P,A[de]);return this};function T(P,A,W){var de=P._events;if(de===void 0)return[];var fe=de[A];return fe===void 0?[]:typeof fe=="function"?W?[fe.listener||fe]:[fe]:W?F(fe):$(fe,fe.length)}f.prototype.listeners=function(P){return T(this,P,!0)},f.prototype.rawListeners=function(P){return T(this,P,!1)},f.listenerCount=function(P,A){return typeof P.listenerCount=="function"?P.listenerCount(A):I.call(P,A)},f.prototype.listenerCount=I;function I(P){var A=this._events;if(A!==void 0){var W=A[P];if(typeof W=="function")return 1;if(W!==void 0)return W.length}return 0}f.prototype.eventNames=function(){return this._eventsCount>0?s(this._events):[]};function $(P,A){for(var W=Array(A),de=0;de<A;++de)W[de]=P[de];return W}function V(P,A){for(;A+1<P.length;A++)P[A]=P[A+1];P.pop()}function F(P){for(var A=Array(P.length),W=0;W<A.length;++W)A[W]=P[W].listener||P[W];return A}function N(P,A){return new Promise(function(W,de){function fe(J){P.removeListener(A,we),de(J)}function we(){typeof P.removeListener=="function"&&P.removeListener("error",fe),W([].slice.call(arguments))}pe(P,A,we,{once:!0}),A!=="error"&&K(P,fe,{once:!0})})}function K(P,A,W){typeof P.on=="function"&&pe(P,"error",A,W)}function pe(P,A,W,de){if(typeof P.on=="function")de.once?P.once(A,W):P.on(A,W);else if(typeof P.addEventListener=="function")P.addEventListener(A,function fe(we){de.once&&P.removeEventListener(A,fe),W(we)});else throw TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof P)}})),m0=Ee((e=>{var n=e&&e.__awaiter||function(s,c,d,f){function p(y){return y instanceof d?y:new d(function(w){w(y)})}return new(d||(d=Promise))(function(y,w){function _(T){try{E(f.next(T))}catch(I){w(I)}}function C(T){try{E(f.throw(T))}catch(I){w(I)}}function E(T){T.done?y(T.value):p(T.value).then(_,C)}E((f=f.apply(s,c||[])).next())})},i=e&&e.__generator||function(s,c){var d={label:0,sent:function(){if(y[0]&1)throw y[1];return y[1]},trys:[],ops:[]},f,p,y,w;return w={next:_(0),throw:_(1),return:_(2)},typeof Symbol=="function"&&(w[Symbol.iterator]=function(){return this}),w;function _(E){return function(T){return C([E,T])}}function C(E){if(f)throw TypeError("Generator is already executing.");for(;d;)try{if(f=1,p&&(y=E[0]&2?p.return:E[0]?p.throw||((y=p.return)&&y.call(p),0):p.next)&&!(y=y.call(p,E[1])).done)return y;switch(p=0,y&&(E=[E[0]&2,y.value]),E[0]){case 0:case 1:y=E;break;case 4:return d.label++,{value:E[1],done:!1};case 5:d.label++,p=E[1],E=[0];continue;case 7:E=d.ops.pop(),d.trys.pop();continue;default:if(y=d.trys,!(y=y.length>0&&y[y.length-1])&&(E[0]===6||E[0]===2)){d=0;continue}if(E[0]===3&&(!y||E[1]>y[0]&&E[1]<y[3])){d.label=E[1];break}if(E[0]===6&&d.label<y[1]){d.label=y[1],y=E;break}if(y&&d.label<y[2]){d.label=y[2],d.ops.push(E);break}y[2]&&d.ops.pop(),d.trys.pop();continue}E=c.call(s,d)}catch(T){E=[6,T],p=0}finally{f=y=0}if(E[0]&5)throw E[1];return{value:E[0]?E[1]:void 0,done:!0}}};Object.defineProperty(e,"__esModule",{value:!0}),e.defaultNextRequest=void 0;var o=Td();e.defaultNextRequest=function(){var s=-1;return function(){return++s}},e.default=(function(){function s(c,d){d===void 0&&(d=e.defaultNextRequest()),this.batch=[],this.batchStarted=!1,this.lastId=-1,this.transports=c,this.requests={},this.connectPromise=this.connect(),this.requestChannel=new o.EventEmitter,this.nextID=d}return s.prototype.connect=function(){var c=this;return Promise.all(this.transports.map(function(d){return n(c,void 0,void 0,function(){return i(this,function(f){switch(f.label){case 0:return d.subscribe("error",this.handleError.bind(this)),d.subscribe("notification",this.handleNotification.bind(this)),[4,d.connect()];case 1:return f.sent(),[2]}})})}))},s.prototype.getPrimaryTransport=function(){return this.transports[0]},s.prototype.request=function(c,d,f){return d===void 0&&(d=!1),n(this,void 0,void 0,function(){var p,y,w,_,C=this;return i(this,function(E){return p=this.nextID().toString(),y=d?null:p,w={request:this.makeRequest(c.method,c.params||[],y),internalID:p},this.batchStarted?(_=new Promise(function(T,I){C.batch.push({resolve:T,reject:I,request:w})}),[2,_]):[2,this.getPrimaryTransport().sendData(w,f)]})})},s.prototype.close=function(){this.requestChannel.removeAllListeners(),this.transports.forEach(function(c){c.unsubscribe(),c.close()})},s.prototype.startBatch=function(){this.batchStarted=!0},s.prototype.stopBatch=function(){if(this.batchStarted===!1)throw Error("cannot end that which has never started");if(this.batch.length===0){this.batchStarted=!1;return}this.getPrimaryTransport().sendData(this.batch),this.batch=[],this.batchStarted=!1},s.prototype.makeRequest=function(c,d,f){return f?{jsonrpc:"2.0",id:f,method:c,params:d}:{jsonrpc:"2.0",method:c,params:d}},s.prototype.handleError=function(c){this.requestChannel.emit("error",c)},s.prototype.handleNotification=function(c){this.requestChannel.emit("notification",c)},s})()})),Ro=Ee((e=>{var n=e&&e.__extends||(function(){var o=function(s,c){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,f){d.__proto__=f}||function(d,f){for(var p in f)f.hasOwnProperty(p)&&(d[p]=f[p])},o(s,c)};return function(s,c){o(s,c);function d(){this.constructor=s}s.prototype=c===null?Object.create(c):(d.prototype=c.prototype,new d)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.convertJSONToRPCError=e.JSONRPCError=e.ERR_UNKNOWN=e.ERR_MISSIING_ID=e.ERR_TIMEOUT=void 0,e.ERR_TIMEOUT=7777,e.ERR_MISSIING_ID=7878,e.ERR_UNKNOWN=7979;var i=(function(o){n(s,o);function s(c,d,f){var p=this.constructor,y=o.call(this,c)||this;return y.message=c,y.code=d,y.data=f,Object.setPrototypeOf(y,p.prototype),y}return s})(Error);e.JSONRPCError=i,e.convertJSONToRPCError=function(o){if(o.error){var s=o.error,c=s.message,d=s.code,f=s.data;return new i(c,d,f)}return new i("Unknown error",e.ERR_UNKNOWN,o)}})),g0=Ee((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TransportRequestManager=void 0;var n=Td(),i=Ro();e.TransportRequestManager=(function(){function o(){this.pendingRequest={},this.pendingBatchRequest={},this.transportEventChannel=new n.EventEmitter}return o.prototype.addRequest=function(s,c){return this.transportEventChannel.emit("pending",s),s instanceof Array?(this.addBatchReq(s,c),Promise.resolve()):this.addReq(s.internalID,c)},o.prototype.settlePendingRequest=function(s,c){var d=this;s.forEach(function(f){var p=d.pendingRequest[f.internalID];if(delete d.pendingBatchRequest[f.internalID],p!==void 0){if(c){p.reject(c);return}p.resolve(),(f.request.id===null||f.request.id===void 0)&&delete d.pendingRequest[f.internalID]}})},o.prototype.isPendingRequest=function(s){return this.pendingRequest.hasOwnProperty(s)},o.prototype.resolveResponse=function(s,c){c===void 0&&(c=!0);var d=s;try{return d=JSON.parse(s),this.checkJSONRPC(d)===!1?void 0:d instanceof Array?this.resolveBatch(d,c):this.resolveRes(d,c)}catch{var f=new i.JSONRPCError("Bad response format",i.ERR_UNKNOWN,s);return c&&this.transportEventChannel.emit("error",f),f}},o.prototype.addBatchReq=function(s,c){var d=this;return s.forEach(function(f){var p=f.resolve,y=f.reject,w=f.request.internalID;d.pendingBatchRequest[w]=!0,d.pendingRequest[w]={resolve:p,reject:y}}),Promise.resolve()},o.prototype.addReq=function(s,c){var d=this;return new Promise(function(f,p){c!==null&&c&&d.setRequestTimeout(s,c,p),d.pendingRequest[s]={resolve:f,reject:p}})},o.prototype.checkJSONRPC=function(s){var c=[s];return s instanceof Array&&(c=s),c.every(function(d){return d.result!==void 0||d.error!==void 0||d.method!==void 0})},o.prototype.processResult=function(s,c){if(s.error){var d=i.convertJSONToRPCError(s);c.reject(d);return}c.resolve(s.result)},o.prototype.resolveBatch=function(s,c){var d=this,f=s.map(function(p){return d.resolveRes(p,c)}).filter(function(p){return p});if(f.length>0)return f[0]},o.prototype.resolveRes=function(s,c){var d=s.id,f=s.error,p=this.pendingRequest[d];if(p){delete this.pendingRequest[d],this.processResult(s,p),this.transportEventChannel.emit("response",s);return}if(d===void 0&&f===void 0){this.transportEventChannel.emit("notification",s);return}var y;return f&&(y=i.convertJSONToRPCError(s)),c&&f&&y&&this.transportEventChannel.emit("error",y),y},o.prototype.setRequestTimeout=function(s,c,d){var f=this;setTimeout(function(){delete f.pendingRequest[s],d(new i.JSONRPCError("Request timeout request took longer than "+c+" ms to resolve",i.ERR_TIMEOUT))},c)},o})()})),Oa=Ee((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Transport=void 0;var n=g0();e.Transport=(function(){function i(){this.transportRequestManager=new n.TransportRequestManager,this.transportRequestManager.transportEventChannel.on("error",function(){})}return i.prototype.subscribe=function(o,s){this.transportRequestManager.transportEventChannel.addListener(o,s)},i.prototype.unsubscribe=function(o,s){if(!o)return this.transportRequestManager.transportEventChannel.removeAllListeners();o&&s&&this.transportRequestManager.transportEventChannel.removeListener(o,s)},i.prototype.parseData=function(o){return o instanceof Array?o.map(function(s){return s.request.request}):o.request},i})()})),Do=Ee((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getNotifications=e.getBatchRequests=e.isNotification=void 0,e.isNotification=function(n){return n.request.id===void 0||n.request.id===null},e.getBatchRequests=function(n){return n instanceof Array?n.filter(function(i){return i.request.request.id!=null}).map(function(i){return i.request}):[]},e.getNotifications=function(n){return n instanceof Array?n.filter(function(i){return e.isNotification(i.request)}).map(function(i){return i.request}):e.isNotification(n)?[n]:[]}})),y0=Ee((e=>{var n=e&&e.__extends||(function(){var c=function(d,f){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,y){p.__proto__=y}||function(p,y){for(var w in y)y.hasOwnProperty(w)&&(p[w]=y[w])},c(d,f)};return function(d,f){c(d,f);function p(){this.constructor=d}d.prototype=f===null?Object.create(f):(p.prototype=f.prototype,new p)}})();Object.defineProperty(e,"__esModule",{value:!0});var i=Oa(),o=Do(),s=Ro();e.default=(function(c){n(d,c);function d(f,p,y){var w=c.call(this)||this;return w.connection=f,w.reqUri=p,w.resUri=y,w}return d.prototype.connect=function(){var f=this;return this.connection.on(this.resUri,function(p){f.transportRequestManager.resolveResponse(p)}),Promise.resolve()},d.prototype.sendData=function(f,p){p===void 0&&(p=null);var y=this.transportRequestManager.addRequest(f,p),w=o.getNotifications(f),_=this.parseData(f);try{return this.connection.emit(this.reqUri,_),this.transportRequestManager.settlePendingRequest(w),y}catch(E){var C=new s.JSONRPCError(E.message,s.ERR_UNKNOWN,E);return this.transportRequestManager.settlePendingRequest(w,C),Promise.reject(C)}},d.prototype.close=function(){this.connection.removeAllListeners()},d})(i.Transport)}));function Vx(e){return e&&DataView.prototype.isPrototypeOf(e)}function Oo(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||e==="")throw TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function Rd(e){return typeof e!="string"&&(e=String(e)),e}function Dd(e){var n={next:function(){var i=e.shift();return{done:i===void 0,value:i}}};return Rn.iterable&&(n[Symbol.iterator]=function(){return n}),n}function cn(e){this.map={},e instanceof cn?e.forEach(function(n,i){this.append(i,n)},this):Array.isArray(e)?e.forEach(function(n){if(n.length!=2)throw TypeError("Headers constructor: expected name/value pair to be length 2, found"+n.length);this.append(n[0],n[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(n){this.append(n,e[n])},this)}function Od(e){if(!e._noBody){if(e.bodyUsed)return Promise.reject(TypeError("Already read"));e.bodyUsed=!0}}function v0(e){return new Promise(function(n,i){e.onload=function(){n(e.result)},e.onerror=function(){i(e.error)}})}function $x(e){var n=new FileReader,i=v0(n);return n.readAsArrayBuffer(e),i}function Wx(e){var n=new FileReader,i=v0(n),o=/charset=([A-Za-z0-9_-]+)/.exec(e.type),s=o?o[1]:"utf-8";return n.readAsText(e,s),i}function Ux(e){for(var n=new Uint8Array(e),i=Array(n.length),o=0;o<n.length;o++)i[o]=String.fromCharCode(n[o]);return i.join("")}function b0(e){if(e.slice)return e.slice(0);var n=new Uint8Array(e.byteLength);return n.set(new Uint8Array(e)),n.buffer}function w0(){return this.bodyUsed=!1,this._initBody=function(e){this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?typeof e=="string"?this._bodyText=e:Rn.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:Rn.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:Rn.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():Rn.arrayBuffer&&Rn.blob&&Vx(e)?(this._bodyArrayBuffer=b0(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):Rn.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||k0(e))?this._bodyArrayBuffer=b0(e):this._bodyText=e=Object.prototype.toString.call(e):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof e=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):Rn.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},Rn.blob&&(this.blob=function(){var e=Od(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer)return Od(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer));if(Rn.blob)return this.blob().then($x);throw Error("could not read as ArrayBuffer")},this.text=function(){var e=Od(this);if(e)return e;if(this._bodyBlob)return Wx(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(Ux(this._bodyArrayBuffer));if(this._bodyFormData)throw Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},Rn.formData&&(this.formData=function(){return this.text().then(Qx)}),this.json=function(){return this.text().then(JSON.parse)},this}function Kx(e){var n=e.toUpperCase();return S0.indexOf(n)>-1?n:e}function Aa(e,n){if(!(this instanceof Aa))throw TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');n||(n={});var i=n.body;if(e instanceof Aa){if(e.bodyUsed)throw TypeError("Already read");this.url=e.url,this.credentials=e.credentials,n.headers||(this.headers=new cn(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!i&&e._bodyInit!=null&&(i=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=n.credentials||this.credentials||"same-origin",(n.headers||!this.headers)&&(this.headers=new cn(n.headers)),this.method=Kx(n.method||this.method||"GET"),this.mode=n.mode||this.mode||null,this.signal=n.signal||this.signal||(function(){if("AbortController"in gn)return new AbortController().signal})(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&i)throw TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),(this.method==="GET"||this.method==="HEAD")&&(n.cache==="no-store"||n.cache==="no-cache")){var o=/([?&])_=[^&]*/;o.test(this.url)?this.url=this.url.replace(o,"$1_="+new Date().getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+new Date().getTime()}}function Qx(e){var n=new FormData;return e.trim().split("&").forEach(function(i){if(i){var o=i.split("="),s=o.shift().replace(/\+/g," "),c=o.join("=").replace(/\+/g," ");n.append(decodeURIComponent(s),decodeURIComponent(c))}}),n}function Gx(e){var n=new cn;return e.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(i){return i.indexOf(`
16
16
  `)===0?i.substr(1,i.length):i}).forEach(function(i){var o=i.split(":"),s=o.shift().trim();if(s){var c=o.join(":").trim();try{n.append(s,c)}catch(d){console.warn("Response "+d.message)}}}),n}function Zr(e,n){if(!(this instanceof Zr))throw TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(n||(n={}),this.type="default",this.status=n.status===void 0?200:n.status,this.status<200||this.status>599)throw RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=n.statusText===void 0?"":""+n.statusText,this.headers=new cn(n.headers),this.url=n.url||"",this._initBody(e)}function _0(e,n){return new Promise(function(i,o){var s=new Aa(e,n);if(s.signal&&s.signal.aborted)return o(new Gi("Aborted","AbortError"));var c=new XMLHttpRequest;function d(){c.abort()}c.onload=function(){var y={statusText:c.statusText,headers:Gx(c.getAllResponseHeaders()||"")};s.url.indexOf("file://")===0&&(c.status<200||c.status>599)?y.status=200:y.status=c.status,y.url="responseURL"in c?c.responseURL:y.headers.get("X-Request-URL");var w="response"in c?c.response:c.responseText;setTimeout(function(){i(new Zr(w,y))},0)},c.onerror=function(){setTimeout(function(){o(TypeError("Network request failed"))},0)},c.ontimeout=function(){setTimeout(function(){o(TypeError("Network request timed out"))},0)},c.onabort=function(){setTimeout(function(){o(new Gi("Aborted","AbortError"))},0)};function f(y){try{return y===""&&gn.location.href?gn.location.href:y}catch{return y}}if(c.open(s.method,f(s.url),!0),s.credentials==="include"?c.withCredentials=!0:s.credentials==="omit"&&(c.withCredentials=!1),"responseType"in c&&(Rn.blob?c.responseType="blob":Rn.arrayBuffer&&(c.responseType="arraybuffer")),n&&typeof n.headers=="object"&&!(n.headers instanceof cn||gn.Headers&&n.headers instanceof gn.Headers)){var p=[];Object.getOwnPropertyNames(n.headers).forEach(function(y){p.push(Oo(y)),c.setRequestHeader(y,Rd(n.headers[y]))}),s.headers.forEach(function(y,w){p.indexOf(w)===-1&&c.setRequestHeader(w,y)})}else s.headers.forEach(function(y,w){c.setRequestHeader(w,y)});s.signal&&(s.signal.addEventListener("abort",d),c.onreadystatechange=function(){c.readyState===4&&s.signal.removeEventListener("abort",d)}),c.send(s._bodyInit===void 0?null:s._bodyInit)})}let gn,Rn,x0,k0,S0,C0,Gi,E0,T0,R0,D0,qa,O0,P0,M0,L0,N0,I0,Po,Pd,Md,A0,Ji,Mo,Gl,q0,Ld,j0,z0,F0,B0,Jl,H0,ja,Nd,Vt,Xl,V0,$0,W0,U0,K0,Q0,G0,J0,X0,Y0,Z0,eg,tg,ng,rg,ig,ag,og,sg,lg,cg,ug,dg,fg;E0=U2((()=>{gn=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global||{},Rn={searchParams:"URLSearchParams"in gn,iterable:"Symbol"in gn&&"iterator"in Symbol,blob:"FileReader"in gn&&"Blob"in gn&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in gn,arrayBuffer:"ArrayBuffer"in gn},Rn.arrayBuffer&&(x0=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],k0=ArrayBuffer.isView||function(e){return e&&x0.indexOf(Object.prototype.toString.call(e))>-1}),cn.prototype.append=function(e,n){e=Oo(e),n=Rd(n);var i=this.map[e];this.map[e]=i?i+", "+n:n},cn.prototype.delete=function(e){delete this.map[Oo(e)]},cn.prototype.get=function(e){return e=Oo(e),this.has(e)?this.map[e]:null},cn.prototype.has=function(e){return this.map.hasOwnProperty(Oo(e))},cn.prototype.set=function(e,n){this.map[Oo(e)]=Rd(n)},cn.prototype.forEach=function(e,n){for(var i in this.map)this.map.hasOwnProperty(i)&&e.call(n,this.map[i],i,this)},cn.prototype.keys=function(){var e=[];return this.forEach(function(n,i){e.push(i)}),Dd(e)},cn.prototype.values=function(){var e=[];return this.forEach(function(n){e.push(n)}),Dd(e)},cn.prototype.entries=function(){var e=[];return this.forEach(function(n,i){e.push([i,n])}),Dd(e)},Rn.iterable&&(cn.prototype[Symbol.iterator]=cn.prototype.entries),S0=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"],Aa.prototype.clone=function(){return new Aa(this,{body:this._bodyInit})},w0.call(Aa.prototype),w0.call(Zr.prototype),Zr.prototype.clone=function(){return new Zr(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new cn(this.headers),url:this.url})},Zr.error=function(){var e=new Zr(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e},C0=[301,302,303,307,308],Zr.redirect=function(e,n){if(C0.indexOf(n)===-1)throw RangeError("Invalid status code");return new Zr(null,{status:n,headers:{location:e}})},Gi=gn.DOMException;try{new Gi}catch{Gi=function(e,n){this.message=e,this.name=n,this.stack=Error(e).stack},Gi.prototype=Object.create(Error.prototype),Gi.prototype.constructor=Gi}_0.polyfill=!0,gn.fetch||(gn.fetch=_0,gn.Headers=cn,gn.Request=Aa,gn.Response=Zr)})),T0=Ee(((e,n)=>{E0(),n.exports=self.fetch.bind(self)})),R0=Ee((e=>{var n=e&&e.__extends||(function(){var w=function(_,C){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,T){E.__proto__=T}||function(E,T){for(var I in T)T.hasOwnProperty(I)&&(E[I]=T[I])},w(_,C)};return function(_,C){w(_,C);function E(){this.constructor=_}_.prototype=C===null?Object.create(C):(E.prototype=C.prototype,new E)}})(),i=e&&e.__awaiter||function(w,_,C,E){function T(I){return I instanceof C?I:new C(function($){$(I)})}return new(C||(C=Promise))(function(I,$){function V(K){try{N(E.next(K))}catch(pe){$(pe)}}function F(K){try{N(E.throw(K))}catch(pe){$(pe)}}function N(K){K.done?I(K.value):T(K.value).then(V,F)}N((E=E.apply(w,_||[])).next())})},o=e&&e.__generator||function(w,_){var C={label:0,sent:function(){if(I[0]&1)throw I[1];return I[1]},trys:[],ops:[]},E,T,I,$;return $={next:V(0),throw:V(1),return:V(2)},typeof Symbol=="function"&&($[Symbol.iterator]=function(){return this}),$;function V(N){return function(K){return F([N,K])}}function F(N){if(E)throw TypeError("Generator is already executing.");for(;C;)try{if(E=1,T&&(I=N[0]&2?T.return:N[0]?T.throw||((I=T.return)&&I.call(T),0):T.next)&&!(I=I.call(T,N[1])).done)return I;switch(T=0,I&&(N=[N[0]&2,I.value]),N[0]){case 0:case 1:I=N;break;case 4:return C.label++,{value:N[1],done:!1};case 5:C.label++,T=N[1],N=[0];continue;case 7:N=C.ops.pop(),C.trys.pop();continue;default:if(I=C.trys,!(I=I.length>0&&I[I.length-1])&&(N[0]===6||N[0]===2)){C=0;continue}if(N[0]===3&&(!I||N[1]>I[0]&&N[1]<I[3])){C.label=N[1];break}if(N[0]===6&&C.label<I[1]){C.label=I[1],I=N;break}if(I&&C.label<I[2]){C.label=I[2],C.ops.push(N);break}I[2]&&C.ops.pop(),C.trys.pop();continue}N=_.call(w,C)}catch(K){N=[6,K],T=0}finally{E=I=0}if(N[0]&5)throw N[1];return{value:N[0]?N[1]:void 0,done:!0}}},s=e&&e.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(e,"__esModule",{value:!0}),e.HTTPTransport=void 0;var c=s(T0()),d=Oa(),f=Do(),p=Ro(),y=(function(w){n(_,w);function _(C,E){var T=w.call(this)||this;return T.onlyNotifications=function(I){return I instanceof Array?I.every(function($){return $.request.request.id===null||$.request.request.id===void 0}):I.request.id===null||I.request.id===void 0},T.uri=C,T.credentials=E&&E.credentials,T.headers=_.setupHeaders(E&&E.headers),T.injectedFetcher=E==null?void 0:E.fetcher,T}return _.prototype.connect=function(){return Promise.resolve()},_.prototype.sendData=function(C,E){return E===void 0&&(E=null),i(this,void 0,void 0,function(){var T,I,$,V,F,N,pe,K,pe;return o(this,function(P){switch(P.label){case 0:T=this.transportRequestManager.addRequest(C,E),I=f.getNotifications(C),$=f.getBatchRequests(C),V=this.injectedFetcher||c.default,P.label=1;case 1:return P.trys.push([1,4,,5]),[4,V(this.uri,{method:"POST",headers:this.headers,body:JSON.stringify(this.parseData(C)),credentials:this.credentials})];case 2:return F=P.sent(),this.transportRequestManager.settlePendingRequest(I),this.onlyNotifications(C)?[2,Promise.resolve()]:[4,F.text()];case 3:return N=P.sent(),pe=this.transportRequestManager.resolveResponse(N),pe?(this.transportRequestManager.settlePendingRequest($,pe),[2,Promise.reject(pe)]):[3,5];case 4:return K=P.sent(),pe=new p.JSONRPCError(K.message,p.ERR_UNKNOWN,K),this.transportRequestManager.settlePendingRequest(I,pe),this.transportRequestManager.settlePendingRequest(f.getBatchRequests(C),pe),[2,Promise.reject(pe)];case 5:return[2,T]}})})},_.prototype.close=function(){},_.setupHeaders=function(C){var E=new Headers(C);return E.set("Content-Type","application/json"),E},_})(d.Transport);e.HTTPTransport=y,e.default=y})),D0=XR({default:()=>O0},1),P0=U2((()=>{qa=null,typeof WebSocket<"u"?qa=WebSocket:typeof MozWebSocket<"u"?qa=MozWebSocket:typeof global<"u"?qa=global.WebSocket||global.MozWebSocket:typeof window<"u"?qa=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(qa=self.WebSocket||self.MozWebSocket),O0=qa})),M0=Ee((e=>{var n=e&&e.__extends||(function(){var y=function(w,_){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,E){C.__proto__=E}||function(C,E){for(var T in E)E.hasOwnProperty(T)&&(C[T]=E[T])},y(w,_)};return function(w,_){y(w,_);function C(){this.constructor=w}w.prototype=_===null?Object.create(_):(C.prototype=_.prototype,new C)}})(),i=e&&e.__awaiter||function(y,w,_,C){function E(T){return T instanceof _?T:new _(function(I){I(T)})}return new(_||(_=Promise))(function(T,I){function $(N){try{F(C.next(N))}catch(K){I(K)}}function V(N){try{F(C.throw(N))}catch(K){I(K)}}function F(N){N.done?T(N.value):E(N.value).then($,V)}F((C=C.apply(y,w||[])).next())})},o=e&&e.__generator||function(y,w){var _={label:0,sent:function(){if(T[0]&1)throw T[1];return T[1]},trys:[],ops:[]},C,E,T,I;return I={next:$(0),throw:$(1),return:$(2)},typeof Symbol=="function"&&(I[Symbol.iterator]=function(){return this}),I;function $(F){return function(N){return V([F,N])}}function V(F){if(C)throw TypeError("Generator is already executing.");for(;_;)try{if(C=1,E&&(T=F[0]&2?E.return:F[0]?E.throw||((T=E.return)&&T.call(E),0):E.next)&&!(T=T.call(E,F[1])).done)return T;switch(E=0,T&&(F=[F[0]&2,T.value]),F[0]){case 0:case 1:T=F;break;case 4:return _.label++,{value:F[1],done:!1};case 5:_.label++,E=F[1],F=[0];continue;case 7:F=_.ops.pop(),_.trys.pop();continue;default:if(T=_.trys,!(T=T.length>0&&T[T.length-1])&&(F[0]===6||F[0]===2)){_=0;continue}if(F[0]===3&&(!T||F[1]>T[0]&&F[1]<T[3])){_.label=F[1];break}if(F[0]===6&&_.label<T[1]){_.label=T[1],T=F;break}if(T&&_.label<T[2]){_.label=T[2],_.ops.push(F);break}T[2]&&_.ops.pop(),_.trys.pop();continue}F=w.call(y,_)}catch(N){F=[6,N],E=0}finally{C=T=0}if(F[0]&5)throw F[1];return{value:F[0]?F[1]:void 0,done:!0}}},s=e&&e.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(e,"__esModule",{value:!0});var c=s((P0(),Eu(D0))),d=Oa(),f=Do(),p=Ro();e.default=(function(y){n(w,y);function w(_){var C=y.call(this)||this;return C.uri=_,C.connection=new c.default(_),C}return w.prototype.connect=function(){var _=this;return new Promise(function(C,E){var T=function(){_.connection.removeEventListener("open",T),C()};_.connection.addEventListener("open",T),_.connection.addEventListener("message",function(I){var $=I.data;_.transportRequestManager.resolveResponse($)})})},w.prototype.sendData=function(_,C){return C===void 0&&(C=5e3),i(this,void 0,void 0,function(){var E,T,I;return o(this,function($){E=this.transportRequestManager.addRequest(_,C),T=f.getNotifications(_);try{this.connection.send(JSON.stringify(this.parseData(_))),this.transportRequestManager.settlePendingRequest(T)}catch(V){I=new p.JSONRPCError(V.message,p.ERR_UNKNOWN,V),this.transportRequestManager.settlePendingRequest(T,I),this.transportRequestManager.settlePendingRequest(f.getBatchRequests(_),I),E=Promise.reject(I)}return[2,E]})})},w.prototype.close=function(){this.connection.close()},w})(d.Transport)})),L0=Ee((e=>{var n=e&&e.__extends||(function(){var f=function(p,y){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(w,_){w.__proto__=_}||function(w,_){for(var C in _)_.hasOwnProperty(C)&&(w[C]=_[C])},f(p,y)};return function(p,y){f(p,y);function w(){this.constructor=p}p.prototype=y===null?Object.create(y):(w.prototype=y.prototype,new w)}})(),i=e&&e.__awaiter||function(f,p,y,w){function _(C){return C instanceof y?C:new y(function(E){E(C)})}return new(y||(y=Promise))(function(C,E){function T(V){try{$(w.next(V))}catch(F){E(F)}}function I(V){try{$(w.throw(V))}catch(F){E(F)}}function $(V){V.done?C(V.value):_(V.value).then(T,I)}$((w=w.apply(f,p||[])).next())})},o=e&&e.__generator||function(f,p){var y={label:0,sent:function(){if(C[0]&1)throw C[1];return C[1]},trys:[],ops:[]},w,_,C,E;return E={next:T(0),throw:T(1),return:T(2)},typeof Symbol=="function"&&(E[Symbol.iterator]=function(){return this}),E;function T($){return function(V){return I([$,V])}}function I($){if(w)throw TypeError("Generator is already executing.");for(;y;)try{if(w=1,_&&(C=$[0]&2?_.return:$[0]?_.throw||((C=_.return)&&C.call(_),0):_.next)&&!(C=C.call(_,$[1])).done)return C;switch(_=0,C&&($=[$[0]&2,C.value]),$[0]){case 0:case 1:C=$;break;case 4:return y.label++,{value:$[1],done:!1};case 5:y.label++,_=$[1],$=[0];continue;case 7:$=y.ops.pop(),y.trys.pop();continue;default:if(C=y.trys,!(C=C.length>0&&C[C.length-1])&&($[0]===6||$[0]===2)){y=0;continue}if($[0]===3&&(!C||$[1]>C[0]&&$[1]<C[3])){y.label=$[1];break}if($[0]===6&&y.label<C[1]){y.label=C[1],C=$;break}if(C&&y.label<C[2]){y.label=C[2],y.ops.push($);break}C[2]&&y.ops.pop(),y.trys.pop();continue}$=p.call(f,y)}catch(V){$=[6,V],_=0}finally{w=C=0}if($[0]&5)throw $[1];return{value:$[0]?$[1]:void 0,done:!0}}};Object.defineProperty(e,"__esModule",{value:!0});var s=Oa(),c=Do(),d=function(f){var p=400,y=window.screen.height;return window.open(f,"inspector:popup","left=0,top=0,width="+p+",height="+y+",resizable,scrollbars=yes,status=1")};e.default=(function(f){n(p,f);function p(y){var w=f.call(this)||this;return w.messageHandler=function(_){w.transportRequestManager.resolveResponse(JSON.stringify(_.data))},w.uri=y,w.postMessageID="post-message-transport-"+Math.random(),w}return p.prototype.createWindow=function(y){return new Promise(function(w,_){var C=d(y);setTimeout(function(){w(C)},3e3)})},p.prototype.connect=function(){var y=this,w=/^(http|https):\/\/.*$/;return new Promise(function(_,C){return i(y,void 0,void 0,function(){var E;return o(this,function(T){switch(T.label){case 0:return w.test(this.uri)||C(Error("Bad URI")),E=this,[4,this.createWindow(this.uri)];case 1:return E.frame=T.sent(),window.addEventListener("message",this.messageHandler),_(),[2]}})})})},p.prototype.sendData=function(y,w){return w===void 0&&(w=5e3),i(this,void 0,void 0,function(){var _,C;return o(this,function(E){return _=this.transportRequestManager.addRequest(y,null),C=c.getNotifications(y),this.frame&&(this.frame.postMessage(y.request,this.uri),this.transportRequestManager.settlePendingRequest(C)),[2,_]})})},p.prototype.close=function(){this.frame&&(window.removeEventListener("message",this.messageHandler),this.frame.close())},p})(s.Transport)})),N0=Ee((e=>{var n=e&&e.__extends||(function(){var d=function(f,p){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,w){y.__proto__=w}||function(y,w){for(var _ in w)w.hasOwnProperty(_)&&(y[_]=w[_])},d(f,p)};return function(f,p){d(f,p);function y(){this.constructor=f}f.prototype=p===null?Object.create(p):(y.prototype=p.prototype,new y)}})(),i=e&&e.__awaiter||function(d,f,p,y){function w(_){return _ instanceof p?_:new p(function(C){C(_)})}return new(p||(p=Promise))(function(_,C){function E($){try{I(y.next($))}catch(V){C(V)}}function T($){try{I(y.throw($))}catch(V){C(V)}}function I($){$.done?_($.value):w($.value).then(E,T)}I((y=y.apply(d,f||[])).next())})},o=e&&e.__generator||function(d,f){var p={label:0,sent:function(){if(_[0]&1)throw _[1];return _[1]},trys:[],ops:[]},y,w,_,C;return C={next:E(0),throw:E(1),return:E(2)},typeof Symbol=="function"&&(C[Symbol.iterator]=function(){return this}),C;function E(I){return function($){return T([I,$])}}function T(I){if(y)throw TypeError("Generator is already executing.");for(;p;)try{if(y=1,w&&(_=I[0]&2?w.return:I[0]?w.throw||((_=w.return)&&_.call(w),0):w.next)&&!(_=_.call(w,I[1])).done)return _;switch(w=0,_&&(I=[I[0]&2,_.value]),I[0]){case 0:case 1:_=I;break;case 4:return p.label++,{value:I[1],done:!1};case 5:p.label++,w=I[1],I=[0];continue;case 7:I=p.ops.pop(),p.trys.pop();continue;default:if(_=p.trys,!(_=_.length>0&&_[_.length-1])&&(I[0]===6||I[0]===2)){p=0;continue}if(I[0]===3&&(!_||I[1]>_[0]&&I[1]<_[3])){p.label=I[1];break}if(I[0]===6&&p.label<_[1]){p.label=_[1],_=I;break}if(_&&p.label<_[2]){p.label=_[2],p.ops.push(I);break}_[2]&&p.ops.pop(),p.trys.pop();continue}I=f.call(d,p)}catch($){I=[6,$],w=0}finally{y=_=0}if(I[0]&5)throw I[1];return{value:I[0]?I[1]:void 0,done:!0}}};Object.defineProperty(e,"__esModule",{value:!0});var s=Oa(),c=Do();e.default=(function(d){n(f,d);function f(p){var y=d.call(this)||this;return y.messageHandler=function(w){y.transportRequestManager.resolveResponse(JSON.stringify(w.data))},y.uri=p,y.postMessageID="post-message-transport-"+Math.random(),y}return f.prototype.createWindow=function(p){var y=this;return new Promise(function(w,_){var C,E=document.createElement("iframe");E.setAttribute("id",y.postMessageID),E.setAttribute("width","0px"),E.setAttribute("height","0px"),E.setAttribute("style","visiblity:hidden;border:none;outline:none;"),E.addEventListener("load",function(){w(C)}),E.setAttribute("src",p),window.document.body.appendChild(E),C=E.contentWindow})},f.prototype.connect=function(){var p=this,y=/^(http|https):\/\/.*$/;return new Promise(function(w,_){return i(p,void 0,void 0,function(){var C;return o(this,function(E){switch(E.label){case 0:return y.test(this.uri)||_(Error("Bad URI")),C=this,[4,this.createWindow(this.uri)];case 1:return C.frame=E.sent(),window.addEventListener("message",this.messageHandler),w(),[2]}})})})},f.prototype.sendData=function(p,y){return y===void 0&&(y=5e3),i(this,void 0,void 0,function(){var w,_;return o(this,function(C){return w=this.transportRequestManager.addRequest(p,null),_=c.getNotifications(p),this.frame&&(this.frame.postMessage(p.request,"*"),this.transportRequestManager.settlePendingRequest(_)),[2,w]})})},f.prototype.close=function(){var p;(p=document.getElementById(this.postMessageID))==null||p.remove(),window.removeEventListener("message",this.messageHandler)},f})(s.Transport)})),I0=Ee((e=>{var n=e&&e.__awaiter||function(o,s,c,d){function f(p){return p instanceof c?p:new c(function(y){y(p)})}return new(c||(c=Promise))(function(p,y){function w(E){try{C(d.next(E))}catch(T){y(T)}}function _(E){try{C(d.throw(E))}catch(T){y(T)}}function C(E){E.done?p(E.value):f(E.value).then(w,_)}C((d=d.apply(o,s||[])).next())})},i=e&&e.__generator||function(o,s){var c={label:0,sent:function(){if(p[0]&1)throw p[1];return p[1]},trys:[],ops:[]},d,f,p,y;return y={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function w(C){return function(E){return _([C,E])}}function _(C){if(d)throw TypeError("Generator is already executing.");for(;c;)try{if(d=1,f&&(p=C[0]&2?f.return:C[0]?f.throw||((p=f.return)&&p.call(f),0):f.next)&&!(p=p.call(f,C[1])).done)return p;switch(f=0,p&&(C=[C[0]&2,p.value]),C[0]){case 0:case 1:p=C;break;case 4:return c.label++,{value:C[1],done:!1};case 5:c.label++,f=C[1],C=[0];continue;case 7:C=c.ops.pop(),c.trys.pop();continue;default:if(p=c.trys,!(p=p.length>0&&p[p.length-1])&&(C[0]===6||C[0]===2)){c=0;continue}if(C[0]===3&&(!p||C[1]>p[0]&&C[1]<p[3])){c.label=C[1];break}if(C[0]===6&&c.label<p[1]){c.label=p[1],p=C;break}if(p&&c.label<p[2]){c.label=p[2],c.ops.push(C);break}p[2]&&c.ops.pop(),c.trys.pop();continue}C=s.call(o,c)}catch(E){C=[6,E],f=0}finally{d=p=0}if(C[0]&5)throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=(function(){function o(s){this.requestManager=s}return o.prototype.startBatch=function(){return this.requestManager.startBatch()},o.prototype.stopBatch=function(){return this.requestManager.stopBatch()},o.prototype.request=function(s,c){return n(this,void 0,void 0,function(){return i(this,function(d){switch(d.label){case 0:return this.requestManager.connectPromise?[4,this.requestManager.connectPromise]:[3,2];case 1:d.sent(),d.label=2;case 2:return[2,this.requestManager.request(s,!1,c)]}})})},o.prototype.notify=function(s){return n(this,void 0,void 0,function(){return i(this,function(c){switch(c.label){case 0:return this.requestManager.connectPromise?[4,this.requestManager.connectPromise]:[3,2];case 1:c.sent(),c.label=2;case 2:return[2,this.requestManager.request(s,!0,null)]}})})},o.prototype.onNotification=function(s){this.requestManager.requestChannel.addListener("notification",s)},o.prototype.onError=function(s){this.requestManager.requestChannel.addListener("error",s)},o.prototype.close=function(){this.requestManager.close()},o})()})),Al=Ee((e=>{var n=e&&e.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(e,"__esModule",{value:!0}),e.PostMessageIframeTransport=e.PostMessageWindowTransport=e.JSONRPCError=e.WebSocketTransport=e.EventEmitterTransport=e.HTTPTransport=e.RequestManager=e.Client=void 0,e.RequestManager=n(m0()).default,e.EventEmitterTransport=n(y0()).default,e.HTTPTransport=n(R0()).default,e.WebSocketTransport=n(M0()).default,e.PostMessageWindowTransport=n(L0()).default,e.PostMessageIframeTransport=n(N0()).default;var i=Ro();Object.defineProperty(e,"JSONRPCError",{enumerable:!0,get:function(){return i.JSONRPCError}});var o=n(I0());e.Client=o.default,e.default=o.default})),Po=Ee((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.stringArray=e.array=e.func=e.error=e.number=e.string=e.boolean=void 0;function n(p){return p===!0||p===!1}e.boolean=n;function i(p){return typeof p=="string"||p instanceof String}e.string=i;function o(p){return typeof p=="number"||p instanceof Number}e.number=o;function s(p){return p instanceof Error}e.error=s;function c(p){return typeof p=="function"}e.func=c;function d(p){return Array.isArray(p)}e.array=d;function f(p){return d(p)&&p.every(y=>i(y))}e.stringArray=f})),Pd=Ee((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Message=e.NotificationType9=e.NotificationType8=e.NotificationType7=e.NotificationType6=e.NotificationType5=e.NotificationType4=e.NotificationType3=e.NotificationType2=e.NotificationType1=e.NotificationType0=e.NotificationType=e.RequestType9=e.RequestType8=e.RequestType7=e.RequestType6=e.RequestType5=e.RequestType4=e.RequestType3=e.RequestType2=e.RequestType1=e.RequestType=e.RequestType0=e.AbstractMessageSignature=e.ParameterStructures=e.ResponseError=e.ErrorCodes=void 0;var n=Po(),i;(function(d){d.ParseError=-32700,d.InvalidRequest=-32600,d.MethodNotFound=-32601,d.InvalidParams=-32602,d.InternalError=-32603,d.jsonrpcReservedErrorRangeStart=-32099,d.serverErrorStart=-32099,d.MessageWriteError=-32099,d.MessageReadError=-32098,d.PendingResponseRejected=-32097,d.ConnectionInactive=-32096,d.ServerNotInitialized=-32002,d.UnknownErrorCode=-32001,d.jsonrpcReservedErrorRangeEnd=-32e3,d.serverErrorEnd=-32e3})(i||(e.ErrorCodes=i={})),e.ResponseError=class fx extends Error{constructor(f,p,y){super(p),this.code=n.number(f)?f:i.UnknownErrorCode,this.data=y,Object.setPrototypeOf(this,fx.prototype)}toJson(){let f={code:this.code,message:this.message};return this.data!==void 0&&(f.data=this.data),f}};var o=class pd{constructor(f){this.kind=f}static is(f){return f===pd.auto||f===pd.byName||f===pd.byPosition}toString(){return this.kind}};e.ParameterStructures=o,o.auto=new o("auto"),o.byPosition=new o("byPosition"),o.byName=new o("byName");var s=class{constructor(d,f){this.method=d,this.numberOfParams=f}get parameterStructures(){return o.auto}};e.AbstractMessageSignature=s,e.RequestType0=class extends s{constructor(d){super(d,0)}},e.RequestType=class extends s{constructor(d,f=o.auto){super(d,1),this._parameterStructures=f}get parameterStructures(){return this._parameterStructures}},e.RequestType1=class extends s{constructor(d,f=o.auto){super(d,1),this._parameterStructures=f}get parameterStructures(){return this._parameterStructures}},e.RequestType2=class extends s{constructor(d){super(d,2)}},e.RequestType3=class extends s{constructor(d){super(d,3)}},e.RequestType4=class extends s{constructor(d){super(d,4)}},e.RequestType5=class extends s{constructor(d){super(d,5)}},e.RequestType6=class extends s{constructor(d){super(d,6)}},e.RequestType7=class extends s{constructor(d){super(d,7)}},e.RequestType8=class extends s{constructor(d){super(d,8)}},e.RequestType9=class extends s{constructor(d){super(d,9)}},e.NotificationType=class extends s{constructor(d,f=o.auto){super(d,1),this._parameterStructures=f}get parameterStructures(){return this._parameterStructures}},e.NotificationType0=class extends s{constructor(d){super(d,0)}},e.NotificationType1=class extends s{constructor(d,f=o.auto){super(d,1),this._parameterStructures=f}get parameterStructures(){return this._parameterStructures}},e.NotificationType2=class extends s{constructor(d){super(d,2)}},e.NotificationType3=class extends s{constructor(d){super(d,3)}},e.NotificationType4=class extends s{constructor(d){super(d,4)}},e.NotificationType5=class extends s{constructor(d){super(d,5)}},e.NotificationType6=class extends s{constructor(d){super(d,6)}},e.NotificationType7=class extends s{constructor(d){super(d,7)}},e.NotificationType8=class extends s{constructor(d){super(d,8)}},e.NotificationType9=class extends s{constructor(d){super(d,9)}};var c;(function(d){function f(w){let _=w;return _&&n.string(_.method)&&(n.string(_.id)||n.number(_.id))}d.isRequest=f;function p(w){let _=w;return _&&n.string(_.method)&&w.id===void 0}d.isNotification=p;function y(w){let _=w;return _&&(_.result!==void 0||!!_.error)&&(n.string(_.id)||n.number(_.id)||_.id===null)}d.isResponse=y})(c||(e.Message=c={}))})),Md=Ee((e=>{var n;Object.defineProperty(e,"__esModule",{value:!0}),e.LRUCache=e.LinkedMap=e.Touch=void 0;var i;(function(s){s.None=0,s.First=1,s.AsOld=s.First,s.Last=2,s.AsNew=s.Last})(i||(e.Touch=i={}));var o=class{constructor(){this[n]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){var s;return(s=this._head)==null?void 0:s.value}get last(){var s;return(s=this._tail)==null?void 0:s.value}has(s){return this._map.has(s)}get(s,c=i.None){let d=this._map.get(s);if(d)return c!==i.None&&this.touch(d,c),d.value}set(s,c,d=i.None){let f=this._map.get(s);if(f)f.value=c,d!==i.None&&this.touch(f,d);else{switch(f={key:s,value:c,next:void 0,previous:void 0},d){case i.None:this.addItemLast(f);break;case i.First:this.addItemFirst(f);break;case i.Last:this.addItemLast(f);break;default:this.addItemLast(f);break}this._map.set(s,f),this._size++}return this}delete(s){return!!this.remove(s)}remove(s){let c=this._map.get(s);if(c)return this._map.delete(s),this.removeItem(c),this._size--,c.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw Error("Invalid list");let s=this._head;return this._map.delete(s.key),this.removeItem(s),this._size--,s.value}forEach(s,c){let d=this._state,f=this._head;for(;f;){if(c?s.bind(c)(f.value,f.key,this):s(f.value,f.key,this),this._state!==d)throw Error("LinkedMap got modified during iteration.");f=f.next}}keys(){let s=this._state,c=this._head,d={[Symbol.iterator]:()=>d,next:()=>{if(this._state!==s)throw Error("LinkedMap got modified during iteration.");if(c){let f={value:c.key,done:!1};return c=c.next,f}else return{value:void 0,done:!0}}};return d}values(){let s=this._state,c=this._head,d={[Symbol.iterator]:()=>d,next:()=>{if(this._state!==s)throw Error("LinkedMap got modified during iteration.");if(c){let f={value:c.value,done:!1};return c=c.next,f}else return{value:void 0,done:!0}}};return d}entries(){let s=this._state,c=this._head,d={[Symbol.iterator]:()=>d,next:()=>{if(this._state!==s)throw Error("LinkedMap got modified during iteration.");if(c){let f={value:[c.key,c.value],done:!1};return c=c.next,f}else return{value:void 0,done:!0}}};return d}[(n=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(s){if(s>=this.size)return;if(s===0){this.clear();return}let c=this._head,d=this.size;for(;c&&d>s;)this._map.delete(c.key),c=c.next,d--;this._head=c,this._size=d,c&&(c.previous=void 0),this._state++}addItemFirst(s){if(!this._head&&!this._tail)this._tail=s;else if(this._head)s.next=this._head,this._head.previous=s;else throw Error("Invalid list");this._head=s,this._state++}addItemLast(s){if(!this._head&&!this._tail)this._head=s;else if(this._tail)s.previous=this._tail,this._tail.next=s;else throw Error("Invalid list");this._tail=s,this._state++}removeItem(s){if(s===this._head&&s===this._tail)this._head=void 0,this._tail=void 0;else if(s===this._head){if(!s.next)throw Error("Invalid list");s.next.previous=void 0,this._head=s.next}else if(s===this._tail){if(!s.previous)throw Error("Invalid list");s.previous.next=void 0,this._tail=s.previous}else{let c=s.next,d=s.previous;if(!c||!d)throw Error("Invalid list");c.previous=d,d.next=c}s.next=void 0,s.previous=void 0,this._state++}touch(s,c){if(!this._head||!this._tail)throw Error("Invalid list");if(!(c!==i.First&&c!==i.Last)){if(c===i.First){if(s===this._head)return;let d=s.next,f=s.previous;s===this._tail?(f.next=void 0,this._tail=f):(d.previous=f,f.next=d),s.previous=void 0,s.next=this._head,this._head.previous=s,this._head=s,this._state++}else if(c===i.Last){if(s===this._tail)return;let d=s.next,f=s.previous;s===this._head?(d.previous=void 0,this._head=d):(d.previous=f,f.next=d),s.next=void 0,s.previous=this._tail,this._tail.next=s,this._tail=s,this._state++}}}toJSON(){let s=[];return this.forEach((c,d)=>{s.push([d,c])}),s}fromJSON(s){this.clear();for(let[c,d]of s)this.set(c,d)}};e.LinkedMap=o,e.LRUCache=class extends o{constructor(s,c=1){super(),this._limit=s,this._ratio=Math.min(Math.max(0,c),1)}get limit(){return this._limit}set limit(s){this._limit=s,this.checkTrim()}get ratio(){return this._ratio}set ratio(s){this._ratio=Math.min(Math.max(0,s),1),this.checkTrim()}get(s,c=i.AsNew){return super.get(s,c)}peek(s){return super.get(s,i.None)}set(s,c){return super.set(s,c,i.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}}})),A0=Ee((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Disposable=void 0;var n;(function(i){function o(s){return{dispose:s}}i.create=o})(n||(e.Disposable=n={}))})),Ji=Ee((e=>{Object.defineProperty(e,"__esModule",{value:!0});var n;function i(){if(n===void 0)throw Error("No runtime abstraction layer installed");return n}(function(o){function s(c){if(c===void 0)throw Error("No runtime abstraction layer provided");n=c}o.install=s})(i||(i={})),e.default=i})),Mo=Ee((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Emitter=e.Event=void 0;var n=Ji(),i;(function(c){let d={dispose(){}};c.None=function(){return d}})(i||(e.Event=i={}));var o=class{add(c,d=null,f){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(c),this._contexts.push(d),Array.isArray(f)&&f.push({dispose:()=>this.remove(c,d)})}remove(c,d=null){if(!this._callbacks)return;let f=!1;for(let p=0,y=this._callbacks.length;p<y;p++)if(this._callbacks[p]===c)if(this._contexts[p]===d){this._callbacks.splice(p,1),this._contexts.splice(p,1);return}else f=!0;if(f)throw Error("When adding a listener with a context, you should remove it with the same context")}invoke(...c){if(!this._callbacks)return[];let d=[],f=this._callbacks.slice(0),p=this._contexts.slice(0);for(let y=0,w=f.length;y<w;y++)try{d.push(f[y].apply(p[y],c))}catch(_){(0,n.default)().console.error(_)}return d}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},s=class px{constructor(d){this._options=d}get event(){return this._event||(this._event=(d,f,p)=>{this._callbacks||(this._callbacks=new o),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(d,f);let y={dispose:()=>{this._callbacks&&(this._callbacks.remove(d,f),y.dispose=px._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(p)&&p.push(y),y}),this._event}fire(d){this._callbacks&&this._callbacks.invoke.call(this._callbacks,d)}dispose(){this._callbacks&&(this._callbacks=(this._callbacks.dispose(),void 0))}};e.Emitter=s,s._noop=function(){}})),Gl=Ee((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CancellationTokenSource=e.CancellationToken=void 0;var n=Ji(),i=Po(),o=Mo(),s;(function(f){f.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:o.Event.None}),f.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:o.Event.None});function p(y){let w=y;return w&&(w===f.None||w===f.Cancelled||i.boolean(w.isCancellationRequested)&&!!w.onCancellationRequested)}f.is=p})(s||(e.CancellationToken=s={}));var c=Object.freeze(function(f,p){let y=(0,n.default)().timer.setTimeout(f.bind(p),0);return{dispose(){y.dispose()}}}),d=class{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?c:(this._emitter||(this._emitter=new o.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter=(this._emitter.dispose(),void 0))}};e.CancellationTokenSource=class{get token(){return this._token||(this._token=new d),this._token}cancel(){this._token?this._token.cancel():this._token=s.Cancelled}dispose(){this._token?this._token instanceof d&&this._token.dispose():this._token=s.None}}})),q0=Ee((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SharedArrayReceiverStrategy=e.SharedArraySenderStrategy=void 0;var n=Gl(),i;(function(c){c.Continue=0,c.Cancelled=1})(i||(i={})),e.SharedArraySenderStrategy=class{constructor(){this.buffers=new Map}enableCancellation(c){if(c.id===null)return;let d=new SharedArrayBuffer(4),f=new Int32Array(d,0,1);f[0]=i.Continue,this.buffers.set(c.id,d),c.$cancellationData=d}async sendCancellation(c,d){let f=this.buffers.get(d);if(f===void 0)return;let p=new Int32Array(f,0,1);Atomics.store(p,0,i.Cancelled)}cleanup(c){this.buffers.delete(c)}dispose(){this.buffers.clear()}};var o=class{constructor(c){this.data=new Int32Array(c,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===i.Cancelled}get onCancellationRequested(){throw Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},s=class{constructor(c){this.token=new o(c)}cancel(){}dispose(){}};e.SharedArrayReceiverStrategy=class{constructor(){this.kind="request"}createCancellationTokenSource(c){let d=c.$cancellationData;return d===void 0?new n.CancellationTokenSource:new s(d)}}})),Ld=Ee((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Semaphore=void 0;var n=Ji();e.Semaphore=class{constructor(i=1){if(i<=0)throw Error("Capacity must be greater than 0");this._capacity=i,this._active=0,this._waiting=[]}lock(i){return new Promise((o,s)=>{this._waiting.push({thunk:i,resolve:o,reject:s}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,n.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let i=this._waiting.shift();if(this._active++,this._active>this._capacity)throw Error("To many thunks active");try{let o=i.thunk();o instanceof Promise?o.then(s=>{this._active--,i.resolve(s),this.runNext()},s=>{this._active--,i.reject(s),this.runNext()}):(this._active--,i.resolve(o),this.runNext())}catch(o){this._active--,i.reject(o),this.runNext()}}}})),j0=Ee((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=void 0;var n=Ji(),i=Po(),o=Mo(),s=Ld(),c;(function(p){function y(w){let _=w;return _&&i.func(_.listen)&&i.func(_.dispose)&&i.func(_.onError)&&i.func(_.onClose)&&i.func(_.onPartialMessage)}p.is=y})(c||(e.MessageReader=c={}));var d=class{constructor(){this.errorEmitter=new o.Emitter,this.closeEmitter=new o.Emitter,this.partialMessageEmitter=new o.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(p){this.errorEmitter.fire(this.asError(p))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(p){this.partialMessageEmitter.fire(p)}asError(p){return p instanceof Error?p:Error(`Reader received error. Reason: ${i.string(p.message)?p.message:"unknown"}`)}};e.AbstractMessageReader=d;var f;(function(p){function y(w){let _,C,E=new Map,T,I=new Map;if(w===void 0||typeof w=="string")_=w??"utf-8";else{if(_=w.charset??"utf-8",w.contentDecoder!==void 0&&(C=w.contentDecoder,E.set(C.name,C)),w.contentDecoders!==void 0)for(let $ of w.contentDecoders)E.set($.name,$);if(w.contentTypeDecoder!==void 0&&(T=w.contentTypeDecoder,I.set(T.name,T)),w.contentTypeDecoders!==void 0)for(let $ of w.contentTypeDecoders)I.set($.name,$)}return T===void 0&&(T=(0,n.default)().applicationJson.decoder,I.set(T.name,T)),{charset:_,contentDecoder:C,contentDecoders:E,contentTypeDecoder:T,contentTypeDecoders:I}}p.fromOptions=y})(f||(f={})),e.ReadableStreamMessageReader=class extends d{constructor(p,y){super(),this.readable=p,this.options=f.fromOptions(y),this.buffer=(0,n.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new s.Semaphore(1)}set partialMessageTimeout(p){this._partialMessageTimeout=p}get partialMessageTimeout(){return this._partialMessageTimeout}listen(p){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=p;let y=this.readable.onData(w=>{this.onData(w)});return this.readable.onError(w=>this.fireError(w)),this.readable.onClose(()=>this.fireClose()),y}onData(p){try{for(this.buffer.append(p);;){if(this.nextMessageLength===-1){let w=this.buffer.tryReadHeaders(!0);if(!w)return;let _=w.get("content-length");if(!_){this.fireError(Error(`Header must provide a Content-Length property.
17
17
  ${JSON.stringify(Object.fromEntries(w))}`));return}let C=parseInt(_);if(isNaN(C)){this.fireError(Error(`Content-Length value must be a number. Got ${_}`));return}this.nextMessageLength=C}let y=this.buffer.tryReadBody(this.nextMessageLength);if(y===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let w=this.options.contentDecoder===void 0?y:await this.options.contentDecoder.decode(y),_=await this.options.contentTypeDecoder.decode(w,this.options);this.callback(_)}).catch(w=>{this.fireError(w)})}}catch(y){this.fireError(y)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer=(this.partialMessageTimer.dispose(),void 0))}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,n.default)().timer.setTimeout((p,y)=>{this.partialMessageTimer=void 0,p===this.messageToken&&(this.firePartialMessage({messageToken:p,waitingTime:y}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}}})),z0=Ee((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=void 0;var n=Ji(),i=Po(),o=Ld(),s=Mo(),c="Content-Length: ",d=`\r
@@ -1 +1 @@
1
- import{s as f}from"./chunk-LvLJmgfZ.js";import{t as y}from"./react-Bj1aDYRI.js";import{Vn as g}from"./cells-CiFhRLUd.js";import{t as j}from"./compiler-runtime-B3qBwwSJ.js";import{t as N}from"./jsx-runtime-ZmTK25f3.js";import{t as k}from"./cn-BKtXLv3a.js";import{t as x}from"./createLucideIcon-BCdY6lG5.js";import{t as w}from"./x-ZP5cObgf.js";import{t as u}from"./file-Ch78NKWp.js";import{n as M}from"./play-GLWQQs7F.js";var b=x("bot-message-square",[["path",{d:"M12 6V2H8",key:"1155em"}],["path",{d:"M15 11v2",key:"i11awn"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 16a2 2 0 0 1-2 2H8.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 4 20.286V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2z",key:"11gyqh"}],["path",{d:"M9 11v2",key:"1ueba0"}]]),v=x("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),d=j(),_=f(y(),1),o=f(N(),1);const q=i=>{var c;let e=(0,d.c)(6),{attachment:t}=i;if((c=t.mediaType)!=null&&c.startsWith("image/")){let a=t.filename||"Attachment",m;return e[0]!==t.url||e[1]!==a?(m=(0,o.jsx)("img",{src:t.url,alt:a,className:"max-h-[100px] max-w-[100px] object-contain mb-1.5"}),e[0]=t.url,e[1]=a,e[2]=m):m=e[2],m}let s;e[3]===Symbol.for("react.memo_cache_sentinel")?(s=(0,o.jsx)(u,{className:"h-3 w-3 mt-0.5"}),e[3]=s):s=e[3];let l=t.filename||"Attachment",r;return e[4]===l?r=e[5]:(r=(0,o.jsxs)("div",{className:"flex flex-row gap-1 items-center text-xs",children:[s,l]}),e[4]=l,e[5]=r),r},A=i=>{let e=(0,d.c)(12),{file:t,className:s,onRemove:l}=i,[r,c]=(0,_.useState)(!1),a;e[0]===s?a=e[1]:(a=k("py-1 px-1.5 bg-muted rounded-md cursor-pointer flex flex-row gap-1 items-center text-xs",s),e[0]=s,e[1]=a);let m,p;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=()=>c(!0),p=()=>c(!1),e[2]=m,e[3]=p):(m=e[2],p=e[3]);let n;e[4]!==t||e[5]!==r||e[6]!==l?(n=r?(0,o.jsx)(w,{className:"h-3 w-3 mt-0.5",onClick:l}):S(t),e[4]=t,e[5]=r,e[6]=l,e[7]=n):n=e[7];let h;return e[8]!==t.name||e[9]!==a||e[10]!==n?(h=(0,o.jsxs)("div",{className:a,onMouseEnter:m,onMouseLeave:p,children:[n,t.name]}),e[8]=t.name,e[9]=a,e[10]=n,e[11]=h):h=e[11],h};function S(i){let e="h-3 w-3 mt-0.5";return i.type.startsWith("image/")?(0,o.jsx)(M,{className:e}):i.type.startsWith("text/")?(0,o.jsx)(g,{className:e}):(0,o.jsx)(u,{className:e})}export{b as i,A as n,v as r,q as t};
1
+ import{s as f}from"./chunk-LvLJmgfZ.js";import{t as y}from"./react-Bj1aDYRI.js";import{Vn as g}from"./cells-B0XKj2oa.js";import{t as j}from"./compiler-runtime-B3qBwwSJ.js";import{t as N}from"./jsx-runtime-ZmTK25f3.js";import{t as k}from"./cn-BKtXLv3a.js";import{t as x}from"./createLucideIcon-BCdY6lG5.js";import{t as w}from"./x-ZP5cObgf.js";import{t as u}from"./file-Ch78NKWp.js";import{n as M}from"./play-GLWQQs7F.js";var b=x("bot-message-square",[["path",{d:"M12 6V2H8",key:"1155em"}],["path",{d:"M15 11v2",key:"i11awn"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 16a2 2 0 0 1-2 2H8.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 4 20.286V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2z",key:"11gyqh"}],["path",{d:"M9 11v2",key:"1ueba0"}]]),v=x("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),d=j(),_=f(y(),1),o=f(N(),1);const q=i=>{var c;let e=(0,d.c)(6),{attachment:t}=i;if((c=t.mediaType)!=null&&c.startsWith("image/")){let a=t.filename||"Attachment",m;return e[0]!==t.url||e[1]!==a?(m=(0,o.jsx)("img",{src:t.url,alt:a,className:"max-h-[100px] max-w-[100px] object-contain mb-1.5"}),e[0]=t.url,e[1]=a,e[2]=m):m=e[2],m}let s;e[3]===Symbol.for("react.memo_cache_sentinel")?(s=(0,o.jsx)(u,{className:"h-3 w-3 mt-0.5"}),e[3]=s):s=e[3];let l=t.filename||"Attachment",r;return e[4]===l?r=e[5]:(r=(0,o.jsxs)("div",{className:"flex flex-row gap-1 items-center text-xs",children:[s,l]}),e[4]=l,e[5]=r),r},A=i=>{let e=(0,d.c)(12),{file:t,className:s,onRemove:l}=i,[r,c]=(0,_.useState)(!1),a;e[0]===s?a=e[1]:(a=k("py-1 px-1.5 bg-muted rounded-md cursor-pointer flex flex-row gap-1 items-center text-xs",s),e[0]=s,e[1]=a);let m,p;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=()=>c(!0),p=()=>c(!1),e[2]=m,e[3]=p):(m=e[2],p=e[3]);let n;e[4]!==t||e[5]!==r||e[6]!==l?(n=r?(0,o.jsx)(w,{className:"h-3 w-3 mt-0.5",onClick:l}):S(t),e[4]=t,e[5]=r,e[6]=l,e[7]=n):n=e[7];let h;return e[8]!==t.name||e[9]!==a||e[10]!==n?(h=(0,o.jsxs)("div",{className:a,onMouseEnter:m,onMouseLeave:p,children:[n,t.name]}),e[8]=t.name,e[9]=a,e[10]=n,e[11]=h):h=e[11],h};function S(i){let e="h-3 w-3 mt-0.5";return i.type.startsWith("image/")?(0,o.jsx)(M,{className:e}):i.type.startsWith("text/")?(0,o.jsx)(g,{className:e}):(0,o.jsx)(u,{className:e})}export{b as i,A as n,v as r,q as t};
@@ -1 +1 @@
1
- import{s as H}from"./chunk-LvLJmgfZ.js";import{t as K}from"./react-Bj1aDYRI.js";import{Bn as U,Kn as $}from"./cells-CiFhRLUd.js";import{C as z,P as G,R as E,T as Q}from"./zod-H_cgTO0M.js";import{t as J}from"./compiler-runtime-B3qBwwSJ.js";import{n as X}from"./assertNever-CBU83Y6o.js";import{t as L}from"./isEmpty-CgX_-6Mt.js";import{ut as Y}from"./ai-model-dropdown-DC4t5PJE.js";import{d as W}from"./hotkeys-BHHWjLlp.js";import{t as Z}from"./jsx-runtime-ZmTK25f3.js";import{t as A}from"./cn-BKtXLv3a.js";import{i as ee,t as te}from"./chat-components-C5FA1-Vu.js";import{t as B}from"./markdown-renderer-Dotqbx_q.js";import{n as se}from"./spinner-DA8-7wQv.js";import{c as ae}from"./datasource-C7Acf9BM.js";import{a as C,i as D,n as I,r as M}from"./multi-map-A4XNra08.js";var re=J();K();var t=H(Z(),1);const le=n=>{let e=(0,re.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)(C,{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)(M,{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)(B,{content:a})})})}),e[4]=a,e[5]=i);let d;e[6]!==c||e[7]!==i?(d=(0,t.jsxs)(D,{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)(I,{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 F=J(),ne=G({status:E().default("success"),auth_required:Q().default(!1),action_url:z(),next_steps:z(),meta:z(),message:E().nullish()}).passthrough(),oe=n=>{let e=(0,F.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)(U,{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(me)})]}),e[0]=a,e[1]=l}else l=e[1];return l},ie=n=>{let e=(0,F.c)(8),{result:a}=n,l;e[0]===a?l=e[1]:(l=ne.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)(oe,{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},de=n=>{let e=(0,F.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"&&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 V=n=>{let e=(0,F.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)($,{className:"h-3 w-3 text-[var(--red-11)]"});case"success":return(0,t.jsx)(Y,{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,T=`tool-${p}`,g;e[6]===o?g=e[7]:(g=A("w-full",o),e[6]=o,e[7]=g);let k=i==="error"&&"text-[var(--red-11)]/80",q=i==="success"&&"text-[var(--grass-11)]/80",v;e[8]!==k||e[9]!==q?(v=A("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",k,q),e[8]=k,e[9]=q,e[10]=v):v=e[10];let j;e[11]===u?j=e[12]:(j=u(),e[11]=u,e[12]=j);let P=f(),b;e[13]===a?b=e[14]:(b=ce(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]!==P||e[18]!==N||e[19]!==j?(y=(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[j,P,":",N]}),e[17]=P,e[18]=N,e[19]=j,e[20]=y):y=e[20];let w;e[21]!==y||e[22]!==v?(w=(0,t.jsx)(C,{className:v,children:y}),e[21]=y,e[22]=v,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)(de,{input:x}),l!=null&&(0,t.jsx)(ie,{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)(M,{className:"py-2 px-2",children:_}),e[29]=_,e[30]=S);let O;e[31]!==w||e[32]!==S?(O=(0,t.jsxs)(D,{value:"tool-call",className:"border-0",children:[w,S]}),e[31]=w,e[32]=S,e[33]=O):O=e[33];let R;return e[34]!==O||e[35]!==T||e[36]!==g?(R=(0,t.jsx)(I,{type:"single",collapsible:!0,className:g,children:O},T),e[34]=O,e[35]=T,e[36]=g,e[37]=R):R=e[37],R};function ce(n){return n.replace("tool-","")}function me(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 ue=({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(xe(s))return(0,t.jsx)(V,{index:r,toolName:s.type,result:s.output,className:"my-2",state:s.state,input:s.input},r);if(pe(s))return W.debug("Found data part",s),null;switch(s.type){case"text":return(0,t.jsx)(B,{content:s.text},r);case"reasoning":return(0,t.jsx)(le,{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)(V,{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 X(s),null}}};function xe(n){return n.type.startsWith("tool-")}function pe(n){return n.type.startsWith("data-")}export{ue as t};
1
+ import{s as H}from"./chunk-LvLJmgfZ.js";import{t as K}from"./react-Bj1aDYRI.js";import{Bn as U,Kn as $}from"./cells-B0XKj2oa.js";import{C as z,P as G,R as E,T as Q}from"./zod-H_cgTO0M.js";import{t as J}from"./compiler-runtime-B3qBwwSJ.js";import{n as X}from"./assertNever-CBU83Y6o.js";import{t as L}from"./isEmpty-CgX_-6Mt.js";import{ut as Y}from"./ai-model-dropdown-Cugcw6NV.js";import{d as W}from"./hotkeys-BHHWjLlp.js";import{t as Z}from"./jsx-runtime-ZmTK25f3.js";import{t as A}from"./cn-BKtXLv3a.js";import{i as ee,t as te}from"./chat-components-BNjAKvAv.js";import{t as B}from"./markdown-renderer-Y3WEBmX7.js";import{n as se}from"./spinner-DA8-7wQv.js";import{c as ae}from"./datasource-2_-ICoTV.js";import{a as C,i as D,n as I,r as M}from"./multi-map-A4XNra08.js";var re=J();K();var t=H(Z(),1);const le=n=>{let e=(0,re.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)(C,{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)(M,{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)(B,{content:a})})})}),e[4]=a,e[5]=i);let d;e[6]!==c||e[7]!==i?(d=(0,t.jsxs)(D,{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)(I,{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 F=J(),ne=G({status:E().default("success"),auth_required:Q().default(!1),action_url:z(),next_steps:z(),meta:z(),message:E().nullish()}).passthrough(),oe=n=>{let e=(0,F.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)(U,{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(me)})]}),e[0]=a,e[1]=l}else l=e[1];return l},ie=n=>{let e=(0,F.c)(8),{result:a}=n,l;e[0]===a?l=e[1]:(l=ne.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)(oe,{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},de=n=>{let e=(0,F.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"&&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 V=n=>{let e=(0,F.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)($,{className:"h-3 w-3 text-[var(--red-11)]"});case"success":return(0,t.jsx)(Y,{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,T=`tool-${p}`,g;e[6]===o?g=e[7]:(g=A("w-full",o),e[6]=o,e[7]=g);let k=i==="error"&&"text-[var(--red-11)]/80",q=i==="success"&&"text-[var(--grass-11)]/80",v;e[8]!==k||e[9]!==q?(v=A("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",k,q),e[8]=k,e[9]=q,e[10]=v):v=e[10];let j;e[11]===u?j=e[12]:(j=u(),e[11]=u,e[12]=j);let P=f(),b;e[13]===a?b=e[14]:(b=ce(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]!==P||e[18]!==N||e[19]!==j?(y=(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[j,P,":",N]}),e[17]=P,e[18]=N,e[19]=j,e[20]=y):y=e[20];let w;e[21]!==y||e[22]!==v?(w=(0,t.jsx)(C,{className:v,children:y}),e[21]=y,e[22]=v,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)(de,{input:x}),l!=null&&(0,t.jsx)(ie,{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)(M,{className:"py-2 px-2",children:_}),e[29]=_,e[30]=S);let O;e[31]!==w||e[32]!==S?(O=(0,t.jsxs)(D,{value:"tool-call",className:"border-0",children:[w,S]}),e[31]=w,e[32]=S,e[33]=O):O=e[33];let R;return e[34]!==O||e[35]!==T||e[36]!==g?(R=(0,t.jsx)(I,{type:"single",collapsible:!0,className:g,children:O},T),e[34]=O,e[35]=T,e[36]=g,e[37]=R):R=e[37],R};function ce(n){return n.replace("tool-","")}function me(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 ue=({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(xe(s))return(0,t.jsx)(V,{index:r,toolName:s.type,result:s.output,className:"my-2",state:s.state,input:s.input},r);if(pe(s))return W.debug("Found data part",s),null;switch(s.type){case"text":return(0,t.jsx)(B,{content:s.text},r);case"reasoning":return(0,t.jsx)(le,{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)(V,{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 X(s),null}}};function xe(n){return n.type.startsWith("tool-")}function pe(n){return n.type.startsWith("data-")}export{ue as t};