import { ElementRef, SimpleChanges, NgZone, ChangeDetectorRef, AfterViewInit, OnInit, OnChanges, EventEmitter } from '@angular/core';
import { CaptchaDataService } from './captcha-data.service';
import { NgControl, ControlValueAccessor } from '@angular/forms';
/**
 * CAPTCHA can display a "required" error automatically when you programmaically
 * call `markAllInpusAsTouched()`. (@see AbstractForm).  In order to do this,
 * you must set: name, ngModel, and required.  Otherwise, these fields are
 * optional.
 *
 *  @example
 *           <common-captcha
 *               [nonce]="application.uuid"
 *               [apiBaseUrl]="captchaApiBaseUrl"
 *               (onValidToken)="setToken($event)"
 *               name='captcha'
 *               ngModel
 *               required>
 *           </common-captcha>
 */
export declare class CaptchaComponent implements AfterViewInit, OnInit, OnChanges, ControlValueAccessor {
    private dataService;
    private cd;
    private ngZone;
    controlDir: NgControl;
    imageContainer: ElementRef;
    audioElement: ElementRef;
    apiBaseUrl: string;
    nonce: string;
    onValidToken: EventEmitter<string>;
    successMessage: string;
    eagerFetchAudio: string;
    language: string;
    userPromptMessage: string;
    /**
     * Http error response for fetching a CAPTCHA image.
     */
    errorFetchingImg: any;
    /**
     * Http error response for verifying user's answer.
     */
    errorVerifyAnswer: any;
    private validation;
    audio: string;
    answer: string;
    state: CAPTCHA_STATE;
    incorrectAnswer: boolean;
    fetchingAudioInProgress: boolean;
    _onChange: (_: any) => void;
    _onTouched: () => void;
    constructor(dataService: CaptchaDataService, cd: ChangeDetectorRef, ngZone: NgZone, controlDir: NgControl);
    registerOnChange(fn: any): void;
    registerOnTouched(fn: any): void;
    writeValue(value: any): void;
    onBlur(): void;
    ngOnInit(): void;
    ngAfterViewInit(): void;
    ngOnChanges(changes: SimpleChanges): void;
    forceRefresh(): void;
    publicForceRefresh(): void;
    answerChanged(event: any): void;
    private handleVerify;
    /**
     * Case where HTTP 200 response code is received by the payload is incorrect or corrupt.
     * The occurance of this type of case should be rare.
     * @param payload
     */
    private isValidPayload;
    retryFetchCaptcha(): void;
    playAudio(): void;
    private fetchAudio;
    getNewCaptcha(errorCase: any): void;
    private createErrorTextLine;
    translatedMessages: {
        playAudio: {
            en: string;
            zh: string;
            fr: string;
            pa: string;
        };
        tryAnotherImg: {
            en: string;
            zh: string;
            fr: string;
            pa: string;
        };
        userPromptMessage: {
            en: string;
            zh: string;
            fr: string;
            pa: string;
        };
        incorrectAnswer: {
            en: string;
            zh: string;
            fr: string;
            pa: string;
        };
        successMessage: {
            en: string;
            zh: string;
            fr: string;
            pa: string;
        };
        correct: {
            en: string;
            zh: string;
            fr: string;
            pa: string;
        };
        loadingImage: {
            en: string;
            zh: string;
            fr: string;
            pa: string;
        };
        browserNotSupportAudio: {
            en: string;
            zh: string;
            fr: string;
            pa: string;
        };
        verifyingAnswer: {
            en: string;
            zh: string;
            fr: string;
            pa: string;
        };
        errorRetrievingImg: {
            en: string;
            zh: string;
            fr: string;
            pa: string;
        };
        errorVerifyingAnswer: {
            en: string;
            zh: string;
            fr: string;
            pa: string;
        };
    };
}
/**
 * 7 mutually exclusive states, the program can only be in one of these state
 * at any given point..
 */
declare enum CAPTCHA_STATE {
    FETCHING_CAPTCHA_IMG = 1,
    SUCCESS_FETCH_IMG = 2,
    ERROR_FETCH_IMG = 3,
    VERIFYING_ANSWER = 4,
    SUCCESS_VERIFY_ANSWER_CORRECT = 5,
    ERROR_VERIFY = 6
}
export {};
