1import{j as e,r as s}from"./react-vendor.B75MsAI9.js";import{a2 as l,a4 as i,w as t,Q as o,u as a,L as r,S as n,O as d,o as c,d8 as u,cs as m,V as p,z as h,cO as g,D as f,t as b,s as v,p as j,H as x,bG as k,R as _,U as w,ib as y,x as R}from"./AuthModalContainer.CwDh3qj_.js";import{u as $}from"./RTLProvider.Dbr8G8Qw.js";import{g as B,I as C,j as N,T as S,B as P,E as T}from"./main.Bj0Ml4GZ.js";import{A as E}from"./Avatar.DUiho-56.js";import{I as U}from"./ImageCard.TT3VIXvZ.js";import{R as I}from"./ReadingLists.B5hCGlC1.js";import{S as L}from"./SocialLinks.BYmvKYqF.js";import{B as A}from"./Block.DxpdHCJY.js";import{P as O}from"./Pagination.qyXpDyCG.js";import"./LazyFontLoader.pvie9HdJ.js";import"./ReadingListCard.D-LWH4X3.js";const M=({books:s=[],isRtl:i,viewport:t})=>e.jsx(l,{variant:"2up-6up",children:s.map(s=>e.jsx(B,{book:s,isRtl:i,viewport:t},s.id))});M.propTypes={books:i.arrayOf(i.shape({id:i.oneOfType([i.string,i.number]).isRequired,slug:i.string,title:i.string,name:i.string,language:i.string,level:i.oneOfType([i.string,i.number]),coverImage:i.object,authors:i.array,illustrators:i.array,publishers:i.array})),isRtl:i.bool};const F=({illustrations:s=[],profileId:i,user:o})=>e.jsx(l,{variant:"4up",children:s.map(s=>{var l,a;return e.jsx(U,{title:s.title,slug:s.slug,image:s.imageUrls[0],isCollection:s.count>1,category:t.misc,label:`profile_${i}`,userId:null==(l=null==o?void 0:o.profile)?void 0:l.id,userType:null==(a=null==o?void 0:o.profile)?void 0:a.profile_type},s.id)})});F.propTypes={illustrations:i.array,profileId:i.string,user:i.object};const z=({label:s,children:l,noWrap:i})=>{const t="pb-info-unit",a={[t]:!0,[`${t}--no-wrap`]:i};return e.jsxs("div",{className:o(a),children:[e.jsx("div",{className:`${t}__label`,children:s}),e.jsx("div",{className:`${t}__content`,children:l})]})};z.propTypes={label:i.string,children:i.node,noWrap:i.bool};const q=({disabled:l=!1,children:i})=>{const[t,o]=s.useState(!1),n=a();s.useEffect(()=>{l||o(!1)},[l]);const d=e=>{e.stopPropagation(),e.preventDefault(),o(!t)},c="pb-shrinker",u=[c];let m;return l||(t||u.push(`${c}--shrunk`),m=e.jsx("div",{className:`${c}__toggle`,onClick:t?null:d,children:e.jsx(r,{parentClassName:`${c}__toggle-link`,onClick:d,children:n(t?"Shrinker.view-less":"Shrinker.view-more")})})),e.jsxs("div",{className:u.join(" "),children:[i,m]})};q.propTypes={disabled:i.bool,children:i.node};const G="pb-media-object",D=({fitToMedia:s,children:l})=>{const i={[G]:!0,[`${G}--fit-to-media`]:s};return e.jsx("div",{className:o(i),children:l})};D.propTypes={children:i.node.isRequired,fitToMedia:i.bool};const H=({children:s})=>e.jsx("div",{className:["pb-media-object__body"].join(" "),children:s});H.propTypes={children:i.node.isRequired};const V=({children:s})=>e.jsx("div",{className:["pb-media-object__media"].join(" "),children:s});V.propTypes={children:i.node.isRequired};const W=({icon:s,image:l,url:i,baseClassName:t,title:o,t:a})=>{const r=`Graphic for ${o}`;let d;if(l)d=e.jsx(C,{image:l,alt:r});else if(i)d=e.jsx("img",{src:i,alt:r});else{if(!s)return null;d=e.jsx(n,{name:s,title:a(`SvgTitle.${s}`),size:"xxl"})}return e.jsx("div",{className:`${t}__graphic`,children:d})},Q=({title:s,children:l,icon:i,image:t,url:r,isRtl:n})=>{const d=a(),c="pb-blank-slate",u={[c]:!0};return e.jsxs("div",{className:o(u),children:[e.jsx(W,{icon:i,image:t,url:r,title:s,baseClassName:c,t:d}),s?e.jsx("h2",{className:`${c}__title`,dir:n?"rtl":"ltr",children:s}):null,e.jsx("div",{className:`${c}__content`,children:l})]})};Q.propTypes={icon:i.string,url:i.string,image:i.object,title:i.string.isRequired,children:i.node,isRtl:i.bool};const J=({baseClassName:s,profile:l,type:i,viewport:t})=>{const o=a();let n,d,c=null;return i!==m.USER&&(n=l.email?e.jsx(z,{label:o("global.email",1),noWrap:!0,children:e.jsx(r,{noSitelLocale:!0,href:`mailto:${l.email}`,children:l.email})},l.email):null),d=l.website?e.jsx(z,{label:i===m.PUBLISHER||i===m.ORGANISATION?o("global.website",1):null,noWrap:!0,children:e.jsx(r,{noSitelLocale:!0,shouldOpenNewPage:!0,href:l.website,children:(u=l.website,function(e){const s=document.createElement("a");return s.setAttribute("href",e),{hostname:s.hostname,protocol:s.protocol,pathname:s.pathname}}(u).hostname)})},l.website):null,c=t.medium?e.jsxs(g,{parentClassName:`${s}__contact`,children:[n,d]}):e.jsxs("div",{className:`${s}__contact`,children:[n,d]}),c;var u},K=({type:l,profile:i,viewport:o,loadMore:r,isFetchingMore:n,isCurrentUser:g,isLanguageChampion:f,showOnlyReadingLists:b,offlineBooks:v,profileUser:j,isRtl:x,user:k,isEmailConfirmed:_,addSlimNotification:w})=>{var y,R,$,B,C,T,U,z,G,W,K,X,Y,Z,ee,se,le,ie,te,oe;const ae=a(),[re,ne]=s.useState(!1),de="pb-profile",ce=[de];let ue;l===m.USER&&g&&(ue=d.editProfile());const me=s.useMemo(()=>{const e=[{title:ae("global.home"),href:d.home(),isInternal:!0}];return b&&e.push({title:ae("global.list",2),href:d.lists()}),e},[b,ae]),{socialMediaLinks:pe}=i||{};let he,ge,fe,be,ve;pe&&({facebookUrl:he,rssUrl:ge,twitterUrl:fe,youtubeUrl:be,instagramUrl:ve}=pe);let je,xe,ke,_e="";g?(ke=u.onEmptyBgImageSelf,xe=ae("Profile.empty-content-self"),_e=e.jsx(c,{label:ae("Profile.write-book"),variant:"primary",parentClassName:`${de}__create-book`,onClick:()=>
1{if(_)if(o.medium){let e=document.getElementsByTagName("body")[0];e&&(e.style.opacity=.5,e.style.pointerEvents="none"),ne(!0),window.location.href=d.create()}else w({id:"Book.mobile-editor-notification",content:ae("Book.mobile-editor-notification-text")});else w({id:"OTP.confirm-email-action",content:ae("OTP.confirm-email-action",{action:ae("global.write-a-book")})})},loading:re,isRtl:x})):(ke=u.onEmptyBgImage,xe=ae("Profile.empty-content"));const we=e.jsx(Q,{title:xe,url:ke,isRtl:x,children:_e}),ye=e.jsx(Q,{title:xe,url:ke,isRtl:x}),Re=e.jsx(Q,{title:ae("Profile.empty-bookshelf"),isRtl:x,url:u.onEmptyBookshelf}),$e="bookShelf"===window.location.search.split("?")[1];l===m.USER?je=[Boolean(null==(R=null==(y=i.books)?void 0:y.meta)?void 0:R.hits)?e.jsx(N,{title:`${ae("global.story",2)} (${i.books.meta.hits})`,hasContent:Boolean(i.books.meta.hits),children:Boolean(i.books.meta.hits)?e.jsxs("div",{children:[e.jsx(M,{books:i.books.results,isRtl:x,viewport:o}),i.books.meta.page<i.books.meta.totalPages?e.jsx(O,{loading:n,onClick:()=>r(m.USER,i.name,i.slug,"books",i.books.meta.page+1)}):null]}):we},"user-books"):null,Boolean(null==(B=null==($=i.illustrations)?void 0:$.meta)?void 0:B.hits)?e.jsx(N,{title:`${ae("global.illustration",2)} (${i.illustrations.meta.hits})`,hasContent:Boolean(i.illustrations.meta.hits),children:Boolean(i.illustrations.meta.hits)?e.jsxs("div",{children:[e.jsx(F,{illustrations:i.illustrations.results,profileId:i.slug.split("-")[0],user:k,viewport:o}),i.illustrations.meta.page<i.illustrations.meta.totalPages?e.jsx(O,{loading:n,onClick:()=>r(m.USER,i.name,i.slug,"illustrations",i.illustrations.meta.page+1)}):null]}):ye},"user-illustrations"):null,Boolean(null==(T=null==(C=i.translations)?void 0:C.meta)?void 0:T.hits)?e.jsx(N,{title:`${ae("global.translation",2)} (${i.translations.meta.hits})`,hasContent:Boolean(i.translations.meta.hits),children:Boolean(i.translations.meta.hits)?e.jsxs("div",{children:[e.jsx(M,{books:i.translations.results,isRtl:x,viewport:o}),i.translations.meta.page<i.translations.meta.totalPages?e.jsx(O,{loading:n,onClick:()=>r(m.USER,i.name,i.slug,"translations",i.translations.meta.page+1)}):null]}):ye},"user-translations"):null,Boolean(null==(z=null==(U=i.releveled_stories)?void 0:U.meta)?void 0:z.hits)?e.jsx(N,{title:`${ae("global.releveled")} (${i.releveled_stories.meta.hits})`,hasContent:Boolean(i.releveled_stories.meta.hits),children:Boolean(i.releveled_stories.meta.hits)?e.jsxs("div",{children:[e.jsx(M,{books:i.releveled_stories.results,isRtl:x,viewport:o}),i.releveled_stories.meta.page<i.releveled_stories.meta.totalPages?e.jsx(O,{loading:n,onClick:()=>r(m.USER,i.name,i.slug,"releveled_stories",i.releveled_stories.meta.page+1)}):null]}):ye},"user-releveled-stories"):null,Boolean(null==(W=null==(G=i.lists)?void 0:G.meta)?void 0:W.hits)||$e?e.jsx(N,{title:`${ae("global.my-bookshelf")} (${i.lists.meta.hits})`,hasContent:Boolean(i.lists.meta.hits),children:Boolean(i.lists.meta.hits)?e.jsx("div",{className:`${de}__lists`,children:e.jsx(I,{viewport:o,lists:i.lists.results,offlineBooks:v,hideVerticalEl:!0,profile:j,isRtl:x,eventCategory:t.bookShelf})}):Re},"user-lists"):null,Boolean(null==(X=null==(K=i.illustrated_books)?void 0:K.meta)?void 0:X.hits)?e.jsx(N,{title:`${ae("global.illustrated-book",2)} (${i.illustrated_books.meta.hits})`,hasContent:Boolean(i.illustrated_books.meta.hits),children:Boolean(i.illustrated_books.meta.hits)?e.jsxs("div",{children:[e.jsx(M,{books:i.illustrated_books.results,isRtl:x,viewport:o}),i.illustrated_books.meta.page<i.illustrated_books.meta.totalPages?e.jsx(O,{loading:n,onClick:()=>r(m.USER,i.name,i.slug,"illustrated_books",i.illustrated_books.meta.page+1)}):null]}):ye},"user-illustrated-books"):null]:l===m.ORGANISATION?je=[Boolean(null==(Z=null==(Y=i.reading_lists)?void 0:Y.meta)?void 0:Z.hits)?e.jsx(N,{title:`${ae("global.my-bookshelf")} (${i.reading_lists.meta.hits})`,hasContent:Boolean(i.reading_lists.meta.hits),children:Boolean(i.reading_lists.meta.hits)?e.jsx("div",{className:`${de}__lists ${de}__lists--narrow`,children:e.jsx(I,{viewport:o,lists:i.reading_lists.results,showDescription:!0,offlineBooks:v,hideVerticalEl:!0,profile:j,isRtl:x,eventCategory:t.bookShelf})}):ye},"organization-reading-lists"):null]:l!==m.PUBLISHER&&l!==m.TRANSLATION_PARTNER||(je=[!Boolean(null==(se=null==(ee=i.newArrivals)?void 0:ee.meta)?void 0:se.hits)||b?null:e.jsx(N,{title:`${ae("global.new-arrival",2)} (${i.newArrivals.meta.hits})`,hasContent:Boolean(i.newArrivals.meta.hits),children:Boolean(i.newArrivals.meta.hits)?e.jsxs("div",{children:[e.jsx(M,{books:i.newArrivals.results,isRtl:x,viewport:o}),i.newArrivals.meta.page<i.newArrivals.meta.totalPages?e.jsx(O,{loading:n,onClick:()=>r(l,i.name,i.slug,"newArrivals",i.newArrivals.meta.page+1)}):null]}):ye},"publisher-new-arrivals"),!Boolean(null==(ie=null==(le=i.editorsPick)?void 0:le.meta)?void 0:ie.hits)||b?null:e.jsx(N,{title:`${ae("global.featured-stories",2)} (${i.editorsPick.meta.hits})`,hasContent:Boolean(i.editorsPick.meta.hits),children:Boolean(i.editorsPick.meta.hits)?e.jsxs("div",{children:[e.jsx(M,{books:i.editorsPick.results,isRtl:x,viewport:o}),i.editorsPick.meta.page<i.editorsPick.meta.totalPages?e.jsx(O,{loading:n,onClick:()=>r(l,i.name,i.slug,"editorsPick",i.editorsPick.meta.page+1)}):null]}):ye},"publisher-editors-pick"),Boolean(null==(oe=null==(te=i.reading_lists)?void 0:te.meta)?void 0:oe.hits)?e.jsx(N,{title:`${ae("global.list",2)} (${i.reading_lists.meta.hits})`,hasContent:Boolean(i.reading_lists.meta.hits),children:Boolean(i.reading_lists.meta.hits)?e.jsx("div",{className:`${de}__lists ${de}__lists--narrow`,children:e.jsx(I,{viewport:o,lists:i.reading_lists.results,showDescription:!0,offlineBooks:v,hideVerticalEl:!0,profile:j,isRtl:x,eventCategory:t.bookShelf})}):ye},"publisher-reading-lists"):null]);const Be=e.jsx(P,{paths:me,isRtl:x}),Ce=!(he||ge||fe||be||ve);let Ne=je.filter(e=>e),Se=0;return window.location.search.split("?").includes("bookShelf")&&Ne.forEach((e,s)=>{"user-lists"===e.key&&(Se=s)}),e.jsxs("div",{className:ce.join(" "),children:[e.jsxs(p,{children:[e.jsx("title",{children:`${i.name} - ${ae("global.site-title")}`}),e.jsx("meta",{name:"robots",content:"noindex, nofollow"})]}
1),e.jsxs(A,{children:[o.large?null:Be,e.jsxs(D,{children:[e.jsx(V,{children:e.jsx("div",{className:`${de}__avatar`,children:e.jsx(E,{url:i.profileImage,name:i.name,variant:l===m.USER?"circular":"default",size:"l",showBadge:f&&l===m.USER,badgeInfo:f&&`${ae("Profile.language-champion")}`,profileEditUrl:ue})})}),e.jsxs(H,{children:[o.large?Be:null,e.jsx("h1",{className:`${de}__title`,children:i.name}),e.jsxs("div",{className:`${de}__summary`,children:[e.jsxs("div",{className:`${de}__summary-col-1`,children:[(s=>{const t=l===m.USER||o.medium||!i.description||i.description.trim().length<100;return e.jsx("div",{className:`${s}__description`,children:e.jsx(q,{disabled:t,children:i.description})})})(de),e.jsx(J,{baseClassName:de,profile:i,type:l,viewport:o})]}),l===m.USER||Ce?null:e.jsx("div",{className:`${de}__summary-col-2`,children:e.jsx("div",{className:`${de}__social`,children:e.jsx(L,{links:{facebook:he,rss:ge?`/${h}${ge}`:"",twitter:fe,youtube:be,instagram:ve},variant:"circular"})})})]})]})]})]}),e.jsx(A,{noHorizontalPadding:!0,children:je.some(e=>null!=e)?e.jsx(S,{parentClassName:`${de}__section-tabs`,align:"left",isRtl:x,setIndex:Se,children:je}):we})]})};K.propTypes={type:i.string,profile:i.object,viewport:i.object,loadMore:i.func,isFetchingMore:i.bool,isCurrentUser:i.bool,isLanguageChampion:i.bool,showOnlyReadingLists:i.bool,offlineBooks:i.object,profileUser:i.object,isRtl:i.bool,user:i.object,isEmailConfirmed:i.bool,addSlimNotification:i.func};const X=({profileType:l=m.USER})=>{var i;const{slug:t}=f(),o=b(),r=v(),n=a(),d=$(),c=s.useRef(null),u=s.useRef(null),[p,h]=s.useState(!1),g=j(e=>e.profile.isFetchingProfile),B=j(e=>e.profile.isFetchingMore),C=j(e=>e.profile.profile),N=j(e=>e.viewport),S=j(e=>e.user),P=j(e=>e.offlineBooks),E=j(e=>e.book.isAddingToBookshelf),U=j(e=>{var s;return null==(s=e.user.profile)?void 0:s.emailConfirmed}),I=s.useCallback(()=>{o(x({id:"Profile.user-unavailable",content:n("Profile.user-unavailable")})),r("/")},[o,r,n]);if(s.useEffect(()=>{const e=setTimeout(async()=>{try{const e=await o(k({slug:t,profileType:l,perPage:24}));404===(null==e?void 0:e._httpStatus)&&(h(!0),I())}catch(e){}},500);return window.scrollTo(0,0),()=>{clearTimeout(e)}},[]),s.useEffect(()=>{const e=null!==c.current&&c.current!==t,s=null!==u.current&&u.current!==E&&!E;if(e||s){const e=setTimeout(async()=>{try{const e=await o(k({slug:t,profileType:l,perPage:24}));404===(null==e?void 0:e._httpStatus)&&(h(!0),I())}catch(e){}},1e3);return c.current=t,u.current=E,()=>{clearTimeout(e)}}c.current=t,u.current=E},[t,E,l,o,I]),s.useEffect(()=>{S.isLoggedIn&&o(_())},[S.isLoggedIn,o]),g||!C[l]||p)return e.jsx(w,{});if(!g&&!C)return e.jsx(T,{});const L=S.isLoggedIn&&S.profile&&S.profile.id===(null==(i=C[l])?void 0:i.id),A="lists"===R.parse(window.location.search).tab;return e.jsx(K,{type:l,profile:C[l],viewport:N,loadMore:(e,s,l,i,t,a)=>{o(y({profileType:e,profileName:s,slug:l,collection:i,page:t,perPage:a}))},isFetchingMore:B,isCurrentUser:L,addSlimNotification:e=>o(x(e)),showOnlyReadingLists:A,isLanguageChampion:C.user&&C.user.isLanguageChampion,offlineBooks:P,profileUser:C,isRtl:d,isEmailConfirmed:U,user:S})};X.propTypes={profileType:i.string};export{X as default}; 2//# sourceMappingURL=index.BfnwfBrD.js.map
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.