@marimo-team/frontend 0.25.2-dev96 → 0.25.2-dev97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{JsonOutput-NVH7GWyC.js → JsonOutput-DCGUcLVV.js} +1 -1
- package/dist/assets/{MarimoErrorOutput-z5iFryzf.js → MarimoErrorOutput-BEsxXqp6.js} +1 -1
- package/dist/assets/{agent-panel-BcoO8S6Q.js → agent-panel-BPLrf7mA.js} +1 -1
- package/dist/assets/{cell-editor-CevZDS63.js → cell-editor-C3818WlB.js} +1 -1
- package/dist/assets/chat-panel-BZipGUZV.js +4 -0
- package/dist/assets/{column-preview-sL_Jo0hX.js → column-preview-fD3qW2B5.js} +1 -1
- package/dist/assets/{command-palette-DMQFuWz1.js → command-palette-BM9fUfEe.js} +1 -1
- package/dist/assets/{dependency-graph-panel-BwMayTyZ.js → dependency-graph-panel-CLrAZrHA.js} +1 -1
- package/dist/assets/{edit-page-DD1NFkiu.js → edit-page-Ctwp3mZE.js} +4 -4
- package/dist/assets/{error-panel-ByOEJuZN.js → error-panel-BgYJTJpA.js} +1 -1
- package/dist/assets/{file-explorer-panel-B92ugwxr.js → file-explorer-panel-HvVNt0Qs.js} +1 -1
- package/dist/assets/{hooks-DNPsQf79.js → hooks-Qxjt0Ypd.js} +1 -1
- package/dist/assets/{index-C6-WDESh.js → index-B5XWyg6n.js} +2 -2
- package/dist/assets/index-Xxay17E9.css +2 -0
- package/dist/assets/{layout-BaluekG6.js → layout-CSLw6wGo.js} +3 -3
- package/dist/assets/{panels-CO6Clgel.js → panels-BdsXFz1w.js} +1 -1
- package/dist/assets/{reveal-component-DeZTBbnn.js → reveal-component-B5GUiD5Q.js} +1 -1
- package/dist/assets/{run-page-BNEg-Ro9.js → run-page-CVWospEP.js} +1 -1
- package/dist/assets/{scratchpad-panel-lDJWcpVs.js → scratchpad-panel-B4qlmwP-.js} +1 -1
- package/dist/assets/{session-panel-BqutyoYd.js → session-panel-Ch5jQNj0.js} +1 -1
- package/dist/assets/state-BI0fn_YF.js +1 -0
- package/dist/assets/{useCellActionButton-DwAUf_Cn.js → useCellActionButton-BTsPn8Dv.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-CbcGEmqM.js → useDependencyPanelTab-BTsnw2rN.js} +1 -1
- package/dist/assets/{useNotebookActions-pXzVjrlk.js → useNotebookActions-BzJtySGp.js} +1 -1
- package/dist/index.html +6 -6
- package/package.json +1 -1
- package/src/components/chat/__tests__/chat-history-popover.test.tsx +157 -0
- package/src/components/chat/chat-history-popover.tsx +98 -17
- package/src/components/chat/chat-panel.tsx +29 -0
- package/src/core/ai/__tests__/state.test.ts +120 -0
- package/src/core/ai/state.ts +36 -10
- package/dist/assets/chat-panel-DyaePe7B.js +0 -4
- package/dist/assets/index-B7ZZVUcj.css +0 -2
- package/dist/assets/state-B85OOscw.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,r as i,u as a}from"./useEvent-Dc9HkKI2.js";import{t as o}from"./react-CUdNIagt.js";import{$ as s,A as c,B as l,D as u,Dt as d,Et as f,Gn as p,Hr as m,I as h,Ii as g,Jn as ee,Kn as te,Mr as ne,Oo as re,Ot as ie,R as ae,So as oe,St as se,T as _,Vi as ce,Wn as le,b as v,ei as ue,g as y,h as de,l as fe,mr as pe,pr as me,qn as he}from"./cells-CxY8RSp7.js";import{t as b}from"./compiler-runtime-BQ9S8nyo.js";import{D as ge,d as _e,w as ve}from"./config-Cyum2gRs.js";import{_ as x,c as ye,g as be,i as xe,m as Se,n as Ce,o as S,p as we,r as Te,s as Ee,t as De}from"./state-sbCCk7ZP.js";import{g as C,t as Oe}from"./useEventListener-IRzG-0mH.js";import{t as ke}from"./objects-snlMn4yk.js";import{i as w}from"./utils-B4K466FK.js";import{a as T,f as E,m as Ae,r as je,v as D}from"./session-BykGt6S3.js";import{M as Me,T as O,_ as Ne,l as Pe,o as Fe,w as k,x as Ie}from"./config-D_c_6ce1.js";import{r as Le}from"./state-YaAkDV8S.js";import{i as Re,o as A,r as ze}from"./state-ja7GWeCS.js";import{r as Be}from"./ErrorBoundary-CG6gtgym.js";import{n as j,t as M}from"./cn-ldLVeaqm.js";import{t as N}from"./jsx-runtime-B74pBk57.js";import{i as P,s as Ve}from"./fullscreen-DEBblJKh.js";import{a as F,c as I,i as L,l as He,n as R,o as z,r as Ue,s as B}from"./use-restore-focus-GUh2Nd8Z.js";import{Dt as We,Ot as Ge,St as V}from"./JsonOutput-NVH7GWyC.js";import{p as H}from"./download-CPMAf7re.js";import{t as U}from"./tooltip-B5pI8o2n.js";import{t as W}from"./button-M49xxKoi.js";import{t as G}from"./createLucideIcon-rHn2EdoM.js";import{P as K,a as q,c as J,i as Y,n as Ke}from"./layout-BaluekG6.js";import{d as qe,n as Je}from"./markdown-renderer-mDlWBE1M.js";import{v as Ye}from"./write-secret-modal-BcosCmZy.js";import{n as Xe}from"./spinner-CGdRKCnw.js";import{c as Ze,l as Qe,s as $e}from"./readonly-python-code-DcYhdd1B.js";import{t as et}from"./use-toast-CC89xOwH.js";import{i as tt}from"./strings-hlCLC-K1.js";import{t as nt}from"./requests-yTHMxhVa.js";import{n as rt}from"./useAsyncData-DucTwMkf.js";import{t as it}from"./RenderHTML-C7QcdAgB.js";import{t as at}from"./package-data-BwaspaKJ.js";import{f as ot}from"./useInstallPackage-HTUlGg0U.js";import{a as st}from"./errors-D9vyuMar.js";import{s as ct}from"./react-icons.esm-C6SMwKZH.js";import{r as lt}from"./events-CbeVJ6OD.js";import{i as ut}from"./cell-link-DC1UZQr_.js";import{t as dt}from"./requests-DFPPfagc.js";import{r as ft,s as pt,t as mt}from"./state-B2ZbImvm.js";import{t as ht}from"./ws-BXWY541V.js";import{n as gt}from"./runs-DyluVj69.js";var _t=G(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),vt=G(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),yt=G(`unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),X=N(),Z=b(),Q=e(o(),1);function bt(e){let t=(0,Z.c)(3),[n,r]=(0,Q.useState)(e<=0),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(e<=0){r(!0);return}r(!1);let t=setTimeout(()=>r(!0),e);return()=>clearTimeout(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,Q.useLayoutEffect)(i,a),n}var xt=e=>{let{requires:t,fallback:n,delay:i,children:a}=e,o=n===void 0?null:n,s=i===void 0?0:i,c=r(t),l=bt(c?0:s);return c?a:l?o:null},St=e=>{let t=(0,Z.c)(10),{title:n}=e,[r,i]=(0,Q.useState)(n),[a,o]=(0,Q.useState)(!0),s,c;t[0]!==r||t[1]!==n?(s=()=>{if(n!==r){o(!1);let e=setTimeout(()=>{i(n),o(!0)},300);return()=>clearTimeout(e)}},c=[n,r],t[0]=r,t[1]=n,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,Q.useEffect)(s,c);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(Xe,{className:`size-20 animate-spin text-primary`,"data-testid":`large-spinner`,strokeWidth:1}),t[4]=l):l=t[4];let u=a?`opacity-100`:`opacity-0`,d;t[5]===u?d=t[6]:(d=M(`mt-2 text-muted-foreground font-semibold text-lg transition-opacity duration-300`,u),t[5]=u,t[6]=d);let f;return t[7]!==r||t[8]!==d?(f=(0,X.jsxs)(`div`,{className:`flex flex-col h-full flex-1 items-center justify-center p-4`,children:[l,(0,X.jsx)(`div`,{className:d,children:r})]}),t[7]=r,t[8]=d,t[9]=f):f=t[9],f};function Ct(e,t){return e===`edit`||e===`home`||e===`gallery`?!0:e===`present`||T(w.includeCode,`false`)||T(w.showCode,`false`)?!1:T(w.showCode,`true`)?!0:t}function wt(e){let t=Ct(e.mode,e.showAppCode),n=e.hasCells&&e.hasCachedOutputs;return{showCode:t,showCachedOutputs:n,canPaint:e.hasCells&&(t||n||e.allCellsIdle)}}var Tt=n(e=>{let t=!1,n=!0;for(let r of Object.values(e(v).cellRuntime))Je(r.output)||(t=!0),r.status!==`idle`&&(n=!1);return{hasCachedOutputs:t,allCellsIdle:n}}),Et=n(e=>e(Tt).hasCachedOutputs),Dt=n(e=>e(Tt).allCellsIdle),Ot=n(e=>wt({mode:e(E),showAppCode:e(Le),hasCells:e(y),hasCachedOutputs:e(Et),allCellsIdle:e(Dt)})),kt=n(e=>e(Ot).canPaint),At=e=>{let t=(0,Z.c)(2),{children:n}=e;if(!Me())return n;let r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(jt,{children:n}),t[0]=n,t[1]=r),r},jt=e=>{let t=(0,Z.c)(8),{children:n}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let{error:a}=rt(Nt,i),o=r(kt),s=(0,Q.useRef)(!1),c,l;if(t[1]!==o||t[2]!==a?(c=()=>{a&&o&&!s.current&&(s.current=!0,C.error(`Pyodide failed to initialize`,a),et({title:`Failed to start the notebook runtime`,description:st(a),variant:`danger`}))},l=[a,o],t[1]=o,t[2]=a,t[3]=c,t[4]=l):(c=t[3],l=t[4]),(0,Q.useEffect)(c,l),a&&!o)throw a;let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(Mt,{}),t[5]=u):u=t[5];let d;return t[6]===n?d=t[7]:(d=(0,X.jsx)(xt,{requires:kt,fallback:u,children:n}),t[6]=n,t[7]=d),d},Mt=()=>{let e=(0,Z.c)(2),t=r(A),n=t.kind===`loading`?t.message:`Loading…`,i;return e[0]===n?i=e[1]:(i=(0,X.jsx)(St,{title:n}),e[0]=n,e[1]=i),i};async function Nt(){return await we.INSTANCE.initialized.promise,!0}var Pt={idle:`./favicon.ico`,success:`data:image/x-icon;base64,AAABAAEAMDAAAAEACACoDgAAFgAAACgAAAAwAAAAYAAAAAEACAAAAAAAAAkAAAAAAAAAAAAAAAEAAAABAAAAAAAAXXQAAFd3AwBWeAQAVngEAFd4AwBXeAQAVnkEAFh3AwBXdwQAVXcGAFd4BQBXeAQAWHgEAFd6AwBXeAMAVnkEAFZ5AwBXdwQAV3cFAFd4BABYeAQAV3gEAFh4BABXeAQA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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//+AAf//AAD///////8AAP///////wAA`};async function $(e){return Pt[e]}function Ft(){let e=document.querySelector(`link[rel~='icon']`);if(e)return e;let t=document.createElement(`link`);return t.rel=`icon`,document.head.append(t),t}function It(e){if(document.visibilityState===`visible`)return;let t=async()=>{e===0?new Notification(`Execution completed`,{body:`Your notebook run completed successfully.`,icon:await $(`success`)}):new Notification(`Execution failed`,{body:`Your notebook run encountered ${e} error(s).`,icon:await $(`error`)})};!(`Notification`in window)||Notification.permission===`denied`||(Notification.permission===`granted`?t():Notification.permission==="default"&&Notification.requestPermission().then(e=>{e===`granted`&&t()}))}var Lt=e=>{let t=(0,Z.c)(11),{isRunning:n}=e,r=c(),i,a;t[0]!==r||t[1]!==n?(i=()=>{let e=Ft();!n&&e.href.includes(`favicon`)||(async()=>{let t;if(t=n?`running`:r.length===0?`success`:`error`,e.href=await $(t),!document.hasFocus())return;let i=setTimeout(async()=>{e.href=await $(`idle`)},3e3);return()=>clearTimeout(i)})()},a=[n,r],t[0]=r,t[1]=n,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,Q.useEffect)(i,a);let o=K(n)??n,s,l;t[4]!==r||t[5]!==n||t[6]!==o?(s=()=>{o&&!n&&It(r.length)},l=[r,o,n],t[4]=r,t[5]=n,t[6]=o,t[7]=s,t[8]=l):(s=t[7],l=t[8]),(0,Q.useEffect)(s,l);let u;return t[9]===n?u=t[10]:(u=async e=>{if(!n){let e=Ft();e.href=await $(`idle`)}},t[9]=n,t[10]=u),Oe(window,`focus`,u),null};function Rt(){let{cellIds:e,cellRuntime:t}=i.get(v),n=e.inOrderIds.find(e=>t[e]?.status===`running`);n&&ut(n,`focus`)}var zt=e=>{let t=(0,Z.c)(18),{connection:n,isRunning:i,onReconnect:a}=e,{mode:o}=r(D),s=n.state===k.CLOSED&&(o===`read`||n.code!==O.KERNEL_STARTUP_ERROR),c=n.state===k.OPEN,l=s&&n.code===O.KERNEL_DISCONNECTED,u;t[0]===s?u=t[1]:(u=s&&(0,X.jsx)(Ut,{}),t[0]=s,t[1]=u);let d=o===`read`?`fixed`:`absolute`,f;t[2]===d?f=t[3]:(f=M(`z-50 top-4 left-4`,d),t[2]=d,t[3]=f);let p;t[4]!==c||t[5]!==i?(p=c&&i&&(0,X.jsx)(Ht,{}),t[4]=c,t[5]=i,t[6]=p):p=t[6];let m;t[7]!==l||t[8]!==s||t[9]!==a?(m=s&&(0,X.jsx)(Vt,{onReconnect:l?a:void 0}),t[7]=l,t[8]=s,t[9]=a,t[10]=m):m=t[10];let h;t[11]!==f||t[12]!==p||t[13]!==m?(h=(0,X.jsxs)(`div`,{className:f,children:[p,m]}),t[11]=f,t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;return t[15]!==u||t[16]!==h?(g=(0,X.jsxs)(X.Fragment,{children:[u,h]}),t[15]=u,t[16]=h,t[17]=g):g=t[17],g},Bt=`print:hidden pointer-events-auto hover:cursor-pointer`,Vt=e=>{let t=(0,Z.c)(12),{onReconnect:n}=e,r=!n,i=r?`App disconnected`:`App disconnected — click to reconnect`,a=r?0:-1,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=M(Bt,`bg-transparent border-0 p-0`),t[0]=o):o=t[0];let s=r?`App disconnected`:`Reconnect to app`,c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(yt,{className:`w-[25px] h-[25px] text-(--red-11)`}),t[1]=c):c=t[1];let l;t[2]!==r||t[3]!==n||t[4]!==s?(l=(0,X.jsx)(`button`,{type:`button`,className:o,"aria-label":s,"data-testid":`disconnected-indicator`,onClick:n,disabled:r,children:c}),t[2]=r,t[3]=n,t[4]=s,t[5]=l):l=t[5];let u;t[6]!==a||t[7]!==l?(u=(0,X.jsx)(`span`,{tabIndex:a,children:l}),t[6]=a,t[7]=l,t[8]=u):u=t[8];let d;return t[9]!==i||t[10]!==u?(d=(0,X.jsx)(U,{content:i,children:u}),t[9]=i,t[10]=u,t[11]=d):d=t[11],d},Ht=()=>{let e=(0,Z.c)(6),t=r(_),n=t?`Scratchpad is running`:`Jump to running cell`,i=t?void 0:Rt,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(_t,{className:`running-app-icon`,size:30,strokeWidth:1}),e[0]=a):a=e[0];let o;e[1]===i?o=e[2]:(o=(0,X.jsx)(`div`,{className:Bt,"data-testid":`loading-indicator`,onClick:i,children:a}),e[1]=i,e[2]=o);let s;return e[3]!==o||e[4]!==n?(s=(0,X.jsx)(U,{content:n,side:`right`,children:o}),e[3]=o,e[4]=n,e[5]=s):s=e[5],s},Ut=()=>{let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`noise`}),(0,X.jsx)(`div`,{className:`disconnected-gradient`})]}),e[0]=t):t=e[0],t},Wt=R,Gt=He,Kt=P(B),qt=Q.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=M(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(z,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});qt.displayName=z.displayName;var Jt=j(`fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,{variants:{side:{top:`inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,bottom:`inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,left:`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,right:`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`}},defaultVariants:{side:`right`}}),Yt=Q.forwardRef((e,t)=>{let n=(0,Z.c)(15),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({side:o,className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s=o===void 0?`right`:o,c;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(qt,{}),n[5]=c):c=n[5];let l;n[6]!==i||n[7]!==s?(l=M(Jt({side:s}),i),n[6]=i,n[7]=s,n[8]=l):l=n[8];let u;n[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsxs)(Ue,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,X.jsx)(ct,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),n[9]=u):u=n[9];let d;return n[10]!==r||n[11]!==a||n[12]!==t||n[13]!==l?(d=(0,X.jsx)(Kt,{children:(0,X.jsxs)(Ve,{children:[c,(0,X.jsxs)(L,{ref:t,className:l,...a,children:[r,u]})]})}),n[10]=r,n[11]=a,n[12]=t,n[13]=l,n[14]=d):d=n[14],d});Yt.displayName=L.displayName;var Xt=Q.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=M(`text-lg font-semibold text-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(I,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Xt.displayName=I.displayName;var Zt=Q.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=M(`text-sm text-muted-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(F,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Zt.displayName=F.displayName;var Qt=(0,Q.memo)(()=>{let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(We,{name:V.SIDEBAR}),e[0]=t):t=e[0],t});Qt.displayName=`SidebarSlot`;var $t=e=>{let t=(0,Z.c)(6),{openWidth:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(Gt,{className:`lg:hidden`,asChild:!0,children:(0,X.jsx)(W,{variant:`ghost`,className:`bg-background`,children:(0,X.jsx)(vt,{className:`w-5 h-5`})})}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i={maxWidth:n},t[1]=n,t[2]=i);let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Qt,{}),t[3]=a):a=t[3];let o;return t[4]===i?o=t[5]:(o=(0,X.jsxs)(Wt,{children:[r,(0,X.jsx)(Yt,{className:`w-full px-3 h-full flex flex-col overflow-y-auto`,style:i,side:`left`,children:a})]}),t[4]=i,t[5]=o),o},en=e=>{let t=(0,Z.c)(7),{isOpen:n,toggle:r}=e,i=n?`rotate-0`:`rotate-180`,a;t[0]===i?a=t[1]:(a=M(`h-5 w-5 transition-transform ease-in-out duration-700`,i),t[0]=i,t[1]=a);let o;t[2]===a?o=t[3]:(o=(0,X.jsx)(H,{className:a}),t[2]=a,t[3]=o);let s;return t[4]!==o||t[5]!==r?(s=(0,X.jsx)(`div`,{className:`invisible lg:visible absolute top-[12px] right-[16px] z-20`,children:(0,X.jsx)(W,{onClick:r,className:`w-10 h-8`,variant:`ghost`,size:`icon`,children:o})}),t[4]=o,t[5]=r,t[6]=s):s=t[6],s},tn=e=>{let t=(0,Z.c)(11),{isOpen:n,toggle:r,width:i}=e,a=n?i:De,o;t[0]===a?o=t[1]:(o={width:a},t[0]=a,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=M(`app-sidebar auto-collapse-nav`,`top-0 left-0 z-20 h-full hidden lg:block relative transition-[width] ease-in-out duration-300`),t[2]=s):s=t[2];let c;t[3]!==n||t[4]!==r?(c=(0,X.jsx)(en,{isOpen:n,toggle:r}),t[3]=n,t[4]=r,t[5]=c):c=t[5];let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(`div`,{className:`relative h-full flex flex-col px-3 pb-16 pt-14 overflow-y-auto shadow-sm border-l`,children:(0,X.jsx)(Qt,{})}),t[6]=l):l=t[6];let u;return t[7]!==n||t[8]!==o||t[9]!==c?(u=(0,X.jsxs)(`aside`,{"data-expanded":n,style:o,className:s,children:[c,l]}),t[7]=n,t[8]=o,t[9]=c,t[10]=u):u=t[10],u},nn=e=>{let n=(0,Z.c)(15),{children:r}=e,[i,a]=t(Te),{isOpen:o,width:s}=i;if(Ge(V.SIDEBAR).length===0)return r;let c;n[0]===s?c=n[1]:(c=Ce(s),n[0]=s,n[1]=c);let l=c,u;n[2]!==a||n[3]!==o?(u=()=>a({type:`toggle`,isOpen:!o}),n[2]=a,n[3]=o,n[4]=u):u=n[4];let d;n[5]!==o||n[6]!==l||n[7]!==u?(d=(0,X.jsx)(tn,{isOpen:o,width:l,toggle:u}),n[5]=o,n[6]=l,n[7]=u,n[8]=d):d=n[8];let f;n[9]===l?f=n[10]:(f=(0,X.jsx)(`div`,{className:`absolute top-3 left-4 flex items-center z-50`,children:(0,X.jsx)($t,{openWidth:l})}),n[9]=l,n[10]=f);let p;return n[11]!==r||n[12]!==d||n[13]!==f?(p=(0,X.jsxs)(`div`,{className:`inset-0 absolute flex`,children:[d,f,r]}),n[11]=r,n[12]=d,n[13]=f,n[14]=p):p=n[14],p},rn=e=>{let t=(0,Z.c)(19),{width:n,connection:r,isRunning:i,children:a,onReconnect:o}=e,s=r.state,c;t[0]===i?c=t[1]:(c=(0,X.jsx)(Lt,{isRunning:i}),t[0]=i,t[1]=c);let l;t[2]!==r||t[3]!==i||t[4]!==o?(l=(0,X.jsx)(zt,{connection:r,isRunning:i,onReconnect:o}),t[2]=r,t[3]=i,t[4]=o,t[5]=l):l=t[5];let u=r.state===k.CLOSED&&r.code!==O.KERNEL_STARTUP_ERROR&&`disconnected`,d=n===`full`&&`config-width-full`,f=n===`columns`?`overflow-x-auto`:`overflow-x-auto sm:overflow-x-hidden`,p;t[6]!==u||t[7]!==d||t[8]!==f?(p=M(`mathjax_ignore`,u,`bg-background w-full h-full text-textColor`,`flex flex-col overflow-y-auto`,d,f,`print:height-fit`),t[6]=u,t[7]=d,t[8]=f,t[9]=p):p=t[9];let m;t[10]!==a||t[11]!==s||t[12]!==p||t[13]!==n?(m=(0,X.jsx)(At,{children:(0,X.jsx)(nn,{children:(0,X.jsx)(`div`,{id:`App`,"data-config-width":n,"data-connection-state":s,className:p,children:a})})}),t[10]=a,t[11]=s,t[12]=p,t[13]=n,t[14]=m):m=t[14];let h;return t[15]!==c||t[16]!==l||t[17]!==m?(h=(0,X.jsxs)(X.Fragment,{children:[c,l,m]}),t[15]=c,t[16]=l,t[17]=m,t[18]=h):h=t[18],h},an=(0,Q.memo)(e=>{let t=(0,Z.c)(9),{appConfig:n,mode:i,children:a}=e,{selectedLayout:o}=Qe();if(!r(Ae)&&(i===`edit`||i===`present`&&o===`vertical`))return a;let s=i===`read`,c;t[0]!==o||t[1]!==s?(c=$e({selectedLayout:o,isReading:s,searchParams:new URLSearchParams(window.location.search)}),t[0]=o,t[1]=s,t[2]=c):c=t[2];let l=c,u;t[3]===l?u=t[4]:(u=q.find(e=>e.type===l),t[3]=l,t[4]=u);let d=u;if(!d)return a;let f;return t[5]!==n||t[6]!==i||t[7]!==d?(f=(0,X.jsx)(on,{appConfig:n,mode:i,plugin:d}),t[5]=n,t[6]=i,t[7]=d,t[8]=f):f=t[8],f});an.displayName=`CellsRenderer`;var on=e=>{let t=(0,Z.c)(12),{appConfig:n,mode:r,plugin:i}=e,a=Qe(),o=h(),{setCurrentLayoutData:s}=Ze(),c,l;t[0]!==a||t[1]!==o||t[2]!==i?(c=fe(o),l=Y({state:a,plugin:i,cells:c}),t[0]=a,t[1]=o,t[2]=i,t[3]=c,t[4]=l):(c=t[3],l=t[4]);let u=l,d=i.Component,f;return t[5]!==d||t[6]!==n||t[7]!==c||t[8]!==u||t[9]!==r||t[10]!==s?(f=(0,X.jsx)(d,{appConfig:n,mode:r,cells:c,layout:u,setLayout:s}),t[5]=d,t[6]=n,t[7]=c,t[8]=u,t[9]=r,t[10]=s,t[11]=f):f=t[11],f},sn=class e{hasStarted=!1;static get INSTANCE(){let t=`_marimo_private_RuntimeState`;return window[t]||(window[t]=new e(S)),window[t]}_sendComponentValues;uiElementRegistry;constructor(e){this.uiElementRegistry=e}get sendComponentValues(){if(!this._sendComponentValues)throw Error(`sendComponentValues is not set`);return this._sendComponentValues}start(e){if(this.hasStarted){C.warn(`RuntimeState already started`);return}this._sendComponentValues=e,document.addEventListener(lt.TYPE,this.handleReadyEvent),this.hasStarted=!0}stop(){if(!this.hasStarted){C.warn(`RuntimeState already stopped`);return}document.removeEventListener(lt.TYPE,this.handleReadyEvent),this.hasStarted=!1}handleReadyEvent=e=>{let t=e.detail.objectId;if(!this.uiElementRegistry.has(t))return;let n=this.uiElementRegistry.lookupValue(t);n!==void 0&&this.sendComponentValues({objectIds:[t],values:[n]}).catch(e=>{C.warn(e)})}},cn=`MARIMO_TRANSPORT_EXHAUSTED`,ln=class{inner;closeWrappers=new WeakMap;constructor(e){this.inner=new ht(e,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4})}get readyState(){return this.inner.readyState}reconnect(e,t){this.inner.reconnect(e,t)}close(){this.inner.close()}send(e){this.inner.send(e)}addEventListener(e,t){if(e===`close`){let e=t;if(this.closeWrappers.has(e))return;let n=t=>{this.inner.retryCount>=10?e(new CloseEvent(`close`,{code:t.code,reason:cn,wasClean:t.wasClean})):e(t)};this.closeWrappers.set(e,n),this.inner.addEventListener(`close`,n);return}this.inner.addEventListener(e,t)}removeEventListener(e,t){if(e===`close`){let e=t,n=this.closeWrappers.get(e);n&&(this.closeWrappers.delete(e),this.inner.removeEventListener(`close`,n));return}this.inner.removeEventListener(e,t)}},un=1e4,dn=1e3,fn=1e4,pn=1.3,mn=1006,hn=class{subscriptions=new x;urlProvider;headersProvider;abortController=null;retryTimer=null;retryCount=0;userClosed=!1;state=WebSocket.CLOSED;constructor(e,t=()=>({})){this.urlProvider=e,this.headersProvider=t}get readyState(){return this.state}reconnect(e,t){this.userClosed=!1,this.retryCount=0,this.clearRetryTimer(),this.abortController?.abort(),this.connect()}close(){this.userClosed=!0,this.clearRetryTimer(),this.state=WebSocket.CLOSED,this.abortController?.abort(),this.abortController=null}send(e){C.warn(`SseTransport does not support send(); dropping message`)}addEventListener(e,t){this.subscriptions.addSubscription(e,t)}removeEventListener(e,t){this.subscriptions.removeSubscription(e,t)}connect(){this.state=WebSocket.CONNECTING,this.run()}async run(){let e=new AbortController;this.abortController=e;let t=setTimeout(()=>e.abort(),un),n=null;try{let r=await fetch(this.urlProvider(),{headers:{...this.headersProvider(),Accept:`text/event-stream`},signal:e.signal});if(clearTimeout(t),!r.ok||r.body===null)throw Error(`Unexpected SSE response: ${r.status}`);this.state=WebSocket.OPEN,this.subscriptions.notify(`open`,new Event(`open`)),n=await this.readEvents(r.body)}catch(n){if(clearTimeout(t),this.isSuperseded(e))return;C.warn(`SSE connection failed`,n),this.subscriptions.notify(`error`,new Event(`error`))}if(this.isSuperseded(e))return;e.abort(),this.state=WebSocket.CLOSED,this.retryCount+=1;let r=this.retryCount>=10;this.subscriptions.notify(`close`,new CloseEvent(`close`,{code:n?.code??mn,reason:r?cn:n?.reason??``,wasClean:n!==null})),!(r||this.isSuperseded(e))&&this.scheduleRetry()}isSuperseded(e){return this.userClosed||this.abortController!==e}scheduleRetry(){this.clearRetryTimer(),this.state=WebSocket.CONNECTING;let e=Math.min(dn*pn**this.retryCount,fn);this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.connect()},e)}clearRetryTimer(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null)}async readEvents(e){let t=e.getReader(),n=new TextDecoder,r=``,i=null,a=[],o=()=>{if(a.length===0)return i=null,null;let e=a.join(`
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,r as i,u as a}from"./useEvent-Dc9HkKI2.js";import{t as o}from"./react-CUdNIagt.js";import{$ as s,A as c,B as l,D as u,Dt as d,Et as f,Gn as p,Hr as m,I as h,Ii as g,Jn as ee,Kn as te,Mr as ne,Oo as re,Ot as ie,R as ae,So as oe,St as se,T as _,Vi as ce,Wn as le,b as v,ei as ue,g as y,h as de,l as fe,mr as pe,pr as me,qn as he}from"./cells-CxY8RSp7.js";import{t as b}from"./compiler-runtime-BQ9S8nyo.js";import{D as ge,d as _e,w as ve}from"./config-Cyum2gRs.js";import{_ as x,c as ye,g as be,i as xe,m as Se,n as Ce,o as S,p as we,r as Te,s as Ee,t as De}from"./state-sbCCk7ZP.js";import{g as C,t as Oe}from"./useEventListener-IRzG-0mH.js";import{t as ke}from"./objects-snlMn4yk.js";import{i as w}from"./utils-B4K466FK.js";import{a as T,f as E,m as Ae,r as je,v as D}from"./session-BykGt6S3.js";import{M as Me,T as O,_ as Ne,l as Pe,o as Fe,w as k,x as Ie}from"./config-D_c_6ce1.js";import{r as Le}from"./state-YaAkDV8S.js";import{i as Re,o as A,r as ze}from"./state-ja7GWeCS.js";import{r as Be}from"./ErrorBoundary-CG6gtgym.js";import{n as j,t as M}from"./cn-ldLVeaqm.js";import{t as N}from"./jsx-runtime-B74pBk57.js";import{i as P,s as Ve}from"./fullscreen-DEBblJKh.js";import{a as F,c as I,i as L,l as He,n as R,o as z,r as Ue,s as B}from"./use-restore-focus-GUh2Nd8Z.js";import{Dt as We,Ot as Ge,St as V}from"./JsonOutput-DCGUcLVV.js";import{p as H}from"./download-CPMAf7re.js";import{t as U}from"./tooltip-B5pI8o2n.js";import{t as W}from"./button-M49xxKoi.js";import{t as G}from"./createLucideIcon-rHn2EdoM.js";import{P as K,a as q,c as J,i as Y,n as Ke}from"./layout-CSLw6wGo.js";import{d as qe,n as Je}from"./markdown-renderer-mDlWBE1M.js";import{v as Ye}from"./write-secret-modal-BcosCmZy.js";import{n as Xe}from"./spinner-CGdRKCnw.js";import{c as Ze,l as Qe,s as $e}from"./readonly-python-code-DcYhdd1B.js";import{t as et}from"./use-toast-CC89xOwH.js";import{i as tt}from"./strings-hlCLC-K1.js";import{t as nt}from"./requests-yTHMxhVa.js";import{n as rt}from"./useAsyncData-DucTwMkf.js";import{t as it}from"./RenderHTML-C7QcdAgB.js";import{t as at}from"./package-data-BwaspaKJ.js";import{f as ot}from"./useInstallPackage-HTUlGg0U.js";import{a as st}from"./errors-D9vyuMar.js";import{s as ct}from"./react-icons.esm-C6SMwKZH.js";import{r as lt}from"./events-CbeVJ6OD.js";import{i as ut}from"./cell-link-DC1UZQr_.js";import{t as dt}from"./requests-DFPPfagc.js";import{r as ft,s as pt,t as mt}from"./state-B2ZbImvm.js";import{t as ht}from"./ws-BXWY541V.js";import{n as gt}from"./runs-DyluVj69.js";var _t=G(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),vt=G(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),yt=G(`unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),X=N(),Z=b(),Q=e(o(),1);function bt(e){let t=(0,Z.c)(3),[n,r]=(0,Q.useState)(e<=0),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(e<=0){r(!0);return}r(!1);let t=setTimeout(()=>r(!0),e);return()=>clearTimeout(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,Q.useLayoutEffect)(i,a),n}var xt=e=>{let{requires:t,fallback:n,delay:i,children:a}=e,o=n===void 0?null:n,s=i===void 0?0:i,c=r(t),l=bt(c?0:s);return c?a:l?o:null},St=e=>{let t=(0,Z.c)(10),{title:n}=e,[r,i]=(0,Q.useState)(n),[a,o]=(0,Q.useState)(!0),s,c;t[0]!==r||t[1]!==n?(s=()=>{if(n!==r){o(!1);let e=setTimeout(()=>{i(n),o(!0)},300);return()=>clearTimeout(e)}},c=[n,r],t[0]=r,t[1]=n,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,Q.useEffect)(s,c);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(Xe,{className:`size-20 animate-spin text-primary`,"data-testid":`large-spinner`,strokeWidth:1}),t[4]=l):l=t[4];let u=a?`opacity-100`:`opacity-0`,d;t[5]===u?d=t[6]:(d=M(`mt-2 text-muted-foreground font-semibold text-lg transition-opacity duration-300`,u),t[5]=u,t[6]=d);let f;return t[7]!==r||t[8]!==d?(f=(0,X.jsxs)(`div`,{className:`flex flex-col h-full flex-1 items-center justify-center p-4`,children:[l,(0,X.jsx)(`div`,{className:d,children:r})]}),t[7]=r,t[8]=d,t[9]=f):f=t[9],f};function Ct(e,t){return e===`edit`||e===`home`||e===`gallery`?!0:e===`present`||T(w.includeCode,`false`)||T(w.showCode,`false`)?!1:T(w.showCode,`true`)?!0:t}function wt(e){let t=Ct(e.mode,e.showAppCode),n=e.hasCells&&e.hasCachedOutputs;return{showCode:t,showCachedOutputs:n,canPaint:e.hasCells&&(t||n||e.allCellsIdle)}}var Tt=n(e=>{let t=!1,n=!0;for(let r of Object.values(e(v).cellRuntime))Je(r.output)||(t=!0),r.status!==`idle`&&(n=!1);return{hasCachedOutputs:t,allCellsIdle:n}}),Et=n(e=>e(Tt).hasCachedOutputs),Dt=n(e=>e(Tt).allCellsIdle),Ot=n(e=>wt({mode:e(E),showAppCode:e(Le),hasCells:e(y),hasCachedOutputs:e(Et),allCellsIdle:e(Dt)})),kt=n(e=>e(Ot).canPaint),At=e=>{let t=(0,Z.c)(2),{children:n}=e;if(!Me())return n;let r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(jt,{children:n}),t[0]=n,t[1]=r),r},jt=e=>{let t=(0,Z.c)(8),{children:n}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let{error:a}=rt(Nt,i),o=r(kt),s=(0,Q.useRef)(!1),c,l;if(t[1]!==o||t[2]!==a?(c=()=>{a&&o&&!s.current&&(s.current=!0,C.error(`Pyodide failed to initialize`,a),et({title:`Failed to start the notebook runtime`,description:st(a),variant:`danger`}))},l=[a,o],t[1]=o,t[2]=a,t[3]=c,t[4]=l):(c=t[3],l=t[4]),(0,Q.useEffect)(c,l),a&&!o)throw a;let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(Mt,{}),t[5]=u):u=t[5];let d;return t[6]===n?d=t[7]:(d=(0,X.jsx)(xt,{requires:kt,fallback:u,children:n}),t[6]=n,t[7]=d),d},Mt=()=>{let e=(0,Z.c)(2),t=r(A),n=t.kind===`loading`?t.message:`Loading…`,i;return e[0]===n?i=e[1]:(i=(0,X.jsx)(St,{title:n}),e[0]=n,e[1]=i),i};async function Nt(){return await we.INSTANCE.initialized.promise,!0}var Pt={idle:`./favicon.ico`,success:`data:image/x-icon;base64,AAABAAEAMDAAAAEACACoDgAAFgAAACgAAAAwAAAAYAAAAAEACAAAAAAAAAkAAAAAAAAAAAAAAAEAAAABAAAAAAAAXXQAAFd3AwBWeAQAVngEAFd4AwBXeAQAVnkEAFh3AwBXdwQAVXcGAFd4BQBXeAQAWHgEAFd6AwBXeAMAVnkEAFZ5AwBXdwQAV3cFAFd4BABYeAQAV3gEAFh4BABXeAQA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAsZGRkZGRkZDA0ODxoaGhoPDg0MGRkZGRkZGQsAAAAAAAAAAAAAAAAAAAAAAAAAAAAKBBkZGRkZGRkZGRkZGRkZGRkZGRkZGRkECgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgJGRkZGRkZGRkZGRkZGRkZGRkZCQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgcZGRkZGRkZGRkZGRkZGQcCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAgMEBQYZGQYFBAMCAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////AAD///////8AAP//gAH//wAA//4AAH//AAD/+AAAH/8AAP/gAAAH/wAA/8AAAAP/AAD/gAAAAf8AAP8AAAAA/wAA/gAAAAB/AAD8AAAAAD8AAPgAAAAAHwAA+AAAAAAfAADwAAAAAA8AAPAAAAAADwAA4AAAAAAHAADgAAAAAAcAAMAAAAAAAwAAwAAAAAADAADAAAAAAAMAAMAAAAAAAwAAwAAAAAADAADAAAAAAAMAAMAAAAAAAwAAwAAAAAADAADAAAAAAAMAAMAAAAAAAwAAwAAAAAADAADAAAAAAAMAAMAAAAAAAwAAwAAAAAADAADgAAAAAAcAAOAAAAAABwAA8AAAAAAPAADwAAAAAA8AAPgAAAAAHwAA+AAAAAAfAAD8AAAAAD8AAP4AAAAAfwAA/wAAAAD/AAD/gAAAAf8AAP/AAAAD/wAA/+AAAAf/AAD/+AAAH/8AAP/+AAB//wAA//+AAf//AAD///////8AAP///////wAA`};async function $(e){return Pt[e]}function Ft(){let e=document.querySelector(`link[rel~='icon']`);if(e)return e;let t=document.createElement(`link`);return t.rel=`icon`,document.head.append(t),t}function It(e){if(document.visibilityState===`visible`)return;let t=async()=>{e===0?new Notification(`Execution completed`,{body:`Your notebook run completed successfully.`,icon:await $(`success`)}):new Notification(`Execution failed`,{body:`Your notebook run encountered ${e} error(s).`,icon:await $(`error`)})};!(`Notification`in window)||Notification.permission===`denied`||(Notification.permission===`granted`?t():Notification.permission==="default"&&Notification.requestPermission().then(e=>{e===`granted`&&t()}))}var Lt=e=>{let t=(0,Z.c)(11),{isRunning:n}=e,r=c(),i,a;t[0]!==r||t[1]!==n?(i=()=>{let e=Ft();!n&&e.href.includes(`favicon`)||(async()=>{let t;if(t=n?`running`:r.length===0?`success`:`error`,e.href=await $(t),!document.hasFocus())return;let i=setTimeout(async()=>{e.href=await $(`idle`)},3e3);return()=>clearTimeout(i)})()},a=[n,r],t[0]=r,t[1]=n,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,Q.useEffect)(i,a);let o=K(n)??n,s,l;t[4]!==r||t[5]!==n||t[6]!==o?(s=()=>{o&&!n&&It(r.length)},l=[r,o,n],t[4]=r,t[5]=n,t[6]=o,t[7]=s,t[8]=l):(s=t[7],l=t[8]),(0,Q.useEffect)(s,l);let u;return t[9]===n?u=t[10]:(u=async e=>{if(!n){let e=Ft();e.href=await $(`idle`)}},t[9]=n,t[10]=u),Oe(window,`focus`,u),null};function Rt(){let{cellIds:e,cellRuntime:t}=i.get(v),n=e.inOrderIds.find(e=>t[e]?.status===`running`);n&&ut(n,`focus`)}var zt=e=>{let t=(0,Z.c)(18),{connection:n,isRunning:i,onReconnect:a}=e,{mode:o}=r(D),s=n.state===k.CLOSED&&(o===`read`||n.code!==O.KERNEL_STARTUP_ERROR),c=n.state===k.OPEN,l=s&&n.code===O.KERNEL_DISCONNECTED,u;t[0]===s?u=t[1]:(u=s&&(0,X.jsx)(Ut,{}),t[0]=s,t[1]=u);let d=o===`read`?`fixed`:`absolute`,f;t[2]===d?f=t[3]:(f=M(`z-50 top-4 left-4`,d),t[2]=d,t[3]=f);let p;t[4]!==c||t[5]!==i?(p=c&&i&&(0,X.jsx)(Ht,{}),t[4]=c,t[5]=i,t[6]=p):p=t[6];let m;t[7]!==l||t[8]!==s||t[9]!==a?(m=s&&(0,X.jsx)(Vt,{onReconnect:l?a:void 0}),t[7]=l,t[8]=s,t[9]=a,t[10]=m):m=t[10];let h;t[11]!==f||t[12]!==p||t[13]!==m?(h=(0,X.jsxs)(`div`,{className:f,children:[p,m]}),t[11]=f,t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;return t[15]!==u||t[16]!==h?(g=(0,X.jsxs)(X.Fragment,{children:[u,h]}),t[15]=u,t[16]=h,t[17]=g):g=t[17],g},Bt=`print:hidden pointer-events-auto hover:cursor-pointer`,Vt=e=>{let t=(0,Z.c)(12),{onReconnect:n}=e,r=!n,i=r?`App disconnected`:`App disconnected — click to reconnect`,a=r?0:-1,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=M(Bt,`bg-transparent border-0 p-0`),t[0]=o):o=t[0];let s=r?`App disconnected`:`Reconnect to app`,c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(yt,{className:`w-[25px] h-[25px] text-(--red-11)`}),t[1]=c):c=t[1];let l;t[2]!==r||t[3]!==n||t[4]!==s?(l=(0,X.jsx)(`button`,{type:`button`,className:o,"aria-label":s,"data-testid":`disconnected-indicator`,onClick:n,disabled:r,children:c}),t[2]=r,t[3]=n,t[4]=s,t[5]=l):l=t[5];let u;t[6]!==a||t[7]!==l?(u=(0,X.jsx)(`span`,{tabIndex:a,children:l}),t[6]=a,t[7]=l,t[8]=u):u=t[8];let d;return t[9]!==i||t[10]!==u?(d=(0,X.jsx)(U,{content:i,children:u}),t[9]=i,t[10]=u,t[11]=d):d=t[11],d},Ht=()=>{let e=(0,Z.c)(6),t=r(_),n=t?`Scratchpad is running`:`Jump to running cell`,i=t?void 0:Rt,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(_t,{className:`running-app-icon`,size:30,strokeWidth:1}),e[0]=a):a=e[0];let o;e[1]===i?o=e[2]:(o=(0,X.jsx)(`div`,{className:Bt,"data-testid":`loading-indicator`,onClick:i,children:a}),e[1]=i,e[2]=o);let s;return e[3]!==o||e[4]!==n?(s=(0,X.jsx)(U,{content:n,side:`right`,children:o}),e[3]=o,e[4]=n,e[5]=s):s=e[5],s},Ut=()=>{let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`noise`}),(0,X.jsx)(`div`,{className:`disconnected-gradient`})]}),e[0]=t):t=e[0],t},Wt=R,Gt=He,Kt=P(B),qt=Q.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=M(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(z,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});qt.displayName=z.displayName;var Jt=j(`fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,{variants:{side:{top:`inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,bottom:`inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,left:`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,right:`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`}},defaultVariants:{side:`right`}}),Yt=Q.forwardRef((e,t)=>{let n=(0,Z.c)(15),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({side:o,className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s=o===void 0?`right`:o,c;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(qt,{}),n[5]=c):c=n[5];let l;n[6]!==i||n[7]!==s?(l=M(Jt({side:s}),i),n[6]=i,n[7]=s,n[8]=l):l=n[8];let u;n[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsxs)(Ue,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,X.jsx)(ct,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),n[9]=u):u=n[9];let d;return n[10]!==r||n[11]!==a||n[12]!==t||n[13]!==l?(d=(0,X.jsx)(Kt,{children:(0,X.jsxs)(Ve,{children:[c,(0,X.jsxs)(L,{ref:t,className:l,...a,children:[r,u]})]})}),n[10]=r,n[11]=a,n[12]=t,n[13]=l,n[14]=d):d=n[14],d});Yt.displayName=L.displayName;var Xt=Q.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=M(`text-lg font-semibold text-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(I,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Xt.displayName=I.displayName;var Zt=Q.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=M(`text-sm text-muted-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(F,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Zt.displayName=F.displayName;var Qt=(0,Q.memo)(()=>{let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(We,{name:V.SIDEBAR}),e[0]=t):t=e[0],t});Qt.displayName=`SidebarSlot`;var $t=e=>{let t=(0,Z.c)(6),{openWidth:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(Gt,{className:`lg:hidden`,asChild:!0,children:(0,X.jsx)(W,{variant:`ghost`,className:`bg-background`,children:(0,X.jsx)(vt,{className:`w-5 h-5`})})}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i={maxWidth:n},t[1]=n,t[2]=i);let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Qt,{}),t[3]=a):a=t[3];let o;return t[4]===i?o=t[5]:(o=(0,X.jsxs)(Wt,{children:[r,(0,X.jsx)(Yt,{className:`w-full px-3 h-full flex flex-col overflow-y-auto`,style:i,side:`left`,children:a})]}),t[4]=i,t[5]=o),o},en=e=>{let t=(0,Z.c)(7),{isOpen:n,toggle:r}=e,i=n?`rotate-0`:`rotate-180`,a;t[0]===i?a=t[1]:(a=M(`h-5 w-5 transition-transform ease-in-out duration-700`,i),t[0]=i,t[1]=a);let o;t[2]===a?o=t[3]:(o=(0,X.jsx)(H,{className:a}),t[2]=a,t[3]=o);let s;return t[4]!==o||t[5]!==r?(s=(0,X.jsx)(`div`,{className:`invisible lg:visible absolute top-[12px] right-[16px] z-20`,children:(0,X.jsx)(W,{onClick:r,className:`w-10 h-8`,variant:`ghost`,size:`icon`,children:o})}),t[4]=o,t[5]=r,t[6]=s):s=t[6],s},tn=e=>{let t=(0,Z.c)(11),{isOpen:n,toggle:r,width:i}=e,a=n?i:De,o;t[0]===a?o=t[1]:(o={width:a},t[0]=a,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=M(`app-sidebar auto-collapse-nav`,`top-0 left-0 z-20 h-full hidden lg:block relative transition-[width] ease-in-out duration-300`),t[2]=s):s=t[2];let c;t[3]!==n||t[4]!==r?(c=(0,X.jsx)(en,{isOpen:n,toggle:r}),t[3]=n,t[4]=r,t[5]=c):c=t[5];let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(`div`,{className:`relative h-full flex flex-col px-3 pb-16 pt-14 overflow-y-auto shadow-sm border-l`,children:(0,X.jsx)(Qt,{})}),t[6]=l):l=t[6];let u;return t[7]!==n||t[8]!==o||t[9]!==c?(u=(0,X.jsxs)(`aside`,{"data-expanded":n,style:o,className:s,children:[c,l]}),t[7]=n,t[8]=o,t[9]=c,t[10]=u):u=t[10],u},nn=e=>{let n=(0,Z.c)(15),{children:r}=e,[i,a]=t(Te),{isOpen:o,width:s}=i;if(Ge(V.SIDEBAR).length===0)return r;let c;n[0]===s?c=n[1]:(c=Ce(s),n[0]=s,n[1]=c);let l=c,u;n[2]!==a||n[3]!==o?(u=()=>a({type:`toggle`,isOpen:!o}),n[2]=a,n[3]=o,n[4]=u):u=n[4];let d;n[5]!==o||n[6]!==l||n[7]!==u?(d=(0,X.jsx)(tn,{isOpen:o,width:l,toggle:u}),n[5]=o,n[6]=l,n[7]=u,n[8]=d):d=n[8];let f;n[9]===l?f=n[10]:(f=(0,X.jsx)(`div`,{className:`absolute top-3 left-4 flex items-center z-50`,children:(0,X.jsx)($t,{openWidth:l})}),n[9]=l,n[10]=f);let p;return n[11]!==r||n[12]!==d||n[13]!==f?(p=(0,X.jsxs)(`div`,{className:`inset-0 absolute flex`,children:[d,f,r]}),n[11]=r,n[12]=d,n[13]=f,n[14]=p):p=n[14],p},rn=e=>{let t=(0,Z.c)(19),{width:n,connection:r,isRunning:i,children:a,onReconnect:o}=e,s=r.state,c;t[0]===i?c=t[1]:(c=(0,X.jsx)(Lt,{isRunning:i}),t[0]=i,t[1]=c);let l;t[2]!==r||t[3]!==i||t[4]!==o?(l=(0,X.jsx)(zt,{connection:r,isRunning:i,onReconnect:o}),t[2]=r,t[3]=i,t[4]=o,t[5]=l):l=t[5];let u=r.state===k.CLOSED&&r.code!==O.KERNEL_STARTUP_ERROR&&`disconnected`,d=n===`full`&&`config-width-full`,f=n===`columns`?`overflow-x-auto`:`overflow-x-auto sm:overflow-x-hidden`,p;t[6]!==u||t[7]!==d||t[8]!==f?(p=M(`mathjax_ignore`,u,`bg-background w-full h-full text-textColor`,`flex flex-col overflow-y-auto`,d,f,`print:height-fit`),t[6]=u,t[7]=d,t[8]=f,t[9]=p):p=t[9];let m;t[10]!==a||t[11]!==s||t[12]!==p||t[13]!==n?(m=(0,X.jsx)(At,{children:(0,X.jsx)(nn,{children:(0,X.jsx)(`div`,{id:`App`,"data-config-width":n,"data-connection-state":s,className:p,children:a})})}),t[10]=a,t[11]=s,t[12]=p,t[13]=n,t[14]=m):m=t[14];let h;return t[15]!==c||t[16]!==l||t[17]!==m?(h=(0,X.jsxs)(X.Fragment,{children:[c,l,m]}),t[15]=c,t[16]=l,t[17]=m,t[18]=h):h=t[18],h},an=(0,Q.memo)(e=>{let t=(0,Z.c)(9),{appConfig:n,mode:i,children:a}=e,{selectedLayout:o}=Qe();if(!r(Ae)&&(i===`edit`||i===`present`&&o===`vertical`))return a;let s=i===`read`,c;t[0]!==o||t[1]!==s?(c=$e({selectedLayout:o,isReading:s,searchParams:new URLSearchParams(window.location.search)}),t[0]=o,t[1]=s,t[2]=c):c=t[2];let l=c,u;t[3]===l?u=t[4]:(u=q.find(e=>e.type===l),t[3]=l,t[4]=u);let d=u;if(!d)return a;let f;return t[5]!==n||t[6]!==i||t[7]!==d?(f=(0,X.jsx)(on,{appConfig:n,mode:i,plugin:d}),t[5]=n,t[6]=i,t[7]=d,t[8]=f):f=t[8],f});an.displayName=`CellsRenderer`;var on=e=>{let t=(0,Z.c)(12),{appConfig:n,mode:r,plugin:i}=e,a=Qe(),o=h(),{setCurrentLayoutData:s}=Ze(),c,l;t[0]!==a||t[1]!==o||t[2]!==i?(c=fe(o),l=Y({state:a,plugin:i,cells:c}),t[0]=a,t[1]=o,t[2]=i,t[3]=c,t[4]=l):(c=t[3],l=t[4]);let u=l,d=i.Component,f;return t[5]!==d||t[6]!==n||t[7]!==c||t[8]!==u||t[9]!==r||t[10]!==s?(f=(0,X.jsx)(d,{appConfig:n,mode:r,cells:c,layout:u,setLayout:s}),t[5]=d,t[6]=n,t[7]=c,t[8]=u,t[9]=r,t[10]=s,t[11]=f):f=t[11],f},sn=class e{hasStarted=!1;static get INSTANCE(){let t=`_marimo_private_RuntimeState`;return window[t]||(window[t]=new e(S)),window[t]}_sendComponentValues;uiElementRegistry;constructor(e){this.uiElementRegistry=e}get sendComponentValues(){if(!this._sendComponentValues)throw Error(`sendComponentValues is not set`);return this._sendComponentValues}start(e){if(this.hasStarted){C.warn(`RuntimeState already started`);return}this._sendComponentValues=e,document.addEventListener(lt.TYPE,this.handleReadyEvent),this.hasStarted=!0}stop(){if(!this.hasStarted){C.warn(`RuntimeState already stopped`);return}document.removeEventListener(lt.TYPE,this.handleReadyEvent),this.hasStarted=!1}handleReadyEvent=e=>{let t=e.detail.objectId;if(!this.uiElementRegistry.has(t))return;let n=this.uiElementRegistry.lookupValue(t);n!==void 0&&this.sendComponentValues({objectIds:[t],values:[n]}).catch(e=>{C.warn(e)})}},cn=`MARIMO_TRANSPORT_EXHAUSTED`,ln=class{inner;closeWrappers=new WeakMap;constructor(e){this.inner=new ht(e,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4})}get readyState(){return this.inner.readyState}reconnect(e,t){this.inner.reconnect(e,t)}close(){this.inner.close()}send(e){this.inner.send(e)}addEventListener(e,t){if(e===`close`){let e=t;if(this.closeWrappers.has(e))return;let n=t=>{this.inner.retryCount>=10?e(new CloseEvent(`close`,{code:t.code,reason:cn,wasClean:t.wasClean})):e(t)};this.closeWrappers.set(e,n),this.inner.addEventListener(`close`,n);return}this.inner.addEventListener(e,t)}removeEventListener(e,t){if(e===`close`){let e=t,n=this.closeWrappers.get(e);n&&(this.closeWrappers.delete(e),this.inner.removeEventListener(`close`,n));return}this.inner.removeEventListener(e,t)}},un=1e4,dn=1e3,fn=1e4,pn=1.3,mn=1006,hn=class{subscriptions=new x;urlProvider;headersProvider;abortController=null;retryTimer=null;retryCount=0;userClosed=!1;state=WebSocket.CLOSED;constructor(e,t=()=>({})){this.urlProvider=e,this.headersProvider=t}get readyState(){return this.state}reconnect(e,t){this.userClosed=!1,this.retryCount=0,this.clearRetryTimer(),this.abortController?.abort(),this.connect()}close(){this.userClosed=!0,this.clearRetryTimer(),this.state=WebSocket.CLOSED,this.abortController?.abort(),this.abortController=null}send(e){C.warn(`SseTransport does not support send(); dropping message`)}addEventListener(e,t){this.subscriptions.addSubscription(e,t)}removeEventListener(e,t){this.subscriptions.removeSubscription(e,t)}connect(){this.state=WebSocket.CONNECTING,this.run()}async run(){let e=new AbortController;this.abortController=e;let t=setTimeout(()=>e.abort(),un),n=null;try{let r=await fetch(this.urlProvider(),{headers:{...this.headersProvider(),Accept:`text/event-stream`},signal:e.signal});if(clearTimeout(t),!r.ok||r.body===null)throw Error(`Unexpected SSE response: ${r.status}`);this.state=WebSocket.OPEN,this.subscriptions.notify(`open`,new Event(`open`)),n=await this.readEvents(r.body)}catch(n){if(clearTimeout(t),this.isSuperseded(e))return;C.warn(`SSE connection failed`,n),this.subscriptions.notify(`error`,new Event(`error`))}if(this.isSuperseded(e))return;e.abort(),this.state=WebSocket.CLOSED,this.retryCount+=1;let r=this.retryCount>=10;this.subscriptions.notify(`close`,new CloseEvent(`close`,{code:n?.code??mn,reason:r?cn:n?.reason??``,wasClean:n!==null})),!(r||this.isSuperseded(e))&&this.scheduleRetry()}isSuperseded(e){return this.userClosed||this.abortController!==e}scheduleRetry(){this.clearRetryTimer(),this.state=WebSocket.CONNECTING;let e=Math.min(dn*pn**this.retryCount,fn);this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.connect()},e)}clearRetryTimer(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null)}async readEvents(e){let t=e.getReader(),n=new TextDecoder,r=``,i=null,a=[],o=()=>{if(a.length===0)return i=null,null;let e=a.join(`
|
|
2
2
|
`),t=i;return i=null,a=[],t===`close`?gn(e):(this.retryCount=0,this.subscriptions.notify(`message`,new MessageEvent(`message`,{data:e})),null)};for(;;){let{done:e,value:s}=await t.read();if(e)return null;r+=n.decode(s,{stream:!0});let c=0,l=r.indexOf(`
|
|
3
3
|
`,c);for(;l!==-1;){let e=r.slice(c,l);if(c=l+1,l=r.indexOf(`
|
|
4
4
|
`,c),e.endsWith(`\r`)&&(e=e.slice(0,-1)),e===``){let e=o();if(e!==null)return e;continue}if(e.startsWith(`:`))continue;let t=e.indexOf(`:`),n=t===-1?e:e.slice(0,t),s=t===-1?``:e.slice(t+1);s.startsWith(` `)&&(s=s.slice(1)),n===`data`?a.push(s):n===`event`&&(i=s)}c>0&&(r=r.slice(c))}}};function gn(e){try{let t=JSON.parse(e);return{code:typeof t.code==`number`?t.code:1e3,reason:typeof t.reason==`string`?t.reason:``}}catch{return C.warn(`Failed to parse SSE close event`,e),{code:1e3,reason:``}}}function _n(e){return e.static?be.empty():Me()?Se():e.transportType===`sse`?new hn(e.url,e.headers):new ln(e.url)}function vn(e){let{onOpen:t,onMessage:n,onClose:r,onError:i,waitToConnect:a}=e,[o]=(0,Q.useState)(()=>{let a=_n(e);return a.addEventListener(`open`,t),a.addEventListener(`close`,r),a.addEventListener(`error`,i),a.addEventListener(`message`,n),a});return(0,Q.useEffect)(()=>(o.readyState===WebSocket.CLOSED&&a().then(()=>o.reconnect()).catch(e=>{C.error(`Healthy connection never made`,e),o.close()}),()=>{C.warn(`useConnectionTransport is unmounting. This likely means there is a bug.`),o.close(),o.removeEventListener(`open`,t),o.removeEventListener(`close`,r),o.removeEventListener(`error`,i),o.removeEventListener(`message`,n)}),[o]),o}function yn(e){let{codes:t,names:n,configs:r,cell_ids:i,last_executed_code:a,last_execution_time:o}=e,s=a||{},c=o||{};return t.map((e,t)=>{let a=i[t],o=s[a];return ae({id:a,code:e,edited:o?o!==e:!1,name:n[t],lastCodeRun:s[a]??null,lastExecutionTime:c[a]??null,config:r[t]})})}function bn(e,t,n){let{layout:r}=e,i=Ke(r,t);return r&&r.type===i.selectedLayout&&n({layoutView:i.selectedLayout,data:i.layoutData[i.selectedLayout]}),i}function xn(){let e=[],t=[];return S.entries.forEach((n,r)=>{e.push(r),t.push(n.value)}),{objectIds:e,values:t}}function Sn(e,t){let{existingCells:n,autoInstantiate:r,setCells:i,setLayoutData:a,setAppConfig:o,setCapabilities:s,setKernelState:c,onError:l}=t,{resumed:u,ui_values:d,app_config:f,capabilities:p,auto_instantiated:m}=e,h=n&&n.length>0,g=h&&!u?n:yn(e);i(g,bn(e,g,a));let ee=ge.safeParse(f);if(ee.success?o(ee.data):C.error(`Failed to parse app config`,ee.error),s(p),m)return;if(u){for(let[e,t]of ke.entries(d||{})){let n=e;S.set(n,t)}return}let{objectIds:te,values:ne}=xn(),re=h?Object.fromEntries(n.map(e=>[e.id,e.code])):void 0;nt().sendInstantiate({objectIds:te,values:ne,autoRun:r,codes:re}).then(()=>{c({isInstantiated:!0,error:null})}).catch(e=>{c({isInstantiated:!1,error:e}),l(Error(`Failed to instantiate`,{cause:e}))})}function Cn(e){let t=e.cell_id;S.removeElementsByCell(t),J.INSTANCE.removeForCellId(t)}function wn(e,t){t(e),J.INSTANCE.track(e)}var Tn={append:e=>{let t=new URL(window.location.href);t.searchParams.append(e.key,e.value),window.history.pushState({},``,`${t.pathname}${t.search}`)},set:e=>{let t=new URL(window.location.href);Array.isArray(e.value)?(t.searchParams.delete(e.key),e.value.forEach(n=>t.searchParams.append(e.key,n))):t.searchParams.set(e.key,e.value),window.history.pushState({},``,`${t.pathname}${t.search}`)},delete:e=>{let t=new URL(window.location.href);e.value==null?t.searchParams.delete(e.key):t.searchParams.delete(e.key,e.value),window.history.pushState({},``,`${t.pathname}${t.search}`)},clear:()=>{let e=new URL(window.location.href);e.search=``,window.history.pushState({},``,`${e.pathname}${e.search}`)}};function En(e){switch(e.reason){case cn:return{kind:`gave-up`,status:{state:k.CLOSED,code:O.KERNEL_DISCONNECTED,reason:`kernel not found`}};case`MARIMO_NO_FILE_KEY`:case`MARIMO_NO_SESSION_ID`:case`MARIMO_NO_SESSION`:case`MARIMO_SHUTDOWN`:return{kind:`terminal`,status:{state:k.CLOSED,code:O.KERNEL_DISCONNECTED,reason:`kernel not found`},closeTransport:!0};case`MARIMO_UNAUTHORIZED`:return{kind:`terminal`,status:{state:k.CLOSED,code:O.KERNEL_DISCONNECTED,reason:`not authorized`},closeTransport:!0};case`MARIMO_KIOSK_NOT_ALLOWED`:return{kind:`terminal`,status:{state:k.CLOSED,code:O.KERNEL_DISCONNECTED,reason:`kiosk mode is not available for this session`},closeTransport:!0};case`MARIMO_KERNEL_STARTUP_ERROR`:return{kind:`terminal`,status:{state:k.CLOSED,code:O.KERNEL_STARTUP_ERROR,reason:`Failed to start kernel sandbox`},closeTransport:!0};default:e.reason&&tt(e.reason)}return{kind:`retry`,status:{state:k.CONNECTING}}}function Dn(){return Object.values(de().cellData).filter(e=>e.id!==oe)}function On(e){let n=(0,Z.c)(51),i=(0,Q.useRef)(!0),{autoInstantiate:o,sessionId:c,setCells:h}=e,{showBoundary:ae}=Be(),{handleCellMessage:oe}=u(),_;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(_={skipMiddleware:!0},n[0]=_):_=n[0];let v=u(_),y;n[1]===v?y=n[2]:(y=e=>{s(e.changes,v,Nn)},n[1]=v,n[2]=y);let fe=y,{addCellNotification:b}=gt(),ge=a(Re),x=a(ze),be=ve(),{setVariables:Se,setMetadata:Ce}=ue(),{addColumnPreview:we}=ce(),{addDatasets:Te,filterDatasetsFromVariables:De}=ce(),{addDataSourceConnection:Oe,filterDataSourcesFromVariables:ke}=g(),{setLayoutData:w}=Ze(),[T,E]=t(Ne),D=a(Ie),{addBanner:Le}=ft(),{addMissingPackageAlert:A,updateEnvironment:j,setEnvironment:M,addStartupLog:N}=pt(),P=a(Ae),Ve=a(je),F=a(m),I=Fe(),L=r(_e),He=a(dt),R=a(mt),{setNamespaces:z,filterFromVariables:Ue}=se(),B;n[3]!==Le||n[4]!==b||n[5]!==we||n[6]!==Oe||n[7]!==Te||n[8]!==A||n[9]!==N||n[10]!==o||n[11]!==ke||n[12]!==De||n[13]!==Ue||n[14]!==oe||n[15]!==fe||n[16]!==be||n[17]!==He||n[18]!==F||n[19]!==h||n[20]!==E||n[21]!==M||n[22]!==x||n[23]!==R||n[24]!==ge||n[25]!==P||n[26]!==w||n[27]!==Ce||n[28]!==Ve||n[29]!==z||n[30]!==Se||n[31]!==ae||n[32]!==j||n[33]!==D?(B=e=>{let t=re(e.data);switch(t.data.op){case`reload`:ot();return;case`startup-progress`:{let{phase:e}=t.data;D(t.data),E(t=>t.state===k.OPEN||t.state===k.CONNECTING&&t.phase===e?t:{state:k.CONNECTING,phase:e});return}case`kernel-ready`:{R(null),E({state:k.OPEN}),x(!!(t.data.resumed||t.data.auto_instantiated));let e=Dn();Sn(t.data,{autoInstantiate:o,setCells:h,setLayoutData:w,setAppConfig:be,setCapabilities:F,setKernelState:ge,onError:ae,existingCells:e}),t.data.resumed||ie(),P(t.data.kiosk),Ve(t.data.stable_session_id??null),pe(null),me();return}case`completed-run`:x(!0);return;case`execution`:return;case`interrupted`:return;case`kernel-startup-error`:R(t.data.error);return;case`send-ui-element-message`:{let e=t.data.ui_element;if(e){let n=qe(t.data);S.broadcastMessage(e,t.data.message,n)}return}case`model-lifecycle`:ye(Ee,t.data);return;case`remove-ui-elements`:Cn(t.data);return;case`completion-result`:ne.resolve(t.data.completion_id,t.data);return;case`function-call-result`:xe.resolve(t.data.function_call_id,t.data);return;case`cell-op`:{wn(t.data,oe);let e=de().cellData[t.data.cell_id];if(!e)return;b({cellNotification:t.data,code:e.code});return}case`variables`:{let e=t.data.variables.map(Mn);Se(t.data.variables.map(jn)),De(e),ke(e),Ue(e);return}case`variable-values`:Ce(t.data.variables.map(An));return;case`alert`:et({title:t.data.title,description:it({html:t.data.description}),variant:t.data.variant});return;case`banner`:Le(t.data);return;case`missing-package-alert`:A({...t.data,kind:`missing`});return;case`environment-operation`:t.data.source===`kernel`&&t.data.status.kind!==`running`&&at(),j(t.data);return;case`environment-state`:M(t.data),t.data.source===`kernel`&&at();return;case`startup-logs`:N({content:t.data.content,status:t.data.status});return;case`query-params-append`:Tn.append(t.data);return;case`query-params-set`:Tn.set(t.data);return;case`query-params-delete`:Tn.delete(t.data);return;case`query-params-clear`:Tn.clear();return;case`datasets`:Te(t.data);return;case`data-column-preview`:we(t.data);return;case`sql-table-preview`:te.resolve(t.data.request_id,t.data);return;case`sql-table-list-preview`:he.resolve(t.data.request_id,t.data);return;case`sql-schema-list-preview`:p.resolve(t.data.request_id,t.data);return;case`validate-sql-result`:ee.resolve(t.data.request_id,t.data);return;case`data-source-discovery-result`:le.resolve(t.data.request_id,t.data);return;case`secret-keys-result`:Ye.resolve(t.data.request_id,t.data);return;case`cache-info`:He(t.data);return;case`cache-cleared`:return;case`data-source-connections`:Oe({connections:t.data.connections.map(kn)});return;case`storage-namespaces`:z(t.data);return;case`storage-entries`:d.resolve(t.data.request_id,t.data);return;case`storage-download-ready`:f.resolve(t.data.request_id,t.data);return;case`reconnected`:R(null),E({state:k.OPEN});return;case`focus-cell`:l(t.data.cell_id);return;case`active-line`:pe(t.data.line==null?null:{cellId:t.data.cell_id,line:t.data.line});return;case`notebook-document-transaction`:fe(t.data.transaction);return;case`consumer-capabilities`:P(!t.data.consumer_capabilities.edit);return;default:tt(t.data)}},n[3]=Le,n[4]=b,n[5]=we,n[6]=Oe,n[7]=Te,n[8]=A,n[9]=N,n[10]=o,n[11]=ke,n[12]=De,n[13]=Ue,n[14]=oe,n[15]=fe,n[16]=be,n[17]=He,n[18]=F,n[19]=h,n[20]=E,n[21]=M,n[22]=x,n[23]=R,n[24]=ge,n[25]=P,n[26]=w,n[27]=Ce,n[28]=Ve,n[29]=z,n[30]=Se,n[31]=ae,n[32]=j,n[33]=D,n[34]=B):B=n[34];let We=B,Ge=(e,t)=>{i.current&&(i.current=!1,J.reconnect(e,t))},V=async()=>{if(J.readyState!==WebSocket.OPEN&&J.readyState!==WebSocket.CONNECTING){if(i.current=!0,R(null),E({state:k.CONNECTING}),!await I.reconcileFromHealth()){i.current=!1,E({state:k.CLOSED,code:O.KERNEL_DISCONNECTED,reason:`kernel not found`});return}J.reconnect()}},H;n[35]===Symbol.for(`react.memo_cache_sentinel`)?(H=Pe(),n[35]=H):H=n[35];let U;n[36]!==I||n[37]!==c||n[38]!==L?(U=()=>L===`sse`?I.getSseURL(c).toString():I.getWsURL(c).toString(),n[36]=I,n[37]=c,n[38]=L,n[39]=U):U=n[39];let W;n[40]===I?W=n[41]:(W=()=>I.headers(),n[40]=I,n[41]=W);let G;n[42]===D?G=n[43]:(G=async()=>{D(null),i.current=!0},n[42]=D,n[43]=G);let K;n[44]===I?K=n[45]:(K=async()=>{Pe()||Me()||I.isSameOrigin||await I.waitForHealthy()},n[44]=I,n[45]=K);let q;n[46]===We?q=n[47]:(q=e=>{try{We(e)}catch(t){let n=t;C.error(`Failed to handle message`,e.data,n),et({title:`Failed to handle message`,description:st(n),variant:`danger`})}},n[46]=We,n[47]=q);let J=vn({static:H,transportType:L,url:U,headers:W,onOpen:G,waitToConnect:K,onMessage:q,onClose:e=>{C.warn(`WebSocket closed`,e.code,e.reason);let t=En(e);if(E(e=>{let n=t.status;return n.state===k.CLOSED&&n.code===O.KERNEL_STARTUP_ERROR&&(e.state===k.CONNECTING||e.state===k.CLOSED)?{...n,phase:e.phase}:n.state===k.CONNECTING&&(e.state===k.OPEN||e.state===k.CONNECTING&&e.phase===`reconnecting`)?{...n,phase:`reconnecting`}:n}),t.kind===`terminal`&&t.closeTransport){J.close();return}t.kind===`retry`&&Ge(e.code,e.reason)},onError:e=>{C.warn(`WebSocket error`,e),E({state:k.CLOSED,code:O.KERNEL_DISCONNECTED,reason:`kernel not found`}),Ge()}}),Y;return n[48]!==T||n[49]!==V?(Y={connection:T,reconnect:V},n[48]=T,n[49]=V,n[50]=Y):Y=n[50],Y}function kn(e){return{...e,name:e.name}}function An(e){return{name:e.name,dataType:e.datatype,value:e.value}}function jn(e){return{name:e.name,declaredBy:e.declared_by,usedBy:e.used_by}}function Mn(e){return e.name}function Nn(){return de().cellIds.inOrderIds}var Pn=e=>{let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(`div`,{"data-testid":`chrome-wrapper`,className:`flex flex-col flex-1 overflow-hidden absolute inset-0 print:relative`,children:n}),t[0]=n,t[1]=r),r};export{rn as a,vt as c,an as i,On as n,xt as o,sn as r,bt as s,Pn as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t,t as n}from"./useEvent-Dc9HkKI2.js";import{t as r}from"./react-CUdNIagt.js";import{Bt as i,D as a,na as o,oa as s,rt as c,ta as l}from"./cells-CxY8RSp7.js";import{t as u}from"./compiler-runtime-BQ9S8nyo.js";import{T as d,s as f}from"./config-Cyum2gRs.js";import{g as p,t as m}from"./useEventListener-IRzG-0mH.js";import{t as h}from"./utils-B4K466FK.js";import{m as g}from"./session-BykGt6S3.js";import{_}from"./config-D_c_6ce1.js";import{r as v}from"./state-ja7GWeCS.js";import{t as y}from"./cn-ldLVeaqm.js";import{t as b}from"./jsx-runtime-B74pBk57.js";import{n as x}from"./fullscreen-DEBblJKh.js";import{Ft as S}from"./JsonOutput-NVH7GWyC.js";import{t as C}from"./tooltip-B5pI8o2n.js";import{r as ee,t as w}from"./button-M49xxKoi.js";import{t as T}from"./createLucideIcon-rHn2EdoM.js";import{_ as E,d as D,f as O,g as k,s as A,u as j}from"./layout-BaluekG6.js";import{a as M}from"./useNumberFormatter-BP99Zbyy.js";import{t as te}from"./code-DW4kNwKG.js";import{t as ne}from"./eye-off-CfkK-QS3.js";import{n as N,t as re}from"./cell-editor-CevZDS63.js";import{n as ie,t as P}from"./RunButton-A__3wcpF.js";import{t as ae}from"./readonly-python-code-DcYhdd1B.js";import{r as oe}from"./useTheme-BkPLyRl9.js";import{r as se}from"./useDebounce-DMbg9X18.js";import{t as ce}from"./CellStatus-Bj7PvY_u.js";import{i as le}from"./useRunCells-zMO43eNR.js";import{n as ue,r as de,t as fe}from"./react-resizable-panels.browser.esm-BL2E7f5c.js";import{n as pe,t as me}from"./code-visibility-DNzJgrTz.js";import{t as he}from"./readonly-code-display-CNbw6v1-.js";/* empty css */var ge=T(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),F=e(r(),1),I=u(),L=(e,t)=>{for(let n in t)e[n]=t[n];return e},R=(e,t)=>Array.from(e.querySelectorAll(t)),_e=(e,t,n)=>{n?e.classList.add(t):e.classList.remove(t)},ve=e=>{if(typeof e==`string`){if(e===`null`)return null;if(e===`true`)return!0;if(e===`false`)return!1;if(e.match(/^-?[\d\.]+$/))return parseFloat(e)}return e},ye=(e,t)=>{e.style.transform=t},z=(e,t)=>{let n=e.matches||e.matchesSelector||e.msMatchesSelector;return!!(n&&n.call(e,t))},B=(e,t)=>{if(e&&typeof e.closest==`function`)return e.closest(t);for(;e;){if(z(e,t))return e;e=e.parentElement}return null},be=e=>{e||=document.documentElement;let t=e.requestFullscreen||e.webkitRequestFullscreen||e.webkitRequestFullScreen||e.mozRequestFullScreen||e.msRequestFullscreen;t&&t.apply(e)},xe=(e,t,n,r=``)=>{let i=e.querySelectorAll(`.`+n);for(let t=0;t<i.length;t++){let n=i[t];if(n.parentNode===e)return n}let a=document.createElement(t);return a.className=n,a.innerHTML=r,e.appendChild(a),a},Se=e=>{let t=document.createElement(`style`);return e&&e.length>0&&t.appendChild(document.createTextNode(e)),document.head.appendChild(t),t},Ce=()=>{let e={};location.search.replace(/[A-Z0-9]+?=([\w\.%-]*)/gi,t=>{let n=t.split(`=`).shift(),r=t.split(`=`).pop();return n&&r!==void 0&&(e[n]=r),t});for(let t in e){let n=e[t];e[t]=ve(unescape(n))}return e.dependencies!==void 0&&delete e.dependencies,e},we=(e,t=0)=>{if(e){let n,r=e.style.height;return e.style.height=`0px`,e.parentElement&&(e.parentElement.style.height=`auto`),n=t-(e.parentElement?.offsetHeight||0),e.style.height=r+`px`,e.parentElement&&e.parentElement.style.removeProperty(`height`),n}return t},V={mp4:`video/mp4`,m4a:`video/mp4`,ogv:`video/ogg`,mpeg:`video/mpeg`,webm:`video/webm`},H=(e=``)=>{let t=e.split(`.`).pop();return t?V[t]:void 0},Te=(e=``)=>encodeURI(e).replace(/%5B/g,`[`).replace(/%5D/g,`]`).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),U=navigator.userAgent,Ee=/(iphone|ipod|ipad|android)/gi.test(U)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1;/chrome/i.test(U)&&/edge/i.test(U);var De=/android/gi.test(U),Oe=function(e){if(e){var t=function(e){return[].slice.call(e)},n=0,r=1,i=2,a=3,o=[],s=null,c=`requestAnimationFrame`in e?function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{sync:!1};e.cancelAnimationFrame(s);var n=function(){return u(o.filter((function(e){return e.dirty&&e.active})))};if(t.sync)return n();s=e.requestAnimationFrame(n)}:function(){},l=function(e){return function(t){o.forEach((function(t){return t.dirty=e})),c(t)}},u=function(e){e.filter((function(e){return!e.styleComputed})).forEach((function(e){e.styleComputed=m(e)})),e.filter(h).forEach(g);var t=e.filter(p);t.forEach(f),t.forEach((function(e){g(e),d(e)})),t.forEach(_)},d=function(e){return e.dirty=n},f=function(e){e.availableWidth=e.element.parentNode.clientWidth,e.currentWidth=e.element.scrollWidth,e.previousFontSize=e.currentFontSize,e.currentFontSize=Math.min(Math.max(e.minSize,e.availableWidth/e.currentWidth*e.previousFontSize),e.maxSize),e.whiteSpace=e.multiLine&&e.currentFontSize===e.minSize?`normal`:`nowrap`},p=function(e){return e.dirty!==i||e.dirty===i&&e.element.parentNode.clientWidth!==e.availableWidth},m=function(t){var n=e.getComputedStyle(t.element,null);return t.currentFontSize=parseFloat(n.getPropertyValue(`font-size`)),t.display=n.getPropertyValue(`display`),t.whiteSpace=n.getPropertyValue(`white-space`),!0},h=function(e){var t=!1;return!e.preStyleTestCompleted&&(/inline-/.test(e.display)||(t=!0,e.display=`inline-block`),e.whiteSpace!==`nowrap`&&(t=!0,e.whiteSpace=`nowrap`),e.preStyleTestCompleted=!0,t)},g=function(e){e.element.style.whiteSpace=e.whiteSpace,e.element.style.display=e.display,e.element.style.fontSize=e.currentFontSize+`px`},_=function(e){e.element.dispatchEvent(new CustomEvent(`fit`,{detail:{oldValue:e.previousFontSize,newValue:e.currentFontSize,scaleFactor:e.currentFontSize/e.previousFontSize}}))},v=function(e,t){return function(n){e.dirty=t,e.active&&c(n)}},y=function(e){return function(){o=o.filter((function(t){return t.element!==e.element})),e.observeMutations&&e.observer.disconnect(),e.element.style.whiteSpace=e.originalStyle.whiteSpace,e.element.style.display=e.originalStyle.display,e.element.style.fontSize=e.originalStyle.fontSize}},b=function(e){return function(){e.active||(e.active=!0,c())}},x=function(e){return function(){return e.active=!1}},S=function(e){e.observeMutations&&(e.observer=new MutationObserver(v(e,r)),e.observer.observe(e.element,e.observeMutations))},C={minSize:16,maxSize:512,multiLine:!0,observeMutations:`MutationObserver`in e&&{subtree:!0,childList:!0,characterData:!0}},ee=null,w=function(){e.clearTimeout(ee),ee=e.setTimeout(l(i),D.observeWindowDelay)},T=[`resize`,`orientationchange`];return Object.defineProperty(D,"observeWindow",{set:function(t){var n=`${t?`add`:`remove`}EventListener`;T.forEach((function(t){e[n](t,w)}))}}),D.observeWindow=!0,D.observeWindowDelay=100,D.fitAll=l(a),D}function E(e,t){var n=Object.assign({},C,t),r=e.map((function(e){var t=Object.assign({},n,{element:e,active:!0});return function(e){e.originalStyle={whiteSpace:e.element.style.whiteSpace,display:e.element.style.display,fontSize:e.element.style.fontSize},S(e),e.newbie=!0,e.dirty=!0,o.push(e)}(t),{element:e,fit:v(t,a),unfreeze:b(t),freeze:x(t),unsubscribe:y(t)}}));return c(),r}function D(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return typeof e==`string`?E(t(document.querySelectorAll(e)),n):E([e],n)[0]}}(typeof window>`u`?null:window);function W(e){"@babel/helpers - typeof";return W=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},W(e)}function ke(e,t){if(W(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(W(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ae(e){var t=ke(e,`string`);return W(t)==`symbol`?t:t+``}function je(e,t,n){return(t=Ae(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Me=class{constructor(e){je(this,`allowedToPlayAudio`,null),this.Reveal=e,this.startEmbeddedMedia=this.startEmbeddedMedia.bind(this),this.startEmbeddedIframe=this.startEmbeddedIframe.bind(this),this.preventIframeAutoFocus=this.preventIframeAutoFocus.bind(this),this.ensureMobileMediaPlaying=this.ensureMobileMediaPlaying.bind(this),this.failedAudioPlaybackTargets=new Set,this.failedVideoPlaybackTargets=new Set,this.failedMutedVideoPlaybackTargets=new Set,this.renderMediaPlayButton()}renderMediaPlayButton(){this.mediaPlayButton=document.createElement(`button`),this.mediaPlayButton.className=`r-overlay-button r-media-play-button`,this.mediaPlayButton.addEventListener(`click`,()=>{this.resetTemporarilyMutedMedia(),new Set([...this.failedAudioPlaybackTargets,...this.failedVideoPlaybackTargets,...this.failedMutedVideoPlaybackTargets]).forEach(e=>{this.startEmbeddedMedia({target:e})}),this.clearMediaPlaybackErrors()})}shouldPreload(e){if(this.Reveal.isScrollView())return!0;let t=this.Reveal.getConfig().preloadIframes;return typeof t!=`boolean`&&(t=e.hasAttribute(`data-preload`)),t}load(e,t={}){let n=this.Reveal.getConfig().display;if(n.includes(`!important`)){let t=n.replace(/\s*!important\s*$/,``).trim();e.style.setProperty(`display`,t,`important`)}else e.style.display=n;R(e,`img[data-src], video[data-src], audio[data-src], iframe[data-src]`).forEach(e=>{let t=e.tagName===`IFRAME`;(!t||this.shouldPreload(e))&&(e.setAttribute(`src`,e.getAttribute(`data-src`)),e.setAttribute(`data-lazy-loaded`,``),e.removeAttribute(`data-src`),t&&e.addEventListener(`load`,this.preventIframeAutoFocus))}),R(e,`video, audio`).forEach(e=>{let t=0;R(e,`source[data-src]`).forEach(e=>{e.setAttribute(`src`,e.getAttribute(`data-src`)),e.removeAttribute(`data-src`),e.setAttribute(`data-lazy-loaded`,``),t+=1}),Ee&&e.tagName===`VIDEO`&&e.setAttribute(`playsinline`,``),t>0&&e.load()});let r=e.slideBackgroundElement;if(r){r.style.display=`block`;let n=e.slideBackgroundContentElement,i=e.getAttribute(`data-background-iframe`);if(r.hasAttribute(`data-loaded`)===!1){r.setAttribute(`data-loaded`,`true`);let a=e.getAttribute(`data-background-image`),o=e.getAttribute(`data-background-video`),s=e.hasAttribute(`data-background-video-loop`),c=e.hasAttribute(`data-background-video-muted`);if(a)/^data:/.test(a.trim())?n.style.backgroundImage=`url(${a.trim()})`:n.style.backgroundImage=a.split(`,`).map(e=>`url(${Te(decodeURI(e.trim()))})`).join(`,`);else if(o){let e=document.createElement(`video`);s&&e.setAttribute(`loop`,``),(c||this.Reveal.isSpeakerNotes())&&(e.muted=!0),Ee&&e.setAttribute(`playsinline`,``),o.split(`,`).forEach(t=>{let n=document.createElement(`source`);n.setAttribute(`src`,t);let r=H(t);r&&n.setAttribute(`type`,r),e.appendChild(n)}),n.appendChild(e)}else if(i&&t.excludeIframes!==!0){let e=document.createElement(`iframe`);e.setAttribute(`allowfullscreen`,``),e.setAttribute(`mozallowfullscreen`,``),e.setAttribute(`webkitallowfullscreen`,``),e.setAttribute(`allow`,`autoplay`),e.setAttribute(`data-src`,i),e.style.width=`100%`,e.style.height=`100%`,e.style.maxHeight=`100%`,e.style.maxWidth=`100%`,n.appendChild(e)}}let a=n.querySelector(`iframe[data-src]`);a&&this.shouldPreload(r)&&!/autoplay=(1|true|yes)/gi.test(i)&&a.getAttribute(`src`)!==i&&a.setAttribute(`src`,i)}this.layout(e)}layout(e){Array.from(e.querySelectorAll(`.r-fit-text`)).forEach(e=>{Oe(e,{minSize:24,maxSize:this.Reveal.getConfig().height*.8,observeMutations:!1,observeWindow:!1})})}unload(e){e.style.display=`none`;let t=this.Reveal.getSlideBackground(e);t&&(t.style.display=`none`,R(t,`iframe[src]`).forEach(e=>{e.removeAttribute(`src`)})),R(e,`video[data-lazy-loaded][src], audio[data-lazy-loaded][src], iframe[data-lazy-loaded][src]`).forEach(e=>{e.setAttribute(`data-src`,e.getAttribute(`src`)),e.removeAttribute(`src`)}),R(e,`video[data-lazy-loaded] source[src], audio source[src]`).forEach(e=>{e.setAttribute(`data-src`,e.getAttribute(`src`)),e.removeAttribute(`src`)})}formatEmbeddedContent(){let e=(e,t,n)=>{R(this.Reveal.getSlidesElement(),`iframe[`+e+`*="`+t+`"]`).forEach(t=>{let r=t.getAttribute(e);r&&r.indexOf(n)===-1&&t.setAttribute(e,r+(/\?/.test(r)?`&`:`?`)+n)})};e(`src`,`youtube.com/embed/`,`enablejsapi=1`),e(`data-src`,`youtube.com/embed/`,`enablejsapi=1`),e(`src`,`player.vimeo.com/`,`api=1`),e(`data-src`,`player.vimeo.com/`,`api=1`)}startEmbeddedContent(e){if(e){let t=this.Reveal.isSpeakerNotes();R(e,`img[src$=".gif"]`).forEach(e=>{e.setAttribute(`src`,e.getAttribute(`src`))}),R(e,`video, audio`).forEach(e=>{if(B(e,`.fragment`)&&!B(e,`.fragment.visible`))return;let n=this.Reveal.getConfig().autoPlayMedia;if(typeof n!=`boolean`&&(n=e.hasAttribute(`data-autoplay`)||!!B(e,`.slide-background`)),n&&typeof e.play==`function`){if(t&&!e.muted)return;e.readyState>1?this.startEmbeddedMedia({target:e}):Ee?(e.addEventListener(`canplay`,this.ensureMobileMediaPlaying),this.playMediaElement(e)):(e.removeEventListener(`loadeddata`,this.startEmbeddedMedia),e.addEventListener(`loadeddata`,this.startEmbeddedMedia))}}),t||(R(e,`iframe[src]`).forEach(e=>{B(e,`.fragment`)&&!B(e,`.fragment.visible`)||this.startEmbeddedIframe({target:e})}),R(e,`iframe[data-src]`).forEach(e=>{B(e,`.fragment`)&&!B(e,`.fragment.visible`)||e.getAttribute(`src`)!==e.getAttribute(`data-src`)&&(e.removeEventListener(`load`,this.startEmbeddedIframe),e.addEventListener(`load`,this.startEmbeddedIframe),e.setAttribute(`src`,e.getAttribute(`data-src`)))}))}}ensureMobileMediaPlaying(e){let t=e.target;typeof t.getVideoPlaybackQuality==`function`&&setTimeout(()=>{let e=t.paused===!1,n=t.getVideoPlaybackQuality().totalVideoFrames;e&&n===0&&(t.load(),t.play())},1e3)}startEmbeddedMedia(e){let t=!!B(e.target,`html`),n=!!B(e.target,`.present`);t&&n&&(e.target.paused||e.target.ended)&&(e.target.currentTime=0,this.playMediaElement(e.target)),e.target.removeEventListener(`loadeddata`,this.startEmbeddedMedia)}playMediaElement(e){let t=e.play();t&&typeof t.catch==`function`&&t.then(()=>{e.muted||(this.allowedToPlayAudio=!0)}).catch(t=>{if(t.name===`NotAllowedError`){if(this.allowedToPlayAudio=!1,e.tagName===`VIDEO`){this.onVideoPlaybackNotAllowed(e);let t=!!B(e,`html`),n=!!B(e,`.present`),r=e.muted;t&&n&&!r&&(e.setAttribute(`data-muted-by-reveal`,`true`),e.muted=!0,e.play().catch(()=>{this.onMutedVideoPlaybackNotAllowed(e)}))}else e.tagName===`AUDIO`&&this.onAudioPlaybackNotAllowed(e)}})}startEmbeddedIframe(e){let t=e.target;if(this.preventIframeAutoFocus(e),t&&t.contentWindow){let n=!!B(e.target,`html`),r=!!B(e.target,`.present`);if(n&&r){let e=this.Reveal.getConfig().autoPlayMedia;typeof e!=`boolean`&&(e=t.hasAttribute(`data-autoplay`)||!!B(t,`.slide-background`)),/youtube\.com\/embed\//.test(t.getAttribute(`src`))&&e?t.contentWindow.postMessage(`{"event":"command","func":"playVideo","args":""}`,`*`):/player\.vimeo\.com\//.test(t.getAttribute(`src`))&&e?t.contentWindow.postMessage(`{"method":"play"}`,`*`):t.contentWindow.postMessage(`slide:start`,`*`)}}}stopEmbeddedContent(e,t={}){t=L({unloadIframes:!0},t),e&&e.parentNode&&(R(e,`video, audio`).forEach(e=>{!e.hasAttribute(`data-ignore`)&&typeof e.pause==`function`&&(e.setAttribute(`data-paused-by-reveal`,``),e.pause(),Ee&&e.removeEventListener(`canplay`,this.ensureMobileMediaPlaying))}),R(e,`iframe`).forEach(e=>{e.contentWindow&&e.contentWindow.postMessage(`slide:stop`,`*`),e.removeEventListener(`load`,this.preventIframeAutoFocus),e.removeEventListener(`load`,this.startEmbeddedIframe)}),R(e,`iframe[src*="youtube.com/embed/"]`).forEach(e=>{!e.hasAttribute(`data-ignore`)&&e.contentWindow&&typeof e.contentWindow.postMessage==`function`&&e.contentWindow.postMessage(`{"event":"command","func":"pauseVideo","args":""}`,`*`)}),R(e,`iframe[src*="player.vimeo.com/"]`).forEach(e=>{!e.hasAttribute(`data-ignore`)&&e.contentWindow&&typeof e.contentWindow.postMessage==`function`&&e.contentWindow.postMessage(`{"method":"pause"}`,`*`)}),t.unloadIframes===!0&&R(e,`iframe[data-src]`).forEach(e=>{e.setAttribute(`src`,`about:blank`),e.removeAttribute(`src`)}))}isAllowedToPlayAudio(){return this.allowedToPlayAudio}showPlayOrUnmuteButton(){let e=this.failedAudioPlaybackTargets.size,t=this.failedVideoPlaybackTargets.size,n=this.failedMutedVideoPlaybackTargets.size,r=`Play media`;n>0?r=`Play video`:t>0?r=`Unmute video`:e>0&&(r=`Play audio`),this.mediaPlayButton.textContent=r,this.Reveal.getRevealElement().appendChild(this.mediaPlayButton)}onAudioPlaybackNotAllowed(e){this.failedAudioPlaybackTargets.add(e),this.showPlayOrUnmuteButton(e)}onVideoPlaybackNotAllowed(e){this.failedVideoPlaybackTargets.add(e),this.showPlayOrUnmuteButton()}onMutedVideoPlaybackNotAllowed(e){this.failedMutedVideoPlaybackTargets.add(e),this.showPlayOrUnmuteButton()}resetTemporarilyMutedMedia(){new Set([...this.failedAudioPlaybackTargets,...this.failedVideoPlaybackTargets,...this.failedMutedVideoPlaybackTargets]).forEach(e=>{e.hasAttribute(`data-muted-by-reveal`)&&(e.muted=!1,e.removeAttribute(`data-muted-by-reveal`))})}clearMediaPlaybackErrors(){this.resetTemporarilyMutedMedia(),this.failedAudioPlaybackTargets.clear(),this.failedVideoPlaybackTargets.clear(),this.failedMutedVideoPlaybackTargets.clear(),this.mediaPlayButton&&this.mediaPlayButton.parentNode&&this.mediaPlayButton.remove()}preventIframeAutoFocus(e){let t=e.target;if(t&&this.Reveal.getConfig().preventIframeAutoFocus){let e=0,n=()=>{document.activeElement===t?document.activeElement.blur():e<1e3&&(e+=100,setTimeout(n,100))};setTimeout(n,100)}}afterSlideChanged(){this.clearMediaPlaybackErrors()}},Ne=`.slides section`,Pe=`.slides>section`,Fe=`.slides>section.present>section`,Ie=`.backgrounds>.slide-background`,Le=/registerPlugin|registerKeyboardShortcut|addKeyBinding|addEventListener|showPreview|previewIframe/,Re=class{constructor(e){this.Reveal=e}render(){this.element=document.createElement(`div`),this.element.className=`slide-number`,this.Reveal.getRevealElement().appendChild(this.element)}configure(e,t){let n=`none`;e.slideNumber&&!this.Reveal.isPrintView()&&(e.showSlideNumber===`all`||e.showSlideNumber===`speaker`&&this.Reveal.isSpeakerNotes())&&(n=`block`),this.element.style.display=n}update(){this.Reveal.getConfig().slideNumber&&this.element&&(this.element.innerHTML=this.getSlideNumber())}getSlideNumber(e=this.Reveal.getCurrentSlide()){let t=this.Reveal.getConfig(),n,r=`h.v`;if(typeof t.slideNumber==`function`)n=t.slideNumber(e);else{typeof t.slideNumber==`string`&&(r=t.slideNumber),!/c/.test(r)&&this.Reveal.getHorizontalSlides().length===1&&(r=`c`);let i=e&&e.dataset.visibility===`uncounted`?0:1;switch(n=[],r){case`c`:n.push(this.Reveal.getSlidePastCount(e)+i);break;case`c/t`:n.push(this.Reveal.getSlidePastCount(e)+i,`/`,this.Reveal.getTotalSlides());break;default:let t=this.Reveal.getIndices(e);n.push(t.h+i);let a=r===`h/v`?`/`:`.`;this.Reveal.isVerticalSlide(e)&&n.push(a,t.v+1)}}let i=`#`+this.Reveal.location.getHash(e);return this.formatNumber(n[0],n[1],n[2],i)}formatNumber(e,t,n,r=`#`+this.Reveal.location.getHash()){return typeof n==`number`&&!isNaN(n)?`<a href="${r}">
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t,t as n}from"./useEvent-Dc9HkKI2.js";import{t as r}from"./react-CUdNIagt.js";import{Bt as i,D as a,na as o,oa as s,rt as c,ta as l}from"./cells-CxY8RSp7.js";import{t as u}from"./compiler-runtime-BQ9S8nyo.js";import{T as d,s as f}from"./config-Cyum2gRs.js";import{g as p,t as m}from"./useEventListener-IRzG-0mH.js";import{t as h}from"./utils-B4K466FK.js";import{m as g}from"./session-BykGt6S3.js";import{_}from"./config-D_c_6ce1.js";import{r as v}from"./state-ja7GWeCS.js";import{t as y}from"./cn-ldLVeaqm.js";import{t as b}from"./jsx-runtime-B74pBk57.js";import{n as x}from"./fullscreen-DEBblJKh.js";import{Ft as S}from"./JsonOutput-DCGUcLVV.js";import{t as C}from"./tooltip-B5pI8o2n.js";import{r as ee,t as w}from"./button-M49xxKoi.js";import{t as T}from"./createLucideIcon-rHn2EdoM.js";import{_ as E,d as D,f as O,g as k,s as A,u as j}from"./layout-CSLw6wGo.js";import{a as M}from"./useNumberFormatter-BP99Zbyy.js";import{t as te}from"./code-DW4kNwKG.js";import{t as ne}from"./eye-off-CfkK-QS3.js";import{n as N,t as re}from"./cell-editor-C3818WlB.js";import{n as ie,t as P}from"./RunButton-A__3wcpF.js";import{t as ae}from"./readonly-python-code-DcYhdd1B.js";import{r as oe}from"./useTheme-BkPLyRl9.js";import{r as se}from"./useDebounce-DMbg9X18.js";import{t as ce}from"./CellStatus-Bj7PvY_u.js";import{i as le}from"./useRunCells-zMO43eNR.js";import{n as ue,r as de,t as fe}from"./react-resizable-panels.browser.esm-BL2E7f5c.js";import{n as pe,t as me}from"./code-visibility-DNzJgrTz.js";import{t as he}from"./readonly-code-display-CNbw6v1-.js";/* empty css */var ge=T(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),F=e(r(),1),I=u(),L=(e,t)=>{for(let n in t)e[n]=t[n];return e},R=(e,t)=>Array.from(e.querySelectorAll(t)),_e=(e,t,n)=>{n?e.classList.add(t):e.classList.remove(t)},ve=e=>{if(typeof e==`string`){if(e===`null`)return null;if(e===`true`)return!0;if(e===`false`)return!1;if(e.match(/^-?[\d\.]+$/))return parseFloat(e)}return e},ye=(e,t)=>{e.style.transform=t},z=(e,t)=>{let n=e.matches||e.matchesSelector||e.msMatchesSelector;return!!(n&&n.call(e,t))},B=(e,t)=>{if(e&&typeof e.closest==`function`)return e.closest(t);for(;e;){if(z(e,t))return e;e=e.parentElement}return null},be=e=>{e||=document.documentElement;let t=e.requestFullscreen||e.webkitRequestFullscreen||e.webkitRequestFullScreen||e.mozRequestFullScreen||e.msRequestFullscreen;t&&t.apply(e)},xe=(e,t,n,r=``)=>{let i=e.querySelectorAll(`.`+n);for(let t=0;t<i.length;t++){let n=i[t];if(n.parentNode===e)return n}let a=document.createElement(t);return a.className=n,a.innerHTML=r,e.appendChild(a),a},Se=e=>{let t=document.createElement(`style`);return e&&e.length>0&&t.appendChild(document.createTextNode(e)),document.head.appendChild(t),t},Ce=()=>{let e={};location.search.replace(/[A-Z0-9]+?=([\w\.%-]*)/gi,t=>{let n=t.split(`=`).shift(),r=t.split(`=`).pop();return n&&r!==void 0&&(e[n]=r),t});for(let t in e){let n=e[t];e[t]=ve(unescape(n))}return e.dependencies!==void 0&&delete e.dependencies,e},we=(e,t=0)=>{if(e){let n,r=e.style.height;return e.style.height=`0px`,e.parentElement&&(e.parentElement.style.height=`auto`),n=t-(e.parentElement?.offsetHeight||0),e.style.height=r+`px`,e.parentElement&&e.parentElement.style.removeProperty(`height`),n}return t},V={mp4:`video/mp4`,m4a:`video/mp4`,ogv:`video/ogg`,mpeg:`video/mpeg`,webm:`video/webm`},H=(e=``)=>{let t=e.split(`.`).pop();return t?V[t]:void 0},Te=(e=``)=>encodeURI(e).replace(/%5B/g,`[`).replace(/%5D/g,`]`).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),U=navigator.userAgent,Ee=/(iphone|ipod|ipad|android)/gi.test(U)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1;/chrome/i.test(U)&&/edge/i.test(U);var De=/android/gi.test(U),Oe=function(e){if(e){var t=function(e){return[].slice.call(e)},n=0,r=1,i=2,a=3,o=[],s=null,c=`requestAnimationFrame`in e?function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{sync:!1};e.cancelAnimationFrame(s);var n=function(){return u(o.filter((function(e){return e.dirty&&e.active})))};if(t.sync)return n();s=e.requestAnimationFrame(n)}:function(){},l=function(e){return function(t){o.forEach((function(t){return t.dirty=e})),c(t)}},u=function(e){e.filter((function(e){return!e.styleComputed})).forEach((function(e){e.styleComputed=m(e)})),e.filter(h).forEach(g);var t=e.filter(p);t.forEach(f),t.forEach((function(e){g(e),d(e)})),t.forEach(_)},d=function(e){return e.dirty=n},f=function(e){e.availableWidth=e.element.parentNode.clientWidth,e.currentWidth=e.element.scrollWidth,e.previousFontSize=e.currentFontSize,e.currentFontSize=Math.min(Math.max(e.minSize,e.availableWidth/e.currentWidth*e.previousFontSize),e.maxSize),e.whiteSpace=e.multiLine&&e.currentFontSize===e.minSize?`normal`:`nowrap`},p=function(e){return e.dirty!==i||e.dirty===i&&e.element.parentNode.clientWidth!==e.availableWidth},m=function(t){var n=e.getComputedStyle(t.element,null);return t.currentFontSize=parseFloat(n.getPropertyValue(`font-size`)),t.display=n.getPropertyValue(`display`),t.whiteSpace=n.getPropertyValue(`white-space`),!0},h=function(e){var t=!1;return!e.preStyleTestCompleted&&(/inline-/.test(e.display)||(t=!0,e.display=`inline-block`),e.whiteSpace!==`nowrap`&&(t=!0,e.whiteSpace=`nowrap`),e.preStyleTestCompleted=!0,t)},g=function(e){e.element.style.whiteSpace=e.whiteSpace,e.element.style.display=e.display,e.element.style.fontSize=e.currentFontSize+`px`},_=function(e){e.element.dispatchEvent(new CustomEvent(`fit`,{detail:{oldValue:e.previousFontSize,newValue:e.currentFontSize,scaleFactor:e.currentFontSize/e.previousFontSize}}))},v=function(e,t){return function(n){e.dirty=t,e.active&&c(n)}},y=function(e){return function(){o=o.filter((function(t){return t.element!==e.element})),e.observeMutations&&e.observer.disconnect(),e.element.style.whiteSpace=e.originalStyle.whiteSpace,e.element.style.display=e.originalStyle.display,e.element.style.fontSize=e.originalStyle.fontSize}},b=function(e){return function(){e.active||(e.active=!0,c())}},x=function(e){return function(){return e.active=!1}},S=function(e){e.observeMutations&&(e.observer=new MutationObserver(v(e,r)),e.observer.observe(e.element,e.observeMutations))},C={minSize:16,maxSize:512,multiLine:!0,observeMutations:`MutationObserver`in e&&{subtree:!0,childList:!0,characterData:!0}},ee=null,w=function(){e.clearTimeout(ee),ee=e.setTimeout(l(i),D.observeWindowDelay)},T=[`resize`,`orientationchange`];return Object.defineProperty(D,"observeWindow",{set:function(t){var n=`${t?`add`:`remove`}EventListener`;T.forEach((function(t){e[n](t,w)}))}}),D.observeWindow=!0,D.observeWindowDelay=100,D.fitAll=l(a),D}function E(e,t){var n=Object.assign({},C,t),r=e.map((function(e){var t=Object.assign({},n,{element:e,active:!0});return function(e){e.originalStyle={whiteSpace:e.element.style.whiteSpace,display:e.element.style.display,fontSize:e.element.style.fontSize},S(e),e.newbie=!0,e.dirty=!0,o.push(e)}(t),{element:e,fit:v(t,a),unfreeze:b(t),freeze:x(t),unsubscribe:y(t)}}));return c(),r}function D(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return typeof e==`string`?E(t(document.querySelectorAll(e)),n):E([e],n)[0]}}(typeof window>`u`?null:window);function W(e){"@babel/helpers - typeof";return W=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},W(e)}function ke(e,t){if(W(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(W(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ae(e){var t=ke(e,`string`);return W(t)==`symbol`?t:t+``}function je(e,t,n){return(t=Ae(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Me=class{constructor(e){je(this,`allowedToPlayAudio`,null),this.Reveal=e,this.startEmbeddedMedia=this.startEmbeddedMedia.bind(this),this.startEmbeddedIframe=this.startEmbeddedIframe.bind(this),this.preventIframeAutoFocus=this.preventIframeAutoFocus.bind(this),this.ensureMobileMediaPlaying=this.ensureMobileMediaPlaying.bind(this),this.failedAudioPlaybackTargets=new Set,this.failedVideoPlaybackTargets=new Set,this.failedMutedVideoPlaybackTargets=new Set,this.renderMediaPlayButton()}renderMediaPlayButton(){this.mediaPlayButton=document.createElement(`button`),this.mediaPlayButton.className=`r-overlay-button r-media-play-button`,this.mediaPlayButton.addEventListener(`click`,()=>{this.resetTemporarilyMutedMedia(),new Set([...this.failedAudioPlaybackTargets,...this.failedVideoPlaybackTargets,...this.failedMutedVideoPlaybackTargets]).forEach(e=>{this.startEmbeddedMedia({target:e})}),this.clearMediaPlaybackErrors()})}shouldPreload(e){if(this.Reveal.isScrollView())return!0;let t=this.Reveal.getConfig().preloadIframes;return typeof t!=`boolean`&&(t=e.hasAttribute(`data-preload`)),t}load(e,t={}){let n=this.Reveal.getConfig().display;if(n.includes(`!important`)){let t=n.replace(/\s*!important\s*$/,``).trim();e.style.setProperty(`display`,t,`important`)}else e.style.display=n;R(e,`img[data-src], video[data-src], audio[data-src], iframe[data-src]`).forEach(e=>{let t=e.tagName===`IFRAME`;(!t||this.shouldPreload(e))&&(e.setAttribute(`src`,e.getAttribute(`data-src`)),e.setAttribute(`data-lazy-loaded`,``),e.removeAttribute(`data-src`),t&&e.addEventListener(`load`,this.preventIframeAutoFocus))}),R(e,`video, audio`).forEach(e=>{let t=0;R(e,`source[data-src]`).forEach(e=>{e.setAttribute(`src`,e.getAttribute(`data-src`)),e.removeAttribute(`data-src`),e.setAttribute(`data-lazy-loaded`,``),t+=1}),Ee&&e.tagName===`VIDEO`&&e.setAttribute(`playsinline`,``),t>0&&e.load()});let r=e.slideBackgroundElement;if(r){r.style.display=`block`;let n=e.slideBackgroundContentElement,i=e.getAttribute(`data-background-iframe`);if(r.hasAttribute(`data-loaded`)===!1){r.setAttribute(`data-loaded`,`true`);let a=e.getAttribute(`data-background-image`),o=e.getAttribute(`data-background-video`),s=e.hasAttribute(`data-background-video-loop`),c=e.hasAttribute(`data-background-video-muted`);if(a)/^data:/.test(a.trim())?n.style.backgroundImage=`url(${a.trim()})`:n.style.backgroundImage=a.split(`,`).map(e=>`url(${Te(decodeURI(e.trim()))})`).join(`,`);else if(o){let e=document.createElement(`video`);s&&e.setAttribute(`loop`,``),(c||this.Reveal.isSpeakerNotes())&&(e.muted=!0),Ee&&e.setAttribute(`playsinline`,``),o.split(`,`).forEach(t=>{let n=document.createElement(`source`);n.setAttribute(`src`,t);let r=H(t);r&&n.setAttribute(`type`,r),e.appendChild(n)}),n.appendChild(e)}else if(i&&t.excludeIframes!==!0){let e=document.createElement(`iframe`);e.setAttribute(`allowfullscreen`,``),e.setAttribute(`mozallowfullscreen`,``),e.setAttribute(`webkitallowfullscreen`,``),e.setAttribute(`allow`,`autoplay`),e.setAttribute(`data-src`,i),e.style.width=`100%`,e.style.height=`100%`,e.style.maxHeight=`100%`,e.style.maxWidth=`100%`,n.appendChild(e)}}let a=n.querySelector(`iframe[data-src]`);a&&this.shouldPreload(r)&&!/autoplay=(1|true|yes)/gi.test(i)&&a.getAttribute(`src`)!==i&&a.setAttribute(`src`,i)}this.layout(e)}layout(e){Array.from(e.querySelectorAll(`.r-fit-text`)).forEach(e=>{Oe(e,{minSize:24,maxSize:this.Reveal.getConfig().height*.8,observeMutations:!1,observeWindow:!1})})}unload(e){e.style.display=`none`;let t=this.Reveal.getSlideBackground(e);t&&(t.style.display=`none`,R(t,`iframe[src]`).forEach(e=>{e.removeAttribute(`src`)})),R(e,`video[data-lazy-loaded][src], audio[data-lazy-loaded][src], iframe[data-lazy-loaded][src]`).forEach(e=>{e.setAttribute(`data-src`,e.getAttribute(`src`)),e.removeAttribute(`src`)}),R(e,`video[data-lazy-loaded] source[src], audio source[src]`).forEach(e=>{e.setAttribute(`data-src`,e.getAttribute(`src`)),e.removeAttribute(`src`)})}formatEmbeddedContent(){let e=(e,t,n)=>{R(this.Reveal.getSlidesElement(),`iframe[`+e+`*="`+t+`"]`).forEach(t=>{let r=t.getAttribute(e);r&&r.indexOf(n)===-1&&t.setAttribute(e,r+(/\?/.test(r)?`&`:`?`)+n)})};e(`src`,`youtube.com/embed/`,`enablejsapi=1`),e(`data-src`,`youtube.com/embed/`,`enablejsapi=1`),e(`src`,`player.vimeo.com/`,`api=1`),e(`data-src`,`player.vimeo.com/`,`api=1`)}startEmbeddedContent(e){if(e){let t=this.Reveal.isSpeakerNotes();R(e,`img[src$=".gif"]`).forEach(e=>{e.setAttribute(`src`,e.getAttribute(`src`))}),R(e,`video, audio`).forEach(e=>{if(B(e,`.fragment`)&&!B(e,`.fragment.visible`))return;let n=this.Reveal.getConfig().autoPlayMedia;if(typeof n!=`boolean`&&(n=e.hasAttribute(`data-autoplay`)||!!B(e,`.slide-background`)),n&&typeof e.play==`function`){if(t&&!e.muted)return;e.readyState>1?this.startEmbeddedMedia({target:e}):Ee?(e.addEventListener(`canplay`,this.ensureMobileMediaPlaying),this.playMediaElement(e)):(e.removeEventListener(`loadeddata`,this.startEmbeddedMedia),e.addEventListener(`loadeddata`,this.startEmbeddedMedia))}}),t||(R(e,`iframe[src]`).forEach(e=>{B(e,`.fragment`)&&!B(e,`.fragment.visible`)||this.startEmbeddedIframe({target:e})}),R(e,`iframe[data-src]`).forEach(e=>{B(e,`.fragment`)&&!B(e,`.fragment.visible`)||e.getAttribute(`src`)!==e.getAttribute(`data-src`)&&(e.removeEventListener(`load`,this.startEmbeddedIframe),e.addEventListener(`load`,this.startEmbeddedIframe),e.setAttribute(`src`,e.getAttribute(`data-src`)))}))}}ensureMobileMediaPlaying(e){let t=e.target;typeof t.getVideoPlaybackQuality==`function`&&setTimeout(()=>{let e=t.paused===!1,n=t.getVideoPlaybackQuality().totalVideoFrames;e&&n===0&&(t.load(),t.play())},1e3)}startEmbeddedMedia(e){let t=!!B(e.target,`html`),n=!!B(e.target,`.present`);t&&n&&(e.target.paused||e.target.ended)&&(e.target.currentTime=0,this.playMediaElement(e.target)),e.target.removeEventListener(`loadeddata`,this.startEmbeddedMedia)}playMediaElement(e){let t=e.play();t&&typeof t.catch==`function`&&t.then(()=>{e.muted||(this.allowedToPlayAudio=!0)}).catch(t=>{if(t.name===`NotAllowedError`){if(this.allowedToPlayAudio=!1,e.tagName===`VIDEO`){this.onVideoPlaybackNotAllowed(e);let t=!!B(e,`html`),n=!!B(e,`.present`),r=e.muted;t&&n&&!r&&(e.setAttribute(`data-muted-by-reveal`,`true`),e.muted=!0,e.play().catch(()=>{this.onMutedVideoPlaybackNotAllowed(e)}))}else e.tagName===`AUDIO`&&this.onAudioPlaybackNotAllowed(e)}})}startEmbeddedIframe(e){let t=e.target;if(this.preventIframeAutoFocus(e),t&&t.contentWindow){let n=!!B(e.target,`html`),r=!!B(e.target,`.present`);if(n&&r){let e=this.Reveal.getConfig().autoPlayMedia;typeof e!=`boolean`&&(e=t.hasAttribute(`data-autoplay`)||!!B(t,`.slide-background`)),/youtube\.com\/embed\//.test(t.getAttribute(`src`))&&e?t.contentWindow.postMessage(`{"event":"command","func":"playVideo","args":""}`,`*`):/player\.vimeo\.com\//.test(t.getAttribute(`src`))&&e?t.contentWindow.postMessage(`{"method":"play"}`,`*`):t.contentWindow.postMessage(`slide:start`,`*`)}}}stopEmbeddedContent(e,t={}){t=L({unloadIframes:!0},t),e&&e.parentNode&&(R(e,`video, audio`).forEach(e=>{!e.hasAttribute(`data-ignore`)&&typeof e.pause==`function`&&(e.setAttribute(`data-paused-by-reveal`,``),e.pause(),Ee&&e.removeEventListener(`canplay`,this.ensureMobileMediaPlaying))}),R(e,`iframe`).forEach(e=>{e.contentWindow&&e.contentWindow.postMessage(`slide:stop`,`*`),e.removeEventListener(`load`,this.preventIframeAutoFocus),e.removeEventListener(`load`,this.startEmbeddedIframe)}),R(e,`iframe[src*="youtube.com/embed/"]`).forEach(e=>{!e.hasAttribute(`data-ignore`)&&e.contentWindow&&typeof e.contentWindow.postMessage==`function`&&e.contentWindow.postMessage(`{"event":"command","func":"pauseVideo","args":""}`,`*`)}),R(e,`iframe[src*="player.vimeo.com/"]`).forEach(e=>{!e.hasAttribute(`data-ignore`)&&e.contentWindow&&typeof e.contentWindow.postMessage==`function`&&e.contentWindow.postMessage(`{"method":"pause"}`,`*`)}),t.unloadIframes===!0&&R(e,`iframe[data-src]`).forEach(e=>{e.setAttribute(`src`,`about:blank`),e.removeAttribute(`src`)}))}isAllowedToPlayAudio(){return this.allowedToPlayAudio}showPlayOrUnmuteButton(){let e=this.failedAudioPlaybackTargets.size,t=this.failedVideoPlaybackTargets.size,n=this.failedMutedVideoPlaybackTargets.size,r=`Play media`;n>0?r=`Play video`:t>0?r=`Unmute video`:e>0&&(r=`Play audio`),this.mediaPlayButton.textContent=r,this.Reveal.getRevealElement().appendChild(this.mediaPlayButton)}onAudioPlaybackNotAllowed(e){this.failedAudioPlaybackTargets.add(e),this.showPlayOrUnmuteButton(e)}onVideoPlaybackNotAllowed(e){this.failedVideoPlaybackTargets.add(e),this.showPlayOrUnmuteButton()}onMutedVideoPlaybackNotAllowed(e){this.failedMutedVideoPlaybackTargets.add(e),this.showPlayOrUnmuteButton()}resetTemporarilyMutedMedia(){new Set([...this.failedAudioPlaybackTargets,...this.failedVideoPlaybackTargets,...this.failedMutedVideoPlaybackTargets]).forEach(e=>{e.hasAttribute(`data-muted-by-reveal`)&&(e.muted=!1,e.removeAttribute(`data-muted-by-reveal`))})}clearMediaPlaybackErrors(){this.resetTemporarilyMutedMedia(),this.failedAudioPlaybackTargets.clear(),this.failedVideoPlaybackTargets.clear(),this.failedMutedVideoPlaybackTargets.clear(),this.mediaPlayButton&&this.mediaPlayButton.parentNode&&this.mediaPlayButton.remove()}preventIframeAutoFocus(e){let t=e.target;if(t&&this.Reveal.getConfig().preventIframeAutoFocus){let e=0,n=()=>{document.activeElement===t?document.activeElement.blur():e<1e3&&(e+=100,setTimeout(n,100))};setTimeout(n,100)}}afterSlideChanged(){this.clearMediaPlaybackErrors()}},Ne=`.slides section`,Pe=`.slides>section`,Fe=`.slides>section.present>section`,Ie=`.backgrounds>.slide-background`,Le=/registerPlugin|registerKeyboardShortcut|addKeyBinding|addEventListener|showPreview|previewIframe/,Re=class{constructor(e){this.Reveal=e}render(){this.element=document.createElement(`div`),this.element.className=`slide-number`,this.Reveal.getRevealElement().appendChild(this.element)}configure(e,t){let n=`none`;e.slideNumber&&!this.Reveal.isPrintView()&&(e.showSlideNumber===`all`||e.showSlideNumber===`speaker`&&this.Reveal.isSpeakerNotes())&&(n=`block`),this.element.style.display=n}update(){this.Reveal.getConfig().slideNumber&&this.element&&(this.element.innerHTML=this.getSlideNumber())}getSlideNumber(e=this.Reveal.getCurrentSlide()){let t=this.Reveal.getConfig(),n,r=`h.v`;if(typeof t.slideNumber==`function`)n=t.slideNumber(e);else{typeof t.slideNumber==`string`&&(r=t.slideNumber),!/c/.test(r)&&this.Reveal.getHorizontalSlides().length===1&&(r=`c`);let i=e&&e.dataset.visibility===`uncounted`?0:1;switch(n=[],r){case`c`:n.push(this.Reveal.getSlidePastCount(e)+i);break;case`c/t`:n.push(this.Reveal.getSlidePastCount(e)+i,`/`,this.Reveal.getTotalSlides());break;default:let t=this.Reveal.getIndices(e);n.push(t.h+i);let a=r===`h/v`?`/`:`.`;this.Reveal.isVerticalSlide(e)&&n.push(a,t.v+1)}}let i=`#`+this.Reveal.location.getHash(e);return this.formatNumber(n[0],n[1],n[2],i)}formatNumber(e,t,n,r=`#`+this.Reveal.location.getHash()){return typeof n==`number`&&!isNaN(n)?`<a href="${r}">
|
|
2
2
|
<span class="slide-number-a">${e}</span>
|
|
3
3
|
<span class="slide-number-delimiter">${t}</span>
|
|
4
4
|
<span class="slide-number-b">${n}</span>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r}from"./useEvent-Dc9HkKI2.js";import{t as i}from"./react-CUdNIagt.js";import{D as a,La as o,g as s,oo as c,x as l}from"./cells-CxY8RSp7.js";import{t as u}from"./compiler-runtime-BQ9S8nyo.js";import{C as d}from"./config-Cyum2gRs.js";import{r as f}from"./utils-B4K466FK.js";import{t as p}from"./session-BykGt6S3.js";import{_ as m,l as h,p as g,w as _}from"./config-D_c_6ce1.js";import{t as v}from"./cn-ldLVeaqm.js";import{t as y}from"./jsx-runtime-B74pBk57.js";import{a as b,c as x,i as S,l as C,n as w,s as T,t as E}from"./alert-dialog-DlL1c-bx.js";import{I as D,It as ee}from"./JsonOutput-NVH7GWyC.js";import{n as te}from"./download-CPMAf7re.js";import{i as O,n as k,r as ne,t as re}from"./tabs-QRT1DYjj.js";import{n as A,t as j}from"./button-M49xxKoi.js";import{n as ie}from"./paths-CzfpItSz.js";import{t as M}from"./arrow-left-DzPJ79ZB.js";import{t as N}from"./copy-RyCOE8jo.js";import{a as P,i as F,n as I,o as L,r as R,t as ae}from"./panels-CO6Clgel.js";import{t as oe}from"./house-CbkYoQ5W.js";import{t as z}from"./spinner-CGdRKCnw.js";import{l as B,s as V}from"./readonly-python-code-DcYhdd1B.js";import{Jt as H,Qt as U,Xt as W,Yt as G,nn as K,tn as q}from"./input-DPd57MDP.js";import{n as J}from"./copy-D03Y7IMR.js";import{t as Y}from"./use-toast-CC89xOwH.js";import{r as se}from"./requests-yTHMxhVa.js";import{t as ce}from"./shell-BSnvn9t7.js";import{t as le}from"./share-BZW3tzEX.js";import{a as ue}from"./cell-link-DC1UZQr_.js";import{n as de,t as fe}from"./react-resizable-panels.browser.esm-BL2E7f5c.js";import{n as pe}from"./code-visibility-DNzJgrTz.js";import{n as me,t as he}from"./marimo-icons-B_1oPpIE.js";import{t as ge}from"./state-B2ZbImvm.js";var _e=e(i(),1),X=u(),Z=y(),ve=()=>{let e=(0,X.c)(25),[n,r]=t(ge);if(n===null)return null;let i;e[0]===n?i=e[1]:(i=async()=>{try{await navigator.clipboard.writeText(n),Y({title:`Copied to clipboard`,description:`Error details have been copied to your clipboard.`})}catch{Y({title:`Failed to copy`,description:`Could not copy to clipboard.`,variant:`danger`})}},e[0]=n,e[1]=i);let a=i,o;e[2]===r?o=e[3]:(o=()=>{r(null)},e[2]=r,e[3]=o);let s=o,l=ye,u;e[4]===s?u=e[5]:(u=e=>!e&&s(),e[4]=s,e[5]=u);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(x,{children:[(0,Z.jsxs)(C,{className:`flex items-center gap-2 text-destructive`,children:[(0,Z.jsx)(c,{className:`h-5 w-5`}),`Kernel Startup Failed`]}),(0,Z.jsx)(b,{children:`The kernel failed to start. This usually happens when the package manager can't install your notebook's dependencies.`})]}),e[6]=d):d=e[6];let f;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`span`,{className:`text-sm font-medium text-muted-foreground`,children:`Error Details`}),e[7]=f):f=e[7];let p;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(N,{className:`h-3 w-3`}),e[8]=p):p=e[8];let m;e[9]===a?m=e[10]:(m=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[f,(0,Z.jsxs)(j,{variant:`outline`,size:`xs`,onClick:a,className:`flex items-center gap-1`,children:[p,`Copy`]})]}),e[9]=a,e[10]=m);let h;e[11]===n?h=e[12]:(h=(0,Z.jsx)(`pre`,{className:`bg-muted p-4 rounded-md text-sm font-mono overflow-auto max-h-80`,children:n}),e[11]=n,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`my-4 overflow-hidden`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsxs)(j,{variant:`outline`,onClick:l,className:`flex items-center gap-2`,children:[(0,Z.jsx)(oe,{className:`h-4 w-4`}),`Return to Home`]}),e[16]=_):_=e[16];let v;e[17]===s?v=e[18]:(v=(0,Z.jsxs)(T,{children:[_,(0,Z.jsx)(w,{onClick:s,children:`Dismiss`})]}),e[17]=s,e[18]=v);let y;e[19]!==v||e[20]!==g?(y=(0,Z.jsxs)(S,{className:`max-w-2xl`,children:[d,g,v]}),e[19]=v,e[20]=g,e[21]=y):y=e[21];let D;return e[22]!==y||e[23]!==u?(D=(0,Z.jsx)(E,{open:!0,onOpenChange:u,children:y}),e[22]=y,e[23]=u,e[24]=D):D=e[24],D};function ye(){let e=document.baseURI.split(`?`)[0];window.open(e,`_self`)}var be=e=>{let t=(0,X.c)(2),{reason:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`font-mono text-center text-base text-(--red-11)`,children:(0,Z.jsx)(`p`,{children:n})}),t[0]=n,t[1]=r),r},xe=e=>{let t=(0,X.c)(7),{connection:n,className:r,children:i}=e,a;t[0]!==n.reason||t[1]!==n.state?(a=n.state===_.CLOSED&&(0,Z.jsx)(be,{reason:n.reason}),t[0]=n.reason,t[1]=n.state,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==r||t[5]!==a?(o=(0,Z.jsxs)(`div`,{className:r,children:[i,a]}),t[3]=i,t[4]=r,t[5]=a,t[6]=o):o=t[6],o},Q=n(e=>e(s)||!g(e(m).state)),Se=e=>{let t=(0,X.c)(22),{appConfig:n,hideHeader:i}=e,{setCells:o}=a(),{sendComponentValues:s}=se(),c;t[0]===s?c=t[1]:(c=()=>(R.INSTANCE.start(s),Ce),t[0]=s,t[1]=c);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[2]=u):u=t[2],(0,_e.useEffect)(c,u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=p(),t[3]=d):d=t[3];let f;t[4]===o?f=t[5]:(f={autoInstantiate:!0,setCells:o,sessionId:d},t[4]=o,t[5]=f);let{connection:m,reconnect:h}=I(f),g=r(l),_;if(t[6]===Symbol.for(`react.memo_cache_sentinel`)){bb0:{if(typeof window>`u`){_=null;break bb0}let e=new URL(window.location.href);if(!e.searchParams.has(`file`)){_=null;break bb0}e.searchParams.delete(`file`);let t=e.searchParams.toString();_=t?`${e.pathname}?${t}`:e.pathname}t[6]=_}else _=t[6];let y=_,b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(ve,{}),t[7]=b):b=t[7];let x=i?`hidden`:`sm:pt-8`,S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=y&&(0,Z.jsx)(`div`,{className:`flex items-center px-6 pt-4 sm:-mt-8`,children:(0,Z.jsxs)(`a`,{href:y,"aria-label":`Back to gallery`,className:v(A({variant:`text`,size:`sm`}),`gap-2 px-0 text-muted-foreground hover:text-foreground`),children:[(0,Z.jsx)(M,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:`Back`})]})}),t[8]=S):S=t[8];let C;t[9]!==m||t[10]!==x?(C=(0,Z.jsx)(xe,{connection:m,className:x,children:S}),t[9]=m,t[10]=x,t[11]=C):C=t[11];let w;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z,{className:`mx-auto`}),(0,Z.jsx)(`p`,{className:`text-center text-sm text-muted-foreground mt-2`,children:`Connecting...`})]}),t[12]=w):w=t[12];let T;t[13]===n?T=t[14]:(T=(0,Z.jsx)(L,{requires:Q,delay:2e3,fallback:w,children:(0,Z.jsx)(F,{appConfig:n,mode:`read`})}),t[13]=n,t[14]=T);let E;return t[15]!==n.width||t[16]!==m||t[17]!==g||t[18]!==h||t[19]!==T||t[20]!==C?(E=(0,Z.jsxs)(P,{connection:m,isRunning:g,width:n.width,onReconnect:h,children:[b,C,T]}),t[15]=n.width,t[16]=m,t[17]=g,t[18]=h,t[19]=T,t[20]=C,t[21]=E):E=t[21],E};function Ce(){R.INSTANCE.stop()}var we=()=>{let e=(0,X.c)(3),t=r(o);if(!h()||!t)return null;let n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`span`,{children:[`Static`,` `,(0,Z.jsx)(`a`,{href:f.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-(--sky-11) font-medium underline`,children:`marimo`}),` `,`notebook - Run or edit for full interactivity`]}),e[0]=n):n=e[0];let i;return e[1]===t?i=e[2]:(i=(0,Z.jsxs)(`div`,{className:`px-4 py-2 bg-(--sky-2) border-b border-(--sky-7) text-(--sky-11) flex justify-between items-center gap-4 print:hidden text-sm`,"data-testid":`static-notebook-banner`,children:[n,(0,Z.jsx)(`span`,{className:`shrink-0`,children:(0,Z.jsx)(Te,{code:t})})]}),e[1]=t,e[2]=i),i},Te=e=>{let t=(0,X.c)(44),{code:n}=e,r=ie.basename(ue()||`notebook.py`),[i]=d(),a=i.sharing?.molab??!0,o=Ee(window.location.href,r),s=o!==r,c=ce(o),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(K,{asChild:!0,children:(0,Z.jsx)(j,{"data-testid":`static-notebook-dialog-trigger`,variant:`outline`,size:`xs`,children:`Run or Edit`})}),t[0]=l):l=t[0];let u;t[1]===r?u=t[2]:(u=(0,Z.jsx)(q,{children:r}),t[1]=r,t[2]=u);let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`a`,{href:f.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-(--sky-11) hover:underline font-medium`,children:`marimo`}),t[3]=p):p=t[3];let m=s?`Run it`:`Download it, then run it`,h;t[4]===m?h=t[5]:(h=(0,Z.jsxs)(`p`,{children:[`This is a static`,` `,p,` `,`notebook. `,m,` `,`locally for full interactivity.`]}),t[4]=m,t[5]=h);let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(ne,{"aria-label":`Package manager`,children:[(0,Z.jsx)(O,{value:`uv`,children:`uv`}),(0,Z.jsx)(O,{value:`pip`,children:`pip`}),(0,Z.jsx)(O,{value:`conda`,children:`conda`})]}),t[6]=g):g=t[6];let _=`uvx marimo edit --sandbox ${c}`,v;t[7]===_?v=t[8]:(v=(0,Z.jsx)(k,{value:`uv`,children:(0,Z.jsx)($,{command:_})}),t[7]=_,t[8]=v);let y=`pip install marimo\nmarimo edit ${c}`,b;t[9]===y?b=t[10]:(b=(0,Z.jsx)(k,{value:`pip`,children:(0,Z.jsx)($,{command:y})}),t[9]=y,t[10]=b);let x=`conda install -c conda-forge marimo\nmarimo edit ${c}`,S;t[11]===x?S=t[12]:(S=(0,Z.jsx)(k,{value:`conda`,children:(0,Z.jsx)($,{command:x})}),t[11]=x,t[12]=S);let C;t[13]!==b||t[14]!==S||t[15]!==v?(C=(0,Z.jsxs)(re,{defaultValue:`uv`,children:[g,v,b,S]}),t[13]=b,t[14]=S,t[15]=v,t[16]=C):C=t[16];let w;t[17]!==n||t[18]!==a?(w=a&&(0,Z.jsx)(De,{code:n}),t[17]=n,t[18]=a,t[19]=w):w=t[19];let T;t[20]!==C||t[21]!==w||t[22]!==h?(T=(0,Z.jsx)(W,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`pt-3 text-left space-y-3`,children:[h,C,w]})}),t[20]=C,t[21]=w,t[22]=h,t[23]=T):T=t[23];let E;t[24]!==T||t[25]!==u?(E=(0,Z.jsxs)(U,{children:[u,T]}),t[24]=T,t[25]=u,t[26]=E):E=t[26];let D;t[27]===n?D=t[28]:(D=async()=>{await J(n),Y({title:`Copied to clipboard`})},t[27]=n,t[28]=D);let A;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(N,{className:`w-3 h-3 mr-2`}),t[29]=A):A=t[29];let M;t[30]===D?M=t[31]:(M=(0,Z.jsxs)(j,{"data-testid":`copy-static-notebook-dialog-button`,variant:`outline`,size:`sm`,onClick:D,children:[A,`Copy code`]}),t[30]=D,t[31]=M);let P;t[32]!==n||t[33]!==r?(P=()=>{te(new Blob([n],{type:`text/plain`}),r)},t[32]=n,t[33]=r,t[34]=P):P=t[34];let F;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(ee,{className:`w-3 h-3 mr-2`}),t[35]=F):F=t[35];let I;t[36]===P?I=t[37]:(I=(0,Z.jsxs)(j,{"data-testid":`download-static-notebook-dialog-button`,variant:`outline`,size:`sm`,onClick:P,children:[F,`Download`]}),t[36]=P,t[37]=I);let L;t[38]!==M||t[39]!==I?(L=(0,Z.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[M,I]}),t[38]=M,t[39]=I,t[40]=L):L=t[40];let R;return t[41]!==E||t[42]!==L?(R=(0,Z.jsxs)(H,{children:[l,(0,Z.jsxs)(G,{children:[E,L]})]}),t[41]=E,t[42]=L,t[43]=R):R=t[43],R};function Ee(e,t){let n=new URL(e);if(n.protocol!==`http:`&&n.protocol!==`https:`)return t;let r=n.pathname.endsWith(`.html`)&&n.search===``,i=n.protocol===`https:`&&(n.hostname===`marimo.app`||n.hostname===`links.marimo.app`||n.hostname===`static.marimo.app`&&n.pathname.startsWith(`/static`)||n.pathname.includes(`/notebooks/nb`));return!r&&!i?t:(n.hash=``,n.href)}var $=e=>{let t=(0,X.c)(10),{command:n}=e,r;t[0]===n?r=t[1]:(r=(0,Z.jsx)(`pre`,{className:`p-3 pr-10 font-mono text-(--sky-11) leading-relaxed whitespace-pre-wrap break-all`,children:n}),t[0]=n,t[1]=r);let i;t[2]===n?i=t[3]:(i=async()=>{await J(n),Y({title:`Command copied to clipboard`})},t[2]=n,t[3]=i);let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(N,{className:`w-3.5 h-3.5`}),t[4]=a):a=t[4];let o;t[5]===i?o=t[6]:(o=(0,Z.jsx)(j,{"aria-label":`Copy command`,className:`absolute right-2 top-2`,variant:`ghost`,size:`icon`,onClick:i,children:a}),t[5]=i,t[6]=o);let s;return t[7]!==r||t[8]!==o?(s=(0,Z.jsxs)(`div`,{className:`relative rounded-lg border bg-(--sky-2) border-(--sky-7)`,children:[r,o]}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s},De=e=>{let t=(0,X.c)(8),{code:n}=e,r;t[0]===n?r=t[1]:(r=le({code:n,baseUrl:`${f.molab}/new`}),t[0]=n,t[1]=r);let i=r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(me,{size:12,strokeWidth:1.5,className:`mr-1.5 mt-px text-(--grass-11)`}),t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,Z.jsx)(j,{asChild:!0,variant:`outline`,size:`xs`,className:`shrink-0`,children:(0,Z.jsxs)(`a`,{href:i,target:`_blank`,rel:`noopener noreferrer`,children:[a,`Open in molab`]})}),t[3]=i,t[4]=o);let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsxs)(`p`,{className:`text-sm text-(--sky-12)`,children:[`Run this notebook in `,(0,Z.jsx)(`span`,{className:`font-semibold`,children:`molab`}),`, marimo's cloud-hosted notebook platform.`]}),t[5]=s):s=t[5];let c;return t[6]===o?c=t[7]:(c=(0,Z.jsxs)(`div`,{className:`pt-3 border-t flex gap-2 items-center`,children:[o,s]}),t[6]=o,t[7]=c),c},Oe=e=>{let t=(0,X.c)(17),n=r(pe).kind,i=n===`static`||n===`wasm`,{selectedLayout:a}=B(),o;t[0]===a?o=t[1]:(o=V({selectedLayout:a,isReading:!0,searchParams:new URLSearchParams(window.location.search)}),t[0]=a,t[1]=o);let s=i&&o===`slides`,c;t[2]===s?c=t[3]:(c=!s&&(0,Z.jsx)(we,{}),t[2]=s,t[3]=c);let l;t[4]!==s||t[5]!==e.appConfig?(l=(0,Z.jsx)(Se,{appConfig:e.appConfig,hideHeader:s}),t[4]=s,t[5]=e.appConfig,t[6]=l):l=t[6];let u;t[7]!==i||t[8]!==s?(u=i&&!s&&(0,Z.jsx)(ke,{}),t[7]=i,t[8]=s,t[9]=u):u=t[9];let d;t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,Z.jsxs)(fe,{children:[c,l,u]}),t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(D,{}),t[14]=f):f=t[14];let p;return t[15]===d?p=t[16]:(p=(0,Z.jsx)(ae,{children:(0,Z.jsxs)(de,{direction:`horizontal`,autoSaveId:`marimo:chrome:v1:run1`,children:[d,f]})}),t[15]=d,t[16]=p),p},ke=()=>{let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:`fixed bottom-0 right-0 z-50 print:hidden`,"data-testid":`watermark`,children:(0,Z.jsxs)(`a`,{href:f.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-sm text-(--grass-11) font-bold tracking-wide transition-colors bg-(--grass-4) hover:bg-(--grass-5) border-t border-l border-(--grass-8) px-3 py-1 rounded-tl-md flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{children:`made with marimo`}),(0,Z.jsx)(he,{className:`h-4 w-auto`})]})}),e[0]=t):t=e[0],t};export{Oe as default};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r}from"./useEvent-Dc9HkKI2.js";import{t as i}from"./react-CUdNIagt.js";import{D as a,La as o,g as s,oo as c,x as l}from"./cells-CxY8RSp7.js";import{t as u}from"./compiler-runtime-BQ9S8nyo.js";import{C as d}from"./config-Cyum2gRs.js";import{r as f}from"./utils-B4K466FK.js";import{t as p}from"./session-BykGt6S3.js";import{_ as m,l as h,p as g,w as _}from"./config-D_c_6ce1.js";import{t as v}from"./cn-ldLVeaqm.js";import{t as y}from"./jsx-runtime-B74pBk57.js";import{a as b,c as x,i as S,l as C,n as w,s as T,t as E}from"./alert-dialog-DlL1c-bx.js";import{I as D,It as ee}from"./JsonOutput-DCGUcLVV.js";import{n as te}from"./download-CPMAf7re.js";import{i as O,n as k,r as ne,t as re}from"./tabs-QRT1DYjj.js";import{n as A,t as j}from"./button-M49xxKoi.js";import{n as ie}from"./paths-CzfpItSz.js";import{t as M}from"./arrow-left-DzPJ79ZB.js";import{t as N}from"./copy-RyCOE8jo.js";import{a as P,i as F,n as I,o as L,r as R,t as ae}from"./panels-BdsXFz1w.js";import{t as oe}from"./house-CbkYoQ5W.js";import{t as z}from"./spinner-CGdRKCnw.js";import{l as B,s as V}from"./readonly-python-code-DcYhdd1B.js";import{Jt as H,Qt as U,Xt as W,Yt as G,nn as K,tn as q}from"./input-DPd57MDP.js";import{n as J}from"./copy-D03Y7IMR.js";import{t as Y}from"./use-toast-CC89xOwH.js";import{r as se}from"./requests-yTHMxhVa.js";import{t as ce}from"./shell-BSnvn9t7.js";import{t as le}from"./share-BZW3tzEX.js";import{a as ue}from"./cell-link-DC1UZQr_.js";import{n as de,t as fe}from"./react-resizable-panels.browser.esm-BL2E7f5c.js";import{n as pe}from"./code-visibility-DNzJgrTz.js";import{n as me,t as he}from"./marimo-icons-B_1oPpIE.js";import{t as ge}from"./state-B2ZbImvm.js";var _e=e(i(),1),X=u(),Z=y(),ve=()=>{let e=(0,X.c)(25),[n,r]=t(ge);if(n===null)return null;let i;e[0]===n?i=e[1]:(i=async()=>{try{await navigator.clipboard.writeText(n),Y({title:`Copied to clipboard`,description:`Error details have been copied to your clipboard.`})}catch{Y({title:`Failed to copy`,description:`Could not copy to clipboard.`,variant:`danger`})}},e[0]=n,e[1]=i);let a=i,o;e[2]===r?o=e[3]:(o=()=>{r(null)},e[2]=r,e[3]=o);let s=o,l=ye,u;e[4]===s?u=e[5]:(u=e=>!e&&s(),e[4]=s,e[5]=u);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(x,{children:[(0,Z.jsxs)(C,{className:`flex items-center gap-2 text-destructive`,children:[(0,Z.jsx)(c,{className:`h-5 w-5`}),`Kernel Startup Failed`]}),(0,Z.jsx)(b,{children:`The kernel failed to start. This usually happens when the package manager can't install your notebook's dependencies.`})]}),e[6]=d):d=e[6];let f;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`span`,{className:`text-sm font-medium text-muted-foreground`,children:`Error Details`}),e[7]=f):f=e[7];let p;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(N,{className:`h-3 w-3`}),e[8]=p):p=e[8];let m;e[9]===a?m=e[10]:(m=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[f,(0,Z.jsxs)(j,{variant:`outline`,size:`xs`,onClick:a,className:`flex items-center gap-1`,children:[p,`Copy`]})]}),e[9]=a,e[10]=m);let h;e[11]===n?h=e[12]:(h=(0,Z.jsx)(`pre`,{className:`bg-muted p-4 rounded-md text-sm font-mono overflow-auto max-h-80`,children:n}),e[11]=n,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`my-4 overflow-hidden`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsxs)(j,{variant:`outline`,onClick:l,className:`flex items-center gap-2`,children:[(0,Z.jsx)(oe,{className:`h-4 w-4`}),`Return to Home`]}),e[16]=_):_=e[16];let v;e[17]===s?v=e[18]:(v=(0,Z.jsxs)(T,{children:[_,(0,Z.jsx)(w,{onClick:s,children:`Dismiss`})]}),e[17]=s,e[18]=v);let y;e[19]!==v||e[20]!==g?(y=(0,Z.jsxs)(S,{className:`max-w-2xl`,children:[d,g,v]}),e[19]=v,e[20]=g,e[21]=y):y=e[21];let D;return e[22]!==y||e[23]!==u?(D=(0,Z.jsx)(E,{open:!0,onOpenChange:u,children:y}),e[22]=y,e[23]=u,e[24]=D):D=e[24],D};function ye(){let e=document.baseURI.split(`?`)[0];window.open(e,`_self`)}var be=e=>{let t=(0,X.c)(2),{reason:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`font-mono text-center text-base text-(--red-11)`,children:(0,Z.jsx)(`p`,{children:n})}),t[0]=n,t[1]=r),r},xe=e=>{let t=(0,X.c)(7),{connection:n,className:r,children:i}=e,a;t[0]!==n.reason||t[1]!==n.state?(a=n.state===_.CLOSED&&(0,Z.jsx)(be,{reason:n.reason}),t[0]=n.reason,t[1]=n.state,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==r||t[5]!==a?(o=(0,Z.jsxs)(`div`,{className:r,children:[i,a]}),t[3]=i,t[4]=r,t[5]=a,t[6]=o):o=t[6],o},Q=n(e=>e(s)||!g(e(m).state)),Se=e=>{let t=(0,X.c)(22),{appConfig:n,hideHeader:i}=e,{setCells:o}=a(),{sendComponentValues:s}=se(),c;t[0]===s?c=t[1]:(c=()=>(R.INSTANCE.start(s),Ce),t[0]=s,t[1]=c);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[2]=u):u=t[2],(0,_e.useEffect)(c,u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=p(),t[3]=d):d=t[3];let f;t[4]===o?f=t[5]:(f={autoInstantiate:!0,setCells:o,sessionId:d},t[4]=o,t[5]=f);let{connection:m,reconnect:h}=I(f),g=r(l),_;if(t[6]===Symbol.for(`react.memo_cache_sentinel`)){bb0:{if(typeof window>`u`){_=null;break bb0}let e=new URL(window.location.href);if(!e.searchParams.has(`file`)){_=null;break bb0}e.searchParams.delete(`file`);let t=e.searchParams.toString();_=t?`${e.pathname}?${t}`:e.pathname}t[6]=_}else _=t[6];let y=_,b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(ve,{}),t[7]=b):b=t[7];let x=i?`hidden`:`sm:pt-8`,S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=y&&(0,Z.jsx)(`div`,{className:`flex items-center px-6 pt-4 sm:-mt-8`,children:(0,Z.jsxs)(`a`,{href:y,"aria-label":`Back to gallery`,className:v(A({variant:`text`,size:`sm`}),`gap-2 px-0 text-muted-foreground hover:text-foreground`),children:[(0,Z.jsx)(M,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:`Back`})]})}),t[8]=S):S=t[8];let C;t[9]!==m||t[10]!==x?(C=(0,Z.jsx)(xe,{connection:m,className:x,children:S}),t[9]=m,t[10]=x,t[11]=C):C=t[11];let w;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z,{className:`mx-auto`}),(0,Z.jsx)(`p`,{className:`text-center text-sm text-muted-foreground mt-2`,children:`Connecting...`})]}),t[12]=w):w=t[12];let T;t[13]===n?T=t[14]:(T=(0,Z.jsx)(L,{requires:Q,delay:2e3,fallback:w,children:(0,Z.jsx)(F,{appConfig:n,mode:`read`})}),t[13]=n,t[14]=T);let E;return t[15]!==n.width||t[16]!==m||t[17]!==g||t[18]!==h||t[19]!==T||t[20]!==C?(E=(0,Z.jsxs)(P,{connection:m,isRunning:g,width:n.width,onReconnect:h,children:[b,C,T]}),t[15]=n.width,t[16]=m,t[17]=g,t[18]=h,t[19]=T,t[20]=C,t[21]=E):E=t[21],E};function Ce(){R.INSTANCE.stop()}var we=()=>{let e=(0,X.c)(3),t=r(o);if(!h()||!t)return null;let n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`span`,{children:[`Static`,` `,(0,Z.jsx)(`a`,{href:f.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-(--sky-11) font-medium underline`,children:`marimo`}),` `,`notebook - Run or edit for full interactivity`]}),e[0]=n):n=e[0];let i;return e[1]===t?i=e[2]:(i=(0,Z.jsxs)(`div`,{className:`px-4 py-2 bg-(--sky-2) border-b border-(--sky-7) text-(--sky-11) flex justify-between items-center gap-4 print:hidden text-sm`,"data-testid":`static-notebook-banner`,children:[n,(0,Z.jsx)(`span`,{className:`shrink-0`,children:(0,Z.jsx)(Te,{code:t})})]}),e[1]=t,e[2]=i),i},Te=e=>{let t=(0,X.c)(44),{code:n}=e,r=ie.basename(ue()||`notebook.py`),[i]=d(),a=i.sharing?.molab??!0,o=Ee(window.location.href,r),s=o!==r,c=ce(o),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(K,{asChild:!0,children:(0,Z.jsx)(j,{"data-testid":`static-notebook-dialog-trigger`,variant:`outline`,size:`xs`,children:`Run or Edit`})}),t[0]=l):l=t[0];let u;t[1]===r?u=t[2]:(u=(0,Z.jsx)(q,{children:r}),t[1]=r,t[2]=u);let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`a`,{href:f.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-(--sky-11) hover:underline font-medium`,children:`marimo`}),t[3]=p):p=t[3];let m=s?`Run it`:`Download it, then run it`,h;t[4]===m?h=t[5]:(h=(0,Z.jsxs)(`p`,{children:[`This is a static`,` `,p,` `,`notebook. `,m,` `,`locally for full interactivity.`]}),t[4]=m,t[5]=h);let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(ne,{"aria-label":`Package manager`,children:[(0,Z.jsx)(O,{value:`uv`,children:`uv`}),(0,Z.jsx)(O,{value:`pip`,children:`pip`}),(0,Z.jsx)(O,{value:`conda`,children:`conda`})]}),t[6]=g):g=t[6];let _=`uvx marimo edit --sandbox ${c}`,v;t[7]===_?v=t[8]:(v=(0,Z.jsx)(k,{value:`uv`,children:(0,Z.jsx)($,{command:_})}),t[7]=_,t[8]=v);let y=`pip install marimo\nmarimo edit ${c}`,b;t[9]===y?b=t[10]:(b=(0,Z.jsx)(k,{value:`pip`,children:(0,Z.jsx)($,{command:y})}),t[9]=y,t[10]=b);let x=`conda install -c conda-forge marimo\nmarimo edit ${c}`,S;t[11]===x?S=t[12]:(S=(0,Z.jsx)(k,{value:`conda`,children:(0,Z.jsx)($,{command:x})}),t[11]=x,t[12]=S);let C;t[13]!==b||t[14]!==S||t[15]!==v?(C=(0,Z.jsxs)(re,{defaultValue:`uv`,children:[g,v,b,S]}),t[13]=b,t[14]=S,t[15]=v,t[16]=C):C=t[16];let w;t[17]!==n||t[18]!==a?(w=a&&(0,Z.jsx)(De,{code:n}),t[17]=n,t[18]=a,t[19]=w):w=t[19];let T;t[20]!==C||t[21]!==w||t[22]!==h?(T=(0,Z.jsx)(W,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`pt-3 text-left space-y-3`,children:[h,C,w]})}),t[20]=C,t[21]=w,t[22]=h,t[23]=T):T=t[23];let E;t[24]!==T||t[25]!==u?(E=(0,Z.jsxs)(U,{children:[u,T]}),t[24]=T,t[25]=u,t[26]=E):E=t[26];let D;t[27]===n?D=t[28]:(D=async()=>{await J(n),Y({title:`Copied to clipboard`})},t[27]=n,t[28]=D);let A;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(N,{className:`w-3 h-3 mr-2`}),t[29]=A):A=t[29];let M;t[30]===D?M=t[31]:(M=(0,Z.jsxs)(j,{"data-testid":`copy-static-notebook-dialog-button`,variant:`outline`,size:`sm`,onClick:D,children:[A,`Copy code`]}),t[30]=D,t[31]=M);let P;t[32]!==n||t[33]!==r?(P=()=>{te(new Blob([n],{type:`text/plain`}),r)},t[32]=n,t[33]=r,t[34]=P):P=t[34];let F;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(ee,{className:`w-3 h-3 mr-2`}),t[35]=F):F=t[35];let I;t[36]===P?I=t[37]:(I=(0,Z.jsxs)(j,{"data-testid":`download-static-notebook-dialog-button`,variant:`outline`,size:`sm`,onClick:P,children:[F,`Download`]}),t[36]=P,t[37]=I);let L;t[38]!==M||t[39]!==I?(L=(0,Z.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[M,I]}),t[38]=M,t[39]=I,t[40]=L):L=t[40];let R;return t[41]!==E||t[42]!==L?(R=(0,Z.jsxs)(H,{children:[l,(0,Z.jsxs)(G,{children:[E,L]})]}),t[41]=E,t[42]=L,t[43]=R):R=t[43],R};function Ee(e,t){let n=new URL(e);if(n.protocol!==`http:`&&n.protocol!==`https:`)return t;let r=n.pathname.endsWith(`.html`)&&n.search===``,i=n.protocol===`https:`&&(n.hostname===`marimo.app`||n.hostname===`links.marimo.app`||n.hostname===`static.marimo.app`&&n.pathname.startsWith(`/static`)||n.pathname.includes(`/notebooks/nb`));return!r&&!i?t:(n.hash=``,n.href)}var $=e=>{let t=(0,X.c)(10),{command:n}=e,r;t[0]===n?r=t[1]:(r=(0,Z.jsx)(`pre`,{className:`p-3 pr-10 font-mono text-(--sky-11) leading-relaxed whitespace-pre-wrap break-all`,children:n}),t[0]=n,t[1]=r);let i;t[2]===n?i=t[3]:(i=async()=>{await J(n),Y({title:`Command copied to clipboard`})},t[2]=n,t[3]=i);let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(N,{className:`w-3.5 h-3.5`}),t[4]=a):a=t[4];let o;t[5]===i?o=t[6]:(o=(0,Z.jsx)(j,{"aria-label":`Copy command`,className:`absolute right-2 top-2`,variant:`ghost`,size:`icon`,onClick:i,children:a}),t[5]=i,t[6]=o);let s;return t[7]!==r||t[8]!==o?(s=(0,Z.jsxs)(`div`,{className:`relative rounded-lg border bg-(--sky-2) border-(--sky-7)`,children:[r,o]}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s},De=e=>{let t=(0,X.c)(8),{code:n}=e,r;t[0]===n?r=t[1]:(r=le({code:n,baseUrl:`${f.molab}/new`}),t[0]=n,t[1]=r);let i=r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(me,{size:12,strokeWidth:1.5,className:`mr-1.5 mt-px text-(--grass-11)`}),t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,Z.jsx)(j,{asChild:!0,variant:`outline`,size:`xs`,className:`shrink-0`,children:(0,Z.jsxs)(`a`,{href:i,target:`_blank`,rel:`noopener noreferrer`,children:[a,`Open in molab`]})}),t[3]=i,t[4]=o);let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsxs)(`p`,{className:`text-sm text-(--sky-12)`,children:[`Run this notebook in `,(0,Z.jsx)(`span`,{className:`font-semibold`,children:`molab`}),`, marimo's cloud-hosted notebook platform.`]}),t[5]=s):s=t[5];let c;return t[6]===o?c=t[7]:(c=(0,Z.jsxs)(`div`,{className:`pt-3 border-t flex gap-2 items-center`,children:[o,s]}),t[6]=o,t[7]=c),c},Oe=e=>{let t=(0,X.c)(17),n=r(pe).kind,i=n===`static`||n===`wasm`,{selectedLayout:a}=B(),o;t[0]===a?o=t[1]:(o=V({selectedLayout:a,isReading:!0,searchParams:new URLSearchParams(window.location.search)}),t[0]=a,t[1]=o);let s=i&&o===`slides`,c;t[2]===s?c=t[3]:(c=!s&&(0,Z.jsx)(we,{}),t[2]=s,t[3]=c);let l;t[4]!==s||t[5]!==e.appConfig?(l=(0,Z.jsx)(Se,{appConfig:e.appConfig,hideHeader:s}),t[4]=s,t[5]=e.appConfig,t[6]=l):l=t[6];let u;t[7]!==i||t[8]!==s?(u=i&&!s&&(0,Z.jsx)(ke,{}),t[7]=i,t[8]=s,t[9]=u):u=t[9];let d;t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,Z.jsxs)(fe,{children:[c,l,u]}),t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(D,{}),t[14]=f):f=t[14];let p;return t[15]===d?p=t[16]:(p=(0,Z.jsx)(ae,{children:(0,Z.jsxs)(de,{direction:`horizontal`,autoSaveId:`marimo:chrome:v1:run1`,children:[d,f]})}),t[15]=d,t[16]=p),p},ke=()=>{let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:`fixed bottom-0 right-0 z-50 print:hidden`,"data-testid":`watermark`,children:(0,Z.jsxs)(`a`,{href:f.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-sm text-(--grass-11) font-bold tracking-wide transition-colors bg-(--grass-4) hover:bg-(--grass-5) border-t border-l border-(--grass-8) px-3 py-1 rounded-tl-md flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{children:`made with marimo`}),(0,Z.jsx)(he,{className:`h-4 w-auto`})]})}),e[0]=t):t=e[0],t};export{Oe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as ee,t as r,u as te}from"./useEvent-Dc9HkKI2.js";import{t as i}from"./react-CUdNIagt.js";import{D as ne,I as re,Qr as a,Rt as ie,So as o,xo as ae}from"./cells-CxY8RSp7.js";import{t as s}from"./compiler-runtime-BQ9S8nyo.js";import{C as oe}from"./config-Cyum2gRs.js";import{_ as se}from"./useEventListener-IRzG-0mH.js";import{n as ce}from"./utils-B4K466FK.js";import{O as c}from"./config-D_c_6ce1.js";import{t as le}from"./cn-ldLVeaqm.js";import{t as l}from"./jsx-runtime-B74pBk57.js";import{n as ue}from"./JsonOutput-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as ee,t as r,u as te}from"./useEvent-Dc9HkKI2.js";import{t as i}from"./react-CUdNIagt.js";import{D as ne,I as re,Qr as a,Rt as ie,So as o,xo as ae}from"./cells-CxY8RSp7.js";import{t as s}from"./compiler-runtime-BQ9S8nyo.js";import{C as oe}from"./config-Cyum2gRs.js";import{_ as se}from"./useEventListener-IRzG-0mH.js";import{n as ce}from"./utils-B4K466FK.js";import{O as c}from"./config-D_c_6ce1.js";import{t as le}from"./cn-ldLVeaqm.js";import{t as l}from"./jsx-runtime-B74pBk57.js";import{n as ue}from"./JsonOutput-DCGUcLVV.js";import{t as u}from"./tooltip-B5pI8o2n.js";import{t as d}from"./button-M49xxKoi.js";import{t as f}from"./createLucideIcon-rHn2EdoM.js";import{l as de}from"./layout-CSLw6wGo.js";import{n as fe,t as pe}from"./LazyAnyLanguageCodeMirror-CeTd_wFt.js";import{u as me}from"./toDate-BbJ1_N2T.js";import{t as he}from"./cell-editor-C3818WlB.js";import{t as ge}from"./spinner-CGdRKCnw.js";import{i as _e}from"./useDeleteCell-BKN7t4DH.js";import{r as ve}from"./requests-yTHMxhVa.js";import{r as ye}from"./useTheme-BkPLyRl9.js";import{n as be,r as xe,t as Se}from"./react-resizable-panels.browser.esm-BL2E7f5c.js";import{a as Ce}from"./renderShortcut-BnRfkbwf.js";import{n as we,r as Te}from"./panel-context-BPaQeOuV.js";import{t as Ee}from"./kiosk-mode-DCHo0R3W.js";var De=f(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),Oe=f(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),p=e(i(),1),ke=s(),m=15,h=c(`marimo:scratchpadHistory:v1`,[],a),Ae=n(!1),je=n(null,(e,t,n)=>{if(n=n.trim(),!n)return;let ee=e(h);t(h,[n,...ee.filter(e=>e!==n)].slice(0,m))}),g=l(),Me={hide_code:!1,disabled:!1},_=()=>{let e=(0,ke.c)(60),n=re(),[i]=oe(),{theme:a}=ye(),s=(0,p.useRef)(null),c=ie(),{createNewCell:l,updateCellCode:f}=ne(),{sendRunScratchpad:m}=ve(),_=we(),v=Te(),y=n.cellRuntime[o],b=y?.output,x=y?.status,S=y?.consoleOutputs,C=n.cellData.__scratch__?.code??``,w=te(je),[T,E]=t(Ae),D=ee(h),O;e[0]!==w||e[1]!==C||e[2]!==m?(O=()=>{m({code:C}),w(C)},e[0]=w,e[1]=C,e[2]=m,e[3]=O):O=e[3];let k=r(O),A;e[4]!==C||e[5]!==l||e[6]!==c?(A=()=>{C.trim()&&l({code:C,before:!1,cellId:c??`__end__`})},e[4]=C,e[5]=l,e[6]=c,e[7]=A):A=e[7];let j=r(A),M;e[8]!==m||e[9]!==f?(M=()=>{f({cellId:o,code:``,formattingChange:!1}),m({code:``});let e=s.current;e&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:``}})},e[8]=m,e[9]=f,e[10]=M):M=e[10];let N=r(M),P;e[11]!==E||e[12]!==f?(P=e=>{E(!1),f({cellId:o,code:e,formattingChange:!1});let t=s.current;t&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},e[11]=E,e[12]=f,e[13]=P):P=e[13];let F=r(P),[I,Ne]=(0,p.useState)(),L;e[14]!==F||e[15]!==D||e[16]!==T||e[17]!==a?(L=()=>T?(0,g.jsx)(`div`,{className:`absolute inset-0 z-100 bg-background p-3 border-none overflow-auto`,children:(0,g.jsx)(`div`,{className:`overflow-auto flex flex-col gap-3`,children:D.map((e,t)=>(0,g.jsx)(`div`,{className:`border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden`,onClick:()=>F(e),children:(0,g.jsx)(p.Suspense,{children:(0,g.jsx)(pe,{language:`python`,theme:a,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:e.trim(),editable:!1,readOnly:!0})})},t))})}):null,e[14]=F,e[15]=D,e[16]=T,e[17]=a,e[18]=L):L=e[18];let R=L,z;e[19]!==N||e[20]!==j||e[21]!==k||e[22]!==D.length||e[23]!==T||e[24]!==E||e[25]!==x?(z=()=>(0,g.jsxs)(`div`,{className:`flex items-center shrink-0 border-b`,children:[(0,g.jsx)(u,{content:Ce(`cell.run`),children:(0,g.jsx)(d,{"data-testid":`scratchpad-run-button`,onClick:k,disabled:T,variant:`text`,size:`xs`,children:(0,g.jsx)(_e,{color:`var(--grass-11)`,size:16})})}),(0,g.jsx)(u,{content:`Clear code and outputs`,children:(0,g.jsx)(d,{disabled:T,size:`xs`,variant:`text`,onClick:N,children:(0,g.jsx)(De,{size:16})})}),(0,g.jsx)(Ee,{children:(0,g.jsx)(u,{content:`Insert code`,children:(0,g.jsx)(d,{disabled:T,size:`xs`,variant:`text`,onClick:j,children:(0,g.jsx)(fe,{size:16})})})}),(x===`running`||x===`queued`)&&(0,g.jsx)(ge,{className:`inline`,size:`small`}),(0,g.jsx)(`div`,{className:`flex-1`}),(0,g.jsx)(u,{content:`Toggle history`,children:(0,g.jsx)(d,{size:`xs`,variant:`text`,className:le(T&&`bg-(--sky-3) rounded-none`),onClick:()=>E(!T),disabled:D.length===0,children:(0,g.jsx)(Oe,{size:16})})}),(0,g.jsx)(u,{content:(0,g.jsx)(`span`,{className:`block max-w-prose`,children:`Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file.`}),children:(0,g.jsx)(d,{size:`xs`,variant:`text`,children:(0,g.jsx)(me,{size:16})})})]}),e[19]=N,e[20]=j,e[21]=k,e[22]=D.length,e[23]=T,e[24]=E,e[25]=x,e[26]=z):z=e[26];let B=z,Pe=_===`vertical`,V;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(V=ae.create(o),e[27]=V):V=e[27];let H;e[28]===B?H=e[29]:(H=B(),e[28]=B,e[29]=H);let U;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>{s.current=e},e[30]=U):U=e[30];let W;e[31]!==C||e[32]!==k||e[33]!==I||e[34]!==a||e[35]!==i?(W=(0,g.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,g.jsx)(he,{theme:a,showPlaceholder:!1,id:o,code:C,config:Me,status:`idle`,serializedEditorState:null,runCell:k,userConfig:i,editorViewRef:s,setEditorView:U,hidden:!1,showHiddenCode:se.NOOP,languageAdapter:I,setLanguageAdapter:Ne})}),e[31]=C,e[32]=k,e[33]=I,e[34]=a,e[35]=i,e[36]=W):W=e[36];let G;e[37]===R?G=e[38]:(G=R(),e[37]=R,e[38]=G);let K;e[39]!==G||e[40]!==H||e[41]!==W?(K=(0,g.jsx)(Se,{defaultSize:40,minSize:20,maxSize:70,children:(0,g.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden relative`,children:[H,W,G]})}),e[39]=G,e[40]=H,e[41]=W,e[42]=K):K=e[42];let q=Pe?`h-1`:`w-1`,J;e[43]===q?J=e[44]:(J=le(`bg-border hover:bg-primary/50 transition-colors`,q),e[43]=q,e[44]=J);let Y;e[45]===J?Y=e[46]:(Y=(0,g.jsx)(xe,{className:J}),e[45]=J,e[46]=Y);let X;e[47]===b?X=e[48]:(X=(0,g.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,g.jsx)(ue,{allowExpand:!1,output:b,className:ce.outputArea,cellId:o,stale:!1,loading:!1})}),e[47]=b,e[48]=X);let Z;e[49]===S?Z=e[50]:(Z=(0,g.jsx)(`div`,{className:`overflow-auto shrink-0 max-h-[50%]`,children:(0,g.jsx)(de,{consoleOutputs:S,className:`overflow-auto`,stale:!1,interrupted:!1,cellName:`_`,onSubmitDebugger:se.NOOP,cellId:o,debuggerActive:!1})}),e[49]=S,e[50]=Z);let Q;e[51]!==X||e[52]!==Z?(Q=(0,g.jsx)(Se,{defaultSize:60,minSize:20,children:(0,g.jsxs)(`div`,{className:`h-full flex flex-col divide-y overflow-hidden`,children:[X,Z]})}),e[51]=X,e[52]=Z,e[53]=Q):Q=e[53];let $;return e[54]!==_||e[55]!==v||e[56]!==K||e[57]!==Y||e[58]!==Q?($=(0,g.jsx)(`div`,{className:`flex flex-col h-full overflow-hidden`,id:V,children:(0,g.jsxs)(be,{direction:_,className:`h-full`,children:[K,Y,Q]},v)}),e[54]=_,e[55]=v,e[56]=K,e[57]=Y,e[58]=Q,e[59]=$):$=e[59],$},v=()=>{let e=(0,ke.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,g.jsx)(_,{}),e[0]=t):t=e[0],t};export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,u as i}from"./useEvent-Dc9HkKI2.js";import{t as a}from"./react-CUdNIagt.js";import{$r as o,Ai as s,Bi as c,Bt as l,Cn as u,D as d,Gn as f,Ha as p,Hi as m,Ii as h,Ji as g,Ki as _,Kn as v,Li as y,M as b,Mi as x,P as S,Qr as C,Ri as w,Rn as T,Rt as E,Ui as D,Wa as O,Wi as k,Xi as A,Yi as j,Zi as M,_n as ee,c as N,fn as P,gn as F,i as I,jn as L,qi as R,qn as z,ro as te,ti as ne,to as B,yr as V,yt as H,zi as U}from"./cells-CxY8RSp7.js";import{t as W}from"./compiler-runtime-BQ9S8nyo.js";import{s as re}from"./config-Cyum2gRs.js";import{O as G}from"./config-D_c_6ce1.js";import{t as K}from"./ErrorBoundary-CG6gtgym.js";import{t as ie}from"./cn-ldLVeaqm.js";import{t as q}from"./jsx-runtime-B74pBk57.js";import{r as ae}from"./config-CR2d-XsP.js";import{_ as oe,at as J,f as se,g as ce,h as le,it as ue,m as de,nt as fe,ot as pe,rt as me,tt as he,v as ge}from"./JsonOutput-NVH7GWyC.js";import{t as _e}from"./tooltip-B5pI8o2n.js";import{r as ve,t as ye}from"./button-M49xxKoi.js";import{t as be}from"./createLucideIcon-rHn2EdoM.js";import{i as xe}from"./paths-CzfpItSz.js";import{r as Se}from"./useNumberFormatter-BP99Zbyy.js";import{a as Ce,r as we}from"./tree-actions-D5clvgKl.js";import{a as Te}from"./input-DPd57MDP.js";import{n as Ee,o as De}from"./column-preview-sL_Jo0hX.js";import{t as Oe}from"./workflow-nBi9HGeO.js";import{t as ke}from"./copy-icon-wfSGfX8v.js";import{l as Ae}from"./arrays-BqUx5USx.js";import{i as je}from"./strings-hlCLC-K1.js";import{r as Me}from"./requests-yTHMxhVa.js";import{t as Ne}from"./I18nProvider-BFOBKCJB.js";import{n as Pe}from"./useAsyncData-DucTwMkf.js";import{t as Fe}from"./cell-link-DC1UZQr_.js";import{a as Ie,i as Le,n as Re,o as ze,r as Be,t as Ve}from"./table-Dg1KxH-q.js";import{n as He}from"./icons-CVdkfEA3.js";import{t as Ue}from"./useDeepCompareMemoize-DSlTt6u_.js";import{t as We}from"./useAddCell-Bhv6GT3m.js";import{t as Ge}from"./empty-state-CzxjZqGW.js";import{n as Ke,t as qe}from"./common-Cy3lJDvJ.js";import{a as Je,i as Ye,n as Xe,o as Ze,r as Qe,s as $e,t as et}from"./components-D9ZIJGG8.js";import{r as tt}from"./panel-accordion-state-BI4SU22L.js";var nt=be(`square-equal`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 10h10`,key:`1101jm`}],[`path`,{d:`M7 14h10`,key:`1mhdw3`}]]),Y=W(),X=e(a(),1),Z=q(),rt=1;function it(e){return 1.75+e*rt}function at(e){return 3+e*rt}function ot(e){return 3.25+e*rt}var Q={engineEmpty:.75,engine:.75,database:1,tableLoading:2.75,tableSchemaless:2,columnLocal:1.25,columnPreview:2.5};function $(e){return{paddingLeft:`${e}rem`}}var st=n(e=>{let t=e(w),n=e(ne),r=e(I);return Ae(t,e=>{if(!e.variable_name)return-1;let t=Object.values(n).find(t=>t.name===e.variable_name);if(!t)return 0;let i=r.inOrderIds.indexOf(t.declaredBy[0]);return i===-1?0:i})}),ct=G(`marimo:datasources:hideEmpty`,!1,C,{getOnInit:!0});function lt(e){let t=!1,n=[];for(let r of e){if(!k(r)||!m(r)){n.push(r);continue}let e=r.child_schemas??[],i=lt(e);if(r.tables.length===0&&i.length===0){t=!0;continue}if(i===e){n.push(r);continue}t=!0,n.push({...r,child_schemas:i})}return t?n:e}function ut(e){let t=!1,n=[];for(let r of e){if(D(r)&&r.schemas.length===0){t=!0;continue}if(r.schemas.length===0){n.push(r);continue}let e=lt(r.schemas);if(e.length===0){t=!0;continue}if(e===r.schemas){n.push(r);continue}t=!0,n.push({...r,schemas:e})}return t?n:e}var dt=()=>{let e=(0,Y.c)(42),[n,a]=X.useState(``),[o,s]=t(ct),c=i(y),l=r(st),d=r(x),f;bb0:{if(!o){f=d;break bb0}let t,n;e[0]===d?(t=e[1],n=e[2]):(t=!1,n=d.map(e=>{let n=ut(e.databases);return n===e.databases?e:(t=!0,{...e,databases:n})}),e[0]=d,e[1]=t,e[2]=n),f=t?n:d}let p=f;if(l.length===0&&p.length===0){let t;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Ge,{title:`No tables found`,description:`Any datasets/dataframes in the global scope will be shown here.`,action:(0,Z.jsx)(Ze,{group:`database`,label:`Add database or catalog`,variant:`outline`,size:`sm`}),icon:(0,Z.jsx)(xe,{})}),e[3]=t):t=e[3],t}let m;e[4]===n?m=e[5]:(m=n.trim(),e[4]=n,e[5]=m);let h=!!m,g;e[6]===c?g=e[7]:(g=e=>{c(e.length>0),a(e)},e[6]=c,e[7]=g);let _;e[8]!==n||e[9]!==g?(_=(0,Z.jsx)(F,{placeholder:`Search tables...`,className:`h-6 m-1`,value:n,onValueChange:g,rootClassName:`flex-1 border-r border-b-0`}),e[8]=n,e[9]=g,e[10]=_):_=e[10];let v;e[11]===h?v=e[12]:(v=h&&(0,Z.jsx)(`button`,{type:`button`,className:`float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground`,onClick:()=>a(``),children:(0,Z.jsx)(Se,{className:`h-4 w-4`})}),e[11]=h,e[12]=v);let b=!o,S;e[13]!==o||e[14]!==s?(S=()=>s(!o),e[13]=o,e[14]=s,e[15]=S):S=e[15];let C;e[16]!==b||e[17]!==S?(C=(0,Z.jsx)(Ce,{"data-testid":`datasources-hide-empty-button`,isVisible:b,onToggle:S,showTooltip:`Show empty schemas and databases`,hideTooltip:`Hide empty schemas and databases`,size:`sm`,className:`px-2 rounded-none focus-visible:outline-hidden`}),e[16]=b,e[17]=S,e[18]=C):C=e[18];let w;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Ze,{group:`database`,label:`Add database or catalog`,compact:!0,variant:`ghost`,size:`sm`,className:`px-2 rounded-none focus-visible:outline-hidden`}),e[19]=w):w=e[19];let T;e[20]!==_||e[21]!==v||e[22]!==C?(T=(0,Z.jsxs)(`div`,{className:`flex items-center w-full border-b`,children:[_,v,C,w]}),e[20]=_,e[21]=v,e[22]=C,e[23]=T):T=e[23];let E;if(e[24]!==p||e[25]!==n){let t;e[27]===n?t=e[28]:(t=e=>(0,Z.jsx)(ft,{connection:e,hasChildren:e.databases.length>0,children:e.databases.map(t=>(0,Z.jsx)(gt,{connection:e,database:t,searchValue:n},t.name))},e.name),e[27]=n,e[28]=t),E=p.map(t),e[24]=p,e[25]=n,e[26]=E}else E=e[26];let D;e[29]!==p.length||e[30]!==l.length?(D=p.length>0&&l.length>0&&(0,Z.jsxs)(de,{className:`pr-2`,style:$(Q.engine),children:[(0,Z.jsx)(He,{className:`h-4 w-4 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`text-xs`,children:`Python`})]}),e[29]=p.length,e[30]=l.length,e[31]=D):D=e[31];let O;e[32]!==n||e[33]!==l?(O=l.length>0&&(0,Z.jsx)(bt,{tables:l,searchValue:n}),e[32]=n,e[33]=l,e[34]=O):O=e[34];let k;e[35]!==E||e[36]!==D||e[37]!==O?(k=(0,Z.jsxs)(u,{className:`flex flex-col`,children:[E,D,O]}),e[35]=E,e[36]=D,e[37]=O,e[38]=k):k=e[38];let A;return e[39]!==k||e[40]!==T?(A=(0,Z.jsxs)(P,{className:`border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden`,shouldFilter:!1,children:[T,k]}),e[39]=k,e[40]=T,e[41]=A):A=e[41],A},ft=e=>{let t=(0,Y.c)(26),{connection:n,children:r,hasChildren:i}=e,a=n.name===M,o=a?`In-Memory`:n.name,{previewDataSourceConnection:c}=Me(),l;t[0]!==n.name||t[1]!==c?(l=async()=>{await c({engine:n.name})},t[0]=n.name,t[1]=c,t[2]=l):l=t[2];let u=l,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=$(Q.engine),t[3]=d):d=t[3];let f;t[4]===n.dialect?f=t[5]:(f=(0,Z.jsx)(L,{className:`h-4 w-4 text-muted-foreground`,name:n.dialect}),t[4]=n.dialect,t[5]=f);let p;t[6]===n.dialect?p=t[7]:(p=s(n.dialect),t[6]=n.dialect,t[7]=p);let m;t[8]===p?m=t[9]:(m=(0,Z.jsx)(`span`,{className:`text-xs`,children:p}),t[8]=p,t[9]=m);let h=o,g;t[10]===h?g=t[11]:(g=(0,Z.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,(0,Z.jsx)($e,{variableName:h}),`)`]}),t[10]=h,t[11]=g);let _;t[12]!==u||t[13]!==a?(_=!a&&(0,Z.jsx)(we,{onClick:u,tooltip:`Refresh connection`,className:`ml-auto h-4 p-0`,iconClassName:`h-3.5 w-3.5`}),t[12]=u,t[13]=a,t[14]=_):_=t[14];let v;t[15]!==f||t[16]!==m||t[17]!==g||t[18]!==_?(v=(0,Z.jsxs)(de,{className:`pr-2`,style:d,children:[f,m,g,_]}),t[15]=f,t[16]=m,t[17]=g,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==r||t[21]!==i?(y=i?r:(0,Z.jsx)(le,{content:`No databases available`,style:$(Q.engineEmpty)}),t[20]=r,t[21]=i,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==v?(b=(0,Z.jsxs)(Z.Fragment,{children:[v,y]}),t[23]=y,t[24]=v,t[25]=b):b=t[25],b},pt=X.createContext(null);function mt(){let e=X.useContext(pt);if(e==null)throw Error(`useDataSourceTree must be used within a DataSourceTreeContext.Provider`);return e}function ht(e,{schema:t,schemaPath:n}){return{engine:e.engineName,database:e.databaseName,schema:t,schemaPath:n,defaultSchema:e.defaultSchema,defaultDatabase:e.defaultDatabase,dialect:e.dialect}}var gt=e=>{let t=(0,Y.c)(21),{connection:n,database:r,searchValue:i}=e,a;t[0]!==n.default_database||t[1]!==n.default_schema||t[2]!==n.dialect||t[3]!==n.name||t[4]!==r.name||t[5]!==i?(a={engineName:n.name,databaseName:r.name,dialect:n.dialect,defaultSchema:n.default_schema,defaultDatabase:n.default_database,searchValue:i},t[0]=n.default_database,t[1]=n.default_schema,t[2]=n.dialect,t[3]=n.name,t[4]=r.name,t[5]=i,t[6]=a):a=t[6];let o=a,s=n.name,c=r.schemas,l;t[7]===r?l=t[8]:(l=D(r),t[7]=r,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[9]=u):u=t[9];let d;t[10]!==r.schemas||t[11]!==l?(d=(0,Z.jsx)(vt,{schemas:c,schemasResolved:l,schemaPath:u,depth:0}),t[10]=r.schemas,t[11]=l,t[12]=d):d=t[12];let f;t[13]!==d||t[14]!==o?(f=(0,Z.jsx)(pt.Provider,{value:o,children:d}),t[13]=d,t[14]=o,t[15]=f):f=t[15];let p;return t[16]!==n.name||t[17]!==r||t[18]!==i||t[19]!==f?(p=(0,Z.jsx)(_t,{engineName:s,database:r,searchValue:i,children:f}),t[16]=n.name,t[17]=r,t[18]=i,t[19]=f,t[20]=p):p=t[20],p},_t=e=>{let t=(0,Y.c)(29),{searchValue:n,engineName:r,database:i,children:a}=e,o;t[0]!==i||t[1]!==n?(o=g(i,n),t[0]=i,t[1]=n,t[2]=o):o=t[2];let s=o,[c,l]=X.useState(s),[u,d]=X.useState(!1),[f,p]=X.useState(n),[m,h]=X.useState(s);(f!==n||m!==s)&&(p(n),h(s),l(s));let _;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=$(Q.database),t[3]=_):_=t[3];let v;t[4]!==c||t[5]!==u?(v=()=>{l(!c),d(!u)},t[4]=c,t[5]=u,t[6]=v):v=t[6];let y=`${r}:${i.name}`,b;t[7]===c?b=t[8]:(b=(0,Z.jsx)(ge,{isExpanded:c}),t[7]=c,t[8]=b);let x=u&&c?`text-foreground`:`text-muted-foreground`,S;t[9]===x?S=t[10]:(S=ie(`h-4 w-4`,x),t[9]=x,t[10]=S);let C;t[11]===S?C=t[12]:(C=(0,Z.jsx)(xe,{className:S}),t[11]=S,t[12]=C);let w=u&&c&&`font-semibold`,T;t[13]===w?T=t[14]:(T=ie(w),t[13]=w,t[14]=T);let E;t[15]===i.name?E=t[16]:(E=i.name===``?(0,Z.jsx)(`i`,{children:`Not connected`}):i.name,t[15]=i.name,t[16]=E);let D;t[17]!==T||t[18]!==E?(D=(0,Z.jsx)(`span`,{className:T,children:E}),t[17]=T,t[18]=E,t[19]=D):D=t[19];let O;t[20]!==D||t[21]!==v||t[22]!==y||t[23]!==b||t[24]!==C?(O=(0,Z.jsxs)(ee,{className:`text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none`,style:_,onSelect:v,value:y,children:[b,C,D]}),t[20]=D,t[21]=v,t[22]=y,t[23]=b,t[24]=C,t[25]=O):O=t[25];let k=c&&a,A;return t[26]!==O||t[27]!==k?(A=(0,Z.jsxs)(Z.Fragment,{children:[O,k]}),t[26]=O,t[27]=k,t[28]=A):A=t[28],A},vt=e=>{let{schemas:t,schemasResolved:n,depth:r}=e,i=mt(),{engineName:a,databaseName:o,searchValue:s}=i,{addSchemaList:c}=h(),l=Ue(e.schemaPath),[u,d]=X.useState(!1),{isPending:p,error:m}=Pe(async()=>{if(!n&&a){d(!0);try{let e=await f.request({engine:a,database:o,schemaPath:l});c({schemas:e.schemas??[],sqlSchemaContext:{engine:a,database:o,schemaPath:l}})}finally{d(!1)}}},[n,a,o,l]),g=$(it(r));return p||u?(0,Z.jsx)(oe,{message:`Loading schemas...`,style:g}):m?(0,Z.jsx)(ce,{error:m,style:g}):t.length===0?(0,Z.jsx)(le,{content:`No schemas available`,style:g}):(0,Z.jsx)(Z.Fragment,{children:t.map(e=>_(e.name)?(0,Z.jsx)(bt,{tables:e.tables,tablesResolved:k(e),searchValue:s,sqlTableContext:ht(i,{schema:e.name,schemaPath:l})},e.name):(0,Z.jsx)(yt,{schema:e,schemaPath:[...l,e.name],depth:r},e.name))})},yt=e=>{let t=(0,Y.c)(41),{schema:n,schemaPath:r,depth:i}=e,a=mt(),{databaseName:o,searchValue:s}=a,c;t[0]!==n||t[1]!==s?(c=R(n,s),t[0]=n,t[1]=s,t[2]=c):c=t[2];let l=c,[u,d]=X.useState(l),[f,p]=X.useState(!1),[h,g]=X.useState(s),[_,v]=X.useState(l),y;t[3]===r?y=t[4]:(y=r.join(`.`),t[3]=r,t[4]=y);let b=`${o}:${y}`,x;t[5]===n.child_schemas?x=t[6]:(x=n.child_schemas??[],t[5]=n.child_schemas,t[6]=x);let S=x;(h!==s||_!==l)&&(g(s),v(l),d(l));let C;t[7]===i?C=t[8]:(C=$(it(i)),t[7]=i,t[8]=C);let w;t[9]!==u||t[10]!==f?(w=()=>{d(!u),p(!f)},t[9]=u,t[10]=f,t[11]=w):w=t[11];let T;t[12]===u?T=t[13]:(T=(0,Z.jsx)(ge,{isExpanded:u}),t[12]=u,t[13]=T);let E=f&&u&&`text-foreground`,D;t[14]===E?D=t[15]:(D=ie(`h-4 w-4 text-muted-foreground`,E),t[14]=E,t[15]=D);let O;t[16]===D?O=t[17]:(O=(0,Z.jsx)(B,{className:D}),t[16]=D,t[17]=O);let A=f&&u&&`font-semibold`,j;t[18]===A?j=t[19]:(j=ie(A),t[18]=A,t[19]=j);let M;t[20]!==n.name||t[21]!==j?(M=(0,Z.jsx)(`span`,{className:j,children:n.name}),t[20]=n.name,t[21]=j,t[22]=M):M=t[22];let N;t[23]!==M||t[24]!==C||t[25]!==w||t[26]!==T||t[27]!==O||t[28]!==b?(N=(0,Z.jsxs)(ee,{className:`text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none`,style:C,onSelect:w,value:b,children:[T,O,M]}),t[23]=M,t[24]=C,t[25]=w,t[26]=T,t[27]=O,t[28]=b,t[29]=N):N=t[29];let P;t[30]!==S||t[31]!==i||t[32]!==u||t[33]!==n||t[34]!==r||t[35]!==s||t[36]!==a?(P=u&&(0,Z.jsxs)(Z.Fragment,{children:[(S.length>0||!m(n))&&(0,Z.jsx)(vt,{schemas:S,schemasResolved:m(n),schemaPath:r,depth:i+1}),(0,Z.jsx)(bt,{tables:n.tables,tablesResolved:k(n),searchValue:s,tableIndentRem:at(i),columnIndentRem:ot(i),sqlTableContext:ht(a,{schema:n.name,schemaPath:r})})]}),t[30]=S,t[31]=i,t[32]=u,t[33]=n,t[34]=r,t[35]=s,t[36]=a,t[37]=P):P=t[37];let F;return t[38]!==N||t[39]!==P?(F=(0,Z.jsxs)(Z.Fragment,{children:[N,P]}),t[38]=N,t[39]=P,t[40]=F):F=t[40],F},bt=e=>{let t=(0,Y.c)(31),{tables:n,sqlTableContext:r,searchValue:i,tablesResolved:a,tableIndentRem:o,columnIndentRem:s}=e,c=a===void 0||a,{addTableList:l}=h(),[u,d]=X.useState(!1),f;t[0]!==l||t[1]!==r||t[2]!==c?(f=async()=>{if(!c&&r){d(!0);let{engine:e,database:t,schema:n,schemaPath:i}=r,a=await z.request({engine:e,database:t,schema:n,schemaPath:i??[]});if(!a?.tables)throw d(!1),Error(`No tables available`);l({tables:a.tables,sqlTableContext:r}),d(!1)}},t[0]=l,t[1]=r,t[2]=c,t[3]=f):f=t[3];let p;t[4]!==r||t[5]!==c?(p=[c,r],t[4]=r,t[5]=c,t[6]=p):p=t[6];let{isPending:m,error:g}=Pe(f,p),_=o??Q.tableLoading,v;t[7]===_?v=t[8]:(v=$(_),t[7]=_,t[8]=v);let y=v;if(m||u){let e;return t[9]===y?e=t[10]:(e=(0,Z.jsx)(oe,{message:`Loading tables...`,style:y}),t[9]=y,t[10]=e),e}if(g){let e;return t[11]!==g||t[12]!==y?(e=(0,Z.jsx)(ce,{error:g,style:y}),t[11]=g,t[12]=y,t[13]=e):e=t[13],e}if(n.length===0){let e;return t[14]===y?e=t[15]:(e=(0,Z.jsx)(le,{content:`No tables found`,style:y}),t[14]=y,t[15]=e),e}let b;if(t[16]!==s||t[17]!==i||t[18]!==r||t[19]!==o||t[20]!==n){let e;t[22]===i?e=t[23]:(e=e=>!i||e.name.toLowerCase().includes(i.toLowerCase()),t[22]=i,t[23]=e);let a=n.filter(e),c;t[24]!==s||t[25]!==i||t[26]!==r||t[27]!==o?(c=e=>(0,Z.jsx)(xt,{table:e,sqlTableContext:r,isSearching:!!i,tableIndentRem:o,columnIndentRem:s},e.name),t[24]=s,t[25]=i,t[26]=r,t[27]=o,t[28]=c):c=t[28],b=a.map(c),t[16]=s,t[17]=i,t[18]=r,t[19]=o,t[20]=n,t[21]=b}else b=t[21];let x;return t[29]===b?x=t[30]:(x=(0,Z.jsx)(Z.Fragment,{children:b}),t[29]=b,t[30]=x),x},xt=e=>{let t=(0,Y.c)(69),{table:n,sqlTableContext:i,isSearching:a,tableIndentRem:o,columnIndentRem:s}=e,{addTable:c}=h(),[u,f]=X.useState(!1),p=n.columns.length>0,m;t[0]!==c||t[1]!==u||t[2]!==i||t[3]!==n.name||t[4]!==p?(m=async()=>{if(u&&!p&&i){let{engine:e,database:t,schema:r,schemaPath:a}=i,o=await v.request({engine:e,database:t,schema:r,tableName:n.name,schemaPath:a??[]});if(!o?.table)throw Error(`No table details available`);c({table:o.table,sqlTableContext:i})}},t[0]=c,t[1]=u,t[2]=i,t[3]=n.name,t[4]=p,t[5]=m):m=t[5];let g;t[6]!==u||t[7]!==p?(g=[u,p],t[6]=u,t[7]=p,t[8]=g):g=t[8];let{isFetching:_,isPending:y,error:b}=Pe(m,g),x=r(re),S=E(),{createNewCell:C}=d(),w=We(),T;t[9]!==w||t[10]!==x||t[11]!==C||t[12]!==S||t[13]!==i||t[14]!==n?(T=()=>{l({autoInstantiate:x,createNewCell:C,fromCellId:S}),w((()=>{if(n.source_type===`catalog`){let e=i?.database?[i.database,...i.schemaPath??[],n.name].join(`.`):n.name;return`${n.engine}.load_table("${e}")`}if(i)return j({table:n,columnName:`*`,sqlTableContext:i});switch(n.source_type){case`local`:return`mo.ui.table(${n.name})`;case`duckdb`:case`connection`:return j({table:n,columnName:`*`,sqlTableContext:i});default:return je(n.source_type),``}})())},t[9]=w,t[10]=x,t[11]=C,t[12]=S,t[13]=i,t[14]=n,t[15]=T):T=t[15];let D=T,k;t[16]!==n.num_columns||t[17]!==n.num_rows?(k=()=>{let e=[];return n.num_rows!=null&&e.push(`${n.num_rows} rows`),n.num_columns!=null&&e.push(`${n.num_columns} columns`),e.length===0?null:(0,Z.jsx)(`div`,{className:`flex flex-row gap-2 items-center pl-6 group-hover:hidden`,children:(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.join(`, `)})})},t[16]=n.num_columns,t[17]=n.num_rows,t[18]=k):k=t[18];let M=k,N;t[19]!==s||t[20]!==b||t[21]!==_||t[22]!==y||t[23]!==i||t[24]!==n?(N=()=>{let e=$(s??Q.tableLoading);if(y||_)return(0,Z.jsx)(oe,{message:`Loading columns...`,style:e});if(b)return(0,Z.jsx)(ce,{error:b,style:e});let t=n.columns;return t.length===0?(0,Z.jsx)(le,{content:`No columns found`,style:e}):t.map(e=>(0,Z.jsx)(St,{table:n,column:e,sqlTableContext:i,columnIndentRem:s},e.name))},t[19]=s,t[20]=b,t[21]=_,t[22]=y,t[23]=i,t[24]=n,t[25]=N):N=t[25];let P=N,F;t[26]!==u||t[27]!==a||t[28]!==n.source_type||t[29]!==n.type?(F=()=>{if(n.source_type===`local`)return;let e=n.type===`table`?O:te;return(0,Z.jsx)(e,{className:`h-3 w-3`,strokeWidth:u||a?2.5:void 0})},t[26]=u,t[27]=a,t[28]=n.source_type,t[29]=n.type,t[30]=F):F=t[30];let I=F,L;t[31]!==i||t[32]!==n.name?(L=A(i,n.name),t[31]=i,t[32]=n.name,t[33]=L):L=t[33];let R=L,z=o??(i?Q.tableSchemaless:0),ne=(u||a)&&`font-semibold`,B;t[34]===ne?B=t[35]:(B=ie(`rounded-none group h-8 cursor-pointer`,ne),t[34]=ne,t[35]=B);let V;t[36]===z?V=t[37]:(V=$(z),t[36]=z,t[37]=V);let H;t[38]===u?H=t[39]:(H=()=>f(!u),t[38]=u,t[39]=H);let U;t[40]===I?U=t[41]:(U=I(),t[40]=I,t[41]=U);let W;t[42]===n.name?W=t[43]:(W=(0,Z.jsx)(`span`,{className:`text-sm`,children:n.name}),t[42]=n.name,t[43]=W);let G;t[44]!==U||t[45]!==W?(G=(0,Z.jsxs)(`div`,{className:`flex gap-2 items-center flex-1 pl-1`,children:[U,W]}),t[44]=U,t[45]=W,t[46]=G):G=t[46];let K;t[47]===M?K=t[48]:(K=M(),t[47]=M,t[48]=K);let q;t[49]===D?q=t[50]:(q=ve.stopPropagation(()=>D()),t[49]=D,t[50]=q);let ae;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(De,{className:`h-3 w-3`}),t[51]=ae):ae=t[51];let J;t[52]===q?J=t[53]:(J=(0,Z.jsx)(_e,{content:`Add table to notebook`,delayDuration:400,children:(0,Z.jsx)(ye,{className:`group-hover:inline-flex hidden`,variant:`text`,size:`icon`,onClick:q,children:ae})}),t[52]=q,t[53]=J);let se;t[54]!==u||t[55]!==V||t[56]!==H||t[57]!==G||t[58]!==K||t[59]!==J||t[60]!==B||t[61]!==R?(se=(0,Z.jsxs)(ee,{className:B,style:V,value:R,"aria-selected":u,forceMount:!0,onSelect:H,children:[G,K,J]}),t[54]=u,t[55]=V,t[56]=H,t[57]=G,t[58]=K,t[59]=J,t[60]=B,t[61]=R,t[62]=se):se=t[62];let ue;t[63]!==u||t[64]!==P?(ue=u&&P(),t[63]=u,t[64]=P,t[65]=ue):ue=t[65];let de;return t[66]!==se||t[67]!==ue?(de=(0,Z.jsxs)(Z.Fragment,{children:[se,ue]}),t[66]=se,t[67]=ue,t[68]=de):de=t[68],de},St=e=>{let t=(0,Y.c)(51),{table:n,column:a,sqlTableContext:o,columnIndentRem:s}=e,[l,u]=X.useState(!1),d=r(y),f=i(U);d&&l&&u(!1),f(l?e=>new Set([...e,`${n.name}:${a.name}`]):e=>(e.delete(`${n.name}:${a.name}`),new Set(e)));let p=We(),{columnsPreviews:m}=c(),h;t[0]!==a.name||t[1]!==n.primary_keys?(h=n.primary_keys?.includes(a.name)||!1,t[0]=a.name,t[1]=n.primary_keys,t[2]=h):h=t[2];let g=h,_;t[3]!==a.name||t[4]!==n.indexes?(_=n.indexes?.includes(a.name)||!1,t[3]=a.name,t[4]=n.indexes,t[5]=_):_=t[5];let v=_,b;t[6]===p?b=t[7]:(b=e=>{p(e)},t[6]=p,t[7]=b);let x=b,S=Ct,C=l?`font-semibold`:``,w;t[8]!==a.name||t[9]!==C?(w=(0,Z.jsx)(`span`,{className:C,children:a.name}),t[8]=a.name,t[9]=C,t[10]=w):w=t[10];let T=w,E=`${n.name}.${a.name}`,D=`${n.name}.${a.name}`,O;t[11]===l?O=t[12]:(O=()=>u(!l),t[11]=l,t[12]=O);let k;t[13]!==s||t[14]!==o?(k=s??(o?ot(0):Q.columnLocal),t[13]=s,t[14]=o,t[15]=k):k=t[15];let A;t[16]===k?A=t[17]:(A=$(k),t[16]=k,t[17]=A);let j;t[18]!==a.type||t[19]!==T?(j=(0,Z.jsx)(se,{columnName:T,dataType:a.type}),t[18]=a.type,t[19]=T,t[20]=j):j=t[20];let M;t[21]===g?M=t[22]:(M=g&&S({tooltipContent:`Primary key`,content:`PK`}),t[21]=g,t[22]=M);let N;t[23]===v?N=t[24]:(N=v&&S({tooltipContent:`Indexed`,content:`IDX`}),t[23]=v,t[24]=N);let P;t[25]!==A||t[26]!==j||t[27]!==M||t[28]!==N?(P=(0,Z.jsxs)(`div`,{className:`flex flex-row gap-2 items-center flex-1`,style:A,children:[j,M,N]}),t[25]=A,t[26]=j,t[27]=M,t[28]=N,t[29]=P):P=t[29];let F;t[30]===a.name?F=t[31]:(F=(0,Z.jsx)(_e,{content:`Copy column name`,delayDuration:400,children:(0,Z.jsx)(ye,{variant:`text`,size:`icon`,className:`group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(ke,{tooltip:!1,value:a.name,className:`h-3 w-3`})})}),t[30]=a.name,t[31]=F);let I;t[32]===a.external_type?I=t[33]:(I=(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a.external_type}),t[32]=a.external_type,t[33]=I);let L;t[34]!==P||t[35]!==F||t[36]!==I||t[37]!==E||t[38]!==D||t[39]!==O?(L=(0,Z.jsxs)(ee,{className:`rounded-none py-1 group cursor-pointer`,value:D,onSelect:O,children:[P,F,I]},E),t[34]=P,t[35]=F,t[36]=I,t[37]=E,t[38]=D,t[39]=O,t[40]=L):L=t[40];let R;t[41]!==a||t[42]!==m||t[43]!==x||t[44]!==l||t[45]!==o||t[46]!==n?(R=l&&(0,Z.jsx)(`div`,{className:`pr-2 py-2 bg-(--slate-1) shadow-inner border-b`,style:$(Q.columnPreview),children:(0,Z.jsx)(K,{children:(0,Z.jsx)(Ee,{table:n,column:a,onAddColumnChart:x,preview:m.get(o?`${o.database}.${o.schema}.${n.name}:${a.name}`:`${n.name}:${a.name}`),sqlTableContext:o})})}),t[41]=a,t[42]=m,t[43]=x,t[44]=l,t[45]=o,t[46]=n,t[47]=R):R=t[47];let z;return t[48]!==L||t[49]!==R?(z=(0,Z.jsxs)(Z.Fragment,{children:[L,R]}),t[48]=L,t[49]=R,t[50]=z):z=t[50],z};function Ct(e){let{tooltipContent:t,content:n}=e;return(0,Z.jsx)(_e,{content:t,delayDuration:100,children:(0,Z.jsx)(`span`,{className:`text-xs text-black bg-gray-100 dark:invert rounded px-1`,children:n})})}function wt(e){return e}var Tt={name:`name`,type:`type-value`,defs:`defs-refs`},Et=[wt({id:Tt.name,accessorFn:e=>[e.name,e.declaredBy],enableSorting:!0,sortingFn:`alphanumeric`,header:({column:e})=>(0,Z.jsx)(he,{header:`Name`,column:e}),cell:({getValue:e})=>{let[t,n]=e();return(0,Z.jsx)(qe,{name:t,declaredBy:n})}}),wt({id:Tt.type,accessorFn:e=>[e.dataType,e.value],enableSorting:!0,sortingFn:`alphanumeric`,header:({column:e})=>(0,Z.jsx)(he,{header:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{children:`Type`}),(0,Z.jsx)(`span`,{children:`Value`})]}),column:e}),cell:({getValue:e})=>{let[t,n]=e();return(0,Z.jsxs)(`div`,{className:`max-w-[150px]`,children:[(0,Z.jsx)(`div`,{className:`text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs`,children:t}),(0,Z.jsx)(`div`,{className:`text-ellipsis overflow-hidden whitespace-nowrap`,title:n??``,children:n})]})}}),wt({id:Tt.defs,accessorFn:e=>[e.declaredBy,e.usedBy,e.name,e.declaredByNames,e.usedByNames],enableSorting:!0,sortingFn:`basic`,header:({column:e})=>(0,Z.jsx)(he,{header:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{children:`Declared By`}),(0,Z.jsx)(`span`,{children:`Used By`})]}),column:e}),cell:({getValue:e})=>{let[t,n,r]=e(),i=e=>{let t=N(e);t&&V(t,r)};return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 py-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-row overflow-auto gap-2 items-center`,children:[(0,Z.jsx)(`span`,{title:`Declared by`,children:(0,Z.jsx)(nt,{className:`w-3.5 h-3.5 text-muted-foreground`})}),t.length===1?(0,Z.jsx)(Fe,{variant:`focus`,cellId:t[0],skipScroll:!0,onClick:()=>i(t[0])}):(0,Z.jsx)(`div`,{className:`text-destructive flex flex-row gap-2`,children:t.slice(0,3).map((e,n)=>(0,Z.jsxs)(`span`,{className:`flex`,children:[(0,Z.jsx)(Fe,{variant:`focus`,cellId:e,skipScroll:!0,className:`whitespace-nowrap text-destructive`,onClick:()=>i(e)},e),n<t.length-1&&`, `]},e))})]}),(0,Z.jsxs)(`div`,{className:`flex flex-row overflow-auto gap-2 items-baseline`,children:[(0,Z.jsx)(`span`,{title:`Used by`,children:(0,Z.jsx)(Oe,{className:`w-3.5 h-3.5 text-muted-foreground`})}),(0,Z.jsx)(Ke,{maxCount:3,cellIds:n,skipScroll:!0,onClick:i})]})]})}})];function Dt({variables:e,sort:t,cellIdToIndex:n}){t||={id:Tt.defs,desc:!1};let r=[];switch(t.id){case Tt.name:r=Ae(e,e=>e.name);break;case Tt.type:r=Ae(e,e=>e.dataType);break;case Tt.defs:r=Ae(e,e=>n.get(e.declaredBy[0]))}return t.desc?r.toReversed():r}var Ot=(0,X.memo)(({className:e,cellIds:t,variables:n})=>{let[r,i]=X.useState([]),[a,o]=X.useState(``),s=S(),{locale:c}=Ne(),l=(0,X.useMemo)(()=>{let e=e=>{let n=s[e];return T(n)?`cell-${t.indexOf(e)}`:n??`cell-${t.indexOf(e)}`};return Object.values(n).map(t=>({...t,declaredByNames:t.declaredBy.map(e),usedByNames:t.usedBy.map(e)}))},[n,s,t]),u=(0,X.useMemo)(()=>{let e=new Map;return t.forEach((t,n)=>e.set(t,n)),Dt({variables:l,sort:r[0],cellIdToIndex:e})},[l,r,t]),d=me({data:u,columns:Et,getCoreRowModel:ue(),onGlobalFilterChange:o,getFilteredRowModel:J(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter(e){return e.columnDef.enableGlobalFilter??!0},globalFilterFn:`auto`,manualSorting:!0,locale:c,onSortingChange:i,getSortedRowModel:pe(),state:{sorting:r,globalFilter:a}});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Te,{className:`w-full`,placeholder:`Search`,value:a,onChange:e=>o(e.target.value)}),(0,Z.jsxs)(Ve,{className:ie(`w-full text-sm flex-1 border-separate border-spacing-0`,e),children:[(0,Z.jsx)(Ie,{children:(0,Z.jsx)(ze,{className:`whitespace-nowrap text-xs`,children:d.getFlatHeaders().map(e=>(0,Z.jsx)(Le,{className:`sticky top-0 bg-background border-b`,children:fe(e.column.columnDef.header,e.getContext())},e.id))})}),(0,Z.jsx)(Re,{children:d.getRowModel().rows.map(e=>(0,Z.jsx)(ze,{className:`hover:bg-accent`,children:e.getVisibleCells().map(e=>(0,Z.jsx)(Be,{className:`border-b`,children:fe(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]})]})});Ot.displayName=`VariableTable`;var kt=()=>{let e=(0,Y.c)(30),n=o(),i=b(),a=r(w),s=r(x),c=H(`database`),[l,u]=t(tt),d=a.length+s.length,f;e[0]!==d||e[1]!==l.hasUserInteracted||e[2]!==l.openSections?(f=!l.hasUserInteracted&&d>0?[...new Set([...l.openSections,`datasources`])]:l.openSections,e[0]=d,e[1]=l.hasUserInteracted,e[2]=l.openSections,e[3]=f):f=e[3];let m=f,h;e[4]===u?h=e[5]:(h=e=>{u({openSections:e,hasUserInteracted:!0})},e[4]=u,e[5]=h);let g=h,_;e[6]===m?_=e[7]:(_=m.includes(`datasources`),e[6]=m,e[7]=_);let v=!_&&d>0,y=c.length>0,S;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(xe,{className:`w-4 h-4`}),e[8]=S):S=e[8];let C;e[9]!==d||e[10]!==v?(C=v&&(0,Z.jsx)(Je,{children:d}),e[9]=d,e[10]=v,e[11]=C):C=e[11];let T;e[12]!==c.length||e[13]!==y?(T=y&&(0,Z.jsx)(et,{count:c.length,type:`database`}),e[12]=c.length,e[13]=y,e[14]=T):T=e[14];let E;e[15]!==C||e[16]!==T?(E=(0,Z.jsxs)(Ye,{children:[S,`Data sources`,C,T]}),e[15]=C,e[16]=T,e[17]=E):E=e[17];let D;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(Xe,{children:(0,Z.jsx)(dt,{})}),e[18]=D):D=e[18];let O;e[19]===E?O=e[20]:(O=(0,Z.jsxs)(Qe,{value:`datasources`,children:[E,D]}),e[19]=E,e[20]=O);let k;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsxs)(Ye,{children:[(0,Z.jsx)(p,{className:`w-4 h-4`}),`Variables`]}),e[21]=k):k=e[21];let A;e[22]!==i||e[23]!==n?(A=(0,Z.jsxs)(Qe,{value:`variables`,lastItem:!0,children:[k,(0,Z.jsx)(Xe,{children:Object.keys(n).length===0?(0,Z.jsx)(`div`,{className:`px-3 py-4 text-sm text-muted-foreground`,children:`No variables defined`}):(0,Z.jsx)(Ot,{cellIds:i.inOrderIds,variables:n})})]}),e[22]=i,e[23]=n,e[24]=A):A=e[24];let j;return e[25]!==g||e[26]!==m||e[27]!==A||e[28]!==O?(j=(0,Z.jsxs)(ae,{type:`multiple`,value:m,onValueChange:g,className:`flex flex-col h-full overflow-auto`,children:[O,A]}),e[25]=g,e[26]=m,e[27]=A,e[28]=O,e[29]=j):j=e[29],j};export{kt as default};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,u as i}from"./useEvent-Dc9HkKI2.js";import{t as a}from"./react-CUdNIagt.js";import{$r as o,Ai as s,Bi as c,Bt as l,Cn as u,D as d,Gn as f,Ha as p,Hi as m,Ii as h,Ji as g,Ki as _,Kn as v,Li as y,M as b,Mi as x,P as S,Qr as C,Ri as w,Rn as T,Rt as E,Ui as D,Wa as O,Wi as k,Xi as A,Yi as j,Zi as M,_n as ee,c as N,fn as P,gn as F,i as I,jn as L,qi as R,qn as z,ro as te,ti as ne,to as B,yr as V,yt as H,zi as U}from"./cells-CxY8RSp7.js";import{t as W}from"./compiler-runtime-BQ9S8nyo.js";import{s as re}from"./config-Cyum2gRs.js";import{O as G}from"./config-D_c_6ce1.js";import{t as K}from"./ErrorBoundary-CG6gtgym.js";import{t as ie}from"./cn-ldLVeaqm.js";import{t as q}from"./jsx-runtime-B74pBk57.js";import{r as ae}from"./config-CR2d-XsP.js";import{_ as oe,at as J,f as se,g as ce,h as le,it as ue,m as de,nt as fe,ot as pe,rt as me,tt as he,v as ge}from"./JsonOutput-DCGUcLVV.js";import{t as _e}from"./tooltip-B5pI8o2n.js";import{r as ve,t as ye}from"./button-M49xxKoi.js";import{t as be}from"./createLucideIcon-rHn2EdoM.js";import{i as xe}from"./paths-CzfpItSz.js";import{r as Se}from"./useNumberFormatter-BP99Zbyy.js";import{a as Ce,r as we}from"./tree-actions-D5clvgKl.js";import{a as Te}from"./input-DPd57MDP.js";import{n as Ee,o as De}from"./column-preview-fD3qW2B5.js";import{t as Oe}from"./workflow-nBi9HGeO.js";import{t as ke}from"./copy-icon-wfSGfX8v.js";import{l as Ae}from"./arrays-BqUx5USx.js";import{i as je}from"./strings-hlCLC-K1.js";import{r as Me}from"./requests-yTHMxhVa.js";import{t as Ne}from"./I18nProvider-BFOBKCJB.js";import{n as Pe}from"./useAsyncData-DucTwMkf.js";import{t as Fe}from"./cell-link-DC1UZQr_.js";import{a as Ie,i as Le,n as Re,o as ze,r as Be,t as Ve}from"./table-Dg1KxH-q.js";import{n as He}from"./icons-CVdkfEA3.js";import{t as Ue}from"./useDeepCompareMemoize-DSlTt6u_.js";import{t as We}from"./useAddCell-Bhv6GT3m.js";import{t as Ge}from"./empty-state-CzxjZqGW.js";import{n as Ke,t as qe}from"./common-Cy3lJDvJ.js";import{a as Je,i as Ye,n as Xe,o as Ze,r as Qe,s as $e,t as et}from"./components-D9ZIJGG8.js";import{r as tt}from"./panel-accordion-state-BI4SU22L.js";var nt=be(`square-equal`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 10h10`,key:`1101jm`}],[`path`,{d:`M7 14h10`,key:`1mhdw3`}]]),Y=W(),X=e(a(),1),Z=q(),rt=1;function it(e){return 1.75+e*rt}function at(e){return 3+e*rt}function ot(e){return 3.25+e*rt}var Q={engineEmpty:.75,engine:.75,database:1,tableLoading:2.75,tableSchemaless:2,columnLocal:1.25,columnPreview:2.5};function $(e){return{paddingLeft:`${e}rem`}}var st=n(e=>{let t=e(w),n=e(ne),r=e(I);return Ae(t,e=>{if(!e.variable_name)return-1;let t=Object.values(n).find(t=>t.name===e.variable_name);if(!t)return 0;let i=r.inOrderIds.indexOf(t.declaredBy[0]);return i===-1?0:i})}),ct=G(`marimo:datasources:hideEmpty`,!1,C,{getOnInit:!0});function lt(e){let t=!1,n=[];for(let r of e){if(!k(r)||!m(r)){n.push(r);continue}let e=r.child_schemas??[],i=lt(e);if(r.tables.length===0&&i.length===0){t=!0;continue}if(i===e){n.push(r);continue}t=!0,n.push({...r,child_schemas:i})}return t?n:e}function ut(e){let t=!1,n=[];for(let r of e){if(D(r)&&r.schemas.length===0){t=!0;continue}if(r.schemas.length===0){n.push(r);continue}let e=lt(r.schemas);if(e.length===0){t=!0;continue}if(e===r.schemas){n.push(r);continue}t=!0,n.push({...r,schemas:e})}return t?n:e}var dt=()=>{let e=(0,Y.c)(42),[n,a]=X.useState(``),[o,s]=t(ct),c=i(y),l=r(st),d=r(x),f;bb0:{if(!o){f=d;break bb0}let t,n;e[0]===d?(t=e[1],n=e[2]):(t=!1,n=d.map(e=>{let n=ut(e.databases);return n===e.databases?e:(t=!0,{...e,databases:n})}),e[0]=d,e[1]=t,e[2]=n),f=t?n:d}let p=f;if(l.length===0&&p.length===0){let t;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Ge,{title:`No tables found`,description:`Any datasets/dataframes in the global scope will be shown here.`,action:(0,Z.jsx)(Ze,{group:`database`,label:`Add database or catalog`,variant:`outline`,size:`sm`}),icon:(0,Z.jsx)(xe,{})}),e[3]=t):t=e[3],t}let m;e[4]===n?m=e[5]:(m=n.trim(),e[4]=n,e[5]=m);let h=!!m,g;e[6]===c?g=e[7]:(g=e=>{c(e.length>0),a(e)},e[6]=c,e[7]=g);let _;e[8]!==n||e[9]!==g?(_=(0,Z.jsx)(F,{placeholder:`Search tables...`,className:`h-6 m-1`,value:n,onValueChange:g,rootClassName:`flex-1 border-r border-b-0`}),e[8]=n,e[9]=g,e[10]=_):_=e[10];let v;e[11]===h?v=e[12]:(v=h&&(0,Z.jsx)(`button`,{type:`button`,className:`float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground`,onClick:()=>a(``),children:(0,Z.jsx)(Se,{className:`h-4 w-4`})}),e[11]=h,e[12]=v);let b=!o,S;e[13]!==o||e[14]!==s?(S=()=>s(!o),e[13]=o,e[14]=s,e[15]=S):S=e[15];let C;e[16]!==b||e[17]!==S?(C=(0,Z.jsx)(Ce,{"data-testid":`datasources-hide-empty-button`,isVisible:b,onToggle:S,showTooltip:`Show empty schemas and databases`,hideTooltip:`Hide empty schemas and databases`,size:`sm`,className:`px-2 rounded-none focus-visible:outline-hidden`}),e[16]=b,e[17]=S,e[18]=C):C=e[18];let w;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Ze,{group:`database`,label:`Add database or catalog`,compact:!0,variant:`ghost`,size:`sm`,className:`px-2 rounded-none focus-visible:outline-hidden`}),e[19]=w):w=e[19];let T;e[20]!==_||e[21]!==v||e[22]!==C?(T=(0,Z.jsxs)(`div`,{className:`flex items-center w-full border-b`,children:[_,v,C,w]}),e[20]=_,e[21]=v,e[22]=C,e[23]=T):T=e[23];let E;if(e[24]!==p||e[25]!==n){let t;e[27]===n?t=e[28]:(t=e=>(0,Z.jsx)(ft,{connection:e,hasChildren:e.databases.length>0,children:e.databases.map(t=>(0,Z.jsx)(gt,{connection:e,database:t,searchValue:n},t.name))},e.name),e[27]=n,e[28]=t),E=p.map(t),e[24]=p,e[25]=n,e[26]=E}else E=e[26];let D;e[29]!==p.length||e[30]!==l.length?(D=p.length>0&&l.length>0&&(0,Z.jsxs)(de,{className:`pr-2`,style:$(Q.engine),children:[(0,Z.jsx)(He,{className:`h-4 w-4 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`text-xs`,children:`Python`})]}),e[29]=p.length,e[30]=l.length,e[31]=D):D=e[31];let O;e[32]!==n||e[33]!==l?(O=l.length>0&&(0,Z.jsx)(bt,{tables:l,searchValue:n}),e[32]=n,e[33]=l,e[34]=O):O=e[34];let k;e[35]!==E||e[36]!==D||e[37]!==O?(k=(0,Z.jsxs)(u,{className:`flex flex-col`,children:[E,D,O]}),e[35]=E,e[36]=D,e[37]=O,e[38]=k):k=e[38];let A;return e[39]!==k||e[40]!==T?(A=(0,Z.jsxs)(P,{className:`border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden`,shouldFilter:!1,children:[T,k]}),e[39]=k,e[40]=T,e[41]=A):A=e[41],A},ft=e=>{let t=(0,Y.c)(26),{connection:n,children:r,hasChildren:i}=e,a=n.name===M,o=a?`In-Memory`:n.name,{previewDataSourceConnection:c}=Me(),l;t[0]!==n.name||t[1]!==c?(l=async()=>{await c({engine:n.name})},t[0]=n.name,t[1]=c,t[2]=l):l=t[2];let u=l,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=$(Q.engine),t[3]=d):d=t[3];let f;t[4]===n.dialect?f=t[5]:(f=(0,Z.jsx)(L,{className:`h-4 w-4 text-muted-foreground`,name:n.dialect}),t[4]=n.dialect,t[5]=f);let p;t[6]===n.dialect?p=t[7]:(p=s(n.dialect),t[6]=n.dialect,t[7]=p);let m;t[8]===p?m=t[9]:(m=(0,Z.jsx)(`span`,{className:`text-xs`,children:p}),t[8]=p,t[9]=m);let h=o,g;t[10]===h?g=t[11]:(g=(0,Z.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,(0,Z.jsx)($e,{variableName:h}),`)`]}),t[10]=h,t[11]=g);let _;t[12]!==u||t[13]!==a?(_=!a&&(0,Z.jsx)(we,{onClick:u,tooltip:`Refresh connection`,className:`ml-auto h-4 p-0`,iconClassName:`h-3.5 w-3.5`}),t[12]=u,t[13]=a,t[14]=_):_=t[14];let v;t[15]!==f||t[16]!==m||t[17]!==g||t[18]!==_?(v=(0,Z.jsxs)(de,{className:`pr-2`,style:d,children:[f,m,g,_]}),t[15]=f,t[16]=m,t[17]=g,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==r||t[21]!==i?(y=i?r:(0,Z.jsx)(le,{content:`No databases available`,style:$(Q.engineEmpty)}),t[20]=r,t[21]=i,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==v?(b=(0,Z.jsxs)(Z.Fragment,{children:[v,y]}),t[23]=y,t[24]=v,t[25]=b):b=t[25],b},pt=X.createContext(null);function mt(){let e=X.useContext(pt);if(e==null)throw Error(`useDataSourceTree must be used within a DataSourceTreeContext.Provider`);return e}function ht(e,{schema:t,schemaPath:n}){return{engine:e.engineName,database:e.databaseName,schema:t,schemaPath:n,defaultSchema:e.defaultSchema,defaultDatabase:e.defaultDatabase,dialect:e.dialect}}var gt=e=>{let t=(0,Y.c)(21),{connection:n,database:r,searchValue:i}=e,a;t[0]!==n.default_database||t[1]!==n.default_schema||t[2]!==n.dialect||t[3]!==n.name||t[4]!==r.name||t[5]!==i?(a={engineName:n.name,databaseName:r.name,dialect:n.dialect,defaultSchema:n.default_schema,defaultDatabase:n.default_database,searchValue:i},t[0]=n.default_database,t[1]=n.default_schema,t[2]=n.dialect,t[3]=n.name,t[4]=r.name,t[5]=i,t[6]=a):a=t[6];let o=a,s=n.name,c=r.schemas,l;t[7]===r?l=t[8]:(l=D(r),t[7]=r,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[9]=u):u=t[9];let d;t[10]!==r.schemas||t[11]!==l?(d=(0,Z.jsx)(vt,{schemas:c,schemasResolved:l,schemaPath:u,depth:0}),t[10]=r.schemas,t[11]=l,t[12]=d):d=t[12];let f;t[13]!==d||t[14]!==o?(f=(0,Z.jsx)(pt.Provider,{value:o,children:d}),t[13]=d,t[14]=o,t[15]=f):f=t[15];let p;return t[16]!==n.name||t[17]!==r||t[18]!==i||t[19]!==f?(p=(0,Z.jsx)(_t,{engineName:s,database:r,searchValue:i,children:f}),t[16]=n.name,t[17]=r,t[18]=i,t[19]=f,t[20]=p):p=t[20],p},_t=e=>{let t=(0,Y.c)(29),{searchValue:n,engineName:r,database:i,children:a}=e,o;t[0]!==i||t[1]!==n?(o=g(i,n),t[0]=i,t[1]=n,t[2]=o):o=t[2];let s=o,[c,l]=X.useState(s),[u,d]=X.useState(!1),[f,p]=X.useState(n),[m,h]=X.useState(s);(f!==n||m!==s)&&(p(n),h(s),l(s));let _;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=$(Q.database),t[3]=_):_=t[3];let v;t[4]!==c||t[5]!==u?(v=()=>{l(!c),d(!u)},t[4]=c,t[5]=u,t[6]=v):v=t[6];let y=`${r}:${i.name}`,b;t[7]===c?b=t[8]:(b=(0,Z.jsx)(ge,{isExpanded:c}),t[7]=c,t[8]=b);let x=u&&c?`text-foreground`:`text-muted-foreground`,S;t[9]===x?S=t[10]:(S=ie(`h-4 w-4`,x),t[9]=x,t[10]=S);let C;t[11]===S?C=t[12]:(C=(0,Z.jsx)(xe,{className:S}),t[11]=S,t[12]=C);let w=u&&c&&`font-semibold`,T;t[13]===w?T=t[14]:(T=ie(w),t[13]=w,t[14]=T);let E;t[15]===i.name?E=t[16]:(E=i.name===``?(0,Z.jsx)(`i`,{children:`Not connected`}):i.name,t[15]=i.name,t[16]=E);let D;t[17]!==T||t[18]!==E?(D=(0,Z.jsx)(`span`,{className:T,children:E}),t[17]=T,t[18]=E,t[19]=D):D=t[19];let O;t[20]!==D||t[21]!==v||t[22]!==y||t[23]!==b||t[24]!==C?(O=(0,Z.jsxs)(ee,{className:`text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none`,style:_,onSelect:v,value:y,children:[b,C,D]}),t[20]=D,t[21]=v,t[22]=y,t[23]=b,t[24]=C,t[25]=O):O=t[25];let k=c&&a,A;return t[26]!==O||t[27]!==k?(A=(0,Z.jsxs)(Z.Fragment,{children:[O,k]}),t[26]=O,t[27]=k,t[28]=A):A=t[28],A},vt=e=>{let{schemas:t,schemasResolved:n,depth:r}=e,i=mt(),{engineName:a,databaseName:o,searchValue:s}=i,{addSchemaList:c}=h(),l=Ue(e.schemaPath),[u,d]=X.useState(!1),{isPending:p,error:m}=Pe(async()=>{if(!n&&a){d(!0);try{let e=await f.request({engine:a,database:o,schemaPath:l});c({schemas:e.schemas??[],sqlSchemaContext:{engine:a,database:o,schemaPath:l}})}finally{d(!1)}}},[n,a,o,l]),g=$(it(r));return p||u?(0,Z.jsx)(oe,{message:`Loading schemas...`,style:g}):m?(0,Z.jsx)(ce,{error:m,style:g}):t.length===0?(0,Z.jsx)(le,{content:`No schemas available`,style:g}):(0,Z.jsx)(Z.Fragment,{children:t.map(e=>_(e.name)?(0,Z.jsx)(bt,{tables:e.tables,tablesResolved:k(e),searchValue:s,sqlTableContext:ht(i,{schema:e.name,schemaPath:l})},e.name):(0,Z.jsx)(yt,{schema:e,schemaPath:[...l,e.name],depth:r},e.name))})},yt=e=>{let t=(0,Y.c)(41),{schema:n,schemaPath:r,depth:i}=e,a=mt(),{databaseName:o,searchValue:s}=a,c;t[0]!==n||t[1]!==s?(c=R(n,s),t[0]=n,t[1]=s,t[2]=c):c=t[2];let l=c,[u,d]=X.useState(l),[f,p]=X.useState(!1),[h,g]=X.useState(s),[_,v]=X.useState(l),y;t[3]===r?y=t[4]:(y=r.join(`.`),t[3]=r,t[4]=y);let b=`${o}:${y}`,x;t[5]===n.child_schemas?x=t[6]:(x=n.child_schemas??[],t[5]=n.child_schemas,t[6]=x);let S=x;(h!==s||_!==l)&&(g(s),v(l),d(l));let C;t[7]===i?C=t[8]:(C=$(it(i)),t[7]=i,t[8]=C);let w;t[9]!==u||t[10]!==f?(w=()=>{d(!u),p(!f)},t[9]=u,t[10]=f,t[11]=w):w=t[11];let T;t[12]===u?T=t[13]:(T=(0,Z.jsx)(ge,{isExpanded:u}),t[12]=u,t[13]=T);let E=f&&u&&`text-foreground`,D;t[14]===E?D=t[15]:(D=ie(`h-4 w-4 text-muted-foreground`,E),t[14]=E,t[15]=D);let O;t[16]===D?O=t[17]:(O=(0,Z.jsx)(B,{className:D}),t[16]=D,t[17]=O);let A=f&&u&&`font-semibold`,j;t[18]===A?j=t[19]:(j=ie(A),t[18]=A,t[19]=j);let M;t[20]!==n.name||t[21]!==j?(M=(0,Z.jsx)(`span`,{className:j,children:n.name}),t[20]=n.name,t[21]=j,t[22]=M):M=t[22];let N;t[23]!==M||t[24]!==C||t[25]!==w||t[26]!==T||t[27]!==O||t[28]!==b?(N=(0,Z.jsxs)(ee,{className:`text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none`,style:C,onSelect:w,value:b,children:[T,O,M]}),t[23]=M,t[24]=C,t[25]=w,t[26]=T,t[27]=O,t[28]=b,t[29]=N):N=t[29];let P;t[30]!==S||t[31]!==i||t[32]!==u||t[33]!==n||t[34]!==r||t[35]!==s||t[36]!==a?(P=u&&(0,Z.jsxs)(Z.Fragment,{children:[(S.length>0||!m(n))&&(0,Z.jsx)(vt,{schemas:S,schemasResolved:m(n),schemaPath:r,depth:i+1}),(0,Z.jsx)(bt,{tables:n.tables,tablesResolved:k(n),searchValue:s,tableIndentRem:at(i),columnIndentRem:ot(i),sqlTableContext:ht(a,{schema:n.name,schemaPath:r})})]}),t[30]=S,t[31]=i,t[32]=u,t[33]=n,t[34]=r,t[35]=s,t[36]=a,t[37]=P):P=t[37];let F;return t[38]!==N||t[39]!==P?(F=(0,Z.jsxs)(Z.Fragment,{children:[N,P]}),t[38]=N,t[39]=P,t[40]=F):F=t[40],F},bt=e=>{let t=(0,Y.c)(31),{tables:n,sqlTableContext:r,searchValue:i,tablesResolved:a,tableIndentRem:o,columnIndentRem:s}=e,c=a===void 0||a,{addTableList:l}=h(),[u,d]=X.useState(!1),f;t[0]!==l||t[1]!==r||t[2]!==c?(f=async()=>{if(!c&&r){d(!0);let{engine:e,database:t,schema:n,schemaPath:i}=r,a=await z.request({engine:e,database:t,schema:n,schemaPath:i??[]});if(!a?.tables)throw d(!1),Error(`No tables available`);l({tables:a.tables,sqlTableContext:r}),d(!1)}},t[0]=l,t[1]=r,t[2]=c,t[3]=f):f=t[3];let p;t[4]!==r||t[5]!==c?(p=[c,r],t[4]=r,t[5]=c,t[6]=p):p=t[6];let{isPending:m,error:g}=Pe(f,p),_=o??Q.tableLoading,v;t[7]===_?v=t[8]:(v=$(_),t[7]=_,t[8]=v);let y=v;if(m||u){let e;return t[9]===y?e=t[10]:(e=(0,Z.jsx)(oe,{message:`Loading tables...`,style:y}),t[9]=y,t[10]=e),e}if(g){let e;return t[11]!==g||t[12]!==y?(e=(0,Z.jsx)(ce,{error:g,style:y}),t[11]=g,t[12]=y,t[13]=e):e=t[13],e}if(n.length===0){let e;return t[14]===y?e=t[15]:(e=(0,Z.jsx)(le,{content:`No tables found`,style:y}),t[14]=y,t[15]=e),e}let b;if(t[16]!==s||t[17]!==i||t[18]!==r||t[19]!==o||t[20]!==n){let e;t[22]===i?e=t[23]:(e=e=>!i||e.name.toLowerCase().includes(i.toLowerCase()),t[22]=i,t[23]=e);let a=n.filter(e),c;t[24]!==s||t[25]!==i||t[26]!==r||t[27]!==o?(c=e=>(0,Z.jsx)(xt,{table:e,sqlTableContext:r,isSearching:!!i,tableIndentRem:o,columnIndentRem:s},e.name),t[24]=s,t[25]=i,t[26]=r,t[27]=o,t[28]=c):c=t[28],b=a.map(c),t[16]=s,t[17]=i,t[18]=r,t[19]=o,t[20]=n,t[21]=b}else b=t[21];let x;return t[29]===b?x=t[30]:(x=(0,Z.jsx)(Z.Fragment,{children:b}),t[29]=b,t[30]=x),x},xt=e=>{let t=(0,Y.c)(69),{table:n,sqlTableContext:i,isSearching:a,tableIndentRem:o,columnIndentRem:s}=e,{addTable:c}=h(),[u,f]=X.useState(!1),p=n.columns.length>0,m;t[0]!==c||t[1]!==u||t[2]!==i||t[3]!==n.name||t[4]!==p?(m=async()=>{if(u&&!p&&i){let{engine:e,database:t,schema:r,schemaPath:a}=i,o=await v.request({engine:e,database:t,schema:r,tableName:n.name,schemaPath:a??[]});if(!o?.table)throw Error(`No table details available`);c({table:o.table,sqlTableContext:i})}},t[0]=c,t[1]=u,t[2]=i,t[3]=n.name,t[4]=p,t[5]=m):m=t[5];let g;t[6]!==u||t[7]!==p?(g=[u,p],t[6]=u,t[7]=p,t[8]=g):g=t[8];let{isFetching:_,isPending:y,error:b}=Pe(m,g),x=r(re),S=E(),{createNewCell:C}=d(),w=We(),T;t[9]!==w||t[10]!==x||t[11]!==C||t[12]!==S||t[13]!==i||t[14]!==n?(T=()=>{l({autoInstantiate:x,createNewCell:C,fromCellId:S}),w((()=>{if(n.source_type===`catalog`){let e=i?.database?[i.database,...i.schemaPath??[],n.name].join(`.`):n.name;return`${n.engine}.load_table("${e}")`}if(i)return j({table:n,columnName:`*`,sqlTableContext:i});switch(n.source_type){case`local`:return`mo.ui.table(${n.name})`;case`duckdb`:case`connection`:return j({table:n,columnName:`*`,sqlTableContext:i});default:return je(n.source_type),``}})())},t[9]=w,t[10]=x,t[11]=C,t[12]=S,t[13]=i,t[14]=n,t[15]=T):T=t[15];let D=T,k;t[16]!==n.num_columns||t[17]!==n.num_rows?(k=()=>{let e=[];return n.num_rows!=null&&e.push(`${n.num_rows} rows`),n.num_columns!=null&&e.push(`${n.num_columns} columns`),e.length===0?null:(0,Z.jsx)(`div`,{className:`flex flex-row gap-2 items-center pl-6 group-hover:hidden`,children:(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.join(`, `)})})},t[16]=n.num_columns,t[17]=n.num_rows,t[18]=k):k=t[18];let M=k,N;t[19]!==s||t[20]!==b||t[21]!==_||t[22]!==y||t[23]!==i||t[24]!==n?(N=()=>{let e=$(s??Q.tableLoading);if(y||_)return(0,Z.jsx)(oe,{message:`Loading columns...`,style:e});if(b)return(0,Z.jsx)(ce,{error:b,style:e});let t=n.columns;return t.length===0?(0,Z.jsx)(le,{content:`No columns found`,style:e}):t.map(e=>(0,Z.jsx)(St,{table:n,column:e,sqlTableContext:i,columnIndentRem:s},e.name))},t[19]=s,t[20]=b,t[21]=_,t[22]=y,t[23]=i,t[24]=n,t[25]=N):N=t[25];let P=N,F;t[26]!==u||t[27]!==a||t[28]!==n.source_type||t[29]!==n.type?(F=()=>{if(n.source_type===`local`)return;let e=n.type===`table`?O:te;return(0,Z.jsx)(e,{className:`h-3 w-3`,strokeWidth:u||a?2.5:void 0})},t[26]=u,t[27]=a,t[28]=n.source_type,t[29]=n.type,t[30]=F):F=t[30];let I=F,L;t[31]!==i||t[32]!==n.name?(L=A(i,n.name),t[31]=i,t[32]=n.name,t[33]=L):L=t[33];let R=L,z=o??(i?Q.tableSchemaless:0),ne=(u||a)&&`font-semibold`,B;t[34]===ne?B=t[35]:(B=ie(`rounded-none group h-8 cursor-pointer`,ne),t[34]=ne,t[35]=B);let V;t[36]===z?V=t[37]:(V=$(z),t[36]=z,t[37]=V);let H;t[38]===u?H=t[39]:(H=()=>f(!u),t[38]=u,t[39]=H);let U;t[40]===I?U=t[41]:(U=I(),t[40]=I,t[41]=U);let W;t[42]===n.name?W=t[43]:(W=(0,Z.jsx)(`span`,{className:`text-sm`,children:n.name}),t[42]=n.name,t[43]=W);let G;t[44]!==U||t[45]!==W?(G=(0,Z.jsxs)(`div`,{className:`flex gap-2 items-center flex-1 pl-1`,children:[U,W]}),t[44]=U,t[45]=W,t[46]=G):G=t[46];let K;t[47]===M?K=t[48]:(K=M(),t[47]=M,t[48]=K);let q;t[49]===D?q=t[50]:(q=ve.stopPropagation(()=>D()),t[49]=D,t[50]=q);let ae;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(De,{className:`h-3 w-3`}),t[51]=ae):ae=t[51];let J;t[52]===q?J=t[53]:(J=(0,Z.jsx)(_e,{content:`Add table to notebook`,delayDuration:400,children:(0,Z.jsx)(ye,{className:`group-hover:inline-flex hidden`,variant:`text`,size:`icon`,onClick:q,children:ae})}),t[52]=q,t[53]=J);let se;t[54]!==u||t[55]!==V||t[56]!==H||t[57]!==G||t[58]!==K||t[59]!==J||t[60]!==B||t[61]!==R?(se=(0,Z.jsxs)(ee,{className:B,style:V,value:R,"aria-selected":u,forceMount:!0,onSelect:H,children:[G,K,J]}),t[54]=u,t[55]=V,t[56]=H,t[57]=G,t[58]=K,t[59]=J,t[60]=B,t[61]=R,t[62]=se):se=t[62];let ue;t[63]!==u||t[64]!==P?(ue=u&&P(),t[63]=u,t[64]=P,t[65]=ue):ue=t[65];let de;return t[66]!==se||t[67]!==ue?(de=(0,Z.jsxs)(Z.Fragment,{children:[se,ue]}),t[66]=se,t[67]=ue,t[68]=de):de=t[68],de},St=e=>{let t=(0,Y.c)(51),{table:n,column:a,sqlTableContext:o,columnIndentRem:s}=e,[l,u]=X.useState(!1),d=r(y),f=i(U);d&&l&&u(!1),f(l?e=>new Set([...e,`${n.name}:${a.name}`]):e=>(e.delete(`${n.name}:${a.name}`),new Set(e)));let p=We(),{columnsPreviews:m}=c(),h;t[0]!==a.name||t[1]!==n.primary_keys?(h=n.primary_keys?.includes(a.name)||!1,t[0]=a.name,t[1]=n.primary_keys,t[2]=h):h=t[2];let g=h,_;t[3]!==a.name||t[4]!==n.indexes?(_=n.indexes?.includes(a.name)||!1,t[3]=a.name,t[4]=n.indexes,t[5]=_):_=t[5];let v=_,b;t[6]===p?b=t[7]:(b=e=>{p(e)},t[6]=p,t[7]=b);let x=b,S=Ct,C=l?`font-semibold`:``,w;t[8]!==a.name||t[9]!==C?(w=(0,Z.jsx)(`span`,{className:C,children:a.name}),t[8]=a.name,t[9]=C,t[10]=w):w=t[10];let T=w,E=`${n.name}.${a.name}`,D=`${n.name}.${a.name}`,O;t[11]===l?O=t[12]:(O=()=>u(!l),t[11]=l,t[12]=O);let k;t[13]!==s||t[14]!==o?(k=s??(o?ot(0):Q.columnLocal),t[13]=s,t[14]=o,t[15]=k):k=t[15];let A;t[16]===k?A=t[17]:(A=$(k),t[16]=k,t[17]=A);let j;t[18]!==a.type||t[19]!==T?(j=(0,Z.jsx)(se,{columnName:T,dataType:a.type}),t[18]=a.type,t[19]=T,t[20]=j):j=t[20];let M;t[21]===g?M=t[22]:(M=g&&S({tooltipContent:`Primary key`,content:`PK`}),t[21]=g,t[22]=M);let N;t[23]===v?N=t[24]:(N=v&&S({tooltipContent:`Indexed`,content:`IDX`}),t[23]=v,t[24]=N);let P;t[25]!==A||t[26]!==j||t[27]!==M||t[28]!==N?(P=(0,Z.jsxs)(`div`,{className:`flex flex-row gap-2 items-center flex-1`,style:A,children:[j,M,N]}),t[25]=A,t[26]=j,t[27]=M,t[28]=N,t[29]=P):P=t[29];let F;t[30]===a.name?F=t[31]:(F=(0,Z.jsx)(_e,{content:`Copy column name`,delayDuration:400,children:(0,Z.jsx)(ye,{variant:`text`,size:`icon`,className:`group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(ke,{tooltip:!1,value:a.name,className:`h-3 w-3`})})}),t[30]=a.name,t[31]=F);let I;t[32]===a.external_type?I=t[33]:(I=(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a.external_type}),t[32]=a.external_type,t[33]=I);let L;t[34]!==P||t[35]!==F||t[36]!==I||t[37]!==E||t[38]!==D||t[39]!==O?(L=(0,Z.jsxs)(ee,{className:`rounded-none py-1 group cursor-pointer`,value:D,onSelect:O,children:[P,F,I]},E),t[34]=P,t[35]=F,t[36]=I,t[37]=E,t[38]=D,t[39]=O,t[40]=L):L=t[40];let R;t[41]!==a||t[42]!==m||t[43]!==x||t[44]!==l||t[45]!==o||t[46]!==n?(R=l&&(0,Z.jsx)(`div`,{className:`pr-2 py-2 bg-(--slate-1) shadow-inner border-b`,style:$(Q.columnPreview),children:(0,Z.jsx)(K,{children:(0,Z.jsx)(Ee,{table:n,column:a,onAddColumnChart:x,preview:m.get(o?`${o.database}.${o.schema}.${n.name}:${a.name}`:`${n.name}:${a.name}`),sqlTableContext:o})})}),t[41]=a,t[42]=m,t[43]=x,t[44]=l,t[45]=o,t[46]=n,t[47]=R):R=t[47];let z;return t[48]!==L||t[49]!==R?(z=(0,Z.jsxs)(Z.Fragment,{children:[L,R]}),t[48]=L,t[49]=R,t[50]=z):z=t[50],z};function Ct(e){let{tooltipContent:t,content:n}=e;return(0,Z.jsx)(_e,{content:t,delayDuration:100,children:(0,Z.jsx)(`span`,{className:`text-xs text-black bg-gray-100 dark:invert rounded px-1`,children:n})})}function wt(e){return e}var Tt={name:`name`,type:`type-value`,defs:`defs-refs`},Et=[wt({id:Tt.name,accessorFn:e=>[e.name,e.declaredBy],enableSorting:!0,sortingFn:`alphanumeric`,header:({column:e})=>(0,Z.jsx)(he,{header:`Name`,column:e}),cell:({getValue:e})=>{let[t,n]=e();return(0,Z.jsx)(qe,{name:t,declaredBy:n})}}),wt({id:Tt.type,accessorFn:e=>[e.dataType,e.value],enableSorting:!0,sortingFn:`alphanumeric`,header:({column:e})=>(0,Z.jsx)(he,{header:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{children:`Type`}),(0,Z.jsx)(`span`,{children:`Value`})]}),column:e}),cell:({getValue:e})=>{let[t,n]=e();return(0,Z.jsxs)(`div`,{className:`max-w-[150px]`,children:[(0,Z.jsx)(`div`,{className:`text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs`,children:t}),(0,Z.jsx)(`div`,{className:`text-ellipsis overflow-hidden whitespace-nowrap`,title:n??``,children:n})]})}}),wt({id:Tt.defs,accessorFn:e=>[e.declaredBy,e.usedBy,e.name,e.declaredByNames,e.usedByNames],enableSorting:!0,sortingFn:`basic`,header:({column:e})=>(0,Z.jsx)(he,{header:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{children:`Declared By`}),(0,Z.jsx)(`span`,{children:`Used By`})]}),column:e}),cell:({getValue:e})=>{let[t,n,r]=e(),i=e=>{let t=N(e);t&&V(t,r)};return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 py-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-row overflow-auto gap-2 items-center`,children:[(0,Z.jsx)(`span`,{title:`Declared by`,children:(0,Z.jsx)(nt,{className:`w-3.5 h-3.5 text-muted-foreground`})}),t.length===1?(0,Z.jsx)(Fe,{variant:`focus`,cellId:t[0],skipScroll:!0,onClick:()=>i(t[0])}):(0,Z.jsx)(`div`,{className:`text-destructive flex flex-row gap-2`,children:t.slice(0,3).map((e,n)=>(0,Z.jsxs)(`span`,{className:`flex`,children:[(0,Z.jsx)(Fe,{variant:`focus`,cellId:e,skipScroll:!0,className:`whitespace-nowrap text-destructive`,onClick:()=>i(e)},e),n<t.length-1&&`, `]},e))})]}),(0,Z.jsxs)(`div`,{className:`flex flex-row overflow-auto gap-2 items-baseline`,children:[(0,Z.jsx)(`span`,{title:`Used by`,children:(0,Z.jsx)(Oe,{className:`w-3.5 h-3.5 text-muted-foreground`})}),(0,Z.jsx)(Ke,{maxCount:3,cellIds:n,skipScroll:!0,onClick:i})]})]})}})];function Dt({variables:e,sort:t,cellIdToIndex:n}){t||={id:Tt.defs,desc:!1};let r=[];switch(t.id){case Tt.name:r=Ae(e,e=>e.name);break;case Tt.type:r=Ae(e,e=>e.dataType);break;case Tt.defs:r=Ae(e,e=>n.get(e.declaredBy[0]))}return t.desc?r.toReversed():r}var Ot=(0,X.memo)(({className:e,cellIds:t,variables:n})=>{let[r,i]=X.useState([]),[a,o]=X.useState(``),s=S(),{locale:c}=Ne(),l=(0,X.useMemo)(()=>{let e=e=>{let n=s[e];return T(n)?`cell-${t.indexOf(e)}`:n??`cell-${t.indexOf(e)}`};return Object.values(n).map(t=>({...t,declaredByNames:t.declaredBy.map(e),usedByNames:t.usedBy.map(e)}))},[n,s,t]),u=(0,X.useMemo)(()=>{let e=new Map;return t.forEach((t,n)=>e.set(t,n)),Dt({variables:l,sort:r[0],cellIdToIndex:e})},[l,r,t]),d=me({data:u,columns:Et,getCoreRowModel:ue(),onGlobalFilterChange:o,getFilteredRowModel:J(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter(e){return e.columnDef.enableGlobalFilter??!0},globalFilterFn:`auto`,manualSorting:!0,locale:c,onSortingChange:i,getSortedRowModel:pe(),state:{sorting:r,globalFilter:a}});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Te,{className:`w-full`,placeholder:`Search`,value:a,onChange:e=>o(e.target.value)}),(0,Z.jsxs)(Ve,{className:ie(`w-full text-sm flex-1 border-separate border-spacing-0`,e),children:[(0,Z.jsx)(Ie,{children:(0,Z.jsx)(ze,{className:`whitespace-nowrap text-xs`,children:d.getFlatHeaders().map(e=>(0,Z.jsx)(Le,{className:`sticky top-0 bg-background border-b`,children:fe(e.column.columnDef.header,e.getContext())},e.id))})}),(0,Z.jsx)(Re,{children:d.getRowModel().rows.map(e=>(0,Z.jsx)(ze,{className:`hover:bg-accent`,children:e.getVisibleCells().map(e=>(0,Z.jsx)(Be,{className:`border-b`,children:fe(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]})]})});Ot.displayName=`VariableTable`;var kt=()=>{let e=(0,Y.c)(30),n=o(),i=b(),a=r(w),s=r(x),c=H(`database`),[l,u]=t(tt),d=a.length+s.length,f;e[0]!==d||e[1]!==l.hasUserInteracted||e[2]!==l.openSections?(f=!l.hasUserInteracted&&d>0?[...new Set([...l.openSections,`datasources`])]:l.openSections,e[0]=d,e[1]=l.hasUserInteracted,e[2]=l.openSections,e[3]=f):f=e[3];let m=f,h;e[4]===u?h=e[5]:(h=e=>{u({openSections:e,hasUserInteracted:!0})},e[4]=u,e[5]=h);let g=h,_;e[6]===m?_=e[7]:(_=m.includes(`datasources`),e[6]=m,e[7]=_);let v=!_&&d>0,y=c.length>0,S;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(xe,{className:`w-4 h-4`}),e[8]=S):S=e[8];let C;e[9]!==d||e[10]!==v?(C=v&&(0,Z.jsx)(Je,{children:d}),e[9]=d,e[10]=v,e[11]=C):C=e[11];let T;e[12]!==c.length||e[13]!==y?(T=y&&(0,Z.jsx)(et,{count:c.length,type:`database`}),e[12]=c.length,e[13]=y,e[14]=T):T=e[14];let E;e[15]!==C||e[16]!==T?(E=(0,Z.jsxs)(Ye,{children:[S,`Data sources`,C,T]}),e[15]=C,e[16]=T,e[17]=E):E=e[17];let D;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(Xe,{children:(0,Z.jsx)(dt,{})}),e[18]=D):D=e[18];let O;e[19]===E?O=e[20]:(O=(0,Z.jsxs)(Qe,{value:`datasources`,children:[E,D]}),e[19]=E,e[20]=O);let k;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsxs)(Ye,{children:[(0,Z.jsx)(p,{className:`w-4 h-4`}),`Variables`]}),e[21]=k):k=e[21];let A;e[22]!==i||e[23]!==n?(A=(0,Z.jsxs)(Qe,{value:`variables`,lastItem:!0,children:[k,(0,Z.jsx)(Xe,{children:Object.keys(n).length===0?(0,Z.jsx)(`div`,{className:`px-3 py-4 text-sm text-muted-foreground`,children:`No variables defined`}):(0,Z.jsx)(Ot,{cellIds:i.inOrderIds,variables:n})})]}),e[22]=i,e[23]=n,e[24]=A):A=e[24];let j;return e[25]!==g||e[26]!==m||e[27]!==A||e[28]!==O?(j=(0,Z.jsxs)(ae,{type:`multiple`,value:m,onValueChange:g,className:`flex flex-col h-full overflow-auto`,children:[O,A]}),e[25]=g,e[26]=m,e[27]=A,e[28]=O,e[29]=j):j=e[29],j};export{kt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as e}from"./useEvent-Dc9HkKI2.js";import{Qr as t,Zr as n}from"./cells-CxY8RSp7.js";import{g as r}from"./useEventListener-IRzG-0mH.js";import{O as i}from"./config-D_c_6ce1.js";import{t as a}from"./use-toast-CC89xOwH.js";import{d as o}from"./arrays-BqUx5USx.js";var s=`marimo:ai:chatState:v5`,c=e(null),l=e(null),u=i(`marimo:ai:chatOptions`,{webSearch:!1},t),d=i(`marimo:ai:includeOtherCells`,!0,t);function f(e){let t=new Map;for(let[n,r]of e.entries()){if(r.messages.length===0)continue;let e=o(r.messages,e=>e.id);t.set(n,{...r,messages:e})}return t}var p=n({toSerializable:e=>({chats:[...f(e.chats).entries()],activeChatId:e.activeChatId}),fromSerializable:e=>({chats:new Map(e.chats),activeChatId:e.activeChatId})}),m=i(s,{chats:new Map,activeChatId:null},{...p,setItem:(e,t)=>{try{f(t.chats).size===0?p.removeItem(e):p.setItem(e,t)}catch(e){r.warn(`Could not save chat history`,e),a({id:`chat-storage-error`,once:!0,title:`Chat history couldn't be saved`,description:`Try deleting old chats. New messages may be lost when you reload.`,variant:`danger`})}}}),h=e(e=>{let t=e(m);return t.activeChatId?t.chats.get(t.activeChatId):null},(e,t,n)=>{t(m,e=>({...e,activeChatId:n}))});export{d as a,m as i,c as n,l as o,u as r,h as t};
|