/**
 * @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.onRotateAntiClockwise = /**
     * @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 class=\"govuk-button hmcts hmcts-button--secondary rotate\" title=\"Clockwise\" role=\"button\" (click)=\"onRotateClockwise()\"></button> -->\n        <!-- <button class=\"govuk-button hmcts hmcts-button--secondary rotate anti\" title=\"Anticlockwise\" role=\"button\" (click)=\"onRotateAntiClockwise()\"></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%;background-image:url(/assets/images/em-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 }],
        img: [{ type: ViewChild, args: ['img',] }]
    };
    return ImageViewerComponent;
}());
export { ImageViewerComponent };
if (false) {
    /** @type {?} */
    ImageViewerComponent.prototype.url;
    /** @type {?} */
    ImageViewerComponent.prototype.originalUrl;
    /** @type {?} */
    ImageViewerComponent.prototype.img;
    /** @type {?} */
    ImageViewerComponent.prototype.rotation;
    /**
     * @type {?}
     * @private
     */
    ImageViewerComponent.prototype.renderer;
    /**
     * @type {?}
     * @private
     */
    ImageViewerComponent.prototype.log;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW1hZ2Utdmlld2VyLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0BobWN0cy9hbm5vdGF0aW9uLXVpLWxpYi8iLCJzb3VyY2VzIjpbImxpYi92aWV3ZXJzL2ltYWdlLXZpZXdlci9pbWFnZS12aWV3ZXIuY29tcG9uZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxLQUFLLEVBQVUsU0FBUyxFQUFFLFNBQVMsRUFBRSxVQUFVLEVBQUUsTUFBTSxlQUFlLENBQ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