dotfiles/.config/spicetify/Extracted/Themed/xpui/browse-v2.js

2 lines
20 KiB
JavaScript
Executable File

"use strict";(("undefined"!=typeof self?self:global).webpackChunkopen=("undefined"!=typeof self?self:global).webpackChunkopen||[]).push([[3817],{37120:(e,n,i)=>{i.d(n,{Z:()=>r});var t=i(24952),a=i(96768),s=i(4637);const r=({name:e,uri:n,images:i,isHero:r,testId:o,description:l,index:d,requestId:c,color:m})=>(0,s.jsx)(t.C,{index:d,featureIdentifier:"artist_concerts",headerText:e,uri:n,isPlayable:!1,renderCardImage:()=>(0,s.jsx)(a.x,{isHero:r,images:i,color:m}),renderSubHeaderContent:()=>(0,s.jsx)("span",{children:l||""}),testId:o,requestId:c})},87956:(e,n,i)=>{i.d(n,{T:()=>r});var t=i(24952),a=i(96768),s=i(4637);const r=({name:e,uri:n,href:i,images:r,isHero:o,testId:l,description:d,index:c,requestId:m,color:u})=>(0,s.jsx)(t.C,{index:c,featureIdentifier:"merch",onClick:()=>{window.open(i,"_blank")},headerText:e,uri:n,isPlayable:!1,renderCardImage:()=>(0,s.jsx)(a.x,{isHero:o,images:r,color:u}),renderSubHeaderContent:()=>(0,s.jsx)("span",{children:d||""}),testId:l,requestId:m,delegateNavigation:!0})},3511:(e,n,i)=>{i.d(n,{P:()=>k});var t=i(59496),a=i(74991),s=i(3802),r=i(54299),o=i(24952),l=i(96768),d=i(20920),c=i(88794),m=i(68776),u=i(4637);const k=t.memo((function(e){const{images:n,name:i,uri:k,onClick:p,isHero:f,testId:g,index:b,requestId:x,color:S}=e;let v;const N=(0,t.useCallback)((()=>(0,u.jsx)(l.x,{isCircular:!0,isHero:f,images:n,color:S,FallbackComponent:e=>(0,u.jsx)(a.a,{iconSize:64,...e})})),[S,n,f]),h=(0,t.useCallback)((()=>f?(0,u.jsx)(c.k,{children:s.ag.get("card.tag.profile")}):s.ag.get("card.tag.profile")),[f]);return v=f?(0,u.jsx)(d.Z,{index:b,onClick:p,headerText:i,featureIdentifier:"profile",uri:k,isPlayable:!1,renderCardImage:N,renderSubHeaderContent:h,testId:g,requestId:x}):(0,u.jsx)(o.C,{index:b,onClick:p,headerText:i,featureIdentifier:"profile",uri:k,isPlayable:!1,renderCardImage:N,renderSubHeaderContent:h,testId:g,requestId:x}),(0,u.jsx)(r._,{menu:(0,u.jsx)(m.I,{uri:k}),children:v})}))},27776:(e,n,i)=>{i.r(n),i.d(n,{BrowsePage:()=>W});var t=i(59496),a=i(84875),s=i.n(a),r=i(60161),o=i(3802),l=i(33971),d=i(96170),c=i(94041),m=i(35725),u=i(41226),k=i(16743),p=i(73997),f=i(4637);const g=({images:e,color:n=c.k77,title:i})=>{const t=0===e.length?u.fR.SMALL:u.fR.DEFAULT;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(u.gF,{backgroundImages:e,backgroundColor:n,size:t,children:[(0,f.jsx)(k.W,{children:i?(0,f.jsx)(p.i,{text:i}):null}),(0,f.jsx)(u.sP,{children:i?(0,f.jsx)(u.xd,{children:i}):null})]}),(0,f.jsx)(m.H,{color:n})]})};var b=i(28418),x=i(29251),S=i(76160),v=i(79642),N=i(88333),h=i(71534);const y={chips:"T8Vmv6htAP7bht774xG5",chip:"BX1DapBHMyHxwyF1aFRv"};function I({section:e}){return(0,f.jsx)("div",{className:y.chips,children:e.sectionItems.items.map((e=>function(e){return"BrowseSectionContainerWrapper"===e.content.__typename&&"BrowseSectionContainer"===e.content.data.__typename&&e.content.data.data?.cardRepresentation?.title?.transformedLabel?(0,f.jsxs)(S.A,{as:N.Z,href:(0,h.t1)(e.uri),className:y.chip,children:[e.content.data.data.cardRepresentation.title.transformedLabel,(0,f.jsx)(v.V,{iconSize:12})]},e.uri):null}(e)))})}var w=i(46117),C=i(69527);const j=({section:e,position:n,showAll:i})=>{const a=(0,t.useMemo)((()=>e.sectionItems.items.map(((e,n)=>(0,w.O)(e,n))).filter(b.K)),[e.sectionItems.items]);switch(e.data?.__typename){case"BrowseGenericSectionData":return(0,f.jsx)(C.q,{title:e.data?.title?.transformedLabel??"",tagline:e.data?.subtitle?.transformedLabel??"",total:e.sectionItems.totalCount,seeAllUri:(0,h.px)(e.uri),index:n,id:e.uri,showAll:i,children:a});case"BrowseGridSectionData":return(0,f.jsx)(C.q,{title:e.data?.title?.transformedLabel??"",tagline:e.data?.subtitle?.transformedLabel??"",total:e.sectionItems.totalCount,index:n,id:e.uri,showAll:!0,children:a});case"BrowseRelatedSectionData":return(0,f.jsx)(I,{section:e});case"BrowseSingleItemSectionData":case"BrowseUnsupportedSectionData":case void 0:return null;default:return(0,x._)(e.data),null}};var F=i(6548);const _=({uri:e,fallback:n})=>{const{section:i,error:t,fetchNextItems:a}=(0,F.X)(e),s=i?.data?.title?.transformedLabel,r=i?.data?.subtitle?.transformedLabel,o=i?.sectionItems.items??[];return 0===o.length||null!==t?n():(0,f.jsx)(l.C,{onReachBottom:a,children:(0,f.jsx)(C.q,{title:s??"",tagline:r??"",index:0,id:e,showAll:!0,children:o.map(((e,n)=>(0,w.O)(e,n)))})})};var P=i(22521),T=i(91703),R=i(23627),B=i(4055),O=i(9102),D=i(41921),L=i(50100),A=i(86577),V=i(35563),U=(i(72071),i(37924));const E={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"browsePage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uri"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pagePagination"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"PaginationInput"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"sectionPagination"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"PaginationInput"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"browse"},arguments:[{kind:"Argument",name:{kind:"Name",value:"input"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"pagePagination"},value:{kind:"Variable",name:{kind:"Name",value:"pagePagination"}}},{kind:"ObjectField",name:{kind:"Name",value:"sectionPagination"},value:{kind:"Variable",name:{kind:"Name",value:"sectionPagination"}}},{kind:"ObjectField",name:{kind:"Name",value:"uri"},value:{kind:"Variable",name:{kind:"Name",value:"uri"}}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename"}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"BrowseSectionContainer"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"header"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"backgroundImage"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"browseImageSources"}}]}},{kind:"Field",name:{kind:"Name",value:"color"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"hex"}}]}},{kind:"Field",name:{kind:"Name",value:"title"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"transformedLabel"}}]}}]}},{kind:"Field",name:{kind:"Name",value:"uri"}},{kind:"Field",name:{kind:"Name",value:"sections"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"totalCount"}},{kind:"Field",name:{kind:"Name",value:"pagingInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"nextOffset"}}]}},{kind:"Field",name:{kind:"Name",value:"items"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename"}},{kind:"FragmentSpread",name:{kind:"Name",value:"browseSectionItem"}}]}}]}}]}}]}}]}},...U.N9.definitions,...U.K1.definitions,{kind:"FragmentDefinition",name:{kind:"Name",value:"browseSectionItem"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"BrowseSection"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename"}},{kind:"Field",name:{kind:"Name",value:"uri"}},{kind:"Field",name:{kind:"Name",value:"data"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename"}},{kind:"Field",name:{kind:"Name",value:"title"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"transformedLabel"}}]}},{kind:"Field",name:{kind:"Name",value:"subtitle"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"transformedLabel"}}]}}]}},{kind:"Field",name:{kind:"Name",value:"sectionItems"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"totalCount"}},{kind:"Field",name:{kind:"Name",value:"items"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"browseItem"}}]}}]}}]}},...U.H5.definitions,...U.RL.definitions,...U.X6.definitions,...U.nE.definitions,...U._C.definitions,...U.Tf.definitions,...U.tl.definitions,...U.dV.definitions,...U.qJ.definitions,...U.YJ.definitions,...U.zZ.definitions,...U.Fk.definitions,...U.Go.definitions,...U.dK.definitions,...U.$z.definitions]};const q="lXcKpCtaEeFf1HifX139",H="KZy9ufUbVUdmV7qnCE2e",M="xcTrtCsYOPtSElbX9inq",W=({uri:e,id:n})=>{const{header:i,sections:a,error:c,fetchNextSections:m}=(e=>{const{request:n}=(0,t.useContext)(D.Ax),{data:i,isLoading:a,error:s,fetchNextPage:r}=(0,O.useInfiniteQuery)(["browse","page",e,{numberOfSections:10,numberOfItems:10}],(async({pageParam:i=0})=>(0,L.J)(n,E,function(e,n,i,t){return{pagePagination:{offset:n,limit:10},sectionPagination:{offset:0,limit:10},uri:e}}(e,i))),{cacheTime:A.ws,staleTime:A._p,getNextPageParam:e=>{if("BrowseSectionContainer"===e?.data?.browse?.__typename)return e.data.browse.sections?.pagingInfo.nextOffset??void 0}}),o=(0,t.useCallback)((async()=>{await r()}),[r]),l=(0,t.useMemo)((()=>i?.pages?i.pages.reduce(((e,n)=>"BrowseSectionContainer"===n?.data?.browse?.__typename&&n.data.browse.sections?.items?[...e,...n.data.browse.sections.items]:e),[]):[]),[i?.pages]);return{header:(0,t.useMemo)((()=>{if(i?.pages)for(const e of i.pages)if("BrowseSectionContainer"===e?.data?.browse?.__typename)return{title:e.data.browse.header?.title?.transformedLabel??void 0,color:e.data.browse.header?.color?.hex??void 0,images:e.data.browse.header?.backgroundImage?.sources.map(V.Np)??[]}}),[i?.pages]),sections:l,error:s,loading:a,fetchNextSections:o}})(e),{spec:k,UBIFragment:p}=(0,d.fU)(r.createDesktopGenreEventFactory,{data:{identifier:e,uri:e}}),b=(0,t.useMemo)((()=>k.shelvesFactory()),[k]),x=(0,B.g)(),S=(0,u.oX)(n);if(0===a.length||null!==c)return(0,f.jsx)(R.h,{hasError:null!==c,errorMessage:o.ag.get("error.generic")});const v=i?.title;return(0,f.jsxs)(p,{spec:k,children:[(0,f.jsx)(T.$,{children:i?.title??o.ag.get("browse")}),v?(0,f.jsx)("div",{className:q,children:S?(0,f.jsx)(u.YD,{isAnonymous:x}):(0,f.jsx)(g,{title:i.title,color:i.color,images:i.images})}):null,(0,f.jsx)(p,{spec:b,children:(0,f.jsxs)("div",{className:M,children:[v&&(0,f.jsx)(P.I,{backgroundColor:i.color}),(0,f.jsx)("div",{className:s()("contentSpacing",H),children:1===a.length?(0,f.jsx)(_,{uri:a[0].uri,fallback:()=>(0,f.jsx)(j,{section:a[0],position:0,showAll:!0})}):(0,f.jsx)(l.C,{onReachBottom:m,children:a.map(((e,n)=>(0,f.jsx)(j,{section:e,position:n,showAll:!1},e.uri)))})})]})})]})}},50339:(e,n,i)=>{i.r(n),i.d(n,{BrowseSection:()=>b});var t=i(59496),a=i(84875),s=i.n(a),r=i(60161),o=i(3802),l=i(33971),d=i(96170),c=i(46117),m=i(91703),u=i(23627),k=i(69527),p=i(6548);const f="Z3ISr2E5M6kLGdC7dCDQ";var g=i(4637);const b=({uri:e})=>{const{section:n,error:i,fetchNextItems:a}=(0,p.X)(e),{spec:b,UBIFragment:x}=(0,d.fU)(r.createDesktopGenreEventFactory,{data:{identifier:e,uri:e}}),S=(0,t.useMemo)((()=>b.shelvesFactory()),[b]),v=n?.data?.title?.transformedLabel,N=n?.data?.subtitle?.transformedLabel,h=n?.sectionItems.items??[];return 0===h.length||null!==i?(0,g.jsx)(u.h,{hasError:null!==i,errorMessage:o.ag.get("error.generic")}):(0,g.jsxs)(x,{spec:b,children:[(0,g.jsx)(m.$,{children:v??o.ag.get("browse")}),(0,g.jsx)(x,{spec:S,children:(0,g.jsx)("div",{className:s()("contentSpacing",f),children:(0,g.jsx)(l.C,{onReachBottom:a,children:(0,g.jsx)(k.q,{title:v??"",tagline:N??"",index:0,id:e,showAll:!0,children:h.map(((e,n)=>(0,c.O)(e,n)))})})})})]})}},46117:(e,n,i)=>{i.d(n,{O:()=>T});var t=i(29251),a=i(50346),s=i(3802),r=i(28604),o=i(79823),l=i(37120),d=i(79351),c=i(59496),m=i(56876),u=i(43171),k=i(96170),p=i(24952),f=i(96768),g=i(63120);const b="NyZJZ8IWZ7Pxvy3yA81D";var x=i(4637);const S=({title:e,uri:n,images:i,href:t,index:s,ubiId:r})=>{const{spec:o,logger:l}=(0,k.fU)(u.createDesktopCategoryCardEventFactory,{data:{position:s,identifier:r}}),d=(0,c.useCallback)((()=>{const e=(0,a.EC)(t)?.toURI();e&&l.logInteraction(o.hitUiNavigate({destination:e}))}),[l,o,t]),S=(0,k.Wi)(o);return(0,x.jsx)(g.Link,{to:t,onClick:d,ref:S,children:(0,x.jsx)(p.C,{index:s,onClick:d,headerText:e,featureIdentifier:"unknown",isPlayable:!1,delegateNavigation:!0,uri:n,className:b,renderCardImage:()=>(0,x.jsx)(f.x,{images:i,FallbackComponent:e=>(0,x.jsx)(m.U,{iconSize:64,...e})})})})};var v=i(78677),N=i(87956),h=i(75523),y=i(3511),I=i(58089),w=i(16500),C=i(99678),j=i(73972),F=i(9603),_=i(35563),P=i(71534);function T(e,n){switch(e.content.__typename){case"AlbumResponseWrapper":case"ArtistResponseWrapper":case"EpisodeOrChapterResponseWrapper":case"PlaylistResponseWrapper":case"PodcastOrAudiobookResponseWrapper":case"TrackResponseWrapper":case"UserResponseWrapper":case"BrowseXlinkResponseWrapper":case"BrowseSectionContainerWrapper":case"MerchResponseWrapper":case"ArtistConcertsResponseWrapper":return function(e,n,i){if("GenericError"===e.__typename||"NotFound"===e.__typename||"RestrictedContent"===e.__typename)return null;const c=(0,_._k)(e);switch(e.__typename){case"Album":return(0,x.jsx)(r.r,{uri:e.uri,name:e.name,images:c,sharingInfo:null,artists:(0,F.BH)(e.artists),index:n},e.uri);case"Artist":return(0,x.jsx)(o.I,{uri:e.uri,name:e.profile.name,images:c,index:n},e.uri);case"Audiobook":return(0,x.jsx)(d.c,{uri:e.uri,name:e.name,images:c,authorName:e.authors?.map((e=>e?.name)).join(s.ag.getSeparator())??"",index:n},e.uri);case"Chapter":return(0,x.jsx)(v.B,{uri:e.uri,name:e.name,images:c,showImages:c,description:"",durationMilliseconds:e.duration.totalMilliseconds,releaseDate:(0,F.Bq)(e.releaseDate),resume_point:{resume_position_ms:e.playedState.playPositionMilliseconds,fully_played:e.playedState.state===j.sY.Completed},isExplicit:(0,F.sW)(e.contentRating),is19PlusOnly:(0,F.R7)(e.contentRating),sharingInfo:null,index:n},e.uri);case"Episode":return(0,x.jsx)(v.B,{uri:e.uri,name:e.name,images:c,showImages:(0,_.Cn)(e),description:e.description??"",durationMilliseconds:e.duration.totalMilliseconds,releaseDate:(0,F.Bq)(e.releaseDate),resume_point:{resume_position_ms:e.playedState.playPositionMilliseconds,fully_played:e.playedState.state===j.sY.Completed},isExplicit:(0,F.sW)(e.contentRating),is19PlusOnly:(0,F.R7)(e.contentRating),sharingInfo:null,index:n},e.uri);case"Playlist":{let i="";return"User"===e.ownerV2.data.__typename&&(i=e.ownerV2.data.name),(0,x.jsx)(h.Z,{uri:e.uri,name:e.name,images:c,description:e.description,authorName:i,index:n},e.uri)}case"Podcast":return(0,x.jsx)(I._,{uri:e.uri,name:e.name,images:c,publisher:e.publisher?.name??"",sharingInfo:null,mediaType:(0,F.x7)(e.mediaType),index:n},e.uri);case"Track":return(0,x.jsx)(w.G,{uri:e.uri,name:e.name,images:c,artists:(0,F.mQ)(e.artists),album:e.albumOfTrack?{uri:e.albumOfTrack.uri,name:e.albumOfTrack.name}:null,isExplicit:(0,F.sW)(e.contentRating),is19PlusOnly:(0,F.R7)(e.contentRating),sharingInfo:null,index:n},e.uri);case"User":return(0,x.jsx)(y.P,{uri:e.uri,name:e.name,images:c,index:n},e.uri);case"BrowseSectionContainer":return(0,x.jsx)(C.p,{title:e.data?.cardRepresentation?.title?.transformedLabel??"",pageId:"search",href:(0,P.t1)(i),color:e.data?.cardRepresentation?.backgroundColor?.hex,imageUrl:c[0]?.url,ubiId:i,index:n},i);case"BrowseSpacesHub":return(0,x.jsx)(C.p,{title:e.title?.transformedLabel??"",pageId:"search",href:(0,P.wJ)(e.spaceId),color:e.backgroundColor?.hex,imageUrl:c[0]?.url,ubiId:i,index:n},i);case"BrowseClientFeature":return(0,x.jsx)(S,{uri:i,title:e.title?.transformedLabel??"",href:`/${(0,a.EC)(e?.featureUri,{parseUnknown:!0})?.toURLPath()}`,images:e.iconOverlay?.sources??[],ubiId:i,index:n},i);case"Merch":{let t="";return null!==e.price&&"profile"in e.artists.items[0].data&&(t=s.ag.get("merch.subtitle.format",e.price,e.artists.items[0].data.profile.name)),(0,x.jsx)(N.T,{name:e.name,uri:e.uri,href:e.url||e.uri,images:[{url:e.image?.sources[0]?.url||""}],description:t,index:n},i)}case"ArtistConcerts":{const t=e.mainArtist.data;return"Artist"!==t.__typename?null:(0,x.jsx)(l.Z,{uri:i,name:t.profile.name,images:c,description:s.ag.get("concerts.count",e.concerts.totalCount),index:n},i)}case"BrowseExternalHref":return null;default:return(0,t._)(e),null}}(e.content.data,n,e.uri);case"UnknownType":case"NoContent":case"ConcertResponseWrapper":break;default:(0,t._)(e.content)}return null}},6548:(e,n,i)=>{i.d(n,{X:()=>m});i(20464),i(86504);var t=i(59496),a=i(9102),s=i(41921),r=i(50100),o=i(29251),l=i(86577),d=(i(72071),i(37924));const c={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"browseSection"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pagination"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"PaginationInput"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uri"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"browseSection"},arguments:[{kind:"Argument",name:{kind:"Name",value:"input"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"sectionPagination"},value:{kind:"Variable",name:{kind:"Name",value:"pagination"}}},{kind:"ObjectField",name:{kind:"Name",value:"sectionUri"},value:{kind:"Variable",name:{kind:"Name",value:"uri"}}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename"}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"BrowseSection"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"data"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename"}},{kind:"Field",name:{kind:"Name",value:"title"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"transformedLabel"}}]}},{kind:"Field",name:{kind:"Name",value:"subtitle"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"transformedLabel"}}]}}]}},{kind:"Field",name:{kind:"Name",value:"sectionItems"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"totalCount"}},{kind:"Field",name:{kind:"Name",value:"pagingInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"nextOffset"}}]}},{kind:"Field",name:{kind:"Name",value:"items"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"browseItem"}}]}}]}}]}}]}}]}},...d.H5.definitions,...d.RL.definitions,...d.X6.definitions,...d.N9.definitions,...d.K1.definitions,...d.nE.definitions,...d._C.definitions,...d.Tf.definitions,...d.tl.definitions,...d.dV.definitions,...d.qJ.definitions,...d.YJ.definitions,...d.zZ.definitions,...d.Fk.definitions,...d.Go.definitions,...d.dK.definitions,...d.$z.definitions]},m=e=>{const{request:n}=(0,t.useContext)(s.Ax),{data:i,isLoading:d,error:m,fetchNextPage:u}=(0,a.useInfiniteQuery)(["browse","section",e,{numberOfItems:20}],(async({pageParam:i=0})=>(0,r.J)(n,c,function(e,n,i){return{pagination:{offset:n,limit:i},uri:e}}(e,i,20))),{cacheTime:l.ws,staleTime:l._p,getNextPageParam:e=>{if("BrowseSection"===e?.data?.browseSection?.__typename){return e.data.browseSection.sectionItems.pagingInfo.nextOffset&&e.data.browseSection.sectionItems.pagingInfo.nextOffset>0?e.data.browseSection.sectionItems.pagingInfo.nextOffset:void 0}}}),k=(0,t.useCallback)((async()=>{await u()}),[u]);return{section:(0,t.useMemo)((()=>i?.pages?i.pages.reduce(((e,n)=>{if(!n?.data?.browseSection)return e;switch(n.data.browseSection.__typename){case"BrowseSection":return null===e?function(e){if("object"!=typeof e||null===e)return e;if(window.structuredClone)return window.structuredClone(e);return JSON.parse(JSON.stringify(e))}(n.data.browseSection):(e.sectionItems.items=[...e.sectionItems.items,...n.data.browseSection.sectionItems.items],e);case"GenericError":case"NotFound":return e;default:return(0,o._)(n.data.browseSection),e}}),null):null),[i?.pages]),error:m,loading:d,fetchNextItems:k}}}}]);
//# sourceMappingURL=browse-v2.js.map