1import{e as d}from"/build/_shared/chunk-EIOC3IOF.js";import{a as Q}from"/build/_shared/chunk-TUIHAGXD.js";import{d as X}from"/build/_shared/chunk-DZGDZ3GC.js";import{b as F}from"/build/_shared/chunk-2VHJHPYT.js";import{a as N}from"/build/_shared/chunk-POUH3CHJ.js";import{b as q}from"/build/_shared/chunk-FONEQPGK.js";import{j as O,k as P,l as b,m as L,n as v,o as M,p as g}from"/build/_shared/chunk-SF7SKMF7.js";import{a as B}from"/build/_shared/chunk-H6S7FWVP.js";import{d as V}from"/build/_shared/chunk-T36URGAI.js";var D=V(B());var f=r=>d(r/100),R=r=>r===!0,U=(r,i)=>r.filter(t=>{var e;return R((e=t.insuranceQuote)==null?void 0:e.optIn)}).filter(t=>{var e;return typeof((e=t.variant)==null?void 0:e.sku)=="string"&&t.variant.sku.length>0}).filter(t=>{var u,o,s;let e=(s=(o=(u=t.insuranceQuote)==null?void 0:u.selectedCoverProduct)==null?void 0:o.price)==null?void 0:s.centAmount;return typeof e=="number"&&e>0}).map((t,e)=>{var a,l,c,p,n;let u=(l=(a=t.variant)==null?void 0:a.sku)!=null?l:"",o=(c=t.insuranceQuote)==null?void 0:c.selectedCoverProduct,s=(n=(p=o==null?void 0:o.price)==null?void 0:p.centAmount)!=null?n:0;return{item_id:b,item_name:L,item_category:g,item_variant:`${u}_${b}`,price:f(s),quantity:1,index:i+e}});var w=(r,i)=>r.filter(t=>Array.isArray(t.customFields)&&t.customFields.length>0).filter(t=>{var e;return typeof((e=t.variant)==null?void 0:e.sku)=="string"&&t.variant.sku.length>0}).filter(t=>{var u;let e=(u=t.customisationPrice)==null?void 0:u.centAmount;return typeof e=="number"&&e>0}).map((t,e)=>{var a,l,c,p;let u=(l=(a=t.variant)==null?void 0:a.sku)!=null?l:"",o=(p=(c=t.customisationPrice)==null?void 0:c.centAmount)!=null?p:0,s=typeof t.quantity=="number"&&t.quantity>0?t.quantity:1;return{item_id:v,item_name:M,item_category:g,item_variant:`${u}_${v}`,price:f(o),quantity:s,index:i+e}});var $=(r,i)=>{var e;if(!r)return[];if(!R(r.optIn))return[];let t=(e=r.price)==null?void 0:e.centAmount;return typeof t!="number"||t<=0?[]:[{item_id:O,item_name:P,item_category:g,price:f(t),quantity:1,index:i}]};var nt=()=>{let{enableJellyfishEventIds:r}=(0,D.useContext)(N);return{beginCheckout:(i,t,e)=>{let u=i.couponCodes[0]?{coupon:i.couponCodes[0]}:{},o=i.lineItems.map((n,y)=>{var A,h,x,E,T,S;let _=(A=n.breadcrumbs)!=null?A:[],m=Q(_),C=(x=(h=n.customisationPrice)==null?void 0:h.centAmount)!=null?x:0,I=(E=n.totalPrice.wasPrice)!=null&&E.centAmount?(n.totalPrice.wasPrice.centAmount-C*n.quantity)/100/n.quantity:void 0,k=(n.totalPrice.centAmount-C*n.quantity)/100/n.quantity;return{item_id:r?n.variant.sku||void 0:n.key||void 0,item_name:n.name||void 0,discount:I?d(I-k):0,index:y,item_brand:((T=n.variant.attributes)==null?void 0:T.collection)||void 0,item_category:m[0],item_category2:m[1],item_category3:m[2],item_category4:m[3],item_category5:m[4],item_variant:r?n.key||void 0:n.variant.sku||void 0,item_variant_id:((S=n.variant.attributes)==null?void 0:S.colour)||void 0,price:d(k),quantity:n.quantity||void 0,item_list_name:X(n.key)||e}}),s=U(i.lineItems,o.length),a=$(i.shippingInsurance,o.length+s.length),l=w(i.lineItems,o.length+s.length+a.length),c=[...o,...s,...a,...l],p=d(c.reduce((n,y)=>{var _,m;return n+((_=y.price)!=null?_:0)*((m=y.quantity)!=null?m:1)},0));q({event:"begin_checkout",event_id:F(),ecommerce:{currency:i.total.currencyCode,value:p,...u,checkout_method:t||void 0,items:c}})}}};export{U as a,w as b,$ as c,nt as d};
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.