import{S as e,n as t,r as n,t as r,x as i}from"./bundled-compat-BpaDaAAu-DJtrIX6i.mjs";import{t as a}from"./plugin-auto-enable-DdH3n9V8-Dr_bUXkG.mjs";function o(e){if(e.pluginIds.length===0)return e.config;let t=new Set(e.config?.plugins?.allow??[]),n={...e.config?.plugins?.entries};for(let r of e.pluginIds){let i=r.trim();if(!i)continue;t.add(i);let a=n[i];n[i]={...a,enabled:a?.enabled!==!1||e.overrideExplicitDisable===!0}}let r=e.overrideGlobalDisable===!0&&e.config?.plugins?.enabled===!1;return{...e.config,plugins:{...e.config?.plugins,...r?{enabled:!0}:{},...t.size>0?{allow:[...t]}:{},entries:n}}}function s(e){let i=e.compat?.allowlistPluginIds?.length?r({config:e.config,pluginIds:e.compat.allowlistPluginIds}):e.config,a=e.compat?.enablementPluginIds?.length?t({config:i,pluginIds:e.compat.enablementPluginIds}):i;return e.compat?.vitestPluginIds?.length?n({config:a,pluginIds:e.compat.vitestPluginIds,env:e.env}):a}function c(e){return e.allowlistCompatEnabled||e.compatMode.enablement===`always`||e.compatMode.enablement===`allowlist`&&e.allowlistCompatEnabled||e.compatMode.vitest===!0}function l(e){return{allowlistPluginIds:e.allowlistCompatEnabled?e.compatPluginIds:void 0,enablementPluginIds:e.compatMode.enablement===`always`||e.compatMode.enablement===`allowlist`&&e.allowlistCompatEnabled?e.compatPluginIds:void 0,vitestPluginIds:e.compatMode.vitest?e.compatPluginIds:void 0}}function u(t){let n=t.env??process.env,r=t.rawConfig??t.resolvedConfig,o=t.resolvedConfig??t.rawConfig,s=t.autoEnabledReasons;if(t.applyAutoEnable&&r!==void 0){let e=a({config:r,env:n});o=e.config,s=e.autoEnabledReasons}return{rawConfig:r,config:o,normalized:e(o?.plugins),activationSourceConfig:r,activationSource:i({config:r}),autoEnabledReasons:s??{}}}function d(t){let n=t.env??process.env,r=u({rawConfig:t.rawConfig,resolvedConfig:t.resolvedConfig,autoEnabledReasons:t.autoEnabledReasons,env:n,applyAutoEnable:t.applyAutoEnable}),i=s({config:r.config,compat:t.compat,env:n});return{rawConfig:r.rawConfig,config:i,normalized:e(i?.plugins),activationSourceConfig:r.activationSourceConfig,activationSource:r.activationSource,autoEnabledReasons:r.autoEnabledReasons}}function f(e){let t=u({rawConfig:e.rawConfig,resolvedConfig:e.resolvedConfig,autoEnabledReasons:e.autoEnabledReasons,env:e.env,applyAutoEnable:e.applyAutoEnable}),n=e.compatMode.allowlist===!0,r=c({compatMode:e.compatMode,allowlistCompatEnabled:n})?e.resolveCompatPluginIds({config:t.config,workspaceDir:e.workspaceDir,env:e.env,onlyPluginIds:e.onlyPluginIds}):[];return{...d({rawConfig:t.rawConfig,resolvedConfig:t.config,autoEnabledReasons:t.autoEnabledReasons,env:e.env,compat:l({compatMode:e.compatMode,allowlistCompatEnabled:n,compatPluginIds:r})}),compatPluginIds:r}}function p(e){let t=e.env??process.env,n=e.rawConfig??e.resolvedConfig,r=e.resolvedConfig??e.rawConfig,i=e.autoEnabledReasons??{};if(e.applyAutoEnable&&n!==void 0){let e=a({config:n,env:t});r=e.config,i=e.autoEnabledReasons}let o=e.compatMode.allowlist===!0,u=c({compatMode:e.compatMode,allowlistCompatEnabled:o})?e.resolveCompatPluginIds({config:r,workspaceDir:e.workspaceDir,env:t,onlyPluginIds:e.onlyPluginIds}):[];return{rawConfig:n,config:s({config:r,compat:l({compatMode:e.compatMode,allowlistCompatEnabled:o,compatPluginIds:u}),env:t}),activationSourceConfig:n,autoEnabledReasons:i,compatPluginIds:u}}export{p as n,o as r,f as t};