import { __assign } from 'tslib';
import { withThemeableProps } from '../../useThemeable.js';
import { classNamesFunction } from '@uifabric-vue/utilities';
import Vue from 'vue';
import { getIconContent } from './FontIcon.js';

var getClassNames = classNamesFunction({
  cacheSize: 100
});
var IconBase = Vue.extend({
  name: "IconBase",
  functional: true,
  props: __assign(__assign({}, withThemeableProps()), { iconName: { type: String, default: "" }, imageProps: { type: Object, default: void 0 } }),
  render: function(h, ctx) {
    var _a = ctx.props, className = _a.className, iconName = _a.iconName, theme = _a.theme, styles = _a.styles;
    var isPlaceholder = typeof iconName === "string" && iconName.length === 0;
    var isImage = !!ctx.props.imageProps;
    var iconContent = getIconContent(iconName) || {};
    var children = iconContent.children;
    var iconClassName = iconContent.iconClassName;
    var classNames = getClassNames(styles, {
      theme: theme,
      className: className,
      iconClassName: iconClassName,
      isImage: isImage,
      isPlaceholder: isPlaceholder
    });
    var RootType = isImage ? "span" : "i";
    return h(RootType, __assign(__assign({}, ctx.data), { class: classNames.root, attrs: {
      "aria-hidden": "true",
      "data-icon-name": iconName
    } }), typeof children === "function" ? [children(h)] : children instanceof Array ? children : [children]);
  }
});

export { IconBase };
