import{a as S}from"./chunk-352NAGUN.mjs";import{a as v}from"./chunk-7WERBEK5.mjs";import{a as j,b as k,c as B,d as A,e as N}from"./chunk-RC4D77VZ.mjs";import{a as _}from"./chunk-KINQKHUH.mjs";import{useState as K}from"react";import{AvatarWithPlaceholder as Q}from"@baseapp-frontend/design-system/components/web/avatars";import{SwipeableDrawer as V}from"@baseapp-frontend/design-system/components/web/drawers";import{OutlinedEditIcon as Y,ShareIcon as M,ThreeDotsIcon as Z}from"@baseapp-frontend/design-system/components/web/icons";import{ImageWithFallback as ee}from"@baseapp-frontend/design-system/components/web/images";import{useResponsive as re}from"@baseapp-frontend/design-system/hooks/web";import{useNotification as oe}from"@baseapp-frontend/utils";import{Button as F,MenuItem as R,Typography as m}from"@mui/material";import{useRouter as te}from"next/navigation";import $ from"numbro";import{useFragment as ne}from"react-relay";import{jsx as t,jsxs as i}from"react/jsx-runtime";function z(r,n){return J(r)||G(r,n)||q(r,n)||X()}function X(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function q(r,n){if(r){if(typeof r=="string")return T(r,n);var o={}.toString.call(r).slice(8,-1);return o==="Object"&&r.constructor&&(o=r.constructor.name),o==="Map"||o==="Set"?Array.from(r):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?T(r,n):void 0}}function T(r,n){(n==null||n>r.length)&&(n=r.length);for(var o=0,a=Array(n);o<n;o++)a[o]=r[o];return a}function G(r,n){var o=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(o!=null){var a,c,s,h,d=[],e=!0,u=!1;try{if(s=(o=o.call(r)).next,n===0){if(Object(o)!==o)return;e=!1}else for(;!(e=(a=s.call(o)).done)&&(d.push(a.value),d.length!==n);e=!0);}catch(y){u=!0,c=y}finally{try{if(!e&&o.return!=null&&(h=o.return(),Object(h)!==h))return}finally{if(u)throw c}}return d}}function J(r){if(Array.isArray(r))return r}var le=function(n){var o,a,c,s,h=n.profile,d=n.currentProfileId,e=ne(_,h),u=re("down","sm"),y=te(),E=K(null),b=z(E,2),C=b[0],w=b[1],P=!!C,W=function(l){w(l.currentTarget)},f=function(){w(null)},U=oe(),D=U.sendToast,x=function(){var l,g,O=(l=e==null||(g=e.urlPath)===null||g===void 0?void 0:g.path)!==null&&l!==void 0?l:"/profile/".concat(e?.id),H=[process.env.NEXT_PUBLIC_APP_BASE_URL,O].join("");navigator.clipboard.writeText(H),D("Profile URL copied to clipboard!",{type:"success"}),f()},I=function(l){return!l||l===0?0:l<=1e3?l:l<105e4?$(l).format({average:!0}):$(l).format({average:!0,mantissa:1})},L=function(){return d===e?.id?t(F,{variant:"soft",size:"medium",color:"inherit",startIcon:t(Y,{}),sx:{maxWidth:u?"100%":"fit-content"},onClick:function(){return y.push("/user/settings")},children:"Edit Profile"}):i("div",{className:"flex flex-row gap-2",children:[!(e!=null&&e.isBlockedByMe)&&t(S,{targetId:e?.id,isFollowedByMe:e?.isFollowedByMe,currentProfileId:d,profileRef:e}),e?.isBlockedByMe&&t(v,{target:e,handleCloseMenu:f,currentProfileId:d})]})};return t("div",{className:"flex h-full w-full justify-center",children:i(j,{children:[t(ee,{src:(o=e==null||(a=e.bannerImage)===null||a===void 0?void 0:a.url)!==null&&o!==void 0?o:"",fallbackSrc:"/png/profile-banner-fallback.png",alt:"Home Banner",width:868,height:290,className:"overflow-hidden rounded-lg",style:{height:"290px",objectFit:"cover"}}),i(k,{children:[t(Q,{className:"self-start justify-self-center",width:96,height:96,src:e==null||(c=e.image)===null||c===void 0?void 0:c.url}),i(B,{children:[i(A,{children:[i("div",{className:"justify-self-start sm:col-span-full sm:justify-self-center",children:[t(m,{component:"h6",variant:"h6",children:e?.name}),t(m,{variant:"body2",color:"text.secondary",children:e!=null&&(s=e.urlPath)!==null&&s!==void 0&&s.path?"@".concat(e.urlPath.path):""})]}),i("div",{className:"flex w-full justify-self-stretch",children:[i("div",{className:"flex-grow border-r border-dashed border-divider text-center sm:w-full",children:[t(m,{component:"h6",variant:"h6",children:I(e?.followersCount)}),t(m,{variant:"body2",color:"text.secondary",children:"Followers"})]}),i("div",{className:"flex-grow text-center sm:w-full",children:[t(m,{component:"h6",variant:"h6",children:I(e?.followingCount)}),t(m,{variant:"body2",color:"text.secondary",children:"Following"})]})]})]}),t("p",{className:"prose-caption text-text-secondary",children:e?.biography})]}),i("div",{className:"grid grid-cols-[auto_min-content] gap-3 min-sm:col-start-2 min-sm:grid-cols-[fit-content_min-content] min-sm:justify-end",children:[L(),t(F,{color:"inherit",variant:"soft",sx:{maxWidth:"fit-content",minWidth:"max-content"},onClick:W,children:t(Z,{})}),!u&&i(N,{anchorEl:C,open:P,onClose:f,children:[i(R,{onClick:x,disableRipple:!0,children:[t(M,{}),"Share profile"]}),e&&t(v,{target:e,handleCloseMenu:f,currentProfileId:d,isMenu:!0})]}),u&&i(V,{anchor:"bottom",open:P,onClose:f,children:[i(R,{onClick:x,disableRipple:!0,children:[t(M,{}),"Share profile"]}),e&&t(v,{target:e,handleCloseMenu:f,currentProfileId:d,isMenu:!0})]})]})]})]})})},Pe=le;export{Pe as a};
//# sourceMappingURL=chunk-PB4WOBSI.mjs.map