@marimo-team/frontend 0.22.1-dev33 → 0.22.1-dev38
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-CNt4LxkV.js → JsonOutput-DboWEw2n.js} +2 -2
- package/dist/assets/{add-connection-dialog-Ca1Tc12W.js → add-connection-dialog-DiHC8_uD.js} +1 -1
- package/dist/assets/{agent-panel-BYAJ_EOf.js → agent-panel-CWWFNdAZ.js} +1 -1
- package/dist/assets/{cell-editor-CSxVMYfU.js → cell-editor-CKnV9MwH.js} +2 -2
- package/dist/assets/{column-preview-B92BXVH1.js → column-preview-BvDPfcdF.js} +1 -1
- package/dist/assets/{command-palette-BHXQKZ5s.js → command-palette-CPRmmNjA.js} +1 -1
- package/dist/assets/common-CRBlPqv5.js +1 -0
- package/dist/assets/{dependency-graph-panel-CABb99dr.js → dependency-graph-panel-BBmN-Vc7.js} +1 -1
- package/dist/assets/{edit-page-DtYaxOp-.js → edit-page-B-kCXJQD.js} +4 -4
- package/dist/assets/{file-explorer-panel-DJgn_eST.js → file-explorer-panel-DyDct4o3.js} +1 -1
- package/dist/assets/{form-BFjzbGu5.js → form-Byef3KYr.js} +1 -1
- package/dist/assets/{hooks-C2LN7xdC.js → hooks-BoxLBXGI.js} +1 -1
- package/dist/assets/index-B1HqiNNr.js +42 -0
- package/dist/assets/{index-BaQAJwyb.css → index-BkdonYlq.css} +1 -1
- package/dist/assets/{layout-Cb75LpRE.js → layout-BjQtqcnj.js} +2 -2
- package/dist/assets/{panels-C-PHvQEf.js → panels-aBXT7_tR.js} +1 -1
- package/dist/assets/{run-page-BZ-VoP12.js → run-page-yA3m6QEA.js} +1 -1
- package/dist/assets/{scratchpad-panel-CCcUfWUz.js → scratchpad-panel-Cul3iUG0.js} +1 -1
- package/dist/assets/{session-panel-DaLr35Wc.js → session-panel-CzPIEKo8.js} +1 -1
- package/dist/assets/{snippets-panel-qn7otI-U.js → snippets-panel-DQgE3W8I.js} +1 -1
- package/dist/assets/{state-q7CKuEm6.js → state-C79RsVoe.js} +1 -1
- package/dist/assets/useNotebookActions-A-2lB6Y1.js +1 -0
- package/dist/index.html +6 -6
- package/package.json +1 -1
- package/src/components/data-table/data-table.tsx +12 -12
- package/src/components/editor/actions/pair-with-agent-modal.tsx +142 -0
- package/src/components/editor/actions/useNotebookActions.tsx +10 -0
- package/src/components/editor/cell/code/cell-editor.tsx +1 -1
- package/src/components/editor/chrome/panels/snippets-panel.tsx +1 -1
- package/src/components/editor/links/cell-link-list.tsx +1 -1
- package/src/components/editor/navigation/multi-cell-action-toolbar.tsx +2 -3
- package/src/components/editor/navigation/navigation.ts +2 -2
- package/src/components/editor/output/console/ConsoleOutput.tsx +1 -1
- package/src/plugins/impl/plotly/PlotlyPlugin.tsx +62 -44
- package/src/plugins/impl/plotly/__tests__/PlotlyPlugin.test.tsx +114 -0
- package/src/plugins/impl/plotly/__tests__/selection.test.ts +158 -196
- package/src/plugins/impl/plotly/selection.ts +274 -56
- package/src/utils/mime-types.ts +1 -1
- package/dist/assets/common-B5GX57h6.js +0 -1
- package/dist/assets/index-BG82ditz.js +0 -35
- package/dist/assets/useNotebookActions-DB5vGtvM.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var jt=Object.defineProperty;var De=f=>{throw TypeError(f)};var Dt=(f,h,y)=>h in f?jt(f,h,{enumerable:!0,configurable:!0,writable:!0,value:y}):f[h]=y;var n=(f,h,y)=>Dt(f,typeof h!="symbol"?h+"":h,y),ue=(f,h,y)=>h.has(f)||De("Cannot "+y);var o=(f,h,y)=>(ue(f,h,"read from private field"),y?y.call(f):h.get(f)),_=(f,h,y)=>h.has(f)?De("Cannot add the same private member more than once"):h instanceof WeakSet?h.add(f):h.set(f,y),C=(f,h,y,z)=>(ue(f,h,"write to private field"),z?z.call(f,y):h.set(f,y),y),A=(f,h,y)=>(ue(f,h,"access private method"),y);import{i as Q,p as de,u as Ht}from"./useEvent-D91BmmQi.js";import{Cn as Ot,Z as He,b as $t,ci as zt,ii as Vt,mi as Y,oi as Qt,pi as Yt,ti as Gt,x as Jt,__tla as Kt}from"./cells-ArUhhHls.js";import{t as Zt}from"./get-D7jeR2wg.js";import{t as Xt}from"./debounce-BbSyBDA8.js";import{t as er}from"./_baseSet-49dbm-yb.js";import{_ as p,y as g}from"./useEventListener-DGjKht0c.js";import{t as tr}from"./invariant-CkiqGLcK.js";import{S as rr}from"./utils-DKaC_ndw.js";import{S as sr,n as nr}from"./config-CmaJdl9U.js";import{n as ar}from"./switch-DqrqDBdD.js";import{n as Oe}from"./globals-DK8gKReW.js";import{at as ce,ot as $e,__tla as ir}from"./JsonOutput-
|
|
1
|
+
var jt=Object.defineProperty;var De=f=>{throw TypeError(f)};var Dt=(f,h,y)=>h in f?jt(f,h,{enumerable:!0,configurable:!0,writable:!0,value:y}):f[h]=y;var n=(f,h,y)=>Dt(f,typeof h!="symbol"?h+"":h,y),ue=(f,h,y)=>h.has(f)||De("Cannot "+y);var o=(f,h,y)=>(ue(f,h,"read from private field"),y?y.call(f):h.get(f)),_=(f,h,y)=>h.has(f)?De("Cannot add the same private member more than once"):h instanceof WeakSet?h.add(f):h.set(f,y),C=(f,h,y,z)=>(ue(f,h,"write to private field"),z?z.call(f,y):h.set(f,y),y),A=(f,h,y)=>(ue(f,h,"access private method"),y);import{i as Q,p as de,u as Ht}from"./useEvent-D91BmmQi.js";import{Cn as Ot,Z as He,b as $t,ci as zt,ii as Vt,mi as Y,oi as Qt,pi as Yt,ti as Gt,x as Jt,__tla as Kt}from"./cells-ArUhhHls.js";import{t as Zt}from"./get-D7jeR2wg.js";import{t as Xt}from"./debounce-BbSyBDA8.js";import{t as er}from"./_baseSet-49dbm-yb.js";import{_ as p,y as g}from"./useEventListener-DGjKht0c.js";import{t as tr}from"./invariant-CkiqGLcK.js";import{S as rr}from"./utils-DKaC_ndw.js";import{S as sr,n as nr}from"./config-CmaJdl9U.js";import{n as ar}from"./switch-DqrqDBdD.js";import{n as Oe}from"./globals-DK8gKReW.js";import{at as ce,ot as $e,__tla as ir}from"./JsonOutput-DboWEw2n.js";import{t as or}from"./createReducer-CYlwteGD.js";import{r as lr}from"./strings-pfr2N700.js";import{t as pe}from"./requests-9-v2bhoi.js";import{a as ze,l as ur,r as Ve,__tla as dr}from"./markdown-renderer-CyUc0f8D.js";import{t as cr}from"./DeferredRequestRegistry-KOgQgaJP.js";import{t as pr}from"./preload-helper-DItdS47A.js";import{t as Qe}from"./Deferred-DMWKlZOV.js";import{t as Ye}from"./uuid-DercMavo.js";import{t as fr}from"./use-toast-T0_cQDma.js";import{n as hr,r as mr,t as gr}from"./share-DkQqqFqC.js";import{t as yr}from"./blob-CpeNXBj-.js";import{i as wr,r as br,t as vr}from"./events-BRAWQiYK.js";let G,fe,he,Ge,Je,Ke,Ze,Xe,J,et,me,tt,rt,st,ge,nt,ne,at,it,ye,ot,lt,_r=Promise.all([(()=>{try{return Kt}catch{}})(),(()=>{try{return ir}catch{}})(),(()=>{try{return dr}catch{}})()]).then(async()=>{var U,ee,dt,Ie,M,T,E,Le,F,Ne,P,V,D,ae,Ae,Ue,te,I,L,H,R,B,N,ct,pt,ft,re;function f(t,e,r){return t==null?t:er(t,e,r)}G=f,lt=de(null);var{valueAtom:h,useActions:y}=or(()=>({banners:[]}),{addBanner:(t,e)=>({...t,banners:[...t.banners,{...e,id:Ye()}]}),removeBanner:(t,e)=>({...t,banners:t.banners.filter(r=>r.id!==e)}),clearBanners:t=>({...t,banners:[]})});Ge=()=>Ht(h),ot=function(){return y()};let z,be,ve;z=class{constructor(){n(this,"subscriptions",new Map)}addSubscription(t,e){var r;this.subscriptions.has(t)||this.subscriptions.set(t,new Set),(r=this.subscriptions.get(t))==null||r.add(e)}removeSubscription(t,e){var r;(r=this.subscriptions.get(t))==null||r.delete(e)}notify(t,e){for(let r of this.subscriptions.get(t)??[])r(e)}},ye=class we{constructor(e){n(this,"subscriptions",new z);this.producer=e}static withProducerCallback(e){return new we(e)}static empty(){return new we}startProducer(){this.producer&&this.producer(e=>{this.subscriptions.notify("message",e)})}connect(){return new Promise(e=>setTimeout(e,0)).then(()=>{this.subscriptions.notify("open",new Event("open"))})}get readyState(){return WebSocket.OPEN}reconnect(e,r){this.close(),this.connect()}close(){this.subscriptions.notify("close",new Event("close"))}send(e){return this.subscriptions.notify("message",new MessageEvent("message",{data:e})),Promise.resolve()}addEventListener(e,r){this.subscriptions.addSubscription(e,r),e==="open"&&r(new Event("open")),e==="message"&&this.startProducer()}removeEventListener(e,r){this.subscriptions.removeSubscription(e,r)}},be=1e10,ve=1e3;function K(t,e){let r=t.map(s=>`"${s}"`).join(", ");return Error(`This RPC instance cannot ${e} because the transport did not provide one or more of these methods: ${r}`)}function mt(t={}){let e={};function r(l){e=l}let s={};function a(l){var c;s.unregisterHandler&&s.unregisterHandler(),s=l,(c=s.registerHandler)==null||c.call(s,Wt)}let i;function u(l){if(typeof l=="function"){i=l;return}i=(c,w)=>{let m=l[c];if(m)return m(w);let b=l._;if(!b)throw Error(`The requested method has no handler: ${c}`);return b(c,w)}}let{maxRequestTime:d=ve}=t;t.transport&&a(t.transport),t.requestHandler&&u(t.requestHandler),t._debugHooks&&r(t._debugHooks);let v=0;function q(){return v<=be?++v:v=0}let x=new Map,S=new Map;function O(l,...c){let w=c[0];return new Promise((m,b)=>{var $;if(!s.send)throw K(["send"],"make requests");let k=q(),j={type:"request",id:k,method:l,params:w};x.set(k,{resolve:m,reject:b}),d!==1/0&&S.set(k,setTimeout(()=>{S.delete(k),b(Error("RPC request timed out."))},d)),($=e.onSend)==null||$.call(e,j),s.send(j)})}let se=new Proxy(O,{get:(l,c,w)=>c in l?Reflect.get(l,c,w):m=>O(c,m)}),Te=se;function Be(l,...c){var b;let w=c[0];if(!s.send)throw K(["send"],"send messages");let m={type:"message",id:l,payload:w};(b=e.onSend)==null||b.call(e,m),s.send(m)}let We=new Proxy(Be,{get:(l,c,w)=>c in l?Reflect.get(l,c,w):m=>Be(c,m)}),je=We,W=new Map,le=new Set;function Tt(l,c){var w;if(!s.registerHandler)throw K(["registerHandler"],"register message listeners");if(l==="*"){le.add(c);return}W.has(l)||W.set(l,new Set),(w=W.get(l))==null||w.add(c)}function Bt(l,c){var w,m;if(l==="*"){le.delete(c);return}(w=W.get(l))==null||w.delete(c),((m=W.get(l))==null?void 0:m.size)===0&&W.delete(l)}async function Wt(l){var c,w;if((c=e.onReceive)==null||c.call(e,l),!("type"in l))throw Error("Message does not contain a type.");if(l.type==="request"){if(!s.send||!i)throw K(["send","requestHandler"],"handle requests");let{id:m,method:b,params:k}=l,j;try{j={type:"response",id:m,success:!0,payload:await i(b,k)}}catch($){if(!($ instanceof Error))throw $;j={type:"response",id:m,success:!1,error:$.message}}(w=e.onSend)==null||w.call(e,j),s.send(j);return}if(l.type==="response"){let m=S.get(l.id);m!=null&&clearTimeout(m);let{resolve:b,reject:k}=x.get(l.id)??{};l.success?b==null||b(l.payload):k==null||k(Error(l.error));return}if(l.type==="message"){for(let b of le)b(l.id,l.payload);let m=W.get(l.id);if(!m)return;for(let b of m)b(l.payload);return}throw Error(`Unexpected RPC message type: ${l.type}`)}return{setTransport:a,setRequestHandler:u,request:se,requestProxy:Te,send:We,sendProxy:je,addMessageListener:Tt,removeMessageListener:Bt,proxy:{send:je,request:Te},_setDebugHooks:r}}function gt(t){return mt(t)}var _e="[transport-id]";function yt(t,e){let{transportId:r}=e;return r==null?t:{[_e]:r,data:t}}function wt(t,e){let{transportId:r,filter:s}=e,a=s==null?void 0:s();if(r!=null&&a!=null)throw Error("Cannot use both `transportId` and `filter` at the same time");let i=t;if(r){if(t[_e]!==r)return[!0];i=t.data}return a===!1?[!0]:[!1,i]}function bt(t,e={}){let{transportId:r,filter:s,remotePort:a}=e,i=t,u=a??t,d;return{send(v){u.postMessage(yt(v,{transportId:r}))},registerHandler(v){d=q=>{let x=q.data,[S,O]=wt(x,{transportId:r,filter:()=>s==null?void 0:s(q)});S||v(O)},i.addEventListener("message",d)},unregisterHandler(){d&&i.removeEventListener("message",d)}}}function vt(t,e){return bt(t,e)}function Ce(t){return gt({transport:vt(t,{transportId:"marimo-transport"}),maxRequestTime:2e4,_debugHooks:{onSend:e=>{p.debug("[rpc] Parent -> Worker",e)},onReceive:e=>{p.debug("[rpc] Worker -> Parent",e)}}})}fe=de("Initializing..."),Xe=de(t=>{let e=t($t),r=Object.values(e.cellRuntime);return r.some(s=>!ur(s.output))?!0:r.every(s=>s.status==="idle")});var Re=hr(),qe="marimo:file",xe=new Gt(null);const _t={saveFile(t){xe.set(qe,t)},readFile(){return xe.get(qe)}};var Ct={saveFile(t){Y.setCodeForHash((0,Re.compressToEncodedURIComponent)(t))},readFile(){let t=Y.getCodeFromHash()||Y.getCodeFromSearchParam();return t?(0,Re.decompressFromEncodedURIComponent)(t):null}};const Rt={saveFile(t){},readFile(){let t=document.querySelector("marimo-code");return t?decodeURIComponent(t.textContent||"").trim():null}};var qt={saveFile(t){},readFile(){if(window.location.hostname!=="marimo.app")return null;let t=new URL("files/wasm-intro.py",document.baseURI);return fetch(t.toString()).then(e=>e.ok?e.text():null).catch(()=>null)}};const xt={saveFile(t){},readFile(){return Q.get(Vt)??null}};var St={saveFile(t){},readFile(){return["import marimo","app = marimo.App()","","@app.cell","def __():"," return","",'if __name__ == "__main__":'," app.run()"].join(`
|
|
2
2
|
`)}},Se=class{constructor(t){this.stores=t}insert(t,e){this.stores.splice(t,0,e)}saveFile(t){this.stores.forEach(e=>e.saveFile(t))}readFile(){for(let t of this.stores){let e=t.readFile();if(e)return e}return null}};let Z;J=new Se([xt,Rt,Ct]),Z=new Se([_t,qt,St]),ge=class ut{constructor(){n(this,"initialized",new Qe);n(this,"sendRename",async({filename:e})=>(e===null||(Y.setFilename(e),await this.rpc.proxy.request.bridge({functionName:"rename_file",payload:e})),null));n(this,"sendSave",async e=>{if(!this.saveRpc)return p.warn("Save RPC not initialized"),null;await this.saveRpc.saveNotebook(e);let r=await this.readCode();return r.contents&&(J.saveFile(r.contents),Z.saveFile(r.contents)),this.rpc.proxy.request.saveNotebook(e).catch(s=>{p.error(s)}),null});n(this,"sendCopy",async()=>{g()});n(this,"sendStdin",async e=>(await this.rpc.proxy.request.bridge({functionName:"put_input",payload:e.text}),null));n(this,"sendPdb",async()=>{g()});n(this,"sendRun",async e=>(await this.rpc.proxy.request.loadPackages(e.codes.join(`
|
|
3
3
|
`)),await this.putControlRequest({type:"execute-cells",...e}),null));n(this,"sendRunScratchpad",async e=>(await this.rpc.proxy.request.loadPackages(e.code),await this.putControlRequest({type:"execute-scratchpad",...e}),null));n(this,"sendInterrupt",async()=>(this.interruptBuffer!==void 0&&(this.interruptBuffer[0]=2),null));n(this,"sendShutdown",async()=>(window.close(),null));n(this,"sendFormat",async e=>await this.rpc.proxy.request.bridge({functionName:"format",payload:e}));n(this,"sendDeleteCell",async e=>(await this.putControlRequest({type:"delete-cell",...e}),null));n(this,"sendInstallMissingPackages",async e=>(this.putControlRequest({type:"install-packages",...e}),null));n(this,"sendCodeCompletionRequest",async e=>(Q.get(Jt)||await this.rpc.proxy.request.bridge({functionName:"code_complete",payload:e}),null));n(this,"saveUserConfig",async e=>(await this.rpc.proxy.request.bridge({functionName:"save_user_config",payload:e}),ar.post("/kernel/save_user_config",e,{baseUrl:"/"}).catch(r=>(p.error(r),null))));n(this,"saveAppConfig",async e=>(await this.rpc.proxy.request.bridge({functionName:"save_app_config",payload:e}),null));n(this,"saveCellConfig",async e=>(await this.putControlRequest({type:"update-cell-config",...e}),null));n(this,"sendRestart",async()=>{let e=await this.readCode();return e.contents&&(J.saveFile(e.contents),Z.saveFile(e.contents)),mr(),null});n(this,"readCode",async()=>this.saveRpc?{contents:await this.saveRpc.readNotebook()}:(p.warn("Save RPC not initialized"),{contents:""}));n(this,"readSnippets",async()=>await this.rpc.proxy.request.bridge({functionName:"read_snippets",payload:void 0}));n(this,"openFile",async({path:e})=>{let r=gr({code:null,baseUrl:window.location.origin});return window.open(r,"_blank"),null});n(this,"sendListFiles",async e=>await this.rpc.proxy.request.bridge({functionName:"list_files",payload:e}));n(this,"sendSearchFiles",async e=>await this.rpc.proxy.request.bridge({functionName:"search_files",payload:e}));n(this,"sendComponentValues",async e=>(await this.putControlRequest({type:"update-ui-element",...e,token:Ye()}),null));n(this,"sendInstantiate",async e=>null);n(this,"sendFunctionRequest",async e=>(await this.putControlRequest({type:"invoke-function",...e}),null));n(this,"sendCreateFileOrFolder",async e=>await this.rpc.proxy.request.bridge({functionName:"create_file_or_directory",payload:e}));n(this,"sendDeleteFileOrFolder",async e=>await this.rpc.proxy.request.bridge({functionName:"delete_file_or_directory",payload:e}));n(this,"sendRenameFileOrFolder",async e=>await this.rpc.proxy.request.bridge({functionName:"move_file_or_directory",payload:e}));n(this,"sendUpdateFile",async e=>await this.rpc.proxy.request.bridge({functionName:"update_file",payload:e}));n(this,"sendFileDetails",async e=>await this.rpc.proxy.request.bridge({functionName:"file_details",payload:e}));n(this,"exportAsHTML",async e=>await this.rpc.proxy.request.bridge({functionName:"export_html",payload:e}));n(this,"exportAsMarkdown",async e=>await this.rpc.proxy.request.bridge({functionName:"export_markdown",payload:e}));n(this,"previewDatasetColumn",async e=>(await this.putControlRequest({type:"preview-dataset-column",...e}),null));n(this,"previewSQLTable",async e=>(await this.putControlRequest({type:"preview-sql-table",...e}),null));n(this,"previewSQLTableList",async e=>(await this.putControlRequest({type:"list-sql-tables",...e}),null));n(this,"previewSQLSchemaList",async e=>(await this.putControlRequest({type:"list-sql-schemas",...e}),null));n(this,"previewDataSourceConnection",async e=>(await this.putControlRequest({type:"list-data-source-connection",...e}),null));n(this,"validateSQL",async e=>(await this.putControlRequest({type:"validate-sql",...e}),null));n(this,"sendModelValue",async e=>(await this.putControlRequest({type:"model",...e}),null));n(this,"sendDocumentTransaction",()=>Promise.resolve(null));n(this,"addPackage",async e=>this.rpc.proxy.request.addPackage(e));n(this,"removePackage",async e=>this.rpc.proxy.request.removePackage(e));n(this,"getPackageList",async()=>await this.rpc.proxy.request.listPackages());n(this,"getDependencyTree",async()=>({tree:{dependencies:[],name:"",tags:[],version:null}}));n(this,"listSecretKeys",async e=>(await this.putControlRequest({type:"list-secret-keys",...e}),null));n(this,"getUsageStats",g);n(this,"openTutorial",g);n(this,"getRecentFiles",g);n(this,"getWorkspaceFiles",g);n(this,"getRunningNotebooks",g);n(this,"shutdownSession",g);n(this,"exportAsIPYNB",g);n(this,"exportAsPDF",g);n(this,"autoExportAsHTML",g);n(this,"autoExportAsMarkdown",g);n(this,"autoExportAsIPYNB",g);n(this,"updateCellOutputs",g);n(this,"writeSecret",g);n(this,"invokeAiTool",g);n(this,"clearCache",g);n(this,"getCacheInfo",g);n(this,"listStorageEntries",g);n(this,"downloadStorage",g);sr()&&(this.rpc=Ce(new Worker(new URL(""+new URL("worker-BPV9SmHz.js",import.meta.url).href,""+import.meta.url),{type:"module",name:Oe()})),this.rpc.addMessageListener("ready",()=>{this.startSession()}),this.rpc.addMessageListener("initialized",()=>{this.saveRpc=this.getSaveWorker(),this.setInterruptBuffer(),this.initialized.resolve()}),this.rpc.addMessageListener("initializingMessage",({message:e})=>{Q.set(fe,e)}),this.rpc.addMessageListener("initializedError",({error:e})=>{this.initialized.status==="resolved"&&(p.error(e),fr({title:"Error initializing",description:e,variant:"danger"})),this.initialized.reject(Error(e))}),this.rpc.addMessageListener("kernelMessage",({message:e})=>{var r;(r=this.messageConsumer)==null||r.call(this,new MessageEvent("message",{data:e}))}))}static get INSTANCE(){let e="_marimo_private_PyodideBridge";return window[e]||(window[e]=new ut),window[e]}getSaveWorker(){return He()==="read"?(p.debug("Skipping SaveWorker in read-mode"),{readFile:g,readNotebook:g,saveNotebook:g}):Ce(new Worker(new URL(""+new URL("save-worker-CtJsIYIM.js",import.meta.url).href,""+import.meta.url),{type:"module",name:Oe()})).proxy.request}async startSession(){let e=await J.readFile(),r=await Z.readFile(),s=Q.get(Qt)??Y.getFilename(),a=Q.get(rr),i={},u=new URLSearchParams(window.location.search);for(let d of u.keys()){let v=u.getAll(d);i[d]=v.length===1?v[0]:v}await this.rpc.proxy.request.startSession({queryParameters:i,code:e||r||"",filename:s,userConfig:{...a,runtime:{...a.runtime,auto_instantiate:He()==="read"?!0:a.runtime.auto_instantiate}}})}setInterruptBuffer(){crossOriginIsolated?(this.interruptBuffer=new Uint8Array(new SharedArrayBuffer(1)),this.rpc.proxy.request.setInterruptBuffer(this.interruptBuffer)):p.warn("Not running in a secure context; interrupts are not available.")}attachMessageConsumer(e){this.messageConsumer=e,this.rpc.proxy.send.consumerReady({})}async putControlRequest(e){await this.rpc.proxy.request.bridge({functionName:"put_control_request",payload:e})}},tt=function(){return ye.withProducerCallback(t=>{ge.INSTANCE.attachMessageConsumer(t)})},Ke=function(t=ce()){let e=window.fetch;return window.fetch=async(r,s)=>{let a=r instanceof Request?r.url:r.toString();if(a.startsWith("data:"))return e(r,s);try{let i=X(a,t);if(i){let u=await(await e(i)).arrayBuffer();return new Response(u,{headers:{"Content-Type":Et(a)}})}return e(r,s)}catch(i){return p.error("Error parsing URL",i),e(r,s)}},()=>{window.fetch=e}};function Et(t){return t.endsWith(".csv")?"text/csv":t.endsWith(".json")?"application/json":t.endsWith(".txt")?"text/plain":"application/octet-stream"}Ze=function(t,e=ce()){let r=t.http.bind(t),s=t.load.bind(t);return t.http=async a=>{let i=X(a,e);if(i)return await window.fetch(i).then(u=>u.text());try{return await r(a)}catch(u){if(a.startsWith("data:"))return await window.fetch(a).then(d=>d.text());throw u}},t.load=async a=>{let i=X(a,e);if(i)return await window.fetch(i).then(u=>u.text());try{return await s(a)}catch(u){if(a.startsWith("data:"))return await window.fetch(a).then(d=>d.text());throw u}},()=>{t.http=r,t.load=s}};function Ee(t){return t.startsWith(".")?t.slice(1):t}function kt(t,e=ce()){let r=X(t,e);if(!r)return t;let s=yr(r);return URL.createObjectURL(s)}function X(t,e){let r=document.baseURI;r.startsWith("blob:")&&(r=r.replace("blob:",""));let s=new URL(t,r).pathname,a=ke(t),i=ke(s);return e[t]||e[Ee(t)]||e[s]||e[Ee(s)]||a&&e[a]||i&&e[i]}function ke(t){let e=t.indexOf("/@file/");return e===-1?null:t.slice(e)}function ie(t,e=[]){let r=[];if(t instanceof DataView)r.push(e);else if(Array.isArray(t))for(let[s,a]of t.entries())r.push(...ie(a,[...e,s]));else if(typeof t=="object"&&t)for(let[s,a]of Object.entries(t))r.push(...ie(a,[...e,s]));return r}function Mt(t){let e=ie(t);if(e.length===0)return{state:t,buffers:[],bufferPaths:[]};let r=structuredClone(t),s=[],a=[];for(let i of e){let u=Zt(t,i);if(u instanceof DataView){let d=ze(u);s.push(d),a.push(i),G(r,i,d)}}return{state:r,buffers:s,bufferPaths:a}}function Me(t){let{state:e,bufferPaths:r,buffers:s}=t;if(!r||r.length===0)return e;s&&tr(s.length===r.length,"Buffers and buffer paths not the same length");let a=e;for(let[i,u]of r.entries()){let d=s==null?void 0:s[i];if(d==null){p.warn("[anywidget] Could not find buffer at path",u);continue}typeof d=="string"?G(a,u,Ve(d)):G(a,u,d)}return a}const Pe={invoke:async()=>{let t="anywidget.invoke not supported in marimo. Please file an issue at https://github.com/marimo-team/marimo/issues";throw p.warn(t),Error(t)}};function Pt(t){if(typeof AbortSignal.any=="function")return AbortSignal.any(t);let e=new AbortController;for(let r of t){if(r.aborted)return e.abort(r.reason),e.signal;r.addEventListener("abort",()=>e.abort(r.reason),{once:!0})}return e.signal}var Ft=(Ie=class{constructor(){_(this,ee);_(this,U,new Map)}getModule(t,e){let r=o(this,U).get(e);if(r)return r;let s=A(this,ee,dt).call(this,t).catch(a=>{throw o(this,U).delete(e),a});return o(this,U).set(e,s),s}invalidate(t){p.debug(`[WidgetDefRegistry] Invalidating module cache for hash=${t}`),o(this,U).delete(t)}},U=new WeakMap,ee=new WeakSet,dt=async function(t){let e=nr(t).toString();return $e()&&(e=kt(e)),pr(()=>import(e).then(async r=>(await r.__tla,r)),[],import.meta.url)},Ie),It=(Le=class{constructor(){_(this,M);_(this,T);_(this,E)}async bind(t,e){var i,u;if(o(this,E)&&o(this,T)===t)return o(this,E);o(this,E)&&o(this,T)!==t&&(p.debug("[WidgetBinding] Hot-reload detected, aborting previous binding"),(i=o(this,M))==null||i.abort(),C(this,M,void 0),C(this,E,void 0)),C(this,T,t),C(this,M,new AbortController);let r=o(this,M).signal,s=typeof t=="function"?await t():t,a=await((u=s.initialize)==null?void 0:u.call(s,{model:e,experimental:Pe}));return a&&r.addEventListener("abort",a),C(this,E,async(d,v)=>{var x;let q=await((x=s.render)==null?void 0:x.call(s,{model:e,el:d,experimental:Pe}));q&&Pt([v,r]).addEventListener("abort",()=>{let S=v.aborted?"view unmount":"binding destroyed";p.debug(`[WidgetBinding] Render cleanup triggered (reason: ${S})`),q()})}),o(this,E)}destroy(){var t;p.debug("[WidgetBinding] Destroying binding, aborting initialize lifecycle"),(t=o(this,M))==null||t.abort(),C(this,M,void 0),C(this,T,void 0),C(this,E,void 0)}},M=new WeakMap,T=new WeakMap,E=new WeakMap,Le),Lt=(Ne=class{constructor(){_(this,F,new Map)}getOrCreate(t){let e=o(this,F).get(t);return e||(e=new It,o(this,F).set(t,e)),e}destroy(t){let e=o(this,F).get(t);e&&(p.debug(`[BindingManager] Destroying binding for model=${t}`),e.destroy(),o(this,F).delete(t))}has(t){return o(this,F).has(t)}},F=new WeakMap,Ne);it=new Ft,me=new Lt;var Nt=(Ae=class{constructor(t=1e4){_(this,D);_(this,P,new Map);_(this,V);C(this,V,t)}get(t){let e=A(this,D,ae).call(this,t);return e.deferred.status==="pending"&&setTimeout(()=>{e.deferred.status==="pending"&&(e.deferred.reject(Error(`Model not found for key: ${t}`)),o(this,P).delete(t))},o(this,V)),e.deferred.promise}create(t,e){let r=A(this,D,ae).call(this,t);r.deferred.resolve(e(r.controller.signal))}set(t,e){A(this,D,ae).call(this,t).deferred.resolve(e)}getSync(t){let e=o(this,P).get(t);if(e&&e.deferred.status==="resolved")return e.deferred.value}delete(t){var e;p.debug(`[ModelManager] Deleting model=${t}, aborting lifecycle signal`),(e=o(this,P).get(t))==null||e.controller.abort(),o(this,P).delete(t)}},P=new WeakMap,V=new WeakMap,D=new WeakSet,ae=function(t){let e=o(this,P).get(t);return e||(e={deferred:new Qe,controller:new AbortController},o(this,P).set(t,e)),e},Ae),Fe=Symbol("marimo");function oe(t){return t[Fe]}ne=new Nt;var At=(Ue=Fe,B=class{constructor(e,r,s){_(this,N);_(this,te,"change");_(this,I);_(this,L);_(this,H);_(this,R,{});n(this,Ue,{updateAndEmitDiffs:e=>A(this,N,pt).call(this,e),emitCustomMessage:(e,r)=>A(this,N,ft).call(this,e,r)});n(this,"widget_manager",{async get_model(e){let r=await B._modelManager.get(e);if(!r)throw Error(`Model not found with id: ${e}. This is likely because the model was not registered.`);return r}});_(this,re,Xt(()=>{let e=o(this,R)[o(this,te)];if(e)for(let r of e)try{r()}catch(s){p.error("Error emitting event",s)}},0));C(this,L,e),C(this,H,r),C(this,I,new Map),s&&s.addEventListener("abort",()=>{p.debug("[Model] Signal aborted, clearing all listeners"),C(this,R,{})})}off(e,r){var s;if(!e){C(this,R,{});return}if(!r){o(this,R)[e]=new Set;return}(s=o(this,R)[e])==null||s.delete(r)}send(e,r,s){let a=(s??[]).map(i=>i instanceof ArrayBuffer?new DataView(i):new DataView(i.buffer,i.byteOffset,i.byteLength));return o(this,H).sendCustomMessage(e,a).then(()=>r==null?void 0:r())}get(e){return o(this,L)[e]}set(e,r){C(this,L,{...o(this,L),[e]:r}),o(this,I).set(e,r),A(this,N,ct).call(this,`change:${e}`,r),o(this,re).call(this)}save_changes(){if(o(this,I).size===0)return;let e=Object.fromEntries(o(this,I).entries());o(this,I).clear(),o(this,H).sendUpdate(e)}on(e,r){o(this,R)[e]||(o(this,R)[e]=new Set),o(this,R)[e].add(r)}},te=new WeakMap,I=new WeakMap,L=new WeakMap,H=new WeakMap,R=new WeakMap,N=new WeakSet,ct=function(e,r){if(!o(this,R)[e])return;let s=o(this,R)[e];for(let a of s)try{a(r)}catch(i){p.error("Error emitting event",i)}},pt=function(e){e!=null&&Object.keys(e).forEach(r=>{let s=r;o(this,L)[s]!==e[s]&&this.set(s,e[s])})},ft=function(e,r=[]){let s=o(this,R)["msg:custom"];if(s)for(let a of s)try{a(e.content,r)}catch(i){p.error("Error emitting event",i)}},re=new WeakMap,n(B,"_modelManager",ne),B);Je=async function(t,e){let r=e.model_id,s=e.message,a=("buffers"in s?s.buffers:[]).map(Ve);switch(s.method){case"open":{let{state:i,buffer_paths:u=[]}=s,d=Me({state:i,bufferPaths:u,buffers:a}),v=t.getSync(r);if(v){oe(v).updateAndEmitDiffs(d);return}t.create(r,q=>new At(d,$e()?{sendUpdate:async()=>{},sendCustomMessage:async()=>{}}:{async sendUpdate(x){if(q.aborted){p.debug(`[Model] sendUpdate suppressed for model=${r} (signal aborted)`);return}let{state:S,buffers:O,bufferPaths:se}=Mt(x);await pe().sendModelValue({modelId:r,message:{method:"update",state:S,bufferPaths:se},buffers:O})},async sendCustomMessage(x,S){if(q.aborted){p.debug(`[Model] sendCustomMessage suppressed for model=${r} (signal aborted)`);return}await pe().sendModelValue({modelId:r,message:{method:"custom",content:x},buffers:S.map(ze)})}},q));return}case"custom":oe(await t.get(r)).emitCustomMessage({method:"custom",content:s.content},a);return;case"close":me.destroy(r),t.delete(r);return;case"update":{let{state:i,buffer_paths:u=[]}=s,d=Me({state:i,bufferPaths:u,buffers:a});oe(await t.get(r)).updateAndEmitDiffs(d);return}default:lr(s)}},Ot(ne,"MODEL_MANAGER"),he=class ht{static get INSTANCE(){let e="_marimo_private_UIElementRegistry";return window[e]||(window[e]=new ht),window[e]}constructor(){this.entries=new Map}has(e){return this.entries.has(e)}set(e,r){this.entries.has(e)&&p.debug("UIElementRegistry overwriting entry for objectId.",e),this.entries.set(e,{objectId:e,value:r,elements:new Set})}registerInstance(e,r){let s=this.entries.get(e);s===void 0?this.entries.set(e,{objectId:e,value:Yt(r,this),elements:new Set([r])}):s.elements.add(r)}removeInstance(e,r){let s=this.entries.get(e);s!=null&&s.elements.has(r)&&s.elements.delete(r)}removeElementsByCell(e){[...this.entries.keys()].filter(r=>r.startsWith(`${e}-`)).forEach(r=>{this.entries.delete(r)})}lookupValue(e){let r=this.entries.get(e);return r===void 0?void 0:r.value}broadcastMessage(e,r,s){let a=this.entries.get(e);a===void 0?p.warn("UIElementRegistry missing entry",e):a.elements.forEach(i=>{i.dispatchEvent(vr.create({bubbles:!1,composed:!0,detail:{objectId:e,message:r,buffers:s}}))})}broadcastValueUpdate(e,r,s){let a=this.entries.get(r);a===void 0?p.warn("UIElementRegistry missing entry",r):(a.value=s,a.elements.forEach(i=>{i!==e&&i.dispatchEvent(wr.create({bubbles:!1,composed:!0,detail:{value:s,element:i}}))}),document.dispatchEvent(br.create({bubbles:!0,composed:!0,detail:{objectId:r}})))}},st=he.INSTANCE,et=new cr("function-call-result",async(t,e)=>{await pe().sendFunctionRequest({functionCallId:t,...e})}),at="68px";var Ut="288px";rt=t=>t?/^\d+$/.test(t)?`${t}px`:t:Ut,nt=zt({isOpen:!0},(t,e)=>{if(!e)return t;switch(e.type){case"toggle":return{...t,isOpen:e.isOpen??t.isOpen};case"setWidth":return{...t,width:e.width};default:return t}})});export{G as S,fe as _,_r as __tla,he as a,Ge as b,Je as c,Ke as d,Ze as f,Xe as g,J as h,et as i,me as l,tt as m,rt as n,st as o,ge as p,nt as r,ne as s,at as t,it as u,ye as v,ot as x,lt as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as Ce}from"./chunk-LvLJmgfZ.js";import{d as E,l as ct,p as ht,u as Z}from"./useEvent-D91BmmQi.js";import{t as mt}from"./react-Bj1aDYRI.js";import{$ as pt,E as ze,Sn as ut,Vt as ft,_ as xt,_i as pe,_n as yt,dr as kt,et as bt,h as Me,jr as wt,or as jt,rr as gt,t as vt,tr as Ct,tt as We,vn as zt,yn as Mt}from"./cells-ArUhhHls.js";import{t as z}from"./compiler-runtime-B3qBwwSJ.js";import{n as Wt,x as _t}from"./ai-model-dropdown-Dnf-CxbP.js";import{_ as L,d as _e}from"./useEventListener-DGjKht0c.js";import{y as Nt}from"./utils-DKaC_ndw.js";import{n as P,t as Ne}from"./constants-tOPFFcLZ.js";import{S as ue,h as St,i as Dt,x as Pt}from"./config-CmaJdl9U.js";import{t as At}from"./jsx-runtime-Blw4afVn.js";import{o as It}from"./alert-dialog-CXspBRlP.js";import{a as Tt,c as fe,o as xe,s as Et}from"./popover-AtoFZ7i4.js";import{a as Lt,c as Ht,i as Rt,n as qt,r as $t,s as Bt,t as Vt}from"./select--zcABebs.js";import{gt as Ot}from"./JsonOutput-DboWEw2n.js";import{c as Se,d as ye,n as Ft,o as Ut,r as ke,t as Yt}from"./download-7EtMZf2Y.js";import{m as Kt}from"./form-Byef3KYr.js";import{t as De}from"./tooltip-DmqhBBs6.js";import{r as Pe,t as H}from"./button-BKVLeSTX.js";import{i as Gt,t as Ae}from"./strings-pfr2N700.js";import{r as R}from"./requests-9-v2bhoi.js";import{t as b}from"./createLucideIcon-w-Qo9n0R.js";import{a as Ie,f as Jt,i as Te,m as Xt,p as Ee,u as Le}from"./layout-BjQtqcnj.js";import{t as be}from"./check-B-sKate2.js";import{n as Qt}from"./maps-B4xARV9R.js";import{r as Zt}from"./useCellActionButton-BiYBXHfb.js";import{t as He}from"./copy-DFMsQ6MJ.js";import{t as ea}from"./eye-off-DgRJ-xBZ.js";import{t as ta}from"./file-plus-corner-BjSB-E2p.js";import{t as ee}from"./file-DaJ4JeZH.js";import{t as aa}from"./github-CP61uL34.js";import{n as oa,r as na,t as sa}from"./youtube-zkHE2QB5.js";import{i as la,n as Re}from"./add-connection-dialog-DiHC8_uD.js";import{n as ia,t as ra}from"./square-BVY9SgWs.js";import{t as da}from"./image-CpSydGUq.js";import{t as ca}from"./link-BCjh6ihR.js";import{r as ha}from"./input-DjrybsRY.js";import{t as ma}from"./settings-D6Nc4lMz.js";import{t as pa}from"./sparkles-DczT6OBt.js";import{y as ua}from"./textarea-DqzNK0s9.js";import{t as M}from"./use-toast-T0_cQDma.js";import{n as qe,t as fa}from"./paths-Dfii2bN8.js";import{o as xa}from"./session-DDorezMU.js";import{a as $e,c as Be,i as Ve,n as Oe,r as Fe}from"./dialog-CognbQV_.js";import{n as we}from"./ImperativeModal-DSu22ncS.js";import{r as ya,t as ka}from"./share-DkQqqFqC.js";import{n as q}from"./copy-C8iWa1qI.js";import{r as ba}from"./useRunCells-DgBY-vh9.js";import{a as wa}from"./cell-link-D4UrIH9w.js";import{a as ja}from"./renderShortcut-Bjt8kSBs.js";import{t as ga}from"./icons-UbXYeuXE.js";import{t as va}from"./links-wWTxfdQn.js";import{r as Ca,t as Ue}from"./hooks-BoxLBXGI.js";import{t as Ye}from"./types-z6Sk3JCV.js";var za=b("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Ma=b("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Ke=b("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),Ge=b("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),Je=b("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),Wa=b("fast-forward",[["path",{d:"M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z",key:"b19h5q"}],["path",{d:"M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z",key:"h7h5ge"}]]),_a=b("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]),Na=b("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),Xe=b("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),Sa=b("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),Da=b("notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]),Pa=b("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Qe=b("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),Aa=b("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),Ia=b("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Ze=b("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),et=z(),$=Ce(mt(),1),a=Ce(At(),1);function Ta(e){let t=new URL(e.url);return e.authToken&&t.searchParams.set("auth",e.authToken),t.toString()}function Ea(e,t){let n=`uvx marimo@latest pair prompt --url '${t}'`;switch(e){case"claude":return`claude "$(${n} --claude)"`;case"codex":return`codex "$(${n} --codex)"`;case"opencode":return`opencode "$(${n} --opencode)"`}}var La="npx skills add marimo-team/marimo-pair";const Ha=e=>{let t=(0,et.c)(25),{onClose:n}=e,[o,d]=(0,$.useState)("claude"),i=Z(Dt),l;t[0]!==o||t[1]!==i?(l=Ea(o,Ta(i)),t[0]=o,t[1]=i,t[2]=l):l=t[2];let s=l,r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Be,{children:"Pair with an agent"}),t[3]=r):r=t[3];let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.jsxs)($e,{children:[r,(0,a.jsxs)(Fe,{children:["Use an AI coding agent to pair-program on this notebook."," ",(0,a.jsx)("a",{href:"https://links.marimo.app/marimo-pair",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Learn more"}),"."]})]}),t[4]=c):c=t[4];let h;t[5]===Symbol.for("react.memo_cache_sentinel")?(h=(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"1. Install the skill"}),(0,a.jsx)(te,{command:La})]}),t[5]=h):h=t[5];let p;t[6]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)("span",{className:"text-sm font-medium",children:"2. Run in your terminal"}),t[6]=p):p=t[6];let u;t[7]===Symbol.for("react.memo_cache_sentinel")?(u=C=>d(C),t[7]=u):u=t[7];let w;t[8]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(Et,{className:"w-full",children:[(0,a.jsx)(fe,{value:"claude",className:"flex-1",children:"Claude"}),(0,a.jsx)(fe,{value:"codex",className:"flex-1",children:"Codex"}),(0,a.jsx)(fe,{value:"opencode",className:"flex-1",children:"OpenCode"})]}),t[8]=w):w=t[8];let f;t[9]===s?f=t[10]:(f=(0,a.jsx)(xe,{value:"claude",className:"mt-3",children:(0,a.jsx)(te,{command:s})}),t[9]=s,t[10]=f);let x;t[11]===s?x=t[12]:(x=(0,a.jsx)(xe,{value:"codex",className:"mt-3",children:(0,a.jsx)(te,{command:s})}),t[11]=s,t[12]=x);let y;t[13]===s?y=t[14]:(y=(0,a.jsx)(xe,{value:"opencode",className:"mt-3",children:(0,a.jsx)(te,{command:s})}),t[13]=s,t[14]=y);let k;t[15]!==o||t[16]!==y||t[17]!==f||t[18]!==x?(k=(0,a.jsxs)("div",{className:"flex flex-col gap-4 py-2",children:[h,(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[p,(0,a.jsxs)(Tt,{value:o,onValueChange:u,children:[w,f,x,y]})]})]}),t[15]=o,t[16]=y,t[17]=f,t[18]=x,t[19]=k):k=t[19];let j;t[20]===n?j=t[21]:(j=(0,a.jsx)(Ve,{children:(0,a.jsx)(H,{variant:"secondary",onClick:n,children:"Close"})}),t[20]=n,t[21]=j);let v;return t[22]!==k||t[23]!==j?(v=(0,a.jsxs)(Oe,{className:"sm:max-w-lg",children:[c,k,j]}),t[22]=k,t[23]=j,t[24]=v):v=t[24],v};var te=e=>{let t=(0,et.c)(15),{command:n}=e,[o,d]=(0,$.useState)(!1),i;t[0]===n?i=t[1]:(i=Pe.stopPropagation(async u=>{u.preventDefault(),await q(n),d(!0),setTimeout(()=>d(!1),2e3)}),t[0]=n,t[1]=i);let l=i,s;t[2]===n?s=t[3]:(s=(0,a.jsx)("code",{className:"flex-1 select-all break-words",children:n}),t[2]=n,t[3]=s);let r;t[4]===o?r=t[5]:(r=o?(0,a.jsx)(be,{size:14,strokeWidth:1.5}):(0,a.jsx)(He,{size:14,strokeWidth:1.5}),t[4]=o,t[5]=r);let c;t[6]!==l||t[7]!==r?(c=(0,a.jsx)(H,{onClick:l,size:"xs",variant:"ghost",children:r}),t[6]=l,t[7]=r,t[8]=c):c=t[8];let h;t[9]!==o||t[10]!==c?(h=(0,a.jsx)(De,{content:"Copied!",open:o,children:c}),t[9]=o,t[10]=c,t[11]=h):h=t[11];let p;return t[12]!==s||t[13]!==h?(p=(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-xs",children:[s,h]}),t[12]=s,t[13]=h,t[14]=p):p=t[14],p},tt=z(),ae="https://static.marimo.app";const Ra=e=>{let t=(0,tt.c)(25),{onClose:n}=e,[o,d]=(0,$.useState)(""),{exportAsHTML:i}=R(),l=`${o}-${Math.random().toString(36).slice(2,6)}`,s=`${ae}/static/${l}`,r;t[0]!==i||t[1]!==n||t[2]!==l?(r=async v=>{v.preventDefault(),n();let C=await i({download:!1,includeCode:!0,files:Jt.INSTANCE.filenames()}),W=M({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${ae}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:C,path:l})}).catch(()=>{W.dismiss(),M({title:"Error uploading static page",description:(0,a.jsxs)("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",(0,a.jsx)("a",{href:P.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),W.dismiss(),M({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},t[0]=i,t[1]=n,t[2]=l,t[3]=r):r=t[3];let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.jsx)(Be,{children:"Share static notebook"}),t[4]=c):c=t[4];let h;t[5]===Symbol.for("react.memo_cache_sentinel")?(h=(0,a.jsxs)($e,{children:[c,(0,a.jsxs)(Fe,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",(0,a.jsx)("a",{href:ae,target:"_blank",children:ae}),"."]})]}),t[5]=h):h=t[5];let p;t[6]===Symbol.for("react.memo_cache_sentinel")?(p=v=>{d(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=p):p=t[6];let u;t[7]===o?u=t[8]:(u=(0,a.jsx)(ha,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:p,required:!0,autoComplete:"off"}),t[7]=o,t[8]=u);let w;t[9]===s?w=t[10]:(w=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(qa,{text:s}),(0,a.jsx)("span",{className:"text-primary",children:s})]})]}),t[9]=s,t[10]=w);let f;t[11]!==u||t[12]!==w?(f=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[u,w]}),t[11]=u,t[12]=w,t[13]=f):f=t[13];let x;t[14]===n?x=t[15]:(x=(0,a.jsx)(H,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=x);let y;t[16]===s?y=t[17]:(y=(0,a.jsx)(H,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await q(s)},children:"Create"}),t[16]=s,t[17]=y);let k;t[18]!==x||t[19]!==y?(k=(0,a.jsxs)(Ve,{children:[x,y]}),t[18]=x,t[19]=y,t[20]=k):k=t[20];let j;return t[21]!==r||t[22]!==k||t[23]!==f?(j=(0,a.jsx)(Oe,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:r,children:[h,f,k]})}),t[21]=r,t[22]=k,t[23]=f,t[24]=j):j=t[24],j};var qa=e=>{let t=(0,tt.c)(8),[n,o]=$.useState(!1),d;t[0]===e.text?d=t[1]:(d=Pe.stopPropagation(async c=>{c.preventDefault(),await q(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=d);let i=d,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(He,{size:14,strokeWidth:1.5}),t[2]=l):l=t[2];let s;t[3]===i?s=t[4]:(s=(0,a.jsx)(H,{"data-testid":"copy-static-notebook-url-button",onClick:i,size:"xs",variant:"secondary",children:l}),t[3]=i,t[4]=s);let r;return t[5]!==n||t[6]!==s?(r=(0,a.jsx)(De,{content:"Copied!",open:n,children:s}),t[5]=n,t[6]=s,t[7]=r):r=t[7],r},$a=z();function Ba(){let e=document.getElementsByClassName(Ne.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=pe.findElement(t);if(!o){L.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:pe.parse(o.id)}}}return L.warn("No visible output area found for scroll anchor"),null}function Va(e){if(!e){L.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(pe.create(e.cellId));if(!t){L.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${Ne.outputArea}`)){L.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function at(){let e=(0,$a.c)(2),t=E(We),n;return e[0]===t?n=e[1]:(n=()=>{let o=Ba();t(d=>({mode:bt(d.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Va(o)})})},e[0]=t,e[1]=n),n}const ot=ht(!1);var Oa=z();const Fa=()=>{let e=(0,Oa.c)(7),{selectedLayout:t}=Ie(),{setLayoutView:n}=Te();if(ue()&&!ut("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=s=>n(s),e[0]=n,e[1]=o);let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=(0,a.jsx)(Bt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Ht,{placeholder:"Select a view"})}),e[2]=d):d=e[2];let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)(qt,{children:(0,a.jsxs)($t,{children:[(0,a.jsx)(Lt,{children:"View as"}),Ye.map(Ya)]})}),e[3]=i):i=e[3];let l;return e[4]!==t||e[5]!==o?(l=(0,a.jsxs)(Vt,{"data-testid":"layout-select",value:t,onValueChange:o,children:[d,i]}),e[4]=t,e[5]=o,e[6]=l):l=e[6],l};function Ua(e){return(0,a.jsx)(nt(e),{className:"h-4 w-4"})}function nt(e){switch(e){case"vertical":return Sa;case"grid":return na;case"slides":return Qe;default:return Gt(e),ra}}function st(e){return Ae.startCase(e)}function Ya(e){return(0,a.jsx)(Rt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Ua(e),(0,a.jsx)("span",{children:st(e)})]})},e)}async function Ka(e){let{filename:t,preset:n,downloadPDF:o}=e;await o({filename:t,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var Ga=z();function Ja(e){let t=(0,Ga.c)(5),{openPrompt:n,closeModal:o}=we(),{sendCopy:d}=R(),i;return t[0]!==o||t[1]!==n||t[2]!==d||t[3]!==e?(i=()=>{if(!e)return null;let l=fa.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${qe.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:s=>{let r=l.join(qe.dirname(e),s);d({source:e,destination:r}).then(()=>{o(),M({title:"Notebook copied",description:"A copy of the notebook has been created."}),va(r)})}})},t[0]=o,t[1]=n,t[2]=d,t[3]=e,t[4]=i):i=t[4],i}const Xa=()=>{let{updateCellConfig:e}=ze(),{saveCellConfig:t}=R();return(0,$.useCallback)(async()=>{let n=new ft,o=Me(),d=o.cellIds.inOrderIds,i={};for(let s of d){if(o.cellData[s]===void 0)continue;let{code:r,config:c}=o.cellData[s];c.hide_code||n.isSupported(r)&&(i[s]={hide_code:!0})}let l=_e.entries(i);if(l.length!==0){await t({configs:i});for(let[s,r]of l)e({cellId:s,config:r})}},[e])};var Qa=z();function lt(){let e=(0,Qa.c)(4),{openConfirm:t}=we(),n=E(St),{sendRestart:o}=R(),d;return e[0]!==t||e[1]!==o||e[2]!==n?(d=()=>{t({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(It,{onClick:async()=>{n({state:Pt.CLOSING}),await o(),ya()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=d):d=e[3],d}var Za=z(),A=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function eo(){var ge,ve;let e=(0,Za.c)(51),t=wa(),{openModal:n,closeModal:o}=we(),{toggleApplication:d}=yt(),{selectedPanel:i}=zt(),[l]=ct(We),s=Z(pt),r=Xa(),[c]=Nt(),{updateCellConfig:h,undoDeleteCell:p,clearAllCellOutputs:u,addSetupCellIfDoesntExist:w,collapseAllCells:f,expandAllCells:x}=ze(),y=lt(),k=ba(),j=Ja(t),v=E(ot),C=E(Wt),W=E(_t),{exportAsIPYNB:ne,exportAsMarkdown:se,readCode:I,saveCellConfig:le,updateCellOutputs:_}=R(),N=Ca(),ie=Z(xt),re=Z(vt),{selectedLayout:B}=Ie(),{setLayoutView:de}=Te(),V=at(),O=((ge=c.sharing)==null?void 0:ge.html)??!0,F=((ve=c.sharing)==null?void 0:ve.wasm)??!0,je=!ue(),ce=B==="slides",it=bo,rt=ko,U;e[0]!==t||e[1]!==N||e[2]!==_?(U=async m=>{let{preset:g,title:T}=m;if(!t){oe();return}await Se(T,async me=>{await Ue({takeScreenshots:()=>N({progress:me}),updateCellOutputs:_}),await Ka({filename:t,preset:g,downloadPDF:Ft})})},e[0]=t,e[1]=N,e[2]=_,e[3]=U):U=e[3];let S=U,Y;e[4]===S?Y=e[5]:(Y=async()=>{if(je){await S({preset:"document",title:"Downloading Document PDF..."});return}let m=new Event("export-beforeprint"),g=new Event("export-afterprint");window.dispatchEvent(m),setTimeout(yo,0),setTimeout(()=>window.dispatchEvent(g),0)},e[4]=S,e[5]=Y);let K=Y,G;e[6]!==ne||e[7]!==t||e[8]!==N||e[9]!==_?(G=async()=>{if(!t){oe();return}await Se("Downloading IPYNB...",async m=>{await Ue({takeScreenshots:()=>N({progress:m}),updateCellOutputs:_});let g=await ne({download:!1});ke(new Blob([g],{type:"application/x-ipynb+json"}),ye.toIPYNB(document.title))})},e[6]=ne,e[7]=t,e[8]=N,e[9]=_,e[10]=G):G=e[10];let he=G,J;e[11]===Symbol.for("react.memo_cache_sentinel")?(J=(0,a.jsx)(Ot,{size:14,strokeWidth:1.5}),e[11]=J):J=e[11];let X;e[12]===Symbol.for("react.memo_cache_sentinel")?(X=(0,a.jsx)(Ee,{size:14,strokeWidth:1.5}),e[12]=X):X=e[12];let D;e[13]===t?D=e[14]:(D=async()=>{if(!t){oe();return}await Le({filename:t,includeCode:!0})},e[13]=t,e[14]=D);let Q;return e[15]!==w||e[16]!==re||e[17]!==u||e[18]!==o||e[19]!==f||e[20]!==j||e[21]!==S||e[22]!==x||e[23]!==se||e[24]!==t||e[25]!==K||e[26]!==he||e[27]!==ie||e[28]!==r||e[29]!==ce||e[30]!==s||e[31]!==n||e[32]!==I||e[33]!==y||e[34]!==k||e[35]!==le||e[36]!==B||e[37]!==i||e[38]!==v||e[39]!==W||e[40]!==de||e[41]!==C||e[42]!==O||e[43]!==F||e[44]!==D||e[45]!==d||e[46]!==V||e[47]!==p||e[48]!==h||e[49]!==l.mode?(Q=[{icon:J,label:"Download",handle:A,dropdown:[{icon:X,label:"Download as HTML",handle:D},{icon:(0,a.jsx)(Ee,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){oe();return}await Le({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(ga,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let m=await se({download:!1});ke(new Blob([m],{type:"text/plain"}),ye.toMarkdown(document.title))}},{icon:(0,a.jsx)(Da,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:he},{icon:(0,a.jsx)(Xt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let m=await I();ke(new Blob([m.contents],{type:"text/plain"}),ye.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:l.mode!=="present",tooltip:l.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",ja("global.hideCode",!1)]}),handle:xo},ce?{divider:!0,icon:(0,a.jsx)(ee,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:A,dropdown:[{icon:(0,a.jsx)(ee,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:K},{icon:(0,a.jsx)(ee,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:rt(!0),hidden:!je,handle:async()=>{await S({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(ee,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:K}]},{icon:(0,a.jsx)(pa,{size:14,strokeWidth:1.5}),label:"Pair with an agent",handle:async()=>{n((0,a.jsx)(Ha,{onClose:o}))}},{icon:(0,a.jsx)(Aa,{size:14,strokeWidth:1.5}),label:"Share",handle:A,hidden:!O&&!F,dropdown:[{icon:(0,a.jsx)(Kt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!O,handle:async()=>{n((0,a.jsx)(Ra,{onClose:o}))}},{icon:(0,a.jsx)(ca,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!F,handle:async()=>{await q(ka({code:(await I()).contents})),M({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(Pa,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:A,dropdown:Mt.flatMap(m=>{let{type:g,Icon:T,hidden:me,additionalKeywords:dt}=m;return me?[]:{label:Ae.startCase(g),rightElement:it(i===g),icon:(0,a.jsx)(T,{size:14,strokeWidth:1.5}),handle:()=>d(g),additionalKeywords:dt}})},{icon:(0,a.jsx)(Qe,{size:14,strokeWidth:1.5}),label:"Present as",handle:A,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(ua,{size:14,strokeWidth:1.5}):(0,a.jsx)(Xe,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{V()}},...Ye.map((m,g)=>{let T=nt(m);return{divider:g===0,label:st(m),icon:(0,a.jsx)(T,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:B===m&&(0,a.jsx)(be,{size:14})}),handle:()=>{de(m),l.mode==="edit"&&V()}}})]},{icon:(0,a.jsx)(_a,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||ue(),handle:j},{icon:(0,a.jsx)(Ke,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await q((await I()).contents),M({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(Zt,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!ie||s,handle:async()=>{let m=wt(Me());await le({configs:_e.fromEntries(m.map(fo))});for(let g of m)h({cellId:g,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Je,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{w({})}},{icon:(0,a.jsx)(gt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(Re,{onClose:o}))}},{icon:(0,a.jsx)(la,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(Re,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(Ze,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!re||s,handle:()=>{p()}},{icon:(0,a.jsx)(Ia,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:y,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Wa,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{k()}},{icon:(0,a.jsx)(jt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{u()}},{icon:(0,a.jsx)(ea,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:r,redundant:!0},{icon:(0,a.jsx)(Ma,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:f,redundant:!0},{icon:(0,a.jsx)(za,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:x,redundant:!0},{divider:!0,icon:(0,a.jsx)(Ge,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(uo)},{icon:(0,a.jsx)(Na,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>W(po)},{icon:(0,a.jsx)(ma,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>C(mo),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(Qt,{size:14,strokeWidth:1.5}),label:"Resources",handle:A,dropdown:[{icon:(0,a.jsx)(kt,{size:14,strokeWidth:1.5}),label:"Documentation",handle:ho},{icon:(0,a.jsx)(aa,{size:14,strokeWidth:1.5}),label:"GitHub",handle:co},{icon:(0,a.jsx)(oa,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:ro},{icon:(0,a.jsx)(sa,{size:14,strokeWidth:1.5}),label:"YouTube",handle:io},{icon:(0,a.jsx)(Ct,{size:14,strokeWidth:1.5}),label:"Changelog",handle:lo}]},{divider:!0,icon:(0,a.jsx)(ia,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:so},{icon:(0,a.jsx)(ta,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:no}].filter(oo).map(to),e[15]=w,e[16]=re,e[17]=u,e[18]=o,e[19]=f,e[20]=j,e[21]=S,e[22]=x,e[23]=se,e[24]=t,e[25]=K,e[26]=he,e[27]=ie,e[28]=r,e[29]=ce,e[30]=s,e[31]=n,e[32]=I,e[33]=y,e[34]=k,e[35]=le,e[36]=B,e[37]=i,e[38]=v,e[39]=W,e[40]=de,e[41]=C,e[42]=O,e[43]=F,e[44]=D,e[45]=d,e[46]=V,e[47]=p,e[48]=h,e[49]=l.mode,e[50]=Q):Q=e[50],Q}function to(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(ao)}:e}function ao(e){return!e.hidden}function oo(e){return!e.hidden}function no(){let e=xa();window.open(e,"_blank")}function so(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function lo(){window.open(P.releasesPage,"_blank")}function io(){window.open(P.youtube,"_blank")}function ro(){window.open(P.discordLink,"_blank")}function co(){window.open(P.githubPage,"_blank")}function ho(){window.open(P.docsPage,"_blank")}function mo(e){return!e}function po(e){return!e}function uo(e){return!e}function fo(e){return[e,{disabled:!1}]}async function xo(){let e=document.getElementById("App");e&&await Ut({element:e,filename:document.title,prepare:Yt})}function yo(){return window.print()}function ko(e){return e?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function bo(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(be,{size:14})})}function oe(){M({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{at as a,Je as c,ot as i,Ge as l,lt as n,Ze as o,Fa as r,Xe as s,eo as t,Ke as u};
|
package/dist/index.html
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
<marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
|
|
67
67
|
<!-- /TODO -->
|
|
68
68
|
<title>{{ title }}</title>
|
|
69
|
-
<script type="module" crossorigin src="./assets/index-
|
|
69
|
+
<script type="module" crossorigin src="./assets/index-B1HqiNNr.js"></script>
|
|
70
70
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-DItdS47A.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="./assets/chunk-LvLJmgfZ.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/react-Bj1aDYRI.js">
|
|
@@ -192,14 +192,14 @@
|
|
|
192
192
|
<link rel="modulepreload" crossorigin href="./assets/table-qC3alE1r.js">
|
|
193
193
|
<link rel="modulepreload" crossorigin href="./assets/message-circle-ehj_MdGz.js">
|
|
194
194
|
<link rel="modulepreload" crossorigin href="./assets/react-resizable-panels.browser.esm-D0qmuH5W.js">
|
|
195
|
-
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-
|
|
195
|
+
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-DboWEw2n.js">
|
|
196
196
|
<link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-CsXoiEZx.js">
|
|
197
197
|
<link rel="modulepreload" crossorigin href="./assets/square-function-DIHpmVFo.js">
|
|
198
198
|
<link rel="modulepreload" crossorigin href="./assets/spec-CBbUxOvL.js">
|
|
199
199
|
<link rel="modulepreload" crossorigin href="./assets/ellipsis-vertical-DEH0lwkn.js">
|
|
200
200
|
<link rel="modulepreload" crossorigin href="./assets/refresh-cw-CoFbRtMK.js">
|
|
201
201
|
<link rel="modulepreload" crossorigin href="./assets/components-BfHGr__b.js">
|
|
202
|
-
<link rel="modulepreload" crossorigin href="./assets/column-preview-
|
|
202
|
+
<link rel="modulepreload" crossorigin href="./assets/column-preview-BvDPfcdF.js">
|
|
203
203
|
<link rel="modulepreload" crossorigin href="./assets/icons-UbXYeuXE.js">
|
|
204
204
|
<link rel="modulepreload" crossorigin href="./assets/floating-outline-B6Qyid7Q.js">
|
|
205
205
|
<link rel="modulepreload" crossorigin href="./assets/useAddCell-cC7JUC0q.js">
|
|
@@ -220,12 +220,12 @@
|
|
|
220
220
|
<link rel="modulepreload" crossorigin href="./assets/memoize-BwAF2XN5.js">
|
|
221
221
|
<link rel="modulepreload" crossorigin href="./assets/get-D7jeR2wg.js">
|
|
222
222
|
<link rel="modulepreload" crossorigin href="./assets/_baseSet-49dbm-yb.js">
|
|
223
|
-
<link rel="modulepreload" crossorigin href="./assets/state-
|
|
223
|
+
<link rel="modulepreload" crossorigin href="./assets/state-C79RsVoe.js">
|
|
224
224
|
<link rel="modulepreload" crossorigin href="./assets/label-C89F4v17.js">
|
|
225
225
|
<link rel="modulepreload" crossorigin href="./assets/textarea-DqzNK0s9.js">
|
|
226
226
|
<link rel="modulepreload" crossorigin href="./assets/refresh-ccw-DxvV30QW.js">
|
|
227
227
|
<link rel="modulepreload" crossorigin href="./assets/trash-2-CwDX6_Ac.js">
|
|
228
|
-
<link rel="modulepreload" crossorigin href="./assets/form-
|
|
228
|
+
<link rel="modulepreload" crossorigin href="./assets/form-Byef3KYr.js">
|
|
229
229
|
<link rel="modulepreload" crossorigin href="./assets/renderShortcut-Bjt8kSBs.js">
|
|
230
230
|
<link rel="modulepreload" crossorigin href="./assets/field-C6i22m8B.js">
|
|
231
231
|
<link rel="modulepreload" crossorigin href="./assets/VisuallyHidden-DVY6OceZ.js">
|
|
@@ -245,7 +245,7 @@
|
|
|
245
245
|
<link rel="stylesheet" crossorigin href="./assets/cells-jmgGt1lS.css">
|
|
246
246
|
<link rel="stylesheet" crossorigin href="./assets/markdown-renderer-DdDKmWlR.css">
|
|
247
247
|
<link rel="stylesheet" crossorigin href="./assets/JsonOutput-B7vuddcd.css">
|
|
248
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
248
|
+
<link rel="stylesheet" crossorigin href="./assets/index-BkdonYlq.css">
|
|
249
249
|
</head>
|
|
250
250
|
<body>
|
|
251
251
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -314,19 +314,19 @@ const DataTableInternal = <TData,>({
|
|
|
314
314
|
virtualize={virtualize}
|
|
315
315
|
/>
|
|
316
316
|
</Table>
|
|
317
|
+
<TableBottomBar
|
|
318
|
+
part="table-footer"
|
|
319
|
+
className="pt-1.5 pb-0.5 border-t border-border"
|
|
320
|
+
totalColumns={totalColumns}
|
|
321
|
+
pagination={pagination}
|
|
322
|
+
selection={selection}
|
|
323
|
+
onRowSelectionChange={onRowSelectionChange}
|
|
324
|
+
table={table}
|
|
325
|
+
getRowIds={getRowIds}
|
|
326
|
+
showPageSizeSelector={showPageSizeSelector}
|
|
327
|
+
tableLoading={reloading}
|
|
328
|
+
/>
|
|
317
329
|
</div>
|
|
318
|
-
<TableBottomBar
|
|
319
|
-
part="table-footer"
|
|
320
|
-
className="border-t border-border pt-1.5 pb-0.5"
|
|
321
|
-
totalColumns={totalColumns}
|
|
322
|
-
pagination={pagination}
|
|
323
|
-
selection={selection}
|
|
324
|
-
onRowSelectionChange={onRowSelectionChange}
|
|
325
|
-
table={table}
|
|
326
|
-
getRowIds={getRowIds}
|
|
327
|
-
showPageSizeSelector={showPageSizeSelector}
|
|
328
|
-
tableLoading={reloading}
|
|
329
|
-
/>
|
|
330
330
|
</CellSelectionProvider>
|
|
331
331
|
</div>
|
|
332
332
|
);
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { useAtomValue } from "jotai";
|
|
4
|
+
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
5
|
+
import React, { useState } from "react";
|
|
6
|
+
import { Button } from "@/components/ui/button";
|
|
7
|
+
import {
|
|
8
|
+
DialogContent,
|
|
9
|
+
DialogDescription,
|
|
10
|
+
DialogFooter,
|
|
11
|
+
DialogHeader,
|
|
12
|
+
DialogTitle,
|
|
13
|
+
} from "@/components/ui/dialog";
|
|
14
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
|
15
|
+
import { runtimeConfigAtom } from "@/core/runtime/config";
|
|
16
|
+
import { copyToClipboard } from "@/utils/copy";
|
|
17
|
+
import { Events } from "@/utils/events";
|
|
18
|
+
import { Tooltip } from "@/components/ui/tooltip";
|
|
19
|
+
import type { RuntimeConfig } from "@/core/runtime/types";
|
|
20
|
+
|
|
21
|
+
type AgentTab = "claude" | "codex" | "opencode";
|
|
22
|
+
|
|
23
|
+
function buildRemoteUrl(config: RuntimeConfig) {
|
|
24
|
+
const url = new URL(config.url);
|
|
25
|
+
if (config.authToken) {
|
|
26
|
+
url.searchParams.set("auth", config.authToken);
|
|
27
|
+
}
|
|
28
|
+
return url.toString();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function getPromptCommand(agent: AgentTab, remoteUrl: string): string {
|
|
32
|
+
const command = import.meta.env.DEV ? "uv run marimo" : "uvx marimo@latest";
|
|
33
|
+
const base = `${command} pair prompt --url '${remoteUrl}'`;
|
|
34
|
+
switch (agent) {
|
|
35
|
+
case "claude":
|
|
36
|
+
return `claude "$(${base} --claude)"`;
|
|
37
|
+
case "codex":
|
|
38
|
+
return `codex "$(${base} --codex)"`;
|
|
39
|
+
case "opencode":
|
|
40
|
+
return `opencode "$(${base} --opencode)"`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const SKILL_INSTALL = "npx skills add marimo-team/marimo-pair";
|
|
45
|
+
|
|
46
|
+
export const PairWithAgentModal: React.FC<{
|
|
47
|
+
onClose: () => void;
|
|
48
|
+
}> = ({ onClose }) => {
|
|
49
|
+
const [activeTab, setActiveTab] = useState<AgentTab>("claude");
|
|
50
|
+
const runtimeConfig = useAtomValue(runtimeConfigAtom);
|
|
51
|
+
const remoteUrl = buildRemoteUrl(runtimeConfig);
|
|
52
|
+
const promptCommand = getPromptCommand(activeTab, remoteUrl);
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<DialogContent className="sm:max-w-lg">
|
|
56
|
+
<DialogHeader>
|
|
57
|
+
<DialogTitle>Pair with an agent</DialogTitle>
|
|
58
|
+
<DialogDescription>
|
|
59
|
+
Use an AI coding agent to pair-program on this notebook.{" "}
|
|
60
|
+
<a
|
|
61
|
+
href="https://links.marimo.app/marimo-pair"
|
|
62
|
+
target="_blank"
|
|
63
|
+
rel="noopener noreferrer"
|
|
64
|
+
className="underline"
|
|
65
|
+
>
|
|
66
|
+
Learn more
|
|
67
|
+
</a>
|
|
68
|
+
.
|
|
69
|
+
</DialogDescription>
|
|
70
|
+
</DialogHeader>
|
|
71
|
+
|
|
72
|
+
<div className="flex flex-col gap-4 py-2">
|
|
73
|
+
<div className="flex flex-col gap-2">
|
|
74
|
+
<span className="text-sm font-medium">1. Install the skill</span>
|
|
75
|
+
<CommandBlock command={SKILL_INSTALL} />
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<div className="flex flex-col gap-2">
|
|
79
|
+
<span className="text-sm font-medium">2. Run in your terminal</span>
|
|
80
|
+
<Tabs
|
|
81
|
+
value={activeTab}
|
|
82
|
+
onValueChange={(v) => setActiveTab(v as AgentTab)}
|
|
83
|
+
>
|
|
84
|
+
<TabsList className="w-full">
|
|
85
|
+
<TabsTrigger value="claude" className="flex-1">
|
|
86
|
+
Claude
|
|
87
|
+
</TabsTrigger>
|
|
88
|
+
<TabsTrigger value="codex" className="flex-1">
|
|
89
|
+
Codex
|
|
90
|
+
</TabsTrigger>
|
|
91
|
+
<TabsTrigger value="opencode" className="flex-1">
|
|
92
|
+
OpenCode
|
|
93
|
+
</TabsTrigger>
|
|
94
|
+
</TabsList>
|
|
95
|
+
|
|
96
|
+
<TabsContent value="claude" className="mt-3">
|
|
97
|
+
<CommandBlock command={promptCommand} />
|
|
98
|
+
</TabsContent>
|
|
99
|
+
<TabsContent value="codex" className="mt-3">
|
|
100
|
+
<CommandBlock command={promptCommand} />
|
|
101
|
+
</TabsContent>
|
|
102
|
+
<TabsContent value="opencode" className="mt-3">
|
|
103
|
+
<CommandBlock command={promptCommand} />
|
|
104
|
+
</TabsContent>
|
|
105
|
+
</Tabs>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<DialogFooter>
|
|
110
|
+
<Button variant="secondary" onClick={onClose}>
|
|
111
|
+
Close
|
|
112
|
+
</Button>
|
|
113
|
+
</DialogFooter>
|
|
114
|
+
</DialogContent>
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const CommandBlock: React.FC<{ command: string }> = ({ command }) => {
|
|
119
|
+
const [copied, setCopied] = useState(false);
|
|
120
|
+
|
|
121
|
+
const copy = Events.stopPropagation(async (e) => {
|
|
122
|
+
e.preventDefault();
|
|
123
|
+
await copyToClipboard(command);
|
|
124
|
+
setCopied(true);
|
|
125
|
+
setTimeout(() => setCopied(false), 2000);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<div className="flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-xs">
|
|
130
|
+
<code className="flex-1 select-all break-words">{command}</code>
|
|
131
|
+
<Tooltip content="Copied!" open={copied}>
|
|
132
|
+
<Button onClick={copy} size="xs" variant="ghost">
|
|
133
|
+
{copied ? (
|
|
134
|
+
<CheckIcon size={14} strokeWidth={1.5} />
|
|
135
|
+
) : (
|
|
136
|
+
<CopyIcon size={14} strokeWidth={1.5} />
|
|
137
|
+
)}
|
|
138
|
+
</Button>
|
|
139
|
+
</Tooltip>
|
|
140
|
+
</div>
|
|
141
|
+
);
|
|
142
|
+
};
|
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
PresentationIcon,
|
|
37
37
|
SettingsIcon,
|
|
38
38
|
Share2Icon,
|
|
39
|
+
SparklesIcon,
|
|
39
40
|
Undo2Icon,
|
|
40
41
|
XCircleIcon,
|
|
41
42
|
YoutubeIcon,
|
|
@@ -45,6 +46,7 @@ import { settingDialogAtom } from "@/components/app-config/state";
|
|
|
45
46
|
import { MarkdownIcon } from "@/components/editor/cell/code/icons";
|
|
46
47
|
import { useImperativeModal } from "@/components/modal/ImperativeModal";
|
|
47
48
|
import { renderShortcut } from "@/components/shortcuts/renderShortcut";
|
|
49
|
+
import { PairWithAgentModal } from "@/components/editor/actions/pair-with-agent-modal";
|
|
48
50
|
import { ShareStaticNotebookModal } from "@/components/static-html/share-modal";
|
|
49
51
|
import { toast } from "@/components/ui/use-toast";
|
|
50
52
|
import {
|
|
@@ -343,6 +345,14 @@ export function useNotebookActions() {
|
|
|
343
345
|
],
|
|
344
346
|
},
|
|
345
347
|
|
|
348
|
+
{
|
|
349
|
+
icon: <SparklesIcon size={14} strokeWidth={1.5} />,
|
|
350
|
+
label: "Pair with an agent",
|
|
351
|
+
handle: async () => {
|
|
352
|
+
openModal(<PairWithAgentModal onClose={closeModal} />);
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
|
|
346
356
|
{
|
|
347
357
|
icon: <Share2Icon size={14} strokeWidth={1.5} />,
|
|
348
358
|
label: "Share",
|
|
@@ -186,7 +186,7 @@ const CellEditorInternal = ({
|
|
|
186
186
|
deleteCell: handleDelete,
|
|
187
187
|
saveNotebook: saveOrNameNotebook,
|
|
188
188
|
createManyBelow: (cells) => {
|
|
189
|
-
for (const code of
|
|
189
|
+
for (const code of cells.toReversed()) {
|
|
190
190
|
cellActions.createNewCell({
|
|
191
191
|
code,
|
|
192
192
|
before: false,
|
|
@@ -125,7 +125,7 @@ const SnippetViewer: React.FC<{ snippet: Snippet; onClose: () => void }> = ({
|
|
|
125
125
|
|
|
126
126
|
const handleInsertSnippet = () => {
|
|
127
127
|
// Add below last focused cell in reverse order
|
|
128
|
-
for (const section of
|
|
128
|
+
for (const section of snippet.sections.toReversed()) {
|
|
129
129
|
if (section.code) {
|
|
130
130
|
createNewCell({
|
|
131
131
|
code: section.code,
|
|
@@ -24,7 +24,7 @@ export const CellLinkList: React.FC<Props> = ({
|
|
|
24
24
|
skipScroll,
|
|
25
25
|
}) => {
|
|
26
26
|
const cellIndex = useCellIds();
|
|
27
|
-
const sortedCellIds =
|
|
27
|
+
const sortedCellIds = cellIds.toSorted((a, b) => {
|
|
28
28
|
return cellIndex.inOrderIds.indexOf(a) - cellIndex.inOrderIds.indexOf(b);
|
|
29
29
|
});
|
|
30
30
|
|
|
@@ -167,8 +167,7 @@ export function useMultiCellActionButtons(cellIds: CellId[]) {
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
// Move cells in the appropriate order to maintain relative positions
|
|
170
|
-
const sortedCells =
|
|
171
|
-
direction === "up" ? cellIds : [...cellIds].toReversed();
|
|
170
|
+
const sortedCells = direction === "up" ? cellIds : cellIds.toReversed();
|
|
172
171
|
sortedCells.forEach((cellId) => {
|
|
173
172
|
moveCell({ cellId, before: direction === "up" });
|
|
174
173
|
});
|
|
@@ -177,7 +176,7 @@ export function useMultiCellActionButtons(cellIds: CellId[]) {
|
|
|
177
176
|
|
|
178
177
|
const sendSelectedCellsToTop = useEvent((cellIds: CellId[]) => {
|
|
179
178
|
// Send in reverse order to maintain relative positions
|
|
180
|
-
|
|
179
|
+
cellIds.toReversed().forEach((cellId) => {
|
|
181
180
|
sendToTop({ cellId });
|
|
182
181
|
});
|
|
183
182
|
});
|
|
@@ -401,7 +401,7 @@ export function useCellNavigationProps(
|
|
|
401
401
|
}
|
|
402
402
|
|
|
403
403
|
// Move cells in the appropriate order to maintain relative positions
|
|
404
|
-
|
|
404
|
+
cellIds.toReversed().forEach((cellId) => {
|
|
405
405
|
actions.moveCell({ cellId, before: false });
|
|
406
406
|
});
|
|
407
407
|
return true;
|
|
@@ -480,7 +480,7 @@ export function useCellNavigationProps(
|
|
|
480
480
|
}),
|
|
481
481
|
"cell.sendToTop": addSingleHandler((cellIds) => {
|
|
482
482
|
// Send in reverse order to maintain relative positions
|
|
483
|
-
|
|
483
|
+
cellIds.toReversed().forEach((cellId) => {
|
|
484
484
|
actions.sendToTop({ cellId });
|
|
485
485
|
});
|
|
486
486
|
return true;
|
|
@@ -167,7 +167,7 @@ const ConsoleOutputInternal = (props: Props): React.ReactNode => {
|
|
|
167
167
|
return null;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
const reversedOutputs =
|
|
170
|
+
const reversedOutputs = consoleOutputs.toReversed();
|
|
171
171
|
const isPdb = reversedOutputs.some(
|
|
172
172
|
(output) =>
|
|
173
173
|
typeof output.data === "string" && output.data.includes("(Pdb)"),
|