ghost 6.24.0 → 6.25.0

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 (207) hide show
  1. package/components/{tryghost-i18n-6.24.0.tgz → tryghost-i18n-6.25.0.tgz} +0 -0
  2. package/components/tryghost-parse-email-address-6.25.0.tgz +0 -0
  3. package/core/boot.js +3 -1
  4. package/core/built/admin/assets/{PolarAngleAxis-7TlIQL3R.js → PolarAngleAxis-BNo3yZOE.js} +1 -1
  5. package/core/built/admin/assets/{_baseAssignValue-DJsCJz6y.js → _baseAssignValue-DwWJd_kU.js} +1 -1
  6. package/core/built/admin/assets/{a-large-small-BnBpzYwl.js → a-large-small-DzN0AB7t.js} +1 -1
  7. package/core/built/admin/assets/{at-sign-DC4NtDDM.js → at-sign-vqoOA4VZ.js} +1 -1
  8. package/core/built/admin/assets/{audience-CC5U4UxI.js → audience-CFjVlFTu.js} +1 -1
  9. package/core/built/admin/assets/{avatar-flipboard-_GQfQXQc.js → avatar-flipboard-DuTJ0ty5.js} +1 -1
  10. package/core/built/admin/assets/{bluesky-sharing-BKyzPl9y.js → bluesky-sharing-C1WkXrRJ.js} +1 -1
  11. package/core/built/admin/assets/{chart-BCQFlmhJ.js → chart-Bs2L1q8g.js} +1 -1
  12. package/core/built/admin/assets/{chunk.423.dae9a3bbe7845c3a3cfc.js → chunk.434.de8a15730373eccfeefe.js} +13 -101
  13. package/core/built/admin/assets/{chunk.524.b5e454aa74df4428420c.js → chunk.524.ed5714f505e821e549f3.js} +5 -5
  14. package/core/built/admin/assets/{chunk.582.20635869be68725e6d5c.js → chunk.582.639cecaca9e77bd7dd4f.js} +7 -7
  15. package/core/built/admin/assets/{chunk.123.1255d9e815f933dfdc57.js → chunk.603.5cb992da88800a9388f3.js} +8 -6
  16. package/core/built/admin/assets/{code-editor-view-BXnjo7qe.js → code-editor-view-DIH4grxv.js} +1 -1
  17. package/core/built/admin/assets/comments-gAnA10dK.js +1 -0
  18. package/core/built/admin/assets/{content-helpers-CQXipRWa.js → content-helpers-Cr_DHEOl.js} +1 -1
  19. package/core/built/admin/assets/{copy-B-MxRWPu.js → copy-w3c9zkaZ.js} +1 -1
  20. package/core/built/admin/assets/{data-list-B2sqn7IE.js → data-list-D-K_XfF3.js} +1 -1
  21. package/core/built/admin/assets/{deleted-feed-item-DQi676Dy.js → deleted-feed-item-DK47iaMV.js} +1 -1
  22. package/core/built/admin/assets/{dropzone-GgOCfK2j.js → dropzone-BHWXAN0m.js} +3 -3
  23. package/core/built/admin/assets/{edit-profile-COx5FmF9.js → edit-profile-DCyHhZgx.js} +1 -1
  24. package/core/built/admin/assets/{empty-indicator-Bf4Dqk72.js → empty-indicator-DjmACVr2.js} +1 -1
  25. package/core/built/admin/assets/{en-BkI47Ou-.js → en-Cl0b7CNW.js} +1 -1
  26. package/core/built/admin/assets/{feed-Dzc-8jwd.js → feed-C5AauoXf.js} +1 -1
  27. package/core/built/admin/assets/filters-DzSJ1ez3.js +1 -0
  28. package/core/built/admin/assets/{gh-chart-Ch6dYUac.js → gh-chart-xjwu2HZo.js} +1 -1
  29. package/core/built/admin/assets/{ghost-69e448feab2cb78aba64f7177fa4d6f0.js → ghost-78b4a517ac907213ab47708eef33bc6f.js} +423 -542
  30. package/core/built/admin/assets/{growth-BIBJdcm6.js → growth-DDyypj0q.js} +1 -1
  31. package/core/built/admin/assets/{hash-BGd7HEsT.js → hash-Bowe71Lt.js} +1 -1
  32. package/core/built/admin/assets/{inbox-CFzKvW3h.js → inbox-DS4qMjUb.js} +1 -1
  33. package/core/built/admin/assets/{index-DDJAHYHQ.js → index-4xuWCs9h.js} +1 -1
  34. package/core/built/admin/assets/{index-DIO8ceib.js → index-6Ag8SK_E.js} +1 -1
  35. package/core/built/admin/assets/{index-Dy8dCc8t.js → index-A6WmqYr6.js} +4 -4
  36. package/core/built/admin/assets/index-B8XuCPIT.js +1 -0
  37. package/core/built/admin/assets/{index-S2DGJkmz.js → index-BCvRITTU.js} +2 -2
  38. package/core/built/admin/assets/{index-BZyG96u1.js → index-B_XhekWb.js} +1 -1
  39. package/core/built/admin/assets/{index-D0gRP4Gp.js → index-C8ssgmjI.js} +1 -1
  40. package/core/built/admin/assets/{index-DM98UB_U.js → index-CFY2MOp4.js} +1 -1
  41. package/core/built/admin/assets/{index-CvX5YYEz.js → index-CVvW6Q-y.js} +1 -1
  42. package/core/built/admin/assets/{index-DpZazR71.js → index-CZK1A375.js} +1 -1
  43. package/core/built/admin/assets/{index-BYXKsmpv.js → index-CfpTfwls.js} +1 -1
  44. package/core/built/admin/assets/index-Chp0ODAU.css +1 -0
  45. package/core/built/admin/assets/{index-7NTHsKgE.js → index-DX6vaEVx.js} +1 -1
  46. package/core/built/admin/assets/{index-CsHjDdYB.js → index-DqlHFtZD.js} +1 -1
  47. package/core/built/admin/assets/{index-ZuWSQ3L6.js → index-JMWMnGGt.js} +93 -93
  48. package/core/built/admin/assets/{index-_WMp37yL.js → index-N61Xkr32.js} +1 -1
  49. package/core/built/admin/assets/{index-n5opb8tL.js → index-SDMWxO5r.js} +1 -1
  50. package/core/built/admin/assets/{koenig-lexical-8qAZ5o1x.js → koenig-lexical-DL3I-AcK.js} +1 -1
  51. package/core/built/admin/assets/{kpis-Cv75oSPY.js → kpis-Bm-hIEkf.js} +1 -1
  52. package/core/built/admin/assets/{label-CofMdj8x.js → label-DBwnwMrX.js} +1 -1
  53. package/core/built/admin/assets/{links-MSlYSad1.js → links-CnjcW0lg.js} +1 -1
  54. package/core/built/admin/assets/{loader-circle-CF5G2g_Z.js → loader-circle-CGDGFypO.js} +1 -1
  55. package/core/built/admin/assets/{lucide-react-DZiAu6PQ.js → lucide-react-BfVLf4Hw.js} +1 -1
  56. package/core/built/admin/assets/{main-layout-DEVUkqt_.js → main-layout-C_UH037j.js} +1 -1
  57. package/core/built/admin/assets/{member-route-mLKS-PsA.js → member-route-CKuE9uDU.js} +1 -1
  58. package/core/built/admin/assets/members-CzztojNk.js +15 -0
  59. package/core/built/admin/assets/{message-square-text-DESy3kSk.js → message-square-text-BDJyLbG2.js} +1 -1
  60. package/core/built/admin/assets/{minus-DVNwSjD6.js → minus-BM0xhFIQ.js} +1 -1
  61. package/core/built/admin/assets/{modals-FYjLOMaQ.js → modals-B6ZySU0x.js} +13 -13
  62. package/core/built/admin/assets/{moderation-u4WS46a-.js → moderation-CQMIGpv1.js} +1 -1
  63. package/core/built/admin/assets/{newsletter-Cj0UCg4J.js → newsletter-Dexg7vU8.js} +1 -1
  64. package/core/built/admin/assets/{newsletters-_UvhdBE3.js → newsletters-CT4k07rm.js} +1 -1
  65. package/core/built/admin/assets/{note-CRnFryTp.js → note-CiemurXq.js} +1 -1
  66. package/core/built/admin/assets/{overview-Cr0dGxEU.js → overview-9TwqfzGq.js} +1 -1
  67. package/core/built/admin/assets/{pagemenu-BqoDENpI.js → pagemenu-Dq744OgH.js} +1 -1
  68. package/core/built/admin/assets/{post-analytics-DIr_rDtL.js → post-analytics-CcRhLDKA.js} +1 -1
  69. package/core/built/admin/assets/{post-analytics-context-WA--pwK5.js → post-analytics-context-COgn3d86.js} +1 -1
  70. package/core/built/admin/assets/{post-analytics-header-D97SoEaV.js → post-analytics-header-DtBp2QSX.js} +1 -1
  71. package/core/built/admin/assets/{post-share-modal-DBxR7WCX.js → post-share-modal-BlOEKX3-.js} +1 -1
  72. package/core/built/admin/assets/posts/comments-C4rwkXWy.mjs +1473 -0
  73. package/core/built/admin/assets/posts/{dialog-67vvNv8e.mjs → dialog-Chkt119L.mjs} +3 -3
  74. package/core/built/admin/assets/posts/{dropdown-menu-BKZfsAPJ.mjs → dropdown-menu-CvSs_ay2.mjs} +5 -5
  75. package/core/built/admin/assets/posts/{empty-indicator-DTmBQa_3.mjs → empty-indicator-GyeO28CG.mjs} +2 -2
  76. package/core/built/admin/assets/posts/filters-BD3A2GlB.mjs +2831 -0
  77. package/core/built/admin/assets/posts/{get-site-timezone-D75cHSJ1.mjs → get-site-timezone-Baeue4hE.mjs} +2 -2
  78. package/core/built/admin/assets/posts/{growth-BqJWjpAp.mjs → growth-kmVbKjBt.mjs} +14 -14
  79. package/core/built/admin/assets/posts/{heading-DXxLDQ96.mjs → heading-DV_WQJh4.mjs} +2 -2
  80. package/core/built/admin/assets/posts/{hooks-pVotzebr.mjs → hooks-DQhsid0U.mjs} +2 -2
  81. package/core/built/admin/assets/posts/{index-By5yPnMZ.mjs → index-Bl1ReYmV.mjs} +10 -10
  82. package/core/built/admin/assets/posts/{index-DZ1HzbGS.mjs → index-CVum5OE6.mjs} +3 -3
  83. package/core/built/admin/assets/posts/{input-DdXe2Fjm.mjs → input-C7qFEkmt.mjs} +2 -2
  84. package/core/built/admin/assets/posts/{kpis-1MXZeSC9.mjs → kpis-DteuJY-D.mjs} +10 -10
  85. package/core/built/admin/assets/posts/{links-DGzzdzsH.mjs → links-eoZr0T0x.mjs} +4 -4
  86. package/core/built/admin/assets/posts/{loading-indicator-CSj2spwS.mjs → loading-indicator-Dj1SCL40.mjs} +3 -3
  87. package/core/built/admin/assets/posts/{main-layout-CGs25JVH.mjs → main-layout-Ct-TA0TH.mjs} +2 -2
  88. package/core/built/admin/assets/posts/{members-BRcED5fL.mjs → members-BY9oPKo4.mjs} +3814 -3378
  89. package/core/built/admin/assets/posts/{newsletter-D706LlgM.mjs → newsletter-BR1tln6E.mjs} +15 -15
  90. package/core/built/admin/assets/posts/{overview-5dG5ypjx.mjs → overview-j1ANMAQ2.mjs} +16 -16
  91. package/core/built/admin/assets/posts/{post-analytics-wvNuOa4c.mjs → post-analytics-DnG-Rolr.mjs} +6 -6
  92. package/core/built/admin/assets/posts/{post-analytics-context-BqnFe05q.mjs → post-analytics-context-hiKFF4yE.mjs} +5 -5
  93. package/core/built/admin/assets/posts/{post-analytics-header-Dsi5l6hb.mjs → post-analytics-header-OqAJ8SUL.mjs} +11 -11
  94. package/core/built/admin/assets/posts/{post-share-modal-DWe35McY.mjs → post-share-modal-BWfujDu2.mjs} +4 -4
  95. package/core/built/admin/assets/posts/posts-CS9tqSJC.mjs +37 -0
  96. package/core/built/admin/assets/posts/posts.js +1 -1
  97. package/core/built/admin/assets/posts/{reply-B4vwBMwj.mjs → reply-CX_EQh9X.mjs} +2 -2
  98. package/core/built/admin/assets/posts/{search-DQuB1WMm.mjs → search-BqzdnPQb.mjs} +2 -2
  99. package/core/built/admin/assets/posts/{select-BMPHyOdQ.mjs → select-CD5WLIrZ.mjs} +8 -8
  100. package/core/built/admin/assets/posts/{separator-DgZ2VF9r.mjs → separator-DFPLsWCc.mjs} +3 -3
  101. package/core/built/admin/assets/posts/{settings-D-wnf7Qg.mjs → settings-lnEt3Kb-.mjs} +2 -2
  102. package/core/built/admin/assets/posts/{sheet-SOdCzxUt.mjs → sheet-CkLfUqdH.mjs} +3 -3
  103. package/core/built/admin/assets/posts/{skeleton-Du7JXZ_1.mjs → skeleton-BZCi-IYy.mjs} +3 -3
  104. package/core/built/admin/assets/posts/{source-icon-DcBtKbCl.mjs → source-icon-C0k2hDC_.mjs} +3 -3
  105. package/core/built/admin/assets/posts/{stats-CeLav-Hu.mjs → stats-AHbSTqzG.mjs} +4 -4
  106. package/core/built/admin/assets/posts/{table-DlaJMBps.mjs → table-DMrf6wp5.mjs} +2 -2
  107. package/core/built/admin/assets/posts/{tabs-BQQbtw2g.mjs → tabs-BH8GNJCe.mjs} +14 -14
  108. package/core/built/admin/assets/posts/tags-C5VV8Gd0.mjs +398 -0
  109. package/core/built/admin/assets/posts/{tags-CLyaNf39.mjs → tags-DucujdYI.mjs} +2 -2
  110. package/core/built/admin/assets/posts/use-scroll-restoration-C7A3TpAz.mjs +517 -0
  111. package/core/built/admin/assets/posts/{use-infinite-virtual-scroll-B_NwiBXK.mjs → virtual-list-window-BIGoc0th.mjs} +322 -244
  112. package/core/built/admin/assets/posts/{web-TEVKbXSI.mjs → web-DczNailO.mjs} +18 -18
  113. package/core/built/admin/assets/posts-Dr3u9yOp.js +1 -0
  114. package/core/built/admin/assets/{referrers-J4vexZCf.js → referrers-6As_USul.js} +1 -1
  115. package/core/built/admin/assets/{repeat-BxOK9zhN.js → repeat-D-Ki-Cg5.js} +1 -1
  116. package/core/built/admin/assets/{reply-BoTN-eE0.js → reply-C4V0xZ2U.js} +1 -1
  117. package/core/built/admin/assets/{select-Bd1zcqox.js → select-Dt579MbD.js} +1 -1
  118. package/core/built/admin/assets/{settings-D72z6T_a.js → settings-BMsoTszq.js} +1 -1
  119. package/core/built/admin/assets/{settings-BGbGoa4s.js → settings-Ck1Hqs1x.js} +19 -19
  120. package/core/built/admin/assets/{sort-button-BOLTpImz.js → sort-button-Bn325H3y.js} +1 -1
  121. package/core/built/admin/assets/{source-icon-BqEM5MvU.js → source-icon-CNqsYZeA.js} +1 -1
  122. package/core/built/admin/assets/{sprout-Bf-wc2Vo.js → sprout-C9DbfYGe.js} +1 -1
  123. package/core/built/admin/assets/{square-Cj_bJ0HZ.js → square-CWrI0H4v.js} +1 -1
  124. package/core/built/admin/assets/stats/{audience-BiHYBUzT.mjs → audience-DBW5Xu1c.mjs} +3 -3
  125. package/core/built/admin/assets/stats/{content-helpers-CIXZiyCm.mjs → content-helpers-BR6DcWwH.mjs} +4 -4
  126. package/core/built/admin/assets/stats/{index-DBB8Oih1.mjs → index-BuS4r1cs.mjs} +5 -5
  127. package/core/built/admin/assets/stats/{index-CkKk-p14.mjs → index-CFvGHbAV.mjs} +8 -8
  128. package/core/built/admin/assets/stats/{index-9zQR4gr0.mjs → index-DKS4mzS-.mjs} +3621 -3512
  129. package/core/built/admin/assets/stats/{index-DMSmQLxG.mjs → index-TeAxlGlY.mjs} +5 -5
  130. package/core/built/admin/assets/stats/{index-DErXBfDM.mjs → index-ZjicrvMA.mjs} +5 -5
  131. package/core/built/admin/assets/stats/{sort-button-BqY7GFaO.mjs → sort-button-DbwzvVKL.mjs} +3 -3
  132. package/core/built/admin/assets/stats/{stats-BeJgKX2G.mjs → stats-BatzfgdA.mjs} +4 -4
  133. package/core/built/admin/assets/stats/stats.js +1 -1
  134. package/core/built/admin/assets/stats/{tabs-CPz357mW.mjs → tabs-B32ptD5t.mjs} +3 -3
  135. package/core/built/admin/assets/stats/{use-growth-stats-WMYXBQE3.mjs → use-growth-stats-DmTT2gKd.mjs} +3 -3
  136. package/core/built/admin/assets/{stats-DWpHtRym.js → stats-G4Ge9ETb.js} +1 -1
  137. package/core/built/admin/assets/stats-view-Bx3oDAIW.js +1 -0
  138. package/core/built/admin/assets/{step-1-Bjya9Gt0.js → step-1-y3anLU0g.js} +1 -1
  139. package/core/built/admin/assets/{step-2-CJ6I8JNc.js → step-2-Dr1lGnHU.js} +1 -1
  140. package/core/built/admin/assets/{step-3-3fs6Y2Kj.js → step-3-C_d2hvMs.js} +2 -2
  141. package/core/built/admin/assets/{table-B4zlzEDP.js → table-CbN_vbUx.js} +1 -1
  142. package/core/built/admin/assets/{tabs-mR5oJGm5.js → tabs-DFJzY5np.js} +1 -1
  143. package/core/built/admin/assets/tags-D5g9tXZU.js +1 -0
  144. package/core/built/admin/assets/{tags-CsgMtkFL.js → tags-Ddg8oG2Y.js} +1 -1
  145. package/core/built/admin/assets/{textarea-CQjEvapR.js → textarea-DikWsYMt.js} +1 -1
  146. package/core/built/admin/assets/{tiers-CQE0v797.js → tiers-B7qV_8mO.js} +1 -1
  147. package/core/built/admin/assets/{toggle-group-CR-Z-bJL.js → toggle-group-tXaaTD7P.js} +1 -1
  148. package/core/built/admin/assets/{topic-filter-_NyD55eH.js → topic-filter-bQtscKE6.js} +1 -1
  149. package/core/built/admin/assets/{trash-BFSLkv0z.js → trash--VS50LgS.js} +1 -1
  150. package/core/built/admin/assets/{upload-BTxT4v2z.js → upload-Dz-DI9rQ.js} +1 -1
  151. package/core/built/admin/assets/{use-growth-stats-BGymNu5O.js → use-growth-stats-DNVioFUq.js} +1 -1
  152. package/core/built/admin/assets/use-scroll-restoration-CxWEiCuS.js +1 -0
  153. package/core/built/admin/assets/{use-simple-pagination-Cq7Afp_c.js → use-simple-pagination-BA6xsVQO.js} +1 -1
  154. package/core/built/admin/assets/{user-plus-DMl69yKl.js → user-plus-B0tpOnLM.js} +1 -1
  155. package/core/built/admin/assets/{user-round-check-CVuZXUPz.js → user-round-check-caJYm0bB.js} +1 -1
  156. package/core/built/admin/assets/virtual-list-window-JdKgHS9L.js +4 -0
  157. package/core/built/admin/assets/{wallet-cards-zHR_y6Sp.js → wallet-cards-DBM65lA_.js} +1 -1
  158. package/core/built/admin/assets/{web-CmFHgeQw.js → web-CSXixG1S.js} +1 -1
  159. package/core/built/admin/index.html +7 -7
  160. package/core/frontend/helpers/ghost_head.js +1 -4
  161. package/core/server/data/migrations/versions/6.25/2026-03-26-15-47-00-insert-default-email-design-settings-row.js +42 -0
  162. package/core/server/data/migrations/versions/6.25/2026-03-30-20-22-25-add-email-design-setting-permissions.js +44 -0
  163. package/core/server/data/migrations/versions/6.25/2026-03-30-22-16-43-add-email-design-setting-id-to-automated-emails.js +8 -0
  164. package/core/server/data/migrations/versions/6.25/2026-03-31-13-12-10-backfill-automated-emails-email-design-setting-id.js +45 -0
  165. package/core/server/data/migrations/versions/6.25/2026-03-31-20-31-19-drop-nullable-on-automated-emails-email-design-setting-id.js +3 -0
  166. package/core/server/data/schema/fixtures/fixtures.json +35 -0
  167. package/core/server/data/schema/schema.js +1 -0
  168. package/core/server/data/seeders/importers/comment-reports-importer.js +1 -3
  169. package/core/server/data/seeders/importers/comments-importer.js +3 -2
  170. package/core/server/data/seeders/importers/email-batches-importer.js +3 -3
  171. package/core/server/data/seeders/importers/email-recipients-importer.js +6 -6
  172. package/core/server/data/seeders/importers/emails-importer.js +4 -3
  173. package/core/server/data/seeders/importers/members-click-events-importer.js +1 -1
  174. package/core/server/data/seeders/importers/members-created-events-importer.js +2 -1
  175. package/core/server/data/seeders/importers/members-feedback-importer.js +3 -4
  176. package/core/server/data/seeders/importers/members-login-events-importer.js +3 -2
  177. package/core/server/data/seeders/importers/members-status-events-importer.js +1 -2
  178. package/core/server/data/seeders/importers/members-stripe-customers-importer.js +2 -1
  179. package/core/server/data/seeders/importers/members-stripe-customers-subscriptions-importer.js +4 -2
  180. package/core/server/data/seeders/importers/members-subscribe-events-importer.js +1 -2
  181. package/core/server/data/seeders/importers/members-subscription-created-events-importer.js +3 -1
  182. package/core/server/data/seeders/importers/offer-redemptions-importer.js +3 -3
  183. package/core/server/data/seeders/utils/database-date.js +26 -1
  184. package/core/server/models/automated-email.js +27 -0
  185. package/core/server/models/email-design-setting.js +27 -0
  186. package/core/server/services/stripe/service.js +1 -2
  187. package/core/server/services/webhooks/webhook-trigger.js +1 -1
  188. package/package.json +10 -28
  189. package/tsconfig.tsbuildinfo +1 -1
  190. package/yarn.lock +423 -107
  191. package/components/tryghost-parse-email-address-6.24.0.tgz +0 -0
  192. package/core/built/admin/assets/comments-CteqV7ZN.js +0 -1
  193. package/core/built/admin/assets/filters-DXXaCya7.js +0 -1
  194. package/core/built/admin/assets/index-QB-va_sk.css +0 -1
  195. package/core/built/admin/assets/index-nBUk6L1X.js +0 -1
  196. package/core/built/admin/assets/members-DcElgZ2t.js +0 -15
  197. package/core/built/admin/assets/posts/comments-Bswx2dzs.mjs +0 -1551
  198. package/core/built/admin/assets/posts/filters-Ds_ZaYIU.mjs +0 -2722
  199. package/core/built/admin/assets/posts/posts-DI5YQFp4.mjs +0 -17
  200. package/core/built/admin/assets/posts/tags-CjwolIiT.mjs +0 -395
  201. package/core/built/admin/assets/posts/use-scroll-restoration-YSR5jwQl.mjs +0 -232
  202. package/core/built/admin/assets/posts-CJHEP4C-.js +0 -1
  203. package/core/built/admin/assets/stats-view-CcyaLPwj.js +0 -1
  204. package/core/built/admin/assets/tags-DEFC6GpD.js +0 -1
  205. package/core/built/admin/assets/use-infinite-virtual-scroll-CNqGwgHd.js +0 -4
  206. package/core/built/admin/assets/use-scroll-restoration-BWtb0NrS.js +0 -1
  207. /package/core/built/admin/assets/{chunk.423.dae9a3bbe7845c3a3cfc.js.LICENSE.txt → chunk.434.de8a15730373eccfeefe.js.LICENSE.txt} +0 -0
@@ -0,0 +1,1473 @@
1
+ import { D as k, j as e, u as y, q as D, b as B, n as N, E as ts, F as L, G as z, H as ye, J as as, T as rs, a as F, N as T, p as H, e as ns, Z, o as Q } from "./index-Bl1ReYmV.mjs";
2
+ import { u as is, F as os, T as K, a as G, b as Y, d as X, c as ls } from "./filters-BD3A2GlB.mjs";
3
+ import { c as cs, u as ds, a as ms, B as us, b as ps, d as hs, M as E, e as xs } from "./use-scroll-restoration-C7A3TpAz.mjs";
4
+ import { u as fs, U as we, d as bs, D as js, a as gs, E as vs, b as Cs, c as $ } from "./dropdown-menu-CvSs_ay2.mjs";
5
+ import { a as Ns, c as ks, F as J, b as _e, D as ee, M as ys, H as Se, R as ws, E as Pe } from "./reply-CX_EQh9X.mjs";
6
+ import { C as _s, F as Ss, c as Ps, a as Is, E as Ie, M as Re } from "./search-BqzdnPQb.mjs";
7
+ import { P as Rs, C as Es, X as Ls, g as se, i as te, j as ae, k as re, l as Ts, m as ne } from "./dialog-Chkt119L.mjs";
8
+ import { H as Ce, u as Ds, a as Ms, L as $s } from "./virtual-list-window-BIGoc0th.mjs";
9
+ import { M as Fs } from "./main-layout-Ct-TA0TH.mjs";
10
+ import { d as zs, P as ie, b as Os, h as Ee, f as Ne, c as Bs, B as C, C as Hs } from "./heading-DV_WQJh4.mjs";
11
+ import { L as M } from "./loading-indicator-Dj1SCL40.mjs";
12
+ import { d as Us, b as Le, c as oe } from "./hooks-DQhsid0U.mjs";
13
+ import { E as As, S as Vs } from "./separator-DFPLsWCc.mjs";
14
+ import { E as Te } from "./empty-indicator-GyeO28CG.mjs";
15
+ import { S as qs, b as Ws, c as Qs, d as Ks } from "./sheet-CkLfUqdH.mjs";
16
+ var U = "Checkbox", [Gs] = zs(U), [Ys, le] = Gs(U);
17
+ function Xs(s) {
18
+ const {
19
+ __scopeCheckbox: t,
20
+ checked: a,
21
+ children: n,
22
+ defaultChecked: r,
23
+ disabled: i,
24
+ form: o,
25
+ name: l,
26
+ onCheckedChange: c,
27
+ required: d,
28
+ value: u = "on",
29
+ // @ts-expect-error
30
+ internal_do_not_use_render: p
31
+ } = s, [h, f] = Os({
32
+ prop: a,
33
+ defaultProp: r ?? !1,
34
+ onChange: c,
35
+ caller: U
36
+ }), [m, b] = y(null), [g, j] = y(null), v = D(!1), P = m ? !!o || !!m.closest("form") : (
37
+ // We set this to true by default so that events bubble to forms without JS (SSR)
38
+ !0
39
+ ), I = {
40
+ checked: h,
41
+ disabled: i,
42
+ setChecked: f,
43
+ control: m,
44
+ setControl: b,
45
+ name: l,
46
+ form: o,
47
+ value: u,
48
+ hasConsumerStoppedPropagationRef: v,
49
+ required: d,
50
+ defaultChecked: S(r) ? !1 : r,
51
+ isFormControl: P,
52
+ bubbleInput: g,
53
+ setBubbleInput: j
54
+ };
55
+ return /* @__PURE__ */ e.jsx(
56
+ Ys,
57
+ {
58
+ scope: t,
59
+ ...I,
60
+ children: Zs(p) ? p(I) : n
61
+ }
62
+ );
63
+ }
64
+ var De = "CheckboxTrigger", Me = k(
65
+ ({ __scopeCheckbox: s, onKeyDown: t, onClick: a, ...n }, r) => {
66
+ const {
67
+ control: i,
68
+ value: o,
69
+ disabled: l,
70
+ checked: c,
71
+ required: d,
72
+ setControl: u,
73
+ setChecked: p,
74
+ hasConsumerStoppedPropagationRef: h,
75
+ isFormControl: f,
76
+ bubbleInput: m
77
+ } = le(De, s), b = Ee(r, u), g = D(c);
78
+ return B(() => {
79
+ const j = i == null ? void 0 : i.form;
80
+ if (j) {
81
+ const v = () => p(g.current);
82
+ return j.addEventListener("reset", v), () => j.removeEventListener("reset", v);
83
+ }
84
+ }, [i, p]), /* @__PURE__ */ e.jsx(
85
+ ie.button,
86
+ {
87
+ type: "button",
88
+ role: "checkbox",
89
+ "aria-checked": S(c) ? "mixed" : c,
90
+ "aria-required": d,
91
+ "data-state": Be(c),
92
+ "data-disabled": l ? "" : void 0,
93
+ disabled: l,
94
+ value: o,
95
+ ...n,
96
+ ref: b,
97
+ onKeyDown: Ne(t, (j) => {
98
+ j.key === "Enter" && j.preventDefault();
99
+ }),
100
+ onClick: Ne(a, (j) => {
101
+ p((v) => S(v) ? !0 : !v), m && f && (h.current = j.isPropagationStopped(), h.current || j.stopPropagation());
102
+ })
103
+ }
104
+ );
105
+ }
106
+ );
107
+ Me.displayName = De;
108
+ var ce = k(
109
+ (s, t) => {
110
+ const {
111
+ __scopeCheckbox: a,
112
+ name: n,
113
+ checked: r,
114
+ defaultChecked: i,
115
+ required: o,
116
+ disabled: l,
117
+ value: c,
118
+ onCheckedChange: d,
119
+ form: u,
120
+ ...p
121
+ } = s;
122
+ return /* @__PURE__ */ e.jsx(
123
+ Xs,
124
+ {
125
+ __scopeCheckbox: a,
126
+ checked: r,
127
+ defaultChecked: i,
128
+ disabled: l,
129
+ required: o,
130
+ onCheckedChange: d,
131
+ name: n,
132
+ form: u,
133
+ value: c,
134
+ internal_do_not_use_render: ({ isFormControl: h }) => /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
135
+ /* @__PURE__ */ e.jsx(
136
+ Me,
137
+ {
138
+ ...p,
139
+ ref: t,
140
+ __scopeCheckbox: a
141
+ }
142
+ ),
143
+ h && /* @__PURE__ */ e.jsx(
144
+ Oe,
145
+ {
146
+ __scopeCheckbox: a
147
+ }
148
+ )
149
+ ] })
150
+ }
151
+ );
152
+ }
153
+ );
154
+ ce.displayName = U;
155
+ var $e = "CheckboxIndicator", Fe = k(
156
+ (s, t) => {
157
+ const { __scopeCheckbox: a, forceMount: n, ...r } = s, i = le($e, a);
158
+ return /* @__PURE__ */ e.jsx(
159
+ Rs,
160
+ {
161
+ present: n || S(i.checked) || i.checked === !0,
162
+ children: /* @__PURE__ */ e.jsx(
163
+ ie.span,
164
+ {
165
+ "data-state": Be(i.checked),
166
+ "data-disabled": i.disabled ? "" : void 0,
167
+ ...r,
168
+ ref: t,
169
+ style: { pointerEvents: "none", ...s.style }
170
+ }
171
+ )
172
+ }
173
+ );
174
+ }
175
+ );
176
+ Fe.displayName = $e;
177
+ var ze = "CheckboxBubbleInput", Oe = k(
178
+ ({ __scopeCheckbox: s, ...t }, a) => {
179
+ const {
180
+ control: n,
181
+ hasConsumerStoppedPropagationRef: r,
182
+ checked: i,
183
+ defaultChecked: o,
184
+ required: l,
185
+ disabled: c,
186
+ name: d,
187
+ value: u,
188
+ form: p,
189
+ bubbleInput: h,
190
+ setBubbleInput: f
191
+ } = le(ze, s), m = Ee(a, f), b = is(i), g = fs(n);
192
+ B(() => {
193
+ const v = h;
194
+ if (!v) return;
195
+ const P = window.HTMLInputElement.prototype, R = Object.getOwnPropertyDescriptor(
196
+ P,
197
+ "checked"
198
+ ).set, V = !r.current;
199
+ if (b !== i && R) {
200
+ const q = new Event("click", { bubbles: V });
201
+ v.indeterminate = S(i), R.call(v, S(i) ? !1 : i), v.dispatchEvent(q);
202
+ }
203
+ }, [h, b, i, r]);
204
+ const j = D(S(i) ? !1 : i);
205
+ return /* @__PURE__ */ e.jsx(
206
+ ie.input,
207
+ {
208
+ type: "checkbox",
209
+ "aria-hidden": !0,
210
+ defaultChecked: o ?? j.current,
211
+ required: l,
212
+ disabled: c,
213
+ name: d,
214
+ value: u,
215
+ form: p,
216
+ ...t,
217
+ tabIndex: -1,
218
+ ref: m,
219
+ style: {
220
+ ...t.style,
221
+ ...g,
222
+ position: "absolute",
223
+ pointerEvents: "none",
224
+ opacity: 0,
225
+ margin: 0,
226
+ // We transform because the input is absolutely positioned but we have
227
+ // rendered it **after** the button. This pulls it back to sit on top
228
+ // of the button.
229
+ transform: "translateX(-100%)"
230
+ }
231
+ }
232
+ );
233
+ }
234
+ );
235
+ Oe.displayName = ze;
236
+ function Zs(s) {
237
+ return typeof s == "function";
238
+ }
239
+ function S(s) {
240
+ return s === "indeterminate";
241
+ }
242
+ function Be(s) {
243
+ return S(s) ? "indeterminate" : s ? "checked" : "unchecked";
244
+ }
245
+ const He = k(({ className: s, ...t }, a) => /* @__PURE__ */ e.jsx(
246
+ ce,
247
+ {
248
+ ref: a,
249
+ className: N(
250
+ "grid place-content-center peer h-4 w-4 shrink-0 rounded-xs border border-primary shadow focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
251
+ s
252
+ ),
253
+ ...t,
254
+ children: /* @__PURE__ */ e.jsx(
255
+ Fe,
256
+ {
257
+ className: N("grid place-content-center text-current"),
258
+ children: /* @__PURE__ */ e.jsx(Es, { className: "size-4" })
259
+ }
260
+ )
261
+ }
262
+ ));
263
+ He.displayName = ce.displayName;
264
+ var Js = Symbol.for("react.lazy"), O = ts[" use ".trim().toString()];
265
+ function et(s) {
266
+ return typeof s == "object" && s !== null && "then" in s;
267
+ }
268
+ function Ue(s) {
269
+ return s != null && typeof s == "object" && "$$typeof" in s && s.$$typeof === Js && "_payload" in s && et(s._payload);
270
+ }
271
+ // @__NO_SIDE_EFFECTS__
272
+ function st(s) {
273
+ const t = /* @__PURE__ */ tt(s), a = k((n, r) => {
274
+ let { children: i, ...o } = n;
275
+ Ue(i) && typeof O == "function" && (i = O(i._payload));
276
+ const l = L.toArray(i), c = l.find(rt);
277
+ if (c) {
278
+ const d = c.props.children, u = l.map((p) => p === c ? L.count(d) > 1 ? L.only(null) : z(d) ? d.props.children : null : p);
279
+ return /* @__PURE__ */ e.jsx(t, { ...o, ref: r, children: z(d) ? ye(d, void 0, u) : null });
280
+ }
281
+ return /* @__PURE__ */ e.jsx(t, { ...o, ref: r, children: i });
282
+ });
283
+ return a.displayName = `${s}.Slot`, a;
284
+ }
285
+ // @__NO_SIDE_EFFECTS__
286
+ function tt(s) {
287
+ const t = k((a, n) => {
288
+ let { children: r, ...i } = a;
289
+ if (Ue(r) && typeof O == "function" && (r = O(r._payload)), z(r)) {
290
+ const o = it(r), l = nt(i, r.props);
291
+ return r.type !== as && (l.ref = n ? Bs(n, o) : o), ye(r, l);
292
+ }
293
+ return L.count(r) > 1 ? L.only(null) : null;
294
+ });
295
+ return t.displayName = `${s}.SlotClone`, t;
296
+ }
297
+ var at = Symbol("radix.slottable");
298
+ function rt(s) {
299
+ return z(s) && typeof s.type == "function" && "__radixId" in s.type && s.type.__radixId === at;
300
+ }
301
+ function nt(s, t) {
302
+ const a = { ...t };
303
+ for (const n in t) {
304
+ const r = s[n], i = t[n];
305
+ /^on[A-Z]/.test(n) ? r && i ? a[n] = (...l) => {
306
+ const c = i(...l);
307
+ return r(...l), c;
308
+ } : r && (a[n] = r) : n === "style" ? a[n] = { ...r, ...i } : n === "className" && (a[n] = [r, i].filter(Boolean).join(" "));
309
+ }
310
+ return { ...s, ...a };
311
+ }
312
+ function it(s) {
313
+ var n, r;
314
+ let t = (n = Object.getOwnPropertyDescriptor(s.props, "ref")) == null ? void 0 : n.get, a = t && "isReactWarning" in t && t.isReactWarning;
315
+ return a ? s.ref : (t = (r = Object.getOwnPropertyDescriptor(s, "ref")) == null ? void 0 : r.get, a = t && "isReactWarning" in t && t.isReactWarning, a ? s.props.ref : s.props.ref || s.ref);
316
+ }
317
+ var ot = [
318
+ "a",
319
+ "button",
320
+ "div",
321
+ "form",
322
+ "h2",
323
+ "h3",
324
+ "img",
325
+ "input",
326
+ "label",
327
+ "li",
328
+ "nav",
329
+ "ol",
330
+ "p",
331
+ "select",
332
+ "span",
333
+ "svg",
334
+ "ul"
335
+ ], lt = ot.reduce((s, t) => {
336
+ const a = /* @__PURE__ */ st(`Primitive.${t}`), n = k((r, i) => {
337
+ const { asChild: o, ...l } = r, c = o ? a : t;
338
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ e.jsx(c, { ...l, ref: i });
339
+ });
340
+ return n.displayName = `Primitive.${t}`, { ...s, [t]: n };
341
+ }, {}), ct = "Label", Ae = k((s, t) => /* @__PURE__ */ e.jsx(
342
+ lt.label,
343
+ {
344
+ ...s,
345
+ ref: t,
346
+ onMouseDown: (a) => {
347
+ var r;
348
+ a.target.closest("button, input, select, textarea") || ((r = s.onMouseDown) == null || r.call(s, a), !a.defaultPrevented && a.detail > 1 && a.preventDefault());
349
+ }
350
+ }
351
+ ));
352
+ Ae.displayName = ct;
353
+ var Ve = Ae;
354
+ const dt = rs(
355
+ "text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
356
+ ), qe = k(({ className: s, ...t }, a) => /* @__PURE__ */ e.jsx(
357
+ Ve,
358
+ {
359
+ ref: a,
360
+ className: N(dt(), s),
361
+ ...t
362
+ }
363
+ ));
364
+ qe.displayName = Ve.displayName;
365
+ const mt = ({ children: s, className: t, ...a }) => /* @__PURE__ */ e.jsx("section", { className: N("flex gap-6 flex-col p-4 lg:p-8 size-full grow", t), ...a, children: s });
366
+ function ut(s) {
367
+ return {
368
+ value: s.id,
369
+ label: s.name || "Unknown name",
370
+ detail: s.email ?? "(Unknown email)"
371
+ };
372
+ }
373
+ const pt = cs({
374
+ id: "posts.members.remote",
375
+ buildBrowseSearchParams: (s) => ({
376
+ limit: "100",
377
+ order: "created_at DESC",
378
+ ...s ? { search: s } : {}
379
+ }),
380
+ selectItems: (s) => s == null ? void 0 : s.members,
381
+ useQuery: ({ enabled: s, searchParams: t }) => ds({
382
+ enabled: s,
383
+ keepPreviousData: !0,
384
+ searchParams: t
385
+ }),
386
+ toOption: ut
387
+ });
388
+ function ht() {
389
+ return pt();
390
+ }
391
+ const xt = ({
392
+ filters: s,
393
+ onFiltersChange: t
394
+ }) => {
395
+ const a = ms(), n = ht(), r = F(
396
+ () => [
397
+ {
398
+ key: "author",
399
+ label: "Author",
400
+ type: "select",
401
+ icon: /* @__PURE__ */ e.jsx(we, { className: "size-4" }),
402
+ searchable: !0,
403
+ valueSource: n,
404
+ className: "w-80",
405
+ popoverContentClassName: "w-80",
406
+ operators: [
407
+ { value: "is", label: "is" },
408
+ { value: "is_not", label: "is not" }
409
+ ]
410
+ },
411
+ {
412
+ key: "post",
413
+ label: "Post",
414
+ type: "select",
415
+ icon: /* @__PURE__ */ e.jsx(Ns, { className: "size-4" }),
416
+ searchable: !0,
417
+ valueSource: a,
418
+ className: "w-full max-w-80",
419
+ popoverContentClassName: "w-full max-w-[calc(100vw-32px)] max-w-80",
420
+ operators: [
421
+ { value: "is", label: "is" },
422
+ { value: "is_not", label: "is not" }
423
+ ]
424
+ },
425
+ {
426
+ key: "body",
427
+ label: "Text",
428
+ type: "text",
429
+ icon: /* @__PURE__ */ e.jsx(ks, { className: "size-4" }),
430
+ placeholder: "Search comment text...",
431
+ operators: [
432
+ { value: "contains", label: "contains" },
433
+ { value: "not_contains", label: "does not contain" }
434
+ ],
435
+ defaultOperator: "contains",
436
+ className: "w-full max-w-48",
437
+ popoverContentClassName: "w-full max-w-48"
438
+ },
439
+ {
440
+ key: "status",
441
+ label: "Status",
442
+ type: "select",
443
+ icon: /* @__PURE__ */ e.jsx(bs, { className: "size-4" }),
444
+ options: [
445
+ { value: "published", label: "Published" },
446
+ { value: "hidden", label: "Hidden" }
447
+ ],
448
+ operators: [
449
+ { value: "is", label: "is" }
450
+ ],
451
+ searchable: !1,
452
+ hideOperatorSelect: !0
453
+ },
454
+ {
455
+ key: "reported",
456
+ label: "Reported",
457
+ type: "select",
458
+ icon: /* @__PURE__ */ e.jsx(J, { className: "size-4" }),
459
+ options: [
460
+ { value: "true", label: "Yes" },
461
+ { value: "false", label: "No" }
462
+ ],
463
+ operators: [
464
+ { value: "is", label: "is" }
465
+ ],
466
+ searchable: !1,
467
+ hideOperatorSelect: !0
468
+ },
469
+ {
470
+ key: "created_at",
471
+ label: "Date",
472
+ type: "date",
473
+ className: "w-full max-w-32",
474
+ icon: /* @__PURE__ */ e.jsx(_s, { className: "size-4" }),
475
+ operators: [
476
+ { value: "is", label: "is" },
477
+ { value: "before", label: "before" },
478
+ { value: "after", label: "after" }
479
+ ]
480
+ }
481
+ ],
482
+ [n, a]
483
+ ), i = s.length > 0, o = N(
484
+ "flex flex-row",
485
+ !i && "[grid-area:actions] pt-5 justify-start sm:justify-end sm:pt-0",
486
+ i && "col-start-1 col-end-4 row-start-3 pt-5"
487
+ );
488
+ return /* @__PURE__ */ e.jsx("div", { className: o, children: /* @__PURE__ */ e.jsx(
489
+ os,
490
+ {
491
+ addButtonIcon: i ? /* @__PURE__ */ e.jsx(Ss, {}) : /* @__PURE__ */ e.jsx(Ps, {}),
492
+ addButtonText: i ? "Add filter" : "Filter",
493
+ allowMultiple: !1,
494
+ className: `[&>button]:order-last ${i ? "[&>button]:border-none" : "w-auto"}`,
495
+ clearButtonClassName: "font-normal text-muted-foreground",
496
+ clearButtonIcon: /* @__PURE__ */ e.jsx(Ls, {}),
497
+ clearButtonText: "Clear",
498
+ fields: r,
499
+ filters: s,
500
+ keyboardShortcut: "f",
501
+ popoverAlign: i ? "start" : "end",
502
+ showClearButton: i,
503
+ showSearchInput: !1,
504
+ onChange: t
505
+ }
506
+ ) });
507
+ }, ft = ({ children: s }) => /* @__PURE__ */ e.jsxs(Ce, { className: "relative pb-6! md:sticky", variant: "inline-nav", children: [
508
+ /* @__PURE__ */ e.jsx(Ce.Title, { children: "Comments" }),
509
+ s
510
+ ] }), bt = ({ children: s }) => /* @__PURE__ */ e.jsx(Fs, { children: /* @__PURE__ */ e.jsx("div", { className: "grid w-full grow", children: /* @__PURE__ */ e.jsx("div", { className: "flex h-full flex-col", "data-testid": "comments-page", children: s }) }) });
511
+ function jt({ onClick: s, expanded: t }) {
512
+ return /* @__PURE__ */ e.jsxs(
513
+ C,
514
+ {
515
+ className: "shrink-0 gap-0.5 self-start p-0 text-base hover:bg-transparent",
516
+ variant: "ghost",
517
+ onClick: s,
518
+ children: [
519
+ t ? "Show less" : "Show more",
520
+ t ? /* @__PURE__ */ e.jsx(Is, {}) : /* @__PURE__ */ e.jsx(Hs, {})
521
+ ]
522
+ }
523
+ );
524
+ }
525
+ function We({ item: s }) {
526
+ const t = D(null), [a, n] = y(!1), [r, i] = y(!1);
527
+ return B(() => {
528
+ if (r)
529
+ return;
530
+ const o = () => {
531
+ t.current && n(t.current.scrollHeight > t.current.clientHeight);
532
+ };
533
+ return o(), window.addEventListener("resize", o), () => window.removeEventListener("resize", o);
534
+ }, [s.html, r]), /* @__PURE__ */ e.jsx("div", { className: "mt-1 flex flex-col gap-2", children: /* @__PURE__ */ e.jsxs("div", { className: `flex max-w-full flex-col items-start ${s.status === "hidden" && "opacity-50"}`, children: [
535
+ /* @__PURE__ */ e.jsx(
536
+ "div",
537
+ {
538
+ dangerouslySetInnerHTML: { __html: s.html || "" },
539
+ ref: t,
540
+ className: N(
541
+ "prose flex-1 text-base max-w-[80ch] balance leading-[1.5em] [&_*]:leading-[1.5em] [&_*]:text-base [&_*]:font-normal [&_blockquote]:border-l-[3px] [&_blockquote]:border-foreground [&_blockquote]:p-0 [&_blockquote]:pl-3 [&_blockquote_p]:mt-0 [&_a]:underline",
542
+ r ? "-mb-1 [&_p]:mb-[0.85em]" : "line-clamp-2 [&_p]:m-0 [&_blockquote+p]:mt-1 mb-1"
543
+ )
544
+ }
545
+ ),
546
+ a && /* @__PURE__ */ e.jsx(jt, { expanded: r, onClick: () => i(!r) })
547
+ ] }) });
548
+ }
549
+ const A = "CommentsResponseType", gt = Us({
550
+ dataType: A,
551
+ path: "/comments/",
552
+ defaultNextPageParams: (s, t) => {
553
+ var a, n;
554
+ return (a = s.meta) != null && a.pagination.next ? {
555
+ ...t,
556
+ page: (((n = s.meta) == null ? void 0 : n.pagination.next) || 1).toString()
557
+ } : void 0;
558
+ },
559
+ returnData: (s) => {
560
+ const { pages: t } = s, a = t.flatMap((r) => r.comments), n = t[t.length - 1].meta;
561
+ return {
562
+ comments: a,
563
+ meta: n,
564
+ isEnd: n ? n.pagination.pages === n.pagination.page : !0
565
+ };
566
+ }
567
+ }), Qe = (s) => gt({
568
+ ...s,
569
+ searchParams: {
570
+ limit: "100",
571
+ order: "created_at desc",
572
+ include: "member,post,parent",
573
+ ...s == null ? void 0 : s.searchParams
574
+ }
575
+ }), Ke = Le({
576
+ method: "PUT",
577
+ path: ({ id: s }) => `/comments/${s}/`,
578
+ body: ({ id: s }) => ({
579
+ comments: [{
580
+ id: s,
581
+ status: "hidden"
582
+ }]
583
+ }),
584
+ invalidateQueries: {
585
+ dataType: A
586
+ }
587
+ }), Ge = Le({
588
+ method: "PUT",
589
+ path: ({ id: s }) => `/comments/${s}/`,
590
+ body: ({ id: s }) => ({
591
+ comments: [{
592
+ id: s,
593
+ status: "published"
594
+ }]
595
+ }),
596
+ invalidateQueries: {
597
+ dataType: A
598
+ }
599
+ }), vt = oe({
600
+ dataType: A,
601
+ path: (s) => `/comments/${s}/`,
602
+ defaultSearchParams: {
603
+ include: "member,post,count.replies,count.direct_replies,count.likes,count.reports,parent,in_reply_to"
604
+ }
605
+ }), Ct = oe({
606
+ dataType: "CommentReportsResponseType",
607
+ path: (s) => `/comments/${s}/reports/`
608
+ }), Nt = (s, t) => Ct(s, { ...t }), kt = oe({
609
+ dataType: "CommentLikesResponseType",
610
+ path: (s) => `/comments/${s}/likes/`,
611
+ defaultSearchParams: {
612
+ include: "member",
613
+ limit: "100",
614
+ order: "created_at desc"
615
+ }
616
+ }), yt = (s, t) => kt(s, { ...t }), wt = (s, t) => Qe({
617
+ ...t,
618
+ searchParams: {
619
+ filter: `(parent_id:${s}+in_reply_to_id:null),in_reply_to_id:${s}`,
620
+ order: "created_at asc",
621
+ include: "member,post,count.direct_replies,count.likes,count.reports,parent,in_reply_to",
622
+ limit: "100"
623
+ }
624
+ });
625
+ function _t(s) {
626
+ const t = new Date(s);
627
+ return new Intl.DateTimeFormat("en-US", {
628
+ month: "short",
629
+ day: "numeric",
630
+ year: "numeric",
631
+ hour: "numeric",
632
+ minute: "numeric"
633
+ }).format(t).replace(/(\d+),(\s+\d{4})/, "$1$2");
634
+ }
635
+ function Ye({
636
+ memberName: s,
637
+ memberId: t,
638
+ createdAt: a,
639
+ isHidden: n,
640
+ canComment: r,
641
+ onAuthorClick: i,
642
+ postTitle: o,
643
+ onPostClick: l,
644
+ className: c
645
+ }) {
646
+ return /* @__PURE__ */ e.jsxs("div", { className: N("flex items-baseline gap-4", c), children: [
647
+ /* @__PURE__ */ e.jsxs("div", { className: N(
648
+ "mb-1 flex min-w-0 items-center gap-x-1 text-sm",
649
+ n && "opacity-50"
650
+ ), children: [
651
+ /* @__PURE__ */ e.jsx("div", { className: "whitespace-nowrap", children: t && i ? /* @__PURE__ */ e.jsx(
652
+ C,
653
+ {
654
+ className: "flex h-auto items-center gap-1.5 truncate p-0 font-semibold text-primary hover:opacity-70",
655
+ variant: "link",
656
+ onClick: i,
657
+ children: s || "Unknown"
658
+ }
659
+ ) : /* @__PURE__ */ e.jsx("span", { className: "block truncate font-semibold", children: s || "Unknown" }) }),
660
+ r === !1 && /* @__PURE__ */ e.jsx(K, { children: /* @__PURE__ */ e.jsxs(G, { children: [
661
+ /* @__PURE__ */ e.jsx(Y, { asChild: !0, children: /* @__PURE__ */ e.jsx("span", { "data-testid": "commenting-disabled-indicator", children: /* @__PURE__ */ e.jsx(
662
+ _e,
663
+ {
664
+ className: "size-3.5 text-muted-foreground"
665
+ }
666
+ ) }) }),
667
+ /* @__PURE__ */ e.jsx(X, { children: "Comments disabled" })
668
+ ] }) }),
669
+ /* @__PURE__ */ e.jsx(ee, { className: "shrink-0 text-muted-foreground/50", size: 16 }),
670
+ /* @__PURE__ */ e.jsx("div", { className: "shrink-0 whitespace-nowrap", children: a && /* @__PURE__ */ e.jsx(K, { children: /* @__PURE__ */ e.jsxs(G, { children: [
671
+ /* @__PURE__ */ e.jsx(Y, { asChild: !0, children: /* @__PURE__ */ e.jsx("span", { className: "cursor-default text-sm text-muted-foreground", children: T(a) }) }),
672
+ /* @__PURE__ */ e.jsx(X, { children: _t(a) })
673
+ ] }) }) }),
674
+ o && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
675
+ /* @__PURE__ */ e.jsx("div", { className: "shrink-0 text-muted-foreground", children: "on" }),
676
+ /* @__PURE__ */ e.jsx("div", { className: "min-w-0 truncate", children: l ? /* @__PURE__ */ e.jsx(
677
+ C,
678
+ {
679
+ className: "block h-auto w-full cursor-pointer truncate p-0 text-left font-medium text-gray-800 hover:opacity-70 dark:text-gray-400",
680
+ variant: "link",
681
+ onClick: l,
682
+ children: o
683
+ }
684
+ ) : /* @__PURE__ */ e.jsx("span", { className: "font-medium text-gray-800 dark:text-gray-400", children: o }) })
685
+ ] })
686
+ ] }),
687
+ n && /* @__PURE__ */ e.jsx(us, { variant: "secondary", children: "Hidden" })
688
+ ] });
689
+ }
690
+ function St({
691
+ open: s,
692
+ memberName: t,
693
+ onOpenChange: a,
694
+ onConfirm: n
695
+ }) {
696
+ const [r, i] = y(!1), o = (c) => {
697
+ c || i(!1), a(c);
698
+ }, l = () => {
699
+ n(r), i(!1);
700
+ };
701
+ return /* @__PURE__ */ e.jsx(se, { open: s, onOpenChange: o, children: /* @__PURE__ */ e.jsxs(te, { className: "gap-5", children: [
702
+ /* @__PURE__ */ e.jsxs(ae, { children: [
703
+ /* @__PURE__ */ e.jsx(re, { children: "Disable comments" }),
704
+ /* @__PURE__ */ e.jsxs(Ts, { children: [
705
+ t || "This member",
706
+ " won't be able to comment in the future. You can re-enable commenting anytime."
707
+ ] })
708
+ ] }),
709
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
710
+ /* @__PURE__ */ e.jsx(
711
+ He,
712
+ {
713
+ checked: r,
714
+ id: "hide-comments",
715
+ onCheckedChange: (c) => i(c === !0)
716
+ }
717
+ ),
718
+ /* @__PURE__ */ e.jsx(qe, { htmlFor: "hide-comments", children: "Hide all previous comments" })
719
+ ] }),
720
+ /* @__PURE__ */ e.jsxs(ne, { children: [
721
+ /* @__PURE__ */ e.jsx(C, { variant: "outline", onClick: () => o(!1), children: "Cancel" }),
722
+ /* @__PURE__ */ e.jsx(C, { onClick: l, children: "Disable comments" })
723
+ ] })
724
+ ] }) });
725
+ }
726
+ function Xe({
727
+ comment: s
728
+ }) {
729
+ const { mutate: t } = ps(), { mutate: a } = hs(), [n, r] = y(!1), { id: i, post: o, member: l } = s, c = o == null ? void 0 : o.url, d = l == null ? void 0 : l.id, u = l == null ? void 0 : l.can_comment, p = (f) => {
730
+ d && (t({
731
+ id: d,
732
+ reason: `Disabled from comment ${i}`,
733
+ hideComments: f
734
+ }), r(!1));
735
+ }, h = () => {
736
+ d && a({ id: d });
737
+ };
738
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
739
+ /* @__PURE__ */ e.jsxs(js, { children: [
740
+ /* @__PURE__ */ e.jsx(gs, { asChild: !0, children: /* @__PURE__ */ e.jsx(
741
+ C,
742
+ {
743
+ className: "relative z-10 text-gray-800 hover:bg-secondary [&_svg]:size-4",
744
+ size: "sm",
745
+ variant: "ghost",
746
+ children: /* @__PURE__ */ e.jsx(vs, {})
747
+ }
748
+ ) }),
749
+ /* @__PURE__ */ e.jsxs(Cs, { align: "start", children: [
750
+ c && /* @__PURE__ */ e.jsx($, { asChild: !0, children: /* @__PURE__ */ e.jsxs("a", { href: `${c}#ghost-comments-${i}`, rel: "noopener noreferrer", target: "_blank", children: [
751
+ /* @__PURE__ */ e.jsx(As, { className: "size-4" }),
752
+ "View on post"
753
+ ] }) }),
754
+ d && /* @__PURE__ */ e.jsx($, { asChild: !0, children: /* @__PURE__ */ e.jsxs("a", { href: `#/members/${d}`, children: [
755
+ /* @__PURE__ */ e.jsx(we, { className: "size-4" }),
756
+ "View member"
757
+ ] }) }),
758
+ d && (u !== !1 ? /* @__PURE__ */ e.jsxs($, { onClick: () => r(!0), children: [
759
+ /* @__PURE__ */ e.jsx(_e, { className: "size-4" }),
760
+ "Disable commenting"
761
+ ] }) : /* @__PURE__ */ e.jsxs($, { onClick: h, children: [
762
+ /* @__PURE__ */ e.jsx(ys, { className: "size-4" }),
763
+ "Enable commenting"
764
+ ] }))
765
+ ] })
766
+ ] }),
767
+ /* @__PURE__ */ e.jsx(
768
+ St,
769
+ {
770
+ memberName: l == null ? void 0 : l.name,
771
+ open: n,
772
+ onConfirm: p,
773
+ onOpenChange: r
774
+ }
775
+ )
776
+ ] });
777
+ }
778
+ function Pt({ comment: s, open: t, onOpenChange: a }) {
779
+ var c, d, u, p, h;
780
+ const { data: n, isLoading: r } = yt(s.id, { enabled: t }), i = (n == null ? void 0 : n.comment_likes) ?? [], o = ((c = s.count) == null ? void 0 : c.likes) ?? 0, l = o - i.length;
781
+ return /* @__PURE__ */ e.jsx(se, { open: t, onOpenChange: a, children: /* @__PURE__ */ e.jsxs(te, { "aria-describedby": void 0, children: [
782
+ /* @__PURE__ */ e.jsx(ae, { children: /* @__PURE__ */ e.jsxs(re, { children: [
783
+ o,
784
+ " ",
785
+ o === 1 ? "like" : "likes"
786
+ ] }) }),
787
+ /* @__PURE__ */ e.jsx("div", { className: "overflow-hidden rounded-md border p-3", children: /* @__PURE__ */ e.jsxs("div", { className: "flex min-w-0 items-start gap-3", children: [
788
+ /* @__PURE__ */ e.jsx(
789
+ E,
790
+ {
791
+ avatarImage: (d = s.member) == null ? void 0 : d.avatar_image,
792
+ className: "shrink-0",
793
+ memberId: (u = s.member) == null ? void 0 : u.id
794
+ }
795
+ ),
796
+ /* @__PURE__ */ e.jsxs("div", { className: "flex min-w-0 flex-col overflow-hidden", children: [
797
+ /* @__PURE__ */ e.jsxs("div", { className: "flex min-w-0 items-center gap-1 text-sm", children: [
798
+ /* @__PURE__ */ e.jsx("span", { className: "shrink-0 font-semibold", children: ((p = s.member) == null ? void 0 : p.name) || "Unknown" }),
799
+ /* @__PURE__ */ e.jsx(ee, { className: "shrink-0 text-muted-foreground/50", size: 16 }),
800
+ /* @__PURE__ */ e.jsx("span", { className: "shrink-0 text-muted-foreground", children: s.created_at && T(s.created_at) }),
801
+ /* @__PURE__ */ e.jsx("span", { className: "shrink-0 text-muted-foreground", children: "on" }),
802
+ /* @__PURE__ */ e.jsx("span", { className: "min-w-0 truncate font-medium text-gray-800 dark:text-gray-400", children: ((h = s.post) == null ? void 0 : h.title) || "Unknown post" })
803
+ ] }),
804
+ /* @__PURE__ */ e.jsx(
805
+ "div",
806
+ {
807
+ dangerouslySetInnerHTML: { __html: s.html || "" },
808
+ className: "prose mt-2 line-clamp-2 text-sm [&_*]:text-sm [&_*]:leading-[1.5em] [&_p]:m-0"
809
+ }
810
+ )
811
+ ] })
812
+ ] }) }),
813
+ /* @__PURE__ */ e.jsx("div", { className: "-mx-1 max-h-64 overflow-y-auto px-1", children: r ? /* @__PURE__ */ e.jsx("div", { className: "flex justify-center py-4", children: /* @__PURE__ */ e.jsx(M, { size: "md" }) }) : /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-3 pb-1", children: [
814
+ i.map((f) => {
815
+ var m, b, g;
816
+ return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between gap-3", children: [
817
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
818
+ /* @__PURE__ */ e.jsxs("div", { className: "relative shrink-0", children: [
819
+ /* @__PURE__ */ e.jsx(
820
+ E,
821
+ {
822
+ avatarImage: (m = f.member) == null ? void 0 : m.avatar_image,
823
+ memberId: (b = f.member) == null ? void 0 : b.id
824
+ }
825
+ ),
826
+ /* @__PURE__ */ e.jsx("div", { className: "absolute -right-0.5 -bottom-0.5 flex size-4 items-center justify-center rounded-full bg-pink-500 text-white", children: /* @__PURE__ */ e.jsx(Se, { className: "size-2.5", fill: "currentColor" }) })
827
+ ] }),
828
+ /* @__PURE__ */ e.jsx("span", { className: "font-medium", children: ((g = f.member) == null ? void 0 : g.name) || "Deleted member" })
829
+ ] }),
830
+ /* @__PURE__ */ e.jsx("span", { className: "shrink-0 text-sm text-muted-foreground", children: T(f.created_at) })
831
+ ] }, f.id);
832
+ }),
833
+ l > 0 && /* @__PURE__ */ e.jsxs("div", { className: "pt-1 text-center text-sm text-muted-foreground", children: [
834
+ "and ",
835
+ l,
836
+ " more"
837
+ ] })
838
+ ] }) }),
839
+ /* @__PURE__ */ e.jsx(ne, { children: /* @__PURE__ */ e.jsx(C, { onClick: () => a(!1), children: "OK" }) })
840
+ ] }) });
841
+ }
842
+ function It({ comment: s, open: t, onOpenChange: a }) {
843
+ var l, c, d, u, p;
844
+ const { data: n, isLoading: r } = Nt(s.id, { enabled: t }), i = (n == null ? void 0 : n.comment_reports) ?? [], o = ((l = s.count) == null ? void 0 : l.reports) ?? i.length;
845
+ return /* @__PURE__ */ e.jsx(se, { open: t, onOpenChange: a, children: /* @__PURE__ */ e.jsxs(te, { "aria-describedby": void 0, children: [
846
+ /* @__PURE__ */ e.jsx(ae, { children: /* @__PURE__ */ e.jsxs(re, { children: [
847
+ o,
848
+ " ",
849
+ o === 1 ? "report" : "reports"
850
+ ] }) }),
851
+ /* @__PURE__ */ e.jsx("div", { className: "overflow-hidden rounded-md border p-3", children: /* @__PURE__ */ e.jsxs("div", { className: "flex min-w-0 items-start gap-3", children: [
852
+ /* @__PURE__ */ e.jsx(
853
+ E,
854
+ {
855
+ avatarImage: (c = s.member) == null ? void 0 : c.avatar_image,
856
+ className: "shrink-0",
857
+ memberId: (d = s.member) == null ? void 0 : d.id
858
+ }
859
+ ),
860
+ /* @__PURE__ */ e.jsxs("div", { className: "flex min-w-0 flex-col overflow-hidden", children: [
861
+ /* @__PURE__ */ e.jsxs("div", { className: "flex min-w-0 items-center gap-1 text-sm", children: [
862
+ /* @__PURE__ */ e.jsx("span", { className: "shrink-0 font-semibold", children: ((u = s.member) == null ? void 0 : u.name) || "Unknown" }),
863
+ /* @__PURE__ */ e.jsx(ee, { className: "shrink-0 text-muted-foreground/50", size: 16 }),
864
+ /* @__PURE__ */ e.jsx("span", { className: "shrink-0 text-muted-foreground", children: s.created_at && T(s.created_at) }),
865
+ /* @__PURE__ */ e.jsx("span", { className: "shrink-0 text-muted-foreground", children: "on" }),
866
+ /* @__PURE__ */ e.jsx("span", { className: "min-w-0 truncate font-medium text-gray-800 dark:text-gray-400", children: ((p = s.post) == null ? void 0 : p.title) || "Unknown post" })
867
+ ] }),
868
+ /* @__PURE__ */ e.jsx(
869
+ "div",
870
+ {
871
+ dangerouslySetInnerHTML: { __html: s.html || "" },
872
+ className: "prose mt-2 line-clamp-2 text-sm [&_*]:text-sm [&_*]:leading-[1.5em] [&_p]:m-0"
873
+ }
874
+ )
875
+ ] })
876
+ ] }) }),
877
+ /* @__PURE__ */ e.jsx("div", { className: "-mx-1 max-h-64 overflow-y-auto px-1", children: r ? /* @__PURE__ */ e.jsx("div", { className: "flex justify-center py-4", children: /* @__PURE__ */ e.jsx(M, { size: "md" }) }) : /* @__PURE__ */ e.jsx("div", { className: "flex flex-col gap-3 pb-1", children: i.map((h) => {
878
+ var f, m, b;
879
+ return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between gap-3", children: [
880
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
881
+ /* @__PURE__ */ e.jsxs("div", { className: "relative shrink-0", children: [
882
+ /* @__PURE__ */ e.jsx(
883
+ E,
884
+ {
885
+ avatarImage: (f = h.member) == null ? void 0 : f.avatar_image,
886
+ memberId: (m = h.member) == null ? void 0 : m.id
887
+ }
888
+ ),
889
+ /* @__PURE__ */ e.jsx("div", { className: "absolute -right-0.5 -bottom-0.5 flex size-4 items-center justify-center rounded-full bg-red text-white", children: /* @__PURE__ */ e.jsx(J, { className: "size-2.5", fill: "currentColor" }) })
890
+ ] }),
891
+ /* @__PURE__ */ e.jsx("span", { className: "font-medium", children: ((b = h.member) == null ? void 0 : b.name) || "Deleted member" })
892
+ ] }),
893
+ /* @__PURE__ */ e.jsx("span", { className: "shrink-0 text-sm text-muted-foreground", children: T(h.created_at) })
894
+ ] }, h.id);
895
+ }) }) }),
896
+ /* @__PURE__ */ e.jsx(ne, { children: /* @__PURE__ */ e.jsx(C, { onClick: () => a(!1), children: "OK" }) })
897
+ ] }) });
898
+ }
899
+ function W({ icon: s, count: t, label: a, to: n, onClick: r, className: i, testId: o }) {
900
+ const l = N("flex items-center gap-1 text-xs text-gray-800", i), c = /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
901
+ s,
902
+ /* @__PURE__ */ e.jsx("span", { children: ns(t) })
903
+ ] }), d = n || r;
904
+ return /* @__PURE__ */ e.jsx(K, { children: /* @__PURE__ */ e.jsxs(G, { children: [
905
+ /* @__PURE__ */ e.jsx(Y, { asChild: !0, children: n ? /* @__PURE__ */ e.jsx(
906
+ Z,
907
+ {
908
+ className: N(l, "cursor-pointer hover:opacity-70"),
909
+ "data-testid": o,
910
+ to: n,
911
+ onClick: (u) => {
912
+ u.stopPropagation();
913
+ },
914
+ children: c
915
+ }
916
+ ) : r ? /* @__PURE__ */ e.jsx(
917
+ "button",
918
+ {
919
+ className: N(l, "cursor-pointer hover:opacity-70"),
920
+ "data-testid": o,
921
+ type: "button",
922
+ onClick: (u) => {
923
+ u.stopPropagation(), r();
924
+ },
925
+ children: c
926
+ }
927
+ ) : /* @__PURE__ */ e.jsx("div", { className: l, "data-testid": o, children: c }) }),
928
+ /* @__PURE__ */ e.jsx(X, { children: d ? `View ${a.toLowerCase()}` : a })
929
+ ] }) });
930
+ }
931
+ function de(s, t) {
932
+ if (!t)
933
+ return;
934
+ const a = new URLSearchParams(s);
935
+ return a.set("thread", `is:${t}`), `?${a.toString()}`;
936
+ }
937
+ function Ze({
938
+ comment: s,
939
+ className: t
940
+ }) {
941
+ var m, b, g, j, v;
942
+ const [a] = H(), [n, r] = y(!1), [i, o] = y(!1), l = de(a, s.id), c = ((m = s.count) == null ? void 0 : m.direct_replies) ?? ((b = s.count) == null ? void 0 : b.replies) ?? ((g = s.replies) == null ? void 0 : g.length) ?? 0, d = ((j = s.count) == null ? void 0 : j.likes) ?? 0, u = ((v = s.count) == null ? void 0 : v.reports) ?? 0, p = c > 0, h = d > 0, f = u > 0;
943
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
944
+ /* @__PURE__ */ e.jsxs("div", { className: N("flex items-center gap-6", t), children: [
945
+ /* @__PURE__ */ e.jsx(
946
+ W,
947
+ {
948
+ count: c,
949
+ icon: /* @__PURE__ */ e.jsx(ws, { size: 16, strokeWidth: 1.5 }),
950
+ label: "Replies",
951
+ testId: "replies-metric",
952
+ to: p ? l : void 0
953
+ }
954
+ ),
955
+ /* @__PURE__ */ e.jsx(
956
+ W,
957
+ {
958
+ count: d,
959
+ icon: /* @__PURE__ */ e.jsx(Se, { size: 16, strokeWidth: 1.5 }),
960
+ label: "Likes",
961
+ onClick: h ? () => r(!0) : void 0
962
+ }
963
+ ),
964
+ /* @__PURE__ */ e.jsx(
965
+ W,
966
+ {
967
+ className: f ? "font-semibold text-red" : void 0,
968
+ count: u,
969
+ icon: /* @__PURE__ */ e.jsx(J, { size: 16, strokeWidth: 1.5 }),
970
+ label: "Reports",
971
+ onClick: f ? () => o(!0) : void 0
972
+ }
973
+ )
974
+ ] }),
975
+ /* @__PURE__ */ e.jsx(
976
+ Pt,
977
+ {
978
+ comment: s,
979
+ open: n,
980
+ onOpenChange: r
981
+ }
982
+ ),
983
+ /* @__PURE__ */ e.jsx(
984
+ It,
985
+ {
986
+ comment: s,
987
+ open: i,
988
+ onOpenChange: o
989
+ }
990
+ )
991
+ ] });
992
+ }
993
+ function Rt({ hasReplies: s }) {
994
+ return s ? /* @__PURE__ */ e.jsx(
995
+ "div",
996
+ {
997
+ className: "mb-2 h-full w-px grow rounded bg-gradient-to-b from-muted-foreground/20 from-70% to-transparent",
998
+ "data-testid": "replies-line"
999
+ }
1000
+ ) : null;
1001
+ }
1002
+ function Je({ comment: s, isReply: t = !1, isSelectedComment: a = !1, selectedCommentId: n }) {
1003
+ var d, u, p, h, f, m, b, g;
1004
+ const [r] = H(), { mutate: i } = Ke(), { mutate: o } = Ge(), l = (((d = s.replies) == null ? void 0 : d.length) ?? 0) > 0 || (((u = s.count) == null ? void 0 : u.direct_replies) ?? ((p = s.count) == null ? void 0 : p.replies) ?? 0) > 0, c = !l || t ? "mb-7" : "mb-0";
1005
+ return /* @__PURE__ */ e.jsxs("div", { className: `flex w-full flex-row ${c}`, children: [
1006
+ /* @__PURE__ */ e.jsxs("div", { className: "mr-2 flex shrink-0 flex-col items-center justify-start md:mr-3", children: [
1007
+ /* @__PURE__ */ e.jsx(
1008
+ E,
1009
+ {
1010
+ avatarImage: (h = s.member) == null ? void 0 : h.avatar_image,
1011
+ className: "mb-3 shrink-0 md:mb-4",
1012
+ isHidden: s.status === "hidden",
1013
+ memberId: (f = s.member) == null ? void 0 : f.id
1014
+ }
1015
+ ),
1016
+ /* @__PURE__ */ e.jsx(Rt, { hasReplies: l && !t })
1017
+ ] }),
1018
+ /* @__PURE__ */ e.jsx("div", { className: "grow", children: /* @__PURE__ */ e.jsxs(
1019
+ "div",
1020
+ {
1021
+ className: "w-full",
1022
+ "data-testid": `comment-thread-row-${s.id}`,
1023
+ children: [
1024
+ /* @__PURE__ */ e.jsxs("div", { className: "flex min-w-0 flex-col", children: [
1025
+ /* @__PURE__ */ e.jsx(
1026
+ Ye,
1027
+ {
1028
+ canComment: (m = s.member) == null ? void 0 : m.can_comment,
1029
+ createdAt: s.created_at,
1030
+ isHidden: s.status === "hidden",
1031
+ memberId: (b = s.member) == null ? void 0 : b.id,
1032
+ memberName: (g = s.member) == null ? void 0 : g.name
1033
+ }
1034
+ ),
1035
+ s.in_reply_to_snippet && a && /* @__PURE__ */ e.jsxs("div", { className: `mb-1 line-clamp-1 text-sm ${s.status === "hidden" && "opacity-50"}`, children: [
1036
+ /* @__PURE__ */ e.jsx("span", { className: "text-muted-foreground", children: "Replied to:" }),
1037
+ " ",
1038
+ /* @__PURE__ */ e.jsx(
1039
+ Z,
1040
+ {
1041
+ className: "text-sm font-normal text-muted-foreground hover:text-foreground",
1042
+ "data-testid": "replied-to-link",
1043
+ to: de(r, s.in_reply_to_id || s.parent_id) || "",
1044
+ onClick: (j) => {
1045
+ j.stopPropagation();
1046
+ },
1047
+ children: s.in_reply_to_snippet
1048
+ }
1049
+ )
1050
+ ] }),
1051
+ /* @__PURE__ */ e.jsx(We, { item: s }),
1052
+ /* @__PURE__ */ e.jsxs("div", { className: "mt-4 flex flex-row flex-wrap items-center gap-3", children: [
1053
+ s.status === "published" && /* @__PURE__ */ e.jsxs(C, { className: "text-gray-800", size: "sm", variant: "outline", onClick: () => i({ id: s.id }), children: [
1054
+ /* @__PURE__ */ e.jsx(Pe, {}),
1055
+ /* @__PURE__ */ e.jsx("span", { className: "max-md:hidden", children: "Hide" })
1056
+ ] }),
1057
+ s.status === "hidden" && /* @__PURE__ */ e.jsxs(C, { className: "text-gray-800", size: "sm", variant: "outline", onClick: () => o({ id: s.id }), children: [
1058
+ /* @__PURE__ */ e.jsx(Ie, {}),
1059
+ /* @__PURE__ */ e.jsx("span", { className: "max-md:hidden", children: "Show" })
1060
+ ] }),
1061
+ /* @__PURE__ */ e.jsx(
1062
+ Ze,
1063
+ {
1064
+ comment: s
1065
+ }
1066
+ ),
1067
+ /* @__PURE__ */ e.jsx(
1068
+ Xe,
1069
+ {
1070
+ comment: s
1071
+ }
1072
+ )
1073
+ ] })
1074
+ ] }),
1075
+ l && s.replies && /* @__PURE__ */ e.jsx("div", { className: "mt-7 mb-4 -ml-2 pl-2 md:mt-8 md:mb-0 md:-ml-3 md:pl-3", children: s.replies.map((j) => /* @__PURE__ */ e.jsx(
1076
+ Je,
1077
+ {
1078
+ comment: j,
1079
+ isReply: !0,
1080
+ selectedCommentId: n
1081
+ },
1082
+ j.id
1083
+ )) })
1084
+ ]
1085
+ }
1086
+ ) })
1087
+ ] });
1088
+ }
1089
+ const Et = ({
1090
+ selectedComment: s,
1091
+ replies: t,
1092
+ selectedCommentId: a,
1093
+ fetchNextPage: n,
1094
+ hasNextPage: r,
1095
+ isFetchingNextPage: i
1096
+ }) => {
1097
+ const o = { ...s, replies: t };
1098
+ return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col", "data-testid": "comment-thread-list", children: [
1099
+ /* @__PURE__ */ e.jsx(
1100
+ Je,
1101
+ {
1102
+ comment: o,
1103
+ isSelectedComment: !0,
1104
+ selectedCommentId: a
1105
+ }
1106
+ ),
1107
+ r && /* @__PURE__ */ e.jsx("div", { className: "flex justify-center pb-4", children: /* @__PURE__ */ e.jsx(
1108
+ C,
1109
+ {
1110
+ disabled: i,
1111
+ variant: "outline",
1112
+ onClick: () => n(),
1113
+ children: i ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1114
+ /* @__PURE__ */ e.jsx(M, { size: "sm" }),
1115
+ "Loading..."
1116
+ ] }) : "Load more replies"
1117
+ }
1118
+ ) })
1119
+ ] });
1120
+ }, Lt = ({
1121
+ commentId: s,
1122
+ open: t,
1123
+ onOpenChange: a
1124
+ }) => {
1125
+ var g;
1126
+ const {
1127
+ data: n,
1128
+ isLoading: r,
1129
+ isError: i,
1130
+ fetchNextPage: o,
1131
+ hasNextPage: l,
1132
+ isFetchingNextPage: c
1133
+ } = wt(s ?? "", {
1134
+ enabled: t && !!s
1135
+ }), { data: d, isLoading: u, isError: p } = vt(s ?? "", {
1136
+ enabled: t && !!s
1137
+ }), h = r || u, f = p || i && !d, m = (g = d == null ? void 0 : d.comments) == null ? void 0 : g[0], b = (n == null ? void 0 : n.comments) || [];
1138
+ return /* @__PURE__ */ e.jsx(qs, { open: t, onOpenChange: a, children: /* @__PURE__ */ e.jsxs(Ws, { className: "overflow-y-auto px-6 pt-0 sm:max-w-[600px]", children: [
1139
+ /* @__PURE__ */ e.jsx(Qs, { className: "sticky top-0 z-40 -mx-6 bg-background/60 p-6 backdrop-blur", children: /* @__PURE__ */ e.jsx(Ks, { className: "text-md", children: "Thread" }) }),
1140
+ (m == null ? void 0 : m.post) && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1141
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-4", children: [
1142
+ /* @__PURE__ */ e.jsxs("div", { className: "min-w-0 flex-1", children: [
1143
+ /* @__PURE__ */ e.jsx("h3", { className: "line-clamp-1 text-xl font-semibold text-foreground", children: m.post.title }),
1144
+ m.post.excerpt && /* @__PURE__ */ e.jsx("p", { className: "mt-1 line-clamp-2 text-sm text-muted-foreground", children: m.post.excerpt })
1145
+ ] }),
1146
+ m.post.feature_image && /* @__PURE__ */ e.jsx(
1147
+ "img",
1148
+ {
1149
+ alt: m.post.title || "Post feature image",
1150
+ className: "hidden aspect-video h-18 shrink-0 rounded object-cover lg:block",
1151
+ src: m.post.feature_image
1152
+ }
1153
+ )
1154
+ ] }),
1155
+ /* @__PURE__ */ e.jsx(Vs, { className: "-mx-6 my-6 w-auto" })
1156
+ ] }),
1157
+ /* @__PURE__ */ e.jsx("div", { children: h ? /* @__PURE__ */ e.jsx("div", { className: "flex h-full items-center justify-center py-8", children: /* @__PURE__ */ e.jsx(M, { size: "lg" }) }) : f || !m ? /* @__PURE__ */ e.jsx("div", { className: "flex h-full items-center justify-center py-8", children: /* @__PURE__ */ e.jsx(
1158
+ Te,
1159
+ {
1160
+ actions: /* @__PURE__ */ e.jsx(C, { variant: "outline", onClick: () => a(!1), children: "Back to comments" }),
1161
+ description: "This thread may have been deleted or doesn't exist.",
1162
+ title: "Thread not found",
1163
+ children: /* @__PURE__ */ e.jsx(Re, {})
1164
+ }
1165
+ ) }) : /* @__PURE__ */ e.jsx(
1166
+ Et,
1167
+ {
1168
+ fetchNextPage: o,
1169
+ hasNextPage: l,
1170
+ isFetchingNextPage: c,
1171
+ replies: b,
1172
+ selectedComment: m,
1173
+ selectedCommentId: s ?? ""
1174
+ }
1175
+ ) })
1176
+ ] }) });
1177
+ }, ke = ({ height: s }) => /* @__PURE__ */ e.jsx("div", { "aria-hidden": "true", className: "flex", children: /* @__PURE__ */ e.jsx("div", { className: "flex", style: { height: s } }) }), Tt = k(function(t, a) {
1178
+ return /* @__PURE__ */ e.jsx(
1179
+ "div",
1180
+ {
1181
+ ref: a,
1182
+ ...t,
1183
+ "aria-hidden": "true",
1184
+ className: "relative flex flex-col",
1185
+ children: /* @__PURE__ */ e.jsx("div", { className: "relative z-10 h-24 animate-pulse", children: /* @__PURE__ */ e.jsx("div", { className: "h-full rounded-md bg-muted", "data-testid": "loading-placeholder" }) })
1186
+ }
1187
+ );
1188
+ });
1189
+ function Dt({
1190
+ items: s,
1191
+ totalItems: t,
1192
+ hasNextPage: a,
1193
+ isFetchingNextPage: n,
1194
+ fetchNextPage: r,
1195
+ resetKey: i,
1196
+ onAddFilter: o,
1197
+ isLoading: l
1198
+ }) {
1199
+ const c = D(null), { visibleItemCount: d, canLoadMore: u, loadMore: p } = Ds(t, { resetKey: i }), [h, f] = H(), [m, b] = y(!1), [g, j] = y(null), { mutate: v } = Ke(), { mutate: P } = Ge(), I = (w) => {
1200
+ if (b(w), !w) {
1201
+ const _ = new URLSearchParams(h);
1202
+ _.delete("thread"), f(_, { replace: !0 });
1203
+ }
1204
+ };
1205
+ B(() => {
1206
+ const w = h.get("thread");
1207
+ if (w) {
1208
+ const _ = w.match(/^is:(.+)$/);
1209
+ if (_ && _[1]) {
1210
+ const x = _[1];
1211
+ j(x), b(!0);
1212
+ } else
1213
+ b(!1), j(null);
1214
+ } else
1215
+ b(!1), j(null);
1216
+ }, [h]), xs({ parentRef: c, isLoading: l });
1217
+ const { visibleItems: R, spaceBefore: V, spaceAfter: q } = Ms({
1218
+ items: s,
1219
+ totalItems: d,
1220
+ hasNextPage: a,
1221
+ isFetchingNextPage: n,
1222
+ fetchNextPage: r,
1223
+ parentRef: c
1224
+ });
1225
+ return /* @__PURE__ */ e.jsxs("div", { ref: c, className: "overflow-hidden", children: [
1226
+ /* @__PURE__ */ e.jsx(
1227
+ "div",
1228
+ {
1229
+ className: "flex flex-col",
1230
+ "data-testid": "comments-list",
1231
+ children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col", children: [
1232
+ /* @__PURE__ */ e.jsx(ke, { height: V }),
1233
+ R.map(({ key: w, virtualItem: _, item: x, props: me }) => {
1234
+ var ue, pe, he, xe, fe, be, je, ge, ve;
1235
+ return _.index > s.length - 1 ? /* @__PURE__ */ e.jsx(Tt, { ...me }, w) : /* @__PURE__ */ e.jsxs(
1236
+ "div",
1237
+ {
1238
+ ...me,
1239
+ className: "grid w-full grid-cols-1 items-start justify-between gap-4 border-b p-3 hover:bg-muted/50 md:p-5 lg:grid-cols-[minmax(0,1fr)_144px]",
1240
+ "data-testid": "comment-list-row",
1241
+ onClick: () => {
1242
+ m && I(!1);
1243
+ },
1244
+ children: [
1245
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-start gap-3", children: [
1246
+ /* @__PURE__ */ e.jsx(
1247
+ E,
1248
+ {
1249
+ avatarImage: (ue = x.member) == null ? void 0 : ue.avatar_image,
1250
+ isHidden: x.status === "hidden",
1251
+ memberId: (pe = x.member) == null ? void 0 : pe.id
1252
+ }
1253
+ ),
1254
+ /* @__PURE__ */ e.jsxs("div", { className: "flex min-w-0 flex-col", children: [
1255
+ /* @__PURE__ */ e.jsx(
1256
+ Ye,
1257
+ {
1258
+ canComment: (he = x.member) == null ? void 0 : he.can_comment,
1259
+ createdAt: x.created_at,
1260
+ isHidden: x.status === "hidden",
1261
+ memberId: (xe = x.member) == null ? void 0 : xe.id,
1262
+ memberName: (fe = x.member) == null ? void 0 : fe.name,
1263
+ postTitle: (be = x.post) == null ? void 0 : be.title,
1264
+ onAuthorClick: (je = x.member) != null && je.id ? () => o("author", x.member.id) : void 0,
1265
+ onPostClick: (ge = x.post) != null && ge.id ? () => o("post", x.post.id) : void 0
1266
+ }
1267
+ ),
1268
+ x.in_reply_to_snippet && /* @__PURE__ */ e.jsxs("div", { className: `mb-1 line-clamp-1 max-w-3xl text-sm ${x.status === "hidden" && "opacity-50"}`, children: [
1269
+ /* @__PURE__ */ e.jsx("span", { className: "text-muted-foreground", children: "Replied to:" }),
1270
+ " ",
1271
+ /* @__PURE__ */ e.jsx(
1272
+ Z,
1273
+ {
1274
+ className: "text-sm font-normal text-muted-foreground hover:text-foreground",
1275
+ "data-testid": "replied-to-link",
1276
+ to: de(h, x.in_reply_to_id || x.parent_id) || "",
1277
+ onClick: (ss) => {
1278
+ ss.stopPropagation();
1279
+ },
1280
+ children: x.in_reply_to_snippet
1281
+ }
1282
+ )
1283
+ ] }),
1284
+ /* @__PURE__ */ e.jsx(We, { item: x }),
1285
+ /* @__PURE__ */ e.jsxs("div", { className: "mt-4 flex flex-row flex-nowrap items-center gap-3", children: [
1286
+ x.status === "published" && /* @__PURE__ */ e.jsxs(C, { className: "text-foreground", size: "sm", variant: "outline", onClick: () => v({ id: x.id }), children: [
1287
+ /* @__PURE__ */ e.jsx(Pe, {}),
1288
+ "Hide"
1289
+ ] }),
1290
+ x.status === "hidden" && /* @__PURE__ */ e.jsxs(C, { className: "text-foreground", size: "sm", variant: "outline", onClick: () => P({ id: x.id }), children: [
1291
+ /* @__PURE__ */ e.jsx(Ie, {}),
1292
+ "Show"
1293
+ ] }),
1294
+ /* @__PURE__ */ e.jsx(
1295
+ Ze,
1296
+ {
1297
+ className: "ml-2",
1298
+ comment: x
1299
+ }
1300
+ ),
1301
+ /* @__PURE__ */ e.jsx(
1302
+ Xe,
1303
+ {
1304
+ comment: x
1305
+ }
1306
+ )
1307
+ ] })
1308
+ ] })
1309
+ ] }),
1310
+ /* @__PURE__ */ e.jsx("div", { children: (ve = x.post) != null && ve.feature_image ? /* @__PURE__ */ e.jsx(
1311
+ "img",
1312
+ {
1313
+ alt: x.post.title || "Post feature image",
1314
+ className: `hidden aspect-video w-36 rounded object-cover lg:block ${x.status === "hidden" && "opacity-50"}`,
1315
+ src: x.post.feature_image
1316
+ }
1317
+ ) : null })
1318
+ ]
1319
+ },
1320
+ w
1321
+ );
1322
+ }),
1323
+ /* @__PURE__ */ e.jsx(ke, { height: q })
1324
+ ] })
1325
+ }
1326
+ ),
1327
+ u && /* @__PURE__ */ e.jsx($s, { isLoading: n, onClick: p }),
1328
+ /* @__PURE__ */ e.jsx(
1329
+ Lt,
1330
+ {
1331
+ commentId: g,
1332
+ open: m,
1333
+ onOpenChange: I
1334
+ }
1335
+ )
1336
+ ] });
1337
+ }
1338
+ const es = ["id", "status", "created_at", "body", "post", "author", "reported"];
1339
+ function Mt(s) {
1340
+ const t = [];
1341
+ for (const a of s)
1342
+ if (a.values[0])
1343
+ switch (a.field) {
1344
+ case "id":
1345
+ t.push(`id:'${a.values[0]}'`);
1346
+ break;
1347
+ case "status":
1348
+ t.push(`status:${a.values[0]}`);
1349
+ break;
1350
+ case "created_at":
1351
+ if (a.operator === "before" && a.values[0])
1352
+ t.push(`created_at:<'${a.values[0]}'`);
1353
+ else if (a.operator === "after" && a.values[0])
1354
+ t.push(`created_at:>'${a.values[0]}'`);
1355
+ else if (a.operator === "is" && a.values[0]) {
1356
+ const i = String(a.values[0]), o = (/* @__PURE__ */ new Date(i + "T00:00:00")).toISOString(), l = (/* @__PURE__ */ new Date(i + "T23:59:59.999")).toISOString();
1357
+ t.push(`created_at:>='${o}'+created_at:<='${l}'`);
1358
+ }
1359
+ break;
1360
+ case "body":
1361
+ const r = a.values[0].replace(/'/g, "\\'");
1362
+ a.operator === "contains" ? t.push(`html:~'${r}'`) : a.operator === "not_contains" && t.push(`html:-~'${r}'`);
1363
+ break;
1364
+ case "post":
1365
+ a.operator === "is_not" ? t.push(`post_id:-${a.values[0]}`) : t.push(`post_id:${a.values[0]}`);
1366
+ break;
1367
+ case "author":
1368
+ a.operator === "is_not" ? t.push(`member_id:-${a.values[0]}`) : t.push(`member_id:${a.values[0]}`);
1369
+ break;
1370
+ case "reported":
1371
+ a.values[0] === "true" ? t.push("count.reports:>0") : a.values[0] === "false" && t.push("count.reports:0");
1372
+ break;
1373
+ }
1374
+ return t.length ? t.join("+") : void 0;
1375
+ }
1376
+ function $t(s) {
1377
+ if (!s)
1378
+ return null;
1379
+ const t = s.indexOf(":");
1380
+ return t <= 0 ? null : {
1381
+ operator: s.substring(0, t),
1382
+ value: s.substring(t + 1)
1383
+ };
1384
+ }
1385
+ function Ft(s) {
1386
+ const t = [];
1387
+ for (const [a, n] of s.entries()) {
1388
+ if (!es.includes(a) || !n)
1389
+ continue;
1390
+ const r = $t(n);
1391
+ r && t.push({
1392
+ id: a,
1393
+ field: a,
1394
+ operator: r.operator,
1395
+ values: [r.value]
1396
+ });
1397
+ }
1398
+ return t;
1399
+ }
1400
+ function zt(s) {
1401
+ const t = new URLSearchParams();
1402
+ for (const a of s)
1403
+ if (es.includes(a.field) && a.values[0] !== void 0) {
1404
+ const n = `${a.operator}:${String(a.values[0])}`;
1405
+ t.set(a.field, n);
1406
+ }
1407
+ return t;
1408
+ }
1409
+ function Ot() {
1410
+ const [s, t] = H(), a = F(() => Ft(s), [s]), n = Q((l, c = {}) => {
1411
+ const d = typeof l == "function" ? l(a) : l, u = zt(d), p = c.replace ?? !0;
1412
+ t(u, { replace: p });
1413
+ }, [a, t]), r = Q(({ replace: l = !0 } = {}) => {
1414
+ t(new URLSearchParams(), { replace: l });
1415
+ }, [t]), i = F(() => Mt(a), [a]), o = F(() => a.length === 1 && a[0].field === "id", [a]);
1416
+ return { filters: a, nql: i, setFilters: n, clearFilters: r, isSingleIdFilter: o };
1417
+ }
1418
+ const ta = () => {
1419
+ var m, b;
1420
+ const { filters: s, nql: t, setFilters: a, clearFilters: n, isSingleIdFilter: r } = Ot(), i = Q((g, j, v = "is") => {
1421
+ a((P) => [...P.filter((R) => R.field !== g), ls(g, v, [j])], { replace: !1 });
1422
+ }, [a]), {
1423
+ data: o,
1424
+ isError: l,
1425
+ isFetching: c,
1426
+ isFetchingNextPage: d,
1427
+ isRefetching: u,
1428
+ fetchNextPage: p,
1429
+ hasNextPage: h
1430
+ } = Qe({
1431
+ searchParams: t ? { filter: t } : {},
1432
+ keepPreviousData: !0
1433
+ }), f = c && !d && !u;
1434
+ return /* @__PURE__ */ e.jsxs(bt, { children: [
1435
+ /* @__PURE__ */ e.jsx(ft, { children: !r && /* @__PURE__ */ e.jsx(
1436
+ xt,
1437
+ {
1438
+ filters: s,
1439
+ onFiltersChange: a
1440
+ }
1441
+ ) }),
1442
+ /* @__PURE__ */ e.jsx(mt, { children: f ? /* @__PURE__ */ e.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e.jsx(M, { size: "lg" }) }) : l ? /* @__PURE__ */ e.jsxs("div", { className: "mb-16 flex h-full flex-col items-center justify-center", children: [
1443
+ /* @__PURE__ */ e.jsx("h2", { className: "mb-2 text-xl font-medium", children: "Error loading comments" }),
1444
+ /* @__PURE__ */ e.jsx("p", { className: "mb-4 text-muted-foreground", children: "Please reload the page to try again" }),
1445
+ /* @__PURE__ */ e.jsx(C, { onClick: () => window.location.reload(), children: "Reload page" })
1446
+ ] }) : o != null && o.comments.length ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1447
+ /* @__PURE__ */ e.jsx(
1448
+ Dt,
1449
+ {
1450
+ fetchNextPage: p,
1451
+ hasNextPage: h,
1452
+ isFetchingNextPage: d,
1453
+ isLoading: c && !d,
1454
+ items: (o == null ? void 0 : o.comments) ?? [],
1455
+ resetKey: t ?? "",
1456
+ totalItems: ((b = (m = o == null ? void 0 : o.meta) == null ? void 0 : m.pagination) == null ? void 0 : b.total) ?? 0,
1457
+ onAddFilter: i
1458
+ }
1459
+ ),
1460
+ r && /* @__PURE__ */ e.jsx("div", { className: "flex justify-center py-8", children: /* @__PURE__ */ e.jsx(C, { variant: "outline", onClick: () => n({ replace: !1 }), children: "Show all comments" }) })
1461
+ ] }) : /* @__PURE__ */ e.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e.jsx(
1462
+ Te,
1463
+ {
1464
+ title: "No comments yet",
1465
+ children: /* @__PURE__ */ e.jsx(Re, {})
1466
+ }
1467
+ ) }) })
1468
+ ] });
1469
+ };
1470
+ export {
1471
+ ta as default
1472
+ };
1473
+ //# sourceMappingURL=comments-C4rwkXWy.mjs.map