import{Minimatch as p}from"minimatch";import{envConfig as d}from"../../../config/env-config.js";import{buildScripts as a}from"./build-scripts.js";import{resolveBrowserHooksPath as c}from"./resolve-browser-hooks.js";async function C(){return{id:"Amplitude Analytics",requiredEntitlements:["analytics"],async processContent(n,{getConfig:i}){const e=(await i())?.analytics?.amplitude;if(!e?.apiKey||!d.isProductionEnv&&!e.includeInDevelopment)return;let o=[];typeof e.exclude<"u"&&e.exclude.map(m=>{const t=new p(m).makeRe();t&&o.push(t)});const{headComponents:s,postBodyComponents:r}=a(e,o);n.addSsrComponents(s,"head"),n.addSsrComponents(r,"postBody"),n.addBrowserPlugin(c())}}}export{C as amplitudeAnalyticsPlugin};
