Loading
function(e,t,l){l.d(t,{XU:()=>L,Yr:()=>g,k0:()=>k});var n=l(64700),u=l(873263),r=l(17928),i=l(775602),s=l(793574),a=l(688810),c=l(590180),o=l(870216),d=l(298072),p=l(238184),h=l(572595),f=l(159439),A=l(57020),E=l(652215);let S="#itemSkuId=",m=RegExp(`^${S}(\\d+)$`),I=[E.BVt.COLLECTIBLES_SHOP],g=e=>{let t=(0,u.zy)();n.useEffect(()=>{if(null!=e&&I.includes(t.pathname))return()=>{window.location.hash.startsWith(S)&&window.location.replace("#")}},[e,t.pathname])},L=e=>{let t=(0,f.U)(),l=n.useRef(null),i=(0,u.zy)(),S=i.pathname===E.BVt.COLLECTIBLES_SHOP?s.A.HOME_PAGE_SHOP_TAB:s.A.COLLECTIBLES_SHOP,{analyticsLocations:I}=(0,a.Ay)(S),g=(0,p.A)();n.useEffect(()=>{let e=m.exec(i.hash);null!=e?l.current=e[1]:l.current=null},[g,i.hash]);let L=(0,r.bG)([o.A],()=>o.A.initialProductSkuId);n.useEffect(()=>{if(t)return;let n=null;if(null!=L?n=L:null!=l.current&&(n=l.current),null!=n){let t=setTimeout(()=>{(e=>{let{productSkuId:t,analyticsLocations:l,analyticsSource:n,tab:u,sessionId:r}=e,i=c.A.getProduct(t),s=c.A.getCategoryForProduct(t);if(null!=i&&null!=s){let e=i,a=(0,A.A)({product:i}),o=document.getElementById(`shop-item-${e.skuId}`);if(o!==document.activeElement&&o?.focus(),null!=i.variantGroupStoreListingId){let l=c.A.getProductByStoreListingId(i.variantGroupStoreListingId);if(null!=l){e=l;let n=l.variants?.findIndex(e=>e.skuId===t);null!=n&&n>-1&&(0,d.n)(l,n)}}(0,h.t)({product:e,category:s,analyticsSource:n,analyticsLocations:l,tab:u,shouldCheckoutWithOrbs:a,sessionId:r})}})({productSkuId:n,analyticsLocations:I,analyticsSource:S,tab:g,sessionId:e})},250);return()=>clearTimeout(t)}},[I,S,t,L,g,e])},k=e=>{let t=n.useRef({}),l=(0,r.bG)([i.Ay],()=>i.Ay.useReducedMotion),u=(0,r.bG)([c.A],()=>c.A.isFetchingCategories),[s,a]=n.useState(null),o=n.useCallback((e,l)=>{t.current[e]=l},[]),d=n.useCallback(n=>{u?a(n):setTimeout(()=>{let u=t.current[n];null!=u&&e?.scrollIntoViewNode({node:u,padding:48,animate:!l,shouldScrollToStart:!0})},100)},[e,l,u,a]);return n.useEffect(()=>{u||null==s||(d(s),a(null))},[u,d,s,a]),{setCategoryRef:o,handleScrollToCategory:d}}}