import { CodeViewItem, CodeViewScrollTarget, DiffLineAnnotation, LineAnnotation } from "../types.js";
import { EditorChangeEvent, EditorType } from "../editor/types.js";
import { GetHoveredLineResult } from "../managers/InteractionManager.js";
import { Editor, EditorOptions } from "../editor/editor.js";
import { CodeView as CodeView$1, CodeViewItemEditCompleteHandler, CodeViewLineSelection, CodeViewOptions } from "../components/CodeView.js";
import { CSSProperties, ReactNode, Ref } from "react";

//#region src/react/CodeView.d.ts
type CodeViewGutterUtilityGetter = (() => GetHoveredLineResult<'file'> | undefined) | (() => GetHoveredLineResult<'diff'> | undefined);
type CodeViewReactOptions<LAnnotation, Caret> = Omit<CodeViewOptions<LAnnotation, Caret>, 'controlledSelection' | 'createEditor' | 'onSelectedLinesChange'>;
interface CodeViewBaseProps<LAnnotation, Caret> {
  options?: CodeViewReactOptions<LAnnotation, Caret>;
  /**
   * Creation-time options passed to the nearest EditProvider factory.
   * CodeView supplies its item-specific change callback.
   */
  editorOptions?: Omit<EditorOptions<EditorType, LAnnotation, Caret>, 'onChange'>;
  /** Resolve an in-memory retention key for an item's draft and undo history. */
  getEditStateKey?(item: CodeViewItem<LAnnotation>): string | undefined;
  className?: string;
  style?: CSSProperties;
  containerRef?: Ref<HTMLDivElement>;
  disableWorkerPool?: boolean;
  selectedLines?: CodeViewLineSelection | null;
  onSelectedLinesChange?(selection: CodeViewLineSelection | null): void;
  onScroll?(scrollTop: number, viewer: CodeView$1<LAnnotation, Caret>): void;
  /** Render a non-virtualized node at the very start of the scroll content,
   * before the first item. Always rendered; scrolls with the content. */
  renderCodeViewHeader?(): ReactNode;
  /** Render a non-virtualized node at the very end of the scroll content, after
   * the last item. Always rendered; scrolls with the content. */
  renderCodeViewFooter?(): ReactNode;
  /**
   * Called with the editor's `EditorChangeEvent` and the owning item on every
   * document change. Do not feed it directly back into the controlled item,
   * which can create update loops.
   */
  onItemEditChange?(event: EditorChangeEvent<EditorType, LAnnotation, Caret>, item: CodeViewItem<LAnnotation>): void;
  /**
   * Called once when an edit session ends: edit turned off, the item removed,
   * or the CodeView unmounted (where the result is not installed). Collapse
   * suspends the session instead of completing it. `nextItem` is the accepted
   * replacement CodeView built from `item`: the event's completed
   * `file`/`fileDiff` and annotations, `edit: false`, and a bumped `version`.
   * Return `'accept'` to install the edit — CodeView applies `nextItem` through
   * the item update path when the item still exists, and a controlled owner
   * puts the same `nextItem` into its state — or `'reject'` to revert. The event
   * is frozen; re-key the accepted value in place before accepting.
   */
  onItemEditComplete?: CodeViewItemEditCompleteHandler<LAnnotation, Caret>;
  renderCustomHeader?(item: CodeViewItem<LAnnotation>): ReactNode;
  renderHeaderPrefix?(item: CodeViewItem<LAnnotation>): ReactNode;
  renderHeaderFilenameSuffix?(item: CodeViewItem<LAnnotation>): ReactNode;
  renderHeaderMetadata?(item: CodeViewItem<LAnnotation>): ReactNode;
  renderAnnotation?(annotation: LineAnnotation<LAnnotation> | DiffLineAnnotation<LAnnotation>, item: CodeViewItem<LAnnotation>): ReactNode;
  renderGutterUtility?(getHoveredLine: CodeViewGutterUtilityGetter, item: CodeViewItem<LAnnotation>): ReactNode;
}
interface ControlledCodeViewProps<LAnnotation, Caret> extends CodeViewBaseProps<LAnnotation, Caret> {
  items: readonly CodeViewItem<LAnnotation>[];
  initialItems?: never;
}
interface UncontrolledCodeViewProps<LAnnotation, Caret> extends CodeViewBaseProps<LAnnotation, Caret> {
  initialItems?: readonly CodeViewItem<LAnnotation>[];
  items?: never;
}
type CodeViewProps<LAnnotation, Caret> = ControlledCodeViewProps<LAnnotation, Caret> | UncontrolledCodeViewProps<LAnnotation, Caret>;
interface CodeViewHandle<LAnnotation, Caret> {
  addItems(items: readonly CodeViewItem<LAnnotation>[]): void;
  getItem(id: string): CodeViewItem<LAnnotation> | undefined;
  removeItem(id: string): boolean;
  updateItem(item: CodeViewItem<LAnnotation>): boolean;
  updateItemId(oldId: string, newId: string): boolean;
  scrollTo(target: CodeViewScrollTarget): void;
  setSelectedLines(selection: CodeViewLineSelection | null): void;
  getSelectedLines(): CodeViewLineSelection | null;
  clearSelectedLines(): void;
  getEditor(id: string): Editor<'file', LAnnotation, Caret> | Editor<'file-diff', LAnnotation, Caret> | undefined;
  getInstance(): CodeView$1<LAnnotation, Caret> | undefined;
}
type CodeViewComponent = <LAnnotation = undefined, Caret = undefined>(props: CodeViewProps<LAnnotation, Caret> & {
  ref?: React.Ref<CodeViewHandle<LAnnotation, Caret>>;
}) => React.JSX.Element;
declare const CodeView: CodeViewComponent;
//#endregion
export { CodeView, CodeViewHandle, type CodeViewItemEditCompleteHandler, CodeViewProps, CodeViewReactOptions, ControlledCodeViewProps, UncontrolledCodeViewProps };
//# sourceMappingURL=CodeView.d.ts.map