import{envConfig as i}from"../../../config/env-config.js";import{buildScripts as s}from"./build-scripts.js";import{resolveBrowserHooksPath as a}from"./resolve-browser-hooks.js";async function l(){return{id:"Google Tag Manager Analytics",requiredEntitlements:["analytics"],async processContent(n,{getConfig:t}){const o=(await t())?.analytics?.gtm;if(!o?.trackingId||!i.isProductionEnv&&!o.includeInDevelopment)return;const{headComponents:e,preBodyComponents:r}=s(o);n.addSsrComponents(e,"head"),n.addSsrComponents(r,"preBody"),n.addBrowserPlugin(a())}}}export{l as gtmAnalyticsPlugin};
