"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("node:fs"),B=require("node:module"),P=require("@rollup/plugin-inject"),S=require("node-stdlib-browser"),q=require("node-stdlib-browser/helpers/rollup/plugin"),j=require("node-stdlib-browser/helpers/esbuild/plugin");var m=typeof document<"u"?document.currentScript:null;const a=e=>e&&e.__esModule?e:{default:e},x=a(P),O=a(S),R=a(j),f=e=>e?e===!0?!0:e==="build":!1,u=e=>e?e===!0?!0:e==="dev":!1,$=e=>e.startsWith("node:"),w=e=>e.replace(/^node:/,""),D=(e={})=>{const c=B.createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:m&&m.src||new URL("index.cjs",document.baseURI).href),n=c.resolve("@artursapek/vite-plugin-node-polyfills/shims"),v=c.resolve("@artursapek/vite-plugin-node-polyfills/shims/banner"),p=_.readFileSync(v,"utf-8"),r={include:[],exclude:[],overrides:{},protocolImports:!0,...e,globals:{Buffer:!0,global:!0,process:!0,...e.globals}},b=(o,t)=>o===t||o===`node:${t}`,h=o=>r.include.length?!r.include.some(t=>b(o,t)):r.exclude.some(t=>b(o,t)),y=o=>{if(u(r.globals.Buffer)&&/^buffer$/.test(o))return c.resolve("buffer-polyfill");if(o in r.overrides)return r.overrides[o]};return{name:"vite-plugin-node-polyfills",config:(o,t)=>{const i=t.command==="serve",g=Object.entries(O.default).reduce((l,[s,d])=>(!r.protocolImports&&$(s)||h(s)||(l[s]=y(w(s))||d),l),{});return{build:{rollupOptions:{onwarn:(l,s)=>{q.handleCircularDependancyWarning(l,()=>{if(o.build?.rollupOptions?.onwarn)return o.build.rollupOptions.onwarn(l,s);s(l)})},plugins:[{...x.default({...f(r.globals.Buffer)?{Buffer:[n,"Buffer"]}:{},...f(r.globals.global)?{global:[n,"global"]}:{},...f(r.globals.process)?{process:[n,"process"]}:{}})}]}},esbuild:{banner:i?p:void 0},optimizeDeps:{esbuildOptions:{banner:i?{js:p}:void 0,define:{...i&&u(r.globals.Buffer)?{Buffer:"Buffer"}:{},...i&&u(r.globals.global)?{global:"global"}:{},...i&&u(r.globals.process)?{process:"process"}:{}},inject:[n],plugins:[R.default(g),{name:"vite-plugin-node-polyfills-shims-resolver",setup(l){const s=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),d=new RegExp(`^${s}$`);l.onResolve({filter:d},()=>({external:!1,path:n}))}}]}},resolve:{alias:{...g}}}}}};exports.nodePolyfills=D; //# sourceMappingURL=index.cjs.map