"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7753],{18954:(e,o,t)=>{t.d(o,{e:()=>a});var l=t(14232);function a(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],[o,t]=(0,l.useState)(e);return[o,(0,l.useCallback)(e=>t(o=>"boolean"==typeof e?e:!o),[])]}},36175:(e,o,t)=>{t.d(o,{X6:()=>s,_2:()=>d,lP:()=>r});var l=t(35881),a=t(5323),n=t(99013),i=t(74199);let r=(0,l.Mz)(n.MH,e=>e?.facet_list),d=(0,l.Mz)([r],e=>e?.filter(e=>e?.facet_id!==i.hv)),s=e=>(0,l.Mz)([r],o=>{let t=o?.find(o=>o?.facet_id===e);return t?.facet_id===i.iE?{...t,options:a(t.options??[],e=>+(e.id!==i.hO))}:t})},36882:(e,o,t)=>{t.d(o,{n:()=>M});var l=t(37876),a=t(14232),n=t(22740),i=t(75186),r=t(94107),d=t(60045),s=t(86139);let{useMutation:c}=(0,r.k)({name:"@web/domain-cdui-orchestrations/mutations/post-update-deferred-enrichment",mutationFn:async e=>{let{enrichmentQueryParameters:o,moduleEnrichmentContext:t,moduleType:l,pageType:a}=e,{apis:n,apiKey:r}=(0,i.config)().services.apiPlatform,{cduiOrchestrations:c}=n,u=`${c.endpointPaths.pagesV1}/${a}/deferred_enrichment/modules`,m=s.o.buildURLWithParams(u,{...o,key:r},c.baseUrl),{data:p,ok:h,status:x,statusText:b}=await (0,d.bE)(m,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({modules:[{module_type:l,enrichment_context:t}]})});if(h)return p;throw Error(`${x}-${b}`)}});var u=t(61548),m=t(83967);let p=(0,a.memo)(e=>{let{ModuleComponent:o,module_data:t,moduleMetadata:a}=e;return(0,l.jsx)(o,{...t,moduleMetadata:a})});p.displayName="ModuleComponentMemo";var h=t(63663),x=t(77232);let b=x.I4.div.withConfig({componentId:"sc-56dbb15f-0"})(["position:absolute;inset:32px 0 0;opacity:0;transition:opacity 300ms;pointer-events:none;&:first-child{display:none;}&::before{content:'';z-index:1;display:block;position:absolute;inset:0;opacity:0.05;border-color:var(--debug-color);border-style:solid;border-top-width:var(--module-gap-top);border-bottom-width:var(--module-gap-bottom);border-left-width:var(--module-gap-left);border-right-width:var(--module-gap-right);}&::after{content:'';display:block;position:absolute;top:var(--module-gap-top);bottom:var(--module-gap-bottom);left:var(--module-gap-left);right:var(--module-gap-right);border:1px dashed color-mix(in lab,var(--debug-color),#ccc 80%);}"]),g=(0,x.DU)(["body:has(#show-module-gaps:checked) ","{opacity:1;}"],b),f=x.I4.div.withConfig({componentId:"sc-56dbb15f-1"})(["position:absolute;font-size:11px;z-index:2;border-radius:4px;background:color-mix(in lab,var(--debug-color),white 95%);color:color-mix(in lab,var(--debug-color),black 50%);",":0;",":calc(50% - 8px);"],e=>{let{$side:o}=e;return`${o}`},e=>{let{$side:o}=e;return`${"top"===o||"bottom"===o?"left":"top"}`}),y=e=>{let{side:o}=e,t=(0,a.useRef)(null),n=((e,o)=>{if(e.current)return getComputedStyle(e.current).getPropertyValue(`--module-gap-${o}`)})(t,o);return(0,l.jsx)(f,{$side:o,ref:t,children:n})};y.displayName="GapValue";let v=()=>(0,h.t)()?(0,l.jsxs)(b,{"data-gap-visualizer":!0,children:[(0,l.jsx)(g,{}),(0,l.jsx)(y,{side:"top"}),(0,l.jsx)(y,{side:"bottom"}),(0,l.jsx)(y,{side:"left"}),(0,l.jsx)(y,{side:"right"})]}):null;v.displayName="ConfigDrivenUiDebugGapVisualizer";let j=e=>{let{modulesToComponentsMap:o,conditionMap:t,module:a,moduleMetadata:n}=e,{module_type:i,module_data:r}=a??{},d=i?o[i]:void 0,s=d&&"component"in d?d.component:d,c=r?.conditions,u=(0,m.P)(c,t);return s&&u?(0,l.jsxs)("div",{"data-module-type":i,children:[(0,l.jsx)(p,{module_data:r,ModuleComponent:s,moduleMetadata:n}),(0,l.jsx)(v,{})]}):null};j.displayName="ConfigDrivenUiModuleInternal";var k=t(52499),N=t(12417);let C=e=>{let{children:o,handleIntersectedOnce:t,isEnrichmentDeferred:a}=e;return a?(0,l.jsx)(N.t,{onIntersectedOnce:t,children:o}):o};C.displayName="ConfigDrivenUiDeferredEnrichmentWrapper";let M=e=>{let{conditionMap:o,extensions:t,module:i,moduleGroupId:r,modulesToComponentsMap:d,zoneId:s}=e,{is_enrichment_deferred:m=!1,module_type:p,module_data:h}=i,{page_type:x,parameters:b}=t?.deferred_enrichment_context??{},[g,f]=(0,a.useState)(),y=(0,a.useMemo)(()=>({...i,module_data:g??h}),[i,h,g]),[v,N]=(0,a.useState)(),[M,w]=(0,a.useState)({isLoading:m}),[_]=c(),D=(0,a.useCallback)(async()=>{if(m){let e=(e=>e?e.reduce((e,o)=>(o.key&&o.value&&(e[o.key]=o.value),e),{}):{})(b);await _({enrichmentQueryParameters:e,moduleEnrichmentContext:y.enrichment_context??"",moduleType:y.module_type??"",pageType:x},{onSuccess:e=>{e?.modules?.[0]?.module_data&&N({...e.modules[0],module_data:e.modules[0].module_data,key:e.modules[0].key||y.key}),w({isLoading:!1})},onError:()=>{w({isLoading:!1})}})}},[m,y.enrichment_context,y.key,y.module_type,x,b,_]),I=v??y;return(0,l.jsx)(k.a,{conditionMap:o,isModule:!0,moduleData:I.module_data,moduleType:p,setDebugModuleData:f,children:(0,l.jsx)(u.H,{action:`error_boundary_zone_${s}_module_group_${r}_module_${p}_non_critical_error`,children:(0,l.jsx)(C,{handleIntersectedOnce:D,isEnrichmentDeferred:m,children:(0,l.jsx)(n.e,{module_type:p,children:(0,l.jsx)(j,{conditionMap:o,module:I,moduleMetadata:M,modulesToComponentsMap:d})})})})})};M.displayName="ConfigDrivenUiModule"},52499:(e,o,t)=>{t.d(o,{a:()=>k});var l=t(37876),a=t(18954),n=t(77216),i=t(63663),r=t(77232),d=t(73076),s=t(20581);let c=(0,r.I4)(s.T).withConfig({componentId:"sc-3a815027-0"})(["width:24px;padding:4px;align-items:center;align-self:stretch;color:color-mix(in lab,var(--debug-color),black 50%);&:focus{color:color-mix(in lab,var(--debug-color),black 50%);}"]),u=(0,r.I4)(c).withConfig({componentId:"sc-3a815027-1"})(["svg{transition:transform 300ms;",";}"],e=>e.$isOpen?"":"transform: rotate(-180deg)"),m=r.I4.div.withConfig({componentId:"sc-3a815027-2"})(["width:24px;padding:4px;align-self:stretch;display:flex;align-items:center;cursor:pointer;"]),p=r.I4.div.withConfig({componentId:"sc-3a815027-3"})(["--debug-color:",";&:has([data-label='module: ProductListCard']){--debug-color:",";[data-label='module: ProductListCard']::before{content:'Pseudo-';font-weight:bold;}}border:1px solid color-mix(in lab,var(--debug-color),black 20%);border-radius:4px;margin:4px;position:relative;> .cdui-module-label{background:color-mix(in lab,var(--debug-color),white 70%);border-radius:",";color:color-mix(in lab,var(--debug-color),black 50%);font-size:",";padding:",";position:relative;display:flex;align-items:center;gap:8px;> span{flex-grow:1;word-break:break-all;}}.cdui-empty-warning{display:none;border-radius:0 0 4px 4px;color:color-mix(in lab,var(--debug-color),black 50%);background:color-mix(in lab,var(--debug-color),white 90%);font-size:",";padding:4px 8px;}*:has([data-gap-visualizer]:first-child) + .cdui-empty-warning{display:block;}> [data-module-type]{margin:0 !important;}"],e=>{let{$isModule:o}=e;return o?"magenta":"cornflowerblue"},e=>{let{$isModule:o}=e;return o?"green":"cornflowerblue"},e=>{let{$isCollapsed:o}=e;return o?"4px":"4px 4px 0 0"},d.eD8,e=>{let{$isModule:o}=e;return o?"4px":"4px 8px"},d.eD8);var h=t(83967);let x=e=>{let{className:o,moduleType:t,moduleGroupId:a,zoneId:n,isModule:i}=e,r=i?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"h-text-bold",children:"Module: "}),(0,l.jsx)("code",{children:t})]}):a===n?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"h-text-bold",children:"Zone & Module Group: "}),(0,l.jsx)("code",{children:a})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"h-text-bold",children:"Zone: "}),(0,l.jsx)("code",{children:n}),", ",(0,l.jsx)("span",{className:"h-text-bold",children:"Module Group: "}),(0,l.jsx)("code",{children:a})]}),d=i?`module: ${t}`:`zone: ${n}, module group: ${a}`;return(0,l.jsx)("span",{className:o,"data-label":d,"data-test":"cdui-module-label",children:r})};x.displayName="ConfigDrivenUiDebugLabel";var b=t(14232),g=t(98932),f=t(38414);let y=(e,o)=>{let{stringOnError:t,shouldSkip:l}=o??{};return(0,b.useMemo)(()=>{if(!l)try{return JSON.stringify(e,void 0,2)}catch{return t}},[t,e,l])};var v=t(17154);let j=e=>{let{conditionMap:o,isDebugging:t,isInfoOpen:n,isModule:i,layoutMetadata:r,moduleData:d,moduleType:s,setDebugModuleData:c,toggleIsInfoOpen:u}=e,m=d?.conditions,p=(m?.length??0)>0,h=!i&&!!r,x="Sorry, error showing data.",j=y(d,{shouldSkip:!t,stringOnError:x}),k=y((0,b.useMemo)(()=>{if(t)return m?.map(e=>{let{condition_id:t,value:l}=e,a=o?.[t??""],n=l===a?"✅ condition met":`❌ condition not met, hiding module (expected: ${l}, actual: ${a})`;return{condition_id:t,value:l,_debug:n}})},[t,m,o]),{shouldSkip:!t,stringOnError:x}),N=y(r,{shouldSkip:!t,stringOnError:x}),C=(0,b.useCallback)(e=>(0,l.jsx)(g.EZ,{...e,children:"Module Info"}),[]),[M,w]=(0,a.e)(!1),_=(0,b.useRef)(null),D=(0,b.useCallback)(()=>{w(),setTimeout(()=>_.current?.focus(),0)},[w]),I=(0,b.useCallback)(e=>{e.preventDefault();let o=new FormData(e.target),t=o.get("moduleData")?.toString();if(t)try{c?.(JSON.parse(t))}catch{alert("Could not parse JSON - try again.");return}w()},[c,w]);return(0,l.jsxs)(f.a,{className:v.modal,isOpen:n,onOpenChange:u,renderHeading:C,shouldNotTrack:!0,type:"drawer-right",children:[i?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"h-margin-b-default",children:[(0,l.jsx)("div",{className:"h-text-bold h-margin-b-tiny",children:"Module Type"}),(0,l.jsx)(g.N_,{href:`https://go/cdui-modules/${s}`,children:(0,l.jsx)("code",{children:s})})]}),(0,l.jsxs)("div",{className:"h-margin-b-default",children:[(0,l.jsx)("div",{className:"h-text-bold h-margin-b-tiny",children:"Module Documentation"}),(0,l.jsxs)(g.N_,{className:"h-text-normal h-margin-l-tiny h-text-md",href:`https://go/cdui-modules/${s}`,children:["https://go/cdui-modules/",s]})]}),(0,l.jsxs)("div",{className:"h-margin-b-default",children:[(0,l.jsxs)("div",{className:"h-text-bold h-margin-b-default",children:["Module Data"," ",M?null:(0,l.jsx)(g.N_,{className:"h-text-normal h-margin-l-tiny h-text-md",onClick:D,children:"Edit"})]}),M?(0,l.jsxs)("form",{onSubmit:I,children:[(0,l.jsx)("div",{children:(0,l.jsx)("textarea",{className:v.codeBlock,defaultValue:j,name:"moduleData",ref:_,rows:10})}),(0,l.jsxs)("div",{className:v.buttonGroup,children:[(0,l.jsx)(g.$n,{type:"submit",children:"Save"}),(0,l.jsx)(g.$n,{onClick:w,variant:"outlined",children:"Cancel"})]})]}):(0,l.jsx)("button",{"aria-label":"Edit module data",className:v.codeBlock,onClick:D,type:"button",children:(0,l.jsx)("pre",{children:(0,l.jsx)("code",{children:j})})})]}),p&&!M?(0,l.jsxs)("div",{className:"h-margin-b-default",children:[(0,l.jsx)("div",{className:"h-text-bold h-margin-b-tiny",children:"Conditions"}),(0,l.jsx)("div",{className:v.codeBlock,children:(0,l.jsx)("pre",{children:(0,l.jsx)("code",{children:k})})})]}):null]}):null,h?(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"h-text-bold h-margin-b-tiny",children:"Layout Metadata"}),(0,l.jsx)("pre",{children:(0,l.jsx)("code",{children:N})})]}):null]})};j.displayName="ConfigDrivenUiDebugModuleModal";let k=e=>{let{zoneId:o,moduleGroupId:t,moduleType:r,moduleData:d,isModule:s,conditionMap:b,children:g,layoutMetadata:f,setDebugModuleData:y}=e,v=d?.conditions,k=(0,h.P)(v,b??{}),N=!s||k,[C,M]=(0,a.e)(!0),[w,_]=(0,a.e)(!1),D=(0,i.t)()&&(s?!!r:!!(o&&t));return D&&(!s||r)&&(s||o||t)?(0,l.jsxs)(p,{$isCollapsed:!C||!k,$isModule:s,children:[(0,l.jsxs)("div",{className:"cdui-module-label",children:[N?(0,l.jsx)(u,{$isOpen:C,"aria-label":C?"Collapse":"Expand",onClick:M,children:(0,l.jsx)(n.IconArrowDown,{})}):(0,l.jsx)(m,{title:"This module is hidden because one or more of its conditions weren't met.",children:(0,l.jsx)(n.IconVisibilityOff,{})}),(0,l.jsx)(x,{isModule:s,moduleGroupId:t,moduleType:r,zoneId:o}),(0,l.jsx)(c,{"aria-label":s?"View module data":"View layout metadata",onClick:_,children:(0,l.jsx)(n.IconInfo,{})}),(0,l.jsx)(j,{conditionMap:b,isDebugging:D,isInfoOpen:w,isModule:s,layoutMetadata:f,moduleData:d,moduleType:r,setDebugModuleData:y,toggleIsInfoOpen:_})]}),C?(0,l.jsxs)(l.Fragment,{children:[g,s&&k?(0,l.jsxs)("div",{className:"cdui-empty-warning",children:["This module met all its conditions, but chose not to display anything. This often means the module is irrelevant to the current experience. (For example,"," ",(0,l.jsx)("code",{children:"ProductDetailFeaturedInCollections"})," only appears on products that are part of a collection.)"]}):null]}):null]}):g};k.displayName="ConfigDrivenUiDebugBorder"},73543:(e,o,t)=>{t.d(o,{Y:()=>s});var l=t(37876),a=t(35333),n=t(829),i=t(38145),r=t(36882),d=t(52499);let s=e=>{let{conditionMap:o,extensions:t,layout:s,zoneId:c,moduleGroupId:u=c,modulesToComponentsMap:m}=e,{asPath:p}=(0,a.rd)(),h=(0,n.x6)(p),x=(0,i.Hy)({zoneId:c,moduleGroupId:u})({data:{layout:s}}),b={...s,zones:void 0};return x?(0,l.jsx)(d.a,{isModule:!1,layoutMetadata:b,moduleGroupId:u,zoneId:c,children:x.map(e=>(0,l.jsx)(r.n,{conditionMap:o,extensions:t,module:e,moduleGroupId:u,modulesToComponentsMap:m,zoneId:c},`${h}-${e.key}`))}):null};s.displayName="ConfigDrivenUiModuleGroup"},83967:(e,o,t)=>{t.d(o,{O:()=>a,P:()=>n});var l=t(14232);let a=(e,o)=>{let{condition_id:t,value:l}=o;return!(t&&Object.prototype.hasOwnProperty.call(e,t))||!!e[t]==!!l},n=(e,o)=>(0,l.useMemo)(()=>!e||e.every(e=>a(o,e)),[e,o])}}]);