import type { Universe } from '@ephox/boss'; import type { Optional } from '@ephox/katamari'; import { breakPath as xBreakPath, breakToLeft as xBreakToLeft, breakToRight as xBreakToRight, type BrokenPath, type LeftRight } from '../../parent/Breaker'; import { type Looker, oneAll } from '../../parent/Shared'; import * as SubsetFn from '../../parent/Subset'; export interface AncestorsFnResult { readonly firstpath: E[]; readonly secondpath: E[]; readonly shared: Optional; } type SharedOneFn = (universe: Universe, look: Looker, elements: E[]) => Optional; const sharedOne: SharedOneFn = oneAll; type SubsetFn = (universe: Universe, start: E, end: E) => Optional; const subset: SubsetFn = SubsetFn.subset; type AncestorsFn = (universe: Universe, start: E, finish: E, isRoot?: ((x: E) => boolean)) => AncestorsFnResult; const ancestors: AncestorsFn = SubsetFn.ancestors; type BreakToLeftFn = (universe: Universe, parent: E, child: E) => Optional>; const breakToLeft: BreakToLeftFn = xBreakToLeft; type BreakToRightFn = (universe: Universe, parent: E, child: E) => Optional>; const breakToRight: BreakToRightFn = xBreakToRight; type BreakPathFn = (universe: Universe, child: E, isTop: (e: E) => boolean, breaker: (universe: Universe, parent: E, child: E) => Optional>) => BrokenPath; const breakPath: BreakPathFn = xBreakPath; export { sharedOne, subset, ancestors, breakToLeft, breakToRight, breakPath };