1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8739],{120:(e,r,t)=>{"use strict";t.d(r,{A:()=>m});var i=t(47175),o=t(1433);t(14232);var s=t(24480),a=t(40014),n=t(99220),l=t(18708),c=t(37876);let p=["id","label"];function d(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,i)}return t}let u=(0,n.n9)()(e=>({label:{display:"block",marginBottom:e.spacing(.5),lineHeight:"1.25rem"}})),m=function(e){let{id:r,label:t}=e,n=(0,o.A)(e,p),{classes:m}=u();return(0,c.jsxs)(s.A,{sx:{mb:1,display:"block"},children:[(0,c.jsx)(a.A,{component:"label",variant:"body2",htmlFor:r,className:m.label,children:(0,c.jsx)("strong",{children:t})}),(0,c.jsx)(l.A,function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?d(Object(t),!0).forEach(function(r){(0,i.A)(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):d(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}({size:"medium",variant:"outlined",fullWidth:!0,slotProps:{htmlInput:{id:r,"data-testid":r,title:t}}},n))]})}},19833:(e,r,t)=>{"use strict";t.d(r,{C:()=>p,a:()=>c}),t(14232);var i=t(24583),o=t(88617),s=t(23074),a=t.n(s),n=t(37876);let l=new o.A;function c(e){var r;return e?(0,n.jsx)(i.oz,{disallowedElements:["p"],unwrapDisallowed:!0,children:(r=e)?"string"==typeof r?l.turndown(r):Array.isArray(r)?r.map(e=>l.turndown(e)):l.turndown(a()(r)):r}):null}function p(e){let r=document.createElement("textarea");return r.innerHTML=e,r?.childNodes?.length===0?"":r?.childNodes?.[0]?.nodeValue}},26114:(e,r,t)=>{"use strict";t.d(r,{A:()=>o});var i=t(14232);let o=(e,r)=>{let t=(0,i.useRef)(r);(0,i.useEffect)(()=>{t.current=r}),(0,i.useEffect)(()=>{let r=e&&"current"in e?e.current:e;if(!r||"u"<typeof ResizeObserver)return;let i=new ResizeObserver((e,r)=>{t.current(e[0],r)});return i.observe(r),()=>i.disconnect()},[e])}},36605:(e,r,t)=>{"use strict";t.d(r,{n:()=>o});var i=t(66386);function o(e,r){let{register:t,handleSubmit:o,formState:{errors:s},setError:a,clearErrors:n,setValue:l,getValues:c,reset:p,control:d,trigger:u}=(0,i.mN)(e),m={};return r.forEach(e=>{let{name:r,options:i}=e;m[r]=t(r,i||{})}),{handleSubmit:o,errors:s,fields:m,setError:a,clearErrors:n,setValue:l,getValues:c,reset:p,control:d,trigger:u}}},36826:(e,r,t)=>{"use strict";function i(e,r){let t=arguments.length>
12&&void 0!==arguments[2]?arguments[2]:40;setTimeout(()=>{let i="string"==typeof r?document.querySelector(r):r.current;if(i){let e=i.getBoundingClientRect().top;e<t&&window.scrollTo({top:window.pageYOffset+e-t,behavior:"smooth"})}e()},0)}t.d(r,{A:()=>i})},38840:(e,r,t)=>{"use strict";t.d(r,{A:()=>u}),t(14232);var i=t(24480),o=t(40014),s=t(25508),a=t(99220),n=t(90458),l=t(31462),c=t(83963),p=t(37876);let d=(0,a.n9)()(e=>({container:{backgroundColor:e.palette.gray.F5F6F8,display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(2,0),marginBottom:e.spacing(5),[e.breakpoints.up("sm")]:{padding:e.spacing(6,0)}},card:{backgroundColor:e.palette.common.white,border:`1px solid ${e.palette.gray.secondary}`,borderRadius:e.spacing(1.5),borderTop:`1px solid ${e.palette.gray.secondary}`,[e.breakpoints.up("lg")]:{width:490}},boxHeader:{display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(3),backgroundColor:(0,s.X4)(e.palette.gray.D1D9E2,.15),[e.breakpoints.up("sm")]:{padding:e.spacing(5)}},heading:{color:e.palette.primary.main,fontSize:e.typography.body1.fontSize,[e.breakpoints.up("sm")]:{fontSize:e.typography.h2.fontSize}},subHeading:{color:e.palette.text.primary,marginTop:e.spacing(2)},divider:{backgroundColor:e.palette.gray.secondary},progressContainer:{margin:e.spacing(10)}})),u=e=>{let{title:r,message:t}=e,{classes:s}=d();return(0,p.jsx)(i.A,{className:s.container,"data-testid":"custom-progress-box",children:(0,p.jsxs)(n.A,{className:s.card,children:[(0,p.jsxs)(i.A,{className:s.boxHeader,children:[(0,p.jsx)(o.A,{variant:"h2",component:"h1",className:s.heading,role:"alert",children:r}),(0,p.jsx)(o.A,{variant:"h3",component:"h2",className:s.subHeading,children:t})]}),(0,p.jsx)(l.A,{className:s.divider}),(0,p.jsx)(i.A,{sx:{mb:25},className:s.progressContainer,children:(0,p.jsx)(c.A,{})})]})})}},42516:(e,r,t)=>{"use strict";t.d(r,{A:()=>s});var i=t(14232),o=t(26114);let s=(e,r)=>{let{0:t,1:s}=(0,i.useState)();function a(){let t=e?.current?.getBoundingClientRect()?.width;return Array.isArray(r)?r.map(e=>t<e):t<r}return((0,i.useLayoutEffect)(()=>{s(a())},[e]),(0,o.A)(e,e=>{JSON.stringify(a())!==JSON.stringify(t)&&s(a())}),Array.isArray(r))?t||[]:t}},48171:(e,r,t)=>{"use strict";t.d(r,{A:()=>p});var i=t(47175),o=t(69202);t(14232);var s=t(80632),a=t(99220),n=t(37876);function l(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,i)}return t}let c=(0,a.n9)()(e=>({radio:{color:e.palette.gray.primary,"&.Mui-checked":{color:e.palette.primary.main},"& .MuiSvgIcon-root":{fontSize:20},"& ~ .MuiFormControlLabel-label":{fontSize:e.typography.body2.fontSize},"&.Mui-checked ~ .MuiFormControlLabel-label":{fontWeight:"bold"}}})),p=e=>{let r=Object.assign({},((0,o.A)(e),e)),{classes:t}=c();return(0,n.jsx)(s.A,function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?l(Object(t),!0).forEach(function(r){(0,i.A)(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):l(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}({size:"small",className:t.radio},r))}},55045:(e,r,t)=>{"use strict";t.d(r,{A:()=>y});var i=t(47175),o=t(14232),s=t(63045),a=t(41381),n=t(99220),l=t(58794),c=t(31241),p=t(47404),d=t(42516),u=t(59534),m=t(27074),f=t(37876);function g(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,i)}return t}let b=(0,n.n9)()(e=>({pagination:{"& li:first-of-type button.Mui-disabled, & li:last-child button.Mui-disabled":{color:e.palette.gray.A0A4AE},"& li:first-of-type button, & li:last-child button":{border:`1px solid ${e.palette.gray.A0A4AE}`,color:e.palette.primary.main},"& li:first-of-type button":{marginRight:e.spacing(1.2)},"& li:last-child button":{marginLeft:e.spacing(1)},"& .MuiPaginationItem-root":{fontSize:e.typography.caption.fontSize,lineHeight:0,[e.breakpoints.only("xs")]:{marginLeft:e.spacing(.3),marginRight:e.spacing(.3)}},"& .MuiPaginationItem-root.Mui-selected":{fontWeight:"bold"}},flexAlignCenter:{display:"flex",width:"100%",justifyContent:"center"},paddingTop:{paddingTop:e.spacing(1)},menuSelect:{"& .MuiSelect-select":{"&:focus":{outline:`${e.spacing(.25)} auto Highlight`}}}})),y=e=>{let{count:r,offset:t,limit:n,onOffsetChange:y,onLimitChange:h,hideResultsPerPage:x=!1,justifyCenter:j=!1,dataTestId:A="pagination-control",searchLimit:F=null}=e,P=(0,l.tz)(),{classes:v,cx:w}=b(),M=(0,u.A)(),L=F||50,O=(0,o.useRef)(null),S=(0,d.A)(O,M.breakpoints.values.sm),{0:C,1:N}=(0,o.useState)(0),{0:k,1:E}=(0,o.useState)(0);function R(e,r){r!==C&&(y(t=(r-1)*n+1),N(r))}(0,o.useEffect)(()=>{r>0&&n>0&&(E(Math.ceil(r/n)),N(Math.ceil(t/n)))},[r,n,t]);let I=e=>e<=0?[]:[...I(e-10),e],T=r>n,B=0,$=!1;return(0,f.jsxs)(c.A,{container:!0,sx:{justifyContent:j?"center":"space-between",alignItems:"center"},ref:O,children:[(0,f.jsx)(c.A,{item:!0,className:S||x?v.flexAlignCenter:null,children:T&&(0,f.jsx)(s.A,{count:k,page:C,onChange:R,color:"primary",siblingCount:+!S,className:v.pagination,renderItem:function(e){return"page"===e.type&&(B=e.page),"end-ellipsis"===e.type&&(e.type="page",e.page=B+1,e["aria-label"]=P.formatMessage({defaultMessage:"Go to page {x}",id:"components.design-system.organisms.PaginationCount.2381586221"},{x:e.page}),e.onClick=()=>R(null,e.page),$=!0),$&&e.page===k&&C<k-2&&(e.type="end-ellipsis"),(0,f.jsx)(m.A,function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};
1r%2?g(Object(t),!0).forEach(function(r){(0,i.A)(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):g(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}({},e))},"data-testid":A})}),!x&&L>10&&(0,f.jsx)(c.A,{item:!0,className:S?w(v.flexAlignCenter,v.paddingTop):null,children:(0,f.jsx)(p.A,{className:v.menuSelect,variant:"label",id:"paginationResultsPerPage",label:P.formatMessage({defaultMessage:"Results per Page:",id:"components.design-system.organisms.PaginationCount.3855993889",id:"components.design-system.organisms.PaginationCount.3855993889",id:"components.design-system.organisms.PaginationCount.3855993889",id:"components.design-system.organisms.PaginationCount.3855993889"}),value:n,onChange:function(e){h(e.target.value)},"data-testid":"pagination-results-per-page",children:I(L).map(e=>(0,f.jsx)(a.A,{"data-testid":`pagination-limit-select-${e}`,value:e,children:e},e))})})]})}},60315:(e,r,t)=>{"use strict";t.d(r,{A:()=>a});var i=t(73832),o=t(85209),s=t(19265);let a=function(){let{setSessionExpired:e}=(0,i.w)(),{isAuthenticated:r}=(0,o.x)();return{fetchWrapper:async function(t,i,o){if(!(0,s.c)(t))return new Response(JSON.stringify({message:"Invalid URL"}),{status:400,headers:{"Content-Type":"application/json"}});{let s=await fetch(t,{method:i,body:o});if(!r||s?.status!==401)return s;e(!0)}}}}},63161:(e,r,t)=>{"use strict";t.r(r),t.d(r,{__N_SSG:()=>eo,default:()=>es});var i=t(24480),o=t(31462),s=t(25508),a=t(99220),n=t(40014),l=t(90458),c=t(14232),p=t(47175),d=t(45015),u=t(59828),m=t(5788),f=t(65622),g=t(49130),b=t(85076),y=t(32347),h=t(69364),x=t(52043),j=t(36826),A=t(66260),F=t(27148),P=t.n(F),v=t(7906),w=t.n(v),M=t(89099),L=t(66386),O=t(58794),S=t(22997),C=t(55045),N=t(37876);let k=(0,a.n9)()(e=>({libraryContainer:{backgroundColor:e.palette.gray.F1F8FF,borderRadius:0,borderTop:`1px solid ${(0,s.X4)(e.palette.misc["1074C3"],.15)}`,[e.breakpoints.up("sm")]:{border:`1px solid ${(0,s.X4)(e.palette.misc["1074C3"],.15)}`,borderRadius:e.spacing(.75)}},libraryList:{padding:e.spacing(2,2)},notification:{marginLeft:e.spacing(-1),marginBottom:e.spacing(1)},libraryCard:{marginBottom:e.spacing(2.5)}})),E=e=>{let{libraries:r,onFavoriteClick:t,offset:s,limit:a,onOffsetChange:l,onLimitChange:c,isShowPagination:p}=e,d=(0,O.tz)(),{classes:u}=k(),{records:m,numRecords:f,totalRecords:g}=r,y=new Intl.NumberFormat((0,h.EM)());return(0,N.jsxs)(i.A,{className:u.libraryContainer,children:[(0,N.jsxs)(i.A,{className:u.libraryList,children:[g>0&&p&&(0,N.jsx)(()=>{let e=g>1?d.formatMessage({defaultMessage:"Showing {0}-{1} of {2} libraries",id:"components.user-profile.LibrarySummary.2877168290"},{0:s,1:y.format(s+f-1),2:g}):d.formatMessage({defaultMessage:"Showing {0}-{1} of {2} library",id:"components.user-profile.LibrarySummary.255964719"},{0:s,1:y.format(s+f-1),2:g});return(0,N.jsx)(i.A,{sx:{mb:1},children:(0,N.jsx)(n.A,{variant:"body2",role:"alert","aria-label":e,children:(0,N.jsx)("i",{children:e})})})},{}),m?.map(e=>(0,N.jsx)(b.A,{className:u.libraryCard,variant:"favorite",selected:e.selected,onFavoriteClick:()=>t(e),library:e,showFavoriteIcon:!0},e.registryId))]}),g>10&&p&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(o.A,{}),(0,N.jsx)(i.A,{sx:{p:2},children:(0,N.jsx)(C.A,{count:g,offset:s,limit:a,onOffsetChange:l,onLimitChange:c,dataTestId:"pagination-control-library-summary"})})]})]})};var R=t(5015),I=t(28477);function T(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,i)}return t}function B(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?T(Object(t),!0).forEach(function(r){(0,p.A)(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):T(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}let $=(0,a.n9)()(e=>({librarySearch:{display:"flex",flexDirection:"column-reverse",justifyContent:"space-between",padding:e.spacing(0),margin:e.spacing(2,2,3,2),[e.breakpoints.up("sm")]:{margin:e.spacing(3,0,0),padding:e.spacing(0,6),flexDirection:"row"},"& > .MuiBox-root":{[e.breakpoints.up("sm")]:{width:"100%",marginRight:e.spacing(10)}}},searchBox:{width:"100%",[e.breakpoints.up("sm")]:{width:550}},locationButton:{color:e.palette.text.primary,marginBottom:e.spacing(1),[e.breakpoints.up("sm")]:{marginBottom:e.spacing(0)},"& .MuiButton-label":{"& .MuiButton-startIcon":{color:e.palette.misc["1074C3"]},"& .MuiBox-root":{textDecoration:"underline"},"& .MuiButton-endIcon":{display:"none"}}},libraryForm:{padding:0,[e.breakpoints.up("sm")]:{padding:e.spacing(3,6)}},notification:{marginLeft:e.spacing(-1),marginBottom:e.spacing(1)},error:{display:"flex",justifyContent:"center",marginBottom:e.spacing(2)},subHeader:{fontWeight:"bold",marginTop:e.spacing(3)},footerButtons:{display:"flex",flexDirection:"row",marginTop:e.spacing(4),marginBottom:e.spacing(6),justifyContent:"center","& button":{textTransform:"none",width:112,height:40},"& > div":{"& button":{marginRight:e.spacing(3),marginBottom:e.spacing(2)}}},buttonProgress:{position:"absolute",top:"12%",marginLeft:e.spacing(-12)},errorNotification:{justifyContent:"space-between",padding:e.spacing(0),margin:e.spacing(2,2,3,2),[e.breakpoints.up("sm")]:{margin:e.spacing(3,0),padding:e.spacing(0,6)}},textCentered:{textAlign:"center"}})),D=e=>{let{onGoBack:r,loading:t,setLoading:o,callUserProfileAPI:s}=e,{classes:a}=$(),l=(0,O.tz)(),p=(0,M.useRouter)(),{actions:F,state:v}=(0,A.u)({actions:{updateAction:d.E}}),{limit:C,offset:k,q:T,searchBy:D=""}
1=p?0!==Object.entries(p.query).length?p.query:v?.query:{},{handleSubmit:z}=(0,L.mN)(),{location:_}=(0,x.z)(),{distanceUnit:W}=(0,h.mf)(),{0:H,1:q}=(0,c.useState)({}),{0:U,1:V}=(0,c.useState)(v?.libraries),{0:Y,1:J}=(0,c.useState)(!1),G=(0,c.useRef)(null),X=(0,c.useRef)(!1),{0:K,1:Q}=(0,c.useState)(v?.selectedLibrary),{0:Z,1:ee}=(0,c.useState)(!1),[er,et]=(0,I.F)("wc_libraryResultsLimit"),ei=er||parseInt(C)||10,eo=parseInt(k)||1,es="location"===D?JSON.parse(""+T):T,ea=es?.latitude||_?.latitude,en=es?.longitude||_?.longitude,el=("string"==typeof es?es:es&&1===Object.keys(es).length?es?.formattedAddress:null)?`/api/library?institutionNameAlias=${encodeURIComponent(T)}&${es}&lat=${ea}&lon=${en}&offset=${eo}&limit=${ei}&distance=99999`:ea||en?`/api/library?lat=${ea}&lon=${en}&distance=999999&unit=${W}&offset=${eo}&limit=${ei}`:null;Z&&(el=`/api/library?lat=${ea}&lon=${en}&distance=999999&unit=${W}&offset=${eo}&limit=${ei}`),(0,c.useEffect)(()=>{(T&&ea||ea&&en)&&(v?.selectedLibrary?.length>0&&F.updateAction({selectedLibrary:[]}),v?.isShowPagination||F.updateAction({isShowPagination:!0}),K&&K.length>0&&(Q([]),q({})))},[T,ea,en]);let{data:ec,error:ep,isValidating:ed,isLoading:eu}=(0,S.u)(el);return(0,c.useEffect)(()=>{o(!1),ep?(V({records:[],numRecords:null,totalRecords:null}),ee(!1)):ec?.libraries&&(V({records:ec.libraries.map(e=>(-1!==K.indexOf(e.registryId)&&(e.selected=!e.selected),e)),numRecords:ec.libraries.length,totalRecords:ec.pagination?.totalEntries||0}),!v?.isShowPagination&&ec.pagination?.totalEntries>10&&F.updateAction({isShowPagination:!0})),ec&&ec.pagination?.totalEntries===0&&ee(!0)},[ec,ep]),(0,c.useEffect)(()=>{ee(!1)},[T]),(0,c.useEffect)(()=>{ed||eu?(J(!0),q({})):J(!1)},[ed,eu]),(0,c.useEffect)(()=>{X.current||(X.current=!0)},[]),(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(i.A,{className:a.librarySearch,ref:G,children:[(0,N.jsx)(y.A,{className:a.searchBox,id:"library-form"}),X.current&&(0,N.jsx)(g.A,{className:a.locationButton})]}),(0,N.jsxs)("form",{id:"library-preferences-form","data-testid":"library-preferences-form",onSubmit:z(()=>{K?.length<=5?(o(!0),q({}),s(v)):ep||ec?.libraries?.length===0?s(v):K?.length>5&&q({message:l.formatMessage({defaultMessage:"You have reached the maximum of 5 favorite libraries",id:"components.user-profile.LibraryForm.2526583455"})})}),className:a.libraryForm,children:[Y&&(0,N.jsx)(f.A,{component:(0,N.jsx)(b.A,{skeleton:Y,variant:"favorite"}),numBlocks:10,distance:2}),!Y&&U?.records?.length>0&&(0,N.jsxs)(N.Fragment,{children:[Z&&!ep&&(0,N.jsxs)(i.A,{className:a.textCentered,sx:{my:2,mx:2},children:[(0,N.jsx)(n.A,{component:"h2",variant:"h3",children:l.formatMessage({defaultMessage:"We didn't find any results.",id:"components.user-profile.LibraryForm.2560801641",id:"components.user-profile.LibraryForm.2560801641",id:"components.user-profile.LibraryForm.2560801641",id:"components.user-profile.LibraryForm.2560801641",id:"components.user-profile.LibraryForm.2560801641",id:"components.user-profile.LibraryForm.2560801641"})}),(0,N.jsx)(n.A,{variant:"body1",component:"p",children:l.formatMessage({defaultMessage:"If the spelling is correct, your library may not be a part of the WorldCat community.",id:"components.user-profile.LibraryForm.3080136127",id:"components.user-profile.LibraryForm.3080136127",id:"components.user-profile.LibraryForm.3080136127",id:"components.user-profile.LibraryForm.3080136127",id:"components.user-profile.LibraryForm.3080136127",id:"components.user-profile.LibraryForm.3080136127"})}),(0,N.jsx)(n.A,{variant:"body1",component:"p",className:a.subHeader,children:l.formatMessage({defaultMessage:"Below is a list of other local libraries.",id:"components.user-profile.LibraryForm.4099651092",id:"components.user-profile.LibraryForm.4099651092",id:"components.user-profile.LibraryForm.4099651092",id:"components.user-profile.LibraryForm.4099651092",id:"components.user-profile.LibraryForm.4099651092",id:"components.user-profile.LibraryForm.4099651092"})})]}),H.message&&(0,N.jsx)(i.A,{className:a.error,children:(0,N.jsx)(m.A,{open:!0,level:"inline",variant:"error",role:"alert","aria-label":l.formatMessage({defaultMessage:"You have reached the maximum of 5 favorite libraries",id:"components.user-profile.LibraryForm.2526583455",id:"components.user-profile.LibraryForm.2526583455",id:"components.user-profile.LibraryForm.2526583455",id:"components.user-profile.LibraryForm.2526583455",id:"components.user-profile.LibraryForm.2526583455",id:"components.user-profile.LibraryForm.2526583455"}),children:H.message})}),(0,N.jsx)(E,{libraries:U,onFavoriteClick:e=>{let r=[...K],t=r.indexOf(e.registryId);-1===t?r.push(e.registryId):r.splice(t,1),Q(r);let i=U.records.map(r=>(r.registryId===e.registryId&&(r.selected=!r.selected),r));r.length>5?q({message:l.formatMessage({defaultMessage:"You have reached the maximum of 5 favorite libraries",id:"components.user-profile.LibraryForm.2526583455"})}):q({}),V(B(B({},U),{},{records:i})),F.updateAction({libraries:U,selectedLibrary:r,query:p.query})},limit:ei,offset:eo,onOffsetChange:e=>{(0,j.A)(()=>{p.push({pathname:"/user/profile",hash:"#libraries",query:w()({limit:ei,offset:e,q:T,searchBy:D},P())},void 0,{shallow:!0})},G,0)},onLimitChange:e=>{(0,j.A)(()=>{et(e),p.push({pathname:"/user/profile",hash:"#libraries",query:w()({limit:e,offset:1},P())},void 0,{shallow:!0})},G,0)},isShowPagination:!Z&&v?.isShowPagination})]}),(ep||ec?.libraries?.length===0)&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(i.A,{role:"alert",children:l.formatMessage({defaultMessage:"No results found",id:"components.user-profile.LibraryForm.4205644805",id:"components.user-profile.LibraryForm.4205644805",id:"components.user-profile.LibraryForm.4205644805",id:"components.user-profile.LibraryForm.4205644805",id:"components.user-profile.LibraryForm.4205644805"})}),(0,N.jsx)(i.A,{role:"alert",sx:{mt:2},children:(0,N.jsx)(m.A,{"data-testid":"library-search-api-down",variant:"warning",open:!0,children:l.formatMessage({defaultMessage:"We are currently experiencing issues with our search. Please try again later.",id:"c
1omponents.user-profile.LibraryForm.1417757756",id:"components.user-profile.LibraryForm.1417757756",id:"components.user-profile.LibraryForm.1417757756",id:"components.user-profile.LibraryForm.1417757756",id:"components.user-profile.LibraryForm.1417757756",id:"components.user-profile.LibraryForm.1417757756"})})})]}),(0,N.jsxs)(i.A,{className:a.footerButtons,children:[(0,N.jsxs)(i.A,{style:{position:"relative"},children:[(0,N.jsx)(u.A,{color:"primary",variant:"contained",disabled:t,type:"submit",children:l.formatMessage({defaultMessage:"Continue",id:"components.user-profile.LibraryForm.3640052215",id:"components.user-profile.LibraryForm.3640052215",id:"components.user-profile.LibraryForm.3640052215",id:"components.user-profile.LibraryForm.3640052215",id:"components.user-profile.LibraryForm.3640052215",id:"components.user-profile.LibraryForm.3640052215"})}),t&&(0,N.jsx)(R.A,{size:24,className:a.buttonProgress,"data-testid":"circular-progress"})]}),(0,N.jsx)(u.A,{color:"primary",variant:"outlined",role:"alert","aria-label":l.formatMessage({defaultMessage:"Go back to step 1 to set your preferences.",id:"components.user-profile.LibraryForm.52139556",id:"components.user-profile.LibraryForm.52139556",id:"components.user-profile.LibraryForm.52139556",id:"components.user-profile.LibraryForm.52139556",id:"components.user-profile.LibraryForm.52139556"}),onClick:r,children:l.formatMessage({defaultMessage:"Go back",id:"components.user-profile.LibraryForm.2333299345",id:"components.user-profile.LibraryForm.2333299345",id:"components.user-profile.LibraryForm.2333299345",id:"components.user-profile.LibraryForm.2333299345",id:"components.user-profile.LibraryForm.2333299345"})})]})]})]})};var z=t(83551),_=t(31279),W=t(59601),H=t(48171),q=t(120),U=t(84324),V=t(36605);let Y=(0,a.n9)()(e=>({form:{padding:e.spacing(3),[e.breakpoints.up("sm")]:{padding:e.spacing(4.5,7.5)}},inputTextField:{width:"100%",[e.breakpoints.up("sm")]:{width:268},"& .MuiInputBase-root":{height:40,backgroundColor:e.palette.common.white,fontSize:e.typography.body2.fontSize,"& .MuiInputBase-input":{border:`2px solid ${e.palette.gray.secondary}`,borderRadius:e.shape.borderRadius,height:0}},"& .MuiFormHelperText-root":{marginLeft:0,marginRight:0}},label:{display:"block",marginBottom:e.spacing(1)},radioSubtitle:{marginLeft:e.spacing(3.25)},checkbox:{margin:0,alignItems:"start","& .MuiButtonBase-root":{padding:0,marginRight:e.spacing(.5)}},button:{height:40,width:"100%",marginTop:e.spacing(4.5),[e.breakpoints.up("sm")]:{width:128}}})),J=e=>{let{hasFavouriteLibraries:r,onFormSubmit:t,loading:o,setLoading:s,callUserProfileAPI:a}=e,{classes:l}=Y(),c=(0,O.tz)(),{actions:p,state:m}=(0,A.u)({actions:{updateAction:d.E}}),f=[{name:"displayName",options:{required:c.formatMessage({defaultMessage:"Required field",id:"components.user-profile.PreferenceForm.2369435044"}),validate:{badWordsError:e=>!(0,U.A)(e)||c.formatMessage({defaultMessage:"Use of the abusive display name is not allowed. Kindly enter a different display name.",id:"components.user-profile.PreferenceForm.3863895268"})}}}],{handleSubmit:g,errors:b,fields:y,setError:h,clearErrors:x}=(0,V.n)({defaultValues:{displayName:m?.displayName||""}},f),{displayName:j}=y,F=function(e,r){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>{};t(e),x("displayName");let i="acceptTerms"===r?!m?.acceptTerms:e.target.value;p.updateAction({[r]:i})},P=c.formatMessage({defaultMessage:"This is a required field. Example: Jane Doe",id:"components.user-profile.PreferenceForm.3049238279"});return(0,N.jsxs)("form",{id:"preference-form","data-testid":"preference-form",onSubmit:g(e=>{let{displayName:i}=e;p.updateAction({displayName:i.trim()}),r?(s(!0),a(m)):t()}),className:l.form,children:[(0,N.jsx)(i.A,{sx:{mb:4},children:(0,N.jsx)(q.A,{role:"alert","aria-label":P,name:j.name,value:m?.displayName||"",onChange:e=>F(e,j.name,j.onChange),inputRef:j.ref,error:!!b.displayName,onBlur:e=>{e.target.value?.trim()||h("displayName",{type:"manual",message:c.formatMessage({defaultMessage:"Required field",id:"components.user-profile.PreferenceForm.2369435044"})})},className:l.inputTextField,label:c.formatMessage({defaultMessage:"Set your display name",id:"components.user-profile.PreferenceForm.2986370840",id:"components.user-profile.PreferenceForm.2986370840",id:"components.user-profile.PreferenceForm.2986370840",id:"components.user-profile.PreferenceForm.2986370840"}),helperText:b?.displayName?b.displayName.message:c.formatMessage({defaultMessage:"E.g. Jane Doe",id:"c
1omponents.user-profile.PreferenceForm.854796124"}),slotProps:{htmlInput:{maxLength:20,"data-testid":"display-name-input"}}})}),(0,N.jsxs)(i.A,{sx:{mb:3.5},children:[(0,N.jsx)(n.A,{component:"label",variant:"body2",htmlFor:"profile-radio-group",className:l.label,children:(0,N.jsx)("strong",{children:c.formatMessage({defaultMessage:"Profile Visibility",id:"components.user-profile.PreferenceForm.3376691221",id:"components.user-profile.PreferenceForm.3376691221",id:"components.user-profile.PreferenceForm.3376691221",id:"components.user-profile.PreferenceForm.3376691221",id:"components.user-profile.PreferenceForm.3376691221"})})}),(0,N.jsxs)(z.A,{onChange:e=>F(e,"profileVisibility"),value:m?.profileVisibility||"private",children:[(0,N.jsx)(_.A,{"data-testid":"profile-private",value:"private",control:(0,N.jsx)(H.A,{}),label:c.formatMessage({defaultMessage:"Private",id:"components.user-profile.PreferenceForm.479536455",id:"components.user-profile.PreferenceForm.479536455",id:"components.user-profile.PreferenceForm.479536455",id:"components.user-profile.PreferenceForm.479536455",id:"components.user-profile.PreferenceForm.479536455"}),"aria-label":c.formatMessage({defaultMessage:"Private. Your profile will be hidden from all the WorldCat users.",id:"components.user-profile.PreferenceForm.1241788612",id:"components.user-profile.PreferenceForm.1241788612",id:"components.user-profile.PreferenceForm.1241788612",id:"components.user-profile.PreferenceForm.1241788612",id:"components.user-profile.PreferenceForm.1241788612"})}),(0,N.jsx)(n.A,{variant:"body2",className:l.radioSubtitle,children:c.formatMessage({defaultMessage:"Your profile will be hidden from all the WorldCat users",id:"components.user-profile.PreferenceForm.2826664844",id:"components.user-profile.PreferenceForm.2826664844",id:"components.user-profile.PreferenceForm.2826664844",id:"components.user-profile.PreferenceForm.2826664844",id:"components.user-profile.PreferenceForm.2826664844"})}),(0,N.jsx)(_.A,{"data-testid":"profile-public",value:"public",control:(0,N.jsx)(H.A,{}),label:c.formatMessage({defaultMessage:"Public",id:"components.user-profile.PreferenceForm.3135366329",id:"components.user-profile.PreferenceForm.3135366329",id:"components.user-profile.PreferenceForm.3135366329",id:"components.user-profile.PreferenceForm.3135366329",id:"components.user-profile.PreferenceForm.3135366329"}),"aria-label":c.formatMessage({defaultMessage:"Public. WorldCat users can see your profile information such as display name on public lists,\xa0interests, etc.",id:"components.user-profile.PreferenceForm.2618759571",id:"components.user-profile.PreferenceForm.2618759571",id:"components.user-profile.PreferenceForm.2618759571",id:"components.user-profile.PreferenceForm.2618759571",id:"components.user-profile.PreferenceForm.2618759571"})}),(0,N.jsx)(n.A,{variant:"body2",className:l.radioSubtitle,children:c.formatMessage({defaultMessage:"WorldCat users can see your profile information such as display name on public lists,\xa0interests, etc.",id:"components.user-profile.PreferenceForm.3423781859",id:"components.user-profile.PreferenceForm.3423781859",id:"components.user-profile.PreferenceForm.3423781859",id:"components.user-profile.PreferenceForm.3423781859",id:"components.user-profile.PreferenceForm.3423781859"})})]})]}),(0,N.jsx)(_.A,{className:l.checkbox,onChange:e=>F(e,"acceptTerms"),checked:m?.acceptTerms||!1,control:(0,N.jsx)(W.A,{slotProps:{input:{"data-testid":"accept-terms-control"}}}),label:c.formatMessage({defaultMessage:"I would like to receive updates on events, services, information from nearby libraries",id:"components.user-profile.PreferenceForm.3448764208",id:"components.user-profile.PreferenceForm.3448764208",id:"components.user-profile.PreferenceForm.3448764208"})}),(0,N.jsxs)(i.A,{sx:{mb:2},children:[(0,N.jsx)(u.A,{color:"primary",variant:"contained",className:l.button,type:"submit",disabled:o,"data-testid":"register-button",children:c.formatMessage({defaultMessage:"Next",id:"components.user-profile.PreferenceForm.3673120330",id:"components.user-profile.PreferenceForm.3673120330",id:"components.user-profile.PreferenceForm.3673120330",id:"components.user-profile.PreferenceForm.3673120330"})}),o&&(0,N.jsx)(R.A,{size:24,className:l.buttonProgress,"data-testid":"circular-progress"})]})]})},G=e=>{let{favouriteLibraries:r,currentStep:t,onContinue:i,onGoBack:o,loading:s,setLoading:a,callUserProfileAPI:n}=e,{actions:l}=(0,A.u)({actions:{updateAction:d.E}}),[,p]=(0,I.F)("wc_libraryResultsLimit");return(0,c.useEffect)(()=>{l.updateAction({displayName:"",profileVisibility:"private",acceptTerms:!1,libraries:[],selectedLibrary:r,isShowPagination:!1,query:{}}),p(null)},[]),(0,N.jsxs)(N.Fragment,{children:[1===t&&(0,N.jsx)(J,{hasFavouriteLibraries:r.length>0,onFormSubmit:i,loading:s,setLoading:a,callUserProfileAPI:n}),2===t&&(0,N.jsx)(D,{onFormSubmit:i,onGoBack:o,loading:s,setLoading:a,callUserProfileAPI:n})]})};
1var X=t(77328),K=t.n(X),Q=t(85209),Z=t(61484),ee=t(38840),er=t(60315),et=t(17667);let ei=(0,a.n9)()((e,r)=>{let{props:t}=r;return{main:{paddingBottom:e.spacing(5)},container:{display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(2,0),[e.breakpoints.up("sm")]:{padding:e.spacing(6,0)}},stepper:{color:e.palette.primary.main,marginBottom:e.spacing(2),[e.breakpoints.up("lg")]:{marginBottom:e.spacing(3)}},card:{borderRadius:0,backgroundColor:e.palette.common.white,width:"100%",borderTop:`1px solid ${e.palette.gray.secondary}`,[e.breakpoints.up("lg")]:{border:`1px solid ${e.palette.gray.secondary}`,width:t.width,borderRadius:e.spacing(1.5)}},boxHeader:{display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(3),backgroundColor:(0,s.X4)(e.palette.gray.D1D9E2,.15)},heading:{color:e.palette.primary.main,fontSize:e.typography.body1.fontSize,[e.breakpoints.up("sm")]:{fontSize:e.typography.h2.fontSize}},subHeading:{color:e.palette.text.primary,marginTop:e.spacing(1)},divider:{backgroundColor:e.palette.gray.secondary}}});var eo=!0;let es=()=>{let e=(0,O.tz)(),r=(0,M.useRouter)(),{0:t,1:s}=(0,c.useState)(1),a=(0,c.useRef)(null),[p,u]=(0,Z.M)("wc_isUserProfileComplete"),{isAuthenticated:m,profile:f}=(0,Q.x)(),g=f?.profileStatusState==="prepopulated",{actions:b}=(0,A.u)({actions:{updateAction:d.E}}),[,y]=(0,I.F)("wc_libraryResultsLimit"),[h,x]=c.useState(!1),[F,P]=c.useState(!1),{fetchWrapper:v}=(0,er.A)(),w=f?.favoriteLibraries||[];w?.length>5&&(w=w.slice(0,5));let{collectVirtualPageviewEvent:L}=(0,et.A)(),S=e.formatMessage({defaultMessage:"Build Your Profile",id:"pages.user.profile.index.2367745510"});(0,c.useEffect)(()=>{L({virtual_page:S})},[]);let C=()=>{b.updateAction({displayName:"",profileVisibility:"private",acceptTerms:!1,libraries:[],selectedLibrary:w,isShowPagination:!1,query:{}}),y(null)},k=(0,c.useCallback)(async e=>{let t=w.length>0?encodeURIComponent(w):encodeURIComponent(e.selectedLibrary),i=e.selectedLibrary[0]?`/api/user-profile?profileName=${encodeURIComponent(e.displayName)}®istryId=${t}&audience=${e.profileVisibility}&acceptTerms=${e.acceptTerms?"agreed":"declined"}`:`/api/user-profile?profileName=${encodeURIComponent(e.displayName)}&audience=${e.profileVisibility}&acceptTerms=${e.acceptTerms?"agreed":"declined"}`,o=g?await v(i,"PATCH"):await v(i,"POST");o?.status===200?(x(!1),C(),P(!0),u(!0),r.push("/user/profile/success")):(x(!1),C(),P(!0),u(!1),r.push("/user/profile/error"))});(0,c.useEffect)(()=>{(0,j.A)(()=>r.beforePopState(()=>!(t>1)||!(t<=2)||(s(t-1),!1)),a,0)},[t]);let E={1:{width:490,path:"/user/profile#preferences",ariaLabel:e.formatMessage({defaultMessage:"Step 1 of 2. Set your preferences.",id:"pages.user.profile.index.3901888570"}),title:e.formatMessage({defaultMessage:"Set your preferences",id:"pages.user.profile.index.3978102309"}),subTitle:e.formatMessage({defaultMessage:"By building your user profile we can help you find the most relevant libraries, items and events that are near you.",id:"pages.user.profile.index.1756505912"})},2:{width:1088,path:"/user/profile#libraries",ariaLabel:e.formatMessage({defaultMessage:"Step 2 of 2. Set your favorite library.",id:"pages.user.profile.index.1201290655"}),title:e.formatMessage({defaultMessage:"Set your favorite library",id:"pages.user.profile.index.671047360"}),subTitle:e.formatMessage({defaultMessage:"You can set up to 5 favorite libraries",id:"pages.user.profile.index.535065089"})}},R=E[t],{classes:T}=ei({props:R}),B=(0,c.useCallback)(()=>(0,j.A)(()=>{r.push(E[t+1].path),t<2&&s(t+1)},a,0),[t]),$=(0,c.useCallback)(()=>(0,j.A)(()=>{r.back(),t>1&&s(t-1)},a,0),[t]);return(0,c.useEffect)(()=>{F||m&&!p||r.push("/")},[m,p]),F||m&&!p?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(K(),{children:(0,N.jsx)("title",{children:S})}),(0,N.jsx)(i.A,{className:T.main,ref:a,children:(0,N.jsxs)(i.A,{className:T.container,children:[!(w.length>0)&&(0,N.jsxs)(n.A,{variant:"h3",className:T.stepper,role:"alert","aria-label":R[t]?.ariaLabel,children:[e.formatMessage({defaultMessage:"Step {currentStep}",id:"pages.user.profile.index.438634059",id:"pages.user.profile.index.438634059",id:"pages.user.profile.index.438634059",id:"pages.user.profile.index.438634059",id:"pages.user.profile.index.438634059"},{currentStep:t}),(0,N.jsx)(n.A,{component:"span",variant:"body1",children:e.formatMessage({defaultMessage:" of 2",id:"pages.user.profile.index.294320753",id:"pages.user.profile.index.294320753",id:"pages.user.profile.index.294320753",id:"pages.user.profile.index.294320753",id:"pages.user.profile.index.294320753",id:"pages.user.profile.index.294320753"})})]}),(0,N.jsxs)(l.A,{className:T.card,children:[(0,N.jsxs)(i.A,{className:T.boxHeader,children:[(0,N.jsx)(n.A,{variant:"h2",className:T.heading,children:R?.title}),R?.subTitle&&(0,N.jsx)(n.A,{variant:"body1",className:T.subHeading,children:R.subTitle})]}),(0,N.jsx)(o.A,{className:T.divider}),(0,N.jsx)(G,{favouriteLibraries:w,currentStep:t,onContinue:B,onGoBack:$,loading:h,setLoa
1ding:x,callUserProfileAPI:k})]})]})})]}):(0,N.jsx)(ee.A,{title:e.formatMessage({defaultMessage:"We are signing you into WorldCat.org",id:"pages.user.profile.index.2172735635",id:"pages.user.profile.index.2172735635"}),message:e.formatMessage({defaultMessage:"Please wait, do not hit back or close the browser window",id:"pages.user.profile.index.2737324023",id:"pages.user.profile.index.2737324023"})})}},64393:(e,r,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/user/profile",function(){return t(63161)}])},65622:(e,r,t)=>{"use strict";t.d(r,{A:()=>a}),t(14232);var i=t(24480),o=t(61586),s=t(37876);let a=e=>{let{numBlocks:r=10,height:t=200,width:a="100%",distance:n=2,component:l,marginRight:c=0}=e;return(0,s.jsx)(s.Fragment,{children:[...Array(r)].map((e,r)=>l?(0,s.jsx)(i.A,{sx:{mb:n,width:a,mr:c},children:l},r):(0,s.jsx)(i.A,{sx:{mb:n,mr:c},children:(0,s.jsx)(o.A,{variant:"rectangular",width:a,height:t,"data-testid":`skeleton-${r}`})},r))})}},84324:(e,r,t)=>{"use strict";t.d(r,{A:()=>o});var i=t(73163);function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=new i.dJ;return r?.removeWords("god"),r.isProfane(e)}},85983:(e,r,t)=>{"use strict";t.d(r,{A:()=>s}),t(14232);var i=t(19833),o=t(37876);let s=e=>{let{children:r}=e;return r?(0,o.jsx)(o.Fragment,{children:(0,i.a)(r)}):null}},92657:(e,r,t)=>{"use strict";t.d(r,{A:()=>c}),t(14232);var i=t(59534),o=t(62539),s=t(99220),a=t(24480),n=t(37876);let l=(0,s.n9)()((e,r)=>{let{color:t,radius:i,backgroundColor:o}=r;return{iconCircle:{display:"flex",alignItems:"center",justifyContent:"center",borderWidth:"thin",borderStyle:"solid",borderColor:t,width:2*i,height:2*i,borderRadius:"50%",backgroundColor:o}}}),c=e=>{let{color:r,icon:t,iconColor:s,fontSize:c="1.5rem",radius:p=12,className:d="",backgroundColor:u,onClick:m=()=>{}}=e,f=(0,i.A)(),g=(0,o.Ay)(t)({fill:(s||f.palette.common.black)+" !important",fontSize:c}),{classes:b,cx:y}=l({color:r||f.palette.common.black,radius:p,backgroundColor:u||f.palette.common.white});return(0,n.jsx)(a.A,{component:"a",className:y(d,b.iconCircle),onClick:m,children:(0,n.jsx)(g,{})})}}},e=>{e.O(0,[6380,6386,4490,3045,7906,4406,9811,493,5076,636,6593,8792],()=>e(e.s=64393)),_N_E=e.O()}]);
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.