<template>
  <view :class="iconClass" :style="iconStyle">
    <image v-if="isImg" :class="bem.e('image')" :src="name" />
  </view>
</template>

<script lang="ts">
import { defineComponent as _defineComponent } from "vue";
import { computed } from "vue";
import { classNames, stringifyStyle, isFileUrl, createBem } from "../utils";
import { iconProps } from "./common";
const __default__ = {
  options: {
    virtualHost: true,
    styleIsolation: "shared"
  }
};
export default /* @__PURE__ */ _defineComponent({
  ...__default__,
  __name: "icon",
  props: iconProps,
  setup(__props, { expose: __expose }) {
    __expose();
    const props = __props;
    const bem = createBem("icon");
    const isImg = computed(() => {
      return isFileUrl(props.name);
    });
    const iconClass = computed(() => {
      return classNames(
        bem.b(),
        {
          [props.family]: !isImg.value,
          [`${props.family}-${props.name}`]: !isImg.value
        },
        props.rootClass
      );
    });
    const iconStyle = computed(() => {
      return stringifyStyle(
        {
          fontSize: props.size,
          color: props.color
        },
        props.rootStyle
      );
    });
    const __returned__ = { props, bem, isImg, iconClass, iconStyle };
    return __returned__;
  }
});
</script>

<style lang="scss">
@use './index.scss';
</style>