(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core')) :
    typeof define === 'function' && define.amd ? define('@sbb-esta/angular-icons/core', ['exports', '@angular/core'], factory) :
    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.sbbEsta = global.sbbEsta || {}, global.sbbEsta.angularIcons = global.sbbEsta.angularIcons || {}, global.sbbEsta.angularIcons.core = {}), global.ng.core));
}(this, (function (exports, core) { 'use strict';

    /**
     * @deprecated use @sbb-esta/angular-core/icon module
     */
    var IconBase = /** @class */ (function () {
        function IconBase(_dimension) {
            this._dimension = _dimension;
            /**
             * Configure the size of the SVG.
             * 'grow' will allow the SVG to grow or shrink to the parent size.
             * 'fixed' will apply the default width and height of the SVG.
             * 'small' will apply 24px as width and height.
             * 'medium' will apply 36px as width and height.
             * 'large' will apply 48px as width and height.
             * Defaults to 'grow'.
             */
            this.size = 'grow';
            /**
             * The given CSS class or classes will be applied to the SVG element.
             */
            this.svgClass = '';
            /** @docs-private */
            this.sbbIconComponent = true;
        }
        Object.defineProperty(IconBase.prototype, "width", {
            /**
             * Width of the icon.
             */
            get: function () {
                return this._resolveDimension(this._inputWidth, this._dimension.width);
            },
            set: function (value) {
                var _this = this;
                if (value === undefined) {
                    this._inputWidth = undefined;
                    return;
                }
                this._inputWidth = this._coerceDimensionValue(value);
                if (!this._inputHeight && !value.endsWith('%')) {
                    this._inputHeight = this._resolveInput(value, function (v) { return v / _this._dimension.ratio; });
                }
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(IconBase.prototype, "height", {
            /**
             * Height of the icon.
             */
            get: function () {
                return this._resolveDimension(this._inputHeight, this._dimension.height);
            },
            set: function (value) {
                var _this = this;
                if (value === undefined) {
                    this._inputHeight = undefined;
                    return;
                }
                this._inputHeight = this._coerceDimensionValue(value);
                if (!this._inputWidth && !value.endsWith('%')) {
                    this._inputWidth = this._resolveInput(value, function (v) { return v * _this._dimension.ratio; });
                }
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(IconBase.prototype, "display", {
            get: function () {
                return this._isFixed() || this._inputHeight || this._inputWidth ? 'inline-block' : undefined;
            },
            enumerable: false,
            configurable: true
        });
        IconBase.prototype._isFixed = function () {
            return !this.size.endsWith('grow');
        };
        IconBase.prototype._resolveDimension = function (growSize, fixedSize) {
            if (this.size === 'fixed') {
                return fixedSize;
            }
            else if (this.size === 'small') {
                return '24px';
            }
            else if (this.size === 'medium') {
                return '36px';
            }
            else if (this.size === 'large') {
                return '48px';
            }
            else {
                return growSize;
            }
        };
        IconBase.prototype._coerceDimensionValue = function (value) {
            return Number.isNaN(+value) ? value : value + "px";
        };
        IconBase.prototype._resolveInput = function (input, operation) {
            var match = /(\d*\.\d+|\d+)(\w*)/g.exec(input);
            return match && match[1] ? "" + operation(Number(match[1])) + (match[2] || 'px') : undefined;
        };
        return IconBase;
    }());
    IconBase.decorators = [
        { type: core.Directive }
    ];
    IconBase.ctorParameters = function () { return [
        { type: undefined }
    ]; };
    IconBase.propDecorators = {
        size: [{ type: core.Input }],
        width: [{ type: core.Input }, { type: core.HostBinding, args: ['style.width',] }],
        height: [{ type: core.Input }, { type: core.HostBinding, args: ['style.height',] }],
        svgClass: [{ type: core.Input }],
        display: [{ type: core.HostBinding, args: ['style.display',] }],
        sbbIconComponent: [{ type: core.HostBinding, args: ['class.sbb-icon-component',] }]
    };

    /**
     * Generated bundle index. Do not edit.
     */

    exports.IconBase = IconBase;

    Object.defineProperty(exports, '__esModule', { value: true });

})));
//# sourceMappingURL=angular-icons-core.umd.js.map
