import * as i0 from '@angular/core'; import { OnInit, OnDestroy, TemplateRef } from '@angular/core'; import { FilesService, AlertService, AppStateService, OnBeforeSave } from '@c8y/ngx-components'; import { FormGroup, FormControl, FormBuilder, NgForm } from '@angular/forms'; import { InventoryService, InventoryBinaryService, FetchClient } from '@c8y/client'; import { TranslateService } from '@ngx-translate/core'; import { BehaviorSubject } from 'rxjs'; interface MarkdownWidgetConfig { markdownBinaryId: string | null; contentUrl: string | null; markdownContent: string | null; } declare const MarkdownSourceType: { readonly WRITE: "writeMarkdown"; readonly UPLOAD: "uploadBinary"; readonly URL: "uploadUrl"; }; type MarkdownSourceType = (typeof MarkdownSourceType)[keyof typeof MarkdownSourceType]; interface DroppedFileItem { file: File; name: string; } type MarkdownWidgetFormGroup = FormGroup<{ contentUrl: FormControl; droppedFile: FormControl; uploadChoice: FormControl; }>; declare class MarkdownWidgetService { private fileService; private inventory; private binary; private alert; private translate; private fetchClient; private appStateService; private readonly headers; constructor(fileService: FilesService, inventory: InventoryService, binary: InventoryBinaryService, alert: AlertService, translate: TranslateService, fetchClient: FetchClient, appStateService: AppStateService); /** * Retrieves a markdown file from the inventory by its binary ID. * @param markdownBinaryId - The ID of the binary managed object. * @returns The file if found, otherwise null. */ getFile(markdownBinaryId: string | null): Promise; /** * Uploads a markdown file to the inventory as a binary. * @param file - The file to upload. * @returns The ID of the created binary managed object. */ uploadFile(file: File): Promise; /** * Fetches markdown content from a URL. * For internal URLs (e.g., `/readme.md`), uses FetchClient with the app's context path. * For external URLs, uses XMLHttpRequest to avoid CORS issues with auth headers. * @param url - The URL to fetch content from. * @returns The markdown content as a string, or empty string on error. */ getContentFromUrl(url: string): Promise; private getContentFromInternalUrl; private getContentFromExternalUrl; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class MarkdownWidgetConfigComponent implements OnInit, OnDestroy, OnBeforeSave { private formBuilder; private form; private alert; private markdownService; config: MarkdownWidgetConfig; set markdownPreviewTemplate(template: TemplateRef); readonly MarkdownSourceType: { readonly WRITE: "writeMarkdown"; readonly UPLOAD: "uploadBinary"; readonly URL: "uploadUrl"; }; formGroup: MarkdownWidgetFormGroup; fileFromConfig: File; uploadChoice: MarkdownSourceType; previewMarkdown$: BehaviorSubject; editorContent: string; private widgetConfigService; private destroy$; constructor(formBuilder: FormBuilder, form: NgForm, alert: AlertService, markdownService: MarkdownWidgetService); onBeforeSave(config?: MarkdownWidgetConfig): Promise; ngOnInit(): Promise; ngOnDestroy(): void; onChange(value: MarkdownSourceType): void; onEditorChange(content: string): void; private updatePreview; private updatePreviewFromFile; private getFileFromFormValue; private initForm; private requireValidSource; private clearRequiredError; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class MarkdownWidgetViewComponent implements OnInit { private markdownWidgetService; config: MarkdownWidgetConfig; markdown: string; constructor(markdownWidgetService: MarkdownWidgetService); ngOnInit(): Promise; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } export { MarkdownSourceType, MarkdownWidgetConfigComponent, MarkdownWidgetService, MarkdownWidgetViewComponent }; export type { DroppedFileItem, MarkdownWidgetConfig, MarkdownWidgetFormGroup }; //# sourceMappingURL=index.d.ts.map