import { KernelStatus } from "@nteract/types" ; import { AppState , KernelRef } from "@nteract/types" ; import { createSelector } from "reselect" ; param state returns export const kernelsByRef = ( state ) => state . core . entities . kernels . byRef ; param state param { kernelRef returns export const kernel = ( state , { kernelRef } ) => { return kernelRef ? kernelsByRef ( state ) . get ( kernelRef , null ) : null ; } ; param state returns export const currentKernelRef = ( state ) => state . core . kernelRef ; /**
 * Returns the kernelspec of the kernel that we are currently connected to.
 * Returns null if there is no kernel.
 */ export const currentKernel = createSelector ( [ currentKernelRef , kernelsByRef ] , ( kernelRef , byRef ) => ( kernelRef ? byRef . get ( kernelRef ) : null ) ) ; /**
 * Returns the type of the kernel the nteract application is currently
 * connected to. Returns `null` if there is no kernel.
 */ export const currentKernelType = createSelector ( currentKernel , kernel => { if ( kernel && kernel . type ) { return kernel . type ; } return null ; } ) ; /**
 * Returns the state of the kernel the nteract application is currently
 * connected to. Returns "not connected" if there is no kernel.
 */ export const currentKernelStatus = createSelector ( [ currentKernel ] , kernel => { if ( kernel && kernel . status ) { return kernel . status ; } return KernelStatus . NotConnected ; } ) ;