"use strict";var e=require("node:path"),s=require("node:fs"),r=require("node:module");function parseImport(t,o,a,n){let c="";try{if(a.startsWith("node_modules://")){c=r.createRequire(process.cwd()).resolve(a.slice(15))}else if(a.startsWith("node_modules:")){c=r.createRequire(process.cwd()).resolve(a.slice(13))}else c=e.resolve(a)}catch(e){throw new Error(`Failed to read ${a} with error ${e instanceof Error?e.message:e}`)}if(n.has(c))return!1;n.add(c),o.result.messages.push({type:"dependency",plugin:"postcss-global-data",file:c,parent:t.source?.input?.file});const i=s.readFileSync(c,"utf8");return o.postcss.parse(i,{from:c})}const creator=e=>{const s=Object.assign({files:[]},e);return{postcssPlugin:"postcss-global-data",prepare(){let e=new Set,r=new Set;return{postcssPlugin:"postcss-global-data",Once(t,o){s.files.forEach((s=>{if(e.has(s))return;const a=parseImport(t,o,s,e);a&&a.each((e=>{t.append(e),r.add(e)}))}))},OnceExit(){r.forEach((e=>{e.remove()})),r=new Set,e=new Set}}}}};creator.postcss=!0,module.exports=creator;