import{p as s,u as C}from"./useEvent-D91BmmQi.js";import{y as d}from"./cells-CJLUCcQg.js";import{t as m}from"./createReducer-DGx5Af-C.js";function p(){return{focusedCellId:null,lastFocusedCellId:null}}var{reducer:V,createActions:b,valueAtom:a,useActions:g}=m(p,{focusCell:(l,e)=>({...l,focusedCellId:e.cellId,lastFocusedCellId:e.cellId}),toggleCell:(l,e)=>l.focusedCellId===e.cellId?{...l,focusedCellId:null}:{...l,focusedCellId:e.cellId,lastFocusedCellId:e.cellId},blurCell:l=>({...l,focusedCellId:null})});const c=s(l=>l(a).lastFocusedCellId);function F(){return C(c)}const O=s(l=>{let e=l(c);return!e||e==="__scratch__"?null:r(e,l(d))});function _(l){return s(e=>r(l,e(d)))}function r(l,e){var o;let{cellData:i,cellHandles:f,cellRuntime:I}=e,t=i[l],u=I[l],n=(o=f[l])==null?void 0:o.current;return!t||!n?null:{cellId:l,name:t.name,config:t.config,status:u?u.status:"idle",getEditorView:()=>n.editorViewOrNull,hasOutput:(u==null?void 0:u.output)!=null,hasConsoleOutput:(u==null?void 0:u.consoleOutputs)!=null}}export{g as a,c as i,_ as n,F as o,O as r,a as t};
