1import{a as te,b as A}from"/build/_shared/chunk-KUQT6XAG.js";import{a as j}from"/build/_shared/chunk-MCOI7644.js";import{a as ee}from"/build/_shared/chunk-OMBAEG72.js";import{a as q}from"/build/_shared/chunk-GNKJZRWJ.js";import{a as Z}from"/build/_shared/chunk-FQUJWE7P.js";import{a as Q,c as X}from"/build/_shared/chunk-HV4KZ4KM.js";import{c as Y}from"/build/_shared/chunk-Q6UAPYBM.js";import{a as J}from"/build/_shared/chunk-42ITEOR7.js";import{c as y}from"/build/_shared/chunk-PE2RAMGK.js";import{a as L}from"/build/_shared/chunk-NUNS6FJ7.js";import{a as $}from"/build/_shared/chunk-RZLDKGLN.js";import{a as V}from"/build/_shared/chunk-UXJUA2QE.js";import{a as S}from"/build/_shared/chunk-ZZB7OGT7.js";import{b as C}from"/build/_shared/chunk-V53WT573.js";import{a as W}from"/build/_shared/chunk-YUUKFOQM.js";import{a as M}from"/build/_shared/chunk-DEVQKMWM.js";import{u as G,w as K}from"/build/_shared/chunk-L4FEFM7G.js";import{a as w}from"/build/_shared/chunk-5OBEDPFR.js";import{a as ie}from"/build/_shared/chunk-H6S7FWVP.js";import{d as b}from"/build/_shared/chunk-T36URGAI.js";var o=b(ie());var i=b(w()),_=({planName:g,planPrice:l,onRemove:c})=>{let{trackUserInteraction:t}=y();return(0,i.jsx)("div",{className:"border border-grey-2 rounded bg-site-background p-4",children:(0,i.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[(0,i.jsx)(V,{className:"text-sm text-default-text-colour",children:"Purchase Protection"}),c&&(0,i.jsx)("button",{type:"button",onClick:()=>{c&&c(),t({section:"product_protection",action:"deselect",value:Z(g)})},className:"text-sm text-default-text-colour bg-grey-2 px-3 py-1 rounded hover:bg-grey-3",children:"Remove"})]}),(0,i.jsxs)("p",{className:"text-sm font-bold text-default-text-colour",children:[g,l&&` - ${l}`]})]})})};var e=b(w()),Ae=({isSubscriptionAdd:g,hideMiniBag:l})=>{var H;let{setLastAddedSKUs:c,lastAddedLines:t}=(0,o.useContext)(Q),{translate:d}=W(),[oe,ae]=(0,o.useState)(!1),ne=q(),{isQuickAddOpen:re}=(0,o.useContext)(X),{cart:a}=(0,o.useContext)(J),m=(0,o.useContext)(M),N=G("root"),k=N==null?void 0:N.deliveryThresholdBanner,{user:U}=(0,o.useContext)($),x=K(),p=(H=x.data)==null?void 0:H.customer,z=!U||U.guest,h=k&&a,P=(0,o.useMemo)(()=>{var v,F;let r=(v=t==null?void 0:t[0])==null?void 0:v.id;return!r||!(a!=null&&a.lineItems)?null:(F=a.lineItems.find(I=>(I==null?void 0:I.id)===r))!=null?F:null},[t,a==null?void 0:a.lineItems]),u=P==null?void 0:P.insuranceQuote,s=u==null?void 0:u.selectedCoverProduct,T=(u==null?void 0:u.optIn)===!0&&!!s,R=(s==null?void 0:s.title)||"Protection Plan",D=te(s==null?void 0:s.price),{trackUserInteraction:f}=y(),n=(0,o.useCallback)(()=>{c(void 0)},[c]),B=(0,o.useCallback)(()=>{f({section:"mini_bag",action:"close"}),n()},[f,n]),O=(0,o.useCallback)(()=>{f({section:"mini_bag",action:"click",label:"continue_shopping"}),n()},[f,n]);(0,o.useEffect)(()=>{if(t!=null&&t.length&&!l){let r=setTimeout(()=>{n()},7e3);return()=>{clearTimeout(r)}}},[t,l,n]),(0,o.useEffect)(()=>{h&&!z&&x.state==="idle"&&!x.data&&x.load("/_api/customer/getCustomer")},[x,h,z]),(0,o.useEffect)(()=>ae(typeof document!="undefined"),[]);let E=(0,o.useCallback)(()=>{f({section:"mini_bag",action:"click",label:"view_bag"}),n()},[f,n]);return g?(n(),null):!oe||re||g||l?null:ne.width>768?(0,e.jsx)("div",{children:(0,e.jsx)(ee,{isOpen:!!(t!=null&&t.length),onClose:B,lockBodyScroll:!0,gradientEdge:!0,dimBackground:!0,closeButton:!0,backgroundClassName:"!z-[99]",align:"RIGHT",height:"100vh",top:0,panelClassName:"!max-w-[500px]",panelContentClassName:"overflow-hidden overflow-y-auto md:border-r-0 md:border-t-0 border-r border-t border-gray-200 bg-site-background",containerClassName:"!z-[100]",testId:"added-to-cart",children:t&&(0,e.jsxs)("div",{children:[(0,e.jsx)(L,{as:"h2",className:"text-3xl pt-10 px-10 pb-10 w-[450px]",children:d("addToCartPanel.addedToBag")}),t.map((r,v)=>(0,e.jsx)("div",{className:"mx-10 my-6",children:(0,e.jsx)(j,{lineItem:r,containerClass:"flex flex-row gap-5 relative"})},v)),h&&(0,e.jsx)("div",{className:"px-5 py-4 mx-5",children:(0,e.jsx)(A,{bannerData:k,cart:a,isPremierCustomer:(p==null?void 0:p.isPremierAccountActive)||!1,locale:m==null?void 0:m.locale})}),(0,e.jsxs)("div",{className:`flex flex-col gap-2 items-center justify-center ${T?"":"mb-5"}`,children:[(0,e.jsxs)("div",{className:"w-full px-10",children:[T&&(0,e.jsx)("div",{className:"flex justify-end",children:(0,e.jsx)("div",{className:"w-2/3 mb-4",children:(0,e.jsx)(_,{planName:R,planPrice:D})})}),(0,e.jsx)(C,{variant:"secondary",className:"w-full p-4 h-[50px] align-center justify-center",onClick:O,"data-test-id":"added-to-cart-continue-btn",children:d("addToCartPanel.continueShopping")})]}),(0,e.jsx)(S,{to:"/basket",className:"w-full px-10",children:(0,e.jsx)(C,{variant:"primary",className:"w-full p-4 h-[50px] align-center justify-center",onClick:E,"data-test-id":"added-to-cart-view-bag-btn",children:d("addToCartPanel.viewBag")})})]})]})})}):(0,e.jsx)(Y,{className:"flex items-end justify-center w-screen",containerClassName:"grow bg-site-background w-auto flex flex-col justify-center relative w-screen",backgroundClick:B,show:!!(t!=null&&t.length),onClose:B,title:"Added to Bag",testId:"added-to-cart",children:t!=null&&t.filter?(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"flex flex-col gap-6 max-h-96 overflow-scroll",children:t.map((r,v)=>(0,e.jsx)("div",{className:"min-w-[325px]",children:(0,e.jsx)(j,{lineItem:r})},v))}),h&&(0,e.jsx)("div",{className:"p-4",children:(0,e.jsx)(A,{bannerData:k,cart:a,isPremierCustomer:(p==null?void 0:p.isPremierAccountActive)||!1,locale:m==null?void 0:m.locale})}),(0,e.jsxs)("div",{className:"flex flex-col gap-2 items-center justify-between mb-5",children:[T&&(0,e.jsx)("div",{className:"w-full px-4 mb-4 flex justify-end",children:(0,e.jsx)("div",{className:"w-2/3 mb-4",children:(0,e.jsx)(_,{planName:R,planPrice:D})})}),(0,e.jsx)("div",{className:"w-full px-4",children:(0,e.jsx)(C,{variant:"secondary",className:"text-s w-full p-4 h-[50px] align-center justify-center",onClick:O,"data-test-id":"added-to-cart-continue-btn",children:d("addToCartPanel.continueShopping")})}),(0,e.jsx)(S,{to:"/basket",className:"w-full px-4",children:(0,e.jsx)(C,{variant:"primary",className:"text-s w-full p-4 h-[50px] align-center justify-center",onClick:E,"data-test-id":"added-to-cart-view-bag-btn",children:d("addToCartPanel.viewBag")})})]})]}):(0,e.jsx)(e.Fragment,{})})};export{_ as a,Ae as b};
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.