{"version":3,"file":"primeng-captcha.umd.js","sources":["../../src/app/components/captcha/captcha.ts","../../src/app/components/captcha/primeng-captcha.ts"],"sourcesContent":["import {NgModule,AfterViewInit,Component,EventEmitter,Input,NgZone,OnDestroy,Output,ElementRef,ChangeDetectionStrategy, ViewEncapsulation, ChangeDetectorRef} from '@angular/core';\nimport {CommonModule} from '@angular/common';\n\n@Component({\n selector: 'p-captcha',\n template: `
`,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None\n})\nexport class Captcha implements AfterViewInit,OnDestroy {\n\n @Input() siteKey: string = null;\n \n @Input() theme = 'light';\n \n @Input() type = 'image';\n \n @Input() size = 'normal';\n \n @Input() tabindex = 0;\n \n @Input() language: string = null;\n \n @Input() initCallback = \"initRecaptcha\";\n \n @Output() onResponse: EventEmitter = new EventEmitter();\n \n @Output() onExpire: EventEmitter = new EventEmitter();\n \n private _instance: any = null;\n\n constructor(public el: ElementRef, public _zone: NgZone, public cd: ChangeDetectorRef) {}\n \n ngAfterViewInit() {\n if ((window).grecaptcha) {\n if (!(window).grecaptcha.render){\n setTimeout(() =>{\n this.init();\n },100)\n }\n else {\n this.init();\n }\n }\n else {\n (window)[this.initCallback] = () => {\n this.init();\n }\n } \n }\n \n init() {\n this._instance = (window).grecaptcha.render(this.el.nativeElement.children[0], {\n 'sitekey': this.siteKey,\n 'theme': this.theme,\n 'type': this.type,\n 'size': this.size,\n 'tabindex': this.tabindex,\n 'hl': this.language,\n 'callback': (response: string) => {this._zone.run(() => this.recaptchaCallback(response))},\n 'expired-callback': () => {this._zone.run(() => this.recaptchaExpiredCallback())}\n });\n }\n \n reset() {\n if (this._instance === null)\n return;\n \n (window).grecaptcha.reset(this._instance);\n this.cd.markForCheck();\n }\n \n getResponse(): String {\n if (this._instance === null)\n return null;\n \n return (window).grecaptcha.getResponse(this._instance);\n }\n \n recaptchaCallback(response: string) {\n this.onResponse.emit({\n response: response\n });\n }\n\n recaptchaExpiredCallback() {\n this.onExpire.emit();\n }\n \n ngOnDestroy() {\n if (this._instance != null) {\n (window).grecaptcha.reset(this._instance);\n }\n }\n}\n\n@NgModule({\n imports: [CommonModule],\n exports: [Captcha],\n declarations: [Captcha]\n})\nexport class CaptchaModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["EventEmitter","Component","ChangeDetectionStrategy","ViewEncapsulation","ElementRef","NgZone","ChangeDetectorRef","Input","Output","NgModule","CommonModule"],"mappings":";;;;;;;QA+BI,iBAAmB,EAAc,EAAS,KAAa,EAAS,EAAqB;YAAlE,OAAE,GAAF,EAAE,CAAY;YAAS,UAAK,GAAL,KAAK,CAAQ;YAAS,OAAE,GAAF,EAAE,CAAmB;YApB5E,YAAO,GAAW,IAAI,CAAC;YAEvB,UAAK,GAAG,OAAO,CAAC;YAEhB,SAAI,GAAG,OAAO,CAAC;YAEf,SAAI,GAAG,QAAQ,CAAC;YAEhB,aAAQ,GAAG,CAAC,CAAC;YAEb,aAAQ,GAAW,IAAI,CAAC;YAExB,iBAAY,GAAG,eAAe,CAAC;YAE9B,eAAU,GAAsB,IAAIA,iBAAY,EAAE,CAAC;YAEnD,aAAQ,GAAsB,IAAIA,iBAAY,EAAE,CAAC;YAEnD,cAAS,GAAQ,IAAI,CAAC;SAE2D;QAEzF,iCAAe,GAAf;YAAA,iBAgBC;YAfG,IAAU,MAAO,CAAC,UAAU,EAAE;gBAC1B,IAAI,CAAO,MAAO,CAAC,UAAU,CAAC,MAAM,EAAC;oBACjC,UAAU,CAAC;wBACP,KAAI,CAAC,IAAI,EAAE,CAAC;qBACf,EAAC,GAAG,CAAC,CAAA;iBACT;qBACI;oBACD,IAAI,CAAC,IAAI,EAAE,CAAC;iBACf;aACJ;iBACI;gBACK,MAAO,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG;oBACjC,KAAI,CAAC,IAAI,EAAE,CAAC;iBACb,CAAA;aACJ;SACJ;QAED,sBAAI,GAAJ;YAAA,iBAWC;YAVG,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