// Formats and optionally truncates and ellipsimogrifies a string for display in a card header
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1 = require("@angular/core");
var typescript_angular_utilities_1 = require("typescript-angular-utilities");
var __object = typescript_angular_utilities_1.services.object;
var TruncatePipe = (function () {
    function TruncatePipe(objectUtility) {
        this.objectUtility = objectUtility;
    }
    TruncatePipe.prototype.transform = function (input, truncateTo, includeEllipses) {
        includeEllipses = includeEllipses == null ? false : includeEllipses;
        var out = this.objectUtility.isNullOrWhitespace(input) ? '' : input.toString();
        if (out.length) {
            if (truncateTo != null && out.length > truncateTo) {
                out = out.substring(0, truncateTo);
                if (includeEllipses) {
                    out += '...';
                }
            }
        }
        return out;
    };
    return TruncatePipe;
}());
TruncatePipe = __decorate([
    core_1.Pipe({ name: 'truncate' }),
    __metadata("design:paramtypes", [__object.ObjectUtility])
], TruncatePipe);
exports.TruncatePipe = TruncatePipe;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJ1bmNhdGUucGlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRydW5jYXRlLnBpcGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsOEZBQThGOzs7Ozs7Ozs7OztBQUU5RixzQ0FBb0Q7QUFFcEQsNkVBQXdEO0FBQ3hELElBQU8sUUFBUSxHQUFHLHVDQU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