ghost 6.13.1 → 6.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/components/tryghost-i18n-6.13.2.tgz +0 -0
  2. package/core/built/admin/assets/{_baseAssignValue-CPzElAl9.js → _baseAssignValue-qTINVNgk.js} +1 -1
  3. package/core/built/admin/assets/{a-large-small-2Oh9oqBr.js → a-large-small-D-nhKFBX.js} +1 -1
  4. package/core/built/admin/assets/admin-x-settings/admin-x-settings.js +2 -2
  5. package/core/built/admin/assets/admin-x-settings/{code-editor-view-B5QudVu-.mjs → code-editor-view-CXaEQbfL.mjs} +2 -2
  6. package/core/built/admin/assets/admin-x-settings/{index-D3C8sdqQ.mjs → index-BrqKezEN.mjs} +30 -24
  7. package/core/built/admin/assets/admin-x-settings/{index-B66mLTSp.mjs → index-CwXvgyDY.mjs} +2 -2
  8. package/core/built/admin/assets/admin-x-settings/{index-CdWUpaGD.mjs → index-Dc7foGQ2.mjs} +2 -2
  9. package/core/built/admin/assets/admin-x-settings/{modals-lYrPGC_E.mjs → modals-Ba1hMizc.mjs} +2 -2
  10. package/core/built/admin/assets/{at-sign-BtKGpnjs.js → at-sign-DHUgIxNb.js} +1 -1
  11. package/core/built/admin/assets/{audience-select-DuSCQEyi.js → audience-select-C17Kh6Hl.js} +1 -1
  12. package/core/built/admin/assets/{avatar-flipboard-CcvOD0pV.js → avatar-flipboard-Cdj8uoBX.js} +1 -1
  13. package/core/built/admin/assets/{bluesky-sharing-Frg4QWOQ.js → bluesky-sharing-DYSv4ewp.js} +1 -1
  14. package/core/built/admin/assets/{chart-tL51cfF9.js → chart-BYGpVun6.js} +1 -1
  15. package/core/built/admin/assets/{chunk.397.a720333cfffc99c47e71.js → chunk.397.71f16fce8de382622bb4.js} +2 -2
  16. package/core/built/admin/assets/{chunk.524.6168e2262e63b155f63e.js → chunk.524.ccb5a082c09fdedaf1d0.js} +6 -6
  17. package/core/built/admin/assets/{chunk.582.45f8c5479d11e969ddc2.js → chunk.582.311f93280422738b8a5d.js} +7 -7
  18. package/core/built/admin/assets/{code-editor-view-BHiySSgi.js → code-editor-view-BnOaGsRA.js} +1 -1
  19. package/core/built/admin/assets/{comments-svHZXAlu.js → comments-DiZAz2yU.js} +1 -1
  20. package/core/built/admin/assets/{copy-B8yuX-e4.js → copy-CCj6xx5V.js} +1 -1
  21. package/core/built/admin/assets/{data-list-C_WXxmo3.js → data-list-By9zN-Ma.js} +1 -1
  22. package/core/built/admin/assets/{deleted-feed-item-OXPcC4Z2.js → deleted-feed-item-Dl0oQ0DH.js} +1 -1
  23. package/core/built/admin/assets/{edit-profile-DgMLvoyu.js → edit-profile-DZhjWF_f.js} +1 -1
  24. package/core/built/admin/assets/{empty-indicator-DOQCKEXD.js → empty-indicator-B7WXKrac.js} +1 -1
  25. package/core/built/admin/assets/{en-Z93BzXte.js → en-B8oRL8Ua.js} +1 -1
  26. package/core/built/admin/assets/{feed-BKXpQU0e.js → feed-DU5QhfRX.js} +1 -1
  27. package/core/built/admin/assets/{filters-dwDByCkK.js → filters-C-v3cGt0.js} +1 -1
  28. package/core/built/admin/assets/{gh-chart-CaA6rQiP.js → gh-chart-B98YGgzG.js} +1 -1
  29. package/core/built/admin/assets/{growth-DKtJYCNb.js → growth-_giTyVF8.js} +1 -1
  30. package/core/built/admin/assets/{hash-ZzZYv2ek.js → hash-B4UtN3nq.js} +1 -1
  31. package/core/built/admin/assets/{inbox-C5KDymI8.js → inbox-D336Mbic.js} +1 -1
  32. package/core/built/admin/assets/{index-VdGL6HfS.js → index-B3CWs1Pb.js} +1 -1
  33. package/core/built/admin/assets/{index-CM3YmTO5.js → index-Bl3YnEiK.js} +1 -1
  34. package/core/built/admin/assets/{index-OPvny56_.js → index-BuFp5nYK.js} +1 -1
  35. package/core/built/admin/assets/{index-BX3p0DcO.js → index-C9PDrFEW.js} +1 -1
  36. package/core/built/admin/assets/{index-DethZCE1.js → index-CEEPij-w.js} +1 -1
  37. package/core/built/admin/assets/{index-BNkw6KwF.js → index-CLdEbHsV.js} +1 -1
  38. package/core/built/admin/assets/{index-CQVI9TPr.js → index-CdIdIOil.js} +1 -1
  39. package/core/built/admin/assets/{index-B6mBuUxr.js → index-DI4OotZO.js} +1 -1
  40. package/core/built/admin/assets/{index-BniBHF2r.js → index-DXuLaG0T.js} +1 -1
  41. package/core/built/admin/assets/{index-6_RXbq08.css → index-DbjfIcZe.css} +1 -1
  42. package/core/built/admin/assets/{index-X_uC_0DD.js → index-Dq_j8mTf.js} +3 -3
  43. package/core/built/admin/assets/{index-DOORRiFo.js → index-cWfIWdIX.js} +1 -1
  44. package/core/built/admin/assets/{index-CF6UHTsD.js → index-iHz8ZTSi.js} +1 -1
  45. package/core/built/admin/assets/{index-D9gfkxEz.js → index-k2aVq6ms.js} +1 -1
  46. package/core/built/admin/assets/{index-syvYkr47.js → index-w7Tz4ytz.js} +1 -1
  47. package/core/built/admin/assets/koenig-lexical/index.css +2 -2
  48. package/core/built/admin/assets/koenig-lexical/koenig-lexical.js +21800 -23540
  49. package/core/built/admin/assets/koenig-lexical/koenig-lexical.umd.js +177 -177
  50. package/core/built/admin/assets/{koenig-lexical-D4CBYCN7.js → koenig-lexical-5o67f7C9.js} +155 -155
  51. package/core/built/admin/assets/{kpi-card-DOIcNxgg.js → kpi-card-XLCPc_4J.js} +1 -1
  52. package/core/built/admin/assets/{kpis-BrSBq5c9.js → kpis-Czdhg1qV.js} +1 -1
  53. package/core/built/admin/assets/{links-DkVK8XO7.js → links-CY3nuFg7.js} +1 -1
  54. package/core/built/admin/assets/{lucide-react-DNj9Mt50.js → lucide-react-B7CWr8XP.js} +1 -1
  55. package/core/built/admin/assets/{main-layout-A6BaeVIm.js → main-layout-CmX429hf.js} +1 -1
  56. package/core/built/admin/assets/{message-square-text-DJWDCab0.js → message-square-text-Cqodm1uC.js} +1 -1
  57. package/core/built/admin/assets/{minus-B7zQY2p1.js → minus-K1Fj4qFh.js} +1 -1
  58. package/core/built/admin/assets/{modals-DJQDv_48.js → modals-C0x0SG_a.js} +1 -1
  59. package/core/built/admin/assets/{moderation-DikYZSIC.js → moderation-DqX2eQNM.js} +1 -1
  60. package/core/built/admin/assets/{newsletter-ok4p5aPZ.js → newsletter-BaZVL4Rg.js} +1 -1
  61. package/core/built/admin/assets/{newsletters-ClUaZMbc.js → newsletters-DpmHk1Kf.js} +1 -1
  62. package/core/built/admin/assets/{note-C445n_od.js → note-Bqr3ECo6.js} +1 -1
  63. package/core/built/admin/assets/{overview-vPttXZEx.js → overview-CGTvSQfN.js} +1 -1
  64. package/core/built/admin/assets/{pagemenu-CUEgz3GC.js → pagemenu-z-Nc5-Yy.js} +1 -1
  65. package/core/built/admin/assets/{post-analytics-DPIgO2YG.js → post-analytics-DCAOPWEx.js} +1 -1
  66. package/core/built/admin/assets/{post-analytics-context-DGNsxT8V.js → post-analytics-context-DctS9fHu.js} +1 -1
  67. package/core/built/admin/assets/{post-analytics-header-B1f7HAy_.js → post-analytics-header-C6tJIKtV.js} +1 -1
  68. package/core/built/admin/assets/{post-share-modal-BIddzWjJ.js → post-share-modal-CtQTpIsC.js} +1 -1
  69. package/core/built/admin/assets/{posts-DOThg8yh.js → posts-D0erEci0.js} +1 -1
  70. package/core/built/admin/assets/{referrers-BK-mXdat.js → referrers-D4s1ncIT.js} +1 -1
  71. package/core/built/admin/assets/{repeat-CQvZJI02.js → repeat-BNamsVQr.js} +1 -1
  72. package/core/built/admin/assets/{reply-BET0l7FZ.js → reply-DqXFv78k.js} +1 -1
  73. package/core/built/admin/assets/{select-BH3t_tDB.js → select-CFBw9aAY.js} +1 -1
  74. package/core/built/admin/assets/{settings-CpkvyD93.js → settings-B_8Oslb0.js} +5 -5
  75. package/core/built/admin/assets/{settings-OIq7tQiJ.js → settings-BnZOyHrT.js} +1 -1
  76. package/core/built/admin/assets/{sort-button-DkfQ-8QJ.js → sort-button-K1rs2zWp.js} +1 -1
  77. package/core/built/admin/assets/{source-icon-DOOAvJR8.js → source-icon-KI6QTdIv.js} +1 -1
  78. package/core/built/admin/assets/{sprout-gjsBxaCU.js → sprout-C96gimQS.js} +1 -1
  79. package/core/built/admin/assets/{square-DsGufPa-.js → square-s6ZVKvbY.js} +1 -1
  80. package/core/built/admin/assets/{stats-Cu49FJzo.js → stats-C8Qt0L-1.js} +1 -1
  81. package/core/built/admin/assets/{stats-view-DUoDKh7r.js → stats-view-0eaQf_pM.js} +1 -1
  82. package/core/built/admin/assets/{step-1-QOnWlIzD.js → step-1-Gnp7iGGY.js} +1 -1
  83. package/core/built/admin/assets/{step-2-CDFj1bR5.js → step-2-DFbY2-K1.js} +1 -1
  84. package/core/built/admin/assets/{step-3-Cjmt9ecL.js → step-3-CoA_-aRF.js} +1 -1
  85. package/core/built/admin/assets/{table-PBYP6iVu.js → table-DpY57zP6.js} +1 -1
  86. package/core/built/admin/assets/{tabs--ia9i-R8.js → tabs-BTEs4Aby.js} +1 -1
  87. package/core/built/admin/assets/{tags-DwsoamaL.js → tags-CIEzegXe.js} +1 -1
  88. package/core/built/admin/assets/{tags-DK91bj9-.js → tags-DUcQDnmf.js} +1 -1
  89. package/core/built/admin/assets/{toggle-group-my6OlgUp.js → toggle-group-qaH0bKBM.js} +1 -1
  90. package/core/built/admin/assets/{topic-filter-Cdat1Ona.js → topic-filter-BmvO9gja.js} +1 -1
  91. package/core/built/admin/assets/{trash-C2kuVkXA.js → trash-DIVNO9rU.js} +1 -1
  92. package/core/built/admin/assets/{url-helpers-BuFo9dQz.js → url-helpers-Cn69VioM.js} +1 -1
  93. package/core/built/admin/assets/{use-growth-stats-DY2E0ltn.js → use-growth-stats-DPN4F7Mt.js} +1 -1
  94. package/core/built/admin/assets/{use-infinite-virtual-scroll-CS20HV8J.js → use-infinite-virtual-scroll-D5U6oSIq.js} +1 -1
  95. package/core/built/admin/assets/{use-simple-pagination-kb9H2Ssw.js → use-simple-pagination-_Ui1WbsL.js} +1 -1
  96. package/core/built/admin/assets/{user-round-check-Biw6QBQA.js → user-round-check-pBOLjTqi.js} +1 -1
  97. package/core/built/admin/assets/{wallet-cards-aM5Ct3OB.js → wallet-cards-yxIjXIK2.js} +1 -1
  98. package/core/built/admin/assets/{web-DiBDLMW8.js → web-CtBMATfv.js} +1 -1
  99. package/core/built/admin/index-forward.html +5 -5
  100. package/core/built/admin/index.html +3 -3
  101. package/core/server/services/member-welcome-emails/constants.js +1 -22
  102. package/core/server/services/member-welcome-emails/service.js +2 -20
  103. package/core/server/services/members/members-api/repositories/member-repository.js +7 -12
  104. package/package.json +13 -13
  105. package/yarn.lock +72 -89
  106. package/components/tryghost-i18n-6.13.1.tgz +0 -0
  107. /package/core/built/admin/assets/{chunk.397.a720333cfffc99c47e71.js.LICENSE.txt → chunk.397.71f16fce8de382622bb4.js.LICENSE.txt} +0 -0
@@ -1 +1 @@
1
- import{m as W,r as u,b as $,j as e,Q as H,R as L,cp as ye,g as Ne,e as Ce,P as Ue,U as Me,A as oe,B as j,n as ae,h as Be,f as X,bB as Pe,F as ie,aO as ce,a0 as de,cH as De,a1 as ue,a2 as _,a3 as Y,a4 as K,H as G,bS as Te,aQ as Fe,a5 as J,a6 as me,V as U,ca as Oe,cb as Re,cd as Ie,cI as ne,a7 as Ee,a8 as Se,u as xe,c2 as Ae,a as $e,J as He,K as Le,M as Ve,N as ze,L as te,E as Qe,c as _e,S as R,aX as Ye,D as Ke,q as Ge,t as Je,v as We,w as Xe,O as qe,$ as Ze,cJ as es,o as ss,s as ls,cE as z,T as ns,bx as ts,by as rs,cK as os,cL as fe,cM as as}from"./index-X_uC_0DD.js";import{P as is}from"./tags-DwsoamaL.js";import{E as cs}from"./edit-profile-DgMLvoyu.js";import{T as ds,a as us,b as S,f as Q,c as A}from"./tabs--ia9i-R8.js";import{a as ms}from"./settings-OIq7tQiJ.js";import{U as xs}from"./lucide-react-DNj9Mt50.js";import{C as fs}from"./copy-B8yuX-e4.js";import"./at-sign-BtKGpnjs.js";import"./index-BNkw6KwF.js";import"./wallet-cards-aM5Ct3OB.js";import"./a-large-small-2Oh9oqBr.js";import"./message-square-text-DJWDCab0.js";import"./hash-ZzZYv2ek.js";import"./inbox-C5KDymI8.js";import"./minus-B7zQY2p1.js";import"./square-DsGufPa-.js";import"./user-round-check-Biw6QBQA.js";import"./repeat-CQvZJI02.js";import"./reply-BET0l7FZ.js";import"./sprout-gjsBxaCU.js";import"./trash-C2kuVkXA.js";function hs(s){return typeof s.name=="string"?s.name:typeof s.preferredUsername=="string"?s.preferredUsername:typeof s.preferredUsername=="object"&&s.preferredUsername!==null&&"@value"in s.preferredUsername&&typeof s.preferredUsername["@value"]=="string"?s.preferredUsername["@value"]:"Unknown"}const he=({noResultsMessage:s,actors:o,isLoading:n,fetchNextPage:c,hasNextPage:x,isFetchingNextPage:d})=>{const i=W("index","me"),{data:r}=i,t=u.useRef(null),a=u.useRef(null);u.useEffect(()=>(t.current&&t.current.disconnect(),t.current=new IntersectionObserver(l=>{l[0].isIntersecting&&x&&!d&&c()}),a.current&&t.current.observe(a.current),()=>{t.current&&t.current.disconnect()}),[x,d,c]);const m=$();return e.jsxs("div",{className:"pt-3","data-testid":"actor-list",children:[x===!1&&o.length===0?e.jsxs(H,{children:[e.jsx(L,{children:e.jsx(ye,{})}),s]}):e.jsx("div",{className:"flex flex-col",children:o.map(({actor:l,isFollowing:h,blockedByMe:b,domainBlockedByMe:k})=>{const w=l.handle||Ne(l),y=w===r?.handle;return e.jsx(Ce.Fragment,{children:e.jsx(Ue,{actor:l,align:"center",isCurrentUser:y,side:"left",children:e.jsx("div",{children:e.jsxs(Me,{"data-testid":"actor-item",onClick:()=>{Be(l,m)},children:[e.jsx(oe,{author:l}),e.jsx("div",{children:e.jsxs("div",{className:"text-gray-600 break-anywhere",children:[e.jsx("span",{className:"mr-1 line-clamp-1 font-bold text-black dark:text-white",children:hs(l)}),e.jsx("div",{className:"line-clamp-1 text-sm",children:w})]})}),b||k?e.jsx(j,{className:"pointer-events-none ml-auto min-w-[90px]",variant:"destructive",children:"Blocked"}):y?null:e.jsx(ae,{className:"ml-auto","data-testid":"follow-button",following:h,handle:w,type:"secondary"})]},l.id)})})},l.id)})}),e.jsx("div",{ref:a,className:"h-1"}),(d||n)&&e.jsx("div",{className:"mt-6 flex flex-col items-center justify-center space-y-4 text-center",children:e.jsx(X,{size:"md"})})]})},ps=({posts:s,fetchNextPage:o,hasNextPage:n,isFetchingNextPage:c,isLoading:x})=>{const d=u.useRef(null),i=u.useRef(null),r=u.useRef(null),t=Math.max(0,Math.floor(s.length*.75)-1);u.useEffect(()=>(d.current&&d.current.disconnect(),d.current=new IntersectionObserver(m=>{m[0].isIntersecting&&n&&!c&&o()}),i.current&&d.current.observe(i.current),r.current&&d.current.observe(r.current),()=>{d.current&&d.current.disconnect()}),[n,c,o]);const a=$();return e.jsxs(e.Fragment,{children:[n===!1&&s.length===0&&e.jsxs(H,{children:[e.jsx(L,{children:e.jsx(Pe,{})}),"You haven't liked anything yet."]}),e.jsxs("ul",{className:"mx-auto flex max-w-[640px] flex-col","data-testid":"profile-likes-list",children:[s.map((m,l)=>e.jsxs("li",{"data-testid":"profile-like-item","data-test-view-article":!0,children:[e.jsx(ie,{actor:m.actor,allowDelete:m.object.authored,commentCount:m.object.replyCount,isLoading:x,layout:"feed",likeCount:m.object.likeCount,object:m.object,repostCount:m.object.repostCount,type:m.type,onClick:()=>{m.object.type==="Note"?a(`/notes/${encodeURIComponent(m.object.id)}`):m.object.type==="Article"&&a(`/reader/${encodeURIComponent(m.object.id)}`)}}),l<s.length-1&&e.jsx(ce,{}),l===t&&e.jsx("div",{ref:i,className:"h-1"})]},`likes-${m.id}`)),c&&e.jsx("li",{className:"flex flex-col items-center justify-center space-y-4 text-center",children:e.jsx(X,{size:"md"})})]}),e.jsx("div",{ref:r,className:"h-1"})]})},js=({posts:s,fetchNextPage:o,hasNextPage:n,isFetchingNextPage:c,isLoading:x,noResultsMessage:d})=>{const i=u.useRef(null),r=u.useRef(null),t=u.useRef(null),a=Math.max(0,Math.floor(s.length*.75)-1);u.useEffect(()=>(i.current&&i.current.disconnect(),i.current=new IntersectionObserver(l=>{l[0].isIntersecting&&n&&!c&&o()}),r.current&&i.current.observe(r.current),t.current&&i.current.observe(t.current),()=>{i.current&&i.current.disconnect()}),[n,c,o]);const m=$();return e.jsxs(e.Fragment,{children:[n===!1&&s.length===0&&e.jsxs(H,{children:[e.jsx(L,{children:e.jsx(is,{})}),d]}),e.jsxs("ul",{className:"mx-auto flex max-w-[640px] flex-col","data-testid":"profile-posts-list",children:[s.map((l,h)=>e.jsxs("li",{"data-testid":"profile-post-item","data-test-view-article":!0,children:[e.jsx(ie,{actor:l.actor,allowDelete:l.object.authored,commentCount:l.object.replyCount,isLoading:x,layout:"feed",likeCount:l.object.likeCount,object:l.object,repostCount:l.object.repostCount,type:l.type,onClick:()=>{l.object.type==="Note"?m(`/notes/${encodeURIComponent(l.object.id)}`):l.object.type==="Article"&&m(`/reader/${encodeURIComponent(l.object.id)}`)}}),h<s.length-1&&e.jsx(ce,{}),h===a&&e.jsx("div",{ref:r,className:"h-1"})]},`posts-${l.id}`)),c&&e.jsx("li",{className:"flex flex-col items-center justify-center space-y-4 text-center",children:e.jsx(X,{size:"md"})})]}),e.jsx("div",{ref:t,className:"h-1"})]})},pe=({handle:s,isUserBlocked:o,isDomainBlocked:n,onUnblockUser:c,onUnblockDomain:x,trigger:d,onUnblockComplete:i,isOpen:r,onOpenChange:t})=>{const[a,m]=u.useState(!1),[l,h]=u.useState(()=>{const p=o&&n,N=o&&!n,F=!o&&n;let g="idle";return p?g="dual":N?g="userOnly":F&&(g="domainOnly"),{mode:g,userUnblocked:!1,domainUnblocked:!1}}),b=r!==void 0,k=b?r:a,[w,y]=u.useState(!1),M=u.useCallback(()=>{const p=o&&n,N=o&&!n,F=!o&&n;let g="idle";p?g="dual":N?g="userOnly":F&&(g="domainOnly"),h(C=>({...C,mode:g,userUnblocked:!1,domainUnblocked:!1}))},[o,n]);u.useEffect(()=>{k&&!w?(M(),y(!0)):k||y(!1)},[k,w,M]);const D=()=>{b?t?.(!0):m(!0)},f=p=>{p||(b?t?.(!1):m(!1))},I=async()=>{await c(),h(p=>({...p,userUnblocked:!0})),(l.mode!=="dual"||l.domainUnblocked)&&(f(!1),i?.()),U.success("User unblocked")},E=async()=>{await x(),h(p=>({...p,domainUnblocked:!0})),(l.mode!=="dual"||l.userUnblocked)&&(f(!1),i?.()),U.success("Domain unblocked")},T=s.split("@").filter(Boolean)[1],B=()=>e.jsxs(e.Fragment,{children:[e.jsxs(_,{children:[e.jsx(Y,{className:"mb-1 flex flex-col gap-1",children:"Unblock"}),e.jsx(K,{className:"!mt-4",asChild:!0,children:e.jsxs("div",{className:"flex flex-col rounded-md border",children:[e.jsxs("div",{className:"flex justify-between gap-6 p-5",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(G,{children:"Unblock user"}),e.jsxs("p",{children:[e.jsx("span",{className:"font-semibold text-black",children:s})," will be able to follow you and engage with your public posts."]})]}),e.jsxs(j,{className:`gap-1 ${l.userUnblocked?"pointer-events-none border-green bg-green text-white hover:bg-green hover:text-white":"text-red hover:text-red-400"}`,variant:"outline",onClick:I,children:[e.jsx(Te,{}),l.userUnblocked?"User unblocked":"Unblock user"]})]}),e.jsx("div",{className:"border-t"}),e.jsxs("div",{className:"flex justify-between gap-6 p-5",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(G,{children:"Unblock domain"}),e.jsxs("p",{children:["Users from ",e.jsx("span",{className:"font-semibold text-black",children:T})," will be able to follow you and engage with your public posts."]})]}),e.jsxs(j,{className:`gap-1 ${l.domainUnblocked?"pointer-events-none border-green bg-green text-white hover:bg-green hover:text-white":"text-red hover:text-red-400"}`,variant:"outline",onClick:E,children:[e.jsx(Fe,{}),l.domainUnblocked?"Domain unblocked":"Unblock domain"]})]})]})})]}),e.jsx(J,{children:e.jsx(j,{onClick:()=>f(!1),children:"OK"})})]}),P=()=>{const p=l.mode==="userOnly";return e.jsxs(e.Fragment,{children:[e.jsxs(_,{children:[e.jsx(Y,{className:"mb-1 flex flex-col gap-1",children:p?"Unblock this user?":"Unblock this domain?"}),e.jsx(K,{children:p?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-semibold text-black",children:s})," will be able to follow you and engage with your public posts."]}):e.jsxs(e.Fragment,{children:["Users from ",e.jsx("span",{className:"font-semibold text-black",children:T})," will be able to follow you and engage with your public posts."]})})]}),e.jsxs(J,{children:[e.jsx(me,{children:"Cancel"}),e.jsx(j,{onClick:p?I:E,children:"Unblock"})]})]})};return e.jsxs(de,{open:k,onOpenChange:f,children:[d&&e.jsx(De,{asChild:!0,onClick:D,children:d}),e.jsx(ue,{className:`${l.mode==="dual"&&"max-w-[600px]"}`,children:l.mode==="dual"?B():P()})]})},bs=({account:s,children:o,onCopyHandle:n,onBlockAccount:c,onBlockDomain:x,disabled:d=!1,isBlocked:i=!1,isDomainBlocked:r=!1})=>{const[t,a]=u.useState(null),[m,l]=u.useState(!1),h=f=>{f.stopPropagation(),n()},b=f=>{f.stopPropagation(),c()},k=f=>{f.stopPropagation(),x()},w=s?.handle,y=w?.split("@").filter(Boolean)[1],M=()=>e.jsx(de,{open:m,onOpenChange:l,children:e.jsxs(ue,{onClick:f=>f.stopPropagation(),children:[e.jsxs(_,{children:[e.jsx(Y,{className:"mb-1 flex flex-col gap-1",children:t==="user"?"Block this user?":"Block this domain?"}),e.jsx(K,{children:t==="user"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-semibold text-black",children:w})," will be able to see your public posts, but will no longer be able follow you or interact with your content on the social web."]}):e.jsxs(e.Fragment,{children:["All users from ",e.jsx("span",{className:"font-semibold text-black",children:y})," will be able to see your public posts, but won't be able to follow you or interact with your content."]})})]}),e.jsxs(J,{children:[t!=="domain"&&e.jsx(j,{className:"-ml-3 mr-auto hover:bg-transparent hover:opacity-80",variant:"ghost",onClick:f=>{f.stopPropagation(),a("domain")},children:"Block domain instead"}),e.jsx(me,{onClick:f=>f.stopPropagation(),children:"Cancel"}),e.jsx(Ee,{className:Se({variant:"destructive"}),onClick:t==="user"?b:k,children:"Block"})]})]})}),D=()=>s&&e.jsx(pe,{handle:s.handle,isDomainBlocked:s.domainBlockedByMe,isOpen:m,isUserBlocked:s.blockedByMe,onOpenChange:l,onUnblockDomain:x,onUnblockUser:c});return e.jsxs(e.Fragment,{children:[e.jsxs(Oe,{children:[e.jsx(Re,{disabled:d,asChild:!0,onClick:f=>f.stopPropagation(),children:o}),e.jsx(Ie,{align:"end",className:"p-2",children:e.jsxs("div",{className:"flex w-48 flex-col",children:[e.jsx(ne,{asChild:!0,children:e.jsx(j,{className:"justify-start",variant:"ghost",onClick:h,children:"Copy handle"})}),e.jsx(ne,{asChild:!0,children:e.jsx(j,{className:"justify-start text-red hover:bg-red/5 hover:text-red",variant:"ghost",onClick:f=>{f.stopPropagation(),!i&&!r&&a("user"),l(!0)},children:i?"Unblock user":r?"Unblock domain":"Block user"})})]})})]}),i||r?D():M()]})},gs=({account:s,onUnblock:o,onDomainUnblock:n,className:c=""})=>{const[x,d]=u.useState(!1),i=e.jsx(j,{className:`min-w-[90px] ${c}`,variant:"destructive",onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:x?"Unblock":"Blocked"});return e.jsx(pe,{handle:s.handle,isDomainBlocked:s.domainBlockedByMe,isUserBlocked:s.blockedByMe,trigger:i,onUnblockDomain:n,onUnblockUser:o})},re=()=>{},ks=({account:s,customFields:o,isLoadingAccount:n,postsTab:c,likesTab:x,followingTab:d,followersTab:i})=>{const r=xe(),t=Ae(),a=$(),{canGoBack:m}=$e(),l=r.handle?`/profile/${r.handle}`:"/profile",h=!r.handle,b=r.handle?r.tab||"":t.pathname.split("/").pop()||"",k=u.useMemo(()=>h?["likes","following","followers"]:["following","followers"],[h]),w=k.includes(b)?b:"posts",y=He("index"),M=Le("index"),D=Ve("index"),f=ze("index"),I=W("index","me"),{data:E}=r.handle?I:{data:void 0},T=r.handle===E?.handle||!r.handle,B=s?.blockedByMe,P=s?.domainBlockedByMe,[p,N]=u.useState(!1),[F,g]=u.useState(!1),C=u.useRef(null);u.useEffect(()=>()=>{C.current&&window.clearTimeout(C.current)},[]);const q=()=>{B?M.mutate(s):(y.mutate(s),U.success("User blocked")),N(!1)},Z=()=>{P?f.mutate({url:s.apId,handle:s.handle}):(D.mutate({url:s.apId,handle:s.handle}),U.success("Domain blocked")),N(!1)},ee=async()=>{if(!s?.handle||!navigator?.clipboard?.writeText){U.error("Unable to copy handle");return}try{await navigator.clipboard.writeText(s.handle),g(!0),U.success("Handle copied"),C.current&&window.clearTimeout(C.current),C.current=window.setTimeout(()=>g(!1),2e3)}catch{U.error("Failed to copy handle"),g(!1)}},[O,je]=u.useState(!1),[be,se]=u.useState(!1),ge=()=>{je(!O)},V=u.useRef(null),[le,ke]=u.useState(!1);u.useEffect(()=>{V.current&&ke(V.current.scrollHeight>160)},[O,s?.bio,o,n]),u.useEffect(()=>{b&&(k.includes(b)||a(l,{replace:!0}))},[k,l,a,b]);const we=v=>v==="posts"?l:`${l}/${v}`,ve=v=>{v!==w&&a(we(v),{replace:!0})};return!n&&!s?e.jsx(te,{children:e.jsx("div",{className:"mx-auto mt-4 flex w-full max-w-[620px] flex-col items-center [&_svg]:translate-x-px",children:e.jsxs(Qe,{children:[e.jsx(_e,{children:e.jsx(xs,{})}),e.jsx("div",{children:"Profile not found"})]})})}):e.jsx(te,{children:e.jsx("div",{className:"z-0 mx-[max(-4vw,-32px)] -mt-9 flex flex-col items-center pb-16",children:e.jsx("div",{className:"mx-auto w-full",children:e.jsxs(e.Fragment,{children:[s?.bannerImageUrl?e.jsx("div",{className:"h-[15vw] min-h-[200px] w-full overflow-hidden bg-gradient-to-tr from-gray-200 to-gray-100",children:e.jsx("img",{alt:s?.name,className:"size-full object-cover",referrerPolicy:"no-referrer",src:s?.bannerImageUrl})}):e.jsx("div",{className:"h-[max(8vw,132px)] w-full overflow-hidden bg-gradient-to-tr from-white to-white dark:from-black dark:to-black"}),e.jsxs("div",{className:`mx-auto max-w-[620px] px-6 ${!s?.bannerImageUrl&&!m?"-mt-8":"-mt-12"}`,children:[e.jsxs("div",{className:"flex items-end justify-between",children:[e.jsx("div",{className:"-ml-2 rounded-full bg-white p-1 dark:bg-black",children:n?e.jsx(R,{className:"size-[92px] rounded-full"}):e.jsx(oe,{author:{icon:{url:s?.avatarUrl},name:s?.name,handle:s?.handle},size:"lg"})}),!T&&!n&&e.jsxs("div",{className:"flex gap-2",children:[B||P?e.jsx(gs,{account:s,onDomainUnblock:Z,onUnblock:q}):e.jsx(ae,{following:s?.followedByMe,handle:s?.handle,type:"primary",onFollow:re,onUnfollow:re}),e.jsx(bs,{account:s,isBlocked:B,isDomainBlocked:P,onBlockAccount:q,onBlockDomain:Z,onCopyHandle:ee,children:e.jsx(j,{"aria-label":"Open profile menu",variant:"outline",children:e.jsx(Ye,{})})})]}),T&&!n&&e.jsxs(Ke,{open:be,onOpenChange:se,children:[e.jsx(Ge,{children:e.jsx(ms,{children:e.jsx(j,{variant:"secondary",children:"Edit profile"})})}),e.jsxs(Je,{className:"w-full max-w-[520px]",onOpenAutoFocus:v=>v.preventDefault(),children:[e.jsx(We,{children:e.jsx(Xe,{children:"Profile settings"})}),s&&e.jsx(cs,{account:s,setIsEditingProfile:se})]})]})]}),e.jsx(qe,{className:"mt-4 truncate break-anywhere",children:n?e.jsx(R,{className:"w-32"}):s?.name}),e.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[e.jsx("a",{className:"inline-flex max-w-full truncate text-[1.5rem] text-gray-800 hover:text-gray-900 dark:text-gray-600 dark:hover:text-gray-500",href:s?.url,rel:"noopener noreferrer",target:"_blank",children:e.jsx("span",{className:"truncate",children:n?e.jsx(R,{className:"w-full max-w-56"}):s?.handle})}),!n&&e.jsx(j,{className:"-ml-1.5 size-6 p-0 text-gray-800 hover:text-gray-900 dark:text-gray-700 dark:hover:text-gray-600",title:"Copy handle",variant:"link",onClick:ee,children:F?e.jsx(Ze,{size:16}):e.jsx(fs,{size:16})}),s?.followsMe&&!n&&e.jsx(es,{className:"mt-px whitespace-nowrap",variant:"secondary",children:"Follows you"})]}),(s?.bio||o?.length>0)&&e.jsxs("div",{ref:V,className:`ap-profile-content relative text-[1.5rem] break-anywhere [&>p]:mb-3 ${O?"max-h-none pb-7":"max-h-[160px] overflow-hidden"} relative`,children:[n?e.jsxs(e.Fragment,{children:[e.jsx(R,{}),e.jsx(R,{className:"w-full max-w-48"})]}):e.jsx("div",{dangerouslySetInnerHTML:{__html:ss(ls(s?.bio??"",["a","br"]))}}),o?.map(v=>e.jsxs("span",{className:"mt-3 line-clamp-1 flex flex-col text-[1.5rem]",children:[e.jsx("span",{className:"text-xs font-semibold",children:v.name}),e.jsx("span",{dangerouslySetInnerHTML:{__html:v.value},className:"ap-profile-content truncate"})]})),!O&&le&&e.jsx("div",{className:"absolute inset-x-0 bottom-0 h-16 bg-gradient-to-t from-white via-white/100 via-60% to-transparent dark:from-black dark:via-black/100"}),le&&e.jsx(j,{className:"absolute bottom-0 h-auto p-0 text-md",variant:"link",onClick:ge,children:O?"Show less":"Show all"})]}),e.jsxs(ds,{className:"mt-5",value:w,variant:"underline",onValueChange:v=>ve(v),children:[e.jsxs(us,{children:[e.jsx(S,{value:"posts",children:"Posts"}),h&&e.jsxs(S,{value:"likes",children:["Likes",e.jsx(Q,{children:z(s?.likedCount||0)})]}),e.jsxs(S,{value:"following",children:["Following",e.jsx(Q,{children:z(s?.followingCount||0)})]}),e.jsxs(S,{value:"followers",children:["Followers",e.jsx(Q,{children:z(s?.followerCount||0)})]})]}),e.jsx(A,{value:"posts",children:(B||P)&&!p?e.jsxs(H,{children:[e.jsx(L,{children:e.jsx(ns,{})}),e.jsxs("div",{className:"mt-2 flex flex-col items-center gap-0.5",children:[e.jsxs(G,{children:[s.name," is blocked"]}),e.jsx("p",{children:"You can view the posts, but it won't unblock the user."}),e.jsx(j,{className:"mt-4",variant:"secondary",onClick:()=>N(!0),children:"View posts"})]})]}):c}),h&&e.jsx(A,{value:"likes",children:x}),e.jsx(A,{value:"following",children:d}),e.jsx(A,{value:"followers",children:i})]},r.handle||s?.handle||"current-user")]})]})})})})},ws=({handle:s})=>{const{postsByAccountQuery:o}=os(s||"me",{enabled:!0}),{data:n,fetchNextPage:c,hasNextPage:x,isFetchingNextPage:d,isLoading:i}=o,r=n?.pages.flatMap(t=>t.posts)??Array.from({length:5},(t,a)=>({id:`placeholder-${a}`,object:{}}));return e.jsx(js,{fetchNextPage:c,hasNextPage:x,isFetchingNextPage:d,isLoading:i,noResultsMessage:s?`${s} hasn't posted anything yet`:"You haven't posted anything yet.",posts:r})},vs=()=>{const{postsLikedByAccountQuery:s}=as({enabled:!0}),{data:o,fetchNextPage:n,hasNextPage:c,isFetchingNextPage:x,isLoading:d}=s,i=o?.pages.flatMap(r=>r.posts)??Array.from({length:5},(r,t)=>({id:`placeholder-${t}`,object:{}}));return e.jsx(ps,{fetchNextPage:n,hasNextPage:c,isFetchingNextPage:x,isLoading:d,posts:i})},ys=({handle:s})=>{const o=fe(s===""?"me":s,"following"),{data:n,fetchNextPage:c,hasNextPage:x,isFetchingNextPage:d,isLoading:i}=o,r=n?.pages.flatMap(t=>"following"in t?t.following:"accounts"in t?t.accounts.map(a=>({actor:{id:a.id,name:a.name,handle:a.handle,icon:{url:a.avatarUrl}},isFollowing:a.isFollowing,blockedByMe:a.blockedByMe,domainBlockedByMe:a.domainBlockedByMe})):[])??[];return e.jsx(he,{actors:r,fetchNextPage:c,hasNextPage:x,isFetchingNextPage:d,isLoading:i,noResultsMessage:`${s||"You"} have no following`})},Ns=({handle:s})=>{const o=fe(s===""?"me":s,"followers"),{data:n,fetchNextPage:c,hasNextPage:x,isFetchingNextPage:d,isLoading:i}=o,r=n?.pages.flatMap(t=>"followers"in t?t.followers:"accounts"in t?t.accounts.map(a=>({actor:{id:a.id,name:a.name,handle:a.handle,icon:{url:a.avatarUrl}},isFollowing:a.isFollowing})):[])??[];return e.jsx(he,{actors:r,fetchNextPage:c,hasNextPage:x,isFetchingNextPage:d,isLoading:i,noResultsMessage:`${s||"You"} have no followers yet`})},Ys=({})=>{const s=xe(),{data:o,isLoading:n,error:c,refetch:x}=W("index",s.handle||"me");if(u.useEffect(()=>{x()},[s.handle,x]),c&&ts(c)&&c.statusCode!==404)return e.jsx(rs,{errorCode:c.code,statusCode:c.statusCode});const d=Object.keys(o?.customFields||{}).map(m=>({name:m,value:o.customFields[m]}))||[],i=e.jsx(ws,{handle:s.handle||""}),r=e.jsx(vs,{}),t=e.jsx(ys,{handle:s.handle||""}),a=e.jsx(Ns,{handle:s.handle||""});return e.jsx(ks,{account:o,customFields:d,followersTab:a,followingTab:t,isLoadingAccount:n,likesTab:r,postsTab:i})};export{Ys as default};
1
+ import{m as W,r as u,b as $,j as e,Q as H,R as L,cp as ye,g as Ne,e as Ce,P as Ue,U as Me,A as oe,B as j,n as ae,h as Be,f as X,bB as Pe,F as ie,aO as ce,a0 as de,cH as De,a1 as ue,a2 as _,a3 as Y,a4 as K,H as G,bS as Te,aQ as Fe,a5 as J,a6 as me,V as U,ca as Oe,cb as Re,cd as Ie,cI as ne,a7 as Ee,a8 as Se,u as xe,c2 as Ae,a as $e,J as He,K as Le,M as Ve,N as ze,L as te,E as Qe,c as _e,S as R,aX as Ye,D as Ke,q as Ge,t as Je,v as We,w as Xe,O as qe,$ as Ze,cJ as es,o as ss,s as ls,cE as z,T as ns,bx as ts,by as rs,cK as os,cL as fe,cM as as}from"./index-Dq_j8mTf.js";import{P as is}from"./tags-CIEzegXe.js";import{E as cs}from"./edit-profile-DZhjWF_f.js";import{T as ds,a as us,b as S,f as Q,c as A}from"./tabs-BTEs4Aby.js";import{a as ms}from"./settings-BnZOyHrT.js";import{U as xs}from"./lucide-react-B7CWr8XP.js";import{C as fs}from"./copy-CCj6xx5V.js";import"./at-sign-DHUgIxNb.js";import"./index-CLdEbHsV.js";import"./wallet-cards-yxIjXIK2.js";import"./a-large-small-D-nhKFBX.js";import"./message-square-text-Cqodm1uC.js";import"./hash-B4UtN3nq.js";import"./inbox-D336Mbic.js";import"./minus-K1Fj4qFh.js";import"./square-s6ZVKvbY.js";import"./user-round-check-pBOLjTqi.js";import"./repeat-BNamsVQr.js";import"./reply-DqXFv78k.js";import"./sprout-C96gimQS.js";import"./trash-DIVNO9rU.js";function hs(s){return typeof s.name=="string"?s.name:typeof s.preferredUsername=="string"?s.preferredUsername:typeof s.preferredUsername=="object"&&s.preferredUsername!==null&&"@value"in s.preferredUsername&&typeof s.preferredUsername["@value"]=="string"?s.preferredUsername["@value"]:"Unknown"}const he=({noResultsMessage:s,actors:o,isLoading:n,fetchNextPage:c,hasNextPage:x,isFetchingNextPage:d})=>{const i=W("index","me"),{data:r}=i,t=u.useRef(null),a=u.useRef(null);u.useEffect(()=>(t.current&&t.current.disconnect(),t.current=new IntersectionObserver(l=>{l[0].isIntersecting&&x&&!d&&c()}),a.current&&t.current.observe(a.current),()=>{t.current&&t.current.disconnect()}),[x,d,c]);const m=$();return e.jsxs("div",{className:"pt-3","data-testid":"actor-list",children:[x===!1&&o.length===0?e.jsxs(H,{children:[e.jsx(L,{children:e.jsx(ye,{})}),s]}):e.jsx("div",{className:"flex flex-col",children:o.map(({actor:l,isFollowing:h,blockedByMe:b,domainBlockedByMe:k})=>{const w=l.handle||Ne(l),y=w===r?.handle;return e.jsx(Ce.Fragment,{children:e.jsx(Ue,{actor:l,align:"center",isCurrentUser:y,side:"left",children:e.jsx("div",{children:e.jsxs(Me,{"data-testid":"actor-item",onClick:()=>{Be(l,m)},children:[e.jsx(oe,{author:l}),e.jsx("div",{children:e.jsxs("div",{className:"text-gray-600 break-anywhere",children:[e.jsx("span",{className:"mr-1 line-clamp-1 font-bold text-black dark:text-white",children:hs(l)}),e.jsx("div",{className:"line-clamp-1 text-sm",children:w})]})}),b||k?e.jsx(j,{className:"pointer-events-none ml-auto min-w-[90px]",variant:"destructive",children:"Blocked"}):y?null:e.jsx(ae,{className:"ml-auto","data-testid":"follow-button",following:h,handle:w,type:"secondary"})]},l.id)})})},l.id)})}),e.jsx("div",{ref:a,className:"h-1"}),(d||n)&&e.jsx("div",{className:"mt-6 flex flex-col items-center justify-center space-y-4 text-center",children:e.jsx(X,{size:"md"})})]})},ps=({posts:s,fetchNextPage:o,hasNextPage:n,isFetchingNextPage:c,isLoading:x})=>{const d=u.useRef(null),i=u.useRef(null),r=u.useRef(null),t=Math.max(0,Math.floor(s.length*.75)-1);u.useEffect(()=>(d.current&&d.current.disconnect(),d.current=new IntersectionObserver(m=>{m[0].isIntersecting&&n&&!c&&o()}),i.current&&d.current.observe(i.current),r.current&&d.current.observe(r.current),()=>{d.current&&d.current.disconnect()}),[n,c,o]);const a=$();return e.jsxs(e.Fragment,{children:[n===!1&&s.length===0&&e.jsxs(H,{children:[e.jsx(L,{children:e.jsx(Pe,{})}),"You haven't liked anything yet."]}),e.jsxs("ul",{className:"mx-auto flex max-w-[640px] flex-col","data-testid":"profile-likes-list",children:[s.map((m,l)=>e.jsxs("li",{"data-testid":"profile-like-item","data-test-view-article":!0,children:[e.jsx(ie,{actor:m.actor,allowDelete:m.object.authored,commentCount:m.object.replyCount,isLoading:x,layout:"feed",likeCount:m.object.likeCount,object:m.object,repostCount:m.object.repostCount,type:m.type,onClick:()=>{m.object.type==="Note"?a(`/notes/${encodeURIComponent(m.object.id)}`):m.object.type==="Article"&&a(`/reader/${encodeURIComponent(m.object.id)}`)}}),l<s.length-1&&e.jsx(ce,{}),l===t&&e.jsx("div",{ref:i,className:"h-1"})]},`likes-${m.id}`)),c&&e.jsx("li",{className:"flex flex-col items-center justify-center space-y-4 text-center",children:e.jsx(X,{size:"md"})})]}),e.jsx("div",{ref:r,className:"h-1"})]})},js=({posts:s,fetchNextPage:o,hasNextPage:n,isFetchingNextPage:c,isLoading:x,noResultsMessage:d})=>{const i=u.useRef(null),r=u.useRef(null),t=u.useRef(null),a=Math.max(0,Math.floor(s.length*.75)-1);u.useEffect(()=>(i.current&&i.current.disconnect(),i.current=new IntersectionObserver(l=>{l[0].isIntersecting&&n&&!c&&o()}),r.current&&i.current.observe(r.current),t.current&&i.current.observe(t.current),()=>{i.current&&i.current.disconnect()}),[n,c,o]);const m=$();return e.jsxs(e.Fragment,{children:[n===!1&&s.length===0&&e.jsxs(H,{children:[e.jsx(L,{children:e.jsx(is,{})}),d]}),e.jsxs("ul",{className:"mx-auto flex max-w-[640px] flex-col","data-testid":"profile-posts-list",children:[s.map((l,h)=>e.jsxs("li",{"data-testid":"profile-post-item","data-test-view-article":!0,children:[e.jsx(ie,{actor:l.actor,allowDelete:l.object.authored,commentCount:l.object.replyCount,isLoading:x,layout:"feed",likeCount:l.object.likeCount,object:l.object,repostCount:l.object.repostCount,type:l.type,onClick:()=>{l.object.type==="Note"?m(`/notes/${encodeURIComponent(l.object.id)}`):l.object.type==="Article"&&m(`/reader/${encodeURIComponent(l.object.id)}`)}}),h<s.length-1&&e.jsx(ce,{}),h===a&&e.jsx("div",{ref:r,className:"h-1"})]},`posts-${l.id}`)),c&&e.jsx("li",{className:"flex flex-col items-center justify-center space-y-4 text-center",children:e.jsx(X,{size:"md"})})]}),e.jsx("div",{ref:t,className:"h-1"})]})},pe=({handle:s,isUserBlocked:o,isDomainBlocked:n,onUnblockUser:c,onUnblockDomain:x,trigger:d,onUnblockComplete:i,isOpen:r,onOpenChange:t})=>{const[a,m]=u.useState(!1),[l,h]=u.useState(()=>{const p=o&&n,N=o&&!n,F=!o&&n;let g="idle";return p?g="dual":N?g="userOnly":F&&(g="domainOnly"),{mode:g,userUnblocked:!1,domainUnblocked:!1}}),b=r!==void 0,k=b?r:a,[w,y]=u.useState(!1),M=u.useCallback(()=>{const p=o&&n,N=o&&!n,F=!o&&n;let g="idle";p?g="dual":N?g="userOnly":F&&(g="domainOnly"),h(C=>({...C,mode:g,userUnblocked:!1,domainUnblocked:!1}))},[o,n]);u.useEffect(()=>{k&&!w?(M(),y(!0)):k||y(!1)},[k,w,M]);const D=()=>{b?t?.(!0):m(!0)},f=p=>{p||(b?t?.(!1):m(!1))},I=async()=>{await c(),h(p=>({...p,userUnblocked:!0})),(l.mode!=="dual"||l.domainUnblocked)&&(f(!1),i?.()),U.success("User unblocked")},E=async()=>{await x(),h(p=>({...p,domainUnblocked:!0})),(l.mode!=="dual"||l.userUnblocked)&&(f(!1),i?.()),U.success("Domain unblocked")},T=s.split("@").filter(Boolean)[1],B=()=>e.jsxs(e.Fragment,{children:[e.jsxs(_,{children:[e.jsx(Y,{className:"mb-1 flex flex-col gap-1",children:"Unblock"}),e.jsx(K,{className:"!mt-4",asChild:!0,children:e.jsxs("div",{className:"flex flex-col rounded-md border",children:[e.jsxs("div",{className:"flex justify-between gap-6 p-5",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(G,{children:"Unblock user"}),e.jsxs("p",{children:[e.jsx("span",{className:"font-semibold text-black",children:s})," will be able to follow you and engage with your public posts."]})]}),e.jsxs(j,{className:`gap-1 ${l.userUnblocked?"pointer-events-none border-green bg-green text-white hover:bg-green hover:text-white":"text-red hover:text-red-400"}`,variant:"outline",onClick:I,children:[e.jsx(Te,{}),l.userUnblocked?"User unblocked":"Unblock user"]})]}),e.jsx("div",{className:"border-t"}),e.jsxs("div",{className:"flex justify-between gap-6 p-5",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(G,{children:"Unblock domain"}),e.jsxs("p",{children:["Users from ",e.jsx("span",{className:"font-semibold text-black",children:T})," will be able to follow you and engage with your public posts."]})]}),e.jsxs(j,{className:`gap-1 ${l.domainUnblocked?"pointer-events-none border-green bg-green text-white hover:bg-green hover:text-white":"text-red hover:text-red-400"}`,variant:"outline",onClick:E,children:[e.jsx(Fe,{}),l.domainUnblocked?"Domain unblocked":"Unblock domain"]})]})]})})]}),e.jsx(J,{children:e.jsx(j,{onClick:()=>f(!1),children:"OK"})})]}),P=()=>{const p=l.mode==="userOnly";return e.jsxs(e.Fragment,{children:[e.jsxs(_,{children:[e.jsx(Y,{className:"mb-1 flex flex-col gap-1",children:p?"Unblock this user?":"Unblock this domain?"}),e.jsx(K,{children:p?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-semibold text-black",children:s})," will be able to follow you and engage with your public posts."]}):e.jsxs(e.Fragment,{children:["Users from ",e.jsx("span",{className:"font-semibold text-black",children:T})," will be able to follow you and engage with your public posts."]})})]}),e.jsxs(J,{children:[e.jsx(me,{children:"Cancel"}),e.jsx(j,{onClick:p?I:E,children:"Unblock"})]})]})};return e.jsxs(de,{open:k,onOpenChange:f,children:[d&&e.jsx(De,{asChild:!0,onClick:D,children:d}),e.jsx(ue,{className:`${l.mode==="dual"&&"max-w-[600px]"}`,children:l.mode==="dual"?B():P()})]})},bs=({account:s,children:o,onCopyHandle:n,onBlockAccount:c,onBlockDomain:x,disabled:d=!1,isBlocked:i=!1,isDomainBlocked:r=!1})=>{const[t,a]=u.useState(null),[m,l]=u.useState(!1),h=f=>{f.stopPropagation(),n()},b=f=>{f.stopPropagation(),c()},k=f=>{f.stopPropagation(),x()},w=s?.handle,y=w?.split("@").filter(Boolean)[1],M=()=>e.jsx(de,{open:m,onOpenChange:l,children:e.jsxs(ue,{onClick:f=>f.stopPropagation(),children:[e.jsxs(_,{children:[e.jsx(Y,{className:"mb-1 flex flex-col gap-1",children:t==="user"?"Block this user?":"Block this domain?"}),e.jsx(K,{children:t==="user"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-semibold text-black",children:w})," will be able to see your public posts, but will no longer be able follow you or interact with your content on the social web."]}):e.jsxs(e.Fragment,{children:["All users from ",e.jsx("span",{className:"font-semibold text-black",children:y})," will be able to see your public posts, but won't be able to follow you or interact with your content."]})})]}),e.jsxs(J,{children:[t!=="domain"&&e.jsx(j,{className:"-ml-3 mr-auto hover:bg-transparent hover:opacity-80",variant:"ghost",onClick:f=>{f.stopPropagation(),a("domain")},children:"Block domain instead"}),e.jsx(me,{onClick:f=>f.stopPropagation(),children:"Cancel"}),e.jsx(Ee,{className:Se({variant:"destructive"}),onClick:t==="user"?b:k,children:"Block"})]})]})}),D=()=>s&&e.jsx(pe,{handle:s.handle,isDomainBlocked:s.domainBlockedByMe,isOpen:m,isUserBlocked:s.blockedByMe,onOpenChange:l,onUnblockDomain:x,onUnblockUser:c});return e.jsxs(e.Fragment,{children:[e.jsxs(Oe,{children:[e.jsx(Re,{disabled:d,asChild:!0,onClick:f=>f.stopPropagation(),children:o}),e.jsx(Ie,{align:"end",className:"p-2",children:e.jsxs("div",{className:"flex w-48 flex-col",children:[e.jsx(ne,{asChild:!0,children:e.jsx(j,{className:"justify-start",variant:"ghost",onClick:h,children:"Copy handle"})}),e.jsx(ne,{asChild:!0,children:e.jsx(j,{className:"justify-start text-red hover:bg-red/5 hover:text-red",variant:"ghost",onClick:f=>{f.stopPropagation(),!i&&!r&&a("user"),l(!0)},children:i?"Unblock user":r?"Unblock domain":"Block user"})})]})})]}),i||r?D():M()]})},gs=({account:s,onUnblock:o,onDomainUnblock:n,className:c=""})=>{const[x,d]=u.useState(!1),i=e.jsx(j,{className:`min-w-[90px] ${c}`,variant:"destructive",onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:x?"Unblock":"Blocked"});return e.jsx(pe,{handle:s.handle,isDomainBlocked:s.domainBlockedByMe,isUserBlocked:s.blockedByMe,trigger:i,onUnblockDomain:n,onUnblockUser:o})},re=()=>{},ks=({account:s,customFields:o,isLoadingAccount:n,postsTab:c,likesTab:x,followingTab:d,followersTab:i})=>{const r=xe(),t=Ae(),a=$(),{canGoBack:m}=$e(),l=r.handle?`/profile/${r.handle}`:"/profile",h=!r.handle,b=r.handle?r.tab||"":t.pathname.split("/").pop()||"",k=u.useMemo(()=>h?["likes","following","followers"]:["following","followers"],[h]),w=k.includes(b)?b:"posts",y=He("index"),M=Le("index"),D=Ve("index"),f=ze("index"),I=W("index","me"),{data:E}=r.handle?I:{data:void 0},T=r.handle===E?.handle||!r.handle,B=s?.blockedByMe,P=s?.domainBlockedByMe,[p,N]=u.useState(!1),[F,g]=u.useState(!1),C=u.useRef(null);u.useEffect(()=>()=>{C.current&&window.clearTimeout(C.current)},[]);const q=()=>{B?M.mutate(s):(y.mutate(s),U.success("User blocked")),N(!1)},Z=()=>{P?f.mutate({url:s.apId,handle:s.handle}):(D.mutate({url:s.apId,handle:s.handle}),U.success("Domain blocked")),N(!1)},ee=async()=>{if(!s?.handle||!navigator?.clipboard?.writeText){U.error("Unable to copy handle");return}try{await navigator.clipboard.writeText(s.handle),g(!0),U.success("Handle copied"),C.current&&window.clearTimeout(C.current),C.current=window.setTimeout(()=>g(!1),2e3)}catch{U.error("Failed to copy handle"),g(!1)}},[O,je]=u.useState(!1),[be,se]=u.useState(!1),ge=()=>{je(!O)},V=u.useRef(null),[le,ke]=u.useState(!1);u.useEffect(()=>{V.current&&ke(V.current.scrollHeight>160)},[O,s?.bio,o,n]),u.useEffect(()=>{b&&(k.includes(b)||a(l,{replace:!0}))},[k,l,a,b]);const we=v=>v==="posts"?l:`${l}/${v}`,ve=v=>{v!==w&&a(we(v),{replace:!0})};return!n&&!s?e.jsx(te,{children:e.jsx("div",{className:"mx-auto mt-4 flex w-full max-w-[620px] flex-col items-center [&_svg]:translate-x-px",children:e.jsxs(Qe,{children:[e.jsx(_e,{children:e.jsx(xs,{})}),e.jsx("div",{children:"Profile not found"})]})})}):e.jsx(te,{children:e.jsx("div",{className:"z-0 mx-[max(-4vw,-32px)] -mt-9 flex flex-col items-center pb-16",children:e.jsx("div",{className:"mx-auto w-full",children:e.jsxs(e.Fragment,{children:[s?.bannerImageUrl?e.jsx("div",{className:"h-[15vw] min-h-[200px] w-full overflow-hidden bg-gradient-to-tr from-gray-200 to-gray-100",children:e.jsx("img",{alt:s?.name,className:"size-full object-cover",referrerPolicy:"no-referrer",src:s?.bannerImageUrl})}):e.jsx("div",{className:"h-[max(8vw,132px)] w-full overflow-hidden bg-gradient-to-tr from-white to-white dark:from-black dark:to-black"}),e.jsxs("div",{className:`mx-auto max-w-[620px] px-6 ${!s?.bannerImageUrl&&!m?"-mt-8":"-mt-12"}`,children:[e.jsxs("div",{className:"flex items-end justify-between",children:[e.jsx("div",{className:"-ml-2 rounded-full bg-white p-1 dark:bg-black",children:n?e.jsx(R,{className:"size-[92px] rounded-full"}):e.jsx(oe,{author:{icon:{url:s?.avatarUrl},name:s?.name,handle:s?.handle},size:"lg"})}),!T&&!n&&e.jsxs("div",{className:"flex gap-2",children:[B||P?e.jsx(gs,{account:s,onDomainUnblock:Z,onUnblock:q}):e.jsx(ae,{following:s?.followedByMe,handle:s?.handle,type:"primary",onFollow:re,onUnfollow:re}),e.jsx(bs,{account:s,isBlocked:B,isDomainBlocked:P,onBlockAccount:q,onBlockDomain:Z,onCopyHandle:ee,children:e.jsx(j,{"aria-label":"Open profile menu",variant:"outline",children:e.jsx(Ye,{})})})]}),T&&!n&&e.jsxs(Ke,{open:be,onOpenChange:se,children:[e.jsx(Ge,{children:e.jsx(ms,{children:e.jsx(j,{variant:"secondary",children:"Edit profile"})})}),e.jsxs(Je,{className:"w-full max-w-[520px]",onOpenAutoFocus:v=>v.preventDefault(),children:[e.jsx(We,{children:e.jsx(Xe,{children:"Profile settings"})}),s&&e.jsx(cs,{account:s,setIsEditingProfile:se})]})]})]}),e.jsx(qe,{className:"mt-4 truncate break-anywhere",children:n?e.jsx(R,{className:"w-32"}):s?.name}),e.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[e.jsx("a",{className:"inline-flex max-w-full truncate text-[1.5rem] text-gray-800 hover:text-gray-900 dark:text-gray-600 dark:hover:text-gray-500",href:s?.url,rel:"noopener noreferrer",target:"_blank",children:e.jsx("span",{className:"truncate",children:n?e.jsx(R,{className:"w-full max-w-56"}):s?.handle})}),!n&&e.jsx(j,{className:"-ml-1.5 size-6 p-0 text-gray-800 hover:text-gray-900 dark:text-gray-700 dark:hover:text-gray-600",title:"Copy handle",variant:"link",onClick:ee,children:F?e.jsx(Ze,{size:16}):e.jsx(fs,{size:16})}),s?.followsMe&&!n&&e.jsx(es,{className:"mt-px whitespace-nowrap",variant:"secondary",children:"Follows you"})]}),(s?.bio||o?.length>0)&&e.jsxs("div",{ref:V,className:`ap-profile-content relative text-[1.5rem] break-anywhere [&>p]:mb-3 ${O?"max-h-none pb-7":"max-h-[160px] overflow-hidden"} relative`,children:[n?e.jsxs(e.Fragment,{children:[e.jsx(R,{}),e.jsx(R,{className:"w-full max-w-48"})]}):e.jsx("div",{dangerouslySetInnerHTML:{__html:ss(ls(s?.bio??"",["a","br"]))}}),o?.map(v=>e.jsxs("span",{className:"mt-3 line-clamp-1 flex flex-col text-[1.5rem]",children:[e.jsx("span",{className:"text-xs font-semibold",children:v.name}),e.jsx("span",{dangerouslySetInnerHTML:{__html:v.value},className:"ap-profile-content truncate"})]})),!O&&le&&e.jsx("div",{className:"absolute inset-x-0 bottom-0 h-16 bg-gradient-to-t from-white via-white/100 via-60% to-transparent dark:from-black dark:via-black/100"}),le&&e.jsx(j,{className:"absolute bottom-0 h-auto p-0 text-md",variant:"link",onClick:ge,children:O?"Show less":"Show all"})]}),e.jsxs(ds,{className:"mt-5",value:w,variant:"underline",onValueChange:v=>ve(v),children:[e.jsxs(us,{children:[e.jsx(S,{value:"posts",children:"Posts"}),h&&e.jsxs(S,{value:"likes",children:["Likes",e.jsx(Q,{children:z(s?.likedCount||0)})]}),e.jsxs(S,{value:"following",children:["Following",e.jsx(Q,{children:z(s?.followingCount||0)})]}),e.jsxs(S,{value:"followers",children:["Followers",e.jsx(Q,{children:z(s?.followerCount||0)})]})]}),e.jsx(A,{value:"posts",children:(B||P)&&!p?e.jsxs(H,{children:[e.jsx(L,{children:e.jsx(ns,{})}),e.jsxs("div",{className:"mt-2 flex flex-col items-center gap-0.5",children:[e.jsxs(G,{children:[s.name," is blocked"]}),e.jsx("p",{children:"You can view the posts, but it won't unblock the user."}),e.jsx(j,{className:"mt-4",variant:"secondary",onClick:()=>N(!0),children:"View posts"})]})]}):c}),h&&e.jsx(A,{value:"likes",children:x}),e.jsx(A,{value:"following",children:d}),e.jsx(A,{value:"followers",children:i})]},r.handle||s?.handle||"current-user")]})]})})})})},ws=({handle:s})=>{const{postsByAccountQuery:o}=os(s||"me",{enabled:!0}),{data:n,fetchNextPage:c,hasNextPage:x,isFetchingNextPage:d,isLoading:i}=o,r=n?.pages.flatMap(t=>t.posts)??Array.from({length:5},(t,a)=>({id:`placeholder-${a}`,object:{}}));return e.jsx(js,{fetchNextPage:c,hasNextPage:x,isFetchingNextPage:d,isLoading:i,noResultsMessage:s?`${s} hasn't posted anything yet`:"You haven't posted anything yet.",posts:r})},vs=()=>{const{postsLikedByAccountQuery:s}=as({enabled:!0}),{data:o,fetchNextPage:n,hasNextPage:c,isFetchingNextPage:x,isLoading:d}=s,i=o?.pages.flatMap(r=>r.posts)??Array.from({length:5},(r,t)=>({id:`placeholder-${t}`,object:{}}));return e.jsx(ps,{fetchNextPage:n,hasNextPage:c,isFetchingNextPage:x,isLoading:d,posts:i})},ys=({handle:s})=>{const o=fe(s===""?"me":s,"following"),{data:n,fetchNextPage:c,hasNextPage:x,isFetchingNextPage:d,isLoading:i}=o,r=n?.pages.flatMap(t=>"following"in t?t.following:"accounts"in t?t.accounts.map(a=>({actor:{id:a.id,name:a.name,handle:a.handle,icon:{url:a.avatarUrl}},isFollowing:a.isFollowing,blockedByMe:a.blockedByMe,domainBlockedByMe:a.domainBlockedByMe})):[])??[];return e.jsx(he,{actors:r,fetchNextPage:c,hasNextPage:x,isFetchingNextPage:d,isLoading:i,noResultsMessage:`${s||"You"} have no following`})},Ns=({handle:s})=>{const o=fe(s===""?"me":s,"followers"),{data:n,fetchNextPage:c,hasNextPage:x,isFetchingNextPage:d,isLoading:i}=o,r=n?.pages.flatMap(t=>"followers"in t?t.followers:"accounts"in t?t.accounts.map(a=>({actor:{id:a.id,name:a.name,handle:a.handle,icon:{url:a.avatarUrl}},isFollowing:a.isFollowing})):[])??[];return e.jsx(he,{actors:r,fetchNextPage:c,hasNextPage:x,isFetchingNextPage:d,isLoading:i,noResultsMessage:`${s||"You"} have no followers yet`})},Ys=({})=>{const s=xe(),{data:o,isLoading:n,error:c,refetch:x}=W("index",s.handle||"me");if(u.useEffect(()=>{x()},[s.handle,x]),c&&ts(c)&&c.statusCode!==404)return e.jsx(rs,{errorCode:c.code,statusCode:c.statusCode});const d=Object.keys(o?.customFields||{}).map(m=>({name:m,value:o.customFields[m]}))||[],i=e.jsx(ws,{handle:s.handle||""}),r=e.jsx(vs,{}),t=e.jsx(ys,{handle:s.handle||""}),a=e.jsx(Ns,{handle:s.handle||""});return e.jsx(ks,{account:o,customFields:d,followersTab:a,followingTab:t,isLoadingAccount:n,likesTab:r,postsTab:i})};export{Ys as default};