import{r as e}from"./chunk-QTnfLwEv.js";import{o as t}from"./jsx-runtime-DHSfUA5-.js";import{P as n}from"./test.id-DxQrYxPk.js";import{n as r}from"./fileAssetService-gA4Q8V3n.js";import{g as i}from"./selectors-DZWoTA9D.js";import{t as a}from"./useDiaryModel-BQGj9xs8.js";var o=e(t(),1);function s(){let e=a(),t=n(r),s=i(e),c=s?.type===`image`?s:void 0,[l,u]=(0,o.useState)(),d=c?.thumbS3Key??c?.s3Key;return(0,o.useEffect)(()=>{let e=!1;async function n(){if(u(void 0),d)try{let n=await t.getFileUrl(d,{role:`avatar`});e||u(n)}catch{e||u(void 0)}}return n(),()=>{e=!0}},[t,d]),{url:l,handleImageError:(0,o.useCallback)(()=>{u(void 0)},[])}}export{s as t};
//# sourceMappingURL=useProfileAvatar-DM2sovVl.js.map