"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
require("../../../../../../vue@3.3.4/node_modules/vue/dist/vue.runtime.esm-bundler.js");
const text_cssr = require("./styles/text.cssr.js");
const useConfig = require("../../_mixins/use-config.js");
const useTheme = require("../../_mixins/use-theme.js");
const light = require("../styles/light.js");
const createKey = require("../../_utils/cssr/create-key.js");
const useCssVarsClass = require("../../_mixins/use-css-vars-class.js");
const useCompitable = require("../../../../../../vooks@0.2.12_vue@3.3.4/node_modules/vooks/es/use-compitable.js");
const warn = require("../../_utils/naive/warn.js");
const runtimeCore_esmBundler = require("../../../../../../@vue_runtime-core@3.3.4/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js");
const textProps = Object.assign(Object.assign({}, useTheme.default.props), {
  code: Boolean,
  type: {
    type: String,
    default: "default"
  },
  delete: Boolean,
  strong: Boolean,
  italic: Boolean,
  underline: Boolean,
  depth: [String, Number],
  tag: String,
  // deprecated
  as: {
    type: String,
    validator: () => {
      if (process.env.NODE_ENV !== "production") {
        warn.warn("text", "`as` is deprecated, please use `tag` instead.");
      }
      return true;
    },
    default: void 0
  }
});
const NText = runtimeCore_esmBundler.defineComponent({
  name: "Text",
  props: textProps,
  setup(props) {
    const { mergedClsPrefixRef, inlineThemeDisabled } = useConfig.default(props);
    const themeRef = useTheme.default("Typography", "-text", text_cssr.default, light.default, props, mergedClsPrefixRef);
    const cssVarsRef = runtimeCore_esmBundler.computed(() => {
      const { depth, type } = props;
      const textColorKey = type === "default" ? depth === void 0 ? "textColor" : `textColor${depth}Depth` : createKey.createKey("textColor", type);
      const { common: { fontWeightStrong, fontFamilyMono, cubicBezierEaseInOut }, self: { codeTextColor, codeBorderRadius, codeColor, codeBorder, [textColorKey]: textColor } } = themeRef.value;
      return {
        "--n-bezier": cubicBezierEaseInOut,
        "--n-text-color": textColor,
        "--n-font-weight-strong": fontWeightStrong,
        "--n-font-famliy-mono": fontFamilyMono,
        "--n-code-border-radius": codeBorderRadius,
        "--n-code-text-color": codeTextColor,
        "--n-code-color": codeColor,
        "--n-code-border": codeBorder
      };
    });
    const themeClassHandle = inlineThemeDisabled ? useCssVarsClass.useThemeClass("text", runtimeCore_esmBundler.computed(() => `${props.type[0]}${props.depth || ""}`), cssVarsRef, props) : void 0;
    return {
      mergedClsPrefix: mergedClsPrefixRef,
      compitableTag: useCompitable.default(props, ["as", "tag"]),
      cssVars: inlineThemeDisabled ? void 0 : cssVarsRef,
      themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
      onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
    };
  },
  render() {
    var _a, _b, _c;
    const { mergedClsPrefix } = this;
    (_a = this.onRender) === null || _a === void 0 ? void 0 : _a.call(this);
    const textClass = [
      `${mergedClsPrefix}-text`,
      this.themeClass,
      {
        [`${mergedClsPrefix}-text--code`]: this.code,
        [`${mergedClsPrefix}-text--delete`]: this.delete,
        [`${mergedClsPrefix}-text--strong`]: this.strong,
        [`${mergedClsPrefix}-text--italic`]: this.italic,
        [`${mergedClsPrefix}-text--underline`]: this.underline
      }
    ];
    const children = (_c = (_b = this.$slots).default) === null || _c === void 0 ? void 0 : _c.call(_b);
    return this.code ? runtimeCore_esmBundler.h("code", { class: textClass, style: this.cssVars }, this.delete ? runtimeCore_esmBundler.h("del", null, children) : children) : this.delete ? runtimeCore_esmBundler.h("del", { class: textClass, style: this.cssVars }, children) : runtimeCore_esmBundler.h(this.compitableTag || "span", { class: textClass, style: this.cssVars }, children);
  }
});
exports.default = NText;
exports.textProps = textProps;
