!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9daf4d76-410b-4776-8eb0-2403ca1f2c1a",e._sentryDebugIdIdentifier="sentry-dbid-9daf4d76-410b-4776-8eb0-2403ca1f2c1a")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5188],{15188:function(e,t,a){a.d(t,{Z:function(){return Y}});var r=a(95235),s=a(82269),i=a(2784),l=a(76542),n=a(64897),o=a(82091),c=a(97224),u=a(46420),d=a(94922),h=a(51505),m=a(82732),p=a(89051),f=a(4721),g=a(1505),b=a(97349),j=a(93056),y=a(21570),x=a(9873),P=a(21059),v=a(95395),O=a(83533),k=a(90862),w=a(2002),F=a(88627),M=(a(64629),a(99140)),S=a(27298),N=a(82090),D=a(26378),I=a(52322);const C=["attribute","items","cmsItems","refine","cmsRefine"];function L(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}const H=e=>{const{attribute:t,items:a,cmsItems:l,refine:n,cmsRefine:o}=e,c=(0,s.Z)(e,C),u=(0,i.useMemo)((()=>(0,N.iJ)(t,a,l)),[t,a,l]),d=(0,i.useCallback)((e=>{let{value:t,cmsValue:a}=e;t&&n(t),a&&o(a)}),[n,o]);return(0,I.jsx)(F.vT,function(e){for(var t=1;t{if(!e?.length)return t||[];if(!t?.length)return e||[];const{interval:r=10,isPromoInFirstPosition:s}=a||{};let i=0;return t.reduce(((t,a,l)=>{if(0===l&&s){const t=e?.[i];return t?(i++,[t,a]):[a]}if(l>0&&l%r===0){const r=e?.[i];return r?(i++,[...t,r,a]):[...t,a]}return[...t,a]}),[])},z=a(62156),_=a(402),B=a(49481),R=a(73353),A=a(33831);const T=["title","attribute"],G=["objectID"],U=["objectID"];function V(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function q(e){for(var t=1;t(ie||[]).flat()),[ie]),Xe=(0,i.useMemo)((()=>Je?.value===d.f.DEFAULT?We.filter((e=>{let{sku:t}=e;return Boolean(t)})):[]),[We,Je]),et=(0,i.useMemo)((()=>{if(ue){const e=We.filter((e=>{let{sku:t}=e;return!t}));return $(e,Xe,{isPromoInFirstPosition:oe})}return We}),[Xe,We,oe,ue]),tt=(0,i.useMemo)((()=>H.map((e=>{let{attribute:t}=e;return t}))),[H]),{appliedFilters:at,filteredProducts:rt,filteredState:st,refine:it,refineByQuery:lt,clearFilters:nt}=(0,v.x3)(Xe,tt,{operator:v.fP.AND,queryToInitializeFilters:(0,o.deserializeHash)(),hidden:ae}),ot=(0,i.useCallback)((e=>(Oe({show:0}),e)),[Oe]),ct=(0,i.useCallback)((function(){return ot(Pe)(...arguments)}),[ot,Pe]),ut=(0,i.useCallback)((e=>{ot((e=>{let{value:t,cmsValue:a}=e;t&&we(t),a&&it(a)}))(e)}),[we,it,ot]),dt=(0,i.useCallback)((()=>{ot((()=>{ke(),nt()}))()}),[ke,nt,ot]),ht=(0,i.useCallback)((function(){ot(Qe)(...arguments)}),[Qe,ot]),mt=(0,i.useCallback)((()=>{const{pageName:e}=J||{};e&&Ie(e),xe&&xe()}),[xe,Ie,J]),pt=(0,i.useCallback)((()=>{const{pageName:e}=J;Ie(e),Oe({show:qe+1})}),[J,qe,Ie,Oe]),ft=(0,i.useMemo)((()=>ge.map((e=>{let{value:t,label:a}=e;return{value:t,label:Ce(a)}}))),[ge,Ce]),gt=(0,i.useRef)(),bt=(0,S.Z)({isSearching:de,cacheKey:"nintendo.plp.cache",cachePrefix:Y,activeIndexName:be,rawSearchHits:me}),jt=(0,i.useMemo)((()=>({value:Je.value,label:Ce(Je.label)})),[Je,Ce]),yt=(0,i.useMemo)((()=>at.map((e=>({attribute:e.split(v.HA)[0],label:e.split(v.HA)[1],value:e})))),[at]),xt=(0,i.useMemo)((()=>{const e=new Set;return rt.filter((t=>{if(!e.has(t.sku))return e.add(t.sku),!0}))}),[rt]),Pt=(0,i.useMemo)((()=>(0,N.hG)(je,yt)),[je,yt]),vt=(0,i.useMemo)((()=>H.map(((e,t)=>{let{title:a,attribute:r}=e,i=(0,s.Z)(e,T);const l=he?.[r]||[];return(0,I.jsx)(E,q({title:a&&Ce(a),attribute:r,startCollapsed:0!==t,showMoreLabel:Ce("Show more"),showLessLabel:Ce("Show less"),collapsible:!0,limit:5,showMore:!0,refine:ct,cmsRefine:it,items:l,cmsItems:st[r]?.items||[],analytics:{pageName:J.pageName}},i),r)}))),[H,Ce,J,st,it,ct,he]),Ot=(0,i.useMemo)((()=>J?.featureFlag?{featureFlag:J.featureFlag}:{featureFlag:He?.id,featureFlagVariant:Ee}),[J,He,Ee]),kt=(0,i.useMemo)((()=>Je?.value===d.f.DEFAULT&&!Pt.length),[Pt,Je]),wt=(0,i.useMemo)((()=>!je?.length&&!yt?.length&&Je?.value===d.f.DEFAULT&&et?.length>0),[je,yt,Je,et]),Ft=wt?et:xt,Mt=W||Ft.length,St=(0,i.useMemo)((()=>Ft.slice(0,Mt*(qe+1))),[qe,Ft,Mt]),Nt=St.length0&&(!It&&!wt||qe>Dt||!St?.length||Je?.value!==d.f.DEFAULT||CtFe?Nt?(0,I.jsx)(A.VR,{children:(0,I.jsx)(f.B,{variant:"tertiary",icon:g.Z,onClick:pt,children:Ce(X)})}):Lt?(0,I.jsx)(F.CD,{isLoading:de,hasMore:pe,onLoadMoreClick:mt}):bt.length>0?(0,I.jsx)(A.VR,{children:(0,I.jsx)(f.B,{variant:"tertiary",icon:g.Z,onClick:pt,children:Ce(X)})}):null:null),[Fe,bt,de,pe,Nt,Lt,Ce,X,mt,pt]),Et=(0,i.useMemo)((()=>wt?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(F.en,{ref:ze,$singleColumnMobile:$e,children:[St.map(((e,t)=>e.sku?(0,i.createElement)(k.I8,q(q(q({},Ot),{},{key:`default-cms-${e.sku}-${t}`},e),{},{constrain:!1,showRating:C||Boolean(Ne.query[M.Tx.UTM_CODE])||!1,mobileHorizontal:$e,analytics:{listDetails:{id:`plp-${(0,w.GL)(J.pageName)}`,name:J.pageName}}})):(0,I.jsx)(D.Z,{cta:e.cta,heading:e.heading,asset:e.asset.primary.assetPath},e.heading+t))),Lt&&bt.map((e=>{let{objectID:t}=e,a=(0,s.Z)(e,G);return(0,I.jsx)(F.xb,q(q({},a),{},{showRating:C||!1,mobileHorizontal:$e,analytics:q({eventName:Te,searchId:a.searchId,position:a.resultsPosition,locale:Ne.locale,pageName:J?.pageName,itemListDetails:{id:`plp-${(0,w.GL)(J.pageName)}`,name:J.pageName}},Ot)}),`default-search-${t}`)}))]}),Ht]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(F.en,{ref:ze,$singleColumnMobile:$e,children:[St.map(((e,t)=>(0,i.createElement)(k.I8,q(q(q({},Ot),{},{key:`filtered-cms-${e.sku}-${t}`},e),{},{constrain:!1,mobileHorizontal:$e,analytics:{listDetails:{id:`plp-${(0,w.GL)(J.pageName)}`,name:J.pageName}}})))),Lt&&bt.map((e=>{let{objectID:t}=e,a=(0,s.Z)(e,U);return(0,I.jsx)(F.xb,q(q({mobileHorizontal:$e},a),{},{analytics:q({eventName:Te,searchId:a.searchId,position:a.resultsPosition,locale:Ne.locale,pageName:J.pageName,itemListDetails:{id:`plp-${(0,w.GL)(J.pageName)}`,name:J.pageName}},Ot)}),`filtered-search-${t}`)}))]}),Ht]})),[J.pageName,Te,wt,C,ze,St,bt,Ne.locale,Ne.query,Ot,$e,Lt,Ht]),Zt=kt&≤(0,z.Z)({isDesktop:Ge,scrollToRef:gt,scrollToElementID:K,enableStickyCollectionNav:te,pillFarm:se.list}),(0,i.useEffect)((()=>{lt((0,o.deserializeHash)(Ne.asPath))}),[lt,Ne.asPath]),(0,i.useEffect)((()=>{Ue.current&>.current&&(0,w.n5)(gt.current,{offsetY:te&&R.d})}),[te,je.length,yt.length]),(0,i.useEffect)((()=>{te&&(0,w.n5)(gt.current,{offsetY:R.d,behavior:"smooth",onlyScrollIfAbove:!0})}),[te]);const $t=()=>(0,I.jsx)(b.B,{currentPage:Ne.pathname,children:V.map(((e,t)=>(0,I.jsx)(c.Z,{href:e.href,children:(0,I.jsx)("a",{children:Ce(e.title)})},e.title+t)))});return(0,I.jsxs)(_.Kq,{preview:t,disableScrollRestoration:!0,children:[ce&&(0,I.jsx)(Se,{children:(0,I.jsx)(Me,{marketingPage:ce})}),V&&(0,I.jsx)(F.JL,{children:$t()}),re?.asset?.primary?.assetPath&&(0,I.jsx)(I.Fragment,{children:Q?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(j.F,{heading:re.heading,subtitle:re.description,image:{desktop:{assetPath:re.asset?.primary?.assetPath},mobile:{assetPath:re.asset?.secondary?.assetPath}},pillFarm:se.list,icon:r}),(0,I.jsx)(F.Hr,{})]}):(0,I.jsx)(F.tm,{iconName:r,content:{assetPath:re.asset?.primary?.assetPath,assetPathAlt:re.asset?.alt,background:re.background,cta:re.cta,description:re.description,heading:re.heading,modifiers:re.modifiers}})}),(0,I.jsxs)(p.H.NewLevel,{children:[!Q&&se?.list.length>0&&(0,I.jsx)(F.$0,{constrained:!0,small:!0,divider:["bottom"],children:(0,I.jsx)(F.l6,{center:!0,items:se.list})}),(0,I.jsx)("span",{ref:gt,id:"products","data-drawer-id":K}),(0,I.jsx)(y.S,{size:36,axis:"vertical"}),(0,I.jsx)(F.He,{children:(0,I.jsxs)(A.zB,{$breadcrumbs:!!V,children:[(0,I.jsx)(h.D,{children:V&&$t()}),(0,I.jsx)(m.S,{label:Ce("Sort by"),onSelect:ht,options:ft,dropdownValue:Fe?jt:null}),(0,I.jsx)(h.M,{children:(0,I.jsx)(F.Lb,{icon:x.Z,variant:"tertiary",onClick:Ye,children:Ce("Filter")})})]})}),(0,I.jsx)(y.S,{size:32,axis:"vertical"}),Zt&&(0,I.jsx)(h.M,{children:(0,I.jsx)(F.mI,{$isOpen:L,$height:Ae,children:(0,I.jsx)(F.He,{children:(0,I.jsx)(F.bn,{ref:Re,children:le})})})}),(0,I.jsx)(F.He,{children:(0,I.jsx)(F.dA,{enableStickyFilterPanel:!0,isFilterModalOpen:Ke,toggleModalFiltersMenu:Ye,attributeFilterSets:vt,isDesktop:Ge,stickyOffset:te&&parseInt(Z.TH)+16,customizeFilters:{activeFilters:Pt,removeFilter:ut,clearFilters:dt,totalHits:ye+xt.length},children:Zt?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(h.D,{children:(0,I.jsx)(F.mI,{$isOpen:L,$height:Be,children:(0,I.jsx)(F.bn,{ref:_e,children:le})})}),!!ne&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(P.S,{children:(0,I.jsx)(p.H,{children:Ce(ne)})}),Et]})]}):Et})}),(0,I.jsx)(F.y4,{})]})]})}J.defaultProps={filterCMSProducts:!0,seeAllCtaLabel:"See all"};var Y=J},27298:function(e,t,a){var r=a(82269),s=a(2784),i=a(64897),l=a(76187),n=a(82091),o=a(44644);const c=["p"];t.Z=e=>{const{0:t,1:a}=(0,s.useState)([]),{isSearching:u,cacheKey:d,cachePrefix:h,activeIndexName:m,rawSearchHits:p}=e,f=(0,i.Z)(),g=(0,n.useLocalizer)();return(0,s.useEffect)((()=>{const e=(0,n.deserializeHash)(f.asPath),{p:t}=e,s=(0,r.Z)(e,c),i=o.U2(d,{}),b=`${h}_${JSON.stringify(s)}_${f.locale}`,j=u?i[b]||[]:((e,t)=>{const a=t?.[0]?.__position||0;return[...(e||[]).slice(0,a),...t]})(i[b],p);o.t8(d,{[b]:j});const y=Object.values(j).sort(((e,t)=>e.__position-t.__position)),x=(0,l.p)(y,{locale:f.locale,localizer:g,indexName:m});a(x)}),[u,d,h,p,f.asPath,f.locale,m,g]),t}}}]); //# sourceMappingURL=5188-65b5614aba19034e.js.map