import * as i0 from '@angular/core'; import { OnChanges, EventEmitter, InjectionToken, Type, OnDestroy, ChangeDetectorRef, ElementRef, SimpleChanges, OnInit, TemplateRef } from '@angular/core'; import * as i9 from '@angular/forms'; import { UntypedFormGroup, UntypedFormControl, UntypedFormBuilder } from '@angular/forms'; import { Query, AppService } from '@sinequa/core/app-utils'; import { OverlayPositionBuilder, Overlay, ConnectedPosition, OverlayRef } from '@angular/cdk/overlay'; import * as i13 from '@sinequa/components/action'; import { Action } from '@sinequa/components/action'; import { Subject, Observable, BehaviorSubject, Subscription } from 'rxjs'; import { DomSanitizer, SafeResourceUrl, SafeHtml } from '@angular/platform-browser'; import * as i14 from '@sinequa/components/facet'; import { AbstractFacet } from '@sinequa/components/facet'; import * as i15 from '@sinequa/components/search'; import { SearchService } from '@sinequa/components/search'; import { UserPreferences } from '@sinequa/components/user-settings'; import * as i12 from '@sinequa/components/utils'; import { UIService } from '@sinequa/components/utils'; import * as i11 from '@sinequa/core/web-services'; import { StartConfig, PreviewWebService, Record, CustomHighlights, PreviewData, Results, HighlightValue, CCColumn } from '@sinequa/core/web-services'; import { Router } from '@angular/router'; import { RecentDocumentsService } from '@sinequa/components/saved-queries'; import { JsonObject } from '@sinequa/core/base'; import { AuthenticationService } from '@sinequa/core/login'; import { ModalService } from '@sinequa/core/modal'; import * as i8 from '@angular/common'; import * as i10 from '@sinequa/core/intl'; declare class PreviewSearchFormComponent implements OnChanges { private formBuilder; query: Query; searchText: EventEmitter; readonly form: UntypedFormGroup; readonly searchControl: UntypedFormControl; constructor(formBuilder: UntypedFormBuilder); /** * Updates the text of the search form when the query changes */ ngOnChanges(): void; /** * Emits an event for the parent component to search this next text */ search(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } type FrameMessage = { type: string; url: string; data?: T; }; declare class PreviewFrameService { appService: AppService; startConfig: StartConfig; subscribers: { [url: string]: { [type: string]: (data: any) => void; }; }; constructor(appService: AppService, startConfig: StartConfig); subscribe(url: string, type: string, callback: (data: T) => void): void; unsubscribe(url: string): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare const enum PreviewEventType { Data = "Preview_Data", Modal = "Preview_Modal", Route = "Preview_Route", Window = "Preview_Window" } interface PreviewEvent { type: PreviewEventType; record?: Record; query: Query; } declare const PREVIEW_MODAL: InjectionToken>; declare class PreviewService { previewModal: Type; private router; private previewWebService; private appService; private authenticationService; private searchService; private modalService; private recentDocumentsService; private readonly _events; private rank; constructor(previewModal: Type, router: Router, previewWebService: PreviewWebService, appService: AppService, authenticationService: AuthenticationService, searchService: SearchService, modalService: ModalService, recentDocumentsService: RecentDocumentsService); /** * Triggers any event among PreviewEvent */ get events(): Subject; private makeQuery; getPreviewData(id: string, query: Query, customHighlights?: CustomHighlights[], audit?: boolean): Observable; openModal(record: Record, query: Query, model: any): void; openNewWindow(record: Record, query: Query): Window | null; openRoute(record: Record, query: Query, path?: string): Promise; /** * Get the page number of a splitted document's record or undefined if * it is not in fact splitted. Stores the page number in the record itself ($page property) * @param record */ getPageNumber(record: Record): number | undefined; /** * Returns the pages of a given record id * @param containerid * @param query */ fetchPages(containerid: string, query: Query): Observable; getAuditPreviewDetail(id: string, query: Query, record?: Record, resultId?: string): JsonObject; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } interface PreviewHighlightColors { name: string; color?: string; bgColor?: string; } declare class Preview extends AbstractFacet implements OnChanges, OnDestroy { previewService: PreviewService; previewFrames: PreviewFrameService; sanitizer: DomSanitizer; appService: AppService; searchService: SearchService; prefs: UserPreferences; cdRef: ChangeDetectorRef; ui: UIService; el: ElementRef; id: string; query?: Query; customHighlights?: CustomHighlights[]; /** Default scale */ scale: number; /** Increment/decrement of scale (additive) */ scaleIncrement: number; /** Highlights configuration */ highlightColors: PreviewHighlightColors[]; /** Whether to highlight entities by default */ highlightEntities: boolean; /** Whether to highlight extracts by default */ highlightExtracts: boolean; /** Whether to display the highlight actions */ highlightActions: boolean; /** List of highlights considered as "extracts" */ extracts: string[]; /** List of highlights considered as "entities" */ get entities(): string[]; usePassageHighlighter: string[]; /** Name of the preference property used to stored the highlight preferences */ preferenceName: string; /** Whether to show an action to download the PDF version of the document (if it exists) */ downloadablePdf: boolean; /** Emits an event when the preview is ready for any interaction via this component */ ready: EventEmitter; resize: EventEmitter; iframe: ElementRef; get preview(): Window | null; /** Subject emitting a value when the "selected highlight" changes */ selectedId$: BehaviorSubject; /** Subject emitting the list of highlights when it changes */ highlights$: BehaviorSubject; zoomInAction: Action; zoomOutAction: Action; toggleEntitiesAction: Action; toggleExtractsAction: Action; toggleDescriptionAction: Action; pdfDownloadAction: Action; _actions: Action[]; get actions(): Action[]; loading: boolean; url?: string; safeUrl?: SafeResourceUrl; data?: PreviewData; /** * Determines if the file format is Excel. * This allow to display the preview in a different way (without sandbox). * @returns {boolean} True if the file format is Excel, false otherwise. */ get isExcelDocFormat(): boolean; constructor(previewService: PreviewService, previewFrames: PreviewFrameService, sanitizer: DomSanitizer, appService: AppService, searchService: SearchService, prefs: UserPreferences, cdRef: ChangeDetectorRef, ui: UIService, el: ElementRef); ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; sendMessage(message: any): void; onReady(): void; totalPages: number; currentPage: number; onPageInfo({ current, total }: { current: number; total: number; }): void; onLoad(): void; onResize: (...params: any[]) => any; /** * Update the facet actions (PDF, highlight toggle, Zoom In/Out) */ updateActions(): void; /** * Update the preview highlights, based on the user settings or defaults. */ updateHighlights(): void; /** * Return highlight colors based on user settings or defaults. */ getHighlights(): PreviewHighlightColors[]; /** * Toggle highlight of entities via the user preferences */ toggleEntities(showEntities: boolean): void; /** * Toggle highlight of extracts via the user preferences */ toggleExtracts(showExtracts: boolean): void; /** * Toggle the highlight of a specific type */ toggleHighlight(highlight: string): void; selectMostRelevant(): void; getMostRelevantId(type: string): string; select(id: string): void; unselect(): void; getHtml(highlight: string): Observable; selectEntity(type: string, value: string, index?: number): void; selectStart(type: string, start: number, value?: string): void; get allHighlights(): string[]; get defaultHighlights(): string[]; get highlightsPref(): string[]; set highlightsPref(pref: string[]); gotoPage(page: number): void; nextPage(): void; prevPage(): void; firstPage(): void; lastPage(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } interface EntityHoverEvent { id: string; position: DOMRect; } interface TextSelectionEvent { selectedText: string; position: DOMRect; } interface PreviewEntityOccurrence { id: string; type: string; index: number; count: number; value: string; label: string; display: string; position: DOMRect; } declare class PreviewTooltipComponent implements OnInit, OnDestroy { overlayPositionBuilder: OverlayPositionBuilder; overlay: Overlay; previewFrames: PreviewFrameService; preview: Preview; /** Actions to display above a hovered entity */ entityActions?: Action[]; /** Actions to display above a selected text */ textActions?: Action[]; entityNavActions: Action[]; tooltipTpl: TemplateRef; entity?: PreviewEntityOccurrence; text?: string; placement: ConnectedPosition; overlayRef?: OverlayRef; sub: Subscription; constructor(overlayPositionBuilder: OverlayPositionBuilder, overlay: Overlay, previewFrames: PreviewFrameService, preview: Preview); ngOnInit(): void; ngOnDestroy(): void; showTooltip(position: DOMRect): void; detach(): void; /** * Subscribe to the preview events needed to display or hide the tooltip. * The subscription is needed for a given preview URL */ initTooltip(url: string): void; tooltipTimeout?: NodeJS.Timeout; onHighlightHover(event: EntityHoverEvent | undefined): void; onTextSelection(event: TextSelectionEvent | undefined): void; showEntityTooltip(event: EntityHoverEvent): void; showTextTooltip(event: TextSelectionEvent): void; hideTextTooltip(): void; initHideTooltip(): void; hideTooltip(): void; cancelHideTooltip(): void; onScroll(event: { x: number; y: number; }): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } interface MinimapItem { id: string; type: string; top: number; height: number | undefined; text: string; } declare class PreviewMinimapComponent implements OnInit { previewFrames: PreviewFrameService; preview: Preview; cdr: ChangeDetectorRef; /** Which highlight type should the minimap display */ minimapType: string; locations?: MinimapItem[]; selectedLocation?: MinimapItem; selectedId?: string; sub: Subscription; constructor(previewFrames: PreviewFrameService, preview: Preview, cdr: ChangeDetectorRef); ngOnInit(): void; ngOnDestroy(): void; initMinimap(url: string): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } type Extract = { id: string; text: SafeHtml; startIndex: number; relevanceIndex: number; textIndex: number; }; declare class PreviewExtractsPanelComponent implements OnChanges, OnDestroy { cdr: ChangeDetectorRef; sanitizer: DomSanitizer; previewData: PreviewData; preview: Preview; type: string; highlights: PreviewHighlightColors[]; /** Whether the extracts pagination should be displayed at the footer of the side menu */ showPagination: boolean; /** The number of items per page */ extractsNumber: number; extracts: Extract[]; displayedExtracts: Extract[]; sortAction: Action; currentIndex: number; scrollIndex: number; loading: boolean; constructor(cdr: ChangeDetectorRef, sanitizer: DomSanitizer); /** * Extracts the list of extracts from the preview document */ ngOnChanges(changes: SimpleChanges): void; sub?: Subscription; ngOnDestroy(): void; private fetchExtracts; updateCurrentIndex(): void; /** * Build Sort Action for Extracts * @param i */ buildSortAction(): void; updateSort(text: string, key: 'textIndex' | 'relevanceIndex'): void; /** * Scroll to a specific extract * @param i */ scrollExtract(extract: Extract): void; /** * Select the previous extract in the list */ previousExtract(): void; /** * Select the next extract in the list */ nextExtract(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class PreviewEntityPanelComponent implements OnChanges { preview: Preview; previewData: PreviewData; style: string; ignored: string[]; highlights?: PreviewHighlightColors[]; entities: { type: string; icon: string; display: string; values: HighlightValue[]; highlights?: PreviewHighlightColors; }[] | undefined; /** * Extracts the list of entities from the preview data */ ngOnChanges(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } interface PreviewEntity { display: string; ids: number[]; current?: number; } declare class PreviewEntityFacetComponent extends AbstractFacet implements OnChanges, OnDestroy { appService: AppService; cdRef: ChangeDetectorRef; entity: string; data: HighlightValue[]; previewData: PreviewData; preview: Preview; count: number; sortFreq: boolean; label?: string; icon?: string; highlights?: PreviewHighlightColors; _actions: Action[]; items: PreviewEntity[]; column: CCColumn | undefined; sortFreqAction: Action; sortAlphaAction: Action; highlighted$: Observable; constructor(appService: AppService, cdRef: ChangeDetectorRef); get actions(): Action[]; /** * Since the preview document comes after the preview data, we need to wait for that change * and apply the hidden state in the document. * @param changes */ ngOnChanges(changes: SimpleChanges): void; sub?: Subscription; ngOnDestroy(): void; /** * Returns the entities to be displayed in the facet, performing truncation and sorting of the input list */ updateValues(): void; /** * Update the order of items */ updateSort(): void; /** * selectedId is the id of the currently selected highlight * in the form "company_123". If this facet displays the entity "company", * then we set occurrence 123 of this entity as the "current" one */ updateSelected(selectedId: string | undefined): void; /** * For each entity in this facet, search for an occurrence of the given id, and * set the "current" property of this entity accordingly (= the index of the currently * selected occurrence). */ setCurrent(id: number): void; /** * Shows all the entities in the list */ showAll(): void; /** * Navigate to the next value of this entity. * Modifies the provided preview document. * @param value */ nextEntity(value: PreviewEntity): void; /** * Navigate to the next value of this entity. * Modifies the provided preview document. * @param value */ prevEntity(value: PreviewEntity): void; /** * Navigate to the given occurrence of an entity in a specific category * Modifies the provided preview document. * @param category * @param value * @param i */ selectEntity(id: number): void; toggleHighlight(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class PreviewNavigator { firstPage: EventEmitter; prevPage: EventEmitter; nextPage: EventEmitter; lastPage: EventEmitter; gotoPage: EventEmitter; total: number; current: number; isFirst: () => boolean; isLast: () => boolean; goto(raw: string | number): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class PreviewModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } declare const enPreview: any; declare const frPreview: any; declare const dePreview: any; export { PREVIEW_MODAL, Preview, PreviewEntityFacetComponent, PreviewEntityPanelComponent, PreviewEventType, PreviewExtractsPanelComponent, PreviewFrameService, PreviewMinimapComponent, PreviewModule, PreviewSearchFormComponent, PreviewService, PreviewTooltipComponent, dePreview, enPreview, frPreview }; export type { Extract, FrameMessage, MinimapItem, PreviewEntityOccurrence, PreviewEvent, PreviewHighlightColors };