PageSourceSearch

https://cdn.petsathome.com/public/static/store/1.1.7631/_next/static/chunks/61033-48ad206a54bd8874.js

js petsathome.com collected 2026-10-01 10:33:45 UTC 10,887 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[61033],{10217:e=>{e.exports={root:"results-grid_root__cw7Mi",item:"results-grid_item__BuYWN","item-full":"results-grid_item-full__ypEli",disruptor:"results-grid_disruptor___ma17",enhanced:"results-grid_enhanced__4IYFZ"}},30987:(e,t,r)=>{"use strict";r.d(t,{L:()=>W});var s=r(6029),i=r(97455),o=r(96430),l=r(25548),a=r(16932),n=r(14251),c=r(39195),u=r(25820),d=r(26786),p=r(83817),m=r.n(p),g=r(90429),h=r(81278),f=r(37016),_=r(55729),b=r(40061),y=r(20444),v=r(19365),x=r(32020),I=r(84905),C=r(90754),P=r(38955),S=r(2567),T=r(37365),k=r(47471),N=r(33497),B=r(14765),w=r(66219),L=r(10217),O=r.n(L);let j=(0,_.memo)(({result:e,itemRefs:t,isLoading:r,shouldOptimise:i,isBloomreachSliceIdEnabled:o,isPlpImageScrollEnabled:l,isQuickAddToBasketEnabled:a})=>{let n,{baseProductId:c,name:u,callout:d,imageUrls:p,price:{min:m,max:h,label:f,theme:b},metadata:{seoUrlPart:y},isInStock:P,promotionName:S,regularPrice:B,easyRepeat:L,healthPlan:j,productSizes:E,netValues:R,averageRating:A,ratingCount:F,enrichedCallout:M,promotionTheme:D,promotionIsPetsClubOnlyOffer:G,displayPricePerUnit:H,products:W,sliceId:Q,fullItemName:z,flavour:U,brandsDisplayText:V,colourDisplay:Z,otherVariantInStock:q,isNonSubscriptionSQP:J}=e,{t:K}=(0,g.Bd)(["product","search"]),{mutate:Y}=(0,C.L)(),{logPlpImageScroll:$}=(n=(0,x.s)(),{logPlpImageScroll:({itemId:e,imageIndex:t})=>{n.logEvent({event:"plp_image_scroll",item_id:e,image_index:t})}}),{displayName:X}=M??{},ee=W?.[0],{promotionPrice:et,productId:er,pricePerUom:es,isPromotionCartDiscount:ei,promotionMechanic:eo,variantCount:el}=ee??{},ea=G?.includes(!0)??!1,en=W?.length===1,ec=j?.toLowerCase()==="yes",eu=!!(ee?.isNonSubscriptionSQP??J),{isSliced:ed,title:ep,tileUrl:em,tileProductSizes:eg,tileProductWeights:eh,tileImages:ef}=(({baseProductId:e,seoUrlPart:t,isBloomreachSliceIdEnabled:r,sliceId:s,productId:i,fullItemName:o,name:l,productLabel:a,productSizes:n,netValues:c,imageUrls:u})=>{let d=r&&!!s,p=d&&o?o:l,m=(0,v.P)(e,{seoUrlPart:t??"",params:d&&i?{productId:i}:void 0}),g=a?[a]:void 0;return{isSliced:d,title:p,tileUrl:m,tileProductSizes:d?void 0:n,tileProductWeights:d&&g?g:c,tileImages:u.map(e=>({src:e,alt:p}))}})({baseProductId:c,seoUrlPart:y,isBloomreachSliceIdEnabled:o,sliceId:Q,productId:er,fullItemName:z,name:u,productLabel:ee?.label,productSizes:E,netValues:R,imageUrls:p}),e_={averageRating:A,reviewCount:F,labels:{reviews:K("product:review",{count:F}),starRatingAriaLabel:K("product:ratings_and_reviews.star_rating",{averageRating:A})}},eb=!!(S?.length&&S.length>=2),ey=S?.length&&S.length>=2?K("search:multiple_offers_available"):S?.length===1?S[0]:"",{cta:ev}=(0,I.h)({baseProductId:c,isSliced:ed,isOutOfStock:!P,isSingleVariant:en,isHealthPlan:ec,isNonSubSQP:eu,otherVariantInStock:q,productId:er??void 0,productName:ep,fullItemName:z,locationType:"Lister"}),ex=(0,_.useCallback)(e=>{let r=[c,Q].filter(e=>!!e);e?r.forEach(r=>t.current.set(r,e)):r.forEach(e=>t.current.delete(e))},[c,t,Q]),eI={pricing:{minPrice:m,maxPrice:h,regularPrice:B,promotionPrice:en?et:void 0,label:f,theme:b,isEasyRepeat:L?.toLowerCase()==="yes",isHealthPlan:ec,pricePerUom:es,displayPricePerUnit:H,isPromotionCartDiscount:ei,promotionMechanic:eo,hasMultipleOffers:eb,isMultiVariant:!en},tag:(0,T.b)({labels:{outOfStock:K("search:out_of_stock"),callout:d,displayName:X},isInStock:P,...(0,k.yu)({callout:M})}),callToAction:a?{...ev,shouldDisplayOnHover:!0}:void 0,isLoading:r,shouldOptimise:i,promotionText:ey,promotionTheme:D,orientation:"dynamic",labels:{healthPlan:K("product:health_plan.label"),nextImage:K("product:image_scroll.next"),previousImage:K("product:image_scroll.previous"),dotImage:K("product:image_scroll.dot"),imagePosition:K("product:image_scroll.position")},onClick:()=>Y({subject:"Product",action:"Clicked",scope:"Base",data:ed&&er?er:c,location:globalThis.location.href}),ref:ex,promotionIsPetsClubOnlyOffer:ea,isEnhanced:a,product:{title:ep,image:{src:p[0],alt:ep},url:em,productSizes:eg,productWeights:eh,productRating:e_,flavour:U,brand:V,variantOptions:(0,N.r)({variantCount:el,t:K}),colour:Z,images:l?ef:void 0}};return(0,s.jsx)("li",{className:O().item,children:(0,s.jsx)(w.W,{...eI,product:{...eI.product,images:l?ef:void 0},onImageScroll:l?e=>$({itemId:c,imageIndex:e}):void 0})})});j.displayName="ResultsGridItem";let E=({isLoading:e,results:t,optimisedTileCount:r,disruptorTiles:i})=>{let{t:o}=(0,g.Bd)(["product","search"]),{isBloomreachSliceIdEnabled:l=!1,isPlpImageScrollEnabled:a=!1,isQuickAddToBasketEnabled:n=!1}=(0,S.ut)(["isBloomreachSliceIdEnabled","isPlpImageScrollEnabled","isQuickAddToBasketEnabled"]),[c]=(0,f.ZA)("target",f.tU.withDefault("")),u=(0,_.useRef)(new Map);(0,P.u)(()=>{let e=u.current.get(c);e?.scrollIntoView({behavior:"instant",block:"center"})});let d=(0,_.useMemo)(()=>
1{if(!i?.length)return t??[];let e=[...i].sort((e,t)=>(e.indexPlacement??0)-(t.indexPlacement??0)),r=[...t??[]];for(let t of e)r.splice(t.indexPlacement??0,0,t);return r},[i,t]);return(0,s.jsx)("ul",{className:O().root,"aria-label":o("product:results_grid"),children:d.map((t,i)=>{let o="baseProductId"in t?t.sliceId||t.itemId||i:t.itemId||i;return(0,s.jsxs)(_.Fragment,{children:["disruptorType"in t&&(0,s.jsx)("li",{className:(0,y.p)([O().item,O().disruptor,t?.isFullWidth&&O()["item-full"],O().enhanced]),children:(0,s.jsx)(B.r,{...t})}),"baseProductId"in t&&(0,s.jsx)(j,{result:t,itemRefs:u,isLoading:e,isBloomreachSliceIdEnabled:l,isPlpImageScrollEnabled:a,isQuickAddToBasketEnabled:n,shouldOptimise:i<r})]},o)})})};var R=r(37316),A=r(33266),F=r(14048),M=r(19311),D=r(45646),G=r.n(D);let H=()=>{let{t:e}=(0,g.Bd)("search");return(0,s.jsxs)("div",{className:G()["no-results"],children:[(0,s.jsx)("h1",{className:"type-helpetica type-subheading",children:e("sorry_no_results")}),(0,s.jsx)("p",{className:"type-w-regular type-attention",children:e("check_spelling")})]})},W=({additionalClassName:e,drawerActive:t,optimisedTileCount:r,setDrawerActive:p,primaryFilter:v,isSearchTerm:x,disruptorTiles:I,isLoading:C,isFetching:P,isSuccess:S,resultCount:T,results:k,offset:N,limit:B,facets:w,isLister:L})=>{let{query:O,asPath:j}=(0,h.useRouter)(),{t:D}=(0,g.Bd)("search"),{mutate:W}=(0,a.n)({mutationKey:[o.B.TrackListingActivity],mutationFn:async e=>{let{isError:t,error:r}=await (0,l.bN)(e);if(t)throw r}}),Q=(0,_.useMemo)(()=>k?.map(({baseProductId:e})=>e).sort((e,t)=>e.localeCompare(t)),[k]),z=(0,_.useRef)(null),[U]=(0,f.ZA)("page",f.GJ.withDefault(1)),{activeFilters:V,activeFilterCount:Z,searchTerm:q,sortingMethod:J}=(0,n.g)(),{handleApplyFilter:K,handleClearFilters:Y}=(0,A.R)({activeFilters:V}),{isPaginated:$,handleLoadPrevious:X,canLoadPrevious:ee,handleLoadMore:et,canLoadMore:er}=(0,F.D)({resultCount:T}),es=(0,i.Qx)(e=>e.previousPage),ei=!C&&S&&0===T||!x||k?.length===0;(0,_.useEffect)(()=>{!S||P||!Q||m()(z.current,Q)||(z.current=Q,W({entityIds:Q,filters:Object.fromEntries(V),limit:B,offset:N,location:window.location.href,searchTerm:q,sortBy:J,count:T}))},[Q,V,U,q,J,T]);let eo=(0,M.L)({asPath:j,searchTerm:O?.searchTerm,page:U,previousPage:es,direction:"previous"});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:(0,y.p)([G().root,G().wrapper,e]),children:[ei?(0,s.jsx)(H,{}):(0,s.jsxs)("section",{className:G().grid,children:[(0,s.jsx)(u.R,{t:D,isLoading:!!P,isSuccess:!!S,resultCount:T}),$&&x&&ee&&(0,s.jsx)(b.$,{onClick:e=>{e.preventDefault(),P||X()},loading:!!P,disabled:!!P,primary:!1,theme:"black",loaderTheme:"black",additionalClassName:G().more,url:eo,children:D("search:pagination_previous")}),(0,s.jsx)(E,{isLoading:!!C,results:k??[],optimisedTileCount:r,disruptorTiles:N||0!==V.size?void 0:I})]}),(0,s.jsx)(R.H,{isSearchTerm:x,resultCount:T,resultsBeingViewed:k?.length??0,isLoadingResults:!!P,previousPage:es,isPaginated:$,canLoadMore:er,onLoadMoreResults:et}),ei&&!L&&(0,s.jsx)(d.e,{heading:{signedOutText:D("common:recommended_products_heading"),signedInText:D("common:recommended_products_heading")}})]}),(0,s.jsx)(c._,{t:D,isLoading:C,canClear:0!==Z,facets:w,isOpen:t,onApplyFilter:K,onClearFilters:async()=>await Y(),onCloseFilters:()=>p(!1),resultCount:T,primaryFilter:v,fullPath:j})]})}},38955:(e,t,r)=>{"use strict";r.d(t,{u:()=>i});var s=r(55729);let i=e=>{(0,s.useEffect)(e,[])}},47471:(e,t,r)=>{"use strict";r.d(t,{dW:()=>i,xJ:()=>o,yu:()=>s});let s=({callout:e})=>e?.theme?.backgroundHexColor&&e.theme.foregroundHexColor?{backgroundColor:e.theme.backgroundHexColor,color:e.theme.foregroundHexColor}:{},i=e=>({backgroundColor:e?.backgroundHexColor??"",color:e?.foregroundHexColor??""}),o=e=>{let{color:t,backgroundColor:r}=i(e);return t&&r?{"--color":t,"--bg-color":r}:void 0}},67100:(e,t,r)=>{"use strict";r.d(t,{W:()=>m});var s=r(70639),i=r(97455),o=r(96430),l=r(59833),a=r(12482),n=r(28459),c=r(81278),u=r(55729),d=r(49832),p=r(36116);let m=({initialResults:e,defaultFilter:t,refetchOnMount:r=!1,refetchOnWindowFocus:m=!1})=>{var g;let h,f,{query:_,pathname:b}=(0,c.useRouter)(),{slug:y,searchTerm:v}=_,x=(g=y?.at(-1),g&&s._v.some(e=>b.includes(e))?g.replaceAll("-","_"):v?v.toString():"pets_at_home"),I=(0,u.useRef)(x),C=(0,u.useRef)(b),P=(0,u.useMemo)(()=>e?{...e,products:e.products.map(e=>({...e,isInitial:!0}))}:void 0,[e]),S=_?.page??1,T=I.current!==x,{resetPaginationState:k,previousPage:N,direction:B}
1=(0,i.Qx)((0,d.k)(e=>({resetPaginationState:e.resetPaginationState,previousPage:e.previousPage,direction:e.direction}))),w=(!B||"next"===B?S:N)?.toString(),L=!T&&(!!_.filters||!!_.sortBy||!!_.page),{isLoading:O,isSuccess:j,isError:E,data:R,isFetching:A}=(h={page:w,filters:(0,n.N)(t,_.filters),sortBy:_.sortBy?_.sortBy:"best-match",searchType:(e=>{switch(!0){case e.includes(s.tl.PRODUCT_LISTING):return"Category";case e.includes(s.tl.BRANDS_LISTING):return"Brand";case e.includes(s.tl.CAMPAIGNS_LISTING):return"Campaign";case e.includes(s.tl.PROMOTIONS_LISTING):return"Promotion";case e.includes(s.tl.COLLECTIONS_LISTING):return"Collection";default:return"Product"}})(b)},f={initialData:P,enabled:L,refetchOnMount:r,refetchOnWindowFocus:m},(0,a.I)({initialData:{products:[],count:0,offset:0,limit:0,facets:[],selectedSortOption:"",sortByOptions:[],searchResultsTitle:""},queryKey:[o.B.Search,{searchTerm:x,...h}],queryFn:async()=>{let{data:e,error:t,isError:r}=await (0,l.p)({searchTerm:x,page:h?.page??"1",limit:void 0,payload:{filters:h?.filters,searchType:h?.searchType,sortBy:h?.sortBy}});if(r)throw t;return e},enabled:f?.enabled??!0,...f})),{concatenatedResults:F}=(0,p.Q)(R);return(0,u.useEffect)(()=>{I.current=x,C.current=b},[x]),(0,u.useEffect)(()=>((T||C.current!==b)&&k(),()=>{k()}),[v,b,T]),{isFetching:A,isLoading:O,isSuccess:j,isError:E,offset:R?.offset??0,limit:R?.limit??0,facets:R?.facets??[],results:R?.products??[],concatenatedResults:F,resultCount:R?.count??e?.count??0,sortByOptions:R?.sortByOptions??[],selectedSortOption:R?.selectedSortOption??"",redirect:R?.redirect}}}}]);

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.