// vite.config.ts
import { defineConfig } from "file:///D:/%E9%A1%B9%E7%9B%AE/%E7%81%BF%E8%83%BD/admin-govern/node_modules/.pnpm/vite@5.4.8_@types+node@20.16.9_sass@1.79.3/node_modules/vite/dist/node/index.js";
import vue from "file:///D:/%E9%A1%B9%E7%9B%AE/%E7%81%BF%E8%83%BD/admin-govern/node_modules/.pnpm/@vitejs+plugin-vue@4.6.2_vite@5.4.8_vue@3.5.9/node_modules/@vitejs/plugin-vue/dist/index.mjs";
import vueJsx from "file:///D:/%E9%A1%B9%E7%9B%AE/%E7%81%BF%E8%83%BD/admin-govern/node_modules/.pnpm/@vitejs+plugin-vue-jsx@3.1.0_vite@5.4.8_vue@3.5.9/node_modules/@vitejs/plugin-vue-jsx/dist/index.mjs";
import path from "path";
import AutoImport from "file:///D:/%E9%A1%B9%E7%9B%AE/%E7%81%BF%E8%83%BD/admin-govern/node_modules/.pnpm/unplugin-auto-import@0.16.7_@vueuse+core@10.11.1/node_modules/unplugin-auto-import/dist/vite.js";

// src/components/icon/svg/index.ts
import { readFileSync, readdirSync } from "fs";
var idPerfix = "";
var iconNames = [];
var svgTitle = /<svg([^>+].*?)>/;
var clearHeightWidth = /(width|height)="([^>+].*?)"/g;
var hasViewBox = /(viewBox="[^>+].*?")/g;
var clearReturn = /(\r)|(\n)/g;
var clearFill = /(fill="[^>+].*?")/g;
function findSvgFile(dir) {
  const svgRes = [];
  const dirents = readdirSync(dir, {
    withFileTypes: true
  });
  for (const dirent of dirents) {
    iconNames.push(`${idPerfix}-${dirent.name.replace(".svg", "")}`);
    if (dirent.isDirectory()) {
      svgRes.push(...findSvgFile(dir + dirent.name + "/"));
    } else {
      const svg = readFileSync(dir + dirent.name).toString().replace(clearReturn, "").replace(clearFill, 'fill=""').replace(svgTitle, ($1, $2) => {
        let width = 0;
        let height = 0;
        let content = $2.replace(clearHeightWidth, (s1, s2, s3) => {
          if (s2 === "width") {
            width = s3;
          } else if (s2 === "height") {
            height = s3;
          }
          return "";
        });
        if (!hasViewBox.test($2)) {
          content += `viewBox="0 0 ${width} ${height}"`;
        }
        return `<symbol id="${idPerfix}-${dirent.name.replace(".svg", "")}" ${content}>`;
      }).replace("</svg>", "</symbol>");
      svgRes.push(svg);
    }
  }
  return svgRes;
}
var svgBuilder = (path2, perfix = "local") => {
  if (path2 === "") return;
  idPerfix = perfix;
  const res = findSvgFile(path2);
  return {
    name: "svg-transform",
    transformIndexHtml(html) {
      return html.replace(
        "<body>",
        `
                <body>
                <svg id="local-icon" data-icon-name="${iconNames.join(
          ","
        )}" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position: absolute; width: 0; height: 0">
                ${res.join("")}
                </svg>
                `
      );
    }
  };
};

// vite.config.ts
var __vite_injected_original_dirname = "D:\\\u9879\u76EE\\\u707F\u80FD\\admin-govern";
var nodeResolve = (dir) => path.resolve(__vite_injected_original_dirname, ".", dir);
var vite_config_default = defineConfig({
  plugins: [
    vue(),
    svgBuilder("./src/assets/icons/"),
    vueJsx(),
    AutoImport({
      //自动引入
      imports: ["vue", "vue-router", "pinia"]
    })
  ],
  server: {
    host: "0.0.0.0",
    open: true,
    proxy: {
      "/api": {
        // target: 'http://192.168.1.81:10215', //数据中心
        // target: 'http://192.168.1.24:10215', //
        // target: 'http://192.168.1.122:10215', //gfh 
        // target: 'http://192.168.1.127:10215', //cdf
        // target: 'http://192.168.1.125:10215',
        target: "http://192.168.2.126:10215",
        // target: 'https://pqmcn.com:8092/api', //治理
        // target:'http://www.zhilitest.com:8089/api',
        changeOrigin: true,
        rewrite: (path2) => path2.replace(/^\/api/, "")
        //路径重写，把'/api'替换为''
      }
    }
    // port:'3000'
  },
  resolve: {
    alias: {
      "/@": nodeResolve(".src"),
      "@": nodeResolve("src"),
      "~": nodeResolve("public")
    }
  }
});
export {
  vite_config_default as default
};
//# sourceMappingURL=data:application/json;base64,[encoded data, 9692 characters]
