/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import * as tslib_1 from "tslib";
import { Component, Input, Renderer2, ViewChild, ElementRef } from '@angular/core';
import { EmLoggerService } from '../../logging/em-logger.service';
var ImageViewerComponent = /** @class */ (function () {
    function ImageViewerComponent(renderer, log) {
        this.renderer = renderer;
        this.log = log;
        this.log.setClass('ImageViewerComponent');
    }
    /**
     * @return {?}
     */
    ImageViewerComponent.prototype.ngOnInit = /**
     * @return {?}
     */
    function () {
        this.rotation = 0;
    };
    /**
     * @return {?}
     */
    ImageViewerComponent.prototype.onRotateClockwise = /**
     * @return {?}
     */
    function () {
        this.rotation = this.rotation + 90;
        this.rotateImage();
    };
    /**
     * @return {?}
     */
    ImageViewerComponent.prototype.rotateImage = /**
     * @return {?}
     */
    function () {
        this.log.info('rotating to-' + this.rotation + 'degrees');
        /** @type {?} */
        var styles = ['transform', '-ms-transform', '-o-transform', '-moz-transform', '-webkit-transform'];
        try {
            for (var styles_1 = tslib_1.__values(styles), styles_1_1 = styles_1.next(); !styles_1_1.done; styles_1_1 = styles_1.next()) {
                var style = styles_1_1.value;
                this.renderer.setStyle(this.img.nativeElement, style, "rotate(" + this.rotation + "deg)");
            }
        }
        catch (e_1_1) { e_1 = { error: e_1_1 }; }
        finally {
            try {
                if (styles_1_1 && !styles_1_1.done && (_a = styles_1.return)) _a.call(styles_1);
            }
            finally { if (e_1) throw e_1.error; }
        }
        var e_1, _a;
    };
    ImageViewerComponent.decorators = [
        { type: Component, args: [{
                    selector: 'app-image-viewer',
                    template: "\n    <div id=\"viewer-wrapper\">\n        <button\n          *ngIf=\"rotate\"\n          class=\"govuk-button hmcts hmcts-button--secondary rotate\"\n          title=\"Clockwise\"\n          role=\"button\"\n          (click)=\"onRotateClockwise()\">Rotate</button>\n\n        <img #img *ngIf=\"url\" data-hook=\"dm.viewer.img\" [src]=\"url\"  />\n    </div>",
                    styles: ["#viewer-wrapper{position:relative;width:100%}.rotate{z-index:1;position:absolute;right:0;background-repeat:no-repeat;background-size:14px 14px;background-position:3px 50%;padding-left:25px;background-image:url(/assets/images/viewer-rotate.svg)}.anti{right:24px;-webkit-transform:scaleX(-1);transform:scaleX(-1)}img{width:100%}"]
                }] }
    ];
    ImageViewerComponent.ctorParameters = function () { return [
        { type: Renderer2 },
        { type: EmLoggerService }
    ]; };
    ImageViewerComponent.propDecorators = {
        url: [{ type: Input }],
        originalUrl: [{ type: Input }],
        rotate: [{ type: Input }],
        img: [{ type: ViewChild, args: ['img',] }]
    };
    return ImageViewerComponent;
}());
export { ImageViewerComponent };
if (false) {
    /** @type {?} */
    ImageViewerComponent.prototype.url;
    /** @type {?} */
    ImageViewerComponent.prototype.originalUrl;
    /** @type {?} */
    ImageViewerComponent.prototype.rotate;
    /** @type {?} */
    ImageViewerComponent.prototype.img;
    /** @type {?} */
    ImageViewerComponent.prototype.rotation;
    /**
     * @type {?}
     * @private
     */
    ImageViewerComponent.prototype.renderer;
    /**
     * @type {?}
     * @private
     */
    ImageViewerComponent.prototype.log;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW1hZ2Utdmlld2VyLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0BobWN0cy9hbm5vdGF0aW9uLXVpLWxpYi8iLCJzb3VyY2VzIjpbImxpYi92aWV3ZXJzL2ltYWdlLXZpZXdlci9pbWFnZS12aWV3ZXIuY29tcG9uZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxLQUFLLEVBQVUsU0FBUyxFQUFFLFNBQVMsRUFBRSxVQUFVLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDM0YsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRWxFO0lBY0ksOEJBQW9CLFFBQW1CLEVBQ25C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