license import type { Matcher , Selector } from './types.js' ; export type { Matcher , Selector } from './types.js' ; export type { CssSelector , RangeSelector , TextPositionSelector , TextQuoteSelector , } from './types.js' ; export * from './text/index.js' ; /**
 * Wrap a matcher creation function so that it supports refinement of selection.
 *
 * See  https * | §4.2.9 Refinement of Selection} in the Web Annotation Data Model.
 *
 *  param matcherCreator - The function to wrap; it will be executed both for
 *  Selector s passed to the returned wrapper function, and for any
 * refining Selector those might contain (and any refinement of that, etc.).
 *
 *  public export function makeRefinable < TSelector extends Selector & { refinedBy ? : TSelector ; } , TScope , TMatch extends TScope > ( matcherCreator ) { return function createMatcherWithRefinement ( sourceSelector ) : Matcher < TScope , TMatch > { const matcher = matcherCreator ( sourceSelector ) ; if ( sourceSelector . refinedBy ) { const refiningSelector = createMatcherWithRefinement ( sourceSelector . refinedBy ) ; return async function * matchAll ( scope ) { for await ( const match of matcher ( scope ) ) { yield * refiningSelector ( match ) ; } } ; } return matcher ; } ; }