import{p as s,u as C}from"./useEvent-D91BmmQi.js";import{b as d}from"./cells-BsaJrRWi.js";import{t as m}from"./createReducer-CI9qeK_X.js";function p(){return{focusedCellId:null,lastFocusedCellId:null}}var{reducer:w,createActions:V,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 _=s(l=>{let e=l(c);return!e||e==="__scratch__"?null:r(e,l(d))});function h(l){return s(e=>r(l,e(d)))}function r(l,e){var o;let{cellData:i,cellHandles:f,cellRuntime:I}=e,u=i[l],t=I[l],n=(o=f[l])==null?void 0:o.current;return!u||!n?null:{cellId:l,name:u.name,config:u.config,status:t?t.status:"idle",getEditorView:()=>n.editorView,hasOutput:(t==null?void 0:t.output)!=null,hasConsoleOutput:(t==null?void 0:t.consoleOutputs)!=null}}export{g as a,c as i,h as n,F as o,_ as r,a as t};
