// vite.config.ts
import path from "path";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import WindiCss from "vite-plugin-windicss";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
import Icons from "unplugin-icons/vite";
import IconsResolver from "unplugin-icons/resolver";

// plugins/vite-plugin-conditional-compile.ts
import MagicString from "magic-string";
import { createFilter } from "vite";
var config = void 0;
var replaceMatched = (code, id) => {
  const env = config.env;
  const source = new MagicString(code, {
    filename: id
  });
  source.replace(/^.*?#if(n?)def\s*(\S+).*[\r\n]{1,2}([\s\S]+?)\s*.*?#endif.*?$/gm, (_, $1, $2, $3) => {
    const isNot = !!$1;
    const isKeep = $2.split("||").some((v) => {
      let flag = false;
      const [key, value] = v.split("=");
      if (value === void 0)
        flag = !!env[key];
      else
        flag = String(env[key]) === value;
      flag = isNot ? !flag : flag;
      return flag;
    });
    return isKeep ? $3 : "";
  });
  if (source.hasChanged()) {
    return {
      code: source.toString(),
      map: source.generateMap({
        source: id,
        file: `${id}.map`,
        includeContent: true
      })
    };
  }
};
var resolveOptions = (userOptions) => {
  return {
    include: ["**/*"],
    exclude: [],
    ...userOptions
  };
};
var VitePluginConditionalCompile = (userOptions = {}) => {
  const options = resolveOptions(userOptions);
  return {
    name: "vite-plugin-conditional-compile",
    enforce: "pre",
    configResolved(_config) {
      config = _config;
    },
    transform(code, id) {
      const filter = createFilter(options.include, options.exclude);
      if (filter(id))
        return replaceMatched(code, id);
    }
  };
};
var vite_plugin_conditional_compile_default = VitePluginConditionalCompile;

// vite.config.ts
var vite_config_default = defineConfig({
  resolve: {
    alias: {
      "@": path.resolve("/Users/Alvis/BozeduStore/aiwen", "src"),
      "~": path.resolve("/Users/Alvis/BozeduStore/aiwen", "src")
    }
  },
  css: {
    preprocessorOptions: {
      scss: {}
    }
  },
  plugins: [
    vite_plugin_conditional_compile_default(),
    vue({
      reactivityTransform: true
    }),
    WindiCss(),
    AutoImport({
      imports: ["vue", "vue/macros", "vue-router"],
      dirs: [
        "src/composables",
        "src/utils"
      ],
      resolvers: [ElementPlusResolver()],
      vueTemplate: true,
      eslintrc: {
        enabled: true
      }
    }),
    Components({
      dirs: ["src/components/"],
      extensions: ["vue", "md"],
      include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
      resolvers: [ElementPlusResolver({ importStyle: "sass" }), IconsResolver()]
    }),
    Icons({
      compiler: "vue3",
      autoInstall: true
    })
  ],
  server: {
    host: true,
    port: 5230
  },
  build: {}
});
export {
  vite_config_default as default
};
//# sourceMappingURL=data:application/json;base64,[encoded data, 10332 characters]
