1import{a as g}from"./fetch-order.js";import{t as u}from"./v2.js";import"./index6.js";import"./index.js";import"./runtime-core.esm-bundler.js";let r=null,d=!1;const m=()=>{const e=localStorage.getItem("cookie-consent");if(e){const t=JSON.parse(e);window.gtag("consent","default",{ad_storage:t.categories.includes("marketing")?"granted":"denied",ad_personalization:t.categories.includes("marketing")?"granted":"denied",ad_user_data:t.categories.includes("marketing")?"granted":"denied",analytics_storage:t.categories.includes("analytics")?"granted":"denied",wait_for_update:500});return}r?.has_cookie_popup!==!1&&window.gtag("consent","default",{ad_storage:"denied",ad_personalization:"denied",ad_user_data:"denied",analytics_storage:"denied",wait_for_update:500})},l=e=>{const t=e.detail.consentedCategories;window.gtag("consent","update",{ad_storage:t.includes("marketing")?"granted":"denied",ad_personalization:t.includes("marketing")?"granted":"denied",ad_user_data:t.includes("marketing")?"granted":"denied",analytics_storage:t.includes("analytics")?"granted":"denied"})},p=()=>{r?.gtm_id&&(window.dataLayer=window.dataLayer||[],function(e,t,n,a,i){e[a]=e[a]||[],e[a].push({"gtm.start":new Date().getTime(),event:"gtm.js"});const o=t.getElementsByTagName(n)[0],s=t.createElement(n),c=a!=="dataLayer"?"&l="+a:"";s.async=!0,s.src="https://www.googletagmanager.com/gtm.js?id="+i+c,o.parentNode.insertBefore(s,o)}(window,document,"script","dataLayer",r.gtm_id))},f=()=>{try{const e=document.getElementById("gtm-data");if(!e||!e.textContent){console.error("GTM settings script block not found");return}r=JSON.parse(e.textContent)}catch(e){console.error("Failed to parse GTM settings from script block:",e);return}if(!r?.gtm_manager||!r?.gtm_id||r?.gtm_version!==1)throw new Error("GTM settings are not valid, skipping GTM V1 initialization");window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)},m(),p(),document.addEventListener("cookie-consent-changed",l),d=!0},_=e=>{if(!e||!(e.payment_status===1||e.payment?.status==="paid"||["directdebit","banktransfer"].includes(e.payment?.method||"")))return;const n=JSON.parse(localStorage.getItem("gtm_tracked_orders")||"[]");if(n.includes(e.id))return;const a=e.items.map(i=>({sku:i.id.toString(),name:i.label,price:i.orig,quantity:i.quantity}));window.dataLayer.push({transactionId:e.invoice_number,transactionTotal:e.summary.total,transactionProducts:a}),n.push(e.id),localStorage.setItem("gtm_tracked_orders",JSON.stringify(n))},y=async(e={})=>{if(!d)try{f()}catch(t){console.error("Failed to initialize GTM V1, skipping GTM V1 events",t);return}if(e.isOrderSummaryPage){const{fetchOrder:t,order:n}=g(!0,!1,!1);await t(),n.value&&_(n.value)}};function w(){const e=document.querySelector('meta[name="page-type"]')?.getAttribute("content"),t=JSON.parse(document.getElementById("gtm-data")?.textContent||"{}");if(!t||t&&!t.gtm_manager)return;const n=t.gtm_version,a=e==="ordersummarypage",i=e==="upsellpage";(a||i)&&(n===1?y({isOrderSummaryPage:a,isUpsellPage:i}):n===2&&u({isOrderSummaryPage:a,isUpsellPage:i}))}w();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.