/// <reference types="node" />
import { DynamicModule, Provider } from "@nestjs/common";
import { Request, Response } from "express";
import { Observable } from "rxjs";
import { workspaces } from "@angular-devkit/core";
declare class AppModule {
    static forRoot(providers: Provider[]): DynamicModule;
}
interface HalLink {
    href: string;
    templated?: boolean;
}
interface Hal {
    _links?: {
        [key: string]: HalLink;
    };
    _embedded?: {
        [key: string]: unknown;
    };
}
declare class LinkBuilder {
    private _links;
    self(href: string): this;
    hrefWhen(condition: boolean, name: string, hrefFactory: () => string): this;
    href(name: string, href: string): this;
    templatedHref(name: string, href: string): this;
    build(): {
        [key: string]: HalLink;
    } | undefined;
}
type Filterable<TModel> = (filter: string) => (e: TModel) => boolean;
interface Filterables<TModel> {
    [property: string]: Filterable<TModel>;
}
declare class FilterableBuilder<TModel> {
    private readonly _selector;
    private _filterables;
    constructor(_selector?: (model: TModel) => any);
    addFilterables(...properties: string[]): this;
    build(): Filterables<TModel>;
}
interface TranslationSourceUnit {
    id: string;
    source: string;
    description?: string;
    meaning?: string;
    locations?: string[];
}
declare class SourceOrphanRequest implements Partial<TranslationSourceUnit> {
    id: string;
}
interface TranslationTargetUnit {
    id: string;
    source: string;
    target: string;
    state: "initial" | "translated" | "reviewed" | "final";
    description?: string;
    meaning?: string;
    locations?: string[];
}
declare class TargetUnitRequest implements Partial<TranslationTargetUnit> {
    target: string;
    state: "initial" | "translated" | "reviewed" | "final";
}
interface QueryParams {
    [key: string]: string;
}
type Sortable<TModel> = (a: TModel, b: TModel) => number;
interface Sortables<TModel> {
    [property: string]: Sortable<TModel>;
}
declare class PaginationResponse<TEntry, TResponse> implements Hal {
    entriesPerPage: number;
    currentPage: number;
    totalEntries: number;
    totalPages: number;
    _links?: {
        [key: string]: HalLink;
    };
    _embedded?: {
        [key: string]: unknown;
    };
    constructor(params: {
        query: QueryParams;
        entries: TEntry[];
        responseMapper: (entry: TEntry) => TResponse;
        urlFactory: (query: QueryParams) => string;
        sortables?: Sortables<TEntry>;
        filterables?: Filterables<TEntry>;
    });
    private _sort;
    private _filter;
}
declare class SortableBuilder<TModel> {
    private readonly _selector;
    private _sortables;
    constructor(_selector?: (model: TModel) => any);
    addSortables(...properties: string[]): this;
    addSafeSortables(...properties: string[]): this;
    build(): Sortables<TModel>;
}
declare class TranslationSource {
    readonly language: string;
    readonly unitMap: Map<string, TranslationSourceUnit>;
    readonly units: TranslationSourceUnit[];
    baseHref?: string;
    constructor(language: string, unitMap: Map<string, TranslationSourceUnit>);
}
declare class RootResponse implements Hal {
    sourceLanguage: string;
    unitCount: number;
    _links?: {
        [key: string]: HalLink;
    };
    _embedded?: {
        [key: string]: unknown;
    };
    constructor(source: TranslationSource, linkHelper: LinkHelper);
}
declare class SourceUnitResponse implements TranslationSourceUnit, Hal {
    id: string;
    source: string;
    description?: string;
    meaning?: string;
    locations?: string[];
    _links?: {
        [key: string]: HalLink;
    };
    _embedded?: {
        [key: string]: unknown;
    };
    constructor(unit: TranslationSourceUnit, linkHelper: LinkHelper);
}
declare class SourceOrphanMatchResponse extends SourceUnitResponse {
    readonly distance: number;
    constructor(distance: number, unit: TranslationSourceUnit, linkHelper: LinkHelper);
}
interface TranslationTargetOrphan {
    unit: TranslationTargetUnit;
    similar: {
        distance: number;
        unit: TranslationTargetUnit;
    }[];
}
declare class TranslationTarget {
    readonly source: TranslationSource;
    readonly language: string;
    readonly changed: Observable<void>;
    readonly units: TranslationTargetUnit[];
    readonly unitMap: Map<string, TranslationTargetUnit>;
    readonly orphans: TranslationTargetOrphan[];
    readonly orphanMap: Map<string, TranslationTargetOrphan>;
    baseHref?: string;
    private _changedSubject;
    constructor(source: TranslationSource, language: string, unitMap: Map<string, TranslationTargetUnit>);
    translateUnit(unit: TranslationTargetUnit, update: Pick<TranslationTargetUnit, "target" | "state">): TranslationTargetUnit;
    migrateOrphan(orphan: TranslationTargetOrphan, targetUnit: TranslationTargetUnit): void;
    deleteOrphan(orphan: TranslationTargetOrphan): void;
    private _generateTargetUnits;
    private _findOrphans;
    private _generateOrphan;
    private _calculateDistance;
    private _normalizeWhitespace;
}
interface TranslationSourceOrphan {
    unit: TranslationSourceUnit;
    similar: {
        distance: number;
        unit: TranslationSourceUnit;
    }[];
    targetOrphans: Map<TranslationTarget, TranslationTargetOrphan>;
}
declare class SourceOrphanResponse extends SourceUnitResponse {
    constructor(orphan: TranslationSourceOrphan, linkHelper: LinkHelper);
}
declare class TargetUnitResponse implements TranslationTargetUnit, Hal {
    id: string;
    source: string;
    target: string;
    state: "initial" | "translated" | "reviewed" | "final";
    description?: string;
    meaning?: string;
    locations?: string[];
    _links?: {
        [key: string]: HalLink;
    };
    _embedded?: {
        [key: string]: unknown;
    };
    constructor(target: TranslationTarget, unit: TranslationTargetUnit, linkHelper: LinkHelper);
}
declare class TargetOrphanMatchResponse extends TargetUnitResponse {
    readonly distance: number;
    constructor(distance: number, target: TranslationTarget, unit: TranslationTargetUnit, linkHelper: LinkHelper);
}
declare class TargetOrphanResponse extends TargetUnitResponse {
    constructor(target: TranslationTarget, orphan: TranslationTargetOrphan, linkHelper: LinkHelper);
}
declare class TargetResponse implements Hal {
    language: string;
    unitCount: number;
    initialCount: number;
    translatedCount: number;
    reviewedCount: number;
    finalCount: number;
    orphanCount: number;
    _links?: {
        [key: string]: HalLink;
    };
    _embedded?: {
        [key: string]: unknown;
    };
    constructor(target: TranslationTarget, linkHelper: LinkHelper);
}
declare class TargetsResponse implements Hal {
    languages: string[];
    _links?: {
        [key: string]: HalLink;
    };
    _embedded?: {
        [key: string]: unknown;
    };
    constructor(languages: string[], linkHelper: LinkHelper);
}
declare class LinkHelper {
    private readonly _origin;
    constructor(request: Request);
    root(): string;
    sourceUnits(query?: QueryParams): string;
    sourceUnit(unitOrId: TranslationSourceUnit | string): string;
    sourceOrphans(query?: QueryParams): string;
    sourceOrphan(unitOrId: TranslationSourceOrphan | string): string;
    targets(): string;
    target(language: string): string;
    targetUnits(target: TranslationTarget, query?: QueryParams): string;
    targetUnit(unitOrId: TranslationTargetUnit | string, target: TranslationTarget): string;
    targetOrphans(target: TranslationTarget, query?: QueryParams): string;
    targetOrphan(unitOrId: TranslationTargetOrphan | string, target: TranslationTarget): string;
}
declare class AppController {
    private _translationSource;
    private _linkHelper;
    constructor(_translationSource: TranslationSource, _linkHelper: LinkHelper);
    root(): RootResponse;
}
declare abstract class PersistenceStrategy {
    abstract create(target: TranslationTarget): Promise<void>;
    abstract update(target: TranslationTarget): Promise<void>;
}
declare class TranslationTargetRegistry {
    private readonly _source;
    private readonly _persistenceStrategy;
    private readonly _targets;
    constructor(_source: TranslationSource, _persistenceStrategy: PersistenceStrategy);
    register(language: string, units: Map<string, TranslationTargetUnit>, baseHref?: string): TranslationTarget;
    create(language: string, baseHref?: string): Promise<TranslationTarget>;
    get(key: string): TranslationTarget | undefined;
    has(key: string): boolean;
    keys(): string[];
    values(): TranslationTarget[];
    sortWithIds(ids: any[], language: string): void;
    private _synchronizeSources;
    private _normalizeWhitespace;
}
declare class OrphanRegistry {
    readonly orphans: TranslationSourceOrphan[];
    readonly orphanMap: Map<string, TranslationSourceOrphan>;
    constructor(translationTargetRegistry: TranslationTargetRegistry, source: TranslationSource);
    migrateOrphan(orphan: TranslationSourceOrphan, unit: TranslationSourceUnit): void;
    deleteOrphan(orphan: TranslationSourceOrphan): void;
}
declare class TargetPathBuilder {
    private readonly _targetDirectory;
    private readonly _basename;
    private readonly _extension;
    constructor(_targetDirectory: string, sourceFile: string);
    createPath(target: TranslationTarget | string): string;
    getTargetDirectory(): string;
}
declare class SourceUnitsController {
    private _translationSource;
    private _translationTargetRegistry;
    private _linkHelper;
    constructor(_translationSource: TranslationSource, _translationTargetRegistry: TranslationTargetRegistry, _linkHelper: LinkHelper);
    getPagination(queryParams: QueryParams): PaginationResponse<TranslationSourceUnit, SourceUnitResponse>;
    getSourceUnit(id: string): SourceUnitResponse;
    reWriteTargetLanguage(language: string, body: Array<object>): {
        data: null;
        message: string;
    };
    private _createEmbeddedObject;
}
declare class TargetOrphansController {
    private _translationTargetRegistry;
    private _linkHelper;
    private _targetOrphanSortables;
    private _targetOrphanFilterables;
    constructor(_translationTargetRegistry: TranslationTargetRegistry, _linkHelper: LinkHelper);
    getPagination(language: string, queryParams: any): PaginationResponse<TranslationTargetOrphan, TargetOrphanResponse>;
    getOrphan(language: string, id: string): TargetOrphanResponse;
    deleteOrphan(language: string, id: string): void;
}
declare class TargetUnitsController {
    private _translationTargetRegistry;
    private _linkHelper;
    private _targetUnitSortables;
    private _targetUnitFilterables;
    constructor(_translationTargetRegistry: TranslationTargetRegistry, _linkHelper: LinkHelper);
    getPagination(language: string, queryParams: any): PaginationResponse<TranslationTargetUnit, TargetUnitResponse>;
    getTargetUnit(language: string, id: string): TargetUnitResponse;
    updateTargetUnit(language: string, id: string, body: TargetUnitRequest): TargetUnitResponse;
}
declare class TargetInfo {
    readonly project: string;
    readonly sourceFile: string;
    readonly sourceLanguage: string;
    readonly autoTargetFile: string;
    constructor(project: string, sourceFile: string, sourceLanguage: string, autoTargetFile: string);
}
declare class GitService {
    private _targetInfo;
    constructor(_targetInfo: TargetInfo);
    commitHandler(): Promise<any>;
    syncLocalizationToDesktop(): Promise<{
        stdout: string;
        stderr: string;
    }>;
}
declare class SyncService {
    private targetInfo;
    private _targetPathBuilder;
    constructor(targetInfo: TargetInfo, _targetPathBuilder: TargetPathBuilder);
    extractI18n(): Promise<void>;
    loadTranslatedFile(): Promise<Buffer>;
    saveTranslatedFile(file: any): Promise<void>;
    restart(): void;
    saveSortedId(data: Array<string>): Promise<void>;
    getSortedId(): Promise<string[] | undefined>;
}
declare class TargetsController {
    private _translationTargetRegistry;
    private _linkHelper;
    private git;
    private sync;
    constructor(_translationTargetRegistry: TranslationTargetRegistry, _linkHelper: LinkHelper, git: GitService, sync: SyncService);
    targets(): TargetsResponse;
    syncGitFromRepo(): Promise<{
        data: null;
        message: string;
        code: number;
        error?: undefined;
    } | {
        error: any;
        message: string;
        code: number;
        data?: undefined;
    }>;
    syncLocalization(): Promise<{
        data: null;
        code: number;
        error?: undefined;
    } | {
        data: null;
        error: unknown;
        code: number;
    }>;
    extracti18n(): Promise<{
        data: unknown;
        message: string;
    }>;
    loadTranslatedFile(res: Response): Promise<void>;
    loadSortedId(): Promise<string[] | undefined>;
    restart(): Promise<void>;
    saveTranslatedFile(file: any): Promise<{
        message: unknown;
        code: number;
    }>;
    target(language: string): TargetResponse;
    createTarget(language: string): Promise<TargetResponse>;
}
interface TranslationDeserializationResult<TUnit> {
    language: string;
    unitMap: Map<string, TUnit>;
}
declare abstract class TranslationDeserializer {
    abstract deserializeSource(content: string): TranslationDeserializationResult<TranslationSourceUnit>;
    abstract deserializeTarget(content: string): TranslationDeserializationResult<TranslationTargetUnit>;
}
declare class XmlParser {
    private _parser;
    parse(content: string): Document;
}
declare abstract class XlfDeserializerBase extends TranslationDeserializer {
    private _parser;
    constructor(_parser: XmlParser);
    abstract deserializeSource(content: string): TranslationDeserializationResult<TranslationSourceUnit>;
    abstract deserializeTarget(content: string): TranslationDeserializationResult<TranslationTargetUnit>;
    protected _createDocument(content: string): Document;
    private _assertEncoding;
    protected _assertXliff(doc: Document): void;
    protected _assertTargetLanguage(targetLanguage: string): void;
    protected _getFileNode(doc: Document): Element;
    protected _convertToString(node: Element): string;
}
declare class XlfDeserializer extends XlfDeserializerBase {
    constructor(parser: XmlParser);
    deserializeSource(content: string): {
        language: string;
        unitMap: Map<string, TranslationSourceUnit>;
    };
    deserializeTarget(content: string): {
        language: string;
        unitMap: Map<string, TranslationTargetUnit>;
    };
    protected _assertXliff(doc: Document): void;
    private _deserializeTargetUnit;
    private _deserializeSourceUnit;
    private _extractSource;
    private _extractTarget;
    private _extractState;
}
declare class Xlf2Deserializer extends XlfDeserializerBase {
    constructor(parser: XmlParser);
    deserializeSource(content: string): {
        language: string;
        unitMap: Map<string, TranslationSourceUnit>;
    };
    deserializeTarget(content: string): {
        language: string;
        unitMap: Map<string, TranslationTargetUnit>;
    };
    protected _assertXliff(doc: Document): void;
    private _deserializeTargetUnit;
    private _deserializeSourceUnit;
    private _extractSource;
    private _extractTarget;
    private _extractNote;
    private _extractState;
}
interface Options {
    translationFile: string;
    targetTranslationPath?: string;
    autoTargetFile?: string;
    includeContextInTarget?: boolean;
    port?: number;
}
declare abstract class SerializationOptions {
    abstract includeContextInTarget: boolean;
}
declare abstract class TranslationSerializer {
    abstract serializeTarget(target: TranslationTarget): string;
}
declare class XlfSerializer extends TranslationSerializer {
    private _options;
    constructor(_options: SerializationOptions);
    serializeTarget(target: TranslationTarget): string;
    private _transformState;
    private _serializeNotes;
}
declare class Xlf2Serializer extends TranslationSerializer {
    private _options;
    constructor(_options: SerializationOptions);
    serializeTarget(target: TranslationTarget): string;
    private _serializeNotes;
}
declare abstract class WorkspaceHost implements workspaces.WorkspaceHost {
    abstract readFile(path: string): Promise<string>;
    abstract writeFile(path: string, data: string): Promise<void>;
    abstract isDirectory(path: string): Promise<boolean>;
    abstract isFile(path: string): Promise<boolean>;
}
declare class SerializationStrategy {
    private readonly _host;
    private readonly _serializer;
    private readonly _deserializer;
    constructor(_host: WorkspaceHost, _serializer: TranslationSerializer, _deserializer: TranslationDeserializer);
    deserializeSource(path: string): Promise<TranslationDeserializationResult<TranslationSourceUnit>>;
    deserializeTarget(path: string): Promise<TranslationDeserializationResult<TranslationTargetUnit>>;
    serializeTarget(target: TranslationTarget, path: string): Promise<void>;
}
declare function timestamp(): string;
export { AppModule, AppController, SourceUnitsController, TargetOrphansController, TargetUnitsController, TargetsController, TranslationDeserializationResult, TranslationDeserializer, XlfDeserializer, XlfDeserializerBase, Xlf2Deserializer, XmlParser, LinkHelper, Hal, HalLink, LinkBuilder, Filterable, FilterableBuilder, Filterables, PaginationResponse, Sortable, SortableBuilder, Sortables, SourceOrphanRequest, TargetUnitRequest, QueryParams, RootResponse, SourceOrphanMatchResponse, SourceOrphanResponse, SourceUnitResponse, TargetOrphanMatchResponse, TargetOrphanResponse, TargetResponse, TargetsResponse, TargetUnitResponse, TranslationSource, TranslationSourceOrphan, TranslationSourceUnit, TranslationTarget, TranslationTargetOrphan, TranslationTargetUnit, Options, OrphanRegistry, PersistenceStrategy, TranslationTargetRegistry, TargetPathBuilder, SerializationOptions, TranslationSerializer, XlfSerializer, Xlf2Serializer, SerializationStrategy, TargetInfo, timestamp, WorkspaceHost };
