PageSourceSearch

https://www.costco.ca/consumer-web/browse/prd/homepage-cabc/_next/static/chunks/7846-32f12916d2408fe5.js

js costco.ca collected 2026-09-24 08:50:59 UTC 113,203 bytes, 95 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7846],{8854:(e,t,l)=>{l.d(t,{Z0:()=>s});var r=l(6776),n=l(96736),i=l(36370),o=l(24386),a=l(23825);let s={Box:i.a,Location:o.a,LocationPinFilled:a.H,Truck:r.default,Warehouse:n.A}},10634:(e,t,l)=>{l.d(t,{OrderNavVisibilityToggle:()=>i});var r=l(95155),n=l(53236);let i=({showLinks:e,showProgramTypeSurcharge:t,children:l})=>{let{isMobile:i}=(0,n.G)();return t||e&&!i?(0,r.jsx)(r.Fragment,{children:l}):null}},11613:(e,t,l)=>{l.d(t,{WarehouseSelectorData:()=>O});var r=l(95155),n=l(2741),i=l(5233),o=l(64657),a=l(7569),s=l(34462),d=l(66775),u=l(20974),c=l(46759),p=l(16002),v=l(12115),g=l(71706),h=l(75699),f=l(70985);let x=e=>(0,r.jsx)(f.K,{...e,variant:"drawer",listType:e.drawerType});x.displayName="WarehouseDrawer";var y=l(51563),m=l(34971),b=l(90830),w=l(68889),S=l(83049);let C="20px";var T=l(86670),I=l(23462),j=l(24386),L=l(96736);let M=(0,T.default)("div")`
2    display: flex;
3    flex-direction: column;
4    flex-wrap: nowrap;
5    text-wrap: wrap;
6`,A=(0,I.AH)`
7    height: ${C};
8    width: ${C};
9`,k=(0,T.default)(j.a)`
10    ${A}
11`,z=(0,T.default)(L.Y)`
12    ${A}
13`,E={COMPOSABLE_DATA_ICON_TITLE:"",COMPOSABLE_DATA_MY_WAREHOUSE:"",COMPOSABLE_DATA_SET_MY_WAREHOUSE:"",COMPOSABLE_DATA_CHANGE_MY_WAREHOUSE:""};function $({displayOpenHours:e,moduleSettings:t,preferredWarehouse:l,onClick:n,showLabel:i,drawerType:o="FMW",stockStatusData:a,analyticsIdentifier:s,locale:d="en-us"}){var u,c;let[p,g]=(0,v.useState)(!1),[h,f]=(0,v.useState)(!0),x=(0,v.useRef)(null);(0,v.useEffect)(()=>{g(!0)},[]);let C="CMW"===o,T=e&&p&&l&&l.hours;(0,v.useEffect)(()=>(x.current&&clearTimeout(x.current),f(!0),x.current=setTimeout(()=>{f(!!(null==l?void 0:l.hours)),x.current&&clearTimeout(x.current)},3e3),()=>{x.current&&clearTimeout(x.current)}),[x,l]);let I=(0,y.Wc)({moduleSettings:t,onClick:n,drawerType:o,...C?{stockStatusData:a}:{}});return(null==I?void 0:I.length)>0?(console.error(`Missing props: ${I}`),null):(t.composable_window.forEach(e=>E[e.text_only.development_field_key]=e.text_only.body),(0,r.jsxs)(M,{"data-testid":"WarehouseSelectorUI",children:[(0,r.jsx)(b.Analytics,{analyticData:{component:{type:"ui"},trackType:"navigation"},children:(0,r.jsx)(w.x,{isCMW:C,ariaLabel:l?`${null==(u=l.name)?void 0:u[0].value}, ${E.warehouseAriaLabelSuffix}`:"",value:l?null==(c=l.name)?void 0:c[0].value:C?E.changeMyWarehouse:E.setMyWarehouse,Icon:C?z:k,iconTitle:C?E.warehouseIconTitle:void 0,label:E.myWarehouse,onClick:n,showLabel:i,stockStatusData:a,analyticsIdentifier:s,uniqueId:"WarehouseSelector"})}),!C&&e&&h&&(0,r.jsx)(r.Fragment,{children:T?(0,r.jsx)(S.K,{messages:(null==t?void 0:t.composable_window)||[],holidays:l.holidays,hours:l.hours,locale:d,sx:{paddingLeft:"20px"},timeZone:l.timeZone,variant:"t7"}):(0,r.jsx)(m.Skeleton,{height:"18px",width:"120px",sx:{marginLeft:"20px"}})})]}))}var D=l(94571),_=l(3974),P=l(19841),B=l(16099),R=l(89871);let O=(0,v.forwardRef)(({analyticsIdentifier:e,batchServiceConfig:t,childItemNumber:l,displayOpenHours:f,drawerType:y="FMW",enabledWarehouseListConfigs:m,featureConfigs:b,hideLabelWhenGRSEnabled:w,isGRSBetaReleaseFeatureFlagEnabled:S,isGRSPhasedReleaseFeatureFlagEnabled:C,isGRSFeatureFlagEnabled:T,locale:I,moduleSettings:j,pageName:L,productFlags:M,productImageData:A,stockStatusData:k,useFmwDrawerQueryParam:z,invokeSalesLocationsAPI:E=!1},O)=>
13{var N,F;let[q,W]=(0,v.useState)(!1),{queryParams:G,updateQueryParams:U}=(0,o.useQueryParams)(),V=G.get(c.T3),K="CMW"===y,H="FMW"===y,Z=H&&z?"true"===V:q,J=(0,v.useCallback)(()=>{H?U({[c.T3]:"true"},{replace:!0}):W(!0)},[H,U]);(0,v.useImperativeHandle)(O,()=>({openDrawer:J}),[J]);let Q=(0,R.p)(),[X,Y]=(0,v.useState)(void 0),[ee,et]=(0,v.useState)([]),[el,er]=(0,_.M)(i.ce,void 0),en=(null==el?void 0:el.fromProfileApi)?el:void 0,ei=(0,v.useRef)(void 0),eo=(0,v.useRef)(new Map),ea=(0,v.useRef)(void 0),es=(0,v.useRef)(!1),ed=(0,v.useRef)(!1),eu=(0,B.Z)({isGRSFeatureFlagEnabled:T,isGRSBetaReleaseFeatureFlagEnabled:S,isGRSPhasedReleaseFeatureFlagEnabled:C}),{agent:ec}=(0,a.useAgent)(),{isInitialized:ep,preferredTerritory:ev,profileLocation:eg,userLocation:eh,warehouse:ef}=(0,g.B)(),{stwMyWarehouse:ex,stwPostalCode:ey,updateStwInfo:em}=(0,d.P)(),eb=j.properties[0],ew=null==(N=u.x[I])?void 0:N.validationSchema,eS=(0,P.z)(eb.defaultLocation.latitude,eb.defaultLocation.longitude,ew,!!(ey&&K)),eC=!(eu===n.Q7.GRS&&w),eT=(0,v.useCallback)(()=>{em({stwMyWarehouse:void 0,stwPostalCode:void 0},{updateState:!1})},[em]);(0,v.useEffect)(()=>{!async function(){ec&&eS&&et(await (0,D.o4)({agent:ec,locale:I,location:eS,invokeSalesLocationsAPI:E}).then(e=>e.filter(e=>(0,D.AJ)(e,E))))}()},[ec,eS,I,E]),(0,v.useEffect)(()=>{if(K)return window.addEventListener("beforeunload",eT),()=>{window.removeEventListener("beforeunload",eT)}},[K,ex,ey,em,eT]),(0,v.useEffect)(()=>{if(K){if(!es.current){es.current=!0;return}em({stwMyWarehouse:void 0,stwPostalCode:void 0})}},[K,null==(F=ef.nearestWarehouse)?void 0:F.catalog]),(0,v.useEffect)(()=>{let e=!0;return(async()=>{var t,l,r,n,i,o,a;if(!ec||!eS||!ee.length||eg.isLoading||ed.current)return;if(K&&ex){let e=ee.find(e=>e.warehouseId===ex);if(e){let t=e.warehouseId;if(ei.current===t)return;Y(l=>(null==l?void 0:l.warehouseId)===t?l:e),ei.current=t;return}}let d=(null==en?void 0:en.id)?(0,p.OT)(en.id):void 0,u=h.uC.read(),c=(0,p.OT)(null==(t=null==u?void 0:u.nearestWarehouse)?void 0:t.catalog),v=(0,p.OT)(ee[0]),g=d||c||v;if(ea.current===c&&ei.current===g)return;ea.current=c;let f=ee.find(e=>e.warehouseId===g);if(!f){let t=`${I}|${E}|${g}`;if(eo.current.has(t))f=eo.current.get(t);else{let l=await (0,D.iN)({agent:ec,locale:I,warehouseId:g,invokeSalesLocationsAPI:E});if(f=l&&(0,D.AJ)(l,E)?l:void 0,eo.current.set(t,f),!e)return}}if(!f)return s.v.warn(`Failed to resolve warehouse from profile: ${g} is not in the warehouse list and could not be fetched by id`);let x=f.warehouseId;ei.current!==x&&(Y(e=>(null==e?void 0:e.warehouseId)===x?e:f),ei.current=x);let m=null==(l=f.address)?void 0:l.countryName,b=null==(r=f.address)?void 0:r.territory;if(g!==c){ed.current=!0;try{await Q({city:null==(i=null==(n=f.name)?void 0:n[0])?void 0:i.value,countryCode:m,postalCode:null==(o=f.address)?void 0:o.postalCode,territory:b,warehouseId:f.warehouseId,warehouseDrawer:y,shouldUpdateCookies:!0})}finally{ed.current=!1}}else{en&&er((0,D.SM)(f.warehouseId,null==(a=f.address)?void 0:a.postalCode));let e=null==ev?void 0:ev.value,t=`${m}${b}`;m&&b&&e!==t&&(null==ev?void 0:ev.updatePreferredTerritory)&&ev.updatePreferredTerritory(t)}})(),()=>{e=!1}},[ec,eg.isLoading,eS,ee,el,ex,K,E,I]),(0,v.useEffect)(()=>{(async()=>{var e;if(ep&&!eg.isLoading&&!K){if(!eh.zip&&(null==en?void 0:en.postalCode)||"true"!==h.Fy.storeLocCookieExpResetFlag()){let e=(null==en?void 0:en.postalCode)??eh.zip??"",t=(null==en?void 0:en.city)??eh.city;eh.updateUserLocation({city:t,zip:e})}(null==en?void 0:en.id)&&(0,p.OT)(null==(e=ef.nearestWarehouse)?void 0:e.catalog)!==(0,p.OT)(en.id)&&ef.updateWarehouse({nearestWarehouse:{...ef.nearestWarehouse,catalog:en.id}})}})()},[null==el?void 0:el.id,null==el?void 0:el.postalCode,null==el?void 0:el.fromProfileApi,K,ep,eg.isLoading,eh,ef]);let eI=eg.isLoading?void 0:X;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)($,{displayOpenHours:f,moduleSettings:j,onClick:J,preferredWarehouse:eI,showLabel:eC,drawerType:y,stockStatusData:k,analyticsIdentifier:e,locale:I}),(0,r.jsx)(x,{...K?{drawerType:"CMW",childItemNumber:l,productImageData:A,productFlags:M,batchServiceConfig:t,featureConfigs:b,enabledWarehouseList
13Configs:m,analyticsIdentifier:e}:{invokeSalesLocationsAPI:E,isGasPricesEnabled:!0,drawerType:"FMW"},isOpen:Z,locale:I,moduleSettings:j,onClose:()=>{H?U({[c.T3]:null},{replace:!0}):W(!1)},pageName:L})]})});O.displayName="WarehouseSelectorData"},25869:(e,t,l)=>{l.r(t),l.d(t,{default:()=>r});let r=(0,l(33757).default)()},30857:(e,t,l)=>{l.r(t),l.d(t,{HomePageLink:()=>s});var r=l(95155),n=l(3187),i=l(90830),o=l(12004);let a={display:"flex",height:{lg:50,md:36,xs:32},maxWidth:{lg:271,md:190,xs:120},minWidth:{lg:170,md:122,xs:108}},s=({altText:e,href:t,src:l,adobeSrc:s,uniqueId:d})=>(0,r.jsx)(i.Analytics,{analyticData:{component:{identifier:"logo",trackedData:[e],type:"nav"},trackType:"navigation"},children:(0,r.jsx)(n.Link,{href:t,underline:"none",uniqueId:`homepagelink_${d}`,children:(0,r.jsx)(o.default,{imageAltText:e,loadingStrategy:"lazy",brandFolderAssets:l,adobeAssets:s,sx:a})})});s.displayName="HomePageLink"},40321:(e,t,l)=>{l.d(t,{TranscendSyncClient:()=>d});var r=l(34641),n=l(12115),i=l(59509),o=l(40336),a=l(3974),s=l(39007);function d({transcendSyncExpiryTimeInMins:e}){let{isUserSignedIn:t,isLoading:l,transcendEmailFeatureFlag:u}=(0,o.A)(),[c]=(0,s.F)(r.nP),[p,v]=(0,a.M)(r.se),g=(0,n.useRef)(!1);return(0,n.useEffect)(()=>{var r;let n=()=>{if("number"!=typeof e||Number.isNaN(e)||e<=0||null==p)return!1;let t=Number(p);return!Number.isNaN(t)&&Date.now()-t<60*e*1e3},o=()=>{g.current||(window.transcendSyncCompleted=!0,window.dispatchEvent(new CustomEvent("transcendSyncCompleted")),g.current=!0)},a=async()=>{var e;let l=await t(),r=l&&c&&"function"==typeof(null==(e=null==window?void 0:window.airgap)?void 0:e.sync)&&!n(),a=!l||!u||l&&n();r?(await (0,i.M)({auth:c}),v(String(Date.now())),o()):a&&o()},s=()=>{l||a().catch(()=>void 0)};return!g.current&&(null==(r=null==window?void 0:window.airgap)?void 0:r.initialized)&&s(),window.addEventListener("airgapLoadEventReady",s),()=>{window.removeEventListener("airgapLoadEventReady",s)}},[l,t,v,c,u,p,e]),null}},47163:(e,t,l)=>{l.d(t,{default:()=>h});var r=l(12115),n=l(29722),i=l(34449),o=l(97335),a=l(13547),s=l(66543),d=l(24819),u=l(67811),c=l(95155);let p=(0,u.A)(),v=(0,d.A)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:l}=e;return[t.root,t[`maxWidth${(0,a.A)(String(l.maxWidth))}`],l.fixed&&t.fixed,l.disableGutters&&t.disableGutters]}}),g=e=>(0,s.default)({props:e,name:"MuiContainer",defaultTheme:p});function h(e={}){let{createStyledComponent:t=v,useThemeProps:l=g,componentName:s="MuiContainer"}=e,d=t(({theme:e,ownerState:t})=>({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",...!t.disableGutters&&{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}}),({theme:e,ownerState:t})=>t.fixed&&Object.keys(e.breakpoints.values).reduce((t,l)=>{let r=e.breakpoints.values[l];return 0!==r&&(t[e.breakpoints.up(l)]={maxWidth:`${r}${e.breakpoints.unit}`}),t},{}),({theme:e,ownerState:t})=>({..."xs"===t.maxWidth&&{[e.breakpoints.up("xs")]:{maxWidth:Math.max(e.breakpoints.values.xs,444)}},...t.maxWidth&&"xs"!==t.maxWidth&&{[e.breakpoints.up(t.maxWidth)]:{maxWidth:`${e.breakpoints.values[t.maxWidth]}${e.breakpoints.unit}`}}}));return r.forwardRef(function(e,t){let r=l(e),{className:u,component:p="div",disableGutters:v=!1,fixed:g=!1,maxWidth:h="lg",classes:f,...x}=r,y={...r,component:p,disableGutters:v,fixed:g,maxWidth:h},m=((e,t)=>{let{classes:l,fixed:r,disableGutters:n,maxWidth:s}=e,d={root:["root",s&&`maxWidth${(0,a.A)(String(s))}`,r&&"fixed",n&&"disableGutters"]};return(0,o.A)(d,e=>(0,i.Ay)(t,e),l)})(y,s);return(0,c.jsx)(d,{as:p,ownerState:y,className:(0,n.A)(m.root,u),ref:t,...x})})}},50366:(e,t,l)=>{l.d(t,{ShopMenuCategoryComposer:()=>p});var r=l(95155),n=l(64835),i=l(12115),o=l(84102),a=l(24880),s=l(64290),d=l(25719),u=l(53236),c=l(33423);let p=e=>{var t,l;let{trackEvent:p}=(0,c.z)(),{isDesktop:v}=(0,u.G)(),{adobeAssetsFeatureToggle:g}=(0,n.D)();return(null==(t=e.shopMenu)?void 0:t.length)?(0,r.jsx)(d.CostcoBox,{"data-testid":"ShopMenuCategoryComposer",sx:{display:"flex",flexDirection:"column",gap:2,width:"100%"},children:null==(l=e.shopMenu)?void 0:l.map((e,t)=>{var l,n,u;if("banner"in e&&e.banner.image){let{banner:t}=e,l=(0,s.C0)(t.image,t.image_adobe,g);return(0,r.jsx)(i.Fragment,{children:Array.isArray(l)&&l.map(e=>(0,r.jsx)("a",{onClick:()=>{var e,l;return e=t.link.href,l=t.alt_text,void p({adItem:{isExternal:t.external_site_warning,style:"banner",title:l,type:"ad",url:e},component:void 0,itemCuration:"costco",position:"flyout",trackType:"ad"})},href:t.link.href,target:t.target??"_self",children:(0,r.jsx)("img",{style:{width:"100%"},alt:t.alt_text,loading:"lazy",src:e.url})},e.id))},t._metadata.uid)}if("markdown"in e){let t=e.markdown;return(0,r.jsx)(o.T,{markdown:t.markdown},t._metadata.uid)}return"ad_builder"in e?null==(l=e.ad_builder)?void 0:l.renderedAd:"segment_based_entry_block"in e?null==(n=e.segment_based_entry_block)?void 0:n.component:v&&"program_card"in e?(0,r.jsx)(d.
13CostcoBox,{sx:{containerType:"inline-size",width:`${1/4*parseInt(a.v6q,10)-32}px`},children:null==(u=e.program_card)?void 0:u.component},`program_card_${t}`):void 0})}):null};p.displayName="ShopMenuCategoryComposer"},50753:(e,t,l)=>{l.d(t,{ShopMenuUI:()=>eX});var r=l(95155),n=l(2741),i=l(39922),o=l(7569),a=l(74662),s=l(51563),d=l(12115),u=l(89953),c=l(85915),p=l(10874),v=l(12158),g=l(24880),h=l(85740),f=l(90830),x=l(71706);let y="closeMenu",m="keyDown",b="openMenu",w="openState",S="updateMenuItems",C="updateState",T="updateMenuLoadingState",I="updateShowLoadingStateText",j="updateMenuChildren",L="keyboard",M="mouse",A="shop-menu-button",k="ShopMenu",z=`${k}-error: invalid props`;var E=l(44209),$=l(87358);let D=async(e,t)=>{let l,{timeout:r,disablecache:n,endpoint:i,required_request_headers:o,required_request_parameters:a}=e||{};if(!i)return console.warn("Shop menu:: Missing required service configuration for mega menu fetch"),null;let s=new URL(i),d="string"==typeof a.locale?a.locale:a.locale[t.substring(0,2)];a.loc&&"{distributionCenters}"!==a.loc&&"string"==typeof a.loc?s.searchParams.append("loc",a.loc):"{distributionCenters}"===a.loc?s.searchParams.append("loc","*"):s.searchParams.append("bypasslocation","1"),s.searchParams.append("locale",d),s.searchParams.append("chdmegamenu","true");let u=new AbortController,{signal:c}=u;r>0&&(l=setTimeout(()=>u.abort(),r));try{let e=await fetch(s.toString(),{headers:{...o,"Cache-Control":n?"no-cache":"max-age=86400000"},method:"GET",signal:r>0?c:void 0});if(!e.ok)throw Error(`Shop menu:: HTTP error! status: ${e.status}`);return await e.json()}catch(e){e instanceof Error&&"AbortError"===e.name?console.info("Shop menu:: Mega Menu Fetch Aborted"):console.error(e)}finally{r>0&&clearTimeout(l)}};(0,E.unstable_cache)(async(e,t)=>{let l=null;for(let r=0;r<2;r++)try{let n=await D(e,t);if((null==n?void 0:n.megaMenu)&&n.megaMenu.length>0)return n;console.warn(`Empty megaMenu received on attempt ${r+1}/2`),l=Error("cachedFetchMegaMenu: Empty megaMenu received!"),r<1&&await new Promise(e=>setTimeout(e,100))}catch(e){console.error(`cachedFetchMegaMenu: Error fetching megaMenu on attempt ${r+1}/2:`,e),l=e instanceof Error?e:Error(String(e)),r<1&&await new Promise(e=>setTimeout(e,100))}throw l||Error("Failed to fetch megaMenu after multiple attempts")},["megaMenu"],{revalidate:1800,tags:["megaMenu"]});let _=async(e,t)=>{var l;let r,{timeout:n,disablecache:i,endpoint:o,required_request_headers:a,required_request_parameters:s}=e,d=new URL(o);if(!t||!$.env.SITE)return null;"object"==typeof s.locale&&d.searchParams.append("locale",String(s.locale[t])),"object"==typeof s.clientId&&d.searchParams.append("clientId",String(s.clientId[$.env.SITE]));let u=new AbortController,{signal:c}=u;n>0&&(r=setTimeout(()=>u.abort(),n));try{let e=await fetch(d.toString(),{headers:{...a,"Cache-Control":i?"no-cache":"max-age=86400000"},method:"GET",signal:n>0?c:void 0});return(null==(l=await e.json())?void 0:l.rootCategories)||[]}catch(e){throw e instanceof Error&&"AbortError"===e.name?console.info("Shop menu:: Root level category Fetch Aborted"):console.error(e),Error("Failed to fetch root level categories")}finally{n>0&&clearTimeout(r)}};(0,E.unstable_cache)(async(e,t)=>{let l=null;for(let r=0;r<1;r++)try{let n=await _(e,t);if((null==n?void 0:n.length)>0)return n;console.warn(`Empty root level categories received on attempt ${r+1}/1`),l=Error("cachedFetchRootLevelCategories: Empty root level categories received!"),r<0&&await new Promise(e=>setTimeout(e,100))}catch(e){console.error(`cachedFetchRootLevelCategories: Error fetching root level categories on attempt ${r+1}/1:`,e),l=e instanceof Error?e:Error(String(e)),r<0&&await new Promise(e=>setTimeout(e,100))}throw l||Error("Failed to fetch grsLvl1Menu after multiple attempts")},["grsLvl1Menu"],{revalidate:1800,tags:["grsLvl1Menu"]});var P=l(27047),B=l(25719),R=l(53236),O=l(88932),N=l(16099),F=l(79176),q=l(43922),W=l(78388);let G={fullMenuItems:[],isAnyMenuLoading:!1,activeIndexes:[0],eventTriggerType:L,focusFlyout:!1,focusedItem:null,hasFlyout:!1,hasShopMenuCategory:!1,isOpen:!1,showLoadingMenuText:!1},U=(e,t)=>{let{type:l,payload:r}=t;switch(l){case w:return{...G,fullMenuItems:e.fullMenuItems,eventTriggerType:(null==r?void 0:r.eventTriggerType)||e.eventTriggerType,focusedItem:r.focusedItem||null,isOpen:r.isOpen};case C:return{...e,...r};case T:return{...e,isAnyMenuLoading:r.isAnyMenuLoading,showLoadingMenuText:r.showLoadingMenuText};case S:return{...e,fullMenuItems:r.fullMenuItems,isAnyMenuLoading:r.isAnyMenuLoading,showLoadingMenuText:r.showLoadingMenuText};case j:{if(!r||"object"!=typeof r)return e;let{keyToUpdate:t,subMenuItems:l}=r;if(void 0===t||void 0===l)return e;let n=structuredClone(e.fullMenuItems);return H(n,t,l),{...e,fullMenuItems:n,isAnyMenuLoading:r.isAnyMenuLoading,showLoadingMenuText:r.showLoadingMenuText}}case I:return{...e,showLoadingMenuText:r.showLoadingMenuText};default:return e}},V=(e,t)=>null==t?void 0:t.find(t=>{var l;return(null==(l=null==t?void 0:t.category_costco_url)?void 0:l.url)===(null==e?void 0:e.url)}),K=(e,t,l,r,n)=>{let{activeIndexes:i,focusedItem:o}=n,a=()=>i[l]===t,s=()=>{var r,n;return!!(!(l>0&&0===t)&&!(null==e?void 0:e.children)&&!(null==(n=null==(r=null==e?void 0:e.children)?void 0:r[0])?void 0:n.flyout))},d=()=>{var r;return(!(l>0)||0!==t)&&!!(null==(r=null==e?void 0:e.children)?void 0:r.length)};return{getHasChildren:d,getHasLoadableChildren:s,getHasChildrenVisible:()=>a()&&i.length-1>l,getHasFlyout:()=>{var n,i;return!!(0===l&&t>=r&&(null==(i=null==(n=null==e?void 0:e.children)?void 0:n[0])?void 0:i.flyout))},getIsChevronVisible:()=>
13l<2&&(d()||s()),getIsFocused:()=>(null==o?void 0:o.index)===t&&(null==o?void 0:o.level)===l,getIsItemActive:a,getLinkStyles:()=>a()?l>0&&0===t?{fontSize:g.x9N,fontWeight:g.Pqj}:{fontSize:g.tGh,fontWeight:g.Pqj}:l>0&&0===t?{fontSize:g.x9N}:{fontSize:g.tGh}}},H=(e,t,l)=>{let r=t.split(".");if(1===r.length){let t=r[0];if(Array.isArray(e)&&!isNaN(Number(t))){let r=e[Number(t)];r&&"children"in r&&(r.children=l)}else e[t]=l}else{let t,n=r.shift();(t=Array.isArray(e)&&!isNaN(Number(n))?e[Number(n)]:e[n])&&H(t,r.join("."),l)}},Z=async(e,t,l,r)=>{var n,i;let o,{locale:a,grsSubMenuApiServiceConfig:s,distributionCenters:d,site:u}=t,{fullMenuItems:c,activeIndexes:p}=e;if(!s)return void console.error("Shop menu:: GRS submenu service config is unavailable");let{timeout:v,disablecache:g,endpoint:h,required_request_headers:f}=s,x=p.slice(0,-1),y=x.reduce((e,t,l)=>{let r=e+(0===l?t:t-1);return r+".children"},""),m=JSON.parse(JSON.stringify(c));if(!r){H(m,y,[]),l({payload:{fullMenuItems:m,isAnyMenuLoading:!1,showLoadingMenuText:!1,activeIndexes:x,focusedItem:{level:x.length-1,index:x[x.length-1]}},type:C});return}let b=new AbortController,{signal:w}=b;v>0&&(o=setTimeout(()=>b.abort(),v));let S=null==h?void 0:h.replace("{CategoryId}",r);try{l({type:T,payload:{isAnyMenuLoading:!0,showLoadingMenuText:!1}});let e=await fetch(S.toString(),{headers:{...f,client_id:String((null==f?void 0:f.client_id)[u]),locale:String((null==f?void 0:f.locale)[a]),"Cache-Control":g?"no-cache":"max-age=86400000"},body:JSON.stringify({visitorId:W.tN,deliveryLocations:d}),method:"POST",signal:v>0?w:void 0});if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);let t=(null==(i=null==(n=await e.json())?void 0:n.categories)?void 0:i.map(e=>((null==e?void 0:e.children)&&(e.children=e.children.map(e=>({...e,slug:`/${e.slug}.html`}))),{...e,slug:`/${e.slug}.html`})))??[];H(m,y,t),l({payload:{isAnyMenuLoading:!1,showLoadingMenuText:!1,keyToUpdate:y,subMenuItems:t},type:j})}catch(e){e instanceof Error&&"AbortError"===e.name?console.info(`Submenu Fetch Aborted for categoryId: ${r}`):console.error(e),l({type:T,payload:{isAnyMenuLoading:!1,showLoadingMenuText:!1}})}finally{v>0&&clearTimeout(o)}},J=(e,t,l)=>{let r=e.slice(0,t+1);return r[t]=l,{activeIndexes:r}},Q=(e,t,l,r)=>{let n=[...e,l?0:-1];return l&&(r.preventDefault(),r.stopPropagation()),{activeIndexes:n,focusedItem:l?{index:0,level:t+1}:null}},X=(e,t,l,r,n,i)=>{let o=e.slice(0,e.length-1);if(i.preventDefault(),i.stopPropagation(),l){if(0===o.length)return r(l?"next":"current"),{...G,fullMenuItems:n};let e=o.length-1;o[e]===t[e]-1?o=[...X(o,t,l,r,n,i).activeIndexes]:o[o.length-1]+=1}if(0===o.length)return r(l?"next":"current"),{...G,fullMenuItems:n};let a=o.length-1,s={index:o[a],level:a};return{activeIndexes:o,focusedItem:s}},Y=(e,t)=>{let{activeIndexes:l,fullMenuItems:r}=e,n=t.event,i=t.hasShopMenuCategory,o=t.isAnyMenuLoading,a=t.isTablet,s=t.itemLevel,d=t.hoveredIndex,u=t.activeMenuItemsLength,c=t.focusParentElement,p={...e};return o&&0!==s&&d===u[s]-1?(n.preventDefault(),n.stopPropagation(),p={...e,showLoadingMenuText:!0}):(a&&0===s&&d===u[s]-1||(d===u[s]-1?(n.stopPropagation(),i&&0!==s||(p=X(l,u,!0,c,r,n))):(n.stopPropagation(),p=J(l,s,d+1))),p)},ee=async(e,t,l,r)=>{let{categoryId:n,hasFlyout:i,isChevronVisible:o,itemLevel:a,hasLoadableChildren:s,hoveredIndex:d}=t,u=t.event,{activeIndexes:c}=e,p=J(c,a,d);o&&(p=Q(p.activeIndexes,a,!1,u)),r({payload:{...p,hasFlyout:i,eventTriggerType:M},type:C}),o&&s&&l.grsSubMenuApiServiceConfig&&!i&&Z({...e,activeIndexes:p.activeIndexes},l,r,n)},et=async(e,t,l,r)=>{let n=t.isChevronVisible,i=t.itemLevel,o=t.hoveredIndex,a=t.activeIndexes,s=t.focusParentElement,d=t.event,u=t.hasLoadableChildren,{activeIndexes:c,fullMenuItems:p}=e,v={...e};"Tab"!==d.key||n||d.shiftKey||(v=Y(e,t)),d.shiftKey&&"Tab"===d.key&&(0===i&&0===o?(v={...G,fullMenuItems:e.fullMenuItems},d.preventDefault(),d.stopPropagation(),s("current")):v=0===o?X(c,a,!1,s,p,d):J(c,i,o-1)),"ArrowRight"===d.key&&n&&(v=Q(c,i,!0,d),u&&l.grsSubMenuApiServiceConfig&&Z({...e,activeIndexes:v.activeIndexes},l,r,t.categoryId)),("Escape"===d.key||"ArrowLeft"===d.key)&&(v=X(c,a,!1,s,p,d)),r({payload:{...v,eventTriggerType:L},type:C})},el=async(e,t,l,r)=>{let n=t.hasFlyout,i=t.itemLevel,o=t.activeIndexes,a=t.event,s=t.focusParentElement,d=t.hasLoadableChildren,{activeIndexes:u,fullMenuItems:c}=e,p={...e};"Tab"!==a.key||a.shiftKey||(p=Y(e,t)),("Enter"===a.key||"Space"===a.code)&&(p=Q(u,i,!0,a),n&&(p={...p,hasFlyout:n,focusFlyout:!0,focusedItem:null}),d&&l.grsSubMenuApiServiceConfig&&Z({...e,activeIndexes:p.activeIndexes},l,r,t.categoryId)),"Escape"===a.key&&(p=X(u,o,!1,s,c,a)),r({payload:{...p,eventTriggerType:L},type:C})},er=async(e,t,l,r)=>{let n=t.hasFlyout,i=t.hoveredIndex,o=t.itemLevel,a=t.event,{activeIndexes:s}=e,d={...e};d=Q(null==(d=J(s,o,i))?void 0:d.activeIndexes,o,!0,a),n&&(d={...d,hasFlyout:n,focusFlyout:!0,focusedItem:null}),t.hasLoadableChildren&&l.grsSubMenuApiServiceConfig&&Z({...e,activeIndexes:d.activeIndexes},l,r,t.categoryId),r({payload:{...d,eventTriggerType:M},type:C})},en=async(e,t,l,r)=>{let{itemLevel:n,hasFlyout:i,hoveredIndex:o}=t,a=t.event,{activeIndexes:s}=e,d={...e};a.preventDefault(),a.stopPropagation(),d=Q((d=J(s,n,o)).activeIndexes,n,!0,a),i&&(d={...d,hasFlyout:i,focusFlyout:!1,focusedItem:null}),t.hasLoadableChildren&&l.grsSubMenuApiServiceConfig&&Z({...e,activeIndexes:d.activeIndexes},l,r,t.categoryId),r({payload:{...d,eventTriggerType:M},type:C})},ei=(e,t,l)=>{let{fullMenuItems:r}=e,n=t.focusParentElement,i=t.event;("Tab"!==i.key||i.shiftKey)&&"Escape"!==i.key||(i.preventDefault(),i.stopPropagation(),n("Escape"===i.key?"current":"next"),l({payload:{...G,fullMenuItems:r},type:C}))},eo=(e,t,l)=>{let{fullMenuItems:r}=e,n=t.focusParentElement,i=t.event;i.preventDefault(),i.stopPropagation(),n("current"),l({payload:{...G,fullMenuItems:r},type:C})},ea={"&:focus":{backgroundColor:g.iCb},"&:hover":{backgroundColor:g.iCb},alignItems:"center",backgroundColor:g.iCb,border:0,borderRadius:0,color:g.DJJ,cursor:"pointer",display:"flex",padding:`${g.iAn} ${g.D3H} !important`,position:"relative"},es={marginLeft:g.m72},ed={height:"20px",width:"20px"},eu={alignItems:"flex-start",alignSelf:"stretch",display:"flex",flexDirection:"column",gap:g.Mzk,padding:{md:`0 ${g.Mzk} ${g.Mzk} ${g.Mzk}`,xs:`${g.Mzk} ${g.Mzk} 0 ${g.Mzk}`}}
13,ec={display:"flex",flex:"auto",marginLeft:{lg:`-${g.i_v}`,md:`-${g.Mzk}`},maxWidth:g.v6q,paddingInline:{lg:g.i_v,md:g.Mzk},position:"absolute",width:"100%",zIndex:101};var ep=l(50366);let ev=(0,d.forwardRef)(({children:e,width:t,ariaLabelText:l,onKeyDown:n,sx:i,hideIfAllChildDivsEmpty:o,setIsCategoryComposerFlyoutHidden:a,isCategoryComposerFlyoutHidden:s},u)=>{(0,d.useEffect)(()=>{if(o){let e=null==u?void 0:u.current;if(e){let t=Array.from(e.querySelectorAll("ul > li > div"));if(0===t.length)null==a||a(!1);else{let e=t.every(e=>{var t,l;return!(null==(t=null==e?void 0:e.textContent)?void 0:t.trim())&&(null==(l=null==e?void 0:e.children)?void 0:l.length)===0});null==a||a(e)}}}},[e,o,u,a]);let c=(null==i?void 0:i.display)||"flex";return o&&s&&(c="none"),(0,r.jsx)(B.CostcoBox,{"aria-labelledby":l,onKeyDown:n,ref:u,role:"region",sx:{...i,width:t,display:c},children:e})});ev.displayName="MegaMenuPopover";var eg=l(83637),eh=l(27966),ef=l(54309),ex=l(80061),ey=l(3187),em=l(43847),eb=l(98210);let ew={alignItems:"center",cursor:"pointer",display:"flex",justifyContent:"space-between",listStyle:"none",padding:`${g.iAn} ${g.Mzk}`},eS={"&:focus-visible":{borderRadius:"1px",outline:"2px solid -webkit-focus-ring-color"},color:g.hGW,flexGrow:1,textDecoration:"none",wordBreak:"break-word"},eC={"&:focus-visible":{borderRadius:"1px",outline:"2px solid -webkit-focus-ring-color"},padding:0},eT={"&:focus-visible":{outline:"none"},"&:hover":{textDecoration:"underline"},color:g.hGW,flexGrow:1,textDecoration:"none",wordBreak:"break-word"},eI={"&:focus-visible":{outline:"none"},"&:hover":{backgroundColor:"transparent"},padding:0},ej=e=>{let{onMouseEvent:t,onLinkKeyDown:l,onChevronKeyDown:n,onChevronClick:i,shopMenuLabel:o,listItemState:a,popoverMenuState:u,categoryUrlPath:c,dataPrivate:p,publishedCategories:v}=e,{isListItemFocus:h,textLinkStyle:f,linkName:x,linkURL:y,itemLevel:m,isChevronVisible:b,hasChildrenVisible:w,isKeyBoardEvent:S,isItemActive:C}=a,T=(0,d.useRef)(null),I=(0,d.useRef)(null);(0,d.useEffect)(()=>{var e,t;h&&(b&&document.activeElement!==T.current&&document.hasFocus()&&document.activeElement===document.body?null==(e=I.current)||e.focus():null==(t=T.current)||t.focus())},[b,h,u.focusedItem]);let j={...f,...C&&S?eS:eT};return(0,r.jsxs)(q.c,{sx:ew,uniqueId:`${m}_${x}`,children:[(0,r.jsx)(ey.Link,{dataPrivate:p,href:(0,s.IF)(c,y,v),onKeyDown:l,onMouseEnter:t,ref:T,sx:j,uniqueId:`${m}_${x}`,variant:"t6",children:x}),b&&(0,r.jsx)(em.K,{"aria-expanded":w,"aria-label":`${x} ${o}`,"data-testid":`${m}_${x}_icon`,ref:I,onClick:i,onKeyDown:n,sx:S&&C?eC:eI,children:(0,r.jsx)(eb.c,{sx:{fontSize:g.tGh},color:g.hGW,width:g.Mzk})})]})},eL={display:"flex",flex:"auto",flexDirection:"column"},eM=e=>{let{menuItems:t,itemLevel:l,popoverMenuState:n,dispatch:i,focusParentElement:o,activeMenuItemsLength:a,isTablet:s,shopMenuTranslations:u,hasShopMenuCategory:c,categoryUrlPath:v,locale:g,isMenuLoading:h,grsSubMenuApiServiceConfig:x,distributionCenters:y,visibleMenuItems:m,visitorId:b,site:w,publishedCategories:S}=e,{closebuttonlabel:C,arialabelmenu:T,loadingmenu:j,showLoadingMenuText:M}=u,{eventTriggerType:A,fullMenuItems:k,activeIndexes:z}=n,E=k.length,$=A===L;return(0,d.useEffect)(()=>{let e;return M?e=setTimeout(()=>{i({type:I,payload:{showLoadingMenuText:!1}})},200):e&&clearTimeout(e),()=>clearTimeout(e)},[i,M]),(0,r.jsxs)(F.B,{sx:eL,uniqueId:`listId-${l}`,variant:"SimpleList",children:[t.map((e,t)=>{let u,p,{getHasChildren:b,getHasLoadableChildren:C,getLinkStyles:I,getIsFocused:j,getIsChevronVisible:L,getHasChildrenVisible:M,getHasFlyout:A,getIsItemActive:k}=K(e,t,l,E,n),D=b(),_=C(),P=L(),B=M(),R=j(),O=I(),N=A(),F={hasChildrenVisible:B,isChevronVisible:P,isItemActive:k(),isKeyBoardEvent:$,isListItemFocus:R,itemLevel:l,linkName:(null==e?void 0:e.name)||(null==e?void 0:e.displayName),linkURL:(null==e?void 0:e.url)||(null==e?void 0:e.slug),listItemIndex:t,textLinkStyle:O},q=s&&D?[]:(u=z.slice(0,l+1),p=[],u.forEach((e,t)=>{var l,r;if(-1!==e){let n=(null==(l=m[t][e])?void 0:l.name)||(null==(r=m[t][e])?void 0:r.displayName);n&&p.push(n)}}),p),W=!!((null==e?void 0:e.leads_to_fsa_chdi)||(null==e?void 0:e.isCHDIEligible)||(null==e?void 0:e.isFSAEligible));return(0,r.jsxs)(d.Fragment,{children:[(0,r.jsx)(f.Analytics,{analyticData:{component:{trackedData:q},doNotTrack:W},children:(0,r.jsx)(ej,{dataPrivate:W,onChevronClick:r=>{er(n,{event:r,hasLoadableChildren:_,hasFlyout:N,hoveredIndex:t,itemLevel:l,categoryId:null==e?void 0:e.categoryId},{locale:g,grsSubMenuApiServiceConfig:x,distributionCenters:y,site:w},i)},onChevronKeyDown:r=>{el(n,{activeMenuItemsLength:a,event:r,focusParentElement:o,hasLoadableChildren:_,hasFlyout:N,hasShopMenuCategory:c,hoveredIndex:t,isTablet:s,itemLevel:l,isAnyMenuLoading:h,categoryId:null==e?void 0:e.categoryId},{locale:g,grsSubMenuApiServiceConfig:x,distributionCenters:y,site:w},i)},onLinkKeyDown:r=>{et(n,{activeMenuItemsLength:a,event:r,focusParentElement:o,hasLoadableChildren:_,hasShopMenuCategory:c,hoveredIndex:t,isChevronVisible:P,isTablet:s,itemLevel:l,isAnyMenuLoading:h,categoryId:null==e?void 0:e.categoryId},{locale:g,grsSubMenuApiServiceConfig:x,distributionCenters:y,site:w},i)},onMouseEvent:r=>{ee(n,{event:r,hasLoadableChildren:_,hasFlyout:N,hoveredIndex:t,isChevronVisible:P,itemLevel:l,categoryId:null==e?void 0:e.categoryId},{locale:g,grsSubMenuApiServiceConfig:x,distributionCenters:y,site:w},i)},categoryUrlPath:v,listItemState:F,popoverMenuState:n,shopMenuLabel:T,publishedCategories:S})},`${null==F?void 0:F.linkName}${l}${t}-analytics`),t===E-1&&s&&(0,r.jsx)(eg.default,{component:"li","data-testid":"Divider_MegaMenuPopoverList",sx:{marginY:"20px"},variant:"middle"})]},`${null==F?void 0:F.linkName}${l}${t}`)}),h&&(0,r.jsx)(ex.y,{label:`shopMenu_${l}_menuLoading`,size:"medium",isInline:!0}),(0,r.jsx)(eh.default,{sx:ef.A,"aria-live":"polite","aria-atomic":!0,role:"status",children:h&&M?j:""}),0===l&&s&&(0,r.jsx)(q.c,{sx:ew,uniqueId:"shopMenuCloseButton",children:(0,r.jsx)(p.Button,{onClick:e=>{eo(n,{event:e,focusParentElement:o},i)},onKeyDown:e=>{ei(n,{event:e,focusParentElement:o},i)},sx:{display:"flex",flex:"auto"},uniqueId:"shopMenuCloseButton",variant:"primary",children:C})})]})},eA="/costco-direct.html",ek=(e,t)=>`${null==e?void 0:e.replace(/[\s]|[^\w\s-]/g,"_")}_${t}`.toLowerCase(),ez=e=>{if(!e||!e.current)return{firstElement:null,lastElement:null};let t=e.current.querySelectorAll('a[href], button, input, select, textarea, area[href], iframe, object, embed, details, summary, audio[controls], video[controls], [contenteditable], [tabindex]:not
13([tabindex="-1"])');return{firstElement:t.length>0?t[0]:null,lastElement:t.length>0?t[t.length-1]:null}},eE={display:"flex",zIndex:101},e$={backgroundColor:g.DJJ,boxShadow:g.Q6v,display:"flex",float:"left",padding:`${g.Mzk} 0`},eD={backgroundColor:g.DJJ,boxShadow:g.Q6v,padding:g.i_v},e_=e=>{var t,l,n,i,o,a,s;let{isDesktop:u}=(0,R.G)(),{categoryUrlPath:c,dispatch:p,focusParentElement:v,shopMenuState:h,shopMenuTranslations:x,shopMenuCategories:y,isTablet:m,grsSubMenuApiServiceConfig:b,distributionCenters:S,locale:T,visibleMenuItems:I,visitorId:j,site:k,publishedCategories:z}=e,[E,$]=(0,d.useState)(!1),D=(0,d.useRef)(null),_=(0,d.useRef)(null),[P,O]=(0,d.useState)({firstElement:null,lastElement:null}),[N,W]=(0,d.useState)({firstElement:null,lastElement:null}),{activeIndexes:G,isOpen:U,hasFlyout:K,focusFlyout:H,fullMenuItems:Z,isAnyMenuLoading:J}=h;if((0,d.useEffect)(()=>{D.current&&O(ez(D)),_.current&&W(ez(_))},[D,_,G,E]),(0,d.useEffect)(()=>{var e;H&&(null==(e=null==P?void 0:P.firstElement)||e.focus())},[H,P]),!U||!Z)return null;let Q=I.map(e=>e.length),Y=V(Z[G[0]],y),ee=!!(G.length>1&&((null==(t=null==Y?void 0:Y.shop_menu)?void 0:t.length)??0)>0&&((null==(l=null==Y?void 0:Y.category_costco_url)?void 0:l.url)===eA&&u||(null==(n=null==Y?void 0:Y.category_costco_url)?void 0:n.url)!==eA)),et=ek(((null==(i=Z[G[0]])?void 0:i.name)||(null==(o=Z[G[0]])?void 0:o.displayName))??"",G.length-1),el=K?"100%":ee?`${25*G.length+25}%`:`${25*G.length}%`;return(0,r.jsxs)(B.CostcoBox,{onMouseLeave:()=>u&&p({payload:{eventTriggerType:M,isOpen:!1},type:w}),sx:{...eE,width:el},"data-testid":"PopoverMenu",children:[I.map((e,t)=>{var l,n,i;if(!(null==e?void 0:e.length)&&!J)return null;let o=0===t?A:ek(((null==(l=e[0])?void 0:l.name)||(null==(n=e[0])?void 0:n.displayName))??"",t-1);return 1===t&&K?(0,r.jsx)(ev,{onKeyDown:e=>((e,t,l,r)=>{let{firstElement:n,lastElement:i}=l,{activeIndexes:o,fullMenuItems:a}=e,{activeMenuItemsLength:s,focusParentElement:d}=t,u=null==t?void 0:t.event,{key:c,shiftKey:p,target:v}=u,g={...e};("Tab"===c&&p&&v===n||"Escape"===c||"ArrowLeft"===c)&&(g=X(o,s,!1,d,a,u)),"Tab"!==c||p||v!==i||(g=X(o,s,!0,d,a,u)),r({payload:{...g,eventTriggerType:L},type:C})})(h,{activeMenuItemsLength:Q,event:e,focusParentElement:v},P,p),ariaLabelText:o,ref:D,sx:eD,width:`${3/4*parseInt(g.v6q,10)}px`,children:(0,r.jsx)(d.Suspense,{children:null==(i=e[0])?void 0:i.flyout})},t):(0,r.jsx)(ev,{ariaLabelText:o,sx:e$,width:`${1/4*parseInt(g.v6q,10)}px`,children:(0,r.jsx)(eM,{hasShopMenuCategory:ee&&!E,activeMenuItemsLength:Q,categoryUrlPath:c,dispatch:p,focusParentElement:v,isTablet:m,itemLevel:t,menuItems:I[t],popoverMenuState:h,shopMenuTranslations:x,grsSubMenuApiServiceConfig:b,isMenuLoading:t===I.length-1&&J,distributionCenters:S,locale:T,visibleMenuItems:I,visitorId:j,site:k,publishedCategories:z})},t)}),Y&&ee&&(0,r.jsx)(ev,{onKeyDown:e=>{((e,t,l,r)=>{let{firstElement:n,lastElement:i}=l,{activeIndexes:o,fullMenuItems:a}=e,{activeMenuItemsLength:s,focusParentElement:d}=t,u=null==t?void 0:t.event,{key:c,shiftKey:p,target:v}=u,g={...e};"Escape"===u.key&&(g=X(o,s,!1,d,a,u)),"Tab"===c&&p&&v===n&&(u.preventDefault(),u.stopPropagation(),g={...g,focusedItem:{index:o[o.length-1],level:o.length-1}}),"Tab"!==c||p||v!==i||(g=X(o,s,!0,d,a,u)),r({payload:{...g,eventTriggerType:L},type:C})})(h,{activeMenuItemsLength:Q,event:e,focusParentElement:v},N,p)},ariaLabelText:et,ref:_,sx:e$,width:`${1/4*parseInt(g.v6q,10)}px`,hideIfAllChildDivsEmpty:!0,setIsCategoryComposerFlyoutHidden:$,isCategoryComposerFlyoutHidden:E,children:(0,r.jsx)(f.Analytics,{analyticData:{doNotTrack:null==(a=null==Y?void 0:Y.privacy_toggle)?void 0:a.disable_third_party_tracking,title:null==(s=null==Y?void 0:Y.category_costco_url)?void 0:s.title},children:(0,r.jsx)(F.B,{role:"presentation",sx:eL,uniqueId:`listId-${G.length}`,variant:"SimpleList",children:(0,r.jsx)(q.c,{role:"presentation",sx:eu,uniqueId:"ShopMenuCategoryComposer",children:(0,r.jsx)(ep.ShopMenuCategoryComposer,{shopMenu:null==Y?void 0:Y.shop_menu})})})})})]})};var eP=l(96185);let eB={float:"left",height:"fit-content",left:"50%",padding:{sm:`0 ${g.Mzk}`},position:"absolute",right:"50%",transform:"translate(-50%, 0)",width:"100%",zIndex:101},eR={".MuiGrid-root":{div:{a:{padding:`0 ${g.Mzk}`}},margin:0,padding:0},background:g.DJJ,zIndex:101},eO={alignItems:"flex-start",alignSelf:"stretch",background:g.DJJ,display:"flex",flexDirection:"column",margin:0,paddingTop:g.Mzk},eN={alignItems:"flex-start",alignSelf:"stretch",display:"flex",padding:`${g.D3H} ${g.Mzk}`},eF={alignItems:"stretch",overflow:"scroll",zIndex:99},eq={color:g.hGW,minWidth:"100%",textAlign:"start"},eW={...eq},eG={...eq,"&:active, &:focus, &:hover":{fontWeight:g.Pqj}},eU={...eq,"&:active, &:focus":{fontWeight:g.Pqj},fontSize:g.dSW,justifyContent:"flex-start",lineHeight:g.dG5,textDecoration:"none !important"},eV={color:g.hGW,fontSize:g.tGh},eK={alignItems:"flex-start",alignSelf:"stretch",display:"flex",flexDirection:"column",gap:g.Mzk,padding:g.Mzk},eH={alignSelf:"stretch",padding:`10px ${g.Mzk}`},eZ=(0,d.forwardRef)(({component:e="button",onClick:t,onKeyDown:l,text:n,href:i,isHighlighted:o=!1,ariaLabel:a,ariaExpanded:d,dataPrivate:u,chevronDirection:c="right",categoryUrlPath:
13h,publishedCategories:f},x)=>{let y;if(!n)return null;switch(e){case"link":y=(0,r.jsx)(ey.Link,{dataPrivate:u,href:(0,s.IF)(h,i,f),ref:x,sx:eG,uniqueId:n,variant:"t6",children:n});break;case"button":y=(0,r.jsxs)(p.Button,{sx:{...eU,gap:"left"===c?g.m72:g.iAn,justifyContent:"left"===c?"flex-start":"space-between"},"aria-expanded":d,"aria-label":a,onClick:t,ref:x,uniqueId:n,variant:"text-button",children:["left"===c&&(0,r.jsx)(eP.J,{height:"20px",sx:eV,width:"20px"}),n,"right"===c&&(0,r.jsx)(eb.c,{height:"20px",sx:eV,width:"20px"})]});break;case"text":y=(0,r.jsx)(v.Text,{component:"h2",sx:eW,uniqueId:n,variant:"t6",children:n})}return(0,r.jsx)(q.c,{sx:{...eN,background:o?g.XgP:"transparent"},onKeyDown:l,uniqueId:n,children:y})});eZ.displayName="ListItem";let eJ="PopoverMobile",eQ=({categoryUrlPath:e,dispatch:t,focusParentElement:l,shopMenuCategories:n,shopMenuTranslations:i,grsSubMenuApiServiceConfig:o,distributionCenters:a,shopMenuState:s,locale:u,visibleMenuItems:v,visitorId:g,site:h,publishedCategories:x})=>{var y,m,b;let{fullMenuItems:w,activeIndexes:S,isOpen:T,hasFlyout:j,isAnyMenuLoading:L,showLoadingMenuText:M}=s||{},A=(0,d.useRef)(null),k=(null==S?void 0:S.length)-1;if((0,d.useEffect)(()=>{var e;T&&(null==(e=A.current)||e.focus())},[T,L,k]),(0,d.useEffect)(()=>{let e;return M?e=setTimeout(()=>{t({type:I,payload:{showLoadingMenuText:!1}})},200):e&&clearTimeout(e),()=>clearTimeout(e)},[t,M]),!(null==w?void 0:w.length))return null;let{allprefix:z,alldepartments:E,arialabelbackto:$,arialabelmenu:D,closebuttonlabel:_,loadingmenu:P}=i,R=V(v[0][S[0]],n);return(0,r.jsxs)(B.CostcoBox,{"data-testid":eJ,sx:{display:T?"block":"none"},children:[(0,r.jsx)(B.CostcoBox,{sx:eB,children:(0,r.jsxs)(B.CostcoBox,{sx:eR,children:[(0,r.jsxs)(F.B,{sx:eO,uniqueId:eJ,variant:"SimpleList",children:[S.length>1&&S.map((e,n)=>{var i;let o=0===n?null:v[n-1][S[n-1]],a=0===n?E:(null==o?void 0:o.name)||(null==o?void 0:o.displayName),d=(0===n?v[n]:v[n].slice(1,null==(i=v[n])?void 0:i.length)).find(e=>{var t;return((null==(t=null==e?void 0:e.children)?void 0:t.length)||0)>0}),u=n===S.length-1,c=u&&d?"text":"button";return u&&!d?null:(0,r.jsx)(eZ,{onClick:e=>((e,t,l)=>{let{hoveredIndex:r}=t,{activeIndexes:n}=e,i=n.slice(0,r);l({payload:{activeIndexes:i=[...i,0]},type:C})})(s,{hoveredIndex:n},t),onKeyDown:e=>((e,t,l)=>{let{hoveredIndex:r}=t,{fullMenuItems:n}=e,i=t.event,o=t.focusParentElement;("Tab"===i.key&&i.shiftKey&&0===r||"Escape"===i.key)&&(i.preventDefault(),i.stopPropagation(),o("current"),l({payload:{...G,fullMenuItems:n},type:C}))})(s,{event:e,hoveredIndex:n,focusParentElement:l},t),ariaLabel:`${$} ${a} ${D}`,chevronDirection:"left",text:a,component:c,isHighlighted:"text"===c,publishedCategories:x},`navitem_${n}`)}),null==(y=null==v?void 0:v[k])?void 0:y.map((n,i)=>{let c,p,{getHasChildren:g,getHasLoadableChildren:y,getIsChevronVisible:m,getHasFlyout:b}=K(n,i,k,null==w?void 0:w.length,s),T=g(),I=y(),j=m(),L=b(),M=(c=S.slice(0,k+1),p=[],c.slice(0,-1).forEach((e,t)=>{var l,r;if(-1!==e){let n=(null==(l=v[t][e])?void 0:l.name)||(null==(r=v[t][e])?void 0:r.displayName);n&&p.push(n)}}),p),E=j||I?"button":"link",$=!!((null==n?void 0:n.leads_to_fsa_chdi)||(null==n?void 0:n.isCHDIEligible)||(null==n?void 0:n.isFSAEligible)),_=j||I?"#":(null==n?void 0:n.url)||(null==n?void 0:n.slug),P=(null==n?void 0:n.name)||(null==n?void 0:n.displayName),B=0!==k&&0===i?`${z} ${P}`:P,R=0===i?A:null,O=0===k&&T?[P,`${z} ${P}`]:0===k?[P]:[...M,B];return(0,r.jsxs)(d.Fragment,{children:[(0,r.jsx)(f.Analytics,{analyticData:{component:{identifier:"flyout",type:"nav",trackedData:O},trackType:"navigation",doNotTrack:$},children:(0,r.jsx)(eZ,{onClick:e=>en(s,{event:e,hasLoadableChildren:I,hasFlyout:L,hoveredIndex:i,itemLevel:k,categoryId:null==n?void 0:n.categoryId},{locale:u,grsSubMenuApiServiceConfig:o,distributionCenters:a,site:h},t),onKeyDown:e=>((e,t,l)=>{let{hoveredIndex:r,itemLevel:n}=t,{fullMenuItems:i}=e,o=t.event,a=t.focusParentElement;("Tab"===o.key&&o.shiftKey&&0===r&&0===n||"Escape"===o.key)&&(o.preventDefault(),o.stopPropagation(),a("current"),l({payload:{...G,fullMenuItems:i},type:C}))})(s,{event:e,hoveredIndex:i,itemLevel:k,focusParentElement:l,categoryId:null==n?void 0:n.categoryId},t),ariaExpanded:"false",ariaLabel:`${B} ${D}`,component:E,dataPrivate:$,href:_,ref:R,text:B,categoryUrlPath:e,publishedCategories:x})},B+`-${i}-analytics`),i===w.length-1&&(0,r.jsx)(eg.default,{sx:{alignSelf:"stretch",marginBottom:"20px",marginTop:"18px"},component:"li","data-testid":`Divider_${eJ}`,role:"",variant:"middle"})]},i)}),L&&(0,r.jsx)(ex.y,{label:`shopMenu_${k}_menuLoading`,size:"medium",isInline:!0}),(0,r.jsx)(eh.default,{sx:ef.A,"aria-live":"polite",role:"status",children:L&&M?P:""}),1===k&&j&&(0,r.jsx)(d.Suspense,{children:null==(m=v[1][0])?void 0:m.flyout}),0!==k&&(null==R?void 0:R.shop_menu)&&(0,r.jsx)(f.Analytics,{analyticData:{title:null==(b=null==R?void 0:R.category_costco_url)?void 0:b.title},children:(0,r.jsx)(q.c,{sx:eu,uniqueId:"ShopMenuCategoryComposer",children:(0,r.jsx)(ep.ShopMenuCategoryComposer,{shopMenu:R.shop_menu})})})]}),(0,r.jsx)(B.CostcoBox,{sx:eK,children:(0,r.jsx)(p.Button,{onKeyDown:e=>{ei(s,{event:e,focusParentElement:l},t)},onClick:e=>{eo(s,{event:e,focusParentElement:l},t)},sx:eH,uniqueId:"shopMenuCloseButton",children:_})})]})}),(0,r.jsx)(c.A,{"data-testid":`Backdrop_${eJ}`,onClick:e=>{eo(s,{event:e,focusParentElement:l},t)},open:T,sx:eF})]})},eX=({blueBarMenuItems:e,shopMenuCategories:t,categoryUrlPath:l,locale:C="en-us",lwMegamenuApiServiceConfig:T,grsSubMenuApiServiceConfig:I,rootLevelCategoriesApiServiceConfig:j,lwMenuItems:E,grsMenuItems:$,grsProviderBetaFeatureFlag:D,grsProviderFeatureFlagEnabled:F,grsProviderPhasedFeatureFlag:q,shopMenuTranslations:W,site:V,publishedCategories:K})=>{var H;let[Z,J]=(0,d.useState)(48),Q=(0,N.Z)({isGRSFeatureFlagEnabled:F,isGRSBetaReleaseFeatureFlagEnabled:D,isGRSPhasedReleaseFeatureFlagEnabled:q}),[X,Y]=(0,d.useReducer)(U,{...G,fullMenuItems:Q!==n.Q7.GRS?E:$}),{activeIndexes:ee,isOpen:et,hasFlyout:el,fullMenuItems:er=[]}=X;(0,d.useEffect)(()=>{Y({payload:{fullMenuItems:Q!==n.Q7.GRS?E:$},type:S})},[$,E,Q]);let{isMobile:en,isTablet:ei,isDesktop:eo}=(0,R.G)(),[eu,ep]=(0,d.useState)(!1);(0,d.useEffect)(()=>{"u">typeof window&&ep(!0)},[]);let ev=(0,d.useRef)(null),eg=(0,d.useRef)(null),{agent:eh}
13=(0,o.useAgent)(),{deliveryLocation:ef,warehouse:ex,bdWarehouseNumber:ey}=(0,x.B)(),em=(0,d.useMemo)(()=>{var e;return(0,a.T6)()?null==ey?void 0:ey.value:null==(e=null==ex?void 0:ex.nearestWarehouse)?void 0:e.catalog},[ey,ex]),{data:eb}=(0,O.z)(i.l,(0,s.GD)()),ew=null==ef?void 0:ef.state,eS=null==ef?void 0:ef.zipCode,{distributionCenters:eC,groceryCenters:eT,nearestWarehouse:eI}=ex,ej=(null==eI?void 0:eI.catalog)??"",eL=(0,a.T6)()?[null==ey?void 0:ey.value]:[...eC,...eT,ej].filter(e=>!!e),eM=`${eL}`,eA=(0,d.useCallback)((e,t)=>{switch(e){case b:en||ei||Y({payload:{eventTriggerType:M,isOpen:!0},type:w});break;case y:Y({payload:{isOpen:!1},type:w});break;case m:((null==t?void 0:t.key)==="Enter"||(null==t?void 0:t.code)==="Space")&&(t.target===ev.current&&t.preventDefault(),Y({payload:{eventTriggerType:L,isOpen:!0,focusedItem:{index:0,level:0}},type:w}))}},[en,ei]),ek=(0,d.useCallback)(e=>{var t,l,r,n,i,o,a,s,d;if("current"===e)null==(t=ev.current)||t.focus();else{let e=(null==(r=null==(l=ev.current)?void 0:l.parentElement)?void 0:r.nextSibling)?null==(i=null==(n=ev.current)?void 0:n.parentElement)?void 0:i.nextSibling:null==(s=null==(a=null==(o=ev.current)?void 0:o.parentElement)?void 0:a.parentElement)?void 0:s.nextSibling,t="function"==typeof(null==e?void 0:e.querySelectorAll)&&(null==e?void 0:e.querySelectorAll);if(t){let e=t('a[href], button, input, select, textarea, area[href], iframe, object, embed, details, summary, audio[controls], video[controls], [contenteditable], [tabindex]:not([tabindex="-1"])');null==(d=null==e?void 0:e[0])||d.focus()}}},[]);(0,d.useEffect)(()=>{let e=e=>{("Escape"===e.key||"Esc"===e.key)&&eA(y)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[eA]),(0,d.useEffect)(()=>{eh&&Q===n.Q7.LUCIDWORKS&&T&&(async()=>{var e;try{let t,l=!1;if((0,a.T6)()&&(null==ey?void 0:ey.value))t=null==ey?void 0:ey.value;else if((0,a.T6)()){let l=null==(e=null==T?void 0:T.required_request_parameters)?void 0:e.loc;t=`${l}`||null}else t=eM,l=0===eC.length;let r=await eh.getMegaMenu(T,t,l,C,ew,eS);Y({payload:{fullMenuItems:r.megaMenu},type:S})}catch(e){console.error("Shop menu:: Error fetching mega menu:",e)}})()},[T,eM,null==ey?void 0:ey.value,eh,C,ew,eS,Q,eC.length]),(0,d.useEffect)(()=>{Q===n.Q7.GRS&&j&&(null==$?void 0:$.length)===0&&(async()=>{try{let e=await _(j,C);(null==e?void 0:e.length)>0&&(e=e.map(e=>({...e,url:`${e.url}.html`}))||[]),Y({payload:{fullMenuItems:e},type:S})}catch(e){console.error("Shop menu:: Error fetching GRS sub menu items",e)}})()},[Q,j,C,null==$?void 0:$.length]),(0,d.useEffect)(()=>{var e;let t=new ResizeObserver(e=>{J(e[0].contentRect.height)}),l=null==(e=eg.current)?void 0:e.parentElement;return l&&t.observe(l),()=>{l&&t.unobserve(l)}},[null==(H=eg.current)?void 0:H.parentElement]);let ez=(0,d.useMemo)(()=>{let t=null==e?void 0:e.reduce((e,t)=>{var l;if(null==t?void 0:t.segmentBasedEntry){let n=null==t?void 0:t.segmentBasedEntry,i=null==(l=null==n?void 0:n.base_content_reference)?void 0:l[0],o=null==n?void 0:n.target_rules_block;if(eu){let l=(0,P.T6)(o,{warehouseId:em})||i;if(l){let r=null==t?void 0:t.flyoutEntryMap.find(({referencedEntry:e})=>(null==e?void 0:e.uid)===l.uid),n=null==r?void 0:r.flyoutOptions;n&&e.push(n)}}else e.push({name:"",url:"",leads_to_fsa_chdi:!1,flyout:(0,r.jsx)(u.A,{variant:"rectangular",height:32})})}else e.push(t);return e},[]);return((e,t,l)=>{var r;let n=[e];for(let e=1;e<t.length;e++){let i=t[e-1],o=n[e-1][i],a=(null==(r=n[e-1][t[e-1]])?void 0:r.children)??[];l?n[e]=[...a]:n[e]=[o,...a]}return n})(eo||!t?er??[]:[...er??[],...t],ee,el)},[ee,e,er,el,eo,em,eu]);if(Q===n.Q7.GRS&&!I||!er||!W||Q===n.Q7.LUCIDWORKS&&!T)return console.error(z),null;let{buttonStyles:eE,textStyles:e$,hamburgerStyles:eD,containerStyles:eP}={buttonStyles:{...ea,height:{lg:"auto",xs:"40px"},paddingLeft:{lg:"0px !important"},paddingTop:{lg:"10px !important"},width:{lg:"fit-content",xs:"fr-ca"===C?"135px":"91px"},zIndex:{lg:"98",xs:"0"},...{"&:after":{backgroundColor:et?g.d1D:"transparent",bottom:"-1px",content:"''",height:et&&"100vh",opacity:.3*!!et,position:"fixed"}}},containerStyles:{paddingRight:{lg:"5px",xs:"0px"}},hamburgerStyles:{...ed,marginBottom:{lg:0,xs:"3px"}},textStyles:{...es,fontSize:{lg:g.MkR,xs:g.x9N},fontWeight:{lg:g.Pqj,xs:g.awq}}},{shopbuttonlabel:eB}=W,eR=(0,r.jsx)(eQ,{categoryUrlPath:l,dispatch:Y,focusParentElement:ek,shopMenuCategories:t,shopMenuTranslations:W,grsSubMenuApiServiceConfig:I,distributionCenters:eL,shopMenuState:X,locale:C,visibleMenuItems:ez,visitorId:eb,site:V,publishedCategories:K});return(eo||ei)&&et&&(eR=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(e_,{categoryUrlPath:l,dispatch:Y,focusParentElement:ek,isTablet:ei,shopMenuCategories:t,shopMenuTranslations:W,grsSubMenuApiServiceConfig:I,distributionCenters:eL,shopMenuState:X,locale:C,visibleMenuItems:ez,visitorId:eb,site:V,publishedCategories:K}),(0,r.jsx)(c.A,{onClick:()=>eA(y),"data-testid":"shop-menu-backdrop",open:et,sx:{zIndex:99}})]})),(0,r.jsx)(f.Analytics,{analyticData:{component:{identifier:"flyout",type:"nav"},trackType:"navigation"},children:(0,r.jsxs)(B.CostcoBox,{"data-testid":k,ref:eg,sx:eP,children:[(0,r.jsxs)(p.Button,{onKeyDown:e=>eA(m,e),onMouseEnter:()=>eA(b),"aria-expanded":et,onClick:()=>{Y({payload:{eventTriggerType:M,isOpen:!et},type:w})},ref:ev,sx:eE,uniqueId:A,children:[(0,r.jsx)(h.U,{sx:eD}),(0,r.jsx)(v.Text,{color:"white",sx:e$,uniqueId:A,variant:"t5",children:eB}
13)]}),(0,r.jsx)(B.CostcoBox,{sx:en?{}:{...ec,...eo&&Z>0?{marginTop:`calc(${Z}px - ${g.rSY} + 6px)`}:{}},children:eR})]})})};eX.displayName=k},58886:(e,t,l)=>{l.d(t,{DeliveryLocationSelectorUI:()=>z});var r=l(95155),n=l(56224),i=l(2741),o=l(5233),a=l(82849),s=l(7569),d=l(74662),u=l(39530),c=l(34462),p=l(20974),v=l(83324),g=l(12115),h=l(10874),f=l(19216),x=l(90830),y=l(71706),m=l(50122),b=l(83669),w=l(68889),S=l(94571),C=l(40336),T=l(3974),I=l(16099),j=l(8854);let L=(e,t)=>{if(e&&"CA"===e&&t){let l=`${e}${t}`;a.A.set(n.eV,l,{expires:n.t4})}},M=(e,t=[],l)=>{if(!l||"CA"!==e)return;let r=t.includes(l).toString();a.A.set(n.GX,r,{expires:n.te})};var A=l(23696);let k=A.z.object({fetchExpirationLengthMs:A.z.number().optional(),defaultLocation:A.z.string().optional(),defaultState:A.z.string().optional(),reloadPageOnAutomaticLocationUpdate:A.z.boolean().optional(),reloadPageOnManualLocationUpdate:A.z.boolean().optional(),iconName:A.z.string().optional(),locale:A.z.enum(["en-us","en-ca","fr-ca"]),locationAriaLabelPrefix:A.z.string().optional(),locationAriaLabelSuffix:A.z.string().optional(),locationSelectorDefault:A.z.string(),locationSelectorLabel:A.z.string(),akamaiSnifferTooltip:A.z.object({delimiter:A.z.string(),message:A.z.string(),buttonAriaLabel:A.z.string()}).optional()}),z=e=>{var t,l,A,z,E,$,D,_,P,B,R,O,N,F,q,W,G;let U,{hideLabelWhenGRSEnabled:V,isGRSFeatureFlagEnabled:K,isGRSBetaReleaseFeatureFlagEnabled:H,isGRSPhasedReleaseFeatureFlagEnabled:Z,moduleSettings:J,siteSettings:Q,isBDPage:X,locale:Y,isReloadDisabled:ee=!1,warehouseSpecificDeliveryMethodUIOverridesMap:et}=e,{agent:el}=(0,s.useAgent)(),{getToken:er}=(0,C.A)(),{isInitialized:en,deliveryLocation:ei,bdDeliveryLocation:eo,bdWarehouseNumber:ea,profileLocation:es,warehouse:ed}=(0,y.B)(),[eu,ec]=(0,g.useState)(!1),[ep,ev]=(0,T.M)(o.rx,void 0),eg=a.A.get(m.pp),eh=(0,I.Z)({isGRSFeatureFlagEnabled:K,isGRSBetaReleaseFeatureFlagEnabled:H,isGRSPhasedReleaseFeatureFlagEnabled:Z}),ef=X||(0,d.T6)(),ex=ef?eo:ei;(0,d.T6)()&&(ex.zipCode=null==(l=null==(t=ex.zipCode)?void 0:t.replace)?void 0:l.call(t,"+"," "));let[ey,em]=(0,g.useState)(!1),eb=(null==Q?void 0:Q.groceryEligibleRegions)||[],ew=Y.split("-")[1].toUpperCase(),eS=J?(U=(null==(_=(D=J[0]).key_value)?void 0:_.reduce((e,t)=>(e[t.key]=t.value,e),{}))||{},{defaultLocation:null==(P=D.properties[0])?void 0:P.defaultLocation,defaultState:null==(B=D.properties[0])?void 0:B.defaultState,reloadPageOnAutomaticLocationUpdate:null==(R=D.properties[0])?void 0:R.reloadPageOnAutomaticLocationUpdate,reloadPageOnManualLocationUpdate:null==(O=D.properties[0])?void 0:O.reloadPageOnManualLocationUpdate,iconName:null==(F=null==(N=D.properties[0])?void 0:N.icons)?void 0:F.deliveryLocationIcon,akamaiSnifferTooltip:null==(W=null==(q=D.properties[0])?void 0:q.icons)?void 0:W.akamaiSnifferTooltip,locale:D.locale,locationAriaLabelPrefix:U.locationarialabelprefix,locationAriaLabelSuffix:U.locationarialabelsuffix,locationSelectorDefault:U.locationselectordefault,locationSelectorLabel:U.locationselectorlabel,fetchExpirationLengthMs:null==(G=D.properties[0])?void 0:G.fetchExpirationLengthMs}):{},eC=eS.reloadPageOnAutomaticLocationUpdate&&!ee,eT=eS.reloadPageOnManualLocationUpdate&&!ee,eI=null==(A=v.Nf[eS.locale])?void 0:A.validationSchema,ej=null==(z=p.x[eS.locale])?void 0:z.validationSchema,eL=({city:e,state:t,zipCode:l})=>{let r=t||eS.defaultState;ex.updateDeliveryLocation({city:e||"",state:r,zipCode:l})},eM=e=>{var t,l,r;let n=null==e?void 0:e.trim(),i=null==(r=null==(l=null==(t=null==el?void 0:el.getProfileAttributeService)?void 0:t.call(el))?void 0:l.custom_properties)?void 0:r.profileZip;if(n&&i)return(async()=>{try{let e=await er(!0);if(!e)return!1;let t=await (0,S.rA)(el,e,n);return t&&(0,S.D9)({zipExpiresAt:new Date(Date.now()+(0,S.jA)(el)).toISOString()}),t}catch(e){return c.v.error(e,"Error saving delivery location to profile"),!1}})()};(0,g.useEffect)(()=>{if(en&&el&&!es.isLoading){let e=async(e,t)=>{try{let l=await (null==el?void 0:el.getDistributionCenters(e,t));ed.updateWarehouse({...l})}catch(e){console.error(e)}},t=async()=>{var t;let l,r,i,o,s,c;if(!eI)return;let{warehouse:p,country:g,city:h,state:f,errors:x}=await (0,v.M5)(el,eI,{zipCode:ex.zipCode},{isBDPage:ef,onlyValidate:!0},Y);if(x){let t,n=a.A.get(u.ag);if(ep&&!ef){let{warehouse:e,city:n,state:a,country:d,errors:u}=await (0,v.M5)(el,eI,{zipCode:ep},{isBDPage:ef},Y);(t=u)||(l=n,r=a,i=ep,o=e,s=d)}else if(n&&!d.fu){let e=decodeURIComponent(n),{warehouse:a,city:d,country:u,postalCode:c,state:p,errors:g,errorConfig:h}=await (0,v.M5)(el,ej,{zipCode:e},{isBDPage:ef},Y);(t=g||h)||(l=d,r=p,i=c,o=a,s=u,ec(!!ef))}if(eS.defaultLocation&&(!i||t)){let{warehouse:e,city:n,state:a,country:d,errors:u}=await (0,v.M5)(el,eI,{zipCode:eS.defaultLocation},{isBDPage:ef},Y);(t=u)||(l=n,r=a,i=eS.defaultLocation,o=e,s=d)}i&&((0,d.T6)()&&"string"==typeof i&&(i=i.trim().replace(" ","+")),ef?(o&&ea.updateBdWarehouse
13Number(o),eA&&a.A.set(m.Q2,[l,r,s].filter(e=>!!e).join("|")),ex.updateDeliveryLocation({zipCode:i})):(await e(r,i),eL({city:l,state:r,zipCode:i}),ev(i),L(ew,r),M(ew,eb,r)),c=!0)}else{if(ef)eA&&a.A.set(m.Q2,[h,f,g].filter(e=>!!e).join("|")),p&&!ea.value&&(ea.updateBdWarehouseNumber(p),c=!0);else{let l=ex.zipCode,r=!!(l&&(ei.city!==h||ei.state!==f)),n=!!(l&&(!(null==(t=ed.distributionCenters)?void 0:t.length)&&l||"true"!==ed.warehouseCookieExpResetFlag()));r&&eL({city:h,state:f,zipCode:l}),n&&(await e(f||ei.state,l),c=!0)}!a.A.get(n.eV)&&ew&&ei.state&&L(ew,ei.state),!a.A.get(n.GX)&&ei.state&&eb&&M(ew,eb,ei.state)}eC&&c&&window.location.reload()};ef&&(!ef||ex.zipCode)||t()}},[en,el,es.isLoading,eC,ec]),(0,g.useEffect)(()=>{ex.zipCode&&ev(ex.zipCode)},[ex.zipCode]);try{k.parse(eS)}catch(e){return console.error(e),null}let eA=es.isLoading?"":null==ex?void 0:ex.zipCode,ek=eS.locationSelectorDefault;eA&&(ek=`${eS.locationAriaLabelPrefix} ${eA}, ${eS.locationAriaLabelSuffix}`);let ez=!(eh===i.Q7.GRS&&V),eE=j.Z0[eS.iconName||"Box"],e$=(null==(E=eS.akamaiSnifferTooltip)?void 0:E.message.replace("{{zipCode}}",eA||"").split(eS.akamaiSnifferTooltip.delimiter))||["","",""];return(0,r.jsxs)(x.Analytics,{analyticData:{component:{type:"ui"},trackType:"navigation"},children:[(0,r.jsx)(w.x,{onClick:()=>{em(!0)},Icon:eE,ariaLabel:ek,label:eS.locationSelectorLabel,showLabel:ez,value:(es.isLoading?"":eg||eA)||eS.locationSelectorDefault,defaultValue:eS.locationSelectorDefault,tooltipConfig:{showTooltip:eu,Component:(0,r.jsx)(f.m,{content:(0,r.jsx)(()=>(0,r.jsxs)(r.Fragment,{children:[null==e$?void 0:e$[0],(0,r.jsx)(h.Button,{variant:"text-button",onClick:()=>em(!0),sx:{textDecoration:"underline"},children:null==e$?void 0:e$[1]}),null==e$?void 0:e$[2]]}),{}),isOpenByDefault:!!(eA&&eu),buttonContent:(0,r.jsx)(eE,{}),buttonAriaLabel:(null==($=eS.akamaiSnifferTooltip)?void 0:$.buttonAriaLabel)||"",tooltipId:"akamai-sniffer",uniqueId:"akamai-sniffer",position:"bottom-start",hasArrow:!0,sx:{lineHeight:"170%",".arrow":{top:"-2px !important"}}})},uniqueId:"DeliveryLocationSelector"}),(0,r.jsx)(b.P,{onSubmit:async({city:e,state:t,zipCode:l,userSelectionDeliveryMethod:r})=>{try{if(ef&&el){let{warehouse:e,country:t,city:n,state:i,postalCode:o,errorConfig:s}=await (0,v.M5)(el,ej,{zipCode:l},{isBDPage:ef,userSelectionDeliveryMethod:r},Y)||{};if(s)return{errorConfig:s};e&&ea.updateBdWarehouseNumber(e),l&&a.A.set(m.Q2,[n,i,t].filter(e=>!!e).join("|")),ex.updateDeliveryLocation({zipCode:o||""}),o&&ev(o);let d=eM(o);eT&&(await d,window.location.reload())}else{let r=await (null==el?void 0:el.getDistributionCenters(t,l));ed.updateWarehouse({...r}),eL({city:e,state:t,zipCode:l}),ev(l),L(ew,t),M(ew,eb,t);let n=eM(l);eT&&(await n,window.location.reload())}}catch(e){console.error(e)}},agent:el,isOpen:ey,moduleSettings:J,onClose:()=>em(!1),zipCode:eA||void 0,isBDPage:ef,locale:Y,warehouseSpecificDeliveryMethodUIOverridesMap:et})]})}},59509:(e,t,l)=>{l.d(t,{M:()=>r});async function r(e){var t,l,r,n,i,o,a,s,d,u,c;try{let o=null==(l=null==(t=null==window?void 0:window.airgap)?void 0:t.getConsent)?void 0:l.call(t),a=Date.now();sessionStorage.setItem("airgapBeforeSyncConsentDataLog",JSON.stringify({beforeSyncData:o,beforeSyncDataTimestamp:a,options:e})),await (null==(r=null==window?void 0:window.airgap)?void 0:r.sync(e));let s=null==(i=null==(n=null==window?void 0:window.airgap)?void 0:n.getConsent)?void 0:i.call(n),d=Date.now();sessionStorage.setItem("airgapAfterSyncConsentDataLog",JSON.stringify({afterSyncData:s,afterSyncDataTimestamp:d,options:e,syncSuccess:!0}))}catch(h){console.error("Consent could not be fetched. Tracking will not be enabled.",h);let t=null==window?void 0:window.airgapLoadEvent,l=null==(o=null==window?void 0:window.airgap)?void 0:o.getRegimePurposes,r=null==(a=null==window?void 0:window.airgap)?void 0:a.override;if(!t||"function"!=typeof l||"function"!=typeof r)return;let n=l();if(!n)return;let i=null==(d=null==(s=null==window?void 0:window.airgap)?void 0:s.getConsent)?void 0:d.call(s),p=Date.now();sessionStorage.setItem("airgapBeforeSyncConsentDataLog",JSON.stringify({beforeSyncData:i,beforeSyncDataTimestamp:p,options:e,syncSuccess:!1})),r(t,{override:e=>{if(!e.purposes.has("Essential")){for(let t of e.purposes)if(n.has(t))return void e.block()}}});let v=null==(c=null==(u=null==window?void 0:window.airgap)?void 0:u.getConsent)?void 0:c.call(u),g=Date.now();sessionStorage.setItem("airgapAfterSyncConsentDataLog",JSON.stringify({afterSyncData:v,afterSyncDataTimestamp:g,options:e,syncSuccess:!1}))}}},67666:(e,t,l)=>{l.r(t),l.d(t,{default:()=>o});var r=l(28203),n=l(5363);let i=(0,l(24885).A)("MuiBox",["root"]),o=(0,n.default)({defaultClassName:i.root,generateClassName:r.A.generate})},68889:(e,t,l)=>{l.d(t,{x:()=>b});var r=l(95155),n=l(51563),i=l(12115),o=l(12158),a=l(10874),s=l(90830),d=l(84864),u=l(25719);let c="locationselector";var p=l(86670),v=l(24880);let g=(0,p.default)(u.CostcoBox)({display:"flex",gap:v.m72}),h={width:{sm:170,xs:125}},f=(0,p.default)(u.CostcoBox)({alignItems:"flex-start",display:"flex",paddingTop:"2px"}),x={color:v.S6v,display:"flex",flexDirection:"row",justifyContent:"flex-start",minWidth:"auto",minHeight:"auto",textAlign:"left"},y={...x,fontWeight:v.Pqj,lineHeight:v.MlV,whiteSpace:"nowrap"},m={...x,textDecoration:"underline",lineHeight:v.MlV},b=({ariaLabel:e,iconTitle:t,label:l,value:p,defaultValue:v,Icon:x,onClick:b,stockStatusData:w,isCMW:S=!1,showLabel:C=!0,disableButton:T=!1,tooltipConfig:I={showTooltip:!1,Component:(0,r.jsx)(r.Fragment,{})},analyticsIdentifier:j,uniqueId:L=""})=>{let[M,A]=(0,i.useState)(!1);(0,i.useEffect)(()=>{A(!0)},[]);let k=M||!v?p:v,z=(0,n.Wc)({ariaLabel:e,label:l,onClick:b,value:k,...S?{iconTitle:t}:{}});return(null==z?void 0:z.length)>0?(console.error(`Missing props: ${z}`),null):(0,r.jsx)(s.Analytics,{analyticData:{component:{identifier:j||l+" flyout",trackedData:j?["Nearby Warehouses","Open"]:["update"]}},children:(0,r.jsxs)(u.CostcoBox,{"data-testid":`${c}${L?`_${L}`:""}`,sx:S?{}:h,children:[C&&!S&&(0,r.jsx)(o.Text,{uniqueId:`${c}${L?`_${L}`:""}-label`,variant:"t7",children:l}),(0,r.jsx)(g,{children:S?(0,r.jsxs)(r.Fragment,{children:[x&&(0,r.jsx)(f,{children:(0,r.jsx)(x,{titleAccess:t})}),T?(0,r.jsx)(o.Text,{sx:y,children:k}):(0,r.jsxs)(u.CostcoBox,{children:[(0,r.jsx)(a.Button,{"aria-label":e,onClick:b,sx:m,uniqueId:`${c}${L?`_${L}`:""}--submit`,variant:"text-button",children:k}),(null==w?void 0:w.statusText)&&(null==w?void 0:w.uniqueId)&&(0,r.jsx)(d.V,{...w})]})]}):(0,r.jsxs)(r.Fragment,{children:[I.showTooltip?I.Component:x&&
13(0,r.jsx)(x,{}),T?(0,r.jsx)(o.Text,{sx:y,children:k}):(0,r.jsx)(a.Button,{"aria-label":e,onClick:b,sx:y,uniqueId:`${c}${L?`_${L}`:""}--submit`,variant:"text-button",children:k})]})})]})})}},75298:(e,t,l)=>{l.d(t,{DeliveryMethodSelectorUI:()=>x});var r=l(95155),n=l(82849),i=l(7569),o=l(3783),a=l(16002),s=l(12115),d=l(90830),u=l(71706),c=l(50122),p=l(8854),v=l(68889),g=l(83324),h=l(83669);function f(e){console.warn(`DeliverMethodSelector - Insufficient module settings: ${e}`)}function x(e){var t,l,x;let{moduleSettings:y,locale:m}=e,{agent:b}=(0,i.useAgent)(),{composable_window:w,key_value:S,properties:C}=y,{miniBannerDetails:T,deliveryLocation:I,bdWarehouseNumber:j}=(0,u.B)(),[L,M]=(0,s.useState)(!1),{updateDeliveryMethod:A}=(({locale:e,isBDPage:t=!0})=>{var l;let{agent:r}=(0,i.useAgent)(),{deliveryLocation:o,bdWarehouseNumber:a}=(0,u.B)(),d=null==(l=g.Nf[e])?void 0:l.validationSchema;return{updateDeliveryMethod:(0,s.useCallback)(async l=>{let i=l.userSelectionDeliveryMethod;try{if(r&&i&&d){let l=n.A.get(c.pp),{warehouse:s,country:u,city:p,state:v,postalCode:h,errorConfig:f}=await (0,g.M5)(r,d,{zipCode:l||o.zipCode},{isBDPage:t,onlyValidate:!1,userSelectionDeliveryMethod:i},e);if(s&&a.updateBdWarehouseNumber(s),h&&(n.A.set(c.Q2,[p,v,u].filter(e=>!!e).join("|")),o.updateDeliveryLocation({zipCode:h})),f)return{errorConfig:f};window.location.reload()}else console.error("Missing agent, userSelectionDeliveryMethod, or validationSchema")}catch(e){console.error(e)}},[r,a,o,t,e,d])}})({locale:m}),k=n.A.get(c.pp);if(!T.values)return null;let{addrType:z,showAddrTypeChangeLink:E}=T.values;if(!w||!S||!C)return f("composable_window, key_value or properties"),null;let $=new o.n({composable_window:w,key_value:S,properties:C}),D=$.getPropertiesItem("icons");if(!D||!D.type)return f("Missing iconProp"),null;let _=(0,a.Se)(null==j?void 0:j.value,z),P=$.getKeyValueItem("selectorlabel"),B=$.getKeyValueItem("selectorarialabel"),R=null==(x=null==(l=null==(t=null==y?void 0:y.properties)?void 0:t[0])?void 0:l.warehouseSpecificDeliveryMethodUIOverrides)?void 0:x[_],O=function(e,t){let l=e.toLocaleUpperCase();if("R"===l){let e=null==t?void 0:t.nationwidedeliveryoption;return{text:(null==e?void 0:e.label)||"Nationwide Delivery",icon:(null==e?void 0:e.icon)||"Box"}}if("S"===l){let e=null==t?void 0:t.pickupoption;return{text:(null==e?void 0:e.label)||"Pick-up",icon:(null==e?void 0:e.icon)||"Warehouse"}}{let e=null==t?void 0:t.localbusinessdeliveryoption;return{text:(null==e?void 0:e.label)||"Local Business Delivery",icon:(null==e?void 0:e.icon)||"Truck"}}}(z||"",R);return p.Z0[O.icon]||console.warn(`Icon type not yet supported: ${O.icon}`),(0,r.jsxs)(d.Analytics,{analyticData:{component:{type:"ui"},trackType:"navigation"},children:[(0,r.jsx)(v.x,{onClick:()=>{M(e=>!e)},Icon:p.Z0[O.icon],ariaLabel:B,label:P,showLabel:!0,value:O.text,disableButton:!E,uniqueId:"DeliveryMethodSelector"}),(0,r.jsx)(h.P,{onSubmit:A,agent:b,isOpen:L,moduleSettings:[y],onClose:()=>M(!1),isBDPage:!0,zipCode:k||I.zipCode,locale:m,warehouseSpecificDeliveryMethodUIOverrides:R})]})}},77203:(e,t,l)=>{l.r(t),l.d(t,{default:()=>r});let r=(0,l(39135).default)()},83669:(e,t,l)=>{l.d(t,{P:()=>R});var r=l(95155),n=l(82849),i=l(12115),o=l(13677),a=l(12158),s=l(84102),d=l(10874),u=l(24880),c=l(90830),p=l(3783),v=l(83324),g=l(42138),h=l(91813),f=l(50122),x=l(96270),y=l(25719);let m={localbusinessdeliveryoption:"Local",nationwidedeliveryoption:"Nationwide",pickupoption:"Store-Pick-Up"};function b({agent:e,onClose:t,onSubmit:l,moduleSettings:o,deliveryMethodsConfig:a,zipCode:s,locale:u,warehouseSpecificDeliveryMethodUIOverrides:c}){let[w,S]=(0,i.useState)(),C=n.A.get(f.pp),[T,I]=(0,i.useState)(),[j,L]=(0,i.useState)(!1),[M,A]=(0,i.useState)(),{composable_window:k,key_value:z,properties:E}=o,$=v.Nf[u],D=null==$?void 0:$.validationSchema;if((0,i.useEffect)(()=>{let t=async()=>{if(e){let{deliveryMethodsConfig:t}=await (0,v.M5)(e,D,{zipCode:C||s},{isBDPage:!0,onlyValidate:!0,isInitiatedFromChangeAddressType:!0},u);I(t)}};!s||a||T||t()},[e,T,a,u,I,D,s,C]),!a&&!T)return console.warn("DeliveryMethodDrawer - missing delivery method config"),null;if(!e)return null;if(!a&&!s)return console.error("DeliveryMethodDrawer - missing delivery method config and zipcode"),null;let{isNationalDeliveryEnabledForWareHouse:_,isStorePickupEnabledForWareHouse:P,isBDTruckZoneEnabledForWareHouse:B}=a||T||{},R=new p.n({composable_window:k,key_value:z,properties:E}),O=R.getKeyValueItem("primarybuttonlabel"),N=R.getKeyValueItem("secondarybuttonlabel"),F=R.getPropertiesItem("optionKeys"),q=R.getPropertiesItem("icons"),W=F;P||(W=W.filter(e=>"pickupoption"!==e)),_||(W=W.filter(e=>"nationwidedeliveryoption"!==e)),B||(W=W.filter(e=>"localbusinessdeliveryoption"!==e));let G=W.map(e=>{let{option:t,body:l,icon:r,label:n,deliverySurcharge:i,freeDeliveryOrderAmount:o}=(null==c?void 0:c[e])||{},a=t||e,s=i||R.getKeyValueItem(`${a}deliverysurcharge`),d=o||R.getKeyValueItem(`${a}freedeliveryorderamount`),p=l||R.getComposableWindowItem(`${a}fillablebody`)||R.getComposableWindowItem(`${a}`)||"";return s&&(p=p.replace("${deliverySurcharge}",(0,x.$g)(u,parseFloat(s),0))),d&&(p=p.replace("${freeDeliveryOrderAmount}",(0,x.$g)(u,parseFloat(d),0))),{isMarkdown:!0,isTitleBold:!0,body:p,iconName:r||q[a]||null,title:n||R.getKeyValueItem(`${a}label`),value:e,uniqueId:e}}),U=async({userSelectionDeliveryMethod:e})=>
13{if(L(!1),e){let t=await l(m[e]);(null==t?void 0:t.errorConfig)&&A(t.errorConfig)}else L(!0)};return(0,r.jsxs)(y.CostcoBox,{sx:{display:"flex",flexDirection:"column",gap:"16px",marginTop:"16px"},children:[j&&(0,r.jsx)(g.Notification,{severity:"critical",message:"Select a delivery method."}),M&&(0,r.jsx)(g.Notification,{severity:"alert",message:"Sorry, we can't update your delivery location right now. Please try again later."}),(0,r.jsx)(h.a,{onChange:function(e){S(e)},options:G,uniqueId:"radio-button-group"}),(0,r.jsx)(d.Button,{onClick:()=>{U({userSelectionDeliveryMethod:w})},children:O}),(0,r.jsx)(d.Button,{variant:"secondary",onClick:t,children:N})]})}var w=l(49820),S=l(74662),C=l(65138),T=l(23696);let I=T.Ay.object({addressLine1:T.Ay.string().regex(/^.+$/),addressLine2:T.Ay.string().optional(),zipCode:T.Ay.string().regex(/^\d{5}(?:[-\s]\d{4})?$/)}),j={"en-us":"US","en-ca":"CA","fr-ca":"CA"};function L(e,t){let l=e;return Object.keys(t).forEach(e=>{l=l.replaceAll(`{{${e}}}`,t[e])}),l}let M=e=>{let t=(0,i.useRef)(null),l=(0,i.useRef)(null),n=(0,i.useRef)(null),{agent:o,data:a,onSubmit:s,tmpZipCode:p,locale:h}=e,{aptSuiteUnitEtcInputField:f,errorNoMatchForAddress:x,zipcodeInputLabel:y,buttonLabel:m,optionalLabelText:b,serviceDownErrorMessage:T,validationSchemaType:L="en-us",streetAddressInputLabel:M,addressLine1LabelText:A,addressLine2LabelText:k,errorMsgInputValidAddrText:z,errorMsgInputValidZipCodeText:E}=a||{},$=v.Nf[L],D=null==$?void 0:$.maxCharacterLimit,_=null==$?void 0:$.inputMaskConfiguration,P=(0,v.Cu)(_),[B,R]=(0,i.useState)(),O=(0,S.T6)(),N=(0,w.Wx)({initialValues:{addressLine1:"",addressLine2:"",zipCode:p||""},onSubmit:async e=>{let t;n.current=new AbortController;let l=encodeURIComponent(JSON.stringify([{line1:e.addressLine1,line2:e.addressLine2,zip:e.zipCode,country:j[h]}])),{jsonValidatedAddress:r}=await o.getZipByAddress(l)||{},{returnedAddress:i,returnedZip:a}=r&&(JSON.parse(r)||{}),{validbdzip:d}=i||{},u=void 0!==d&&"false"!==d&&""!==d&&"true"===d.toLowerCase();if(a&&u&&(t=await (0,v.M5)(o,I,{...e,zipCode:a},{isBDPage:!0,onlyValidate:!0},h)),!u)return void R({type:"noMatchForAddress",severity:"critical"});if(!t)return void R({type:"server",severity:"alert"});let{warehouse:c,country:p,city:g,state:f,errorConfig:x,deliveryMethodsConfig:y}=t;a&&s&&s({...e,zipCode:a,city:g||"",state:f||"",warehouse:c||"",country:p||"",errorConfig:x,...!!y&&{deliveryMethodsConfig:y}})},validate:async e=>{var r,n;let{errors:i,errorConfig:a}=await (0,v.M5)(o,I,e,{isBDPage:O,onlyValidate:!0},h);if(R(a),(null==B?void 0:B.type)!=="server"&&i)return i.zipCode&&(null==(r=null==l?void 0:l.current)||r.focus()),i.addressLine1&&(null==(n=null==t?void 0:t.current)||n.focus()),i},validateOnBlur:!1,validateOnChange:!1});if(!a)return null;if(!$)return console.error(`Missing valid validationSchemaType: Options are ${Object.keys(v.Nf).join(" | ")}`),null;let F=e=>N.handleChange(e);return(0,r.jsx)(c.Analytics,{analyticData:{component:{trackedData:[N.values.addressLine1,N.values.addressLine2,N.values.zipCode]}},children:(0,r.jsxs)("form",{"data-testid":"deliverylocationform",onSubmit:e=>{N.validateForm().then(()=>{e.preventDefault(),N.handleSubmit()})},children:[(null==B?void 0:B.type)==="server"&&(0,r.jsx)(g.Notification,{message:T,severity:"alert",sx:{marginTop:u.D3H,marginBottom:u.Mzk,padding:u.iAn}}),(null==B?void 0:B.type)==="noMatchForAddress"&&x&&(0,r.jsx)(g.Notification,{message:x,severity:"critical",sx:{marginTop:u.D3H,marginBottom:u.Mzk,padding:u.iAn}}),(0,r.jsx)(C.A,{errorText:N.errors.addressLine1?z:void 0,sx:{marginBottom:4},id:"addressLine1",inputLabelId:A,inputRef:t,isError:!!N.errors.addressLine1,isRequired:!0,label:A,helpText:M,helpTextId:M,name:"addressLine1",onBlur:N.handleBlur,onChange:F,size:"small",type:"text",uniqueId:"deliverylocationform--address-line-1",value:N.values.addressLine1}),(0,r.jsx)(C.A,{id:"addressLine2",inputLabelId:k,isError:!!N.errors.addressLine2,isRequired:!1,labelOptionalText:b,label:k,helpText:f,helpTextId:f,name:"addressLine2",onBlur:N.handleBlur,onChange:F,size:"small",type:"text",uniqueId:"deliverylocationform--address-line-2",value:N.values.addressLine2}),(0,r.jsx)(C.A,{errorText:N.errors.zipCode?E:void 0,sx:{marginBottom:4,marginTop:4},id:"zipCode",inputLabelId:y,inputRef:l,isError:!!N.errors.zipCode,isRequired:!0,label:y,maxCharacterLimit:
13D,name:"zipCode",onBlur:N.handleBlur,onChange:e=>{let t=P.resolve(e.target.value);return e.target.value=t,N.handleChange(e)},size:"small",type:"text",uniqueId:"deliverylocationform--zipcode",value:N.values.zipCode}),(0,r.jsx)(d.Button,{sx:{width:"100%"},"data-testid":"deliverylocationform--submit",onClick:N.handleSubmit,type:"submit",children:m})]})})};var A=l(855);let k=e=>{var t;let l,n=(0,i.useRef)(null),{agent:o,data:a,isBDPage:s,onClose:p,onSubmit:h,tmpZipCode:f,locale:x,skipValidation:y}=e,{inputTitle:m,buttonLabel:b,invalidInputErrorMessage:I,requiredInputErrorMessage:j,serviceDownErrorMessage:M="Sorry, we can't update your delivery location right now. Please try again later.",deliveryNotAvailable:k,enterFullDeliveryAddress:z,deliveryToLimitedAreas:E,validationSchemaType:$="en-us"}=a||{},D=v.Nf[$],_=(t={requiredInputErrorMessage:j,invalidInputErrorMessage:I},l="en-ca"===$||"fr-ca"===$?v.h5:A.B,T.Ay.object({zipCode:T.Ay.string().min(1,{message:t.requiredInputErrorMessage}).regex(l,{message:t.invalidInputErrorMessage})})),P=null==D?void 0:D.maxCharacterLimit,B=null==D?void 0:D.inputMaskConfiguration,R=(0,v.Cu)(B),[O,N]=(0,i.useState)(""),[F,q]=(0,i.useState)(),W=s||(0,S.T6)(),G=(0,w.Wx)({initialValues:{city:"",state:"",zipCode:f||""},onSubmit:async e=>{let t,l,r,n,i,a,s;if(!y){let d=await (0,v.M5)(o,_,e,{isBDPage:W,onlyValidate:!0},x);if(!d)return;({warehouse:t,country:l,city:r,state:n,errorConfig:s,deliveryMethodsConfig:i,confirmationConfig:a}=d),q(s)}if(h){let{errorConfig:o}=await h({...e,city:r||"",state:n||"",warehouse:t||"",country:l||"",errorConfig:s,...!!a&&{confirmationConfig:a},...!!i&&{deliveryMethodsConfig:i}})||{};if(o)return q(o),(null==o?void 0:o.type)==="server"&&(null==o?void 0:o.message)?N(null==o?void 0:o.message):(null==o?void 0:o.type)==="deliveryNotAvailable"?N(k||"Unavailable"):(null==o?void 0:o.type)==="deliveryToLimitedAreas"?N(L(E||"",{oldZip:`${e.zipCode}`||"{{oldZip}}"})||"Unavailable"):((null==o?void 0:o.type)==="serviceDownError"||q({type:"serviceDownError",severity:"general"}),N(M)),o}},validate:async e=>{var t,l,r;if(y)return;let i=_.safeParse(e);if(!i.success){let e=null==(t=i.error.flatten().fieldErrors.zipCode)?void 0:t[0];if(e)return null==(l=null==n?void 0:n.current)||l.focus(),{zipCode:e}}let a=await (0,v.M5)(o,_,e,{isBDPage:W,onlyValidate:!0},x);if(!a)return q({severity:"alert",type:"serviceDownError"}),N(M),{zipCode:I};let{errors:s,errorConfig:d}=a;return(null==d?void 0:d.type)==="deliveryZipSame"?(p(),d):s?(null==(r=null==n?void 0:n.current)||r.focus(),{zipCode:I}):(q(d),d)?((null==d?void 0:d.type)==="server"&&(null==d?void 0:d.message)?N(null==d?void 0:d.message):(null==d?void 0:d.type)==="deliveryNotAvailable"?N(k||"Unavailable"):(null==d?void 0:d.type)==="deliveryToLimitedAreas"?N(L(E||"",{oldZip:`${e.zipCode}`||"{{oldZip}}"})||"Unavailable"):(null==d?void 0:d.type)==="serviceDownError"&&N(M),d):void 0},validateOnBlur:!1,validateOnChange:!1});if(!a)return null;if(!D)return console.error(`Missing valid validationSchemaType: Options are ${Object.keys(v.Nf).join(" | ")}`),null;let U=z&&L(z,{submittedZip:`${G.values.zipCode}`||"{{submittedZip}}"}),V=null==U?void 0:U.split("|"),K=Array.isArray(G.errors.zipCode)?G.errors.zipCode[0]:G.errors.zipCode;return(0,r.jsx)(c.Analytics,{analyticData:{component:{trackedData:[G.values.zipCode]}},children:(0,r.jsxs)("form",{"data-testid":"deliverylocationform",onSubmit:e=>{G.validateForm().then(()=>{e.preventDefault(),G.handleSubmit()})},children:[(null==F?void 0:F.type)==="enterFullDeliveryAddress"&&V&&(0,r.jsx)(()=>{let e,t=[];return t.push(null==V?void 0:V[0]),t.push((e=(null==V?void 0:V[1])||"",(0,r.jsx)(d.Button,{variant:"text-button",onClick:()=>{h&&h({...G.values,city:"",state:"",warehouse:"",country:"",errorConfig:F})},sx:{textDecoration:"underline"},children:e}))),t.push(null==V?void 0:V[2]),(0,r.jsx)(g.Notification,{severity:"alert",message:t.map((e,t)=>(0,r.jsx)("span",{children:e},t))})},{}),F&&O&&(null==F?void 0:F.type)!=="enterFullDeliveryAddress"&&(0,r.jsx)(g.Notification,{message:O,severity:F.severity||"general",sx:{marginTop:u.D3H,padding:u.iAn}}),(0,r.jsx)(C.A,{errorText:K,sx:{marginBottom:4,marginTop:4},id:"zipCode",inputLabelId:m,inputRef:n,isError:!!K,isRequired:!0,label:m,maxCharacterLimit:P,name:"zipCode",onBlur:G.handleBlur,onChange:e=>{let t=R.resolve(e.target.value);return e.target.value=t,q(void 0),G.handleChange(e)},size:"small",type:"text",uniqueId:"deliverylocationform--zipcode",value:G.values.zipCode}),(0,r.jsx)(d.Button,{sx:{width:"100%"},"data-testid":"deliverylocationform--submit",onClick:G.handleSubmit,type:"submit",children:b})]})})},z=T.z.object({backButtonAriaLabel:T.z.string(),closeButtonAriaLabel:T.z.string(),description:T.z.string().optional(),NDEnabledDescription:T.z.string().optional(),confirmationTemplate:T.z.string().optional(),inputTitle:T.z.string().optional(),invalidInputErrorMessage:T.z.string().optional(),requiredInputErrorMessage:T.z.string().optional(),serviceDownErrorMessage:T.z.string().optional(),enterFullDeliveryAddress:T.z.string().optional(),title:T.z.string(),drawerSubtitle:T.z.string().optional(),validationSchemaType:T.z.enum(["en-us","en-ca","fr-ca"]),helperText:T.z.string().optional(),buttonLabel:T.z.string(),secondaryButtonLabel:T.z.string().optional(),deliveryNotAvailable:T.z.string().optional(),deliveryToLimitedAreas:T.z.string().optional(),streetAddressInputLabel:T.z.string().optional(),aptSuiteUnitEtcInputField:T.z.string().optional(),zipcodeInputLabel:T.z.string().optional(),errorNoMatchForAddress:T.z.string().optional(),serviceError:T.z.string().optional(),optionalLabelText:T.z.string().optional(),addressLine1LabelText:T.z.string().optional(),addressLine2LabelText:T.z.string().optional(),errorMsgInputValidAddrText:T.z.string().optional(),errorMsgInputValidZipCodeText:T.z.string().optional()}),E=T.z.object({errorConfig:T.z.object({severity:T.z.enum(["critical","alert","general"]),type:T.z.enum(["deliveryNotAvailable","deliveryToLimitedAreas","deliveryZipSame","enterFullDeliveryAddress","serviceDownError","server"]),message:T.z.string().optional()})}),$=T.z.object({warehouse:T.z.string(),country:T.z.string(),city:T.z.string(),state:T.z.string(),zipCode:T.z.string(),userSelectionDeliveryMethod:T.z.enum(["Local","Nationwide","Store-Pick-Up"]).optional(),errorConfig:E.optional()}),D=T.z.function().args($).returns(T.z.union([T.z.promise(T.z.union([E,T.z.undefined()])),T.z.void()])).optional();T.z.object({data:z,onSubmit:D,onClose:T.z.function().returns(T.z.void())});let _=T.z.object({isOpen:T.z.boolean(),onClose:T.z.function().returns(T.z.void()),onSubmit:D,zipCode:T.z.union([T.z.string(),T.z.literal(""),T.z.literal(0),T.z.literal(!1),T.z.null(),T.z.undefined(),T.z.nan()])});T.z.object({streetAddress:T.z.string(),aptSuiteUnitEtc:T.z.string(),zipCode:T.z.string()}),T.z.object({data:z,onSubmit:D});let P={fontSize:u.tGh,lineHeight:"170%",a:{color:u.tjF,textDecoration:"none"}},B={width:"100%"},R=e=>{var t,l,p,v,g,h,f;let{agent:x,zipCode:m,moduleSettings:w,isOpen:S,onSubmit:C,onClose:T,isBDPage:I,locale:j,warehouseSpecificDeliveryMethodUIOverrides:A,warehouseSpecificDeliveryMethodUIOverridesMap:E}=e,$=n.A.get("hashedUserId"),[D,R]=(0,i.useState)(0),[O,N]=(0,i.useState)(),[F,q]=(0,i.useState)(!1);if((0,i.useEffect)(()=>{0===D&&q(!1)},[D]),!w||!w[0])return null;let W=I&&!!m,G=w;w.length>1&&!W&&(G=G.filter(({development_key:e})=>"delivery_location_confirmation"!==e));let U=(null==(t=null==O?void 0:O.errorConfig)?void 0:t.type)==="enterFullDeliveryAddress"||F;U?F||q(!0):G=G.filter(({development_key:e})=>"delivery_address"!==e);let V=null==(l=null==O?void 0:O.deliveryMethodsConfig)?void 0:l.showDeliveryMethodPopup;
13w.length>1&&!V&&(G=G.filter(({development_key:e})=>"delivery_methods"!==e));let K=G.map(e=>{var t;let l=(null==(t=e.composable_window)?void 0:t.reduce((e,t)=>{var l,r;return e[null==(l=null==t?void 0:t.text_only)?void 0:l.development_field_key]=null==(r=null==t?void 0:t.text_only)?void 0:r.body,e},{}))||{};return{closeButtonAriaLabel:l.closeButtonAriaLabel,backButtonAriaLabel:l.backButtonAriaLabel,description:l.drawerBody,NDEnabledDescription:l.NDEnabledDrawerBody,confirmationTemplate:l.confirmationTemplate,inputTitle:l.inputFieldLabel,invalidInputErrorMessage:l.inputError,requiredInputErrorMessage:l.requiredInputError,serviceDownErrorMessage:l.serviceError,buttonLabel:l.buttonLabel,secondaryButtonLabel:l.cancelButtonLabel,title:l.drawerTitle,drawerSubtitle:l.drawerSubtitle,helperText:l.helperText,deliveryNotAvailable:l.deliveryNotAvailable,enterFullDeliveryAddress:l.enterFullDeliveryAddress,deliveryToLimitedAreas:l.deliveryToLimitedAreas,validationSchemaType:e.locale,streetAddressInputLabel:l.streetAddressInputLabel,aptSuiteUnitEtcInputField:l.aptSuiteUnitEtcInputField,zipcodeInputLabel:l.zipcodeInputLabel,errorNoMatchForAddress:l.errorNoMatchForAddress,serviceError:l.serviceError,optionalLabelText:l.optionalLabelText,errorMsgInputValidZipCodeText:l.errorMsgInputValidZipCodeText,errorMsgInputValidAddrText:l.errorMsgInputValidAddrText,addressLine1LabelText:l.addressLine1LabelText,addressLine2LabelText:l.addressLine2LabelText}});if(!x)return null;
13try{_.parse(e),K.forEach(e=>{z.parse(e)})}catch(e){return console.error(e),null}let{backButtonAriaLabel:H,closeButtonAriaLabel:Z,title:J,description:Q,NDEnabledDescription:X,confirmationTemplate:Y,helperText:ee,buttonLabel:et,secondaryButtonLabel:el,drawerSubtitle:er}=K[D]||{},en=(null==(p=G[D])?void 0:p.development_key)||"",ei=(null==(v=null==O?void 0:O.confirmationConfig)?void 0:v.type)==="NDEnabledDrawerBody"?X:Q;Y&&(null==(g=null==O?void 0:O.confirmationConfig)?void 0:g.type)==="confirmationTemplate"&&(null==(h=null==O?void 0:O.confirmationConfig)?void 0:h.message)&&(ei=L(Y,{message:null==(f=null==O?void 0:O.confirmationConfig)?void 0:f.message}));let eo=()=>{null==T||T(),R(0),N(void 0),q(!1)},ea=e=>{D+1<K.length?N(()=>(R(e=>e+1),e)):eo()},es=async e=>{let t=e||O;if(t){if(D+1>=K.length){let{errorConfig:e}=await (null==C?void 0:C(t))||{};if(e)return{errorConfig:e}}ea(t)}else console.error("An error occurred while attempting to update zip code. Undefined Data.")},ed=A;return!ed&&(null==O?void 0:O.warehouse)&&(ed=null==E?void 0:E[O.warehouse]),(0,r.jsx)(c.Analytics,{analyticData:{component:{identifier:null==J?void 0:J.toLowerCase()}},children:(0,r.jsxs)(o.m,{"data-testId":"delivery-method-drawer",headerProps:{backButtonAriaLabel:H,closeButtonAriaLabel:Z,level:D,onClose:eo,title:J,onBack:()=>R(e=>e-1)},open:S,children:[er&&(0,r.jsx)(a.Text,{variant:"t4",children:er}),(0,r.jsxs)(y.CostcoBox,{"data-testid":"deliverylocation",children:[ei&&(0,r.jsx)(s.T,{uniqueId:"deliverylocation-description",markdown:L(ei,{oldZip:`${m}`||"{{oldZip}}",newZip:`${null==O?void 0:O.zipCode}`||"{{newZip}}"}),styles:{...P,p:{marginTop:"0"}}}),"delivery_location"===en&&(0,r.jsx)(k,{agent:x,data:K[0],onSubmit:W||U?ea:es,onClose:eo,skipValidation:I&&!W,tmpZipCode:(null==O?void 0:O.zipCode)||"",isBDPage:I,locale:j}),"delivery_address"===en&&(0,r.jsx)(M,{agent:x,data:K[1],onSubmit:W?ea:es,tmpZipCode:(null==O?void 0:O.zipCode)||"",isBDPage:I,locale:j}),"delivery_location_confirmation"===en&&(0,r.jsxs)(y.CostcoBox,{sx:{display:"flex",flexDirection:"column",gap:u.D3H,marginTop:u.Mzk},children:[(0,r.jsx)(d.Button,{sx:B,"data-testid":"deliverylocationconfirmform--submit",onClick:()=>{es()},type:"submit",children:et}),(0,r.jsx)(d.Button,{variant:"secondary",onClick:eo,children:el})]}),"delivery_methods"===en&&(0,r.jsx)(b,{agent:x,onClose:eo,onSubmit:O?async e=>await es({warehouse:O.warehouse,country:O.country,city:O.city,state:O.state,zipCode:O.zipCode,userSelectionDeliveryMethod:e}):async e=>await es({warehouse:"",country:"",city:"",state:"",zipCode:"",userSelectionDeliveryMethod:e}),moduleSettings:G[D],deliveryMethodsConfig:null==O?void 0:O.deliveryMethodsConfig,zipCode:`${m}`||"",locale:j,warehouseSpecificDeliveryMethodUIOverrides:ed}),!$&&ee&&(0,r.jsx)(s.T,{uniqueId:"deliverylocation-helperText",markdown:ee,styles:P})]})]})})};R.displayName="DeliveryLocationDrawerUI"},84325:(e,t,l)=>{l.d(t,{TwoDayDeliverySurchargeUI:()=>m});var r=l(95155),n=l(50148),i=l(12115),o=l(3187),a=l(12158),s=l(2377),d=l(19216),u=l(24880),c=l(96013);let p={display:"flex",flexDirection:{lg:"row",md:"column",sm:"column"},gap:u.m72,justifyContent:"flex-start",alignItems:"flex-end",fontSize:u.Yvi},v={color:u.H4y,fontWeight:u.Pqj,flexShrink:0},g={fontWeight:u.Pqj},h={color:u.H4y,height:"18px",width:"18px"},f={display:"flex",flexDirection:"row",gap:"4px",flexShrink:0};var x=l(25719),y=l(58419);let m=({msText:e,locale:t,groceryRoutes:l})=>{var m,b,w,S;let{grocerySurcharge:C}=(()=>{let[e,t]=(0,i.useState)(()=>({Grocery:{amountToGo:"",deliveryFee:"",orderTotal:"",threshold:""}}));return(0,i.useEffect)(()=>{let l=y.qr.readRaw();t(y.qr.decodeCookie(l)??e);let r=setInterval(()=>{let r=y.qr.readRaw();r!==l&&(l=r,t(y.qr.decodeCookie(r)??e))},500);return()=>clearInterval(r)},[]),{grocerySurcharge:{value:e}}})(),{isGrocery:T,setIsGroceryRoute:I}=(0,n.V)(),[j,L]=(0,i.useState)(!1);return((0,i.useEffect)(()=>{var e,t;(null==(t=null==(e=C.value)?void 0:e.Grocery)?void 0:t.orderTotal)?L(!0):L(!1)},[C.value]),(0,i.useEffect)(()=>{if("u">typeof window){let e=window.location.pathname,t=e.substring(e.lastIndexOf("/")).replace(/\.html/g,"");l.includes(t)&&I(!0)}},[l,I]),T&&e)?(0,r.jsxs)(x.CostcoBox,{sx:p,children:[(0,r.jsxs)(x.CostcoBox,{sx:f,children:[(0,r.jsx)(()=>"fr-ca"===t?(0,r.jsxs)(o.Link,{href:e.faqLink,sx:{display:"inline-flex",gap:"4px"},children:[(0,r.jsx)(a.Text,{variant:"t7",sx:v,children:e.grocery}),(0,r.jsx)(a.Text,{variant:"t7",sx:{color:u.wcX,fontWeight:u.Pqj},children:"Costco"})]}):"en-ca"===t?(0,r.jsxs)(o.Link,{href:e.faqLink,sx:{display:"inline-flex",gap:"4px"},children:[(0,r.jsx)(a.Text,{variant:"t7",sx:{color:u.wcX,fontWeight:u.Pqj},children:"Costco"}),(0,r.jsx)(a.Text,{variant:"t7",sx:v,children:e.grocery})]}):(0,r.jsx)(o.Link,{href:e.faqLink,children:(0,r.jsx)(a.Text,{variant:"t7",sx:v,children:e.twodayshipping})}),{}),(0,r.jsx)(a.Text,{variant:"t7",children:e.currentOrder.replace("{{currentOrder}}",(0,y.Bq)(j,C.value,t))}),(0,r.jsx)(s.Divider,{sx:{display:{lg:"block",sm:"none"}},orientation:"vertical"})]}),(0,r.jsxs)(x.CostcoBox,{sx:f,children:[!j||Number(null==(b=null==(m=C.value)?void 0:m.Grocery)?void 0:b.threshold)>Number(null==(S=null==(w=C.value)?void 0:w.Grocery)?void 0:S.orderTotal)?(0,r.jsx)(()=>{let l=j?e.someItemsDeliverySurcharge:e.noItemsDeliverySurcharge;if("fr-ca"!==t)return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.Text,{uniqueId:"surcharge-and-threshold",variant:"t7",sx:g,children:e.amounttogo.replace("{{amountToGo}}",(0,y.gT)(j,C.value,e,t))}),(0,r.jsx)(a.Text,{variant:"t7",children:l.replace("{{deliveryFee}}",(0,y.vh)(j,C.value,t))})]});{let n=(0,y.vh)(j,C.value,t),i=(0,y.gT)(j,C.value,e,t);return(0,r.jsxs)(x.CostcoBox,{sx:{display:"flex",gap:"4px",textAlign:"right"},children:[(0,r.jsx)(a.Text,{variant:"t7",children:l.replace("{{deliveryFee}}",`${n}`)}),(0,r.jsx)(a.Text,{uniqueId:"surcharge-and-threshold",variant:"t7",sx:g,children:e.amounttogo.replace("{{amountToGo}}",`${i}`)})]})}},{}):(0,r.jsx)(a.Text,{variant:"t7",children:e.deliveryFeeWaived}),(0,r.jsx)(d.m,{hasArrow:!0,buttonContent:(0,r.jsx)(c.A,{sx:h}),buttonStyles:h,offset:[20,0],content:(0,r.jsx)(a.Text,{variant:"t6",children:(0,y.Eg)(e.surchargeTooltip,e.threshold)}),position:"bottom-end",buttonAriaLabel:e.tooltipAriaLabel,tooltipId:"surcharge-tooltip",uniqueId:"surcharge-tooltip",sx:{zIndex:10,'&[data-popper-placement*="bottom-end"]':{".arrow":{left:"-2px !important"}}}})]})]}):null}},84337:(e,t,l)=>{l.d(t,{OrderStatusSurchargeUI:()=>y});var r=l(95155),n=l(16002),i=l(12115),o=l(12158),a=l(2377),s=l(19216),d=l(24880),u=l(96013),c=l(71706),p=l(75699),v=l(32722);d.Mzk;let g={alignItems:{lg:"normal",md:"flex-end"},display:"flex",flexDirection:{lg:"row",md:"column",sm:"column",xs:"column"},gap:d.m72},h={...{alignSelf:"center",borderColor:`${d.S6v}`,height:d.Mzk,margin:`0 ${d.iAn} 0 ${d.iAn}`},display:{lg:"block",md:"none",sm:"none",xs:"none"}};d.i_v;var f=l(25719),x=l(96270);let y=({locale:e,msText:t,serviceConfiguration:l,warehouseSpecificDeliveryMethodUIOverridesMap:y})=>{var m,b,w;let S,C,{bdDeliveryLocation:T,wcCartOrder:I,miniBannerDetails:j,bdWarehouse
13Number:L}=(0,c.B)(),{cartItemCount:M}=(0,v.B)(),{value:A}=I??{},{zipCode:k}=T??{},{setMiniBannerDetails:z,values:E}=j,$=!1,D=(0,i.useRef)();if((0,i.useEffect)(()=>{I.updateWcCartOrder(p.lr.read())},[M]),(0,i.useEffect)(()=>{if((!E||null==E.freeDeliveryOrderAmount||null==E.deliverySurcharge||null==E.addrType)&&(D.current=new AbortController,k))return(async()=>{let e=await (0,x.xw)(l.endpoint,A,k,D.current);e&&z(e),D.current=void 0})(),()=>{var e;null==(e=D.current)||e.abort("OrderStatusSurcharge - cleanup on unmounted")}},[L.value,A,k,l.endpoint]),E){let e,{freeDeliveryOrderAmount:t,deliverySurcharge:l,addrType:r}=E,i=(0,n.Se)(null==L?void 0:L.value,r),o=null==y?void 0:y[i],a=null==r?void 0:r.toLocaleUpperCase();e="R"===a?"nationwidedeliveryoption":"S"===a?"pickupoption":"localbusinessdeliveryoption";let s=null==(m=null==o?void 0:o[e])?void 0:m.overrideAPIValuesInOrderStatusUI,d=null==(b=null==o?void 0:o[e])?void 0:b.freeDeliveryOrderAmount,u=null==(w=null==o?void 0:o[e])?void 0:w.deliverySurcharge;S=s&&d?parseFloat(d):t,C=s&&u?parseFloat(u):l,$="S"===r||"729"===L.value}return!S||null==C||isNaN(C)?null:(0,r.jsxs)(f.CostcoBox,{sx:g,children:[(0,r.jsxs)(o.Text,{variant:"t7",children:[t.currentOrder,(0,x.$g)(e,A)]}),(0,r.jsx)(a.Divider,{orientation:"vertical",sx:h}),(0,r.jsxs)(o.Text,{sx:{display:"flex",gap:d.m72},uniqueId:"surcharge-and-threshold",variant:"t7",children:[(0,x.$V)(e,t,A,S,C,$),(0,r.jsx)(s.m,{buttonContent:(0,r.jsx)(u.R,{sx:{color:d.iCb,height:"18px",width:"18px"}}),content:(0,r.jsx)(o.Text,{variant:"t6",children:(0,x.RE)(e,t,A,S,C,$)}),hasArrow:!0,buttonAriaLabel:t.tooltipAriaLabel,position:"bottom-end",tooltipId:t.tooltipId,sx:{'&[data-popper-placement*="bottom-end"]':{".arrow":{left:"-2px !important"}}},offset:[20,0]})]})]})}},87443:(e,t,l)=>{l.d(t,{default:()=>r});let r=(0,l(47163).default)()},87930:(e,t,l)=>{let r,n;l.d(t,{SearchBarData:()=>eo});var i,o=l(95155),a=l(2741),s=l(39922),d=l(74662),u=l(3783),c=l(51563),p=l(12115),v=l(92119),g=l(51838),h=l(71706),f=l(27966),x=l(54309),y=l(2377),m=l(78388),b=l(25719);let w=(0,p.forwardRef)(({isFocused:e,popperContainerRef:t,...l},r)=>(0,o.jsx)(b.CostcoBox,{sx:{display:"flex",flexGrow:1},"aria-owns":e?m.nR:void 0,ref:t,children:(0,o.jsx)("input",{ref:r,...l})}));w.displayName="SearchBarInput";var S=l(55207);let C=({inputRef:e,popperContainerRef:t,popperProps:l})=>{let r=(0,p.useCallback)(()=>null==t?void 0:t.current,[t]);return(0,o.jsx)(S.A,{...l,style:{...(null==l?void 0:l.style)?l.style:{},width:"calc(100% - 90px)"},anchorEl:null==e?void 0:e.current,container:r})};var T=l(81938),I=l(95149),j=l(69758),L=l(82755),M=l(98935),A=l(54506),k=l(86670),z=l(10874),E=l(24880),$=l(19945),D=l(87213);let _=(0,k.default)(j.A)`
14    & .MuiOutlinedInput-root.MuiInputBase-sizeSmall {
15        padding: 0px;
16    }
17    & .MuiAutocomplete-inputFocused {
18        box-sizing: border-box;
19        height: 40px;
20    }
21`,P="0px 5px 10px 0px #00000033",B=(0,k.default)(L.default)({borderRadius:0,boxShadow:P}),R=(0,k.default)(M.A)`
22    color: ${E.S6v};
23    font-size: ${E.eLT};
24    display: flex;
25    width: 100%;
26
27    & .MuiOutlinedInput-root {
28        align-items: center;
29        align-self: stretch;
30        background: ${E.DJJ};
31
32        :hover {
33            & fieldset {
34                border-color: ${E.iCb};
35            }
36        }
37
38        & input {
39            padding-right: ${E.D3H};
40            padding-left: ${E.D3H};
41            border: ${E.RYE} solid ${E.DJJ};
42
43            :focus {
44                border-radius: ${E.oOK};
45                border: ${E.PPD} solid ${E.iCb};
46                box-shadow: 0px 0px 4px 0px ${E.iCb};
47                padding-top: 8.5px;
48                padding-bottom: 8.5px;
49                z-index: 1320;
50            }
51
52            ::placeholder {
53                color: ${E.BO};
54                opacity: 1;
55            }
56        }
57
58        & fieldset {
59            border: ${E.RYE} solid ${E.iCb};
60            border-radius: 0px;
61        }
62    }
63
64    & .MuiOutlinedInput-root.Mui-focused {
65        & fieldset {
66            border: ${E.RYE} solid ${E.iCb};
67            border-top-right-radius: 0px;
68            border-bottom-right-radius: 0px;
69            border-top-left-radius: ${E.oOK};
70            border-bottom-left-radius: ${E.oOK};
71        }
72    }
73`,O=(0,k.default)(f.default)({display:"flex",width:"90px",justifyContent:"flex-end"}),N=(0,k.default)(z.Button)`
74    gap: 0px;
75    margin: 0px;
76    min-width: auto;
77    padding: 0px;
78    width: 45px;
79    height: ${E.ZDA};
80
81    :hover {
82        background-color: transparent;
83    }
84
85    :focus {
86        background-color: transparent;
87        outline: 2px solid Highlight;
88        outline: 2px auto -webkit-focus-ring-color;
89        outline-offset: -1px;
90    }
91`,F=(0,k.default)(A.default)`
92    &.MuiAutocomplete-option.Mui-focused {
93        background-color: ${E.KLo};
94    }
95`,q=(0,k.default)(D.WW)({color:E.tjF,height:"20px",width:"20px"}),W=(0,k.default)($.v)({color:E.tjF,height:"28px",width:"28px"}),G=(0,k.default)(f.default)({padding:E.D3H}),U=(0,k.default)(f.default)({display:"flex",flexDirection:"column",gap:E.Mzk}),V=(0,k.default)(f.default)({alignItems:"flex-start",display:"flex",flexWrap:"wrap",gap:E.Mzk}),K=(0,k.default)("span")({color:E.iCb}),H={[`@media (max-width: ${E.sOp})`]:{display:"none"},height:"90px",width:"90px"},Z=({executeSearch:e,inputRef:t,moduleSettings:l,onClear:r,onInputChange:n,onInputFocus:i,onOptionClick:a,options:s,placeholder:d,value:c})=>{let v=(0,p.useRef)(null),g=(0,p.useRef)([]),[h,b]=(0,p.useState)(!1),[S,j]=(0,p.useState)(!1),L=s.length>0,M=S&&L;(0,p.useEffect)(()=>()=>
95{g.current.forEach(e=>clearTimeout(e))},[]);let A=(0,p.useMemo)(()=>new u.n({composable_window:l.composable_window,key_value:l.key_value}),[l]),k=A.getKeyValueItem(m.hv),z=A.getKeyValueItem(m.ON),E=A.getKeyValueItem(m.cE),$=A.getKeyValueItem(m.Up),D=A.getKeyValueItem(m.v_),Z=A.getKeyValueItem(m.lR),J=(0,p.useCallback)(()=>{b(!0),i()},[i]),Q=(0,p.useCallback)(e=>{let t=e.relatedTarget;if(!(v.current&&v.current.contains(t))){if(!t){let e=window.setTimeout(()=>{var t;let l=document.activeElement;l&&(null==(t=v.current)?void 0:t.contains(l))||(b(!1),g.current=g.current.filter(t=>t!==e))},0);g.current.push(e);return}b(!1)}},[]),X=(0,p.useCallback)((e,t)=>{if("blur"===t){let e=window.setTimeout(()=>{var t;let l=document.activeElement;l&&(null==(t=v.current)?void 0:t.contains(l))||(j(!1),g.current=g.current.filter(t=>t!==e))},0);g.current.push(e);return}j(!1)},[]),Y=(0,p.useCallback)(t=>{let l=t.target;"Enter"===t.key&&l.value===c&&e(t)},[e,c]),ee=(0,p.useCallback)(e=>(0,o.jsx)(C,{popperProps:{...e,style:{...e.style,visibility:h&&M?"visible":"hidden"}},inputRef:t,popperContainerRef:v}),[t,h,M]);return(0,o.jsx)(_,{onOpen:()=>{j(!0),b(!0)},onClose:X,getOptionLabel:e=>e.label,groupBy:e=>e.group,renderGroup:e=>{let t=(0,T.nC)(e.group,s);return(0,o.jsxs)(p.Fragment,{children:["RecommendedSearch"===e.group&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(F,{children:(0,o.jsx)("strong",{children:D})})}),t&&(0,o.jsx)(G,{children:(0,o.jsx)(y.Divider,{})}),"productSection"===e.group&&(0,o.jsx)(U,{children:e.children}),"productSection"!==e.group&&(0,o.jsx)(o.Fragment,{children:e.children})]},e.key)},renderInput:l=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(f.default,{id:m.Rs,sx:x.A,children:Z}),(0,o.jsx)(R,{...l,slotProps:{...l.slotProps,input:{...l.slotProps.input,"aria-haspopup":"listbox",endAdornment:(0,o.jsxs)(O,{children:[!!c.length&&(0,o.jsx)(N,{onClick:e=>{e.stopPropagation(),r()},"aria-label":k,variant:"tertiary",children:(0,o.jsx)(q,{})}),(0,o.jsx)(N,{onClick:t=>e(t),"aria-label":E,"data-testid":"SearchButton",variant:"tertiary",children:(0,o.jsx)(W,{})})]}),inputComponent:w,onKeyDown:Y},htmlInput:{...l.slotProps.htmlInput,"aria-controls":M?m.nR:void 0,"aria-expanded":M,"aria-label":z,"data-private":!0,"aria-describedby":m.Rs,isFocused:h,popperContainerRef:v}},"data-testid":m.EA,inputRef:t,onBlur:Q,onFocus:J,placeholder:d,size:"small",variant:"outlined"})]}),renderOption:({key:e,...t},l)=>{let r=((e,t)=>{if(!t)return(0,o.jsx)(f.default,{component:"span",sx:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:{xs:4,md:"none"},overflow:"hidden",textOverflow:"ellipsis"},children:e});let l=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=RegExp(`(${l})`,"gi");return(0,o.jsx)(f.default,{component:"span",sx:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:{xs:4,md:"none"},overflow:"hidden",textOverflow:"ellipsis"},children:e.split(r).map((e,l)=>e.toLowerCase()===t.toLowerCase()?(0,o.jsx)("strong",{children:e},l):e)})})(l.label,c);return(0,o.jsxs)(F,{...t,"automation-id":l.automationId,"data-bi-private":l.dataBiPrivate,"data-private":l.dataBiPrivate,onClick:()=>a(l),children:["RecommendedSearch"===l.group&&r,"searchTermSection"===l.group&&"Category"===l.type&&(0,o.jsxs)("span",{children:[r,l.category&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{children:" in "}),(0,o.jsx)(K,{children:l.category})]})]}),"searchTermSection"===l.group&&"Category"!==l.type&&(0,o.jsx)(o.Fragment,{children:r}),"productSection"===l.group&&(0,o.jsxs)(V,{children:[(0,o.jsx)(I.A,{alt:"",loading:"lazy",src:null==l?void 0:l.FullImage,sx:H}),r]}),"warehouseSection"===l.group&&(0,o.jsx)(o.Fragment,{children:r})]},`${l.label}-${l.index}`)},slots:{paper:B,popper:ee},slotProps:{listbox:{"aria-label":$,"aria-labelledby":void 0,id:m.nR,role:"listbox",style:{maxHeight:"100%",overflow:"auto"}},paper:{style:{boxShadow:P}}},open:M,"aria-owns":M?m.nR:void 0,filterOptions:e=>e,freeSolo:!0,inputValue:c,onInputChange:n,autoComplete:!0,includeInputInList:!0,openOnFocus:!0,options:s})};Z.displayName=m.EA;var J=l(5353),Q=l(66119);let X=()=>{let e=0;return async(t,l,r,n=!0,i=3e5,o=1e3,a)=>{let s=Date.now(),d=s-e;if(0===e||d>=o)return e=s,(0,Q.$3)(t,l,r,n,i,a);{let s=o-d;return new Promise((o,d)=>{setTimeout(()=>{e=Date.now(),(0,Q.$3)(t,l,r,n,i,a).then(e=>o(e)).catch(e=>d(e))},s)})}}},Y=(e,t)=>
95e[t]??"";var ee=((i=ee||{}).setOptions="setOptions",i.setPlaceholder="setPlaceholder",i.setShouldFocusInput="setShouldFocusInput",i.setValue="setValue",i),et=l(88932),el=l(16099),er=l(33423);let en={options:[],shouldFocusInput:!1,value:""};function ei(e,t){switch(t.type){case ee.setOptions:return{...e,options:t.payload};case ee.setPlaceholder:return{...e,placeholder:t.payload};case ee.setShouldFocusInput:return{...e,shouldFocusInput:t.payload};case ee.setValue:return{...e,value:t.payload};default:return e}}let eo=({categoryUrlPath:e,isGRSFeatureFlagEnabled:t,isGRSBetaReleaseFeatureFlagEnabled:l,isGRSPhasedReleaseFeatureFlagEnabled:i,locale:f,moduleSettings:x,serviceConfigurationGRSAutosuggest:y,serviceConfigurationGRSSearch:b,serviceConfigurationLucidWorks:w,site:S,publishedCategories:C})=>{let{bdWarehouseNumber:I,deliveryLocation:j,warehouse:L}=(0,h.B)(),{data:M}=(0,et.z)(s.l,(0,c.GD)()),A=(0,el.Z)({isGRSFeatureFlagEnabled:t,isGRSBetaReleaseFeatureFlagEnabled:l,isGRSPhasedReleaseFeatureFlagEnabled:i}),k=null==j?void 0:j.state,z=null==j?void 0:j.zipCode,E=(0,p.useRef)(null),$=(0,p.useRef)(!1),D=(0,p.useMemo)(()=>new u.n({composable_window:x.composable_window,key_value:x.key_value}),[x]),{trackEvent:_}=(0,er.z)(),P=D.getKeyValueItem(m.GM),B=D.getKeyValueItem(m.Lf),R=x.properties[0][m.G8]??"",O=x.properties[0][m.HG],N=x.properties[0][m.oD],F=A===a.Q7.GRS?y:w,{minCharsToSendRequest:q,maxTotalSuggestions:W,emptyQueryMaxTotalSuggestions:G,maxSearchTermSuggestions:U,emptyQueryMaxSearchTermSuggestions:V}=(0,p.useMemo)(()=>{let e=(e,t,l)=>{if(!A||!(null==F?void 0:F.custom_properties))return l;let r=F.custom_properties,n=r[e];if("object"==typeof n&&null!==n&&S in n){let e=n[S];if(null!=e)return e}for(let e of t){let t=r[e];if(null!=t)return t}return l};return{minCharsToSendRequest:e("minCharsToSendReq",["MIN_CHARS_TO_SEND_REQUEST"],4),maxTotalSuggestions:e("maxTotalSuggestions",["MAX_TOTAL_SUGGESTIONS"],8),emptyQueryMaxTotalSuggestions:e("emptyQueryMaxTotalSuggestions",["MAX_TOTAL_SUGGESTIONS"],8),maxSearchTermSuggestions:e("maxSearchTermSuggestions",["MAX_SEARCH_TERM_SUGGESTIONS"],5),emptyQueryMaxSearchTermSuggestions:e("emptyQueryMaxSearchTermSuggestions",["MAX_SEARCH_TERM_SUGGESTIONS"],5)}},[F,A,S]),[{options:K,placeholder:H,shouldFocusInput:Q,value:eo},ea]=(0,p.useReducer)(ei,{...en,placeholder:P});(0,p.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get(m.xl)||"";e&&ea({payload:e,type:ee.setValue})},[]);let es=(0,p.useMemo)(()=>{if(A===a.Q7.LUCIDWORKS&&w)return async(e,t,l)=>{var r;n&&n.abort(),n=new AbortController;let i=X(),o=w.endpoint,a=e?w.required_request_parameters.rowsPerGroup:(null==(r=w.required_request_parameters)?void 0:r.rowsPerGroupOnEmptyQuery)||m.Dw,s=((e,t,l,r,n,i,o,a)=>{let s=`${e}?locale=${l}&rowsPerGroup=${n}&includeTravelInSearch=${i}`;if(t&&(s+=`&q=${encodeURIComponent(t)}`),r){let e=`${r}`;e.includes("-ND")&&(e=e.replace("-ND",""),s+="&nationalDelivery=true"),s+=`&loc=${e}`}return o&&(s+=`&userLocation=${o}`),a&&(s+=`&userPostal=${a}`),s})(o,e,t,l,a,w.required_request_parameters.includeTravelInSearch,k,z);return n=new AbortController,i(s,{headers:(0,J.X)(w.required_request_headers)},w.timeout,!0,3e5,w.custom_properties.RATE_LIMIT_WAIT_MS,n)}},[A,w,k,z]),ed=(0,p.useMemo)(()=>{if(A===a.Q7.GRS&&y&&b){let{distributionCenters:e,nearestWarehouse:t,groceryCenters:l}=L,n=null==t?void 0:t.catalog;return(({adobeSessionID:e,distributionCenters:t,preferredWarehouse:l,serviceConfigurationGRSAutosuggest:n,serviceConfigurationGRSSearch:i,site:o})=>{let a=X(),s=X();return async(d,u)=>{var c,p,v,g;r&&r.abort(),r=new AbortController;let h=e??m.tN,f=(g=n.endpoint,`${g}?searchTerm=${encodeURIComponent(d)}&visitorId=${h}`),x=(0,J.X)(n.required_request_headers),y=n.required_request_headers.client_id,b={headers:{...x,client_id:Y(y,o),locale:u}},w=await a(f,b,n.timeout,!0,3e5,n.custom_properties.RATE_LIMIT_WAIT_MS,r);if(!(null==(c=null==w?void 0:w.suggestions)?void 0:c.length))return{products:[],searchTermSuggestions:(null==w?void 0:w.suggestions)??[],warehouses:(null==w?void 0:w.suggestedWarehouseLocations)??[]};let S=(({grsSearchRequestBody:e,locale:t,serviceConfigurationGRSSearch:l,site:r})=>{let n=(0,J.X)(l.required_request_headers),i=l.required_request_headers.client_id;return{body:JSON.stringify(e),headers:{...n,"Content-Type":"application/json",client_id:Y(i,r),locale:t},method:"POST"}})({grsSearchRequestBody:(({deliveryLocations:e,query:t,warehouseId:l})=>({deliveryLocations:e||[],filterBy:[],offset:0,pageSize:5,personalizationEnabled:!1,query:t,searchMode:"typeahead",visitorId:m.tN,warehouseId:l}))({deliveryLocations:t,query:null==(p=null==w?void 0:w.suggestions)?void 0:p[0],warehouseId:l}),locale:u,serviceConfigurationGRSSearch:i,site:o}),C=new URL(i.endpoint);C.searchParams.append("searchType","typeahead");let T=await s(C.toString(),S,i.timeout,!0,3e5,i.custom_properties.RATE_LIMIT_WAIT_MS,r);return{products:(null==(v=null==T?void 0:T.searchResult)?void 0:v.results)??[],searchTermSuggestions:(null==w?void 0:w.suggestions)??[],warehouses:(null==w?void 0:w.suggestedWarehouseLocations)??[]}}})({adobeSessionID:M,distributionCenters:(0,d.T6)()?[null==I?void 0:I.value]:[...e,n,...l].filter(e=>!!e),preferredWarehouse:(0,d.T6)()?null==I?void 0:I.value:n,serviceConfigurationGRSAutosuggest:y,serviceConfigurationGRSSearch:b,site:S})}},[M,A,y,b,S,L,I]),eu=(0,p.useCallback)((0,v.A)(async e=>{var t;try{let l=e?U:V,r=e?W:G;if(A===a.Q7.GRS){let t=await (null==ed?void 0:ed(e,(0,T.G7)(f))),n=(({locale:e,products:t,searchTermSuggestions:l,warehouses:r})=>{let n=[];return null==l||l.forEach(t=>{n.push({label:t,locale:e,term:t,type:"PopularSearch"})}),null==t||t.forEach(t=>{var l,r,i,o,a,s,d,u,c,p,v;let g=!!(null==(r=null==(l=t.product.attributes.chdi_eligible)?void 0:l.numbers)?void 0:r[0])||!!(null==(i=t.variantRollupValues["attributes.chdi_eligible"])?void 0:i.includes(1)),h=!!(null==(a=null==(o=t.product.attributes.fsa_eligible)?void 0:o.numbers)?void 0:a[0])||!!(null==(s=t.variantRollupValues["attributes.fsa_eligible"])?void 0:s.includes(1));n.push({FullImage:null==(u=null==(d=t.product.attributes.primary_image)?void 0:d.text)?void 0:u[0],baseUrl:t.product.uri||(null==(c=t.product.variants[0])?void 0:c.uri),group_id:t.
95id,item_chdi_eligible:g,item_fsa_eligible:h,label:t.product.title,locale:e,productType:null==(v=null==(p=t.product.attributes.product_type)?void 0:p.text)?void 0:v[0],term:t.product.title,type:"Product"})}),null==r||r.forEach(t=>{n.push({WarehouseAddress:t.address1,baseUrl:t.baseUrl,label:t.locationName,locale:e,term:t.locationName,type:"Warehouse"})}),n})({locale:f,products:null==t?void 0:t.products,searchTermSuggestions:null==t?void 0:t.searchTermSuggestions,warehouses:null==t?void 0:t.warehouses});n&&ea({payload:(0,T.Ku)({maxSearchTermSuggestions:l,maxTotalSuggestions:r,pharmacyPlaceholderImage:N,suggestions:n}),type:ee.setOptions})}else if(A===a.Q7.LUCIDWORKS){let n;n=(0,d.T6)()&&(null==I?void 0:I.value)?null==I?void 0:I.value:(0,d.T6)()?null:(0,T.jC)(L);let i=await (null==es?void 0:es(e,(0,T.G7)(f),n)),o=null==(t=null==i?void 0:i.response)?void 0:t.docs;o&&ea({payload:(0,T.Ku)({maxSearchTermSuggestions:l,maxTotalSuggestions:r,pharmacyPlaceholderImage:N,suggestions:o}),type:ee.setOptions})}}catch{ea({payload:[],type:ee.setOptions})}},m.uT),[es,ed,f,U,V,W,G,N,A,null==I?void 0:I.value,L,v.A]);(0,p.useEffect)(()=>{var e;Q&&(null==(e=E.current)||e.focus(),ea({payload:!1,type:ee.setShouldFocusInput}))},[Q]);let ec=(0,p.useCallback)((t,l)=>{var r;let n=l&&(0,T.tC)({categoryUrlPath:e,option:l,publishedCategories:C,refineParameterSuffix:R,searchUrl:O,value:t});n&&((null==l?void 0:l.dataBiPrivate)||_({identifier:"searchTerm",keyword:l.label,searchBar:{searchType:"typeahead",typeaheadGroup:"popularsearch"===l.type?"popular":"ShadowDimension"===l.type?"shadow dimension":null==(r=l.type)?void 0:r.toLowerCase()},trackType:"search"}),window.location.href=n)},[e,C,R,O,_]),ep=(0,p.useCallback)(e=>{ea({payload:e.label,type:ee.setValue}),ec(e.label,e)},[ec]),ev=(0,p.useCallback)((e,t,l)=>{if("undefined"!==t)if(ea({payload:t,type:ee.setValue}),"reset"===l||"selectOption"===l){let e=(0,T.gL)(K,t);ec(t,e)}else t.length>=q?eu(t):ea({payload:[],type:ee.setOptions})},[ec,eu,q,K]),eg=(0,p.useCallback)(()=>{ea({payload:P,type:ee.setPlaceholder}),ea({payload:"",type:ee.setValue}),ea({payload:[],type:ee.setOptions}),ea({payload:!0,type:ee.setShouldFocusInput})},[P]),eh=(0,p.useCallback)(()=>{if($.current)return;let e=new URLSearchParams(window.location.search).get(m.xl)||"";(e||0===q&&0===eo.length&&0===K.length)&&(eu(e||eo),$.current=!0)},[eu,q,K.length,eo]),ef=(0,p.useCallback)(e=>{var t;eo?(_({identifier:g.R5,keyword:eo,searchBar:{searchType:g.ID},trackType:g.Y2}),window.location.href=`${O}${encodeURIComponent(eo)}`):(ea({payload:B,type:ee.setPlaceholder}),null==(t=E.current)||t.focus(),e.preventDefault())},[B,O,_,eo]);return(0,o.jsx)(Z,{executeSearch:ef,inputRef:E,moduleSettings:x,onClear:eg,onInputChange:ev,onInputFocus:eh,onOptionClick:ep,options:K,placeholder:H,value:eo})}},91813:(e,t,l)=>{l.d(t,{a:()=>D});var r=l(95155),n=l(12115),i=l(10527),o=l(53443),a=l(78919),s=l(54309),d=l(96013),u=l(12158),c=l(27966),p=l(82683),v=l(26234),g=l(28683),h=l(29445);let f="SelectorRadioButton",x=`${f}-error: invalid props`,y=`${f}-warning: when 'helpLinkTex' and 'helpLinkUrl' must be provided together`,m=`${f}-warning: 'ariaLabelErrorPrefix' must be provided when 'errorText' is provided, the component may not meet accessibility standards`;var b=l(17049),w=l(24880),S=l(4557);let C={div:{marginTop:w.iAn,display:"flex",flexDirection:"column",gap:w.iAn},"p, ul":{margin:0},ul:{paddingLeft:"20px"}};var T=l(84102);let I=e=>{let t,l=(t=(0,g.default)(),{box:[{display:"flex",flexDirection:"column",color:w.S6v},t.applyStyles("midnight-blue",{color:w.XgP})],titleWrapper:{display:"flex",flexDirection:"row",gap:w.iAn},icon:{margin:"2px 0",height:"20px",width:"20px"},body:{paddingTop:w.iAn}}),{title:n,titleComponent:i,iconName:o,subtitle:a,body:s,bodyStyles:d,uniqueId:p,isMarkdown:v=!1,isTitleBold:h=!1}=e,f=o&&b[o];return(0,r.jsxs)(c.default,{sx:l.box,children:[(n||f)&&(0,r.jsxs)(c.default,{sx:l.titleWrapper,children:[f&&(0,r.jsx)(f,{sx:l.icon}),n&&(0,r.jsx)(u.Text,{variant:"t5",bold:h,uniqueId:`${p}_title`,component:i,children:n})]}),a&&(0,r.jsx)(u.Text,{variant:"t6",uniqueId:`${p}_subtitle`,children:a}),s&&!v&&(0,r.jsx)(u.Text,{variant:"t6",uniqueId:`${p}_body`,sx:d||l.body,children:s}),"string"==typeof s&&v&&(0,r.jsx)(T.T,{markdown:s,styles:C})]})};var j=l(3187),L=l(99858);let M=e=>{let{value:t,title:l,helpLink:n,onChange:i,checked:o,errorText:a,ariaLabelErrorPrefix:s,uniqueId:d}=e,u=!!a,b=((e,{hasError:t=!1,isChecked:l=!1})=>({box:{display:"inline-flex",flexDirection:"column",gap:w.m72},formControl:[{border:`${t?w.PPD:w.RYE} solid ${t?w.uYZ:w.oKw}`,borderRadius:"4px",display:"flex",alignItems:"start",flexDirection:"row",padding:w.yF6,margin:0,gap:w.m72,"&:hover":{boxShadow:l?"none":w.XM9},".MuiTypography-root":{alignSelf:"start",alignItems:"start","&.MuiFormControl
95Label-label":{width:"100%"}},"&:has(span.Mui-checked)":{border:`${w.PPD} solid ${t?w.uYZ:w.H4y}`}},e.applyStyles("midnight-blue",{borderColor:t?w.mIf:w.XgP,"&:has(span.Mui-checked)":{borderColor:t?w.mIf:w.aoF}})],radioButton:{...(0,S.f)(e,{isSelected:!1}),"&.MuiButtonBase-root":{padding:0},"&.Mui-checked":{...(0,S.f)(e,{hasError:t,isSelected:!0})}},helpLink:{color:w.S6v,textDecorationColor:w.S6v,...e.applyStyles("midnight-blue",{color:w.XgP})}}))((0,g.default)(),{hasError:u,isChecked:o}),C=!!n,T=(null==n?void 0:n.text)&&(null==n?void 0:n.href);if(!t||!l&&!d)return console.error(x),null;C&&!T&&console.warn(y),u&&!s&&console.warn(m);let M=`${f}_${l?l.replaceAll(" ",""):d.replaceAll(" ","")}_${t}`,A={"aria-label":`${s}: `,"aria-hidden":!1,focusable:!0};return(0,r.jsxs)(c.default,{sx:b.box,children:[(0,r.jsx)(p.A,{value:t,control:(0,r.jsx)(v.A,{sx:b.radioButton,checked:o,onChange:i,"data-testid":(0,L.A)(f,d),slotProps:{input:{"aria-invalid":u,"aria-describedby":u?M:void 0}}}),label:(0,r.jsx)(I,{...e}),sx:b.formControl}),(0,r.jsx)(h.d,{hasError:u,errorTextId:M,errorIconA11yAttributes:A,errorText:a}),C&&T&&(0,r.jsx)(j.Link,{variant:"t7",sx:b.helpLink,href:n.href,target:n.target||"_self",underline:"always",children:n.text})]})};M.displayName=f;let A="SelectorRadioButtonGroup",k=`${A}-error: invalid props`,z=`${A}-warning: neither 'accessibleLegendText' nor 'ariaLabelledby were provided, the component may not meet accessibility standards`,E=`${A}-warning: 'ariaLabelErrorPrefix' must be provided when 'errorText' is provided, the component may not meet accessibility standards`,$=n.lazy(()=>Promise.resolve().then(l.bind(l,42138)).then(e=>({default:e.Notification}))),D=e=>{let{accessibleLegendText:t,accessibleLegendId:l,accessibleLegendTextProps:c,isAccessibleLegendVisible:p=!1,ariaLabelledBy:v,options:g,onChange:h,selectedOption:f,errorText:x,ariaLabelErrorPrefix:y,uniqueId:m,required:b}=e,S=!!x;if(!g||0===g.length)return console.error(k),null;t||v||console.warn(z),S&&!y&&console.warn(E);let C={radioGroup:{display:"flex",flexDirection:"column",gap:w.Mzk}},T=(0,L.A)(A,m),I=`${T}-error`,j={"aria-label":`${y}: `,"aria-hidden":!1,focusable:!0};return(0,r.jsxs)(i.A,{"data-testid":T,component:"fieldset","aria-invalid":S,"aria-describedby":S?I:void 0,"aria-labelledby":v,"aria-required":b,children:[t&&(0,r.jsx)(o.default,{id:l,component:"legend",sx:p?{}:s.A,children:(0,r.jsx)(u.Text,{...c,children:t})}),(0,r.jsxs)(a.A,{role:void 0,value:f,onChange:e=>h(e.target.value),sx:C.radioGroup,children:[S&&(0,r.jsx)("div",{id:I,children:(0,r.jsx)(n.Suspense,{fallback:null,children:(0,r.jsx)($,{icon:(0,r.jsx)(d.A,{...j}),message:x,uniqueId:m,severity:"critical"})})}),g.map((e,t)=>(0,r.jsx)(M,{ariaLabelErrorPrefix:y,checked:e.value===f||void 0,uniqueId:`${m}-${t}`,...e},e.value))]})]})};D.displayName=A},96270:(e,t,l)=>{l.d(t,{$V:()=>i,$g:()=>s,RE:()=>a,xw:()=>n});var r=l(49909);let n=async(e,t,l,r)=>{var n;try{let n=await fetch(`${e}?orderTotal=${t}&zipcode=${l}`,{method:"POST",signal:r?r.signal:void 0});if(n.ok)return n.json()}catch(e){(null==(n=null==r?void 0:r.signal)?void 0:n.aborted)?console.info("Request getMiniBannerDetails aborted"):console.error("Error fetching MiniBannerDetails:",e);return}},i=(e,t,l,r,n,i)=>l>=r?i?t.reachedMinimumOrderAmount:`${t.surcharge}: ${s(e,0)}`:o(e,i?t.addToPickupText:t.addToRemoveText,r-l,n),o=(e,t,l,r)=>t.replace("${thresholdPrice}",s(e,l)).replace("${surchargePrice}",s(e,r)),a=(e,t,l,r,n,i)=>(i?t.pickupTooltip:l>=r?t.reachedMinimumOrderAmountTooltip:t.tooltip).replace("${freeDeliveryOrderAmount}",s(e,r,0)).replace("${surchargePrice}",s(e,n,0));function s(e,t,l){return new Intl.NumberFormat(e,{currency:r.S6[e],maximumFractionDigits:l,minimumFractionDigits:l,currencyDisplay:"symbol",style:"currency"}).format(t)}},97737:(e,t,l)=>{l.d(t,{SkipLink:()=>u});var r=l(95155),n=l(24880),i=l(12158),o=l(3187);let a="SkipLink",s=`${a}-error: invalid props - missing targetId and/or skipLinkText`,d={display:"block",position:"absolute",top:"auto",left:-999,textAlign:"center",overflow:"hidden",clip:"rect(0,0,0,0)",border:0,"&:focus":{backgroundColor:n.DJJ,left:"3px",top:"3px",height:"auto",width:"30%",zIndex:999,clip:"auto",padding:`${n.m72} ${n.i_v}`},"&:visited":{textDecoration:"none"}},u=({targetId:e,skipLinkText:t,preventHashChange:l=!1})=>e&&t?(0,r.jsx)(o.Link,{href:`#${e}`,sx:d,"data-testid":`jump-to-${e}`,onClick:t=>{if(!l)return;t.preventDefault();let r=document.getElementById(e);r&&(r.hasAttribute("tabindex")?r.focus():(r.setAttribute("tabindex","-1"),r.focus(),r.removeAttribute("tabindex")),r.scrollIntoView({behavior:"smooth",block:"start"}))},children:(0,r.jsx)(i.Text,{variant:"t3",color:n.iCb,children:t})}):(console.error(s),null);u.displayName=a},98011:(e,t,l)=>{l.d(t,{IdlePrompt:()=>c});var r=l(95155),n=l(4255),i=l(12115),o=l(40336),a=l(49090),s=l(12158);let d="IdlePromptDialog_",u=e=>{var t;let l,n,o,u,c,{isOpen:p,onStaySignedIn:v,onCancel:g,onTimeout:h,countDownTime:f,translationText:x}=e,y=(0,i.useRef)(null),[m,b]=(0,i.useState)(f),w=(0,i.useRef)(!0);return((0,i.useEffect)(()=>{(m-1)%30==0?w.current=!1:w.current=!0},[m]),(0,i.useEffect)(()=>{let e=()=>{y&&y.current&&(clearInterval(y.current),y.current=null)};return p?(b(f),y.current=setInterval(()=>{b(t=>(0===t&&(e(),h()),t-1))},1e3)):e(),()=>{e()}},[p,h,f]),x)?(0,r.jsx)(a.Modal,{buttons:[{action:v,text:x.primaryButton},{action:g,text:x.secondaryButton}],hideCloseButton:!0,isOpen:p,modalTitle:x.title,onClose:()=>{},sx:{zIndex:9999},titleId:`${d}Header`,children:(0,r.jsxs)(s.Text,{"aria-atomic":"true","aria-busy":w.current,"aria-live":"polite",uniqueId:`${d}TimerText`,variant:"bodyCopy",children:[x.body1,(0,r.jsx)(s.Text,{bold:!0,component:"span",uniqueId:`${d}Timer`,children:(l=(t={seconds:m,textTemplate:x.body2}).hideLeadingZeroes??!1,n=Math.floor(t.seconds/60),o=t.seconds%60,n<0&&(n=0),o<0&&(o=0),u=n.toString(),c=o.toString(),l||(u=u.padStart(2,"0"),c=c.padStart(2,"0")),t.textTemplate.replace("{minutes}",u).replace("{seconds}",c))})]})}):null},c=e=>{let[t,l]=(0,i.useState)(!1),{idleTime:a,countDownTime:s,translationText:d}=e,{kmsi:c,isKmsiSession:p,isUserSignedIn:v,isLoading:g}=(0,o.A)(),[h,f]=(0,i.useState)(null),x=(0,i.useCallback)(()=>{let e=a-s;h&&clearTimeout(h),f(setTimeout(()=>l(!0),1e3*e))},[h,l,a,s]);return(0,i.useEffect)(()=>{let e=async()=>{let e=await v(),t=await p();e&&!t&&null===h&&x()};return g||e(),()=>{h&&clearTimeout(h)}},[h,p,g,v,x]),(0,r.jsx)(u,{countDownTime:s,isOpen:t,onCancel:()=>l(!1),onStaySignedIn:()=>(l(!1),x(),c()),onTimeout:n.C,translationText:d})};c.displayName="IdlePrompt"}}]);

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.