import{d as k,n as i,p as v}from"./useEvent-D91BmmQi.js";import{D as w,St as y,Vn as F,ci as b,h as d,ri as D}from"./cells-DQ5n6Zef.js";import{t as V}from"./compiler-runtime-B3qBwwSJ.js";import{_}from"./useEventListener-BakX-tnw.js";import{o as x}from"./dist-B0WqBUnf.js";import{r as H}from"./requests-KshNNAOp.js";var u=V();const I=v(!1);function S(){let r=(0,u.c)(2),n=f(),t;return r[0]===n?t=r[1]:(t=()=>n(b(d())),r[0]=n,r[1]=t),i(t)}function j(r){let n=(0,u.c)(3),t=f(),o;return n[0]!==r||n[1]!==t?(o=()=>{r!==void 0&&t([r])},n[0]=r,n[1]=t,n[2]=o):o=n[2],i(o)}function q(){let r=(0,u.c)(2),n=f(),t;return r[0]===n?t=r[1]:(t=()=>n(D(d())),r[0]=n,r[1]=t),i(t)}function f(){let r=(0,u.c)(4),{prepareForRun:n}=w(),{sendRun:t}=H(),o=k(I),e;return r[0]!==n||r[1]!==t||r[2]!==o?(e=async s=>{if(s.length===0)return;let c=d();return o(!0),g({cellIds:s,sendRun:t,prepareForRun:n,notebook:c})},r[0]=n,r[1]=t,r[2]=o,r[3]=e):e=r[3],i(e)}async function g({cellIds:r,sendRun:n,prepareForRun:t,notebook:o}){var m,h,R;if(r.length===0)return;let{cellHandles:e,cellData:s}=o,c=[];for(let a of r){let l=(h=(m=e[a])==null?void 0:m.current)==null?void 0:h.editorView,p;l?(F(l)!=="markdown"&&x(l),p=y(l)):p=((R=s[a])==null?void 0:R.code)||"",c.push(p),t({cellId:a})}await n({cellIds:r,codes:c}).catch(a=>{_.error(a)})}export{f as a,j as i,g as n,S as o,q as r,I as t};
