!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/platform-browser")):"function"==typeof define&&define.amd?define("ngp-signature-generator",["exports","@angular/core","@angular/common","@angular/platform-browser"],t):t((e=e||self)["ngp-signature-generator"]={},e.ng.core,e.ng.common,e.ng.platformBrowser)}(this,(function(e,t,n,i){"use strict";
/*! *****************************************************************************
    Copyright (c) Microsoft Corporation. All rights reserved.
    Licensed under the Apache License, Version 2.0 (the "License"); you may not use
    this file except in compliance with the License. You may obtain a copy of the
    License at http://www.apache.org/licenses/LICENSE-2.0

    THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
    WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
    MERCHANTABLITY OR NON-INFRINGEMENT.

    See the Apache Version 2.0 License for specific language governing permissions
    and limitations under the License.
    ***************************************************************************** */function o(e,t,n,i){var o,a=arguments.length,r=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,n,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(r=(a<3?o(r):a>3?o(t,n,r):o(t,n))||r);return a>3&&r&&Object.defineProperty(t,n,r),r}var a=function(){function e(){}return e.ɵprov=t["ɵɵdefineInjectable"]({factory:function(){return new e},token:e,providedIn:"root"}),e=o([t.Injectable({providedIn:"root"})],e)}(),r=function(){function e(){this.base64Image="",this.SignatureText="",this.DataSource=[],this.imageHeight="200",this.imageWidth="200",this.ShowSignature=!1,this.SignatureAsBase64=new t.EventEmitter}return e.prototype.ngAfterViewInit=function(){},e.prototype.applyStyles=function(e){return{"font-family":e.FontFamily}},e.prototype.onSignatureSelection=function(e){this.GenerateSignature(e.FontSize,e.FontFamily,e.FontWeight)},e.prototype.GenerateSignature=function(e,t,n){this.context=this.canvasEl.nativeElement.getContext("2d"),this.context.font=" "+e+" "+t,this.context.textBaseline="middle",this.context.textAlign="center",this.context.imageSmoothingQuality="high",this.context.imageSmoothingEnabled=!0,this.context.lineWidth=15,this.context.fillStyle="black";var i=this.canvasEl.nativeElement.width/2,o=this.canvasEl.nativeElement.height/2;if(this.context.fillText(this.SignatureText,i,o),this.context){this.base64Image=this.canvasEl.nativeElement.toDataURL("image/png");var a=this.canvasEl.nativeElement.width,r=this.canvasEl.nativeElement.height;this.context.clearRect(0,0,a,r),this.SignatureAsBase64.emit(this.base64Image)}},o([t.ViewChild("canvasEl",{static:!1})],e.prototype,"canvasEl",void 0),o([t.Input("Text")],e.prototype,"SignatureText",void 0),o([t.Input("DataSource")],e.prototype,"DataSource",void 0),o([t.Input("ImageHeight")],e.prototype,"imageHeight",void 0),o([t.Input("ImageWidth")],e.prototype,"imageWidth",void 0),o([t.Input("ShowSignature")],e.prototype,"ShowSignature",void 0),o([t.Output()],e.prototype,"SignatureAsBase64",void 0),e=o([t.Component({selector:"ngp-signature-generator",template:'<canvas #canvasEl [width]=\'imageWidth\' [height]=\'imageHeight\' style="display: none;"></canvas>\r\n<div class="fade" *ngIf="DataSource.length > 1">\r\n  <label class="ngp-rd-container" *ngFor="let item of DataSource; index as i">\r\n    <span [ngStyle]="applyStyles(item)">{{ SignatureText }}</span>\r\n    <input type="radio" name="sign" [value]="i" (change)="onSignatureSelection(item)" />\r\n    <span class="ngp-checkmark"></span>\r\n  </label>\r\n</div>\r\n<div *ngIf="ShowSignature">\r\n  <img [src]=\'base64Image\' *ngIf="base64Image" style="border:1px solid black" [width]=\'imageWidth\'\r\n    [height]=\'imageHeight\'>\r\n</div>\r\n',styles:['.fade{-webkit-animation-name:fade;-webkit-animation-duration:1.5s;animation-name:fade;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;animation-duration:1.5s}.ngp-rd-container{display:block;position:relative;padding-left:35px;margin-bottom:12px;cursor:pointer;font-size:22px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.ngp-rd-container input{position:absolute;opacity:0;cursor:pointer;height:0;width:0}.ngp-checkmark{position:absolute;top:0;left:0;height:25px;width:25px;background-color:#eee;border-radius:50%}.ngp-rd-container:hover input~.ngp-checkmark{background-color:#ccc}.ngp-rd-container input:checked~.ngp-checkmark{background-color:#2196f3}.ngp-checkmark:after{content:"";position:absolute;display:none}.ngp-rd-container input:checked~.ngp-checkmark:after{display:block}.ngp-rd-container .ngp-checkmark:after{top:9px;left:9px;width:8px;height:8px;border-radius:50%;background:#fff}']})],e)}(),c=function(){function e(){}return e=o([t.NgModule({declarations:[r],imports:[n.CommonModule,i.BrowserModule],exports:[r]})],e)}();e.SignatureGeneratorComponent=r,e.SignatureGeneratorModule=c,e.SignatureGeneratorService=a,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=ngp-signature-generator.umd.min.js.map