"use strict";var u=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var h=(o,t)=>{for(var r in t)u(o,r,{get:t[r],enumerable:!0})},L=(o,t,r,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of g(t))!f.call(o,n)&&n!==r&&u(o,n,{get:()=>t[n],enumerable:!(e=b(t,n))||e.enumerable});return o};var w=o=>L(u({},"__esModule",{value:!0}),o);var E={};h(E,{GTM_ID_PATTERN:()=>c,GtmSupport:()=>l,assertIsGtmId:()=>i,hasScript:()=>d,loadScript:()=>a});module.exports=w(E);var c=/^GTM-[0-9A-Z]+$/;function i(o){if(typeof o!="string"||!c.test(o)){let t=String(o).toUpperCase().replace(/.*-|[^0-9A-Z]/g,""),r=t.length===0?"":` Did you mean 'GTM-${t}'?`;throw new Error(`'${o}' is not a valid GTM-ID (${c}).${r}`)}}function a(o,t){let r=document,e=r.createElement("script"),n=y=>{t.onReady?.({id:o,script:e}),e.removeEventListener("load",n)};if(e.addEventListener("load",n),window.dataLayer=window.dataLayer??[],window.dataLayer?.push({event:"gtm.js","gtm.start":new Date().getTime()}),!o)return e;e.async=!t.defer,e.defer=!!(t.defer||t.compatibility),t.nonce&&(e.nonce=t.nonce),t.scriptType&&(e.type=t.scriptType);let s=new URLSearchParams({id:o,...t.queryParams??{}}),m=t.source??"https://www.googletagmanager.com/gtm.js";e.src=`${m}?${s}`;let p=t.parentElement??r.body;if(typeof p?.appendChild!="function")throw new Error("parentElement must be a DOM element");return p.appendChild(e),e}function d(o="https://www.googletagmanager.com/gtm.js"){return Array.from(document.getElementsByTagName("script")).some(t=>t.src.includes(o))}var l=class{id;options;scriptElements=[];constructor(t){if(Array.isArray(t.id))for(let r of t.id)typeof r=="string"?i(r):i(r.id);else i(t.id);this.id=t.id,this.options={enabled:!0,debug:!1,loadScript:!0,defer:!1,compatibility:!1,...t},delete this.options.id}isInBrowserContext=()=>typeof window<"u";enabled(){return this.options.enabled??!0}enable(t=!0,r){if(this.options.enabled=t,this.isInBrowserContext()&&t&&!d(r)&&this.options.loadScript)if(Array.isArray(this.id))this.id.forEach(e=>{let n;typeof e=="string"?n=a(e,{...this.options}):n=a(e.id,{...this.options,queryParams:e.queryParams}),this.scriptElements.push(n)});else{let e=a(this.id,{...this.options});this.scriptElements.push(e)}}debugEnabled(){return this.options.debug??!1}debug(t){this.options.debug=t}dataLayer(){return this.isInBrowserContext()&&this.options.enabled?window.dataLayer=window.dataLayer??[]:!1}trackView(t,r,e={}){let n=this.isInBrowserContext()&&(this.options.enabled??!1);this.options.debug&&console.log(`[GTM-Support${n?"":"(disabled)"}]: Dispatching TrackView`,{screenName:t,path:r}),n&&(window.dataLayer=window.dataLayer??[]).push({...e,event:this.options.trackViewEventProperty??"content-view","content-name":r,"content-view-name":t})}trackEvent({event:t,category:r=null,action:e=null,label:n=null,value:s=null,noninteraction:m=!1,...p}={}){let y=this.isInBrowserContext()&&(this.options.enabled??!1);this.options.debug&&console.log(`[GTM-Support${y?"":"(disabled)"}]: Dispatching event`,{event:t,category:r,action:e,label:n,value:s,...p}),y&&(window.dataLayer=window.dataLayer??[]).push({event:t??"interaction",target:r,action:e,"target-properties":n,value:s,"interaction-type":m,...p})}push(t){let r=this.isInBrowserContext()&&(this.options.enabled??!1);this.options.debug&&console.log(`[GTM-Support${r?"":"(disabled)"}]: Dispatching event`,t),r&&(window.dataLayer=window.dataLayer??[]).push(t)}};0&&(module.exports={GTM_ID_PATTERN,GtmSupport,assertIsGtmId,hasScript,loadScript});
//# sourceMappingURL=index.cjs.map